VR-Forces 4.7 Class Documentation
 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) 2017 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
14 #include <vrvCore/DtDe.h>
15 
17 
18 #include <osg/Drawable>
19 #include <osg/Vec3>
20 #include <osg/Vec4>
21 #include <osg/Depth>
22 #include <osg/BlendFunc>
23 #include <osg/BlendEquation>
24 #include <osg/ColorMask>
25 #include <osg/Point>
26 #include <osg/Endian>
27 #include <osg/Texture>
28 #include <osgSim/Export>
29 
30 #include <vector>
31 
32 
33 namespace makVrv
34 {
35 
36  class DtOsgLightPointManager;
37  class DtGlBuffer;
38 
51  class DT_DLL_VRVOSG DtLightPointDrawable : public osg::Drawable
52  {
53  public:
54 
61  {
62  int myType;
63  int myGroup;
64  int myNode;
65  osg::Matrix3 mySectorLocalToLp;
66  float myPhase;
67  osg::Vec3 myPos;
69  myType(-1),
70  myGroup(-1),
71  myNode(-1),
72  mySectorLocalToLp(),
73  myPhase(0.0),
74  myPos(0, 0, 0)
75  {
76  }
77 
78  LightPointVertexAttrib(int type, int groupId, int nodeId, const osg::Matrix3 &sectorLocalToLp, float phase, const osg::Vec3& pos) :
79  myType(type),
80  myGroup(groupId),
81  myNode(nodeId),
82  mySectorLocalToLp(sectorLocalToLp),
83  myPhase(phase),
84  myPos(pos)
85  {
86  }
87  };
88 
89  virtual void releaseGLObjects(osg::State* state) const;
90 
91  public:
92 
96 
98  DtLightPointDrawable(const DtLightPointDrawable&, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
99 
102  virtual osg::Object* clone(const osg::CopyOp& copyop) const
103  {
104  return new DtLightPointDrawable(*this, copyop);
105  }
106  virtual osg::Object* cloneType() const
107  {
108  return NULL;
109  }
110  virtual bool isSameKindAs(const osg::Object* obj) const
111  {
112  return dynamic_cast<const DtLightPointDrawable *>(obj) != NULL;
113  }
114  virtual const char* className() const
115  {
116  return "DtLightPointDrawable";
117  }
118  virtual const char* libraryName() const
119  {
120  return "vrvOsg";
121  }
122  virtual void accept(osg::NodeVisitor& nv)
123  {
124  if (nv.validNodeMask(*this))
125  {
126  nv.pushOntoNodePath(this);
127  nv.apply(*this);
128  nv.popFromNodePath();
129  }
130  }
132 
133 
136  virtual void setLightPointManager(DtOsgLightPointManager *lpManager);
137 
139  virtual DtOsgLightPointManager *findLightPointManger();
140 
142  virtual void addLightPoint(const LightPointVertexAttrib& attribData);
143 
145  virtual void removeLightPoints(const std::vector<int>& nodeIds);
146 
148  virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
149 
151  virtual void setSimulationTime(double time);
152 
154  virtual double simulationTime() const;
155 
157  virtual osg::BoundingBox computeBoundingBox() const;
158 
159  protected:
160 
162  void slot_reverseZChanged(bool flag);
163 
166 
167  protected:
168 
170 
171  typedef std::vector<LightPointVertexAttrib> LightPointList;
173 
174  osg::ref_ptr<osg::Depth> myDepthOn;
175  osg::ref_ptr<osg::BlendFunc> myBlendFunc;
176  osg::ref_ptr<osg::BlendEquation> myBlendEquation;
177 
179 
180  //Texture for rendering the debug labels. Contains all 10 digits so that any number can be
181  // shown using the debug labels. The debug labels show the light point type for now.
182  osg::ref_ptr<osg::Texture> myDigitTexture;
183 
185 
186  osg::ref_ptr<osg::Uniform> myTimeUniform;
187 
189 
190  };
191 
193  {
194  public:
197 
199  virtual ~DtLightPointDrawableCreator();
200 
202  virtual DtLightPointDrawable* create() const;
203 
206  static DtLightPointDrawableCreator& instance(DtDe& de);
207 
209  static const std::string& theClassName();
210  protected:
211 
213  };
214 
215 
216 }
217 

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)