Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexInternalShape.h @ 11367

Last change on this file since 11367 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.4 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 BT_CONVEX_INTERNAL_SHAPE_H
17#define BT_CONVEX_INTERNAL_SHAPE_H
18
19#include "btConvexShape.h"
20#include "LinearMath/btAabbUtil2.h"
21
22
23///The btConvexInternalShape is an internal base class, shared by most convex shape implementations.
24class btConvexInternalShape : public btConvexShape
25{
26
27        protected:
28
29        //local scaling. collisionMargin is not scaled !
30        btVector3       m_localScaling;
31
32        btVector3       m_implicitShapeDimensions;
33       
34        btScalar        m_collisionMargin;
35
36        btScalar        m_padding;
37
38        btConvexInternalShape();
39
40public:
41
42       
43
44        virtual ~btConvexInternalShape()
45        {
46
47        }
48
49        virtual btVector3       localGetSupportingVertex(const btVector3& vec)const;
50
51        const btVector3& getImplicitShapeDimensions() const
52        {
53                return m_implicitShapeDimensions;
54        }
55
56        ///warning: use setImplicitShapeDimensions with care
57        ///changing a collision shape while the body is in the world is not recommended,
58        ///it is best to remove the body from the world, then make the change, and re-add it
59        ///alternatively flush the contact points, see documentation for 'cleanProxyFromPairs'
60        void    setImplicitShapeDimensions(const btVector3& dimensions)
61        {
62                m_implicitShapeDimensions = dimensions;
63        }
64
65        ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
66        void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
67        {
68                getAabbSlow(t,aabbMin,aabbMax);
69        }
70
71
72       
73        virtual void getAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
74
75
76        virtual void    setLocalScaling(const btVector3& scaling);
77        virtual const btVector3& getLocalScaling() const 
78        {
79                return m_localScaling;
80        }
81
82        const btVector3& getLocalScalingNV() const 
83        {
84                return m_localScaling;
85        }
86
87        virtual void    setMargin(btScalar margin)
88        {
89                m_collisionMargin = margin;
90        }
91        virtual btScalar        getMargin() const
92        {
93                return m_collisionMargin;
94        }
95
96        btScalar        getMarginNV() const
97        {
98                return m_collisionMargin;
99        }
100
101        virtual int             getNumPreferredPenetrationDirections() const
102        {
103                return 0;
104        }
105       
106        virtual void    getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const
107        {
108                (void)penetrationVector;
109                (void)index;
110                btAssert(0);
111        }
112
113        virtual int     calculateSerializeBufferSize() const;
114
115        ///fills the dataBuffer and returns the struct name (and 0 on failure)
116        virtual const char*     serialize(void* dataBuffer, btSerializer* serializer) const;
117
118       
119};
120
121///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
122struct  btConvexInternalShapeData
123{
124        btCollisionShapeData    m_collisionShapeData;
125
126        btVector3FloatData      m_localScaling;
127
128        btVector3FloatData      m_implicitShapeDimensions;
129       
130        float                   m_collisionMargin;
131
132        int     m_padding;
133
134};
135
136
137
138SIMD_FORCE_INLINE       int     btConvexInternalShape::calculateSerializeBufferSize() const
139{
140        return sizeof(btConvexInternalShapeData);
141}
142
143///fills the dataBuffer and returns the struct name (and 0 on failure)
144SIMD_FORCE_INLINE       const char*     btConvexInternalShape::serialize(void* dataBuffer, btSerializer* serializer) const
145{
146        btConvexInternalShapeData* shapeData = (btConvexInternalShapeData*) dataBuffer;
147        btCollisionShape::serialize(&shapeData->m_collisionShapeData, serializer);
148
149        m_implicitShapeDimensions.serializeFloat(shapeData->m_implicitShapeDimensions);
150        m_localScaling.serializeFloat(shapeData->m_localScaling);
151        shapeData->m_collisionMargin = float(m_collisionMargin);
152
153        return "btConvexInternalShapeData";
154}
155
156
157
158
159///btConvexInternalAabbCachingShape adds local aabb caching for convex shapes, to avoid expensive bounding box calculations
160class btConvexInternalAabbCachingShape : public btConvexInternalShape
161{
162        btVector3       m_localAabbMin;
163        btVector3       m_localAabbMax;
164        bool            m_isLocalAabbValid;
165       
166protected:
167                                       
168        btConvexInternalAabbCachingShape();
169       
170        void setCachedLocalAabb (const btVector3& aabbMin, const btVector3& aabbMax)
171        {
172                m_isLocalAabbValid = true;
173                m_localAabbMin = aabbMin;
174                m_localAabbMax = aabbMax;
175        }
176
177        inline void getCachedLocalAabb (btVector3& aabbMin, btVector3& aabbMax) const
178        {
179                btAssert(m_isLocalAabbValid);
180                aabbMin = m_localAabbMin;
181                aabbMax = m_localAabbMax;
182        }
183
184        inline void getNonvirtualAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax, btScalar margin) const
185        {
186
187                //lazy evaluation of local aabb
188                btAssert(m_isLocalAabbValid);
189                btTransformAabb(m_localAabbMin,m_localAabbMax,margin,trans,aabbMin,aabbMax);
190        }
191               
192public:
193               
194        virtual void    setLocalScaling(const btVector3& scaling);
195
196        virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
197
198        void    recalcLocalAabb();
199
200};
201
202#endif //BT_CONVEX_INTERNAL_SHAPE_H
Note: See TracBrowser for help on using the repository browser.