AGXDynamics  2.35.0.2
CylinderGeometryShader.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. 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;
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
agxOSG::CylinderGeometryShader::setNumActiveElements
void setNumActiveElements(size_t numActiveElements)
Definition: CylinderGeometryShader.h:88
agx::Real
double Real
Definition: Real.h:42
agxOSG::CylinderGeometryShader::m_redShiftArray
osg::FloatArray * m_redShiftArray
Definition: CylinderGeometryShader.h:100
agxOSG::CylinderGeometryShader::m_cylinderColor
osg::Uniform * m_cylinderColor
Definition: CylinderGeometryShader.h:103
agxOSG::CylinderGeometryShader::m_numActiveElements
size_t m_numActiveElements
Definition: CylinderGeometryShader.h:94
agxOSG::CylinderGeometryShader::getNumCylinderSegmentsUniform
const osg::Uniform * getNumCylinderSegmentsUniform() const
Definition: CylinderGeometryShader.h:77
agxOSG::CylinderGeometryShader::getProgram
osg::Program * getProgram()
Definition: CylinderGeometryShader.h:70
agxOSG::CylinderGeometryShader
Definition: CylinderGeometryShader.h:36
agxOSG::CylinderGeometryShader::getCylinderColorUniform
const osg::Uniform * getCylinderColorUniform() const
Definition: CylinderGeometryShader.h:83
agxOSG
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
PushDisableWarnings.h
agxOSG::CylinderGeometryShader::getQuatsInColorArray
osg::Vec4Array * getQuatsInColorArray()
Definition: CylinderGeometryShader.h:86
agxCollide::Geometry
The geometry representation used by the collision detection engine.
Definition: Geometry.h:92
agx::Vec2T
Definition: Vec2Template.h:30
agxOSG::CylinderGeometryShader::m_primitiveSet
osg::DrawArrays * m_primitiveSet
Definition: CylinderGeometryShader.h:96
agxOSG::CylinderGeometryShader::getNumCylinderSegmentsUniform
osg::Uniform * getNumCylinderSegmentsUniform()
Definition: CylinderGeometryShader.h:76
agx::QuatT< Real >
agxOSG::CylinderGeometryShader::getRadiusArray
osg::FloatArray * getRadiusArray()
Definition: CylinderGeometryShader.h:87
agxOSG::CylinderGeometryShader::getProgram
const osg::Program * getProgram() const
Definition: CylinderGeometryShader.h:71
agxOSG::CylinderGeometryShader::getCylinderColorUniform
osg::Uniform * getCylinderColorUniform()
Definition: CylinderGeometryShader.h:82
agxCollide
This namespace consists of a set of classes for handling geometric intersection tests including boole...
Definition: ContactForceFilterParticipant.h:22
agxOSG::CylinderGeometryShader::m_vertexArray
osg::Vec3Array * m_vertexArray
Definition: CylinderGeometryShader.h:97
export.h
agxOSG::CylinderGeometryShader::m_numCylinderSegments
osg::Uniform * m_numCylinderSegments
Definition: CylinderGeometryShader.h:102
agx::Vec4Array
agxData::Array< agx::Vec4 > Vec4Array
Definition: generated_container_typedefs.h:304
agx::Vec3T< Real >
agxOSG::CylinderGeometryShader::m_quatsInColorArray
osg::Vec4Array * m_quatsInColorArray
Definition: CylinderGeometryShader.h:98
agxOSG::CylinderGeometryShaderRef
osg::ref_ptr< CylinderGeometryShader > CylinderGeometryShaderRef
Definition: CylinderGeometryShader.h:106
agxOSG::CylinderGeometryShader::m_program
osg::Program * m_program
Definition: CylinderGeometryShader.h:101
agxOSG::CylinderGeometryShader::getVertexArray
osg::Vec3Array * getVertexArray()
Definition: CylinderGeometryShader.h:85
agx_vector_types.h
agxOSG::CylinderGeometryShader::m_radiusArray
osg::FloatArray * m_radiusArray
Definition: CylinderGeometryShader.h:99
agx::Vec3Array
agxData::Array< agx::Vec3 > Vec3Array
Definition: generated_container_typedefs.h:232
AGXOSG_EXPORT
#define AGXOSG_EXPORT
PopDisableWarnings.h