Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'extern/bullet2/BulletCollision/CollisionShapes')
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btBox2dShape.cpp42
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btBox2dShape.h363
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btBoxShape.cpp41
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btBoxShape.h318
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp466
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h139
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btCapsuleShape.cpp171
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btCapsuleShape.h173
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btCollisionMargin.h26
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btCollisionShape.cpp119
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btCollisionShape.h150
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btCompoundShape.cpp323
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btCompoundShape.h206
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btConcaveShape.cpp27
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btConcaveShape.h60
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btConeShape.cpp133
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btConeShape.h100
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btConvex2dShape.cpp92
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btConvex2dShape.h80
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btConvexHullShape.cpp223
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btConvexHullShape.h120
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btConvexInternalShape.cpp151
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btConvexInternalShape.h202
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp157
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btConvexPointCloudShape.h105
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btConvexShape.cpp429
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btConvexShape.h82
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.cpp315
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h75
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btCylinderShape.cpp222
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btCylinderShape.h192
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btEmptyShape.cpp50
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btEmptyShape.h70
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp411
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h161
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btMaterial.h35
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp60
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btMinkowskiSumShape.h60
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btMultiSphereShape.cpp167
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btMultiSphereShape.h99
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.cpp45
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.h121
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btOptimizedBvh.cpp391
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btOptimizedBvh.h65
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp193
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h98
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp121
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h62
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btShapeHull.cpp170
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btShapeHull.h59
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btSphereShape.cpp71
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btSphereShape.h73
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btStaticPlaneShape.cpp107
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btStaticPlaneShape.h103
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp331
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btStridingMeshInterface.h154
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btTetrahedronShape.cpp218
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btTetrahedronShape.h74
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btTriangleBuffer.cpp35
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btTriangleBuffer.h69
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btTriangleCallback.cpp28
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btTriangleCallback.h42
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.cpp95
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h131
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.cpp86
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.h84
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btTriangleInfoMap.h238
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btTriangleMesh.cpp140
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btTriangleMesh.h69
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btTriangleMeshShape.cpp211
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btTriangleMeshShape.h89
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btTriangleShape.h182
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btUniformScalingShape.cpp115
-rw-r--r--extern/bullet2/BulletCollision/CollisionShapes/btUniformScalingShape.h87
74 files changed, 0 insertions, 10572 deletions
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btBox2dShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btBox2dShape.cpp
deleted file mode 100644
index ecce028c2e6..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btBox2dShape.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btBox2dShape.h"
-
-
-//{
-
-
-void btBox2dShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
-{
- btTransformAabb(getHalfExtentsWithoutMargin(),getMargin(),t,aabbMin,aabbMax);
-}
-
-
-void btBox2dShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
-{
- //btScalar margin = btScalar(0.);
- btVector3 halfExtents = getHalfExtentsWithMargin();
-
- btScalar lx=btScalar(2.)*(halfExtents.x());
- btScalar ly=btScalar(2.)*(halfExtents.y());
- btScalar lz=btScalar(2.)*(halfExtents.z());
-
- inertia.setValue(mass/(btScalar(12.0)) * (ly*ly + lz*lz),
- mass/(btScalar(12.0)) * (lx*lx + lz*lz),
- mass/(btScalar(12.0)) * (lx*lx + ly*ly));
-
-}
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btBox2dShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btBox2dShape.h
deleted file mode 100644
index fc032069c03..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btBox2dShape.h
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef OBB_BOX_2D_SHAPE_H
-#define OBB_BOX_2D_SHAPE_H
-
-#include "BulletCollision/CollisionShapes/btPolyhedralConvexShape.h"
-#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
-#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
-#include "LinearMath/btVector3.h"
-#include "LinearMath/btMinMax.h"
-
-///The btBox2dShape is a box primitive around the origin, its sides axis aligned with length specified by half extents, in local shape coordinates. When used as part of a btCollisionObject or btRigidBody it will be an oriented box in world space.
-class btBox2dShape: public btPolyhedralConvexShape
-{
-
- //btVector3 m_boxHalfExtents1; //use m_implicitShapeDimensions instead
-
- btVector3 m_centroid;
- btVector3 m_vertices[4];
- btVector3 m_normals[4];
-
-public:
-
- btVector3 getHalfExtentsWithMargin() const
- {
- btVector3 halfExtents = getHalfExtentsWithoutMargin();
- btVector3 margin(getMargin(),getMargin(),getMargin());
- halfExtents += margin;
- return halfExtents;
- }
-
- const btVector3& getHalfExtentsWithoutMargin() const
- {
- return m_implicitShapeDimensions;//changed in Bullet 2.63: assume the scaling and margin are included
- }
-
-
- virtual btVector3 localGetSupportingVertex(const btVector3& vec) const
- {
- btVector3 halfExtents = getHalfExtentsWithoutMargin();
- btVector3 margin(getMargin(),getMargin(),getMargin());
- halfExtents += margin;
-
- return btVector3(btFsels(vec.x(), halfExtents.x(), -halfExtents.x()),
- btFsels(vec.y(), halfExtents.y(), -halfExtents.y()),
- btFsels(vec.z(), halfExtents.z(), -halfExtents.z()));
- }
-
- SIMD_FORCE_INLINE btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const
- {
- const btVector3& halfExtents = getHalfExtentsWithoutMargin();
-
- return btVector3(btFsels(vec.x(), halfExtents.x(), -halfExtents.x()),
- btFsels(vec.y(), halfExtents.y(), -halfExtents.y()),
- btFsels(vec.z(), halfExtents.z(), -halfExtents.z()));
- }
-
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
- {
- const btVector3& halfExtents = getHalfExtentsWithoutMargin();
-
- for (int i=0;i<numVectors;i++)
- {
- const btVector3& vec = vectors[i];
- supportVerticesOut[i].setValue(btFsels(vec.x(), halfExtents.x(), -halfExtents.x()),
- btFsels(vec.y(), halfExtents.y(), -halfExtents.y()),
- btFsels(vec.z(), halfExtents.z(), -halfExtents.z()));
- }
-
- }
-
-
- btBox2dShape( const btVector3& boxHalfExtents)
- : btPolyhedralConvexShape(),
- m_centroid(0,0,0)
- {
- m_vertices[0].setValue(-boxHalfExtents.getX(),-boxHalfExtents.getY(),0);
- m_vertices[1].setValue(boxHalfExtents.getX(),-boxHalfExtents.getY(),0);
- m_vertices[2].setValue(boxHalfExtents.getX(),boxHalfExtents.getY(),0);
- m_vertices[3].setValue(-boxHalfExtents.getX(),boxHalfExtents.getY(),0);
-
- m_normals[0].setValue(0,-1,0);
- m_normals[1].setValue(1,0,0);
- m_normals[2].setValue(0,1,0);
- m_normals[3].setValue(-1,0,0);
-
- m_shapeType = BOX_2D_SHAPE_PROXYTYPE;
- btVector3 margin(getMargin(),getMargin(),getMargin());
- m_implicitShapeDimensions = (boxHalfExtents * m_localScaling) - margin;
- };
-
- virtual void setMargin(btScalar collisionMargin)
- {
- //correct the m_implicitShapeDimensions for the margin
- btVector3 oldMargin(getMargin(),getMargin(),getMargin());
- btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin;
-
- btConvexInternalShape::setMargin(collisionMargin);
- btVector3 newMargin(getMargin(),getMargin(),getMargin());
- m_implicitShapeDimensions = implicitShapeDimensionsWithMargin - newMargin;
-
- }
- virtual void setLocalScaling(const btVector3& scaling)
- {
- btVector3 oldMargin(getMargin(),getMargin(),getMargin());
- btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin;
- btVector3 unScaledImplicitShapeDimensionsWithMargin = implicitShapeDimensionsWithMargin / m_localScaling;
-
- btConvexInternalShape::setLocalScaling(scaling);
-
- m_implicitShapeDimensions = (unScaledImplicitShapeDimensionsWithMargin * m_localScaling) - oldMargin;
-
- }
-
- virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
-
-
-
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
-
-
-
-
-
- int getVertexCount() const
- {
- return 4;
- }
-
- virtual int getNumVertices()const
- {
- return 4;
- }
-
- const btVector3* getVertices() const
- {
- return &m_vertices[0];
- }
-
- const btVector3* getNormals() const
- {
- return &m_normals[0];
- }
-
-
-
-
-
-
-
- virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const
- {
- //this plane might not be aligned...
- btVector4 plane ;
- getPlaneEquation(plane,i);
- planeNormal = btVector3(plane.getX(),plane.getY(),plane.getZ());
- planeSupport = localGetSupportingVertex(-planeNormal);
- }
-
-
- const btVector3& getCentroid() const
- {
- return m_centroid;
- }
-
- virtual int getNumPlanes() const
- {
- return 6;
- }
-
-
-
- virtual int getNumEdges() const
- {
- return 12;
- }
-
-
- virtual void getVertex(int i,btVector3& vtx) const
- {
- btVector3 halfExtents = getHalfExtentsWithoutMargin();
-
- vtx = btVector3(
- halfExtents.x() * (1-(i&1)) - halfExtents.x() * (i&1),
- halfExtents.y() * (1-((i&2)>>1)) - halfExtents.y() * ((i&2)>>1),
- halfExtents.z() * (1-((i&4)>>2)) - halfExtents.z() * ((i&4)>>2));
- }
-
-
- virtual void getPlaneEquation(btVector4& plane,int i) const
- {
- btVector3 halfExtents = getHalfExtentsWithoutMargin();
-
- switch (i)
- {
- case 0:
- plane.setValue(btScalar(1.),btScalar(0.),btScalar(0.),-halfExtents.x());
- break;
- case 1:
- plane.setValue(btScalar(-1.),btScalar(0.),btScalar(0.),-halfExtents.x());
- break;
- case 2:
- plane.setValue(btScalar(0.),btScalar(1.),btScalar(0.),-halfExtents.y());
- break;
- case 3:
- plane.setValue(btScalar(0.),btScalar(-1.),btScalar(0.),-halfExtents.y());
- break;
- case 4:
- plane.setValue(btScalar(0.),btScalar(0.),btScalar(1.),-halfExtents.z());
- break;
- case 5:
- plane.setValue(btScalar(0.),btScalar(0.),btScalar(-1.),-halfExtents.z());
- break;
- default:
- btAssert(0);
- }
- }
-
-
- virtual void getEdge(int i,btVector3& pa,btVector3& pb) const
- //virtual void getEdge(int i,Edge& edge) const
- {
- int edgeVert0 = 0;
- int edgeVert1 = 0;
-
- switch (i)
- {
- case 0:
- edgeVert0 = 0;
- edgeVert1 = 1;
- break;
- case 1:
- edgeVert0 = 0;
- edgeVert1 = 2;
- break;
- case 2:
- edgeVert0 = 1;
- edgeVert1 = 3;
-
- break;
- case 3:
- edgeVert0 = 2;
- edgeVert1 = 3;
- break;
- case 4:
- edgeVert0 = 0;
- edgeVert1 = 4;
- break;
- case 5:
- edgeVert0 = 1;
- edgeVert1 = 5;
-
- break;
- case 6:
- edgeVert0 = 2;
- edgeVert1 = 6;
- break;
- case 7:
- edgeVert0 = 3;
- edgeVert1 = 7;
- break;
- case 8:
- edgeVert0 = 4;
- edgeVert1 = 5;
- break;
- case 9:
- edgeVert0 = 4;
- edgeVert1 = 6;
- break;
- case 10:
- edgeVert0 = 5;
- edgeVert1 = 7;
- break;
- case 11:
- edgeVert0 = 6;
- edgeVert1 = 7;
- break;
- default:
- btAssert(0);
-
- }
-
- getVertex(edgeVert0,pa );
- getVertex(edgeVert1,pb );
- }
-
-
-
-
-
- virtual bool isInside(const btVector3& pt,btScalar tolerance) const
- {
- btVector3 halfExtents = getHalfExtentsWithoutMargin();
-
- //btScalar minDist = 2*tolerance;
-
- bool result = (pt.x() <= (halfExtents.x()+tolerance)) &&
- (pt.x() >= (-halfExtents.x()-tolerance)) &&
- (pt.y() <= (halfExtents.y()+tolerance)) &&
- (pt.y() >= (-halfExtents.y()-tolerance)) &&
- (pt.z() <= (halfExtents.z()+tolerance)) &&
- (pt.z() >= (-halfExtents.z()-tolerance));
-
- return result;
- }
-
-
- //debugging
- virtual const char* getName()const
- {
- return "Box2d";
- }
-
- virtual int getNumPreferredPenetrationDirections() const
- {
- return 6;
- }
-
- virtual void getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const
- {
- switch (index)
- {
- case 0:
- penetrationVector.setValue(btScalar(1.),btScalar(0.),btScalar(0.));
- break;
- case 1:
- penetrationVector.setValue(btScalar(-1.),btScalar(0.),btScalar(0.));
- break;
- case 2:
- penetrationVector.setValue(btScalar(0.),btScalar(1.),btScalar(0.));
- break;
- case 3:
- penetrationVector.setValue(btScalar(0.),btScalar(-1.),btScalar(0.));
- break;
- case 4:
- penetrationVector.setValue(btScalar(0.),btScalar(0.),btScalar(1.));
- break;
- case 5:
- penetrationVector.setValue(btScalar(0.),btScalar(0.),btScalar(-1.));
- break;
- default:
- btAssert(0);
- }
- }
-
-};
-
-#endif //OBB_BOX_2D_SHAPE_H
-
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btBoxShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btBoxShape.cpp
deleted file mode 100644
index c6644efbef3..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btBoxShape.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-#include "btBoxShape.h"
-
-
-//{
-
-
-void btBoxShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
-{
- btTransformAabb(getHalfExtentsWithoutMargin(),getMargin(),t,aabbMin,aabbMax);
-}
-
-
-void btBoxShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
-{
- //btScalar margin = btScalar(0.);
- btVector3 halfExtents = getHalfExtentsWithMargin();
-
- btScalar lx=btScalar(2.)*(halfExtents.x());
- btScalar ly=btScalar(2.)*(halfExtents.y());
- btScalar lz=btScalar(2.)*(halfExtents.z());
-
- inertia.setValue(mass/(btScalar(12.0)) * (ly*ly + lz*lz),
- mass/(btScalar(12.0)) * (lx*lx + lz*lz),
- mass/(btScalar(12.0)) * (lx*lx + ly*ly));
-
-}
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btBoxShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btBoxShape.h
deleted file mode 100644
index b405efc8e3c..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btBoxShape.h
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef OBB_BOX_MINKOWSKI_H
-#define OBB_BOX_MINKOWSKI_H
-
-#include "btPolyhedralConvexShape.h"
-#include "btCollisionMargin.h"
-#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
-#include "LinearMath/btVector3.h"
-#include "LinearMath/btMinMax.h"
-
-///The btBoxShape is a box primitive around the origin, its sides axis aligned with length specified by half extents, in local shape coordinates. When used as part of a btCollisionObject or btRigidBody it will be an oriented box in world space.
-class btBoxShape: public btPolyhedralConvexShape
-{
-
- //btVector3 m_boxHalfExtents1; //use m_implicitShapeDimensions instead
-
-
-public:
-
- btVector3 getHalfExtentsWithMargin() const
- {
- btVector3 halfExtents = getHalfExtentsWithoutMargin();
- btVector3 margin(getMargin(),getMargin(),getMargin());
- halfExtents += margin;
- return halfExtents;
- }
-
- const btVector3& getHalfExtentsWithoutMargin() const
- {
- return m_implicitShapeDimensions;//scaling is included, margin is not
- }
-
-
- virtual btVector3 localGetSupportingVertex(const btVector3& vec) const
- {
- btVector3 halfExtents = getHalfExtentsWithoutMargin();
- btVector3 margin(getMargin(),getMargin(),getMargin());
- halfExtents += margin;
-
- return btVector3(btFsels(vec.x(), halfExtents.x(), -halfExtents.x()),
- btFsels(vec.y(), halfExtents.y(), -halfExtents.y()),
- btFsels(vec.z(), halfExtents.z(), -halfExtents.z()));
- }
-
- SIMD_FORCE_INLINE btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const
- {
- const btVector3& halfExtents = getHalfExtentsWithoutMargin();
-
- return btVector3(btFsels(vec.x(), halfExtents.x(), -halfExtents.x()),
- btFsels(vec.y(), halfExtents.y(), -halfExtents.y()),
- btFsels(vec.z(), halfExtents.z(), -halfExtents.z()));
- }
-
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
- {
- const btVector3& halfExtents = getHalfExtentsWithoutMargin();
-
- for (int i=0;i<numVectors;i++)
- {
- const btVector3& vec = vectors[i];
- supportVerticesOut[i].setValue(btFsels(vec.x(), halfExtents.x(), -halfExtents.x()),
- btFsels(vec.y(), halfExtents.y(), -halfExtents.y()),
- btFsels(vec.z(), halfExtents.z(), -halfExtents.z()));
- }
-
- }
-
-
- btBoxShape( const btVector3& boxHalfExtents)
- : btPolyhedralConvexShape()
- {
- m_shapeType = BOX_SHAPE_PROXYTYPE;
- btVector3 margin(getMargin(),getMargin(),getMargin());
- m_implicitShapeDimensions = (boxHalfExtents * m_localScaling) - margin;
- };
-
- virtual void setMargin(btScalar collisionMargin)
- {
- //correct the m_implicitShapeDimensions for the margin
- btVector3 oldMargin(getMargin(),getMargin(),getMargin());
- btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin;
-
- btConvexInternalShape::setMargin(collisionMargin);
- btVector3 newMargin(getMargin(),getMargin(),getMargin());
- m_implicitShapeDimensions = implicitShapeDimensionsWithMargin - newMargin;
-
- }
- virtual void setLocalScaling(const btVector3& scaling)
- {
- btVector3 oldMargin(getMargin(),getMargin(),getMargin());
- btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin;
- btVector3 unScaledImplicitShapeDimensionsWithMargin = implicitShapeDimensionsWithMargin / m_localScaling;
-
- btConvexInternalShape::setLocalScaling(scaling);
-
- m_implicitShapeDimensions = (unScaledImplicitShapeDimensionsWithMargin * m_localScaling) - oldMargin;
-
- }
-
- virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
-
-
-
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
-
- virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const
- {
- //this plane might not be aligned...
- btVector4 plane ;
- getPlaneEquation(plane,i);
- planeNormal = btVector3(plane.getX(),plane.getY(),plane.getZ());
- planeSupport = localGetSupportingVertex(-planeNormal);
- }
-
-
- virtual int getNumPlanes() const
- {
- return 6;
- }
-
- virtual int getNumVertices() const
- {
- return 8;
- }
-
- virtual int getNumEdges() const
- {
- return 12;
- }
-
-
- virtual void getVertex(int i,btVector3& vtx) const
- {
- btVector3 halfExtents = getHalfExtentsWithoutMargin();
-
- vtx = btVector3(
- halfExtents.x() * (1-(i&1)) - halfExtents.x() * (i&1),
- halfExtents.y() * (1-((i&2)>>1)) - halfExtents.y() * ((i&2)>>1),
- halfExtents.z() * (1-((i&4)>>2)) - halfExtents.z() * ((i&4)>>2));
- }
-
-
- virtual void getPlaneEquation(btVector4& plane,int i) const
- {
- btVector3 halfExtents = getHalfExtentsWithoutMargin();
-
- switch (i)
- {
- case 0:
- plane.setValue(btScalar(1.),btScalar(0.),btScalar(0.),-halfExtents.x());
- break;
- case 1:
- plane.setValue(btScalar(-1.),btScalar(0.),btScalar(0.),-halfExtents.x());
- break;
- case 2:
- plane.setValue(btScalar(0.),btScalar(1.),btScalar(0.),-halfExtents.y());
- break;
- case 3:
- plane.setValue(btScalar(0.),btScalar(-1.),btScalar(0.),-halfExtents.y());
- break;
- case 4:
- plane.setValue(btScalar(0.),btScalar(0.),btScalar(1.),-halfExtents.z());
- break;
- case 5:
- plane.setValue(btScalar(0.),btScalar(0.),btScalar(-1.),-halfExtents.z());
- break;
- default:
- btAssert(0);
- }
- }
-
-
- virtual void getEdge(int i,btVector3& pa,btVector3& pb) const
- //virtual void getEdge(int i,Edge& edge) const
- {
- int edgeVert0 = 0;
- int edgeVert1 = 0;
-
- switch (i)
- {
- case 0:
- edgeVert0 = 0;
- edgeVert1 = 1;
- break;
- case 1:
- edgeVert0 = 0;
- edgeVert1 = 2;
- break;
- case 2:
- edgeVert0 = 1;
- edgeVert1 = 3;
-
- break;
- case 3:
- edgeVert0 = 2;
- edgeVert1 = 3;
- break;
- case 4:
- edgeVert0 = 0;
- edgeVert1 = 4;
- break;
- case 5:
- edgeVert0 = 1;
- edgeVert1 = 5;
-
- break;
- case 6:
- edgeVert0 = 2;
- edgeVert1 = 6;
- break;
- case 7:
- edgeVert0 = 3;
- edgeVert1 = 7;
- break;
- case 8:
- edgeVert0 = 4;
- edgeVert1 = 5;
- break;
- case 9:
- edgeVert0 = 4;
- edgeVert1 = 6;
- break;
- case 10:
- edgeVert0 = 5;
- edgeVert1 = 7;
- break;
- case 11:
- edgeVert0 = 6;
- edgeVert1 = 7;
- break;
- default:
- btAssert(0);
-
- }
-
- getVertex(edgeVert0,pa );
- getVertex(edgeVert1,pb );
- }
-
-
-
-
-
- virtual bool isInside(const btVector3& pt,btScalar tolerance) const
- {
- btVector3 halfExtents = getHalfExtentsWithoutMargin();
-
- //btScalar minDist = 2*tolerance;
-
- bool result = (pt.x() <= (halfExtents.x()+tolerance)) &&
- (pt.x() >= (-halfExtents.x()-tolerance)) &&
- (pt.y() <= (halfExtents.y()+tolerance)) &&
- (pt.y() >= (-halfExtents.y()-tolerance)) &&
- (pt.z() <= (halfExtents.z()+tolerance)) &&
- (pt.z() >= (-halfExtents.z()-tolerance));
-
- return result;
- }
-
-
- //debugging
- virtual const char* getName()const
- {
- return "Box";
- }
-
- virtual int getNumPreferredPenetrationDirections() const
- {
- return 6;
- }
-
- virtual void getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const
- {
- switch (index)
- {
- case 0:
- penetrationVector.setValue(btScalar(1.),btScalar(0.),btScalar(0.));
- break;
- case 1:
- penetrationVector.setValue(btScalar(-1.),btScalar(0.),btScalar(0.));
- break;
- case 2:
- penetrationVector.setValue(btScalar(0.),btScalar(1.),btScalar(0.));
- break;
- case 3:
- penetrationVector.setValue(btScalar(0.),btScalar(-1.),btScalar(0.));
- break;
- case 4:
- penetrationVector.setValue(btScalar(0.),btScalar(0.),btScalar(1.));
- break;
- case 5:
- penetrationVector.setValue(btScalar(0.),btScalar(0.),btScalar(-1.));
- break;
- default:
- btAssert(0);
- }
- }
-
-};
-
-
-#endif //OBB_BOX_MINKOWSKI_H
-
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp
deleted file mode 100644
index b71ee03d042..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-//#define DISABLE_BVH
-
-#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h"
-#include "BulletCollision/CollisionShapes/btOptimizedBvh.h"
-#include "LinearMath/btSerializer.h"
-
-///Bvh Concave triangle mesh is a static-triangle mesh shape with Bounding Volume Hierarchy optimization.
-///Uses an interface to access the triangles to allow for sharing graphics/physics triangles.
-btBvhTriangleMeshShape::btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh)
-:btTriangleMeshShape(meshInterface),
-m_bvh(0),
-m_triangleInfoMap(0),
-m_useQuantizedAabbCompression(useQuantizedAabbCompression),
-m_ownsBvh(false)
-{
- m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;
- //construct bvh from meshInterface
-#ifndef DISABLE_BVH
-
- if (buildBvh)
- {
- buildOptimizedBvh();
- }
-
-#endif //DISABLE_BVH
-
-}
-
-btBvhTriangleMeshShape::btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btVector3& bvhAabbMax,bool buildBvh)
-:btTriangleMeshShape(meshInterface),
-m_bvh(0),
-m_triangleInfoMap(0),
-m_useQuantizedAabbCompression(useQuantizedAabbCompression),
-m_ownsBvh(false)
-{
- m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;
- //construct bvh from meshInterface
-#ifndef DISABLE_BVH
-
- if (buildBvh)
- {
- void* mem = btAlignedAlloc(sizeof(btOptimizedBvh),16);
- m_bvh = new (mem) btOptimizedBvh();
-
- m_bvh->build(meshInterface,m_useQuantizedAabbCompression,bvhAabbMin,bvhAabbMax);
- m_ownsBvh = true;
- }
-
-#endif //DISABLE_BVH
-
-}
-
-void btBvhTriangleMeshShape::partialRefitTree(const btVector3& aabbMin,const btVector3& aabbMax)
-{
- m_bvh->refitPartial( m_meshInterface,aabbMin,aabbMax );
-
- m_localAabbMin.setMin(aabbMin);
- m_localAabbMax.setMax(aabbMax);
-}
-
-
-void btBvhTriangleMeshShape::refitTree(const btVector3& aabbMin,const btVector3& aabbMax)
-{
- m_bvh->refit( m_meshInterface, aabbMin,aabbMax );
-
- recalcLocalAabb();
-}
-
-btBvhTriangleMeshShape::~btBvhTriangleMeshShape()
-{
- if (m_ownsBvh)
- {
- m_bvh->~btOptimizedBvh();
- btAlignedFree(m_bvh);
- }
-}
-
-void btBvhTriangleMeshShape::performRaycast (btTriangleCallback* callback, const btVector3& raySource, const btVector3& rayTarget)
-{
- struct MyNodeOverlapCallback : public btNodeOverlapCallback
- {
- btStridingMeshInterface* m_meshInterface;
- btTriangleCallback* m_callback;
-
- MyNodeOverlapCallback(btTriangleCallback* callback,btStridingMeshInterface* meshInterface)
- :m_meshInterface(meshInterface),
- m_callback(callback)
- {
- }
-
- virtual void processNode(int nodeSubPart, int nodeTriangleIndex)
- {
- btVector3 m_triangle[3];
- const unsigned char *vertexbase;
- int numverts;
- PHY_ScalarType type;
- int stride;
- const unsigned char *indexbase;
- int indexstride;
- int numfaces;
- PHY_ScalarType indicestype;
-
- m_meshInterface->getLockedReadOnlyVertexIndexBase(
- &vertexbase,
- numverts,
- type,
- stride,
- &indexbase,
- indexstride,
- numfaces,
- indicestype,
- nodeSubPart);
-
- unsigned int* gfxbase = (unsigned int*)(indexbase+nodeTriangleIndex*indexstride);
- btAssert(indicestype==PHY_INTEGER||indicestype==PHY_SHORT);
-
- const btVector3& meshScaling = m_meshInterface->getScaling();
- for (int j=2;j>=0;j--)
- {
- int graphicsindex = indicestype==PHY_SHORT?((unsigned short*)gfxbase)[j]:gfxbase[j];
-
- if (type == PHY_FLOAT)
- {
- float* graphicsbase = (float*)(vertexbase+graphicsindex*stride);
-
- m_triangle[j] = btVector3(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());
- }
- else
- {
- double* graphicsbase = (double*)(vertexbase+graphicsindex*stride);
-
- m_triangle[j] = btVector3(btScalar(graphicsbase[0])*meshScaling.getX(),btScalar(graphicsbase[1])*meshScaling.getY(),btScalar(graphicsbase[2])*meshScaling.getZ());
- }
- }
-
- /* Perform ray vs. triangle collision here */
- m_callback->processTriangle(m_triangle,nodeSubPart,nodeTriangleIndex);
- m_meshInterface->unLockReadOnlyVertexBase(nodeSubPart);
- }
- };
-
- MyNodeOverlapCallback myNodeCallback(callback,m_meshInterface);
-
- m_bvh->reportRayOverlappingNodex(&myNodeCallback,raySource,rayTarget);
-}
-
-void btBvhTriangleMeshShape::performConvexcast (btTriangleCallback* callback, const btVector3& raySource, const btVector3& rayTarget, const btVector3& aabbMin, const btVector3& aabbMax)
-{
- struct MyNodeOverlapCallback : public btNodeOverlapCallback
- {
- btStridingMeshInterface* m_meshInterface;
- btTriangleCallback* m_callback;
-
- MyNodeOverlapCallback(btTriangleCallback* callback,btStridingMeshInterface* meshInterface)
- :m_meshInterface(meshInterface),
- m_callback(callback)
- {
- }
-
- virtual void processNode(int nodeSubPart, int nodeTriangleIndex)
- {
- btVector3 m_triangle[3];
- const unsigned char *vertexbase;
- int numverts;
- PHY_ScalarType type;
- int stride;
- const unsigned char *indexbase;
- int indexstride;
- int numfaces;
- PHY_ScalarType indicestype;
-
- m_meshInterface->getLockedReadOnlyVertexIndexBase(
- &vertexbase,
- numverts,
- type,
- stride,
- &indexbase,
- indexstride,
- numfaces,
- indicestype,
- nodeSubPart);
-
- unsigned int* gfxbase = (unsigned int*)(indexbase+nodeTriangleIndex*indexstride);
- btAssert(indicestype==PHY_INTEGER||indicestype==PHY_SHORT);
-
- const btVector3& meshScaling = m_meshInterface->getScaling();
- for (int j=2;j>=0;j--)
- {
- int graphicsindex = indicestype==PHY_SHORT?((unsigned short*)gfxbase)[j]:gfxbase[j];
-
- if (type == PHY_FLOAT)
- {
- float* graphicsbase = (float*)(vertexbase+graphicsindex*stride);
-
- m_triangle[j] = btVector3(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());
- }
- else
- {
- double* graphicsbase = (double*)(vertexbase+graphicsindex*stride);
-
- m_triangle[j] = btVector3(btScalar(graphicsbase[0])*meshScaling.getX(),btScalar(graphicsbase[1])*meshScaling.getY(),btScalar(graphicsbase[2])*meshScaling.getZ());
- }
- }
-
- /* Perform ray vs. triangle collision here */
- m_callback->processTriangle(m_triangle,nodeSubPart,nodeTriangleIndex);
- m_meshInterface->unLockReadOnlyVertexBase(nodeSubPart);
- }
- };
-
- MyNodeOverlapCallback myNodeCallback(callback,m_meshInterface);
-
- m_bvh->reportBoxCastOverlappingNodex (&myNodeCallback, raySource, rayTarget, aabbMin, aabbMax);
-}
-
-//perform bvh tree traversal and report overlapping triangles to 'callback'
-void btBvhTriangleMeshShape::processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
-{
-
-#ifdef DISABLE_BVH
- //brute force traverse all triangles
- btTriangleMeshShape::processAllTriangles(callback,aabbMin,aabbMax);
-#else
-
- //first get all the nodes
-
-
- struct MyNodeOverlapCallback : public btNodeOverlapCallback
- {
- btStridingMeshInterface* m_meshInterface;
- btTriangleCallback* m_callback;
- btVector3 m_triangle[3];
-
-
- MyNodeOverlapCallback(btTriangleCallback* callback,btStridingMeshInterface* meshInterface)
- :m_meshInterface(meshInterface),
- m_callback(callback)
- {
- }
-
- virtual void processNode(int nodeSubPart, int nodeTriangleIndex)
- {
- const unsigned char *vertexbase;
- int numverts;
- PHY_ScalarType type;
- int stride;
- const unsigned char *indexbase;
- int indexstride;
- int numfaces;
- PHY_ScalarType indicestype;
-
-
- m_meshInterface->getLockedReadOnlyVertexIndexBase(
- &vertexbase,
- numverts,
- type,
- stride,
- &indexbase,
- indexstride,
- numfaces,
- indicestype,
- nodeSubPart);
-
- unsigned int* gfxbase = (unsigned int*)(indexbase+nodeTriangleIndex*indexstride);
- btAssert(indicestype==PHY_INTEGER||indicestype==PHY_SHORT);
-
- const btVector3& meshScaling = m_meshInterface->getScaling();
- for (int j=2;j>=0;j--)
- {
-
- int graphicsindex = indicestype==PHY_SHORT?((unsigned short*)gfxbase)[j]:gfxbase[j];
-
-
-#ifdef DEBUG_TRIANGLE_MESH
- printf("%d ,",graphicsindex);
-#endif //DEBUG_TRIANGLE_MESH
- if (type == PHY_FLOAT)
- {
- float* graphicsbase = (float*)(vertexbase+graphicsindex*stride);
-
- m_triangle[j] = btVector3(
- graphicsbase[0]*meshScaling.getX(),
- graphicsbase[1]*meshScaling.getY(),
- graphicsbase[2]*meshScaling.getZ());
- }
- else
- {
- double* graphicsbase = (double*)(vertexbase+graphicsindex*stride);
-
- m_triangle[j] = btVector3(
- btScalar(graphicsbase[0])*meshScaling.getX(),
- btScalar(graphicsbase[1])*meshScaling.getY(),
- btScalar(graphicsbase[2])*meshScaling.getZ());
- }
-#ifdef DEBUG_TRIANGLE_MESH
- printf("triangle vertices:%f,%f,%f\n",triangle[j].x(),triangle[j].y(),triangle[j].z());
-#endif //DEBUG_TRIANGLE_MESH
- }
-
- m_callback->processTriangle(m_triangle,nodeSubPart,nodeTriangleIndex);
- m_meshInterface->unLockReadOnlyVertexBase(nodeSubPart);
- }
-
- };
-
- MyNodeOverlapCallback myNodeCallback(callback,m_meshInterface);
-
- m_bvh->reportAabbOverlappingNodex(&myNodeCallback,aabbMin,aabbMax);
-
-
-#endif//DISABLE_BVH
-
-
-}
-
-void btBvhTriangleMeshShape::setLocalScaling(const btVector3& scaling)
-{
- if ((getLocalScaling() -scaling).length2() > SIMD_EPSILON)
- {
- btTriangleMeshShape::setLocalScaling(scaling);
- buildOptimizedBvh();
- }
-}
-
-void btBvhTriangleMeshShape::buildOptimizedBvh()
-{
- if (m_ownsBvh)
- {
- m_bvh->~btOptimizedBvh();
- btAlignedFree(m_bvh);
- }
- ///m_localAabbMin/m_localAabbMax is already re-calculated in btTriangleMeshShape. We could just scale aabb, but this needs some more work
- void* mem = btAlignedAlloc(sizeof(btOptimizedBvh),16);
- m_bvh = new(mem) btOptimizedBvh();
- //rebuild the bvh...
- m_bvh->build(m_meshInterface,m_useQuantizedAabbCompression,m_localAabbMin,m_localAabbMax);
- m_ownsBvh = true;
-}
-
-void btBvhTriangleMeshShape::setOptimizedBvh(btOptimizedBvh* bvh, const btVector3& scaling)
-{
- btAssert(!m_bvh);
- btAssert(!m_ownsBvh);
-
- m_bvh = bvh;
- m_ownsBvh = false;
- // update the scaling without rebuilding the bvh
- if ((getLocalScaling() -scaling).length2() > SIMD_EPSILON)
- {
- btTriangleMeshShape::setLocalScaling(scaling);
- }
-}
-
-
-
-///fills the dataBuffer and returns the struct name (and 0 on failure)
-const char* btBvhTriangleMeshShape::serialize(void* dataBuffer, btSerializer* serializer) const
-{
- btTriangleMeshShapeData* trimeshData = (btTriangleMeshShapeData*) dataBuffer;
-
- btCollisionShape::serialize(&trimeshData->m_collisionShapeData,serializer);
-
- m_meshInterface->serialize(&trimeshData->m_meshInterface, serializer);
-
- trimeshData->m_collisionMargin = float(m_collisionMargin);
-
-
-
- if (m_bvh && !(serializer->getSerializationFlags()&BT_SERIALIZE_NO_BVH))
- {
- void* chunk = serializer->findPointer(m_bvh);
- if (chunk)
- {
-#ifdef BT_USE_DOUBLE_PRECISION
- trimeshData->m_quantizedDoubleBvh = (btQuantizedBvhData*)chunk;
- trimeshData->m_quantizedFloatBvh = 0;
-#else
- trimeshData->m_quantizedFloatBvh = (btQuantizedBvhData*)chunk;
- trimeshData->m_quantizedDoubleBvh= 0;
-#endif //BT_USE_DOUBLE_PRECISION
- } else
- {
-
-#ifdef BT_USE_DOUBLE_PRECISION
- trimeshData->m_quantizedDoubleBvh = (btQuantizedBvhData*)serializer->getUniquePointer(m_bvh);
- trimeshData->m_quantizedFloatBvh = 0;
-#else
- trimeshData->m_quantizedFloatBvh = (btQuantizedBvhData*)serializer->getUniquePointer(m_bvh);
- trimeshData->m_quantizedDoubleBvh= 0;
-#endif //BT_USE_DOUBLE_PRECISION
-
- int sz = m_bvh->calculateSerializeBufferSizeNew();
- btChunk* chunk = serializer->allocate(sz,1);
- const char* structType = m_bvh->serialize(chunk->m_oldPtr, serializer);
- serializer->finalizeChunk(chunk,structType,BT_QUANTIZED_BVH_CODE,m_bvh);
- }
- } else
- {
- trimeshData->m_quantizedFloatBvh = 0;
- trimeshData->m_quantizedDoubleBvh = 0;
- }
-
-
-
- if (m_triangleInfoMap && !(serializer->getSerializationFlags()&BT_SERIALIZE_NO_TRIANGLEINFOMAP))
- {
- void* chunk = serializer->findPointer(m_triangleInfoMap);
- if (chunk)
- {
- trimeshData->m_triangleInfoMap = (btTriangleInfoMapData*)chunk;
- } else
- {
- trimeshData->m_triangleInfoMap = (btTriangleInfoMapData*)serializer->getUniquePointer(m_triangleInfoMap);
- int sz = m_triangleInfoMap->calculateSerializeBufferSize();
- btChunk* chunk = serializer->allocate(sz,1);
- const char* structType = m_triangleInfoMap->serialize(chunk->m_oldPtr, serializer);
- serializer->finalizeChunk(chunk,structType,BT_TRIANLGE_INFO_MAP,m_triangleInfoMap);
- }
- } else
- {
- trimeshData->m_triangleInfoMap = 0;
- }
-
- return "btTriangleMeshShapeData";
-}
-
-void btBvhTriangleMeshShape::serializeSingleBvh(btSerializer* serializer) const
-{
- if (m_bvh)
- {
- int len = m_bvh->calculateSerializeBufferSizeNew(); //make sure not to use calculateSerializeBufferSize because it is used for in-place
- btChunk* chunk = serializer->allocate(len,1);
- const char* structType = m_bvh->serialize(chunk->m_oldPtr, serializer);
- serializer->finalizeChunk(chunk,structType,BT_QUANTIZED_BVH_CODE,(void*)m_bvh);
- }
-}
-
-void btBvhTriangleMeshShape::serializeSingleTriangleInfoMap(btSerializer* serializer) const
-{
- if (m_triangleInfoMap)
- {
- int len = m_triangleInfoMap->calculateSerializeBufferSize();
- btChunk* chunk = serializer->allocate(len,1);
- const char* structType = m_triangleInfoMap->serialize(chunk->m_oldPtr, serializer);
- serializer->finalizeChunk(chunk,structType,BT_TRIANLGE_INFO_MAP,(void*)m_triangleInfoMap);
- }
-}
-
-
-
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h
deleted file mode 100644
index e4d4386ae50..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef BVH_TRIANGLE_MESH_SHAPE_H
-#define BVH_TRIANGLE_MESH_SHAPE_H
-
-#include "btTriangleMeshShape.h"
-#include "btOptimizedBvh.h"
-#include "LinearMath/btAlignedAllocator.h"
-#include "btTriangleInfoMap.h"
-
-///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.
-///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.
-///Instead of building the bounding volume hierarchy acceleration structure, it is also possible to serialize (save) and deserialize (load) the structure from disk.
-///See Demos\ConcaveDemo\ConcavePhysicsDemo.cpp for an example.
-ATTRIBUTE_ALIGNED16(class) btBvhTriangleMeshShape : public btTriangleMeshShape
-{
-
- btOptimizedBvh* m_bvh;
- btTriangleInfoMap* m_triangleInfoMap;
-
- bool m_useQuantizedAabbCompression;
- bool m_ownsBvh;
- bool m_pad[11];////need padding due to alignment
-
-public:
-
- BT_DECLARE_ALIGNED_ALLOCATOR();
-
- btBvhTriangleMeshShape() : btTriangleMeshShape(0),m_bvh(0),m_triangleInfoMap(0),m_ownsBvh(false) {m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;};
- btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh = true);
-
- ///optionally pass in a larger bvh aabb, used for quantization. This allows for deformations within this aabb
- btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btVector3& bvhAabbMax, bool buildBvh = true);
-
- virtual ~btBvhTriangleMeshShape();
-
- bool getOwnsBvh () const
- {
- return m_ownsBvh;
- }
-
-
-
- void performRaycast (btTriangleCallback* callback, const btVector3& raySource, const btVector3& rayTarget);
- void performConvexcast (btTriangleCallback* callback, const btVector3& boxSource, const btVector3& boxTarget, const btVector3& boxMin, const btVector3& boxMax);
-
- virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
-
- void refitTree(const btVector3& aabbMin,const btVector3& aabbMax);
-
- ///for a fast incremental refit of parts of the tree. Note: the entire AABB of the tree will become more conservative, it never shrinks
- void partialRefitTree(const btVector3& aabbMin,const btVector3& aabbMax);
-
- //debugging
- virtual const char* getName()const {return "BVHTRIANGLEMESH";}
-
-
- virtual void setLocalScaling(const btVector3& scaling);
-
- btOptimizedBvh* getOptimizedBvh()
- {
- return m_bvh;
- }
-
- void setOptimizedBvh(btOptimizedBvh* bvh, const btVector3& localScaling=btVector3(1,1,1));
-
- void buildOptimizedBvh();
-
- bool usesQuantizedAabbCompression() const
- {
- return m_useQuantizedAabbCompression;
- }
-
- void setTriangleInfoMap(btTriangleInfoMap* triangleInfoMap)
- {
- m_triangleInfoMap = triangleInfoMap;
- }
-
- const btTriangleInfoMap* getTriangleInfoMap() const
- {
- return m_triangleInfoMap;
- }
-
- btTriangleInfoMap* getTriangleInfoMap()
- {
- return m_triangleInfoMap;
- }
-
- virtual int calculateSerializeBufferSize() const;
-
- ///fills the dataBuffer and returns the struct name (and 0 on failure)
- virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
-
- virtual void serializeSingleBvh(btSerializer* serializer) const;
-
- virtual void serializeSingleTriangleInfoMap(btSerializer* serializer) const;
-
-};
-
-///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
-struct btTriangleMeshShapeData
-{
- btCollisionShapeData m_collisionShapeData;
-
- btStridingMeshInterfaceData m_meshInterface;
-
- btQuantizedBvhFloatData *m_quantizedFloatBvh;
- btQuantizedBvhDoubleData *m_quantizedDoubleBvh;
-
- btTriangleInfoMapData *m_triangleInfoMap;
-
- float m_collisionMargin;
-
- char m_pad3[4];
-
-};
-
-
-SIMD_FORCE_INLINE int btBvhTriangleMeshShape::calculateSerializeBufferSize() const
-{
- return sizeof(btTriangleMeshShapeData);
-}
-
-
-
-#endif //BVH_TRIANGLE_MESH_SHAPE_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btCapsuleShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btCapsuleShape.cpp
deleted file mode 100644
index 2faa11d4360..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btCapsuleShape.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-
-#include "btCapsuleShape.h"
-
-#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
-#include "LinearMath/btQuaternion.h"
-
-btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInternalShape ()
-{
- m_shapeType = CAPSULE_SHAPE_PROXYTYPE;
- m_upAxis = 1;
- m_implicitShapeDimensions.setValue(radius,0.5f*height,radius);
-}
-
-
- btVector3 btCapsuleShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
-{
-
- btVector3 supVec(0,0,0);
-
- btScalar maxDot(btScalar(-BT_LARGE_FLOAT));
-
- btVector3 vec = vec0;
- btScalar lenSqr = vec.length2();
- if (lenSqr < btScalar(0.0001))
- {
- vec.setValue(1,0,0);
- } else
- {
- btScalar rlen = btScalar(1.) / btSqrt(lenSqr );
- vec *= rlen;
- }
-
- btVector3 vtx;
- btScalar newDot;
-
- btScalar radius = getRadius();
-
-
- {
- btVector3 pos(0,0,0);
- pos[getUpAxis()] = getHalfHeight();
-
- vtx = pos +vec*m_localScaling*(radius) - vec * getMargin();
- newDot = vec.dot(vtx);
- if (newDot > maxDot)
- {
- maxDot = newDot;
- supVec = vtx;
- }
- }
- {
- btVector3 pos(0,0,0);
- pos[getUpAxis()] = -getHalfHeight();
-
- vtx = pos +vec*m_localScaling*(radius) - vec * getMargin();
- newDot = vec.dot(vtx);
- if (newDot > maxDot)
- {
- maxDot = newDot;
- supVec = vtx;
- }
- }
-
- return supVec;
-
-}
-
- void btCapsuleShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
-{
-
-
- btScalar radius = getRadius();
-
- for (int j=0;j<numVectors;j++)
- {
- btScalar maxDot(btScalar(-BT_LARGE_FLOAT));
- const btVector3& vec = vectors[j];
-
- btVector3 vtx;
- btScalar newDot;
- {
- btVector3 pos(0,0,0);
- pos[getUpAxis()] = getHalfHeight();
- vtx = pos +vec*m_localScaling*(radius) - vec * getMargin();
- newDot = vec.dot(vtx);
- if (newDot > maxDot)
- {
- maxDot = newDot;
- supportVerticesOut[j] = vtx;
- }
- }
- {
- btVector3 pos(0,0,0);
- pos[getUpAxis()] = -getHalfHeight();
- vtx = pos +vec*m_localScaling*(radius) - vec * getMargin();
- newDot = vec.dot(vtx);
- if (newDot > maxDot)
- {
- maxDot = newDot;
- supportVerticesOut[j] = vtx;
- }
- }
-
- }
-}
-
-
-void btCapsuleShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
-{
- //as an approximation, take the inertia of the box that bounds the spheres
-
- btTransform ident;
- ident.setIdentity();
-
-
- btScalar radius = getRadius();
-
- btVector3 halfExtents(radius,radius,radius);
- halfExtents[getUpAxis()]+=getHalfHeight();
-
- btScalar margin = CONVEX_DISTANCE_MARGIN;
-
- btScalar lx=btScalar(2.)*(halfExtents[0]+margin);
- btScalar ly=btScalar(2.)*(halfExtents[1]+margin);
- btScalar lz=btScalar(2.)*(halfExtents[2]+margin);
- const btScalar x2 = lx*lx;
- const btScalar y2 = ly*ly;
- const btScalar z2 = lz*lz;
- const btScalar scaledmass = mass * btScalar(.08333333);
-
- inertia[0] = scaledmass * (y2+z2);
- inertia[1] = scaledmass * (x2+z2);
- inertia[2] = scaledmass * (x2+y2);
-
-}
-
-btCapsuleShapeX::btCapsuleShapeX(btScalar radius,btScalar height)
-{
- m_upAxis = 0;
- m_implicitShapeDimensions.setValue(0.5f*height, radius,radius);
-}
-
-
-
-
-
-
-btCapsuleShapeZ::btCapsuleShapeZ(btScalar radius,btScalar height)
-{
- m_upAxis = 2;
- m_implicitShapeDimensions.setValue(radius,radius,0.5f*height);
-}
-
-
-
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btCapsuleShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btCapsuleShape.h
deleted file mode 100644
index ab763abf808..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btCapsuleShape.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef BT_CAPSULE_SHAPE_H
-#define BT_CAPSULE_SHAPE_H
-
-#include "btConvexInternalShape.h"
-#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
-
-
-///The btCapsuleShape represents a capsule around the Y axis, there is also the btCapsuleShapeX aligned around the X axis and btCapsuleShapeZ around the Z axis.
-///The total height is height+2*radius, so the height is just the height between the center of each 'sphere' of the capsule caps.
-///The btCapsuleShape is a convex hull of two spheres. The btMultiSphereShape is a more general collision shape that takes the convex hull of multiple sphere, so it can also represent a capsule when just using two spheres.
-class btCapsuleShape : public btConvexInternalShape
-{
-protected:
- int m_upAxis;
-
-protected:
- ///only used for btCapsuleShapeZ and btCapsuleShapeX subclasses.
- btCapsuleShape() : btConvexInternalShape() {m_shapeType = CAPSULE_SHAPE_PROXYTYPE;};
-
-public:
- btCapsuleShape(btScalar radius,btScalar height);
-
- ///CollisionShape Interface
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
-
- /// btConvexShape Interface
- virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
-
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
-
- virtual void setMargin(btScalar collisionMargin)
- {
- //correct the m_implicitShapeDimensions for the margin
- btVector3 oldMargin(getMargin(),getMargin(),getMargin());
- btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin;
-
- btConvexInternalShape::setMargin(collisionMargin);
- btVector3 newMargin(getMargin(),getMargin(),getMargin());
- m_implicitShapeDimensions = implicitShapeDimensionsWithMargin - newMargin;
-
- }
-
- virtual void getAabb (const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const
- {
- btVector3 halfExtents(getRadius(),getRadius(),getRadius());
- halfExtents[m_upAxis] = getRadius() + getHalfHeight();
- halfExtents += btVector3(getMargin(),getMargin(),getMargin());
- btMatrix3x3 abs_b = t.getBasis().absolute();
- btVector3 center = t.getOrigin();
- btVector3 extent = btVector3(abs_b[0].dot(halfExtents),abs_b[1].dot(halfExtents),abs_b[2].dot(halfExtents));
-
- aabbMin = center - extent;
- aabbMax = center + extent;
- }
-
- virtual const char* getName()const
- {
- return "CapsuleShape";
- }
-
- int getUpAxis() const
- {
- return m_upAxis;
- }
-
- btScalar getRadius() const
- {
- int radiusAxis = (m_upAxis+2)%3;
- return m_implicitShapeDimensions[radiusAxis];
- }
-
- btScalar getHalfHeight() const
- {
- return m_implicitShapeDimensions[m_upAxis];
- }
-
- virtual void setLocalScaling(const btVector3& scaling)
- {
- btVector3 oldMargin(getMargin(),getMargin(),getMargin());
- btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin;
- btVector3 unScaledImplicitShapeDimensionsWithMargin = implicitShapeDimensionsWithMargin / m_localScaling;
-
- btConvexInternalShape::setLocalScaling(scaling);
-
- m_implicitShapeDimensions = (unScaledImplicitShapeDimensionsWithMargin * m_localScaling) - oldMargin;
-
- }
-
- virtual int calculateSerializeBufferSize() const;
-
- ///fills the dataBuffer and returns the struct name (and 0 on failure)
- virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
-
-
-};
-
-///btCapsuleShapeX represents a capsule around the Z axis
-///the total height is height+2*radius, so the height is just the height between the center of each 'sphere' of the capsule caps.
-class btCapsuleShapeX : public btCapsuleShape
-{
-public:
-
- btCapsuleShapeX(btScalar radius,btScalar height);
-
- //debugging
- virtual const char* getName()const
- {
- return "CapsuleX";
- }
-
-
-
-};
-
-///btCapsuleShapeZ represents a capsule around the Z axis
-///the total height is height+2*radius, so the height is just the height between the center of each 'sphere' of the capsule caps.
-class btCapsuleShapeZ : public btCapsuleShape
-{
-public:
- btCapsuleShapeZ(btScalar radius,btScalar height);
-
- //debugging
- virtual const char* getName()const
- {
- return "CapsuleZ";
- }
-
-
-};
-
-///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
-struct btCapsuleShapeData
-{
- btConvexInternalShapeData m_convexInternalShapeData;
-
- int m_upAxis;
-
- char m_padding[4];
-};
-
-SIMD_FORCE_INLINE int btCapsuleShape::calculateSerializeBufferSize() const
-{
- return sizeof(btCapsuleShapeData);
-}
-
- ///fills the dataBuffer and returns the struct name (and 0 on failure)
-SIMD_FORCE_INLINE const char* btCapsuleShape::serialize(void* dataBuffer, btSerializer* serializer) const
-{
- btCapsuleShapeData* shapeData = (btCapsuleShapeData*) dataBuffer;
-
- btConvexInternalShape::serialize(&shapeData->m_convexInternalShapeData,serializer);
-
- shapeData->m_upAxis = m_upAxis;
-
- return "btCapsuleShapeData";
-}
-
-#endif //BT_CAPSULE_SHAPE_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btCollisionMargin.h b/extern/bullet2/BulletCollision/CollisionShapes/btCollisionMargin.h
deleted file mode 100644
index 18fd026041f..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btCollisionMargin.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef COLLISION_MARGIN_H
-#define COLLISION_MARGIN_H
-
-//used by Gjk and some other algorithms
-
-#define CONVEX_DISTANCE_MARGIN btScalar(0.04)// btScalar(0.1)//;//btScalar(0.01)
-
-
-
-#endif //COLLISION_MARGIN_H
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btCollisionShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btCollisionShape.cpp
deleted file mode 100644
index 39ee21cad73..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btCollisionShape.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-#include "BulletCollision/CollisionShapes/btCollisionShape.h"
-#include "LinearMath/btSerializer.h"
-
-/*
- Make sure this dummy function never changes so that it
- can be used by probes that are checking whether the
- library is actually installed.
-*/
-extern "C"
-{
-void btBulletCollisionProbe ();
-
-void btBulletCollisionProbe () {}
-}
-
-
-
-void btCollisionShape::getBoundingSphere(btVector3& center,btScalar& radius) const
-{
- btTransform tr;
- tr.setIdentity();
- btVector3 aabbMin,aabbMax;
-
- getAabb(tr,aabbMin,aabbMax);
-
- radius = (aabbMax-aabbMin).length()*btScalar(0.5);
- center = (aabbMin+aabbMax)*btScalar(0.5);
-}
-
-
-btScalar btCollisionShape::getContactBreakingThreshold(btScalar defaultContactThreshold) const
-{
- return getAngularMotionDisc() * defaultContactThreshold;
-}
-
-btScalar btCollisionShape::getAngularMotionDisc() const
-{
- ///@todo cache this value, to improve performance
- btVector3 center;
- btScalar disc;
- getBoundingSphere(center,disc);
- disc += (center).length();
- return disc;
-}
-
-void btCollisionShape::calculateTemporalAabb(const btTransform& curTrans,const btVector3& linvel,const btVector3& angvel,btScalar timeStep, btVector3& temporalAabbMin,btVector3& temporalAabbMax) const
-{
- //start with static aabb
- getAabb(curTrans,temporalAabbMin,temporalAabbMax);
-
- btScalar temporalAabbMaxx = temporalAabbMax.getX();
- btScalar temporalAabbMaxy = temporalAabbMax.getY();
- btScalar temporalAabbMaxz = temporalAabbMax.getZ();
- btScalar temporalAabbMinx = temporalAabbMin.getX();
- btScalar temporalAabbMiny = temporalAabbMin.getY();
- btScalar temporalAabbMinz = temporalAabbMin.getZ();
-
- // add linear motion
- btVector3 linMotion = linvel*timeStep;
- ///@todo: simd would have a vector max/min operation, instead of per-element access
- if (linMotion.x() > btScalar(0.))
- temporalAabbMaxx += linMotion.x();
- else
- temporalAabbMinx += linMotion.x();
- if (linMotion.y() > btScalar(0.))
- temporalAabbMaxy += linMotion.y();
- else
- temporalAabbMiny += linMotion.y();
- if (linMotion.z() > btScalar(0.))
- temporalAabbMaxz += linMotion.z();
- else
- temporalAabbMinz += linMotion.z();
-
- //add conservative angular motion
- btScalar angularMotion = angvel.length() * getAngularMotionDisc() * timeStep;
- btVector3 angularMotion3d(angularMotion,angularMotion,angularMotion);
- temporalAabbMin = btVector3(temporalAabbMinx,temporalAabbMiny,temporalAabbMinz);
- temporalAabbMax = btVector3(temporalAabbMaxx,temporalAabbMaxy,temporalAabbMaxz);
-
- temporalAabbMin -= angularMotion3d;
- temporalAabbMax += angularMotion3d;
-}
-
-///fills the dataBuffer and returns the struct name (and 0 on failure)
-const char* btCollisionShape::serialize(void* dataBuffer, btSerializer* serializer) const
-{
- btCollisionShapeData* shapeData = (btCollisionShapeData*) dataBuffer;
- char* name = (char*) serializer->findNameForPointer(this);
- shapeData->m_name = (char*)serializer->getUniquePointer(name);
- if (shapeData->m_name)
- {
- serializer->serializeName(name);
- }
- shapeData->m_shapeType = m_shapeType;
- //shapeData->m_padding//??
- return "btCollisionShapeData";
-}
-
-void btCollisionShape::serializeSingleShape(btSerializer* serializer) const
-{
- int len = calculateSerializeBufferSize();
- btChunk* chunk = serializer->allocate(len,1);
- const char* structType = serialize(chunk->m_oldPtr, serializer);
- serializer->finalizeChunk(chunk,structType,BT_SHAPE_CODE,(void*)this);
-} \ No newline at end of file
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btCollisionShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btCollisionShape.h
deleted file mode 100644
index f32bd736a99..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btCollisionShape.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef COLLISION_SHAPE_H
-#define COLLISION_SHAPE_H
-
-#include "LinearMath/btTransform.h"
-#include "LinearMath/btVector3.h"
-#include "LinearMath/btMatrix3x3.h"
-#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" //for the shape types
-class btSerializer;
-
-
-///The btCollisionShape class provides an interface for collision shapes that can be shared among btCollisionObjects.
-class btCollisionShape
-{
-protected:
- int m_shapeType;
- void* m_userPointer;
-
-public:
-
- btCollisionShape() : m_shapeType (INVALID_SHAPE_PROXYTYPE), m_userPointer(0)
- {
- }
-
- virtual ~btCollisionShape()
- {
- }
-
- ///getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t.
- virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const =0;
-
- virtual void getBoundingSphere(btVector3& center,btScalar& radius) const;
-
- ///getAngularMotionDisc returns the maximus radius needed for Conservative Advancement to handle time-of-impact with rotations.
- virtual btScalar getAngularMotionDisc() const;
-
- virtual btScalar getContactBreakingThreshold(btScalar defaultContactThresholdFactor) const;
-
-
- ///calculateTemporalAabb calculates the enclosing aabb for the moving object over interval [0..timeStep)
- ///result is conservative
- void calculateTemporalAabb(const btTransform& curTrans,const btVector3& linvel,const btVector3& angvel,btScalar timeStep, btVector3& temporalAabbMin,btVector3& temporalAabbMax) const;
-
-
-
- SIMD_FORCE_INLINE bool isPolyhedral() const
- {
- return btBroadphaseProxy::isPolyhedral(getShapeType());
- }
-
- SIMD_FORCE_INLINE bool isConvex2d() const
- {
- return btBroadphaseProxy::isConvex2d(getShapeType());
- }
-
- SIMD_FORCE_INLINE bool isConvex() const
- {
- return btBroadphaseProxy::isConvex(getShapeType());
- }
- SIMD_FORCE_INLINE bool isNonMoving() const
- {
- return btBroadphaseProxy::isNonMoving(getShapeType());
- }
- SIMD_FORCE_INLINE bool isConcave() const
- {
- return btBroadphaseProxy::isConcave(getShapeType());
- }
- SIMD_FORCE_INLINE bool isCompound() const
- {
- return btBroadphaseProxy::isCompound(getShapeType());
- }
-
- SIMD_FORCE_INLINE bool isSoftBody() const
- {
- return btBroadphaseProxy::isSoftBody(getShapeType());
- }
-
- ///isInfinite is used to catch simulation error (aabb check)
- SIMD_FORCE_INLINE bool isInfinite() const
- {
- return btBroadphaseProxy::isInfinite(getShapeType());
- }
-
-#ifndef __SPU__
- virtual void setLocalScaling(const btVector3& scaling) =0;
- virtual const btVector3& getLocalScaling() const =0;
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const = 0;
-
-
-//debugging support
- virtual const char* getName()const =0 ;
-#endif //__SPU__
-
-
- int getShapeType() const { return m_shapeType; }
- virtual void setMargin(btScalar margin) = 0;
- virtual btScalar getMargin() const = 0;
-
-
- ///optional user data pointer
- void setUserPointer(void* userPtr)
- {
- m_userPointer = userPtr;
- }
-
- void* getUserPointer() const
- {
- return m_userPointer;
- }
-
- virtual int calculateSerializeBufferSize() const;
-
- ///fills the dataBuffer and returns the struct name (and 0 on failure)
- virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
-
- virtual void serializeSingleShape(btSerializer* serializer) const;
-
-};
-
-///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
-struct btCollisionShapeData
-{
- char *m_name;
- int m_shapeType;
- char m_padding[4];
-};
-
-SIMD_FORCE_INLINE int btCollisionShape::calculateSerializeBufferSize() const
-{
- return sizeof(btCollisionShapeData);
-}
-
-
-
-#endif //COLLISION_SHAPE_H
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btCompoundShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btCompoundShape.cpp
deleted file mode 100644
index 36906a75f34..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btCompoundShape.cpp
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btCompoundShape.h"
-#include "btCollisionShape.h"
-#include "BulletCollision/BroadphaseCollision/btDbvt.h"
-#include "LinearMath/btSerializer.h"
-
-btCompoundShape::btCompoundShape(bool enableDynamicAabbTree)
-: m_localAabbMin(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT)),
-m_localAabbMax(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT)),
-m_dynamicAabbTree(0),
-m_updateRevision(1),
-m_collisionMargin(btScalar(0.)),
-m_localScaling(btScalar(1.),btScalar(1.),btScalar(1.))
-{
- m_shapeType = COMPOUND_SHAPE_PROXYTYPE;
-
- if (enableDynamicAabbTree)
- {
- void* mem = btAlignedAlloc(sizeof(btDbvt),16);
- m_dynamicAabbTree = new(mem) btDbvt();
- btAssert(mem==m_dynamicAabbTree);
- }
-}
-
-
-btCompoundShape::~btCompoundShape()
-{
- if (m_dynamicAabbTree)
- {
- m_dynamicAabbTree->~btDbvt();
- btAlignedFree(m_dynamicAabbTree);
- }
-}
-
-void btCompoundShape::addChildShape(const btTransform& localTransform,btCollisionShape* shape)
-{
- m_updateRevision++;
- //m_childTransforms.push_back(localTransform);
- //m_childShapes.push_back(shape);
- btCompoundShapeChild child;
- child.m_transform = localTransform;
- child.m_childShape = shape;
- child.m_childShapeType = shape->getShapeType();
- child.m_childMargin = shape->getMargin();
-
-
- //extend the local aabbMin/aabbMax
- btVector3 localAabbMin,localAabbMax;
- shape->getAabb(localTransform,localAabbMin,localAabbMax);
- for (int i=0;i<3;i++)
- {
- if (m_localAabbMin[i] > localAabbMin[i])
- {
- m_localAabbMin[i] = localAabbMin[i];
- }
- if (m_localAabbMax[i] < localAabbMax[i])
- {
- m_localAabbMax[i] = localAabbMax[i];
- }
-
- }
- if (m_dynamicAabbTree)
- {
- const btDbvtVolume bounds=btDbvtVolume::FromMM(localAabbMin,localAabbMax);
- int index = m_children.size();
- child.m_node = m_dynamicAabbTree->insert(bounds,(void*)index);
- }
-
- m_children.push_back(child);
-
-}
-
-void btCompoundShape::updateChildTransform(int childIndex, const btTransform& newChildTransform)
-{
- m_children[childIndex].m_transform = newChildTransform;
-
- if (m_dynamicAabbTree)
- {
- ///update the dynamic aabb tree
- btVector3 localAabbMin,localAabbMax;
- m_children[childIndex].m_childShape->getAabb(newChildTransform,localAabbMin,localAabbMax);
- ATTRIBUTE_ALIGNED16(btDbvtVolume) bounds=btDbvtVolume::FromMM(localAabbMin,localAabbMax);
- //int index = m_children.size()-1;
- m_dynamicAabbTree->update(m_children[childIndex].m_node,bounds);
- }
-
- recalculateLocalAabb();
-}
-
-void btCompoundShape::removeChildShapeByIndex(int childShapeIndex)
-{
- m_updateRevision++;
- btAssert(childShapeIndex >=0 && childShapeIndex < m_children.size());
- if (m_dynamicAabbTree)
- {
- m_dynamicAabbTree->remove(m_children[childShapeIndex].m_node);
- }
- m_children.swap(childShapeIndex,m_children.size()-1);
- m_children.pop_back();
-
-}
-
-
-
-void btCompoundShape::removeChildShape(btCollisionShape* shape)
-{
- m_updateRevision++;
- // Find the children containing the shape specified, and remove those children.
- //note: there might be multiple children using the same shape!
- for(int i = m_children.size()-1; i >= 0 ; i--)
- {
- if(m_children[i].m_childShape == shape)
- {
- removeChildShapeByIndex(i);
- }
- }
-
-
-
- recalculateLocalAabb();
-}
-
-void btCompoundShape::recalculateLocalAabb()
-{
- // Recalculate the local aabb
- // Brute force, it iterates over all the shapes left.
-
- m_localAabbMin = btVector3(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT));
- m_localAabbMax = btVector3(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT));
-
- //extend the local aabbMin/aabbMax
- for (int j = 0; j < m_children.size(); j++)
- {
- btVector3 localAabbMin,localAabbMax;
- m_children[j].m_childShape->getAabb(m_children[j].m_transform, localAabbMin, localAabbMax);
- for (int i=0;i<3;i++)
- {
- if (m_localAabbMin[i] > localAabbMin[i])
- m_localAabbMin[i] = localAabbMin[i];
- if (m_localAabbMax[i] < localAabbMax[i])
- m_localAabbMax[i] = localAabbMax[i];
- }
- }
-}
-
-///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
-void btCompoundShape::getAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const
-{
- btVector3 localHalfExtents = btScalar(0.5)*(m_localAabbMax-m_localAabbMin);
- btVector3 localCenter = btScalar(0.5)*(m_localAabbMax+m_localAabbMin);
-
- //avoid an illegal AABB when there are no children
- if (!m_children.size())
- {
- localHalfExtents.setValue(0,0,0);
- localCenter.setValue(0,0,0);
- }
- localHalfExtents += btVector3(getMargin(),getMargin(),getMargin());
-
-
- btMatrix3x3 abs_b = trans.getBasis().absolute();
-
- btVector3 center = trans(localCenter);
-
- btVector3 extent = btVector3(abs_b[0].dot(localHalfExtents),
- abs_b[1].dot(localHalfExtents),
- abs_b[2].dot(localHalfExtents));
- aabbMin = center-extent;
- aabbMax = center+extent;
-
-}
-
-void btCompoundShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
-{
- //approximation: take the inertia from the aabb for now
- btTransform ident;
- ident.setIdentity();
- btVector3 aabbMin,aabbMax;
- getAabb(ident,aabbMin,aabbMax);
-
- btVector3 halfExtents = (aabbMax-aabbMin)*btScalar(0.5);
-
- btScalar lx=btScalar(2.)*(halfExtents.x());
- btScalar ly=btScalar(2.)*(halfExtents.y());
- btScalar lz=btScalar(2.)*(halfExtents.z());
-
- inertia[0] = mass/(btScalar(12.0)) * (ly*ly + lz*lz);
- inertia[1] = mass/(btScalar(12.0)) * (lx*lx + lz*lz);
- inertia[2] = mass/(btScalar(12.0)) * (lx*lx + ly*ly);
-
-}
-
-
-
-
-void btCompoundShape::calculatePrincipalAxisTransform(btScalar* masses, btTransform& principal, btVector3& inertia) const
-{
- int n = m_children.size();
-
- btScalar totalMass = 0;
- btVector3 center(0, 0, 0);
- int k;
-
- for (k = 0; k < n; k++)
- {
- center += m_children[k].m_transform.getOrigin() * masses[k];
- totalMass += masses[k];
- }
- center /= totalMass;
- principal.setOrigin(center);
-
- btMatrix3x3 tensor(0, 0, 0, 0, 0, 0, 0, 0, 0);
- for ( k = 0; k < n; k++)
- {
- btVector3 i;
- m_children[k].m_childShape->calculateLocalInertia(masses[k], i);
-
- const btTransform& t = m_children[k].m_transform;
- btVector3 o = t.getOrigin() - center;
-
- //compute inertia tensor in coordinate system of compound shape
- btMatrix3x3 j = t.getBasis().transpose();
- j[0] *= i[0];
- j[1] *= i[1];
- j[2] *= i[2];
- j = t.getBasis() * j;
-
- //add inertia tensor
- tensor[0] += j[0];
- tensor[1] += j[1];
- tensor[2] += j[2];
-
- //compute inertia tensor of pointmass at o
- btScalar o2 = o.length2();
- j[0].setValue(o2, 0, 0);
- j[1].setValue(0, o2, 0);
- j[2].setValue(0, 0, o2);
- j[0] += o * -o.x();
- j[1] += o * -o.y();
- j[2] += o * -o.z();
-
- //add inertia tensor of pointmass
- tensor[0] += masses[k] * j[0];
- tensor[1] += masses[k] * j[1];
- tensor[2] += masses[k] * j[2];
- }
-
- tensor.diagonalize(principal.getBasis(), btScalar(0.00001), 20);
- inertia.setValue(tensor[0][0], tensor[1][1], tensor[2][2]);
-}
-
-
-
-void btCompoundShape::setLocalScaling(const btVector3& scaling)
-{
-
- for(int i = 0; i < m_children.size(); i++)
- {
- btTransform childTrans = getChildTransform(i);
- btVector3 childScale = m_children[i].m_childShape->getLocalScaling();
-// childScale = childScale * (childTrans.getBasis() * scaling);
- childScale = childScale * scaling / m_localScaling;
- m_children[i].m_childShape->setLocalScaling(childScale);
- childTrans.setOrigin((childTrans.getOrigin())*scaling);
- updateChildTransform(i, childTrans);
- recalculateLocalAabb();
- }
- m_localScaling = scaling;
-}
-
-
-
-
-///fills the dataBuffer and returns the struct name (and 0 on failure)
-const char* btCompoundShape::serialize(void* dataBuffer, btSerializer* serializer) const
-{
-
- btCompoundShapeData* shapeData = (btCompoundShapeData*) dataBuffer;
- btCollisionShape::serialize(&shapeData->m_collisionShapeData, serializer);
-
- shapeData->m_collisionMargin = float(m_collisionMargin);
- shapeData->m_numChildShapes = m_children.size();
- shapeData->m_childShapePtr = 0;
- if (shapeData->m_numChildShapes)
- {
- btChunk* chunk = serializer->allocate(sizeof(btCompoundShapeChildData),shapeData->m_numChildShapes);
- btCompoundShapeChildData* memPtr = (btCompoundShapeChildData*)chunk->m_oldPtr;
- shapeData->m_childShapePtr = (btCompoundShapeChildData*)serializer->getUniquePointer(memPtr);
-
- for (int i=0;i<shapeData->m_numChildShapes;i++,memPtr++)
- {
- memPtr->m_childMargin = float(m_children[i].m_childMargin);
- memPtr->m_childShape = (btCollisionShapeData*)serializer->getUniquePointer(m_children[i].m_childShape);
- //don't serialize shapes that already have been serialized
- if (!serializer->findPointer(m_children[i].m_childShape))
- {
- btChunk* chunk = serializer->allocate(m_children[i].m_childShape->calculateSerializeBufferSize(),1);
- const char* structType = m_children[i].m_childShape->serialize(chunk->m_oldPtr,serializer);
- serializer->finalizeChunk(chunk,structType,BT_SHAPE_CODE,m_children[i].m_childShape);
- }
-
- memPtr->m_childShapeType = m_children[i].m_childShapeType;
- m_children[i].m_transform.serializeFloat(memPtr->m_transform);
- }
- serializer->finalizeChunk(chunk,"btCompoundShapeChildData",BT_ARRAY_CODE,chunk->m_oldPtr);
- }
- return "btCompoundShapeData";
-}
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btCompoundShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btCompoundShape.h
deleted file mode 100644
index 179bb00918c..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btCompoundShape.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef COMPOUND_SHAPE_H
-#define COMPOUND_SHAPE_H
-
-#include "btCollisionShape.h"
-
-#include "LinearMath/btVector3.h"
-#include "LinearMath/btTransform.h"
-#include "LinearMath/btMatrix3x3.h"
-#include "btCollisionMargin.h"
-#include "LinearMath/btAlignedObjectArray.h"
-
-//class btOptimizedBvh;
-struct btDbvt;
-
-ATTRIBUTE_ALIGNED16(struct) btCompoundShapeChild
-{
- BT_DECLARE_ALIGNED_ALLOCATOR();
-
- btTransform m_transform;
- btCollisionShape* m_childShape;
- int m_childShapeType;
- btScalar m_childMargin;
- struct btDbvtNode* m_node;
-};
-
-SIMD_FORCE_INLINE bool operator==(const btCompoundShapeChild& c1, const btCompoundShapeChild& c2)
-{
- return ( c1.m_transform == c2.m_transform &&
- c1.m_childShape == c2.m_childShape &&
- c1.m_childShapeType == c2.m_childShapeType &&
- c1.m_childMargin == c2.m_childMargin );
-}
-
-/// The btCompoundShape allows to store multiple other btCollisionShapes
-/// This allows for moving concave collision objects. This is more general then the static concave btBvhTriangleMeshShape.
-/// It has an (optional) dynamic aabb tree to accelerate early rejection tests.
-/// @todo: This aabb tree can also be use to speed up ray tests on btCompoundShape, see http://code.google.com/p/bullet/issues/detail?id=25
-/// Currently, removal of child shapes is only supported when disabling the aabb tree (pass 'false' in the constructor of btCompoundShape)
-ATTRIBUTE_ALIGNED16(class) btCompoundShape : public btCollisionShape
-{
- btAlignedObjectArray<btCompoundShapeChild> m_children;
- btVector3 m_localAabbMin;
- btVector3 m_localAabbMax;
-
- btDbvt* m_dynamicAabbTree;
-
- ///increment m_updateRevision when adding/removing/replacing child shapes, so that some caches can be updated
- int m_updateRevision;
-
- btScalar m_collisionMargin;
-
-protected:
- btVector3 m_localScaling;
-
-public:
- BT_DECLARE_ALIGNED_ALLOCATOR();
-
- btCompoundShape(bool enableDynamicAabbTree = true);
-
- virtual ~btCompoundShape();
-
- void addChildShape(const btTransform& localTransform,btCollisionShape* shape);
-
- /// Remove all children shapes that contain the specified shape
- virtual void removeChildShape(btCollisionShape* shape);
-
- void removeChildShapeByIndex(int childShapeindex);
-
-
- int getNumChildShapes() const
- {
- return int (m_children.size());
- }
-
- btCollisionShape* getChildShape(int index)
- {
- return m_children[index].m_childShape;
- }
- const btCollisionShape* getChildShape(int index) const
- {
- return m_children[index].m_childShape;
- }
-
- btTransform& getChildTransform(int index)
- {
- return m_children[index].m_transform;
- }
- const btTransform& getChildTransform(int index) const
- {
- return m_children[index].m_transform;
- }
-
- ///set a new transform for a child, and update internal data structures (local aabb and dynamic tree)
- void updateChildTransform(int childIndex, const btTransform& newChildTransform);
-
-
- btCompoundShapeChild* getChildList()
- {
- return &m_children[0];
- }
-
- ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
- virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
-
- /** Re-calculate the local Aabb. Is called at the end of removeChildShapes.
- Use this yourself if you modify the children or their transforms. */
- virtual void recalculateLocalAabb();
-
- virtual void setLocalScaling(const btVector3& scaling);
-
- virtual const btVector3& getLocalScaling() const
- {
- return m_localScaling;
- }
-
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
-
- virtual void setMargin(btScalar margin)
- {
- m_collisionMargin = margin;
- }
- virtual btScalar getMargin() const
- {
- return m_collisionMargin;
- }
- virtual const char* getName()const
- {
- return "Compound";
- }
-
-
- btDbvt* getDynamicAabbTree()
- {
- return m_dynamicAabbTree;
- }
-
- ///computes the exact moment of inertia and the transform from the coordinate system defined by the principal axes of the moment of inertia
- ///and the center of mass to the current coordinate system. "masses" points to an array of masses of the children. The resulting transform
- ///"principal" has to be applied inversely to all children transforms in order for the local coordinate system of the compound
- ///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
- ///of the collision object by the principal transform.
- void calculatePrincipalAxisTransform(btScalar* masses, btTransform& principal, btVector3& inertia) const;
-
- int getUpdateRevision() const
- {
- return m_updateRevision;
- }
-
- virtual int calculateSerializeBufferSize() const;
-
- ///fills the dataBuffer and returns the struct name (and 0 on failure)
- virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
-
-
-};
-
-///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
-struct btCompoundShapeChildData
-{
- btTransformFloatData m_transform;
- btCollisionShapeData *m_childShape;
- int m_childShapeType;
- float m_childMargin;
-};
-
-///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
-struct btCompoundShapeData
-{
- btCollisionShapeData m_collisionShapeData;
-
- btCompoundShapeChildData *m_childShapePtr;
-
- int m_numChildShapes;
-
- float m_collisionMargin;
-
-};
-
-
-SIMD_FORCE_INLINE int btCompoundShape::calculateSerializeBufferSize() const
-{
- return sizeof(btCompoundShapeData);
-}
-
-
-
-
-
-
-
-#endif //COMPOUND_SHAPE_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btConcaveShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btConcaveShape.cpp
deleted file mode 100644
index 58ff84a5b02..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btConcaveShape.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-
-#include "btConcaveShape.h"
-
-btConcaveShape::btConcaveShape() : m_collisionMargin(btScalar(0.))
-{
-
-}
-
-btConcaveShape::~btConcaveShape()
-{
-
-}
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btConcaveShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btConcaveShape.h
deleted file mode 100644
index 2a370a47c75..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btConcaveShape.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef CONCAVE_SHAPE_H
-#define CONCAVE_SHAPE_H
-
-#include "btCollisionShape.h"
-#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
-#include "btTriangleCallback.h"
-
-/// PHY_ScalarType enumerates possible scalar types.
-/// See the btStridingMeshInterface or btHeightfieldTerrainShape for its use
-typedef enum PHY_ScalarType {
- PHY_FLOAT,
- PHY_DOUBLE,
- PHY_INTEGER,
- PHY_SHORT,
- PHY_FIXEDPOINT88,
- PHY_UCHAR
-} PHY_ScalarType;
-
-///The btConcaveShape class provides an interface for non-moving (static) concave shapes.
-///It has been implemented by the btStaticPlaneShape, btBvhTriangleMeshShape and btHeightfieldTerrainShape.
-class btConcaveShape : public btCollisionShape
-{
-protected:
- btScalar m_collisionMargin;
-
-public:
- btConcaveShape();
-
- virtual ~btConcaveShape();
-
- virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const = 0;
-
- virtual btScalar getMargin() const {
- return m_collisionMargin;
- }
- virtual void setMargin(btScalar collisionMargin)
- {
- m_collisionMargin = collisionMargin;
- }
-
-
-
-};
-
-#endif //CONCAVE_SHAPE_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btConeShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btConeShape.cpp
deleted file mode 100644
index dfa3f941eeb..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btConeShape.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btConeShape.h"
-
-
-
-btConeShape::btConeShape (btScalar radius,btScalar height): btConvexInternalShape (),
-m_radius (radius),
-m_height(height)
-{
- m_shapeType = CONE_SHAPE_PROXYTYPE;
- setConeUpIndex(1);
- btVector3 halfExtents;
- m_sinAngle = (m_radius / btSqrt(m_radius * m_radius + m_height * m_height));
-}
-
-btConeShapeZ::btConeShapeZ (btScalar radius,btScalar height):
-btConeShape(radius,height)
-{
- setConeUpIndex(2);
-}
-
-btConeShapeX::btConeShapeX (btScalar radius,btScalar height):
-btConeShape(radius,height)
-{
- setConeUpIndex(0);
-}
-
-///choose upAxis index
-void btConeShape::setConeUpIndex(int upIndex)
-{
- switch (upIndex)
- {
- case 0:
- m_coneIndices[0] = 1;
- m_coneIndices[1] = 0;
- m_coneIndices[2] = 2;
- break;
- case 1:
- m_coneIndices[0] = 0;
- m_coneIndices[1] = 1;
- m_coneIndices[2] = 2;
- break;
- case 2:
- m_coneIndices[0] = 0;
- m_coneIndices[1] = 2;
- m_coneIndices[2] = 1;
- break;
- default:
- btAssert(0);
- };
-}
-
-btVector3 btConeShape::coneLocalSupport(const btVector3& v) const
-{
-
- btScalar halfHeight = m_height * btScalar(0.5);
-
- if (v[m_coneIndices[1]] > v.length() * m_sinAngle)
- {
- btVector3 tmp;
-
- tmp[m_coneIndices[0]] = btScalar(0.);
- tmp[m_coneIndices[1]] = halfHeight;
- tmp[m_coneIndices[2]] = btScalar(0.);
- return tmp;
- }
- else {
- btScalar s = btSqrt(v[m_coneIndices[0]] * v[m_coneIndices[0]] + v[m_coneIndices[2]] * v[m_coneIndices[2]]);
- if (s > SIMD_EPSILON) {
- btScalar d = m_radius / s;
- btVector3 tmp;
- tmp[m_coneIndices[0]] = v[m_coneIndices[0]] * d;
- tmp[m_coneIndices[1]] = -halfHeight;
- tmp[m_coneIndices[2]] = v[m_coneIndices[2]] * d;
- return tmp;
- }
- else {
- btVector3 tmp;
- tmp[m_coneIndices[0]] = btScalar(0.);
- tmp[m_coneIndices[1]] = -halfHeight;
- tmp[m_coneIndices[2]] = btScalar(0.);
- return tmp;
- }
- }
-
-}
-
-btVector3 btConeShape::localGetSupportingVertexWithoutMargin(const btVector3& vec) const
-{
- return coneLocalSupport(vec);
-}
-
-void btConeShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
-{
- for (int i=0;i<numVectors;i++)
- {
- const btVector3& vec = vectors[i];
- supportVerticesOut[i] = coneLocalSupport(vec);
- }
-}
-
-
-btVector3 btConeShape::localGetSupportingVertex(const btVector3& vec) const
-{
- btVector3 supVertex = coneLocalSupport(vec);
- if ( getMargin()!=btScalar(0.) )
- {
- btVector3 vecnorm = vec;
- if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
- {
- vecnorm.setValue(btScalar(-1.),btScalar(-1.),btScalar(-1.));
- }
- vecnorm.normalize();
- supVertex+= getMargin() * vecnorm;
- }
- return supVertex;
-}
-
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btConeShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btConeShape.h
deleted file mode 100644
index 9766c7ef249..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btConeShape.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef CONE_MINKOWSKI_H
-#define CONE_MINKOWSKI_H
-
-#include "btConvexInternalShape.h"
-#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
-
-///The btConeShape implements a cone shape primitive, centered around the origin and aligned with the Y axis. The btConeShapeX is aligned around the X axis and btConeShapeZ around the Z axis.
-class btConeShape : public btConvexInternalShape
-
-{
-
- btScalar m_sinAngle;
- btScalar m_radius;
- btScalar m_height;
- int m_coneIndices[3];
- btVector3 coneLocalSupport(const btVector3& v) const;
-
-
-public:
- btConeShape (btScalar radius,btScalar height);
-
- virtual btVector3 localGetSupportingVertex(const btVector3& vec) const;
- virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec) const;
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
-
- btScalar getRadius() const { return m_radius;}
- btScalar getHeight() const { return m_height;}
-
-
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const
- {
- btTransform identity;
- identity.setIdentity();
- btVector3 aabbMin,aabbMax;
- getAabb(identity,aabbMin,aabbMax);
-
- btVector3 halfExtents = (aabbMax-aabbMin)*btScalar(0.5);
-
- btScalar margin = getMargin();
-
- btScalar lx=btScalar(2.)*(halfExtents.x()+margin);
- btScalar ly=btScalar(2.)*(halfExtents.y()+margin);
- btScalar lz=btScalar(2.)*(halfExtents.z()+margin);
- const btScalar x2 = lx*lx;
- const btScalar y2 = ly*ly;
- const btScalar z2 = lz*lz;
- const btScalar scaledmass = mass * btScalar(0.08333333);
-
- inertia = scaledmass * (btVector3(y2+z2,x2+z2,x2+y2));
-
-// inertia.x() = scaledmass * (y2+z2);
-// inertia.y() = scaledmass * (x2+z2);
-// inertia.z() = scaledmass * (x2+y2);
- }
-
-
- virtual const char* getName()const
- {
- return "Cone";
- }
-
- ///choose upAxis index
- void setConeUpIndex(int upIndex);
-
- int getConeUpIndex() const
- {
- return m_coneIndices[1];
- }
-};
-
-///btConeShape implements a Cone shape, around the X axis
-class btConeShapeX : public btConeShape
-{
- public:
- btConeShapeX(btScalar radius,btScalar height);
-};
-
-///btConeShapeZ implements a Cone shape, around the Z axis
-class btConeShapeZ : public btConeShape
-{
- public:
- btConeShapeZ(btScalar radius,btScalar height);
-};
-#endif //CONE_MINKOWSKI_H
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btConvex2dShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btConvex2dShape.cpp
deleted file mode 100644
index 10ea3e981af..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btConvex2dShape.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btConvex2dShape.h"
-
-btConvex2dShape::btConvex2dShape( btConvexShape* convexChildShape):
-btConvexShape (), m_childConvexShape(convexChildShape)
-{
- m_shapeType = CONVEX_2D_SHAPE_PROXYTYPE;
-}
-
-btConvex2dShape::~btConvex2dShape()
-{
-}
-
-
-
-btVector3 btConvex2dShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
-{
- return m_childConvexShape->localGetSupportingVertexWithoutMargin(vec);
-}
-
-void btConvex2dShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
-{
- m_childConvexShape->batchedUnitVectorGetSupportingVertexWithoutMargin(vectors,supportVerticesOut,numVectors);
-}
-
-
-btVector3 btConvex2dShape::localGetSupportingVertex(const btVector3& vec)const
-{
- return m_childConvexShape->localGetSupportingVertex(vec);
-}
-
-
-void btConvex2dShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
-{
- ///this linear upscaling is not realistic, but we don't deal with large mass ratios...
- m_childConvexShape->calculateLocalInertia(mass,inertia);
-}
-
-
- ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
-void btConvex2dShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
-{
- m_childConvexShape->getAabb(t,aabbMin,aabbMax);
-}
-
-void btConvex2dShape::getAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
-{
- m_childConvexShape->getAabbSlow(t,aabbMin,aabbMax);
-}
-
-void btConvex2dShape::setLocalScaling(const btVector3& scaling)
-{
- m_childConvexShape->setLocalScaling(scaling);
-}
-
-const btVector3& btConvex2dShape::getLocalScaling() const
-{
- return m_childConvexShape->getLocalScaling();
-}
-
-void btConvex2dShape::setMargin(btScalar margin)
-{
- m_childConvexShape->setMargin(margin);
-}
-btScalar btConvex2dShape::getMargin() const
-{
- return m_childConvexShape->getMargin();
-}
-
-int btConvex2dShape::getNumPreferredPenetrationDirections() const
-{
- return m_childConvexShape->getNumPreferredPenetrationDirections();
-}
-
-void btConvex2dShape::getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const
-{
- m_childConvexShape->getPreferredPenetrationDirection(index,penetrationVector);
-}
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btConvex2dShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btConvex2dShape.h
deleted file mode 100644
index 58166c8291a..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btConvex2dShape.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef BT_CONVEX_2D_SHAPE_H
-#define BT_CONVEX_2D_SHAPE_H
-
-#include "BulletCollision/CollisionShapes/btConvexShape.h"
-#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
-
-///The btConvex2dShape allows to use arbitrary convex shapes are 2d convex shapes, with the Z component assumed to be 0.
-///For 2d boxes, the btBox2dShape is recommended.
-class btConvex2dShape : public btConvexShape
-{
- btConvexShape* m_childConvexShape;
-
- public:
-
- btConvex2dShape( btConvexShape* convexChildShape);
-
- virtual ~btConvex2dShape();
-
- virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
-
- virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
-
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
-
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
-
- btConvexShape* getChildShape()
- {
- return m_childConvexShape;
- }
-
- const btConvexShape* getChildShape() const
- {
- return m_childConvexShape;
- }
-
- virtual const char* getName()const
- {
- return "Convex2dShape";
- }
-
-
-
- ///////////////////////////
-
-
- ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
- void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
-
- virtual void getAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
-
- virtual void setLocalScaling(const btVector3& scaling) ;
- virtual const btVector3& getLocalScaling() const ;
-
- virtual void setMargin(btScalar margin);
- virtual btScalar getMargin() const;
-
- virtual int getNumPreferredPenetrationDirections() const;
-
- virtual void getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const;
-
-
-};
-
-#endif //BT_CONVEX_2D_SHAPE_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btConvexHullShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btConvexHullShape.cpp
deleted file mode 100644
index 2c39cabca54..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btConvexHullShape.cpp
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btConvexHullShape.h"
-#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
-
-#include "LinearMath/btQuaternion.h"
-#include "LinearMath/btSerializer.h"
-
-btConvexHullShape ::btConvexHullShape (const btScalar* points,int numPoints,int stride) : btPolyhedralConvexAabbCachingShape ()
-{
- m_shapeType = CONVEX_HULL_SHAPE_PROXYTYPE;
- m_unscaledPoints.resize(numPoints);
-
- unsigned char* pointsAddress = (unsigned char*)points;
-
- for (int i=0;i<numPoints;i++)
- {
- btScalar* point = (btScalar*)pointsAddress;
- m_unscaledPoints[i] = btVector3(point[0], point[1], point[2]);
- pointsAddress += stride;
- }
-
- recalcLocalAabb();
-
-}
-
-
-
-void btConvexHullShape::setLocalScaling(const btVector3& scaling)
-{
- m_localScaling = scaling;
- recalcLocalAabb();
-}
-
-void btConvexHullShape::addPoint(const btVector3& point)
-{
- m_unscaledPoints.push_back(point);
- recalcLocalAabb();
-
-}
-
-btVector3 btConvexHullShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
-{
- btVector3 supVec(btScalar(0.),btScalar(0.),btScalar(0.));
- btScalar newDot,maxDot = btScalar(-BT_LARGE_FLOAT);
-
- btVector3 vec = vec0;
- btScalar lenSqr = vec.length2();
- if (lenSqr < btScalar(0.0001))
- {
- vec.setValue(1,0,0);
- } else
- {
- btScalar rlen = btScalar(1.) / btSqrt(lenSqr );
- vec *= rlen;
- }
-
-
- for (int i=0;i<m_unscaledPoints.size();i++)
- {
- btVector3 vtx = m_unscaledPoints[i] * m_localScaling;
-
- newDot = vec.dot(vtx);
- if (newDot > maxDot)
- {
- maxDot = newDot;
- supVec = vtx;
- }
- }
- return supVec;
-}
-
-void btConvexHullShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
-{
- btScalar newDot;
- //use 'w' component of supportVerticesOut?
- {
- for (int i=0;i<numVectors;i++)
- {
- supportVerticesOut[i][3] = btScalar(-BT_LARGE_FLOAT);
- }
- }
- for (int i=0;i<m_unscaledPoints.size();i++)
- {
- btVector3 vtx = getScaledPoint(i);
-
- for (int j=0;j<numVectors;j++)
- {
- const btVector3& vec = vectors[j];
-
- newDot = vec.dot(vtx);
- if (newDot > supportVerticesOut[j][3])
- {
- //WARNING: don't swap next lines, the w component would get overwritten!
- supportVerticesOut[j] = vtx;
- supportVerticesOut[j][3] = newDot;
- }
- }
- }
-
-
-
-}
-
-
-
-btVector3 btConvexHullShape::localGetSupportingVertex(const btVector3& vec)const
-{
- btVector3 supVertex = localGetSupportingVertexWithoutMargin(vec);
-
- if ( getMargin()!=btScalar(0.) )
- {
- btVector3 vecnorm = vec;
- if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
- {
- vecnorm.setValue(btScalar(-1.),btScalar(-1.),btScalar(-1.));
- }
- vecnorm.normalize();
- supVertex+= getMargin() * vecnorm;
- }
- return supVertex;
-}
-
-
-
-
-
-
-
-
-
-//currently just for debugging (drawing), perhaps future support for algebraic continuous collision detection
-//Please note that you can debug-draw btConvexHullShape with the Raytracer Demo
-int btConvexHullShape::getNumVertices() const
-{
- return m_unscaledPoints.size();
-}
-
-int btConvexHullShape::getNumEdges() const
-{
- return m_unscaledPoints.size();
-}
-
-void btConvexHullShape::getEdge(int i,btVector3& pa,btVector3& pb) const
-{
-
- int index0 = i%m_unscaledPoints.size();
- int index1 = (i+1)%m_unscaledPoints.size();
- pa = getScaledPoint(index0);
- pb = getScaledPoint(index1);
-}
-
-void btConvexHullShape::getVertex(int i,btVector3& vtx) const
-{
- vtx = getScaledPoint(i);
-}
-
-int btConvexHullShape::getNumPlanes() const
-{
- return 0;
-}
-
-void btConvexHullShape::getPlane(btVector3& ,btVector3& ,int ) const
-{
-
- btAssert(0);
-}
-
-//not yet
-bool btConvexHullShape::isInside(const btVector3& ,btScalar ) const
-{
- btAssert(0);
- return false;
-}
-
-///fills the dataBuffer and returns the struct name (and 0 on failure)
-const char* btConvexHullShape::serialize(void* dataBuffer, btSerializer* serializer) const
-{
- //int szc = sizeof(btConvexHullShapeData);
- btConvexHullShapeData* shapeData = (btConvexHullShapeData*) dataBuffer;
- btConvexInternalShape::serialize(&shapeData->m_convexInternalShapeData, serializer);
-
- int numElem = m_unscaledPoints.size();
- shapeData->m_numUnscaledPoints = numElem;
-#ifdef BT_USE_DOUBLE_PRECISION
- shapeData->m_unscaledPointsFloatPtr = 0;
- shapeData->m_unscaledPointsDoublePtr = numElem ? (btVector3Data*)serializer->getUniquePointer((void*)&m_unscaledPoints[0]): 0;
-#else
- shapeData->m_unscaledPointsFloatPtr = numElem ? (btVector3Data*)serializer->getUniquePointer((void*)&m_unscaledPoints[0]): 0;
- shapeData->m_unscaledPointsDoublePtr = 0;
-#endif
-
- if (numElem)
- {
- int sz = sizeof(btVector3Data);
- // int sz2 = sizeof(btVector3DoubleData);
- // int sz3 = sizeof(btVector3FloatData);
- btChunk* chunk = serializer->allocate(sz,numElem);
- btVector3Data* memPtr = (btVector3Data*)chunk->m_oldPtr;
- for (int i=0;i<numElem;i++,memPtr++)
- {
- m_unscaledPoints[i].serialize(*memPtr);
- }
- serializer->finalizeChunk(chunk,btVector3DataName,BT_ARRAY_CODE,(void*)&m_unscaledPoints[0]);
- }
-
- return "btConvexHullShapeData";
-}
-
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btConvexHullShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btConvexHullShape.h
deleted file mode 100644
index bf960f4df92..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btConvexHullShape.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef CONVEX_HULL_SHAPE_H
-#define CONVEX_HULL_SHAPE_H
-
-#include "btPolyhedralConvexShape.h"
-#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
-#include "LinearMath/btAlignedObjectArray.h"
-
-
-///The btConvexHullShape implements an implicit convex hull of an array of vertices.
-///Bullet provides a general and fast collision detector for convex shapes based on GJK and EPA using localGetSupportingVertex.
-ATTRIBUTE_ALIGNED16(class) btConvexHullShape : public btPolyhedralConvexAabbCachingShape
-{
- btAlignedObjectArray<btVector3> m_unscaledPoints;
-
-public:
- BT_DECLARE_ALIGNED_ALLOCATOR();
-
-
- ///this constructor optionally takes in a pointer to points. Each point is assumed to be 3 consecutive btScalar (x,y,z), the striding defines the number of bytes between each point, in memory.
- ///It is easier to not pass any points in the constructor, and just add one point at a time, using addPoint.
- ///btConvexHullShape make an internal copy of the points.
- btConvexHullShape(const btScalar* points=0,int numPoints=0, int stride=sizeof(btVector3));
-
- void addPoint(const btVector3& point);
-
-
- btVector3* getUnscaledPoints()
- {
- return &m_unscaledPoints[0];
- }
-
- const btVector3* getUnscaledPoints() const
- {
- return &m_unscaledPoints[0];
- }
-
- ///getPoints is obsolete, please use getUnscaledPoints
- const btVector3* getPoints() const
- {
- return getUnscaledPoints();
- }
-
-
-
-
- SIMD_FORCE_INLINE btVector3 getScaledPoint(int i) const
- {
- return m_unscaledPoints[i] * m_localScaling;
- }
-
- SIMD_FORCE_INLINE int getNumPoints() const
- {
- return m_unscaledPoints.size();
- }
-
- virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
- virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
-
-
-
- //debugging
- virtual const char* getName()const {return "Convex";}
-
-
- virtual int getNumVertices() const;
- virtual int getNumEdges() const;
- virtual void getEdge(int i,btVector3& pa,btVector3& pb) const;
- virtual void getVertex(int i,btVector3& vtx) const;
- virtual int getNumPlanes() const;
- virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const;
- virtual bool isInside(const btVector3& pt,btScalar tolerance) const;
-
- ///in case we receive negative scaling
- virtual void setLocalScaling(const btVector3& scaling);
-
- virtual int calculateSerializeBufferSize() const;
-
- ///fills the dataBuffer and returns the struct name (and 0 on failure)
- virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
-
-};
-
-///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
-struct btConvexHullShapeData
-{
- btConvexInternalShapeData m_convexInternalShapeData;
-
- btVector3FloatData *m_unscaledPointsFloatPtr;
- btVector3DoubleData *m_unscaledPointsDoublePtr;
-
- int m_numUnscaledPoints;
- char m_padding3[4];
-
-};
-
-
-SIMD_FORCE_INLINE int btConvexHullShape::calculateSerializeBufferSize() const
-{
- return sizeof(btConvexHullShapeData);
-}
-
-
-#endif //CONVEX_HULL_SHAPE_H
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btConvexInternalShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btConvexInternalShape.cpp
deleted file mode 100644
index 083d60b1b1e..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btConvexInternalShape.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-
-#include "btConvexInternalShape.h"
-
-
-
-btConvexInternalShape::btConvexInternalShape()
-: m_localScaling(btScalar(1.),btScalar(1.),btScalar(1.)),
-m_collisionMargin(CONVEX_DISTANCE_MARGIN)
-{
-}
-
-
-void btConvexInternalShape::setLocalScaling(const btVector3& scaling)
-{
- m_localScaling = scaling.absolute();
-}
-
-
-
-void btConvexInternalShape::getAabbSlow(const btTransform& trans,btVector3&minAabb,btVector3&maxAabb) const
-{
-#ifndef __SPU__
- //use localGetSupportingVertexWithoutMargin?
- btScalar margin = getMargin();
- for (int i=0;i<3;i++)
- {
- btVector3 vec(btScalar(0.),btScalar(0.),btScalar(0.));
- vec[i] = btScalar(1.);
-
- btVector3 sv = localGetSupportingVertex(vec*trans.getBasis());
-
- btVector3 tmp = trans(sv);
- maxAabb[i] = tmp[i]+margin;
- vec[i] = btScalar(-1.);
- tmp = trans(localGetSupportingVertex(vec*trans.getBasis()));
- minAabb[i] = tmp[i]-margin;
- }
-#endif
-}
-
-
-
-btVector3 btConvexInternalShape::localGetSupportingVertex(const btVector3& vec)const
-{
-#ifndef __SPU__
-
- btVector3 supVertex = localGetSupportingVertexWithoutMargin(vec);
-
- if ( getMargin()!=btScalar(0.) )
- {
- btVector3 vecnorm = vec;
- if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
- {
- vecnorm.setValue(btScalar(-1.),btScalar(-1.),btScalar(-1.));
- }
- vecnorm.normalize();
- supVertex+= getMargin() * vecnorm;
- }
- return supVertex;
-
-#else
- btAssert(0);
- return btVector3(0,0,0);
-#endif //__SPU__
-
- }
-
-
-btConvexInternalAabbCachingShape::btConvexInternalAabbCachingShape()
- : btConvexInternalShape(),
-m_localAabbMin(1,1,1),
-m_localAabbMax(-1,-1,-1),
-m_isLocalAabbValid(false)
-{
-}
-
-
-void btConvexInternalAabbCachingShape::getAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const
-{
- getNonvirtualAabb(trans,aabbMin,aabbMax,getMargin());
-}
-
-void btConvexInternalAabbCachingShape::setLocalScaling(const btVector3& scaling)
-{
- btConvexInternalShape::setLocalScaling(scaling);
- recalcLocalAabb();
-}
-
-
-void btConvexInternalAabbCachingShape::recalcLocalAabb()
-{
- m_isLocalAabbValid = true;
-
- #if 1
- static const btVector3 _directions[] =
- {
- btVector3( 1., 0., 0.),
- btVector3( 0., 1., 0.),
- btVector3( 0., 0., 1.),
- btVector3( -1., 0., 0.),
- btVector3( 0., -1., 0.),
- btVector3( 0., 0., -1.)
- };
-
- btVector3 _supporting[] =
- {
- btVector3( 0., 0., 0.),
- btVector3( 0., 0., 0.),
- btVector3( 0., 0., 0.),
- btVector3( 0., 0., 0.),
- btVector3( 0., 0., 0.),
- btVector3( 0., 0., 0.)
- };
-
- batchedUnitVectorGetSupportingVertexWithoutMargin(_directions, _supporting, 6);
-
- for ( int i = 0; i < 3; ++i )
- {
- m_localAabbMax[i] = _supporting[i][i] + m_collisionMargin;
- m_localAabbMin[i] = _supporting[i + 3][i] - m_collisionMargin;
- }
-
- #else
-
- for (int i=0;i<3;i++)
- {
- btVector3 vec(btScalar(0.),btScalar(0.),btScalar(0.));
- vec[i] = btScalar(1.);
- btVector3 tmp = localGetSupportingVertex(vec);
- m_localAabbMax[i] = tmp[i]+m_collisionMargin;
- vec[i] = btScalar(-1.);
- tmp = localGetSupportingVertex(vec);
- m_localAabbMin[i] = tmp[i]-m_collisionMargin;
- }
- #endif
-}
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btConvexInternalShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btConvexInternalShape.h
deleted file mode 100644
index 12527731804..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btConvexInternalShape.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef BT_CONVEX_INTERNAL_SHAPE_H
-#define BT_CONVEX_INTERNAL_SHAPE_H
-
-#include "btConvexShape.h"
-#include "LinearMath/btAabbUtil2.h"
-
-
-///The btConvexInternalShape is an internal base class, shared by most convex shape implementations.
-class btConvexInternalShape : public btConvexShape
-{
-
- protected:
-
- //local scaling. collisionMargin is not scaled !
- btVector3 m_localScaling;
-
- btVector3 m_implicitShapeDimensions;
-
- btScalar m_collisionMargin;
-
- btScalar m_padding;
-
- btConvexInternalShape();
-
-public:
-
-
-
- virtual ~btConvexInternalShape()
- {
-
- }
-
- virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
-
- const btVector3& getImplicitShapeDimensions() const
- {
- return m_implicitShapeDimensions;
- }
-
- ///warning: use setImplicitShapeDimensions with care
- ///changing a collision shape while the body is in the world is not recommended,
- ///it is best to remove the body from the world, then make the change, and re-add it
- ///alternatively flush the contact points, see documentation for 'cleanProxyFromPairs'
- void setImplicitShapeDimensions(const btVector3& dimensions)
- {
- m_implicitShapeDimensions = dimensions;
- }
-
- ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
- void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
- {
- getAabbSlow(t,aabbMin,aabbMax);
- }
-
-
-
- virtual void getAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
-
-
- virtual void setLocalScaling(const btVector3& scaling);
- virtual const btVector3& getLocalScaling() const
- {
- return m_localScaling;
- }
-
- const btVector3& getLocalScalingNV() const
- {
- return m_localScaling;
- }
-
- virtual void setMargin(btScalar margin)
- {
- m_collisionMargin = margin;
- }
- virtual btScalar getMargin() const
- {
- return m_collisionMargin;
- }
-
- btScalar getMarginNV() const
- {
- return m_collisionMargin;
- }
-
- virtual int getNumPreferredPenetrationDirections() const
- {
- return 0;
- }
-
- virtual void getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const
- {
- (void)penetrationVector;
- (void)index;
- btAssert(0);
- }
-
- virtual int calculateSerializeBufferSize() const;
-
- ///fills the dataBuffer and returns the struct name (and 0 on failure)
- virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
-
-
-};
-
-///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
-struct btConvexInternalShapeData
-{
- btCollisionShapeData m_collisionShapeData;
-
- btVector3FloatData m_localScaling;
-
- btVector3FloatData m_implicitShapeDimensions;
-
- float m_collisionMargin;
-
- int m_padding;
-
-};
-
-
-
-SIMD_FORCE_INLINE int btConvexInternalShape::calculateSerializeBufferSize() const
-{
- return sizeof(btConvexInternalShapeData);
-}
-
-///fills the dataBuffer and returns the struct name (and 0 on failure)
-SIMD_FORCE_INLINE const char* btConvexInternalShape::serialize(void* dataBuffer, btSerializer* serializer) const
-{
- btConvexInternalShapeData* shapeData = (btConvexInternalShapeData*) dataBuffer;
- btCollisionShape::serialize(&shapeData->m_collisionShapeData, serializer);
-
- m_implicitShapeDimensions.serializeFloat(shapeData->m_implicitShapeDimensions);
- m_localScaling.serializeFloat(shapeData->m_localScaling);
- shapeData->m_collisionMargin = float(m_collisionMargin);
-
- return "btConvexInternalShapeData";
-}
-
-
-
-
-///btConvexInternalAabbCachingShape adds local aabb caching for convex shapes, to avoid expensive bounding box calculations
-class btConvexInternalAabbCachingShape : public btConvexInternalShape
-{
- btVector3 m_localAabbMin;
- btVector3 m_localAabbMax;
- bool m_isLocalAabbValid;
-
-protected:
-
- btConvexInternalAabbCachingShape();
-
- void setCachedLocalAabb (const btVector3& aabbMin, const btVector3& aabbMax)
- {
- m_isLocalAabbValid = true;
- m_localAabbMin = aabbMin;
- m_localAabbMax = aabbMax;
- }
-
- inline void getCachedLocalAabb (btVector3& aabbMin, btVector3& aabbMax) const
- {
- btAssert(m_isLocalAabbValid);
- aabbMin = m_localAabbMin;
- aabbMax = m_localAabbMax;
- }
-
- inline void getNonvirtualAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax, btScalar margin) const
- {
-
- //lazy evaluation of local aabb
- btAssert(m_isLocalAabbValid);
- btTransformAabb(m_localAabbMin,m_localAabbMax,margin,trans,aabbMin,aabbMax);
- }
-
-public:
-
- virtual void setLocalScaling(const btVector3& scaling);
-
- virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
-
- void recalcLocalAabb();
-
-};
-
-#endif //BT_CONVEX_INTERNAL_SHAPE_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp
deleted file mode 100644
index c1b155aef45..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btConvexPointCloudShape.h"
-#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
-
-#include "LinearMath/btQuaternion.h"
-
-void btConvexPointCloudShape::setLocalScaling(const btVector3& scaling)
-{
- m_localScaling = scaling;
- recalcLocalAabb();
-}
-
-#ifndef __SPU__
-btVector3 btConvexPointCloudShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
-{
- btVector3 supVec(btScalar(0.),btScalar(0.),btScalar(0.));
- btScalar newDot,maxDot = btScalar(-BT_LARGE_FLOAT);
-
- btVector3 vec = vec0;
- btScalar lenSqr = vec.length2();
- if (lenSqr < btScalar(0.0001))
- {
- vec.setValue(1,0,0);
- } else
- {
- btScalar rlen = btScalar(1.) / btSqrt(lenSqr );
- vec *= rlen;
- }
-
-
- for (int i=0;i<m_numPoints;i++)
- {
- btVector3 vtx = getScaledPoint(i);
-
- newDot = vec.dot(vtx);
- if (newDot > maxDot)
- {
- maxDot = newDot;
- supVec = vtx;
- }
- }
- return supVec;
-}
-
-void btConvexPointCloudShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
-{
- btScalar newDot;
- //use 'w' component of supportVerticesOut?
- {
- for (int i=0;i<numVectors;i++)
- {
- supportVerticesOut[i][3] = btScalar(-BT_LARGE_FLOAT);
- }
- }
- for (int i=0;i<m_numPoints;i++)
- {
- btVector3 vtx = getScaledPoint(i);
-
- for (int j=0;j<numVectors;j++)
- {
- const btVector3& vec = vectors[j];
-
- newDot = vec.dot(vtx);
- if (newDot > supportVerticesOut[j][3])
- {
- //WARNING: don't swap next lines, the w component would get overwritten!
- supportVerticesOut[j] = vtx;
- supportVerticesOut[j][3] = newDot;
- }
- }
- }
-
-
-
-}
-
-
-
-btVector3 btConvexPointCloudShape::localGetSupportingVertex(const btVector3& vec)const
-{
- btVector3 supVertex = localGetSupportingVertexWithoutMargin(vec);
-
- if ( getMargin()!=btScalar(0.) )
- {
- btVector3 vecnorm = vec;
- if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
- {
- vecnorm.setValue(btScalar(-1.),btScalar(-1.),btScalar(-1.));
- }
- vecnorm.normalize();
- supVertex+= getMargin() * vecnorm;
- }
- return supVertex;
-}
-
-
-#endif
-
-
-
-
-
-
-//currently just for debugging (drawing), perhaps future support for algebraic continuous collision detection
-//Please note that you can debug-draw btConvexHullShape with the Raytracer Demo
-int btConvexPointCloudShape::getNumVertices() const
-{
- return m_numPoints;
-}
-
-int btConvexPointCloudShape::getNumEdges() const
-{
- return 0;
-}
-
-void btConvexPointCloudShape::getEdge(int i,btVector3& pa,btVector3& pb) const
-{
- btAssert (0);
-}
-
-void btConvexPointCloudShape::getVertex(int i,btVector3& vtx) const
-{
- vtx = m_unscaledPoints[i]*m_localScaling;
-}
-
-int btConvexPointCloudShape::getNumPlanes() const
-{
- return 0;
-}
-
-void btConvexPointCloudShape::getPlane(btVector3& ,btVector3& ,int ) const
-{
-
- btAssert(0);
-}
-
-//not yet
-bool btConvexPointCloudShape::isInside(const btVector3& ,btScalar ) const
-{
- btAssert(0);
- return false;
-}
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btConvexPointCloudShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btConvexPointCloudShape.h
deleted file mode 100644
index 54b5afac3ec..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btConvexPointCloudShape.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef BT_CONVEX_POINT_CLOUD_SHAPE_H
-#define BT_CONVEX_POINT_CLOUD_SHAPE_H
-
-#include "btPolyhedralConvexShape.h"
-#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
-#include "LinearMath/btAlignedObjectArray.h"
-
-///The btConvexPointCloudShape implements an implicit convex hull of an array of vertices.
-ATTRIBUTE_ALIGNED16(class) btConvexPointCloudShape : public btPolyhedralConvexAabbCachingShape
-{
- btVector3* m_unscaledPoints;
- int m_numPoints;
-
-public:
- BT_DECLARE_ALIGNED_ALLOCATOR();
-
- btConvexPointCloudShape()
- {
- m_localScaling.setValue(1.f,1.f,1.f);
- m_shapeType = CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE;
- m_unscaledPoints = 0;
- m_numPoints = 0;
- }
-
- btConvexPointCloudShape(btVector3* points,int numPoints, const btVector3& localScaling,bool computeAabb = true)
- {
- m_localScaling = localScaling;
- m_shapeType = CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE;
- m_unscaledPoints = points;
- m_numPoints = numPoints;
-
- if (computeAabb)
- recalcLocalAabb();
- }
-
- void setPoints (btVector3* points, int numPoints, bool computeAabb = true,const btVector3& localScaling=btVector3(1.f,1.f,1.f))
- {
- m_unscaledPoints = points;
- m_numPoints = numPoints;
- m_localScaling = localScaling;
-
- if (computeAabb)
- recalcLocalAabb();
- }
-
- SIMD_FORCE_INLINE btVector3* getUnscaledPoints()
- {
- return m_unscaledPoints;
- }
-
- SIMD_FORCE_INLINE const btVector3* getUnscaledPoints() const
- {
- return m_unscaledPoints;
- }
-
- SIMD_FORCE_INLINE int getNumPoints() const
- {
- return m_numPoints;
- }
-
- SIMD_FORCE_INLINE btVector3 getScaledPoint( int index) const
- {
- return m_unscaledPoints[index] * m_localScaling;
- }
-
-#ifndef __SPU__
- virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
- virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
-#endif
-
-
- //debugging
- virtual const char* getName()const {return "ConvexPointCloud";}
-
- virtual int getNumVertices() const;
- virtual int getNumEdges() const;
- virtual void getEdge(int i,btVector3& pa,btVector3& pb) const;
- virtual void getVertex(int i,btVector3& vtx) const;
- virtual int getNumPlanes() const;
- virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const;
- virtual bool isInside(const btVector3& pt,btScalar tolerance) const;
-
- ///in case we receive negative scaling
- virtual void setLocalScaling(const btVector3& scaling);
-};
-
-
-#endif //BT_CONVEX_POINT_CLOUD_SHAPE_H
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btConvexShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btConvexShape.cpp
deleted file mode 100644
index f5f3aa58aa4..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btConvexShape.cpp
+++ /dev/null
@@ -1,429 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btConvexShape.h"
-#include "btTriangleShape.h"
-#include "btSphereShape.h"
-#include "btCylinderShape.h"
-#include "btCapsuleShape.h"
-#include "btConvexHullShape.h"
-#include "btConvexPointCloudShape.h"
-
-///not supported on IBM SDK, until we fix the alignment of btVector3
-#if defined (__CELLOS_LV2__) && defined (__SPU__)
-#include <spu_intrinsics.h>
-static inline vec_float4 vec_dot3( vec_float4 vec0, vec_float4 vec1 )
-{
- vec_float4 result;
- result = spu_mul( vec0, vec1 );
- result = spu_madd( spu_rlqwbyte( vec0, 4 ), spu_rlqwbyte( vec1, 4 ), result );
- return spu_madd( spu_rlqwbyte( vec0, 8 ), spu_rlqwbyte( vec1, 8 ), result );
-}
-#endif //__SPU__
-
-btConvexShape::btConvexShape ()
-{
-}
-
-btConvexShape::~btConvexShape()
-{
-
-}
-
-
-
-static btVector3 convexHullSupport (const btVector3& localDirOrg, const btVector3* points, int numPoints, const btVector3& localScaling)
-{
-
- btVector3 vec = localDirOrg * localScaling;
-
-#if defined (__CELLOS_LV2__) && defined (__SPU__)
-
- btVector3 localDir = vec;
-
- vec_float4 v_distMax = {-FLT_MAX,0,0,0};
- vec_int4 v_idxMax = {-999,0,0,0};
- int v=0;
- int numverts = numPoints;
-
- for(;v<(int)numverts-4;v+=4) {
- vec_float4 p0 = vec_dot3(points[v ].get128(),localDir.get128());
- vec_float4 p1 = vec_dot3(points[v+1].get128(),localDir.get128());
- vec_float4 p2 = vec_dot3(points[v+2].get128(),localDir.get128());
- vec_float4 p3 = vec_dot3(points[v+3].get128(),localDir.get128());
- const vec_int4 i0 = {v ,0,0,0};
- const vec_int4 i1 = {v+1,0,0,0};
- const vec_int4 i2 = {v+2,0,0,0};
- const vec_int4 i3 = {v+3,0,0,0};
- vec_uint4 retGt01 = spu_cmpgt(p0,p1);
- vec_float4 pmax01 = spu_sel(p1,p0,retGt01);
- vec_int4 imax01 = spu_sel(i1,i0,retGt01);
- vec_uint4 retGt23 = spu_cmpgt(p2,p3);
- vec_float4 pmax23 = spu_sel(p3,p2,retGt23);
- vec_int4 imax23 = spu_sel(i3,i2,retGt23);
- vec_uint4 retGt0123 = spu_cmpgt(pmax01,pmax23);
- vec_float4 pmax0123 = spu_sel(pmax23,pmax01,retGt0123);
- vec_int4 imax0123 = spu_sel(imax23,imax01,retGt0123);
- vec_uint4 retGtMax = spu_cmpgt(v_distMax,pmax0123);
- v_distMax = spu_sel(pmax0123,v_distMax,retGtMax);
- v_idxMax = spu_sel(imax0123,v_idxMax,retGtMax);
- }
- for(;v<(int)numverts;v++) {
- vec_float4 p = vec_dot3(points[v].get128(),localDir.get128());
- const vec_int4 i = {v,0,0,0};
- vec_uint4 retGtMax = spu_cmpgt(v_distMax,p);
- v_distMax = spu_sel(p,v_distMax,retGtMax);
- v_idxMax = spu_sel(i,v_idxMax,retGtMax);
- }
- int ptIndex = spu_extract(v_idxMax,0);
- const btVector3& supVec= points[ptIndex] * localScaling;
- return supVec;
-#else
-
- btScalar newDot,maxDot = btScalar(-BT_LARGE_FLOAT);
- int ptIndex = -1;
-
- for (int i=0;i<numPoints;i++)
- {
-
- newDot = vec.dot(points[i]);
- if (newDot > maxDot)
- {
- maxDot = newDot;
- ptIndex = i;
- }
- }
- btAssert(ptIndex >= 0);
- btVector3 supVec = points[ptIndex] * localScaling;
- return supVec;
-#endif //__SPU__
-}
-
-btVector3 btConvexShape::localGetSupportVertexWithoutMarginNonVirtual (const btVector3& localDir) const
-{
- switch (m_shapeType)
- {
- case SPHERE_SHAPE_PROXYTYPE:
- {
- return btVector3(0,0,0);
- }
- case BOX_SHAPE_PROXYTYPE:
- {
- btBoxShape* convexShape = (btBoxShape*)this;
- const btVector3& halfExtents = convexShape->getImplicitShapeDimensions();
-
- return btVector3(btFsels(localDir.x(), halfExtents.x(), -halfExtents.x()),
- btFsels(localDir.y(), halfExtents.y(), -halfExtents.y()),
- btFsels(localDir.z(), halfExtents.z(), -halfExtents.z()));
- }
- case TRIANGLE_SHAPE_PROXYTYPE:
- {
- btTriangleShape* triangleShape = (btTriangleShape*)this;
- btVector3 dir(localDir.getX(),localDir.getY(),localDir.getZ());
- btVector3* vertices = &triangleShape->m_vertices1[0];
- btVector3 dots(dir.dot(vertices[0]), dir.dot(vertices[1]), dir.dot(vertices[2]));
- btVector3 sup = vertices[dots.maxAxis()];
- return btVector3(sup.getX(),sup.getY(),sup.getZ());
- }
- case CYLINDER_SHAPE_PROXYTYPE:
- {
- btCylinderShape* cylShape = (btCylinderShape*)this;
- //mapping of halfextents/dimension onto radius/height depends on how cylinder local orientation is (upAxis)
-
- btVector3 halfExtents = cylShape->getImplicitShapeDimensions();
- btVector3 v(localDir.getX(),localDir.getY(),localDir.getZ());
- int cylinderUpAxis = cylShape->getUpAxis();
- int XX(1),YY(0),ZZ(2);
-
- switch (cylinderUpAxis)
- {
- case 0:
- {
- XX = 1;
- YY = 0;
- ZZ = 2;
- }
- break;
- case 1:
- {
- XX = 0;
- YY = 1;
- ZZ = 2;
- }
- break;
- case 2:
- {
- XX = 0;
- YY = 2;
- ZZ = 1;
-
- }
- break;
- default:
- btAssert(0);
- break;
- };
-
- btScalar radius = halfExtents[XX];
- btScalar halfHeight = halfExtents[cylinderUpAxis];
-
- btVector3 tmp;
- btScalar d ;
-
- btScalar s = btSqrt(v[XX] * v[XX] + v[ZZ] * v[ZZ]);
- if (s != btScalar(0.0))
- {
- d = radius / s;
- tmp[XX] = v[XX] * d;
- tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
- tmp[ZZ] = v[ZZ] * d;
- return btVector3(tmp.getX(),tmp.getY(),tmp.getZ());
- } else {
- tmp[XX] = radius;
- tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
- tmp[ZZ] = btScalar(0.0);
- return btVector3(tmp.getX(),tmp.getY(),tmp.getZ());
- }
- }
- case CAPSULE_SHAPE_PROXYTYPE:
- {
- btVector3 vec0(localDir.getX(),localDir.getY(),localDir.getZ());
-
- btCapsuleShape* capsuleShape = (btCapsuleShape*)this;
- btScalar halfHeight = capsuleShape->getHalfHeight();
- int capsuleUpAxis = capsuleShape->getUpAxis();
-
- btScalar radius = capsuleShape->getRadius();
- btVector3 supVec(0,0,0);
-
- btScalar maxDot(btScalar(-BT_LARGE_FLOAT));
-
- btVector3 vec = vec0;
- btScalar lenSqr = vec.length2();
- if (lenSqr < btScalar(0.0001))
- {
- vec.setValue(1,0,0);
- } else
- {
- btScalar rlen = btScalar(1.) / btSqrt(lenSqr );
- vec *= rlen;
- }
- btVector3 vtx;
- btScalar newDot;
- {
- btVector3 pos(0,0,0);
- pos[capsuleUpAxis] = halfHeight;
-
- //vtx = pos +vec*(radius);
- vtx = pos +vec*capsuleShape->getLocalScalingNV()*(radius) - vec * capsuleShape->getMarginNV();
- newDot = vec.dot(vtx);
-
-
- if (newDot > maxDot)
- {
- maxDot = newDot;
- supVec = vtx;
- }
- }
- {
- btVector3 pos(0,0,0);
- pos[capsuleUpAxis] = -halfHeight;
-
- //vtx = pos +vec*(radius);
- vtx = pos +vec*capsuleShape->getLocalScalingNV()*(radius) - vec * capsuleShape->getMarginNV();
- newDot = vec.dot(vtx);
- if (newDot > maxDot)
- {
- maxDot = newDot;
- supVec = vtx;
- }
- }
- return btVector3(supVec.getX(),supVec.getY(),supVec.getZ());
- }
- case CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE:
- {
- btConvexPointCloudShape* convexPointCloudShape = (btConvexPointCloudShape*)this;
- btVector3* points = convexPointCloudShape->getUnscaledPoints ();
- int numPoints = convexPointCloudShape->getNumPoints ();
- return convexHullSupport (localDir, points, numPoints,convexPointCloudShape->getLocalScalingNV());
- }
- case CONVEX_HULL_SHAPE_PROXYTYPE:
- {
- btConvexHullShape* convexHullShape = (btConvexHullShape*)this;
- btVector3* points = convexHullShape->getUnscaledPoints();
- int numPoints = convexHullShape->getNumPoints ();
- return convexHullSupport (localDir, points, numPoints,convexHullShape->getLocalScalingNV());
- }
- default:
-#ifndef __SPU__
- return this->localGetSupportingVertexWithoutMargin (localDir);
-#else
- btAssert (0);
-#endif
- }
-
- // should never reach here
- btAssert (0);
- return btVector3 (btScalar(0.0f), btScalar(0.0f), btScalar(0.0f));
-}
-
-btVector3 btConvexShape::localGetSupportVertexNonVirtual (const btVector3& localDir) const
-{
- btVector3 localDirNorm = localDir;
- if (localDirNorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
- {
- localDirNorm.setValue(btScalar(-1.),btScalar(-1.),btScalar(-1.));
- }
- localDirNorm.normalize ();
-
- return localGetSupportVertexWithoutMarginNonVirtual(localDirNorm)+ getMarginNonVirtual() * localDirNorm;
-}
-
-/* TODO: This should be bumped up to btCollisionShape () */
-btScalar btConvexShape::getMarginNonVirtual () const
-{
- switch (m_shapeType)
- {
- case SPHERE_SHAPE_PROXYTYPE:
- {
- btSphereShape* sphereShape = (btSphereShape*)this;
- return sphereShape->getRadius ();
- }
- case BOX_SHAPE_PROXYTYPE:
- {
- btBoxShape* convexShape = (btBoxShape*)this;
- return convexShape->getMarginNV ();
- }
- case TRIANGLE_SHAPE_PROXYTYPE:
- {
- btTriangleShape* triangleShape = (btTriangleShape*)this;
- return triangleShape->getMarginNV ();
- }
- case CYLINDER_SHAPE_PROXYTYPE:
- {
- btCylinderShape* cylShape = (btCylinderShape*)this;
- return cylShape->getMarginNV();
- }
- case CAPSULE_SHAPE_PROXYTYPE:
- {
- btCapsuleShape* capsuleShape = (btCapsuleShape*)this;
- return capsuleShape->getMarginNV();
- }
- case CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE:
- /* fall through */
- case CONVEX_HULL_SHAPE_PROXYTYPE:
- {
- btPolyhedralConvexShape* convexHullShape = (btPolyhedralConvexShape*)this;
- return convexHullShape->getMarginNV();
- }
- default:
-#ifndef __SPU__
- return this->getMargin ();
-#else
- btAssert (0);
-#endif
- }
-
- // should never reach here
- btAssert (0);
- return btScalar(0.0f);
-}
-#ifndef __SPU__
-void btConvexShape::getAabbNonVirtual (const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const
-{
- switch (m_shapeType)
- {
- case SPHERE_SHAPE_PROXYTYPE:
- {
- btSphereShape* sphereShape = (btSphereShape*)this;
- btScalar radius = sphereShape->getImplicitShapeDimensions().getX();// * convexShape->getLocalScaling().getX();
- btScalar margin = radius + sphereShape->getMarginNonVirtual();
- const btVector3& center = t.getOrigin();
- btVector3 extent(margin,margin,margin);
- aabbMin = center - extent;
- aabbMax = center + extent;
- }
- break;
- case CYLINDER_SHAPE_PROXYTYPE:
- /* fall through */
- case BOX_SHAPE_PROXYTYPE:
- {
- btBoxShape* convexShape = (btBoxShape*)this;
- btScalar margin=convexShape->getMarginNonVirtual();
- btVector3 halfExtents = convexShape->getImplicitShapeDimensions();
- halfExtents += btVector3(margin,margin,margin);
- btMatrix3x3 abs_b = t.getBasis().absolute();
- btVector3 center = t.getOrigin();
- btVector3 extent = btVector3(abs_b[0].dot(halfExtents),abs_b[1].dot(halfExtents),abs_b[2].dot(halfExtents));
-
- aabbMin = center - extent;
- aabbMax = center + extent;
- break;
- }
- case TRIANGLE_SHAPE_PROXYTYPE:
- {
- btTriangleShape* triangleShape = (btTriangleShape*)this;
- btScalar margin = triangleShape->getMarginNonVirtual();
- for (int i=0;i<3;i++)
- {
- btVector3 vec(btScalar(0.),btScalar(0.),btScalar(0.));
- vec[i] = btScalar(1.);
-
- btVector3 sv = localGetSupportVertexWithoutMarginNonVirtual(vec*t.getBasis());
-
- btVector3 tmp = t(sv);
- aabbMax[i] = tmp[i]+margin;
- vec[i] = btScalar(-1.);
- tmp = t(localGetSupportVertexWithoutMarginNonVirtual(vec*t.getBasis()));
- aabbMin[i] = tmp[i]-margin;
- }
- }
- break;
- case CAPSULE_SHAPE_PROXYTYPE:
- {
- btCapsuleShape* capsuleShape = (btCapsuleShape*)this;
- btVector3 halfExtents(capsuleShape->getRadius(),capsuleShape->getRadius(),capsuleShape->getRadius());
- int m_upAxis = capsuleShape->getUpAxis();
- halfExtents[m_upAxis] = capsuleShape->getRadius() + capsuleShape->getHalfHeight();
- halfExtents += btVector3(capsuleShape->getMarginNonVirtual(),capsuleShape->getMarginNonVirtual(),capsuleShape->getMarginNonVirtual());
- btMatrix3x3 abs_b = t.getBasis().absolute();
- btVector3 center = t.getOrigin();
- btVector3 extent = btVector3(abs_b[0].dot(halfExtents),abs_b[1].dot(halfExtents),abs_b[2].dot(halfExtents));
- aabbMin = center - extent;
- aabbMax = center + extent;
- }
- break;
- case CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE:
- case CONVEX_HULL_SHAPE_PROXYTYPE:
- {
- btPolyhedralConvexAabbCachingShape* convexHullShape = (btPolyhedralConvexAabbCachingShape*)this;
- btScalar margin = convexHullShape->getMarginNonVirtual();
- convexHullShape->getNonvirtualAabb (t, aabbMin, aabbMax, margin);
- }
- break;
- default:
-#ifndef __SPU__
- this->getAabb (t, aabbMin, aabbMax);
-#else
- btAssert (0);
-#endif
- break;
- }
-
- // should never reach here
- btAssert (0);
-}
-
-#endif //__SPU__
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btConvexShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btConvexShape.h
deleted file mode 100644
index 9c158259c1c..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btConvexShape.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef CONVEX_SHAPE_INTERFACE1
-#define CONVEX_SHAPE_INTERFACE1
-
-#include "btCollisionShape.h"
-
-#include "LinearMath/btVector3.h"
-#include "LinearMath/btTransform.h"
-#include "LinearMath/btMatrix3x3.h"
-#include "btCollisionMargin.h"
-#include "LinearMath/btAlignedAllocator.h"
-
-#define MAX_PREFERRED_PENETRATION_DIRECTIONS 10
-
-/// The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape, btConvexHullShape etc.
-/// It describes general convex shapes using the localGetSupportingVertex interface, used by collision detectors such as btGjkPairDetector.
-ATTRIBUTE_ALIGNED16(class) btConvexShape : public btCollisionShape
-{
-
-
-public:
-
- BT_DECLARE_ALIGNED_ALLOCATOR();
-
- btConvexShape ();
-
- virtual ~btConvexShape();
-
- virtual btVector3 localGetSupportingVertex(const btVector3& vec)const = 0;
-
- ////////
- #ifndef __SPU__
- virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec) const=0;
- #endif //#ifndef __SPU__
-
- btVector3 localGetSupportVertexWithoutMarginNonVirtual (const btVector3& vec) const;
- btVector3 localGetSupportVertexNonVirtual (const btVector3& vec) const;
- btScalar getMarginNonVirtual () const;
- void getAabbNonVirtual (const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const;
-
-
- //notice that the vectors should be unit length
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const= 0;
-
- ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
- void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const =0;
-
- virtual void getAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const =0;
-
- virtual void setLocalScaling(const btVector3& scaling) =0;
- virtual const btVector3& getLocalScaling() const =0;
-
- virtual void setMargin(btScalar margin)=0;
-
- virtual btScalar getMargin() const=0;
-
- virtual int getNumPreferredPenetrationDirections() const=0;
-
- virtual void getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const=0;
-
-
-
-
-};
-
-
-
-#endif //CONVEX_SHAPE_INTERFACE1
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.cpp
deleted file mode 100644
index 0f9ced554b8..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.cpp
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btConvexTriangleMeshShape.h"
-#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
-
-#include "LinearMath/btQuaternion.h"
-#include "BulletCollision/CollisionShapes/btStridingMeshInterface.h"
-
-
-btConvexTriangleMeshShape ::btConvexTriangleMeshShape (btStridingMeshInterface* meshInterface, bool calcAabb)
-: btPolyhedralConvexAabbCachingShape(), m_stridingMesh(meshInterface)
-{
- m_shapeType = CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE;
- if ( calcAabb )
- recalcLocalAabb();
-}
-
-
-
-
-///It's not nice to have all this virtual function overhead, so perhaps we can also gather the points once
-///but then we are duplicating
-class LocalSupportVertexCallback: public btInternalTriangleIndexCallback
-{
-
- btVector3 m_supportVertexLocal;
-public:
-
- btScalar m_maxDot;
- btVector3 m_supportVecLocal;
-
- LocalSupportVertexCallback(const btVector3& supportVecLocal)
- : m_supportVertexLocal(btScalar(0.),btScalar(0.),btScalar(0.)),
- m_maxDot(btScalar(-BT_LARGE_FLOAT)),
- m_supportVecLocal(supportVecLocal)
- {
- }
-
- virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
- {
- (void)triangleIndex;
- (void)partId;
-
- for (int i=0;i<3;i++)
- {
- btScalar dot = m_supportVecLocal.dot(triangle[i]);
- if (dot > m_maxDot)
- {
- m_maxDot = dot;
- m_supportVertexLocal = triangle[i];
- }
- }
- }
-
- btVector3 GetSupportVertexLocal()
- {
- return m_supportVertexLocal;
- }
-
-};
-
-
-
-
-
-btVector3 btConvexTriangleMeshShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
-{
- btVector3 supVec(btScalar(0.),btScalar(0.),btScalar(0.));
-
- btVector3 vec = vec0;
- btScalar lenSqr = vec.length2();
- if (lenSqr < btScalar(0.0001))
- {
- vec.setValue(1,0,0);
- } else
- {
- btScalar rlen = btScalar(1.) / btSqrt(lenSqr );
- vec *= rlen;
- }
-
- LocalSupportVertexCallback supportCallback(vec);
- btVector3 aabbMax(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT));
- m_stridingMesh->InternalProcessAllTriangles(&supportCallback,-aabbMax,aabbMax);
- supVec = supportCallback.GetSupportVertexLocal();
-
- return supVec;
-}
-
-void btConvexTriangleMeshShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
-{
- //use 'w' component of supportVerticesOut?
- {
- for (int i=0;i<numVectors;i++)
- {
- supportVerticesOut[i][3] = btScalar(-BT_LARGE_FLOAT);
- }
- }
-
- ///@todo: could do the batch inside the callback!
-
-
- for (int j=0;j<numVectors;j++)
- {
- const btVector3& vec = vectors[j];
- LocalSupportVertexCallback supportCallback(vec);
- btVector3 aabbMax(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT));
- m_stridingMesh->InternalProcessAllTriangles(&supportCallback,-aabbMax,aabbMax);
- supportVerticesOut[j] = supportCallback.GetSupportVertexLocal();
- }
-
-}
-
-
-
-btVector3 btConvexTriangleMeshShape::localGetSupportingVertex(const btVector3& vec)const
-{
- btVector3 supVertex = localGetSupportingVertexWithoutMargin(vec);
-
- if ( getMargin()!=btScalar(0.) )
- {
- btVector3 vecnorm = vec;
- if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
- {
- vecnorm.setValue(btScalar(-1.),btScalar(-1.),btScalar(-1.));
- }
- vecnorm.normalize();
- supVertex+= getMargin() * vecnorm;
- }
- return supVertex;
-}
-
-
-
-
-
-
-
-
-
-//currently just for debugging (drawing), perhaps future support for algebraic continuous collision detection
-//Please note that you can debug-draw btConvexTriangleMeshShape with the Raytracer Demo
-int btConvexTriangleMeshShape::getNumVertices() const
-{
- //cache this?
- return 0;
-
-}
-
-int btConvexTriangleMeshShape::getNumEdges() const
-{
- return 0;
-}
-
-void btConvexTriangleMeshShape::getEdge(int ,btVector3& ,btVector3& ) const
-{
- btAssert(0);
-}
-
-void btConvexTriangleMeshShape::getVertex(int ,btVector3& ) const
-{
- btAssert(0);
-}
-
-int btConvexTriangleMeshShape::getNumPlanes() const
-{
- return 0;
-}
-
-void btConvexTriangleMeshShape::getPlane(btVector3& ,btVector3& ,int ) const
-{
- btAssert(0);
-}
-
-//not yet
-bool btConvexTriangleMeshShape::isInside(const btVector3& ,btScalar ) const
-{
- btAssert(0);
- return false;
-}
-
-
-
-void btConvexTriangleMeshShape::setLocalScaling(const btVector3& scaling)
-{
- m_stridingMesh->setScaling(scaling);
-
- recalcLocalAabb();
-
-}
-
-
-const btVector3& btConvexTriangleMeshShape::getLocalScaling() const
-{
- return m_stridingMesh->getScaling();
-}
-
-void btConvexTriangleMeshShape::calculatePrincipalAxisTransform(btTransform& principal, btVector3& inertia, btScalar& volume) const
-{
- class CenterCallback: public btInternalTriangleIndexCallback
- {
- bool first;
- btVector3 ref;
- btVector3 sum;
- btScalar volume;
-
- public:
-
- CenterCallback() : first(true), ref(0, 0, 0), sum(0, 0, 0), volume(0)
- {
- }
-
- virtual void internalProcessTriangleIndex(btVector3* triangle, int partId, int triangleIndex)
- {
- (void) triangleIndex;
- (void) partId;
- if (first)
- {
- ref = triangle[0];
- first = false;
- }
- else
- {
- btScalar vol = btFabs((triangle[0] - ref).triple(triangle[1] - ref, triangle[2] - ref));
- sum += (btScalar(0.25) * vol) * ((triangle[0] + triangle[1] + triangle[2] + ref));
- volume += vol;
- }
- }
-
- btVector3 getCenter()
- {
- return (volume > 0) ? sum / volume : ref;
- }
-
- btScalar getVolume()
- {
- return volume * btScalar(1. / 6);
- }
-
- };
-
- class InertiaCallback: public btInternalTriangleIndexCallback
- {
- btMatrix3x3 sum;
- btVector3 center;
-
- public:
-
- InertiaCallback(btVector3& center) : sum(0, 0, 0, 0, 0, 0, 0, 0, 0), center(center)
- {
- }
-
- virtual void internalProcessTriangleIndex(btVector3* triangle, int partId, int triangleIndex)
- {
- (void) triangleIndex;
- (void) partId;
- btMatrix3x3 i;
- btVector3 a = triangle[0] - center;
- btVector3 b = triangle[1] - center;
- btVector3 c = triangle[2] - center;
- btScalar volNeg = -btFabs(a.triple(b, c)) * btScalar(1. / 6);
- for (int j = 0; j < 3; j++)
- {
- for (int k = 0; k <= j; k++)
- {
- i[j][k] = i[k][j] = volNeg * (btScalar(0.1) * (a[j] * a[k] + b[j] * b[k] + c[j] * c[k])
- + btScalar(0.05) * (a[j] * b[k] + a[k] * b[j] + a[j] * c[k] + a[k] * c[j] + b[j] * c[k] + b[k] * c[j]));
- }
- }
- btScalar i00 = -i[0][0];
- btScalar i11 = -i[1][1];
- btScalar i22 = -i[2][2];
- i[0][0] = i11 + i22;
- i[1][1] = i22 + i00;
- i[2][2] = i00 + i11;
- sum[0] += i[0];
- sum[1] += i[1];
- sum[2] += i[2];
- }
-
- btMatrix3x3& getInertia()
- {
- return sum;
- }
-
- };
-
- CenterCallback centerCallback;
- btVector3 aabbMax(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT));
- m_stridingMesh->InternalProcessAllTriangles(&centerCallback, -aabbMax, aabbMax);
- btVector3 center = centerCallback.getCenter();
- principal.setOrigin(center);
- volume = centerCallback.getVolume();
-
- InertiaCallback inertiaCallback(center);
- m_stridingMesh->InternalProcessAllTriangles(&inertiaCallback, -aabbMax, aabbMax);
-
- btMatrix3x3& i = inertiaCallback.getInertia();
- i.diagonalize(principal.getBasis(), btScalar(0.00001), 20);
- inertia.setValue(i[0][0], i[1][1], i[2][2]);
- inertia /= volume;
-}
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h
deleted file mode 100644
index f5167e74b80..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-#ifndef CONVEX_TRIANGLEMESH_SHAPE_H
-#define CONVEX_TRIANGLEMESH_SHAPE_H
-
-
-#include "btPolyhedralConvexShape.h"
-#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
-
-
-/// The btConvexTriangleMeshShape is a convex hull of a triangle mesh, but the performance is not as good as btConvexHullShape.
-/// 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.
-class btConvexTriangleMeshShape : public btPolyhedralConvexAabbCachingShape
-{
-
- class btStridingMeshInterface* m_stridingMesh;
-
-public:
- btConvexTriangleMeshShape(btStridingMeshInterface* meshInterface, bool calcAabb = true);
-
- class btStridingMeshInterface* getMeshInterface()
- {
- return m_stridingMesh;
- }
- const class btStridingMeshInterface* getMeshInterface() const
- {
- return m_stridingMesh;
- }
-
- virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
- virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
-
- //debugging
- virtual const char* getName()const {return "ConvexTrimesh";}
-
- virtual int getNumVertices() const;
- virtual int getNumEdges() const;
- virtual void getEdge(int i,btVector3& pa,btVector3& pb) const;
- virtual void getVertex(int i,btVector3& vtx) const;
- virtual int getNumPlanes() const;
- virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const;
- virtual bool isInside(const btVector3& pt,btScalar tolerance) const;
-
-
- virtual void setLocalScaling(const btVector3& scaling);
- virtual const btVector3& getLocalScaling() const;
-
- ///computes the exact moment of inertia and the transform from the coordinate system defined by the principal axes of the moment of inertia
- ///and the center of mass to the current coordinate system. A mass of 1 is assumed, for other masses just multiply the computed "inertia"
- ///by the mass. The resulting transform "principal" has to be applied inversely to the mesh in order for the local coordinate system of the
- ///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
- ///of the collision object by the principal transform. This method also computes the volume of the convex mesh.
- void calculatePrincipalAxisTransform(btTransform& principal, btVector3& inertia, btScalar& volume) const;
-
-};
-
-
-
-#endif //CONVEX_TRIANGLEMESH_SHAPE_H
-
-
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btCylinderShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btCylinderShape.cpp
deleted file mode 100644
index 26880930479..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btCylinderShape.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btCylinderShape.h"
-
-btCylinderShape::btCylinderShape (const btVector3& halfExtents)
-:btConvexInternalShape(),
-m_upAxis(1)
-{
- btVector3 margin(getMargin(),getMargin(),getMargin());
- m_implicitShapeDimensions = (halfExtents * m_localScaling) - margin;
- m_shapeType = CYLINDER_SHAPE_PROXYTYPE;
-}
-
-
-btCylinderShapeX::btCylinderShapeX (const btVector3& halfExtents)
-:btCylinderShape(halfExtents)
-{
- m_upAxis = 0;
-
-}
-
-
-btCylinderShapeZ::btCylinderShapeZ (const btVector3& halfExtents)
-:btCylinderShape(halfExtents)
-{
- m_upAxis = 2;
-
-}
-
-void btCylinderShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
-{
- btTransformAabb(getHalfExtentsWithoutMargin(),getMargin(),t,aabbMin,aabbMax);
-}
-
-void btCylinderShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
-{
- //approximation of box shape, todo: implement cylinder shape inertia before people notice ;-)
- btVector3 halfExtents = getHalfExtentsWithMargin();
-
- btScalar lx=btScalar(2.)*(halfExtents.x());
- btScalar ly=btScalar(2.)*(halfExtents.y());
- btScalar lz=btScalar(2.)*(halfExtents.z());
-
- inertia.setValue(mass/(btScalar(12.0)) * (ly*ly + lz*lz),
- mass/(btScalar(12.0)) * (lx*lx + lz*lz),
- mass/(btScalar(12.0)) * (lx*lx + ly*ly));
-
-}
-
-
-SIMD_FORCE_INLINE btVector3 CylinderLocalSupportX(const btVector3& halfExtents,const btVector3& v)
-{
-const int cylinderUpAxis = 0;
-const int XX = 1;
-const int YY = 0;
-const int ZZ = 2;
-
- //mapping depends on how cylinder local orientation is
- // extents of the cylinder is: X,Y is for radius, and Z for height
-
-
- btScalar radius = halfExtents[XX];
- btScalar halfHeight = halfExtents[cylinderUpAxis];
-
-
- btVector3 tmp;
- btScalar d ;
-
- btScalar s = btSqrt(v[XX] * v[XX] + v[ZZ] * v[ZZ]);
- if (s != btScalar(0.0))
- {
- d = radius / s;
- tmp[XX] = v[XX] * d;
- tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
- tmp[ZZ] = v[ZZ] * d;
- return tmp;
- }
- else
- {
- tmp[XX] = radius;
- tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
- tmp[ZZ] = btScalar(0.0);
- return tmp;
- }
-
-
-}
-
-
-
-
-
-
-inline btVector3 CylinderLocalSupportY(const btVector3& halfExtents,const btVector3& v)
-{
-
-const int cylinderUpAxis = 1;
-const int XX = 0;
-const int YY = 1;
-const int ZZ = 2;
-
-
- btScalar radius = halfExtents[XX];
- btScalar halfHeight = halfExtents[cylinderUpAxis];
-
-
- btVector3 tmp;
- btScalar d ;
-
- btScalar s = btSqrt(v[XX] * v[XX] + v[ZZ] * v[ZZ]);
- if (s != btScalar(0.0))
- {
- d = radius / s;
- tmp[XX] = v[XX] * d;
- tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
- tmp[ZZ] = v[ZZ] * d;
- return tmp;
- }
- else
- {
- tmp[XX] = radius;
- tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
- tmp[ZZ] = btScalar(0.0);
- return tmp;
- }
-
-}
-
-inline btVector3 CylinderLocalSupportZ(const btVector3& halfExtents,const btVector3& v)
-{
-const int cylinderUpAxis = 2;
-const int XX = 0;
-const int YY = 2;
-const int ZZ = 1;
-
- //mapping depends on how cylinder local orientation is
- // extents of the cylinder is: X,Y is for radius, and Z for height
-
-
- btScalar radius = halfExtents[XX];
- btScalar halfHeight = halfExtents[cylinderUpAxis];
-
-
- btVector3 tmp;
- btScalar d ;
-
- btScalar s = btSqrt(v[XX] * v[XX] + v[ZZ] * v[ZZ]);
- if (s != btScalar(0.0))
- {
- d = radius / s;
- tmp[XX] = v[XX] * d;
- tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
- tmp[ZZ] = v[ZZ] * d;
- return tmp;
- }
- else
- {
- tmp[XX] = radius;
- tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight;
- tmp[ZZ] = btScalar(0.0);
- return tmp;
- }
-
-
-}
-
-btVector3 btCylinderShapeX::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
-{
- return CylinderLocalSupportX(getHalfExtentsWithoutMargin(),vec);
-}
-
-
-btVector3 btCylinderShapeZ::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
-{
- return CylinderLocalSupportZ(getHalfExtentsWithoutMargin(),vec);
-}
-btVector3 btCylinderShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
-{
- return CylinderLocalSupportY(getHalfExtentsWithoutMargin(),vec);
-}
-
-void btCylinderShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
-{
- for (int i=0;i<numVectors;i++)
- {
- supportVerticesOut[i] = CylinderLocalSupportY(getHalfExtentsWithoutMargin(),vectors[i]);
- }
-}
-
-void btCylinderShapeZ::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
-{
- for (int i=0;i<numVectors;i++)
- {
- supportVerticesOut[i] = CylinderLocalSupportZ(getHalfExtentsWithoutMargin(),vectors[i]);
- }
-}
-
-
-
-
-void btCylinderShapeX::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
-{
- for (int i=0;i<numVectors;i++)
- {
- supportVerticesOut[i] = CylinderLocalSupportX(getHalfExtentsWithoutMargin(),vectors[i]);
- }
-}
-
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btCylinderShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btCylinderShape.h
deleted file mode 100644
index 5b92b09f610..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btCylinderShape.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef CYLINDER_MINKOWSKI_H
-#define CYLINDER_MINKOWSKI_H
-
-#include "btBoxShape.h"
-#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
-#include "LinearMath/btVector3.h"
-
-/// The btCylinderShape class implements a cylinder shape primitive, centered around the origin. Its central axis aligned with the Y axis. btCylinderShapeX is aligned with the X axis and btCylinderShapeZ around the Z axis.
-class btCylinderShape : public btConvexInternalShape
-
-{
-
-protected:
-
- int m_upAxis;
-
-public:
-
- btVector3 getHalfExtentsWithMargin() const
- {
- btVector3 halfExtents = getHalfExtentsWithoutMargin();
- btVector3 margin(getMargin(),getMargin(),getMargin());
- halfExtents += margin;
- return halfExtents;
- }
-
- const btVector3& getHalfExtentsWithoutMargin() const
- {
- return m_implicitShapeDimensions;//changed in Bullet 2.63: assume the scaling and margin are included
- }
-
- btCylinderShape (const btVector3& halfExtents);
-
- void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
-
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
-
- virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
-
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
-
- virtual void setMargin(btScalar collisionMargin)
- {
- //correct the m_implicitShapeDimensions for the margin
- btVector3 oldMargin(getMargin(),getMargin(),getMargin());
- btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin;
-
- btConvexInternalShape::setMargin(collisionMargin);
- btVector3 newMargin(getMargin(),getMargin(),getMargin());
- m_implicitShapeDimensions = implicitShapeDimensionsWithMargin - newMargin;
-
- }
-
- virtual btVector3 localGetSupportingVertex(const btVector3& vec) const
- {
-
- btVector3 supVertex;
- supVertex = localGetSupportingVertexWithoutMargin(vec);
-
- if ( getMargin()!=btScalar(0.) )
- {
- btVector3 vecnorm = vec;
- if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
- {
- vecnorm.setValue(btScalar(-1.),btScalar(-1.),btScalar(-1.));
- }
- vecnorm.normalize();
- supVertex+= getMargin() * vecnorm;
- }
- return supVertex;
- }
-
-
- //use box inertia
- // virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
-
-
- int getUpAxis() const
- {
- return m_upAxis;
- }
-
- virtual btScalar getRadius() const
- {
- return getHalfExtentsWithMargin().getX();
- }
-
- //debugging
- virtual const char* getName()const
- {
- return "CylinderY";
- }
-
- virtual int calculateSerializeBufferSize() const;
-
- ///fills the dataBuffer and returns the struct name (and 0 on failure)
- virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
-
-};
-
-class btCylinderShapeX : public btCylinderShape
-{
-public:
- btCylinderShapeX (const btVector3& halfExtents);
-
- virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
-
- //debugging
- virtual const char* getName()const
- {
- return "CylinderX";
- }
-
- virtual btScalar getRadius() const
- {
- return getHalfExtentsWithMargin().getY();
- }
-
-};
-
-class btCylinderShapeZ : public btCylinderShape
-{
-public:
- btCylinderShapeZ (const btVector3& halfExtents);
-
- virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
-
- virtual int getUpAxis() const
- {
- return 2;
- }
- //debugging
- virtual const char* getName()const
- {
- return "CylinderZ";
- }
-
- virtual btScalar getRadius() const
- {
- return getHalfExtentsWithMargin().getX();
- }
-
-};
-
-///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
-struct btCylinderShapeData
-{
- btConvexInternalShapeData m_convexInternalShapeData;
-
- int m_upAxis;
-
- char m_padding[4];
-};
-
-SIMD_FORCE_INLINE int btCylinderShape::calculateSerializeBufferSize() const
-{
- return sizeof(btCylinderShapeData);
-}
-
- ///fills the dataBuffer and returns the struct name (and 0 on failure)
-SIMD_FORCE_INLINE const char* btCylinderShape::serialize(void* dataBuffer, btSerializer* serializer) const
-{
- btCylinderShapeData* shapeData = (btCylinderShapeData*) dataBuffer;
-
- btConvexInternalShape::serialize(&shapeData->m_convexInternalShapeData,serializer);
-
- shapeData->m_upAxis = m_upAxis;
-
- return "btCylinderShapeData";
-}
-
-
-
-#endif //CYLINDER_MINKOWSKI_H
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btEmptyShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btEmptyShape.cpp
deleted file mode 100644
index a9e6df5c58e..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btEmptyShape.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btEmptyShape.h"
-
-
-#include "btCollisionShape.h"
-
-
-btEmptyShape::btEmptyShape() : btConcaveShape ()
-{
- m_shapeType = EMPTY_SHAPE_PROXYTYPE;
-}
-
-
-btEmptyShape::~btEmptyShape()
-{
-}
-
-
- ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
-void btEmptyShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
-{
- btVector3 margin(getMargin(),getMargin(),getMargin());
-
- aabbMin = t.getOrigin() - margin;
-
- aabbMax = t.getOrigin() + margin;
-
-}
-
-void btEmptyShape::calculateLocalInertia(btScalar ,btVector3& ) const
-{
- btAssert(0);
-}
-
-
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btEmptyShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btEmptyShape.h
deleted file mode 100644
index 9f6b4435c29..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btEmptyShape.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef EMPTY_SHAPE_H
-#define EMPTY_SHAPE_H
-
-#include "btConcaveShape.h"
-
-#include "LinearMath/btVector3.h"
-#include "LinearMath/btTransform.h"
-#include "LinearMath/btMatrix3x3.h"
-#include "btCollisionMargin.h"
-
-
-
-
-/// The btEmptyShape is a collision shape without actual collision detection shape, so most users should ignore this class.
-/// It can be replaced by another shape during runtime, but the inertia tensor should be recomputed.
-class btEmptyShape : public btConcaveShape
-{
-public:
- btEmptyShape();
-
- virtual ~btEmptyShape();
-
-
- ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
- void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
-
-
- virtual void setLocalScaling(const btVector3& scaling)
- {
- m_localScaling = scaling;
- }
- virtual const btVector3& getLocalScaling() const
- {
- return m_localScaling;
- }
-
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
-
- virtual const char* getName()const
- {
- return "Empty";
- }
-
- virtual void processAllTriangles(btTriangleCallback* ,const btVector3& ,const btVector3& ) const
- {
- }
-
-protected:
- btVector3 m_localScaling;
-
-};
-
-
-
-#endif //EMPTY_SHAPE_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp
deleted file mode 100644
index 3a1e6f4a2b9..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp
+++ /dev/null
@@ -1,411 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btHeightfieldTerrainShape.h"
-
-#include "LinearMath/btTransformUtil.h"
-
-
-
-btHeightfieldTerrainShape::btHeightfieldTerrainShape
-(
-int heightStickWidth, int heightStickLength, void* heightfieldData,
-btScalar heightScale, btScalar minHeight, btScalar maxHeight,int upAxis,
-PHY_ScalarType hdt, bool flipQuadEdges
-)
-{
- initialize(heightStickWidth, heightStickLength, heightfieldData,
- heightScale, minHeight, maxHeight, upAxis, hdt,
- flipQuadEdges);
-}
-
-
-
-btHeightfieldTerrainShape::btHeightfieldTerrainShape(int heightStickWidth, int heightStickLength,void* heightfieldData,btScalar maxHeight,int upAxis,bool useFloatData,bool flipQuadEdges)
-{
- // legacy constructor: support only float or unsigned char,
- // and min height is zero
- PHY_ScalarType hdt = (useFloatData) ? PHY_FLOAT : PHY_UCHAR;
- btScalar minHeight = 0.0;
-
- // previously, height = uchar * maxHeight / 65535.
- // So to preserve legacy behavior, heightScale = maxHeight / 65535
- btScalar heightScale = maxHeight / 65535;
-
- initialize(heightStickWidth, heightStickLength, heightfieldData,
- heightScale, minHeight, maxHeight, upAxis, hdt,
- flipQuadEdges);
-}
-
-
-
-void btHeightfieldTerrainShape::initialize
-(
-int heightStickWidth, int heightStickLength, void* heightfieldData,
-btScalar heightScale, btScalar minHeight, btScalar maxHeight, int upAxis,
-PHY_ScalarType hdt, bool flipQuadEdges
-)
-{
- // validation
- btAssert(heightStickWidth > 1 && "bad width");
- btAssert(heightStickLength > 1 && "bad length");
- btAssert(heightfieldData && "null heightfield data");
- // btAssert(heightScale) -- do we care? Trust caller here
- btAssert(minHeight <= maxHeight && "bad min/max height");
- btAssert(upAxis >= 0 && upAxis < 3 &&
- "bad upAxis--should be in range [0,2]");
- btAssert(hdt != PHY_UCHAR || hdt != PHY_FLOAT || hdt != PHY_SHORT &&
- "Bad height data type enum");
-
- // initialize member variables
- m_shapeType = TERRAIN_SHAPE_PROXYTYPE;
- m_heightStickWidth = heightStickWidth;
- m_heightStickLength = heightStickLength;
- m_minHeight = minHeight;
- m_maxHeight = maxHeight;
- m_width = (btScalar) (heightStickWidth - 1);
- m_length = (btScalar) (heightStickLength - 1);
- m_heightScale = heightScale;
- m_heightfieldDataUnknown = heightfieldData;
- m_heightDataType = hdt;
- m_flipQuadEdges = flipQuadEdges;
- m_useDiamondSubdivision = false;
- m_upAxis = upAxis;
- m_localScaling.setValue(btScalar(1.), btScalar(1.), btScalar(1.));
-
- // determine min/max axis-aligned bounding box (aabb) values
- switch (m_upAxis)
- {
- case 0:
- {
- m_localAabbMin.setValue(m_minHeight, 0, 0);
- m_localAabbMax.setValue(m_maxHeight, m_width, m_length);
- break;
- }
- case 1:
- {
- m_localAabbMin.setValue(0, m_minHeight, 0);
- m_localAabbMax.setValue(m_width, m_maxHeight, m_length);
- break;
- };
- case 2:
- {
- m_localAabbMin.setValue(0, 0, m_minHeight);
- m_localAabbMax.setValue(m_width, m_length, m_maxHeight);
- break;
- }
- default:
- {
- //need to get valid m_upAxis
- btAssert(0 && "Bad m_upAxis");
- }
- }
-
- // remember origin (defined as exact middle of aabb)
- m_localOrigin = btScalar(0.5) * (m_localAabbMin + m_localAabbMax);
-}
-
-
-
-btHeightfieldTerrainShape::~btHeightfieldTerrainShape()
-{
-}
-
-
-
-void btHeightfieldTerrainShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
-{
- btVector3 halfExtents = (m_localAabbMax-m_localAabbMin)* m_localScaling * btScalar(0.5);
-
- btVector3 localOrigin(0, 0, 0);
- localOrigin[m_upAxis] = (m_minHeight + m_maxHeight) * btScalar(0.5);
- localOrigin *= m_localScaling;
-
- btMatrix3x3 abs_b = t.getBasis().absolute();
- btVector3 center = t.getOrigin();
- btVector3 extent = btVector3(abs_b[0].dot(halfExtents),
- abs_b[1].dot(halfExtents),
- abs_b[2].dot(halfExtents));
- extent += btVector3(getMargin(),getMargin(),getMargin());
-
- aabbMin = center - extent;
- aabbMax = center + extent;
-}
-
-
-/// This returns the "raw" (user's initial) height, not the actual height.
-/// The actual height needs to be adjusted to be relative to the center
-/// of the heightfield's AABB.
-btScalar
-btHeightfieldTerrainShape::getRawHeightFieldValue(int x,int y) const
-{
- btScalar val = 0.f;
- switch (m_heightDataType)
- {
- case PHY_FLOAT:
- {
- val = m_heightfieldDataFloat[(y*m_heightStickWidth)+x];
- break;
- }
-
- case PHY_UCHAR:
- {
- unsigned char heightFieldValue = m_heightfieldDataUnsignedChar[(y*m_heightStickWidth)+x];
- val = heightFieldValue * m_heightScale;
- break;
- }
-
- case PHY_SHORT:
- {
- short hfValue = m_heightfieldDataShort[(y * m_heightStickWidth) + x];
- val = hfValue * m_heightScale;
- break;
- }
-
- default:
- {
- btAssert(!"Bad m_heightDataType");
- }
- }
-
- return val;
-}
-
-
-
-
-/// this returns the vertex in bullet-local coordinates
-void btHeightfieldTerrainShape::getVertex(int x,int y,btVector3& vertex) const
-{
- btAssert(x>=0);
- btAssert(y>=0);
- btAssert(x<m_heightStickWidth);
- btAssert(y<m_heightStickLength);
-
- btScalar height = getRawHeightFieldValue(x,y);
-
- switch (m_upAxis)
- {
- case 0:
- {
- vertex.setValue(
- height - m_localOrigin.getX(),
- (-m_width/btScalar(2.0)) + x,
- (-m_length/btScalar(2.0) ) + y
- );
- break;
- }
- case 1:
- {
- vertex.setValue(
- (-m_width/btScalar(2.0)) + x,
- height - m_localOrigin.getY(),
- (-m_length/btScalar(2.0)) + y
- );
- break;
- };
- case 2:
- {
- vertex.setValue(
- (-m_width/btScalar(2.0)) + x,
- (-m_length/btScalar(2.0)) + y,
- height - m_localOrigin.getZ()
- );
- break;
- }
- default:
- {
- //need to get valid m_upAxis
- btAssert(0);
- }
- }
-
- vertex*=m_localScaling;
-}
-
-
-
-static inline int
-getQuantized
-(
-btScalar x
-)
-{
- if (x < 0.0) {
- return (int) (x - 0.5);
- }
- return (int) (x + 0.5);
-}
-
-
-
-/// given input vector, return quantized version
-/**
- This routine is basically determining the gridpoint indices for a given
- input vector, answering the question: "which gridpoint is closest to the
- provided point?".
-
- "with clamp" means that we restrict the point to be in the heightfield's
- axis-aligned bounding box.
- */
-void btHeightfieldTerrainShape::quantizeWithClamp(int* out, const btVector3& point,int /*isMax*/) const
-{
- btVector3 clampedPoint(point);
- clampedPoint.setMax(m_localAabbMin);
- clampedPoint.setMin(m_localAabbMax);
-
- out[0] = getQuantized(clampedPoint.getX());
- out[1] = getQuantized(clampedPoint.getY());
- out[2] = getQuantized(clampedPoint.getZ());
-
-}
-
-
-
-/// process all triangles within the provided axis-aligned bounding box
-/**
- basic algorithm:
- - convert input aabb to local coordinates (scale down and shift for local origin)
- - convert input aabb to a range of heightfield grid points (quantize)
- - iterate over all triangles in that subset of the grid
- */
-void btHeightfieldTerrainShape::processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
-{
- // scale down the input aabb's so they are in local (non-scaled) coordinates
- btVector3 localAabbMin = aabbMin*btVector3(1.f/m_localScaling[0],1.f/m_localScaling[1],1.f/m_localScaling[2]);
- btVector3 localAabbMax = aabbMax*btVector3(1.f/m_localScaling[0],1.f/m_localScaling[1],1.f/m_localScaling[2]);
-
- // account for local origin
- localAabbMin += m_localOrigin;
- localAabbMax += m_localOrigin;
-
- //quantize the aabbMin and aabbMax, and adjust the start/end ranges
- int quantizedAabbMin[3];
- int quantizedAabbMax[3];
- quantizeWithClamp(quantizedAabbMin, localAabbMin,0);
- quantizeWithClamp(quantizedAabbMax, localAabbMax,1);
-
- // expand the min/max quantized values
- // this is to catch the case where the input aabb falls between grid points!
- for (int i = 0; i < 3; ++i) {
- quantizedAabbMin[i]--;
- quantizedAabbMax[i]++;
- }
-
- int startX=0;
- int endX=m_heightStickWidth-1;
- int startJ=0;
- int endJ=m_heightStickLength-1;
-
- switch (m_upAxis)
- {
- case 0:
- {
- if (quantizedAabbMin[1]>startX)
- startX = quantizedAabbMin[1];
- if (quantizedAabbMax[1]<endX)
- endX = quantizedAabbMax[1];
- if (quantizedAabbMin[2]>startJ)
- startJ = quantizedAabbMin[2];
- if (quantizedAabbMax[2]<endJ)
- endJ = quantizedAabbMax[2];
- break;
- }
- case 1:
- {
- if (quantizedAabbMin[0]>startX)
- startX = quantizedAabbMin[0];
- if (quantizedAabbMax[0]<endX)
- endX = quantizedAabbMax[0];
- if (quantizedAabbMin[2]>startJ)
- startJ = quantizedAabbMin[2];
- if (quantizedAabbMax[2]<endJ)
- endJ = quantizedAabbMax[2];
- break;
- };
- case 2:
- {
- if (quantizedAabbMin[0]>startX)
- startX = quantizedAabbMin[0];
- if (quantizedAabbMax[0]<endX)
- endX = quantizedAabbMax[0];
- if (quantizedAabbMin[1]>startJ)
- startJ = quantizedAabbMin[1];
- if (quantizedAabbMax[1]<endJ)
- endJ = quantizedAabbMax[1];
- break;
- }
- default:
- {
- //need to get valid m_upAxis
- btAssert(0);
- }
- }
-
-
-
-
- for(int j=startJ; j<endJ; j++)
- {
- for(int x=startX; x<endX; x++)
- {
- btVector3 vertices[3];
- if (m_flipQuadEdges || (m_useDiamondSubdivision && !((j+x) & 1)))
- {
- //first triangle
- getVertex(x,j,vertices[0]);
- getVertex(x+1,j,vertices[1]);
- getVertex(x+1,j+1,vertices[2]);
- callback->processTriangle(vertices,x,j);
- //second triangle
- getVertex(x,j,vertices[0]);
- getVertex(x+1,j+1,vertices[1]);
- getVertex(x,j+1,vertices[2]);
- callback->processTriangle(vertices,x,j);
- } else
- {
- //first triangle
- getVertex(x,j,vertices[0]);
- getVertex(x,j+1,vertices[1]);
- getVertex(x+1,j,vertices[2]);
- callback->processTriangle(vertices,x,j);
- //second triangle
- getVertex(x+1,j,vertices[0]);
- getVertex(x,j+1,vertices[1]);
- getVertex(x+1,j+1,vertices[2]);
- callback->processTriangle(vertices,x,j);
- }
- }
- }
-
-
-
-}
-
-void btHeightfieldTerrainShape::calculateLocalInertia(btScalar ,btVector3& inertia) const
-{
- //moving concave objects not supported
-
- inertia.setValue(btScalar(0.),btScalar(0.),btScalar(0.));
-}
-
-void btHeightfieldTerrainShape::setLocalScaling(const btVector3& scaling)
-{
- m_localScaling = scaling;
-}
-const btVector3& btHeightfieldTerrainShape::getLocalScaling() const
-{
- return m_localScaling;
-}
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h
deleted file mode 100644
index 4f5d1e35bf3..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef HEIGHTFIELD_TERRAIN_SHAPE_H
-#define HEIGHTFIELD_TERRAIN_SHAPE_H
-
-#include "btConcaveShape.h"
-
-///btHeightfieldTerrainShape simulates a 2D heightfield terrain
-/**
- The caller is responsible for maintaining the heightfield array; this
- class does not make a copy.
-
- The heightfield can be dynamic so long as the min/max height values
- capture the extremes (heights must always be in that range).
-
- The local origin of the heightfield is assumed to be the exact
- center (as determined by width and length and height, with each
- axis multiplied by the localScaling).
-
- \b NOTE: be careful with coordinates. If you have a heightfield with a local
- min height of -100m, and a max height of +500m, you may be tempted to place it
- at the origin (0,0) and expect the heights in world coordinates to be
- -100 to +500 meters.
- Actually, the heights will be -300 to +300m, because bullet will re-center
- the heightfield based on its AABB (which is determined by the min/max
- heights). So keep in mind that once you create a btHeightfieldTerrainShape
- object, the heights will be adjusted relative to the center of the AABB. This
- is different to the behavior of many rendering engines, but is useful for
- physics engines.
-
- Most (but not all) rendering and heightfield libraries assume upAxis = 1
- (that is, the y-axis is "up"). This class allows any of the 3 coordinates
- to be "up". Make sure your choice of axis is consistent with your rendering
- system.
-
- The heightfield heights are determined from the data type used for the
- heightfieldData array.
-
- - PHY_UCHAR: height at a point is the uchar value at the
- grid point, multipled by heightScale. uchar isn't recommended
- because of its inability to deal with negative values, and
- low resolution (8-bit).
-
- - PHY_SHORT: height at a point is the short int value at that grid
- point, multipled by heightScale.
-
- - PHY_FLOAT: height at a point is the float value at that grid
- point. heightScale is ignored when using the float heightfield
- data type.
-
- Whatever the caller specifies as minHeight and maxHeight will be honored.
- The class will not inspect the heightfield to discover the actual minimum
- or maximum heights. These values are used to determine the heightfield's
- axis-aligned bounding box, multiplied by localScaling.
-
- For usage and testing see the TerrainDemo.
- */
-class btHeightfieldTerrainShape : public btConcaveShape
-{
-protected:
- btVector3 m_localAabbMin;
- btVector3 m_localAabbMax;
- btVector3 m_localOrigin;
-
- ///terrain data
- int m_heightStickWidth;
- int m_heightStickLength;
- btScalar m_minHeight;
- btScalar m_maxHeight;
- btScalar m_width;
- btScalar m_length;
- btScalar m_heightScale;
- union
- {
- unsigned char* m_heightfieldDataUnsignedChar;
- short* m_heightfieldDataShort;
- btScalar* m_heightfieldDataFloat;
- void* m_heightfieldDataUnknown;
- };
-
- PHY_ScalarType m_heightDataType;
- bool m_flipQuadEdges;
- bool m_useDiamondSubdivision;
-
- int m_upAxis;
-
- btVector3 m_localScaling;
-
- virtual btScalar getRawHeightFieldValue(int x,int y) const;
- void quantizeWithClamp(int* out, const btVector3& point,int isMax) const;
- void getVertex(int x,int y,btVector3& vertex) const;
-
-
-
- /// protected initialization
- /**
- Handles the work of constructors so that public constructors can be
- backwards-compatible without a lot of copy/paste.
- */
- void initialize(int heightStickWidth, int heightStickLength,
- void* heightfieldData, btScalar heightScale,
- btScalar minHeight, btScalar maxHeight, int upAxis,
- PHY_ScalarType heightDataType, bool flipQuadEdges);
-
-public:
- /// preferred constructor
- /**
- This constructor supports a range of heightfield
- data types, and allows for a non-zero minimum height value.
- heightScale is needed for any integer-based heightfield data types.
- */
- btHeightfieldTerrainShape(int heightStickWidth,int heightStickLength,
- void* heightfieldData, btScalar heightScale,
- btScalar minHeight, btScalar maxHeight,
- int upAxis, PHY_ScalarType heightDataType,
- bool flipQuadEdges);
-
- /// legacy constructor
- /**
- The legacy constructor assumes the heightfield has a minimum height
- of zero. Only unsigned char or floats are supported. For legacy
- compatibility reasons, heightScale is calculated as maxHeight / 65535
- (and is only used when useFloatData = false).
- */
- btHeightfieldTerrainShape(int heightStickWidth,int heightStickLength,void* heightfieldData, btScalar maxHeight,int upAxis,bool useFloatData,bool flipQuadEdges);
-
- virtual ~btHeightfieldTerrainShape();
-
-
- void setUseDiamondSubdivision(bool useDiamondSubdivision=true) { m_useDiamondSubdivision = useDiamondSubdivision;}
-
-
- virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
-
- virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
-
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
-
- virtual void setLocalScaling(const btVector3& scaling);
-
- virtual const btVector3& getLocalScaling() const;
-
- //debugging
- virtual const char* getName()const {return "HEIGHTFIELD";}
-
-};
-
-#endif //HEIGHTFIELD_TERRAIN_SHAPE_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btMaterial.h b/extern/bullet2/BulletCollision/CollisionShapes/btMaterial.h
deleted file mode 100644
index 030e167da50..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btMaterial.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-/// This file was created by Alex Silverman
-
-#ifndef MATERIAL_H
-#define MATERIAL_H
-
-// Material class to be used by btMultimaterialTriangleMeshShape to store triangle properties
-class btMaterial
-{
- // public members so that materials can change due to world events
-public:
- btScalar m_friction;
- btScalar m_restitution;
- int pad[2];
-
- btMaterial(){}
- btMaterial(btScalar fric, btScalar rest) { m_friction = fric; m_restitution = rest; }
-};
-
-#endif // MATERIAL_H
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp
deleted file mode 100644
index 06707e24e55..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-
-#include "btMinkowskiSumShape.h"
-
-
-btMinkowskiSumShape::btMinkowskiSumShape(const btConvexShape* shapeA,const btConvexShape* shapeB)
-: btConvexInternalShape (),
-m_shapeA(shapeA),
-m_shapeB(shapeB)
-{
- m_shapeType = MINKOWSKI_DIFFERENCE_SHAPE_PROXYTYPE;
- m_transA.setIdentity();
- m_transB.setIdentity();
-}
-
-btVector3 btMinkowskiSumShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
-{
- btVector3 supVertexA = m_transA(m_shapeA->localGetSupportingVertexWithoutMargin(vec*m_transA.getBasis()));
- btVector3 supVertexB = m_transB(m_shapeB->localGetSupportingVertexWithoutMargin(-vec*m_transB.getBasis()));
- return supVertexA - supVertexB;
-}
-
-void btMinkowskiSumShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
-{
- ///@todo: could make recursive use of batching. probably this shape is not used frequently.
- for (int i=0;i<numVectors;i++)
- {
- supportVerticesOut[i] = localGetSupportingVertexWithoutMargin(vectors[i]);
- }
-
-}
-
-
-
-btScalar btMinkowskiSumShape::getMargin() const
-{
- return m_shapeA->getMargin() + m_shapeB->getMargin();
-}
-
-
-void btMinkowskiSumShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
-{
- (void)mass;
- btAssert(0);
- inertia.setValue(0,0,0);
-}
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btMinkowskiSumShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btMinkowskiSumShape.h
deleted file mode 100644
index d6fd040213b..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btMinkowskiSumShape.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef MINKOWSKI_SUM_SHAPE_H
-#define MINKOWSKI_SUM_SHAPE_H
-
-#include "btConvexInternalShape.h"
-#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
-
-/// The btMinkowskiSumShape is only for advanced users. This shape represents implicit based minkowski sum of two convex implicit shapes.
-class btMinkowskiSumShape : public btConvexInternalShape
-{
-
- btTransform m_transA;
- btTransform m_transB;
- const btConvexShape* m_shapeA;
- const btConvexShape* m_shapeB;
-
-public:
-
- btMinkowskiSumShape(const btConvexShape* shapeA,const btConvexShape* shapeB);
-
- virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
-
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
-
-
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
-
- void setTransformA(const btTransform& transA) { m_transA = transA;}
- void setTransformB(const btTransform& transB) { m_transB = transB;}
-
- const btTransform& getTransformA()const { return m_transA;}
- const btTransform& GetTransformB()const { return m_transB;}
-
-
- virtual btScalar getMargin() const;
-
- const btConvexShape* getShapeA() const { return m_shapeA;}
- const btConvexShape* getShapeB() const { return m_shapeB;}
-
- virtual const char* getName()const
- {
- return "MinkowskiSum";
- }
-};
-
-#endif //MINKOWSKI_SUM_SHAPE_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btMultiSphereShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btMultiSphereShape.cpp
deleted file mode 100644
index c996bfcdaba..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btMultiSphereShape.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-
-
-#include "btMultiSphereShape.h"
-#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
-#include "LinearMath/btQuaternion.h"
-#include "LinearMath/btSerializer.h"
-
-btMultiSphereShape::btMultiSphereShape (const btVector3* positions,const btScalar* radi,int numSpheres)
-:btConvexInternalAabbCachingShape ()
-{
- m_shapeType = MULTI_SPHERE_SHAPE_PROXYTYPE;
- //btScalar startMargin = btScalar(BT_LARGE_FLOAT);
-
- m_localPositionArray.resize(numSpheres);
- m_radiArray.resize(numSpheres);
- for (int i=0;i<numSpheres;i++)
- {
- m_localPositionArray[i] = positions[i];
- m_radiArray[i] = radi[i];
-
- }
-
- recalcLocalAabb();
-
-}
-
-
- btVector3 btMultiSphereShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
-{
- int i;
- btVector3 supVec(0,0,0);
-
- btScalar maxDot(btScalar(-BT_LARGE_FLOAT));
-
-
- btVector3 vec = vec0;
- btScalar lenSqr = vec.length2();
- if (lenSqr < (SIMD_EPSILON*SIMD_EPSILON))
- {
- vec.setValue(1,0,0);
- } else
- {
- btScalar rlen = btScalar(1.) / btSqrt(lenSqr );
- vec *= rlen;
- }
-
- btVector3 vtx;
- btScalar newDot;
-
- const btVector3* pos = &m_localPositionArray[0];
- const btScalar* rad = &m_radiArray[0];
- int numSpheres = m_localPositionArray.size();
-
- for (i=0;i<numSpheres;i++)
- {
- vtx = (*pos) +vec*m_localScaling*(*rad) - vec * getMargin();
- pos++;
- rad++;
- newDot = vec.dot(vtx);
- if (newDot > maxDot)
- {
- maxDot = newDot;
- supVec = vtx;
- }
- }
-
- return supVec;
-
-}
-
- void btMultiSphereShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
-{
-
- for (int j=0;j<numVectors;j++)
- {
- btScalar maxDot(btScalar(-BT_LARGE_FLOAT));
-
- const btVector3& vec = vectors[j];
-
- btVector3 vtx;
- btScalar newDot;
-
- const btVector3* pos = &m_localPositionArray[0];
- const btScalar* rad = &m_radiArray[0];
- int numSpheres = m_localPositionArray.size();
- for (int i=0;i<numSpheres;i++)
- {
- vtx = (*pos) +vec*m_localScaling*(*rad) - vec * getMargin();
- pos++;
- rad++;
- newDot = vec.dot(vtx);
- if (newDot > maxDot)
- {
- maxDot = newDot;
- supportVerticesOut[j] = vtx;
- }
- }
- }
-}
-
-
-
-
-
-
-
-
-void btMultiSphereShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
-{
- //as an approximation, take the inertia of the box that bounds the spheres
-
- btVector3 localAabbMin,localAabbMax;
- getCachedLocalAabb(localAabbMin,localAabbMax);
- btVector3 halfExtents = (localAabbMax-localAabbMin)*btScalar(0.5);
-
- btScalar lx=btScalar(2.)*(halfExtents.x());
- btScalar ly=btScalar(2.)*(halfExtents.y());
- btScalar lz=btScalar(2.)*(halfExtents.z());
-
- inertia.setValue(mass/(btScalar(12.0)) * (ly*ly + lz*lz),
- mass/(btScalar(12.0)) * (lx*lx + lz*lz),
- mass/(btScalar(12.0)) * (lx*lx + ly*ly));
-
-}
-
-
-///fills the dataBuffer and returns the struct name (and 0 on failure)
-const char* btMultiSphereShape::serialize(void* dataBuffer, btSerializer* serializer) const
-{
- btMultiSphereShapeData* shapeData = (btMultiSphereShapeData*) dataBuffer;
- btConvexInternalShape::serialize(&shapeData->m_convexInternalShapeData, serializer);
-
- int numElem = m_localPositionArray.size();
- shapeData->m_localPositionArrayPtr = numElem ? (btPositionAndRadius*)serializer->getUniquePointer((void*)&m_localPositionArray[0]): 0;
-
- shapeData->m_localPositionArraySize = numElem;
- if (numElem)
- {
- btChunk* chunk = serializer->allocate(sizeof(btPositionAndRadius),numElem);
- btPositionAndRadius* memPtr = (btPositionAndRadius*)chunk->m_oldPtr;
- for (int i=0;i<numElem;i++,memPtr++)
- {
- m_localPositionArray[i].serializeFloat(memPtr->m_pos);
- memPtr->m_radius = float(m_radiArray[i]);
- }
- serializer->finalizeChunk(chunk,"btPositionAndRadius",BT_ARRAY_CODE,(void*)&m_localPositionArray[0]);
- }
-
- return "btMultiSphereShapeData";
-}
-
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btMultiSphereShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btMultiSphereShape.h
deleted file mode 100644
index 3db7e320889..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btMultiSphereShape.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef MULTI_SPHERE_MINKOWSKI_H
-#define MULTI_SPHERE_MINKOWSKI_H
-
-#include "btConvexInternalShape.h"
-#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
-#include "LinearMath/btAlignedObjectArray.h"
-#include "LinearMath/btAabbUtil2.h"
-
-
-
-///The btMultiSphereShape represents the convex hull of a collection of spheres. You can create special capsules or other smooth volumes.
-///It is possible to animate the spheres for deformation, but call 'recalcLocalAabb' after changing any sphere position/radius
-class btMultiSphereShape : public btConvexInternalAabbCachingShape
-{
-
- btAlignedObjectArray<btVector3> m_localPositionArray;
- btAlignedObjectArray<btScalar> m_radiArray;
-
-public:
- btMultiSphereShape (const btVector3* positions,const btScalar* radi,int numSpheres);
-
- ///CollisionShape Interface
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
-
- /// btConvexShape Interface
- virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
-
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
-
- int getSphereCount() const
- {
- return m_localPositionArray.size();
- }
-
- const btVector3& getSpherePosition(int index) const
- {
- return m_localPositionArray[index];
- }
-
- btScalar getSphereRadius(int index) const
- {
- return m_radiArray[index];
- }
-
-
- virtual const char* getName()const
- {
- return "MultiSphere";
- }
-
- virtual int calculateSerializeBufferSize() const;
-
- ///fills the dataBuffer and returns the struct name (and 0 on failure)
- virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
-
-
-};
-
-
-struct btPositionAndRadius
-{
- btVector3FloatData m_pos;
- float m_radius;
-};
-
-struct btMultiSphereShapeData
-{
- btConvexInternalShapeData m_convexInternalShapeData;
-
- btPositionAndRadius *m_localPositionArrayPtr;
- int m_localPositionArraySize;
- char m_padding[4];
-};
-
-
-
-SIMD_FORCE_INLINE int btMultiSphereShape::calculateSerializeBufferSize() const
-{
- return sizeof(btMultiSphereShapeData);
-}
-
-
-
-#endif //MULTI_SPHERE_MINKOWSKI_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.cpp
deleted file mode 100644
index 58799ac96ad..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-/// This file was created by Alex Silverman
-
-#include "BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.h"
-#include "BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.h"
-//#include "BulletCollision/CollisionShapes/btOptimizedBvh.h"
-
-
-///Obtains the material for a specific triangle
-const btMaterial * btMultimaterialTriangleMeshShape::getMaterialProperties(int partID, int triIndex)
-{
- const unsigned char * materialBase = 0;
- int numMaterials;
- PHY_ScalarType materialType;
- int materialStride;
- const unsigned char * triangleMaterialBase = 0;
- int numTriangles;
- int triangleMaterialStride;
- PHY_ScalarType triangleType;
-
- ((btTriangleIndexVertexMaterialArray*)m_meshInterface)->getLockedReadOnlyMaterialBase(&materialBase, numMaterials, materialType, materialStride,
- &triangleMaterialBase, numTriangles, triangleMaterialStride, triangleType, partID);
-
- // return the pointer to the place with the friction for the triangle
- // TODO: This depends on whether it's a moving mesh or not
- // BUG IN GIMPACT
- //return (btScalar*)(&materialBase[triangleMaterialBase[(triIndex-1) * triangleMaterialStride] * materialStride]);
- int * matInd = (int *)(&(triangleMaterialBase[(triIndex * triangleMaterialStride)]));
- btMaterial *matVal = (btMaterial *)(&(materialBase[*matInd * materialStride]));
- return (matVal);
-}
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.h
deleted file mode 100644
index d42ba114349..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-/// This file was created by Alex Silverman
-
-#ifndef BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
-#define BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
-
-#include "btBvhTriangleMeshShape.h"
-#include "btMaterial.h"
-
-///The BvhTriangleMaterialMeshShape extends the btBvhTriangleMeshShape. Its main contribution is the interface into a material array, which allows per-triangle friction and restitution.
-ATTRIBUTE_ALIGNED16(class) btMultimaterialTriangleMeshShape : public btBvhTriangleMeshShape
-{
- btAlignedObjectArray <btMaterial*> m_materialList;
- int ** m_triangleMaterials;
-
-public:
-
- BT_DECLARE_ALIGNED_ALLOCATOR();
-
- btMultimaterialTriangleMeshShape(): btBvhTriangleMeshShape() {m_shapeType = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;}
- btMultimaterialTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh = true):
- btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression, buildBvh)
- {
- m_shapeType = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;
-
- const unsigned char *vertexbase;
- int numverts;
- PHY_ScalarType type;
- int stride;
- const unsigned char *indexbase;
- int indexstride;
- int numfaces;
- PHY_ScalarType indicestype;
-
- //m_materialLookup = (int**)(btAlignedAlloc(sizeof(int*) * meshInterface->getNumSubParts(), 16));
-
- for(int i = 0; i < meshInterface->getNumSubParts(); i++)
- {
- m_meshInterface->getLockedReadOnlyVertexIndexBase(
- &vertexbase,
- numverts,
- type,
- stride,
- &indexbase,
- indexstride,
- numfaces,
- indicestype,
- i);
- //m_materialLookup[i] = (int*)(btAlignedAlloc(sizeof(int) * numfaces, 16));
- }
- }
-
- ///optionally pass in a larger bvh aabb, used for quantization. This allows for deformations within this aabb
- btMultimaterialTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btVector3& bvhAabbMax, bool buildBvh = true):
- btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax, buildBvh)
- {
- m_shapeType = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;
-
- const unsigned char *vertexbase;
- int numverts;
- PHY_ScalarType type;
- int stride;
- const unsigned char *indexbase;
- int indexstride;
- int numfaces;
- PHY_ScalarType indicestype;
-
- //m_materialLookup = (int**)(btAlignedAlloc(sizeof(int*) * meshInterface->getNumSubParts(), 16));
-
- for(int i = 0; i < meshInterface->getNumSubParts(); i++)
- {
- m_meshInterface->getLockedReadOnlyVertexIndexBase(
- &vertexbase,
- numverts,
- type,
- stride,
- &indexbase,
- indexstride,
- numfaces,
- indicestype,
- i);
- //m_materialLookup[i] = (int*)(btAlignedAlloc(sizeof(int) * numfaces * 2, 16));
- }
- }
-
- virtual ~btMultimaterialTriangleMeshShape()
- {
-/*
- for(int i = 0; i < m_meshInterface->getNumSubParts(); i++)
- {
- btAlignedFree(m_materialValues[i]);
- m_materialLookup[i] = NULL;
- }
- btAlignedFree(m_materialValues);
- m_materialLookup = NULL;
-*/
- }
- //debugging
- virtual const char* getName()const {return "MULTIMATERIALTRIANGLEMESH";}
-
- ///Obtains the material for a specific triangle
- const btMaterial * getMaterialProperties(int partID, int triIndex);
-
-}
-;
-
-#endif //BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btOptimizedBvh.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btOptimizedBvh.cpp
deleted file mode 100644
index 981b8a2652c..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btOptimizedBvh.cpp
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-
-#include "btOptimizedBvh.h"
-#include "btStridingMeshInterface.h"
-#include "LinearMath/btAabbUtil2.h"
-#include "LinearMath/btIDebugDraw.h"
-
-
-btOptimizedBvh::btOptimizedBvh()
-{
-}
-
-btOptimizedBvh::~btOptimizedBvh()
-{
-}
-
-
-void btOptimizedBvh::build(btStridingMeshInterface* triangles, bool useQuantizedAabbCompression, const btVector3& bvhAabbMin, const btVector3& bvhAabbMax)
-{
- m_useQuantization = useQuantizedAabbCompression;
-
-
- // NodeArray triangleNodes;
-
- struct NodeTriangleCallback : public btInternalTriangleIndexCallback
- {
-
- NodeArray& m_triangleNodes;
-
- NodeTriangleCallback& operator=(NodeTriangleCallback& other)
- {
- m_triangleNodes = other.m_triangleNodes;
- return *this;
- }
-
- NodeTriangleCallback(NodeArray& triangleNodes)
- :m_triangleNodes(triangleNodes)
- {
- }
-
- virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
- {
- btOptimizedBvhNode node;
- btVector3 aabbMin,aabbMax;
- aabbMin.setValue(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT));
- aabbMax.setValue(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT));
- aabbMin.setMin(triangle[0]);
- aabbMax.setMax(triangle[0]);
- aabbMin.setMin(triangle[1]);
- aabbMax.setMax(triangle[1]);
- aabbMin.setMin(triangle[2]);
- aabbMax.setMax(triangle[2]);
-
- //with quantization?
- node.m_aabbMinOrg = aabbMin;
- node.m_aabbMaxOrg = aabbMax;
-
- node.m_escapeIndex = -1;
-
- //for child nodes
- node.m_subPart = partId;
- node.m_triangleIndex = triangleIndex;
- m_triangleNodes.push_back(node);
- }
- };
- struct QuantizedNodeTriangleCallback : public btInternalTriangleIndexCallback
- {
- QuantizedNodeArray& m_triangleNodes;
- const btQuantizedBvh* m_optimizedTree; // for quantization
-
- QuantizedNodeTriangleCallback& operator=(QuantizedNodeTriangleCallback& other)
- {
- m_triangleNodes = other.m_triangleNodes;
- m_optimizedTree = other.m_optimizedTree;
- return *this;
- }
-
- QuantizedNodeTriangleCallback(QuantizedNodeArray& triangleNodes,const btQuantizedBvh* tree)
- :m_triangleNodes(triangleNodes),m_optimizedTree(tree)
- {
- }
-
- virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
- {
- // The partId and triangle index must fit in the same (positive) integer
- btAssert(partId < (1<<MAX_NUM_PARTS_IN_BITS));
- btAssert(triangleIndex < (1<<(31-MAX_NUM_PARTS_IN_BITS)));
- //negative indices are reserved for escapeIndex
- btAssert(triangleIndex>=0);
-
- btQuantizedBvhNode node;
- btVector3 aabbMin,aabbMax;
- aabbMin.setValue(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT));
- aabbMax.setValue(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT));
- aabbMin.setMin(triangle[0]);
- aabbMax.setMax(triangle[0]);
- aabbMin.setMin(triangle[1]);
- aabbMax.setMax(triangle[1]);
- aabbMin.setMin(triangle[2]);
- aabbMax.setMax(triangle[2]);
-
- //PCK: add these checks for zero dimensions of aabb
- const btScalar MIN_AABB_DIMENSION = btScalar(0.002);
- const btScalar MIN_AABB_HALF_DIMENSION = btScalar(0.001);
- if (aabbMax.x() - aabbMin.x() < MIN_AABB_DIMENSION)
- {
- aabbMax.setX(aabbMax.x() + MIN_AABB_HALF_DIMENSION);
- aabbMin.setX(aabbMin.x() - MIN_AABB_HALF_DIMENSION);
- }
- if (aabbMax.y() - aabbMin.y() < MIN_AABB_DIMENSION)
- {
- aabbMax.setY(aabbMax.y() + MIN_AABB_HALF_DIMENSION);
- aabbMin.setY(aabbMin.y() - MIN_AABB_HALF_DIMENSION);
- }
- if (aabbMax.z() - aabbMin.z() < MIN_AABB_DIMENSION)
- {
- aabbMax.setZ(aabbMax.z() + MIN_AABB_HALF_DIMENSION);
- aabbMin.setZ(aabbMin.z() - MIN_AABB_HALF_DIMENSION);
- }
-
- m_optimizedTree->quantize(&node.m_quantizedAabbMin[0],aabbMin,0);
- m_optimizedTree->quantize(&node.m_quantizedAabbMax[0],aabbMax,1);
-
- node.m_escapeIndexOrTriangleIndex = (partId<<(31-MAX_NUM_PARTS_IN_BITS)) | triangleIndex;
-
- m_triangleNodes.push_back(node);
- }
- };
-
-
-
- int numLeafNodes = 0;
-
-
- if (m_useQuantization)
- {
-
- //initialize quantization values
- setQuantizationValues(bvhAabbMin,bvhAabbMax);
-
- QuantizedNodeTriangleCallback callback(m_quantizedLeafNodes,this);
-
-
- triangles->InternalProcessAllTriangles(&callback,m_bvhAabbMin,m_bvhAabbMax);
-
- //now we have an array of leafnodes in m_leafNodes
- numLeafNodes = m_quantizedLeafNodes.size();
-
-
- m_quantizedContiguousNodes.resize(2*numLeafNodes);
-
-
- } else
- {
- NodeTriangleCallback callback(m_leafNodes);
-
- btVector3 aabbMin(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT));
- btVector3 aabbMax(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT));
-
- triangles->InternalProcessAllTriangles(&callback,aabbMin,aabbMax);
-
- //now we have an array of leafnodes in m_leafNodes
- numLeafNodes = m_leafNodes.size();
-
- m_contiguousNodes.resize(2*numLeafNodes);
- }
-
- m_curNodeIndex = 0;
-
- buildTree(0,numLeafNodes);
-
- ///if the entire tree is small then subtree size, we need to create a header info for the tree
- if(m_useQuantization && !m_SubtreeHeaders.size())
- {
- btBvhSubtreeInfo& subtree = m_SubtreeHeaders.expand();
- subtree.setAabbFromQuantizeNode(m_quantizedContiguousNodes[0]);
- subtree.m_rootNodeIndex = 0;
- subtree.m_subtreeSize = m_quantizedContiguousNodes[0].isLeafNode() ? 1 : m_quantizedContiguousNodes[0].getEscapeIndex();
- }
-
- //PCK: update the copy of the size
- m_subtreeHeaderCount = m_SubtreeHeaders.size();
-
- //PCK: clear m_quantizedLeafNodes and m_leafNodes, they are temporary
- m_quantizedLeafNodes.clear();
- m_leafNodes.clear();
-}
-
-
-
-
-void btOptimizedBvh::refit(btStridingMeshInterface* meshInterface,const btVector3& aabbMin,const btVector3& aabbMax)
-{
- if (m_useQuantization)
- {
-
- setQuantizationValues(aabbMin,aabbMax);
-
- updateBvhNodes(meshInterface,0,m_curNodeIndex,0);
-
- ///now update all subtree headers
-
- int i;
- for (i=0;i<m_SubtreeHeaders.size();i++)
- {
- btBvhSubtreeInfo& subtree = m_SubtreeHeaders[i];
- subtree.setAabbFromQuantizeNode(m_quantizedContiguousNodes[subtree.m_rootNodeIndex]);
- }
-
- } else
- {
-
- }
-}
-
-
-
-
-void btOptimizedBvh::refitPartial(btStridingMeshInterface* meshInterface,const btVector3& aabbMin,const btVector3& aabbMax)
-{
- //incrementally initialize quantization values
- btAssert(m_useQuantization);
-
- btAssert(aabbMin.getX() > m_bvhAabbMin.getX());
- btAssert(aabbMin.getY() > m_bvhAabbMin.getY());
- btAssert(aabbMin.getZ() > m_bvhAabbMin.getZ());
-
- btAssert(aabbMax.getX() < m_bvhAabbMax.getX());
- btAssert(aabbMax.getY() < m_bvhAabbMax.getY());
- btAssert(aabbMax.getZ() < m_bvhAabbMax.getZ());
-
- ///we should update all quantization values, using updateBvhNodes(meshInterface);
- ///but we only update chunks that overlap the given aabb
-
- unsigned short quantizedQueryAabbMin[3];
- unsigned short quantizedQueryAabbMax[3];
-
- quantize(&quantizedQueryAabbMin[0],aabbMin,0);
- quantize(&quantizedQueryAabbMax[0],aabbMax,1);
-
- int i;
- for (i=0;i<this->m_SubtreeHeaders.size();i++)
- {
- btBvhSubtreeInfo& subtree = m_SubtreeHeaders[i];
-
- //PCK: unsigned instead of bool
- unsigned overlap = testQuantizedAabbAgainstQuantizedAabb(quantizedQueryAabbMin,quantizedQueryAabbMax,subtree.m_quantizedAabbMin,subtree.m_quantizedAabbMax);
- if (overlap != 0)
- {
- updateBvhNodes(meshInterface,subtree.m_rootNodeIndex,subtree.m_rootNodeIndex+subtree.m_subtreeSize,i);
-
- subtree.setAabbFromQuantizeNode(m_quantizedContiguousNodes[subtree.m_rootNodeIndex]);
- }
- }
-
-}
-
-void btOptimizedBvh::updateBvhNodes(btStridingMeshInterface* meshInterface,int firstNode,int endNode,int index)
-{
- (void)index;
-
- btAssert(m_useQuantization);
-
- int curNodeSubPart=-1;
-
- //get access info to trianglemesh data
- const unsigned char *vertexbase = 0;
- int numverts = 0;
- PHY_ScalarType type = PHY_INTEGER;
- int stride = 0;
- const unsigned char *indexbase = 0;
- int indexstride = 0;
- int numfaces = 0;
- PHY_ScalarType indicestype = PHY_INTEGER;
-
- btVector3 triangleVerts[3];
- btVector3 aabbMin,aabbMax;
- const btVector3& meshScaling = meshInterface->getScaling();
-
- int i;
- for (i=endNode-1;i>=firstNode;i--)
- {
-
-
- btQuantizedBvhNode& curNode = m_quantizedContiguousNodes[i];
- if (curNode.isLeafNode())
- {
- //recalc aabb from triangle data
- int nodeSubPart = curNode.getPartId();
- int nodeTriangleIndex = curNode.getTriangleIndex();
- if (nodeSubPart != curNodeSubPart)
- {
- if (curNodeSubPart >= 0)
- meshInterface->unLockReadOnlyVertexBase(curNodeSubPart);
- meshInterface->getLockedReadOnlyVertexIndexBase(&vertexbase,numverts, type,stride,&indexbase,indexstride,numfaces,indicestype,nodeSubPart);
-
- curNodeSubPart = nodeSubPart;
- btAssert(indicestype==PHY_INTEGER||indicestype==PHY_SHORT);
- }
- //triangles->getLockedReadOnlyVertexIndexBase(vertexBase,numVerts,
-
- unsigned int* gfxbase = (unsigned int*)(indexbase+nodeTriangleIndex*indexstride);
-
-
- for (int j=2;j>=0;j--)
- {
-
- int graphicsindex = indicestype==PHY_SHORT?((unsigned short*)gfxbase)[j]:gfxbase[j];
- if (type == PHY_FLOAT)
- {
- float* graphicsbase = (float*)(vertexbase+graphicsindex*stride);
- triangleVerts[j] = btVector3(
- graphicsbase[0]*meshScaling.getX(),
- graphicsbase[1]*meshScaling.getY(),
- graphicsbase[2]*meshScaling.getZ());
- }
- else
- {
- double* graphicsbase = (double*)(vertexbase+graphicsindex*stride);
- triangleVerts[j] = btVector3( btScalar(graphicsbase[0]*meshScaling.getX()), btScalar(graphicsbase[1]*meshScaling.getY()), btScalar(graphicsbase[2]*meshScaling.getZ()));
- }
- }
-
-
-
- aabbMin.setValue(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT));
- aabbMax.setValue(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT));
- aabbMin.setMin(triangleVerts[0]);
- aabbMax.setMax(triangleVerts[0]);
- aabbMin.setMin(triangleVerts[1]);
- aabbMax.setMax(triangleVerts[1]);
- aabbMin.setMin(triangleVerts[2]);
- aabbMax.setMax(triangleVerts[2]);
-
- quantize(&curNode.m_quantizedAabbMin[0],aabbMin,0);
- quantize(&curNode.m_quantizedAabbMax[0],aabbMax,1);
-
- } else
- {
- //combine aabb from both children
-
- btQuantizedBvhNode* leftChildNode = &m_quantizedContiguousNodes[i+1];
-
- btQuantizedBvhNode* rightChildNode = leftChildNode->isLeafNode() ? &m_quantizedContiguousNodes[i+2] :
- &m_quantizedContiguousNodes[i+1+leftChildNode->getEscapeIndex()];
-
-
- {
- for (int i=0;i<3;i++)
- {
- curNode.m_quantizedAabbMin[i] = leftChildNode->m_quantizedAabbMin[i];
- if (curNode.m_quantizedAabbMin[i]>rightChildNode->m_quantizedAabbMin[i])
- curNode.m_quantizedAabbMin[i]=rightChildNode->m_quantizedAabbMin[i];
-
- curNode.m_quantizedAabbMax[i] = leftChildNode->m_quantizedAabbMax[i];
- if (curNode.m_quantizedAabbMax[i] < rightChildNode->m_quantizedAabbMax[i])
- curNode.m_quantizedAabbMax[i] = rightChildNode->m_quantizedAabbMax[i];
- }
- }
- }
-
- }
-
- if (curNodeSubPart >= 0)
- meshInterface->unLockReadOnlyVertexBase(curNodeSubPart);
-
-
-}
-
-///deSerializeInPlace loads and initializes a BVH from a buffer in memory 'in place'
-btOptimizedBvh* btOptimizedBvh::deSerializeInPlace(void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian)
-{
- btQuantizedBvh* bvh = btQuantizedBvh::deSerializeInPlace(i_alignedDataBuffer,i_dataBufferSize,i_swapEndian);
-
- //we don't add additional data so just do a static upcast
- return static_cast<btOptimizedBvh*>(bvh);
-}
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btOptimizedBvh.h b/extern/bullet2/BulletCollision/CollisionShapes/btOptimizedBvh.h
deleted file mode 100644
index 749fe6005dd..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btOptimizedBvh.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-///Contains contributions from Disney Studio's
-
-#ifndef OPTIMIZED_BVH_H
-#define OPTIMIZED_BVH_H
-
-#include "BulletCollision/BroadphaseCollision/btQuantizedBvh.h"
-
-class btStridingMeshInterface;
-
-
-///The btOptimizedBvh extends the btQuantizedBvh to create AABB tree for triangle meshes, through the btStridingMeshInterface.
-ATTRIBUTE_ALIGNED16(class) btOptimizedBvh : public btQuantizedBvh
-{
-
-public:
- BT_DECLARE_ALIGNED_ALLOCATOR();
-
-protected:
-
-public:
-
- btOptimizedBvh();
-
- virtual ~btOptimizedBvh();
-
- void build(btStridingMeshInterface* triangles,bool useQuantizedAabbCompression, const btVector3& bvhAabbMin, const btVector3& bvhAabbMax);
-
- void refit(btStridingMeshInterface* triangles,const btVector3& aabbMin,const btVector3& aabbMax);
-
- void refitPartial(btStridingMeshInterface* triangles,const btVector3& aabbMin, const btVector3& aabbMax);
-
- void updateBvhNodes(btStridingMeshInterface* meshInterface,int firstNode,int endNode,int index);
-
- /// Data buffer MUST be 16 byte aligned
- virtual bool serializeInPlace(void *o_alignedDataBuffer, unsigned i_dataBufferSize, bool i_swapEndian) const
- {
- return btQuantizedBvh::serialize(o_alignedDataBuffer,i_dataBufferSize,i_swapEndian);
-
- }
-
- ///deSerializeInPlace loads and initializes a BVH from a buffer in memory 'in place'
- static btOptimizedBvh *deSerializeInPlace(void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian);
-
-
-};
-
-
-#endif //OPTIMIZED_BVH_H
-
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
deleted file mode 100644
index b1ecb3e432c..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "BulletCollision/CollisionShapes/btPolyhedralConvexShape.h"
-
-btPolyhedralConvexShape::btPolyhedralConvexShape() :btConvexInternalShape()
-{
-
-}
-
-
-btVector3 btPolyhedralConvexShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
-{
-
-
- btVector3 supVec(0,0,0);
-#ifndef __SPU__
- int i;
- btScalar maxDot(btScalar(-BT_LARGE_FLOAT));
-
- btVector3 vec = vec0;
- btScalar lenSqr = vec.length2();
- if (lenSqr < btScalar(0.0001))
- {
- vec.setValue(1,0,0);
- } else
- {
- btScalar rlen = btScalar(1.) / btSqrt(lenSqr );
- vec *= rlen;
- }
-
- btVector3 vtx;
- btScalar newDot;
-
- for (i=0;i<getNumVertices();i++)
- {
- getVertex(i,vtx);
- newDot = vec.dot(vtx);
- if (newDot > maxDot)
- {
- maxDot = newDot;
- supVec = vtx;
- }
- }
-
-
-#endif //__SPU__
- return supVec;
-}
-
-
-
-void btPolyhedralConvexShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
-{
-#ifndef __SPU__
- int i;
-
- btVector3 vtx;
- btScalar newDot;
-
- for (i=0;i<numVectors;i++)
- {
- supportVerticesOut[i][3] = btScalar(-BT_LARGE_FLOAT);
- }
-
- for (int j=0;j<numVectors;j++)
- {
-
- const btVector3& vec = vectors[j];
-
- for (i=0;i<getNumVertices();i++)
- {
- getVertex(i,vtx);
- newDot = vec.dot(vtx);
- if (newDot > supportVerticesOut[j][3])
- {
- //WARNING: don't swap next lines, the w component would get overwritten!
- supportVerticesOut[j] = vtx;
- supportVerticesOut[j][3] = newDot;
- }
- }
- }
-#endif //__SPU__
-}
-
-
-
-void btPolyhedralConvexShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
-{
-#ifndef __SPU__
- //not yet, return box inertia
-
- btScalar margin = getMargin();
-
- btTransform ident;
- ident.setIdentity();
- btVector3 aabbMin,aabbMax;
- getAabb(ident,aabbMin,aabbMax);
- btVector3 halfExtents = (aabbMax-aabbMin)*btScalar(0.5);
-
- btScalar lx=btScalar(2.)*(halfExtents.x()+margin);
- btScalar ly=btScalar(2.)*(halfExtents.y()+margin);
- btScalar lz=btScalar(2.)*(halfExtents.z()+margin);
- const btScalar x2 = lx*lx;
- const btScalar y2 = ly*ly;
- const btScalar z2 = lz*lz;
- const btScalar scaledmass = mass * btScalar(0.08333333);
-
- inertia = scaledmass * (btVector3(y2+z2,x2+z2,x2+y2));
-#endif //__SPU__
-}
-
-
-
-void btPolyhedralConvexAabbCachingShape::setLocalScaling(const btVector3& scaling)
-{
- btConvexInternalShape::setLocalScaling(scaling);
- recalcLocalAabb();
-}
-
-btPolyhedralConvexAabbCachingShape::btPolyhedralConvexAabbCachingShape()
-:btPolyhedralConvexShape(),
-m_localAabbMin(1,1,1),
-m_localAabbMax(-1,-1,-1),
-m_isLocalAabbValid(false)
-{
-}
-
-void btPolyhedralConvexAabbCachingShape::getAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const
-{
- getNonvirtualAabb(trans,aabbMin,aabbMax,getMargin());
-}
-
-void btPolyhedralConvexAabbCachingShape::recalcLocalAabb()
-{
- m_isLocalAabbValid = true;
-
- #if 1
- static const btVector3 _directions[] =
- {
- btVector3( 1., 0., 0.),
- btVector3( 0., 1., 0.),
- btVector3( 0., 0., 1.),
- btVector3( -1., 0., 0.),
- btVector3( 0., -1., 0.),
- btVector3( 0., 0., -1.)
- };
-
- btVector3 _supporting[] =
- {
- btVector3( 0., 0., 0.),
- btVector3( 0., 0., 0.),
- btVector3( 0., 0., 0.),
- btVector3( 0., 0., 0.),
- btVector3( 0., 0., 0.),
- btVector3( 0., 0., 0.)
- };
-
- batchedUnitVectorGetSupportingVertexWithoutMargin(_directions, _supporting, 6);
-
- for ( int i = 0; i < 3; ++i )
- {
- m_localAabbMax[i] = _supporting[i][i] + m_collisionMargin;
- m_localAabbMin[i] = _supporting[i + 3][i] - m_collisionMargin;
- }
-
- #else
-
- for (int i=0;i<3;i++)
- {
- btVector3 vec(btScalar(0.),btScalar(0.),btScalar(0.));
- vec[i] = btScalar(1.);
- btVector3 tmp = localGetSupportingVertex(vec);
- m_localAabbMax[i] = tmp[i]+m_collisionMargin;
- vec[i] = btScalar(-1.);
- tmp = localGetSupportingVertex(vec);
- m_localAabbMin[i] = tmp[i]-m_collisionMargin;
- }
- #endif
-}
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h
deleted file mode 100644
index 2c691b95652..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef BU_SHAPE
-#define BU_SHAPE
-
-#include "LinearMath/btMatrix3x3.h"
-#include "btConvexInternalShape.h"
-
-
-///The btPolyhedralConvexShape is an internal interface class for polyhedral convex shapes.
-class btPolyhedralConvexShape : public btConvexInternalShape
-{
-
-protected:
-
-public:
-
- btPolyhedralConvexShape();
-
- //brute force implementations
-
- virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
-
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
-
-
- virtual int getNumVertices() const = 0 ;
- virtual int getNumEdges() const = 0;
- virtual void getEdge(int i,btVector3& pa,btVector3& pb) const = 0;
- virtual void getVertex(int i,btVector3& vtx) const = 0;
- virtual int getNumPlanes() const = 0;
- virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const = 0;
-// virtual int getIndex(int i) const = 0 ;
-
- virtual bool isInside(const btVector3& pt,btScalar tolerance) const = 0;
-
-};
-
-
-///The btPolyhedralConvexAabbCachingShape adds aabb caching to the btPolyhedralConvexShape
-class btPolyhedralConvexAabbCachingShape : public btPolyhedralConvexShape
-{
-
- btVector3 m_localAabbMin;
- btVector3 m_localAabbMax;
- bool m_isLocalAabbValid;
-
-protected:
-
- void setCachedLocalAabb (const btVector3& aabbMin, const btVector3& aabbMax)
- {
- m_isLocalAabbValid = true;
- m_localAabbMin = aabbMin;
- m_localAabbMax = aabbMax;
- }
-
- inline void getCachedLocalAabb (btVector3& aabbMin, btVector3& aabbMax) const
- {
- btAssert(m_isLocalAabbValid);
- aabbMin = m_localAabbMin;
- aabbMax = m_localAabbMax;
- }
-
-public:
-
- btPolyhedralConvexAabbCachingShape();
-
- inline void getNonvirtualAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax, btScalar margin) const
- {
-
- //lazy evaluation of local aabb
- btAssert(m_isLocalAabbValid);
- btTransformAabb(m_localAabbMin,m_localAabbMax,margin,trans,aabbMin,aabbMax);
- }
-
- virtual void setLocalScaling(const btVector3& scaling);
-
- virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
-
- void recalcLocalAabb();
-
-};
-
-#endif //BU_SHAPE
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp
deleted file mode 100644
index d964e1e48ed..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-
-#include "btScaledBvhTriangleMeshShape.h"
-
-btScaledBvhTriangleMeshShape::btScaledBvhTriangleMeshShape(btBvhTriangleMeshShape* childShape,const btVector3& localScaling)
-:m_localScaling(localScaling),m_bvhTriMeshShape(childShape)
-{
- m_shapeType = SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE;
-}
-
-btScaledBvhTriangleMeshShape::~btScaledBvhTriangleMeshShape()
-{
-}
-
-
-class btScaledTriangleCallback : public btTriangleCallback
-{
- btTriangleCallback* m_originalCallback;
-
- btVector3 m_localScaling;
-
-public:
-
- btScaledTriangleCallback(btTriangleCallback* originalCallback,const btVector3& localScaling)
- :m_originalCallback(originalCallback),
- m_localScaling(localScaling)
- {
- }
-
- virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex)
- {
- btVector3 newTriangle[3];
- newTriangle[0] = triangle[0]*m_localScaling;
- newTriangle[1] = triangle[1]*m_localScaling;
- newTriangle[2] = triangle[2]*m_localScaling;
- m_originalCallback->processTriangle(&newTriangle[0],partId,triangleIndex);
- }
-};
-
-void btScaledBvhTriangleMeshShape::processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
-{
- btScaledTriangleCallback scaledCallback(callback,m_localScaling);
-
- btVector3 invLocalScaling(1.f/m_localScaling.getX(),1.f/m_localScaling.getY(),1.f/m_localScaling.getZ());
- btVector3 scaledAabbMin,scaledAabbMax;
-
- ///support negative scaling
- scaledAabbMin[0] = m_localScaling.getX() >= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0];
- scaledAabbMin[1] = m_localScaling.getY() >= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1];
- scaledAabbMin[2] = m_localScaling.getZ() >= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2];
-
- scaledAabbMax[0] = m_localScaling.getX() <= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0];
- scaledAabbMax[1] = m_localScaling.getY() <= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1];
- scaledAabbMax[2] = m_localScaling.getZ() <= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2];
-
-
- m_bvhTriMeshShape->processAllTriangles(&scaledCallback,scaledAabbMin,scaledAabbMax);
-}
-
-
-void btScaledBvhTriangleMeshShape::getAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const
-{
- btVector3 localAabbMin = m_bvhTriMeshShape->getLocalAabbMin();
- btVector3 localAabbMax = m_bvhTriMeshShape->getLocalAabbMax();
-
- btVector3 tmpLocalAabbMin = localAabbMin * m_localScaling;
- btVector3 tmpLocalAabbMax = localAabbMax * m_localScaling;
-
- localAabbMin[0] = (m_localScaling.getX() >= 0.) ? tmpLocalAabbMin[0] : tmpLocalAabbMax[0];
- localAabbMin[1] = (m_localScaling.getY() >= 0.) ? tmpLocalAabbMin[1] : tmpLocalAabbMax[1];
- localAabbMin[2] = (m_localScaling.getZ() >= 0.) ? tmpLocalAabbMin[2] : tmpLocalAabbMax[2];
- localAabbMax[0] = (m_localScaling.getX() <= 0.) ? tmpLocalAabbMin[0] : tmpLocalAabbMax[0];
- localAabbMax[1] = (m_localScaling.getY() <= 0.) ? tmpLocalAabbMin[1] : tmpLocalAabbMax[1];
- localAabbMax[2] = (m_localScaling.getZ() <= 0.) ? tmpLocalAabbMin[2] : tmpLocalAabbMax[2];
-
- btVector3 localHalfExtents = btScalar(0.5)*(localAabbMax-localAabbMin);
- btScalar margin = m_bvhTriMeshShape->getMargin();
- localHalfExtents += btVector3(margin,margin,margin);
- btVector3 localCenter = btScalar(0.5)*(localAabbMax+localAabbMin);
-
- btMatrix3x3 abs_b = trans.getBasis().absolute();
-
- btVector3 center = trans(localCenter);
-
- btVector3 extent = btVector3(abs_b[0].dot(localHalfExtents),
- abs_b[1].dot(localHalfExtents),
- abs_b[2].dot(localHalfExtents));
- aabbMin = center - extent;
- aabbMax = center + extent;
-
-}
-
-void btScaledBvhTriangleMeshShape::setLocalScaling(const btVector3& scaling)
-{
- m_localScaling = scaling;
-}
-
-const btVector3& btScaledBvhTriangleMeshShape::getLocalScaling() const
-{
- return m_localScaling;
-}
-
-void btScaledBvhTriangleMeshShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
-{
- ///don't make this a movable object!
-// btAssert(0);
-}
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h
deleted file mode 100644
index d720b1b4f89..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SCALED_BVH_TRIANGLE_MESH_SHAPE_H
-#define SCALED_BVH_TRIANGLE_MESH_SHAPE_H
-
-#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h"
-
-
-///The btScaledBvhTriangleMeshShape allows to instance a scaled version of an existing btBvhTriangleMeshShape.
-///Note that each btBvhTriangleMeshShape still can have its own local scaling, independent from this btScaledBvhTriangleMeshShape 'localScaling'
-ATTRIBUTE_ALIGNED16(class) btScaledBvhTriangleMeshShape : public btConcaveShape
-{
-
-
- btVector3 m_localScaling;
-
- btBvhTriangleMeshShape* m_bvhTriMeshShape;
-
-public:
-
-
- btScaledBvhTriangleMeshShape(btBvhTriangleMeshShape* childShape,const btVector3& localScaling);
-
- virtual ~btScaledBvhTriangleMeshShape();
-
-
- virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
- virtual void setLocalScaling(const btVector3& scaling);
- virtual const btVector3& getLocalScaling() const;
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
-
- virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
-
- btBvhTriangleMeshShape* getChildShape()
- {
- return m_bvhTriMeshShape;
- }
-
- const btBvhTriangleMeshShape* getChildShape() const
- {
- return m_bvhTriMeshShape;
- }
-
- //debugging
- virtual const char* getName()const {return "SCALEDBVHTRIANGLEMESH";}
-
-};
-
-#endif //BVH_TRIANGLE_MESH_SHAPE_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btShapeHull.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btShapeHull.cpp
deleted file mode 100644
index 3beaf865801..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btShapeHull.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-//btShapeHull was implemented by John McCutchan.
-
-
-#include "btShapeHull.h"
-#include "LinearMath/btConvexHull.h"
-
-#define NUM_UNITSPHERE_POINTS 42
-
-btShapeHull::btShapeHull (const btConvexShape* shape)
-{
- m_shape = shape;
- m_vertices.clear ();
- m_indices.clear();
- m_numIndices = 0;
-}
-
-btShapeHull::~btShapeHull ()
-{
- m_indices.clear();
- m_vertices.clear ();
-}
-
-bool
-btShapeHull::buildHull (btScalar /*margin*/)
-{
- int numSampleDirections = NUM_UNITSPHERE_POINTS;
- {
- int numPDA = m_shape->getNumPreferredPenetrationDirections();
- if (numPDA)
- {
- for (int i=0;i<numPDA;i++)
- {
- btVector3 norm;
- m_shape->getPreferredPenetrationDirection(i,norm);
- getUnitSpherePoints()[numSampleDirections] = norm;
- numSampleDirections++;
- }
- }
- }
-
- btVector3 supportPoints[NUM_UNITSPHERE_POINTS+MAX_PREFERRED_PENETRATION_DIRECTIONS*2];
- int i;
- for (i = 0; i < numSampleDirections; i++)
- {
- supportPoints[i] = m_shape->localGetSupportingVertex(getUnitSpherePoints()[i]);
- }
-
- HullDesc hd;
- hd.mFlags = QF_TRIANGLES;
- hd.mVcount = static_cast<unsigned int>(numSampleDirections);
-
-#ifdef BT_USE_DOUBLE_PRECISION
- hd.mVertices = &supportPoints[0];
- hd.mVertexStride = sizeof(btVector3);
-#else
- hd.mVertices = &supportPoints[0];
- hd.mVertexStride = sizeof (btVector3);
-#endif
-
- HullLibrary hl;
- HullResult hr;
- if (hl.CreateConvexHull (hd, hr) == QE_FAIL)
- {
- return false;
- }
-
- m_vertices.resize (static_cast<int>(hr.mNumOutputVertices));
-
-
- for (i = 0; i < static_cast<int>(hr.mNumOutputVertices); i++)
- {
- m_vertices[i] = hr.m_OutputVertices[i];
- }
- m_numIndices = hr.mNumIndices;
- m_indices.resize(static_cast<int>(m_numIndices));
- for (i = 0; i < static_cast<int>(m_numIndices); i++)
- {
- m_indices[i] = hr.m_Indices[i];
- }
-
- // free temporary hull result that we just copied
- hl.ReleaseResult (hr);
-
- return true;
-}
-
-int
-btShapeHull::numTriangles () const
-{
- return static_cast<int>(m_numIndices / 3);
-}
-
-int
-btShapeHull::numVertices () const
-{
- return m_vertices.size ();
-}
-
-int
-btShapeHull::numIndices () const
-{
- return static_cast<int>(m_numIndices);
-}
-
-
-btVector3* btShapeHull::getUnitSpherePoints()
-{
- static btVector3 sUnitSpherePoints[NUM_UNITSPHERE_POINTS+MAX_PREFERRED_PENETRATION_DIRECTIONS*2] =
- {
- btVector3(btScalar(0.000000) , btScalar(-0.000000),btScalar(-1.000000)),
- btVector3(btScalar(0.723608) , btScalar(-0.525725),btScalar(-0.447219)),
- btVector3(btScalar(-0.276388) , btScalar(-0.850649),btScalar(-0.447219)),
- btVector3(btScalar(-0.894426) , btScalar(-0.000000),btScalar(-0.447216)),
- btVector3(btScalar(-0.276388) , btScalar(0.850649),btScalar(-0.447220)),
- btVector3(btScalar(0.723608) , btScalar(0.525725),btScalar(-0.447219)),
- btVector3(btScalar(0.276388) , btScalar(-0.850649),btScalar(0.447220)),
- btVector3(btScalar(-0.723608) , btScalar(-0.525725),btScalar(0.447219)),
- btVector3(btScalar(-0.723608) , btScalar(0.525725),btScalar(0.447219)),
- btVector3(btScalar(0.276388) , btScalar(0.850649),btScalar(0.447219)),
- btVector3(btScalar(0.894426) , btScalar(0.000000),btScalar(0.447216)),
- btVector3(btScalar(-0.000000) , btScalar(0.000000),btScalar(1.000000)),
- btVector3(btScalar(0.425323) , btScalar(-0.309011),btScalar(-0.850654)),
- btVector3(btScalar(-0.162456) , btScalar(-0.499995),btScalar(-0.850654)),
- btVector3(btScalar(0.262869) , btScalar(-0.809012),btScalar(-0.525738)),
- btVector3(btScalar(0.425323) , btScalar(0.309011),btScalar(-0.850654)),
- btVector3(btScalar(0.850648) , btScalar(-0.000000),btScalar(-0.525736)),
- btVector3(btScalar(-0.525730) , btScalar(-0.000000),btScalar(-0.850652)),
- btVector3(btScalar(-0.688190) , btScalar(-0.499997),btScalar(-0.525736)),
- btVector3(btScalar(-0.162456) , btScalar(0.499995),btScalar(-0.850654)),
- btVector3(btScalar(-0.688190) , btScalar(0.499997),btScalar(-0.525736)),
- btVector3(btScalar(0.262869) , btScalar(0.809012),btScalar(-0.525738)),
- btVector3(btScalar(0.951058) , btScalar(0.309013),btScalar(0.000000)),
- btVector3(btScalar(0.951058) , btScalar(-0.309013),btScalar(0.000000)),
- btVector3(btScalar(0.587786) , btScalar(-0.809017),btScalar(0.000000)),
- btVector3(btScalar(0.000000) , btScalar(-1.000000),btScalar(0.000000)),
- btVector3(btScalar(-0.587786) , btScalar(-0.809017),btScalar(0.000000)),
- btVector3(btScalar(-0.951058) , btScalar(-0.309013),btScalar(-0.000000)),
- btVector3(btScalar(-0.951058) , btScalar(0.309013),btScalar(-0.000000)),
- btVector3(btScalar(-0.587786) , btScalar(0.809017),btScalar(-0.000000)),
- btVector3(btScalar(-0.000000) , btScalar(1.000000),btScalar(-0.000000)),
- btVector3(btScalar(0.587786) , btScalar(0.809017),btScalar(-0.000000)),
- btVector3(btScalar(0.688190) , btScalar(-0.499997),btScalar(0.525736)),
- btVector3(btScalar(-0.262869) , btScalar(-0.809012),btScalar(0.525738)),
- btVector3(btScalar(-0.850648) , btScalar(0.000000),btScalar(0.525736)),
- btVector3(btScalar(-0.262869) , btScalar(0.809012),btScalar(0.525738)),
- btVector3(btScalar(0.688190) , btScalar(0.499997),btScalar(0.525736)),
- btVector3(btScalar(0.525730) , btScalar(0.000000),btScalar(0.850652)),
- btVector3(btScalar(0.162456) , btScalar(-0.499995),btScalar(0.850654)),
- btVector3(btScalar(-0.425323) , btScalar(-0.309011),btScalar(0.850654)),
- btVector3(btScalar(-0.425323) , btScalar(0.309011),btScalar(0.850654)),
- btVector3(btScalar(0.162456) , btScalar(0.499995),btScalar(0.850654))
- };
- return sUnitSpherePoints;
-}
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btShapeHull.h b/extern/bullet2/BulletCollision/CollisionShapes/btShapeHull.h
deleted file mode 100644
index 07b3500f994..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btShapeHull.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-///btShapeHull implemented by John McCutchan.
-
-#ifndef _SHAPE_HULL_H
-#define _SHAPE_HULL_H
-
-#include "LinearMath/btAlignedObjectArray.h"
-#include "BulletCollision/CollisionShapes/btConvexShape.h"
-
-
-///The btShapeHull class takes a btConvexShape, builds a simplified convex hull using btConvexHull and provides triangle indices and vertices.
-///It can be useful for to simplify a complex convex object and for visualization of a non-polyhedral convex object.
-///It approximates the convex hull using the supporting vertex of 42 directions.
-class btShapeHull
-{
-protected:
-
- btAlignedObjectArray<btVector3> m_vertices;
- btAlignedObjectArray<unsigned int> m_indices;
- unsigned int m_numIndices;
- const btConvexShape* m_shape;
-
- static btVector3* getUnitSpherePoints();
-
-public:
- btShapeHull (const btConvexShape* shape);
- ~btShapeHull ();
-
- bool buildHull (btScalar margin);
-
- int numTriangles () const;
- int numVertices () const;
- int numIndices () const;
-
- const btVector3* getVertexPointer() const
- {
- return &m_vertices[0];
- }
- const unsigned int* getIndexPointer() const
- {
- return &m_indices[0];
- }
-};
-
-#endif //_SHAPE_HULL_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btSphereShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btSphereShape.cpp
deleted file mode 100644
index b9a736c0fdd..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btSphereShape.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btSphereShape.h"
-#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
-
-#include "LinearMath/btQuaternion.h"
-
-btVector3 btSphereShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
-{
- (void)vec;
- return btVector3(btScalar(0.),btScalar(0.),btScalar(0.));
-}
-
-void btSphereShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
-{
- (void)vectors;
-
- for (int i=0;i<numVectors;i++)
- {
- supportVerticesOut[i].setValue(btScalar(0.),btScalar(0.),btScalar(0.));
- }
-}
-
-
-btVector3 btSphereShape::localGetSupportingVertex(const btVector3& vec)const
-{
- btVector3 supVertex;
- supVertex = localGetSupportingVertexWithoutMargin(vec);
-
- btVector3 vecnorm = vec;
- if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
- {
- vecnorm.setValue(btScalar(-1.),btScalar(-1.),btScalar(-1.));
- }
- vecnorm.normalize();
- supVertex+= getMargin() * vecnorm;
- return supVertex;
-}
-
-
-//broken due to scaling
-void btSphereShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
-{
- const btVector3& center = t.getOrigin();
- btVector3 extent(getMargin(),getMargin(),getMargin());
- aabbMin = center - extent;
- aabbMax = center + extent;
-}
-
-
-
-void btSphereShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
-{
- btScalar elem = btScalar(0.4) * mass * getMargin()*getMargin();
- inertia.setValue(elem,elem,elem);
-
-}
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btSphereShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btSphereShape.h
deleted file mode 100644
index f98372442ba..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btSphereShape.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-#ifndef SPHERE_MINKOWSKI_H
-#define SPHERE_MINKOWSKI_H
-
-#include "btConvexInternalShape.h"
-#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
-
-///The btSphereShape implements an implicit sphere, centered around a local origin with radius.
-ATTRIBUTE_ALIGNED16(class) btSphereShape : public btConvexInternalShape
-
-{
-
-public:
- BT_DECLARE_ALIGNED_ALLOCATOR();
-
- btSphereShape (btScalar radius) : btConvexInternalShape ()
- {
- m_shapeType = SPHERE_SHAPE_PROXYTYPE;
- m_implicitShapeDimensions.setX(radius);
- m_collisionMargin = radius;
- }
-
- virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
- virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
- //notice that the vectors should be unit length
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
-
-
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
-
- virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
-
-
- btScalar getRadius() const { return m_implicitShapeDimensions.getX() * m_localScaling.getX();}
-
- void setUnscaledRadius(btScalar radius)
- {
- m_implicitShapeDimensions.setX(radius);
- btConvexInternalShape::setMargin(radius);
- }
-
- //debugging
- virtual const char* getName()const {return "SPHERE";}
-
- virtual void setMargin(btScalar margin)
- {
- btConvexInternalShape::setMargin(margin);
- }
- virtual btScalar getMargin() const
- {
- //to improve gjk behaviour, use radius+margin as the full margin, so never get into the penetration case
- //this means, non-uniform scaling is not supported anymore
- return getRadius();
- }
-
-
-};
-
-
-#endif //SPHERE_MINKOWSKI_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btStaticPlaneShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btStaticPlaneShape.cpp
deleted file mode 100644
index 38ef8f03706..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btStaticPlaneShape.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btStaticPlaneShape.h"
-
-#include "LinearMath/btTransformUtil.h"
-
-
-btStaticPlaneShape::btStaticPlaneShape(const btVector3& planeNormal,btScalar planeConstant)
-: btConcaveShape (), m_planeNormal(planeNormal.normalized()),
-m_planeConstant(planeConstant),
-m_localScaling(btScalar(0.),btScalar(0.),btScalar(0.))
-{
- m_shapeType = STATIC_PLANE_PROXYTYPE;
- // btAssert( btFuzzyZero(m_planeNormal.length() - btScalar(1.)) );
-}
-
-
-btStaticPlaneShape::~btStaticPlaneShape()
-{
-}
-
-
-
-void btStaticPlaneShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
-{
- (void)t;
- /*
- btVector3 infvec (btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT));
-
- btVector3 center = m_planeNormal*m_planeConstant;
- aabbMin = center + infvec*m_planeNormal;
- aabbMax = aabbMin;
- aabbMin.setMin(center - infvec*m_planeNormal);
- aabbMax.setMax(center - infvec*m_planeNormal);
- */
-
- aabbMin.setValue(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT));
- aabbMax.setValue(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT));
-
-}
-
-
-
-
-void btStaticPlaneShape::processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
-{
-
- btVector3 halfExtents = (aabbMax - aabbMin) * btScalar(0.5);
- btScalar radius = halfExtents.length();
- btVector3 center = (aabbMax + aabbMin) * btScalar(0.5);
-
- //this is where the triangles are generated, given AABB and plane equation (normal/constant)
-
- btVector3 tangentDir0,tangentDir1;
-
- //tangentDir0/tangentDir1 can be precalculated
- btPlaneSpace1(m_planeNormal,tangentDir0,tangentDir1);
-
- btVector3 supVertex0,supVertex1;
-
- btVector3 projectedCenter = center - (m_planeNormal.dot(center) - m_planeConstant)*m_planeNormal;
-
- btVector3 triangle[3];
- triangle[0] = projectedCenter + tangentDir0*radius + tangentDir1*radius;
- triangle[1] = projectedCenter + tangentDir0*radius - tangentDir1*radius;
- triangle[2] = projectedCenter - tangentDir0*radius - tangentDir1*radius;
-
- callback->processTriangle(triangle,0,0);
-
- triangle[0] = projectedCenter - tangentDir0*radius - tangentDir1*radius;
- triangle[1] = projectedCenter - tangentDir0*radius + tangentDir1*radius;
- triangle[2] = projectedCenter + tangentDir0*radius + tangentDir1*radius;
-
- callback->processTriangle(triangle,0,1);
-
-}
-
-void btStaticPlaneShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
-{
- (void)mass;
-
- //moving concave objects not supported
-
- inertia.setValue(btScalar(0.),btScalar(0.),btScalar(0.));
-}
-
-void btStaticPlaneShape::setLocalScaling(const btVector3& scaling)
-{
- m_localScaling = scaling;
-}
-const btVector3& btStaticPlaneShape::getLocalScaling() const
-{
- return m_localScaling;
-}
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btStaticPlaneShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btStaticPlaneShape.h
deleted file mode 100644
index beb53ef33a1..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btStaticPlaneShape.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef STATIC_PLANE_SHAPE_H
-#define STATIC_PLANE_SHAPE_H
-
-#include "btConcaveShape.h"
-
-
-///The btStaticPlaneShape simulates an infinite non-moving (static) collision plane.
-ATTRIBUTE_ALIGNED16(class) btStaticPlaneShape : public btConcaveShape
-{
-protected:
- btVector3 m_localAabbMin;
- btVector3 m_localAabbMax;
-
- btVector3 m_planeNormal;
- btScalar m_planeConstant;
- btVector3 m_localScaling;
-
-public:
- btStaticPlaneShape(const btVector3& planeNormal,btScalar planeConstant);
-
- virtual ~btStaticPlaneShape();
-
-
- virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
-
- virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
-
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
-
- virtual void setLocalScaling(const btVector3& scaling);
- virtual const btVector3& getLocalScaling() const;
-
- const btVector3& getPlaneNormal() const
- {
- return m_planeNormal;
- }
-
- const btScalar& getPlaneConstant() const
- {
- return m_planeConstant;
- }
-
- //debugging
- virtual const char* getName()const {return "STATICPLANE";}
-
- virtual int calculateSerializeBufferSize() const;
-
- ///fills the dataBuffer and returns the struct name (and 0 on failure)
- virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
-
-
-};
-
-///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
-struct btStaticPlaneShapeData
-{
- btCollisionShapeData m_collisionShapeData;
-
- btVector3FloatData m_localScaling;
- btVector3FloatData m_planeNormal;
- float m_planeConstant;
- char m_pad[4];
-};
-
-
-SIMD_FORCE_INLINE int btStaticPlaneShape::calculateSerializeBufferSize() const
-{
- return sizeof(btStaticPlaneShapeData);
-}
-
-///fills the dataBuffer and returns the struct name (and 0 on failure)
-SIMD_FORCE_INLINE const char* btStaticPlaneShape::serialize(void* dataBuffer, btSerializer* serializer) const
-{
- btStaticPlaneShapeData* planeData = (btStaticPlaneShapeData*) dataBuffer;
- btCollisionShape::serialize(&planeData->m_collisionShapeData,serializer);
-
- m_localScaling.serializeFloat(planeData->m_localScaling);
- m_planeNormal.serializeFloat(planeData->m_planeNormal);
- planeData->m_planeConstant = float(m_planeConstant);
-
- return "btStaticPlaneShapeData";
-}
-
-
-#endif //STATIC_PLANE_SHAPE_H
-
-
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp
deleted file mode 100644
index 8624531ab52..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btStridingMeshInterface.h"
-#include "LinearMath/btSerializer.h"
-
-btStridingMeshInterface::~btStridingMeshInterface()
-{
-
-}
-
-
-void btStridingMeshInterface::InternalProcessAllTriangles(btInternalTriangleIndexCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
-{
- (void)aabbMin;
- (void)aabbMax;
- int numtotalphysicsverts = 0;
- int part,graphicssubparts = getNumSubParts();
- const unsigned char * vertexbase;
- const unsigned char * indexbase;
- int indexstride;
- PHY_ScalarType type;
- PHY_ScalarType gfxindextype;
- int stride,numverts,numtriangles;
- int gfxindex;
- btVector3 triangle[3];
-
- btVector3 meshScaling = getScaling();
-
- ///if the number of parts is big, the performance might drop due to the innerloop switch on indextype
- for (part=0;part<graphicssubparts ;part++)
- {
- getLockedReadOnlyVertexIndexBase(&vertexbase,numverts,type,stride,&indexbase,indexstride,numtriangles,gfxindextype,part);
- numtotalphysicsverts+=numtriangles*3; //upper bound
-
- ///unlike that developers want to pass in double-precision meshes in single-precision Bullet build
- ///so disable this feature by default
- ///see patch http://code.google.com/p/bullet/issues/detail?id=213
-
- switch (type)
- {
- case PHY_FLOAT:
- {
-
- float* graphicsbase;
-
- switch (gfxindextype)
- {
- case PHY_INTEGER:
- {
- for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
- {
- unsigned int* tri_indices= (unsigned int*)(indexbase+gfxindex*indexstride);
- graphicsbase = (float*)(vertexbase+tri_indices[0]*stride);
- triangle[0].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());
- graphicsbase = (float*)(vertexbase+tri_indices[1]*stride);
- triangle[1].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(), graphicsbase[2]*meshScaling.getZ());
- graphicsbase = (float*)(vertexbase+tri_indices[2]*stride);
- triangle[2].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(), graphicsbase[2]*meshScaling.getZ());
- callback->internalProcessTriangleIndex(triangle,part,gfxindex);
- }
- break;
- }
- case PHY_SHORT:
- {
- for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
- {
- unsigned short int* tri_indices= (unsigned short int*)(indexbase+gfxindex*indexstride);
- graphicsbase = (float*)(vertexbase+tri_indices[0]*stride);
- triangle[0].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ());
- graphicsbase = (float*)(vertexbase+tri_indices[1]*stride);
- triangle[1].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(), graphicsbase[2]*meshScaling.getZ());
- graphicsbase = (float*)(vertexbase+tri_indices[2]*stride);
- triangle[2].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(), graphicsbase[2]*meshScaling.getZ());
- callback->internalProcessTriangleIndex(triangle,part,gfxindex);
- }
- break;
- }
- default:
- btAssert((gfxindextype == PHY_INTEGER) || (gfxindextype == PHY_SHORT));
- }
- break;
- }
-
- case PHY_DOUBLE:
- {
- double* graphicsbase;
-
- switch (gfxindextype)
- {
- case PHY_INTEGER:
- {
- for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
- {
- unsigned int* tri_indices= (unsigned int*)(indexbase+gfxindex*indexstride);
- graphicsbase = (double*)(vertexbase+tri_indices[0]*stride);
- triangle[0].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(),(btScalar)graphicsbase[2]*meshScaling.getZ());
- graphicsbase = (double*)(vertexbase+tri_indices[1]*stride);
- triangle[1].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(), (btScalar)graphicsbase[2]*meshScaling.getZ());
- graphicsbase = (double*)(vertexbase+tri_indices[2]*stride);
- triangle[2].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(), (btScalar)graphicsbase[2]*meshScaling.getZ());
- callback->internalProcessTriangleIndex(triangle,part,gfxindex);
- }
- break;
- }
- case PHY_SHORT:
- {
- for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
- {
- unsigned short int* tri_indices= (unsigned short int*)(indexbase+gfxindex*indexstride);
- graphicsbase = (double*)(vertexbase+tri_indices[0]*stride);
- triangle[0].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(),(btScalar)graphicsbase[2]*meshScaling.getZ());
- graphicsbase = (double*)(vertexbase+tri_indices[1]*stride);
- triangle[1].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(), (btScalar)graphicsbase[2]*meshScaling.getZ());
- graphicsbase = (double*)(vertexbase+tri_indices[2]*stride);
- triangle[2].setValue((btScalar)graphicsbase[0]*meshScaling.getX(),(btScalar)graphicsbase[1]*meshScaling.getY(), (btScalar)graphicsbase[2]*meshScaling.getZ());
- callback->internalProcessTriangleIndex(triangle,part,gfxindex);
- }
- break;
- }
- default:
- btAssert((gfxindextype == PHY_INTEGER) || (gfxindextype == PHY_SHORT));
- }
- break;
- }
- default:
- btAssert((type == PHY_FLOAT) || (type == PHY_DOUBLE));
- }
-
- unLockReadOnlyVertexBase(part);
- }
-}
-
-void btStridingMeshInterface::calculateAabbBruteForce(btVector3& aabbMin,btVector3& aabbMax)
-{
-
- struct AabbCalculationCallback : public btInternalTriangleIndexCallback
- {
- btVector3 m_aabbMin;
- btVector3 m_aabbMax;
-
- AabbCalculationCallback()
- {
- m_aabbMin.setValue(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT));
- m_aabbMax.setValue(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT));
- }
-
- virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
- {
- (void)partId;
- (void)triangleIndex;
-
- m_aabbMin.setMin(triangle[0]);
- m_aabbMax.setMax(triangle[0]);
- m_aabbMin.setMin(triangle[1]);
- m_aabbMax.setMax(triangle[1]);
- m_aabbMin.setMin(triangle[2]);
- m_aabbMax.setMax(triangle[2]);
- }
- };
-
- //first calculate the total aabb for all triangles
- AabbCalculationCallback aabbCallback;
- aabbMin.setValue(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT));
- aabbMax.setValue(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT));
- InternalProcessAllTriangles(&aabbCallback,aabbMin,aabbMax);
-
- aabbMin = aabbCallback.m_aabbMin;
- aabbMax = aabbCallback.m_aabbMax;
-}
-
-
-
-///fills the dataBuffer and returns the struct name (and 0 on failure)
-const char* btStridingMeshInterface::serialize(void* dataBuffer, btSerializer* serializer) const
-{
- btStridingMeshInterfaceData* trimeshData = (btStridingMeshInterfaceData*) dataBuffer;
-
- trimeshData->m_numMeshParts = getNumSubParts();
-
- //void* uniquePtr = 0;
-
- trimeshData->m_meshPartsPtr = 0;
-
- if (trimeshData->m_numMeshParts)
- {
- btChunk* chunk = serializer->allocate(sizeof(btMeshPartData),trimeshData->m_numMeshParts);
- btMeshPartData* memPtr = (btMeshPartData*)chunk->m_oldPtr;
- trimeshData->m_meshPartsPtr = (btMeshPartData *)serializer->getUniquePointer(memPtr);
-
-
- // int numtotalphysicsverts = 0;
- int part,graphicssubparts = getNumSubParts();
- const unsigned char * vertexbase;
- const unsigned char * indexbase;
- int indexstride;
- PHY_ScalarType type;
- PHY_ScalarType gfxindextype;
- int stride,numverts,numtriangles;
- int gfxindex;
- // btVector3 triangle[3];
-
- btVector3 meshScaling = getScaling();
-
- ///if the number of parts is big, the performance might drop due to the innerloop switch on indextype
- for (part=0;part<graphicssubparts ;part++,memPtr++)
- {
- getLockedReadOnlyVertexIndexBase(&vertexbase,numverts,type,stride,&indexbase,indexstride,numtriangles,gfxindextype,part);
- memPtr->m_numTriangles = numtriangles;//indices = 3*numtriangles
- memPtr->m_numVertices = numverts;
- memPtr->m_indices16 = 0;
- memPtr->m_indices32 = 0;
- memPtr->m_3indices16 = 0;
- memPtr->m_vertices3f = 0;
- memPtr->m_vertices3d = 0;
-
- switch (gfxindextype)
- {
- case PHY_INTEGER:
- {
- int numindices = numtriangles*3;
-
- if (numindices)
- {
- btChunk* chunk = serializer->allocate(sizeof(btIntIndexData),numindices);
- btIntIndexData* tmpIndices = (btIntIndexData*)chunk->m_oldPtr;
- memPtr->m_indices32 = (btIntIndexData*)serializer->getUniquePointer(tmpIndices);
- for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
- {
- unsigned int* tri_indices= (unsigned int*)(indexbase+gfxindex*indexstride);
- tmpIndices[gfxindex*3].m_value = tri_indices[0];
- tmpIndices[gfxindex*3+1].m_value = tri_indices[1];
- tmpIndices[gfxindex*3+2].m_value = tri_indices[2];
- }
- serializer->finalizeChunk(chunk,"btIntIndexData",BT_ARRAY_CODE,(void*)chunk->m_oldPtr);
- }
- break;
- }
- case PHY_SHORT:
- {
- if (numtriangles)
- {
- btChunk* chunk = serializer->allocate(sizeof(btShortIntIndexTripletData),numtriangles);
- btShortIntIndexTripletData* tmpIndices = (btShortIntIndexTripletData*)chunk->m_oldPtr;
- memPtr->m_3indices16 = (btShortIntIndexTripletData*) serializer->getUniquePointer(tmpIndices);
- for (gfxindex=0;gfxindex<numtriangles;gfxindex++)
- {
- unsigned short int* tri_indices= (unsigned short int*)(indexbase+gfxindex*indexstride);
- tmpIndices[gfxindex].m_values[0] = tri_indices[0];
- tmpIndices[gfxindex].m_values[1] = tri_indices[1];
- tmpIndices[gfxindex].m_values[2] = tri_indices[2];
- }
- serializer->finalizeChunk(chunk,"btShortIntIndexTripletData",BT_ARRAY_CODE,(void*)chunk->m_oldPtr);
- }
- break;
- }
- default:
- {
- btAssert(0);
- //unknown index type
- }
- }
-
- switch (type)
- {
- case PHY_FLOAT:
- {
- float* graphicsbase;
-
- if (numverts)
- {
- btChunk* chunk = serializer->allocate(sizeof(btVector3FloatData),numverts);
- btVector3FloatData* tmpVertices = (btVector3FloatData*) chunk->m_oldPtr;
- memPtr->m_vertices3f = (btVector3FloatData *)serializer->getUniquePointer(tmpVertices);
- for (int i=0;i<numverts;i++)
- {
- graphicsbase = (float*)(vertexbase+i*stride);
- tmpVertices[i].m_floats[0] = graphicsbase[0];
- tmpVertices[i].m_floats[1] = graphicsbase[1];
- tmpVertices[i].m_floats[2] = graphicsbase[2];
- }
- serializer->finalizeChunk(chunk,"btVector3FloatData",BT_ARRAY_CODE,(void*)chunk->m_oldPtr);
- }
- break;
- }
-
- case PHY_DOUBLE:
- {
- if (numverts)
- {
- btChunk* chunk = serializer->allocate(sizeof(btVector3DoubleData),numverts);
- btVector3DoubleData* tmpVertices = (btVector3DoubleData*) chunk->m_oldPtr;
- memPtr->m_vertices3d = (btVector3DoubleData *) serializer->getUniquePointer(tmpVertices);
- for (int i=0;i<numverts;i++)
- {
- double* graphicsbase = (double*)(vertexbase+i*stride);//for now convert to float, might leave it at double
- tmpVertices[i].m_floats[0] = graphicsbase[0];
- tmpVertices[i].m_floats[1] = graphicsbase[1];
- tmpVertices[i].m_floats[2] = graphicsbase[2];
- }
- serializer->finalizeChunk(chunk,"btVector3DoubleData",BT_ARRAY_CODE,(void*)chunk->m_oldPtr);
- }
- break;
- }
-
- default:
- btAssert((type == PHY_FLOAT) || (type == PHY_DOUBLE));
- }
-
- unLockReadOnlyVertexBase(part);
- }
-
- serializer->finalizeChunk(chunk,"btMeshPartData",BT_ARRAY_CODE,chunk->m_oldPtr);
- }
-
-
- m_scaling.serializeFloat(trimeshData->m_scaling);
- return "btStridingMeshInterfaceData";
-}
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btStridingMeshInterface.h b/extern/bullet2/BulletCollision/CollisionShapes/btStridingMeshInterface.h
deleted file mode 100644
index e0c1b54f8a8..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btStridingMeshInterface.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef STRIDING_MESHINTERFACE_H
-#define STRIDING_MESHINTERFACE_H
-
-#include "LinearMath/btVector3.h"
-#include "btTriangleCallback.h"
-#include "btConcaveShape.h"
-
-
-
-
-
-/// The btStridingMeshInterface is the interface class for high performance generic access to triangle meshes, used in combination with btBvhTriangleMeshShape and some other collision shapes.
-/// Using index striding of 3*sizeof(integer) it can use triangle arrays, using index striding of 1*sizeof(integer) it can handle triangle strips.
-/// It allows for sharing graphics and collision meshes. Also it provides locking/unlocking of graphics meshes that are in gpu memory.
-class btStridingMeshInterface
-{
- protected:
-
- btVector3 m_scaling;
-
- public:
- btStridingMeshInterface() :m_scaling(btScalar(1.),btScalar(1.),btScalar(1.))
- {
-
- }
-
- virtual ~btStridingMeshInterface();
-
-
-
- virtual void InternalProcessAllTriangles(btInternalTriangleIndexCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
-
- ///brute force method to calculate aabb
- void calculateAabbBruteForce(btVector3& aabbMin,btVector3& aabbMax);
-
- /// get read and write access to a subpart of a triangle mesh
- /// this subpart has a continuous array of vertices and indices
- /// in this way the mesh can be handled as chunks of memory with striding
- /// very similar to OpenGL vertexarray support
- /// make a call to unLockVertexBase when the read and write access is finished
- virtual void getLockedVertexIndexBase(unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& stride,unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart=0)=0;
-
- virtual void getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& stride,const unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart=0) const=0;
-
- /// unLockVertexBase finishes the access to a subpart of the triangle mesh
- /// make a call to unLockVertexBase when the read and write access (using getLockedVertexIndexBase) is finished
- virtual void unLockVertexBase(int subpart)=0;
-
- virtual void unLockReadOnlyVertexBase(int subpart) const=0;
-
-
- /// getNumSubParts returns the number of seperate subparts
- /// each subpart has a continuous array of vertices and indices
- virtual int getNumSubParts() const=0;
-
- virtual void preallocateVertices(int numverts)=0;
- virtual void preallocateIndices(int numindices)=0;
-
- virtual bool hasPremadeAabb() const { return false; }
- virtual void setPremadeAabb(const btVector3& aabbMin, const btVector3& aabbMax ) const
- {
- (void) aabbMin;
- (void) aabbMax;
- }
- virtual void getPremadeAabb(btVector3* aabbMin, btVector3* aabbMax ) const
- {
- (void) aabbMin;
- (void) aabbMax;
- }
-
- const btVector3& getScaling() const {
- return m_scaling;
- }
- void setScaling(const btVector3& scaling)
- {
- m_scaling = scaling;
- }
-
- virtual int calculateSerializeBufferSize() const;
-
- ///fills the dataBuffer and returns the struct name (and 0 on failure)
- virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
-
-
-};
-
-struct btIntIndexData
-{
- int m_value;
-};
-
-struct btShortIntIndexData
-{
- short m_value;
- char m_pad[2];
-};
-
-struct btShortIntIndexTripletData
-{
- short m_values[3];
- char m_pad[2];
-};
-
-///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
-struct btMeshPartData
-{
- btVector3FloatData *m_vertices3f;
- btVector3DoubleData *m_vertices3d;
-
- btIntIndexData *m_indices32;
- btShortIntIndexTripletData *m_3indices16;
-
- btShortIntIndexData *m_indices16;//backwards compatibility
-
- int m_numTriangles;//length of m_indices = m_numTriangles
- int m_numVertices;
-};
-
-
-///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
-struct btStridingMeshInterfaceData
-{
- btMeshPartData *m_meshPartsPtr;
- btVector3FloatData m_scaling;
- int m_numMeshParts;
- char m_padding[4];
-};
-
-
-
-
-SIMD_FORCE_INLINE int btStridingMeshInterface::calculateSerializeBufferSize() const
-{
- return sizeof(btStridingMeshInterfaceData);
-}
-
-
-
-#endif //STRIDING_MESHINTERFACE_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btTetrahedronShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btTetrahedronShape.cpp
deleted file mode 100644
index 52f346bf726..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btTetrahedronShape.cpp
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btTetrahedronShape.h"
-#include "LinearMath/btMatrix3x3.h"
-
-btBU_Simplex1to4::btBU_Simplex1to4() : btPolyhedralConvexAabbCachingShape (),
-m_numVertices(0)
-{
- m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
-}
-
-btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0) : btPolyhedralConvexAabbCachingShape (),
-m_numVertices(0)
-{
- m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
- addVertex(pt0);
-}
-
-btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1) : btPolyhedralConvexAabbCachingShape (),
-m_numVertices(0)
-{
- m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
- addVertex(pt0);
- addVertex(pt1);
-}
-
-btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1,const btVector3& pt2) : btPolyhedralConvexAabbCachingShape (),
-m_numVertices(0)
-{
- m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
- addVertex(pt0);
- addVertex(pt1);
- addVertex(pt2);
-}
-
-btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1,const btVector3& pt2,const btVector3& pt3) : btPolyhedralConvexAabbCachingShape (),
-m_numVertices(0)
-{
- m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
- addVertex(pt0);
- addVertex(pt1);
- addVertex(pt2);
- addVertex(pt3);
-}
-
-
-void btBU_Simplex1to4::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
-{
-#if 1
- btPolyhedralConvexAabbCachingShape::getAabb(t,aabbMin,aabbMax);
-#else
- aabbMin.setValue(BT_LARGE_FLOAT,BT_LARGE_FLOAT,BT_LARGE_FLOAT);
- aabbMax.setValue(-BT_LARGE_FLOAT,-BT_LARGE_FLOAT,-BT_LARGE_FLOAT);
-
- //just transform the vertices in worldspace, and take their AABB
- for (int i=0;i<m_numVertices;i++)
- {
- btVector3 worldVertex = t(m_vertices[i]);
- aabbMin.setMin(worldVertex);
- aabbMax.setMax(worldVertex);
- }
-#endif
-}
-
-
-
-
-
-void btBU_Simplex1to4::addVertex(const btVector3& pt)
-{
- m_vertices[m_numVertices++] = pt;
- recalcLocalAabb();
-}
-
-
-int btBU_Simplex1to4::getNumVertices() const
-{
- return m_numVertices;
-}
-
-int btBU_Simplex1to4::getNumEdges() const
-{
- //euler formula, F-E+V = 2, so E = F+V-2
-
- switch (m_numVertices)
- {
- case 0:
- return 0;
- case 1: return 0;
- case 2: return 1;
- case 3: return 3;
- case 4: return 6;
-
-
- }
-
- return 0;
-}
-
-void btBU_Simplex1to4::getEdge(int i,btVector3& pa,btVector3& pb) const
-{
-
- switch (m_numVertices)
- {
-
- case 2:
- pa = m_vertices[0];
- pb = m_vertices[1];
- break;
- case 3:
- switch (i)
- {
- case 0:
- pa = m_vertices[0];
- pb = m_vertices[1];
- break;
- case 1:
- pa = m_vertices[1];
- pb = m_vertices[2];
- break;
- case 2:
- pa = m_vertices[2];
- pb = m_vertices[0];
- break;
-
- }
- break;
- case 4:
- switch (i)
- {
- case 0:
- pa = m_vertices[0];
- pb = m_vertices[1];
- break;
- case 1:
- pa = m_vertices[1];
- pb = m_vertices[2];
- break;
- case 2:
- pa = m_vertices[2];
- pb = m_vertices[0];
- break;
- case 3:
- pa = m_vertices[0];
- pb = m_vertices[3];
- break;
- case 4:
- pa = m_vertices[1];
- pb = m_vertices[3];
- break;
- case 5:
- pa = m_vertices[2];
- pb = m_vertices[3];
- break;
- }
-
- }
-
-
-
-
-}
-
-void btBU_Simplex1to4::getVertex(int i,btVector3& vtx) const
-{
- vtx = m_vertices[i];
-}
-
-int btBU_Simplex1to4::getNumPlanes() const
-{
- switch (m_numVertices)
- {
- case 0:
- return 0;
- case 1:
- return 0;
- case 2:
- return 0;
- case 3:
- return 2;
- case 4:
- return 4;
- default:
- {
- }
- }
- return 0;
-}
-
-
-void btBU_Simplex1to4::getPlane(btVector3&, btVector3& ,int ) const
-{
-
-}
-
-int btBU_Simplex1to4::getIndex(int ) const
-{
- return 0;
-}
-
-bool btBU_Simplex1to4::isInside(const btVector3& ,btScalar ) const
-{
- return false;
-}
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btTetrahedronShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btTetrahedronShape.h
deleted file mode 100644
index 72e9f232876..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btTetrahedronShape.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef BU_SIMPLEX_1TO4_SHAPE
-#define BU_SIMPLEX_1TO4_SHAPE
-
-
-#include "btPolyhedralConvexShape.h"
-#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
-
-
-///The btBU_Simplex1to4 implements tetrahedron, triangle, line, vertex collision shapes. In most cases it is better to use btConvexHullShape instead.
-class btBU_Simplex1to4 : public btPolyhedralConvexAabbCachingShape
-{
-protected:
-
- int m_numVertices;
- btVector3 m_vertices[4];
-
-public:
- btBU_Simplex1to4();
-
- btBU_Simplex1to4(const btVector3& pt0);
- btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1);
- btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1,const btVector3& pt2);
- btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1,const btVector3& pt2,const btVector3& pt3);
-
-
- void reset()
- {
- m_numVertices = 0;
- }
-
- virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
-
- void addVertex(const btVector3& pt);
-
- //PolyhedralConvexShape interface
-
- virtual int getNumVertices() const;
-
- virtual int getNumEdges() const;
-
- virtual void getEdge(int i,btVector3& pa,btVector3& pb) const;
-
- virtual void getVertex(int i,btVector3& vtx) const;
-
- virtual int getNumPlanes() const;
-
- virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i) const;
-
- virtual int getIndex(int i) const;
-
- virtual bool isInside(const btVector3& pt,btScalar tolerance) const;
-
-
- ///getName is for debugging
- virtual const char* getName()const { return "btBU_Simplex1to4";}
-
-};
-
-#endif //BU_SIMPLEX_1TO4_SHAPE
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleBuffer.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btTriangleBuffer.cpp
deleted file mode 100644
index 3027e65b256..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleBuffer.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btTriangleBuffer.h"
-
-
-
-
-
-
-
-void btTriangleBuffer::processTriangle(btVector3* triangle,int partId,int triangleIndex)
-{
- btTriangle tri;
- tri.m_vertex0 = triangle[0];
- tri.m_vertex1 = triangle[1];
- tri.m_vertex2 = triangle[2];
- tri.m_partId = partId;
- tri.m_triangleIndex = triangleIndex;
-
- m_triangleBuffer.push_back(tri);
-}
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleBuffer.h b/extern/bullet2/BulletCollision/CollisionShapes/btTriangleBuffer.h
deleted file mode 100644
index b71fc8b3746..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleBuffer.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef BT_TRIANGLE_BUFFER_H
-#define BT_TRIANGLE_BUFFER_H
-
-#include "btTriangleCallback.h"
-#include "LinearMath/btAlignedObjectArray.h"
-
-struct btTriangle
-{
- btVector3 m_vertex0;
- btVector3 m_vertex1;
- btVector3 m_vertex2;
- int m_partId;
- int m_triangleIndex;
-};
-
-///The btTriangleBuffer callback can be useful to collect and store overlapping triangles between AABB and concave objects that support 'processAllTriangles'
-///Example usage of this class:
-/// btTriangleBuffer triBuf;
-/// concaveShape->processAllTriangles(&triBuf,aabbMin, aabbMax);
-/// for (int i=0;i<triBuf.getNumTriangles();i++)
-/// {
-/// const btTriangle& tri = triBuf.getTriangle(i);
-/// //do something useful here with the triangle
-/// }
-class btTriangleBuffer : public btTriangleCallback
-{
-
- btAlignedObjectArray<btTriangle> m_triangleBuffer;
-
-public:
-
-
- virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex);
-
- int getNumTriangles() const
- {
- return int(m_triangleBuffer.size());
- }
-
- const btTriangle& getTriangle(int index) const
- {
- return m_triangleBuffer[index];
- }
-
- void clearBuffer()
- {
- m_triangleBuffer.clear();
- }
-
-};
-
-
-#endif //BT_TRIANGLE_BUFFER_H
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleCallback.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btTriangleCallback.cpp
deleted file mode 100644
index f558bf6d241..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleCallback.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btTriangleCallback.h"
-
-btTriangleCallback::~btTriangleCallback()
-{
-
-}
-
-
-btInternalTriangleIndexCallback::~btInternalTriangleIndexCallback()
-{
-
-}
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleCallback.h b/extern/bullet2/BulletCollision/CollisionShapes/btTriangleCallback.h
deleted file mode 100644
index 0499702b05b..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleCallback.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef TRIANGLE_CALLBACK_H
-#define TRIANGLE_CALLBACK_H
-
-#include "LinearMath/btVector3.h"
-
-
-///The btTriangleCallback provides a callback for each overlapping triangle when calling processAllTriangles.
-///This callback is called by processAllTriangles for all btConcaveShape derived class, such as btBvhTriangleMeshShape, btStaticPlaneShape and btHeightfieldTerrainShape.
-class btTriangleCallback
-{
-public:
-
- virtual ~btTriangleCallback();
- virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex) = 0;
-};
-
-class btInternalTriangleIndexCallback
-{
-public:
-
- virtual ~btInternalTriangleIndexCallback();
- virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex) = 0;
-};
-
-
-
-#endif //TRIANGLE_CALLBACK_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.cpp
deleted file mode 100644
index a665024cb61..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btTriangleIndexVertexArray.h"
-
-btTriangleIndexVertexArray::btTriangleIndexVertexArray(int numTriangles,int* triangleIndexBase,int triangleIndexStride,int numVertices,btScalar* vertexBase,int vertexStride)
-: m_hasAabb(0)
-{
- btIndexedMesh mesh;
-
- mesh.m_numTriangles = numTriangles;
- mesh.m_triangleIndexBase = (const unsigned char *)triangleIndexBase;
- mesh.m_triangleIndexStride = triangleIndexStride;
- mesh.m_numVertices = numVertices;
- mesh.m_vertexBase = (const unsigned char *)vertexBase;
- mesh.m_vertexStride = vertexStride;
-
- addIndexedMesh(mesh);
-
-}
-
-btTriangleIndexVertexArray::~btTriangleIndexVertexArray()
-{
-
-}
-
-void btTriangleIndexVertexArray::getLockedVertexIndexBase(unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& vertexStride,unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart)
-{
- btAssert(subpart< getNumSubParts() );
-
- btIndexedMesh& mesh = m_indexedMeshes[subpart];
-
- numverts = mesh.m_numVertices;
- (*vertexbase) = (unsigned char *) mesh.m_vertexBase;
-
- type = mesh.m_vertexType;
-
- vertexStride = mesh.m_vertexStride;
-
- numfaces = mesh.m_numTriangles;
-
- (*indexbase) = (unsigned char *)mesh.m_triangleIndexBase;
- indexstride = mesh.m_triangleIndexStride;
- indicestype = mesh.m_indexType;
-}
-
-void btTriangleIndexVertexArray::getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& vertexStride,const unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart) const
-{
- const btIndexedMesh& mesh = m_indexedMeshes[subpart];
-
- numverts = mesh.m_numVertices;
- (*vertexbase) = (const unsigned char *)mesh.m_vertexBase;
-
- type = mesh.m_vertexType;
-
- vertexStride = mesh.m_vertexStride;
-
- numfaces = mesh.m_numTriangles;
- (*indexbase) = (const unsigned char *)mesh.m_triangleIndexBase;
- indexstride = mesh.m_triangleIndexStride;
- indicestype = mesh.m_indexType;
-}
-
-bool btTriangleIndexVertexArray::hasPremadeAabb() const
-{
- return (m_hasAabb == 1);
-}
-
-
-void btTriangleIndexVertexArray::setPremadeAabb(const btVector3& aabbMin, const btVector3& aabbMax ) const
-{
- m_aabbMin = aabbMin;
- m_aabbMax = aabbMax;
- m_hasAabb = 1; // this is intentionally an int see notes in header
-}
-
-void btTriangleIndexVertexArray::getPremadeAabb(btVector3* aabbMin, btVector3* aabbMax ) const
-{
- *aabbMin = m_aabbMin;
- *aabbMax = m_aabbMax;
-}
-
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h b/extern/bullet2/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h
deleted file mode 100644
index c64ea6e7043..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef BT_TRIANGLE_INDEX_VERTEX_ARRAY_H
-#define BT_TRIANGLE_INDEX_VERTEX_ARRAY_H
-
-#include "btStridingMeshInterface.h"
-#include "LinearMath/btAlignedObjectArray.h"
-#include "LinearMath/btScalar.h"
-
-
-///The btIndexedMesh indexes a single vertex and index array. Multiple btIndexedMesh objects can be passed into a btTriangleIndexVertexArray using addIndexedMesh.
-///Instead of the number of indices, we pass the number of triangles.
-ATTRIBUTE_ALIGNED16( struct) btIndexedMesh
-{
- BT_DECLARE_ALIGNED_ALLOCATOR();
-
- int m_numTriangles;
- const unsigned char * m_triangleIndexBase;
- int m_triangleIndexStride;
- int m_numVertices;
- const unsigned char * m_vertexBase;
- int m_vertexStride;
-
- // The index type is set when adding an indexed mesh to the
- // btTriangleIndexVertexArray, do not set it manually
- PHY_ScalarType m_indexType;
-
- // The vertex type has a default type similar to Bullet's precision mode (float or double)
- // but can be set manually if you for example run Bullet with double precision but have
- // mesh data in single precision..
- PHY_ScalarType m_vertexType;
-
-
- btIndexedMesh()
- :m_indexType(PHY_INTEGER),
-#ifdef BT_USE_DOUBLE_PRECISION
- m_vertexType(PHY_DOUBLE)
-#else // BT_USE_DOUBLE_PRECISION
- m_vertexType(PHY_FLOAT)
-#endif // BT_USE_DOUBLE_PRECISION
- {
- }
-}
-;
-
-
-typedef btAlignedObjectArray<btIndexedMesh> IndexedMeshArray;
-
-///The btTriangleIndexVertexArray allows to access multiple triangle meshes, by indexing into existing triangle/index arrays.
-///Additional meshes can be added using addIndexedMesh
-///No duplcate is made of the vertex/index data, it only indexes into external vertex/index arrays.
-///So keep those arrays around during the lifetime of this btTriangleIndexVertexArray.
-ATTRIBUTE_ALIGNED16( class) btTriangleIndexVertexArray : public btStridingMeshInterface
-{
-protected:
- IndexedMeshArray m_indexedMeshes;
- int m_pad[2];
- mutable int m_hasAabb; // using int instead of bool to maintain alignment
- mutable btVector3 m_aabbMin;
- mutable btVector3 m_aabbMax;
-
-public:
-
- BT_DECLARE_ALIGNED_ALLOCATOR();
-
- btTriangleIndexVertexArray() : m_hasAabb(0)
- {
- }
-
- virtual ~btTriangleIndexVertexArray();
-
- //just to be backwards compatible
- btTriangleIndexVertexArray(int numTriangles,int* triangleIndexBase,int triangleIndexStride,int numVertices,btScalar* vertexBase,int vertexStride);
-
- void addIndexedMesh(const btIndexedMesh& mesh, PHY_ScalarType indexType = PHY_INTEGER)
- {
- m_indexedMeshes.push_back(mesh);
- m_indexedMeshes[m_indexedMeshes.size()-1].m_indexType = indexType;
- }
-
-
- virtual void getLockedVertexIndexBase(unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& vertexStride,unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart=0);
-
- virtual void getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& vertexStride,const unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart=0) const;
-
- /// unLockVertexBase finishes the access to a subpart of the triangle mesh
- /// make a call to unLockVertexBase when the read and write access (using getLockedVertexIndexBase) is finished
- virtual void unLockVertexBase(int subpart) {(void)subpart;}
-
- virtual void unLockReadOnlyVertexBase(int subpart) const {(void)subpart;}
-
- /// getNumSubParts returns the number of seperate subparts
- /// each subpart has a continuous array of vertices and indices
- virtual int getNumSubParts() const {
- return (int)m_indexedMeshes.size();
- }
-
- IndexedMeshArray& getIndexedMeshArray()
- {
- return m_indexedMeshes;
- }
-
- const IndexedMeshArray& getIndexedMeshArray() const
- {
- return m_indexedMeshes;
- }
-
- virtual void preallocateVertices(int numverts){(void) numverts;}
- virtual void preallocateIndices(int numindices){(void) numindices;}
-
- virtual bool hasPremadeAabb() const;
- virtual void setPremadeAabb(const btVector3& aabbMin, const btVector3& aabbMax ) const;
- virtual void getPremadeAabb(btVector3* aabbMin, btVector3* aabbMax ) const;
-
-}
-;
-
-#endif //BT_TRIANGLE_INDEX_VERTEX_ARRAY_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.cpp
deleted file mode 100644
index dc562941ad6..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-///This file was created by Alex Silverman
-
-#include "btTriangleIndexVertexMaterialArray.h"
-
-btTriangleIndexVertexMaterialArray::btTriangleIndexVertexMaterialArray(int numTriangles,int* triangleIndexBase,int triangleIndexStride,
- int numVertices,btScalar* vertexBase,int vertexStride,
- int numMaterials, unsigned char* materialBase, int materialStride,
- int* triangleMaterialsBase, int materialIndexStride) :
-btTriangleIndexVertexArray(numTriangles, triangleIndexBase, triangleIndexStride, numVertices, vertexBase, vertexStride)
-{
- btMaterialProperties mat;
-
- mat.m_numMaterials = numMaterials;
- mat.m_materialBase = materialBase;
- mat.m_materialStride = materialStride;
-#ifdef BT_USE_DOUBLE_PRECISION
- mat.m_materialType = PHY_DOUBLE;
-#else
- mat.m_materialType = PHY_FLOAT;
-#endif
-
- mat.m_numTriangles = numTriangles;
- mat.m_triangleMaterialsBase = (unsigned char *)triangleMaterialsBase;
- mat.m_triangleMaterialStride = materialIndexStride;
- mat.m_triangleType = PHY_INTEGER;
-
- addMaterialProperties(mat);
-}
-
-
-void btTriangleIndexVertexMaterialArray::getLockedMaterialBase(unsigned char **materialBase, int& numMaterials, PHY_ScalarType& materialType, int& materialStride,
- unsigned char ** triangleMaterialBase, int& numTriangles, int& triangleMaterialStride, PHY_ScalarType& triangleType, int subpart)
-{
- btAssert(subpart< getNumSubParts() );
-
- btMaterialProperties& mats = m_materials[subpart];
-
- numMaterials = mats.m_numMaterials;
- (*materialBase) = (unsigned char *) mats.m_materialBase;
-#ifdef BT_USE_DOUBLE_PRECISION
- materialType = PHY_DOUBLE;
-#else
- materialType = PHY_FLOAT;
-#endif
- materialStride = mats.m_materialStride;
-
- numTriangles = mats.m_numTriangles;
- (*triangleMaterialBase) = (unsigned char *)mats.m_triangleMaterialsBase;
- triangleMaterialStride = mats.m_triangleMaterialStride;
- triangleType = mats.m_triangleType;
-}
-
-void btTriangleIndexVertexMaterialArray::getLockedReadOnlyMaterialBase(const unsigned char **materialBase, int& numMaterials, PHY_ScalarType& materialType, int& materialStride,
- const unsigned char ** triangleMaterialBase, int& numTriangles, int& triangleMaterialStride, PHY_ScalarType& triangleType, int subpart)
-{
- btMaterialProperties& mats = m_materials[subpart];
-
- numMaterials = mats.m_numMaterials;
- (*materialBase) = (const unsigned char *) mats.m_materialBase;
-#ifdef BT_USE_DOUBLE_PRECISION
- materialType = PHY_DOUBLE;
-#else
- materialType = PHY_FLOAT;
-#endif
- materialStride = mats.m_materialStride;
-
- numTriangles = mats.m_numTriangles;
- (*triangleMaterialBase) = (const unsigned char *)mats.m_triangleMaterialsBase;
- triangleMaterialStride = mats.m_triangleMaterialStride;
- triangleType = mats.m_triangleType;
-}
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.h b/extern/bullet2/BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.h
deleted file mode 100644
index ba4f7b46076..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-///This file was created by Alex Silverman
-
-#ifndef BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H
-#define BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H
-
-#include "btTriangleIndexVertexArray.h"
-
-
-ATTRIBUTE_ALIGNED16( struct) btMaterialProperties
-{
- ///m_materialBase ==========> 2 btScalar values make up one material, friction then restitution
- int m_numMaterials;
- const unsigned char * m_materialBase;
- int m_materialStride;
- PHY_ScalarType m_materialType;
- ///m_numTriangles <=========== This exists in the btIndexedMesh object for the same subpart, but since we're
- /// padding the structure, it can be reproduced at no real cost
- ///m_triangleMaterials =====> 1 integer value makes up one entry
- /// eg: m_triangleMaterials[1] = 5; // This will set triangle 2 to use material 5
- int m_numTriangles;
- const unsigned char * m_triangleMaterialsBase;
- int m_triangleMaterialStride;
- ///m_triangleType <========== Automatically set in addMaterialProperties
- PHY_ScalarType m_triangleType;
-};
-
-typedef btAlignedObjectArray<btMaterialProperties> MaterialArray;
-
-///Teh btTriangleIndexVertexMaterialArray is built on TriangleIndexVertexArray
-///The addition of a material array allows for the utilization of the partID and
-///triangleIndex that are returned in the ContactAddedCallback. As with
-///TriangleIndexVertexArray, no duplicate is made of the material data, so it
-///is the users responsibility to maintain the array during the lifetime of the
-///TriangleIndexVertexMaterialArray.
-ATTRIBUTE_ALIGNED16(class) btTriangleIndexVertexMaterialArray : public btTriangleIndexVertexArray
-{
-protected:
- MaterialArray m_materials;
-
-public:
- BT_DECLARE_ALIGNED_ALLOCATOR();
-
- btTriangleIndexVertexMaterialArray()
- {
- }
-
- btTriangleIndexVertexMaterialArray(int numTriangles,int* triangleIndexBase,int triangleIndexStride,
- int numVertices,btScalar* vertexBase,int vertexStride,
- int numMaterials, unsigned char* materialBase, int materialStride,
- int* triangleMaterialsBase, int materialIndexStride);
-
- virtual ~btTriangleIndexVertexMaterialArray() {}
-
- void addMaterialProperties(const btMaterialProperties& mat, PHY_ScalarType triangleType = PHY_INTEGER)
- {
- m_materials.push_back(mat);
- m_materials[m_materials.size()-1].m_triangleType = triangleType;
- }
-
- virtual void getLockedMaterialBase(unsigned char **materialBase, int& numMaterials, PHY_ScalarType& materialType, int& materialStride,
- unsigned char ** triangleMaterialBase, int& numTriangles, int& triangleMaterialStride, PHY_ScalarType& triangleType ,int subpart = 0);
-
- virtual void getLockedReadOnlyMaterialBase(const unsigned char **materialBase, int& numMaterials, PHY_ScalarType& materialType, int& materialStride,
- const unsigned char ** triangleMaterialBase, int& numTriangles, int& triangleMaterialStride, PHY_ScalarType& triangleType, int subpart = 0);
-
-}
-;
-
-#endif //BT_MULTIMATERIAL_TRIANGLE_INDEX_VERTEX_ARRAY_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleInfoMap.h b/extern/bullet2/BulletCollision/CollisionShapes/btTriangleInfoMap.h
deleted file mode 100644
index 282a7702e80..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleInfoMap.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2010 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef _BT_TRIANGLE_INFO_MAP_H
-#define _BT_TRIANGLE_INFO_MAP_H
-
-
-#include "LinearMath/btHashMap.h"
-#include "LinearMath/btSerializer.h"
-
-
-///for btTriangleInfo m_flags
-#define TRI_INFO_V0V1_CONVEX 1
-#define TRI_INFO_V1V2_CONVEX 2
-#define TRI_INFO_V2V0_CONVEX 4
-
-#define TRI_INFO_V0V1_SWAP_NORMALB 8
-#define TRI_INFO_V1V2_SWAP_NORMALB 16
-#define TRI_INFO_V2V0_SWAP_NORMALB 32
-
-
-///The btTriangleInfo structure stores information to adjust collision normals to avoid collisions against internal edges
-///it can be generated using
-struct btTriangleInfo
-{
- btTriangleInfo()
- {
- m_edgeV0V1Angle = SIMD_2_PI;
- m_edgeV1V2Angle = SIMD_2_PI;
- m_edgeV2V0Angle = SIMD_2_PI;
- m_flags=0;
- }
-
- int m_flags;
-
- btScalar m_edgeV0V1Angle;
- btScalar m_edgeV1V2Angle;
- btScalar m_edgeV2V0Angle;
-
-};
-
-typedef btHashMap<btHashInt,btTriangleInfo> btInternalTriangleInfoMap;
-
-
-///The btTriangleInfoMap stores edge angle information for some triangles. You can compute this information yourself or using btGenerateInternalEdgeInfo.
-struct btTriangleInfoMap : public btInternalTriangleInfoMap
-{
- btScalar m_convexEpsilon;///used to determine if an edge or contact normal is convex, using the dot product
- btScalar m_planarEpsilon; ///used to determine if a triangle edge is planar with zero angle
- btScalar m_equalVertexThreshold; ///used to compute connectivity: if the distance between two vertices is smaller than m_equalVertexThreshold, they are considered to be 'shared'
- btScalar m_edgeDistanceThreshold; ///used to determine edge contacts: if the closest distance between a contact point and an edge is smaller than this distance threshold it is considered to "hit the edge"
- btScalar m_zeroAreaThreshold; ///used to determine if a triangle is degenerate (length squared of cross product of 2 triangle edges < threshold)
-
-
- btTriangleInfoMap()
- {
- m_convexEpsilon = 0.00f;
- m_planarEpsilon = 0.0001f;
- m_equalVertexThreshold = btScalar(0.0001)*btScalar(0.0001);
- m_edgeDistanceThreshold = btScalar(0.1);
- m_zeroAreaThreshold = btScalar(0.0001)*btScalar(0.0001);
- }
- virtual ~btTriangleInfoMap() {}
-
- virtual int calculateSerializeBufferSize() const;
-
- ///fills the dataBuffer and returns the struct name (and 0 on failure)
- virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
-
- void deSerialize(struct btTriangleInfoMapData& data);
-
-};
-
-struct btTriangleInfoData
-{
- int m_flags;
- float m_edgeV0V1Angle;
- float m_edgeV1V2Angle;
- float m_edgeV2V0Angle;
-};
-
-struct btTriangleInfoMapData
-{
- int *m_hashTablePtr;
- int *m_nextPtr;
- btTriangleInfoData *m_valueArrayPtr;
- int *m_keyArrayPtr;
-
- float m_convexEpsilon;
- float m_planarEpsilon;
- float m_equalVertexThreshold;
- float m_edgeDistanceThreshold;
- float m_zeroAreaThreshold;
-
- int m_nextSize;
- int m_hashTableSize;
- int m_numValues;
- int m_numKeys;
- char m_padding[4];
-};
-
-SIMD_FORCE_INLINE int btTriangleInfoMap::calculateSerializeBufferSize() const
-{
- return sizeof(btTriangleInfoMapData);
-}
-
-///fills the dataBuffer and returns the struct name (and 0 on failure)
-SIMD_FORCE_INLINE const char* btTriangleInfoMap::serialize(void* dataBuffer, btSerializer* serializer) const
-{
- btTriangleInfoMapData* tmapData = (btTriangleInfoMapData*) dataBuffer;
- tmapData->m_convexEpsilon = m_convexEpsilon;
- tmapData->m_planarEpsilon = m_planarEpsilon;
- tmapData->m_equalVertexThreshold = m_equalVertexThreshold;
- tmapData->m_edgeDistanceThreshold = m_edgeDistanceThreshold;
- tmapData->m_zeroAreaThreshold = m_zeroAreaThreshold;
-
- tmapData->m_hashTableSize = m_hashTable.size();
-
- tmapData->m_hashTablePtr = tmapData->m_hashTableSize ? (int*)serializer->getUniquePointer((void*)&m_hashTable[0]) : 0;
- if (tmapData->m_hashTablePtr)
- {
- //serialize an int buffer
- int sz = sizeof(int);
- int numElem = tmapData->m_hashTableSize;
- btChunk* chunk = serializer->allocate(sz,numElem);
- int* memPtr = (int*)chunk->m_oldPtr;
- for (int i=0;i<numElem;i++,memPtr++)
- {
- *memPtr = m_hashTable[i];
- }
- serializer->finalizeChunk(chunk,"int",BT_ARRAY_CODE,(void*)&m_hashTable[0]);
-
- }
-
- tmapData->m_nextSize = m_next.size();
- tmapData->m_nextPtr = tmapData->m_nextSize? (int*)serializer->getUniquePointer((void*)&m_next[0]): 0;
- if (tmapData->m_nextPtr)
- {
- int sz = sizeof(int);
- int numElem = tmapData->m_nextSize;
- btChunk* chunk = serializer->allocate(sz,numElem);
- int* memPtr = (int*)chunk->m_oldPtr;
- for (int i=0;i<numElem;i++,memPtr++)
- {
- *memPtr = m_next[i];
- }
- serializer->finalizeChunk(chunk,"int",BT_ARRAY_CODE,(void*)&m_next[0]);
- }
-
- tmapData->m_numValues = m_valueArray.size();
- tmapData->m_valueArrayPtr = tmapData->m_numValues ? (btTriangleInfoData*)serializer->getUniquePointer((void*)&m_valueArray[0]): 0;
- if (tmapData->m_valueArrayPtr)
- {
- int sz = sizeof(btTriangleInfoData);
- int numElem = tmapData->m_numValues;
- btChunk* chunk = serializer->allocate(sz,numElem);
- btTriangleInfoData* memPtr = (btTriangleInfoData*)chunk->m_oldPtr;
- for (int i=0;i<numElem;i++,memPtr++)
- {
- memPtr->m_edgeV0V1Angle = m_valueArray[i].m_edgeV0V1Angle;
- memPtr->m_edgeV1V2Angle = m_valueArray[i].m_edgeV1V2Angle;
- memPtr->m_edgeV2V0Angle = m_valueArray[i].m_edgeV2V0Angle;
- memPtr->m_flags = m_valueArray[i].m_flags;
- }
- serializer->finalizeChunk(chunk,"btTriangleInfoData",BT_ARRAY_CODE,(void*) &m_valueArray[0]);
- }
-
- tmapData->m_numKeys = m_keyArray.size();
- tmapData->m_keyArrayPtr = tmapData->m_numKeys ? (int*)serializer->getUniquePointer((void*)&m_keyArray[0]) : 0;
- if (tmapData->m_keyArrayPtr)
- {
- int sz = sizeof(int);
- int numElem = tmapData->m_numValues;
- btChunk* chunk = serializer->allocate(sz,numElem);
- int* memPtr = (int*)chunk->m_oldPtr;
- for (int i=0;i<numElem;i++,memPtr++)
- {
- *memPtr = m_keyArray[i].getUid1();
- }
- serializer->finalizeChunk(chunk,"int",BT_ARRAY_CODE,(void*) &m_keyArray[0]);
-
- }
- return "btTriangleInfoMapData";
-}
-
-
-
-///fills the dataBuffer and returns the struct name (and 0 on failure)
-SIMD_FORCE_INLINE void btTriangleInfoMap::deSerialize(btTriangleInfoMapData& tmapData )
-{
-
-
- m_convexEpsilon = tmapData.m_convexEpsilon;
- m_planarEpsilon = tmapData.m_planarEpsilon;
- m_equalVertexThreshold = tmapData.m_equalVertexThreshold;
- m_edgeDistanceThreshold = tmapData.m_edgeDistanceThreshold;
- m_zeroAreaThreshold = tmapData.m_zeroAreaThreshold;
- m_hashTable.resize(tmapData.m_hashTableSize);
- int i =0;
- for (i=0;i<tmapData.m_hashTableSize;i++)
- {
- m_hashTable[i] = tmapData.m_hashTablePtr[i];
- }
- m_next.resize(tmapData.m_nextSize);
- for (i=0;i<tmapData.m_nextSize;i++)
- {
- m_next[i] = tmapData.m_nextPtr[i];
- }
- m_valueArray.resize(tmapData.m_numValues);
- for (i=0;i<tmapData.m_numValues;i++)
- {
- m_valueArray[i].m_edgeV0V1Angle = tmapData.m_valueArrayPtr[i].m_edgeV0V1Angle;
- m_valueArray[i].m_edgeV1V2Angle = tmapData.m_valueArrayPtr[i].m_edgeV1V2Angle;
- m_valueArray[i].m_edgeV2V0Angle = tmapData.m_valueArrayPtr[i].m_edgeV2V0Angle;
- m_valueArray[i].m_flags = tmapData.m_valueArrayPtr[i].m_flags;
- }
-
- m_keyArray.resize(tmapData.m_numKeys,btHashInt(0));
- for (i=0;i<tmapData.m_numKeys;i++)
- {
- m_keyArray[i].setUid1(tmapData.m_keyArrayPtr[i]);
- }
-}
-
-
-#endif //_BT_TRIANGLE_INFO_MAP_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleMesh.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btTriangleMesh.cpp
deleted file mode 100644
index b29e0f71e62..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleMesh.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-
-#include "btTriangleMesh.h"
-
-
-
-btTriangleMesh::btTriangleMesh (bool use32bitIndices,bool use4componentVertices)
-:m_use32bitIndices(use32bitIndices),
-m_use4componentVertices(use4componentVertices),
-m_weldingThreshold(0.0)
-{
- btIndexedMesh meshIndex;
- meshIndex.m_numTriangles = 0;
- meshIndex.m_numVertices = 0;
- meshIndex.m_indexType = PHY_INTEGER;
- meshIndex.m_triangleIndexBase = 0;
- meshIndex.m_triangleIndexStride = 3*sizeof(int);
- meshIndex.m_vertexBase = 0;
- meshIndex.m_vertexStride = sizeof(btVector3);
- m_indexedMeshes.push_back(meshIndex);
-
- if (m_use32bitIndices)
- {
- m_indexedMeshes[0].m_numTriangles = m_32bitIndices.size()/3;
- m_indexedMeshes[0].m_triangleIndexBase = 0;
- m_indexedMeshes[0].m_indexType = PHY_INTEGER;
- m_indexedMeshes[0].m_triangleIndexStride = 3*sizeof(int);
- } else
- {
- m_indexedMeshes[0].m_numTriangles = m_16bitIndices.size()/3;
- m_indexedMeshes[0].m_triangleIndexBase = 0;
- m_indexedMeshes[0].m_indexType = PHY_SHORT;
- m_indexedMeshes[0].m_triangleIndexStride = 3*sizeof(short int);
- }
-
- if (m_use4componentVertices)
- {
- m_indexedMeshes[0].m_numVertices = m_4componentVertices.size();
- m_indexedMeshes[0].m_vertexBase = 0;
- m_indexedMeshes[0].m_vertexStride = sizeof(btVector3);
- } else
- {
- m_indexedMeshes[0].m_numVertices = m_3componentVertices.size()/3;
- m_indexedMeshes[0].m_vertexBase = 0;
- m_indexedMeshes[0].m_vertexStride = 3*sizeof(btScalar);
- }
-
-
-}
-
-void btTriangleMesh::addIndex(int index)
-{
- if (m_use32bitIndices)
- {
- m_32bitIndices.push_back(index);
- m_indexedMeshes[0].m_triangleIndexBase = (unsigned char*) &m_32bitIndices[0];
- } else
- {
- m_16bitIndices.push_back(index);
- m_indexedMeshes[0].m_triangleIndexBase = (unsigned char*) &m_16bitIndices[0];
- }
-}
-
-
-int btTriangleMesh::findOrAddVertex(const btVector3& vertex, bool removeDuplicateVertices)
-{
- //return index of new/existing vertex
- ///@todo: could use acceleration structure for this
- if (m_use4componentVertices)
- {
- if (removeDuplicateVertices)
- {
- for (int i=0;i< m_4componentVertices.size();i++)
- {
- if ((m_4componentVertices[i]-vertex).length2() <= m_weldingThreshold)
- {
- return i;
- }
- }
- }
- m_indexedMeshes[0].m_numVertices++;
- m_4componentVertices.push_back(vertex);
- m_indexedMeshes[0].m_vertexBase = (unsigned char*)&m_4componentVertices[0];
-
- return m_4componentVertices.size()-1;
-
- } else
- {
-
- if (removeDuplicateVertices)
- {
- for (int i=0;i< m_3componentVertices.size();i+=3)
- {
- btVector3 vtx(m_3componentVertices[i],m_3componentVertices[i+1],m_3componentVertices[i+2]);
- if ((vtx-vertex).length2() <= m_weldingThreshold)
- {
- return i/3;
- }
- }
- }
- m_3componentVertices.push_back((float)vertex.getX());
- m_3componentVertices.push_back((float)vertex.getY());
- m_3componentVertices.push_back((float)vertex.getZ());
- m_indexedMeshes[0].m_numVertices++;
- m_indexedMeshes[0].m_vertexBase = (unsigned char*)&m_3componentVertices[0];
- return (m_3componentVertices.size()/3)-1;
- }
-
-}
-
-void btTriangleMesh::addTriangle(const btVector3& vertex0,const btVector3& vertex1,const btVector3& vertex2,bool removeDuplicateVertices)
-{
- m_indexedMeshes[0].m_numTriangles++;
- addIndex(findOrAddVertex(vertex0,removeDuplicateVertices));
- addIndex(findOrAddVertex(vertex1,removeDuplicateVertices));
- addIndex(findOrAddVertex(vertex2,removeDuplicateVertices));
-}
-
-int btTriangleMesh::getNumTriangles() const
-{
- if (m_use32bitIndices)
- {
- return m_32bitIndices.size() / 3;
- }
- return m_16bitIndices.size() / 3;
-}
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleMesh.h b/extern/bullet2/BulletCollision/CollisionShapes/btTriangleMesh.h
deleted file mode 100644
index d2624fe18e1..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleMesh.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef TRIANGLE_MESH_H
-#define TRIANGLE_MESH_H
-
-#include "btTriangleIndexVertexArray.h"
-#include "LinearMath/btVector3.h"
-#include "LinearMath/btAlignedObjectArray.h"
-
-///The btTriangleMesh class is a convenience class derived from btTriangleIndexVertexArray, that provides storage for a concave triangle mesh. It can be used as data for the btBvhTriangleMeshShape.
-///It allows either 32bit or 16bit indices, and 4 (x-y-z-w) or 3 (x-y-z) component vertices.
-///If you want to share triangle/index data between graphics mesh and collision mesh (btBvhTriangleMeshShape), you can directly use btTriangleIndexVertexArray or derive your own class from btStridingMeshInterface.
-///Performance of btTriangleMesh and btTriangleIndexVertexArray used in a btBvhTriangleMeshShape is the same.
-class btTriangleMesh : public btTriangleIndexVertexArray
-{
- btAlignedObjectArray<btVector3> m_4componentVertices;
- btAlignedObjectArray<float> m_3componentVertices;
-
- btAlignedObjectArray<unsigned int> m_32bitIndices;
- btAlignedObjectArray<unsigned short int> m_16bitIndices;
- bool m_use32bitIndices;
- bool m_use4componentVertices;
-
-
- public:
- btScalar m_weldingThreshold;
-
- btTriangleMesh (bool use32bitIndices=true,bool use4componentVertices=true);
-
- bool getUse32bitIndices() const
- {
- return m_use32bitIndices;
- }
-
- bool getUse4componentVertices() const
- {
- return m_use4componentVertices;
- }
- ///By default addTriangle won't search for duplicate vertices, because the search is very slow for large triangle meshes.
- ///In general it is better to directly use btTriangleIndexVertexArray instead.
- void addTriangle(const btVector3& vertex0,const btVector3& vertex1,const btVector3& vertex2, bool removeDuplicateVertices=false);
-
- int getNumTriangles() const;
-
- virtual void preallocateVertices(int numverts){(void) numverts;}
- virtual void preallocateIndices(int numindices){(void) numindices;}
-
- ///findOrAddVertex is an internal method, use addTriangle instead
- int findOrAddVertex(const btVector3& vertex, bool removeDuplicateVertices);
- ///addIndex is an internal method, use addTriangle instead
- void addIndex(int index);
-
-};
-
-#endif //TRIANGLE_MESH_H
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleMeshShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btTriangleMeshShape.cpp
deleted file mode 100644
index 683684da770..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleMeshShape.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btTriangleMeshShape.h"
-#include "LinearMath/btVector3.h"
-#include "LinearMath/btQuaternion.h"
-#include "btStridingMeshInterface.h"
-#include "LinearMath/btAabbUtil2.h"
-#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
-
-
-btTriangleMeshShape::btTriangleMeshShape(btStridingMeshInterface* meshInterface)
-: btConcaveShape (), m_meshInterface(meshInterface)
-{
- m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;
- if(meshInterface->hasPremadeAabb())
- {
- meshInterface->getPremadeAabb(&m_localAabbMin, &m_localAabbMax);
- }
- else
- {
- recalcLocalAabb();
- }
-}
-
-
-btTriangleMeshShape::~btTriangleMeshShape()
-{
-
-}
-
-
-
-
-void btTriangleMeshShape::getAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const
-{
-
- btVector3 localHalfExtents = btScalar(0.5)*(m_localAabbMax-m_localAabbMin);
- localHalfExtents += btVector3(getMargin(),getMargin(),getMargin());
- btVector3 localCenter = btScalar(0.5)*(m_localAabbMax+m_localAabbMin);
-
- btMatrix3x3 abs_b = trans.getBasis().absolute();
-
- btVector3 center = trans(localCenter);
-
- btVector3 extent = btVector3(abs_b[0].dot(localHalfExtents),
- abs_b[1].dot(localHalfExtents),
- abs_b[2].dot(localHalfExtents));
- aabbMin = center - extent;
- aabbMax = center + extent;
-
-
-}
-
-void btTriangleMeshShape::recalcLocalAabb()
-{
- for (int i=0;i<3;i++)
- {
- btVector3 vec(btScalar(0.),btScalar(0.),btScalar(0.));
- vec[i] = btScalar(1.);
- btVector3 tmp = localGetSupportingVertex(vec);
- m_localAabbMax[i] = tmp[i]+m_collisionMargin;
- vec[i] = btScalar(-1.);
- tmp = localGetSupportingVertex(vec);
- m_localAabbMin[i] = tmp[i]-m_collisionMargin;
- }
-}
-
-
-
-class SupportVertexCallback : public btTriangleCallback
-{
-
- btVector3 m_supportVertexLocal;
-public:
-
- btTransform m_worldTrans;
- btScalar m_maxDot;
- btVector3 m_supportVecLocal;
-
- SupportVertexCallback(const btVector3& supportVecWorld,const btTransform& trans)
- : m_supportVertexLocal(btScalar(0.),btScalar(0.),btScalar(0.)), m_worldTrans(trans) ,m_maxDot(btScalar(-BT_LARGE_FLOAT))
-
- {
- m_supportVecLocal = supportVecWorld * m_worldTrans.getBasis();
- }
-
- virtual void processTriangle( btVector3* triangle,int partId, int triangleIndex)
- {
- (void)partId;
- (void)triangleIndex;
- for (int i=0;i<3;i++)
- {
- btScalar dot = m_supportVecLocal.dot(triangle[i]);
- if (dot > m_maxDot)
- {
- m_maxDot = dot;
- m_supportVertexLocal = triangle[i];
- }
- }
- }
-
- btVector3 GetSupportVertexWorldSpace()
- {
- return m_worldTrans(m_supportVertexLocal);
- }
-
- btVector3 GetSupportVertexLocal()
- {
- return m_supportVertexLocal;
- }
-
-};
-
-
-void btTriangleMeshShape::setLocalScaling(const btVector3& scaling)
-{
- m_meshInterface->setScaling(scaling);
- recalcLocalAabb();
-}
-
-const btVector3& btTriangleMeshShape::getLocalScaling() const
-{
- return m_meshInterface->getScaling();
-}
-
-
-
-
-
-
-//#define DEBUG_TRIANGLE_MESH
-
-
-
-void btTriangleMeshShape::processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
-{
- struct FilteredCallback : public btInternalTriangleIndexCallback
- {
- btTriangleCallback* m_callback;
- btVector3 m_aabbMin;
- btVector3 m_aabbMax;
-
- FilteredCallback(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax)
- :m_callback(callback),
- m_aabbMin(aabbMin),
- m_aabbMax(aabbMax)
- {
- }
-
- virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
- {
- if (TestTriangleAgainstAabb2(&triangle[0],m_aabbMin,m_aabbMax))
- {
- //check aabb in triangle-space, before doing this
- m_callback->processTriangle(triangle,partId,triangleIndex);
- }
-
- }
-
- };
-
- FilteredCallback filterCallback(callback,aabbMin,aabbMax);
-
- m_meshInterface->InternalProcessAllTriangles(&filterCallback,aabbMin,aabbMax);
-}
-
-
-
-
-
-void btTriangleMeshShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
-{
- (void)mass;
- //moving concave objects not supported
- btAssert(0);
- inertia.setValue(btScalar(0.),btScalar(0.),btScalar(0.));
-}
-
-
-btVector3 btTriangleMeshShape::localGetSupportingVertex(const btVector3& vec) const
-{
- btVector3 supportVertex;
-
- btTransform ident;
- ident.setIdentity();
-
- SupportVertexCallback supportCallback(vec,ident);
-
- btVector3 aabbMax(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT));
-
- processAllTriangles(&supportCallback,-aabbMax,aabbMax);
-
- supportVertex = supportCallback.GetSupportVertexLocal();
-
- return supportVertex;
-}
-
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleMeshShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btTriangleMeshShape.h
deleted file mode 100644
index 2216698d275..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleMeshShape.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef TRIANGLE_MESH_SHAPE_H
-#define TRIANGLE_MESH_SHAPE_H
-
-#include "btConcaveShape.h"
-#include "btStridingMeshInterface.h"
-
-
-///The btTriangleMeshShape is an internal concave triangle mesh interface. Don't use this class directly, use btBvhTriangleMeshShape instead.
-class btTriangleMeshShape : public btConcaveShape
-{
-protected:
- btVector3 m_localAabbMin;
- btVector3 m_localAabbMax;
- btStridingMeshInterface* m_meshInterface;
-
- ///btTriangleMeshShape constructor has been disabled/protected, so that users will not mistakenly use this class.
- ///Don't use btTriangleMeshShape but use btBvhTriangleMeshShape instead!
- btTriangleMeshShape(btStridingMeshInterface* meshInterface);
-
-public:
-
- virtual ~btTriangleMeshShape();
-
- virtual btVector3 localGetSupportingVertex(const btVector3& vec) const;
-
- virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const
- {
- btAssert(0);
- return localGetSupportingVertex(vec);
- }
-
- void recalcLocalAabb();
-
- virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
-
- virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
-
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
-
- virtual void setLocalScaling(const btVector3& scaling);
- virtual const btVector3& getLocalScaling() const;
-
- btStridingMeshInterface* getMeshInterface()
- {
- return m_meshInterface;
- }
-
- const btStridingMeshInterface* getMeshInterface() const
- {
- return m_meshInterface;
- }
-
- const btVector3& getLocalAabbMin() const
- {
- return m_localAabbMin;
- }
- const btVector3& getLocalAabbMax() const
- {
- return m_localAabbMax;
- }
-
-
-
- //debugging
- virtual const char* getName()const {return "TRIANGLEMESH";}
-
-
-
-};
-
-
-
-
-#endif //TRIANGLE_MESH_SHAPE_H
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btTriangleShape.h
deleted file mode 100644
index 847147cf6b4..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btTriangleShape.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef OBB_TRIANGLE_MINKOWSKI_H
-#define OBB_TRIANGLE_MINKOWSKI_H
-
-#include "btConvexShape.h"
-#include "btBoxShape.h"
-
-ATTRIBUTE_ALIGNED16(class) btTriangleShape : public btPolyhedralConvexShape
-{
-
-
-public:
-
- btVector3 m_vertices1[3];
-
- virtual int getNumVertices() const
- {
- return 3;
- }
-
- btVector3& getVertexPtr(int index)
- {
- return m_vertices1[index];
- }
-
- const btVector3& getVertexPtr(int index) const
- {
- return m_vertices1[index];
- }
- virtual void getVertex(int index,btVector3& vert) const
- {
- vert = m_vertices1[index];
- }
-
- virtual int getNumEdges() const
- {
- return 3;
- }
-
- virtual void getEdge(int i,btVector3& pa,btVector3& pb) const
- {
- getVertex(i,pa);
- getVertex((i+1)%3,pb);
- }
-
-
- virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax)const
- {
-// btAssert(0);
- getAabbSlow(t,aabbMin,aabbMax);
- }
-
- btVector3 localGetSupportingVertexWithoutMargin(const btVector3& dir)const
- {
- btVector3 dots(dir.dot(m_vertices1[0]), dir.dot(m_vertices1[1]), dir.dot(m_vertices1[2]));
- return m_vertices1[dots.maxAxis()];
-
- }
-
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
- {
- for (int i=0;i<numVectors;i++)
- {
- const btVector3& dir = vectors[i];
- btVector3 dots(dir.dot(m_vertices1[0]), dir.dot(m_vertices1[1]), dir.dot(m_vertices1[2]));
- supportVerticesOut[i] = m_vertices1[dots.maxAxis()];
- }
-
- }
-
- btTriangleShape() : btPolyhedralConvexShape ()
- {
- m_shapeType = TRIANGLE_SHAPE_PROXYTYPE;
- }
-
- btTriangleShape(const btVector3& p0,const btVector3& p1,const btVector3& p2) : btPolyhedralConvexShape ()
- {
- m_shapeType = TRIANGLE_SHAPE_PROXYTYPE;
- m_vertices1[0] = p0;
- m_vertices1[1] = p1;
- m_vertices1[2] = p2;
- }
-
-
- virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i) const
- {
- getPlaneEquation(i,planeNormal,planeSupport);
- }
-
- virtual int getNumPlanes() const
- {
- return 1;
- }
-
- void calcNormal(btVector3& normal) const
- {
- normal = (m_vertices1[1]-m_vertices1[0]).cross(m_vertices1[2]-m_vertices1[0]);
- normal.normalize();
- }
-
- virtual void getPlaneEquation(int i, btVector3& planeNormal,btVector3& planeSupport) const
- {
- (void)i;
- calcNormal(planeNormal);
- planeSupport = m_vertices1[0];
- }
-
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const
- {
- (void)mass;
- btAssert(0);
- inertia.setValue(btScalar(0.),btScalar(0.),btScalar(0.));
- }
-
- virtual bool isInside(const btVector3& pt,btScalar tolerance) const
- {
- btVector3 normal;
- calcNormal(normal);
- //distance to plane
- btScalar dist = pt.dot(normal);
- btScalar planeconst = m_vertices1[0].dot(normal);
- dist -= planeconst;
- if (dist >= -tolerance && dist <= tolerance)
- {
- //inside check on edge-planes
- int i;
- for (i=0;i<3;i++)
- {
- btVector3 pa,pb;
- getEdge(i,pa,pb);
- btVector3 edge = pb-pa;
- btVector3 edgeNormal = edge.cross(normal);
- edgeNormal.normalize();
- btScalar dist = pt.dot( edgeNormal);
- btScalar edgeConst = pa.dot(edgeNormal);
- dist -= edgeConst;
- if (dist < -tolerance)
- return false;
- }
-
- return true;
- }
-
- return false;
- }
- //debugging
- virtual const char* getName()const
- {
- return "Triangle";
- }
-
- virtual int getNumPreferredPenetrationDirections() const
- {
- return 2;
- }
-
- virtual void getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const
- {
- calcNormal(penetrationVector);
- if (index)
- penetrationVector *= btScalar(-1.);
- }
-
-
-};
-
-#endif //OBB_TRIANGLE_MINKOWSKI_H
-
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btUniformScalingShape.cpp b/extern/bullet2/BulletCollision/CollisionShapes/btUniformScalingShape.cpp
deleted file mode 100644
index 8e86f6bf290..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btUniformScalingShape.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "btUniformScalingShape.h"
-
-btUniformScalingShape::btUniformScalingShape( btConvexShape* convexChildShape,btScalar uniformScalingFactor):
-btConvexShape (), m_childConvexShape(convexChildShape),
-m_uniformScalingFactor(uniformScalingFactor)
-{
- m_shapeType = UNIFORM_SCALING_SHAPE_PROXYTYPE;
-}
-
-btUniformScalingShape::~btUniformScalingShape()
-{
-}
-
-
-btVector3 btUniformScalingShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
-{
- btVector3 tmpVertex;
- tmpVertex = m_childConvexShape->localGetSupportingVertexWithoutMargin(vec);
- return tmpVertex*m_uniformScalingFactor;
-}
-
-void btUniformScalingShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
-{
- m_childConvexShape->batchedUnitVectorGetSupportingVertexWithoutMargin(vectors,supportVerticesOut,numVectors);
- int i;
- for (i=0;i<numVectors;i++)
- {
- supportVerticesOut[i] = supportVerticesOut[i] * m_uniformScalingFactor;
- }
-}
-
-
-btVector3 btUniformScalingShape::localGetSupportingVertex(const btVector3& vec)const
-{
- btVector3 tmpVertex;
- tmpVertex = m_childConvexShape->localGetSupportingVertex(vec);
- return tmpVertex*m_uniformScalingFactor;
-}
-
-
-void btUniformScalingShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
-{
-
- ///this linear upscaling is not realistic, but we don't deal with large mass ratios...
- btVector3 tmpInertia;
- m_childConvexShape->calculateLocalInertia(mass,tmpInertia);
- inertia = tmpInertia * m_uniformScalingFactor;
-}
-
-
- ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
-void btUniformScalingShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
-{
- m_childConvexShape->getAabb(t,aabbMin,aabbMax);
- btVector3 aabbCenter = (aabbMax+aabbMin)*btScalar(0.5);
- btVector3 scaledAabbHalfExtends = (aabbMax-aabbMin)*btScalar(0.5)*m_uniformScalingFactor;
-
- aabbMin = aabbCenter - scaledAabbHalfExtends;
- aabbMax = aabbCenter + scaledAabbHalfExtends;
-
-}
-
-void btUniformScalingShape::getAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
-{
- m_childConvexShape->getAabbSlow(t,aabbMin,aabbMax);
- btVector3 aabbCenter = (aabbMax+aabbMin)*btScalar(0.5);
- btVector3 scaledAabbHalfExtends = (aabbMax-aabbMin)*btScalar(0.5)*m_uniformScalingFactor;
-
- aabbMin = aabbCenter - scaledAabbHalfExtends;
- aabbMax = aabbCenter + scaledAabbHalfExtends;
-}
-
-void btUniformScalingShape::setLocalScaling(const btVector3& scaling)
-{
- m_childConvexShape->setLocalScaling(scaling);
-}
-
-const btVector3& btUniformScalingShape::getLocalScaling() const
-{
- return m_childConvexShape->getLocalScaling();
-}
-
-void btUniformScalingShape::setMargin(btScalar margin)
-{
- m_childConvexShape->setMargin(margin);
-}
-btScalar btUniformScalingShape::getMargin() const
-{
- return m_childConvexShape->getMargin() * m_uniformScalingFactor;
-}
-
-int btUniformScalingShape::getNumPreferredPenetrationDirections() const
-{
- return m_childConvexShape->getNumPreferredPenetrationDirections();
-}
-
-void btUniformScalingShape::getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const
-{
- m_childConvexShape->getPreferredPenetrationDirection(index,penetrationVector);
-}
diff --git a/extern/bullet2/BulletCollision/CollisionShapes/btUniformScalingShape.h b/extern/bullet2/BulletCollision/CollisionShapes/btUniformScalingShape.h
deleted file mode 100644
index cbf7e6fd3ed..00000000000
--- a/extern/bullet2/BulletCollision/CollisionShapes/btUniformScalingShape.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. 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.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef BT_UNIFORM_SCALING_SHAPE_H
-#define BT_UNIFORM_SCALING_SHAPE_H
-
-#include "btConvexShape.h"
-#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
-
-///The btUniformScalingShape allows to re-use uniform scaled instances of btConvexShape in a memory efficient way.
-///Istead of using btUniformScalingShape, it is better to use the non-uniform setLocalScaling method on convex shapes that implement it.
-class btUniformScalingShape : public btConvexShape
-{
- btConvexShape* m_childConvexShape;
-
- btScalar m_uniformScalingFactor;
-
- public:
-
- btUniformScalingShape( btConvexShape* convexChildShape, btScalar uniformScalingFactor);
-
- virtual ~btUniformScalingShape();
-
- virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
-
- virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
-
- virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
-
- virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
-
- btScalar getUniformScalingFactor() const
- {
- return m_uniformScalingFactor;
- }
-
- btConvexShape* getChildShape()
- {
- return m_childConvexShape;
- }
-
- const btConvexShape* getChildShape() const
- {
- return m_childConvexShape;
- }
-
- virtual const char* getName()const
- {
- return "UniformScalingShape";
- }
-
-
-
- ///////////////////////////
-
-
- ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
- void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
-
- virtual void getAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
-
- virtual void setLocalScaling(const btVector3& scaling) ;
- virtual const btVector3& getLocalScaling() const ;
-
- virtual void setMargin(btScalar margin);
- virtual btScalar getMargin() const;
-
- virtual int getNumPreferredPenetrationDirections() const;
-
- virtual void getPreferredPenetrationDirection(int index, btVector3& penetrationVector) const;
-
-
-};
-
-#endif //BT_UNIFORM_SCALING_SHAPE_H