VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtLightManager.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 
12 
13 #pragma warning( push )
14 #pragma warning( disable : 4251 )
15 
23 
24 #include <tbb/mutex.h>
25 
26 namespace makVrv
27 {
31  {
32  public:
34  DtLightManager(const AxisAlignedBoundingBox_64& box, size_t depth);
35 
37  virtual ~DtLightManager();
38 
39  private:
41  DtLightManager() = delete;
42 
44  DtLightManager(const DtLightManager& rhs) = delete;
45 
47  DtLightManager& operator=(const DtLightManager& rhs) = delete;
48 
49  public:
51  virtual DtLight* createLight(LightType lightType);
52 
54  virtual void destroyLight(DtLight* pLight);
55 
57  virtual size_t numLights(void) const;
58 
60  virtual DtLight* light(size_t index);
61 
63  virtual const VectorLights& allLights(void) const;
64 
66  virtual bool lightExists(const DtLight* pLight) const;
67 
69  virtual void update(Camera_64* pCamera);
71  virtual void update(Frustum_64* pFrustum, const Vector3_64& vRefPosition);
73 
75  virtual void getClosestLights(VectorLights& closestLights
76  , const Vector3_64& vPosition, size_t n);
77 
79  virtual const VectorLights& frustumAffectingLights(void) const;
80 
82  virtual void setlodDistance(float fDistance);
83 
85  virtual float lodDistance(void) const;
86 
88  virtual float lodDistanceSquared(void) const;
89 
91  virtual void initOctree(const AxisAlignedBoundingBox_64& box);
92 
94  virtual void lightUpdated(const DtLight* pLight);
95 
97  virtual void lightBoundsUpdated(const DtLight* pLight);
98 
100  virtual void lightDestroyed(const DtLight* pLight);
101 
103  virtual void createOctreeNode(DtLight* pLight);
104 
106  virtual void destroyOctreeNode(DtLight* pLight);
107 
109  virtual OctreeNode_64* octreeNode(const DtLight* pLight) const;
110 
111  protected:
112  // ! find visible objects given the camera
113  virtual void findVisibleObjects(const Camera_64* pCamera);
114 
115  // ! find visible objects given the frustum and the reference position
116  virtual void findVisibleObjects(const Frustum_64* pCamera, const Vector3_64& vRefPosition);
117 
118  protected:
119  ListLights myLights;
120 
121  mutable bool mybVectorLightsdirty;
122  mutable VectorLights myVectorLights;
123 
125 
128 
130 
132  // needed in case multiple clients attempt to modify the octree simultaneously
133  tbb::mutex myOctreeMutex;
134  };
135 
136 } //namespace makVrv
137 
138 #pragma warning( pop )
LightManager class which allows creation/deletion of lights.
Definition: DtLightManager.h:30
Dll export defines.
OctreeNode class.
Definition: DtOctreeNode.h:21
float myLODDistance
Definition: DtLightManager.h:131
OctreeNode forward declarations.
VectorLights myFrustumAffectingLightsSortingScratchPad
Definition: DtLightManager.h:129
bool mybVectorLightsdirty
Definition: DtLightManager.h:121
VectorLights myFrustumAffectingLights
Definition: DtLightManager.h:127
Camera forward declarations.
DtOctree class.
Axis Aligned Bounding Box class.
Octree_64::NodeVector myVisibleOctreeNodes
Definition: DtLightManager.h:126
Template for 32/64 bit Cameras.
Definition: DtCamera.h:43
Light class.
VectorLights myVectorLights
Definition: DtLightManager.h:122
LightType
Definition: DtLight.h:30
Octree datastructure for managing scene nodes. This is a loose octree implementation, meaning that each octant child of the octree actually overlaps it&#39;s siblings by a factor of .5. This guarantees that any thing that is half the size of the parent will fit completely into a child, with no splitting necessary.
Definition: DtOctree.h:27
std::vector< DtOctreeNode< T > * > NodeVector
Definition: DtOctree.h:79
ListLights myLights
Definition: DtLightManager.h:119
OctreeNode forward declarations.
Class for generic lights This holds per-light data such as range, attenuation factors, colors, etc.
Definition: DtLight.h:48
#define DT_DLL_VRVGRAPHICSUTILS
Definition: vrvGraphicsUtils.h:18
Helpers to easily define forward declarations.
tbb::mutex myOctreeMutex
Definition: DtLightManager.h:133
Octree_64 * myOctree
Definition: DtLightManager.h:124

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)