1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0032188: Visualization, Graphic3d_Aspects - define backface culling using Graphic3d_TypeOfBackfacingModel

Graphic3d_Aspects::ToSuppressBackFaces() bool flag has been replaced by
Graphic3d_Aspects::FaceCulling() property defined by Graphic3d_TypeOfBackfacingModel enumeration.

Graphic3d_TypeOfBackfacingModel_Auto corresponds to old ToSuppressBackFaces()==TRUE;
Graphic3d_TypeOfBackfacingModel_DoubleSided corresponds to old ToSuppressBackFaces()==FALSE;
Graphic3d_TypeOfBackfacingModel_BackCulled allows enabling back face culling regardless of Graphic3d_Group::IsClosed() flag.

XCAFDoc_VisMaterial::IsDoubleSided() bool flag has been replaced by
XCAFDoc_VisMaterial::FaceCulling() property defined by Graphic3d_TypeOfBackfacingModel enumeration.

glTF reader now maps "doubleSided" material flag into
Graphic3d_TypeOfBackfacingModel_BackCulled (forced back face culling) and
Graphic3d_TypeOfBackfacingModel_Auto (e.g. practically doubleSided as there is no closed/open info in glTF).

glTF writer by default writes materials as "doubleSided" save the Graphic3d_TypeOfBackfacingModel_BackCulled property set
(in future, extra logic might written for automatically defining singleSided materials for Solid B-Rep objects).

Removed obsolete unused types V3d_TypeOfPickCamera, V3d_TypeOfPickLight, V3d_TypeOfRepresentation, and V3d_Coordinate.
Deprecated types V3d_TypeOfBackfacingModel, V3d_TypeOfLight, and V3d_TypeOfShadingModel.
This commit is contained in:
kgv
2021-03-01 23:25:21 +03:00
committed by bugmaster
parent 42ddd0028c
commit 7fd4958d45
28 changed files with 202 additions and 255 deletions

View File

@@ -198,7 +198,7 @@ void AIS_ViewCube::setDefaultAttributes()
myDrawer->TextAspect()->SetHeight (16.0);
myDrawer->TextAspect()->Aspect()->SetTextZoomable (true); // the whole object is drawn within transformation-persistence
// this should be forced back-face culling regardless Closed flag
myDrawer->TextAspect()->Aspect()->SetSuppressBackFaces (true);
myDrawer->TextAspect()->Aspect()->SetFaceCulling (Graphic3d_TypeOfBackfacingModel_BackCulled);
Graphic3d_MaterialAspect aMat (Graphic3d_NameOfMaterial_UserDefined);
aMat.SetColor (Quantity_NOC_WHITE);
@@ -207,7 +207,7 @@ void AIS_ViewCube::setDefaultAttributes()
const Handle(Graphic3d_AspectFillArea3d)& aShading = myDrawer->ShadingAspect()->Aspect();
aShading->SetInteriorStyle (Aspect_IS_SOLID);
// this should be forced back-face culling regardless Closed flag
aShading->SetSuppressBackFaces (true);
aShading->SetFaceCulling (Graphic3d_TypeOfBackfacingModel_BackCulled);
aShading->SetInteriorColor (aMat.Color());
aShading->SetFrontMaterial (aMat);
myDrawer->SetFaceBoundaryDraw (false);
@@ -671,7 +671,7 @@ void AIS_ViewCube::Compute (const Handle(PrsMgr_PresentationManager)& ,
{
Handle(Graphic3d_Group) aGroupSides = thePrs->NewGroup();
aGroupSides->SetClosed (true); // should be replaced by forced back-face culling aspect
aGroupSides->SetClosed (true);
aGroupSides->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroupSides->AddPrimitiveArray (aTris);
}