17#ifndef AGXOSG_RIGIDBODY_TRAJECTORIES_DRAWABLE_H
18#define AGXOSG_RIGIDBODY_TRAJECTORIES_DRAWABLE_H
21#include <osg/Drawable>
22#include <osgViewer/Viewer>
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;
69 agx::UInt getNumTrajectoryPositions()
const;
72 void setDefaultTrajectoryColor(
const agx::Vec4f& color);
80 void setEnable(
bool enable,
bool doResample =
true );
82 bool getEnable()
const;
#define AGX_DECLARE_POINTER_TYPES(type)
agxSDK::Simulation::RigidBodyEvent::CallbackType m_removeRigidBodyCallback
agxSDK::Simulation::RigidBodyEvent::CallbackType m_addRigidBodyCallback
bool getOnlyDrawRigidBodyEmitterBodies() const
void removeRigidBodyCallback(agxSDK::Simulation *, agx::RigidBody *body)
virtual const char * className() const
virtual void drawImplementation(osg::RenderInfo &renderInfo) const
The actual draw method for the particle system.
virtual osg::Object * clone(const osg::CopyOp &) const
agx::Vec4f m_trajectoryColor
void updateTrajectories()
Update the trajectory structures.
virtual bool isSameKindAs(const osg::Object *obj) const
agxData::BufferRef m_countBuffer
agx::UInt getNumTrajectoryPositions() const
Get the number of positions used in the trajectories.
void setOnlyDrawRigidBodyEmitterBodies(bool enable)
agxSDK::Simulation * getSimulation()
ScalarColorMapRef m_colorMap
void setNumTrajectoryPositions(agx::UInt num)
Set the number of positions used in the trajectories.
void resetTrajectories()
Reset trajectories.
void updateKernelBuffers()
ScalarColorMap * getColorMap() const
agx::Real getSampling() const
bool m_onlyDrawRigidBodyEmitterBodies
RigidBodyTrajectoryDrawable(agxSDK::Simulation *simulation)
TrajectoryTable m_activeTrajectories
void handleDestructionEvent(agx::Index index)
agxData::BufferRef m_firstsBuffer
void removeTrajectoryFromId(agx::Index particleId)
Remove the current stored trajectory from the drawable for a particle with given id.
void handleCreationEvent(agx::Index index)
void setEnable(bool enable, bool doResample=true)
agxSDK::SimulationObserver m_simulation
void setDefaultTrajectoryColor(const agx::Vec4f &color)
Set default color of trajectories.
void popOldPositionsInDeadTrajectories()
virtual osg::Object * cloneType() const
void addRigidBodyCallback(agxSDK::Simulation *, agx::RigidBody *body)
void sample(agx::Index index)
virtual osg::BoundingBox computeBound() const
Compute the bounding box around Drawables's geometry.
void setSampling(agx::Real sampling, bool doResample=true)
void setColorMap(ScalarColorMap *colorMap)
Set the scalar color map that will be used color the rigid body trajectories with respect to speed.
agx::Vector< TrajectoryData > m_destroyedTrajectories
virtual const char * libraryName() const
agxData::BufferRef m_colorBuffer
virtual ~RigidBodyTrajectoryDrawable()
agxData::BufferRef m_verticesBuffer
agx::TaskGroupRef m_renderTask
Class that represents a linear scalar color map that converts a scalar interval to a specified color ...
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Inheritance with partial specialization due to bug with ref_ptr containers.
The rigid body class, combining a geometric model and a frame of reference.
A class holding 4 dimensional vectors and providing basic arithmetic.
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.