VR-Forces 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) 2023 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
11 #pragma warning( push )
12 #pragma warning( disable : 4251 )
13 
16 
17 #include <vrvMath/DtColorValue.h>
18 #include <vrvMath/DtVector3.h>
20 #include <vrvMath/DtMath.h>
23 
24 #include <array>
25 
26 namespace makVrv
27 {
28  class DtLight;
29  class DtLightManager;
30 
31  enum LightType
32  {
34  , LT_POINT = 1
36  };
37 
39  {
41  , LG_PROPS = 1
42  , LG_TERRAIN = 2
43  };
44 
50  {
51  public:
53  DtLight(DtLightManager * lightManager);
54 
56  virtual ~DtLight();
57 
59  DtLight& operator=(const DtLight& rhs);
60 
61  private:
63  DtLight() = delete;
64 
66  DtLight(const DtLight& rhs) = delete;
67 
68  public:
70  virtual void setOn(bool bOn);
72  virtual bool isOn(void) const;
74 
76  virtual void setLightType(LightType lightType);
82  virtual LightType lightType(void) const;
84 
86  virtual void setSensorMask(unsigned int sensorMask);
91  virtual unsigned int sensorMask() const;
93 
94 
96  virtual void setAmbientColor(const DtColorValue& color);
98  virtual void setDiffuseColor(const DtColorValue& color);
99  virtual void setSpecularColor(const DtColorValue& color);
101 
103  virtual const DtColorValue& ambientColor(void) const;
105  virtual const DtColorValue& diffuseColor(void) const;
106  virtual const DtColorValue& specularColor(void) const;
108 
110  virtual void setPosition(const Vector3_64& vPosition);
111  virtual const Vector3_64& position(void) const;
112 
114  virtual void setDirection(const Vector3_64& vDirection);
115  virtual const Vector3_64& direction(void) const;
116 
118  virtual void setRange(float32 fRange);
120  virtual float32 range(void) const;
121  virtual float32 squaredRange(void) const;
123 
125  virtual void setAttenuation(float32 fConstant, float32 fLinear, float32 fQuadratic);
127 
128  virtual float32 constantAttenuation(void) const;
129  virtual float32 linearAttenuation(void) const;
130  virtual float32 quadraticAttenuation(void) const;
131 
132  virtual void getAttenuation(float32 attenuations[3]) const;
134 
135 
137  virtual void setSpotLightParameters(const DtDegrees& fInnerAngleDegrees
139  , const DtDegrees& fOuterAngleDegrees
140  , float32 fFalloff);
141 
142  virtual void setSpotLightAngles(const DtDegrees& fInnerAngleDegrees, const DtDegrees& fOuterAngleDegrees);
143  virtual void spotLightAngles(DtDegrees& fInnerAngleDegrees, DtDegrees& fOuterAngleDegrees);
144 
145  virtual DtDegrees innerAngle(void) const;
146  virtual DtDegrees outerAngle(void) const;
147  virtual float32 falloff(void) const;
149 
151  virtual void setReserved(bool val);
153  virtual bool reserved(void) const;
155 
157  virtual void setOctreeNode(void* pUserData);
159  virtual void* octreeNode() const;
161 
163  virtual LightGroup lightGroup() const;
164 
166  virtual void setLightGroup(LightGroup group);
167 
169  virtual const AxisAlignedBoundingBox_64& worldAABB(void) const;
170 
172  virtual bool isInitted() const;
173 
176  virtual void setLightSourceTypeId(unsigned int lightSourceTypeId);
177 
179  virtual unsigned int lightSourceTypeId() const;
180 
182  virtual void printDetails(void) const;
183 
185  virtual void setUserValue(float64 val);
186 
188  virtual float64 userValue(void) const;
189 
190  protected:
192 
194  virtual void getArbitraryBasisVectors(Vector3_64& vBasis0, Vector3_64& vBasis1) const;
196  virtual void getArbitraryBasisPoints(float distance, std::array<Vector3_64, 4>& point) const;
198  virtual float getAngleFactor() const;
199 
201  virtual Vector3_64 getSpotCenter() const;
202 
204  virtual void UpdateBounds(void);
205 
206  protected:
207 
209 
210  unsigned int mySensorMask; //bit 0 is visual, bit 1 is NVG, bit 2 is MWIR, bit 3 is LWIR
211 
215 
220 
223 
227 
234 
235  bool mybIsOn;
239  bool myIsReserved = false;
241 
243 
249 
250  unsigned int myLightSourceTypeId;
251 
253  };
254 
255  // initializer for a light pointer
257  {
258  public:
259  void operator()(DtLight*& light)
260  {
261  light = nullptr;
262  }
263  };
264 
265  // a reusable vector of DtLight pointers
267 
268 } //namespace makVrv
269 
270 #pragma warning( pop )
bool mybIsOn
Definition: DtLight.h:235
DtColorValue class.
float32 myfConstantAttenuation
Definition: DtLight.h:224
float32 myfFallOff
Decrease in illumination between a spotlight&#39;s inner cone and the outer edge of the outer cone...
Definition: DtLight.h:233
LightManager class which allows creation/deletion of lights.
Definition: DtLightManager.h:32
Screen space light data, set up per frame and re-used multiple times while adding lights to light buc...
Definition: DtLightScreenSpaceData.h:56
DtReusableMemoryVector< DtLight *, DtLightPointerInitializer > LightReusableVector
Definition: DtLight.h:266
Definition: DtLight.h:33
unsigned int myLightSourceTypeId
Definition: DtLight.h:250
float32 myfRange
Definition: DtLight.h:221
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:231
Definition: DtLight.h:35
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:217
LightGroup myLightGroup
For switching on and off lights Is this light node under the DtOsgRenderer::propsRoot or under DtOsgR...
Definition: DtLight.h:247
DtColorValue myAmbientColor
Definition: DtLight.h:212
AxisAlignedBoundingBox_64 myWorldAABB
Definition: DtLight.h:242
#define FORWARD_DECLARE_DIFFERENT_SUFFIX(T, U)
Definition: DtForwardDeclare.h:31
float32 myfSquaredRange
Definition: DtLight.h:222
3 dimensional vector
Definition: DtLight.h:34
void * myOctreeNode
Definition: DtLight.h:240
DtDegrees myfInnerAngle
Angle of a spotlight&#39;s inner cone - that is, the fully illuminated spotlight cone.
Definition: DtLight.h:229
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:208
Definition: DtLight.h:41
LightType
Definition: DtLight.h:31
float32 myfLinearAttenuation
Definition: DtLight.h:225
Math utilities.
DtColorValue myDiffuseColor
Definition: DtLight.h:213
float float32
Definition: DtCommonTypes.h:33
unsigned int mySensorMask
Definition: DtLight.h:210
Definition: DtMath.h:25
DtColorValue mySpecularColor
Definition: DtLight.h:214
float32 myfQuadraticAttenuation
Definition: DtLight.h:226
Contains makVrv::DtReusableMemoryVector class.
Class for generic lights This holds per-light data such as range, attenuation factors, colors, etc.
Definition: DtLight.h:49
Definition: DtLight.h:40
#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:237
Definition: DtLight.h:42
Definition: DtLight.h:256
Vector3_64 myVecDirection
Applicable only to directional lights.
Definition: DtLight.h:219
Helpers to easily define forward declarations.
void operator()(DtLight *&light)
Definition: DtLight.h:259
float64 myUserValue
Definition: DtLight.h:252
Template for Color values in [0,1] range.
Definition: DtColorValue.h:20
LightGroup
Definition: DtLight.h:38
DtLightManager * myLightManager
Definition: DtLight.h:248

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)