PxIsosurfaceExtractor

Defined in include/PxIsosurfaceExtraction.h

class PxIsosurfaceExtractor

Base class for isosurface extractors.

Allows to register the data arrays for the isosurface and to obtain the number vertices/triangles in use.

Subclassed by PxSparseGridIsosurfaceExtractor

Public Functions

virtual PxIsosurfaceParams getIsosurfaceParams() const = 0

Returns the isosurface parameters.

Returns

The isosurfacesettings used for the isosurface extraction

virtual void setIsosurfaceParams(const PxIsosurfaceParams &params) = 0

Set the isosurface extraction parameters.

Allows to configure the isosurface extraction by controlling threshold value, smoothing options etc.

Parameters

params[in] A collection of settings to control the isosurface extraction

virtual PxU32 getNumVertices() const = 0

Returns the number of vertices that the current isosurface triangle mesh uses.

Returns

The number of vertices currently in use

virtual PxU32 getNumTriangles() const = 0

Returns the number of triangles that the current isosurface triangle mesh uses.

Returns

The number of triangles currently in use

virtual PxU32 getMaxVertices() const = 0

Returns the maximum number of vertices that the isosurface triangle mesh can contain.

Returns

The maximum number of vertices that can be genrated

virtual PxU32 getMaxTriangles() const = 0

Returns the maximum number of triangles that the isosurface triangle mesh can contain.

Returns

The maximum number of triangles that can be generated

virtual void setMaxVerticesAndTriangles(PxU32 maxNumVertices, PxU32 maxNumTriangles) = 0

Resizes the internal triangle mesh buffers.

If the output buffers are device buffers, nothing will get resized but new output buffers can be set using setResultBufferDevice. For host side output buffers, temporary buffers will get resized. The new host side result buffers with the same size must be set using setResultBufferHost.

Parameters
  • maxNumVertices[in] The maximum number of vertices the output buffer can hold

  • maxNumTriangles[in] The maximum number of triangles the ouput buffer can hold

virtual PxU32 getMaxParticles() const = 0

The maximal number of particles the isosurface extractor can process.

Returns

The maximal number of particles

virtual void setMaxParticles(PxU32 maxParticles) = 0

Sets the maximal number of particles the isosurface extractor can process.

Parameters

maxParticles[in] The maximal number of particles

virtual void release() = 0

Releases the isosurface extractor instance and its data.

virtual void extractIsosurface(PxVec4 *deviceParticlePos, const PxU32 numParticles, CUstream stream, PxU32 *phases = NULL, PxU32 validPhaseMask = PxParticlePhaseFlag::eParticlePhaseFluid, PxU32 *activeIndices = NULL, PxVec4 *anisotropy1 = NULL, PxVec4 *anisotropy2 = NULL, PxVec4 *anisotropy3 = NULL, PxReal anisotropyFactor = 1.0f) = 0

Triggers the compuation of a new isosurface based on the specified particle locations.

Parameters
  • deviceParticlePos[in] A gpu pointer pointing to the start of the particle array

  • numParticles[in] The number of particles

  • stream[in] The stream on which all the gpu work will be performed

  • phases[in] A phase value per particle

  • validPhaseMask[in] A mask that specifies which phases should contribute to the isosurface. If the binary and operation between this mask and the particle phase is non zero, then the particle will contribute to the isosurface

  • activeIndices[in] Optional array with indices of all active particles

  • anisotropy1[in] Optional anisotropy information, x axis direction (xyz) and scale in w component

  • anisotropy2[in] Optional anisotropy information, y axis direction (xyz) and scale in w component

  • anisotropy3[in] Optional anisotropy information, z axis direction (xyz) and scale in w component

  • anisotropyFactor[in] A factor to multiply with the anisotropy scale

virtual void setResultBufferHost(PxVec4 *vertices, PxU32 *triIndices, PxVec4 *normals = NULL) = 0

Allows to register the host buffers into which the final isosurface triangle mesh will get stored.

Parameters
  • vertices[in] A host buffer to store the vertices of the isosurface mesh

  • triIndices[in] A host buffer to store the triangles of the isosurface mesh

  • normals[in] A host buffer to store the normals of the isosurface mesh

virtual void setResultBufferDevice(PxVec4 *vertices, PxU32 *triIndices, PxVec4 *normals) = 0

Allows to register the host buffers into which the final isosurface triangle mesh will get stored.

Parameters
  • vertices[in] A device buffer to store the vertices of the isosurface mesh

  • triIndices[in] A device buffer to store the triangles of the isosurface mesh

  • normals[in] A device buffer to store the normals of the isosurface mesh

virtual void setEnabled(bool enabled) = 0

Enables or disables the isosurface extractor.

Parameters

enabled[in] The boolean to set the extractor to enabled or disabled

virtual bool isEnabled() const = 0

Allows to query if the isosurface extractor is enabled.

Returns

True if enabled, false otherwise

inline virtual ~PxIsosurfaceExtractor()

Destructor.