From bdbea25d0d7e00cad5d71184a63e9c9e270df2aa Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 15 Jan 2019 21:29:47 +0100 Subject: [PATCH] issue 0003624: FEM, GUI, mesh VP, element colors --- src/Mod/Fem/Gui/ViewProviderFemMesh.cpp | 55 +++++++++---------------- 1 file changed, 19 insertions(+), 36 deletions(-) diff --git a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp index d2815ae949..0566ecb7bf 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp @@ -273,9 +273,8 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj) SoPointSet *pointset = new SoPointSet; pcAnotRoot->addChild(pointset); - // flat + // Faces SoGroup* pcFlatRoot = new SoGroup(); - // face nodes pcFlatRoot->addChild(pcCoords); pcFlatRoot->addChild(pShapeHints); pcFlatRoot->addChild(pcShapeMaterial); @@ -284,10 +283,10 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj) pcFlatRoot->addChild(pcAnotRoot); addDisplayMaskMode(pcFlatRoot, Private::dm_face); - // line + // Wireframe + SoGroup* pcWireRoot = new SoSeparator(); SoLightModel* pcLightModel = new SoLightModel(); pcLightModel->model = SoLightModel::BASE_COLOR; - SoGroup* pcWireRoot = new SoGroup(); pcWireRoot->addChild(pcCoords); pcWireRoot->addChild(pcDrawStyle); pcWireRoot->addChild(pcLightModel); @@ -297,8 +296,7 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj) pcWireRoot->addChild(pcLines); addDisplayMaskMode(pcWireRoot, Private::dm_wire); - - // Points + // Nodes SoGroup* pcPointsRoot = new SoSeparator(); pcPointsRoot->addChild(pcPointMaterial); pcPointsRoot->addChild(pcPointStyle); @@ -307,42 +305,27 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj) pcPointsRoot->addChild(pointset); addDisplayMaskMode(pcPointsRoot, Private::dm_node); - // flat+line (Elements) - SoPolygonOffset* offset = new SoPolygonOffset(); - offset->styles = SoPolygonOffset::LINES; + // For combined modes make sure to use a Separator instead of a Group + // because the group affects nodes that are rendered afterwards (#0003769) + + // Faces + Wireframe (Elements) + //SoPolygonOffset* offset = new SoPolygonOffset(); + //offset->styles = SoPolygonOffset::FILLED; //offset->factor = 2.0f; //offset->units = 1.0f; - SoGroup* pcFlatWireRoot = new SoSeparator(); - // add the complete flat group (contains the coordinates) - pcFlatWireRoot->addChild(pcFlatRoot); - //pcFlatWireRoot->addChild(offset); // makes no difference..... - // add the line nodes - SoMaterialBinding *pcMatBind = new SoMaterialBinding; - pcMatBind->value = SoMaterialBinding::OVERALL; - pcFlatWireRoot->addChild(pcMatBind); - pcFlatWireRoot->addChild(pcDrawStyle); - pcFlatWireRoot->addChild(pcLightModel); - pcFlatWireRoot->addChild(color); - pcFlatWireRoot->addChild(pcLines); + SoGroup* pcFlatWireRoot = new SoGroup(); + pcFlatWireRoot->addChild(pcWireRoot); + //pcFlatWireRoot->addChild(offset); + pcFlatWireRoot->addChild(pcFlatRoot); addDisplayMaskMode(pcFlatWireRoot, Private::dm_face_wire); - // flat+line+Nodes (Elements&Nodes) - SoGroup* pcElemNodesRoot = new SoSeparator(); - // add the complete flat group (contains the coordinates) - pcElemNodesRoot->addChild(pcFlatRoot); + // Faces + Wireframe + Nodes (Elements&Nodes) + SoGroup* pcElemNodesRoot = new SoGroup(); + pcElemNodesRoot->addChild(pcPointsRoot); + pcElemNodesRoot->addChild(pcWireRoot); //pcElemNodesRoot->addChild(offset); - // add the line nodes - pcElemNodesRoot->addChild(pcDrawStyle); - pcElemNodesRoot->addChild(pcLightModel); - pcElemNodesRoot->addChild(color); - pcElemNodesRoot->addChild(pcLines); - // add the points nodes - pcElemNodesRoot->addChild(pcPointMaterial); - pcElemNodesRoot->addChild(pcPointStyle); - pcElemNodesRoot->addChild(pcPointMaterial); - pcElemNodesRoot->addChild(pointset); - + pcElemNodesRoot->addChild(pcFlatRoot); addDisplayMaskMode(pcElemNodesRoot, Private::dm_face_wire_node); }