22 #ifndef __ND_SHAPE_HEIGHT_FIELD__
23 #define __ND_SHAPE_HEIGHT_FIELD__
25 #include "ndCollisionStdafx.h"
26 #include "ndShapeStaticMesh.h"
39 ndInt32 m_normal_edge01;
40 ndInt32 m_normal_edge12;
41 ndInt32 m_normal_edge20;
52 enum ndGridConstruction
54 m_normalDiagonals = 0,
60 ndInt32 width, ndInt32 height, ndGridConstruction constructionMode,
61 ndFloat32 horizontalScale_x, ndFloat32 horizontalScale_z);
68 D_COLLISION_API
void UpdateElevationMapAabb();
80 void CalculateLocalObb();
81 ndInt32 FastInt(ndFloat32 x)
const;
82 const ndInt32* GetIndexList()
const;
85 ndFloat32 RayCastCell(
const ndFastRay& ray, ndInt32 xIndex0, ndInt32 zIndex0,
ndVector& normalOut, ndFloat32 maxT)
const;
86 void CalculateMinAndMaxElevation(ndInt32 x0, ndInt32 x1, ndInt32 z0, ndInt32 z1, ndFloat32& minHeight, ndFloat32& maxHeight)
const;
92 ndFloat32 m_horizontalScale_x;
93 ndFloat32 m_horizontalScale_z;
94 ndFloat32 m_horizontalScaleInv_x;
95 ndFloat32 m_horizontalScaleInv_z;
98 ndGridConstruction m_diagonalMode;
103 static ndInt32 m_cellIndices[][4];
109 return m_elevationMap;
112 inline const ndArray<ndReal>& ndShapeHeightfield::GetElevationMap()
const
114 return m_elevationMap;
117 inline ndInt32 ndShapeHeightfield::FastInt(ndFloat32 x)
const
119 ndInt32 i = ndInt32(x);
120 if (ndFloat32(i) > x)