[1963] | 1 | |
---|
| 2 | #ifndef BT_CONVEX_INTERNAL_SHAPE_H |
---|
| 3 | #define BT_CONVEX_INTERNAL_SHAPE_H |
---|
| 4 | |
---|
| 5 | #include "btConvexShape.h" |
---|
| 6 | |
---|
| 7 | ///The btConvexInternalShape is an internal base class, shared by most convex shape implementations. |
---|
| 8 | class btConvexInternalShape : public btConvexShape |
---|
| 9 | { |
---|
| 10 | |
---|
| 11 | protected: |
---|
| 12 | |
---|
| 13 | //local scaling. collisionMargin is not scaled ! |
---|
| 14 | btVector3 m_localScaling; |
---|
| 15 | |
---|
| 16 | btVector3 m_implicitShapeDimensions; |
---|
| 17 | |
---|
| 18 | btScalar m_collisionMargin; |
---|
| 19 | |
---|
| 20 | btScalar m_padding; |
---|
| 21 | |
---|
| 22 | btConvexInternalShape(); |
---|
| 23 | |
---|
| 24 | public: |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | virtual ~btConvexInternalShape() |
---|
| 29 | { |
---|
| 30 | |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | virtual btVector3 localGetSupportingVertex(const btVector3& vec)const; |
---|
| 35 | #ifndef __SPU__ |
---|
| 36 | virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec) const= 0; |
---|
| 37 | |
---|
| 38 | //notice that the vectors should be unit length |
---|
| 39 | virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const= 0; |
---|
| 40 | #endif //#ifndef __SPU__ |
---|
| 41 | |
---|
| 42 | const btVector3& getImplicitShapeDimensions() const |
---|
| 43 | { |
---|
| 44 | return m_implicitShapeDimensions; |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version |
---|
| 48 | void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const |
---|
| 49 | { |
---|
| 50 | getAabbSlow(t,aabbMin,aabbMax); |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | virtual void getAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const; |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | virtual void setLocalScaling(const btVector3& scaling); |
---|
| 59 | virtual const btVector3& getLocalScaling() const |
---|
| 60 | { |
---|
| 61 | return m_localScaling; |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | const btVector3& getLocalScalingNV() const |
---|
| 65 | { |
---|
| 66 | return m_localScaling; |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | virtual void setMargin(btScalar margin) |
---|
| 70 | { |
---|
| 71 | m_collisionMargin = margin; |
---|
| 72 | } |
---|
| 73 | virtual btScalar getMargin() const |
---|
| 74 | { |
---|
| 75 | return m_collisionMargin; |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | btScalar getMarginNV() const |
---|
| 79 | { |
---|
| 80 | return m_collisionMargin; |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | virtual int getNumPreferredPenetrationDirections() const |
---|
| 84 | { |
---|
| 85 | return 0; |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | virtual void getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const |
---|
| 89 | { |
---|
| 90 | (void)penetrationVector; |
---|
| 91 | (void)index; |
---|
| 92 | btAssert(0); |
---|
| 93 | } |
---|
| 94 | |
---|
| 95 | |
---|
| 96 | |
---|
| 97 | }; |
---|
| 98 | |
---|
| 99 | |
---|
| 100 | #endif //BT_CONVEX_INTERNAL_SHAPE_H |
---|