Fixed several bugs: python refcounting related and Bullet related (basic add/remove...
[blender.git] / extern / bullet / Bullet / CollisionShapes / TriangleMeshShape.h
1 /*
2  * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
3  *
4  * Permission to use, copy, modify, distribute and sell this software
5  * and its documentation for any purpose is hereby granted without fee,
6  * provided that the above copyright notice appear in all copies.
7  * Erwin Coumans makes no representations about the suitability 
8  * of this software for any purpose.  
9  * It is provided "as is" without express or implied warranty.
10 */
11 #ifndef TRIANGLE_MESH_SHAPE_H
12 #define TRIANGLE_MESH_SHAPE_H
13
14 #include "CollisionShapes/CollisionShape.h"
15 #include "BroadphaseCollision/BroadphaseProxy.h" // for the types
16
17 #include "StridingMeshInterface.h"
18 #include "TriangleCallback.h"
19
20
21
22 ///Concave triangle mesh. Uses an interface to access the triangles to allow for sharing graphics/physics triangles.
23 class TriangleMeshShape : public CollisionShape
24 {
25 protected:
26         StridingMeshInterface* m_meshInterface;
27         SimdVector3     m_localAabbMin;
28         SimdVector3     m_localAabbMax;
29         float m_collisionMargin;
30
31 public:
32         TriangleMeshShape(StridingMeshInterface* meshInterface);
33
34         virtual ~TriangleMeshShape();
35
36
37         
38         virtual SimdVector3 LocalGetSupportingVertex(const SimdVector3& vec) const;
39
40         virtual SimdVector3     LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const
41         {
42                 assert(0);
43                 return LocalGetSupportingVertex(vec);
44         }
45
46         void    RecalcLocalAabb();
47
48         virtual int     GetShapeType() const
49         {
50                 return TRIANGLE_MESH_SHAPE_PROXYTYPE;
51         }
52
53         virtual void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const;
54
55         virtual void    ProcessAllTriangles(TriangleCallback* callback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const;
56
57         virtual void    CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia);
58
59         virtual void    setLocalScaling(const SimdVector3& scaling);
60         virtual const SimdVector3& getLocalScaling() const;
61         
62
63         //debugging
64         virtual char*   GetName()const {return "TRIANGLEMESH";}
65
66         
67         virtual float GetMargin() const {
68                 return m_collisionMargin;
69         }
70         virtual void SetMargin(float collisionMargin)
71         {
72                 m_collisionMargin = collisionMargin;
73         }
74
75
76
77 };
78
79 #endif //TRIANGLE_MESH_SHAPE_H