RavEngine
Loading...
Searching...
No Matches
PxSDFDesc.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef PX_SDF_DESC_H
30#define PX_SDF_DESC_H
35#include "PxPhysXConfig.h"
36#include "geometry/PxSimpleTriangleMesh.h"
37#include "foundation/PxBounds3.h"
38
39#if !PX_DOXYGEN
40namespace physx
41{
42#endif
43
47 struct PxDim3
48 {
49 PxU32 x, y, z;
50 };
51
56 {
57 public:
64 };
65
157
174
176 {
177 // Check validity of user's input(if any)
178 if (sdf.data)
179 {
180 if (dims.x < 1 || dims.y < 1 || dims.z < 1)
181 return false;
182 if (!meshLower.isFinite())
183 return false;
184 if (spacing <= 0)
185 return false;
186 }
187
188 return true;
189 }
190
191#if !PX_DOXYGEN
192} // namespace physx
193#endif
194
196#endif
Class representing 3D range or axis aligned bounding box.
Definition PxBounds3.h:58
static PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3 empty()
Return empty bounds.
Definition PxBounds3.h:284
A structure describing signed distance field for mesh.
Definition PxSDFDesc.h:70
PxU32 numThreadsForSdfConstruction
The number of threads that are launched to compute the signed distance field.
Definition PxSDFDesc.h:144
PX_INLINE PxSDFDesc()
Constructor.
Definition PxSDFDesc.h:158
PxDim3 sdfSubgrids3DTexBlockDim
Number of subgrid blocks in the 3d texture. The full texture dimension will be sdfSubgrids3DTexBlockD...
Definition PxSDFDesc.h:107
PxDim3 dims
Dimensions of sdf.
Definition PxSDFDesc.h:81
PxBoundedData sdfStartSlots
Array with start indices into the subgrid texture for every subgrid block. 10bits for z coordinate,...
Definition PxSDFDesc.h:117
PxReal subgridsMinSdfValue
The minimum value over all subgrid blocks. Used if normalized textures are used which is the case for...
Definition PxSDFDesc.h:122
PxReal spacing
The spacing of each sdf voxel.
Definition PxSDFDesc.h:91
PxU32 subgridSize
The number of cells in a sparse subgrid block (full block has subgridSize^3 cells and (subgridSize+1)...
Definition PxSDFDesc.h:97
PxBounds3 sdfBounds
The bounds of the sdf. If left unassigned (empty), the bounds of the mesh will be used.
Definition PxSDFDesc.h:132
PxReal subgridsMaxSdfValue
The maximum value over all subgrid blocks. Used if normalized textures are used which is the case for...
Definition PxSDFDesc.h:127
PX_INLINE bool isValid() const
Returns true if the descriptor is valid.
Definition PxSDFDesc.h:175
PxSdfBitsPerSubgridPixel::Enum bitsPerSubgridPixel
Enumeration that defines the number of bits per subgrid pixel (either 32, 16 or 8bits)
Definition PxSDFDesc.h:102
PxVec3 meshLower
The Lower bound of the original mesh.
Definition PxSDFDesc.h:86
PxBoundedData sdfSubgrids
The data to create the 3d texture containg the packed subgrid blocks. Stored as PxU8 to support multi...
Definition PxSDFDesc.h:112
PxBoundedData sdf
Pointer to first sdf array element.
Definition PxSDFDesc.h:76
PxReal narrowBandThicknessRelativeToSdfBoundsDiagonal
Narrow band thickness as a fraction of the bounds diagonal length. Every subgrid block that overlaps ...
Definition PxSDFDesc.h:139
Defines the number of bits per subgrid pixel.
Definition PxSDFDesc.h:56
Enum
Definition PxSDFDesc.h:59
@ e16_BIT_PER_PIXEL
16 bit per subgrid pixel (values will be stored as normalized integers)
Definition PxSDFDesc.h:61
@ e8_BIT_PER_PIXEL
8 bit per subgrid pixel (values will be stored as normalized integers)
Definition PxSDFDesc.h:60
@ e32_BIT_PER_PIXEL
32 bit per subgrid pixel (values will be stored as floats in world scale units)
Definition PxSDFDesc.h:62
3 Element vector class.
Definition PxVec3.h:50
PX_CUDA_CALLABLE PX_INLINE bool isFinite() const
returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)
Definition PxVec3.h:156
#define PX_INLINE
Definition PxPreprocessor.h:320
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition PxCoreUtilityTypes.h:96
A helper structure to define dimensions in 3D.
Definition PxSDFDesc.h:48