Ejemplo n.º 1
0
DisplayManager::~DisplayManager()
{
	clearDisplayList();

    if( _displayRenderNode )
    {
        _displayRenderNode->removeFromParentAndCleanup(true);
        if(_displayRenderNode->getReferenceCount() > 0)
            CC_SAFE_RELEASE_NULL(_displayRenderNode);
    }

}
Ejemplo n.º 2
0
void CObjectView::setupSurface(COLORREF c, COLORREF bkC, float nH, float nS){  // -1 for off
  col[0] = GetRValue(c) / 256.0;
  col[1] = GetGValue(c) / 256.0;
  col[2] = GetBValue(c) / 256.0;

  bkCol[0] = GetRValue(bkC) / 256.0;
  bkCol[1] = GetGValue(bkC) / 256.0;
  bkCol[2] = GetBValue(bkC) / 256.0;

  hilite = nH;
  shine = nS;

  clearDisplayList();
  InvalidateRect(NULL);
}
Ejemplo n.º 3
0
void CObjectView::setupTexture(const char *file, float scale){
  SELECT_CONTEXT();

  if (file == NULL || textureFile.Compare(file) != 0){
    textureFile = file;
    if (file && file[0] != '\0'){
      loadTexture(file, &tex);
      }
    else if (glIsTexture(tex)){
      glDeleteTextures(1, &tex);
      tex = -1;
      }
    }
  UNSELECT_CONTEXT();

  texScale = scale;
  clearDisplayList();
  InvalidateRect(NULL);
}
Ejemplo n.º 4
0
void DisplayManager::initDisplayList(BoneData *boneData)
{
    clearDisplayList();

    CS_RETURN_IF(!boneData);

	_decoDisplayList.resize(boneData->displayDataList.size());

	/*for(auto& object : boneData->displayDataList)
	{
	DisplayData *displayData = static_cast<DisplayData *>(object);

	DecorativeDisplay *decoDisplay = DecorativeDisplay::create();
	decoDisplay->setDisplayData(displayData);

	DisplayFactory::createDisplay(_bone, decoDisplay);

	_decoDisplayList.push_back(decoDisplay);
	}*/
}
Ejemplo n.º 5
0
void CObjectView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
  clearDisplayList();
  InvalidateRect(NULL);
}
Ejemplo n.º 6
0
/////////////////////////////////////////////////////////////////////////////
// CObjectView interaction
void CObjectView::OnLButtonDown(UINT nFlags, CPoint point) 
{
  if (mode == POINT){
    selID = -1;

    SELECT_CONTEXT();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    //  setup select mode
    GLuint selBuf[1024];
    glSelectBuffer(1024, selBuf);
    glRenderMode(GL_SELECT);
    glInitNames();
    glPushName(~0);

    //  save projection matrix
    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    setupPerspective(true, point.x, point.y);

    glMatrixMode(GL_MODELVIEW);
    setupModelView();

    //  draw scene for selection
    drawObject(true);

    int sI = glRenderMode(GL_RENDER);
    if (sI){
      //  find closest hit

/*      GLint minZ = 1000000;
      for (int l = 0; l < sI; l++){
        GLint z = selBuf[4*l+1];
        if (z < minZ){
          minZ = z;
          selID = selBuf[4*l+3];
          }
        }*/

      selID = selBuf[4*(sI-1)+3];
      TRACE("selID = %d\n", selID);
      clearDisplayList();
      InvalidateRect(NULL);
      }
    else{
      selID = -1;
      TRACE("No Hit\n");
      clearDisplayList();
      InvalidateRect(NULL);
      }

    //  restore matrix
    glMatrixMode(GL_PROJECTION);
    glPopMatrix();
    glMatrixMode(GL_MODELVIEW);
    UNSELECT_CONTEXT();
    }
  else if (mode != ZOOM){
  	//  record starting point and hook mouse
    lastPt = point;
    SetCapture();
    RedrawWindow();
    }
  else{
    scale *= 2.0f;        //  zoom in
    RedrawWindow();
    }

	CView ::OnLButtonDown(nFlags, point);
}