35#include "common/PxPhysXCommonConfig.h"
36#include "foundation/PxVec3.h"
37#include "foundation/PxUserAllocated.h"
38#include "foundation/PxArray.h"
68 Dim3(PxU32 _x, PxU32 _y, PxU32 _z) :
x(_x),
y(_y),
z(_z)
129 PxReal* allocateSdfs(
const PxVec3& meshLower,
const PxReal& spacing,
const PxU32 dimX,
const PxU32 dimY,
const PxU32 dimZ,
130 const PxU32 subgridSize,
const PxU32 sdfSubgrids3DTexBlockDimX,
const PxU32 sdfSubgrids3DTexBlockDimY,
const PxU32 sdfSubgrids3DTexBlockDimZ,
131 PxReal subgridsMinSdfValue, PxReal subgridsMaxSdfValue, PxU32 bytesPerSparsePixel);
166 PX_PHYSX_COMMON_API
void windingNumbers(
const PxVec3* vertices,
const PxU32* indices, PxU32 numTriangleIndices, PxU32 width, PxU32 height, PxU32 depth,
183 PX_PHYSX_COMMON_API
void windingNumbersInsideCheck(
const PxVec3* vertices,
const PxU32* indices, PxU32 numTriangleIndices, PxU32 width, PxU32 height, PxU32 depth,
184 bool* insideResult,
PxVec3 minExtents,
PxVec3 maxExtents,
PxVec3* sampleLocations = NULL);
203 PX_PHYSX_COMMON_API
void SDFUsingWindingNumbers(
const PxVec3* vertices,
const PxU32* indices, PxU32 numTriangleIndices, PxU32 width, PxU32 height, PxU32 depth,
204 PxReal* sdf,
PxVec3 minExtents,
PxVec3 maxExtents,
PxVec3* sampleLocations = NULL,
bool cellCenteredSamples =
true, PxU32 numThreads = 1);
231 const PxVec3& minExtents,
const PxVec3& maxExtents, PxReal narrowBandThicknessRelativeToExtentDiagonal, PxU32 cellsPerSubgrid,
233 PxReal& subgridsMinSdfValue, PxReal& subgridsMaxSdfValue, PxU32 numThreads = 1);
253 PxU32* sdfFineStartSlots,
const PxReal* sdfFineSubgridsIn, PxU32 sdfFineSubgridsSize,
PxArray<PxReal>& subgrids3DTexFormat,
254 PxU32& numSubgridsX, PxU32& numSubgridsY, PxU32& numSubgridsZ);
Represents dimensions of signed distance field.
Definition GuSDF.h:48
PxU32 y
Size of Y dimension.
Definition GuSDF.h:80
PxU32 z
Size of Z dimension.
Definition GuSDF.h:81
Dim3(const Dim3 &d)
Copy constructor.
Definition GuSDF.h:75
Dim3(PxU32 _x, PxU32 _y, PxU32 _z)
Constructor.
Definition GuSDF.h:68
PxU32 x
Size of X dimension.
Definition GuSDF.h:79
Dim3(PxZERO d)
Constructor.
Definition GuSDF.h:60
Dim3()
Constructor.
Definition GuSDF.h:53
Represents a signed distance field.
Definition GuSDF.h:88
PxReal mSpacing
Spacing of each sdf voxel.
Definition GuSDF.h:134
PxU32 mSubgridSize
The number of cells in a sparse subgrid block (full block has mSubgridSize^3 cells and (mSubgridSize+...
Definition GuSDF.h:140
PxU32 * mSubgridStartSlots
Array with start indices into the subgrid texture for every subgrid block. 10bits for z coordinate,...
Definition GuSDF.h:142
PxReal mSubgridsMinSdfValue
The minimum value over all subgrid blocks. Used if normalized textures are used which is the case for...
Definition GuSDF.h:146
PxU32 mNumSubgridSdfs
Array length of mSubgridSdf. Only used for serialization.
Definition GuSDF.h:143
SDF(PxZERO s)
Constructor.
Definition GuSDF.h:105
SDF()
Constructor.
Definition GuSDF.h:98
PxReal * mSdf
Array of sdf.
Definition GuSDF.h:137
Dim3 mDims
Dimension of the sdf.
Definition GuSDF.h:135
PxU32 mNumStartSlots
Array length of mSubgridStartSlots. Only used for serialization.
Definition GuSDF.h:141
SDF(const SDF &sdf)
Copy constructor.
Definition GuSDF.h:116
PxVec3 mMeshLower
Lower bound of the original mesh.
Definition GuSDF.h:133
PxReal mSubgridsMaxSdfValue
The maximum value over all subgrid blocks. Used if normalized textures are used which is the case for...
Definition GuSDF.h:147
Dim3 mSdfSubgrids3DTexBlockDim
Subgrid sdf is layed out as a 3d texture including packed blocks of size (mSubgridSize+1)^3.
Definition GuSDF.h:145
~SDF()
Destructor.
Definition GuSDF.cpp:52
PxU8 * mSubgridSdf
The data to create the 3d texture containg the packed subgrid blocks. Stored as PxU8 to support multi...
Definition GuSDF.h:144
PxU32 mBytesPerSparsePixel
The number of bytes per subgrid pixel.
Definition GuSDF.h:148
PxU32 mNumSdfs
Number of sdf values.
Definition GuSDF.h:136
Output stream class for I/O.
Definition PxIO.h:114
Definition PxUserAllocated.h:43
3 Element vector class.
Definition PxVec3.h:50
void windingNumbersInsideCheck(const PxVec3 *vertices, const PxU32 *indices, PxU32 numTriangleIndices, PxU32 width, PxU32 height, PxU32 depth, bool *insideResult, PxVec3 min, PxVec3 max, PxVec3 *sampleLocations)
Returns if a point is enclosed by a triangle mesh.
Definition GuSDF.cpp:399
void windingNumbers(const PxVec3 *vertices, const PxU32 *indices, PxU32 numTriangleIndices, PxU32 width, PxU32 height, PxU32 depth, PxReal *windingNumbers, PxVec3 min, PxVec3 max, PxVec3 *sampleLocations)
Returns the number of times a point is enclosed by a triangle mesh. Therefore points with a winding n...
Definition GuSDF.cpp:298
void convertSparseSDFTo3DTextureLayout(PxU32 width, PxU32 height, PxU32 depth, PxU32 cellsPerSubgrid, PxU32 *sdfFineStartSlots, const PxReal *sdfFineSubgridsIn, PxU32 sdfFineSubgridsSize, PxArray< PxReal > &subgrids3DTexFormat, PxU32 &numSubgridsX, PxU32 &numSubgridsY, PxU32 &numSubgridsZ)
Converts a sparse grid sdf to a format that can be used to create a 3d texture. 3d textures support v...
Definition GuSDF.cpp:1034
void SDFUsingWindingNumbersSparse(const PxVec3 *vertices, const PxU32 *indices, PxU32 numTriangleIndices, PxU32 width, PxU32 height, PxU32 depth, const PxVec3 &minExtents, const PxVec3 &maxExtents, PxReal narrowBandThickness, PxU32 cellsPerSubgrid, PxArray< PxReal > &sdfCoarse, PxArray< PxU32 > &sdfFineStartSlots, PxArray< PxReal > &subgridData, PxArray< PxReal > &denseSdf, PxReal &subgridsMinSdfValue, PxReal &subgridsMaxSdfValue, PxU32 numThreads)
Returns the distance to the mesh's surface for all samples in a grid. The sign is dependent on the tr...
Definition GuSDF.cpp:1189
void extractIsosurfaceFromSDF(const Gu::SDF &sdf, PxArray< PxVec3 > &isosurfaceVertices, PxArray< PxU32 > &isosurfaceTriangleIndices)
Extracts an isosurface as a triangular mesh from a signed distance function.
Definition GuSDF.cpp:1718
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PxEMPTY
Definition Px.h:87