diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2007-07-06 07:12:31 +0400 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2007-07-06 07:12:31 +0400 |
commit | 376be529bb932f867b01466592c33899ee5ec2c8 (patch) | |
tree | e89c72da658f04ed4aa816ada6adabfb5d938b74 /extern/bullet2/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h | |
parent | cff039bc58fe2ed54d4dad0828f5dede0b26a206 (diff) |
synchronized to latest version of Bullet. added btConeTwistConstraint (useful for ragdolls etc)
Diffstat (limited to 'extern/bullet2/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h')
-rw-r--r-- | extern/bullet2/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h | 34 |
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; |