23 int upAxis,
bool flipQuadEdges)
24 : m_userValue3(0), m_triangleInfoMap(0)
34 : m_userValue3(0), m_triangleInfoMap(0)
44 : m_userValue3(0), m_triangleInfoMap(0)
54 : m_userValue3(0), m_triangleInfoMap(0)
69#ifdef BT_USE_DOUBLE_PRECISION
84#ifdef BT_USE_DOUBLE_PRECISION
284 return (
int)(x - 0.5);
286 return (
int)(x + 0.5);
358 for (
int i = 0; i < 3; ++i)
499 struct GridRaycastState
516template <
typename Action_T>
521 if (
rs.maxDistance3d < 0.0001)
532 if (
rs.maxDistanceFlat < 0.0001)
620 rs.prevParam =
rs.param;
639 if (
rs.param >
rs.maxDistanceFlat)
641 rs.param =
rs.maxDistanceFlat;
743 if (
rs.maxDistanceFlat > 0.0001)
788 processTriangles.
shape =
this;
791 processTriangles.
callback = callback;
889 int z0 =
cz * chunkSize;
893 int x0 =
cx * chunkSize;
916 for (
int z =
z0; z <
z0 + chunkSize + 1; ++z)
923 for (
int x =
x0; x <
x0 + chunkSize + 1; ++x)
@ TERRAIN_SHAPE_PROXYTYPE
PHY_ScalarType
PHY_ScalarType enumerates possible scalar types.
static btHeightfieldTerrainShape::Range minmaxRange(btScalar a, btScalar b, btScalar c)
static int getQuantized(btScalar x)
void gridRaycast(Action_T &quadAction, const btVector3 &beginPos, const btVector3 &endPos, int indices[3])
Iterates through a virtual 2D grid of unit-sized square cells, and executes an action on each cell in...
const T & btMax(const T &a, const T &b)
const T & btMin(const T &a, const T &b)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btScalar btSqrt(btScalar y)
btScalar btFabs(btScalar x)
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
virtual btScalar getMargin() const
btHeightfieldTerrainShape simulates a 2D heightfield terrain
bool m_flipTriangleWinding
PHY_ScalarType m_heightDataType
bool m_useZigzagSubdivision
bool m_useDiamondSubdivision
virtual btScalar getRawHeightFieldValue(int x, int y) const
This returns the "raw" (user's initial) height, not the actual height.
const short * m_heightfieldDataShort
const double * m_heightfieldDataDouble
virtual void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t.
void quantizeWithClamp(int *out, const btVector3 &point, int isMax) const
given input vector, return quantized version
virtual ~btHeightfieldTerrainShape()
void getVertex(int x, int y, btVector3 &vertex) const
this returns the vertex in bullet-local coordinates
virtual void calculateLocalInertia(btScalar mass, btVector3 &inertia) const
const void * m_heightfieldDataUnknown
const unsigned char * m_heightfieldDataUnsignedChar
virtual void setLocalScaling(const btVector3 &scaling)
const float * m_heightfieldDataFloat
void performRaycast(btTriangleCallback *callback, const btVector3 &raySource, const btVector3 &rayTarget) const
Performs a raycast using a hierarchical Bresenham algorithm.
int m_heightStickWidth
terrain data
virtual void processAllTriangles(btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
process all triangles within the provided axis-aligned bounding box
btHeightfieldTerrainShape(int heightStickWidth, int heightStickLength, const float *heightfieldData, btScalar minHeight, btScalar maxHeight, int upAxis, bool flipQuadEdges)
preferred constructors
btAlignedObjectArray< Range > m_vboundsGrid
virtual const btVector3 & getLocalScaling() const
void buildAccelerator(int chunkSize=16)
Builds a grid data structure storing the min and max heights of the terrain in chunks.
void initialize(int heightStickWidth, int heightStickLength, const void *heightfieldData, btScalar heightScale, btScalar minHeight, btScalar maxHeight, int upAxis, PHY_ScalarType heightDataType, bool flipQuadEdges)
protected initialization
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
btMatrix3x3 absolute() const
Return the matrix with all values non negative.
The btTriangleCallback provides a callback for each overlapping triangle when calling processAllTrian...
virtual void processTriangle(btVector3 *triangle, int partId, int triangleIndex)=0
btVector3 can be used to represent 3D points and vectors.
const btScalar & getZ() const
Return the z value.
btScalar distance(const btVector3 &v) const
Return the distance between the ends of this and another vector This is symantically treating the vec...
btVector3 dot3(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2) const
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
const btScalar & getY() const
Return the y value.
const btScalar & getX() const
Return the x value.
void operator()(const GridRaycastState &bs) const
void exec(int x, int z) const
btTriangleCallback * callback
bool useDiamondSubdivision
const btHeightfieldTerrainShape * shape
void operator()(const GridRaycastState &rs) const
ProcessVBoundsAction(const btAlignedObjectArray< btHeightfieldTerrainShape::Range > &bnd, int *indices)
ProcessTrianglesAction processTriangles
const btAlignedObjectArray< btHeightfieldTerrainShape::Range > & vbounds