VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtFxGizmoRenderer.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 <vrvFx/vrvFx.h>
13 
14 #include <bdi_vector_arrays.h>
15 
16 #include <osg/Vec3>
17 #include <osg/ref_ptr>
18 
19 #include <string>
20 #include <vector>
21 
22 namespace osg
23 {
24  class RenderInfo;
25  class Program;
26  class Shader;
27  class State;
28  class StateSet;
29 }
30 
31 class bdiUShortArray;
32 
33 namespace makVrv
34 {
35  class DtFxOglParticleSystemRenderer;
39  {
40  public:
46  void releaseGLObjects(osg::State* state) const;
47 
49  void init();
51  void setName(const char* name);
53  void update(const bdiVec3fArray& verts,
54  const bdiVec4fArray* colors, const bdiVec3fArray* normals, const bdiVec2fArray* uvs,
55  const bdiUShortArray* index_buffer);
57  void updateBuffer(GLuint& id, const char* suffix, int size, void* data);
58 
60  void draw(const bdiMat4f& model_matrix, const bdiVec4f& default_color = bdiVec4f(1, 1, 1, 1));
61 
62  public:
63  std::string m_name;
64 
65  mutable unsigned int m_verts_object;
66  mutable unsigned int m_colors_object;
67  mutable unsigned int m_normals_object;
68  mutable unsigned int m_index_buffer;
69  mutable unsigned int m_model_matrix_buffer;
70  mutable unsigned int m_color_array_buffer;
75  };
76 
80  {
81  public:
86 
88  void releaseGLObjects(osg::State* state);
89 
91  void setCameraPos(const bdiFarPosition& pos);
92 
94  const bdiFarPosition& getCameraPos();
95 
97  void drawAxis(osg::RenderInfo& renderInfo, const osg::Vec3& pos);
98 
100  void drawStreamedData(osg::RenderInfo& renderInfo, const bdiMat4f& model_matrix, int primitive_type,
101  const bdiVec3fArray& verts, const bdiVec4fArray* colors, const bdiVec3fArray* normals,
102  const std::vector<unsigned short>* index_buffer,
103  const bdiVec4f& default_color = bdiVec4f(1, 1, 1, 1));
104 
106  void drawBox(osg::RenderInfo& renderInfo, bool highlight, const bdiFarPosition& p1, const bdiFarPosition& p2,
107  const bdiVec4f& color);
108 
110  void drawBoxFromPoints(osg::RenderInfo& renderInfo, const bdiMat4f& model_matrix, bool highlight,
111  const bdiVec3f& pMin, const bdiVec3f& pMax, const bdiVec4f& color);
112 
114  static void renderSphereIntoVbo(const bdiVec3f& localCenter, const bdiVec3f& radii, const bdiMat4f& geocentricMatrix,
115  const bdiVec4f& force_color, bdiVec3fArray& verts, bdiVec4fArray& colors);
116 
118  static void renderCircleIntoVbo(const bdiVec3f& localCenter, const float radii, const bdiMat4f& geocentricMatrix,
119  const bdiVec4f& force_color, bdiVec3fArray& verts, bdiVec4fArray& colors);
120 
122  static void renderHemisphereIntoVbo(const bdiVec3f& center, const bdiVec3f& radii, const bdiMat4f& geocentricMatrix,
123  const bdiVec4f& force_color, bdiVec3fArray& verts, bdiVec4fArray& colors);
124 
126  static void renderEllipseIntoVbo(const bdiVec3f& localCenter, const bdiVec2f& radii, const bdiMat4f& geocentricMatrix,
127  const bdiVec4f& force_color, bdiVec3fArray& verts, bdiVec4fArray& colors);
128 
130  static void renderBoxIntoVbo(const bdiVec3f& localCenter, const bdiVec3f& localMin, const bdiVec3f& localMax, const bdiMat4f& geocentricMatrix,
131  const bdiVec4f& force_color, bdiVec3fArray& verts, bdiVec4fArray& colors);
132 
134  bdiVec3fArray& scratchVerts(bool depth_test_mode);
136  bdiVec4fArray& scratchColors(bool depth_test_mode);
137 
139  bdiVec3fArray& scratchPointsVerts(bool depth_test_mode);
141  bdiVec4fArray& scratchPointsColors(bool depth_test_mode);
142 
143  protected:
147 
148  // used for drawing boxes
149  bdiVec3fArray m_line_strip_verts[2];
150  bdiVec4fArray m_line_strip_colors[2];
151  std::vector<unsigned short> m_line_strip_indexes[2];
152 
154 
155  bdiFarPosition m_camera_pos;
156  bdiVec3fArray m_scratch_verts[2];
157  bdiVec4fArray m_scratch_colors[2];
158 
159  bdiVec3fArray m_scratch_points_verts[2];
160  bdiVec4fArray m_scratch_points_colors[2];
161 
163 
168 
169  };
170 
171 
172 }
DT_DLL_EXAMPLESCENEROOTPLUGIN void init(DtDe &anIG)
a class to quickly render a bunch of basic primitives as debugging aids
Definition: DtFxGizmoRenderer.h:79
std::string m_name
Definition: DtFxGizmoRenderer.h:63
unsigned int m_index_buffer
Definition: DtFxGizmoRenderer.h:68
int m_depth_test_mode
Definition: DtFxGizmoRenderer.h:162
voidpf void uLong size
Definition: ioapi.h:39
#define DT_DLL_VRVFX
Definition: vrvFx.h:20
DtDe & myDe
Definition: DtFxGizmoRenderer.h:144
unsigned int GLuint
Definition: DtGlTextureBufferObject.h:17
DtFxStreamedVboData m_dynamic_vbo
Definition: DtFxGizmoRenderer.h:145
unsigned int m_verts_object
Definition: DtFxGizmoRenderer.h:65
Contains DLL export macros.
unsigned int m_colors_object
Definition: DtFxGizmoRenderer.h:66
int m_primitive_type
Definition: DtFxGizmoRenderer.h:74
bdiFarPosition m_camera_pos
Definition: DtFxGizmoRenderer.h:155
unsigned int m_normals_object
Definition: DtFxGizmoRenderer.h:67
int m_index_count
Definition: DtFxGizmoRenderer.h:72
osg::ref_ptr< osg::Program > m_default_program
Definition: DtFxGizmoRenderer.h:167
osg::ref_ptr< osg::Shader > m_vertex_shader
Definition: DtFxGizmoRenderer.h:165
GLuint m_vertex_array_object
Definition: DtFxGizmoRenderer.h:153
unsigned int m_color_array_buffer
Definition: DtFxGizmoRenderer.h:70
osg::ref_ptr< osg::Shader > m_fragment_shader
Definition: DtFxGizmoRenderer.h:166
unsigned int m_model_matrix_buffer
Definition: DtFxGizmoRenderer.h:69
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
DtFxStreamedVboData m_axis_vbo
Definition: DtFxGizmoRenderer.h:146
int m_intialized
Definition: DtFxGizmoRenderer.h:73
a helper struct to send basic primitives to video card
Definition: DtFxGizmoRenderer.h:38
int m_primitive_size
Definition: DtFxGizmoRenderer.h:71
osg::ref_ptr< osg::StateSet > m_debug_state_set
Definition: DtFxGizmoRenderer.h:164

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)