Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'extern/bullet2/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h')
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h34
1 files changed, 32 insertions, 2 deletions
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h b/extern/bullet2/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h
index 85fd49638ce..49f3e106733 100644
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h
@@ -25,16 +25,46 @@ protected:
btVector3 m_localAabbMin;
btVector3 m_localAabbMax;
- //todo: terrain data
+ ///terrain data
+ int m_width;
+ int m_length;
+ btScalar m_maxHeight;
+ union
+ {
+ unsigned char* m_heightfieldDataUnsignedChar;
+ btScalar* m_heightfieldDataFloat;
+ void* m_heightfieldDataUnknown;
+ };
+
+ bool m_useFloatData;
+ bool m_flipQuadEdges;
+ bool m_useDiamondSubdivision;
+ int m_upAxis;
+
btVector3 m_localScaling;
+ virtual btScalar getHeightFieldValue(int x,int y) const;
+ void quantizeWithClamp(int* out, const btVector3& point) const;
+ void getVertex(int x,int y,btVector3& vertex) const;
+
+ inline bool testQuantizedAabbAgainstQuantizedAabb(int* aabbMin1, int* aabbMax1,const int* aabbMin2,const int* aabbMax2) const
+ {
+ bool overlap = true;
+ overlap = (aabbMin1[0] > aabbMax2[0] || aabbMax1[0] < aabbMin2[0]) ? false : overlap;
+ overlap = (aabbMin1[2] > aabbMax2[2] || aabbMax1[2] < aabbMin2[2]) ? false : overlap;
+ overlap = (aabbMin1[1] > aabbMax2[1] || aabbMax1[1] < aabbMin2[1]) ? false : overlap;
+ return overlap;
+ }
+
public:
- btHeightfieldTerrainShape();
+ btHeightfieldTerrainShape(int width,int height,void* heightfieldData, btScalar maxHeight,int upAxis,bool useFloatData,bool flipQuadEdges);
virtual ~btHeightfieldTerrainShape();
+ void setUseDiamondSubdivision(bool useDiamondSubdivision=true) { m_useDiamondSubdivision = useDiamondSubdivision;}
+
virtual int getShapeType() const
{
return TERRAIN_SHAPE_PROXYTYPE;