MeshVS_MeshPrsBuilder::DrawArrays now sets IsClosed flag to group according to MeshVS_DA_SupressBackFaces attribute in MeshVS_Drawer
theFillAsp->Values( aStyle, anIntColor, aBackColor, anEdgeColor, aType, aWidth );
+ Standard_Boolean isSupressBackFaces = Standard_False;
+ Handle(MeshVS_Drawer) aDrawer = GetDrawer();
+ if (!aDrawer.IsNull())
+ {
+ aDrawer->GetBoolean (MeshVS_DA_SupressBackFaces, isSupressBackFaces);
+ }
+
if ( IsPolygons && theFillAsp->FrontMaterial().Transparency()<0.01 )
{
Prs3d_Root::NewGroup ( Prs );
else
theFillAsp->SetDistinguishOff();
+ aGroup->SetClosed (isSupressBackFaces);
+ Handle(Graphic3d_AspectFillArea3d) aFillAsp = new Graphic3d_AspectFillArea3d (*(theFillAsp.operator->()));
+ if (isSupressBackFaces)
+ {
+ aFillAsp->SuppressBackFace();
+ }
+ aGroup->SetPrimitivesAspect (aFillAsp);
+
if( IsFacePolygons )
{
- aGroup->SetPrimitivesAspect ( theFillAsp );
aGroup->AddPrimitiveArray ( thePolygons );
}
if( IsVolumePolygons )
{
- Handle( Graphic3d_AspectFillArea3d ) aCullFillAsp =
- new Graphic3d_AspectFillArea3d( *( theFillAsp.operator->() ) );
-
- Standard_Boolean isSupressBackFaces = Standard_False;
- Handle( MeshVS_Drawer ) aDrawer = GetDrawer();
- if (!aDrawer.IsNull())
- aDrawer->GetBoolean ( MeshVS_DA_SupressBackFaces, isSupressBackFaces );
-
- if (isSupressBackFaces)
- aCullFillAsp->SuppressBackFace();
-
- aGroup->SetPrimitivesAspect ( aCullFillAsp );
aGroup->AddPrimitiveArray ( theVolumesInShad );
}
}
else
theFillAsp->SetDistinguishOff();
+ aGroup->SetClosed (isSupressBackFaces);
+ Handle(Graphic3d_AspectFillArea3d) aFillAsp = new Graphic3d_AspectFillArea3d (*(theFillAsp.operator->()));
+ if (isSupressBackFaces)
+ {
+ aFillAsp->SuppressBackFace();
+ }
+ aGroup->SetPrimitivesAspect (aFillAsp);
+
if( IsFacePolygons )
{
- aGroup->SetPrimitivesAspect ( theFillAsp );
aGroup->AddPrimitiveArray ( thePolygons );
}
if( IsVolumePolygons )
{
- Handle( Graphic3d_AspectFillArea3d ) aCullFillAsp =
- new Graphic3d_AspectFillArea3d( *( theFillAsp.operator->() ) );
-
- Standard_Boolean isSupressBackFaces = Standard_False;
- Handle( MeshVS_Drawer ) aDrawer = GetDrawer();
- if (!aDrawer.IsNull())
- aDrawer->GetBoolean ( MeshVS_DA_SupressBackFaces, isSupressBackFaces );
-
- if (isSupressBackFaces)
- aCullFillAsp->SuppressBackFace();
-
- aGroup->SetPrimitivesAspect ( aCullFillAsp );
aGroup->AddPrimitiveArray ( theVolumesInShad );
}
}
}
return 0;
}
+
+//-----------------------------------------------------------------------------
+static Standard_Integer closed (Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
+{
+ if (theArgc < 3)
+ {
+ theDI << "Wrong number of parameters." << "\n";
+ }
+ else
+ {
+ Handle(MeshVS_Mesh) aMesh = getMesh (theArgv[1], theDI);
+ if (!aMesh.IsNull())
+ {
+ Standard_Integer aFlag = Draw::Atoi (theArgv[2]);
+ aMesh->GetDrawer()->SetBoolean (MeshVS_DA_SupressBackFaces, aFlag);
+
+ Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext();
+ if (aContext.IsNull())
+ {
+ theDI << "The context is null" << "\n";
+ }
+ else
+ {
+ aContext->Redisplay (aMesh);
+ }
+ }
+ }
+ return 0;
+}
+
//-----------------------------------------------------------------------------
static Standard_Integer mdisplay
theCommands.Add ("meshlinkcolor", "change MeshVS_Mesh line color", __FILE__, linecolor, g );
theCommands.Add ("meshmat", "change MeshVS_Mesh material and transparency", __FILE__, meshmat, g );
theCommands.Add ("meshshrcoef", "change MeshVS_Mesh shrink coeff", __FILE__, shrink, g );
+ theCommands.Add ("meshclosed", "meshclosed meshname (0/1) \nChange MeshVS_Mesh drawing mode. 0 - not closed object, 1 - closed object", __FILE__, closed, g);
theCommands.Add ("meshshow", "display MeshVS_Mesh object", __FILE__, mdisplay, g );
theCommands.Add ("meshhide", "erase MeshVS_Mesh object", __FILE__, merase, g );
theCommands.Add ("meshhidesel", "hide selected entities", __FILE__, hidesel, g );
--- /dev/null
+puts "============="
+puts ""
+puts "============="
+puts ""
+
+##############################################################################
+## Drawing mesh as closed object.
+##############################################################################
+
+pload XDE
+
+set anImage1 $imagedir/${casename}_Opened.png
+set anImage2 $imagedir/${casename}_Closed.png
+
+vinit
+meshfromstl aMesh [locate_data_file sh1.stl]
+vsetdispmode aMesh 2
+vright
+vfit
+
+vclipplane create aClipPlane
+vclipplane change aClipPlane equation 0 1 0 0
+vclipplane change aClipPlane capping on
+vclipplane change aClipPlane capping color 0.9 0.9 0.9
+vclipplane set aClipPlane object aMesh
+
+meshclosed aMesh 0
+vdump ${anImage1}
+
+meshclosed aMesh 1
+vdump ${anImage2}