VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtLightPointDrawable.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2022 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
14 
15 #include <vrvCore/DtDe.h>
16 
17 #include <osg/Drawable>
18 #include <osg/Vec3>
19 #include <osg/Vec4>
20 #include <osg/Depth>
21 #include <osg/BlendFunc>
22 #include <osg/BlendEquation>
23 #include <osg/ColorMask>
24 #include <osg/Point>
25 #include <osg/Endian>
26 #include <osg/Texture>
27 #include <osg/PointSprite>
28 #include <osgSim/Export>
29 
30 #include <vector>
31 
32 namespace makVrv
33 {
34  class DtOsgLightPointManager;
35  class DtGlBuffer;
36 
49  class DT_DLL_VRVOSG DtLightPointDrawable : public osg::Drawable
50  {
51  public:
52 
59  {
60  int myType;
61  int myGroup;
62  int myNode;
63  float myPhase;
64  osg::Matrix3 mySectorLocalToLp;
65  osg::Vec3 myPos;
67  myType(-1),
68  myGroup(-1),
69  myNode(-1),
70  mySectorLocalToLp(),
71  myPhase(0.0),
72  myPos(0, 0, 0)
73  {
74  }
75 
76  LightPointVertexAttrib(int type, int groupId, int nodeId, const osg::Matrix3 &sectorLocalToLp, float phase, const osg::Vec3& pos) :
77  myType(type),
78  myGroup(groupId),
79  myNode(nodeId),
80  mySectorLocalToLp(sectorLocalToLp),
81  myPhase(phase),
82  myPos(pos)
83  {
84  }
85  };
86 
87  public:
88 
92 
94  DtLightPointDrawable(const DtLightPointDrawable&, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
95 
96  protected:
98  virtual ~DtLightPointDrawable();
99 
100  public:
103  virtual osg::Object* clone(const osg::CopyOp& copyop) const
104  {
105  return new DtLightPointDrawable(*this, copyop);
106  }
107  virtual osg::Object* cloneType() const
108  {
109  return NULL;
110  }
111  virtual bool isSameKindAs(const osg::Object* obj) const
112  {
113  return dynamic_cast<const DtLightPointDrawable *>(obj) != NULL;
114  }
115  virtual const char* className() const
116  {
117  return "DtLightPointDrawable";
118  }
119  virtual const char* libraryName() const
120  {
121  return "vrvOsg";
122  }
123  virtual void accept(osg::NodeVisitor& nv)
124  {
125  if (nv.validNodeMask(*this))
126  {
127  nv.pushOntoNodePath(this);
128  nv.apply(*this);
129  nv.popFromNodePath();
130  }
131  }
133 
134  public:
135 
137  virtual void releaseGLObjects(osg::State* state) const;
138 
140  virtual void accept(osg::PrimitiveFunctor &functor) const;
141 
144  virtual void setLightPointManager(DtOsgLightPointManager *lpManager);
145 
147  virtual DtOsgLightPointManager *findLightPointManger();
148 
150  virtual void addLightPoint(const LightPointVertexAttrib& attribData);
151 
153  virtual void removeLightPoints(const std::vector<int>& nodeIds);
154 
155 
157  virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
159  virtual void setSimulationTime(double time);
160 
162  virtual double simulationTime() const;
163 
165  virtual osg::BoundingBox computeBoundingBox() const;
166 
167  protected:
168 
170  virtual void init();
171 
173  virtual void setUpReverseZ(bool flag);
174  protected:
175 
177 
178  typedef std::vector<LightPointVertexAttrib> LightPointList;
180 
184 
186 
187  //Texture for rendering the debug labels. Contains all 10 digits so that any number can be
188  // shown using the debug labels. The debug labels show the light point type for now.
190 
192 
194 
197 
199 
201  };
202 
204  {
205  public:
208 
210  virtual ~DtLightPointDrawableCreator();
211 
213  virtual DtLightPointDrawable* create() const;
214 
217  static DtLightPointDrawableCreator& instance(DtDe& de);
218 
220  static const std::string& theClassName();
221  protected:
222 
224  };
225 
226 
227 }
228 
DT_DLL_EXAMPLESCENEROOTPLUGIN void init(DtDe &anIG)
virtual const char * libraryName() const
Definition: DtLightPointDrawable.h:119
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
DtOsgLightPointManager * myLightPointManager
Definition: DtLightPointDrawable.h:185
DtDe & myDe
Definition: DtLightPointDrawable.h:191
virtual osg::Object * cloneType() const
Definition: DtLightPointDrawable.h:107
LightPointVertexAttrib()
Definition: DtLightPointDrawable.h:66
LightPointList myLightPointList
Definition: DtLightPointDrawable.h:179
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
osg::ref_ptr< osg::Texture > myDigitTexture
Definition: DtLightPointDrawable.h:189
osg::Vec3 myPos
Definition: DtLightPointDrawable.h:65
Contains makVrv::DtDe class.
int myType
Definition: DtLightPointDrawable.h:60
double mySimulationTime
Definition: DtLightPointDrawable.h:176
osg::Matrix3 mySectorLocalToLp
Definition: DtLightPointDrawable.h:64
virtual void accept(osg::NodeVisitor &nv)
Definition: DtLightPointDrawable.h:123
DtOsgLightPointManager registers LightPoint nodes so their TBO can be created and updated in a single...
Definition: DtOsgLightPointManager.h:128
int myGroup
Definition: DtLightPointDrawable.h:61
osg::ref_ptr< osg::PointSprite > mySprite
Definition: DtLightPointDrawable.h:200
int myNode
Definition: DtLightPointDrawable.h:62
osg::ref_ptr< osg::BlendFunc > myBlendFunc
Definition: DtLightPointDrawable.h:182
Structure that matches the format of the data that is sent down as vertex attributes for the light po...
Definition: DtLightPointDrawable.h:58
virtual bool isSameKindAs(const osg::Object *obj) const
Definition: DtLightPointDrawable.h:111
int myMutableLightPointListMinChanged
Definition: DtLightPointDrawable.h:195
osg::ref_ptr< osg::Depth > myDepthOn
Definition: DtLightPointDrawable.h:181
Manager to delete GL object in the main thread.
virtual osg::Object * clone(const osg::CopyOp &copyop) const
required functions for deriving from osg::Drawable couldn&#39;t use META_Node because it didn&#39;t compile ...
Definition: DtLightPointDrawable.h:103
LightPointVertexAttrib(int type, int groupId, int nodeId, const osg::Matrix3 &sectorLocalToLp, float phase, const osg::Vec3 &pos)
Definition: DtLightPointDrawable.h:76
float myPhase
Definition: DtLightPointDrawable.h:63
Class derived from osg::Drawable to handle all DtLightPointNode light points it gathers all the light...
Definition: DtLightPointDrawable.h:49
osg::ref_ptr< osg::Uniform > myTimeUniform
Definition: DtLightPointDrawable.h:193
Contains DLL export macros.
std::vector< LightPointVertexAttrib > LightPointList
Definition: DtLightPointDrawable.h:178
virtual const char * className() const
Definition: DtLightPointDrawable.h:115
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
Definition: DtLightPointDrawable.h:203
DtDe & myDe
Definition: DtLightPointDrawable.h:223
int myMutableLightPointListMaxChanged
Definition: DtLightPointDrawable.h:196
bool myInitialized
Definition: DtLightPointDrawable.h:198
osg::ref_ptr< osg::BlendEquation > myBlendEquation
Definition: DtLightPointDrawable.h:183

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)