Class PxParticleBuffer

java.lang.Object
physx.NativeObject
physx.common.PxBase
physx.particles.PxParticleBuffer
Direct Known Subclasses:
PxParticleAndDiffuseBuffer, PxParticleClothBuffer

public class PxParticleBuffer extends PxBase
The shared base class for all particle buffers, can be instantiated directly to simulate granular and fluid particles.

See #PxPhysics::createParticleBuffer.

A particle buffer is a container that specifies per-particle attributes of a set of particles that will be used during the simulation of a particle system. It exposes direct access to the underlying GPU buffers and is independent of the scene and particle system. Particle buffers can be added/removed from a particle system at any time between simulation steps, and transferred from one particle system to another.

  • Field Details

    • SIZEOF

      public static final int SIZEOF
    • ALIGNOF

      public static final int ALIGNOF
      See Also:
  • Constructor Details

    • PxParticleBuffer

      protected PxParticleBuffer()
    • PxParticleBuffer

      protected PxParticleBuffer(long address)
  • Method Details

    • wrapPointer

      public static PxParticleBuffer wrapPointer(long address)
    • arrayGet

      public static PxParticleBuffer arrayGet(long baseAddress, int index)
    • getBufferIndex

      public int getBufferIndex()
      Index of this buffer in the particle system it is assigned to.
    • getBufferUniqueId

      public int getBufferUniqueId()
      Unique index that does not change over the lifetime of a PxParticleBuffer.
    • getPositionInvMasses

      public PxVec4 getPositionInvMasses()
      Get positions and inverse masses for this particle buffer.
      Returns:
      A pointer to a device buffer containing the positions and inverse mass packed as PxVec4(pos.x, pos.y, pos.z, inverseMass).
    • getVelocities

      public PxVec4 getVelocities()
      Get velocities for this particle buffer.
      Returns:
      A pointer to a device buffer containing the velocities packed as PxVec4(vel.x, vel.y, vel.z, 0.0f).
    • getPhases

      public NativeObject getPhases()
      Get phases for this particle buffer.

      See #PxParticlePhase

      Returns:
      A pointer to a device buffer containing the per-particle phases for this particle buffer.
    • getParticleVolumes

      public PxParticleVolume getParticleVolumes()
      Get particle volumes for this particle buffer.

      See #PxParticleVolume

      Returns:
      A pointer to a device buffer containing the #PxParticleVolume s for this particle buffer.
    • setNbActiveParticles

      public void setNbActiveParticles(int nbActiveParticles)
      Set the number of active particles for this particle buffer.
      Parameters:
      nbActiveParticles - The number of active particles.

      The number of active particles can be <= PxParticleBuffer::getMaxParticles(). The particle system will simulate the first x particles in the #PxParticleBuffer, where x is the number of active particles.

    • getNbActiveParticles

      public int getNbActiveParticles()
      Get the number of active particles for this particle buffer.
      Returns:
      The number of active particles.
    • getMaxParticles

      public int getMaxParticles()
      Get the maximum number particles this particle buffer can hold.

      The maximum number of particles is specified when creating a #PxParticleBuffer. See #PxPhysics::createParticleBuffer.

      Returns:
      The maximum number of particles.
    • getNbParticleVolumes

      public int getNbParticleVolumes()
      Get the number of particle volumes in this particle buffer.
      Returns:
      The number of #PxParticleVolume s for this particle buffer.
    • setNbParticleVolumes

      public void setNbParticleVolumes(int nbParticleVolumes)
      Set the number of #PxParticleVolume s for this particle buffer.
      Parameters:
      nbParticleVolumes - The number of particle volumes in this particle buffer.
    • getMaxParticleVolumes

      public int getMaxParticleVolumes()
      Get the maximum number of particle volumes this particle buffer can hold.

      See #PxParticleVolume.

      Returns:
      The maximum number of particle volumes this particle buffer can hold.
    • setRigidFilters

      public void setRigidFilters(PxParticleRigidFilterPair filters, int nbFilters)
      Set the #PxParticleRigidFilterPair s for collision filtering of particles in this buffer with rigid bodies.

      See #PxParticleRigidFilterPair

      Parameters:
      filters - A device buffer containing #PxParticleRigidFilterPair s.
      nbFilters - The number of particle-rigid body collision filtering pairs.
    • setRigidAttachments

      public void setRigidAttachments(PxParticleRigidAttachment attachments, int nbAttachments)
      Set the particle-rigid body attachments for particles in this particle buffer.

      See #PxParticleRigidAttachment

      Parameters:
      attachments - A device buffer containing #PxParticleRigidAttachment s.
      nbAttachments - The number of particle-rigid body attachments.
    • getFlatListStartIndex

      public int getFlatListStartIndex()
      Get the start index for the first particle of this particle buffer in the complete list of particles of the particle system this buffer is used in.

      The return value is only correct if the particle buffer is assigned to a particle system and at least one call to simulate() has been performed.

      Returns:
      The index of the first particle in the complete particle list.
    • raiseFlags

      public void raiseFlags(PxParticleBufferFlagEnum flags)
      Raise dirty flags on this particle buffer to communicate that the corresponding data has been updated by the user.
      Parameters:
      flags - The flag corresponding to the data that is dirty.

      See #PxParticleBufferFlag.

    • release

      public void release()
      Release this buffer and deallocate all the memory.
      Overrides:
      release in class PxBase