29#ifndef PX_PARTICLE_BUFFER_H
30#define PX_PARTICLE_BUFFER_H
34#include "common/PxBase.h"
35#include "common/PxPhysXCommonConfig.h"
36#include "common/PxTypeInfo.h"
38#include "PxParticleSystemFlag.h"
40#include "foundation/PxBounds3.h"
41#include "foundation/PxSimpleTypes.h"
42#include "foundation/PxVec4.h"
51#pragma warning(disable : 4435)
54class PxCudaContextManager;
55struct PxParticleRigidFilterPair;
56struct PxParticleRigidAttachment;
228 PX_INLINE PxParticleBuffer(PxU32 uniqueId, PxType type) : PxBase(type, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE),
bufferIndex(0xffffffff),
bufferUniqueId(uniqueId){}
231 PX_NOCOPY(PxParticleBuffer)
332 PX_NOCOPY(PxParticleAndDiffuseBuffer)
338struct PX_ALIGN_PREFIX(8) PxParticleSpring
363 bool operator < (
const PxParticleCloth& other)
const {
return startVertexIndex < other.startVertexIndex; }
364 bool operator > (
const PxParticleCloth& other)
const {
return startVertexIndex > other.startVertexIndex; }
365 bool operator == (
const PxParticleCloth& other)
const {
return startVertexIndex == other.startVertexIndex; }
482 PX_NOCOPY(PxParticleClothBuffer)
556 PX_NOCOPY(PxParticleRigidBuffer)
Base class for objects that can be members of a PxCollection.
Definition PxBase.h:73
Class representing 3D range or axis aligned bounding box.
Definition PxBounds3.h:58
Parameters to configure the behavior of diffuse particles.
Definition PxParticleBuffer.h:238
PX_INLINE PxDiffuseParticleParams()
Construct parameters with default values.
Definition PxParticleBuffer.h:243
PxReal lifetime
Diffuse particle will be removed after the specified lifetime.
Definition PxParticleBuffer.h:266
PX_INLINE void setToDefault()
(re)sets the structure to the default.
Definition PxParticleBuffer.h:260
PxReal collisionDecay
Decay factor of diffuse particles' lifetime after they collide with shapes.
Definition PxParticleBuffer.h:273
PxReal airDrag
Air drag force factor for spray particles.
Definition PxParticleBuffer.h:267
PxReal divergenceWeight
Contribution from divergence when deciding diffuse particle creation.
Definition PxParticleBuffer.h:272
PxReal threshold
Particles with potential value greater than the threshold will spawn diffuse particles.
Definition PxParticleBuffer.h:265
PxReal buoyancy
Buoyancy force factor for bubble particles.
Definition PxParticleBuffer.h:269
PxReal pressureWeight
Contribution from pressure when deciding diffuse particle creation.
Definition PxParticleBuffer.h:271
PxReal bubbleDrag
Fluid drag force factor for bubble particles.
Definition PxParticleBuffer.h:268
bool useAccurateVelocity
If true, enables accurate velocity estimation when using PBD solver.
Definition PxParticleBuffer.h:274
PxReal kineticEnergyWeight
Contribution from kinetic energy when deciding diffuse particle creation.
Definition PxParticleBuffer.h:270
A particle buffer used to simulate diffuse particles.
Definition PxParticleBuffer.h:283
virtual PxDiffuseParticleParams getDiffuseParticleParams() const =0
Get the parameters currently used for diffuse particle simulation.
virtual void setMaxActiveDiffuseParticles(PxU32 maxActiveDiffuseParticles)=0
Set the maximum possible number of diffuse particles for this buffer.
virtual PxU32 getNbActiveDiffuseParticles() const =0
Get number of currently active diffuse particles.
virtual PxU32 getMaxDiffuseParticles() const =0
Get maximum possible number of diffuse particles.
virtual void setDiffuseParticleParams(const PxDiffuseParticleParams ¶ms)=0
Set the parameters for diffuse particle simulation.
virtual PxVec4 * getDiffusePositionLifeTime() const =0
Get a device buffer of positions and remaining lifetimes for the diffuse particles.
The shared base class for all particle buffers, can be instantiated directly to simulate granular and...
Definition PxParticleBuffer.h:81
virtual PxParticleVolume * getParticleVolumes() const =0
Get particle volumes for this particle buffer.
virtual void setRigidFilters(PxParticleRigidFilterPair *filters, PxU32 nbFilters)=0
Set the #PxParticleRigidFilterPair s for collision filtering of particles in this buffer with rigid b...
virtual void raiseFlags(PxParticleBufferFlag::Enum flags)=0
Raise dirty flags on this particle buffer to communicate that the corresponding data has been updated...
virtual PxVec4 * getVelocities() const =0
Get velocities for this particle buffer.
virtual void release()=0
Release this buffer and deallocate all the memory.
virtual PxU32 getMaxParticles() const =0
Get the maximum number particles this particle buffer can hold.
const PxU32 bufferUniqueId
Unique index that does not change over the lifetime of a PxParticleBuffer.
Definition PxParticleBuffer.h:222
virtual void setNbActiveParticles(PxU32 nbActiveParticles)=0
Set the number of active particles for this particle buffer.
virtual void setNbParticleVolumes(PxU32 nbParticleVolumes)=0
Set the number of #PxParticleVolume s for this particle buffer.
virtual PxVec4 * getPositionInvMasses() const =0
Get positions and inverse masses for this particle buffer.
virtual PxU32 getNbParticleVolumes() const =0
Get the number of particle volumes in this particle buffer.
virtual PxU32 getFlatListStartIndex() const =0
Get the start index for the first particle of this particle buffer in the complete list of particles ...
virtual PxU32 getMaxParticleVolumes() const =0
Get the maximum number of particle volumes this particle buffer can hold.
virtual void setInternalData(void *data)=0
Reserved for internal use.
virtual PxU32 * getPhases() const =0
Get phases for this particle buffer.
virtual PxU32 getNbActiveParticles() const =0
Get the number of active particles for this particle buffer.
virtual void setRigidAttachments(PxParticleRigidAttachment *attachments, PxU32 nbAttachments)=0
Set the particle-rigid body attachments for particles in this particle buffer.
PxU32 bufferIndex
Index of this buffer in the particle system it is assigned to.
Definition PxParticleBuffer.h:217
virtual void onParticleSystemDestroy()=0
Cleanup helper used in case a particle system is released before the particle buffers have been remov...
A particle buffer used to simulate particle cloth.
Definition PxParticleBuffer.h:429
virtual void setNbTriangles(PxU32 nbTriangles)=0
Set the number of triangles for this particle buffer.
virtual PxVec4 * getRestPositions()=0
Get rest positions for this particle buffer.
virtual PxParticleSpring * getSprings()=0
Get the springs for this particle buffer.
virtual PxU32 getNbTriangles() const =0
Get the number of triangles for this particle buffer.
virtual PxU32 * getTriangles() const =0
Get the triangle indices for this particle buffer.
virtual PxU32 getNbSprings() const =0
Get the number of springs in this particle buffer.
virtual void setCloths(PxPartitionedParticleCloth &cloths)=0
Set cloths for this particle buffer.
Preprocessor to prepare particle cloths for simulation.
Definition PxParticleBuffer.h:569
virtual void partitionSprings(const PxParticleClothDesc &clothDesc, PxPartitionedParticleCloth &output)=0
Partition the spring constraints for particle cloth simulation.
virtual void release()=0
Release this object and deallocate all the memory.
A particle buffer used to simulate rigid bodies using shape matching with particles.
Definition PxParticleBuffer.h:491
virtual PxVec4 * getRigidLocalPositions() const =0
Get the local position of each particle relative to the rigid body's center of mass.
virtual PxVec4 * getRigidLocalNormals() const =0
Get the local space normals for each particle relative to the shape of the corresponding rigid body.
virtual PxU32 getNbRigids() const =0
Get the number of shape matched rigid bodies in this buffer.
virtual PxReal * getRigidCoefficients() const =0
Get the stiffness coefficients for all shape matched rigid bodies in this buffer.
virtual void setNbRigids(PxU32 nbRigids)=0
Set the number of shape matched rigid bodies in this buffer.
virtual PxVec4 * getRigidRotations() const =0
Get the world-space rotation of every shape-matched rigid body in this buffer.
virtual PxU32 * getRigidOffsets() const =0
Get the particle indices of the first particle for each shape matched rigid body.
virtual PxVec4 * getRigidTranslations() const =0
Get the world-space translations for all rigid bodies in this buffer.
#define PX_CALL_CONV
Definition PxPreprocessor.h:299
#define PX_INLINE
Definition PxPreprocessor.h:320
PX_C_EXPORT PX_PHYSX_CORE_API physx::PxParticleClothPreProcessor *PX_CALL_CONV PxCreateParticleClothPreProcessor(physx::PxCudaContextManager *cudaContextManager)
Create a particle cloth preprocessor.
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Flags for PxBase.
Definition PxBase.h:54
an enumeration of concrete classes inheriting from PxBase
Definition PxTypeInfo.h:53
Enum
Definition PxParticleSystemFlag.h:47
Structure to describe the set of particle cloths in the same #PxParticleClothBuffer....
Definition PxParticleBuffer.h:372
PxParticleCloth * cloths
List of PxParticleCloth s, describes the individual cloths.
Definition PxParticleBuffer.h:378
PxVec4 * restPositions
List of rest positions for all particles.
Definition PxParticleBuffer.h:381
PxU32 nbTriangles
The number of triangles in this cloth descriptor.
Definition PxParticleBuffer.h:384
PxU32 nbCloths
The number of cloths in described using this cloth descriptor.
Definition PxParticleBuffer.h:382
PxU32 nbParticles
The number of particles in this cloth descriptor.
Definition PxParticleBuffer.h:385
PxParticleSpring * springs
List of PxParticleSpring s.
Definition PxParticleBuffer.h:380
PxU32 * triangles
List of triangle indices, 3 consecutive PxU32 that map triangle vertices to particles.
Definition PxParticleBuffer.h:379
PxU32 nbSprings
The number of springs in this cloth descriptor.
Definition PxParticleBuffer.h:383
Particle cloth structure. Holds information about a single piece of cloth that is part of a #PxPartic...
Definition PxParticleBuffer.h:352
PxU32 numTriangles
The number of triangles of this piece of cloth.
Definition PxParticleBuffer.h:359
PxU32 startVertexIndex
Index of the first particle of this cloth in the position/velocity buffers of the parent #PxParticleC...
Definition PxParticleBuffer.h:353
PxReal clothBlendScale
Used internally.
Definition PxParticleBuffer.h:355
PxU32 numVertices
The number of particles of this piece of cloth.
Definition PxParticleBuffer.h:354
PxReal restVolume
The rest volume of this piece of cloth, used for inflatable simulation.
Definition PxParticleBuffer.h:356
PxU32 startTriangleIndex
The index of the first triangle of this piece of cloth in the triangle list.
Definition PxParticleBuffer.h:358
PxReal pressure
The factor of the rest volume to specify the target volume for this piece of cloth,...
Definition PxParticleBuffer.h:357
Struct to specify attachment between a particle/vertex and a rigid.
Definition PxAttachment.h:49
Struct for storing a particle/vertex - rigid filter pair with comparison operators.
Definition PxFiltering.h:751
Particle volume structure. Used to track the bounding volume of a user-specified set of particles....
Definition PxParticleBuffer.h:64
PxU32 numParticles
The number of particles contained in this #PxParticleVolume.
Definition PxParticleBuffer.h:67
PxU32 particleIndicesOffset
The index into the particle list of the #PxParticleBuffer for the first particle of this volume.
Definition PxParticleBuffer.h:66
PxBounds3 bound
The current bounds of the particles contained in this #PxParticleVolume.
Definition PxParticleBuffer.h:65
Structure to describe the output of the particle cloth preprocessing. Used as an input to specify clo...
Definition PxParticleBuffer.h:395
void allocateBuffers(PxU32 nbParticles, PxCudaContextManager *cudaManager)
allocate all the buffers for this PxPartitionedParticleCloth.
PxU32 * sortedClothStartIndices
The first particle index into the position buffer of the #PxParticleClothBuffer for each cloth....
Definition PxParticleBuffer.h:400
PxU32 nbCloths
The number of cloths.
Definition PxParticleBuffer.h:406
PxU32 * remapOutput
Index of the next copy of this particle in the next partition, or in the accumulation buffer....
Definition PxParticleBuffer.h:398
PxU32 * accumulatedCopiesPerParticles
Start index for each particle in the accumulation buffer. Size: numParticles.
Definition PxParticleBuffer.h:397
PxU32 nbSprings
The number of springs.
Definition PxParticleBuffer.h:405
PxParticleCloth * cloths
The #PxParticleCloth s sorted by start particle index.
Definition PxParticleBuffer.h:401
PxCudaContextManager * mCudaManager
A cuda context manager.
Definition PxParticleBuffer.h:409
PxU32 * accumulatedSpringsPerPartitions
The number of springs in each partition. Size: numPartitions.
Definition PxParticleBuffer.h:396
PxParticleSpring * orderedSprings
Springs ordered by partition. Size: numSprings.
Definition PxParticleBuffer.h:399
PxU32 maxSpringsPerPartition
The maximum number of springs in a partition.
Definition PxParticleBuffer.h:407
PxU32 nbPartitions
The number of partitions.
Definition PxParticleBuffer.h:404
PxU32 remapOutputSize
Size of remapOutput.
Definition PxParticleBuffer.h:403