Back facing question

Hello community.

In my application, I have a custom treatment to generate back faces as single shapes because front and back faces should be distinguished as single entities when the user select a front / back face of a surface shape.

Thus I specified my view calling the "SetBackFacingModel" method with "Graphic3d_TypeOfBackfacingModel_BackCulled".

The problem now is that I wanted to add an AIS_Manipulator object, but it uses disks made with "Prs3d_ToolDisk" which is a surface and requires back faces to be not culled.

Is there a way to leave the view with the "Graphic3d_TypeOfBackfacingModel_BackCulled" parameter, but inform the AIS_Manipulator that I want him to display back faces (whereas the best in my opinion should have been that the AIS_Manipulator use a torus instead of a disk).

I tried to create a Graphic3d_AspectFillArea3d in which I called SetFaceCulling(Graphic3d_TypeOfBackfacingModel_DoubleSided) that i sent to the "Attributes()->SetBasicFillAreaAspect(...)" method of my manipulator without success.

Thank you for your answers ❤

gkv311 n's picture

You have forced specific culling mode for entre View and now trying to replace it within AIS_Manipulator. Instead, you are supposed to change culling mode for your AIS_Shape (or override defaults within AIS_InteractiveContext).

Guillaume CHAFFAROD's picture

OK, I already tried to set the culling mode for my AIS object without success, but maybe I didn't do the right way.
I use a XCAFPrs_AISObject and, to define colors, a XCAFDoc_ColorTool for each TopoDS_Face of the TopoDS_Shape drawn.

gkv311 n's picture

So how exactly you are trying to apply aspects to your XCAFPrs_AISObject? Before or after presentation was computed?

Handle(AIS_InteractiveContext) theCtx = ...;
Handle(XCAFPrs_AISObject) aPrs = new XCAFPrs_AISObject(...);

aPrs->Attributes()->SetupOwnShadingAspect(theCtx->DefaultDrawer());
aPrs->Attributes()->ShadingAspect()->Aspect()
  ->SetFaceCulling(Graphic3d_TypeOfBackfacingModel_FrontCulled);

theCtx->Display(aPrs, AIS_Shaded, 0, false);

In Draw:

pload XDE OCAF VISUALIZATION
ReadStep D as1-oc-214.stp
vinit View1
XDisplay D -dispMode 1 -explore 0
vfit
vaspects D:as1 -faceCulling front
vdisplay D:as1 -redisplay

Note that if you are using XCAFDoc_VisMaterial, you'll need to set XCAFDoc_VisMaterial::FaceCulling() property instead.

Guillaume CHAFFAROD's picture

Waaah, it does the job !! I didn't know I need to specify the face culling parameter on the shading aspect. Thank you very much !! You're the man (or the woman) ;)