17#ifndef AGXOSG_PARTICLE_TRAJECTORIES_DRAWABLE_H
18#define AGXOSG_PARTICLE_TRAJECTORIES_DRAWABLE_H
21#include <osg/Drawable>
22#include <osgViewer/Viewer>
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;
95 agx::UInt getNumTrajectoryPositions()
const;
112 bool getEnable()
const;
Type-specific Array used for fast access into the data held by a Buffer.
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
Data storage for a collection of entity instances of a specified EntityModel.
agxData::BufferRef m_countBuffer
void popOldPositionsInDeadTrajectories()
void setEnable(bool enable)
agx::ParticleSystemObserver m_particleSystem
bool particleIsRendered(agx::Physics::ParticlePtr &ptr)
virtual const char * className() const
virtual ~ParticleTrajectoriesDrawable()
agxData::BufferRef m_colorBuffer
void sample(agx::Index index)
virtual osg::BoundingBox computeBound() const
Compute the bounding box around Drawables's geometry.
virtual bool isSameKindAs(const osg::Object *obj) const
TrajectoryTable m_activeParticleTrajectories
void removeParticleTrajectoryFromId(agx::Index particleId)
Remove the current stored trajectory from the drawable for a particle with given id.
ParticleTrajectoriesDrawable(agx::ParticleSystem *particleSystem)
agx::UInt getNumTrajectoryPositions() const
Get the number of positions used in the trajectories.
void handleCreationEvent(agx::Index index)
agx::Real getSampling() const
virtual osg::Object * cloneType() const
void setNumTrajectoryPositions(agx::UInt num)
Set the number of positions used in the trajectories.
void handleDestructionEvent(agx::Index index)
virtual void drawImplementation(osg::RenderInfo &renderInfo) const
The actual draw method for the particle system.
agxData::BufferRef m_verticesBuffer
void createParticleTrajectoryFromId(agx::Index particleId)
virtual osg::Object * clone(const osg::CopyOp &) const
agx::Vector< ParticleTrajectoryData > m_destroyedParticlesTrajectories
void updateParticleTrajectories()
Update the trajectory structures.
void resetTrajectories()
Reset trajectories.
virtual const char * libraryName() const
void popLatestPositions()
Pops latest positions in all trajectories. Useful when stepping backwards in a journal.
agxData::BufferRef m_firstsBuffer
agx::TaskGroupRef m_renderTask
void updateKernelBuffers()
ParticleStorageListener m_particleStorageListener
agx::ParticleSystem * getParticleSystem()
void setSampling(agx::Real sampling, bool doResample=true)
Inheritance with partial specialization due to bug with ref_ptr containers.
A basic particle system that contains all the storages and buffers required for basic operation and a...
Pointer to a entity instance of type Physics.Particle.
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.