29#ifndef GU_HEIGHTFIELD_H
30#define GU_HEIGHTFIELD_H
32#include "geometry/PxHeightFieldSample.h"
33#include "geometry/PxHeightFieldDesc.h"
34#include "geometry/PxHeightField.h"
35#include "geometry/PxHeightFieldGeometry.h"
37#include "foundation/PxUserAllocated.h"
38#include "CmRefCountable.h"
40#include "GuHeightFieldData.h"
44#define PX_HEIGHTFIELD_VERSION 2
48class PxHeightFieldDesc;
65 void preExportDataReset() { Cm::RefCountable_preExportDataReset(*
this); }
70 PX_PHYSX_COMMON_API
static void getBinaryMetaData(
PxOutputStream& stream);
79 virtual PxU32
saveCells(
void* destBuffer, PxU32 destBufferSize)
const;
81 virtual PxU32
getNbRows()
const {
return mData.rows; }
87 virtual PxReal
getHeight(PxReal x, PxReal z)
const {
return getHeightInternal(x, z); }
90 return getTriangleMaterial(triangleIndex);
95 return getTriangleNormalInternal(triangleIndex);
100 const PxU32 cell = row * getNbColumnsFast() + column;
112 virtual void onRefCountZero();
118 PX_CUDA_CALLABLE
PX_FORCE_INLINE PxU32 getNbRowsFast()
const {
return mData.rows; }
119 PX_CUDA_CALLABLE
PX_FORCE_INLINE PxU32 getNbColumnsFast()
const {
return mData.columns; }
123 PX_CUDA_CALLABLE
PX_FORCE_INLINE bool isZerothVertexShared(PxU32 vertexIndex)
const
126 return getSample(vertexIndex).tessFlag() != 0;
131 PX_CUDA_CALLABLE
PX_FORCE_INLINE PxU32 getMaterialIndex01(PxU32 vertexIndex)
const
133 const PxHeightFieldSample& sample =
getSample(vertexIndex);
134 return PxU32(sample.materialIndex0 | (sample.materialIndex1 << 16));
139 return PxReal(
getSample(vertexIndex).height);
142 PX_INLINE PxReal getHeightInternal2(PxU32 vertexIndex, PxReal fracX, PxReal fracZ)
const;
146 const PxU32 vertexIndex = computeCellCoordinates(x, z, fracX, fracZ);
148 return getHeightInternal2(vertexIndex, fracX, fracZ);
151 PX_FORCE_INLINE bool isValidVertex(PxU32 vertexIndex)
const {
return vertexIndex < mData.rows*mData.columns; }
153 PX_INLINE PxVec3 getVertex(PxU32 vertexIndex)
const;
154 PX_INLINE bool isConvexVertex(PxU32 vertexIndex, PxU32 row, PxU32 column)
const;
156 PX_INLINE bool isValidEdge(PxU32 edgeIndex)
const;
157 PX_INLINE PxU32 getEdgeTriangleIndices(PxU32 edgeIndex, PxU32 triangleIndices[2])
const;
158 PX_INLINE PxU32 getEdgeTriangleIndices(PxU32 edgeIndex, PxU32 triangleIndices[2], PxU32 cell, PxU32 row, PxU32 column)
const;
159 PX_INLINE void getEdgeVertexIndices(PxU32 edgeIndex, PxU32& vertexIndex0, PxU32& vertexIndex1)
const;
161 PX_INLINE bool isConvexEdge(PxU32 edgeIndex, PxU32 cell, PxU32 row, PxU32 column)
const;
164 const PxU32 cell = edgeIndex / 3;
165 const PxU32
row = cell / mData.columns;
166 const PxU32
column = cell % mData.columns;
167 return isConvexEdge(edgeIndex, cell, row, column);
170 PxU32 computeCellCoordinates(PxReal x, PxReal z, PxReal& fracX, PxReal& fracZ)
const;
172 PX_CUDA_CALLABLE
PX_FORCE_INLINE PxU32 getMin(PxReal x, PxU32 nb)
const
179 const PxReal cx = PxFloor(x);
180 const PxU32 icx = PxU32(cx);
184 PX_CUDA_CALLABLE
PX_FORCE_INLINE PxU32 getMax(PxReal x, PxU32 nb)
const
191 const PxReal cx = PxCeil(x);
192 const PxU32 icx = PxU32(cx);
196 PX_CUDA_CALLABLE
PX_FORCE_INLINE PxU32 getMinRow(PxReal x)
const {
return getMin(x, mData.rows-2); }
197 PX_CUDA_CALLABLE
PX_FORCE_INLINE PxU32 getMaxRow(PxReal x)
const {
return getMax(x, mData.rows-1); }
198 PX_CUDA_CALLABLE
PX_FORCE_INLINE PxU32 getMinColumn(PxReal z)
const {
return getMin(z, mData.columns-2); }
199 PX_CUDA_CALLABLE
PX_FORCE_INLINE PxU32 getMaxColumn(PxReal z)
const {
return getMax(z, mData.columns-1); }
201 PX_CUDA_CALLABLE
PX_INLINE bool isValidTriangle(PxU32 triangleIndex)
const;
202 PX_CUDA_CALLABLE
PX_FORCE_INLINE bool isFirstTriangle(PxU32 triangleIndex)
const {
return ((triangleIndex & 0x1) == 0); }
204 PX_CUDA_CALLABLE
PX_FORCE_INLINE PxU16 getTriangleMaterial(PxU32 triangleIndex)
const
206 return isFirstTriangle(triangleIndex) ? getMaterialIndex0(triangleIndex >> 1) : getMaterialIndex1(triangleIndex >> 1);
209 PX_CUDA_CALLABLE
PX_INLINE void getTriangleVertexIndices(PxU32 triangleIndex, PxU32& vertexIndex0, PxU32& vertexIndex1, PxU32& vertexIndex2)
const;
210 PX_CUDA_CALLABLE
PX_INLINE PxVec3 getTriangleNormalInternal(PxU32 triangleIndex)
const;
211 PX_INLINE void getTriangleAdjacencyIndices(PxU32 triangleIndex,PxU32 vertexIndex0, PxU32 vertexIndex1, PxU32 vertexIndex2, PxU32& adjacencyIndex0, PxU32& adjacencyIndex1, PxU32& adjacencyIndex2)
const;
213 PX_INLINE PxVec3 getNormal_2(PxU32 vertexIndex, PxReal fracX, PxReal fracZ, PxReal xcoeff, PxReal ycoeff, PxReal zcoeff)
const;
214 PX_FORCE_INLINE PxVec3 getNormal_(PxReal x, PxReal z, PxReal xcoeff, PxReal ycoeff, PxReal zcoeff)
const
217 const PxU32 vertexIndex = computeCellCoordinates(x, z, fracX, fracZ);
219 return getNormal_2(vertexIndex, fracX, fracZ, xcoeff, ycoeff, zcoeff);
222 PX_INLINE PxU32 getTriangleIndex(PxReal x, PxReal z)
const;
223 PX_INLINE PxU32 getTriangleIndex2(PxU32 cell, PxReal fracX, PxReal fracZ)
const;
226 return getTriangleMaterial(getTriangleIndex(x, z));
232 PX_FORCE_INLINE const Gu::HeightFieldData& getData()
const {
return mData; }
234 PX_CUDA_CALLABLE
PX_FORCE_INLINE void getTriangleVertices(PxU32 triangleIndex, PxU32 row, PxU32 column, PxVec3& v0, PxVec3& v1, PxVec3& v2)
const;
237 bool isSolidVertex(PxU32 vertexIndex, PxU32 row, PxU32 coloumn, PxU16 holeMaterialIndex,
bool& nbSolid)
const;
242 PX_PHYSX_COMMON_API
bool isCollisionVertexPreca(PxU32 vertexIndex, PxU32 row, PxU32 column, PxU16 holeMaterialIndex)
const;
243 void parseTrianglesForCollisionVertices(PxU16 holeMaterialIndex);
247 PX_ASSERT(isValidVertex(vertexIndex));
248 return mData.samples[vertexIndex];
251 PX_CUDA_CALLABLE
void setSamplePtr(PxHeightFieldSample* s) { mData.samples = s; }
253 Gu::HeightFieldData mData;
260 void releaseMemory();
261 virtual ~HeightField();
264 MeshFactory* mMeshFactory;
269PX_INLINE PxVec3 Gu::HeightField::getVertex(PxU32 vertexIndex)
const
271 const PxU32
row = vertexIndex / mData.columns;
272 const PxU32
column = vertexIndex % mData.columns;
274 return PxVec3(PxReal(row),
getHeight(vertexIndex), PxReal(column));
278PX_INLINE bool Gu::HeightField::isConvexVertex(PxU32 vertexIndex, PxU32 row, PxU32 column)
const
280#ifdef PX_HEIGHTFIELD_DEBUG
281 PX_ASSERT(isValidVertex(vertexIndex));
283 PX_ASSERT((vertexIndex / mData.columns)==row);
284 PX_ASSERT((vertexIndex % mData.columns)==column);
287 PxI32 h0 = getSample(vertexIndex).height;
290 bool definedInX, definedInZ;
291 PxI32 convexityX, convexityZ;
293 if ((row > 0) && (row < mData.rows - 1))
296 convexityX = h0 - getSample(vertexIndex + mData.columns).height - getSample(vertexIndex - mData.columns).height;
305 if ((column > 0) && (column < mData.columns - 1))
308 convexityZ = h0 - getSample(vertexIndex + 1).height - getSample(vertexIndex - 1).height;
317 if(definedInX || definedInZ)
325 if(((convexityX ^ convexityZ) & 0x80000000)==0)
328 const PxReal value = PxReal(convexityX + convexityZ);
329 return value > mData.convexEdgeThreshold;
336PX_INLINE bool Gu::HeightField::isValidEdge(PxU32 edgeIndex)
const
338 const PxU32 cell = (edgeIndex / 3);
339 const PxU32
row = cell / mData.columns;
340 const PxU32
column = cell % mData.columns;
342 switch (edgeIndex - cell*3)
345 if (row > mData.rows - 1)
return false;
346 if (column >= mData.columns - 1)
return false;
349 if (row >= mData.rows - 1)
return false;
350 if (column >= mData.columns - 1)
return false;
353 if (row >= mData.rows - 1)
return false;
354 if (column > mData.columns - 1)
return false;
360PX_INLINE PxU32 Gu::HeightField::getEdgeTriangleIndices(PxU32 edgeIndex, PxU32 triangleIndices[2])
const
362 const PxU32 cell = edgeIndex / 3;
363 const PxU32
row = cell / mData.columns;
364 const PxU32
column = cell % mData.columns;
367 switch (edgeIndex - cell*3)
370 if (column < mData.columns - 1)
378 triangleIndices[count++] = ((cell - mData.columns) << 1) + 1 - isZerothVertexShared(cell - mData.columns);
380 if (row < mData.rows - 1)
386 triangleIndices[count++] = (cell << 1) + isZerothVertexShared(cell);
391 if ((row < mData.rows - 1) && (
column < mData.columns - 1))
393 triangleIndices[count++] = cell << 1;
394 triangleIndices[count++] = (cell << 1) + 1;
398 if (row < mData.rows - 1)
401 triangleIndices[count++] = ((cell - 1) << 1) + 1;
402 if (column < mData.columns - 1)
403 triangleIndices[count++] = cell << 1;
410PX_INLINE PxU32 Gu::HeightField::getEdgeTriangleIndices(PxU32 edgeIndex, PxU32 triangleIndices[2], PxU32 cell, PxU32 row, PxU32 column)
const
417 switch (edgeIndex - cell*3)
420 if (column < mData.columns - 1)
428 triangleIndices[count++] = ((cell - mData.columns) << 1) + 1 - isZerothVertexShared(cell - mData.columns);
430 if (row < mData.rows - 1)
436 triangleIndices[count++] = (cell << 1) + isZerothVertexShared(cell);
441 if ((row < mData.rows - 1) && (
column < mData.columns - 1))
443 triangleIndices[count++] = cell << 1;
444 triangleIndices[count++] = (cell << 1) + 1;
448 if (row < mData.rows - 1)
451 triangleIndices[count++] = ((cell - 1) << 1) + 1;
452 if (column < mData.columns - 1)
453 triangleIndices[count++] = cell << 1;
460PX_INLINE void Gu::HeightField::getEdgeVertexIndices(PxU32 edgeIndex, PxU32& vertexIndex0, PxU32& vertexIndex1)
const
462 const PxU32 cell = edgeIndex / 3;
464 switch (edgeIndex - cell*3)
468 vertexIndex1 = cell + 1;
482 const bool b = isZerothVertexShared(cell);
483 vertexIndex0 = cell + 1 - b;
484 vertexIndex1 = cell + mData.columns + b;
489 vertexIndex1 = cell + mData.columns;
494PX_INLINE bool Gu::HeightField::isConvexEdge(PxU32 edgeIndex, PxU32 cell, PxU32 row, PxU32 column)
const
497 PX_ASSERT(cell == edgeIndex / 3);
500 PX_ASSERT(row == cell / mData.columns);
501 if (row > mData.rows-2)
return false;
504 PX_ASSERT(column == cell % mData.columns);
505 if (column > mData.columns-2)
return false;
509 PxI32 h0 = 0, h1 = 0, h2 = 0, h3 = 0;
513 switch (edgeIndex - cell*3)
517 if (row < 1)
return false;
562 const bool b0 = !isZerothVertexShared(cell - mData.columns);
563 h0 = getSample(cell - mData.columns + b0).height;
564 h1 = getSample(cell + b0).height;
610 const bool b1 = isZerothVertexShared(cell);
611 h2 = getSample(cell + b1).height;
612 h3 = getSample(cell + mData.columns + b1).height;
615 convexity = (h1-h0) - (h3-h2);
623 h0 = getSample(cell).height;
624 h1 = getSample(cell + 1).height;
625 h2 = getSample(cell + mData.columns).height;
626 h3 = getSample(cell + mData.columns + 1).height;
627 if (isZerothVertexShared(cell))
629 convexity = (h0 + h3) - (h1 + h2);
632 convexity = (h2 + h1) - (h0 + h3);
636 if (column < 1)
return false;
667 const PxU32 offset0 = isZerothVertexShared(cell-1) ? 0 : mData.columns;
668 h0 = getSample(cell - 1 + offset0).height;
669 h1 = getSample(cell + offset0).height;
701 const PxU32 offset1 = isZerothVertexShared(cell) ? mData.columns : 0;
702 h2 = getSample(cell + offset1).height;
703 h3 = getSample(cell + offset1 + 1).height;
706 convexity = (h1-h0) - (h3-h2);
711 const PxI32 threshold = PxI32(mData.convexEdgeThreshold);
712 return convexity > threshold;
715PX_INLINE bool Gu::HeightField::isValidTriangle(PxU32 triangleIndex)
const
717 const PxU32 cell = triangleIndex >> 1;
718 const PxU32
row = cell / mData.columns;
719 if (row >= (mData.rows - 1))
return false;
720 const PxU32
column = cell % mData.columns;
721 if (column >= (mData.columns - 1))
return false;
725PX_INLINE void Gu::HeightField::getTriangleVertexIndices(PxU32 triangleIndex, PxU32& vertexIndex0, PxU32& vertexIndex1, PxU32& vertexIndex2)
const
727 const PxU32 cell = triangleIndex >> 1;
728 if (isZerothVertexShared(cell))
738 if (isFirstTriangle(triangleIndex))
740 vertexIndex0 = cell + mData.columns;
742 vertexIndex2 = cell + mData.columns + 1;
746 vertexIndex0 = cell + 1;
747 vertexIndex1 = cell + mData.columns + 1;
761 if (isFirstTriangle(triangleIndex))
764 vertexIndex1 = cell + 1;
765 vertexIndex2 = cell + mData.columns;
769 vertexIndex0 = cell + mData.columns + 1;
770 vertexIndex1 = cell + mData.columns;
771 vertexIndex2 = cell + 1;
776PX_INLINE void Gu::HeightField::getTriangleAdjacencyIndices(PxU32 triangleIndex, PxU32 vertexIndex0, PxU32 vertexIndex1, PxU32 vertexIndex2, PxU32& adjacencyIndex0, PxU32& adjacencyIndex1, PxU32& adjacencyIndex2)
const
778 PX_UNUSED(vertexIndex0);
779 PX_UNUSED(vertexIndex1);
780 PX_UNUSED(vertexIndex2);
782 const PxU32 cell = triangleIndex >> 1;
783 if (isZerothVertexShared(cell))
793 if (isFirstTriangle(triangleIndex))
795 adjacencyIndex0 = 0xFFFFFFFF;
796 adjacencyIndex1 = triangleIndex + 1;
797 adjacencyIndex2 = 0xFFFFFFFF;
799 if((cell % (mData.columns) != 0))
801 adjacencyIndex0 = triangleIndex - 1;
804 if((cell / mData.columns != mData.rows - 2))
806 const PxU32 tMod = isZerothVertexShared(cell + mData.columns) ? 1u : 0u;
807 adjacencyIndex2 = ((cell + mData.columns) * 2) + tMod;
812 adjacencyIndex0 = 0xFFFFFFFF;
813 adjacencyIndex1 = triangleIndex - 1;
814 adjacencyIndex2 = 0xFFFFFFFF;
816 if(cell % (mData.columns) < (mData.columns - 2))
818 adjacencyIndex0 = triangleIndex + 1;
821 if(cell >= mData.columns - 1)
823 const PxU32 tMod = isZerothVertexShared(cell - mData.columns) ? 0u : 1u;
824 adjacencyIndex2 = ((cell - mData.columns) * 2) + tMod;
838 if (isFirstTriangle(triangleIndex))
840 adjacencyIndex0 = 0xFFFFFFFF;
841 adjacencyIndex1 = triangleIndex + 1;
842 adjacencyIndex2 = 0xFFFFFFFF;
844 if(cell >= mData.columns - 1)
846 const PxU32 tMod = isZerothVertexShared(cell - mData.columns) ? 0u : 1u;
847 adjacencyIndex0 = ((cell - (mData.columns)) * 2) + tMod;
850 if((cell % (mData.columns) != 0))
852 adjacencyIndex2 = triangleIndex - 1;
857 adjacencyIndex0 = 0xFFFFFFFF;
858 adjacencyIndex1 = triangleIndex - 1;
859 adjacencyIndex2 = 0xFFFFFFFF;
861 if((cell / mData.columns != mData.rows - 2))
863 const PxU32 tMod = isZerothVertexShared(cell + mData.columns) ? 1u : 0u;
864 adjacencyIndex0 = (cell + (mData.columns)) * 2 + tMod;
867 if(cell % (mData.columns) < (mData.columns - 2))
869 adjacencyIndex2 = triangleIndex + 1;
875PX_INLINE PxVec3 Gu::HeightField::getTriangleNormalInternal(PxU32 triangleIndex)
const
878 getTriangleVertexIndices(triangleIndex, v0, v1, v2);
883 const PxI32 h0 = getSample(v0).height;
884 const PxI32 h1 = getSample(v1).height;
885 const PxI32 h2 = getSample(v2).height;
887 const float thickness = 0.0f;
888 const PxReal coeff = physx::intrinsics::fsel(thickness, -1.0f, 1.0f);
891 const PxU32 cell = triangleIndex >> 1;
892 if (isZerothVertexShared(cell))
902 if (isFirstTriangle(triangleIndex))
906 return PxVec3(coeff*PxReal(h1-h0), coeff, coeff*PxReal(h0-h2));
912 return PxVec3(coeff*PxReal(h0-h1), coeff, coeff*PxReal(h2-h0));
925 if (isFirstTriangle(triangleIndex))
929 return PxVec3(coeff*PxReal(h0-h2), coeff, coeff*PxReal(h0-h1));
935 return PxVec3(coeff*PxReal(h2-h0), coeff, coeff*PxReal(h1-h0));
941PX_INLINE PxReal Gu::HeightField::getHeightInternal2(PxU32 vertexIndex, PxReal fracX, PxReal fracZ)
const
943 if (isZerothVertexShared(vertexIndex))
953 const PxReal h0 = getHeight(vertexIndex);
954 const PxReal h2 = getHeight(vertexIndex + mData.columns + 1);
965 const PxReal h1 = getHeight(vertexIndex + 1);
966 return h0 + fracZ*(h1-h0) + fracX*(h2-h1);
978 const PxReal h1 = getHeight(vertexIndex + mData.columns);
979 return h0 + fracX*(h1-h0) + fracZ*(h2-h1);
992 const PxReal h2 = getHeight(vertexIndex + mData.columns);
993 const PxReal h1 = getHeight(vertexIndex + 1);
994 if (fracX + fracZ < 1.0f)
1004 const PxReal h0 = getHeight(vertexIndex);
1005 return h0 + fracZ*(h1-h0) + fracX*(h2-h0);
1019 const PxReal h0 = getHeight(vertexIndex + mData.columns + 1);
1020 return h0 + (1.0f - fracZ)*(h2-h0) + (1.0f - fracX)*(h1-h0);
1025PX_INLINE PxVec3 Gu::HeightField::getNormal_2(PxU32 vertexIndex, PxReal fracX, PxReal fracZ, PxReal xcoeff, PxReal ycoeff, PxReal zcoeff)
const
1028 if (isZerothVertexShared(vertexIndex))
1040 const PxI32 ih0 = getSample(vertexIndex).height;
1041 const PxI32 ih2 = getSample(vertexIndex + mData.columns + 1).height;
1056 const PxI32 ih1 = getSample(vertexIndex + 1).height;
1057 normal = PxVec3(PxReal(ih1 - ih2)*xcoeff, ycoeff, PxReal(ih0 - ih1)*zcoeff);
1073 const PxI32 ih1 = getSample(vertexIndex + mData.columns).height;
1074 normal = PxVec3(PxReal(ih0 - ih1)*xcoeff, ycoeff, PxReal(ih1 - ih2)*zcoeff);
1087 const PxI32 ih1 = getSample(vertexIndex + 1).height;
1088 const PxI32 ih2 = getSample(vertexIndex + mData.columns).height;
1089 if (fracX + fracZ <= PxReal(1))
1103 const PxI32 ih0 = getSample(vertexIndex).height;
1106 normal = PxVec3(PxReal(ih0 - ih2)*xcoeff, ycoeff, PxReal(ih0 - ih1)*zcoeff);
1126 const PxI32 ih0 = getSample(vertexIndex + mData.columns + 1).height;
1128 normal = PxVec3(PxReal(ih1 - ih0)*xcoeff, ycoeff, PxReal(ih2 - ih0)*zcoeff);
1134PX_INLINE PxU32 Gu::HeightField::getTriangleIndex2(PxU32 cell, PxReal fracX, PxReal fracZ)
const
1136 if (isZerothVertexShared(cell))
1137 return (fracZ > fracX) ? (cell << 1) + 1 : (cell << 1);
1139 return (fracX + fracZ > 1) ? (cell << 1) + 1 : (cell << 1);
1142PX_INLINE PxU32 Gu::HeightField::getTriangleIndex(PxReal x, PxReal z)
const
1144 PxReal fracX, fracZ;
1145 const PxU32 cell = computeCellCoordinates(x, z, fracX, fracZ);
1147 return getTriangleIndex2(cell, fracX, fracZ);
1150PX_FORCE_INLINE void Gu::HeightField::getTriangleVertices(PxU32 triangleIndex, PxU32 row, PxU32 column, PxVec3& v0, PxVec3& v1, PxVec3& v2)
const
1152 PxU32 cell = triangleIndex >> 1;
1153 PX_ASSERT(row * getNbColumnsFast() + column == cell);
1155 PxReal h0 = getHeight(cell);
1156 PxReal h1 = getHeight(cell + 1);
1157 PxReal h2 = getHeight(cell + getNbColumnsFast());
1158 PxReal h3 = getHeight(cell + getNbColumnsFast() + 1);
1160 if (isFirstTriangle(triangleIndex))
1162 if (isZerothVertexShared(cell))
1172 v0 = PxVec3(PxReal(row + 1), h2, PxReal(column ));
1173 v1 = PxVec3(PxReal(row ), h0, PxReal(column ));
1174 v2 = PxVec3(PxReal(row + 1), h3, PxReal(column + 1));
1186 v0 = PxVec3(PxReal(row ), h0, PxReal(column ));
1187 v1 = PxVec3(PxReal(row ), h1, PxReal(column + 1));
1188 v2 = PxVec3(PxReal(row + 1), h2, PxReal(column ));
1193 if (isZerothVertexShared(cell))
1203 v0 = PxVec3(PxReal(row ), h1, PxReal(column + 1));
1204 v1 = PxVec3(PxReal(row + 1), h3, PxReal(column + 1));
1205 v2 = PxVec3(PxReal(row ), h0, PxReal(column ));
1217 v0 = PxVec3(PxReal(row + 1), h3, PxReal(column + 1));
1218 v1 = PxVec3(PxReal(row + 1), h2, PxReal(column ));
1219 v2 = PxVec3(PxReal(row ), h1, PxReal(column + 1));
1224PX_FORCE_INLINE const Gu::HeightFieldData* _getHFData(
const PxHeightFieldGeometry& hfGeom)
1226 return &
static_cast<const Gu::HeightField*
>(hfGeom.heightField)->getData();
Definition GuHeightField.h:54
virtual PxVec3 getTriangleNormal(PxTriangleID triangleIndex) const
Returns a triangle face normal for a given triangle index.
Definition GuHeightField.h:93
virtual PxReal getHeight(PxReal x, PxReal z) const
Retrieves the height at the given coordinates in grid space.
Definition GuHeightField.h:87
virtual PxU32 getNbColumns() const
Retrieves the number of sample columns in the samples array.
Definition GuHeightField.h:82
virtual PxReal getConvexEdgeThreshold() const
Retrieves the convex edge threshold.
Definition GuHeightField.h:85
virtual PxU32 getTimestamp() const
Returns the number of times the heightfield data has been modified.
Definition GuHeightField.h:103
virtual PxHeightFieldFlags getFlags() const
Retrieves the flags bits, combined from values of the enum ::PxHeightFieldFlag.
Definition GuHeightField.h:86
virtual PxHeightFieldFormat::Enum getFormat() const
Retrieves the format of the sample data.
Definition GuHeightField.h:83
virtual PxU32 getNbRows() const
Retrieves the number of sample rows in the samples array.
Definition GuHeightField.h:81
virtual void acquireReference()
Acquires a counted reference to this object.
Definition GuHeightField.cpp:113
virtual void release()
Decrements the reference count of a height field and releases it if the new reference count is zero.
Definition GuHeightField.cpp:108
virtual bool modifySamples(PxI32 startCol, PxI32 startRow, const PxHeightFieldDesc &subfieldDesc, bool shrinkBounds)
Replaces a rectangular subfield in the sample data array.
Definition GuHeightField.cpp:125
virtual PxU32 getReferenceCount() const
Returns the reference count of the object.
Definition GuHeightField.cpp:118
virtual const PxHeightFieldSample & getSample(PxU32 row, PxU32 column) const
Returns heightfield sample of given row and column
Definition GuHeightField.h:98
virtual PxU32 getSampleStride() const
Retrieves the offset in bytes between consecutive samples in the array.
Definition GuHeightField.h:84
virtual PxMaterialTableIndex getTriangleMaterialIndex(PxTriangleID triangleIndex) const
Returns material table index of given triangle.
Definition GuHeightField.h:88
virtual PxU32 saveCells(void *destBuffer, PxU32 destBufferSize) const
Writes out the sample data array.
Definition GuHeightField.cpp:382
Definition GuMeshFactory.h:83
Binary deserialization context class.
Definition PxSerialFramework.h:174
Descriptor class for #PxHeightField.
Definition PxHeightFieldDesc.h:53
A height field class.
Definition PxHeightField.h:84
Output stream class for I/O.
Definition PxIO.h:114
Callback class used to process PxBase objects.
Definition PxSerialFramework.h:81
Binary serialization context class.
Definition PxSerialFramework.h:99
Definition PxUserAllocated.h:43
3 Element vector class.
Definition PxVec3.h:50
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
#define PX_INLINE
Definition PxPreprocessor.h:320
GLM_FUNC_DECL genType::row_type row(genType const &m, length_t index)
Definition matrix_access.inl:23
GLM_FUNC_DECL genType::col_type column(genType const &m, length_t index)
Definition matrix_access.inl:53
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition GuHeightFieldData.h:48
Heightfield sample format.
Definition PxHeightFieldSample.h:67
PxBitAndByte materialIndex1
The triangle material index of the quad's upper triangle + reserved flag.
Definition PxHeightFieldSample.h:114
PxBitAndByte materialIndex0
The triangle material index of the quad's lower triangle + tesselation flag.
Definition PxHeightFieldSample.h:99