Classes | Static Public Member Functions | List of all members
PxParticleExt Class Reference

#include <PxParticleExt.h>

Classes

class  IndexPool
 Class to manage particle indices. Extension particle index management can be useful if no application side particle index allocation functionality is available. An PxParticleExt::IndexPool instance is meant to be used for one PxParticleSystem/PxParticleFluid instance. The instance can be created with PxParticleExt::createIndexPool(). More...
 
struct  ParticleBounds
 

Static Public Member Functions

static PxU32 buildBoundsHash (PxU32 *sortedParticleIndices, ParticleBounds *particleBounds, const PxStrideIterator< const PxVec3 > &positionBuffer, const PxU32 validParticleRange, const PxU32 *validParticleBitmap, const PxU32 hashSize, const PxU32 maxBounds, const PxReal gridSpacing)
 Computes particle bounds by sorting particle positions into a spatial hash grid. More...
 
static IndexPoolcreateIndexPool (PxU32 maxParticles)
 Creates a PxParticlesExt::IndexPool instance. More...
 
static IndexPoolcreateIndexPool (PxU32 maxParticles, PxU32 validParticleRange, const PxU32 *validParticleBitmap)
 Creates a PxParticlesExt::IndexPool instance initialized with a preallocated set of indices specified with a bitmap. More...
 

Member Function Documentation

static PxU32 PxParticleExt::buildBoundsHash ( PxU32 sortedParticleIndices,
ParticleBounds particleBounds,
const PxStrideIterator< const PxVec3 > &  positionBuffer,
const PxU32  validParticleRange,
const PxU32 validParticleBitmap,
const PxU32  hashSize,
const PxU32  maxBounds,
const PxReal  gridSpacing 
)
static

Computes particle bounds by sorting particle positions into a spatial hash grid.

Given a strided array of particle positions, this function partitions the particles into subsets of nearby particles by mapping the particle positions onto a 3-dimensional grid and creating ParticleBounds data structures for each occupied grid cell.

Each returned ParticleBounds data structure can be used to determine the indices of the particles belonging to the same grid cell. Particle indices of one grid cell are returned as contiguous blocks in the sortedParticleIndices buffer and can be found within the range [firstParticle, firstParticle + numParticles - 1]. Each returned ParticleBounds further contains an AABB "bounds" that tightly fits all particle positions within the grid cell.

The number of created ParticleBounds can be retrieved via the return value. The user can cap the maximum amount of generated ParticleBounds via the maxBounds parameter. Particles that would cause this maximum to be exceeded will be skipped over and will not be part of any returned ParticleBounds. (Note that this also hold when maxBounds is equal to hashSize. Thus, in the worst case, if no particle should ever be skipped over by the algorithm "hashSize" must be at least equal to numParticles)

The user is responsible for allocating the output buffers sortedParticleIndices (for at least numParticles entries) and particleBounds (for at least maxBounds entries).

The size of a cubical grid cell can be tuned by setting the gridSpacing parameter.

The user supplied hashSize must be a power of two.

Parameters
[out]sortedParticleIndicesPointer to user allocated array of size numParticles where the sorted particle indices will be written to.
[out]particleBoundsPointer to user allocated array of size maxBounds where the ParticleBounds will be written to.
[in]positionBufferStrided data of input particle positions.
[in]validParticleRangeRange of valid particles within validParticleBitmap. (See PxParticleReadData.validParticleRange).
[in]validParticleBitmapBitmap specifying valid slots in positionBuffer. (See PxParticleReadData.validParticleBitmap).
[in]hashSizeHash size used internally by the hashing algorithm. Must be a power of two.
[in]maxBoundsMaximum number of bounds to be returned. Must be smaller or equal than hashSize.
[in]gridSpacingSide length of each cubical grid cell.
Returns
PxU32. Number of ParticleBounds data structures written to the particleBounds buffer. Smaller or equal than maxBounds.
static IndexPool* PxParticleExt::createIndexPool ( PxU32  maxParticles)
static

Creates a PxParticlesExt::IndexPool instance.

Parameters
[in]maxParticlesMaximum number of available indices.
static IndexPool* PxParticleExt::createIndexPool ( PxU32  maxParticles,
PxU32  validParticleRange,
const PxU32 validParticleBitmap 
)
static

Creates a PxParticlesExt::IndexPool instance initialized with a preallocated set of indices specified with a bitmap.

Parameters
[in]maxParticlesMaximum number of available indices.
[in]validParticleRangeRange of indices represented in validParticleBitmap. (See PxParticleReadData.validParticleRange).
[in]validParticleBitmapBitmap specifying the valid particle indices that should be preallocated. (See PxParticleReadData.validParticleBitmap).

The documentation for this class was generated from the following file:


Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com