VR-Vantage 2.6 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtLight.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
11 #pragma warning( push )
12 #pragma warning( disable : 4251 )
13 
20 
22 
23 #include <boost/array.hpp> // TODO: replace with std::array when c++11 is available
24 #include <boost/signals.hpp>
25 
26 namespace makVrv
27 {
28 
30  typedef boost::signal< void(const DtLight*) > LightSignal;
31 
32  enum LightType
33  {
35  , LT_POINT = 1
37  };
38 
40  {
42  , LG_PROPS = 1
43  , LG_TERRAIN = 2
44  };
45 
49  {
50  public:
52  DtLight(DtLightManager * lightManager);
53 
55  ~DtLight();
56 
58  void setOn(bool bOn);
60  bool isOn(void) const { return mybIsOn; }
62 
64  void setLightType(LightType lightType);
70  LightType lightType(void) const;
72 
74  void setAmbientColor(const DtColorValue& color);
76  void setDiffuseColor(const DtColorValue& color);
77  void setSpecularColor(const DtColorValue& color);
79 
81  const DtColorValue& ambientColor(void) const;
83  const DtColorValue& diffuseColor(void) const;
84  const DtColorValue& specularColor(void) const;
86 
88  void setPosition(const Vector3_64& vPosition);
89  const Vector3_64& position(void) const;
90 
92  void setDirection(const Vector3_64& vDirection);
93  const Vector3_64& direction(void) const;
94 
96  void setRange(float32 fRange);
98  float32 range(void) const;
99  float32 squaredRange(void) const;
101 
103  void setAttenuation(float32 fConstant, float32 fLinear, float32 fQuadratic);
105 
106  float32 constantAttenuation(void) const;
107  float32 linearAttenuation(void) const;
108  float32 quadraticAttenuation(void) const;
109 
110  void getAttenuation(float32 attenuations[3]) const;
112 
113 
115  void setSpotLightParameters(const DtDegrees& fInnerAngleDegrees
117  , const DtDegrees& fOuterAngleDegrees
118  , float32 fFalloff);
119 
120  void setSpotLightAngles(const DtDegrees& fInnerAngleDegrees, const DtDegrees& fOuterAngleDegrees);
121  void getSpotLightAngles(DtDegrees& fInnerAngleDegrees, DtDegrees& fOuterAngleDegrees);
122 
123  DtDegrees innerAngle(void) const;
124  DtDegrees outerAngle(void) const;
125  float32 falloff(void) const;
127 
129  DtUserObjectBindings& getUserObjectBindings(void);
131  const DtUserObjectBindings& getUserObjectBindings(void) const;
133 
135  void setOctreeNode(void* pUserData);
137  void* octreeNode() const { return myOctreeNode; }
139 
141  LightSignal signal_LightUpdated;
145 
146  void enableSignals(bool enable);
147  bool signalsEnabled(void) const;
148 
149  void enableUpdateSignals(bool enable);
151 
153  LightGroup lightGroup() const;
154 
156  void setLightGroup(LightGroup group);
157 
158  const AxisAlignedBoundingBox_64& getWorldAABB(void) const;
159 
161 
162  static const std::string& getReservedBindingKey(void)
163  {
164  return mystrReservedBinding;
165  }
166 
167  DtLight& operator=(const DtLight& rhs);
168 
169 
170  bool isInitted() const { return mybIsInitted; }
171 
172  private:
174 
176  void getArbitraryBasisVectors(Vector3_64& vBasis0, Vector3_64& vBasis1) const;
178  void getArbitraryBasisPoints(float distance, boost::array<Vector3_64, 4>& point) const;
180  float getAngleFactor() const;
181 
183  Vector3_64 getSpotCenter() const;
184 
186 
190 
195 
198 
202 
209 
210  bool mybIsOn;
215 
216  void UpdateBounds(void);
218 
219  static const std::string mystrReservedBinding;
220 
223 
229  };
230 
231 } //namespace makVrv
232 
233 #pragma warning( pop )
bool mybIsOn
Definition: DtLight.h:210
DtColorValue class.
float32 myfConstantAttenuation
Definition: DtLight.h:199
float32 myfFallOff
Decrease in illumination between a spotlight&#39;s inner cone and the outer edge of the outer cone...
Definition: DtLight.h:208
LightManager class which allows creation/deletion of lights.
Definition: DtLightManager.h:30
Screen space light data, set up per frame and re-used multiple times while adding lights to light buc...
Definition: DtLightScreenSpaceData.h:53
Definition: DtLight.h:34
bool isInitted() const
Definition: DtLight.h:170
float32 myfRange
Definition: DtLight.h:196
DtDegrees myfOuterAngle
Angle defining the outer edge of the spotlight&#39;s outer cone. Points outside this cone are not lit by ...
Definition: DtLight.h:206
Definition: DtLight.h:36
Class to store a set of keys mapping to a set of any objects.
Vector3_64 myVecPosition
Applicable only to point lights and spot lights.
Definition: DtLight.h:192
LightSignal signal_LightDestroyed
Light signals.
Definition: DtLight.h:144
LightGroup myLightGroup
For switching on and off lights Is this light node under the DtOsgRenderer::propsRoot or under DtOsgR...
Definition: DtLight.h:227
DtColorValue myAmbientColor
Definition: DtLight.h:187
bool isOn(void) const
Turn light on or off.
Definition: DtLight.h:60
AxisAlignedBoundingBox_64 myWorldAABB
Definition: DtLight.h:217
bool myUpdateSignalEnabled
Definition: DtLight.h:222
#define FORWARD_DECLARE_DIFFERENT_SUFFIX(T, U)
Definition: DtForwardDeclare.h:31
float32 myfSquaredRange
Definition: DtLight.h:197
double float64
Definition: DtCommonTypes.h:34
Definition: DtLight.h:35
void * myOctreeNode
Definition: DtLight.h:214
bool mySignalsEnabled
Definition: DtLight.h:221
DtDegrees myfInnerAngle
Angle of a spotlight&#39;s inner cone - that is, the fully illuminated spotlight cone.
Definition: DtLight.h:204
static const std::string mystrReservedBinding
Definition: DtLight.h:219
DT_DLL_VRVCORE double distance(const makVrv::DtCoordinateSystem &, const DtVector &from, const DtVector &to)
Returns the distance from the two points.
Axis Aligned Bounding Box class.
Forward declarations for Vectors.
LightType myLightType
Definition: DtLight.h:185
static const std::string & getReservedBindingKey(void)
Definition: DtLight.h:162
Definition: DtLight.h:42
LightType
Definition: DtLight.h:32
float32 myfLinearAttenuation
Definition: DtLight.h:200
Math utilities.
DtColorValue myDiffuseColor
Definition: DtLight.h:188
float float32
Definition: DtCommonTypes.h:33
Definition: DtMath.h:21
DtColorValue mySpecularColor
Definition: DtLight.h:189
float64 myTempValue
Definition: DtLight.h:160
LightSignal signal_LightBoundsUpdated
Light signals.
Definition: DtLight.h:143
DtUserObjectBindings myUserObjectBindings
Definition: DtLight.h:213
float32 myfQuadraticAttenuation
Definition: DtLight.h:201
Class for generic lights.
Definition: DtLight.h:48
Definition: DtLight.h:41
#define DT_DLL_VRVGRAPHICSUTILS
Definition: vrvGraphicsUtils.h:18
bool mybIsInitted
init bit to keep track if it&#39;s really safe to add to the octtree
Definition: DtLight.h:212
Definition: DtLight.h:43
Vector3_64 myVecDirection
Applicable only to directional lights.
Definition: DtLight.h:194
Helpers to easily define forward declarations.
void * octreeNode() const
octree Data
Definition: DtLight.h:137
Template for Color values in [0,1] range.
Definition: DtColorValue.h:18
Class to store a set of keys mapping to a set of any objects.
Definition: DtUserObjectBindings.h:23
boost::signal< void(const DtLight *) > LightSignal
Definition: DtLight.h:29
LightGroup
Definition: DtLight.h:39
DtLightManager * myLightManager
Definition: DtLight.h:228


Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)