File indexing completed on 2026-09-18 09:22:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _XCAFDoc_VisMaterialCommon_HeaderFile
0015 #define _XCAFDoc_VisMaterialCommon_HeaderFile
0016
0017 #include <NCollection_Vec2.hxx>
0018
0019 #include <Standard_TypeDef.hxx>
0020
0021 #include <NCollection_Vec3.hxx>
0022
0023 #include <NCollection_Vec4.hxx>
0024
0025 #include <NCollection_Mat4.hxx>
0026 #include <Image_Texture.hxx>
0027 #include <Quantity_ColorRGBA.hxx>
0028 #include <Standard_Dump.hxx>
0029
0030 class Graphic3d_Aspects;
0031 class Graphic3d_MaterialAspect;
0032
0033
0034 struct XCAFDoc_VisMaterialCommon
0035 {
0036 occ::handle<Image_Texture> DiffuseTexture;
0037 Quantity_Color AmbientColor;
0038 Quantity_Color DiffuseColor;
0039 Quantity_Color SpecularColor;
0040 Quantity_Color EmissiveColor;
0041 float Shininess;
0042
0043 float Transparency;
0044
0045 bool IsDefined;
0046
0047
0048 XCAFDoc_VisMaterialCommon()
0049 : AmbientColor(0.1, 0.1, 0.1, Quantity_TOC_RGB),
0050 DiffuseColor(0.8, 0.8, 0.8, Quantity_TOC_RGB),
0051 SpecularColor(0.2, 0.2, 0.2, Quantity_TOC_RGB),
0052 EmissiveColor(0.0, 0.0, 0.0, Quantity_TOC_RGB),
0053 Shininess(1.0f),
0054 Transparency(0.0f),
0055 IsDefined(true)
0056 {
0057 }
0058
0059
0060 bool IsEqual(const XCAFDoc_VisMaterialCommon& theOther) const
0061 {
0062 if (&theOther == this)
0063 {
0064 return true;
0065 }
0066 else if (theOther.IsDefined != IsDefined)
0067 {
0068 return false;
0069 }
0070 else if (!IsDefined)
0071 {
0072 return true;
0073 }
0074
0075 return theOther.DiffuseTexture == DiffuseTexture && theOther.AmbientColor == AmbientColor
0076 && theOther.DiffuseColor == DiffuseColor && theOther.SpecularColor == SpecularColor
0077 && theOther.EmissiveColor == EmissiveColor && theOther.Shininess == Shininess
0078 && theOther.Transparency == Transparency;
0079 }
0080
0081
0082 void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const
0083 {
0084 OCCT_DUMP_CLASS_BEGIN(theOStream, XCAFDoc_VisMaterialCommon)
0085
0086 OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, DiffuseTexture.get())
0087
0088 OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, &AmbientColor)
0089 OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, &DiffuseColor)
0090 OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, &SpecularColor)
0091 OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, &EmissiveColor)
0092
0093 OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, Shininess)
0094 OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, Transparency)
0095 OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, IsDefined)
0096 }
0097 };
0098
0099 #endif