VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtLight.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
11 #pragma warning( push )
12 #pragma warning( disable : 4251 )
13 
22 
23 #include <array>
24 
25 namespace makVrv
26 {
27  class DtLight;
28  class DtLightManager;
29 
30  enum LightType
31  {
33  , LT_POINT = 1
35  };
36 
38  {
40  , LG_PROPS = 1
41  , LG_TERRAIN = 2
42  };
43 
49  {
50  public:
52  DtLight(DtLightManager * lightManager);
53 
55  virtual ~DtLight();
56 
58  DtLight& operator=(const DtLight& rhs);
59 
60  private:
62  DtLight() = delete;
63 
65  DtLight(const DtLight& rhs) = delete;
66 
67  public:
69  virtual void setOn(bool bOn);
71  virtual bool isOn(void) const;
73 
75  virtual void setLightType(LightType lightType);
81  virtual LightType lightType(void) const;
83 
85  virtual void setSensorMask(unsigned int sensorMask);
90  virtual unsigned int sensorMask() const;
92 
93 
95  virtual void setAmbientColor(const DtColorValue& color);
97  virtual void setDiffuseColor(const DtColorValue& color);
98  virtual void setSpecularColor(const DtColorValue& color);
100 
102  virtual const DtColorValue& ambientColor(void) const;
104  virtual const DtColorValue& diffuseColor(void) const;
105  virtual const DtColorValue& specularColor(void) const;
107 
109  virtual void setPosition(const Vector3_64& vPosition);
110  virtual const Vector3_64& position(void) const;
111 
113  virtual void setDirection(const Vector3_64& vDirection);
114  virtual const Vector3_64& direction(void) const;
115 
117  virtual void setRange(float32 fRange);
119  virtual float32 range(void) const;
120  virtual float32 squaredRange(void) const;
122 
124  virtual void setAttenuation(float32 fConstant, float32 fLinear, float32 fQuadratic);
126 
127  virtual float32 constantAttenuation(void) const;
128  virtual float32 linearAttenuation(void) const;
129  virtual float32 quadraticAttenuation(void) const;
130 
131  virtual void getAttenuation(float32 attenuations[3]) const;
133 
134 
136  virtual void setSpotLightParameters(const DtDegrees& fInnerAngleDegrees
138  , const DtDegrees& fOuterAngleDegrees
139  , float32 fFalloff);
140 
141  virtual void setSpotLightAngles(const DtDegrees& fInnerAngleDegrees, const DtDegrees& fOuterAngleDegrees);
142  virtual void spotLightAngles(DtDegrees& fInnerAngleDegrees, DtDegrees& fOuterAngleDegrees);
143 
144  virtual DtDegrees innerAngle(void) const;
145  virtual DtDegrees outerAngle(void) const;
146  virtual float32 falloff(void) const;
148 
150  virtual DtUserObjectBindings& userObjectBindings(void);
152  virtual const DtUserObjectBindings& userObjectBindings(void) const;
154 
156  virtual void setOctreeNode(void* pUserData);
158  virtual void* octreeNode() const;
160 
162  virtual LightGroup lightGroup() const;
163 
165  virtual void setLightGroup(LightGroup group);
166 
168  virtual const AxisAlignedBoundingBox_64& worldAABB(void) const;
169 
171  virtual bool isInitted() const;
172 
175  virtual void setLightSourceTypeId(unsigned int lightSourceTypeId);
176 
178  virtual unsigned int lightSourceTypeId() const;
179 
181  virtual void printDetails(void) const;
182 
184  virtual void setUserValue(float64 val);
185 
187  virtual float64 userValue(void) const;
188 
189  public:
190  static const std::string& reservedBindingKey(void);
191 
192 
193  protected:
195 
197  virtual void getArbitraryBasisVectors(Vector3_64& vBasis0, Vector3_64& vBasis1) const;
199  virtual void getArbitraryBasisPoints(float distance, std::array<Vector3_64, 4>& point) const;
201  virtual float getAngleFactor() const;
202 
204  virtual Vector3_64 getSpotCenter() const;
205 
207  virtual void UpdateBounds(void);
208 
209  protected:
210 
212 
213  unsigned int mySensorMask; //bit 0 is visual, bit 1 is NVG, bit 2 is MWIR, bit 3 is LWIR
214 
218 
223 
226 
230 
237 
238  bool mybIsOn;
243 
245 
251 
252  unsigned int myLightSourceTypeId;
253 
255 
256  static const std::string theStrReservedBinding;
257  };
258 
259  // initializer for a light pointer
261  {
262  public:
263  void operator()(DtLight*& light)
264  {
265  light = nullptr;
266  }
267  };
268 
269  // a reusable vector of DtLight pointers
271 
272 } //namespace makVrv
273 
274 #pragma warning( pop )
bool mybIsOn
Definition: DtLight.h:238
DtColorValue class.
float32 myfConstantAttenuation
Definition: DtLight.h:227
float32 myfFallOff
Decrease in illumination between a spotlight&#39;s inner cone and the outer edge of the outer cone...
Definition: DtLight.h:236
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
DtReusableMemoryVector< DtLight *, DtLightPointerInitializer > LightReusableVector
Definition: DtLight.h:270
Definition: DtLight.h:32
unsigned int myLightSourceTypeId
Definition: DtLight.h:252
float32 myfRange
Definition: DtLight.h:224
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:234
Definition: DtLight.h:34
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:220
LightGroup myLightGroup
For switching on and off lights Is this light node under the DtOsgRenderer::propsRoot or under DtOsgR...
Definition: DtLight.h:249
DtColorValue myAmbientColor
Definition: DtLight.h:215
AxisAlignedBoundingBox_64 myWorldAABB
Definition: DtLight.h:244
#define FORWARD_DECLARE_DIFFERENT_SUFFIX(T, U)
Definition: DtForwardDeclare.h:31
float32 myfSquaredRange
Definition: DtLight.h:225
3 dimensional vector
Definition: DtLight.h:33
void * myOctreeNode
Definition: DtLight.h:242
DtDegrees myfInnerAngle
Angle of a spotlight&#39;s inner cone - that is, the fully illuminated spotlight cone.
Definition: DtLight.h:232
static const std::string theStrReservedBinding
Definition: DtLight.h:256
DT_DLL_VRVCORE double distance(const makVrv::DtCoordinateSystem &, const DtVector &from, const DtVector &to)
Returns the distance from the two points. Coordinates are in local database coordinates The coordinat...
Axis Aligned Bounding Box class.
LightType myLightType
Definition: DtLight.h:211
Definition: DtLight.h:40
LightType
Definition: DtLight.h:30
float32 myfLinearAttenuation
Definition: DtLight.h:228
Math utilities.
DtColorValue myDiffuseColor
Definition: DtLight.h:216
float float32
Definition: DtCommonTypes.h:33
unsigned int mySensorMask
Definition: DtLight.h:213
Definition: DtMath.h:25
DtColorValue mySpecularColor
Definition: DtLight.h:217
DtUserObjectBindings myUserObjectBindings
Definition: DtLight.h:241
float32 myfQuadraticAttenuation
Definition: DtLight.h:229
Contains makVrv::DtReusableMemoryVector class.
Class for generic lights This holds per-light data such as range, attenuation factors, colors, etc.
Definition: DtLight.h:48
Definition: DtLight.h:39
#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:240
Definition: DtLight.h:41
Definition: DtLight.h:260
Vector3_64 myVecDirection
Applicable only to directional lights.
Definition: DtLight.h:222
Helpers to easily define forward declarations.
void operator()(DtLight *&light)
Definition: DtLight.h:263
float64 myUserValue
Definition: DtLight.h:254
Template for Color values in [0,1] range.
Definition: DtColorValue.h:20
Class to store a set of keys mapping to a set of any objects.
Definition: DtUserObjectBindings.h:23
LightGroup
Definition: DtLight.h:37
DtLightManager * myLightManager
Definition: DtLight.h:250

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)