Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/mac_osx2/src/external/bullet/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h @ 10499

Last change on this file since 10499 was 8351, checked in by rgrieder, 14 years ago

Merged kicklib2 branch back to trunk (includes former branches ois_update, mac_osx and kicklib).

Notes for updating

Linux:
You don't need an extra package for CEGUILua and Tolua, it's already shipped with CEGUI.
However you do need to make sure that the OgreRenderer is installed too with CEGUI 0.7 (may be a separate package).
Also, Orxonox now recognises if you install the CgProgramManager (a separate package available on newer Ubuntu on Debian systems).

Windows:
Download the new dependency packages versioned 6.0 and use these. If you have problems with that or if you don't like the in game console problem mentioned below, you can download the new 4.3 version of the packages (only available for Visual Studio 2005/2008).

Key new features:

  • *Support for Mac OS X*
  • Visual Studio 2010 support
  • Bullet library update to 2.77
  • OIS library update to 1.3
  • Support for CEGUI 0.7 —> Support for Arch Linux and even SuSE
  • Improved install target
  • Compiles now with GCC 4.6
  • Ogre Cg Shader plugin activated for Linux if available
  • And of course lots of bug fixes

There are also some regressions:

  • No support for CEGUI 0.5, Ogre 1.4 and boost 1.35 - 1.39 any more
  • In game console is not working in main menu for CEGUI 0.7
  • Tolua (just the C lib, not the application) and CEGUILua libraries are no longer in our repository. —> You will need to get these as well when compiling Orxonox
  • And of course lots of new bugs we don't yet know about
  • Property svn:eol-style set to native
File size: 5.0 KB
Line 
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2009 Erwin Coumans  http://bulletphysics.org
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. 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.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16#ifndef BVH_TRIANGLE_MESH_SHAPE_H
17#define BVH_TRIANGLE_MESH_SHAPE_H
18
19#include "btTriangleMeshShape.h"
20#include "btOptimizedBvh.h"
21#include "LinearMath/btAlignedAllocator.h"
22#include "btTriangleInfoMap.h"
23
24///The btBvhTriangleMeshShape is a static-triangle mesh shape with several optimizations, such as bounding volume hierarchy and cache friendly traversal for PlayStation 3 Cell SPU. It is recommended to enable useQuantizedAabbCompression for better memory usage.
25///It takes a triangle mesh as input, for example a btTriangleMesh or btTriangleIndexVertexArray. The btBvhTriangleMeshShape class allows for triangle mesh deformations by a refit or partialRefit method.
26///Instead of building the bounding volume hierarchy acceleration structure, it is also possible to serialize (save) and deserialize (load) the structure from disk.
27///See Demos\ConcaveDemo\ConcavePhysicsDemo.cpp for an example.
28ATTRIBUTE_ALIGNED16(class) btBvhTriangleMeshShape : public btTriangleMeshShape
29{
30
31        btOptimizedBvh* m_bvh;
32        btTriangleInfoMap*      m_triangleInfoMap;
33
34        bool m_useQuantizedAabbCompression;
35        bool m_ownsBvh;
36        bool m_pad[11];////need padding due to alignment
37
38public:
39
40        BT_DECLARE_ALIGNED_ALLOCATOR();
41
42        btBvhTriangleMeshShape() : btTriangleMeshShape(0),m_bvh(0),m_triangleInfoMap(0),m_ownsBvh(false) {m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;};
43        btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh = true);
44
45        ///optionally pass in a larger bvh aabb, used for quantization. This allows for deformations within this aabb
46        btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btVector3& bvhAabbMax, bool buildBvh = true);
47       
48        virtual ~btBvhTriangleMeshShape();
49
50        bool getOwnsBvh () const
51        {
52                return m_ownsBvh;
53        }
54
55
56       
57        void performRaycast (btTriangleCallback* callback, const btVector3& raySource, const btVector3& rayTarget);
58        void performConvexcast (btTriangleCallback* callback, const btVector3& boxSource, const btVector3& boxTarget, const btVector3& boxMin, const btVector3& boxMax);
59
60        virtual void    processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
61
62        void    refitTree(const btVector3& aabbMin,const btVector3& aabbMax);
63
64        ///for a fast incremental refit of parts of the tree. Note: the entire AABB of the tree will become more conservative, it never shrinks
65        void    partialRefitTree(const btVector3& aabbMin,const btVector3& aabbMax);
66
67        //debugging
68        virtual const char*     getName()const {return "BVHTRIANGLEMESH";}
69
70
71        virtual void    setLocalScaling(const btVector3& scaling);
72       
73        btOptimizedBvh* getOptimizedBvh()
74        {
75                return m_bvh;
76        }
77
78        void    setOptimizedBvh(btOptimizedBvh* bvh, const btVector3& localScaling=btVector3(1,1,1));
79
80        void    buildOptimizedBvh();
81
82        bool    usesQuantizedAabbCompression() const
83        {
84                return  m_useQuantizedAabbCompression;
85        }
86
87        void    setTriangleInfoMap(btTriangleInfoMap* triangleInfoMap)
88        {
89                m_triangleInfoMap = triangleInfoMap;
90        }
91
92        const btTriangleInfoMap*        getTriangleInfoMap() const
93        {
94                return m_triangleInfoMap;
95        }
96       
97        btTriangleInfoMap*      getTriangleInfoMap()
98        {
99                return m_triangleInfoMap;
100        }
101
102        virtual int     calculateSerializeBufferSize() const;
103
104        ///fills the dataBuffer and returns the struct name (and 0 on failure)
105        virtual const char*     serialize(void* dataBuffer, btSerializer* serializer) const;
106
107        virtual void    serializeSingleBvh(btSerializer* serializer) const;
108
109        virtual void    serializeSingleTriangleInfoMap(btSerializer* serializer) const;
110
111};
112
113///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
114struct  btTriangleMeshShapeData
115{
116        btCollisionShapeData    m_collisionShapeData;
117
118        btStridingMeshInterfaceData m_meshInterface;
119
120        btQuantizedBvhFloatData         *m_quantizedFloatBvh;
121        btQuantizedBvhDoubleData        *m_quantizedDoubleBvh;
122
123        btTriangleInfoMapData   *m_triangleInfoMap;
124       
125        float   m_collisionMargin;
126
127        char m_pad3[4];
128       
129};
130
131
132SIMD_FORCE_INLINE       int     btBvhTriangleMeshShape::calculateSerializeBufferSize() const
133{
134        return sizeof(btTriangleMeshShapeData);
135}
136
137
138
139#endif //BVH_TRIANGLE_MESH_SHAPE_H
Note: See TracBrowser for help on using the repository browser.