VR-Forces 5.0.3 Developer's Guide
 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) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
15 
16 #include <osg/Vec3>
17 #include <osg/Vec4>
18 #include <osg/Matrix>
19 #include <osg/Drawable>
20 
22 
23 #include <array>
24 
25 namespace osg
26 {
27  class RenderInfo;
28  class State;
29 }
30 
31 namespace makVrv
32 {
33  class DtOsgGizmoRenderer;
34  class DtDebugDrawCallbackInterface;
35 
36 
44  class DT_DLL_VRVOSG DtOsgGizmoRenderer : public osg::Drawable
45  {
46  public:
51  private:
53  DtOsgGizmoRenderer(const DtOsgGizmoRenderer& rhs) = delete;
55  DtOsgGizmoRenderer& operator=(const DtOsgGizmoRenderer& rhs) = delete;
56 
57  public:
58 
60  virtual void releaseGLObjects(osg::State* state);
61 
63  virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
64 
66  virtual void addDebugDrawerCallback(DtDebugDrawCallbackInterface* drawer);
67 
69  virtual void addWsLine(const osg::Vec3d& p1, const osg::Vec3d& p2, const osg::Vec4f& color1, const osg::Vec4f& color2, bool depth_test = true);
70 
72  // virtual void drawAxis(const osg::Matrixf& model_matrix, const osg::Vec3& pos);
73 
75  virtual void renderWsBoxIntoVbo(const osg::Vec3d& p1, const osg::Vec3d& p2,
76  const osg::Vec4f& color);
77 
79  virtual void renderBoxFromPointsIntoVbo(const osg::Matrixf& model_matrix,
80  const osg::Vec3f& pMin, const osg::Vec3f& pMax, const osg::Vec4f& color);
81 
83  virtual void renderSphereIntoVbo(const osg::Vec3f& localCenter, const osg::Vec3f& radii, const osg::Matrixf& xform,
84  const osg::Vec4f& force_color);
85 
87  virtual void renderCircleIntoVbo(const osg::Vec3f& localCenter, const float radii, const osg::Matrixf& xform,
88  const osg::Vec4f& force_color);
89 
91  virtual void renderHemisphereIntoVbo(const osg::Vec3f& localCenter, const osg::Vec3f& radii, const osg::Matrixf& xform,
92  const osg::Vec4f& force_color);
93 
95  virtual void renderEllipseIntoVbo(const osg::Vec3f& localCenter, const osg::Vec2f& radii, const osg::Matrixf& xform,
96  const osg::Vec4f& force_color);
97 
99  virtual void renderBoxIntoVbo(const osg::Vec3f& localCenter, const osg::Vec3f& localMin, const osg::Vec3f& localMax, const osg::Matrixf& xform,
100  const osg::Vec4f& force_color);
101 
103  virtual void drawStreamedData(osg::RenderInfo& renderInfo, int primitive_type,
104  const std::vector<osg::Vec3f>& verts, const std::vector<osg::Vec4f>* colors, const std::vector<osg::Vec3f>* normals,
105  const std::vector<unsigned short>* index_buffer,
106  const osg::Vec4f& default_color = osg::Vec4f(1, 1, 1, 1));
107 
108  protected:
110  virtual void setCameraPos(const osg::Vec3& pos);
111 
113  virtual void drawImplementationNonConst(osg::RenderInfo& renderInfo);
114 
116  virtual bool anythingToDraw(void) const;
117 
118  protected:
122 
123  // used for drawing boxes
124  std::vector<osg::Vec3f> myLineStripVerts;
125  std::vector<osg::Vec4f> myLineStripColors;
126  std::vector<unsigned short> myLineStripIndexes;
127 
129 
130  osg::Vec3d myCameraPosition;
131  std::array< std::vector<osg::Vec3f>, 2> myScratchVerts;
132  std::array< std::vector<osg::Vec4f>, 2> myScratchColors;
133  std::vector<DtDebugDrawCallbackInterface*> myExtraDebugDrawObjects;
134  };
135 
136 
137 
138 
139 }
a helper struct to send basic primitives to video card
Definition: DtStreamedVboData.h:25
Contains makVrv::DtStreamedVboData class.
std::array< std::vector< osg::Vec3f >, 2 > myScratchVerts
Definition: DtOsgGizmoRenderer.h:131
DtStreamedVboData myDynamicVbo
Definition: DtOsgGizmoRenderer.h:120
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
std::vector< unsigned short > myLineStripIndexes
Definition: DtOsgGizmoRenderer.h:126
unsigned int GLuint
Definition: DtGlTextureBufferObject.h:17
A simple interface for allowing the various systems to draw lines at the right time.
Definition: DtDebugDrawCallbackInterface.h:30
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. Your code will then get called while the system is drawing, user should then add various primitives that will get rendered in one big batch after all the callbacks. See DtOsgLightDebugAdapter::drawDebugLines() for an example.
Definition: DtOsgGizmoRenderer.h:44
std::array< std::vector< osg::Vec4f >, 2 > myScratchColors
Definition: DtOsgGizmoRenderer.h:132
DtDe & myDe
Definition: DtOsgGizmoRenderer.h:119
Contains makVrv::DtVirtualBaseClass class.
osg::Vec3d myCameraPosition
Definition: DtOsgGizmoRenderer.h:130
std::vector< osg::Vec4f > myLineStripColors
Definition: DtOsgGizmoRenderer.h:125
GLuint myVao
Definition: DtOsgGizmoRenderer.h:128
Contains DLL export macros.
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:70
DtStreamedVboData myAxisVbo
Definition: DtOsgGizmoRenderer.h:121
std::vector< osg::Vec3f > myLineStripVerts
Definition: DtOsgGizmoRenderer.h:124
std::vector< DtDebugDrawCallbackInterface * > myExtraDebugDrawObjects
Definition: DtOsgGizmoRenderer.h:133

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)