X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=blobdiff_plain;f=src%2FMeshVS%2FMeshVS_ElementalColorPrsBuilder.cxx;h=7ceb2696f31912283ae1d37b11afde6fb55a6c6a;hp=75880888e4fe4c9a0d02dbc322c126dc1aad311a;hb=b1492cb30fcac293dcedabecb914a8a9db0fe536;hpb=3e05329c4cf565910bfcf85653f45fbbcb66bdcb diff --git a/src/MeshVS/MeshVS_ElementalColorPrsBuilder.cxx b/src/MeshVS/MeshVS_ElementalColorPrsBuilder.cxx index 75880888e4..7ceb2696f3 100644 --- a/src/MeshVS/MeshVS_ElementalColorPrsBuilder.cxx +++ b/src/MeshVS/MeshVS_ElementalColorPrsBuilder.cxx @@ -179,8 +179,7 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& //Now we are ready to draw faces with equal colors Aspect_TypeOfLine anEdgeType = Aspect_TOL_SOLID; Aspect_TypeOfLine aLineType = Aspect_TOL_SOLID; - Standard_Integer anEdgeInt, aLineInt; - Standard_Real anEdgeWidth, aLineWidth; + Standard_Real anEdgeWidth = 1.0, aLineWidth = 1.0; Quantity_Color anInteriorColor; Quantity_Color anEdgeColor, aLineColor; Standard_Boolean anEdgeOn = Standard_True, IsReflect = Standard_False, @@ -197,9 +196,11 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& aDrawer->GetBoolean( MeshVS_DA_SmoothShading, IsMeshSmoothShading ); aDrawer->GetBoolean (MeshVS_DA_SupressBackFaces, toSupressBackFaces); + Standard_Integer anEdgeInt = Aspect_TOL_SOLID; if ( aDrawer->GetInteger ( MeshVS_DA_EdgeType, anEdgeInt) ) anEdgeType = (Aspect_TypeOfLine) anEdgeInt; + Standard_Integer aLineInt = Aspect_TOL_SOLID; if ( aDrawer->GetInteger ( MeshVS_DA_BeamType, aLineInt) ) aLineType = (Aspect_TypeOfLine) aLineInt; @@ -215,13 +216,14 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& PolygonVerticesFor3D, PolygonBoundsFor3D ); } - Graphic3d_MaterialAspect aMaterial[2]; + Graphic3d_MaterialAspect aMaterial[2] = { Graphic3d_NOM_PLASTIC, Graphic3d_NOM_PLASTIC }; for (Standard_Integer i = 0; i < 2; i++) { // OCC20644 "plastic" is most suitable here, as it is "non-physic" // so TelUpdateMaterial() from OpenGl_attri.c uses the interior // color from AspectFillArea3d to calculate all material colors - aMaterial[i] = Graphic3d_MaterialAspect ( Graphic3d_NOM_PLASTIC ); + aMaterial[i].SetSpecularColor (Quantity_NOC_BLACK); + aMaterial[i].SetEmissiveColor (Quantity_NOC_BLACK); // OCC21720 For single-colored elements turning all material components off is a good idea, // as anyhow the normals are not computed and the lighting will be off, @@ -229,10 +231,8 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& // and there is no need to spend time on updating material properties if ( !IsReflect ) { - aMaterial[i].SetReflectionModeOff(Graphic3d_TOR_AMBIENT); - aMaterial[i].SetReflectionModeOff(Graphic3d_TOR_DIFFUSE); - aMaterial[i].SetReflectionModeOff(Graphic3d_TOR_SPECULAR); - aMaterial[i].SetReflectionModeOff(Graphic3d_TOR_EMISSION); + aMaterial[i].SetAmbientColor (Quantity_NOC_BLACK); + aMaterial[i].SetDiffuseColor (Quantity_NOC_BLACK); } else { @@ -241,10 +241,8 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& // those in the color scale most exactly (the sum of all reflection // coefficients is equal to 1). See also MeshVS_NodalColorPrsBuilder // class for more explanations. - aMaterial[i].SetAmbient( .5 ); - aMaterial[i].SetDiffuse( .5 ); - aMaterial[i].SetSpecular( 0. ); - aMaterial[i].SetEmissive( 0. ); + aMaterial[i].SetAmbientColor (Quantity_Color (Graphic3d_Vec3 (0.5f))); + aMaterial[i].SetDiffuseColor (Quantity_Color (Graphic3d_Vec3 (0.5f))); } } @@ -481,13 +479,14 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& CustomBuild(Prs, aCustomElements, IDsToExclude, DisplayMode); } - Graphic3d_MaterialAspect aMaterial2[2]; + Graphic3d_MaterialAspect aMaterial2[2] = { Graphic3d_NOM_PLASTIC, Graphic3d_NOM_PLASTIC }; for (Standard_Integer i = 0; i < 2; i++) { // OCC20644 "plastic" is most suitable here, as it is "non-physic" // so TelUpdateMaterial() from OpenGl_attri.c uses the interior // color from AspectFillArea3d to calculate all material colors - aMaterial2[i] = Graphic3d_MaterialAspect ( Graphic3d_NOM_PLASTIC ); + aMaterial2[i].SetSpecularColor (Quantity_NOC_BLACK); + aMaterial2[i].SetEmissiveColor (Quantity_NOC_BLACK); if ( !IsReflect ) { @@ -496,14 +495,8 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& // to have different materials for front and back sides! // Instead, trying to make material color "nondirectional" with // only ambient component on. - aMaterial2[i].SetReflectionModeOn ( Graphic3d_TOR_AMBIENT ); - aMaterial2[i].SetReflectionModeOff( Graphic3d_TOR_DIFFUSE ); - aMaterial2[i].SetReflectionModeOff( Graphic3d_TOR_SPECULAR ); - aMaterial2[i].SetReflectionModeOff( Graphic3d_TOR_EMISSION ); - aMaterial2[i].SetAmbient ( 1. ); - aMaterial2[i].SetDiffuse ( 0. ); - aMaterial2[i].SetSpecular( 0. ); - aMaterial2[i].SetEmissive( 0. ); + aMaterial2[i].SetAmbientColor (Quantity_Color (Graphic3d_Vec3 (1.0f))); + aMaterial2[i].SetDiffuseColor (Quantity_NOC_BLACK); } else { @@ -512,10 +505,8 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& // those in the color scale most exactly (the sum of all reflection // coefficients is equal to 1). See also MeshVS_NodalColorPrsBuilder // class for more explanations. - aMaterial2[i].SetAmbient( .5 ); - aMaterial2[i].SetDiffuse( .5 ); - aMaterial2[i].SetSpecular( 0. ); - aMaterial2[i].SetEmissive( 0. ); + aMaterial2[i].SetAmbientColor (Quantity_Color (Graphic3d_Vec3 (0.5f))); + aMaterial2[i].SetDiffuseColor (Quantity_Color (Graphic3d_Vec3 (0.5f))); } }