void CBinaryTree::DrawNode(CNode *Root,int X,int Y,int PrevX,int PrevY,int Level) { if(Root!=NULL) { char Data[5]; char BF[2]; setcolor(WHITE); circle(X,Y,7); floodfill(X,Y,WHITE); line(X,Y-7,PrevX,PrevY+7); itoa(Root->GetData(),Data,10); setcolor(RED); settextjustify(CENTER_TEXT,TOP_TEXT); outtextxy(X,Y-3,Data); itoa(GetBalancingFactor(Root->pRight)-GetBalancingFactor(Root->pLeft),BF,10); setcolor(GREEN); settextjustify(RIGHT_TEXT,TOP_TEXT); outtextxy(X-10,Y-2,BF); setcolor(WHITE); DrawNode(Root->pLeft,X-(30+Level),Y+30,X,Y,Level+10); DrawNode(Root->pRight,X+(30-Level),Y+30,X,Y,Level-10); } }
void Renderer::DrawNodes() { for (vector<SceneNode*>::const_iterator i = nodeList.begin(); i != nodeList.end(); ++i) { DrawNode((*i)); } for (vector<SceneNode*>::const_reverse_iterator i = transparentNodeList.rbegin(); i != transparentNodeList.rend(); ++i) { DrawNode((*i)); } }
long CTree::DrawTree( ITreeNode* pNode , POINT ptDraw , int& iSelectRow, int& iExtent , int& iStart ) { if( pNode == NULL || iExtent <= 0 ) return ptDraw.y; POINT ptChildDraw = ptDraw; bool bSelect = false; if( iSelectRow == 0 ) bSelect = true; if( pNode == m_pTreeModel->getRoot() ) { if( m_bRootVisible ) { if( iStart <= 0 ) { DrawNode( pNode , ptChildDraw , bSelect ); ptChildDraw.y += m_iRowHeight; iExtent--; } else { iStart--; } ptChildDraw.x += m_iIntentWidth; iSelectRow--; } } else { if( iStart <= 0 ) { DrawNode( pNode, ptChildDraw , bSelect ); ptChildDraw.y += m_iRowHeight; iExtent--; } else { iStart--; } ptChildDraw.x += m_iIntentWidth; iSelectRow--; } if( !pNode->isLeaf() && pNode->isOpen() ) { for( int i = 0; i < pNode->getChildCount(); ++i ) ptChildDraw.y = DrawTree( pNode->getChildAt( i ), ptChildDraw ,iSelectRow, iExtent ,iStart ); } return ptChildDraw.y; }
void DrawNode(R3Scene *scene, R3Node *node) { // Push transformation onto stack glPushMatrix(); LoadMatrix(&node->transformation); // Load material if (node->material) LoadMaterial(node->material); // Draw shape if (node->shape) DrawShape(node->shape); // Draw children nodes for (int i = 0; i < (int) node->children.size(); i++) DrawNode(scene, node->children[i]); // Restore previous transformation glPopMatrix(); // Show bounding box if (show_bboxes) { GLboolean lighting = glIsEnabled(GL_LIGHTING); glDisable(GL_LIGHTING); node->bbox.Outline(); if (lighting) glEnable(GL_LIGHTING); } }
void GUIComponentManager::UpdateConnection(int index) { GUIComponent *currentCreateGUIComponent = guiComponentFactory.CreateGUIComponent(guiPresentation->GetNewConnection()); StoreGUIComponent(currentCreateGUIComponent, index); SetConnectionPosition(guiComponents.at(index)); DrawNode(guiComponents.at(index)); }
void touchmind::view::node::NodeViewManager::DrawNodes(touchmind::Context *pContext, ID2D1RenderTarget *pRenderTarget, std::shared_ptr<model::node::NodeModel> edittingNode) { CreateSharedDeviceResources(pContext, pRenderTarget); auto root = m_pMapModel->GetRootNodeModel(); // if (root->IsDescendantRepaintRequired()) { SynchronizeWithModel(); //} // Draw all paths root->ApplyVisitor([&](std::shared_ptr<model::node::NodeModel> node) -> touchmind::VISITOR_RESULT { DrawNodePaths(pContext, pRenderTarget, node); return touchmind::VISITOR_RESULT_CONTINUE; }); // Draw all nodes root->ApplyVisitor([&](std::shared_ptr<model::node::NodeModel> node) -> touchmind::VISITOR_RESULT { if (edittingNode != node) { DrawNode(pContext, pRenderTarget, node); } return touchmind::VISITOR_RESULT_CONTINUE; }); // root->ClearDescendantRepaintRequired(); }
void Renderer::fillBuffers() { cellGcmSetSurface(&deferredLight[0]); cellGcmSetDitherEnable(CELL_GCM_FALSE); clear_buffer(); this->SetCurrentShader(*sceneVert, *sceneFrag); cellGcmSetDepthTestEnable(CELL_GCM_TRUE); cellGcmSetCullFaceEnable(CELL_GCM_TRUE); cellGcmSetBlendEnable(CELL_GCM_TRUE); cellGcmSetDepthFunc(CELL_GCM_LESS); cellGcmSetColorMaskMrt(CELL_GCM_COLOR_MASK_MRT1_A | CELL_GCM_COLOR_MASK_MRT1_R | CELL_GCM_COLOR_MASK_MRT1_G | CELL_GCM_COLOR_MASK_MRT1_B); projMatrix = Matrix4::perspective(0.7853982, screen_ratio, 1.0f, 10000.0f); //CHANGED TO THIS!! //projMatrix = Matrix4::orthographic(-0.5,0.5,-0.5,0.5,-1,1); viewMatrix = camera->BuildViewMatrix(); modelMatrix = Matrix4::identity(); currentVert->UpdateShaderMatrices(modelMatrix, viewMatrix, projMatrix); DrawNode(root); cellGcmSetDitherEnable(CELL_GCM_TRUE); cellGcmSetColorMaskMrt(0); //SetTextureSampler(currentFrag->GetParameter("texture"), height->GetMesh()->GetDefaultTexture()); //height->GetMesh()->Draw(*sceneVert, *sceneFrag); }
void SkeinWindow::DrawNodeTree(Skein::Node* node, Skein::Node* transcriptEnd, CDC& dc, CDibSection& bitmap, const CRect& client, const CPoint& parentCentre, const CPoint& siblingCentre, int spacing) { // Draw the node CPoint nodeCentre(siblingCentre.x+node->GetX(),siblingCentre.y); DrawNode(node,dc,bitmap,client,nodeCentre); // Draw a line connecting the node to its parent if (node->GetParent() != NULL) { COLORREF colour = theApp.GetColour( node->GetTemporary() ? InformApp::ColourUnlocked : InformApp::ColourLocked); DrawNodeLine(dc,bitmap,client,parentCentre,nodeCentre,colour, m_skein->InThread(node,transcriptEnd),ShowLabel(node),node->GetTemporary()); } // Draw all the node's children CPoint childSiblingCentre(siblingCentre.x,siblingCentre.y+spacing); for (int i = 0; i < node->GetNumChildren(); i++) { DrawNodeTree(node->GetChild(i),transcriptEnd,dc,bitmap,client, nodeCentre,childSiblingCentre,spacing); } }
void ZHD_Node::Select( zVIEW vDiagram ) { zSHORT nPos; ZHD_Node *pWkNode; if ( m_bSelected ) return; for ( nPos = 0; nPos < m_pHD_Diagram->m_nNodeCnt; nPos++ ) { pWkNode = m_pHD_Diagram->m_NodeList[ nPos ]; if ( pWkNode->m_bSelected ) { pWkNode->m_bSelected = 0; pWkNode->DrawNode( ); vDiagram = m_pHD_Diagram->PositionOnDiagramNode( pWkNode, vDiagram ); SetSelectStateOfEntityForSet( vDiagram, szlHD_Node, 0, 1 ); break; } } vDiagram = m_pHD_Diagram->PositionOnDiagramNode( this, vDiagram ); SetSelectStateOfEntityForSet( vDiagram, szlHD_Node, 1, 1 ); m_bSelected = 1; DrawNode( ); }
void Renderer::DrawNode(SceneNode*n) { if(n->GetMesh()) { //Matrix4 transform = n->GetWorldTransform() * // Matrix4::Scale(n->GetModelScale()); //glUniformMatrix4fv( // glGetUniformLocation(currentShader->GetProgram(), // "modelMatrix"), 1, false, (float*)&transform); //glUniform4fv(glGetUniformLocation(currentShader->GetProgram(), // "nodeColour"),1,(float*)&n->GetColour()); //glUniform1i(glGetUniformLocation(currentShader->GetProgram(), // "useTexture"),(int)n->GetMesh()->GetTexture()); ////n->Draw //n->PreDraw(*this); n->Draw(*this); } for(vector<SceneNode*>::const_iterator i = n->GetChildIteratorStart(); i!= n->GetChildIteratorEnd(); ++i) { if((*i)->GetMesh()) { (*i)->PreDraw(*this); } DrawNode(*i); } }
void Draw::DrawMap(Terrain *t ) { Draw.DrawTerrain(t,start->x*a-a/2,start->y*(s+2*h)-(s+2*h)/2); #define BLUE 0x0000FFAA #define GREEN 0x00FF00AA //int center_x = 300; //int center_y = 200; HexNode * current_lattitude = start; for( int i=0; i<30; i++) { // draw lattitude HexNode * current_longitude = current_lattitude; for( int j=0; j<40; j++) { int offset = a/2; if(i%2) offset = 0; DrawNode(current_longitude, j*18 + offset, i*17); current_longitude = current_longitude->neighbor[EAST]; } if(i%2) current_lattitude = current_lattitude->neighbor[SOUTH_EAST]; else current_lattitude = current_lattitude->neighbor[SOUTH_WEST]; } }
void Model::Draw() { if (m_animationtree) DrawNode(&m_animationtree->rootnode); else for (unsigned i = 0; i < m_meshes.size(); ++i) m_meshes[i].Draw(m_transform); }
void Model::DrawNode(Node * node) { unsigned int i; for (i = 0; i<node->meshes.size(); ++i) m_meshes[node->meshes[i]].Draw(m_transform * node->combined_transform); for (i = 0; i<node->children.size(); ++i) DrawNode(&node->children[i]); }
void Renderer :: RenderScene () { glClear ( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT ); glUseProgram ( currentShader -> GetProgram ()); UpdateShaderMatrices (); glUniform1i ( glGetUniformLocation ( currentShader -> GetProgram (),"diffuseTex"), 1); DrawNode (root); glUseProgram(0); SwapBuffers(); }
void CPicView::OnDraw(CDC* pDC) // View에서 DC를 얻어다 쓰는것 { //CMainProjectDoc* pDoc = GetDocument(); // TODO: add draw code here for(POSITION pos = m_NodeList.GetHeadPosition(); pos != NULL; ) { DrawNode(pDC, (CData *)m_NodeList.GetNext(pos)); } }
void CBinaryTree::ShowTree() { int gdriver = DETECT, gmode, errorcode; initgraph(&gdriver, &gmode, "C:\\TC\\BGI"); DrawNode(pRoot,getmaxx()/2,10,getmaxx()/2,10,0); getch(); closegraph(); }
void Scene::DrawNodes(bool drawTransparentObjects) { for (auto node : m_NodeList) { DrawNode(node.target); } if (drawTransparentObjects) { glFrontFace(GL_CW); for (auto node : m_TransparentNodeList) { DrawNode(node.target); } glFrontFace(GL_CCW); for (auto node : m_TransparentNodeList) { DrawNode(node.target); } } }
void wxTreeLayout::DrawNodes(wxDC& dc) { long id = GetTopNode(); while (id != wxID_ANY) { if (NodeActive(id)) DrawNode(id, dc); id = GetNextNode(id); } }
void Renderer::RenderScene() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer glUseProgram(currentShader->GetProgram()); //Switch on our shader //First off, some familiar code to simply draw our boxes scene graph viewMatrix = camera->BuildViewMatrix(); projMatrix = Matrix4::Perspective(1.0f,15000.0f,(float)width/(float)height,45.0f); UpdateShaderMatrices(); glUniform1i(glGetUniformLocation(currentShader->GetProgram(), "diffuseTex"), 0); //New! and to move... DrawNode(root); //We also set their colours to white - in the following code we set boxes under our mouse //to blue, so they'll be drawn blue in the 'next' frame, and then reset by this code. for(vector<SceneNode*>::const_iterator i = root->GetChildIteratorStart(); i != root->GetChildIteratorEnd(); ++i) { (*i)->SetColour(Vector4(1,1,1,1)); } //If the left mouse button is held down, we're going to do some picking! if(Window::GetMouse()->ButtonHeld(MOUSE_LEFT)) { //We start by getting a normalised direction vector from the camera and mouse... Vector3 dir = GetMouseDirectionVector3((float)width/(float)height,45.0f, *camera); //And then forming a ray out of it, starting at the camera's position Ray r = Ray(camera->GetPosition(),dir); //Now we're going to test our ray against our node hierarchy r.IntersectsNodes(*root); //If it has collided against any nodes, set them to blue for(unsigned int i = 0; i < r.collisions.size(); ++i ) { r.collisions.at(i).node->SetColour(Vector4(0,0,1,1)); } //In case you didn't quite know how, here's how to draw a textured 'mouse //pointer' in OpenGL. We go to an orthographic perspective, with a range //of 0-width on the x-axis, and 0-height on the y axis. Then we draw //a shape at the mouse position. See how we still use the near plane of //-1, so that a mouse pointer drawn at a z of 0 will definitely show up! Vector2 mpos = Window::GetMouse()->GetAbsolutePosition(); viewMatrix.ToIdentity(); projMatrix = Matrix4::Orthographic(-1.0f,1.0f,(float)width,0.0f,(float)height,0.0f); modelMatrix = Matrix4::Translation(Vector3(mpos.x,height - mpos.y,0)) * Matrix4::Scale(Vector3(25,25,25)); UpdateShaderMatrices(); triangle->Draw(); } //That's everything! glUseProgram(0); SwapBuffers(); }
void QTPFSPathDrawer::DrawSearchIteration(unsigned int pathType, const std::list<unsigned int>& nodeIndices, CVertexArray* va) const { std::list<unsigned int>::const_iterator it = nodeIndices.begin(); unsigned int hmx = (*it) % mapDims.mapx; unsigned int hmz = (*it) / mapDims.mapx; const QTPFS::NodeLayer& nodeLayer = pm->nodeLayers[pathType]; const QTPFS::QTNode* poppedNode = static_cast<const QTPFS::QTNode*>(nodeLayer.GetNode(hmx, hmz)); const QTPFS::QTNode* pushedNode = NULL; DrawNode(poppedNode, NULL, va, true, false, false); for (++it; it != nodeIndices.end(); ++it) { hmx = (*it) % mapDims.mapx; hmz = (*it) / mapDims.mapx; pushedNode = static_cast<const QTPFS::QTNode*>(nodeLayer.GetNode(hmx, hmz)); DrawNode(pushedNode, NULL, va, true, false, false); DrawNodeLink(pushedNode, poppedNode, va); } }
void Mob2DRenderer::Render() { GLuint current_image = 0, previous_image = 9001; // Loop through all instances of Mob2D_node (Mob2DNode) in the sprite manager and render them out. for(Mob2DNodeIter i = SpriteManager::Instance()->nodes.begin(); i != SpriteManager::Instance()->nodes.end(); i++) { // If it's not an error if(((*i).second->draw) && (isInView((*i).second))) { current_image = (*i).second->m_sprite->GetImageHandle(); glActiveTexture(GL_TEXTURE0); if(current_image != previous_image) glBindTexture(GL_TEXTURE_2D, (*i).second->m_sprite->GetImageHandle()); if(!(*i).second->draw_to_screen) { glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(camera_data[0], camera_data[0]+camera_data[2], camera_data[1]+camera_data[3], camera_data[1], -9001, 9001); glViewport(0, 0, window[0], window[1]); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } else { glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, window[0], 0, window[1], -9001, 9001); glViewport(0, 0, window[0], window[1]); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // OH GOD DRAW TO SCREEN IS DRAWING UPSIDE DOWN! glTranslatef(0.375f, 0.375f, 0.0f); // glScalef(0.0f, -1.0f, 0.0f); } DrawNode((*i).second); previous_image = current_image; glBindBuffer(GL_ARRAY_BUFFER, 0); } } }
/* This is just the DrawNode function from the SceneGraphs tutorial! */ void Renderer::DrawNode(SceneNode*n) { if(n->GetMesh()) { glUniformMatrix4fv(glGetUniformLocation(currentShader->GetProgram(), "modelMatrix"), 1,false, (float*)&(n->GetWorldTransform()*Matrix4::Scale(n->GetModelScale()))); glUniform4fv(glGetUniformLocation(currentShader->GetProgram(), "nodeColour"),1,(float*)&n->GetColour()); glUniform1i(glGetUniformLocation(currentShader->GetProgram(), "useTexture"),(int)n->GetMesh()->GetTexture()); n->GetMesh()->Draw(); } for(vector<SceneNode*>::const_iterator i = n->GetChildIteratorStart(); i != n->GetChildIteratorEnd(); ++i) { DrawNode((*i)); } }
} void Renderer::UpdateScene(float msec) { camera -> UpdateCamera(msec); viewMatrix = camera -> BuildViewMatrix(); root->Update(msec); /*root->SetTransform(Matrix4::Rotation(f, Vector3(1, 3, 5)));*/ } void Renderer::RenderScene() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glUseProgram(currentShader -> GetProgram()); UpdateShaderMatrices(); glUniform1i(glGetUniformLocation(currentShader -> GetProgram(),"diffuseTex"), 0); heightMap -> Draw();
void DrawNode(Node *theNode) { Node * oneNode; RenderState *rs; if (theNode == NULL) return; rs = RenderStateScene(); //printf("Estoy en drawnode\n"); //PrintTrfm3D(theNode->placement_WC); PushRS(rs, MG_MODELVIEW); MultTrfmRS(rs, MG_MODELVIEW, theNode->placement); /* Si theNode es un nodo hoja, se dibuja directamente el objeto. En caso contrario, se dibuja cada uno de sus hijos con una llamada a la misma función. */ if(theNode->gObject != NULL){ DrawGObject(theNode->gObject); }else{ /* theNode es un nodo intermedio (o la raíz) */ oneNode = StartLoop(theNode->nodeChilds); while(oneNode) { DrawNode(oneNode); oneNode = GetNext(theNode->nodeChilds); } } PopRS(rs, MG_MODELVIEW); // Uncomment this to toggle viewing the Bounding Box // //if(rs->drawBBox || theNode->drawBBox) //PrintBBox(theNode->container_WC); DrawGLBBox(theNode->container_WC); }
void ToolBar::Paint( wal::GC& gc, const crect& paintRect ) { crect cr = ClientRect(); crect rect = cr; unsigned colorBg = UiGetColor( uiBackground, 0, 0, 0x808080 ); //GetColor(0); unsigned splitColor1 = ColorTone( colorBg, -70 ); unsigned splitColor2 = ColorTone( colorBg, 70 ); if ( g_WcmConfig.styleShow3DUI ) { Draw3DButtonW2( gc, rect, colorBg, true ); rect.Dec(); rect.Dec(); } gc.SetFillColor( colorBg ); gc.FillRect( rect ); gc.Set( GetFont() ); int x = 2; for ( size_t i = 0; i < _list.size(); i++ ) { Node* p = _list[i].ptr(); if ( p ) { DrawNode( gc, p, _pressed == p ? DRAW_PRESSED : DRAW_NORMAL ); x += p->rect.Width(); } else { gc.SetFillColor( splitColor1 ); int x1 = x + SPLITTER_WIDTH / 2; gc.FillRect( crect( x1, rect.top, x1 + 1, rect.bottom ) ); gc.SetFillColor( splitColor2 ); gc.FillRect( crect( x1 + 2, rect.top, x1 + 2, rect.bottom ) ); x += SPLITTER_WIDTH; } } return; }
void QTPFSPathDrawer::DrawNodeTreeRec( const QTPFS::QTNode* nt, const MoveDef* md, CVertexArray* va ) const { if (nt->IsLeaf()) { DrawNode(nt, md, va, false, true, false); } else { for (unsigned int i = 0; i < nt->children.size(); i++) { const QTPFS::QTNode* n = nt->children[i]; const float3 mins = float3(n->xmin() * SQUARE_SIZE, 0.0f, n->zmin() * SQUARE_SIZE); const float3 maxs = float3(n->xmax() * SQUARE_SIZE, 0.0f, n->zmax() * SQUARE_SIZE); if (!camera->InView(mins, maxs)) continue; DrawNodeTreeRec(nt->children[i], md, va); } } }
void DrawNode( Node *node ) { glPushMatrix(); const Material *mtl = node->GetMaterial(); if ( mtl ) mtl->SetViewportMaterial(); Matrix3 tm = node->GetTransform(); Point3 p = node->GetPosition(); float m[16] = { tm[0],tm[1],tm[2],0, tm[3],tm[4],tm[5],0, tm[6],tm[7],tm[8],0, p.x,p.y,p.z,1 }; glMultMatrixf( m ); Object *obj = node->GetObject(); if ( obj ) obj->ViewportDisplay(); for ( int i=0; i<node->GetNumChild(); i++ ) { DrawNode( node->GetChild(i) ); } glPopMatrix(); }
void GUIComponentManager::UpdateComponent(int id) { GUIComponent *currentCreateGUIComponent = guiComponentFactory.CreateGUIComponent(guiPresentation->GetComponent(id)); StoreGUIComponent(currentCreateGUIComponent, id); //qDebug() << guiComponents.at(index)->GetPosition(); if(!CheckPoint(guiComponents.at(id)->GetPosition())) { QPointF point = guiPresentation->GetMousePoint(); guiComponents.at(id)->setPos(point); } else { guiComponents.at(id)->setPos(guiComponents.at(id)->GetPosition()); } guiComponents.at(id)->UpdatePoint(); //qDebug() << guiComponents.at(index)->GetPosition(); DrawNode(guiComponents.at(id)); ClearSelected(); }
void GUIComponentManager::UpdateNode(int index) { GUIComponent *currentCreateGUIComponent = guiComponentFactory.CreateGUIComponent(guiPresentation->GetNewComponent()); StoreGUIComponent(currentCreateGUIComponent, index); //qDebug() << guiComponents.at(index)->GetPosition(); if(!CheckPoint(guiComponents.at(index)->GetPosition())) { QPointF point = guiPresentation->GetMousePoint(); guiComponents.at(index)->setPos(point); } else { guiComponents.at(index)->setPos(guiComponents.at(index)->GetPosition()); } guiComponents.at(index)->UpdatePoint(); //qDebug() << guiComponents.at(index)->GetPosition(); DrawNode(guiComponents.at(index)); DesroyPreview(); }
void QTPFSPathDrawer::DrawNodeTree(const MoveDef* md) const { QTPFS::QTNode* nt = pm->nodeTrees[md->pathType]; CVertexArray* va = GetVertexArray(); std::list<const QTPFS::QTNode*> nodes; std::list<const QTPFS::QTNode*>::const_iterator nodesIt; GetVisibleNodes(nt, nodes); va->Initialize(); va->EnlargeArrays(nodes.size() * 4, 0, VA_SIZE_C); for (nodesIt = nodes.begin(); nodesIt != nodes.end(); ++nodesIt) { DrawNode(*nodesIt, md, va, false, true, true); } glLineWidth(2); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); va->DrawArrayC(GL_QUADS); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glLineWidth(1); }