PxSDFBuilder#

Defined in include/PxSDFBuilder.h

class PxSDFBuilder#

Utility class to compute an SDF on the GPU.

Public Functions

virtual bool buildSDF(
const PxVec3 *vertices,
PxU32 numVertices,
const PxU32 *indices,
PxU32 numTriangleIndices,
PxU32 width,
PxU32 height,
PxU32 depth,
const PxVec3 &minExtents,
const PxVec3 &maxExtents,
bool cellCenteredSamples,
PxReal *sdf,
CUstream stream = 0,
) = 0#

Constructs a dense grid SDF for a triangle mesh using the GPU.

Parameters:
  • vertices – [in] The vertices of the triangle mesh

  • numVertices – [in] The number of vertices

  • indices – [in] The triangle indices

  • numTriangleIndices – [in] The number of triangle indices

  • width – [in] The number of samples along the x direction of the resulting SDF volume

  • height – [in] The number of samples along the y direction of the resulting SDF volume

  • depth – [in] The number of samples along the z direction of the resulting SDF volume

  • minExtents – [in] The minimum corner location of the axis aligned box containing the SDF samples

  • maxExtents – [in] The maximum corner location of the axis aligned box containing the SDF samples

  • cellCenteredSamples – [in] Determines if the sample points are located at the center of a SDF cell or at the lower left (=min) corner of a cell

  • sdf – [out] The distance values. Must provide space for width*height*depth distance samples. Negative distance means the sample point is located inside of the triangle mesh

  • stream – [in] The cuda stream on which the conversion is processed. If the default stream (0) is used, a temporary stream will be created internally

Returns:

A boolean that indicates whether the SDF creation succeeded

virtual bool buildSparseSDF(
const PxVec3 *vertices,
PxU32 numVertices,
const PxU32 *indices,
PxU32 numTriangleIndices,
PxU32 width,
PxU32 height,
PxU32 depth,
const PxVec3 &minExtents,
const PxVec3 &maxExtents,
PxReal narrowBandThickness,
PxU32 cellsPerSubgrid,
PxSdfBitsPerSubgridPixel::Enum bitsPerSubgridPixel,
PxArray<PxReal> &sdfCoarse,
PxArray<PxU32> &sdfSubgridsStartSlots,
PxArray<PxU8> &sdfDataSubgrids,
PxReal &subgridsMinSdfValue,
PxReal &subgridsMaxSdfValue,
PxU32 &sdfSubgrids3DTexBlockDimX,
PxU32 &sdfSubgrids3DTexBlockDimY,
PxU32 &sdfSubgrids3DTexBlockDimZ,
CUstream stream = 0,
) = 0#

Constructs a sparse grid SDF for a triangle mesh using the GPU.

Parameters:
  • vertices – [in] The vertices of the triangle mesh

  • numVertices – [in] The number of vertices

  • indices – [in] The triangle indices

  • numTriangleIndices – [in] The number of triangle indices

  • width – [in] The number of samples along the x direction of the resulting SDF volume

  • height – [in] The number of samples along the y direction of the resulting SDF volume

  • depth – [in] The number of samples along the z direction of the resulting SDF volume

  • minExtents – [in] The minimum corner location of the axis aligned box containing the SDF samples

  • maxExtents – [in] The maximum corner location of the axis aligned box containing the SDF samples

  • narrowBandThickness – [in] The thickness of the narrow band

  • cellsPerSubgrid – [in] The number of cells in a sparse subgrid block (full block has mSubgridSize^3 cells and (mSubgridSize+1)^3 samples)

  • bitsPerSubgridPixel – [in] Subgrid pixel compression

  • sdfCoarse – [out] Used to store the lower resolution, dense backround SDF to provide distance information further away from the mesh’s surface

  • sdfSubgridsStartSlots – [out] Used to store the subgrids start indices

  • sdfDataSubgrids – [out] Used to store the subgrids

  • subgridsMinSdfValue – [out] Used to store the minimum sdf value over all subgrids

  • subgridsMaxSdfValue – [out] Used to store the maximum sdf value over all subgrids

  • sdfSubgrids3DTexBlockDimX – [out] Used to store x dimension of the texture block that stores the subgrids

  • sdfSubgrids3DTexBlockDimY – [out] Used to store y dimension of the texture block that stores the subgrids

  • sdfSubgrids3DTexBlockDimZ – [out] Used to store z dimension of the texture block that stores the subgrids

  • stream – [in] The cuda stream on which the conversion is processed. If the default stream (0) is used, a temporary stream will be created internally

Returns:

A boolean that indicates whether the SDF creation succeeded

virtual void release() = 0#

Releases the memory including the this pointer.

inline virtual ~PxSDFBuilder()#

Destructor.