PxHeightFieldDesc.h
Go to the documentation of this file.
1 //
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions
4 // are met:
5 // * Redistributions of source code must retain the above copyright
6 // notice, this list of conditions and the following disclaimer.
7 // * Redistributions in binary form must reproduce the above copyright
8 // notice, this list of conditions and the following disclaimer in the
9 // documentation and/or other materials provided with the distribution.
10 // * Neither the name of NVIDIA CORPORATION nor the names of its
11 // contributors may be used to endorse or promote products derived
12 // from this software without specific prior written permission.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
15 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 //
26 // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
28 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
29 
30 
31 #ifndef PX_COLLISION_NXHEIGHTFIELDDESC
32 #define PX_COLLISION_NXHEIGHTFIELDDESC
33 
40 
41 #if !PX_DOXYGEN
42 namespace physx
43 {
44 #endif
45 
55 {
56 public:
57 
67 
77 
88 
108 
124 
133 
138 
142  PX_INLINE void setToDefault();
143 
148  PX_INLINE bool isValid() const;
149 };
150 
151 PX_INLINE PxHeightFieldDesc::PxHeightFieldDesc() //constructor sets to default
152 {
153  nbColumns = 0;
154  nbRows = 0;
156  convexEdgeThreshold = 0.0f;
158 }
159 
161 {
162  *this = PxHeightFieldDesc();
163 }
164 
166 {
167  if (nbColumns < 2)
168  return false;
169  if (nbRows < 2)
170  return false;
171  if(format != PxHeightFieldFormat::eS16_TM)
172  return false;
173  if (samples.stride < 4)
174  return false;
175  if (convexEdgeThreshold < 0)
176  return false;
178  return false;
179  return true;
180 }
181 
182 #if !PX_DOXYGEN
183 } // namespace physx
184 #endif
185 
187 #endif
Definition: GuContactBuffer.h:37
PX_INLINE PxHeightFieldDesc()
Constructor sets to default.
Definition: PxHeightFieldDesc.h:151
Disable collisions with height field with boundary edges.
Definition: PxHeightFieldFlag.h:145
Enum
Definition: PxHeightFieldFlag.h:50
float PxReal
Definition: PxSimpleTypes.h:78
PxReal convexEdgeThreshold
Definition: PxHeightFieldDesc.h:123
Descriptor class for PxHeightField.
Definition: PxHeightFieldDesc.h:54
PxHeightFieldFlags flags
Flags bits, combined from values of the enum PxHeightFieldFlag.
Definition: PxHeightFieldDesc.h:132
PX_INLINE void setToDefault()
(re)sets the structure to the default.
Definition: PxHeightFieldDesc.h:160
PxU32 nbColumns
Number of sample columns in the height field samples array.
Definition: PxHeightFieldDesc.h:76
Height field height data is 16 bit signed integers, followed by triangle materials.
Definition: PxHeightFieldFlag.h:72
PxU32 nbRows
Number of sample rows in the height field samples array.
Definition: PxHeightFieldDesc.h:66
PxFlags< PxHeightFieldFlag::Enum, PxU16 > PxHeightFieldFlags
collection of set bits defined in PxHeightFieldFlag.
Definition: PxHeightFieldFlag.h:154
PxU16 flags
a set of Px1DConstraintFlags
Definition: PxConstraintDesc.h:110
Definition: PxCoreUtilityTypes.h:46
uint32_t PxU32
Definition: Px.h:48
#define PX_INLINE
Definition: PxPreprocessor.h:336
PxHeightFieldFormat::Enum format
Format of the sample data.
Definition: PxHeightFieldDesc.h:87
PX_INLINE bool isValid() const
Returns true if the descriptor is valid.
Definition: PxHeightFieldDesc.h:165
PxStridedData samples
The samples array.
Definition: PxHeightFieldDesc.h:107