File indexing completed on 2025-01-18 10:03:50
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 (Standard_False),
0034 myToRaytrace (Standard_True),
0035 myUseEnvironmentTexture (Standard_True),
0036 myToEnableDepthTest (Standard_True),
0037 myToEnableDepthWrite(Standard_True),
0038 myToClearDepth (Standard_True),
0039 myToRenderInDepthPrepass (Standard_True) {}
0040
0041
0042 const TCollection_AsciiString& Name() const { return myName; }
0043
0044
0045 void SetName (const TCollection_AsciiString& theName) { myName = theName; }
0046
0047
0048
0049 const Handle(Graphic3d_LightSet)& Lights() const { return myLights; }
0050
0051
0052 void SetLights (const Handle(Graphic3d_LightSet)& theLights) { myLights = theLights; }
0053
0054
0055 const gp_XYZ& Origin() const { return myOrigin; }
0056
0057
0058 const Handle(TopLoc_Datum3D)& OriginTransformation() const { return myOriginTrsf; }
0059
0060
0061 void SetOrigin (const gp_XYZ& theOrigin)
0062 {
0063 myOrigin = theOrigin;
0064 myOriginTrsf.Nullify();
0065 if (!theOrigin.IsEqual (gp_XYZ(0.0, 0.0, 0.0), gp::Resolution()))
0066 {
0067 gp_Trsf aTrsf;
0068 aTrsf.SetTranslation (theOrigin);
0069 myOriginTrsf = new TopLoc_Datum3D (aTrsf);
0070 }
0071 }
0072
0073
0074
0075 Standard_Boolean HasCullingDistance() const { return !Precision::IsInfinite (myCullingDistance) && myCullingDistance > 0.0; }
0076
0077
0078
0079
0080 Standard_Real CullingDistance() const { return myCullingDistance; }
0081
0082
0083 void SetCullingDistance (Standard_Real theDistance) { myCullingDistance = theDistance; }
0084
0085
0086
0087 Standard_Boolean HasCullingSize() const { return !Precision::IsInfinite (myCullingSize) && myCullingSize > 0.0; }
0088
0089
0090
0091
0092 Standard_Real CullingSize() const { return myCullingSize; }
0093
0094
0095 void SetCullingSize (Standard_Real theSize) { myCullingSize = theSize; }
0096
0097
0098 Standard_Boolean IsImmediate() const { return myIsImmediate; }
0099
0100
0101 void SetImmediate (const Standard_Boolean theValue) { myIsImmediate = theValue; }
0102
0103
0104
0105 Standard_Boolean IsRaytracable() const { return myToRaytrace; }
0106
0107
0108 void SetRaytracable (Standard_Boolean theToRaytrace) { myToRaytrace = theToRaytrace; }
0109
0110
0111 Standard_Boolean UseEnvironmentTexture() const { return myUseEnvironmentTexture; }
0112
0113
0114 void SetEnvironmentTexture (const Standard_Boolean theValue) { myUseEnvironmentTexture = theValue; }
0115
0116
0117 Standard_Boolean ToEnableDepthTest() const { return myToEnableDepthTest; }
0118
0119
0120 void SetEnableDepthTest(const Standard_Boolean theValue) { myToEnableDepthTest = theValue; }
0121
0122
0123 Standard_Boolean ToEnableDepthWrite() const { return myToEnableDepthWrite; }
0124
0125
0126 void SetEnableDepthWrite (const Standard_Boolean theValue) { myToEnableDepthWrite = theValue; }
0127
0128
0129 Standard_Boolean ToClearDepth() const { return myToClearDepth; }
0130
0131
0132 void SetClearDepth (const Standard_Boolean theValue) { myToClearDepth = theValue; }
0133
0134
0135 Standard_Boolean ToRenderInDepthPrepass() const { return myToRenderInDepthPrepass; }
0136
0137
0138 void SetRenderInDepthPrepass (Standard_Boolean theToRender) { myToRenderInDepthPrepass = theToRender; }
0139
0140
0141 const Graphic3d_PolygonOffset& PolygonOffset() const { return myPolygonOffset; }
0142
0143
0144 void SetPolygonOffset (const Graphic3d_PolygonOffset& theParams) { myPolygonOffset = theParams; }
0145
0146
0147 Graphic3d_PolygonOffset& ChangePolygonOffset() { return myPolygonOffset; }
0148
0149
0150 void SetDepthOffsetPositive()
0151 {
0152 myPolygonOffset.Mode = Aspect_POM_Fill;
0153 myPolygonOffset.Factor = 1.0f;
0154 myPolygonOffset.Units = 1.0f;
0155 }
0156
0157
0158 void SetDepthOffsetNegative()
0159 {
0160 myPolygonOffset.Mode = Aspect_POM_Fill;
0161 myPolygonOffset.Factor = 1.0f;
0162 myPolygonOffset.Units =-1.0f;
0163 }
0164
0165
0166 void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const
0167 {
0168 OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_ZLayerSettings)
0169
0170 OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myName)
0171 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myOriginTrsf.get())
0172 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myOrigin)
0173
0174 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCullingDistance)
0175 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCullingSize)
0176
0177 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPolygonOffset)
0178
0179 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsImmediate)
0180 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToRaytrace)
0181 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUseEnvironmentTexture)
0182 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToEnableDepthTest)
0183 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToEnableDepthWrite)
0184 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToClearDepth)
0185 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToRenderInDepthPrepass)
0186 }
0187
0188 protected:
0189
0190 TCollection_AsciiString myName;
0191 Handle(Graphic3d_LightSet) myLights;
0192 Handle(TopLoc_Datum3D) myOriginTrsf;
0193 gp_XYZ myOrigin;
0194 Standard_Real myCullingDistance;
0195 Standard_Real myCullingSize;
0196 Graphic3d_PolygonOffset myPolygonOffset;
0197 Standard_Boolean myIsImmediate;
0198 Standard_Boolean myToRaytrace;
0199 Standard_Boolean myUseEnvironmentTexture;
0200 Standard_Boolean myToEnableDepthTest;
0201 Standard_Boolean myToEnableDepthWrite;
0202 Standard_Boolean myToClearDepth;
0203 Standard_Boolean myToRenderInDepthPrepass;
0204
0205 };
0206
0207 #endif