diff --git a/src/BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp b/src/BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp index 0aa868781..9a9fa00bd 100644 --- a/src/BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp +++ b/src/BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp @@ -17,30 +17,13 @@ subject to the following restrictions: #include "LinearMath/btQuaternion.h" -btConvexPointCloudShape::btConvexPointCloudShape (btVector3* points,int numPoints) : btPolyhedralConvexShape () -{ - m_shapeType = CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE; - m_points = points; - m_numPoints = numPoints; - - recalcLocalAabb(); -} - -void btConvexPointCloudShape::setPoints (btVector3* points, int numPoints) -{ - m_points = points; - m_numPoints = numPoints; - - recalcLocalAabb(); -} - - void btConvexPointCloudShape::setLocalScaling(const btVector3& scaling) { m_localScaling = scaling; recalcLocalAabb(); } +#ifndef __SPU__ btVector3 btConvexPointCloudShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const { btVector3 supVec(btScalar(0.),btScalar(0.),btScalar(0.)); @@ -124,7 +107,7 @@ btVector3 btConvexPointCloudShape::localGetSupportingVertex(const btVector3& vec } - +#endif diff --git a/src/BulletCollision/CollisionShapes/btConvexPointCloudShape.h b/src/BulletCollision/CollisionShapes/btConvexPointCloudShape.h index 6596bcb31..63dcab190 100644 --- a/src/BulletCollision/CollisionShapes/btConvexPointCloudShape.h +++ b/src/BulletCollision/CollisionShapes/btConvexPointCloudShape.h @@ -28,9 +28,24 @@ ATTRIBUTE_ALIGNED16(class) btConvexPointCloudShape : public btPolyhedralConvexSh public: BT_DECLARE_ALIGNED_ALLOCATOR(); - btConvexPointCloudShape(btVector3* points,int numPoints); + btConvexPointCloudShape(btVector3* points,int numPoints, bool computeAabb = true) + { + m_shapeType = CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE; + m_points = points; + m_numPoints = numPoints; - void setPoints (btVector3* points, int numPoints); + if (computeAabb) + recalcLocalAabb(); + } + + void setPoints (btVector3* points, int numPoints, bool computeAabb = true) + { + m_points = points; + m_numPoints = numPoints; + + if (computeAabb) + recalcLocalAabb(); + } btPoint3* getPoints() { @@ -47,9 +62,11 @@ public: return m_numPoints; } +#ifndef __SPU__ virtual btVector3 localGetSupportingVertex(const btVector3& vec)const; virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const; virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const; +#endif //debugging diff --git a/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp b/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp index 6b574b5b9..9ecd7a9d5 100644 --- a/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp +++ b/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp @@ -15,18 +15,6 @@ subject to the following restrictions: #include "BulletCollision/CollisionShapes/btPolyhedralConvexShape.h" -btPolyhedralConvexShape::btPolyhedralConvexShape() -:btConvexInternalShape(), -m_localAabbMin(1,1,1), -m_localAabbMax(-1,-1,-1), -m_isLocalAabbValid(false), -m_optionalHull(0) -{ - -} - - - btVector3 btPolyhedralConvexShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const { int i; diff --git a/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h b/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h index ea1768d29..3d52c0d33 100644 --- a/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h +++ b/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h @@ -31,18 +31,41 @@ protected: btVector3 m_localAabbMax; bool m_isLocalAabbValid; - btPolyhedralConvexShape(); + btPolyhedralConvexShape() :btConvexInternalShape(), +m_localAabbMin(1,1,1), +m_localAabbMax(-1,-1,-1), +m_isLocalAabbValid(false), +m_optionalHull(0) +{ + +} public: //brute force implementations + virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const; virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const; + virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const; + void setCachedLocalAabb (const btVector3& aabbMin, const btVector3& aabbMax) + { + m_isLocalAabbValid = true; + m_localAabbMin = aabbMin; + m_localAabbMax = aabbMax; + } + + inline void getCachedLocalAabb (btVector3& aabbMin, btVector3& aabbMax) const + { + btAssert(m_isLocalAabbValid); + aabbMin = m_localAabbMin; + aabbMax = m_localAabbMax; + } + inline void getNonvirtualAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax, btScalar margin) const { diff --git a/src/BulletCollision/CollisionShapes/btSphereShape.cpp b/src/BulletCollision/CollisionShapes/btSphereShape.cpp index c684e0a3b..cab7b2772 100644 --- a/src/BulletCollision/CollisionShapes/btSphereShape.cpp +++ b/src/BulletCollision/CollisionShapes/btSphereShape.cpp @@ -18,14 +18,6 @@ subject to the following restrictions: #include "LinearMath/btQuaternion.h" - -btSphereShape ::btSphereShape (btScalar radius) : btConvexInternalShape () -{ - m_shapeType = SPHERE_SHAPE_PROXYTYPE; - m_implicitShapeDimensions.setX(radius); - m_collisionMargin = radius; -} - btVector3 btSphereShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const { (void)vec; diff --git a/src/BulletCollision/CollisionShapes/btSphereShape.h b/src/BulletCollision/CollisionShapes/btSphereShape.h index 57689561c..b5b9015d6 100644 --- a/src/BulletCollision/CollisionShapes/btSphereShape.h +++ b/src/BulletCollision/CollisionShapes/btSphereShape.h @@ -27,8 +27,12 @@ ATTRIBUTE_ALIGNED16(class) btSphereShape : public btConvexInternalShape public: BT_DECLARE_ALIGNED_ALLOCATOR(); - btSphereShape (btScalar radius); - + btSphereShape (btScalar radius) : btConvexInternalShape () + { + m_shapeType = SPHERE_SHAPE_PROXYTYPE; + m_implicitShapeDimensions.setX(radius); + m_collisionMargin = radius; + } virtual btVector3 localGetSupportingVertex(const btVector3& vec)const; virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;