CFx SDK Documentation  2020SP3
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__
OdCmEntityColor
Definition: CmColorBase.h:68
OdEqual
bool OdEqual(double x, double y, double tol=1.e-10)
Definition: OdaDefs.h:523
OdGeVector3d
Definition: GeVector3d.h:54
NULL
#define NULL
Definition: GsProperties.h:177
OdGiViewportTraitsData::setDefaultLightingIntensity
void setDefaultLightingIntensity(double dIntensity)
Definition: GiViewportTraitsData.h:117
OdGiViewportTraitsData::visualStyle
OdDbStub * visualStyle() const
Definition: GiViewportTraitsData.h:189
GiViewportTraits.h
OdGiViewportTraitsData::defaultLightingIntensity
double defaultLightingIntensity() const
Definition: GiViewportTraitsData.h:113
OdGiShadowParameters::setShadowsOn
void setShadowsOn(bool on)
Definition: GiLightTraits.h:284
false
false
Definition: DimVarDefs.h:165
OdGiViewportTraitsData::setBrightness
void setBrightness(double brightness)
Definition: GiViewportTraitsData.h:149
OdGiViewportTraitsData::setAmbientLightColor
void setAmbientLightColor(const OdCmEntityColor &clr)
Definition: GiViewportTraitsData.h:140
OdGiViewportTraitsData::background
OdDbStub * background() const
Definition: GiViewportTraitsData.h:81
OdGeVector3d::isEqualTo
bool isEqualTo(const OdGeVector3d &vect, const OdGeTol &tol=OdGeContext::gTol) const
TD_PackPop.h
OdGiViewportTraitsData::setDefaultLightingColor
void setDefaultLightingColor(const OdCmEntityColor &color)
Definition: GiViewportTraitsData.h:126
OdGiViewportTraitsData::userDefinedLightDirection
OdGeVector3d userDefinedLightDirection() const
Definition: GiViewportTraitsData.h:104
OdGiViewportTraitsData::contrast
double contrast() const
Definition: GiViewportTraitsData.h:162
OdGiViewportTraitsData::defaultLightingType
OdGiViewportTraits::DefaultLightingType defaultLightingType() const
Definition: GiViewportTraitsData.h:99
OdGiShadowParameters
Definition: GiLightTraits.h:120
OdGiViewportTraitsData::setRenderSettings
void setRenderSettings(OdDbStub *renderSettingsId)
Definition: GiViewportTraitsData.h:176
GiLightTraits.h
OdGiViewportTraitsData::OdGiViewportTraitsData
OdGiViewportTraitsData()
Definition: GiViewportTraitsData.h:56
OdGiViewportTraitsData::setVisualStyle
void setVisualStyle(OdDbStub *visualStyleId)
Definition: GiViewportTraitsData.h:185
OdSmartPtr< OdGiToneOperatorParameters >
OdSmartPtr::get
const T * get() const
Definition: SmartPtr.h:326
OdGiViewportTraitsData::ambientLightColor
const OdCmEntityColor & ambientLightColor() const
Definition: GiViewportTraitsData.h:144
OdRxObject::isKindOf
bool isKindOf(const OdRxClass *pClass) const
Definition: RxObject.h:728
OdGiViewportTraitsData::renderSettings
OdDbStub * renderSettings() const
Definition: GiViewportTraitsData.h:180
TD_PackPush.h
OdGiViewportTraitsData::toneOperatorParameters
void toneOperatorParameters(OdGiToneOperatorParameters &params) const
Definition: GiViewportTraitsData.h:209
OdGiToneOperatorParameters
Definition: GiViewportTraits.h:40
OdGiViewportTraitsData::setDefaultLightingOn
void setDefaultLightingOn(bool on)
Definition: GiViewportTraitsData.h:86
GeVector3d.h
OdGiViewportTraits
Definition: GiViewportTraits.h:176
params
GLenum GLint * params
Definition: gles2_ext.h:184
OdGiViewportTraitsData::setDefaultLightingType
void setDefaultLightingType(OdGiViewportTraits::DefaultLightingType typ)
Definition: GiViewportTraitsData.h:95
OdGiViewportTraitsData::renderEnvironment
OdDbStub * renderEnvironment() const
Definition: GiViewportTraitsData.h:171
OdGiViewportTraitsData
Definition: GiViewportTraitsData.h:38
OdGiViewportTraitsData::isDefaultLightingOn
bool isDefaultLightingOn() const
Definition: GiViewportTraitsData.h:90
OdGiDrawable::kViewport
@ kViewport
Definition: GiDrawable.h:96
OdGiViewportTraitsData::compareToneOps
static bool compareToneOps(const OdGiToneOperatorParametersPtr &op1, const OdGiToneOperatorParametersPtr &op2)
Definition: GiViewportTraitsData.h:222
OdGiDrawable::DrawableType
DrawableType
Definition: GiDrawable.h:86
OdGiViewportTraitsData::defaultLightingShadowParameters
const OdGiShadowParameters & defaultLightingShadowParameters() const
Definition: GiViewportTraitsData.h:131
OdGiViewportTraitsData::setRenderEnvironment
void setRenderEnvironment(OdDbStub *renderEnvId)
Definition: GiViewportTraitsData.h:167
OdGiViewportTraitsData::setDefaultLightingShadowParameters
void setDefaultLightingShadowParameters(const OdGiShadowParameters &params)
Definition: GiViewportTraitsData.h:135
OdGiViewportTraitsData::operator==
bool operator==(const OdGiViewportTraitsData &data2) const
Definition: GiViewportTraitsData.h:233
OdGiViewportTraitsData::setToneOperatorParameters
void setToneOperatorParameters(const OdGiToneOperatorParameters &params)
Definition: GiViewportTraitsData.h:194
OdGiPhotographicExposureParameters
Definition: GiViewportTraits.h:123
OdGiViewportTraitsData::operator!=
bool operator!=(const OdGiViewportTraitsData &data2) const
Definition: GiViewportTraitsData.h:247
OdGiViewportTraitsData::setBackground
void setBackground(OdDbStub *backgroundId)
Definition: GiViewportTraitsData.h:77
OdGiViewportTraitsData::setUserDefinedLightDirection
void setUserDefinedLightDirection(const OdGeVector3d &lightDirection)
Definition: GiViewportTraitsData.h:108
OdGiViewportTraitsData::defaultLightingColor
const OdCmEntityColor & defaultLightingColor() const
Definition: GiViewportTraitsData.h:122
OdGiViewportTraitsData::brightness
double brightness() const
Definition: GiViewportTraitsData.h:153
OdGiViewportTraits::DefaultLightingType
DefaultLightingType
Definition: GiViewportTraits.h:181
OdGiViewportTraitsData::toneOperatorParameters
const OdGiToneOperatorParameters & toneOperatorParameters() const
Definition: GiViewportTraitsData.h:217
OdRxObject::desc
static OdRxClass * desc()
OdGiViewportTraitsData::setContrast
void setContrast(double contrast)
Definition: GiViewportTraitsData.h:158
OdGiViewportTraitsData::type
OdGiDrawable::DrawableType type() const
Definition: GiViewportTraitsData.h:75