AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
CylinderGeometryShader.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx 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
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
29namespace agxCollide
30{
31 class Geometry;
32}
33
34namespace 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
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:
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;
103 osg::Uniform* m_cylinderColor;
104 };
105
106 typedef osg::ref_ptr< CylinderGeometryShader > CylinderGeometryShaderRef;
107
108}
109
110#endif
#define AGXOSG_EXPORT
The geometry representation used by the collision detection engine.
Definition: Geometry.h:92
void add(const agx::Vec3 &point, const agx::Quat &zToDir, agx::Real radius, agx::Real redShift=agx::Real(0))
Continuous mesh, for splines.
const osg::Uniform * getCylinderColorUniform() const
const osg::Uniform * getNumCylinderSegmentsUniform() const
void update()
Push the data to the graphics card.
void resetCounters()
Resets all internal counters.
CylinderGeometryShader(size_t initialBufferSize=256)
void add(const agxCollide::Geometry *geometry)
All compatible shapes in geometry will be rendered.
void setNumActiveElements(size_t numActiveElements)
void add(const agx::Vec3 &startPoint, const agx::Vec3 &endPoint, agx::Real radius, agx::Vec2 redShift=agx::Vec2(0, 0))
Add cylinder given world start- and end point, and radius.
const osg::Program * getProgram() const
This namespace consists of a set of classes for handling geometric intersection tests including boole...
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
osg::ref_ptr< CylinderGeometryShader > CylinderGeometryShaderRef
double Real
Definition: Real.h:41