// commercial license or contractual agreement.
#define _POLYGONES_
-// if define _POLYGONES_ ColorPrsBuilder use ArrayOfPolygons for drawing faces
-#include <MeshVS_NodalColorPrsBuilder.ixx>
+// if define _POLYGONES_ ColorPrsBuilder use ArrayOfPolygons for drawing faces
-#include <Graphic3d_AspectFillArea3d.hxx>
-#include <Graphic3d_AspectLine3d.hxx>
+#include <Aspect_SequenceOfColor.hxx>
+#include <gp_Pnt.hxx>
#include <Graphic3d_ArrayOfPolygons.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
+#include <Graphic3d_ArrayOfPrimitives.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_ArrayOfTriangles.hxx>
+#include <Graphic3d_AspectFillArea3d.hxx>
+#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_Group.hxx>
+#include <Graphic3d_Texture2D.hxx>
#include <Graphic3d_TextureParams.hxx>
-
-#include <Prs3d_Drawer.hxx>
-#include <Prs3d_ShadingAspect.hxx>
-#include <Prs3d_Root.hxx>
-#include <Prs3d_LineAspect.hxx>
-
-#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <TColStd_HArray1OfReal.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
-#include <TColStd_HPackedMapOfInteger.hxx>
-
-#include <MeshVS_DisplayModeFlags.hxx>
-#include <MeshVS_DrawerAttribute.hxx>
+#include <Graphic3d_TypeOfTextureMode.hxx>
+#include <Image_PixMap.hxx>
+#include <MeshVS_Buffer.hxx>
#include <MeshVS_DataSource.hxx>
+#include <MeshVS_DisplayModeFlags.hxx>
#include <MeshVS_Drawer.hxx>
+#include <MeshVS_DrawerAttribute.hxx>
+#include <MeshVS_HArray1OfSequenceOfInteger.hxx>
#include <MeshVS_Mesh.hxx>
#include <MeshVS_MeshPrsBuilder.hxx>
-#include <MeshVS_HArray1OfSequenceOfInteger.hxx>
-#include <MeshVS_Buffer.hxx>
-#include <MeshVS_Tool.hxx>
+#include <MeshVS_NodalColorPrsBuilder.hxx>
#include <MeshVS_SymmetricPairHasher.hxx>
-
-#include <gp_Pnt.hxx>
-#include <Image_PixMap.hxx>
-#include <Graphic3d_Texture2D.hxx>
-#include <Graphic3d_TypeOfTextureMode.hxx>
-#include <Standard_Type.hxx>
+#include <MeshVS_Tool.hxx>
+#include <NCollection_Map.hxx>
+#include <NCollection_Vector.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_LineAspect.hxx>
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_Root.hxx>
+#include <Prs3d_ShadingAspect.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
#include <Quantity_Array1OfColor.hxx>
-#include <Aspect_SequenceOfColor.hxx>
+#include <Quantity_Color.hxx>
+#include <Standard_Type.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+#include <TColStd_HPackedMapOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
-#include <NCollection_Map.hxx>
-#include <NCollection_Vector.hxx>
+IMPLEMENT_STANDARD_RTTIEXT(MeshVS_NodalColorPrsBuilder,MeshVS_PrsBuilder)
/*
Class : MeshVS_ImageTexture2D
public:
- DEFINE_STANDARD_RTTI(MeshVS_ImageTexture2D, Graphic3d_Texture2D)
+ DEFINE_STANDARD_RTTI_INLINE(MeshVS_ImageTexture2D,Graphic3d_Texture2D)
};
DEFINE_STANDARD_HANDLE (MeshVS_ImageTexture2D, Graphic3d_Texture2D)
}
// Draw faces with nodal color
- // OCC20644 Use "plastic" material as it is "non-physic" and so it is easier
- // to get the required colors (see TelUpdateMaterial() function in OpenGl_attri.c)
- Graphic3d_MaterialAspect aMaterial[ 2 ];
- aMaterial[ 0 ] = Graphic3d_MaterialAspect( Graphic3d_NOM_PLASTIC );
- aMaterial[ 1 ] = Graphic3d_MaterialAspect( Graphic3d_NOM_PLASTIC );
- Standard_Integer i;
- for ( i = 0; i < 2; i++ )
+ // OCC20644 Use "plastic" material as it is "non-physic" and so it is easier to get the required colors
+ Graphic3d_MaterialAspect aMaterial[2] = { Graphic3d_NOM_PLASTIC, Graphic3d_NOM_PLASTIC };
+ for (Standard_Integer i = 0; i < 2; ++i)
{
+ aMaterial[i].SetSpecularColor (Quantity_NOC_BLACK);
+ aMaterial[i].SetEmissiveColor (Quantity_NOC_BLACK);
if ( !IsReflect )
{
- aMaterial[ i ].SetReflectionModeOff( Graphic3d_TOR_SPECULAR );
- aMaterial[ i ].SetReflectionModeOff( Graphic3d_TOR_AMBIENT );
- aMaterial[ i ].SetReflectionModeOff( Graphic3d_TOR_DIFFUSE );
- aMaterial[ i ].SetReflectionModeOff( Graphic3d_TOR_EMISSION );
+ aMaterial[i].SetAmbientColor (Quantity_NOC_BLACK);
+ aMaterial[i].SetDiffuseColor (Quantity_NOC_BLACK);
}
else{
// OCC20644 Using the material with reflection properties same as in
// is done by TelUpdateMaterial().
// 0.5 is used to have the colors in 3D maximally similar to those in the color scale.
// This is possible when the sum of all coefficient is equal to 1.
- 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)));
}
-
- }
-
+ }
// Create array of polygons for interior presentation of faces and volumes
Handle(Graphic3d_ArrayOfPolygons) aCPolyArr = new Graphic3d_ArrayOfPolygons
gp_Dir aDefNorm( 0., 0., 1. );
// Prepare for scaling the incoming colors
- Standard_Real anColorRatio = aMaterial[0].Ambient();
+ const Standard_Real anColorRatio = !IsReflect ? 0.44f : 0.5f;
for (it.Reset(); it.More(); it.Next())
{
Quantity_Color aNColor;
Standard_Boolean isValid = Standard_True;
- Standard_Integer i;
if (myUseTexture)
{
- for (i = 1; i <= NbNodes && isValid; ++i)
- isValid = myTextureCoords.IsBound (aNodes (i));
+ for (Standard_Integer k = 1; k <= NbNodes && isValid; ++k)
+ isValid = myTextureCoords.IsBound (aNodes (k));
}
else
{
- for (i = 1; i <= NbNodes && isValid; ++i)
- isValid = GetColor (aNodes (i), aNColor);
+ for (Standard_Integer k = 1; k <= NbNodes && isValid; ++k)
+ isValid = GetColor (aNodes (k), aNColor);
}
if (!isValid)
// Aspect_InteriorStyle aStyle;
// Standard_Integer aStyleInt;
Aspect_TypeOfLine anEdgeType = Aspect_TOL_SOLID;
- Standard_Integer anEdgeInt;
- Standard_Real anEdgeWidth;
+ Standard_Real anEdgeWidth = 1.0;
Quantity_Color anInteriorColor;
Quantity_Color anEdgeColor, aLineColor;
Standard_Boolean aShowEdges = Standard_True;
aDrawer->GetDouble ( MeshVS_DA_EdgeWidth, anEdgeWidth );
aDrawer->GetBoolean( MeshVS_DA_ShowEdges, aShowEdges );
+ Standard_Integer anEdgeInt = Aspect_TOL_SOLID;
if ( aDrawer->GetInteger ( MeshVS_DA_EdgeType, anEdgeInt ) )
anEdgeType = (Aspect_TypeOfLine) anEdgeInt;
Handle(Graphic3d_AspectLine3d) anLAsp =
new Graphic3d_AspectLine3d( anEdgeColor, anEdgeType, anEdgeWidth );
- Prs3d_Root::NewGroup ( Prs );
- Handle(Graphic3d_Group) aGroup1 = Prs3d_Root::CurrentGroup ( Prs );
+ Handle(Graphic3d_Group) aGroup1 = Prs3d_Root::NewGroup (Prs);
+
+ Standard_Boolean toSupressBackFaces = Standard_False;
+ aDrawer->GetBoolean (MeshVS_DA_SupressBackFaces, toSupressBackFaces);
+ aGroup1->SetClosed (toSupressBackFaces == Standard_True);
aGroup1->SetPrimitivesAspect( anAsp );
aGroup1->AddPrimitiveArray( aFaceTriangles /*aCPolyArr*/ );
Prs3d_Root::NewGroup ( Prs );
Handle(Graphic3d_Group) aGroup2 = Prs3d_Root::CurrentGroup ( Prs );
- anAsp->SetEdgeOff();
- anAsp->SetTextureMapOff();
- aGroup2->SetPrimitivesAspect( anAsp );
+ Handle(Graphic3d_AspectFillArea3d) anAspCopy = new Graphic3d_AspectFillArea3d (*anAsp);
+ anAspCopy->SetTextureMapOff();
+ aGroup2->SetPrimitivesAspect( anAspCopy );
aGroup2->SetPrimitivesAspect( anLAsp );
aGroup2->AddPrimitiveArray( anEdgeSegments );
- anAsp->SetEdgeOn();
}
}
// create and fill image with colors
Handle(Image_PixMap) anImage = new Image_PixMap();
- if (!anImage->InitTrash (Image_PixMap::ImgRGBA, Standard_Size(getNearestPow2 (aColorsNb)), 2))
+ if (!anImage->InitTrash (Image_Format_RGBA, Standard_Size(getNearestPow2 (aColorsNb)), 2))
{
return NULL;
}