VR-Forces 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) 2023 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
12 
13 #pragma warning( push )
14 #pragma warning( disable : 4251 )
15 
17 
20 
24 #include <vrvMath/DtOctree.h>
25 
26 #include <tbb/mutex.h>
27 
28 namespace makVrv
29 {
33  {
34  public:
36  DtLightManager(const AxisAlignedBoundingBox_64& box, size_t depth);
37 
39  virtual ~DtLightManager();
40 
41  private:
43  DtLightManager() = delete;
44 
46  DtLightManager(const DtLightManager& rhs) = delete;
47 
49  DtLightManager& operator=(const DtLightManager& rhs) = delete;
50 
51  public:
53  virtual DtLight* createLight(LightType lightType);
54 
56  virtual void destroyLight(DtLight* pLight);
57 
59  virtual size_t numLights(void) const;
60 
62  virtual DtLight* light(size_t index);
63 
65  virtual const VectorLights& allLights(void) const;
66 
68  virtual bool lightExists(const DtLight* pLight) const;
69 
70  // ! find visible objects given the frustum and the reference position
71  virtual void findVisibleObjects(std::vector<const DtLight*>& frustumAffectingLights, Octree_64::NodeVector& visibleOctreeNodes
72  , const Frustum_64* pCamera, const Vector3_64& vRefPosition);
73 
75  virtual void setlodDistance(float fDistance);
76 
78  virtual float lodDistance(void) const;
79 
81  virtual float lodDistanceSquared(void) const;
82 
84  virtual void initOctree(const AxisAlignedBoundingBox_64& box);
85 
87  virtual void lightUpdated(const DtLight* pLight);
88 
90  virtual void lightBoundsUpdated(const DtLight* pLight);
91 
93  virtual void lightDestroyed(const DtLight* pLight);
94 
96  virtual void createOctreeNode(DtLight* pLight);
97 
99  virtual void destroyOctreeNode(DtLight* pLight);
100 
102  virtual OctreeNode_64* octreeNode(const DtLight* pLight) const;
103  protected:
106  virtual void getClosestLights(std::vector<const DtLight*>& closestLights
107  , const std::vector<const DtLight*>& frustumAffectingLights
108  , const Vector3_64& vPosition, size_t n);
109 
110  protected:
111  ListLights myLights;
112 
113  mutable bool mybVectorLightsdirty;
114  mutable VectorLights myVectorLights;
115 
117 
118 
120  // needed in case multiple clients attempt to modify the octree simultaneously
121  tbb::mutex myOctreeMutex;
122  };
123 
124 } //namespace makVrv
125 
126 #pragma warning( pop )
LightManager class which allows creation/deletion of lights.
Definition: DtLightManager.h:32
Dll export defines.
OctreeNode class.
Definition: DtOctreeNode.h:20
float myLODDistance
Definition: DtLightManager.h:119
OctreeNode forward declarations.
bool mybVectorLightsdirty
Definition: DtLightManager.h:113
Camera forward declarations.
DtOctree class.
Axis Aligned Bounding Box class.
Light class.
VectorLights myVectorLights
Definition: DtLightManager.h:114
LightType
Definition: DtLight.h:31
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:111
OctreeNode forward declarations.
Class for generic lights This holds per-light data such as range, attenuation factors, colors, etc.
Definition: DtLight.h:49
#define DT_DLL_VRVGRAPHICSUTILS
Definition: vrvGraphicsUtils.h:18
Helpers to easily define forward declarations.
tbb::mutex myOctreeMutex
Definition: DtLightManager.h:121
Octree_64 * myOctree
Definition: DtLightManager.h:116

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)