File indexing completed on 2026-09-27 09:17:51
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _Graphic3d_ZLayerSettings_HeaderFile
0015 #define _Graphic3d_ZLayerSettings_HeaderFile
0016
0017 #include <gp_XYZ.hxx>
0018 #include <TopLoc_Datum3D.hxx>
0019 #include <Graphic3d_LightSet.hxx>
0020 #include <Graphic3d_PolygonOffset.hxx>
0021 #include <Precision.hxx>
0022 #include <Standard_Dump.hxx>
0023 #include <TCollection_AsciiString.hxx>
0024
0025
0026 struct Graphic3d_ZLayerSettings
0027 {
0028
0029
0030 Graphic3d_ZLayerSettings()
0031 : myCullingDistance(Precision::Infinite()),
0032 myCullingSize(Precision::Infinite()),
0033 myIsImmediate(false),
0034 myToRaytrace(true),
0035 myUseEnvironmentTexture(true),
0036 myToEnableDepthTest(true),
0037 myToEnableDepthWrite(true),
0038 myToClearDepth(true),
0039 myToRenderInDepthPrepass(true)
0040 {
0041 }
0042
0043
0044 const TCollection_AsciiString& Name() const { return myName; }
0045
0046
0047 void SetName(const TCollection_AsciiString& theName) { myName = theName; }
0048
0049
0050
0051
0052 const occ::handle<Graphic3d_LightSet>& Lights() const { return myLights; }
0053
0054
0055 void SetLights(const occ::handle<Graphic3d_LightSet>& theLights) { myLights = theLights; }
0056
0057
0058 const gp_XYZ& Origin() const { return myOrigin; }
0059
0060
0061 const occ::handle<TopLoc_Datum3D>& OriginTransformation() const { return myOriginTrsf; }
0062
0063
0064 void SetOrigin(const gp_XYZ& theOrigin)
0065 {
0066 myOrigin = theOrigin;
0067 myOriginTrsf.Nullify();
0068 if (!theOrigin.IsEqual(gp_XYZ(0.0, 0.0, 0.0), gp::Resolution()))
0069 {
0070 gp_Trsf aTrsf;
0071 aTrsf.SetTranslation(theOrigin);
0072 myOriginTrsf = new TopLoc_Datum3D(aTrsf);
0073 }
0074 }
0075
0076
0077
0078
0079 bool HasCullingDistance() const
0080 {
0081 return !Precision::IsInfinite(myCullingDistance) && myCullingDistance > 0.0;
0082 }
0083
0084
0085
0086
0087
0088 double CullingDistance() const { return myCullingDistance; }
0089
0090
0091 void SetCullingDistance(double theDistance) { myCullingDistance = theDistance; }
0092
0093
0094
0095 bool HasCullingSize() const
0096 {
0097 return !Precision::IsInfinite(myCullingSize) && myCullingSize > 0.0;
0098 }
0099
0100
0101
0102
0103
0104 double CullingSize() const { return myCullingSize; }
0105
0106
0107 void SetCullingSize(double theSize) { myCullingSize = theSize; }
0108
0109
0110 bool IsImmediate() const { return myIsImmediate; }
0111
0112
0113
0114 void SetImmediate(const bool theValue) { myIsImmediate = theValue; }
0115
0116
0117
0118 bool IsRaytracable() const { return myToRaytrace; }
0119
0120
0121 void SetRaytracable(bool theToRaytrace) { myToRaytrace = theToRaytrace; }
0122
0123
0124 bool UseEnvironmentTexture() const { return myUseEnvironmentTexture; }
0125
0126
0127 void SetEnvironmentTexture(const bool theValue) { myUseEnvironmentTexture = theValue; }
0128
0129
0130 bool ToEnableDepthTest() const { return myToEnableDepthTest; }
0131
0132
0133 void SetEnableDepthTest(const bool theValue) { myToEnableDepthTest = theValue; }
0134
0135
0136 bool ToEnableDepthWrite() const { return myToEnableDepthWrite; }
0137
0138
0139 void SetEnableDepthWrite(const bool theValue) { myToEnableDepthWrite = theValue; }
0140
0141
0142 bool ToClearDepth() const { return myToClearDepth; }
0143
0144
0145 void SetClearDepth(const bool theValue) { myToClearDepth = theValue; }
0146
0147
0148 bool ToRenderInDepthPrepass() const { return myToRenderInDepthPrepass; }
0149
0150
0151 void SetRenderInDepthPrepass(bool theToRender) { myToRenderInDepthPrepass = theToRender; }
0152
0153
0154 const Graphic3d_PolygonOffset& PolygonOffset() const { return myPolygonOffset; }
0155
0156
0157 void SetPolygonOffset(const Graphic3d_PolygonOffset& theParams) { myPolygonOffset = theParams; }
0158
0159
0160 Graphic3d_PolygonOffset& ChangePolygonOffset() { return myPolygonOffset; }
0161
0162
0163 void SetDepthOffsetPositive()
0164 {
0165 myPolygonOffset.Mode = Aspect_POM_Fill;
0166 myPolygonOffset.Factor = 1.0f;
0167 myPolygonOffset.Units = 1.0f;
0168 }
0169
0170
0171 void SetDepthOffsetNegative()
0172 {
0173 myPolygonOffset.Mode = Aspect_POM_Fill;
0174 myPolygonOffset.Factor = 1.0f;
0175 myPolygonOffset.Units = -1.0f;
0176 }
0177
0178
0179 void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const
0180 {
0181 OCCT_DUMP_CLASS_BEGIN(theOStream, Graphic3d_ZLayerSettings)
0182
0183 OCCT_DUMP_FIELD_VALUE_STRING(theOStream, myName)
0184 OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, myOriginTrsf.get())
0185 OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, &myOrigin)
0186
0187 OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, myCullingDistance)
0188 OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, myCullingSize)
0189
0190 OCCT_DUMP_FIELD_VALUES_DUMPED(theOStream, theDepth, &myPolygonOffset)
0191
0192 OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, myIsImmediate)
0193 OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, myToRaytrace)
0194 OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, myUseEnvironmentTexture)
0195 OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, myToEnableDepthTest)
0196 OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, myToEnableDepthWrite)
0197 OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, myToClearDepth)
0198 OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, myToRenderInDepthPrepass)
0199 }
0200
0201 protected:
0202 TCollection_AsciiString myName;
0203 occ::handle<Graphic3d_LightSet> myLights;
0204 occ::handle<TopLoc_Datum3D> myOriginTrsf;
0205
0206 gp_XYZ myOrigin;
0207 double myCullingDistance;
0208 double myCullingSize;
0209 Graphic3d_PolygonOffset myPolygonOffset;
0210 bool myIsImmediate;
0211 bool myToRaytrace;
0212 bool myUseEnvironmentTexture;
0213 bool myToEnableDepthTest;
0214 bool myToEnableDepthWrite;
0215 bool myToClearDepth;
0216 bool myToRenderInDepthPrepass;
0217
0218 };
0219
0220 #endif