~diresu/blender/blender-command-port

« back to all changes in this revision

Viewing changes to extern/bullet2/src/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h

  • Committer: theeth
  • Date: 2008-10-14 16:52:04 UTC
  • Revision ID: vcs-imports@canonical.com-20081014165204-r32w2gm6s0osvdhn
copy back trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef CONVEX_TRIANGLEMESH_SHAPE_H
 
2
#define CONVEX_TRIANGLEMESH_SHAPE_H
 
3
 
 
4
 
 
5
#include "btPolyhedralConvexShape.h"
 
6
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
 
7
 
 
8
 
 
9
/// The btConvexTriangleMeshShape is a convex hull of a triangle mesh, but the performance is not as good as btConvexHullShape.
 
10
/// A small benefit of this class is that it uses the btStridingMeshInterface, so you can avoid the duplication of the triangle mesh data. Nevertheless, most users should use the much better performing btConvexHullShape instead.
 
11
class btConvexTriangleMeshShape : public btPolyhedralConvexShape
 
12
{
 
13
 
 
14
        class btStridingMeshInterface*  m_stridingMesh;
 
15
 
 
16
public:
 
17
        btConvexTriangleMeshShape(btStridingMeshInterface* meshInterface, bool calcAabb = true);
 
18
 
 
19
        class btStridingMeshInterface*  getMeshInterface()
 
20
        {
 
21
                return m_stridingMesh;
 
22
        }
 
23
        const class btStridingMeshInterface* getMeshInterface() const
 
24
        {
 
25
                return m_stridingMesh;
 
26
        }
 
27
        
 
28
        virtual btVector3       localGetSupportingVertex(const btVector3& vec)const;
 
29
        virtual btVector3       localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
 
30
        virtual void    batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
 
31
        
 
32
        virtual int     getShapeType()const { return CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE; }
 
33
 
 
34
        //debugging
 
35
        virtual const char*     getName()const {return "ConvexTrimesh";}
 
36
        
 
37
        virtual int     getNumVertices() const;
 
38
        virtual int getNumEdges() const;
 
39
        virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const;
 
40
        virtual void getVertex(int i,btPoint3& vtx) const;
 
41
        virtual int     getNumPlanes() const;
 
42
        virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const;
 
43
        virtual bool isInside(const btPoint3& pt,btScalar tolerance) const;
 
44
 
 
45
        
 
46
        virtual void    setLocalScaling(const btVector3& scaling);
 
47
        virtual const btVector3& getLocalScaling() const;
 
48
 
 
49
        ///computes the exact moment of inertia and the transform from the coordinate system defined by the principal axes of the moment of inertia
 
50
        ///and the center of mass to the current coordinate system. A mass of 1 is assumed, for other masses just multiply the computed "inertia"
 
51
        ///by the mass. The resulting transform "principal" has to be applied inversely to the mesh in order for the local coordinate system of the
 
52
        ///shape to be centered at the center of mass and to coincide with the principal axes. This also necessitates a correction of the world transform
 
53
        ///of the collision object by the principal transform. This method also computes the volume of the convex mesh.
 
54
        void calculatePrincipalAxisTransform(btTransform& principal, btVector3& inertia, btScalar& volume) const;
 
55
 
 
56
};
 
57
 
 
58
 
 
59
 
 
60
#endif //CONVEX_TRIANGLEMESH_SHAPE_H
 
61
 
 
62
 
 
63