CFx SDK Documentation  2022 SP0
GiViewportTraitsData.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 #ifndef __OD_GI_VIEWPORT_TRAITS_DATA__
25 #define __OD_GI_VIEWPORT_TRAITS_DATA__
26 
27 #include "TD_PackPush.h"
28 
29 #include "Ge/GeVector3d.h"
30 #include "Gi/GiViewportTraits.h"
31 #include "Gi/GiLightTraits.h"
32 
38 {
39  OdDbStub* m_backgroundId;
40  bool m_bDefLightOn;
42  OdGeVector3d m_userDefLightDir;
43  double m_defLightIntensity;
44  OdCmEntityColor m_defLightColor;
45  OdGiShadowParameters m_defShadowParams;
46  OdCmEntityColor m_colorAmbient;
47  double m_dBrightness;
48  double m_dContrast;
49  OdDbStub* m_renderEnvId;
50  OdDbStub* m_renderSettings;
51  OdDbStub* m_visualStyle;
52  OdGiToneOperatorParametersPtr m_pToneOperators;
53 
54 public:
55 
57  : m_backgroundId(NULL)
58  , m_bDefLightOn(false)
59  , m_lightType(OdGiViewportTraits::kOneDistantLight)
60  , m_userDefLightDir(OdGeVector3d::kZAxis)
61  , m_defLightIntensity(0.5)
62  , m_defLightColor(255, 255, 255)
63  , m_defShadowParams()
64  , m_colorAmbient()
65  , m_dBrightness(50.0)
66  , m_dContrast(50.0)
67  , m_renderEnvId(NULL)
68  , m_renderSettings(NULL)
69  , m_visualStyle(NULL)
70  {
71  m_defShadowParams.setShadowsOn(false);
72  m_pToneOperators = OdGiToneOperatorParameters::createObject();
73  }
74 
76 
77  void setBackground(OdDbStub* backgroundId)
78  {
79  m_backgroundId = backgroundId;
80  }
81  OdDbStub* background() const
82  {
83  return m_backgroundId;
84  }
85 
86  void setDefaultLightingOn(bool on)
87  {
88  m_bDefLightOn = on;
89  }
90  bool isDefaultLightingOn() const
91  {
92  return m_bDefLightOn;
93  }
94 
96  {
97  m_lightType = typ;
98  }
100  {
101  return m_lightType;
102  }
103 
105  {
106  return m_userDefLightDir;
107  }
108  void setUserDefinedLightDirection(const OdGeVector3d& lightDirection)
109  {
110  m_userDefLightDir = lightDirection;
111  }
112 
114  {
115  return m_defLightIntensity;
116  }
117  void setDefaultLightingIntensity(double dIntensity)
118  {
119  m_defLightIntensity = dIntensity;
120  }
121 
123  {
124  return m_defLightColor;
125  }
127  {
128  m_defLightColor = color;
129  }
130 
132  {
133  return m_defShadowParams;
134  }
136  {
137  m_defShadowParams = params;
138  }
139 
141  {
142  m_colorAmbient = clr;
143  }
145  {
146  return m_colorAmbient;
147  }
148 
150  {
151  m_dBrightness = brightness;
152  }
153  double brightness() const
154  {
155  return m_dBrightness;
156  }
157 
158  void setContrast(double contrast)
159  {
160  m_dContrast = contrast;
161  }
162  double contrast() const
163  {
164  return m_dContrast;
165  }
166 
167  void setRenderEnvironment(OdDbStub* renderEnvId)
168  {
169  m_renderEnvId = renderEnvId;
170  }
171  OdDbStub* renderEnvironment() const
172  {
173  return m_renderEnvId;
174  }
175 
176  void setRenderSettings(OdDbStub* renderSettingsId)
177  {
178  m_renderSettings = renderSettingsId;
179  }
180  OdDbStub* renderSettings() const
181  {
182  return m_renderSettings;
183  }
184 
185  void setVisualStyle(OdDbStub* visualStyleId)
186  {
187  m_visualStyle = visualStyleId;
188  }
189  OdDbStub* visualStyle() const
190  {
191  return m_visualStyle;
192  }
193 
195  {
197  {
198  if (!m_pToneOperators->isKindOf(OdGiPhotographicExposureParameters::desc()))
199  m_pToneOperators = OdGiPhotographicExposureParameters::createObject();
200  *static_cast<OdGiPhotographicExposureParameters*>(m_pToneOperators.get()) = static_cast<const OdGiPhotographicExposureParameters&>(params);
201  }
202  else
203  {
204  if (m_pToneOperators->isKindOf(OdGiPhotographicExposureParameters::desc()))
205  m_pToneOperators = OdGiToneOperatorParameters::createObject();
206  *m_pToneOperators = params;
207  }
208  }
210  {
211  if (m_pToneOperators->isKindOf(OdGiPhotographicExposureParameters::desc()) &&
213  static_cast<OdGiPhotographicExposureParameters&>(params) = *static_cast<const OdGiPhotographicExposureParameters*>(m_pToneOperators.get());
214  else
215  params = *m_pToneOperators;
216  }
218  {
219  return *m_pToneOperators;
220  }
221 
223  {
224  const bool bPhoto1 = op1->isKindOf(OdGiPhotographicExposureParameters::desc());
225  const bool bPhoto2 = op2->isKindOf(OdGiPhotographicExposureParameters::desc());
226  if (bPhoto1 && bPhoto2)
227  return *static_cast<const OdGiPhotographicExposureParameters*>(op1.get()) == *static_cast<const OdGiPhotographicExposureParameters*>(op2.get());
228  else if (!bPhoto1 && !bPhoto2)
229  return *op1 == *op2;
230  return false;
231  }
232 
233  bool operator ==(const OdGiViewportTraitsData &data2) const
234  {
235  return ((m_backgroundId == data2.m_backgroundId) &&
236  (m_bDefLightOn == data2.m_bDefLightOn) &&
237  (m_lightType == data2.m_lightType) &&
238  m_userDefLightDir.isEqualTo(data2.m_userDefLightDir) &&
239  (m_colorAmbient == data2.m_colorAmbient) &&
240  OdEqual(m_dBrightness, data2.m_dBrightness) &&
241  OdEqual(m_dContrast, data2.m_dContrast) &&
242  (m_renderEnvId == data2.m_renderEnvId) &&
243  (m_renderSettings == data2.m_renderSettings) &&
244  (m_visualStyle == data2.m_visualStyle) &&
245  compareToneOps(m_pToneOperators, data2.m_pToneOperators));
246  }
247  bool operator !=(const OdGiViewportTraitsData &data2) const
248  {
249  return !(*this == data2);
250  }
251 };
252 
253 #include "TD_PackPop.h"
254 
255 #endif // __OD_GI_VIEWPORT_TRAITS_DATA__
false
Definition: DimVarDefs.h:165
#define NULL
Definition: GsProperties.h:177
bool OdEqual(double x, double y, double tol=1.e-10)
Definition: OdaDefs.h:523
bool isEqualTo(const OdGeVector3d &vect, const OdGeTol &tol=OdGeContext::gTol) const
void setShadowsOn(bool on)
static bool compareToneOps(const OdGiToneOperatorParametersPtr &op1, const OdGiToneOperatorParametersPtr &op2)
void setDefaultLightingColor(const OdCmEntityColor &color)
void setDefaultLightingType(OdGiViewportTraits::DefaultLightingType typ)
void setDefaultLightingShadowParameters(const OdGiShadowParameters &params)
void setDefaultLightingIntensity(double dIntensity)
const OdGiToneOperatorParameters & toneOperatorParameters() const
OdGiViewportTraits::DefaultLightingType defaultLightingType() const
OdDbStub * background() const
OdDbStub * renderSettings() const
OdDbStub * renderEnvironment() const
void setBrightness(double brightness)
void setDefaultLightingOn(bool on)
const OdCmEntityColor & defaultLightingColor() const
OdGiDrawable::DrawableType type() const
bool operator!=(const OdGiViewportTraitsData &data2) const
OdDbStub * visualStyle() const
OdGeVector3d userDefinedLightDirection() const
void toneOperatorParameters(OdGiToneOperatorParameters &params) const
void setVisualStyle(OdDbStub *visualStyleId)
void setContrast(double contrast)
void setAmbientLightColor(const OdCmEntityColor &clr)
void setRenderEnvironment(OdDbStub *renderEnvId)
double defaultLightingIntensity() const
void setToneOperatorParameters(const OdGiToneOperatorParameters &params)
void setUserDefinedLightDirection(const OdGeVector3d &lightDirection)
bool operator==(const OdGiViewportTraitsData &data2) const
const OdGiShadowParameters & defaultLightingShadowParameters() const
const OdCmEntityColor & ambientLightColor() const
void setBackground(OdDbStub *backgroundId)
void setRenderSettings(OdDbStub *renderSettingsId)
static OdRxClass * desc()
bool isKindOf(const OdRxClass *pClass) const
Definition: RxObject.h:728
const T * get() const
Definition: SmartPtr.h:326
GLenum GLint * params
Definition: gles2_ext.h:184