~ubuntu-branches/ubuntu/maverick/blender/maverick

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Khashayar Naderehvandi, Khashayar Naderehvandi, Alessio Treglia
  • Date: 2009-01-22 16:53:59 UTC
  • mfrom: (14.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20090122165359-v0996tn7fbit64ni
Tags: 2.48a+dfsg-1ubuntu1
[ Khashayar Naderehvandi ]
* Merge from debian experimental (LP: #320045), Ubuntu remaining changes:
  - Add patch correcting header file locations.
  - Add libvorbis-dev and libgsm1-dev to Build-Depends.
  - Use avcodec_decode_audio2() in source/blender/src/hddaudio.c

[ Alessio Treglia ]
* Add missing previous changelog entries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
 
5
5
#include "btPolyhedralConvexShape.h"
6
 
#include "../BroadphaseCollision/btBroadphaseProxy.h" // for the types
7
 
 
8
 
 
9
 
/// btConvexTriangleMeshShape is a convex hull of a triangle mesh. If you just have a point cloud, you can use btConvexHullShape instead.
10
 
/// It uses the btStridingMeshInterface instead of a point cloud. This can avoid the duplication of the triangle mesh data.
 
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
11
class btConvexTriangleMeshShape : public btPolyhedralConvexShape
12
12
{
13
13
 
14
14
        class btStridingMeshInterface*  m_stridingMesh;
15
15
 
16
16
public:
17
 
        btConvexTriangleMeshShape(btStridingMeshInterface* meshInterface);
 
17
        btConvexTriangleMeshShape(btStridingMeshInterface* meshInterface, bool calcAabb = true);
18
18
 
19
 
        class btStridingMeshInterface*  getStridingMesh()
 
19
        class btStridingMeshInterface*  getMeshInterface()
 
20
        {
 
21
                return m_stridingMesh;
 
22
        }
 
23
        const class btStridingMeshInterface* getMeshInterface() const
20
24
        {
21
25
                return m_stridingMesh;
22
26
        }
28
32
        virtual int     getShapeType()const { return CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE; }
29
33
 
30
34
        //debugging
31
 
        virtual char*   getName()const {return "ConvexTrimesh";}
 
35
        virtual const char*     getName()const {return "ConvexTrimesh";}
32
36
        
33
37
        virtual int     getNumVertices() const;
34
38
        virtual int getNumEdges() const;
42
46
        virtual void    setLocalScaling(const btVector3& scaling);
43
47
        virtual const btVector3& getLocalScaling() const;
44
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
 
45
56
};
46
57
 
47
58
 
49
60
#endif //CONVEX_TRIANGLEMESH_SHAPE_H
50
61
 
51
62
 
 
63