| 1 | /* |
| 2 | * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. |
| 3 | * |
| 4 | * NVIDIA CORPORATION and its licensors retain all intellectual property |
| 5 | * and proprietary rights in and to this software, related documentation |
| 6 | * and any modifications thereto. Any use, reproduction, disclosure or |
| 7 | * distribution of this software and related documentation without an express |
| 8 | * license agreement from NVIDIA CORPORATION is strictly prohibited. |
| 9 | */ |
| 10 | // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. |
| 11 | // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. |
| 12 | |
| 13 | |
| 14 | #ifndef PX_COLLISION_NXHEIGHTFIELDFLAG |
| 15 | #define PX_COLLISION_NXHEIGHTFIELDFLAG |
| 16 | /** \addtogroup geomutils |
| 17 | @{ |
| 18 | */ |
| 19 | |
| 20 | #include "foundation/PxFlags.h" |
| 21 | |
| 22 | #ifndef PX_DOXYGEN |
| 23 | namespace physx |
| 24 | { |
| 25 | #endif |
| 26 | |
| 27 | /** |
| 28 | \brief Describes the format of height field samples. |
| 29 | @see PxHeightFieldDesc.format PxHeightFieldDesc.samples |
| 30 | */ |
| 31 | struct PxHeightFieldFormat |
| 32 | { |
| 33 | enum Enum |
| 34 | { |
| 35 | /** |
| 36 | \brief Height field height data is 16 bit signed integers, followed by triangle materials. |
| 37 | |
| 38 | Each sample is 32 bits wide arranged as follows: |
| 39 | |
| 40 | \image html heightFieldFormat_S16_TM.png |
| 41 | |
| 42 | 1) First there is a 16 bit height value. |
| 43 | 2) Next, two one byte material indices, with the high bit of each byte reserved for special use. |
| 44 | (so the material index is only 7 bits). |
| 45 | The high bit of material0 is the tess-flag. |
| 46 | The high bit of material1 is reserved for future use. |
| 47 | |
| 48 | There are zero or more unused bytes before the next sample depending on PxHeightFieldDesc.sampleStride, |
| 49 | where the application may eventually keep its own data. |
| 50 | |
| 51 | This is the only format supported at the moment. |
| 52 | |
| 53 | @see PxHeightFieldDesc.format PxHeightFieldDesc.samples |
| 54 | */ |
| 55 | eS16_TM = (1 << 0) |
| 56 | }; |
| 57 | }; |
| 58 | |
| 59 | /** |
| 60 | \brief Determines the tessellation of height field cells. |
| 61 | @see PxHeightFieldDesc.format PxHeightFieldDesc.samples |
| 62 | */ |
| 63 | struct PxHeightFieldTessFlag |
| 64 | { |
| 65 | enum Enum |
| 66 | { |
| 67 | /** |
| 68 | \brief This flag determines which way each quad cell is subdivided. |
| 69 | |
| 70 | The flag lowered indicates subdivision like this: (the 0th vertex is referenced by only one triangle) |
| 71 | |
| 72 | \image html heightfieldTriMat2.PNG |
| 73 | |
| 74 | <pre> |
| 75 | +--+--+--+---> column |
| 76 | | /| /| /| |
| 77 | |/ |/ |/ | |
| 78 | +--+--+--+ |
| 79 | | /| /| /| |
| 80 | |/ |/ |/ | |
| 81 | +--+--+--+ |
| 82 | | |
| 83 | | |
| 84 | V row |
| 85 | </pre> |
| 86 | |
| 87 | The flag raised indicates subdivision like this: (the 0th vertex is shared by two triangles) |
| 88 | |
| 89 | \image html heightfieldTriMat1.PNG |
| 90 | |
| 91 | <pre> |
| 92 | +--+--+--+---> column |
| 93 | |\ |\ |\ | |
| 94 | | \| \| \| |
| 95 | +--+--+--+ |
| 96 | |\ |\ |\ | |
| 97 | | \| \| \| |
| 98 | +--+--+--+ |
| 99 | | |
| 100 | | |
| 101 | V row |
| 102 | </pre> |
| 103 | |
| 104 | @see PxHeightFieldDesc.format PxHeightFieldDesc.samples |
| 105 | */ |
| 106 | e0TH_VERTEX_SHARED = (1 << 0) |
| 107 | }; |
| 108 | }; |
| 109 | |
| 110 | |
| 111 | /** |
| 112 | \brief Enum with flag values to be used in PxHeightFieldDesc.flags. |
| 113 | */ |
| 114 | struct PxHeightFieldFlag |
| 115 | { |
| 116 | enum Enum |
| 117 | { |
| 118 | /** |
| 119 | \brief Disable collisions with height field with boundary edges. |
| 120 | |
| 121 | Raise this flag if several terrain patches are going to be placed adjacent to each other, |
| 122 | to avoid a bump when sliding across. |
| 123 | |
| 124 | This flag is ignored in contact generation with sphere and capsule shapes. |
| 125 | |
| 126 | @see PxHeightFieldDesc.flags |
| 127 | */ |
| 128 | eNO_BOUNDARY_EDGES = (1 << 0) |
| 129 | }; |
| 130 | }; |
| 131 | |
| 132 | /** |
| 133 | \brief collection of set bits defined in PxHeightFieldFlag. |
| 134 | |
| 135 | @see PxHeightFieldFlag |
| 136 | */ |
| 137 | typedef PxFlags<PxHeightFieldFlag::Enum,PxU16> PxHeightFieldFlags; |
| 138 | PX_FLAGS_OPERATORS(PxHeightFieldFlag::Enum,PxU16) |
| 139 | |
| 140 | #ifndef PX_DOXYGEN |
| 141 | } // namespace physx |
| 142 | #endif |
| 143 | |
| 144 | /** @} */ |
| 145 | #endif |
| 146 | |