File indexing completed on 2025-01-18 10:05:34
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 <Graphic3d_Vec.hxx>
0018 #include <Image_Texture.hxx>
0019 #include <Quantity_ColorRGBA.hxx>
0020 #include <Standard_Dump.hxx>
0021
0022 class Graphic3d_Aspects;
0023 class Graphic3d_MaterialAspect;
0024
0025
0026 struct XCAFDoc_VisMaterialCommon
0027 {
0028 Handle(Image_Texture) DiffuseTexture;
0029 Quantity_Color AmbientColor;
0030 Quantity_Color DiffuseColor;
0031 Quantity_Color SpecularColor;
0032 Quantity_Color EmissiveColor;
0033 Standard_ShortReal Shininess;
0034 Standard_ShortReal Transparency;
0035 Standard_Boolean IsDefined;
0036
0037
0038 XCAFDoc_VisMaterialCommon()
0039 : AmbientColor (0.1, 0.1, 0.1, Quantity_TOC_RGB),
0040 DiffuseColor (0.8, 0.8, 0.8, Quantity_TOC_RGB),
0041 SpecularColor(0.2, 0.2, 0.2, Quantity_TOC_RGB),
0042 EmissiveColor(0.0, 0.0, 0.0, Quantity_TOC_RGB),
0043 Shininess (1.0f),
0044 Transparency (0.0f),
0045 IsDefined (Standard_True) {}
0046
0047
0048 Standard_Boolean IsEqual (const XCAFDoc_VisMaterialCommon& theOther) const
0049 {
0050 if (&theOther == this)
0051 {
0052 return true;
0053 }
0054 else if (theOther.IsDefined != IsDefined)
0055 {
0056 return false;
0057 }
0058 else if (!IsDefined)
0059 {
0060 return true;
0061 }
0062
0063 return theOther.DiffuseTexture == DiffuseTexture
0064 && theOther.AmbientColor == AmbientColor
0065 && theOther.DiffuseColor == DiffuseColor
0066 && theOther.SpecularColor == SpecularColor
0067 && theOther.EmissiveColor == EmissiveColor
0068 && theOther.Shininess == Shininess
0069 && theOther.Transparency == Transparency;
0070 }
0071
0072
0073 void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const
0074 {
0075 OCCT_DUMP_CLASS_BEGIN (theOStream, XCAFDoc_VisMaterialCommon)
0076
0077 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, DiffuseTexture.get())
0078
0079 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &AmbientColor)
0080 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &DiffuseColor)
0081 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &SpecularColor)
0082 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &EmissiveColor)
0083
0084 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Shininess)
0085 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Transparency)
0086 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsDefined)
0087 }
0088 };
0089
0090 #endif