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_NXHEIGHTFIELDFLAG
32#define PX_COLLISION_NXHEIGHTFIELDFLAG
33/** \addtogroup geomutils
34@{
35*/
36
37#include "foundation/PxFlags.h"
38
39#if !PX_DOXYGEN
40namespace physx
41{
42#endif
43
44/**
45\brief Describes the format of height field samples.
46@see PxHeightFieldDesc.format PxHeightFieldDesc.samples
47*/
48struct PxHeightFieldFormat
49{
50 enum Enum
51 {
52 /**
53 \brief Height field height data is 16 bit signed integers, followed by triangle materials.
54
55 Each sample is 32 bits wide arranged as follows:
56
57 \image html heightFieldFormat_S16_TM.png
58
59 1) First there is a 16 bit height value.
60 2) Next, two one byte material indices, with the high bit of each byte reserved for special use.
61 (so the material index is only 7 bits).
62 The high bit of material0 is the tess-flag.
63 The high bit of material1 is reserved for future use.
64
65 There are zero or more unused bytes before the next sample depending on PxHeightFieldDesc.sampleStride,
66 where the application may eventually keep its own data.
67
68 This is the only format supported at the moment.
69
70 @see PxHeightFieldDesc.format PxHeightFieldDesc.samples
71 */
72 eS16_TM = (1 << 0)
73 };
74};
75
76/**
77\brief Determines the tessellation of height field cells.
78@see PxHeightFieldDesc.format PxHeightFieldDesc.samples
79*/
80struct PxHeightFieldTessFlag
81{
82 enum Enum
83 {
84 /**
85 \brief This flag determines which way each quad cell is subdivided.
86
87 The flag lowered indicates subdivision like this: (the 0th vertex is referenced by only one triangle)
88
89 \image html heightfieldTriMat2.PNG
90
91 <pre>
92 +--+--+--+---> column
93 | /| /| /|
94 |/ |/ |/ |
95 +--+--+--+
96 | /| /| /|
97 |/ |/ |/ |
98 +--+--+--+
99 |
100 |
101 V row
102 </pre>
103
104 The flag raised indicates subdivision like this: (the 0th vertex is shared by two triangles)
105
106 \image html heightfieldTriMat1.PNG
107
108 <pre>
109 +--+--+--+---> column
110 |\ |\ |\ |
111 | \| \| \|
112 +--+--+--+
113 |\ |\ |\ |
114 | \| \| \|
115 +--+--+--+
116 |
117 |
118 V row
119 </pre>
120
121 @see PxHeightFieldDesc.format PxHeightFieldDesc.samples
122 */
123 e0TH_VERTEX_SHARED = (1 << 0)
124 };
125};
126
127
128/**
129\brief Enum with flag values to be used in PxHeightFieldDesc.flags.
130*/
131struct PxHeightFieldFlag
132{
133 enum Enum
134 {
135 /**
136 \brief Disable collisions with height field with boundary edges.
137
138 Raise this flag if several terrain patches are going to be placed adjacent to each other,
139 to avoid a bump when sliding across.
140
141 This flag is ignored in contact generation with sphere and capsule shapes.
142
143 @see PxHeightFieldDesc.flags
144 */
145 eNO_BOUNDARY_EDGES = (1 << 0)
146 };
147};
148
149/**
150\brief collection of set bits defined in PxHeightFieldFlag.
151
152@see PxHeightFieldFlag
153*/
154typedef PxFlags<PxHeightFieldFlag::Enum,PxU16> PxHeightFieldFlags;
155PX_FLAGS_OPERATORS(PxHeightFieldFlag::Enum,PxU16)
156
157#if !PX_DOXYGEN
158} // namespace physx
159#endif
160
161/** @} */
162#endif
163

source code of qtquick3dphysics/src/3rdparty/PhysX/include/geometry/PxHeightFieldFlag.h