17 #ifndef AGXOSG_PARTICLE_TRAJECTORIES_DRAWABLE_H 18 #define AGXOSG_PARTICLE_TRAJECTORIES_DRAWABLE_H 21 #include <osg/Drawable> 22 #include <osgViewer/Viewer> 23 #include <osg/Version> 38 typedef std::deque<agx::Vec3> PositionBuffer;
39 typedef std::deque<agx::Vec4f> ColorsBuffer;
40 typedef std::pair<PositionBuffer, ColorsBuffer> ParticleTrajectoryData;
44 class ParticleStorageListener :
public agxData::EntityStorage::EventListener
74 virtual const char*
className()
const {
return "ParticleTrajectoriesDrawable"; }
78 # if OSG_VERSION_GREATER_OR_EQUAL(3,4,0) 79 virtual osg::BoundingSphere computeBound()
const;
80 virtual osg::BoundingBox computeBoundingBox()
const;
82 virtual osg::BoundingBox computeBound()
const;
86 virtual void drawImplementation(osg::RenderInfo& renderInfo)
const;
89 void updateParticleTrajectories();
92 void setNumTrajectoryPositions(
agx::UInt num);
95 agx::UInt getNumTrajectoryPositions()
const;
98 void resetTrajectories();
101 void popLatestPositions();
104 void removeParticleTrajectoryFromId(
agx::Index particleId);
106 void createParticleTrajectoryFromId(
agx::Index particleId );
110 void setEnable(
bool enable);
112 bool getEnable()
const;
115 void setSampling(
agx::Real sampling,
bool doResample=
true);
126 void updateKernelBuffers();
130 void handleDestructionEvent(
agx::Index index);
134 void popOldPositionsInDeadTrajectories();
virtual bool isSameKindAs(const osg::Object *obj) const
Data storage for a collection of entity instances of a specified EntityModel.
agx::ParticleSystem * getParticleSystem()
TrajectoryTable m_activeParticleTrajectories
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
agx::Vector< ParticleTrajectoryData > m_destroyedParticlesTrajectories
virtual osg::Object * cloneType() const
virtual const char * libraryName() const
Type-specific Array used for fast access into the data held by a Buffer.
agxData::BufferRef m_countBuffer
virtual const char * className() const
A basic particle system that contains all the storages and buffers required for basic operation and a...
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
agxData::BufferRef m_verticesBuffer
ParticleStorageListener m_particleStorageListener
agx::Real getSampling() const
agxData::BufferRef m_colorBuffer
agx::UInt getNumTrajectoryPositions() const
Get the number of positions used in the trajectories.
agxData::BufferRef m_firstsBuffer
virtual osg::Object * clone(const osg::CopyOp &) const
Inheritance with partial specialization due to bug with ref_ptr containers.
agx::ParticleSystemObserver m_particleSystem
Pointer to a entity instance of type Physics.Particle.
agx::TaskGroupRef m_renderTask