17 #ifndef AGXOSG_RIGIDBODY_TRAJECTORIES_DRAWABLE_H 18 #define AGXOSG_RIGIDBODY_TRAJECTORIES_DRAWABLE_H 21 #include <osg/Drawable> 22 #include <osgViewer/Viewer> 23 #include <osg/Version> 37 typedef std::deque<agx::Vec3> PositionBuffer;
38 typedef std::deque<agx::Vec4f> ColorsBuffer;
39 typedef std::pair<PositionBuffer, ColorsBuffer> TrajectoryData;
49 virtual const char*
className()
const {
return "RigidBodyTrajectoryDrawable"; }
52 # if OSG_VERSION_GREATER_OR_EQUAL(3,4,0) 53 virtual osg::BoundingSphere computeBound()
const;
54 virtual osg::BoundingBox computeBoundingBox()
const;
56 virtual osg::BoundingBox computeBound()
const;
60 virtual void drawImplementation(osg::RenderInfo& renderInfo)
const;
63 void updateTrajectories();
66 void setNumTrajectoryPositions(
agx::UInt num);
69 agx::UInt getNumTrajectoryPositions()
const;
72 void setDefaultTrajectoryColor(
const agx::Vec4f& color);
75 void resetTrajectories();
78 void removeTrajectoryFromId(
agx::Index particleId);
80 void setEnable(
bool enable,
bool doResample =
true );
82 bool getEnable()
const;
84 void setOnlyDrawRigidBodyEmitterBodies(
bool enable );
86 bool getOnlyDrawRigidBodyEmitterBodies()
const;
89 void setSampling(
agx::Real sampling,
bool doResample =
true);
119 void updateKernelBuffers();
123 void handleDestructionEvent(
agx::Index index);
127 void popOldPositionsInDeadTrajectories();
virtual const char * className() const
agxData::BufferRef m_firstsBuffer
agxSDK::SimulationObserver m_simulation
bool m_onlyDrawRigidBodyEmitterBodies
agx::UInt getNumTrajectoryPositions() const
Get the number of positions used in the trajectories.
agx::Vector< TrajectoryData > m_destroyedTrajectories
A class holding 4 dimensional vectors and providing basic arithmetic.
virtual bool isSameKindAs(const osg::Object *obj) const
agxSDK::Simulation::RigidBodyEvent::CallbackType m_removeRigidBodyCallback
virtual osg::Object * cloneType() const
#define AGX_DECLARE_POINTER_TYPES(type)
agxData::BufferRef m_colorBuffer
void setDefaultTrajectoryColor(const agx::Vec4f &color)
Set default color of trajectories.
ScalarColorMapRef m_colorMap
virtual const char * libraryName() const
agxSDK::Simulation::RigidBodyEvent::CallbackType m_addRigidBodyCallback
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
Callback2< T1, T2 > CallbackType
agx::Vec4f m_trajectoryColor
The rigid body class, combining a geometric model and a frame of reference.
agxSDK::Simulation * getSimulation()
TrajectoryTable m_activeTrajectories
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
agx::Real getSampling() const
agxData::BufferRef m_countBuffer
virtual osg::Object * clone(const osg::CopyOp &) const
Class that represents a linear scalar color map that converts a scalar interval to a specified color ...
Inheritance with partial specialization due to bug with ref_ptr containers.
agx::TaskGroupRef m_renderTask
agxData::BufferRef m_verticesBuffer