AGX Dynamics  2.37.3.2
CylinderGeometryShader.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXOSG_CYLINDER_GEOMETRY_SHADER_H
18 #define AGXOSG_CYLINDER_GEOMETRY_SHADER_H
19 
20 
21 #include <agxOSG/export.h>
22 
23 #include <agx/agx_vector_types.h>
24 
25 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
26 #include <osg/Geometry>
27 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
28 
29 namespace agxCollide
30 {
31  class Geometry;
32 }
33 
34 namespace agxOSG
35 {
36  class AGXOSG_EXPORT CylinderGeometryShader : public osg::Geometry
37  {
38  public:
39  CylinderGeometryShader(size_t initialBufferSize = 256);
40 
44  void add(const agx::Vec3& startPoint, const agx::Vec3& endPoint, agx::Real radius, agx::Vec2 redShift = agx::Vec2(0, 0));
45 
49  void add(const agx::Vec3& point, const agx::Quat& zToDir, agx::Real radius, agx::Real redShift = agx::Real(0));
50 
55  void add(const agxCollide::Geometry* geometry);
56 
60  void update();
61 
65  void resetCounters();
66 
70  osg::Program* getProgram() { return m_program; }
71  const osg::Program* getProgram() const { return m_program; }
72 
76  osg::Uniform* getNumCylinderSegmentsUniform() { return m_numCylinderSegments; }
77  const osg::Uniform* getNumCylinderSegmentsUniform() const { return m_numCylinderSegments; }
78 
82  osg::Uniform* getCylinderColorUniform() { return m_cylinderColor; }
83  const osg::Uniform* getCylinderColorUniform() const { return m_cylinderColor; }
84 
85  osg::Vec3Array* getVertexArray() { return m_vertexArray; }
86  osg::Vec4Array* getQuatsInColorArray() { return m_quatsInColorArray; }
87  osg::FloatArray* getRadiusArray() { return m_radiusArray; }
88  void setNumActiveElements(size_t numActiveElements) { m_numActiveElements = numActiveElements; }
89 
90  protected:
91  virtual ~CylinderGeometryShader();
92 
93  protected:
95 
96  osg::DrawArrays* m_primitiveSet;
97  osg::Vec3Array* m_vertexArray;
98  osg::Vec4Array* m_quatsInColorArray;
99  osg::FloatArray* m_radiusArray;
100  osg::FloatArray* m_redShiftArray;
101  osg::Program* m_program;
102  osg::Uniform* m_numCylinderSegments;
103  osg::Uniform* m_cylinderColor;
104  };
105 
106  typedef osg::ref_ptr< CylinderGeometryShader > CylinderGeometryShaderRef;
107 
108 }
109 
110 #endif
#define AGXOSG_EXPORT
This namespace consists of a set of classes for handling geometric intersection tests including boole...
void setNumActiveElements(size_t numActiveElements)
const osg::Uniform * getNumCylinderSegmentsUniform() const
The geometry representation used by the collision detection engine.
Definition: Geometry.h:92
const osg::Program * getProgram() const
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
const osg::Uniform * getCylinderColorUniform() const
osg::ref_ptr< CylinderGeometryShader > CylinderGeometryShaderRef
double Real
Definition: Real.h:42