1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

0029902: Data Exchange, XCAF - provide extended Material definition for visualization purposes

Introduced new attribute XCAFDoc_VisMaterial storing visualization material definition.

XCAFPrs_Style has been exteneded Material() property.
XCAFPrs_AISObject::DispatchStyles() maps new XCAFPrs_Style::Material() property onto graphics aspects.

RWGltf_GltfJsonParser and RWObj_CafReader now put Material definition into XCAF document instead of a color label.
RWGltf_MaterialMetallicRoughness - added missing properties AlphaMode, AlphaCutOff and IsDoubleSided;
fixed default values in constructor for Metallic and Roughness.

Added commands XGetAllVisMaterials, XGetVisMaterial, XAddVisMaterial,
XRemoveVisMaterial, XSetVisMaterial, XUnsetVisMaterial for working with
new visualization materials table in the document.
This commit is contained in:
kgv
2019-07-03 11:28:26 +03:00
committed by apn
parent ba00aab7a0
commit a4815d5509
49 changed files with 3252 additions and 256 deletions

View File

@@ -20,6 +20,7 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Quantity_ColorRGBAHasher.hxx>
#include <XCAFDoc_VisMaterial.hxx>
//! Represents a set of styling settings applicable to a (sub)shape
class XCAFPrs_Style
@@ -31,6 +32,21 @@ public:
//! Empty constructor - colors are unset, visibility is TRUE.
Standard_EXPORT XCAFPrs_Style();
//! Return TRUE if style is empty - does not override any properties.
Standard_Boolean IsEmpty() const
{
return !myHasColorSurf
&& !myHasColorCurv
&& myMaterial.IsNull()
&& myIsVisible;
}
//! Return material.
const Handle(XCAFDoc_VisMaterial)& Material() const { return myMaterial; }
//! Set material.
void SetMaterial (const Handle(XCAFDoc_VisMaterial)& theMaterial) { myMaterial = theMaterial; }
//! Return TRUE if surface color has been defined.
Standard_Boolean IsSetColorSurf() const { return myHasColorSurf; }
@@ -82,6 +98,7 @@ public:
return myHasColorSurf == theOther.myHasColorSurf
&& myHasColorCurv == theOther.myHasColorCurv
&& myMaterial == theOther.myMaterial
&& (!myHasColorSurf || myColorSurf == theOther.myColorSurf)
&& (!myHasColorCurv || myColorCurv == theOther.myColorCurv);
}
@@ -112,6 +129,10 @@ public:
{
aHashCode = aHashCode ^ Quantity_ColorHasher::HashCode (theStyle.myColorCurv, theUpperBound);
}
if (!theStyle.myMaterial.IsNull())
{
aHashCode = aHashCode ^ ::HashCode (theStyle.myMaterial, theUpperBound);
}
return ::HashCode (aHashCode, theUpperBound);
}
@@ -126,6 +147,7 @@ public:
protected:
Handle(XCAFDoc_VisMaterial) myMaterial;
Quantity_ColorRGBA myColorSurf;
Quantity_Color myColorCurv;
Standard_Boolean myHasColorSurf;