Ejemplo n.º 1
0
void CFace::glCommands(bool select, bool marked, bool no_color){
	bool owned_by_solid = false;
	if(GetParentBody()) {
		// using existing BRepMesh::Mesh
		// use solid's colour
		owned_by_solid = true;

		// add a marking display list
		if(m_marking_gl_list)
		{
			glCallList(m_marking_gl_list);
		}
	}
	else {
		// clean mesh
		double pixels_per_mm = wxGetApp().GetPixelScale();
		MeshFace(m_topods_face, 1/pixels_per_mm);

		// use a default material
		Material().glMaterial(1.0);
		glEnable(GL_LIGHTING);
		glShadeModel(GL_SMOOTH);
	}

	DrawFaceWithCommands(m_topods_face);

	if(!owned_by_solid)
	{
		glDisable(GL_LIGHTING);
		glShadeModel(GL_FLAT);
	}
}
Ejemplo n.º 2
0
void CSketch::glCommands(bool select, bool marked, bool no_color)
{
	if(m_coordinate_system && m_draw_with_transform)
	{
		glPushMatrix();
		m_coordinate_system->ApplyMatrix();
	}

	ObjList::glCommands(select,marked,no_color);

	if(m_solidify)
	{
	    try
	    {
            //TODO: we should really only be doing this when geometry changes
            std::vector<TopoDS_Face> faces = GetFaces();

            double pixels_per_mm = wxGetApp().GetPixelScale();

            for(unsigned i=0; i < faces.size(); i++)
            {
                MeshFace(faces[i],pixels_per_mm);
                DrawFaceWithCommands(faces[i]);
            }
	    }catch(...)
	    {

	    }
	}

	if(m_coordinate_system && m_draw_with_transform)
		glPopMatrix();
}