void TraceGfx::DoRender(graph::Engine& engine) { //Отрисовка путей for (Trace::Points::const_iterator iter = _trace->GetPoints().begin(); iter != _trace->GetPoints().end(); ++iter) { _libMat->material.SetDiffuse(*iter == _selPoint ? clrGreen : clrRed); _wayPnt->SetPos((*iter)->GetPos()); _wayPnt->SetScale((*iter)->GetSize()); _wayPnt->Render(engine); } //Отрисовка связей между путями Vec3Range resColor(D3DXVECTOR3(clrWhite / 2.0f), D3DXVECTOR3(clrWhite), Vec3Range::vdVolume); D3DXVECTOR3 upVec = engine.GetContext().GetCamera().GetDesc().dir; float iPath = 0.0f; float pathCnt = static_cast<float>(_trace->GetPathes().size()); for (Trace::Pathes::const_iterator iter = _trace->GetPathes().begin(); iter != _trace->GetPathes().end(); ++iter, ++iPath) { WayPath* path = *iter; D3DXCOLOR pathColor = path == _selPath ? clrGreen : D3DXCOLOR(resColor.GetValue(iPath / (pathCnt - 1.0f))); res::VertexData vBuf; path->GetTriStripVBuf(vBuf, &upVec); if (vBuf.IsInit()) DrawNodes(engine, vBuf.begin().Pos3(), vBuf.GetVertexCount() - 2, pathColor); } //Для выделенного узла свой цикл отрисовки if (_selNode && _selNode->GetNext()) { D3DXVECTOR3 vBuf[4]; _selNode->GetTile().GetVBuf(vBuf, 4, &upVec); DrawNodes(engine, vBuf, 4 - 2, clrGreen); } //Отрисовка связи выделения if (_pointLink) { D3DXVECTOR3 pos1 = _pointLink->GetPoint()->GetPos(); D3DXVECTOR3 pos2 = _pointLink->GetPos(); D3DXVECTOR3 dir = pos1 - pos2; D3DXVECTOR2 sizes(D3DXVec3Length(&dir), _pointLink->GetPoint()->GetSize()); D3DXVec3Normalize(&dir, &dir); _sprite->SetPos((pos1 + pos2) / 2.0f); _sprite->SetDir(dir); _sprite->sizes = sizes; _libMat->material.SetDiffuse(clrGreen); _sprite->Render(engine); } }
void CCharShape::DrawNodes (const TCharNode *node) { glPushMatrix(); glMultMatrix(node->trans); if (node->node_name == highlight_node) highlighted = true; const TCharMaterial *mat; if (highlighted && useHighlighting) { mat = &Highlight; } else { if (node->mat != NULL && useMaterials) mat = node->mat; else mat = &TuxDefMat; } if (node->visible == true) { set_material (mat->diffuse, mat->specular, mat->exp); DrawCharSphere (node->divisions); } // -------------- recursive loop ------------------------------------- TCharNode *child = node->child; while (child != NULL) { DrawNodes (child); if (child->node_name == highlight_node) highlighted = false; child = child->next; } // ------------------------------------------------------------------- glPopMatrix(); }
void RateLimiter::Draw(wxPoint2DDouble translation, double scale) const { glLineWidth(1.0); if(m_selected) { glColor4dv(m_selectionColour.GetRGBA()); double borderSize = (m_borderSize * 2.0 + 1.0) / scale; DrawRectangle(m_position, m_width + borderSize, m_height + borderSize); } glColor4d(1.0, 1.0, 1.0, 1.0); DrawRectangle(m_position, m_width, m_height); glColor4d(0.0, 0.0, 0.0, 1.0); DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP); // Plot symbol. std::vector<wxPoint2DDouble> axis; axis.push_back(m_position + wxPoint2DDouble(-13, 0)); axis.push_back(m_position + wxPoint2DDouble(13, 0)); axis.push_back(m_position + wxPoint2DDouble(0, -13)); axis.push_back(m_position + wxPoint2DDouble(0, 13)); DrawLine(axis, GL_LINES); glLineWidth(2.0); std::vector<wxPoint2DDouble> limSymbol; limSymbol.push_back(m_position + wxPoint2DDouble(10, -10)); limSymbol.push_back(m_position + wxPoint2DDouble(-10, 10)); glColor4d(0.0, 0.3, 1.0, 1.0); DrawLine(limSymbol); glColor4d(0.0, 0.0, 0.0, 1.0); DrawNodes(); }
void CCharShape::DrawNodes (TCharNode *node) { TCharNode *child; glPushMatrix(); GLfloat trans[16]; for ( int i = 0; i < 16; i++ ) { trans[i] = ((const double*)node->trans)[i]; } glMultMatrixf (trans); if (node->node_name == highlight_node) highlighted = true; TCharMaterial *mat; if (highlighted && useHighlighting) { mat = &Highlight; } else { if (node->mat != NULL && useMaterials) mat = node->mat; else mat = &TuxDefMat; } if (node->visible == true) { set_material (mat->diffuse, mat->specular, mat->exp); DrawCharSphere (node->divisions); } // -------------- recursive loop ------------------------------------- child = node->child; while (child != NULL) { DrawNodes (child); if (child->node_name == highlight_node) highlighted = false; child = child->next; } // ------------------------------------------------------------------- glPopMatrix(); }
GUI_Status ListWidget::Select( short item ) { if ( item < 0 ) item = -1; else if ( item >= nodes ) item = nodes - 1; if ( item != current ) { short newtop = toprow; current = item; if ( current >= 0 ) { short selrow = current * ItemHeight(); if ( selrow < toprow ) newtop = selrow; else if ( selrow + ItemHeight() >= newtop + visrows ) newtop = selrow - visrows + ItemHeight(); } if ( toprow != newtop ) { static_cast<SliderWidget *>( GetWidget(0) )->ScrollTo( newtop ); } else { DrawNodes(); Show(); } } if ( hook ) return hook->WidgetActivated( this, surface ); return GUI_OK; }
void Renderer::RenderScene() { glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); if(camera) { SetCurrentShader(simpleShader); glUniform1i(glGetUniformLocation(currentShader->GetProgram(), "diffuseTex"), 0); textureMatrix.ToIdentity(); modelMatrix.ToIdentity(); viewMatrix = camera->BuildViewMatrix(); projMatrix = Matrix4::Perspective(1.0f,10000.0f,(float)width / (float) height, 60.0f); frameFrustum.FromMatrix(projMatrix * viewMatrix); UpdateShaderMatrices(); //Return to default 'usable' state every frame! glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glDisable(GL_STENCIL_TEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); BuildNodeLists(root); SortNodeLists(); DrawNodes(); ClearNodeLists(); } glUseProgram(0); SwapBuffers(); }
void Scene::DrawCominedScene() { SetCurrentShader(SceneShader); glUniform1i(glGetUniformLocation(currentShader->GetProgram(), "diffuseTex"), 0); glUniform1i(glGetUniformLocation(currentShader->GetProgram(), "bumpTex"), 1); glUniform1i(glGetUniformLocation(currentShader->GetProgram(), "shadowTex1"), 2); glUniform3fv(glGetUniformLocation(currentShader->GetProgram(), "cameraPos"), 1, (float*)&m_Camera->GetPosition()); SetShaderLightList(lightList); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, shadowTex); //glActiveTexture(GL_TEXTURE3); //glBindTexture(GL_TEXTURE_2D, shadowTexs[0]); projMatrix = Matrix4::Perspective(1.0f, 1000.0f, (float)width / (float)height, 45.0f); viewMatrix = m_Camera->BuildViewMatrix(); /*Vector3 translate = Vector3((lightList.at(0)).GetPosition()); translate += Vector3(0, 90, 0); viewMatrix = Matrix4::BuildViewMatrix((lightList.at(0)).GetPosition(), translate);*/ UpdateShaderMatrices(); //draw the object DrawNodes(true); glUseProgram(0); }
//---------------------------------------------------------------------------- // // ROUTINE: CAINodeMgr::UpdateDebugRendering() // // PURPOSE: Draw or hide nodes. // //---------------------------------------------------------------------------- void CAINodeMgr::UpdateDebugRendering(LTFLOAT fVarTrack) { if( m_fDrawingNodes != fVarTrack ) { EnumAINodeType eNodeType = (EnumAINodeType)( (uint32)m_fDrawingNodes ); HideNodes( eNodeType ); eNodeType = (EnumAINodeType)( (uint32)fVarTrack ); DrawNodes( eNodeType ); m_fDrawingNodes = fVarTrack; } }
void CCharShape::Draw () { TCharNode *node; float dummy_color[] = {0.0, 0.0, 0.0, 1.0}; glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, dummy_color); set_gl_options (TUX); glEnable (GL_NORMALIZE); if (!GetNode (0, &node)) return; DrawNodes (node); glDisable (GL_NORMALIZE); if (param.perf_level > 2 && g_game.argument == 0) DrawShadow (); highlighted = false; }
void Renderer::RenderScene() { BuildNodeLists(root); SortNodeLists(); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glUseProgram(currentShader->GetProgram()); UpdateShaderMatrices(); glUniform1i(glGetUniformLocation(currentShader->GetProgram(), "diffuseTex"), 0); DrawNodes(); glUseProgram(0); SwapBuffers(); ClearNodeLists(); }
void CEffectVis::ShowVis(CDC * pDC, CRect rectBorder) //--------------------------------------------------- { MPT_UNREFERENCED_PARAMETER(rectBorder); if (m_forceRedraw) { m_forceRedraw = false; // if we already have a memory dc, destroy it (this occurs for a re-size) if (m_dcGrid.GetSafeHdc()) { m_dcGrid.SelectObject(m_pbOldGrid) ; m_dcGrid.DeleteDC() ; m_dcNodes.SelectObject(m_pbOldNodes) ; m_dcNodes.DeleteDC() ; m_dcPlayPos.SelectObject(m_pbOldPlayPos) ; m_dcPlayPos.DeleteDC() ; m_bPlayPos.DeleteObject() ; m_bGrid.DeleteObject() ; m_bNodes.DeleteObject() ; } // create a memory based dc for drawing the grid m_dcGrid.CreateCompatibleDC(pDC); m_bGrid.CreateCompatibleBitmap(pDC, m_rcDraw.Width(), m_rcDraw.Height()); m_pbOldGrid = m_dcGrid.SelectObject(&m_bGrid); // create a memory based dc for drawing the nodes m_dcNodes.CreateCompatibleDC(pDC); m_bNodes.CreateCompatibleBitmap(pDC, m_rcDraw.Width(), m_rcDraw.Height()); m_pbOldNodes = m_dcNodes.SelectObject(&m_bNodes); // create a memory based dc for drawing the nodes m_dcPlayPos.CreateCompatibleDC(pDC); m_bPlayPos.CreateCompatibleBitmap(pDC, m_rcDraw.Width(), m_rcDraw.Height()); m_pbOldPlayPos = m_dcPlayPos.SelectObject(&m_bPlayPos); SetPlayCursor(m_nPattern, m_nOldPlayPos); DrawGrid(); DrawNodes(); } // display the new image, combining the nodes with the grid ShowVisImage(pDC); }
void CCharShape::Draw () { static const float dummy_color[] = {0.0, 0.0, 0.0, 1.0}; glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, dummy_color); ScopedRenderMode rm(TUX); glEnable (GL_NORMALIZE); TCharNode *node = GetNode(0); if (node == NULL) return; DrawNodes (node); glDisable (GL_NORMALIZE); if (param.perf_level > 2 && g_game.argument == 0) DrawShadow (); highlighted = false; }
void CEffectVis::Update() { DrawNodes(); if (::IsWindow(m_hWnd)) { OnPaint(); if (m_nRowToErase<0) InvalidateRect(NULL, FALSE); // redraw everything else { InvalidateRow(m_nRowToErase); m_nParamToErase=-1; m_nRowToErase=-1; } } }
void Constant::Draw(wxPoint2DDouble translation, double scale) const { glLineWidth(1.0); if(m_selected) { glColor4dv(m_selectionColour.GetRGBA()); double borderSize = (m_borderSize * 2.0 + 1.0) / scale; DrawRectangle(m_position, m_width + borderSize, m_height + borderSize); } glColor4d(1.0, 1.0, 1.0, 1.0); DrawRectangle(m_position, m_width, m_height); glColor4d(0.0, 0.0, 0.0, 1.0); DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP); // Plot number. m_glText->Draw(m_position); glColor4d(0.0, 0.0, 0.0, 1.0); DrawNodes(); }
void CCharShape::Draw () { static const float dummy_color[] = {0.0, 0.0, 0.0, 1.0}; glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, dummy_color); ScopedRenderMode rm(TUX); glEnable (GL_NORMALIZE); TCharNode *node = GetNode(0); if (node == NULL) return; glEnableClientState(GL_NORMAL_ARRAY); glNormalPointer(GL_FLOAT, 0,charvertices); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(3, GL_FLOAT, 0,charvertices); DrawNodes (node); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); glDisable (GL_NORMALIZE); if (param.perf_level > 2 && g_game.argument == 0) DrawShadow (); highlighted = false; }
void Exponential::Draw(wxPoint2DDouble translation, double scale) const { glLineWidth(1.0); if(m_selected) { glColor4dv(m_selectionColour.GetRGBA()); double borderSize = (m_borderSize * 2.0 + 1.0) / scale; DrawRectangle(m_position, m_width + borderSize, m_height + borderSize); } glColor4d(1.0, 1.0, 1.0, 1.0); DrawRectangle(m_position, m_width, m_height); glColor4d(0.0, 0.0, 0.0, 1.0); DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP); // Plot symbol. std::vector<wxPoint2DDouble> axis; axis.push_back(m_position + wxPoint2DDouble(-13, 13)); axis.push_back(m_position + wxPoint2DDouble(13, 13)); axis.push_back(m_position + wxPoint2DDouble(-13, -13)); axis.push_back(m_position + wxPoint2DDouble(-13, 13)); DrawLine(axis, GL_LINES); glLineWidth(2.0); std::vector<wxPoint2DDouble> expSymbol; expSymbol.push_back(m_position + wxPoint2DDouble(-13, 13)); expSymbol.push_back(m_position + wxPoint2DDouble(-6, 13)); expSymbol.push_back(m_position + wxPoint2DDouble(2, 12)); expSymbol.push_back(m_position + wxPoint2DDouble(4, 11)); expSymbol.push_back(m_position + wxPoint2DDouble(6, 10)); expSymbol.push_back(m_position + wxPoint2DDouble(8, 7)); expSymbol.push_back(m_position + wxPoint2DDouble(11, -1)); expSymbol.push_back(m_position + wxPoint2DDouble(12, -7)); expSymbol.push_back(m_position + wxPoint2DDouble(13, -13)); glColor4d(0.0, 0.3, 1.0, 1.0); DrawLine(expSymbol); glColor4d(0.0, 0.0, 0.0, 1.0); DrawNodes(); }
void CTwoOptDlg::OnPaint() { // device context for painting //CDC memDC ; // buffer context CPaintDC dc(this); if (IsIconic()) { SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { if ( CoordsMatrix_.size() < 1 ) return; // device context for painting CPen penDot(PS_DOT,1,RGB(255,0,0)); CPen penblack(PS_SOLID,3,RGB(0,0,0)); CRect rect; GetClientRect(&rect); int rectx1 = rect.left + 20; int rectx2 = rect.right - 170; int recty1 = rect.top + 25; int recty2 = rect.bottom - bottom_limit; dc.Rectangle(rectx1-5,recty1-5,rectx2+5,recty2+5); // Plot each node size_t tour_size = CoordsMatrix_.size(); for ( count = 0; count < tour_size; count++ ) { Coords mat = CoordsMatrix_[count]; xc1 =static_cast<int>(mat.GetX()); yc1 = static_cast<int>(mat.GetY()); xn1 = (float) ( xc1 - MinX ) / (float) ( MaxX - MinX ); yn1 = (float) ( yc1 - MinY ) / (float) ( MaxY - MinY ); xcoord1 = rectx1 + (int) (float) ( xn1 * abs( rectx1 - rectx2 ) ); ycoord1 = recty2 - (int) (float) ( yn1 * abs( recty1 - recty2 ) ); dc.SelectObject(&penblack); dc.Ellipse( xcoord1 - 2, ycoord1 - 2, xcoord1 + 2, ycoord1 + 2 ); //draw lines dc.SelectObject(&penDot); //draw last tour if ( hasRun && count < tour_size - 1 && m_lasttour.Tour.size()) { m_lasttour.Tour[count]; cc1 = static_cast<int>(m_lasttour.Tour[count]); cc2 = static_cast<int>(m_lasttour.Tour[count +1]); DrawNodes(cc1 , cc2, rectx1, rectx2, recty2, recty1, dc); } dc.SelectObject(&penblack); if ( hasRun && count < tour_size - 1 && m_besttour.Tour.size()) { cc1 = static_cast<int>(m_besttour.Tour[count]); cc2 = static_cast<int>(m_besttour.Tour[count +1]); DrawNodes(cc1 , cc2, rectx1, rectx2, recty2, recty1, dc); } } // Draw final link if ( hasRun ) { if(m_lasttour.Tour.size()) { cc1 = static_cast<int>(m_lasttour.Tour[tour_size-1]); cc2 = static_cast<int>( m_lasttour.Tour[0]); dc.SelectObject(&penDot); DrawNodes(cc1 , cc2, rectx1, rectx2, recty2, recty1, dc); } if(m_besttour.Tour.size()) { dc.SelectObject(&penblack); cc1 = static_cast<int>(m_besttour.Tour[tour_size-1]); cc2 = static_cast<int>(m_besttour.Tour[0]); DrawNodes(cc1 , cc2, rectx1, rectx2, recty2, recty1, dc); } } CDialogEx::OnPaint(); } }
static void DrawAll(void) { DrawPartitions(); DrawNodes(); }
void wxTreeLayout::Draw(wxDC& dc) { dc.Clear(); DrawBranches(dc); DrawNodes(dc); }
void ListWidget::Set( short row ) { toprow = row; DrawNodes(); Show(); }
void Scene::DrawShadowScene() { //Matrix4 tempMatrix = Matrix4::Translation(Vector3((200 * 150) / 2.0f, -90.0f, (200 * 150) / 2)); Vector3 translate = Vector3((lightList.at(0)).GetPosition()); //Matrix4 pushMatrix = Matrix4::Translation(translate); //Matrix4 popMatrix = Matrix4::Translation(-translate); translate += Vector3(-5, -175, 0); //top glBindFramebuffer(GL_FRAMEBUFFER, shadowFBO); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, shadowTex, 0); glClear(GL_DEPTH_BUFFER_BIT); glDrawBuffer(GL_NONE); glViewport(0, 0, SHADOWSIZE, SHADOWSIZE); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); SetCurrentShader(ShadowShader); /*if (loop < 4) { tempMatrix = pushMatrix * Matrix4::Rotation(90.0f * loop, Vector3(0.0f, 1.0f, 0.0f)) * popMatrix; } else { tempMatrix = pushMatrix * Matrix4::Rotation(90.0f * (loop == 4 ? 1 : -1), Vector3(1.0f, 0.0f, 0.0f)) * popMatrix; }*/ //if (loop == 0) // translate += Vector3(-5,-90,0); //top //if (loop == 1) // translate += Vector3(-5, 90,0); // floor //if (loop == 2) // translate += Vector3(200,-5,0); //if (loop == 3) // translate += Vector3(-200,-5,0); //if (loop == 4) // translate += Vector3(0,-5,150); //if (loop == 5) // translate += Vector3(0,-5,-150); //from the light to the middle of the height map //viewMatrix = Matrix4::BuildViewMatrix(lightList.at(10).GetPosition(), MiddleOfScene); projMatrix = Matrix4::Perspective(1.0f, 15000.0f, (float)width / (float)height, 200.0f); //Vector3 pos = tempMatrix.GetPositionVector(); //Vector3 pos = translate; //translate += Vector3(-5,-5,-5); //cout << translate << endl; viewMatrix = Matrix4::BuildViewMatrix((lightList.at(0)).GetPosition(), translate); //ShadowTransMatrix = biasMatrix*(projMatrix * viewMatrix); //viewMatrix = Matrix4::BuildViewMatrix(lightList.at(0).GetPosition(), Vector3(0,0,0)); //textureMatrix = biasMatrix * (projMatrix * viewMatrix); (lightList.at(0)).SetlightViewProjMat(biasMatrix * (projMatrix * viewMatrix)); //Texture matrix is really = biasMatrix * (light proj Matrix * light view Matrix) UpdateShaderMatrices(); //draw a shadow of each things DrawNodes(true); glUseProgram(0); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glViewport(0, 0, width, height); glBindFramebuffer(GL_FRAMEBUFFER, 0); }
void ListWidget::Draw( void ) { CompositeWidget::Draw(); PrintTitle( surface->GetFGPen() ); surface->DrawBox( Rect(x,y,listboxw,h), BOX_RECESSED ); DrawNodes(); }
void CCinemaPath::Draw() const { DrawSpline(*this, CVector4D(0.2f, 0.2f, 1.f, 0.5f), 100, true); DrawSpline(m_TargetSpline, CVector4D(1.0f, 0.2f, 0.2f, 0.5f), 100, true); DrawNodes(CVector4D(0.5f, 1.0f, 0.f, 0.5f)); }