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

@@ -486,8 +486,13 @@ void RWGltf_GltfMaterialMap::DefineMaterial (const XCAFPrs_Style& theStyle,
}
myWriter->EndObject();
// export automatic culling as doubleSided material;
// extra preprocessing is necessary to automatically export
// Solids with singleSided material and Shells with doubleSided material,
// as both may share the same material having "auto" flag
if (theStyle.Material().IsNull()
|| theStyle.Material()->IsDoubleSided())
|| theStyle.Material()->FaceCulling() == Graphic3d_TypeOfBackfacingModel_Auto
|| theStyle.Material()->FaceCulling() == Graphic3d_TypeOfBackfacingModel_DoubleSided)
{
myWriter->Key ("doubleSided");
myWriter->Bool (true);