Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp @ 8351

Last change on this file since 8351 was 8351, checked in by rgrieder, 13 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: 3.7 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 "btConvexPointCloudShape.h"
17#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
18
19#include "LinearMath/btQuaternion.h"
20
21void btConvexPointCloudShape::setLocalScaling(const btVector3& scaling)
22{
23        m_localScaling = scaling;
24        recalcLocalAabb();
25}
26
27#ifndef __SPU__
28btVector3       btConvexPointCloudShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
29{
30        btVector3 supVec(btScalar(0.),btScalar(0.),btScalar(0.));
31        btScalar newDot,maxDot = btScalar(-BT_LARGE_FLOAT);
32
33        btVector3 vec = vec0;
34        btScalar lenSqr = vec.length2();
35        if (lenSqr < btScalar(0.0001))
36        {
37                vec.setValue(1,0,0);
38        } else
39        {
40                btScalar rlen = btScalar(1.) / btSqrt(lenSqr );
41                vec *= rlen;
42        }
43
44
45        for (int i=0;i<m_numPoints;i++)
46        {
47                btVector3 vtx = getScaledPoint(i);
48
49                newDot = vec.dot(vtx);
50                if (newDot > maxDot)
51                {
52                        maxDot = newDot;
53                        supVec = vtx;
54                }
55        }
56        return supVec;
57}
58
59void    btConvexPointCloudShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
60{
61        btScalar newDot;
62        //use 'w' component of supportVerticesOut?
63        {
64                for (int i=0;i<numVectors;i++)
65                {
66                        supportVerticesOut[i][3] = btScalar(-BT_LARGE_FLOAT);
67                }
68        }
69        for (int i=0;i<m_numPoints;i++)
70        {
71                btVector3 vtx = getScaledPoint(i);
72
73                for (int j=0;j<numVectors;j++)
74                {
75                        const btVector3& vec = vectors[j];
76                       
77                        newDot = vec.dot(vtx);
78                        if (newDot > supportVerticesOut[j][3])
79                        {
80                                //WARNING: don't swap next lines, the w component would get overwritten!
81                                supportVerticesOut[j] = vtx;
82                                supportVerticesOut[j][3] = newDot;
83                        }
84                }
85        }
86
87
88
89}
90       
91
92
93btVector3       btConvexPointCloudShape::localGetSupportingVertex(const btVector3& vec)const
94{
95        btVector3 supVertex = localGetSupportingVertexWithoutMargin(vec);
96
97        if ( getMargin()!=btScalar(0.) )
98        {
99                btVector3 vecnorm = vec;
100                if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
101                {
102                        vecnorm.setValue(btScalar(-1.),btScalar(-1.),btScalar(-1.));
103                } 
104                vecnorm.normalize();
105                supVertex+= getMargin() * vecnorm;
106        }
107        return supVertex;
108}
109
110
111#endif
112
113
114
115
116
117
118//currently just for debugging (drawing), perhaps future support for algebraic continuous collision detection
119//Please note that you can debug-draw btConvexHullShape with the Raytracer Demo
120int     btConvexPointCloudShape::getNumVertices() const
121{
122        return m_numPoints;
123}
124
125int btConvexPointCloudShape::getNumEdges() const
126{
127        return 0;
128}
129
130void btConvexPointCloudShape::getEdge(int i,btVector3& pa,btVector3& pb) const
131{
132        btAssert (0);
133}
134
135void btConvexPointCloudShape::getVertex(int i,btVector3& vtx) const
136{
137        vtx = m_unscaledPoints[i]*m_localScaling;
138}
139
140int     btConvexPointCloudShape::getNumPlanes() const
141{
142        return 0;
143}
144
145void btConvexPointCloudShape::getPlane(btVector3& ,btVector3& ,int ) const
146{
147
148        btAssert(0);
149}
150
151//not yet
152bool btConvexPointCloudShape::isInside(const btVector3& ,btScalar ) const
153{
154        btAssert(0);
155        return false;
156}
157
Note: See TracBrowser for help on using the repository browser.