17#ifndef AGXOSG_FRAME_TRAJECTORY_DRAWABLE_H
18#define AGXOSG_FRAME_TRAJECTORY_DRAWABLE_H
21#include <osg/Drawable>
22#include <osgViewer/Viewer>
36 typedef std::deque<agx::Vec3> PositionBuffer;
37 typedef std::deque<agx::Vec4f> ColorsBuffer;
38 typedef std::pair<PositionBuffer, ColorsBuffer> TrajectoryData;
49 virtual const char*
className()
const {
return "FrameTrajectoryDrawable"; }
53# if OSG_VERSION_GREATER_OR_EQUAL(3,4,0)
54 virtual osg::BoundingSphere computeBound()
const;
55 virtual osg::BoundingBox computeBoundingBox()
const;
70 agx::UInt getNumTrajectoryPositions()
const;
73 void setDefaultTrajectoryColor(
const agx::Vec4f& color);
88 void setEnable(
bool enable);
91 bool getEnable()
const;
#define AGX_DECLARE_POINTER_TYPES(type)
void setDefaultTrajectoryColor(const agx::Vec4f &color)
Set default color of trajectories.
agx::Vec4f m_defaultTrajectoryColor
virtual osg::Object * clone(const osg::CopyOp &) const
bool addTrajectory(agx::Frame *frame, agx::Vec4f color)
Add a trajectory to be drawn given a frame and a color.
agxData::BufferRef m_colorBuffer
agxData::BufferRef m_firstsBuffer
agxData::BufferRef m_countBuffer
agx::Vector< std::tuple< agx::FrameRef, agx::Vec4f, TrajectoryData > > m_activeTrajectories
virtual ~FrameTrajectoryDrawable()
bool getEnable() const
Return true of the drawable is enabled.
void setNumTrajectoryPositions(agx::UInt num)
Set the number of positions used in the trajectories.
virtual const char * className() const
FrameTrajectoryDrawable(agxSDK::Simulation *simulation)
agxSDK::SimulationObserver m_simulation
agx::TaskGroupRef m_renderTask
agx::Vector< TrajectoryData > m_destroyedTrajectories
agx::UInt getNumTrajectoryPositions() const
Get the number of positions used in the trajectories.
agxSDK::Simulation * getSimulation()
Get the simulation related to the drawable.
void popOldPositionsInDeadTrajectories()
agxData::BufferRef m_verticesBuffer
bool removeTrajectory(agx::Frame *frame)
Remove the current stored trajectory from the drawable for a particle with given id.
void setEnable(bool enable)
Enable the drawable.
virtual osg::BoundingBox computeBound() const
Compute the bounding box around Drawables's geometry.
virtual osg::Object * cloneType() const
void resetTrajectories()
Reset trajectories.
virtual const char * libraryName() const
virtual void drawImplementation(osg::RenderInfo &renderInfo) const
The actual draw method for the particle system.
void updateTrajectories()
Update the trajectory structures.
bool addTrajectory(agx::Frame *frame)
Add a trajectory to be drawn given a frame.
virtual bool isSameKindAs(const osg::Object *obj) const
void updateKernelBuffers()
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
The object defining a frame of reference and providing transformations operations.
Inheritance with partial specialization due to bug with ref_ptr containers.
A class holding 4 dimensional vectors and providing basic arithmetic.
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.