
Fri, 10/29/2010 - 06:36
Forums:
Hello.
I tried AIS_Triangulation at OCC6.4.
it display polygons first enough,but it works only as a wireframe.
means it shows up only when SetDisplayMode(AIS_WireFrame);
so, I can't set the FrontMaterial or BackMaterial.
like below.
->Attributes()->ShadingAspect()->Aspect()->SetFrontMaterial(Graphic3d_NOM_GOLD);
->Attributes()->ShadingAspect()->Aspect()->SetBackMaterial(Graphic3d_NOM_JADE);
does anybody knows how to set Front and Back material of AIS_Triangulation.
thank you.
Wed, 09/25/2013 - 18:01
AIS_Triangulation currently supports only display mode 0 (=AIS_WireFrame).
However, the triangulation can be displayed with shading by setting the shading aspect as you can see in the implementation of the Draw command VDrawSphere in ViewerTest_ObjectCommands.cxx.
Tue, 10/08/2013 - 03:07
Strange because I am having problems setting it to wireframe mode, shading works great.
Tue, 10/08/2013 - 13:46
Yes, you are right it is shaded. I meant that AIS_Triangulation supports only one mode, which is '0' in its Compute method (see AIS_Triangulation::Compute).
According to the enumeration AIS_DisplayMode (defined in AIS_DisplayMode.hxx), mode '0' is called AIS_WireFrame, which is not really fitting here. Probably, this enumeration is meant only for AIS_Shape, or what do OCCT developers say about it?
Regarding the display of edges, did you have a look at the function VDrawSphere in ViewerTest_ObjectCommands.cxx? In the end of the function visual aspects are defined.
Using the first argument of the constructor of Graphic3d_AspectFillArea3d you can define if the triangulation should be shaded or not.
You can use the SetEdgeOn() / SetEdgeOff() methods of Graphic3d_AspectFillArea3d to control the display of edges.
Here is a code excerpt from the function VDrawSphere:
...
Handle(Graphic3d_AspectFillArea3d) anAspect
= new Graphic3d_AspectFillArea3d (Aspect_IS_SOLID,
Quantity_NOC_RED,
Quantity_NOC_YELLOW,
Aspect_TOL_SOLID,
1.0,
aMat,
aMat);
Handle(Prs3d_ShadingAspect) aShAsp = new Prs3d_ShadingAspect();
if (toShowEdges)
{
anAspect->SetEdgeOn();
}
else
{
anAspect->SetEdgeOff();
}
aShAsp->SetAspect (anAspect);
aShape->Attributes()->SetShadingAspect (aShAsp);
Regards
Tue, 10/08/2013 - 15:47
Thank you very much for your response. After I posted I looked at AIS_Triangulation::Compute and verified that only Mode '0' is implemented and then figured out AIS_Wireframe is mode 0.
I was thinking of deriving my own class from AIS_Triangulation and then overriding the compute method. Or just deriving directly from AIS_Object and implement both rendering modes.
Wed, 10/09/2013 - 21:28
I set ->SetEdgeOn(); but how do I change the Aspect_IS_SOLID parameter (Aspect_IS_HOLLOW)?
Thu, 10/10/2013 - 13:32
Yes, or Aspect_IS_EMPTY, depending on what you want it to be. Try it out!
Regards
Fri, 10/11/2013 - 18:48
Just too say that this solution is working very nicely. Thanks once again.