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:
authorErwin Coumans <blender@erwincoumans.com>2007-06-23 09:28:07 +0400
committerErwin Coumans <blender@erwincoumans.com>2007-06-23 09:28:07 +0400
commitca26aeb7b23e37e65f49d907ea53fcaeee77ad4e (patch)
treeb6530195a8ef5d874b9fc2bbb9574f1484781be5 /extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h
parent14ad8c9941ac1e6f5252a843c6ad17653cbbd689 (diff)
upgrade to latest Bullet 2.53. cross the fingers it doesn't break one of the exotic or less exotic platforms
Diffstat (limited to 'extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h')
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h44
1 files changed, 41 insertions, 3 deletions
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h b/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h
index a404504ba86..c35f7512663 100644
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h
@@ -16,15 +16,20 @@ subject to the following restrictions:
#ifndef BU_SHAPE
#define BU_SHAPE
-#include <LinearMath/btPoint3.h>
-#include <LinearMath/btMatrix3x3.h>
-#include <BulletCollision/CollisionShapes/btConvexShape.h>
+#include "../../LinearMath/btPoint3.h"
+#include "../../LinearMath/btMatrix3x3.h"
+#include "btConvexShape.h"
///PolyhedralConvexShape is an interface class for feature based (vertex/edge/face) convex shapes.
class btPolyhedralConvexShape : public btConvexShape
{
+protected:
+ btVector3 m_localAabbMin;
+ btVector3 m_localAabbMax;
+ bool m_isLocalAabbValid;
+
public:
btPolyhedralConvexShape();
@@ -36,6 +41,39 @@ public:
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
+ inline void getNonvirtualAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax, btScalar margin) const
+ {
+
+ //lazy evaluation of local aabb
+ btAssert(m_isLocalAabbValid);
+
+ btAssert(m_localAabbMin.getX() <= m_localAabbMax.getX());
+ btAssert(m_localAabbMin.getY() <= m_localAabbMax.getY());
+ btAssert(m_localAabbMin.getZ() <= m_localAabbMax.getZ());
+
+
+ btVector3 localHalfExtents = btScalar(0.5)*(m_localAabbMax-m_localAabbMin);
+ btVector3 localCenter = btScalar(0.5)*(m_localAabbMax+m_localAabbMin);
+
+ btMatrix3x3 abs_b = trans.getBasis().absolute();
+
+ btPoint3 center = trans(localCenter);
+
+ btVector3 extent = btVector3(abs_b[0].dot(localHalfExtents),
+ abs_b[1].dot(localHalfExtents),
+ abs_b[2].dot(localHalfExtents));
+ extent += btVector3(margin,margin,margin);
+
+ aabbMin = center - extent;
+ aabbMax = center + extent;
+
+
+ }
+
+
+ virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
+
+ void recalcLocalAabb();
virtual int getNumVertices() const = 0 ;
virtual int getNumEdges() const = 0;