[1963] | 1 | /* |
---|
| 2 | Bullet Continuous Collision Detection and Physics Library |
---|
| 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ |
---|
| 4 | |
---|
| 5 | This software is provided 'as-is', without any express or implied warranty. |
---|
| 6 | In no event will the authors be held liable for any damages arising from the use of this software. |
---|
| 7 | Permission is granted to anyone to use this software for any purpose, |
---|
| 8 | including commercial applications, and to alter it and redistribute it freely, |
---|
| 9 | subject to the following restrictions: |
---|
| 10 | |
---|
| 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. |
---|
| 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. |
---|
| 13 | 3. This notice may not be removed or altered from any source distribution. |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | #ifndef BU_SHAPE |
---|
| 17 | #define BU_SHAPE |
---|
| 18 | |
---|
| 19 | #include "LinearMath/btPoint3.h" |
---|
| 20 | #include "LinearMath/btMatrix3x3.h" |
---|
| 21 | #include "LinearMath/btAabbUtil2.h" |
---|
| 22 | #include "btConvexInternalShape.h" |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | ///The btPolyhedralConvexShape is an internal interface class for polyhedral convex shapes. |
---|
| 26 | class btPolyhedralConvexShape : public btConvexInternalShape |
---|
| 27 | { |
---|
| 28 | |
---|
| 29 | protected: |
---|
| 30 | btVector3 m_localAabbMin; |
---|
| 31 | btVector3 m_localAabbMax; |
---|
| 32 | bool m_isLocalAabbValid; |
---|
| 33 | |
---|
[1972] | 34 | btPolyhedralConvexShape(); |
---|
[1963] | 35 | public: |
---|
| 36 | |
---|
[1972] | 37 | |
---|
[1963] | 38 | |
---|
| 39 | //brute force implementations |
---|
| 40 | virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const; |
---|
| 41 | virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const; |
---|
| 42 | |
---|
| 43 | virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const; |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | inline void getNonvirtualAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax, btScalar margin) const |
---|
| 47 | { |
---|
| 48 | |
---|
| 49 | //lazy evaluation of local aabb |
---|
| 50 | btAssert(m_isLocalAabbValid); |
---|
| 51 | btTransformAabb(m_localAabbMin,m_localAabbMax,margin,trans,aabbMin,aabbMax); |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const; |
---|
| 56 | |
---|
| 57 | virtual void setLocalScaling(const btVector3& scaling); |
---|
| 58 | |
---|
| 59 | void recalcLocalAabb(); |
---|
| 60 | |
---|
| 61 | virtual int getNumVertices() const = 0 ; |
---|
| 62 | virtual int getNumEdges() const = 0; |
---|
| 63 | virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const = 0; |
---|
| 64 | virtual void getVertex(int i,btPoint3& vtx) const = 0; |
---|
| 65 | virtual int getNumPlanes() const = 0; |
---|
| 66 | virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const = 0; |
---|
| 67 | // virtual int getIndex(int i) const = 0 ; |
---|
| 68 | |
---|
| 69 | virtual bool isInside(const btPoint3& pt,btScalar tolerance) const = 0; |
---|
| 70 | |
---|
| 71 | /// optional Hull is for optional Separating Axis Test Hull collision detection, see Hull.cpp |
---|
| 72 | class Hull* m_optionalHull; |
---|
| 73 | |
---|
| 74 | }; |
---|
| 75 | |
---|
| 76 | #endif //BU_SHAPE |
---|