Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/archive/tutorial4/src/external/bullet/BulletCollision/CollisionShapes/btTetrahedronShape.cpp

Last change on this file 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: 4.3 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#include "btTetrahedronShape.h"
17#include "LinearMath/btMatrix3x3.h"
18
19btBU_Simplex1to4::btBU_Simplex1to4() : btPolyhedralConvexAabbCachingShape (),
20m_numVertices(0)
21{
22        m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
23}
24
25btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0) : btPolyhedralConvexAabbCachingShape (),
26m_numVertices(0)
27{
28        m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
29        addVertex(pt0);
30}
31
32btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1) : btPolyhedralConvexAabbCachingShape (),
33m_numVertices(0)
34{
35        m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
36        addVertex(pt0);
37        addVertex(pt1);
38}
39
40btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1,const btVector3& pt2) : btPolyhedralConvexAabbCachingShape (),
41m_numVertices(0)
42{
43        m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
44        addVertex(pt0);
45        addVertex(pt1);
46        addVertex(pt2);
47}
48
49btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1,const btVector3& pt2,const btVector3& pt3) : btPolyhedralConvexAabbCachingShape (),
50m_numVertices(0)
51{
52        m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
53        addVertex(pt0);
54        addVertex(pt1);
55        addVertex(pt2);
56        addVertex(pt3);
57}
58
59
60void btBU_Simplex1to4::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
61{
62#if 1
63        btPolyhedralConvexAabbCachingShape::getAabb(t,aabbMin,aabbMax);
64#else
65        aabbMin.setValue(BT_LARGE_FLOAT,BT_LARGE_FLOAT,BT_LARGE_FLOAT);
66        aabbMax.setValue(-BT_LARGE_FLOAT,-BT_LARGE_FLOAT,-BT_LARGE_FLOAT);
67
68        //just transform the vertices in worldspace, and take their AABB
69        for (int i=0;i<m_numVertices;i++)
70        {
71                btVector3 worldVertex = t(m_vertices[i]);
72                aabbMin.setMin(worldVertex);
73                aabbMax.setMax(worldVertex);
74        }
75#endif
76}
77
78
79
80
81
82void btBU_Simplex1to4::addVertex(const btVector3& pt)
83{
84        m_vertices[m_numVertices++] = pt;
85        recalcLocalAabb();
86}
87
88
89int     btBU_Simplex1to4::getNumVertices() const
90{
91        return m_numVertices;
92}
93
94int btBU_Simplex1to4::getNumEdges() const
95{
96        //euler formula, F-E+V = 2, so E = F+V-2
97
98        switch (m_numVertices)
99        {
100        case 0:
101                return 0;
102        case 1: return 0;
103        case 2: return 1;
104        case 3: return 3;
105        case 4: return 6;
106
107
108        }
109
110        return 0;
111}
112
113void btBU_Simplex1to4::getEdge(int i,btVector3& pa,btVector3& pb) const
114{
115       
116    switch (m_numVertices)
117        {
118
119        case 2: 
120                pa = m_vertices[0];
121                pb = m_vertices[1];
122                break;
123        case 3: 
124                switch (i)
125                {
126                case 0:
127                        pa = m_vertices[0];
128                        pb = m_vertices[1];
129                        break;
130                case 1:
131                        pa = m_vertices[1];
132                        pb = m_vertices[2];
133                        break;
134                case 2:
135                        pa = m_vertices[2];
136                        pb = m_vertices[0];
137                        break;
138
139                }
140                break;
141        case 4: 
142                switch (i)
143                {
144                case 0:
145                        pa = m_vertices[0];
146                        pb = m_vertices[1];
147                        break;
148                case 1:
149                        pa = m_vertices[1];
150                        pb = m_vertices[2];
151                        break;
152                case 2:
153                        pa = m_vertices[2];
154                        pb = m_vertices[0];
155                        break;
156                case 3:
157                        pa = m_vertices[0];
158                        pb = m_vertices[3];
159                        break;
160                case 4:
161                        pa = m_vertices[1];
162                        pb = m_vertices[3];
163                        break;
164                case 5:
165                        pa = m_vertices[2];
166                        pb = m_vertices[3];
167                        break;
168                }
169
170        }
171
172
173
174
175}
176
177void btBU_Simplex1to4::getVertex(int i,btVector3& vtx) const
178{
179        vtx = m_vertices[i];
180}
181
182int     btBU_Simplex1to4::getNumPlanes() const
183{
184        switch (m_numVertices)
185        {
186        case 0:
187                        return 0;
188        case 1:
189                        return 0;
190        case 2:
191                        return 0;
192        case 3:
193                        return 2;
194        case 4:
195                        return 4;
196        default:
197                {
198                }
199        }
200        return 0;
201}
202
203
204void btBU_Simplex1to4::getPlane(btVector3&, btVector3& ,int ) const
205{
206       
207}
208
209int btBU_Simplex1to4::getIndex(int ) const
210{
211        return 0;
212}
213
214bool btBU_Simplex1to4::isInside(const btVector3& ,btScalar ) const
215{
216        return false;
217}
218
Note: See TracBrowser for help on using the repository browser.