#include <PxParticleBase.h>
Public Member Functions | |
virtual void | setParticleBaseFlag (PxParticleBaseFlag::Enum flag, bool val)=0 |
Sets particle system flags. | |
virtual PxParticleBaseFlags | getParticleBaseFlags () const =0 |
Returns particle system flags. | |
Particle Access and Manipulation | |
virtual PxParticleReadData * | lockParticleReadData (PxDataAccessFlags flags)=0 |
Locks the particle data and provides the data descriptor for accessing the particles. After reading from the buffers the application needs to call PxParticleReadData::unlock() before any SDK operation can access the buffers. Particularly the buffers need to be unlocked before calling PxParticleBase::lockParticleReadData(), PxParticleBase::createParticles(), PxParticleBase::releaseParticles(), PxScene::fetchResults(). | |
virtual PxParticleReadData * | lockParticleReadData ()=0 |
Locks the particle read data and provides the data descriptor for accessing the particles. | |
virtual bool | createParticles (const PxParticleCreationData &creationData)=0 |
Creates new particles. | |
virtual void | releaseParticles (PxU32 numParticles, const PxStrideIterator< const PxU32 > &indexBuffer)=0 |
Releases particles. | |
virtual void | releaseParticles ()=0 |
Releases all particles. | |
virtual void | setPositions (PxU32 numParticles, const PxStrideIterator< const PxU32 > &indexBuffer, const PxStrideIterator< const PxVec3 > &positionBuffer)=0 |
Sets particle positions. | |
virtual void | setVelocities (PxU32 numParticles, const PxStrideIterator< const PxU32 > &indexBuffer, const PxStrideIterator< const PxVec3 > &velocityBuffer)=0 |
Sets particle velocities. | |
virtual void | setRestOffsets (PxU32 numParticles, const PxStrideIterator< const PxU32 > &indexBuffer, const PxStrideIterator< const PxF32 > &restOffsetBuffer)=0 |
Sets particle rest offsets. | |
virtual void | addForces (PxU32 numParticles, const PxStrideIterator< const PxU32 > &indexBuffer, const PxStrideIterator< const PxVec3 > &forceBuffer, PxForceMode::Enum forceMode)=0 |
Set forces to be applied to the particles when the simulation starts. | |
ParticleBase Parameters | |
virtual PxReal | getDamping () const =0 |
Returns the particle system damping. | |
virtual void | setDamping (PxReal damp)=0 |
Sets the particle system damping (must be nonnegative). | |
virtual PxVec3 | getExternalAcceleration () const =0 |
Returns the external acceleration applied to each particle at each time step. | |
virtual void | setExternalAcceleration (const PxVec3 &acceleration)=0 |
Sets the external acceleration applied to each particle at each time step. | |
virtual void | getProjectionPlane (PxVec3 &normal, PxReal &distance) const =0 |
Returns the plane the particles are projected to. | |
virtual void | setProjectionPlane (const PxVec3 &normal, PxReal distance)=0 |
Sets the plane the particles are projected to. | |
Collisions | |
virtual PxReal | getParticleMass () const =0 |
Returns the mass of a particle. | |
virtual void | setParticleMass (PxReal mass)=0 |
Sets the mass of a particle. | |
virtual PxReal | getRestitution () const =0 |
Returns the restitution used for collision with shapes. | |
virtual void | setRestitution (PxReal rest)=0 |
Sets the restitution used for collision with shapes. | |
virtual PxReal | getDynamicFriction () const =0 |
Returns the dynamic friction used for collision with shapes. | |
virtual void | setDynamicFriction (PxReal friction)=0 |
Sets the dynamic friction used for collision with shapes. | |
virtual PxReal | getStaticFriction () const =0 |
Returns the static friction used for collision with shapes. | |
virtual void | setStaticFriction (PxReal friction)=0 |
Sets the static friction used for collision with shapes. | |
Collision Filtering | |
virtual void | setSimulationFilterData (const PxFilterData &data)=0 |
Sets the user definable collision filter data. | |
virtual PxFilterData | getSimulationFilterData () const =0 |
Retrieves the object's collision filter data. | |
ParticleSystem Property Read Back | |
virtual PxU32 | getMaxParticles () const =0 |
Returns the maximum number of particles for this particle system. | |
virtual PxReal | getMaxMotionDistance () const =0 |
Returns the maximal motion distance (the particle can move the maximal distance of getMaxMotionDistance() during one timestep). | |
virtual void | setMaxMotionDistance (PxReal distance)=0 |
Sets the maximal motion distance (the particle can move the maximal distance during one timestep). Immutable when the particle system is part of a scene. | |
virtual PxReal | getRestOffset () const =0 |
Returns the distance between particles and collision geometry, which is maintained during simulation. | |
virtual void | setRestOffset (PxReal restOffset)=0 |
Sets the distance between particles and collision geometry, which is maintained during simulation. If per particle restOffsets are used, they need to be in the range [0.0f, restOffset]. Immutable when the particle system is part of a scene. | |
virtual PxReal | getContactOffset () const =0 |
Returns the distance at which contacts are generated between particles and collision geometry. | |
virtual void | setContactOffset (PxReal contactOffset)=0 |
Sets the distance at which contacts are generated between particles and collision geometry. Immutable when the particle system is part of a scene. | |
virtual PxReal | getGridSize () const =0 |
Returns the particle grid size used for internal spatial data structures. | |
virtual void | setGridSize (PxReal gridSize)=0 |
Sets the particle grid size used for internal spatial data structures. Immutable when the particle system is part of a scene. The actual grid size used might differ from the grid size set in the setGridSize(). | |
virtual PxParticleReadDataFlags | getParticleReadDataFlags () const =0 |
Returns particle read data flags. | |
virtual void | setParticleReadDataFlag (PxParticleReadDataFlag::Enum flag, bool val)=0 |
Sets particle read data flags. | |
PX_INLINE | PxParticleBase (PxType concreteType, PxBaseFlags baseFlags) |
PX_INLINE | PxParticleBase (PxBaseFlags baseFlags) |
virtual | ~PxParticleBase () |
virtual bool | isKindOf (const char *name) const |
Returns whether a given type name matches with the type of this instance. |
The particle base class manages a set of particles. Particles can be created, released and updated directly through the API. When a particle is created the user gets an index for it which can be used to address the particle until it is released again.
Particles collide with static and dynamic shapes. They are also affected by the scene gravity and a user force, as well as global velocity damping. When a particle collides, a particle flag is raised corresponding to the type of actor, static or dynamic, it collided with. Additionally a shape can be flagged as a drain (See PxShapeFlag), in order to get a corresponding particle flag raised when a collision occurs. This information can be used to delete particles.
PX_INLINE PxParticleBase::PxParticleBase | ( | PxType | concreteType, | |
PxBaseFlags | baseFlags | |||
) | [inline, protected] |
PX_INLINE PxParticleBase::PxParticleBase | ( | PxBaseFlags | baseFlags | ) | [inline, protected] |
virtual PxParticleBase::~PxParticleBase | ( | ) | [inline, protected, virtual] |
virtual void PxParticleBase::addForces | ( | PxU32 | numParticles, | |
const PxStrideIterator< const PxU32 > & | indexBuffer, | |||
const PxStrideIterator< const PxVec3 > & | forceBuffer, | |||
PxForceMode::Enum | forceMode | |||
) | [pure virtual] |
Set forces to be applied to the particles when the simulation starts.
This call is ignored on particle system that aren't assigned to a scene.
numParticles | Number of particle updates. | |
indexBuffer | Structure describing indices of particles that should be updated. (Has to be consistent with numParticles). | |
forceBuffer | Structure describing values for particle updates depending on forceMode. (Has to be consistent with numParticles). | |
forceMode | Describes type of update. |
virtual bool PxParticleBase::createParticles | ( | const PxParticleCreationData & | creationData | ) | [pure virtual] |
Creates new particles.
The PxParticleCreationData descriptor is used to create new particles based on the provided PxParticleCreationData. Providing particle indices and positions is mandatory. Indices need to be consistent with the available particle slots within the range [0, maxParticles-1]. The new particles can be immediately read from the application readable particle data, PxParticleReadData.
creationData | specifies particle attributes for the particles to be created. (all buffers set have to be consistent with numParticles). |
virtual PxReal PxParticleBase::getContactOffset | ( | ) | const [pure virtual] |
Returns the distance at which contacts are generated between particles and collision geometry.
virtual PxReal PxParticleBase::getDamping | ( | ) | const [pure virtual] |
Returns the particle system damping.
virtual PxReal PxParticleBase::getDynamicFriction | ( | ) | const [pure virtual] |
Returns the dynamic friction used for collision with shapes.
virtual PxVec3 PxParticleBase::getExternalAcceleration | ( | ) | const [pure virtual] |
Returns the external acceleration applied to each particle at each time step.
virtual PxReal PxParticleBase::getGridSize | ( | ) | const [pure virtual] |
Returns the particle grid size used for internal spatial data structures.
The actual grid size used might differ from the grid size set in the setGridSize().
virtual PxReal PxParticleBase::getMaxMotionDistance | ( | ) | const [pure virtual] |
Returns the maximal motion distance (the particle can move the maximal distance of getMaxMotionDistance() during one timestep).
virtual PxU32 PxParticleBase::getMaxParticles | ( | ) | const [pure virtual] |
Returns the maximum number of particles for this particle system.
virtual PxParticleBaseFlags PxParticleBase::getParticleBaseFlags | ( | ) | const [pure virtual] |
Returns particle system flags.
virtual PxReal PxParticleBase::getParticleMass | ( | ) | const [pure virtual] |
Returns the mass of a particle.
virtual PxParticleReadDataFlags PxParticleBase::getParticleReadDataFlags | ( | ) | const [pure virtual] |
Returns particle read data flags.
virtual void PxParticleBase::getProjectionPlane | ( | PxVec3 & | normal, | |
PxReal & | distance | |||
) | const [pure virtual] |
Returns the plane the particles are projected to.
[out] | normal | Particle projection plane normal |
[out] | distance | Particle projection plane constant term |
virtual PxReal PxParticleBase::getRestitution | ( | ) | const [pure virtual] |
Returns the restitution used for collision with shapes.
virtual PxReal PxParticleBase::getRestOffset | ( | ) | const [pure virtual] |
Returns the distance between particles and collision geometry, which is maintained during simulation.
virtual PxFilterData PxParticleBase::getSimulationFilterData | ( | ) | const [pure virtual] |
virtual PxReal PxParticleBase::getStaticFriction | ( | ) | const [pure virtual] |
Returns the static friction used for collision with shapes.
virtual bool PxParticleBase::isKindOf | ( | const char * | superClass | ) | const [inline, protected, virtual] |
Returns whether a given type name matches with the type of this instance.
Reimplemented from PxActor.
Reimplemented in PxParticleFluid, and PxParticleSystem.
References PxActor::isKindOf().
Referenced by PxParticleSystem::isKindOf(), and PxParticleFluid::isKindOf().
virtual PxParticleReadData* PxParticleBase::lockParticleReadData | ( | ) | [pure virtual] |
Locks the particle read data and provides the data descriptor for accessing the particles.
virtual PxParticleReadData* PxParticleBase::lockParticleReadData | ( | PxDataAccessFlags | flags | ) | [pure virtual] |
Locks the particle data and provides the data descriptor for accessing the particles. After reading from the buffers the application needs to call PxParticleReadData::unlock() before any SDK operation can access the buffers. Particularly the buffers need to be unlocked before calling PxParticleBase::lockParticleReadData(), PxParticleBase::createParticles(), PxParticleBase::releaseParticles(), PxScene::fetchResults().
flags | If PxDataAccessFlag::eDEVICE is specified for GPU particles then pointers to GPU memory will be returned otherwise it will be ignored. |
If using PxDataAccessFlag::eDEVICE, newly created particles will not become visible in the GPU buffers until a subsequent simulation step has completed
virtual void PxParticleBase::releaseParticles | ( | ) | [pure virtual] |
Releases all particles.
Application readable particle data is updated accordingly.
virtual void PxParticleBase::releaseParticles | ( | PxU32 | numParticles, | |
const PxStrideIterator< const PxU32 > & | indexBuffer | |||
) | [pure virtual] |
Releases particles.
Particles corresponding to passed indices are released. Releasing a particle will immediately mark the particle in the application readable particle data, PxParticleReadData, as being invalid, removing PxParticleFlag::eVALID. Passing duplicate indices is not allowed.
numParticles | Number of particles to be released. | |
indexBuffer | Structure describing indices of particles that should be deleted. (Has to be consistent with numParticles). |
virtual void PxParticleBase::setContactOffset | ( | PxReal | contactOffset | ) | [pure virtual] |
Sets the distance at which contacts are generated between particles and collision geometry. Immutable when the particle system is part of a scene.
contactOffset | New contactOffset value. |
virtual void PxParticleBase::setDamping | ( | PxReal | damp | ) | [pure virtual] |
Sets the particle system damping (must be nonnegative).
damp | The new particle system damping. |
virtual void PxParticleBase::setDynamicFriction | ( | PxReal | friction | ) | [pure virtual] |
Sets the dynamic friction used for collision with shapes.
Must be between 0 and 1.
friction | The new dynamic friction |
virtual void PxParticleBase::setExternalAcceleration | ( | const PxVec3 & | acceleration | ) | [pure virtual] |
Sets the external acceleration applied to each particle at each time step.
acceleration | External acceleration to apply to particles. |
virtual void PxParticleBase::setGridSize | ( | PxReal | gridSize | ) | [pure virtual] |
Sets the particle grid size used for internal spatial data structures. Immutable when the particle system is part of a scene. The actual grid size used might differ from the grid size set in the setGridSize().
gridSize | New gridSize value. |
virtual void PxParticleBase::setMaxMotionDistance | ( | PxReal | distance | ) | [pure virtual] |
Sets the maximal motion distance (the particle can move the maximal distance during one timestep). Immutable when the particle system is part of a scene.
distance | New Max motionDistance value. |
virtual void PxParticleBase::setParticleBaseFlag | ( | PxParticleBaseFlag::Enum | flag, | |
bool | val | |||
) | [pure virtual] |
virtual void PxParticleBase::setParticleMass | ( | PxReal | mass | ) | [pure virtual] |
Sets the mass of a particle.
mass | The particle mass. |
virtual void PxParticleBase::setParticleReadDataFlag | ( | PxParticleReadDataFlag::Enum | flag, | |
bool | val | |||
) | [pure virtual] |
Sets particle read data flags.
flag | Member of PxParticleReadDataFlag. | |
val | New flag value. |
virtual void PxParticleBase::setPositions | ( | PxU32 | numParticles, | |
const PxStrideIterator< const PxU32 > & | indexBuffer, | |||
const PxStrideIterator< const PxVec3 > & | positionBuffer | |||
) | [pure virtual] |
Sets particle positions.
Directly sets the positions of particles. The supplied positions are used to change particles in the order of the indices listed in the index buffer. Duplicate indices are allowed. A position buffer of stride zero is allowed. Application readable particle data is updated accordingly.
numParticles | Number of particle updates. | |
indexBuffer | Structure describing indices of particles that should be updated. (Has to be consistent with numParticles). | |
positionBuffer | Structure describing positions for position updates. (Has to be consistent with numParticles). |
virtual void PxParticleBase::setProjectionPlane | ( | const PxVec3 & | normal, | |
PxReal | distance | |||
) | [pure virtual] |
Sets the plane the particles are projected to.
Points p on the plane have to fulfill the equation:
(normal.x * p.x) + (normal.y * p.y) + (normal.z * p.z) + d = 0
[in] | normal | Particle projection plane normal |
[in] | distance | Particle projection plane constant term |
virtual void PxParticleBase::setRestitution | ( | PxReal | rest | ) | [pure virtual] |
Sets the restitution used for collision with shapes.
Must be between 0 and 1.
rest | The new restitution. |
virtual void PxParticleBase::setRestOffset | ( | PxReal | restOffset | ) | [pure virtual] |
Sets the distance between particles and collision geometry, which is maintained during simulation. If per particle restOffsets are used, they need to be in the range [0.0f, restOffset]. Immutable when the particle system is part of a scene.
restOffset | New restOffset value. |
virtual void PxParticleBase::setRestOffsets | ( | PxU32 | numParticles, | |
const PxStrideIterator< const PxU32 > & | indexBuffer, | |||
const PxStrideIterator< const PxF32 > & | restOffsetBuffer | |||
) | [pure virtual] |
Sets particle rest offsets.
Directly sets the rest offsets of particles. The supplied rest offsets are used to change particles in the order of the indices listed in the index buffer. The provided offsets need to be in the range [0.0f, restOffset]. Duplicate indices are allowed. A rest offset buffer of stride zero is allowed. Application readable particle data is updated accordingly.
numParticles | Number of particle updates. | |
indexBuffer | Structure describing indices of particles that should be updated. (Has to be consistent with numParticles). | |
restOffsetBuffer | Structure describing rest offsets for rest offset updates. (Has to be consistent with numParticles). |
virtual void PxParticleBase::setSimulationFilterData | ( | const PxFilterData & | data | ) | [pure virtual] |
virtual void PxParticleBase::setStaticFriction | ( | PxReal | friction | ) | [pure virtual] |
Sets the static friction used for collision with shapes.
Must be non-negative.
friction | The new static friction |
virtual void PxParticleBase::setVelocities | ( | PxU32 | numParticles, | |
const PxStrideIterator< const PxU32 > & | indexBuffer, | |||
const PxStrideIterator< const PxVec3 > & | velocityBuffer | |||
) | [pure virtual] |
Sets particle velocities.
Directly sets the velocities of particles. The supplied velocities are used to change particles in the order of the indices listed in the index buffer. Duplicate indices are allowed. A velocity buffer of stride zero is allowed. Application readable particle data is updated accordingly.
numParticles | Number of particle updates. | |
indexBuffer | Structure describing indices of particles that should be updated. (Has to be consistent with numParticles). | |
velocityBuffer | Structure describing velocities for velocity updates. (Has to be consistent with numParticles). |