VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtLightPointNode.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2025 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
11 #include <vrvOsg/vrvOsg.h>
12 
14 
16 
17 #include <boost/thread/recursive_mutex.hpp>
18 
19 namespace osgUtil
20 {
21  class CullVisitor;
22 }
23 
24 namespace makVrv
25 {
26  class DtDe;
28 
29  typedef std::vector<osg::Node*> DtNodePointerStack;
30 
37  class DT_DLL_VRVOSG DtLightPointNode : public osg::Node
38  {
39  public:
40 
43 
45  DtLightPointNode(const DtLightPointNode& lpn, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
46 
48  virtual ~DtLightPointNode();
49 
50  META_Node(vrvOsg, DtLightPointNode);
51 
52  private:
54  DtLightPointNode& operator=(const DtLightPointNode& other) = delete;
55 
56  public:
58  virtual void traverse(osg::NodeVisitor& nv);
59 
63  virtual void updateDrawable(const osg::Camera* camera, int frameNum, double simTime, const osg::Matrixd &modelViewMatrix,
64  osgUtil::CullVisitor* cv, int groupId, bool shouldCull, const DtIndirectFadeParameters& fadeParameters, float posScale, float radiusScale, bool isInstancedReflection = false);
65 
67  virtual void updateNodeInfo(bool isInstancedReflection = false, bool isForcedAdd = false);
68 
74  virtual int addTypedLightPoint(const osg::Vec3d& pos, int type, const std::string& id,
75  const osg::Vec3& rotation, float phaseShift);
76 
79  virtual void removeTypedLightPoint(int index);
80 
82  virtual void setLightPointManager(DtOsgLightPointManager *lightPointManager);
83 
85  virtual DtOsgLightPointManager *findLightPointManager();
86 
88  virtual void setLightPointsEnabled(bool enabled);
89 
91  virtual bool lightPointsEnabled();
92 
94  virtual void setGroupId(int id);
95 
97  virtual int groupId();
98 
102  virtual void freeNodeIdIfNecessary(unsigned int maxNodeIds);
103 
107  virtual const osg::BoundingSphere computeBound(osg::BoundingBox& outBox) const;
108 
109 
112  virtual void applyMatrixToLightPoints(const osg::Matrix& adjustmentMatrix);
113 
116  virtual void applyMatrixToLightPointsIncremental(const osg::Matrix& adjustmentMatrix,
117  int firstNodeToChange);
118 
119  virtual void setFadeParameters(const DtIndirectFadeParameters& fadeParameters);
120 
121  virtual DtIndirectFadeParameters fadeParameters() const;
122 
123  // Return number of light points in this node
124  virtual int lightPointCount() const;
125 
126  // Get the light point position for a particular light point
127  virtual osg::Vec3d lightPointPosition(int index) const;
128 
129  // set the light point position for a particular light point requires setDynamicLightsMode
130  virtual void setLightPointPosition(int index, const osg::Vec3d & pos);
131 
132  // Get the light point type
133  virtual int lightPointType(int index) const;
134 
135  // Get the light point node id
136  virtual int lightPointNodeId() const;
137 
138  // Get the light point group id
139  virtual int lightPointGroupId(int index) const;
140 
141  // Get the light point phase
142  virtual float lightPointPhase(int index) const;
143 
144  // Get the light point sector direction
145  virtual osg::Vec3 lightPointSectorDir(int index) const;
146 
147  // Get the light point sector transform
148  virtual const osg::Matrix3& lightPointSectorLocalToLp(int index) const;
149 
152  virtual void setCameraRelativeLightsMode( bool mode = true);
153  virtual bool cameraRelativeLightsMode( );
154 
155  protected:
158  {
159  public:
161  LightPointInfo(int type, std::string group, const osg::Vec3d& pos, const osg::Vec3& sectorDir,
162  const osg::Matrix3& sectorLocalToLp, float phase)
163  : myLightPointType(type)
164  , myLightPointGroup(group)
165  , myPosition(pos)
166  , mySectorLocalToLp(sectorLocalToLp)
167  , mySectorDir(sectorDir)
168  , myPhaseShift(phase)
169  , myActive(true)
170  {
171  /*intentionally nop*/
172  }
173 
175  std::string myLightPointGroup;
176  osg::Vec3d myPosition;
177  osg::Matrix3 mySectorLocalToLp;
178  osg::Vec3 mySectorDir;
180  bool myActive;
181  };
182 
183  typedef std::vector< LightPointInfo > LightPointIntList;
184 
189  virtual osg::BoundingSphere computeBoundsIncremental(int firstNode) const;
190 
191  protected:
192  mutable osg::BoundingBox myMutableBoundingBox; // Bounding box for all the points in the node
193  mutable osg::Vec3 myMutableFurthestPoint; // Used for incremental bounds calculations.
194 
196 
198 
200 
201  std::vector<int> myNodeIds;
202 
203  const osg::Camera* myLastCamera;
205 
208 
210 
212 
214 
216 
218 
219  std::vector<int> myFreeList;
220 
221 
222  protected:
223 
224  mutable boost::recursive_mutex myMutableNodeIdMutex;
225 
226  static int theFrameNum;
227  static const osg::Camera* theLastCamera;
228  };
229 }
DtOsgLightPointManager * myLightPointManager
Definition: DtLightPointNode.h:197
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
std::vector< LightPointInfo > LightPointIntList
Definition: DtLightPointNode.h:183
Definition: featureContext.h:36
boost::recursive_mutex myMutableNodeIdMutex
Definition: DtLightPointNode.h:224
int myFrameNum
Definition: DtLightPointNode.h:204
osg::Vec3d myPosition
Definition: DtLightPointNode.h:176
osg::Matrix3 mySectorLocalToLp
Definition: DtLightPointNode.h:177
bool myActive
Definition: DtLightPointNode.h:180
osg::Vec3 myMutableFurthestPoint
Definition: DtLightPointNode.h:193
std::string myLightPointGroup
Definition: DtLightPointNode.h:175
DtIndirectFadeParameters myFadeParameters
Definition: DtLightPointNode.h:213
static int theFrameNum
Definition: DtLightPointNode.h:226
osg::BoundingBox myMutableBoundingBox
Definition: DtLightPointNode.h:192
DtOsgLightPointManager registers LightPoint nodes so their TBO can be created and updated in a single...
Definition: DtOsgLightPointManager.h:128
int myCurrentInstance
Definition: DtLightPointNode.h:206
osg::Vec3 mySectorDir
Definition: DtLightPointNode.h:178
LightPointIntList myLightPointTypeList
Definition: DtLightPointNode.h:195
Contains makVrv::DtLightPointDrawable class.
std::vector< int > myFreeList
Definition: DtLightPointNode.h:219
LightPointInfo(int type, std::string group, const osg::Vec3d &pos, const osg::Vec3 &sectorDir, const osg::Matrix3 &sectorLocalToLp, float phase)
constructor for filling the structure with data
Definition: DtLightPointNode.h:161
int myGroupId
Definition: DtLightPointNode.h:211
static const osg::Camera * theLastCamera
Definition: DtLightPointNode.h:227
struct for holding the fade parameters used by the indirect rendering cull compute shader ...
Definition: DtIndirectFadeParameters.h:17
Derived from osg::Node and is a replacement for the osgSim::LightPointNode represents a group of ligh...
Definition: DtLightPointNode.h:37
float myPhaseShift
Definition: DtLightPointNode.h:179
float myFirstFrameTime
Definition: DtLightPointNode.h:215
std::vector< osg::Node * > DtNodePointerStack
Definition: DtLightPointNode.h:27
const char int mode
Definition: ioapi.h:38
bool myCameraRelativeLightsMode
Definition: DtLightPointNode.h:217
bool myLightPointsEnabled
Definition: DtLightPointNode.h:209
structure for holding all the information required to describe a single light point.
Definition: DtLightPointNode.h:157
Contains DLL export macros.
int myLightPointType
Definition: DtLightPointNode.h:174
int myAddedInstances
Definition: DtLightPointNode.h:207
osg::ref_ptr< DtLightPointDrawable > myLightPointDrawable
Definition: DtLightPointNode.h:199
const osg::Camera * myLastCamera
Definition: DtLightPointNode.h:203
Contains makVrv::DtIndirectFadeParameters class.
std::vector< int > myNodeIds
Definition: DtLightPointNode.h:201

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)