diff --git a/src/XCAFDoc/XCAFDoc_VisMaterial.cxx b/src/XCAFDoc/XCAFDoc_VisMaterial.cxx index 847289eb09..9e223b9f51 100644 --- a/src/XCAFDoc/XCAFDoc_VisMaterial.cxx +++ b/src/XCAFDoc/XCAFDoc_VisMaterial.cxx @@ -40,7 +40,8 @@ XCAFDoc_VisMaterial::XCAFDoc_VisMaterial() myAlphaCutOff (0.5f), myFaceCulling (Graphic3d_TypeOfBackfacingModel_Auto) { - // + myPbrMat .IsDefined = false; + myCommonMat.IsDefined = false; } //======================================================================= diff --git a/src/XCAFDoc/XCAFDoc_VisMaterial.hxx b/src/XCAFDoc/XCAFDoc_VisMaterial.hxx index a94a81a507..92456cf631 100644 --- a/src/XCAFDoc/XCAFDoc_VisMaterial.hxx +++ b/src/XCAFDoc/XCAFDoc_VisMaterial.hxx @@ -69,29 +69,41 @@ public: //! Fill in graphic aspects. Standard_EXPORT void FillAspect (const Handle(Graphic3d_Aspects)& theAspect) const; - //! Return TRUE if metal-roughness PBR material is defined. + //! Return TRUE if metal-roughness PBR material is defined; FALSE by default. Standard_Boolean HasPbrMaterial() const { return myPbrMat.IsDefined; } //! Return metal-roughness PBR material. + //! Note that default constructor creates an empty material (@sa XCAFDoc_VisMaterialPBR::IsDefined). const XCAFDoc_VisMaterialPBR& PbrMaterial() const { return myPbrMat; } //! Setup metal-roughness PBR material. Standard_EXPORT void SetPbrMaterial (const XCAFDoc_VisMaterialPBR& theMaterial); //! Setup undefined metal-roughness PBR material. - void UnsetPbrMaterial() { SetPbrMaterial (XCAFDoc_VisMaterialPBR()); } + void UnsetPbrMaterial() + { + XCAFDoc_VisMaterialPBR anEmpty; + anEmpty.IsDefined = false; + SetPbrMaterial (anEmpty); + } - //! Return TRUE if common material is defined. + //! Return TRUE if common material is defined; FALSE by default. Standard_Boolean HasCommonMaterial() const { return myCommonMat.IsDefined; } //! Return common material. + //! Note that default constructor creates an empty material (@sa XCAFDoc_VisMaterialCommon::IsDefined). const XCAFDoc_VisMaterialCommon& CommonMaterial() const { return myCommonMat; } //! Setup common material. Standard_EXPORT void SetCommonMaterial (const XCAFDoc_VisMaterialCommon& theMaterial); //! Setup undefined common material. - void UnsetCommonMaterial() { SetCommonMaterial (XCAFDoc_VisMaterialCommon()); } + void UnsetCommonMaterial() + { + XCAFDoc_VisMaterialCommon anEmpty; + anEmpty.IsDefined = false; + SetCommonMaterial (anEmpty); + } //! Return base color. Standard_EXPORT Quantity_ColorRGBA BaseColor() const; diff --git a/src/XCAFDoc/XCAFDoc_VisMaterialCommon.hxx b/src/XCAFDoc/XCAFDoc_VisMaterialCommon.hxx index 22cb88a336..88148f2dfa 100644 --- a/src/XCAFDoc/XCAFDoc_VisMaterialCommon.hxx +++ b/src/XCAFDoc/XCAFDoc_VisMaterialCommon.hxx @@ -33,7 +33,7 @@ struct XCAFDoc_VisMaterialCommon Quantity_Color EmissiveColor; //!< emission color Standard_ShortReal Shininess; //!< shininess value Standard_ShortReal Transparency; //!< transparency value within [0, 1] range with 0 meaning opaque - Standard_Boolean IsDefined; //!< defined flag; FALSE by default + Standard_Boolean IsDefined; //!< defined flag; TRUE by default //! Empty constructor. XCAFDoc_VisMaterialCommon() @@ -43,7 +43,7 @@ struct XCAFDoc_VisMaterialCommon EmissiveColor(0.0, 0.0, 0.0, Quantity_TOC_RGB), Shininess (1.0f), Transparency (0.0f), - IsDefined (Standard_False) {} + IsDefined (Standard_True) {} //! Compare two materials. Standard_Boolean IsEqual (const XCAFDoc_VisMaterialCommon& theOther) const diff --git a/src/XCAFDoc/XCAFDoc_VisMaterialPBR.hxx b/src/XCAFDoc/XCAFDoc_VisMaterialPBR.hxx index 39bd90abfb..123a815a87 100644 --- a/src/XCAFDoc/XCAFDoc_VisMaterialPBR.hxx +++ b/src/XCAFDoc/XCAFDoc_VisMaterialPBR.hxx @@ -33,7 +33,7 @@ struct XCAFDoc_VisMaterialPBR Standard_ShortReal Metallic; //!< metalness (or scale factor to the texture) within range [0.0, 1.0]; 1.0 by default Standard_ShortReal Roughness; //!< roughness (or scale factor to the texture) within range [0.0, 1.0]; 1.0 by default Standard_ShortReal RefractionIndex; //!< IOR (index of refraction) within range [1.0, 3.0]; 1.5 by default - Standard_Boolean IsDefined; //!< defined flag; FALSE by default + Standard_Boolean IsDefined; //!< defined flag; TRUE by default //! Empty constructor. XCAFDoc_VisMaterialPBR() @@ -42,7 +42,7 @@ struct XCAFDoc_VisMaterialPBR Metallic (1.0f), Roughness (1.0f), RefractionIndex (1.5f), - IsDefined (Standard_False) {} + IsDefined (Standard_True) {} //! Compare two materials. Standard_Boolean IsEqual (const XCAFDoc_VisMaterialPBR& theOther) const