VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgGizmoRenderer.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
14 #include <osg/Vec3>
15 #include <osg/MatrixTransform>
16 #include <osg/Drawable>
17 
19 
20 namespace osg
21 {
22  class RenderInfo;
23 }
24 
25 
26 namespace makVrv
27 {
28  class DtOsgGizmoRenderer;
32  {
33  public:
36 
39  private:
43  DtDebugDrawCallbackInterface& operator=(const DtDebugDrawCallbackInterface& rhs) = delete;
44  public:
45 
47  virtual void drawDebugLines(osg::RenderInfo& renderInfo, const osg::Vec3d& eyePoint, DtOsgGizmoRenderer* renderer) = 0;
48 
50  virtual void systemShutDown();
51 
52  protected:
54 
55  };
56 
59  class DT_DLL_VRVOSG DtOsgGizmoTransform : public osg::MatrixTransform
60  {
61  public:
64 
67  private:
69  DtOsgGizmoTransform(const DtOsgGizmoTransform& ob, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
70 
72  DtOsgGizmoTransform& operator=(const DtOsgGizmoTransform& rhs) = delete;
73  public:
74 
76  virtual osg::Object* clone(const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY) const;
77 
82  virtual bool computeWorldToLocalMatrix(osg::Matrix& matrix, osg::NodeVisitor* nv) const;
83 
85  virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix, osg::NodeVisitor* nv) const;
86  };
87 
91  {
92  public:
97 
98  private:
100  DtStreamedVboData(const DtStreamedVboData& rhs) = delete;
102  DtStreamedVboData& operator=(const DtStreamedVboData& rhs) = delete;
103 
104  public:
106  virtual void releaseGLObjects(osg::State* state) const;
107 
109  virtual void init();
110 
112  virtual void setName(const char* name);
113 
114  public:
115  std::string myName;
116 
117  mutable unsigned int myVertsObject;
118  mutable unsigned int myColorsObject;
119  mutable unsigned int myNormalsObject;
120  mutable unsigned int myIndexBuffer;
121  mutable unsigned int myModelMatrixBuffer;
122  mutable unsigned int myColorArrayBuffer;
127  };
128 
136  class DT_DLL_VRVOSG DtOsgGizmoRenderer : public osg::Drawable
137  {
138  public:
143  private:
145  DtOsgGizmoRenderer(const DtOsgGizmoRenderer& rhs) = delete;
147  DtOsgGizmoRenderer& operator=(const DtOsgGizmoRenderer& rhs) = delete;
148 
149  public:
150 
152  virtual void releaseGLObjects(osg::State* state);
153 
155  virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
156 
158  virtual void addDebugDrawerCallback(DtDebugDrawCallbackInterface* drawer);
159 
161  virtual void addWsLine(const osg::Vec3d& p1, const osg::Vec3d& p2, const osg::Vec4f& color1, const osg::Vec4f& color2, bool depth_test = true);
162 
164  // virtual void drawAxis(const osg::Matrixf& model_matrix, const osg::Vec3& pos);
165 
167  virtual void renderWsBoxIntoVbo(const osg::Vec3d& p1, const osg::Vec3d& p2,
168  const osg::Vec4f& color);
169 
171  virtual void renderBoxFromPointsIntoVbo(const osg::Matrixf& model_matrix,
172  const osg::Vec3f& pMin, const osg::Vec3f& pMax, const osg::Vec4f& color);
173 
175  virtual void renderSphereIntoVbo(const osg::Vec3f& localCenter, const osg::Vec3f& radii, const osg::Matrixf& xform,
176  const osg::Vec4f& force_color);
177 
179  virtual void renderCircleIntoVbo(const osg::Vec3f& localCenter, const float radii, const osg::Matrixf& xform,
180  const osg::Vec4f& force_color);
181 
183  virtual void renderHemisphereIntoVbo(const osg::Vec3f& localCenter, const osg::Vec3f& radii, const osg::Matrixf& xform,
184  const osg::Vec4f& force_color);
185 
187  virtual void renderEllipseIntoVbo(const osg::Vec3f& localCenter, const osg::Vec2f& radii, const osg::Matrixf& xform,
188  const osg::Vec4f& force_color);
189 
191  virtual void renderBoxIntoVbo(const osg::Vec3f& localCenter, const osg::Vec3f& localMin, const osg::Vec3f& localMax, const osg::Matrixf& xform,
192  const osg::Vec4f& force_color);
193 
195  virtual void drawStreamedData(osg::RenderInfo& renderInfo, int primitive_type,
196  const std::vector<osg::Vec3f>& verts, const std::vector<osg::Vec4f>* colors, const std::vector<osg::Vec3f>* normals,
197  const std::vector<unsigned short>* index_buffer,
198  const osg::Vec4f& default_color = osg::Vec4f(1, 1, 1, 1));
199 
200  protected:
202  virtual void setCameraPos(const osg::Vec3& pos);
203 
205  virtual void drawImplementationNonConst(osg::RenderInfo& renderInfo);
206 
207  protected:
211 
212  // used for drawing boxes
213  std::vector<osg::Vec3f> myLineStripVerts;
214  std::vector<osg::Vec4f> myLineStripColors;
215  std::vector<unsigned short> myLineStripIndexes;
216 
218 
219  osg::Vec3d myCameraPosition;
220  std::vector<osg::Vec3f> myScratchVerts[2];
221  std::vector<osg::Vec4f> myScratchColors[2];
222  std::vector<DtDebugDrawCallbackInterface*> myExtraDebugDrawObjects;
223  };
224 
225 
229  {
230  public:
234  virtual ~DtOsgGizmoRendererManager();
235 
236  private:
240  DtOsgGizmoRendererManager& operator=(const DtOsgGizmoRendererManager& rhs) = delete;
241 
242  public:
243 
245  virtual DtOsgGizmoRenderer* gizmoRenderer();
246  public:
247 
250  static DtOsgGizmoRendererManager& instance(DtDe& de);
251 
252  static void registerInstance(DtDe& de, DtOsgGizmoRendererManager *manager);
253  static const std::string& theClassName();
254 
255  protected:
258  };
259 
260 }
DT_DLL_EXAMPLESCENEROOTPLUGIN void init(DtDe &anIG)
int myPrimitiveSize
Definition: DtOsgGizmoRenderer.h:123
unsigned int myColorArrayBuffer
Definition: DtOsgGizmoRenderer.h:122
a helper struct to send basic primitives to video card
Definition: DtOsgGizmoRenderer.h:90
Virtual base class.
Definition: DtVirtualBaseClass.h:19
DtStreamedVboData myDynamicVbo
Definition: DtOsgGizmoRenderer.h:209
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Definition: featureContext.h:37
std::vector< unsigned short > myLineStripIndexes
Definition: DtOsgGizmoRenderer.h:215
unsigned int GLuint
Definition: DtGlTextureBufferObject.h:17
A simple interface for allowing the various systems to draw lines at the right time.
Definition: DtOsgGizmoRenderer.h:31
a class to quickly render a bunch of basic primitives as debugging aids basic overview, create an adapter that inherits from DtDebugDrawCallbackInterface then call DtOsgGizmoRenderer::addDebugDrawerCallback() to register it with the system.
Definition: DtOsgGizmoRenderer.h:136
unsigned int myColorsObject
Definition: DtOsgGizmoRenderer.h:118
DtDe & myDe
Definition: DtOsgGizmoRenderer.h:208
int myPrimitiveType
Definition: DtOsgGizmoRenderer.h:126
DtDe & myDe
Definition: DtOsgGizmoRenderer.h:53
Contains makVrv::DtVirtualBaseClass class.
unsigned int myModelMatrixBuffer
Definition: DtOsgGizmoRenderer.h:121
unsigned int myNormalsObject
Definition: DtOsgGizmoRenderer.h:119
DtGizmoRendererManager.
Definition: DtOsgGizmoRenderer.h:228
std::string myName
Definition: DtOsgGizmoRenderer.h:115
osg::Vec3d myCameraPosition
Definition: DtOsgGizmoRenderer.h:219
osg::ref_ptr< DtOsgGizmoRenderer > myRenderer
Definition: DtOsgGizmoRenderer.h:257
unsigned int myVertsObject
Definition: DtOsgGizmoRenderer.h:117
std::vector< osg::Vec4f > myLineStripColors
Definition: DtOsgGizmoRenderer.h:214
unsigned int myIndexBuffer
Definition: DtOsgGizmoRenderer.h:120
GLuint myVao
Definition: DtOsgGizmoRenderer.h:217
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
DtStreamedVboData myAxisVbo
Definition: DtOsgGizmoRenderer.h:210
DtDe & myDe
Definition: DtOsgGizmoRenderer.h:256
int myIsInitialized
Definition: DtOsgGizmoRenderer.h:125
std::vector< osg::Vec3f > myLineStripVerts
Definition: DtOsgGizmoRenderer.h:213
std::vector< DtDebugDrawCallbackInterface * > myExtraDebugDrawObjects
Definition: DtOsgGizmoRenderer.h:222
Helps attach the drawable to the scene graph.
Definition: DtOsgGizmoRenderer.h:59
int myIndexCount
Definition: DtOsgGizmoRenderer.h:124

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)