summaryrefslogtreecommitdiff
path: root/Demos
diff options
context:
space:
mode:
authorejcoumans <ejcoumans@08e121b0-ae19-0410-a57b-3be3395fd4fd>2006-09-27 20:43:51 +0000
committerejcoumans <ejcoumans@08e121b0-ae19-0410-a57b-3be3395fd4fd>2006-09-27 20:43:51 +0000
commiteb23bb5c0cd4dcf43aab8df3e6681c113a34596f (patch)
tree12532b73992581860036d0dc8b3f9b41d01a73bc /Demos
parentd1e9a885f34cf85afd09abcbe9263b54d6ffcac2 (diff)
downloadbullet3-eb23bb5c0cd4dcf43aab8df3e6681c113a34596f.tar.gz
merged most of the changes from the branch into trunk, except for COLLADA, libxml and glut glitches.
Still need to verify to make sure no unwanted renaming is introduced.
Diffstat (limited to 'Demos')
-rw-r--r--Demos/BspDemo/BspConverter.cpp42
-rw-r--r--Demos/BspDemo/BspConverter.h8
-rw-r--r--Demos/BspDemo/BspDemo.cpp24
-rw-r--r--Demos/BspDemo/BspLoader.cpp6
-rw-r--r--Demos/BspDemo/BspLoader.h6
-rw-r--r--Demos/CcdPhysicsDemo/CcdPhysicsDemo.cpp126
-rw-r--r--Demos/CcdPhysicsDemo/MyMotionState.cpp6
-rw-r--r--Demos/CcdPhysicsDemo/MyMotionState.h4
-rw-r--r--Demos/ColladaDemo/ColladaConverter.cpp134
-rw-r--r--Demos/ColladaDemo/ColladaConverter.h30
-rw-r--r--Demos/ColladaDemo/ColladaDemo.cpp36
-rw-r--r--Demos/CollisionDemo/CollisionDemo.cpp58
-rw-r--r--Demos/CollisionInterfaceDemo/CollisionInterfaceDemo.cpp62
-rw-r--r--Demos/CollisionInterfaceDemo/CollisionInterfaceDemo.h2
-rw-r--r--Demos/ConcaveDemo/ConcavePhysicsDemo.cpp44
-rw-r--r--Demos/ConcaveDemo/MyMotionState.cpp6
-rw-r--r--Demos/ConcaveDemo/MyMotionState.h4
-rw-r--r--Demos/ConstraintDemo/ConstraintDemo.cpp16
-rw-r--r--Demos/ConstraintDemo/ConstraintDemo.h2
-rw-r--r--Demos/ConstraintDemo/MyMotionState.cpp6
-rw-r--r--Demos/ConstraintDemo/MyMotionState.h4
-rw-r--r--Demos/ContinuousConvexCollision/ContinuousConvexCollision.h2
-rw-r--r--Demos/ContinuousConvexCollision/ContinuousConvexCollisionDemo.cpp110
-rw-r--r--Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp60
-rw-r--r--Demos/ConvexHullDistance/ConvexHullDistanceDemo.cpp52
-rw-r--r--Demos/EPAPenDepthDemo/EpaPenDepthDemo.cpp96
-rw-r--r--Demos/ForkLiftDemo/ForkLiftDemo.cpp62
-rw-r--r--Demos/GjkConvexCastDemo/LinearConvexCastDemo.cpp70
-rw-r--r--Demos/OpenGL/BMF_Api.cpp6
-rw-r--r--Demos/OpenGL/BMF_Api.h6
-rw-r--r--Demos/OpenGL/BMF_BitmapFont.cpp6
-rw-r--r--Demos/OpenGL/BMF_BitmapFont.h6
-rw-r--r--Demos/OpenGL/BMF_FontData.h6
-rw-r--r--Demos/OpenGL/BMF_Fonts.h6
-rw-r--r--Demos/OpenGL/BMF_Settings.h6
-rw-r--r--Demos/OpenGL/BMF_font_helv10.cpp6
-rw-r--r--Demos/OpenGL/DebugCastResult.h26
-rw-r--r--Demos/OpenGL/DemoApplication.cpp404
-rw-r--r--Demos/OpenGL/DemoApplication.h39
-rw-r--r--Demos/OpenGL/GLDebugDrawer.cpp12
-rw-r--r--Demos/OpenGL/GLDebugDrawer.h8
-rw-r--r--Demos/OpenGL/GL_ShapeDrawer.cpp62
-rw-r--r--Demos/OpenGL/GL_ShapeDrawer.h6
-rw-r--r--Demos/OpenGL/GL_Simplex1to4.cpp8
-rw-r--r--Demos/OpenGL/GL_Simplex1to4.h6
-rw-r--r--Demos/OpenGL/RenderTexture.cpp4
-rw-r--r--Demos/OpenGL/RenderTexture.h4
-rw-r--r--Demos/Raytracer/Raytracer.cpp100
-rw-r--r--Demos/SimplexDemo/SimplexDemo.cpp26
-rw-r--r--Demos/UserCollisionAlgorithm/UserCollisionAlgorithm.cpp42
-rw-r--r--Demos/VehicleDemo/VehicleDemo.cpp62
51 files changed, 1061 insertions, 874 deletions
diff --git a/Demos/BspDemo/BspConverter.cpp b/Demos/BspDemo/BspConverter.cpp
index 05a60049a..2c9475a56 100644
--- a/Demos/BspDemo/BspConverter.cpp
+++ b/Demos/BspDemo/BspConverter.cpp
@@ -16,12 +16,12 @@ subject to the following restrictions:
#include "BspConverter.h"
#include "BspLoader.h"
#include "CcdPhysicsEnvironment.h"
-#include "LinearMath/SimdVector3.h"
+#include "LinearMath/btVector3.h"
void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
{
{
- SimdVector3 playerStart (0.f, 0.f, 100.f);
+ btVector3 playerStart (0.f, 0.f, 100.f);
if (bspLoader.findVectorByName(&playerStart[0],"info_player_start"))
{
@@ -53,7 +53,7 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
for (int b=0;b<leaf.numLeafBrushes;b++)
{
- std::vector<SimdVector3> planeEquations;
+ std::vector<btVector3> planeEquations;
int brushid = bspLoader.m_dleafbrushes[leaf.firstLeafBrush+b];
@@ -70,7 +70,7 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
BSPBrushSide& brushside = bspLoader.m_dbrushsides[sideid];
int planeid = brushside.planeNum;
BSPPlane& plane = bspLoader.m_dplanes[planeid];
- SimdVector3 planeEq;
+ btVector3 planeEq;
planeEq.setValue(
plane.normal[0],
plane.normal[1],
@@ -83,13 +83,13 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
if (isValidBrush)
{
- std::vector<SimdVector3> vertices;
+ std::vector<btVector3> vertices;
getVerticesFromPlaneEquations(planeEquations,vertices);
printf("getVerticesFromPlaneEquations returned %i\n",(int)vertices.size());
bool isEntity = false;
- SimdVector3 entityTarget(0.f,0.f,0.f);
+ btVector3 entityTarget(0.f,0.f,0.f);
AddConvexVerticesCollider(vertices,isEntity,entityTarget);
}
@@ -109,7 +109,7 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
const BSPEntity& entity = bspLoader.m_entities[i];
const char* cl = bspLoader.ValueForKey(&entity,"classname");
if ( !strcmp( cl, "trigger_push" ) ) {
- SimdVector3 targetLocation(0.f,0.f,0.f);
+ btVector3 targetLocation(0.f,0.f,0.f);
cl = bspLoader.ValueForKey(&entity,"target");
if ( strcmp( cl, "" ) ) {
@@ -136,7 +136,7 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
const BSPModel& model = bspLoader.m_dmodels[modelnr];
for (int n=0;n<model.numBrushes;n++)
{
- std::vector<SimdVector3> planeEquations;
+ std::vector<btVector3> planeEquations;
bool isValidBrush = false;
//convert brush
@@ -148,7 +148,7 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
BSPBrushSide& brushside = bspLoader.m_dbrushsides[sideid];
int planeid = brushside.planeNum;
BSPPlane& plane = bspLoader.m_dplanes[planeid];
- SimdVector3 planeEq;
+ btVector3 planeEq;
planeEq.setValue(
plane.normal[0],
plane.normal[1],
@@ -160,7 +160,7 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
if (isValidBrush)
{
- std::vector<SimdVector3> vertices;
+ std::vector<btVector3> vertices;
getVerticesFromPlaneEquations(planeEquations,vertices);
bool isEntity=true;
@@ -197,27 +197,27 @@ void BspConverter::convertBsp(BspLoader& bspLoader,float scaling)
-void BspConverter::getVerticesFromPlaneEquations(const std::vector<SimdVector3>& planeEquations , std::vector<SimdVector3>& verticesOut )
+void BspConverter::getVerticesFromPlaneEquations(const std::vector<btVector3>& planeEquations , std::vector<btVector3>& verticesOut )
{
const int numbrushes = planeEquations.size();
// brute force:
for (int i=0;i<numbrushes;i++)
{
- const SimdVector3& N1 = planeEquations[i];
+ const btVector3& N1 = planeEquations[i];
for (int j=i+1;j<numbrushes;j++)
{
- const SimdVector3& N2 = planeEquations[j];
+ const btVector3& N2 = planeEquations[j];
for (int k=j+1;k<numbrushes;k++)
{
- const SimdVector3& N3 = planeEquations[k];
+ const btVector3& N3 = planeEquations[k];
- SimdVector3 n2n3; n2n3 = N2.cross(N3);
- SimdVector3 n3n1; n3n1 = N3.cross(N1);
- SimdVector3 n1n2; n1n2 = N1.cross(N2);
+ btVector3 n2n3; n2n3 = N2.cross(N3);
+ btVector3 n3n1; n3n1 = N3.cross(N1);
+ btVector3 n1n2; n1n2 = N1.cross(N2);
if ( ( n2n3.length2() > 0.0001f ) &&
( n3n1.length2() > 0.0001f ) &&
@@ -231,13 +231,13 @@ void BspConverter::getVerticesFromPlaneEquations(const std::vector<SimdVector3>&
float quotient = (N1.dot(n2n3));
- if (SimdFabs(quotient) > 0.000001f)
+ if (btFabs(quotient) > 0.000001f)
{
quotient = -1.f / quotient;
n2n3 *= N1[3];
n3n1 *= N2[3];
n1n2 *= N3[3];
- SimdVector3 potentialVertex = n2n3;
+ btVector3 potentialVertex = n2n3;
potentialVertex += n3n1;
potentialVertex += n1n2;
potentialVertex *= quotient;
@@ -257,12 +257,12 @@ void BspConverter::getVerticesFromPlaneEquations(const std::vector<SimdVector3>&
-bool BspConverter::isInside(const std::vector<SimdVector3>& planeEquations, const SimdVector3& point, float margin)
+bool BspConverter::isInside(const std::vector<btVector3>& planeEquations, const btVector3& point, float margin)
{
int numbrushes = planeEquations.size();
for (int i=0;i<numbrushes;i++)
{
- const SimdVector3& N1 = planeEquations[i];
+ const btVector3& N1 = planeEquations[i];
float dist = float(N1.dot(point))+float(N1[3])-margin;
if (dist>0.f)
{
diff --git a/Demos/BspDemo/BspConverter.h b/Demos/BspDemo/BspConverter.h
index dc9e99981..7054cb492 100644
--- a/Demos/BspDemo/BspConverter.h
+++ b/Demos/BspDemo/BspConverter.h
@@ -18,7 +18,7 @@ subject to the following restrictions:
class BspLoader;
#include <vector>
-#include "LinearMath/SimdVector3.h"
+#include "LinearMath/btVector3.h"
///BspConverter turns a loaded bsp level into convex parts (vertices)
class BspConverter
@@ -31,11 +31,11 @@ class BspConverter
}
///Utility function to create vertices from a Quake Brush. Brute force but it works.
///Bit overkill to use QHull package
- void getVerticesFromPlaneEquations(const std::vector<SimdVector3>& planeEquations , std::vector<SimdVector3>& verticesOut );
- bool isInside(const std::vector<SimdVector3>& planeEquations, const SimdVector3& point, float margin);
+ void getVerticesFromPlaneEquations(const std::vector<btVector3>& planeEquations , std::vector<btVector3>& verticesOut );
+ bool isInside(const std::vector<btVector3>& planeEquations, const btVector3& point, float margin);
///this callback is called for each brush that succesfully converted into vertices
- virtual void AddConvexVerticesCollider(std::vector<SimdVector3>& vertices, bool isEntity, const SimdVector3& entityTargetLocation) = 0;
+ virtual void AddConvexVerticesCollider(std::vector<btVector3>& vertices, bool isEntity, const btVector3& entityTargetLocation) = 0;
};
diff --git a/Demos/BspDemo/BspDemo.cpp b/Demos/BspDemo/BspDemo.cpp
index 957a70609..6a3cdb4e3 100644
--- a/Demos/BspDemo/BspDemo.cpp
+++ b/Demos/BspDemo/BspDemo.cpp
@@ -18,8 +18,8 @@ subject to the following restrictions:
#include "btBulletDynamicsCommon.h"
-#include "LinearMath/GenQuickprof.h"
-#include "LinearMath/GenIDebugDraw.h"
+#include "LinearMath/btQuickprof.h"
+#include "LinearMath/btIDebugDraw.h"
#include "GLDebugDrawer.h"
@@ -60,7 +60,7 @@ public:
{
}
- virtual void AddConvexVerticesCollider(std::vector<SimdVector3>& vertices, bool isEntity, const SimdVector3& entityTargetLocation)
+ virtual void AddConvexVerticesCollider(std::vector<btVector3>& vertices, bool isEntity, const btVector3& entityTargetLocation)
{
///perhaps we can do something special with entities (isEntity)
///like adding a collision Triggering (as example)
@@ -69,12 +69,12 @@ public:
{
bool isDynamic = false;
float mass = 0.f;
- SimdTransform startTransform;
+ btTransform startTransform;
//can use a shift
startTransform.setIdentity();
- startTransform.setOrigin(SimdVector3(0,0,-10.f));
+ startTransform.setOrigin(btVector3(0,0,-10.f));
//this create an internal copy of the vertices
- CollisionShape* shape = new ConvexHullShape(&vertices[0],vertices.size());
+ btCollisionShape* shape = new btConvexHullShape(&vertices[0],vertices.size());
m_demoApp->LocalCreatePhysicsObject(isDynamic, mass, startTransform,shape);
}
@@ -128,15 +128,15 @@ void BspDemo::initPhysics(char* bspfilename)
{
- m_cameraUp = SimdVector3(0,0,1);
+ m_cameraUp = btVector3(0,0,1);
m_forwardAxis = 1;
///Setup a Physics Simulation Environment
- CollisionDispatcher* dispatcher = new CollisionDispatcher();
- SimdVector3 worldAabbMin(-10000,-10000,-10000);
- SimdVector3 worldAabbMax(10000,10000,10000);
- OverlappingPairCache* broadphase = new AxisSweep3(worldAabbMin,worldAabbMax);
- //BroadphaseInterface* broadphase = new SimpleBroadphase();
+ btCollisionDispatcher* dispatcher = new btCollisionDispatcher();
+ btVector3 worldAabbMin(-10000,-10000,-10000);
+ btVector3 worldAabbMax(10000,10000,10000);
+ btOverlappingPairCache* broadphase = new btAxisSweep3(worldAabbMin,worldAabbMax);
+ //BroadphaseInterface* broadphase = new btSimpleBroadphase();
m_physicsEnvironmentPtr = new CcdPhysicsEnvironment(dispatcher,broadphase);
m_physicsEnvironmentPtr->setDeactivationTime(2.f);
m_physicsEnvironmentPtr->setGravity(0,0,-10);
diff --git a/Demos/BspDemo/BspLoader.cpp b/Demos/BspDemo/BspLoader.cpp
index f4f36badd..c4b3e437b 100644
--- a/Demos/BspDemo/BspLoader.cpp
+++ b/Demos/BspDemo/BspLoader.cpp
@@ -5,16 +5,16 @@ Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
+and/or modify it under the terms of the GNU bteral Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Quake III Arena source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+GNU bteral Public License for more details.
-You should have received a copy of the GNU General Public License
+You should have received a copy of the GNU bteral Public License
along with Foobar; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
diff --git a/Demos/BspDemo/BspLoader.h b/Demos/BspDemo/BspLoader.h
index c89a8a125..36874f051 100644
--- a/Demos/BspDemo/BspLoader.h
+++ b/Demos/BspDemo/BspLoader.h
@@ -5,16 +5,16 @@ Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
+and/or modify it under the terms of the GNU bteral Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Quake III Arena source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+GNU bteral Public License for more details.
-You should have received a copy of the GNU General Public License
+You should have received a copy of the GNU bteral Public License
along with Foobar; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
diff --git a/Demos/CcdPhysicsDemo/CcdPhysicsDemo.cpp b/Demos/CcdPhysicsDemo/CcdPhysicsDemo.cpp
index b71d89ebb..6c4a5ec99 100644
--- a/Demos/CcdPhysicsDemo/CcdPhysicsDemo.cpp
+++ b/Demos/CcdPhysicsDemo/CcdPhysicsDemo.cpp
@@ -13,28 +13,17 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
-
//#define USER_DEFINED_FRICTION_MODEL 1
//#define PRINT_CONTACT_STATISTICS 1
#define REGISTER_CUSTOM_COLLISION_ALGORITHM 1
-#include "CcdPhysicsEnvironment.h"
-#include "ParallelPhysicsEnvironment.h"
-
#include "btBulletDynamicsCommon.h"
-#include "CcdPhysicsController.h"
-#include "MyMotionState.h"
-
-#include "ParallelIslandDispatcher.h"
-
-#include "LinearMath/GenQuickprof.h"
-#include "LinearMath/GenIDebugDraw.h"
+#include "LinearMath/btQuickprof.h"
+#include "LinearMath/btIDebugDraw.h"
#include "GLDebugDrawer.h"
-
-
#include "PHY_Pro.h"
#include "BMF_Api.h"
#include <stdio.h> //printf debugging
@@ -68,40 +57,35 @@ const int maxNumObjects = 32760;
int shapeIndex[maxNumObjects];
-#ifdef USE_PARALLEL_DISPATCHER
-ParallelPhysicsEnvironment* m_physicsEnvironmentPtr = 0;
-#else
-CcdPhysicsEnvironment* m_physicsEnvironmentPtr = 0;
-#endif
#define CUBE_HALF_EXTENTS 1
#define EXTRA_HEIGHT -20.f
-//GL_LineSegmentShape shapeE(SimdPoint3(-50,0,0),
-// SimdPoint3(50,0,0));
+//GL_LineSegmentShape shapeE(btPoint3(-50,0,0),
+// btPoint3(50,0,0));
static const int numShapes = 4;
-CollisionShape* shapePtr[numShapes] =
+btCollisionShape* shapePtr[numShapes] =
{
///Please don't make the box sizes larger then 1000: the collision detection will be inaccurate.
///See http://www.continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=346
//#define USE_GROUND_PLANE 1
#ifdef USE_GROUND_PLANE
- new StaticPlaneShape(SimdVector3(0,1,0),10),
+ new btStaticPlaneShape(btVector3(0,1,0),10),
#else
- new BoxShape (SimdVector3(50,10,50)),
+ new btBoxShape (btVector3(50,10,50)),
#endif
- new BoxShape (SimdVector3(CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS)),
- new SphereShape (CUBE_HALF_EXTENTS- 0.05f),
+ new btBoxShape (btVector3(CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS)),
+ new btSphereShape (CUBE_HALF_EXTENTS- 0.05f),
- //new ConeShape(CUBE_HALF_EXTENTS,2.f*CUBE_HALF_EXTENTS),
- //new BU_Simplex1to4(SimdPoint3(-1,-1,-1),SimdPoint3(1,-1,-1),SimdPoint3(-1,1,-1),SimdPoint3(0,0,1)),
+ //new btConeShape(CUBE_HALF_EXTENTS,2.f*CUBE_HALF_EXTENTS),
+ //new btBU_Simplex1to4(btPoint3(-1,-1,-1),btPoint3(1,-1,-1),btPoint3(-1,1,-1),btPoint3(0,0,1)),
- //new EmptyShape(),
+ //new btEmptyShape(),
- new BoxShape (SimdVector3(0.4,1,0.8))
+ new btBoxShape (btVector3(0.4,1,0.8))
};
@@ -138,19 +122,17 @@ void CcdPhysicsDemo::clientMoveAndDisplay()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
-
- if (m_physicsEnvironmentPtr)
- m_physicsEnvironmentPtr->proceedDeltaTime(0.f,deltaTime);
-
+ if (m_dynamicsWorld)
+ m_dynamicsWorld->stepSimulation(deltaTime);
+
#ifdef USE_QUICKPROF
- Profiler::beginBlock("render");
+ btProfiler::beginBlock("render");
#endif //USE_QUICKPROF
renderme();
#ifdef USE_QUICKPROF
- Profiler::endBlock("render");
+ btProfiler::endBlock("render");
#endif
glFlush();
//some additional debugging info
@@ -171,12 +153,15 @@ void CcdPhysicsDemo::displayCallback(void) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ /*
if (m_physicsEnvironmentPtr)
{
m_physicsEnvironmentPtr->UpdateAabbs(deltaTime);
//draw contactpoints
m_physicsEnvironmentPtr->CallbackTriggers();
}
+ */
+
renderme();
@@ -192,7 +177,7 @@ void CcdPhysicsDemo::displayCallback(void) {
void CcdPhysicsDemo::clientResetScene()
{
-
+/*
int i;
int numObjects = m_physicsEnvironmentPtr->GetNumControllers();
@@ -203,7 +188,7 @@ void CcdPhysicsDemo::clientResetScene()
{
CcdPhysicsController* ctrl = m_physicsEnvironmentPtr->GetPhysicsController(i);
- if ((getDebugMode() & IDebugDraw::DBG_NoHelpText))
+ if ((getDebugMode() & btIDebugDraw::DBG_NoHelpText))
{
if (ctrl->GetRigidBody()->GetCollisionShape()->GetShapeType() != SPHERE_SHAPE_PROXYTYPE)
{
@@ -213,7 +198,7 @@ void CcdPhysicsDemo::clientResetScene()
ctrl->GetRigidBody()->SetCollisionShape(shapePtr[1]);
}
- BroadphaseProxy* bpproxy = ctrl->GetRigidBody()->m_broadphaseHandle;
+ btBroadphaseProxy* bpproxy = ctrl->GetRigidBody()->m_broadphaseHandle;
m_physicsEnvironmentPtr->GetBroadphase()->CleanProxyFromPairs(bpproxy);
}
@@ -236,11 +221,13 @@ void CcdPhysicsDemo::clientResetScene()
ctrl->SetAngularVelocity(0,0,0,false);
}
}
+ */
+
}
///User-defined friction model, the most simple friction model available: no friction
-float myFrictionModel( RigidBody& body1, RigidBody& body2, ManifoldPoint& contactPoint, const ContactSolverInfo& solverInfo )
+float myFrictionModel( btRigidBody& body1, btRigidBody& body2, btManifoldPoint& contactPoint, const btContactSolverInfo& solverInfo )
{
//don't do any friction
return 0.f;
@@ -249,32 +236,25 @@ float myFrictionModel( RigidBody& body1, RigidBody& body2, ManifoldPoint& contac
void CcdPhysicsDemo::initPhysics()
{
- CollisionDispatcher* dispatcher = new CollisionDispatcher();
+ btCollisionDispatcher* dispatcher = new btCollisionDispatcher();
- SimdVector3 worldAabbMin(-10000,-10000,-10000);
- SimdVector3 worldAabbMax(10000,10000,10000);
+ btVector3 worldAabbMin(-10000,-10000,-10000);
+ btVector3 worldAabbMax(10000,10000,10000);
- OverlappingPairCache* broadphase = new AxisSweep3(worldAabbMin,worldAabbMax,maxProxies);
-// OverlappingPairCache* broadphase = new SimpleBroadphase;
+ btOverlappingPairCache* broadphase = new btAxisSweep3(worldAabbMin,worldAabbMax,maxProxies);
+// btOverlappingPairCache* broadphase = new btSimpleBroadphase;
#ifdef REGISTER_CUSTOM_COLLISION_ALGORITHM
- dispatcher->RegisterCollisionCreateFunc(SPHERE_SHAPE_PROXYTYPE,SPHERE_SHAPE_PROXYTYPE,new SphereSphereCollisionAlgorithm::CreateFunc);
+ dispatcher->RegisterCollisionCreateFunc(SPHERE_SHAPE_PROXYTYPE,SPHERE_SHAPE_PROXYTYPE,new btSphereSphereCollisionAlgorithm::CreateFunc);
#endif //REGISTER_CUSTOM_COLLISION_ALGORITHM
+ btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver;
-#ifdef USE_PARALLEL_DISPATCHER
- m_physicsEnvironmentPtr = new ParallelPhysicsEnvironment(dispatcher2,broadphase);
-#else
- m_physicsEnvironmentPtr = new CcdPhysicsEnvironment(dispatcher,broadphase);
-#endif
- m_physicsEnvironmentPtr->setDeactivationTime(2.f);
+ m_dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,broadphase,solver);
- m_physicsEnvironmentPtr->setGravity(0,-10,0);
-
- m_physicsEnvironmentPtr->setDebugDrawer(&debugDrawer);
#ifdef USER_DEFINED_FRICTION_MODEL
- SequentialImpulseConstraintSolver* solver = (SequentialImpulseConstraintSolver*) m_physicsEnvironmentPtr->GetConstraintSolver();
+ btSequentialImpulseConstraintSolver* solver = (btSequentialImpulseConstraintSolver*) m_physicsEnvironmentPtr->GetConstraintSolver();
//solver->SetContactSolverFunc(ContactSolverFunc func,USER_CONTACT_SOLVER_TYPE1,DEFAULT_CONTACT_SOLVER_TYPE);
solver->SetFrictionSolverFunc(myFrictionModel,USER_CONTACT_SOLVER_TYPE1,DEFAULT_CONTACT_SOLVER_TYPE);
solver->SetFrictionSolverFunc(myFrictionModel,DEFAULT_CONTACT_SOLVER_TYPE,USER_CONTACT_SOLVER_TYPE1);
@@ -285,7 +265,7 @@ void CcdPhysicsDemo::initPhysics()
int i;
- SimdTransform tr;
+ btTransform tr;
tr.setIdentity();
@@ -301,26 +281,26 @@ void CcdPhysicsDemo::initPhysics()
if (useCompound)
{
- CompoundShape* compoundShape = new CompoundShape();
- CollisionShape* oldShape = shapePtr[1];
+ btCompoundShape* compoundShape = new btCompoundShape();
+ btCollisionShape* oldShape = shapePtr[1];
shapePtr[1] = compoundShape;
- SimdTransform ident;
+ btTransform ident;
ident.setIdentity();
- ident.setOrigin(SimdVector3(0,0,0));
+ ident.setOrigin(btVector3(0,0,0));
compoundShape->AddChildShape(ident,oldShape);//
- ident.setOrigin(SimdVector3(0,0,2));
- compoundShape->AddChildShape(ident,new SphereShape(0.9));//
+ ident.setOrigin(btVector3(0,0,2));
+ compoundShape->AddChildShape(ident,new btSphereShape(0.9));//
}
for (i=0;i<gNumObjects;i++)
{
- CollisionShape* shape = shapePtr[shapeIndex[i]];
+ btCollisionShape* shape = shapePtr[shapeIndex[i]];
shape->SetMargin(0.05f);
bool isDyna = i>0;
- SimdTransform trans;
+ btTransform trans;
trans.setIdentity();
if (i>0)
@@ -338,13 +318,13 @@ void CcdPhysicsDemo::initPhysics()
row2 |=1;
}
- SimdVector3 pos(col*2*CUBE_HALF_EXTENTS + (row2%2)*CUBE_HALF_EXTENTS,
+ btVector3 pos(col*2*CUBE_HALF_EXTENTS + (row2%2)*CUBE_HALF_EXTENTS,
row*2*CUBE_HALF_EXTENTS+CUBE_HALF_EXTENTS+EXTRA_HEIGHT,0);
trans.setOrigin(pos);
} else
{
- trans.setOrigin(SimdVector3(0,-30,0));
+ trans.setOrigin(btVector3(0,-30,0));
}
float mass = 1.f;
@@ -352,13 +332,16 @@ void CcdPhysicsDemo::initPhysics()
if (!isDyna)
mass = 0.f;
- CcdPhysicsController* ctrl = LocalCreatePhysicsObject(isDyna,mass,trans,shape);
-
+ btRigidBody* body = LocalCreateRigidBody(isDyna,mass,trans,shape);
+
+ m_dynamicsWorld->AddCollisionObject(body);
+
// Only do CCD if motion in one timestep (1.f/60.f) exceeds CUBE_HALF_EXTENTS
- ctrl->GetRigidBody()->m_ccdSquareMotionTreshold = CUBE_HALF_EXTENTS;
+ body->m_ccdSquareMotionTreshold = CUBE_HALF_EXTENTS;
//Experimental: better estimation of CCD Time of Impact:
- ctrl->GetRigidBody()->m_ccdSweptShereRadius = 0.2*CUBE_HALF_EXTENTS;
+ body->m_ccdSweptShereRadius = 0.2*CUBE_HALF_EXTENTS;
+
#ifdef USER_DEFINED_FRICTION_MODEL
///Advanced use: override the friction solver
ctrl->GetRigidBody()->m_frictionSolverType = USER_CONTACT_SOLVER_TYPE1;
@@ -369,7 +352,6 @@ void CcdPhysicsDemo::initPhysics()
clientResetScene();
- m_physicsEnvironmentPtr->SyncMotionStates(0.f);
}
diff --git a/Demos/CcdPhysicsDemo/MyMotionState.cpp b/Demos/CcdPhysicsDemo/MyMotionState.cpp
index 4699dd718..fe3636d5d 100644
--- a/Demos/CcdPhysicsDemo/MyMotionState.cpp
+++ b/Demos/CcdPhysicsDemo/MyMotionState.cpp
@@ -14,7 +14,7 @@ subject to the following restrictions:
*/
#include "MyMotionState.h"
-#include "LinearMath/SimdPoint3.h"
+#include "LinearMath/btPoint3.h"
MyMotionState::MyMotionState()
{
@@ -51,13 +51,13 @@ void MyMotionState::getWorldOrientation(float& quatIma0,float& quatIma1,float& q
void MyMotionState::setWorldPosition(float posX,float posY,float posZ)
{
- SimdPoint3 pos(posX,posY,posZ);
+ btPoint3 pos(posX,posY,posZ);
m_worldTransform.setOrigin( pos );
}
void MyMotionState::setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal)
{
- SimdQuaternion orn(quatIma0,quatIma1,quatIma2,quatReal);
+ btQuaternion orn(quatIma0,quatIma1,quatIma2,quatReal);
m_worldTransform.setRotation( orn );
}
diff --git a/Demos/CcdPhysicsDemo/MyMotionState.h b/Demos/CcdPhysicsDemo/MyMotionState.h
index cbf9988e2..7aa7c8520 100644
--- a/Demos/CcdPhysicsDemo/MyMotionState.h
+++ b/Demos/CcdPhysicsDemo/MyMotionState.h
@@ -17,7 +17,7 @@ subject to the following restrictions:
#define MY_MOTIONSTATE_H
#include "PHY_IMotionState.h"
-#include <LinearMath/SimdTransform.h>
+#include <LinearMath/btTransform.h>
class MyMotionState : public PHY_IMotionState
@@ -37,7 +37,7 @@ class MyMotionState : public PHY_IMotionState
virtual void calculateWorldTransformations();
- SimdTransform m_worldTransform;
+ btTransform m_worldTransform;
};
diff --git a/Demos/ColladaDemo/ColladaConverter.cpp b/Demos/ColladaDemo/ColladaConverter.cpp
index a3c9247d4..8caf5f355 100644
--- a/Demos/ColladaDemo/ColladaConverter.cpp
+++ b/Demos/ColladaDemo/ColladaConverter.cpp
@@ -37,7 +37,7 @@ char* getLastFileName();
char* fixFileName(const char* lpCmdLine);
//todo: sort out this domInstance_rigid_bodyRef forward definition, put it in the headerfile and make it virtual (make code more re-usable)
-struct RigidBodyInput
+struct btRigidBodyInput
{
domInstance_rigid_bodyRef m_instanceRigidBodyRef;
domRigid_bodyRef m_rigidBodyRef2;
@@ -52,12 +52,12 @@ struct ConstraintInput
};
-struct RigidBodyOutput
+struct btRigidBodyOutput
{
float m_mass;
bool m_isDynamics;
- CollisionShape* m_colShape;
- CompoundShape* m_compoundShape;
+ btCollisionShape* m_colShape;
+ btCompoundShape* m_compoundShape;
};
@@ -66,13 +66,13 @@ domMatrix_Array emptyMatrixArray;
domNodeRef m_colladadomNodes[COLLADA_CONVERTER_MAX_NUM_OBJECTS];
-SimdTransform GetSimdTransformFromCOLLADA_DOM(domMatrix_Array& matrixArray,
+btTransform GetbtTransformFromCOLLADA_DOM(domMatrix_Array& matrixArray,
domRotate_Array& rotateArray,
domTranslate_Array& translateArray
)
{
- SimdTransform startTransform;
+ btTransform startTransform;
startTransform.setIdentity();
unsigned int i;
@@ -81,9 +81,9 @@ SimdTransform GetSimdTransformFromCOLLADA_DOM(domMatrix_Array& matrixArray,
{
domMatrixRef matrixRef = matrixArray[i];
domFloat4x4 fl16 = matrixRef->getValue();
- SimdVector3 origin(fl16.get(3),fl16.get(7),fl16.get(11));
+ btVector3 origin(fl16.get(3),fl16.get(7),fl16.get(11));
startTransform.setOrigin(origin);
- SimdMatrix3x3 basis(fl16.get(0),fl16.get(1),fl16.get(2),
+ btMatrix3x3 basis(fl16.get(0),fl16.get(1),fl16.get(2),
fl16.get(4),fl16.get(5),fl16.get(6),
fl16.get(8),fl16.get(9),fl16.get(10));
startTransform.setBasis(basis);
@@ -94,15 +94,15 @@ SimdTransform GetSimdTransformFromCOLLADA_DOM(domMatrix_Array& matrixArray,
domRotateRef rotateRef = rotateArray[i];
domFloat4 fl4 = rotateRef->getValue();
float angleRad = SIMD_RADS_PER_DEG*fl4.get(3);
- SimdQuaternion rotQuat(SimdVector3(fl4.get(0),fl4.get(1),fl4.get(2)),angleRad);
- startTransform.getBasis() = startTransform.getBasis() * SimdMatrix3x3(rotQuat);
+ btQuaternion rotQuat(btVector3(fl4.get(0),fl4.get(1),fl4.get(2)),angleRad);
+ startTransform.getBasis() = startTransform.getBasis() * btMatrix3x3(rotQuat);
}
for (i=0;i<translateArray.getCount();i++)
{
domTranslateRef translateRef = translateArray[i];
domFloat3 fl3 = translateRef->getValue();
- startTransform.getOrigin() += SimdVector3(fl3.get(0),fl3.get(1),fl3.get(2));
+ startTransform.getOrigin() += btVector3(fl3.get(0),fl3.get(1),fl3.get(2));
}
return startTransform;
}
@@ -185,20 +185,20 @@ bool ColladaConverter::convert()
printf(" X is Up Data and Hiearchies must be converted!\n" );
printf(" Conversion to X axis Up isn't currently supported!\n" );
printf(" COLLADA_RT defaulting to Y Up \n" );
- SetGravity(SimdVector3(-10,0,0));
- SetCameraInfo(SimdVector3(1,0,0),1);
+ SetGravity(btVector3(-10,0,0));
+ SetCameraInfo(btVector3(1,0,0),1);
break;
case UPAXISTYPE_Y_UP:
printf(" Y Axis is Up for this file \n" );
printf(" COLLADA_RT set to Y Up \n" );
- SetGravity(SimdVector3(0,-10,0));
- SetCameraInfo(SimdVector3(0,1,0),0);
+ SetGravity(btVector3(0,-10,0));
+ SetCameraInfo(btVector3(0,1,0),0);
break;
case UPAXISTYPE_Z_UP:
printf(" Z Axis is Up for this file \n" );
printf(" All Geometry and Hiearchies must be converted!\n" );
- SetGravity(SimdVector3(0,0,-10));
+ SetGravity(btVector3(0,0,-10));
break;
default:
@@ -294,7 +294,7 @@ bool ColladaConverter::convert()
const domFloat3 grav = physicsSceneRef->getTechnique_common()->getGravity()->getValue();
printf("gravity set to %f,%f,%f\n",grav.get(0),grav.get(1),grav.get(2));
- SetGravity(SimdVector3(grav.get(0),grav.get(1),grav.get(2)));
+ SetGravity(btVector3(grav.get(0),grav.get(1),grav.get(2)));
}
}
@@ -324,8 +324,8 @@ bool ColladaConverter::convert()
float mass = 1.f;
bool isDynamics = true;
- CollisionShape* colShape = 0;
- CompoundShape* compoundShape = 0;
+ btCollisionShape* colShape = 0;
+ btCompoundShape* compoundShape = 0;
xsNCName bodyName = instRigidbodyRef->getBody();
@@ -355,11 +355,11 @@ bool ColladaConverter::convert()
{
- RigidBodyOutput output;
+ btRigidBodyOutput output;
output.m_colShape = colShape;
output.m_compoundShape = compoundShape;
- RigidBodyInput rbInput;
+ btRigidBodyInput rbInput;
rbInput.m_rigidBodyRef2 = rigidBodyRef;
rbInput.m_instanceRigidBodyRef = instRigidbodyRef;
ConvertRigidBodyRef( rbInput , output );
@@ -380,7 +380,7 @@ bool ColladaConverter::convert()
if (colShape)
{
- RigidBodyInput input;
+ btRigidBodyInput input;
input.m_instanceRigidBodyRef = instRigidbodyRef;
input.m_rigidBodyRef2 = 0;
input.m_bodyName = (char*)bodyName;
@@ -399,8 +399,8 @@ bool ColladaConverter::convert()
float mass = 1.f;
bool isDynamics = true;
- CollisionShape* colShape = 0;
- CompoundShape* compoundShape = 0;
+ btCollisionShape* colShape = 0;
+ btCompoundShape* compoundShape = 0;
xsNCName bodyName = instRigidbodyRef->getBody();
@@ -430,11 +430,11 @@ bool ColladaConverter::convert()
{
- RigidBodyOutput output;
+ btRigidBodyOutput output;
output.m_colShape = colShape;
output.m_compoundShape = compoundShape;
- RigidBodyInput rbInput;
+ btRigidBodyInput rbInput;
rbInput.m_rigidBodyRef2 = rigidBodyRef;
rbInput.m_instanceRigidBodyRef = instRigidbodyRef;
ConvertRigidBodyRef( rbInput , output );
@@ -455,7 +455,7 @@ bool ColladaConverter::convert()
if (colShape)
{
- RigidBodyInput input;
+ btRigidBodyInput input;
input.m_instanceRigidBodyRef = instRigidbodyRef;
input.m_rigidBodyRef2 = 0;
input.m_bodyName = (char*)bodyName;
@@ -560,31 +560,31 @@ void ColladaConverter::PrepareConstraints(ConstraintInput& input)
const domRigid_constraint::domTechnique_commonRef commonRef = rigidConstraintRef->getTechnique_common();
domFloat3 flMin = commonRef->getLimits()->getLinear()->getMin()->getValue();
- SimdVector3 minLinearLimit(flMin.get(0),flMin.get(1),flMin.get(2));
+ btVector3 minLinearLimit(flMin.get(0),flMin.get(1),flMin.get(2));
domFloat3 flMax = commonRef->getLimits()->getLinear()->getMax()->getValue();
- SimdVector3 maxLinearLimit(flMax.get(0),flMax.get(1),flMax.get(2));
+ btVector3 maxLinearLimit(flMax.get(0),flMax.get(1),flMax.get(2));
domFloat3 coneMinLimit = commonRef->getLimits()->getSwing_cone_and_twist()->getMin()->getValue();
- SimdVector3 angularMin(coneMinLimit.get(0),coneMinLimit.get(1),coneMinLimit.get(2));
+ btVector3 angularMin(coneMinLimit.get(0),coneMinLimit.get(1),coneMinLimit.get(2));
domFloat3 coneMaxLimit = commonRef->getLimits()->getSwing_cone_and_twist()->getMax()->getValue();
- SimdVector3 angularMax(coneMaxLimit.get(0),coneMaxLimit.get(1),coneMaxLimit.get(2));
+ btVector3 angularMax(coneMaxLimit.get(0),coneMaxLimit.get(1),coneMaxLimit.get(2));
{
int constraintId;
- SimdTransform attachFrameRef0;
+ btTransform attachFrameRef0;
attachFrameRef0 =
- GetSimdTransformFromCOLLADA_DOM
+ GetbtTransformFromCOLLADA_DOM
(
emptyMatrixArray,
attachRefBody->getRotate_array(),
attachRefBody->getTranslate_array());
- SimdTransform attachFrameOther;
+ btTransform attachFrameOther;
attachFrameOther =
- GetSimdTransformFromCOLLADA_DOM
+ GetbtTransformFromCOLLADA_DOM
(
emptyMatrixArray,
attachBody1->getRotate_array(),
@@ -609,10 +609,10 @@ void ColladaConverter::PrepareConstraints(ConstraintInput& input)
//limited means upper > lower
//limitIndex: first 3 are linear, next 3 are angular
- SimdVector3 linearLowerLimits = minLinearLimit;
- SimdVector3 linearUpperLimits = maxLinearLimit;
- SimdVector3 angularLowerLimits = angularMin;
- SimdVector3 angularUpperLimits = angularMax;
+ btVector3 linearLowerLimits = minLinearLimit;
+ btVector3 linearUpperLimits = maxLinearLimit;
+ btVector3 angularLowerLimits = angularMin;
+ btVector3 angularUpperLimits = angularMax;
{
for (int i=0;i<3;i++)
{
@@ -665,11 +665,11 @@ void ColladaConverter::PrepareConstraints(ConstraintInput& input)
}
-void ColladaConverter::PreparePhysicsObject(struct RigidBodyInput& input, bool isDynamics, float mass,CollisionShape* colShape)
+void ColladaConverter::PreparePhysicsObject(struct btRigidBodyInput& input, bool isDynamics, float mass,btCollisionShape* colShape)
{
- SimdTransform startTransform;
+ btTransform startTransform;
startTransform.setIdentity();
- SimdVector3 startScale(1.f,1.f,1.f);
+ btVector3 startScale(1.f,1.f,1.f);
//The 'target' points to a graphics element/node, which contains the start (world) transform
daeElementRef elem = input.m_instanceRigidBodyRef->getTarget().getElement();
@@ -681,7 +681,7 @@ void ColladaConverter::PreparePhysicsObject(struct RigidBodyInput& input, bool i
//find transform of the node that this rigidbody maps to
- startTransform = GetSimdTransformFromCOLLADA_DOM(
+ startTransform = GetbtTransformFromCOLLADA_DOM(
node->getMatrix_array(),
node->getRotate_array(),
node->getTranslate_array()
@@ -692,7 +692,7 @@ void ColladaConverter::PreparePhysicsObject(struct RigidBodyInput& input, bool i
{
domScaleRef scaleRef = node->getScale_array()[i];
domFloat3 fl3 = scaleRef->getValue();
- startScale = SimdVector3(fl3.get(0),fl3.get(1),fl3.get(2));
+ startScale = btVector3(fl3.get(0),fl3.get(1),fl3.get(2));
}
}
@@ -764,15 +764,15 @@ bool ColladaConverter::saveAs(const char* filename)
}
{
- SimdQuaternion quat = m_physObjects[i]->GetRigidBody()->getCenterOfMassTransform().getRotation();
- SimdVector3 axis(quat.getX(),quat.getY(),quat.getZ());
+ btQuaternion quat = m_physObjects[i]->GetRigidBody()->getCenterOfMassTransform().getRotation();
+ btVector3 axis(quat.getX(),quat.getY(),quat.getZ());
axis[3] = 0.f;
//check for axis length
- SimdScalar len = axis.length2();
+ btScalar len = axis.length2();
if (len < SIMD_EPSILON*SIMD_EPSILON)
- axis = SimdVector3(1.f,0.f,0.f);
+ axis = btVector3(1.f,0.f,0.f);
else
- axis /= SimdSqrt(len);
+ axis /= btSqrt(len);
m_colladadomNodes[i]->getRotate_array().get(0)->getValue().set(0,axis[0]);
m_colladadomNodes[i]->getRotate_array().get(0)->getValue().set(1,axis[1]);
m_colladadomNodes[i]->getRotate_array().get(0)->getValue().set(2,axis[2]);
@@ -886,7 +886,7 @@ char* fixFileName(const char* lpCmdLine)
}
-void ColladaConverter::ConvertRigidBodyRef( RigidBodyInput& rbInput,RigidBodyOutput& rbOutput)
+void ColladaConverter::ConvertRigidBodyRef( btRigidBodyInput& rbInput,btRigidBodyOutput& rbOutput)
{
const domRigid_body::domTechnique_commonRef techniqueRef = rbInput.m_rigidBodyRef2->getTechnique_common();
@@ -913,9 +913,9 @@ void ColladaConverter::ConvertRigidBodyRef( RigidBodyInput& rbInput,RigidBodyOut
if (planeRef->getEquation())
{
const domFloat4 planeEq = planeRef->getEquation()->getValue();
- SimdVector3 planeNormal(planeEq.get(0),planeEq.get(1),planeEq.get(2));
- SimdScalar planeConstant = planeEq.get(3);
- rbOutput.m_colShape = new StaticPlaneShape(planeNormal,planeConstant);
+ btVector3 planeNormal(planeEq.get(0),planeEq.get(1),planeEq.get(2));
+ btScalar planeConstant = planeEq.get(3);
+ rbOutput.m_colShape = new btStaticPlaneShape(planeNormal,planeConstant);
}
}
@@ -928,14 +928,14 @@ void ColladaConverter::ConvertRigidBodyRef( RigidBodyInput& rbInput,RigidBodyOut
float x = halfExtents.get(0);
float y = halfExtents.get(1);
float z = halfExtents.get(2);
- rbOutput.m_colShape = new BoxShape(SimdVector3(x,y,z));
+ rbOutput.m_colShape = new btBoxShape(btVector3(x,y,z));
}
if (shapeRef->getSphere())
{
domSphereRef sphereRef = shapeRef->getSphere();
domSphere::domRadiusRef radiusRef = sphereRef->getRadius();
domFloat radius = radiusRef->getValue();
- rbOutput.m_colShape = new SphereShape(radius);
+ rbOutput.m_colShape = new btSphereShape(radius);
}
if (shapeRef->getCylinder())
@@ -946,7 +946,7 @@ void ColladaConverter::ConvertRigidBodyRef( RigidBodyInput& rbInput,RigidBodyOut
domFloat radius0 = radius2.get(0);
//Cylinder around the local Y axis
- rbOutput.m_colShape = new CylinderShape(SimdVector3(radius0,height,radius0));
+ rbOutput.m_colShape = new btCylinderShape(btVector3(radius0,height,radius0));
}
@@ -960,7 +960,7 @@ void ColladaConverter::ConvertRigidBodyRef( RigidBodyInput& rbInput,RigidBodyOut
{
const domMeshRef meshRef = geom->getMesh();
- TriangleMesh* trimesh = new TriangleMesh();
+ btTriangleMesh* trimesh = new btTriangleMesh();
for (unsigned int tg = 0;tg<meshRef->getTriangles_array().getCount();tg++)
@@ -969,7 +969,7 @@ void ColladaConverter::ConvertRigidBodyRef( RigidBodyInput& rbInput,RigidBodyOut
domTrianglesRef triRef = meshRef->getTriangles_array()[tg];
const domPRef pRef = triRef->getP();
- IndexedMesh meshPart;
+ btIndexedMesh meshPart;
meshPart.m_triangleIndexStride=0;
@@ -1024,7 +1024,7 @@ void ColladaConverter::ConvertRigidBodyRef( RigidBodyInput& rbInput,RigidBodyOut
int vertexStride = 3;//instead of hardcoded stride, should use the 'accessor'
for (;t<meshPart.m_numTriangles;t++)
{
- SimdVector3 verts[3];
+ btVector3 verts[3];
int index0;
for (int i=0;i<3;i++)
{
@@ -1055,11 +1055,11 @@ void ColladaConverter::ConvertRigidBodyRef( RigidBodyInput& rbInput,RigidBodyOut
if (rbOutput.m_isDynamics)
{
printf("moving concave <mesh> not supported, transformed into convex\n");
- rbOutput.m_colShape = new ConvexTriangleMeshShape(trimesh);
+ rbOutput.m_colShape = new btConvexTriangleMeshShape(trimesh);
} else
{
printf("static concave triangle <mesh> added\n");
- rbOutput.m_colShape = new TriangleMeshShape(trimesh);
+ rbOutput.m_colShape = new btTriangleMeshShape(trimesh);
}
}
@@ -1086,7 +1086,7 @@ void ColladaConverter::ConvertRigidBodyRef( RigidBodyInput& rbInput,RigidBodyOut
- ConvexHullShape* convexHullShape = new ConvexHullShape(0,0);
+ btConvexHullShape* convexHullShape = new btConvexHullShape(0,0);
//it is quite a trick to get to the vertices, using Collada.
//we are not there yet...
@@ -1144,7 +1144,7 @@ void ColladaConverter::ConvertRigidBodyRef( RigidBodyInput& rbInput,RigidBodyOut
domFloat fl2 = listFloats.get(k+2);
//printf("float %f %f %f\n",fl0,fl1,fl2);
- convexHullShape->AddPoint(SimdPoint3(fl0,fl1,fl2));
+ convexHullShape->AddPoint(btPoint3(fl0,fl1,fl2));
}
}
@@ -1192,7 +1192,7 @@ void ColladaConverter::ConvertRigidBodyRef( RigidBodyInput& rbInput,RigidBodyOut
domFloat fl2 = listFloats.get(k+2);
//printf("float %f %f %f\n",fl0,fl1,fl2);
- convexHullShape->AddPoint(SimdPoint3(fl0,fl1,fl2));
+ convexHullShape->AddPoint(btPoint3(fl0,fl1,fl2));
}
}
@@ -1237,14 +1237,14 @@ void ColladaConverter::ConvertRigidBodyRef( RigidBodyInput& rbInput,RigidBodyOut
if (!rbOutput.m_compoundShape)
{
- rbOutput.m_compoundShape = new CompoundShape();
+ rbOutput.m_compoundShape = new btCompoundShape();
}
- SimdTransform localTransform;
+ btTransform localTransform;
localTransform.setIdentity();
if (hasShapeLocalTransform)
{
- localTransform = GetSimdTransformFromCOLLADA_DOM(
+ localTransform = GetbtTransformFromCOLLADA_DOM(
emptyMatrixArray,
shapeRef->getRotate_array(),
shapeRef->getTranslate_array()
diff --git a/Demos/ColladaDemo/ColladaConverter.h b/Demos/ColladaDemo/ColladaConverter.h
index 33526e90b..554e5c7bf 100644
--- a/Demos/ColladaDemo/ColladaConverter.h
+++ b/Demos/ColladaDemo/ColladaConverter.h
@@ -18,10 +18,10 @@ subject to the following restrictions:
#ifndef COLLADA_CONVERTER_H
#define COLLADA_CONVERTER_H
-#include "LinearMath/SimdTransform.h"
-#include "LinearMath/SimdVector3.h"
+#include "LinearMath/btTransform.h"
+#include "LinearMath/btVector3.h"
-class CollisionShape;
+class btCollisionShape;
class PHY_IPhysicsController;
class CcdPhysicsController;
class ConstraintInput;
@@ -44,11 +44,11 @@ protected:
int m_numObjects;
CcdPhysicsController* m_physObjects[COLLADA_CONVERTER_MAX_NUM_OBJECTS];
- void PreparePhysicsObject(struct RigidBodyInput& input, bool isDynamics, float mass,CollisionShape* colShape);
+ void PreparePhysicsObject(struct btRigidBodyInput& input, bool isDynamics, float mass,btCollisionShape* colShape);
void PrepareConstraints(ConstraintInput& input);
- void ConvertRigidBodyRef( struct RigidBodyInput& , struct RigidBodyOutput& output );
+ void ConvertRigidBodyRef( struct btRigidBodyInput& , struct btRigidBodyOutput& output );
public:
@@ -68,22 +68,22 @@ public:
///those 2 virtuals are called for each constraint/physics object
virtual int createUniversalD6Constraint(
class PHY_IPhysicsController* ctrlRef,class PHY_IPhysicsController* ctrlOther,
- SimdTransform& localAttachmentFrameRef,
- SimdTransform& localAttachmentOther,
- const SimdVector3& linearMinLimits,
- const SimdVector3& linearMaxLimits,
- const SimdVector3& angularMinLimits,
- const SimdVector3& angularMaxLimits
+ btTransform& localAttachmentFrameRef,
+ btTransform& localAttachmentOther,
+ const btVector3& linearMinLimits,
+ const btVector3& linearMaxLimits,
+ const btVector3& angularMinLimits,
+ const btVector3& angularMaxLimits
) = 0;
virtual CcdPhysicsController* CreatePhysicsObject(bool isDynamic,
float mass,
- const SimdTransform& startTransform,
- CollisionShape* shape) = 0;
+ const btTransform& startTransform,
+ btCollisionShape* shape) = 0;
- virtual void SetGravity(const SimdVector3& gravity) = 0;
+ virtual void SetGravity(const btVector3& gravity) = 0;
- virtual void SetCameraInfo(const SimdVector3& up, int forwardAxis) = 0;
+ virtual void SetCameraInfo(const btVector3& up, int forwardAxis) = 0;
};
diff --git a/Demos/ColladaDemo/ColladaDemo.cpp b/Demos/ColladaDemo/ColladaDemo.cpp
index 6e07c531e..8984bf47f 100644
--- a/Demos/ColladaDemo/ColladaDemo.cpp
+++ b/Demos/ColladaDemo/ColladaDemo.cpp
@@ -16,8 +16,8 @@ subject to the following restrictions:
#include "CcdPhysicsEnvironment.h"
#include "CcdPhysicsController.h"
#include "btBulletDynamicsCommon.h"
-#include "LinearMath/GenQuickprof.h"
-#include "LinearMath/GenIDebugDraw.h"
+#include "LinearMath/btQuickprof.h"
+#include "LinearMath/btIDebugDraw.h"
#include "GLDebugDrawer.h"
@@ -50,12 +50,12 @@ class MyColladaConverter : public ColladaConverter
///those 2 virtuals are called for each constraint/physics object
virtual int createUniversalD6Constraint(
class PHY_IPhysicsController* ctrlRef,class PHY_IPhysicsController* ctrlOther,
- SimdTransform& localAttachmentFrameRef,
- SimdTransform& localAttachmentOther,
- const SimdVector3& linearMinLimits,
- const SimdVector3& linearMaxLimits,
- const SimdVector3& angularMinLimits,
- const SimdVector3& angularMaxLimits
+ btTransform& localAttachmentFrameRef,
+ btTransform& localAttachmentOther,
+ const btVector3& linearMinLimits,
+ const btVector3& linearMaxLimits,
+ const btVector3& angularMinLimits,
+ const btVector3& angularMaxLimits
)
{
return m_demoApp->GetPhysicsEnvironment()->createUniversalD6Constraint(
@@ -71,19 +71,19 @@ class MyColladaConverter : public ColladaConverter
virtual CcdPhysicsController* CreatePhysicsObject(bool isDynamic,
float mass,
- const SimdTransform& startTransform,
- CollisionShape* shape)
+ const btTransform& startTransform,
+ btCollisionShape* shape)
{
CcdPhysicsController* ctrl = m_demoApp->LocalCreatePhysicsObject(isDynamic, mass, startTransform,shape);
return ctrl;
}
- virtual void SetGravity(const SimdVector3& grav)
+ virtual void SetGravity(const btVector3& grav)
{
m_demoApp->GetPhysicsEnvironment()->setGravity(grav.getX(),grav.getY(),grav.getZ());
}
- virtual void SetCameraInfo(const SimdVector3& camUp,int forwardAxis)
+ virtual void SetCameraInfo(const btVector3& camUp,int forwardAxis)
{
m_demoApp->setCameraUp(camUp);
m_demoApp->setCameraForwardAxis(forwardAxis);
@@ -138,15 +138,15 @@ int main(int argc,char** argv)
void ColladaDemo::initPhysics(const char* filename)
{
- m_cameraUp = SimdVector3(0,0,1);
+ m_cameraUp = btVector3(0,0,1);
m_forwardAxis = 1;
///Setup a Physics Simulation Environment
- CollisionDispatcher* dispatcher = new CollisionDispatcher();
- SimdVector3 worldAabbMin(-10000,-10000,-10000);
- SimdVector3 worldAabbMax(10000,10000,10000);
- OverlappingPairCache* broadphase = new AxisSweep3(worldAabbMin,worldAabbMax);
- //BroadphaseInterface* broadphase = new SimpleBroadphase();
+ btCollisionDispatcher* dispatcher = new btCollisionDispatcher();
+ btVector3 worldAabbMin(-10000,-10000,-10000);
+ btVector3 worldAabbMax(10000,10000,10000);
+ btOverlappingPairCache* broadphase = new btAxisSweep3(worldAabbMin,worldAabbMax);
+ //BroadphaseInterface* broadphase = new btSimpleBroadphase();
m_physicsEnvironmentPtr = new CcdPhysicsEnvironment(dispatcher,broadphase);
m_physicsEnvironmentPtr->setDeactivationTime(2.f);
m_physicsEnvironmentPtr->setGravity(0,0,-10);
diff --git a/Demos/CollisionDemo/CollisionDemo.cpp b/Demos/CollisionDemo/CollisionDemo.cpp
index ee4cc9323..49b9d90a4 100644
--- a/Demos/CollisionDemo/CollisionDemo.cpp
+++ b/Demos/CollisionDemo/CollisionDemo.cpp
@@ -16,15 +16,15 @@ subject to the following restrictions:
///
/// Collision Demo shows a degenerate case, where the Simplex solver has to deal with near-affine dependent cases
-/// See the define CATCH_DEGENERATE_TETRAHEDRON in Bullet's VoronoiSimplexSolver.cpp
+/// See the define CATCH_DEGENERATE_TETRAHEDRON in Bullet's btVoronoiSimplexSolver.cpp
///
///This low-level internal demo does intentionally NOT use the btBulletCollisionCommon.h header
///It needs internal access
#include "GL_Simplex1to4.h"
-#include "LinearMath/SimdQuaternion.h"
-#include "LinearMath/SimdTransform.h"
+#include "LinearMath/btQuaternion.h"
+#include "LinearMath/btTransform.h"
#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
#include "BulletCollision/CollisionShapes/btBoxShape.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h"
@@ -35,7 +35,7 @@ subject to the following restrictions:
#include "CollisionDemo.h"
#include "GL_ShapeDrawer.h"
#include "GlutStuff.h"
-#include "LinearMath/GenIDebugDraw.h"
+#include "LinearMath/btIDebugDraw.h"
float yaw=0.f,pitch=0.f,roll=0.f;
@@ -44,9 +44,9 @@ const int numObjects = 2;
GL_Simplex1to4 simplex;
-PolyhedralConvexShape* shapePtr[maxNumObjects];
+btPolyhedralConvexShape* shapePtr[maxNumObjects];
-SimdTransform tr[numObjects];
+btTransform tr[numObjects];
int screenWidth = 640;
int screenHeight = 480;
@@ -70,22 +70,22 @@ int main(int argc,char** argv)
void CollisionDemo::initPhysics()
{
- m_debugMode |= IDebugDraw::DBG_DrawWireframe;
+ m_debugMode |= btIDebugDraw::DBG_DrawWireframe;
m_azi = 250.f;
m_ele = 25.f;
- tr[0].setOrigin(SimdVector3(0.0013328250f,8.1363249f,7.0390840f));
- tr[1].setOrigin(SimdVector3(0.00000000f,9.1262732f,2.0343180f));
+ tr[0].setOrigin(btVector3(0.0013328250f,8.1363249f,7.0390840f));
+ tr[1].setOrigin(btVector3(0.00000000f,9.1262732f,2.0343180f));
- //tr[0].setOrigin(SimdVector3(0,0,0));
- //tr[1].setOrigin(SimdVector3(0,10,0));
+ //tr[0].setOrigin(btVector3(0,0,0));
+ //tr[1].setOrigin(btVector3(0,10,0));
- SimdMatrix3x3 basisA;
+ btMatrix3x3 basisA;
basisA.setValue(0.99999958f,0.00022980258f,0.00090992288f,
-0.00029313788f,0.99753088f,0.070228584f,
-0.00089153741f,-0.070228823f,0.99753052f);
- SimdMatrix3x3 basisB;
+ btMatrix3x3 basisB;
basisB.setValue(1.0000000f,4.4865553e-018f,-4.4410586e-017f,
4.4865495e-018f,0.97979438f,0.20000751f,
4.4410586e-017f,-0.20000751f,0.97979438f);
@@ -95,11 +95,11 @@ void CollisionDemo::initPhysics()
- SimdVector3 boxHalfExtentsA(1.0000004768371582f,1.0000004768371582f,1.0000001192092896f);
- SimdVector3 boxHalfExtentsB(3.2836332321166992f,3.2836332321166992f,3.2836320400238037f);
+ btVector3 boxHalfExtentsA(1.0000004768371582f,1.0000004768371582f,1.0000001192092896f);
+ btVector3 boxHalfExtentsB(3.2836332321166992f,3.2836332321166992f,3.2836320400238037f);
- BoxShape* boxA = new BoxShape(boxHalfExtentsA);
- BoxShape* boxB = new BoxShape(boxHalfExtentsB);
+ btBoxShape* boxA = new btBoxShape(boxHalfExtentsA);
+ btBoxShape* boxB = new btBoxShape(boxHalfExtentsB);
shapePtr[0] = boxA;
shapePtr[1] = boxB;
@@ -112,8 +112,8 @@ void CollisionDemo::clientMoveAndDisplay()
}
-static VoronoiSimplexSolver sGjkSimplexSolver;
-SimplexSolverInterface& gGjkSimplexSolver = sGjkSimplexSolver;
+static btVoronoiSimplexSolver sGjkSimplexSolver;
+btSimplexSolverInterface& gGjkSimplexSolver = sGjkSimplexSolver;
@@ -127,13 +127,13 @@ void CollisionDemo::displayCallback(void) {
float m[16];
int i;
- GjkPairDetector convexConvex(shapePtr[0],shapePtr[1],&sGjkSimplexSolver,0);
+ btGjkPairDetector convexConvex(shapePtr[0],shapePtr[1],&sGjkSimplexSolver,0);
- SimdVector3 seperatingAxis(0.00000000f,0.059727669f,0.29259586f);
+ btVector3 seperatingAxis(0.00000000f,0.059727669f,0.29259586f);
convexConvex.SetCachedSeperatingAxis(seperatingAxis);
- PointCollector gjkOutput;
- GjkPairDetector::ClosestPointInput input;
+ btPointCollector gjkOutput;
+ btGjkPairDetector::ClosestPointInput input;
input.m_transformA = tr[0];
input.m_transformB = tr[1];
@@ -141,7 +141,7 @@ void CollisionDemo::displayCallback(void) {
if (gjkOutput.m_hasResult)
{
- SimdVector3 endPt = gjkOutput.m_pointInWorld +
+ btVector3 endPt = gjkOutput.m_pointInWorld +
gjkOutput.m_normalOnBInWorld*gjkOutput.m_distance;
glBegin(GL_LINES);
@@ -159,26 +159,26 @@ void CollisionDemo::displayCallback(void) {
tr[i].getOpenGLMatrix( m );
- GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],SimdVector3(1,1,1),getDebugMode());
+ GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],btVector3(1,1,1),getDebugMode());
}
simplex.SetSimplexSolver(&sGjkSimplexSolver);
- SimdPoint3 ybuf[4],pbuf[4],qbuf[4];
+ btPoint3 ybuf[4],pbuf[4],qbuf[4];
int numpoints = sGjkSimplexSolver.getSimplex(pbuf,qbuf,ybuf);
simplex.Reset();
for (i=0;i<numpoints;i++)
simplex.AddVertex(ybuf[i]);
- SimdTransform ident;
+ btTransform ident;
ident.setIdentity();
ident.getOpenGLMatrix(m);
- GL_ShapeDrawer::DrawOpenGL(m,&simplex,SimdVector3(1,1,1),getDebugMode());
+ GL_ShapeDrawer::DrawOpenGL(m,&simplex,btVector3(1,1,1),getDebugMode());
- SimdQuaternion orn;
+ btQuaternion orn;
orn.setEuler(yaw,pitch,roll);
tr[0].setRotation(orn);
diff --git a/Demos/CollisionInterfaceDemo/CollisionInterfaceDemo.cpp b/Demos/CollisionInterfaceDemo/CollisionInterfaceDemo.cpp
index d6a6aff20..e884fd4b9 100644
--- a/Demos/CollisionInterfaceDemo/CollisionInterfaceDemo.cpp
+++ b/Demos/CollisionInterfaceDemo/CollisionInterfaceDemo.cpp
@@ -23,7 +23,7 @@ subject to the following restrictions:
//include common Bullet Collision Detection headerfiles
#include "btBulletCollisionCommon.h"
-#include "LinearMath/GenIDebugDraw.h"
+#include "LinearMath/btIDebugDraw.h"
#include "GL_ShapeDrawer.h"
#include "CollisionInterfaceDemo.h"
#include "GlutStuff.h"
@@ -36,8 +36,8 @@ const int numObjects = 2;
GL_Simplex1to4 simplex;
-CollisionObject objects[maxNumObjects];
-CollisionWorld* collisionWorld = 0;
+btCollisionObject objects[maxNumObjects];
+btCollisionWorld* collisionWorld = 0;
int screenWidth = 640;
int screenHeight = 480;
@@ -57,40 +57,40 @@ int main(int argc,char** argv)
void CollisionInterfaceDemo::initPhysics()
{
- m_debugMode |= IDebugDraw::DBG_DrawWireframe;
+ m_debugMode |= btIDebugDraw::DBG_DrawWireframe;
- SimdMatrix3x3 basisA;
+ btMatrix3x3 basisA;
basisA.setIdentity();
- SimdMatrix3x3 basisB;
+ btMatrix3x3 basisB;
basisB.setIdentity();
objects[0].m_worldTransform.setBasis(basisA);
objects[1].m_worldTransform.setBasis(basisB);
- //SimdPoint3 points0[3]={SimdPoint3(1,0,0),SimdPoint3(0,1,0),SimdPoint3(0,0,1)};
- //SimdPoint3 points1[5]={SimdPoint3(1,0,0),SimdPoint3(0,1,0),SimdPoint3(0,0,1),SimdPoint3(0,0,-1),SimdPoint3(-1,-1,0)};
+ //btPoint3 points0[3]={btPoint3(1,0,0),btPoint3(0,1,0),btPoint3(0,0,1)};
+ //btPoint3 points1[5]={btPoint3(1,0,0),btPoint3(0,1,0),btPoint3(0,0,1),btPoint3(0,0,-1),btPoint3(-1,-1,0)};
- BoxShape* boxA = new BoxShape(SimdVector3(1,1,1));
- BoxShape* boxB = new BoxShape(SimdVector3(0.5,0.5,0.5));
+ btBoxShape* boxA = new btBoxShape(btVector3(1,1,1));
+ btBoxShape* boxB = new btBoxShape(btVector3(0.5,0.5,0.5));
//ConvexHullShape hullA(points0,3);
- //hullA.setLocalScaling(SimdVector3(3,3,3));
+ //hullA.setLocalScaling(btVector3(3,3,3));
//ConvexHullShape hullB(points1,4);
- //hullB.setLocalScaling(SimdVector3(4,4,4));
+ //hullB.setLocalScaling(btVector3(4,4,4));
objects[0].m_collisionShape = boxA;//&hullA;
objects[1].m_collisionShape = boxB;//&hullB;
- CollisionDispatcher* dispatcher = new CollisionDispatcher;
- SimdVector3 worldAabbMin(-1000,-1000,-1000);
- SimdVector3 worldAabbMax(1000,1000,1000);
+ btCollisionDispatcher* dispatcher = new btCollisionDispatcher;
+ btVector3 worldAabbMin(-1000,-1000,-1000);
+ btVector3 worldAabbMax(1000,1000,1000);
- AxisSweep3* broadphase = new AxisSweep3(worldAabbMin,worldAabbMax);
+ btAxisSweep3* broadphase = new btAxisSweep3(worldAabbMin,worldAabbMax);
//SimpleBroadphase is a brute force alternative, performing N^2 aabb overlap tests
- //SimpleBroadphase* broadphase = new SimpleBroadphase;
+ //SimpleBroadphase* broadphase = new btSimpleBroadphase;
- collisionWorld = new CollisionWorld(dispatcher,broadphase);
+ collisionWorld = new btCollisionWorld(dispatcher,broadphase);
collisionWorld->AddCollisionObject(&objects[0]);
collisionWorld->AddCollisionObject(&objects[1]);
@@ -107,8 +107,8 @@ void CollisionInterfaceDemo::clientMoveAndDisplay()
}
-static VoronoiSimplexSolver sGjkSimplexSolver;
-SimplexSolverInterface& gGjkSimplexSolver = sGjkSimplexSolver;
+static btVoronoiSimplexSolver sGjkSimplexSolver;
+btSimplexSolverInterface& gGjkSimplexSolver = sGjkSimplexSolver;
@@ -127,21 +127,21 @@ void CollisionInterfaceDemo::displayCallback(void) {
int numManifolds = collisionWorld->GetDispatcher()->GetNumManifolds();
for (i=0;i<numManifolds;i++)
{
- PersistentManifold* contactManifold = collisionWorld->GetDispatcher()->GetManifoldByIndexInternal(i);
- CollisionObject* obA = static_cast<CollisionObject*>(contactManifold->GetBody0());
- CollisionObject* obB = static_cast<CollisionObject*>(contactManifold->GetBody1());
+ btPersistentManifold* contactManifold = collisionWorld->GetDispatcher()->GetManifoldByIndexInternal(i);
+ btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->GetBody0());
+ btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->GetBody1());
contactManifold->RefreshContactPoints(obA->m_worldTransform,obB->m_worldTransform);
int numContacts = contactManifold->GetNumContacts();
for (int j=0;j<numContacts;j++)
{
- ManifoldPoint& pt = contactManifold->GetContactPoint(j);
+ btManifoldPoint& pt = contactManifold->GetContactPoint(j);
glBegin(GL_LINES);
glColor3f(1, 0, 1);
- SimdVector3 ptA = pt.GetPositionWorldOnA();
- SimdVector3 ptB = pt.GetPositionWorldOnB();
+ btVector3 ptA = pt.GetPositionWorldOnA();
+ btVector3 ptB = pt.GetPositionWorldOnB();
glVertex3d(ptA.x(),ptA.y(),ptA.z());
glVertex3d(ptB.x(),ptB.y(),ptB.z());
@@ -162,14 +162,14 @@ void CollisionInterfaceDemo::displayCallback(void) {
{
objects[i].m_worldTransform.getOpenGLMatrix( m );
- GL_ShapeDrawer::DrawOpenGL(m,objects[i].m_collisionShape,SimdVector3(1,1,1),getDebugMode());
+ GL_ShapeDrawer::DrawOpenGL(m,objects[i].m_collisionShape,btVector3(1,1,1),getDebugMode());
}
- SimdQuaternion orn;
+ btQuaternion orn;
orn.setEuler(yaw,pitch,roll);
- objects[1].m_worldTransform.setOrigin(objects[1].m_worldTransform.getOrigin()+SimdVector3(0,-0.01,0));
+ objects[1].m_worldTransform.setOrigin(objects[1].m_worldTransform.getOrigin()+btVector3(0,-0.01,0));
objects[0].m_worldTransform.setRotation(orn);
@@ -182,8 +182,8 @@ void CollisionInterfaceDemo::displayCallback(void) {
void CollisionInterfaceDemo::clientResetScene()
{
- objects[0].m_worldTransform.setOrigin(SimdVector3(0.0f,3.f,0.f));
- objects[1].m_worldTransform.setOrigin(SimdVector3(0.0f,9.f,0.f));
+ objects[0].m_worldTransform.setOrigin(btVector3(0.0f,3.f,0.f));
+ objects[1].m_worldTransform.setOrigin(btVector3(0.0f,9.f,0.f));
}
diff --git a/Demos/CollisionInterfaceDemo/CollisionInterfaceDemo.h b/Demos/CollisionInterfaceDemo/CollisionInterfaceDemo.h
index 28b0cd414..6ec45cb55 100644
--- a/Demos/CollisionInterfaceDemo/CollisionInterfaceDemo.h
+++ b/Demos/CollisionInterfaceDemo/CollisionInterfaceDemo.h
@@ -17,7 +17,7 @@ subject to the following restrictions:
#include "DemoApplication.h"
-///CollisionInterfaceDemo shows how to use the collision detection without dynamics (CollisionWorld/CollisionObject)
+///CollisionInterfaceDemo shows how to use the collision detection without dynamics (btCollisionWorld/CollisionObject)
class CollisionInterfaceDemo : public DemoApplication
{
public:
diff --git a/Demos/ConcaveDemo/ConcavePhysicsDemo.cpp b/Demos/ConcaveDemo/ConcavePhysicsDemo.cpp
index 0835c97ad..d6891f256 100644
--- a/Demos/ConcaveDemo/ConcavePhysicsDemo.cpp
+++ b/Demos/ConcaveDemo/ConcavePhysicsDemo.cpp
@@ -17,7 +17,7 @@ subject to the following restrictions:
#include "CcdPhysicsController.h"
#include "MyMotionState.h"
#include "btBulletDynamicsCommon.h"
-#include "LinearMath/GenIDebugDraw.h"
+#include "LinearMath/btIDebugDraw.h"
#include "GLDebugDrawer.h"
#include "PHY_Pro.h"
#include "ConcaveDemo.h"
@@ -30,17 +30,17 @@ GLDebugDrawer debugDrawer;
static const int NUM_VERTICES = 5;
static const int NUM_TRIANGLES=4;
-SimdVector3 gVertices[NUM_VERTICES];
+btVector3 gVertices[NUM_VERTICES];
int gIndices[NUM_TRIANGLES*3];
const float TRIANGLE_SIZE=80.f;
-///User can override this material combiner by implementing gContactAddedCallback and setting body0->m_collisionFlags |= CollisionObject::customMaterialCallback;
-inline SimdScalar calculateCombinedFriction(float friction0,float friction1)
+///User can override this material combiner by implementing gContactAddedCallback and setting body0->m_collisionFlags |= btCollisionObject::customMaterialCallback;
+inline btScalar calculateCombinedFriction(float friction0,float friction1)
{
- SimdScalar friction = friction0 * friction1;
+ btScalar friction = friction0 * friction1;
- const SimdScalar MAX_FRICTION = 10.f;
+ const btScalar MAX_FRICTION = 10.f;
if (friction < -MAX_FRICTION)
friction = -MAX_FRICTION;
if (friction > MAX_FRICTION)
@@ -49,14 +49,14 @@ inline SimdScalar calculateCombinedFriction(float friction0,float friction1)
}
-inline SimdScalar calculateCombinedRestitution(float restitution0,float restitution1)
+inline btScalar calculateCombinedRestitution(float restitution0,float restitution1)
{
return restitution0 * restitution1;
}
-bool CustomMaterialCombinerCallback(ManifoldPoint& cp, const CollisionObject* colObj0,int partId0,int index0,const CollisionObject* colObj1,int partId1,int index1)
+bool CustomMaterialCombinerCallback(btManifoldPoint& cp, const btCollisionObject* colObj0,int partId0,int index0,const btCollisionObject* colObj1,int partId1,int index1)
{
float friction0 = colObj0->getFriction();
@@ -64,12 +64,12 @@ bool CustomMaterialCombinerCallback(ManifoldPoint& cp, const CollisionObject* co
float restitution0 = colObj0->getRestitution();
float restitution1 = colObj1->getRestitution();
- if (colObj0->m_collisionFlags & CollisionObject::customMaterialCallback)
+ if (colObj0->m_collisionFlags & btCollisionObject::customMaterialCallback)
{
friction0 = 1.0;//partId0,index0
restitution0 = 0.f;
}
- if (colObj1->m_collisionFlags & CollisionObject::customMaterialCallback)
+ if (colObj1->m_collisionFlags & btCollisionObject::customMaterialCallback)
{
if (index1&1)
{
@@ -107,7 +107,7 @@ void ConcaveDemo::initPhysics()
{
#define TRISIZE 10.f
- int vertStride = sizeof(SimdVector3);
+ int vertStride = sizeof(btVector3);
int indexStride = 3*sizeof(int);
const int NUM_VERTS_X = 50;
@@ -116,7 +116,7 @@ void ConcaveDemo::initPhysics()
const int totalTriangles = 2*(NUM_VERTS_X-1)*(NUM_VERTS_Y-1);
- SimdVector3* gVertices = new SimdVector3[totalVerts];
+ btVector3* gVertices = new btVector3[totalVerts];
int* gIndices = new int[totalTriangles*3];
int i;
@@ -144,39 +144,39 @@ void ConcaveDemo::initPhysics()
}
}
- TriangleIndexVertexArray* indexVertexArrays = new TriangleIndexVertexArray(totalTriangles,
+ btTriangleIndexVertexArray* indexVertexArrays = new btTriangleIndexVertexArray(totalTriangles,
gIndices,
indexStride,
totalVerts,(float*) &gVertices[0].x(),vertStride);
- CollisionShape* trimeshShape = new BvhTriangleMeshShape(indexVertexArrays);
+ btCollisionShape* trimeshShape = new btBvhTriangleMeshShape(indexVertexArrays);
- // ConstraintSolver* solver = new SequentialImpulseConstraintSolver;
+ // btConstraintSolver* solver = new btSequentialImpulseConstraintSolver;
- CollisionDispatcher* dispatcher = new CollisionDispatcher();
+ btCollisionDispatcher* dispatcher = new btCollisionDispatcher();
- OverlappingPairCache* broadphase = new SimpleBroadphase();
+ btOverlappingPairCache* broadphase = new btSimpleBroadphase();
m_physicsEnvironmentPtr = new CcdPhysicsEnvironment(dispatcher,broadphase);
bool isDynamic = false;
float mass = 0.f;
- SimdTransform startTransform;
+ btTransform startTransform;
startTransform.setIdentity();
- startTransform.setOrigin(SimdVector3(0,-2,0));
+ startTransform.setOrigin(btVector3(0,-2,0));
CcdPhysicsController* staticTrimesh = LocalCreatePhysicsObject(isDynamic, mass, startTransform,trimeshShape);
//enable custom material callback
- staticTrimesh->GetRigidBody()->m_collisionFlags |= CollisionObject::customMaterialCallback;
+ staticTrimesh->GetRigidBody()->m_collisionFlags |= btCollisionObject::customMaterialCallback;
{
for (int i=0;i<10;i++)
{
- CollisionShape* boxShape = new BoxShape(SimdVector3(1,1,1));
- startTransform.setOrigin(SimdVector3(2*i,1,1));
+ btCollisionShape* boxShape = new btBoxShape(btVector3(1,1,1));
+ startTransform.setOrigin(btVector3(2*i,1,1));
LocalCreatePhysicsObject(true, 1, startTransform,boxShape);
}
}
diff --git a/Demos/ConcaveDemo/MyMotionState.cpp b/Demos/ConcaveDemo/MyMotionState.cpp
index 4699dd718..fe3636d5d 100644
--- a/Demos/ConcaveDemo/MyMotionState.cpp
+++ b/Demos/ConcaveDemo/MyMotionState.cpp
@@ -14,7 +14,7 @@ subject to the following restrictions:
*/
#include "MyMotionState.h"
-#include "LinearMath/SimdPoint3.h"
+#include "LinearMath/btPoint3.h"
MyMotionState::MyMotionState()
{
@@ -51,13 +51,13 @@ void MyMotionState::getWorldOrientation(float& quatIma0,float& quatIma1,float& q
void MyMotionState::setWorldPosition(float posX,float posY,float posZ)
{
- SimdPoint3 pos(posX,posY,posZ);
+ btPoint3 pos(posX,posY,posZ);
m_worldTransform.setOrigin( pos );
}
void MyMotionState::setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal)
{
- SimdQuaternion orn(quatIma0,quatIma1,quatIma2,quatReal);
+ btQuaternion orn(quatIma0,quatIma1,quatIma2,quatReal);
m_worldTransform.setRotation( orn );
}
diff --git a/Demos/ConcaveDemo/MyMotionState.h b/Demos/ConcaveDemo/MyMotionState.h
index cbf9988e2..7aa7c8520 100644
--- a/Demos/ConcaveDemo/MyMotionState.h
+++ b/Demos/ConcaveDemo/MyMotionState.h
@@ -17,7 +17,7 @@ subject to the following restrictions:
#define MY_MOTIONSTATE_H
#include "PHY_IMotionState.h"
-#include <LinearMath/SimdTransform.h>
+#include <LinearMath/btTransform.h>
class MyMotionState : public PHY_IMotionState
@@ -37,7 +37,7 @@ class MyMotionState : public PHY_IMotionState
virtual void calculateWorldTransformations();
- SimdTransform m_worldTransform;
+ btTransform m_worldTransform;
};
diff --git a/Demos/ConstraintDemo/ConstraintDemo.cpp b/Demos/ConstraintDemo/ConstraintDemo.cpp
index dfc42d98d..c605dbb7c 100644
--- a/Demos/ConstraintDemo/ConstraintDemo.cpp
+++ b/Demos/ConstraintDemo/ConstraintDemo.cpp
@@ -17,7 +17,7 @@ subject to the following restrictions:
#include "CcdPhysicsController.h"
#include "MyMotionState.h"
#include "btBulletDynamicsCommon.h"
-#include "LinearMath/GenIDebugDraw.h"
+#include "LinearMath/btIDebugDraw.h"
#include "GLDebugDrawer.h"
@@ -53,12 +53,12 @@ int main(int argc,char** argv)
void ConstraintDemo::initPhysics()
{
- //ConstraintSolver* solver = new SequentialImpulseConstraintSolver;
+ //ConstraintSolver* solver = new btSequentialImpulseConstraintSolver;
//ConstraintSolver* solver = new OdeConstraintSolver;
- CollisionDispatcher* dispatcher = new CollisionDispatcher();
+ btCollisionDispatcher* dispatcher = new btCollisionDispatcher();
- OverlappingPairCache* broadphase = new SimpleBroadphase();
+ btOverlappingPairCache* broadphase = new btSimpleBroadphase();
m_physicsEnvironmentPtr = new CcdPhysicsEnvironment(dispatcher,broadphase);
@@ -66,16 +66,16 @@ void ConstraintDemo::initPhysics()
m_physicsEnvironmentPtr->setGravity(0,-10,0);
- CollisionShape* shape = new BoxShape(SimdVector3(CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS));
- SimdTransform trans;
+ btCollisionShape* shape = new btBoxShape(btVector3(CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS));
+ btTransform trans;
trans.setIdentity();
- trans.setOrigin(SimdVector3(0,20,0));
+ trans.setOrigin(btVector3(0,20,0));
bool isDynamic = false;
float mass = 1.f;
CcdPhysicsController* ctrl0 = LocalCreatePhysicsObject( isDynamic,mass,trans,shape);
- trans.setOrigin(SimdVector3(2*CUBE_HALF_EXTENTS,20,0));
+ trans.setOrigin(btVector3(2*CUBE_HALF_EXTENTS,20,0));
isDynamic = true;
CcdPhysicsController* ctrl1 = LocalCreatePhysicsObject( isDynamic,mass,trans,shape);
diff --git a/Demos/ConstraintDemo/ConstraintDemo.h b/Demos/ConstraintDemo/ConstraintDemo.h
index 229fa4382..7fb9c7e13 100644
--- a/Demos/ConstraintDemo/ConstraintDemo.h
+++ b/Demos/ConstraintDemo/ConstraintDemo.h
@@ -17,7 +17,7 @@ subject to the following restrictions:
#include "DemoApplication.h"
-///ConstraintDemo shows how to create a constraint, like Hinge or GenericD6constraint
+///ConstraintDemo shows how to create a constraint, like Hinge or btGenericD6constraint
class ConstraintDemo : public DemoApplication
{
public:
diff --git a/Demos/ConstraintDemo/MyMotionState.cpp b/Demos/ConstraintDemo/MyMotionState.cpp
index 4699dd718..fe3636d5d 100644
--- a/Demos/ConstraintDemo/MyMotionState.cpp
+++ b/Demos/ConstraintDemo/MyMotionState.cpp
@@ -14,7 +14,7 @@ subject to the following restrictions:
*/
#include "MyMotionState.h"
-#include "LinearMath/SimdPoint3.h"
+#include "LinearMath/btPoint3.h"
MyMotionState::MyMotionState()
{
@@ -51,13 +51,13 @@ void MyMotionState::getWorldOrientation(float& quatIma0,float& quatIma1,float& q
void MyMotionState::setWorldPosition(float posX,float posY,float posZ)
{
- SimdPoint3 pos(posX,posY,posZ);
+ btPoint3 pos(posX,posY,posZ);
m_worldTransform.setOrigin( pos );
}
void MyMotionState::setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal)
{
- SimdQuaternion orn(quatIma0,quatIma1,quatIma2,quatReal);
+ btQuaternion orn(quatIma0,quatIma1,quatIma2,quatReal);
m_worldTransform.setRotation( orn );
}
diff --git a/Demos/ConstraintDemo/MyMotionState.h b/Demos/ConstraintDemo/MyMotionState.h
index cbf9988e2..7aa7c8520 100644
--- a/Demos/ConstraintDemo/MyMotionState.h
+++ b/Demos/ConstraintDemo/MyMotionState.h
@@ -17,7 +17,7 @@ subject to the following restrictions:
#define MY_MOTIONSTATE_H
#include "PHY_IMotionState.h"
-#include <LinearMath/SimdTransform.h>
+#include <LinearMath/btTransform.h>
class MyMotionState : public PHY_IMotionState
@@ -37,7 +37,7 @@ class MyMotionState : public PHY_IMotionState
virtual void calculateWorldTransformations();
- SimdTransform m_worldTransform;
+ btTransform m_worldTransform;
};
diff --git a/Demos/ContinuousConvexCollision/ContinuousConvexCollision.h b/Demos/ContinuousConvexCollision/ContinuousConvexCollision.h
index da3316c66..e2fd0642a 100644
--- a/Demos/ContinuousConvexCollision/ContinuousConvexCollision.h
+++ b/Demos/ContinuousConvexCollision/ContinuousConvexCollision.h
@@ -18,7 +18,7 @@ subject to the following restrictions:
#include "DemoApplication.h"
///ContinuousConvexCollisionDemo shows the working of the continuous collision detection, including linear and angular motion
-class ContinuousConvexCollisionDemo : public DemoApplication
+class btContinuousConvexCollisionDemo : public DemoApplication
{
public:
diff --git a/Demos/ContinuousConvexCollision/ContinuousConvexCollisionDemo.cpp b/Demos/ContinuousConvexCollision/ContinuousConvexCollisionDemo.cpp
index f0490b6e6..b412e0df3 100644
--- a/Demos/ContinuousConvexCollision/ContinuousConvexCollisionDemo.cpp
+++ b/Demos/ContinuousConvexCollision/ContinuousConvexCollisionDemo.cpp
@@ -20,8 +20,8 @@
///This low level demo need internal access, and intentionally doesn't include the btBulletCollisionCommon.h headerfile
-#include "LinearMath/SimdQuaternion.h"
-#include "LinearMath/SimdTransform.h"
+#include "LinearMath/btQuaternion.h"
+#include "LinearMath/btTransform.h"
#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
#include "BulletCollision/CollisionShapes/btBoxShape.h"
#include "BulletCollision/CollisionShapes/btMinkowskiSumShape.h"
@@ -31,7 +31,7 @@
#include "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h"
#include "BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.h"
-#include "LinearMath/SimdTransformUtil.h"
+#include "LinearMath/btTransformUtil.h"
#include "DebugCastResult.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
@@ -50,14 +50,14 @@ float yaw=0.f,pitch=0.f,roll=0.f;
const int maxNumObjects = 4;
const int numObjects = 2;
-SimdVector3 angVels[numObjects];
-SimdVector3 linVels[numObjects];
+btVector3 angVels[numObjects];
+btVector3 linVels[numObjects];
-PolyhedralConvexShape* shapePtr[maxNumObjects];
+btPolyhedralConvexShape* shapePtr[maxNumObjects];
-SimdTransform fromTrans[maxNumObjects];
-SimdTransform toTrans[maxNumObjects];
+btTransform fromTrans[maxNumObjects];
+btTransform toTrans[maxNumObjects];
int screenWidth = 640;
@@ -66,7 +66,7 @@ int screenHeight = 480;
int main(int argc,char** argv)
{
- ContinuousConvexCollisionDemo* ccdDemo = new ContinuousConvexCollisionDemo();
+ btContinuousConvexCollisionDemo* ccdDemo = new btContinuousConvexCollisionDemo();
ccdDemo->setCameraDistance(40.f);
@@ -75,17 +75,17 @@ int main(int argc,char** argv)
return glutmain(argc, argv,screenWidth,screenHeight,"Continuous Convex Collision Demo",ccdDemo);
}
-void ContinuousConvexCollisionDemo::initPhysics()
+void btContinuousConvexCollisionDemo::initPhysics()
{
- fromTrans[0].setOrigin(SimdVector3(0,10,20));
- toTrans[0].setOrigin(SimdVector3(0,10,-20));
- fromTrans[1].setOrigin(SimdVector3(-2,7,0));
- toTrans[1].setOrigin(SimdVector3(-2,10,0));
+ fromTrans[0].setOrigin(btVector3(0,10,20));
+ toTrans[0].setOrigin(btVector3(0,10,-20));
+ fromTrans[1].setOrigin(btVector3(-2,7,0));
+ toTrans[1].setOrigin(btVector3(-2,10,0));
- SimdMatrix3x3 identBasis;
+ btMatrix3x3 identBasis;
identBasis.setIdentity();
- SimdMatrix3x3 basisA;
+ btMatrix3x3 basisA;
basisA.setIdentity();
basisA.setEulerZYX(0.f,-SIMD_HALF_PI,0.f);
@@ -96,15 +96,15 @@ void ContinuousConvexCollisionDemo::initPhysics()
toTrans[1].setBasis(identBasis);
toTrans[1].setBasis(identBasis);
- SimdVector3 boxHalfExtentsA(10,1,1);
- SimdVector3 boxHalfExtentsB(1.1f,1.1f,1.1f);
- BoxShape* boxA = new BoxShape(boxHalfExtentsA);
-// BU_Simplex1to4* boxA = new BU_Simplex1to4(SimdPoint3(-2,0,-2),SimdPoint3(2,0,-2),SimdPoint3(0,0,2),SimdPoint3(0,2,0));
-// BU_Simplex1to4* boxA = new BU_Simplex1to4(SimdPoint3(-12,0,0),SimdPoint3(12,0,0));
+ btVector3 boxHalfExtentsA(10,1,1);
+ btVector3 boxHalfExtentsB(1.1f,1.1f,1.1f);
+ btBoxShape* boxA = new btBoxShape(boxHalfExtentsA);
+// btBU_Simplex1to4* boxA = new btBU_Simplex1to4(btPoint3(-2,0,-2),btPoint3(2,0,-2),btPoint3(0,0,2),btPoint3(0,2,0));
+// btBU_Simplex1to4* boxA = new btBU_Simplex1to4(btPoint3(-12,0,0),btPoint3(12,0,0));
- BoxShape* boxB = new BoxShape(boxHalfExtentsB);
-// BU_Simplex1to4 boxB(SimdPoint3(0,10,0),SimdPoint3(0,-10,0));
+ btBoxShape* boxB = new btBoxShape(boxHalfExtentsB);
+// btBU_Simplex1to4 boxB(btPoint3(0,10,0),btPoint3(0,-10,0));
shapePtr[0] = boxA;
@@ -115,22 +115,22 @@ void ContinuousConvexCollisionDemo::initPhysics()
for (int i=0;i<numObjects;i++)
{
- SimdTransformUtil::CalculateVelocity(fromTrans[i],toTrans[i],1.f,linVels[i],angVels[i]);
+ btTransformUtil::CalculateVelocity(fromTrans[i],toTrans[i],1.f,linVels[i],angVels[i]);
}
}
//to be implemented by the demo
-void ContinuousConvexCollisionDemo::clientMoveAndDisplay()
+void btContinuousConvexCollisionDemo::clientMoveAndDisplay()
{
displayCallback();
}
-static VoronoiSimplexSolver sVoronoiSimplexSolver;
+static btVoronoiSimplexSolver sVoronoiSimplexSolver;
-SimplexSolverInterface& gGjkSimplexSolver = sVoronoiSimplexSolver;
+btSimplexSolverInterface& gGjkSimplexSolver = sVoronoiSimplexSolver;
bool drawLine= false;
@@ -139,7 +139,7 @@ int minlines = 0;
int maxlines = 512;
-void ContinuousConvexCollisionDemo::displayCallback(void) {
+void btContinuousConvexCollisionDemo::displayCallback(void) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDisable(GL_LIGHTING);
@@ -156,7 +156,7 @@ void ContinuousConvexCollisionDemo::displayCallback(void) {
}
*/
- if (getDebugMode()==IDebugDraw::DBG_DrawAabb)
+ if (getDebugMode()==btIDebugDraw::DBG_DrawAabb)
{
i=0;//for (i=1;i<numObjects;i++)
{
@@ -165,10 +165,10 @@ void ContinuousConvexCollisionDemo::displayCallback(void) {
int numSubSteps = 10;
for (int s=0;s<10;s++)
{
- SimdScalar subStep = s * 1.f/(float)numSubSteps;
- SimdTransform interpolatedTrans;
+ btScalar subStep = s * 1.f/(float)numSubSteps;
+ btTransform interpolatedTrans;
- SimdTransformUtil::IntegrateTransform(fromTrans[i],linVels[i],angVels[i],subStep,interpolatedTrans);
+ btTransformUtil::IntegrateTransform(fromTrans[i],linVels[i],angVels[i],subStep,interpolatedTrans);
//fromTrans[i].getOpenGLMatrix(m);
//GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i]);
@@ -177,15 +177,15 @@ void ContinuousConvexCollisionDemo::displayCallback(void) {
//GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i]);
interpolatedTrans.getOpenGLMatrix( m );
- GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],SimdVector3(1,0,1),getDebugMode());
+ GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],btVector3(1,0,1),getDebugMode());
}
}
}
- SimdMatrix3x3 mat;
+ btMatrix3x3 mat;
mat.setEulerZYX(yaw,pitch,roll);
- SimdQuaternion orn;
+ btQuaternion orn;
mat.getRotation(orn);
orn.setEuler(yaw,pitch,roll);
fromTrans[1].setRotation(orn);
@@ -198,17 +198,17 @@ void ContinuousConvexCollisionDemo::displayCallback(void) {
pitch += 0.005f;
// yaw += 0.01f;
}
-// SimdVector3 fromA(-25,11,0);
-// SimdVector3 toA(-15,11,0);
+// btVector3 fromA(-25,11,0);
+// btVector3 toA(-15,11,0);
-// SimdQuaternion ornFromA(0.f,0.f,0.f,1.f);
-// SimdQuaternion ornToA(0.f,0.f,0.f,1.f);
+// btQuaternion ornFromA(0.f,0.f,0.f,1.f);
+// btQuaternion ornToA(0.f,0.f,0.f,1.f);
-// SimdTransform rayFromWorld(ornFromA,fromA);
-// SimdTransform rayToWorld(ornToA,toA);
+// btTransform rayFromWorld(ornFromA,fromA);
+// btTransform rayToWorld(ornToA,toA);
- SimdTransform rayFromWorld = fromTrans[0];
- SimdTransform rayToWorld = toTrans[0];
+ btTransform rayFromWorld = fromTrans[0];
+ btTransform rayToWorld = toTrans[0];
if (drawLine)
@@ -229,17 +229,17 @@ void ContinuousConvexCollisionDemo::displayCallback(void) {
for (i=0;i<numObjects;i++)
{
fromTrans[i].getOpenGLMatrix(m);
- GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],SimdVector3(1,1,1),getDebugMode());
+ GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],btVector3(1,1,1),getDebugMode());
}
- DebugCastResult rayResult1(fromTrans[0],shapePtr[0],linVels[0],angVels[0]);
+ btDebugCastResult rayResult1(fromTrans[0],shapePtr[0],linVels[0],angVels[0]);
for (i=1;i<numObjects;i++)
{
- ConvexCast::CastResult rayResult2;
- ConvexCast::CastResult* rayResultPtr;
- if (IDebugDraw::DBG_DrawAabb)
+ btConvexCast::CastResult rayResult2;
+ btConvexCast::CastResult* rayResultPtr;
+ if (btIDebugDraw::DBG_DrawAabb)
{
rayResultPtr = &rayResult1;
} else
@@ -251,8 +251,8 @@ void ContinuousConvexCollisionDemo::displayCallback(void) {
//SubsimplexConvexCast convexCaster(&gGjkSimplexSolver);
//optional
- ConvexPenetrationDepthSolver* penetrationDepthSolver = 0;
- ContinuousConvexCollision convexCaster(shapePtr[0],shapePtr[i],&gGjkSimplexSolver,penetrationDepthSolver );
+ btConvexPenetrationDepthSolver* penetrationDepthSolver = 0;
+ btContinuousConvexCollision convexCaster(shapePtr[0],shapePtr[i],&gGjkSimplexSolver,penetrationDepthSolver );
gGjkSimplexSolver.reset();
@@ -263,16 +263,16 @@ void ContinuousConvexCollisionDemo::displayCallback(void) {
glDisable(GL_DEPTH_TEST);
- SimdTransform hitTrans;
- SimdTransformUtil::IntegrateTransform(fromTrans[0],linVels[0],angVels[0],rayResultPtr->m_fraction,hitTrans);
+ btTransform hitTrans;
+ btTransformUtil::IntegrateTransform(fromTrans[0],linVels[0],angVels[0],rayResultPtr->m_fraction,hitTrans);
hitTrans.getOpenGLMatrix(m);
- GL_ShapeDrawer::DrawOpenGL(m,shapePtr[0],SimdVector3(0,1,0),getDebugMode());
+ GL_ShapeDrawer::DrawOpenGL(m,shapePtr[0],btVector3(0,1,0),getDebugMode());
- SimdTransformUtil::IntegrateTransform(fromTrans[i],linVels[i],angVels[i],rayResultPtr->m_fraction,hitTrans);
+ btTransformUtil::IntegrateTransform(fromTrans[i],linVels[i],angVels[i],rayResultPtr->m_fraction,hitTrans);
hitTrans.getOpenGLMatrix(m);
- GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],SimdVector3(0,1,1),getDebugMode());
+ GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],btVector3(0,1,1),getDebugMode());
}
diff --git a/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp b/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp
index 21f576e80..f888be7e4 100644
--- a/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp
+++ b/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp
@@ -21,8 +21,8 @@ subject to the following restrictions:
#include "CcdPhysicsController.h"
#include "btBulletDynamicsCommon.h"
-#include "LinearMath/GenQuickprof.h"
-#include "LinearMath/GenIDebugDraw.h"
+#include "LinearMath/btQuickprof.h"
+#include "LinearMath/btIDebugDraw.h"
#include "GLDebugDrawer.h"
@@ -42,11 +42,11 @@ const int maxNumObjects = 450;
int shapeIndex[maxNumObjects];
-SimdVector3 centroid;
+btVector3 centroid;
#define CUBE_HALF_EXTENTS 4
-CollisionShape* shapePtr[maxNumObjects];
+btCollisionShape* shapePtr[maxNumObjects];
@@ -81,25 +81,25 @@ void ConvexDecompositionDemo::initPhysics(const char* filename)
tcount = wo.loadObj(filename);
- CollisionDispatcher* dispatcher = new CollisionDispatcher();
+ btCollisionDispatcher* dispatcher = new btCollisionDispatcher();
- SimdVector3 worldAabbMin(-10000,-10000,-10000);
- SimdVector3 worldAabbMax(10000,10000,10000);
+ btVector3 worldAabbMin(-10000,-10000,-10000);
+ btVector3 worldAabbMax(10000,10000,10000);
- OverlappingPairCache* broadphase = new AxisSweep3(worldAabbMin,worldAabbMax);
- //OverlappingPairCache* broadphase = new SimpleBroadphase();
+ btOverlappingPairCache* broadphase = new btAxisSweep3(worldAabbMin,worldAabbMax);
+ //OverlappingPairCache* broadphase = new btSimpleBroadphase();
m_physicsEnvironmentPtr = new CcdPhysicsEnvironment(dispatcher,broadphase);
m_physicsEnvironmentPtr->setDeactivationTime(2.f);
m_physicsEnvironmentPtr->setGravity(0,-10,0);
- SimdTransform startTransform;
+ btTransform startTransform;
startTransform.setIdentity();
- startTransform.setOrigin(SimdVector3(0,-4,0));
+ startTransform.setOrigin(btVector3(0,-4,0));
- LocalCreatePhysicsObject(false,0,startTransform,new BoxShape(SimdVector3(30,2,30)));
+ LocalCreatePhysicsObject(false,0,startTransform,new btBoxShape(btVector3(30,2,30)));
class MyConvexDecomposition : public ConvexDecomposition::ConvexDecompInterface
{
@@ -119,9 +119,9 @@ void ConvexDecompositionDemo::initPhysics(const char* filename)
virtual void ConvexDecompResult(ConvexDecomposition::ConvexResult &result)
{
- TriangleMesh* trimesh = new TriangleMesh();
+ btTriangleMesh* trimesh = new btTriangleMesh();
- SimdVector3 localScaling(6.f,6.f,6.f);
+ btVector3 localScaling(6.f,6.f,6.f);
//export data to .obj
printf("ConvexResult\n");
@@ -148,9 +148,9 @@ void ConvexDecompositionDemo::initPhysics(const char* filename)
unsigned int index0 = *src++;
unsigned int index1 = *src++;
unsigned int index2 = *src++;
- SimdVector3 vertex0(result.mHullVertices[index0*3], result.mHullVertices[index0*3+1],result.mHullVertices[index0*3+2]);
- SimdVector3 vertex1(result.mHullVertices[index1*3], result.mHullVertices[index1*3+1],result.mHullVertices[index1*3+2]);
- SimdVector3 vertex2(result.mHullVertices[index2*3], result.mHullVertices[index2*3+1],result.mHullVertices[index2*3+2]);
+ btVector3 vertex0(result.mHullVertices[index0*3], result.mHullVertices[index0*3+1],result.mHullVertices[index0*3+2]);
+ btVector3 vertex1(result.mHullVertices[index1*3], result.mHullVertices[index1*3+1],result.mHullVertices[index1*3+2]);
+ btVector3 vertex2(result.mHullVertices[index2*3], result.mHullVertices[index2*3+1],result.mHullVertices[index2*3+2]);
vertex0 *= localScaling;
vertex1 *= localScaling;
vertex2 *= localScaling;
@@ -173,9 +173,9 @@ void ConvexDecompositionDemo::initPhysics(const char* filename)
unsigned int index2 = *src++;
- SimdVector3 vertex0(result.mHullVertices[index0*3], result.mHullVertices[index0*3+1],result.mHullVertices[index0*3+2]);
- SimdVector3 vertex1(result.mHullVertices[index1*3], result.mHullVertices[index1*3+1],result.mHullVertices[index1*3+2]);
- SimdVector3 vertex2(result.mHullVertices[index2*3], result.mHullVertices[index2*3+1],result.mHullVertices[index2*3+2]);
+ btVector3 vertex0(result.mHullVertices[index0*3], result.mHullVertices[index0*3+1],result.mHullVertices[index0*3+2]);
+ btVector3 vertex1(result.mHullVertices[index1*3], result.mHullVertices[index1*3+1],result.mHullVertices[index1*3+2]);
+ btVector3 vertex2(result.mHullVertices[index2*3], result.mHullVertices[index2*3+1],result.mHullVertices[index2*3+2]);
vertex0 *= localScaling;
vertex1 *= localScaling;
vertex2 *= localScaling;
@@ -196,8 +196,8 @@ void ConvexDecompositionDemo::initPhysics(const char* filename)
bool isDynamic = true;
float mass = 1.f;
- CollisionShape* convexShape = new ConvexTriangleMeshShape(trimesh);
- SimdTransform trans;
+ btCollisionShape* convexShape = new btConvexTriangleMeshShape(trimesh);
+ btTransform trans;
trans.setIdentity();
trans.setOrigin(centroid);
m_convexDemo->LocalCreatePhysicsObject(isDynamic, mass, trans,convexShape);
@@ -216,9 +216,9 @@ void ConvexDecompositionDemo::initPhysics(const char* filename)
if (tcount)
{
- TriangleMesh* trimesh = new TriangleMesh();
+ btTriangleMesh* trimesh = new btTriangleMesh();
- SimdVector3 localScaling(6.f,6.f,6.f);
+ btVector3 localScaling(6.f,6.f,6.f);
for (int i=0;i<wo.mTriCount;i++)
{
@@ -226,9 +226,9 @@ void ConvexDecompositionDemo::initPhysics(const char* filename)
int index1 = wo.mIndices[i*3+1];
int index2 = wo.mIndices[i*3+2];
- SimdVector3 vertex0(wo.mVertices[index0*3], wo.mVertices[index0*3+1],wo.mVertices[index0*3+2]);
- SimdVector3 vertex1(wo.mVertices[index1*3], wo.mVertices[index1*3+1],wo.mVertices[index1*3+2]);
- SimdVector3 vertex2(wo.mVertices[index2*3], wo.mVertices[index2*3+1],wo.mVertices[index2*3+2]);
+ btVector3 vertex0(wo.mVertices[index0*3], wo.mVertices[index0*3+1],wo.mVertices[index0*3+2]);
+ btVector3 vertex1(wo.mVertices[index1*3], wo.mVertices[index1*3+1],wo.mVertices[index1*3+2]);
+ btVector3 vertex2(wo.mVertices[index2*3], wo.mVertices[index2*3+1],wo.mVertices[index2*3+2]);
vertex0 *= localScaling;
vertex1 *= localScaling;
@@ -237,13 +237,13 @@ void ConvexDecompositionDemo::initPhysics(const char* filename)
trimesh->AddTriangle(vertex0,vertex1,vertex2);
}
- CollisionShape* convexShape = new ConvexTriangleMeshShape(trimesh);
+ btCollisionShape* convexShape = new btConvexTriangleMeshShape(trimesh);
bool isDynamic = true;
float mass = 1.f;
- SimdTransform startTransform;
+ btTransform startTransform;
startTransform.setIdentity();
- startTransform.setOrigin(SimdVector3(20,2,0));
+ startTransform.setOrigin(btVector3(20,2,0));
LocalCreatePhysicsObject(isDynamic, mass, startTransform,convexShape);
diff --git a/Demos/ConvexHullDistance/ConvexHullDistanceDemo.cpp b/Demos/ConvexHullDistance/ConvexHullDistanceDemo.cpp
index b1de88bf4..394cb6d0f 100644
--- a/Demos/ConvexHullDistance/ConvexHullDistanceDemo.cpp
+++ b/Demos/ConvexHullDistance/ConvexHullDistanceDemo.cpp
@@ -16,12 +16,12 @@ subject to the following restrictions:
///
/// Convex Hull Distance Demo shows distance calculation between two convex hulls of points.
-/// GJK with the VoronoiSimplexSolver is used.
+/// GJK with the btVoronoiSimplexSolver is used.
///
#include "GL_Simplex1to4.h"
-#include "LinearMath/SimdQuaternion.h"
-#include "LinearMath/SimdTransform.h"
+#include "LinearMath/btQuaternion.h"
+#include "LinearMath/btTransform.h"
#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
#include "BulletCollision/CollisionShapes/btConvexHullShape.h"
@@ -51,9 +51,9 @@ const int numObjects = 2;
GL_Simplex1to4 simplex;
-PolyhedralConvexShape* shapePtr[maxNumObjects];
+btPolyhedralConvexShape* shapePtr[maxNumObjects];
-SimdTransform tr[numObjects];
+btTransform tr[numObjects];
int screenWidth = 640.f;
int screenHeight = 480.f;
@@ -62,26 +62,26 @@ int main(int argc,char** argv)
{
clientResetScene();
- SimdMatrix3x3 basisA;
+ btMatrix3x3 basisA;
basisA.setIdentity();
- SimdMatrix3x3 basisB;
+ btMatrix3x3 basisB;
basisB.setIdentity();
tr[0].setBasis(basisA);
tr[1].setBasis(basisB);
- SimdPoint3 points0[3]={SimdPoint3(1,0,0),SimdPoint3(0,1,0),SimdPoint3(0,0,1)};
- SimdPoint3 points1[5]={SimdPoint3(1,0,0),SimdPoint3(0,1,0),SimdPoint3(0,0,1),SimdPoint3(0,0,-1),SimdPoint3(-1,-1,0)};
+ btPoint3 points0[3]={btPoint3(1,0,0),btPoint3(0,1,0),btPoint3(0,0,1)};
+ btPoint3 points1[5]={btPoint3(1,0,0),btPoint3(0,1,0),btPoint3(0,0,1),btPoint3(0,0,-1),btPoint3(-1,-1,0)};
- ConvexHullShape hullA(points0,3);
- ConvexHullShape hullB(points1,5);
+ btConvexHullShape hullA(points0,3);
+ btConvexHullShape hullB(points1,5);
shapePtr[0] = &hullA;
shapePtr[1] = &hullB;
- SimdTransform tr;
+ btTransform tr;
tr.setIdentity();
@@ -97,8 +97,8 @@ void clientMoveAndDisplay()
}
-static VoronoiSimplexSolver sGjkSimplexSolver;
-SimplexSolverInterface& gGjkSimplexSolver = sGjkSimplexSolver;
+static btVoronoiSimplexSolver sGjkSimplexSolver;
+btSimplexSolverInterface& gGjkSimplexSolver = sGjkSimplexSolver;
@@ -112,13 +112,13 @@ void clientDisplay(void) {
float m[16];
int i;
- GjkPairDetector convexConvex(shapePtr[0],shapePtr[1],&sGjkSimplexSolver,0);
+ btGjkPairDetector convexConvex(shapePtr[0],shapePtr[1],&sGjkSimplexSolver,0);
- SimdVector3 seperatingAxis(0.00000000f,0.059727669f,0.29259586f);
+ btVector3 seperatingAxis(0.00000000f,0.059727669f,0.29259586f);
convexConvex.SetCachedSeperatingAxis(seperatingAxis);
- PointCollector gjkOutput;
- GjkPairDetector::ClosestPointInput input;
+ btPointCollector gjkOutput;
+ btGjkPairDetector::ClosestPointInput input;
input.m_transformA = tr[0];
input.m_transformB = tr[1];
@@ -126,7 +126,7 @@ void clientDisplay(void) {
if (gjkOutput.m_hasResult)
{
- SimdVector3 endPt = gjkOutput.m_pointInWorld +
+ btVector3 endPt = gjkOutput.m_pointInWorld +
gjkOutput.m_normalOnBInWorld*gjkOutput.m_distance;
glBegin(GL_LINES);
@@ -142,26 +142,26 @@ void clientDisplay(void) {
tr[i].getOpenGLMatrix( m );
- GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],SimdVector3(1,1,1),getDebugMode());
+ GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],btVector3(1,1,1),getDebugMode());
}
simplex.SetSimplexSolver(&sGjkSimplexSolver);
- SimdPoint3 ybuf[4],pbuf[4],qbuf[4];
+ btPoint3 ybuf[4],pbuf[4],qbuf[4];
int numpoints = sGjkSimplexSolver.getSimplex(pbuf,qbuf,ybuf);
simplex.Reset();
for (i=0;i<numpoints;i++)
simplex.AddVertex(ybuf[i]);
- SimdTransform ident;
+ btTransform ident;
ident.setIdentity();
ident.getOpenGLMatrix(m);
- GL_ShapeDrawer::DrawOpenGL(m,&simplex,SimdVector3(1,1,1),getDebugMode());
+ GL_ShapeDrawer::DrawOpenGL(m,&simplex,btVector3(1,1,1),getDebugMode());
- SimdQuaternion orn;
+ btQuaternion orn;
orn.setEuler(yaw,pitch,roll);
tr[0].setRotation(orn);
tr[1].setRotation(orn);
@@ -175,8 +175,8 @@ void clientDisplay(void) {
void clientResetScene()
{
- tr[0].setOrigin(SimdVector3(0.0f,3.f,7.f));
- tr[1].setOrigin(SimdVector3(0.0f,9.f,2.f));
+ tr[0].setOrigin(btVector3(0.0f,3.f,7.f));
+ tr[1].setOrigin(btVector3(0.0f,9.f,2.f));
}
void clientKeyboard(unsigned char key, int x, int y)
diff --git a/Demos/EPAPenDepthDemo/EpaPenDepthDemo.cpp b/Demos/EPAPenDepthDemo/EpaPenDepthDemo.cpp
index a5f1f4575..6bc30fe67 100644
--- a/Demos/EPAPenDepthDemo/EpaPenDepthDemo.cpp
+++ b/Demos/EPAPenDepthDemo/EpaPenDepthDemo.cpp
@@ -19,13 +19,13 @@ subject to the following restrictions:
/**
* Sample that shows the Expanding Polytope Algorithm ( EPA )
-* Generates two convex shapes and calculates the penetration depth
+* bterates two convex shapes and calculates the penetration depth
* between them in case they are penetrating
*/
#include "GL_Simplex1to4.h"
-#include "LinearMath/SimdQuaternion.h"
-#include "LinearMath/SimdTransform.h"
+#include "LinearMath/btQuaternion.h"
+#include "LinearMath/btTransform.h"
#include "GL_ShapeDrawer.h"
#include <GL/glut.h>
#include "GlutStuff.h"
@@ -51,34 +51,34 @@ subject to the following restrictions:
EpaPenetrationDepthSolver epaPenDepthSolver;
-SimplexSolverInterface simplexSolver;
+btSimplexSolverInterface simplexSolver;
int screenWidth = 640.f;
int screenHeight = 480.f;
// Scene stuff
-SimdPoint3 g_sceneVolumeMin( -1, -1, -1 );
-SimdPoint3 g_sceneVolumeMax( 1, 1, 1 );
+btPoint3 g_sceneVolumeMin( -1, -1, -1 );
+btPoint3 g_sceneVolumeMax( 1, 1, 1 );
bool g_shapesPenetrate = false;
-SimdVector3 g_wWitnesses[ 2 ];
+btVector3 g_wWitnesses[ 2 ];
// Shapes stuff
-ConvexShape* g_pConvexShapes[ 2 ] = { 0 };
-SimdTransform g_convexShapesTransform[ 2 ];
+btConvexShape* g_pConvexShapes[ 2 ] = { 0 };
+btTransform g_convexShapesTransform[ 2 ];
-SimdScalar g_animAngle = SIMD_RADS_PER_DEG;
+btScalar g_animAngle = SIMD_RADS_PER_DEG;
bool g_pauseAnim = true;
// 0 - Box ; 1 - Sphere
int g_shapesType[ 2 ] = { 0 };
// Box config
-SimdVector3 g_boxExtents( 1, 1, 1 );
+btVector3 g_boxExtents( 1, 1, 1 );
// Sphere config
-SimdScalar g_sphereRadius = 1;
+btScalar g_sphereRadius = 1;
float randomFloat( float rangeMin, float rangeMax )
{
@@ -90,9 +90,9 @@ int randomShapeType( int minShapeType, int maxShapeType )
return ( ( ( ( maxShapeType - minShapeType ) + 1 ) * rand() ) / ( ( RAND_MAX + 1 ) + minShapeType ) );
}
-SimdVector3 randomPosition( const SimdPoint3& minPoint, const SimdPoint3& maxPoint )
+btVector3 randomPosition( const btPoint3& minPoint, const btPoint3& maxPoint )
{
- return SimdVector3( randomFloat( minPoint.getX(), maxPoint.getX() ),
+ return btVector3( randomFloat( minPoint.getX(), maxPoint.getX() ),
randomFloat( minPoint.getY(), maxPoint.getY() ),
randomFloat( minPoint.getZ(), maxPoint.getZ() ) );
}
@@ -104,39 +104,39 @@ bool createBoxShape( int shapeIndex )
//
//if ( b )
//{
- // g_pConvexShapes[ shapeIndex ] = new BoxShape( SimdVector3( 1, 1, 1 ) );
+ // g_pConvexShapes[ shapeIndex ] = new btBoxShape( btVector3( 1, 1, 1 ) );
// g_pConvexShapes[ shapeIndex ]->SetMargin( 0.05 );
// g_convexShapesTransform[ shapeIndex ].setIdentity();
- // SimdMatrix3x3 basis( 0.99365157, 0.024418538, -0.10981932,
+ // btMatrix3x3 basis( 0.99365157, 0.024418538, -0.10981932,
// -0.025452739, 0.99964380, -0.0080251107,
// 0.10958424, 0.010769366, 0.99391919 );
- // g_convexShapesTransform[ shapeIndex ].setOrigin( SimdVector3( 4.4916530, -19.059078, -0.22695254 ) );
+ // g_convexShapesTransform[ shapeIndex ].setOrigin( btVector3( 4.4916530, -19.059078, -0.22695254 ) );
// g_convexShapesTransform[ shapeIndex ].setBasis( basis );
// b = false;
//}
//else
//{
- // g_pConvexShapes[ shapeIndex ] = new BoxShape( SimdVector3( 25, 10, 25 ) );
+ // g_pConvexShapes[ shapeIndex ] = new btBoxShape( btVector3( 25, 10, 25 ) );
// g_pConvexShapes[ shapeIndex ]->SetMargin( 0.05 );
- // //SimdMatrix3x3 basis( 0.658257, 0.675022, -0.333709,
+ // //btMatrix3x3 basis( 0.658257, 0.675022, -0.333709,
// // -0.333120, 0.658556, 0.675023,
// // 0.675314, -0.333120, 0.658256 );
// g_convexShapesTransform[ shapeIndex ].setIdentity();
- // g_convexShapesTransform[ shapeIndex ].setOrigin( SimdVector3( 0, -30, 0/*0.326090, -0.667531, 0.214331*/ ) );
+ // g_convexShapesTransform[ shapeIndex ].setOrigin( btVector3( 0, -30, 0/*0.326090, -0.667531, 0.214331*/ ) );
// //g_convexShapesTransform[ shapeIndex ].setBasis( basis );
//}
//#endif
- g_pConvexShapes[ shapeIndex ] = new BoxShape( SimdVector3( 1, 1, 1 ) );
+ g_pConvexShapes[ shapeIndex ] = new btBoxShape( btVector3( 1, 1, 1 ) );
g_pConvexShapes[ shapeIndex ]->SetMargin( 1e-1 );
@@ -149,7 +149,7 @@ bool createBoxShape( int shapeIndex )
bool createSphereShape( int shapeIndex )
{
- g_pConvexShapes[ shapeIndex ] = new SphereShape( g_sphereRadius );
+ g_pConvexShapes[ shapeIndex ] = new btSphereShape( g_sphereRadius );
g_pConvexShapes[ shapeIndex ]->SetMargin( 1e-1 );
@@ -160,12 +160,12 @@ bool createSphereShape( int shapeIndex )
//static bool b = true;
//if ( b )
//{
- // g_convexShapesTransform[ shapeIndex ].setOrigin( SimdVector3( 0.001, 0, 0 ) );
+ // g_convexShapesTransform[ shapeIndex ].setOrigin( btVector3( 0.001, 0, 0 ) );
// b = false;
//}
//else
//{
- // g_convexShapesTransform[ shapeIndex ].setOrigin( SimdVector3( 0, 0, 0 ) );
+ // g_convexShapesTransform[ shapeIndex ].setOrigin( btVector3( 0, 0, 0 ) );
//}
//#endif
@@ -191,15 +191,15 @@ bool calcPenDepth()
{
// Ryn Hybrid Pen Depth and EPA if necessary
- SimdVector3 v( 1, 0, 0 );
+ btVector3 v( 1, 0, 0 );
- SimdScalar squaredDistance = SIMD_INFINITY;
- SimdScalar delta = 0.f;
+ btScalar squaredDistance = SIMD_INFINITY;
+ btScalar delta = 0.f;
- const SimdScalar margin = g_pConvexShapes[ 0 ]->GetMargin() + g_pConvexShapes[ 1 ]->GetMargin();
- const SimdScalar marginSqrd = margin * margin;
+ const btScalar margin = g_pConvexShapes[ 0 ]->GetMargin() + g_pConvexShapes[ 1 ]->GetMargin();
+ const btScalar marginSqrd = margin * margin;
- SimdScalar maxRelErrorSqrd = 1e-3 * 1e-3;
+ btScalar maxRelErrorSqrd = 1e-3 * 1e-3;
simplexSolver.reset();
@@ -207,16 +207,16 @@ bool calcPenDepth()
{
assert( ( v.length2() > 0 ) && "Warning: v is the zero vector!" );
- SimdVector3 seperatingAxisInA = -v * g_convexShapesTransform[ 0 ].getBasis();
- SimdVector3 seperatingAxisInB = v * g_convexShapesTransform[ 1 ].getBasis();
+ btVector3 seperatingAxisInA = -v * g_convexShapesTransform[ 0 ].getBasis();
+ btVector3 seperatingAxisInB = v * g_convexShapesTransform[ 1 ].getBasis();
- SimdVector3 pInA = g_pConvexShapes[ 0 ]->LocalGetSupportingVertexWithoutMargin( seperatingAxisInA );
- SimdVector3 qInB = g_pConvexShapes[ 1 ]->LocalGetSupportingVertexWithoutMargin( seperatingAxisInB );
+ btVector3 pInA = g_pConvexShapes[ 0 ]->LocalGetSupportingVertexWithoutMargin( seperatingAxisInA );
+ btVector3 qInB = g_pConvexShapes[ 1 ]->LocalGetSupportingVertexWithoutMargin( seperatingAxisInB );
- SimdPoint3 pWorld = g_convexShapesTransform[ 0 ]( pInA );
- SimdPoint3 qWorld = g_convexShapesTransform[ 1 ]( qInB );
+ btPoint3 pWorld = g_convexShapesTransform[ 0 ]( pInA );
+ btPoint3 qWorld = g_convexShapesTransform[ 1 ]( qInB );
- SimdVector3 w = pWorld - qWorld;
+ btVector3 w = pWorld - qWorld;
delta = v.dot( w );
// potential exit, they don't overlap
@@ -232,7 +232,7 @@ bool calcPenDepth()
simplexSolver.compute_points( g_wWitnesses[ 0 ], g_wWitnesses[ 1 ] );
assert( ( squaredDistance > 0 ) && "squaredDistance is zero!" );
- SimdScalar vLength = sqrt( squaredDistance );
+ btScalar vLength = sqrt( squaredDistance );
g_wWitnesses[ 0 ] -= v * ( g_pConvexShapes[ 0 ]->GetMargin() / vLength );
g_wWitnesses[ 1 ] += v * ( g_pConvexShapes[ 1 ]->GetMargin() / vLength );
@@ -249,7 +249,7 @@ bool calcPenDepth()
simplexSolver.compute_points( g_wWitnesses[ 0 ], g_wWitnesses[ 1 ] );
assert( ( squaredDistance > 0 ) && "squaredDistance is zero!" );
- SimdScalar vLength = sqrt( squaredDistance );
+ btScalar vLength = sqrt( squaredDistance );
g_wWitnesses[ 0 ] -= v * ( g_pConvexShapes[ 0 ]->GetMargin() / vLength );
g_wWitnesses[ 1 ] += v * ( g_pConvexShapes[ 1 ]->GetMargin() / vLength );
@@ -257,7 +257,7 @@ bool calcPenDepth()
return true;
}
- SimdScalar previousSquaredDistance = squaredDistance;
+ btScalar previousSquaredDistance = squaredDistance;
squaredDistance = v.length2();
//are we getting any closer ?
@@ -269,7 +269,7 @@ bool calcPenDepth()
simplexSolver.compute_points( g_wWitnesses[ 0 ], g_wWitnesses[ 1 ] );
assert( ( squaredDistance > 0 ) && "squaredDistance is zero!" );
- SimdScalar vLength = sqrt( squaredDistance );
+ btScalar vLength = sqrt( squaredDistance );
g_wWitnesses[ 0 ] -= v * ( g_pConvexShapes[ 0 ]->GetMargin() / vLength );
g_wWitnesses[ 1 ] += v * ( g_pConvexShapes[ 1 ]->GetMargin() / vLength );
@@ -313,7 +313,7 @@ void drawShape( int shapeIndex )
if ( g_pConvexShapes[ shapeIndex ]->GetShapeType() == BOX_SHAPE_PROXYTYPE )
{
- glutWireCube( ( ( BoxShape* ) g_pConvexShapes[ shapeIndex ] )->GetHalfExtents().x() * 2 );
+ glutWireCube( ( ( btBoxShape* ) g_pConvexShapes[ shapeIndex ] )->GetHalfExtents().x() * 2 );
}
else if ( g_pConvexShapes[ shapeIndex ]->GetShapeType() == SPHERE_SHAPE_PROXYTYPE )
{
@@ -349,10 +349,10 @@ void clientMoveAndDisplay()
{
if ( !g_pauseAnim )
{
- SimdMatrix3x3 rot;
+ btMatrix3x3 rot;
rot.setEulerZYX( g_animAngle * 0.05, g_animAngle * 0.05, g_animAngle * 0.05 );
- SimdTransform t;
+ btTransform t;
t.setIdentity();
t.setBasis( rot );
@@ -419,11 +419,11 @@ void clientKeyboard(unsigned char key, int x, int y)
else if ( key == 'T' || key == 't' )
{
#ifdef DEBUG_ME
- SimdVector3 shapeAPos = g_convexShapesTransform[ 0 ].getOrigin();
- SimdVector3 shapeBPos = g_convexShapesTransform[ 1 ].getOrigin();
+ btVector3 shapeAPos = g_convexShapesTransform[ 0 ].getOrigin();
+ btVector3 shapeBPos = g_convexShapesTransform[ 1 ].getOrigin();
- SimdMatrix3x3 shapeARot = g_convexShapesTransform[ 0 ].getBasis();
- SimdMatrix3x3 shapeBRot = g_convexShapesTransform[ 1 ].getBasis();
+ btMatrix3x3 shapeARot = g_convexShapesTransform[ 0 ].getBasis();
+ btMatrix3x3 shapeBRot = g_convexShapesTransform[ 1 ].getBasis();
FILE* fp = 0;
diff --git a/Demos/ForkLiftDemo/ForkLiftDemo.cpp b/Demos/ForkLiftDemo/ForkLiftDemo.cpp
index d5acdca89..7061dcad7 100644
--- a/Demos/ForkLiftDemo/ForkLiftDemo.cpp
+++ b/Demos/ForkLiftDemo/ForkLiftDemo.cpp
@@ -27,8 +27,8 @@ subject to the following restrictions:
#include "PHY_IVehicle.h"
#include "ParallelIslandDispatcher.h"
-#include "LinearMath/GenQuickprof.h"
-#include "LinearMath/GenIDebugDraw.h"
+#include "LinearMath/btQuickprof.h"
+#include "LinearMath/btIDebugDraw.h"
#include "GLDebugDrawer.h"
@@ -50,7 +50,7 @@ const int maxOverlap = 65535;
DefaultMotionState wheelMotionState[4];
-///PHY_IVehicle is the interface behind the constraint that implements the raycast vehicle (WrapperVehicle which holds a RaycastVehicle)
+///PHY_IVehicle is the interface behind the constraint that implements the raycast vehicle (WrapperVehicle which holds a btRaycastVehicle)
///notice that for higher-quality slow-moving vehicles, another approach might be better
///implementing explicit hinged-wheel constraints with cylinder collision, rather then raycasts
PHY_IVehicle* gVehicleConstraint=0;
@@ -66,9 +66,9 @@ float suspensionStiffness = 10.f;
float suspensionDamping = 1.3f;
float suspensionCompression = 2.4f;
float rollInfluence = 0.1f;
-SimdVector3 wheelDirectionCS0(0,-1,0);
-SimdVector3 wheelAxleCS(1,0,0);
-SimdScalar suspensionRestLength(0.6);
+btVector3 wheelDirectionCS0(0,-1,0);
+btVector3 wheelAxleCS(1,0,0);
+btScalar suspensionRestLength(0.6);
#define CUBE_HALF_EXTENTS 1
@@ -97,20 +97,20 @@ m_cameraHeight(4.f),
m_minCameraDistance(3.f),
m_maxCameraDistance(10.f)
{
- m_cameraPosition = SimdVector3(30,30,30);
+ m_cameraPosition = btVector3(30,30,30);
}
void ForkLiftDemo::setupPhysics()
{
- CollisionDispatcher* dispatcher = new CollisionDispatcher();
+ btCollisionDispatcher* dispatcher = new btCollisionDispatcher();
//ParallelIslandDispatcher* dispatcher2 = new ParallelIslandDispatcher();
- SimdVector3 worldAabbMin(-30000,-30000,-30000);
- SimdVector3 worldAabbMax(30000,30000,30000);
+ btVector3 worldAabbMin(-30000,-30000,-30000);
+ btVector3 worldAabbMax(30000,30000,30000);
- OverlappingPairCache* broadphase = new AxisSweep3(worldAabbMin,worldAabbMax,maxProxies);
- //OverlappingPairCache* broadphase = new SimpleBroadphase(maxProxies,maxOverlap);
+ btOverlappingPairCache* broadphase = new btAxisSweep3(worldAabbMin,worldAabbMax,maxProxies);
+ //OverlappingPairCache* broadphase = new btSimpleBroadphase(maxProxies,maxOverlap);
#ifdef USE_PARALLEL_DISPATCHER
m_physicsEnvironmentPtr = new ParallelPhysicsEnvironment(dispatcher2,broadphase);
@@ -124,7 +124,7 @@ void ForkLiftDemo::setupPhysics()
m_physicsEnvironmentPtr->setGravity(0,-10,0);//0,0);//-10,0);
int i;
- CollisionShape* groundShape = new BoxShape(SimdVector3(50,3,50));
+ btCollisionShape* groundShape = new btBoxShape(btVector3(50,3,50));
#define USE_TRIMESH_GROUND 1
#ifdef USE_TRIMESH_GROUND
@@ -133,7 +133,7 @@ void ForkLiftDemo::setupPhysics()
const float TRIANGLE_SIZE=20.f;
//create a triangle-mesh ground
- int vertStride = sizeof(SimdVector3);
+ int vertStride = sizeof(btVector3);
int indexStride = 3*sizeof(int);
const int NUM_VERTS_X = 50;
@@ -142,7 +142,7 @@ const float TRIANGLE_SIZE=20.f;
const int totalTriangles = 2*(NUM_VERTS_X-1)*(NUM_VERTS_Y-1);
- SimdVector3* gVertices = new SimdVector3[totalVerts];
+ btVector3* gVertices = new btVector3[totalVerts];
int* gIndices = new int[totalTriangles*3];
@@ -170,25 +170,25 @@ const float TRIANGLE_SIZE=20.f;
}
}
- TriangleIndexVertexArray* indexVertexArrays = new TriangleIndexVertexArray(totalTriangles,
+ btTriangleIndexVertexArray* indexVertexArrays = new btTriangleIndexVertexArray(totalTriangles,
gIndices,
indexStride,
totalVerts,(float*) &gVertices[0].x(),vertStride);
- groundShape = new BvhTriangleMeshShape(indexVertexArrays);
+ groundShape = new btBvhTriangleMeshShape(indexVertexArrays);
#endif //
- SimdTransform tr;
+ btTransform tr;
tr.setIdentity();
- tr.setOrigin(SimdVector3(0,-20.f,0));
+ tr.setOrigin(btVector3(0,-20.f,0));
//create ground object
LocalCreatePhysicsObject(false,0,tr,groundShape);
- CollisionShape* chassisShape = new BoxShape(SimdVector3(1.f,0.5f,2.f));
- tr.setOrigin(SimdVector3(0,0.f,0));
+ btCollisionShape* chassisShape = new btBoxShape(btVector3(1.f,0.5f,2.f));
+ tr.setOrigin(btVector3(0,0.f,0));
m_carChassis = LocalCreatePhysicsObject(true,800,tr,chassisShape);
@@ -211,8 +211,8 @@ const float TRIANGLE_SIZE=20.f;
gVehicleConstraint = m_physicsEnvironmentPtr->getVehicleConstraint(constraintId);
- SimdVector3 connectionPointCS0(CUBE_HALF_EXTENTS-(0.3*wheelWidth),0,2*CUBE_HALF_EXTENTS-wheelRadius);
- RaycastVehicle::VehicleTuning tuning;
+ btVector3 connectionPointCS0(CUBE_HALF_EXTENTS-(0.3*wheelWidth),0,2*CUBE_HALF_EXTENTS-wheelRadius);
+ btRaycastVehicle::btVehicleTuning tuning;
bool isFrontWheel=true;
int rightIndex = 0;
int upIndex = 1;
@@ -224,18 +224,18 @@ const float TRIANGLE_SIZE=20.f;
(PHY__Vector3&)connectionPointCS0,
(PHY__Vector3&)wheelDirectionCS0,(PHY__Vector3&)wheelAxleCS,suspensionRestLength,wheelRadius,isFrontWheel);
- connectionPointCS0 = SimdVector3(-CUBE_HALF_EXTENTS+(0.3*wheelWidth),0,2*CUBE_HALF_EXTENTS-wheelRadius);
+ connectionPointCS0 = btVector3(-CUBE_HALF_EXTENTS+(0.3*wheelWidth),0,2*CUBE_HALF_EXTENTS-wheelRadius);
gVehicleConstraint->AddWheel(&wheelMotionState[1],
(PHY__Vector3&)connectionPointCS0,
(PHY__Vector3&)wheelDirectionCS0,(PHY__Vector3&)wheelAxleCS,suspensionRestLength,wheelRadius,isFrontWheel);
- connectionPointCS0 = SimdVector3(-CUBE_HALF_EXTENTS+(0.3*wheelWidth),0,-2*CUBE_HALF_EXTENTS+wheelRadius);
+ connectionPointCS0 = btVector3(-CUBE_HALF_EXTENTS+(0.3*wheelWidth),0,-2*CUBE_HALF_EXTENTS+wheelRadius);
isFrontWheel = false;
gVehicleConstraint->AddWheel(&wheelMotionState[2],
(PHY__Vector3&)connectionPointCS0,
(PHY__Vector3&)wheelDirectionCS0,(PHY__Vector3&)wheelAxleCS,suspensionRestLength,wheelRadius,isFrontWheel);
- connectionPointCS0 = SimdVector3(CUBE_HALF_EXTENTS-(0.3*wheelWidth),0,-2*CUBE_HALF_EXTENTS+wheelRadius);
+ connectionPointCS0 = btVector3(CUBE_HALF_EXTENTS-(0.3*wheelWidth),0,-2*CUBE_HALF_EXTENTS+wheelRadius);
gVehicleConstraint->AddWheel(&wheelMotionState[3],
(PHY__Vector3&)connectionPointCS0,
(PHY__Vector3&)wheelDirectionCS0,(PHY__Vector3&)wheelAxleCS,suspensionRestLength,wheelRadius,isFrontWheel);
@@ -280,8 +280,8 @@ void ForkLiftDemo::renderme()
float m[16];
int i;
- CylinderShapeX wheelShape(SimdVector3(wheelWidth,wheelRadius,wheelRadius));
- SimdVector3 wheelColor(1,0,0);
+ btCylinderShapeX wheelShape(btVector3(wheelWidth,wheelRadius,wheelRadius));
+ btVector3 wheelColor(1,0,0);
for (i=0;i<4;i++)
{
@@ -318,14 +318,14 @@ void ForkLiftDemo::clientMoveAndDisplay()
#ifdef USE_QUICKPROF
- Profiler::beginBlock("render");
+ btProfiler::beginBlock("render");
#endif //USE_QUICKPROF
renderme();
#ifdef USE_QUICKPROF
- Profiler::endBlock("render");
+ btProfiler::endBlock("render");
#endif
glFlush();
glutSwapBuffers();
@@ -419,7 +419,7 @@ void ForkLiftDemo::updateCamera()
//interpolate the camera height
m_cameraPosition[1] = (15.0*m_cameraPosition[1] + m_cameraTargetPosition[1] + m_cameraHeight)/16.0;
- SimdVector3 camToObject = m_cameraTargetPosition - m_cameraPosition;
+ btVector3 camToObject = m_cameraTargetPosition - m_cameraPosition;
//keep distance between min and max distance
float cameraDistance = camToObject.length();
diff --git a/Demos/GjkConvexCastDemo/LinearConvexCastDemo.cpp b/Demos/GjkConvexCastDemo/LinearConvexCastDemo.cpp
index ebc577cb6..67b9e41cc 100644
--- a/Demos/GjkConvexCastDemo/LinearConvexCastDemo.cpp
+++ b/Demos/GjkConvexCastDemo/LinearConvexCastDemo.cpp
@@ -21,8 +21,8 @@
///Low level demo, doesn't include btBulletCollisionCommon.h
-#include "LinearMath/SimdQuaternion.h"
-#include "LinearMath/SimdTransform.h"
+#include "LinearMath/btQuaternion.h"
+#include "LinearMath/btTransform.h"
#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
#include "BulletCollision/CollisionShapes/btBoxShape.h"
#include "BulletCollision/CollisionShapes/btMinkowskiSumShape.h"
@@ -49,9 +49,9 @@ const int maxNumObjects = 4;
const int numObjects = 2;
-PolyhedralConvexShape* shapePtr[maxNumObjects];
+btPolyhedralConvexShape* shapePtr[maxNumObjects];
-SimdTransform tr[numObjects];
+btTransform tr[numObjects];
int screenWidth = 640;
int screenHeight = 480;
void DrawRasterizerLine(float const* , float const*, int)
@@ -73,15 +73,15 @@ int main(int argc,char** argv)
void LinearConvexCastDemo::initPhysics()
{
setCameraDistance(30.f);
- tr[0].setOrigin(SimdVector3(0,0,0));
- tr[1].setOrigin(SimdVector3(0,10,0));
+ tr[0].setOrigin(btVector3(0,0,0));
+ tr[1].setOrigin(btVector3(0,10,0));
- SimdMatrix3x3 basisA;
+ btMatrix3x3 basisA;
basisA.setValue(0.99999958f,0.00022980258f,0.00090992288f,
-0.00029313788f,0.99753088f,0.070228584f,
-0.00089153741f,-0.070228823f,0.99753052f);
- SimdMatrix3x3 basisB;
+ btMatrix3x3 basisB;
basisB.setValue(1.0000000f,4.4865553e-018f,-4.4410586e-017f,
4.4865495e-018f,0.97979438f,0.20000751f,
4.4410586e-017f,-0.20000751f,0.97979438f);
@@ -91,25 +91,25 @@ void LinearConvexCastDemo::initPhysics()
- SimdVector3 boxHalfExtentsA(0.2,4,4);
- SimdVector3 boxHalfExtentsB(6,6,6);
+ btVector3 boxHalfExtentsA(0.2,4,4);
+ btVector3 boxHalfExtentsB(6,6,6);
- BoxShape* boxA = new BoxShape(boxHalfExtentsA);
-/* BU_Simplex1to4 boxB;
- boxB.AddVertex(SimdPoint3(-5,0,-5));
- boxB.AddVertex(SimdPoint3(5,0,-5));
- boxB.AddVertex(SimdPoint3(0,0,5));
- boxB.AddVertex(SimdPoint3(0,5,0));
+ btBoxShape* boxA = new btBoxShape(boxHalfExtentsA);
+/* btBU_Simplex1to4 boxB;
+ boxB.AddVertex(btPoint3(-5,0,-5));
+ boxB.AddVertex(btPoint3(5,0,-5));
+ boxB.AddVertex(btPoint3(0,0,5));
+ boxB.AddVertex(btPoint3(0,5,0));
*/
- BoxShape* boxB = new BoxShape(boxHalfExtentsB);
+ btBoxShape* boxB = new btBoxShape(boxHalfExtentsB);
shapePtr[0] = boxA;
shapePtr[1] = boxB;
shapePtr[0]->SetMargin(0.01f);
shapePtr[1]->SetMargin(0.01f);
- SimdTransform tr;
+ btTransform tr;
tr.setIdentity();
}
@@ -124,9 +124,9 @@ void LinearConvexCastDemo::clientMoveAndDisplay()
#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
#include "BulletCollision/NarrowPhaseCollision/btConvexPenetrationDepthSolver.h"
-static VoronoiSimplexSolver sVoronoiSimplexSolver;
+static btVoronoiSimplexSolver sVoronoiSimplexSolver;
-SimplexSolverInterface& gGjkSimplexSolver = sVoronoiSimplexSolver;
+btSimplexSolverInterface& gGjkSimplexSolver = sVoronoiSimplexSolver;
bool drawLine= false;
@@ -145,13 +145,13 @@ void LinearConvexCastDemo::displayCallback(void)
for (i=0;i<numObjects;i++)
{
tr[i].getOpenGLMatrix( m );
- GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],SimdVector3(1,1,1),getDebugMode());
+ GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],btVector3(1,1,1),getDebugMode());
}
int shapeIndex = 1;
- SimdQuaternion orn;
+ btQuaternion orn;
orn.setEuler(yaw,pitch,roll);
tr[shapeIndex].setRotation(orn);
@@ -163,14 +163,14 @@ void LinearConvexCastDemo::displayCallback(void)
yaw += 0.01f;
}
- SimdVector3 fromA(-25,11,0);
- SimdVector3 toA(15,11,0);
+ btVector3 fromA(-25,11,0);
+ btVector3 toA(15,11,0);
- SimdQuaternion ornFromA(0.f,0.f,0.f,1.f);
- SimdQuaternion ornToA(0.f,0.f,0.f,1.f);
+ btQuaternion ornFromA(0.f,0.f,0.f,1.f);
+ btQuaternion ornToA(0.f,0.f,0.f,1.f);
- SimdTransform rayFromWorld(ornFromA,fromA);
- SimdTransform rayToWorld(ornToA,toA);
+ btTransform rayFromWorld(ornFromA,fromA);
+ btTransform rayToWorld(ornToA,toA);
tr[0] = rayFromWorld;
@@ -191,16 +191,16 @@ void LinearConvexCastDemo::displayCallback(void)
for (i=1;i<numObjects;i++)
{
- ContinuousConvexCollision convexCaster0(shapePtr[0],shapePtr[i],&gGjkSimplexSolver,0);
- GjkConvexCast convexCaster1(shapePtr[0],shapePtr[i],&gGjkSimplexSolver);
+ btContinuousConvexCollision convexCaster0(shapePtr[0],shapePtr[i],&gGjkSimplexSolver,0);
+ btGjkConvexCast convexCaster1(shapePtr[0],shapePtr[i],&gGjkSimplexSolver);
//BU_CollisionPair (algebraic version) is currently broken, will look into this
//BU_CollisionPair convexCaster2(shapePtr[0],shapePtr[i]);
- SubsimplexConvexCast convexCaster3(shapePtr[0],shapePtr[i],&gGjkSimplexSolver);
+ btSubsimplexConvexCast convexCaster3(shapePtr[0],shapePtr[i],&gGjkSimplexSolver);
gGjkSimplexSolver.reset();
- ConvexCast::CastResult rayResult;
+ btConvexCast::CastResult rayResult;
@@ -208,7 +208,7 @@ void LinearConvexCastDemo::displayCallback(void)
{
glDisable(GL_DEPTH_TEST);
- SimdVector3 hitPoint;
+ btVector3 hitPoint;
hitPoint.setInterpolate3(rayFromWorld.getOrigin(),rayToWorld.getOrigin(),rayResult.m_fraction);
//draw the raycast result
@@ -219,12 +219,12 @@ void LinearConvexCastDemo::displayCallback(void)
glEnd();
glEnable(GL_DEPTH_TEST);
- SimdTransform toTransWorld;
+ btTransform toTransWorld;
toTransWorld = tr[0];
toTransWorld.setOrigin(hitPoint);
toTransWorld.getOpenGLMatrix( m );
- GL_ShapeDrawer::DrawOpenGL(m,shapePtr[0],SimdVector3(0,1,1),getDebugMode());
+ GL_ShapeDrawer::DrawOpenGL(m,shapePtr[0],btVector3(0,1,1),getDebugMode());
}
diff --git a/Demos/OpenGL/BMF_Api.cpp b/Demos/OpenGL/BMF_Api.cpp
index d67191d26..663e84f6e 100644
--- a/Demos/OpenGL/BMF_Api.cpp
+++ b/Demos/OpenGL/BMF_Api.cpp
@@ -2,7 +2,7 @@
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU bteral Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
@@ -12,9 +12,9 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU bteral Public License for more details.
*
- * You should have received a copy of the GNU General Public License
+ * You should have received a copy of the GNU bteral Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
diff --git a/Demos/OpenGL/BMF_Api.h b/Demos/OpenGL/BMF_Api.h
index af23c06ed..0df762999 100644
--- a/Demos/OpenGL/BMF_Api.h
+++ b/Demos/OpenGL/BMF_Api.h
@@ -2,7 +2,7 @@
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU bteral Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
@@ -12,9 +12,9 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU bteral Public License for more details.
*
- * You should have received a copy of the GNU General Public License
+ * You should have received a copy of the GNU bteral Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
diff --git a/Demos/OpenGL/BMF_BitmapFont.cpp b/Demos/OpenGL/BMF_BitmapFont.cpp
index 0c1035a01..f50d1894b 100644
--- a/Demos/OpenGL/BMF_BitmapFont.cpp
+++ b/Demos/OpenGL/BMF_BitmapFont.cpp
@@ -2,7 +2,7 @@
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU bteral Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
@@ -12,9 +12,9 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU bteral Public License for more details.
*
- * You should have received a copy of the GNU General Public License
+ * You should have received a copy of the GNU bteral Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
diff --git a/Demos/OpenGL/BMF_BitmapFont.h b/Demos/OpenGL/BMF_BitmapFont.h
index 4b5bedd14..237fab40b 100644
--- a/Demos/OpenGL/BMF_BitmapFont.h
+++ b/Demos/OpenGL/BMF_BitmapFont.h
@@ -2,7 +2,7 @@
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU bteral Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
@@ -12,9 +12,9 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU bteral Public License for more details.
*
- * You should have received a copy of the GNU General Public License
+ * You should have received a copy of the GNU bteral Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
diff --git a/Demos/OpenGL/BMF_FontData.h b/Demos/OpenGL/BMF_FontData.h
index ff827cce7..c3bdd8081 100644
--- a/Demos/OpenGL/BMF_FontData.h
+++ b/Demos/OpenGL/BMF_FontData.h
@@ -2,7 +2,7 @@
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU bteral Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
@@ -12,9 +12,9 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU bteral Public License for more details.
*
- * You should have received a copy of the GNU General Public License
+ * You should have received a copy of the GNU bteral Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
diff --git a/Demos/OpenGL/BMF_Fonts.h b/Demos/OpenGL/BMF_Fonts.h
index 92c2f3d07..96bc96100 100644
--- a/Demos/OpenGL/BMF_Fonts.h
+++ b/Demos/OpenGL/BMF_Fonts.h
@@ -2,7 +2,7 @@
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU bteral Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
@@ -12,9 +12,9 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU bteral Public License for more details.
*
- * You should have received a copy of the GNU General Public License
+ * You should have received a copy of the GNU bteral Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
diff --git a/Demos/OpenGL/BMF_Settings.h b/Demos/OpenGL/BMF_Settings.h
index 3f38c36ef..90a073401 100644
--- a/Demos/OpenGL/BMF_Settings.h
+++ b/Demos/OpenGL/BMF_Settings.h
@@ -2,7 +2,7 @@
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU bteral Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
@@ -12,9 +12,9 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU bteral Public License for more details.
*
- * You should have received a copy of the GNU General Public License
+ * You should have received a copy of the GNU bteral Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
diff --git a/Demos/OpenGL/BMF_font_helv10.cpp b/Demos/OpenGL/BMF_font_helv10.cpp
index 05252c89c..025ebf6b4 100644
--- a/Demos/OpenGL/BMF_font_helv10.cpp
+++ b/Demos/OpenGL/BMF_font_helv10.cpp
@@ -2,7 +2,7 @@
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU bteral Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
@@ -12,9 +12,9 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU bteral Public License for more details.
*
- * You should have received a copy of the GNU General Public License
+ * You should have received a copy of the GNU bteral Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
diff --git a/Demos/OpenGL/DebugCastResult.h b/Demos/OpenGL/DebugCastResult.h
index 05a34215d..53f40f176 100644
--- a/Demos/OpenGL/DebugCastResult.h
+++ b/Demos/OpenGL/DebugCastResult.h
@@ -17,7 +17,7 @@ subject to the following restrictions:
#define DEBUG_CAST_RESULT_H
#include "BulletCollision/NarrowPhaseCollision/btConvexCast.h"
-#include "LinearMath/SimdTransform.h"
+#include "LinearMath/btTransform.h"
#include "GL_ShapeDrawer.h"
#ifdef WIN32
#include <windows.h>
@@ -29,16 +29,16 @@ subject to the following restrictions:
#else
#include <GL/gl.h>
#endif
-struct DebugCastResult : public ConvexCast::CastResult
+struct btDebugCastResult : public btConvexCast::CastResult
{
- SimdTransform m_fromTrans;
- const PolyhedralConvexShape* m_shape;
- SimdVector3 m_linVel;
- SimdVector3 m_angVel;
+ btTransform m_fromTrans;
+ const btPolyhedralConvexShape* m_shape;
+ btVector3 m_linVel;
+ btVector3 m_angVel;
- DebugCastResult(const SimdTransform& fromTrans,const PolyhedralConvexShape* shape,
- const SimdVector3& linVel,const SimdVector3& angVel)
+ btDebugCastResult(const btTransform& fromTrans,const btPolyhedralConvexShape* shape,
+ const btVector3& linVel,const btVector3& angVel)
:m_fromTrans(fromTrans),
m_shape(shape),
m_linVel(linVel),
@@ -46,7 +46,7 @@ struct DebugCastResult : public ConvexCast::CastResult
{
}
- virtual void DrawCoordSystem(const SimdTransform& tr)
+ virtual void DrawCoordSystem(const btTransform& tr)
{
float m[16];
tr.getOpenGLMatrix(m);
@@ -66,14 +66,14 @@ struct DebugCastResult : public ConvexCast::CastResult
glPopMatrix();
}
- virtual void DebugDraw(SimdScalar fraction)
+ virtual void DebugDraw(btScalar fraction)
{
float m[16];
- SimdTransform hitTrans;
- SimdTransformUtil::IntegrateTransform(m_fromTrans,m_linVel,m_angVel,fraction,hitTrans);
+ btTransform hitTrans;
+ btTransformUtil::IntegrateTransform(m_fromTrans,m_linVel,m_angVel,fraction,hitTrans);
hitTrans.getOpenGLMatrix(m);
- GL_ShapeDrawer::DrawOpenGL(m,m_shape,SimdVector3(1,0,0),IDebugDraw::DBG_NoDebug);
+ GL_ShapeDrawer::DrawOpenGL(m,m_shape,btVector3(1,0,0),btIDebugDraw::DBG_NoDebug);
}
};
diff --git a/Demos/OpenGL/DemoApplication.cpp b/Demos/OpenGL/DemoApplication.cpp
index 220d700a0..dfb0e2a99 100644
--- a/Demos/OpenGL/DemoApplication.cpp
+++ b/Demos/OpenGL/DemoApplication.cpp
@@ -14,7 +14,8 @@ subject to the following restrictions:
*/
#include "DemoApplication.h"
-#include "LinearMath/GenIDebugDraw.h"
+#include "LinearMath/btIDebugDraw.h"
+#include "BulletDynamics/Dynamics/btDynamicsWorld.h"
#include "CcdPhysicsEnvironment.h"
#include "CcdPhysicsController.h"
@@ -23,21 +24,24 @@ subject to the following restrictions:
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
#include "BulletCollision/CollisionShapes/btBoxShape.h"
#include "GL_ShapeDrawer.h"
-#include "LinearMath/GenQuickprof.h"
+#include "LinearMath/btQuickprof.h"
#include "BMF_Api.h"
+#include "BulletDynamics/Dynamics/btMassProps.h"
int numObjects = 0;
const int maxNumObjects = 16384;
DefaultMotionState ms[maxNumObjects];
CcdPhysicsController* physObjects[maxNumObjects];
-SimdTransform startTransforms[maxNumObjects];
-CollisionShape* gShapePtr[maxNumObjects];//1 rigidbody has 1 shape (no re-use of shapes)
+btTransform startTransforms[maxNumObjects];
+btCollisionShape* gShapePtr[maxNumObjects];//1 rigidbody has 1 shape (no re-use of shapes)
DemoApplication::DemoApplication()
- //see IDebugDraw.h for modes
+ //see btIDebugDraw.h for modes
:
m_physicsEnvironmentPtr(0),
+m_dynamicsWorld(0),
+m_pickConstraint(0),
m_cameraDistance(15.0),
m_debugMode(0),
m_ele(0.f),
@@ -133,21 +137,21 @@ void DemoApplication::updateCamera() {
float razi = m_azi * 0.01745329251994329547;// rads per deg
- SimdQuaternion rot(m_cameraUp,razi);
+ btQuaternion rot(m_cameraUp,razi);
- SimdVector3 eyePos(0,0,0);
+ btVector3 eyePos(0,0,0);
eyePos[m_forwardAxis] = -m_cameraDistance;
- SimdVector3 forward(eyePos[0],eyePos[1],eyePos[2]);
+ btVector3 forward(eyePos[0],eyePos[1],eyePos[2]);
if (forward.length2() < SIMD_EPSILON)
{
forward.setValue(1.f,0.f,0.f);
}
- SimdVector3 right = m_cameraUp.cross(forward);
- SimdQuaternion roll(right,-rele);
+ btVector3 right = m_cameraUp.cross(forward);
+ btQuaternion roll(right,-rele);
- eyePos = SimdMatrix3x3(rot) * SimdMatrix3x3(roll) * eyePos;
+ eyePos = btMatrix3x3(rot) * btMatrix3x3(roll) * eyePos;
m_cameraPosition[0] = eyePos.getX();
m_cameraPosition[1] = eyePos.getY();
@@ -226,70 +230,70 @@ void DemoApplication::keyboardCallback(unsigned char key, int x, int y)
case 'x' : zoomOut(); break;
case 'i' : toggleIdle(); break;
case 'h':
- if (m_debugMode & IDebugDraw::DBG_NoHelpText)
- m_debugMode = m_debugMode & (~IDebugDraw::DBG_NoHelpText);
+ if (m_debugMode & btIDebugDraw::DBG_NoHelpText)
+ m_debugMode = m_debugMode & (~btIDebugDraw::DBG_NoHelpText);
else
- m_debugMode |= IDebugDraw::DBG_NoHelpText;
+ m_debugMode |= btIDebugDraw::DBG_NoHelpText;
break;
case 'w':
- if (m_debugMode & IDebugDraw::DBG_DrawWireframe)
- m_debugMode = m_debugMode & (~IDebugDraw::DBG_DrawWireframe);
+ if (m_debugMode & btIDebugDraw::DBG_DrawWireframe)
+ m_debugMode = m_debugMode & (~btIDebugDraw::DBG_DrawWireframe);
else
- m_debugMode |= IDebugDraw::DBG_DrawWireframe;
+ m_debugMode |= btIDebugDraw::DBG_DrawWireframe;
break;
case 'p':
- if (m_debugMode & IDebugDraw::DBG_ProfileTimings)
- m_debugMode = m_debugMode & (~IDebugDraw::DBG_ProfileTimings);
+ if (m_debugMode & btIDebugDraw::DBG_ProfileTimings)
+ m_debugMode = m_debugMode & (~btIDebugDraw::DBG_ProfileTimings);
else
- m_debugMode |= IDebugDraw::DBG_ProfileTimings;
+ m_debugMode |= btIDebugDraw::DBG_ProfileTimings;
break;
case 'm':
- if (m_debugMode & IDebugDraw::DBG_EnableSatComparison)
- m_debugMode = m_debugMode & (~IDebugDraw::DBG_EnableSatComparison);
+ if (m_debugMode & btIDebugDraw::DBG_EnableSatComparison)
+ m_debugMode = m_debugMode & (~btIDebugDraw::DBG_EnableSatComparison);
else
- m_debugMode |= IDebugDraw::DBG_EnableSatComparison;
+ m_debugMode |= btIDebugDraw::DBG_EnableSatComparison;
break;
case 'n':
- if (m_debugMode & IDebugDraw::DBG_DisableBulletLCP)
- m_debugMode = m_debugMode & (~IDebugDraw::DBG_DisableBulletLCP);
+ if (m_debugMode & btIDebugDraw::DBG_DisableBulletLCP)
+ m_debugMode = m_debugMode & (~btIDebugDraw::DBG_DisableBulletLCP);
else
- m_debugMode |= IDebugDraw::DBG_DisableBulletLCP;
+ m_debugMode |= btIDebugDraw::DBG_DisableBulletLCP;
break;
case 't' :
- if (m_debugMode & IDebugDraw::DBG_DrawText)
- m_debugMode = m_debugMode & (~IDebugDraw::DBG_DrawText);
+ if (m_debugMode & btIDebugDraw::DBG_DrawText)
+ m_debugMode = m_debugMode & (~btIDebugDraw::DBG_DrawText);
else
- m_debugMode |= IDebugDraw::DBG_DrawText;
+ m_debugMode |= btIDebugDraw::DBG_DrawText;
break;
case 'y':
- if (m_debugMode & IDebugDraw::DBG_DrawFeaturesText)
- m_debugMode = m_debugMode & (~IDebugDraw::DBG_DrawFeaturesText);
+ if (m_debugMode & btIDebugDraw::DBG_DrawFeaturesText)
+ m_debugMode = m_debugMode & (~btIDebugDraw::DBG_DrawFeaturesText);
else
- m_debugMode |= IDebugDraw::DBG_DrawFeaturesText;
+ m_debugMode |= btIDebugDraw::DBG_DrawFeaturesText;
break;
case 'a':
- if (m_debugMode & IDebugDraw::DBG_DrawAabb)
- m_debugMode = m_debugMode & (~IDebugDraw::DBG_DrawAabb);
+ if (m_debugMode & btIDebugDraw::DBG_DrawAabb)
+ m_debugMode = m_debugMode & (~btIDebugDraw::DBG_DrawAabb);
else
- m_debugMode |= IDebugDraw::DBG_DrawAabb;
+ m_debugMode |= btIDebugDraw::DBG_DrawAabb;
break;
case 'c' :
- if (m_debugMode & IDebugDraw::DBG_DrawContactPoints)
- m_debugMode = m_debugMode & (~IDebugDraw::DBG_DrawContactPoints);
+ if (m_debugMode & btIDebugDraw::DBG_DrawContactPoints)
+ m_debugMode = m_debugMode & (~btIDebugDraw::DBG_DrawContactPoints);
else
- m_debugMode |= IDebugDraw::DBG_DrawContactPoints;
+ m_debugMode |= btIDebugDraw::DBG_DrawContactPoints;
break;
case 'd' :
- if (m_debugMode & IDebugDraw::DBG_NoDeactivation)
- m_debugMode = m_debugMode & (~IDebugDraw::DBG_NoDeactivation);
+ if (m_debugMode & btIDebugDraw::DBG_NoDeactivation)
+ m_debugMode = m_debugMode & (~btIDebugDraw::DBG_NoDeactivation);
else
- m_debugMode |= IDebugDraw::DBG_NoDeactivation;
+ m_debugMode |= btIDebugDraw::DBG_NoDeactivation;
break;
@@ -306,10 +310,10 @@ void DemoApplication::keyboardCallback(unsigned char key, int x, int y)
break;
case '1':
{
- if (m_debugMode & IDebugDraw::DBG_EnableCCD)
- m_debugMode = m_debugMode & (~IDebugDraw::DBG_EnableCCD);
+ if (m_debugMode & btIDebugDraw::DBG_EnableCCD)
+ m_debugMode = m_debugMode & (~btIDebugDraw::DBG_EnableCCD);
else
- m_debugMode |= IDebugDraw::DBG_EnableCCD;
+ m_debugMode |= btIDebugDraw::DBG_EnableCCD;
break;
}
@@ -380,21 +384,45 @@ void DemoApplication::displayCallback()
-void DemoApplication::shootBox(const SimdVector3& destination)
+void DemoApplication::shootBox(const btVector3& destination)
{
+
+ if (m_dynamicsWorld)
+ {
+ bool isDynamic = true;
+ float mass = 1.f;
+ btTransform startTransform;
+ startTransform.setIdentity();
+ btVector3 camPos = getCameraPosition();
+ startTransform.setOrigin(camPos);
+ btCollisionShape* boxShape = new btBoxShape(btVector3(1.f,1.f,1.f));
+
+ btRigidBody* body = this->LocalCreateRigidBody(isDynamic, mass, startTransform,boxShape);
+ m_dynamicsWorld->AddCollisionObject(body);
+
+ btVector3 linVel(destination[0]-camPos[0],destination[1]-camPos[1],destination[2]-camPos[2]);
+ linVel.normalize();
+ linVel*=m_ShootBoxInitialSpeed;
+
+ body->m_worldTransform.setOrigin(camPos);
+ body->m_worldTransform.setRotation(btQuaternion(0,0,0,1));
+ body->setLinearVelocity(linVel);
+ body->setAngularVelocity(btVector3(0,0,0));
+ }
+
if (m_physicsEnvironmentPtr)
{
bool isDynamic = true;
float mass = 1.f;
- SimdTransform startTransform;
+ btTransform startTransform;
startTransform.setIdentity();
- SimdVector3 camPos = getCameraPosition();
+ btVector3 camPos = getCameraPosition();
startTransform.setOrigin(camPos);
- CollisionShape* boxShape = new BoxShape(SimdVector3(1.f,1.f,1.f));
+ btCollisionShape* boxShape = new btBoxShape(btVector3(1.f,1.f,1.f));
CcdPhysicsController* newBox = LocalCreatePhysicsObject(isDynamic, mass, startTransform,boxShape);
- SimdVector3 linVel(destination[0]-camPos[0],destination[1]-camPos[1],destination[2]-camPos[2]);
+ btVector3 linVel(destination[0]-camPos[0],destination[1]-camPos[1],destination[2]-camPos[2]);
linVel.normalize();
linVel*=m_ShootBoxInitialSpeed;
@@ -407,12 +435,12 @@ void DemoApplication::shootBox(const SimdVector3& destination)
int gPickingConstraintId = 0;
-SimdVector3 gOldPickingPos;
+btVector3 gOldPickingPos;
float gOldPickingDist = 0.f;
-RigidBody* pickedBody = 0;//for deactivation state
+btRigidBody* pickedBody = 0;//for deactivation state
-SimdVector3 DemoApplication::GetRayTo(int x,int y)
+btVector3 DemoApplication::GetRayTo(int x,int y)
{
float top = 1.f;
@@ -421,16 +449,16 @@ SimdVector3 DemoApplication::GetRayTo(int x,int y)
float tanFov = (top-bottom)*0.5f / nearPlane;
float fov = 2.0 * atanf (tanFov);
- SimdVector3 rayFrom = getCameraPosition();
- SimdVector3 rayForward = (getCameraTargetPosition()-getCameraPosition());
+ btVector3 rayFrom = getCameraPosition();
+ btVector3 rayForward = (getCameraTargetPosition()-getCameraPosition());
rayForward.normalize();
float farPlane = 600.f;
rayForward*= farPlane;
- SimdVector3 rightOffset;
- SimdVector3 vertical = m_cameraUp;
+ btVector3 rightOffset;
+ btVector3 vertical = m_cameraUp;
- SimdVector3 hor;
+ btVector3 hor;
hor = rayForward.cross(vertical);
hor.normalize();
vertical = hor.cross(rayForward);
@@ -439,10 +467,10 @@ SimdVector3 DemoApplication::GetRayTo(int x,int y)
float tanfov = tanf(0.5f*fov);
hor *= 2.f * farPlane * tanfov;
vertical *= 2.f * farPlane * tanfov;
- SimdVector3 rayToCenter = rayFrom + rayForward;
- SimdVector3 dHor = hor * 1.f/float(m_glutScreenWidth);
- SimdVector3 dVert = vertical * 1.f/float(m_glutScreenHeight);
- SimdVector3 rayTo = rayToCenter - 0.5f * hor + 0.5f * vertical;
+ btVector3 rayToCenter = rayFrom + rayForward;
+ btVector3 dHor = hor * 1.f/float(m_glutScreenWidth);
+ btVector3 dVert = vertical * 1.f/float(m_glutScreenHeight);
+ btVector3 rayTo = rayToCenter - 0.5f * hor + 0.5f * vertical;
rayTo += x * dHor;
rayTo -= y * dVert;
return rayTo;
@@ -454,7 +482,7 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
//printf("button %i, state %i, x=%i,y=%i\n",button,state,x,y);
//button 0, state 0 means left mouse down
- SimdVector3 rayTo = GetRayTo(x,y);
+ btVector3 rayTo = GetRayTo(x,y);
switch (button)
{
@@ -468,8 +496,40 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
};
case 1:
{
+
+
if (state==0)
{
+
+ //apply an impulse
+ if (m_dynamicsWorld)
+ {
+ float hit[3];
+ float normal[3];
+
+ btCollisionWorld::ClosestRayResultCallback rayCallback(m_cameraPosition,rayTo);
+ m_dynamicsWorld->RayTest(m_cameraPosition,rayTo,rayCallback);
+ if (rayCallback.HasHit())
+ {
+
+ if (rayCallback.m_collisionObject->m_internalOwner)
+ {
+ btRigidBody* body = (btRigidBody*)rayCallback.m_collisionObject->m_internalOwner;
+ if (body)
+ {
+ body->SetActivationState(ACTIVE_TAG);
+ btVector3 impulse = rayTo;
+ impulse.normalize();
+ float impulseStrength = 10.f;
+ impulse *= impulseStrength;
+ btVector3 relPos = rayCallback.m_hitPointWorld - body->getCenterOfMassPosition();
+ body->applyImpulse(impulse,relPos);
+ }
+ }
+
+ }
+ }
+
//apply an impulse
if (m_physicsEnvironmentPtr)
{
@@ -479,15 +539,15 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
if (hitObj)
{
CcdPhysicsController* physCtrl = static_cast<CcdPhysicsController*>(hitObj);
- RigidBody* body = physCtrl->GetRigidBody();
+ btRigidBody* body = physCtrl->GetRigidBody();
if (body)
{
body->SetActivationState(ACTIVE_TAG);
- SimdVector3 impulse = rayTo;
+ btVector3 impulse = rayTo;
impulse.normalize();
float impulseStrength = 10.f;
impulse *= impulseStrength;
- SimdVector3 relPos(
+ btVector3 relPos(
hit[0] - body->getCenterOfMassPosition().getX(),
hit[1] - body->getCenterOfMassPosition().getY(),
hit[2] - body->getCenterOfMassPosition().getZ());
@@ -509,6 +569,48 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
{
if (state==0)
{
+
+ //add a point to point constraint for picking
+ if (m_dynamicsWorld)
+ {
+ float hit[3];
+ float normal[3];
+ btCollisionWorld::ClosestRayResultCallback rayCallback(m_cameraPosition,rayTo);
+ m_dynamicsWorld->RayTest(m_cameraPosition,rayTo,rayCallback);
+ if (rayCallback.HasHit())
+ {
+
+ if (rayCallback.m_collisionObject->m_internalOwner)
+ {
+ btRigidBody* body = (btRigidBody*)rayCallback.m_collisionObject->m_internalOwner;
+ if (body && !body->IsStatic())
+ {
+ pickedBody = body;
+ pickedBody->SetActivationState(DISABLE_DEACTIVATION);
+
+
+ btVector3 pickPos = rayCallback.m_hitPointWorld;
+
+ btVector3 localPivot = body->getCenterOfMassTransform().inverse() * pickPos;
+
+ btPoint2PointConstraint* p2p = new btPoint2PointConstraint(*body,localPivot);
+ m_dynamicsWorld->addConstraint(p2p);
+ m_pickConstraint = p2p;
+
+ //save mouse position for dragging
+ gOldPickingPos = rayTo;
+
+ btVector3 eyePos(m_cameraPosition[0],m_cameraPosition[1],m_cameraPosition[2]);
+
+ gOldPickingDist = (pickPos-eyePos).length();
+
+ //very weak constraint for picking
+ p2p->m_setting.m_tau = 0.1f;
+ }
+ }
+ }
+ }
+
//add a point to point constraint for picking
if (m_physicsEnvironmentPtr)
{
@@ -519,16 +621,16 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
{
CcdPhysicsController* physCtrl = static_cast<CcdPhysicsController*>(hitObj);
- RigidBody* body = physCtrl->GetRigidBody();
+ btRigidBody* body = physCtrl->GetRigidBody();
if (body && !body->IsStatic())
{
pickedBody = body;
pickedBody->SetActivationState(DISABLE_DEACTIVATION);
- SimdVector3 pickPos(hit[0],hit[1],hit[2]);
+ btVector3 pickPos(hit[0],hit[1],hit[2]);
- SimdVector3 localPivot = body->getCenterOfMassTransform().inverse() * pickPos;
+ btVector3 localPivot = body->getCenterOfMassTransform().inverse() * pickPos;
gPickingConstraintId = m_physicsEnvironmentPtr->createConstraint(physCtrl,0,PHY_POINT2POINT_CONSTRAINT,
localPivot.getX(),
@@ -541,11 +643,11 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
gOldPickingPos = rayTo;
- SimdVector3 eyePos(m_cameraPosition[0],m_cameraPosition[1],m_cameraPosition[2]);
+ btVector3 eyePos(m_cameraPosition[0],m_cameraPosition[1],m_cameraPosition[2]);
gOldPickingDist = (pickPos-eyePos).length();
- Point2PointConstraint* p2p = static_cast<Point2PointConstraint*>(m_physicsEnvironmentPtr->getConstraintById(gPickingConstraintId));
+ btPoint2PointConstraint* p2p = static_cast<btPoint2PointConstraint*>(m_physicsEnvironmentPtr->getConstraintById(gPickingConstraintId));
if (p2p)
{
//very weak constraint for picking
@@ -556,6 +658,18 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
}
} else
{
+
+ if (m_pickConstraint && m_dynamicsWorld)
+ {
+ m_dynamicsWorld->removeConstraint(m_pickConstraint);
+ delete m_pickConstraint;
+ //printf("removed constraint %i",gPickingConstraintId);
+ m_pickConstraint = 0;
+ pickedBody->ForceActivationState(ACTIVE_TAG);
+ pickedBody->m_deactivationTime = 0.f;
+ pickedBody = 0;
+ }
+
if (gPickingConstraintId && m_physicsEnvironmentPtr)
{
m_physicsEnvironmentPtr->removeConstraint(gPickingConstraintId);
@@ -582,23 +696,43 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
void DemoApplication::mouseMotionFunc(int x,int y)
{
+ if (m_pickConstraint)
+ {
+ //move the constraint pivot
+ btPoint2PointConstraint* p2p = static_cast<btPoint2PointConstraint*>(m_pickConstraint);
+ if (p2p)
+ {
+ //keep it at the same picking distance
+
+ btVector3 newRayTo = GetRayTo(x,y);
+ btVector3 eyePos(m_cameraPosition[0],m_cameraPosition[1],m_cameraPosition[2]);
+ btVector3 dir = newRayTo-eyePos;
+ dir.normalize();
+ dir *= gOldPickingDist;
+
+ btVector3 newPos = eyePos + dir;
+ p2p->SetPivotB(newPos);
+ }
+
+ }
+
if (gPickingConstraintId && m_physicsEnvironmentPtr)
{
//move the constraint pivot
- Point2PointConstraint* p2p = static_cast<Point2PointConstraint*>(m_physicsEnvironmentPtr->getConstraintById(gPickingConstraintId));
+ btPoint2PointConstraint* p2p = static_cast<btPoint2PointConstraint*>(m_physicsEnvironmentPtr->getConstraintById(gPickingConstraintId));
if (p2p)
{
//keep it at the same picking distance
- SimdVector3 newRayTo = GetRayTo(x,y);
- SimdVector3 eyePos(m_cameraPosition[0],m_cameraPosition[1],m_cameraPosition[2]);
- SimdVector3 dir = newRayTo-eyePos;
+ btVector3 newRayTo = GetRayTo(x,y);
+ btVector3 eyePos(m_cameraPosition[0],m_cameraPosition[1],m_cameraPosition[2]);
+ btVector3 dir = newRayTo-eyePos;
dir.normalize();
dir *= gOldPickingDist;
- SimdVector3 newPos = eyePos + dir;
+ btVector3 newPos = eyePos + dir;
p2p->SetPivotB(newPos);
}
@@ -606,16 +740,40 @@ void DemoApplication::mouseMotionFunc(int x,int y)
}
+
+btRigidBody* DemoApplication::LocalCreateRigidBody(bool isDynamic, float mass, const btTransform& startTransform,btCollisionShape* shape)
+{
+ btVector3 localInertia(0,0,0);
+ if (isDynamic)
+ shape->CalculateLocalInertia(mass,localInertia);
+
+ btMassProps massProps(0.f,localInertia);
+
+ btRigidBody* body = new btRigidBody(massProps);
+ body->m_collisionShape = shape;
+ body->m_worldTransform = startTransform;
+ body->m_internalOwner = body;
+ body->setMassProps( mass, localInertia);
+ body->setGravity(btVector3(0,-9.8f,0));
+ if (!isDynamic)
+ {
+ body->m_collisionFlags = btCollisionObject::isStatic;//??
+ }
+ return body;
+}
+
+
+
///Very basic import
-CcdPhysicsController* DemoApplication::LocalCreatePhysicsObject(bool isDynamic, float mass, const SimdTransform& startTransform,CollisionShape* shape)
+CcdPhysicsController* DemoApplication::LocalCreatePhysicsObject(bool isDynamic, float mass, const btTransform& startTransform,btCollisionShape* shape)
{
startTransforms[numObjects] = startTransform;
- CcdConstructionInfo ccdObjectCi;
+ btCcdConstructionInfo ccdObjectCi;
ccdObjectCi.m_friction = 0.5f;
- SimdTransform tr;
+ btTransform tr;
tr.setIdentity();
int i = numObjects;
@@ -623,20 +781,20 @@ CcdPhysicsController* DemoApplication::LocalCreatePhysicsObject(bool isDynamic,
gShapePtr[i] = shape;
gShapePtr[i]->SetMargin(0.05f);
- SimdQuaternion orn = startTransform.getRotation();
+ btQuaternion orn = startTransform.getRotation();
ms[i].setWorldOrientation(orn[0],orn[1],orn[2],orn[3]);
ms[i].setWorldPosition(startTransform.getOrigin().getX(),startTransform.getOrigin().getY(),startTransform.getOrigin().getZ());
ccdObjectCi.m_MotionState = &ms[i];
- ccdObjectCi.m_gravity = SimdVector3(0,-9.8,0);
- ccdObjectCi.m_localInertiaTensor =SimdVector3(0,0,0);
+ ccdObjectCi.m_gravity = btVector3(0,-9.8,0);
+ ccdObjectCi.m_localInertiaTensor =btVector3(0,0,0);
if (!isDynamic)
{
ccdObjectCi.m_mass = 0.f;
- ccdObjectCi.m_collisionFlags = CollisionObject::isStatic;
- ccdObjectCi.m_collisionFilterGroup = CcdConstructionInfo::StaticFilter;
- ccdObjectCi.m_collisionFilterMask = CcdConstructionInfo::AllFilter ^ CcdConstructionInfo::StaticFilter;
+ ccdObjectCi.m_collisionFlags = btCollisionObject::isStatic;
+ ccdObjectCi.m_collisionFilterGroup = btCcdConstructionInfo::StaticFilter;
+ ccdObjectCi.m_collisionFilterMask = btCcdConstructionInfo::AllFilter ^ btCcdConstructionInfo::StaticFilter;
}
else
{
@@ -644,7 +802,7 @@ CcdPhysicsController* DemoApplication::LocalCreatePhysicsObject(bool isDynamic,
ccdObjectCi.m_collisionFlags = 0;
}
- SimdVector3 localInertia(0.f,0.f,0.f);
+ btVector3 localInertia(0.f,0.f,0.f);
if (isDynamic)
{
@@ -677,10 +835,50 @@ void DemoApplication::renderme()
float m[16];
+ if (m_dynamicsWorld)
+ {
+ int numObjects = m_dynamicsWorld->GetNumCollisionObjects();
+ btVector3 wireColor(1,0,0);
+ for (int i=0;i<numObjects;i++)
+ {
+ btCollisionObject* colObj = m_dynamicsWorld->GetCollisionObjectArray()[i];
+ colObj->m_worldTransform.getOpenGLMatrix(m);
+
+ btVector3 wireColor(1.f,1.0f,0.5f); //wants deactivation
+ if (i & 1)
+ {
+ wireColor = btVector3(0.f,0.0f,1.f);
+ }
+ ///color differently for active, sleeping, wantsdeactivation states
+ if (colObj->GetActivationState() == 1) //active
+ {
+ if (i & 1)
+ {
+ wireColor += btVector3 (1.f,0.f,0.f);
+ } else
+ {
+ wireColor += btVector3 (.5f,0.f,0.f);
+ }
+ }
+ if (colObj->GetActivationState() == 2) //ISLAND_SLEEPING
+ {
+ if (i & 1)
+ {
+ wireColor += btVector3 (0.f,1.f, 0.f);
+ } else
+ {
+ wireColor += btVector3 (0.f,0.5f,0.f);
+ }
+ }
+
+ GL_ShapeDrawer::DrawOpenGL(m,colObj->m_collisionShape,wireColor,getDebugMode());
+ }
+ }
+
if (m_physicsEnvironmentPtr)
{
- if (getDebugMode() & IDebugDraw::DBG_DisableBulletLCP)
+ if (getDebugMode() & btIDebugDraw::DBG_DisableBulletLCP)
{
//don't use Bullet, use quickstep
m_physicsEnvironmentPtr->setSolverType(0);
@@ -690,7 +888,7 @@ void DemoApplication::renderme()
m_physicsEnvironmentPtr->setSolverType(1);
}
- if (getDebugMode() & IDebugDraw::DBG_EnableCCD)
+ if (getDebugMode() & btIDebugDraw::DBG_EnableCCD)
{
m_physicsEnvironmentPtr->setCcdMode(3);
} else
@@ -699,7 +897,7 @@ void DemoApplication::renderme()
}
- bool isSatEnabled = (getDebugMode() & IDebugDraw::DBG_EnableSatComparison);
+ bool isSatEnabled = (getDebugMode() & btIDebugDraw::DBG_EnableSatComparison);
m_physicsEnvironmentPtr->EnableSatCollisionDetection(isSatEnabled);
@@ -711,34 +909,34 @@ void DemoApplication::renderme()
{
CcdPhysicsController* ctrl = m_physicsEnvironmentPtr->GetPhysicsController(i);
- RigidBody* body = ctrl->GetRigidBody();
+ btRigidBody* body = ctrl->GetRigidBody();
body->m_worldTransform.getOpenGLMatrix( m );
- SimdVector3 wireColor(1.f,1.0f,0.5f); //wants deactivation
+ btVector3 wireColor(1.f,1.0f,0.5f); //wants deactivation
if (i & 1)
{
- wireColor = SimdVector3(0.f,0.0f,1.f);
+ wireColor = btVector3(0.f,0.0f,1.f);
}
///color differently for active, sleeping, wantsdeactivation states
if (ctrl->GetRigidBody()->GetActivationState() == 1) //active
{
if (i & 1)
{
- wireColor += SimdVector3 (1.f,0.f,0.f);
+ wireColor += btVector3 (1.f,0.f,0.f);
} else
{
- wireColor += SimdVector3 (.5f,0.f,0.f);
+ wireColor += btVector3 (.5f,0.f,0.f);
}
}
if (ctrl->GetRigidBody()->GetActivationState() == 2) //ISLAND_SLEEPING
{
if (i & 1)
{
- wireColor += SimdVector3 (0.f,1.f, 0.f);
+ wireColor += btVector3 (0.f,1.f, 0.f);
} else
{
- wireColor += SimdVector3 (0.f,0.5f,0.f);
+ wireColor += btVector3 (0.f,0.5f,0.f);
}
}
@@ -747,7 +945,7 @@ void DemoApplication::renderme()
ctrl->GetRigidBody()->GetCollisionShape()->SetExtraDebugInfo(extraDebug);
float vec[16];
- SimdTransform ident;
+ btTransform ident;
ident.setIdentity();
ident.getOpenGLMatrix(vec);
@@ -759,7 +957,7 @@ void DemoApplication::renderme()
}
- if (!(getDebugMode() & IDebugDraw::DBG_NoHelpText))
+ if (!(getDebugMode() & btIDebugDraw::DBG_NoHelpText))
{
float xOffset = 10.f;
@@ -774,15 +972,15 @@ void DemoApplication::renderme()
#ifdef USE_QUICKPROF
- if ( getDebugMode() & IDebugDraw::DBG_ProfileTimings)
+ if ( getDebugMode() & btIDebugDraw::DBG_ProfileTimings)
{
static int counter = 0;
counter++;
std::map<std::string, hidden::ProfileBlock*>::iterator iter;
- for (iter = Profiler::mProfileBlocks.begin(); iter != Profiler::mProfileBlocks.end(); ++iter)
+ for (iter = btProfiler::mProfileBlocks.begin(); iter != btProfiler::mProfileBlocks.end(); ++iter)
{
char blockTime[128];
- sprintf(blockTime, "%s: %lf",&((*iter).first[0]),Profiler::getBlockTime((*iter).first, Profiler::BLOCK_CYCLE_SECONDS));//BLOCK_TOTAL_PERCENT));
+ sprintf(blockTime, "%s: %lf",&((*iter).first[0]),btProfiler::getBlockTime((*iter).first, btProfiler::BLOCK_CYCLE_SECONDS));//BLOCK_TOTAL_PERCENT));
glRasterPos3f(xOffset,yStart,0);
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),blockTime);
yStart += yIncr;
@@ -790,7 +988,7 @@ void DemoApplication::renderme()
}
}
#endif //USE_QUICKPROF
- //profiling << Profiler::createStatsString(Profiler::BLOCK_TOTAL_PERCENT);
+ //profiling << btProfiler::createStatsString(btProfiler::BLOCK_TOTAL_PERCENT);
//<< std::endl;
@@ -836,9 +1034,9 @@ void DemoApplication::renderme()
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf);
yStart += yIncr;
- bool useBulletLCP = !(getDebugMode() & IDebugDraw::DBG_DisableBulletLCP);
+ bool useBulletLCP = !(getDebugMode() & btIDebugDraw::DBG_DisableBulletLCP);
- bool useCCD = (getDebugMode() & IDebugDraw::DBG_EnableCCD);
+ bool useCCD = (getDebugMode() & btIDebugDraw::DBG_EnableCCD);
glRasterPos3f(xOffset,yStart,0);
sprintf(buf,"m Bullet GJK = %i",!isSatEnabled);
diff --git a/Demos/OpenGL/DemoApplication.h b/Demos/OpenGL/DemoApplication.h
index 31f2ae384..503f98884 100644
--- a/Demos/OpenGL/DemoApplication.h
+++ b/Demos/OpenGL/DemoApplication.h
@@ -35,14 +35,16 @@ subject to the following restrictions:
#include <math.h>
-#include "LinearMath/SimdVector3.h"
-#include "LinearMath/SimdMatrix3x3.h"
-#include "LinearMath/SimdTransform.h"
-
-class CcdPhysicsEnvironment;
-class CcdPhysicsController;
-class CollisionShape;
+#include "LinearMath/btVector3.h"
+#include "LinearMath/btMatrix3x3.h"
+#include "LinearMath/btTransform.h"
+class CcdPhysicsEnvironment;
+class CcdPhysicsController;
+class btCollisionShape;
+class btDynamicsWorld;
+class btRigidBody;
+class btTypedConstraint;
class DemoApplication
{
@@ -53,18 +55,21 @@ class DemoApplication
///this is the most important class
CcdPhysicsEnvironment* m_physicsEnvironmentPtr;
+ btDynamicsWorld* m_dynamicsWorld;
+
+ btTypedConstraint* m_pickConstraint;
float m_cameraDistance;
int m_debugMode;
float m_ele;
float m_azi;
- SimdVector3 m_cameraPosition;
- SimdVector3 m_cameraTargetPosition;//look at
+ btVector3 m_cameraPosition;
+ btVector3 m_cameraTargetPosition;//look at
float m_scaleBottom;
float m_scaleFactor;
- SimdVector3 m_cameraUp;
+ btVector3 m_cameraUp;
int m_forwardAxis;
int m_glutScreenWidth;
@@ -99,7 +104,7 @@ class DemoApplication
return m_physicsEnvironmentPtr;
}
- void setCameraUp(const SimdVector3& camUp)
+ void setCameraUp(const btVector3& camUp)
{
m_cameraUp = camUp;
}
@@ -114,11 +119,11 @@ class DemoApplication
virtual void updateCamera();
- SimdVector3 getCameraPosition()
+ btVector3 getCameraPosition()
{
return m_cameraPosition;
}
- SimdVector3 getCameraTargetPosition()
+ btVector3 getCameraTargetPosition()
{
return m_cameraTargetPosition;
}
@@ -135,11 +140,13 @@ class DemoApplication
virtual void clientResetScene() =0 ;
///Demo functions
- void shootBox(const SimdVector3& destination);
+ void shootBox(const btVector3& destination);
+
+ btVector3 GetRayTo(int x,int y);
- SimdVector3 GetRayTo(int x,int y);
+ CcdPhysicsController* LocalCreatePhysicsObject(bool isDynamic, float mass, const btTransform& startTransform,btCollisionShape* shape);
- CcdPhysicsController* LocalCreatePhysicsObject(bool isDynamic, float mass, const SimdTransform& startTransform,CollisionShape* shape);
+ btRigidBody* LocalCreateRigidBody(bool isDynamic, float mass, const btTransform& startTransform,btCollisionShape* shape);
///callback methods by glut
diff --git a/Demos/OpenGL/GLDebugDrawer.cpp b/Demos/OpenGL/GLDebugDrawer.cpp
index 716fd5782..605b49ad5 100644
--- a/Demos/OpenGL/GLDebugDrawer.cpp
+++ b/Demos/OpenGL/GLDebugDrawer.cpp
@@ -1,6 +1,6 @@
#include "GLDebugDrawer.h"
-#include "LinearMath/SimdPoint3.h"
+#include "LinearMath/btPoint3.h"
#ifdef WIN32 //needed for glut.h
#include <windows.h>
@@ -22,7 +22,7 @@ GLDebugDrawer::GLDebugDrawer()
{
}
-void GLDebugDrawer::DrawLine(const SimdVector3& from,const SimdVector3& to,const SimdVector3& color)
+void GLDebugDrawer::DrawLine(const btVector3& from,const btVector3& to,const btVector3& color)
{
if (m_debugMode > 0)
{
@@ -40,12 +40,12 @@ void GLDebugDrawer::SetDebugMode(int debugMode)
}
-void GLDebugDrawer::DrawContactPoint(const SimdVector3& pointOnB,const SimdVector3& normalOnB,float distance,int lifeTime,const SimdVector3& color)
+void GLDebugDrawer::DrawContactPoint(const btVector3& pointOnB,const btVector3& normalOnB,float distance,int lifeTime,const btVector3& color)
{
- if (m_debugMode & IDebugDraw::DBG_DrawContactPoints)
+ if (m_debugMode & btIDebugDraw::DBG_DrawContactPoints)
{
- SimdVector3 to=pointOnB+normalOnB*distance;
- const SimdVector3&from = pointOnB;
+ btVector3 to=pointOnB+normalOnB*distance;
+ const btVector3&from = pointOnB;
glBegin(GL_LINES);
glColor3f(color.getX(), color.getY(), color.getZ());
glVertex3d(from.getX(), from.getY(), from.getZ());
diff --git a/Demos/OpenGL/GLDebugDrawer.h b/Demos/OpenGL/GLDebugDrawer.h
index 2a4942580..7904cbdfa 100644
--- a/Demos/OpenGL/GLDebugDrawer.h
+++ b/Demos/OpenGL/GLDebugDrawer.h
@@ -1,11 +1,11 @@
#ifndef GL_DEBUG_DRAWER_H
#define GL_DEBUG_DRAWER_H
-#include "LinearMath/GenIDebugDraw.h"
+#include "LinearMath/btIDebugDraw.h"
-class GLDebugDrawer : public IDebugDraw
+class GLDebugDrawer : public btIDebugDraw
{
int m_debugMode;
@@ -13,9 +13,9 @@ public:
GLDebugDrawer();
- virtual void DrawLine(const SimdVector3& from,const SimdVector3& to,const SimdVector3& color);
+ virtual void DrawLine(const btVector3& from,const btVector3& to,const btVector3& color);
- virtual void DrawContactPoint(const SimdVector3& PointOnB,const SimdVector3& normalOnB,float distance,int lifeTime,const SimdVector3& color);
+ virtual void DrawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,float distance,int lifeTime,const btVector3& color);
virtual void SetDebugMode(int debugMode);
diff --git a/Demos/OpenGL/GL_ShapeDrawer.cpp b/Demos/OpenGL/GL_ShapeDrawer.cpp
index 9cad8907b..0f9887a8f 100644
--- a/Demos/OpenGL/GL_ShapeDrawer.cpp
+++ b/Demos/OpenGL/GL_ShapeDrawer.cpp
@@ -39,7 +39,7 @@ subject to the following restrictions:
#include "BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h"
-#include "LinearMath/GenIDebugDraw.h"
+#include "LinearMath/btIDebugDraw.h"
//for debugmodes
#include "BMF_Api.h"
#include <stdio.h> //printf debugging
@@ -63,11 +63,11 @@ void GL_ShapeDrawer::DrawCoordSystem() {
-class GlDrawcallback : public TriangleCallback
+class GlDrawcallback : public btTriangleCallback
{
public:
- virtual void ProcessTriangle(SimdVector3* triangle,int partId, int triangleIndex)
+ virtual void ProcessTriangle(btVector3* triangle,int partId, int triangleIndex)
{
glBegin(GL_LINES);
glColor3f(1, 0, 0);
@@ -84,10 +84,10 @@ public:
}
};
-class TriangleGlDrawcallback : public InternalTriangleIndexCallback
+class TriangleGlDrawcallback : public btInternalTriangleIndexCallback
{
public:
- virtual void InternalProcessTriangleIndex(SimdVector3* triangle,int partId,int triangleIndex)
+ virtual void InternalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
{
glBegin(GL_TRIANGLES);//LINES);
glColor3f(1, 0, 0);
@@ -104,7 +104,7 @@ public:
};
-void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const SimdVector3& color,int debugMode)
+void GL_ShapeDrawer::DrawOpenGL(float* m, const btCollisionShape* shape, const btVector3& color,int debugMode)
{
@@ -113,11 +113,11 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
if (shape->GetShapeType() == COMPOUND_SHAPE_PROXYTYPE)
{
- const CompoundShape* compoundShape = static_cast<const CompoundShape*>(shape);
+ const btCompoundShape* compoundShape = static_cast<const btCompoundShape*>(shape);
for (int i=compoundShape->GetNumChildShapes()-1;i>=0;i--)
{
- SimdTransform childTrans = compoundShape->GetChildTransform(i);
- const CollisionShape* colShape = compoundShape->GetChildShape(i);
+ btTransform childTrans = compoundShape->GetChildTransform(i);
+ const btCollisionShape* colShape = compoundShape->GetChildShape(i);
float childMat[16];
childTrans.getOpenGLMatrix(childMat);
DrawOpenGL(childMat,colShape,color,debugMode);
@@ -135,14 +135,14 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
bool useWireframeFallback = true;
- if (!(debugMode & IDebugDraw::DBG_DrawWireframe))
+ if (!(debugMode & btIDebugDraw::DBG_DrawWireframe))
{
switch (shape->GetShapeType())
{
case BOX_SHAPE_PROXYTYPE:
{
- const BoxShape* boxShape = static_cast<const BoxShape*>(shape);
- SimdVector3 halfExtent = boxShape->GetHalfExtents();
+ const btBoxShape* boxShape = static_cast<const btBoxShape*>(shape);
+ btVector3 halfExtent = boxShape->GetHalfExtents();
glScaled(2*halfExtent[0], 2*halfExtent[1], 2*halfExtent[2]);
glutSolidCube(1.0);
useWireframeFallback = false;
@@ -159,7 +159,7 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
break;
case SPHERE_SHAPE_PROXYTYPE:
{
- const SphereShape* sphereShape = static_cast<const SphereShape*>(shape);
+ const btSphereShape* sphereShape = static_cast<const btSphereShape*>(shape);
float radius = sphereShape->GetMargin();//radius doesn't include the margin, so draw with margin
glutSolidSphere(radius,10,10);
useWireframeFallback = false;
@@ -168,7 +168,7 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
case MULTI_SPHERE_SHAPE_PROXYTYPE:
case CONE_SHAPE_PROXYTYPE:
{
- const ConeShape* coneShape = static_cast<const ConeShape*>(shape);
+ const btConeShape* coneShape = static_cast<const btConeShape*>(shape);
float radius = coneShape->GetRadius();//+coneShape->GetMargin();
float height = coneShape->GetHeight();//+coneShape->GetMargin();
//glRotatef(-90.0, 1.0, 0.0, 0.0);
@@ -187,7 +187,7 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
case CONVEX_SHAPE_PROXYTYPE:
case CYLINDER_SHAPE_PROXYTYPE:
{
- const CylinderShape* cylinder = static_cast<const CylinderShape*>(shape);
+ const btCylinderShape* cylinder = static_cast<const btCylinderShape*>(shape);
int upAxis = cylinder->GetUpAxis();
GLUquadricObj *quadObj = gluNewQuadric();
@@ -246,7 +246,7 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
/// for polyhedral shapes
if (shape->IsPolyhedral())
{
- PolyhedralConvexShape* polyshape = (PolyhedralConvexShape*) shape;
+ btPolyhedralConvexShape* polyshape = (btPolyhedralConvexShape*) shape;
glBegin(GL_LINES);
@@ -255,7 +255,7 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
int i;
for (i=0;i<polyshape->GetNumEdges();i++)
{
- SimdPoint3 a,b;
+ btPoint3 a,b;
polyshape->GetEdge(i,a,b);
glVertex3f(a.getX(),a.getY(),a.getZ());
@@ -266,7 +266,7 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
glEnd();
- if (debugMode==IDebugDraw::DBG_DrawFeaturesText)
+ if (debugMode==btIDebugDraw::DBG_DrawFeaturesText)
{
glRasterPos3f(0.0, 0.0, 0.0);
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),polyshape->GetExtraDebugInfo());
@@ -274,7 +274,7 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
glColor3f(1.f, 1.f, 1.f);
for (i=0;i<polyshape->GetNumVertices();i++)
{
- SimdPoint3 vtx;
+ btPoint3 vtx;
polyshape->GetVertex(i,vtx);
glRasterPos3f(vtx.x(), vtx.y(), vtx.z());
char buf[12];
@@ -284,10 +284,10 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
for (i=0;i<polyshape->GetNumPlanes();i++)
{
- SimdVector3 normal;
- SimdPoint3 vtx;
+ btVector3 normal;
+ btPoint3 vtx;
polyshape->GetPlane(normal,vtx,i);
- SimdScalar d = vtx.dot(normal);
+ btScalar d = vtx.dot(normal);
glRasterPos3f(normal.x()*d, normal.y()*d, normal.z()*d);
char buf[12];
@@ -303,13 +303,13 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
if (shape->GetShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)
{
- TriangleMeshShape* concaveMesh = (TriangleMeshShape*) shape;
- //SimdVector3 aabbMax(1e30f,1e30f,1e30f);
- //SimdVector3 aabbMax(100,100,100);//1e30f,1e30f,1e30f);
+ btTriangleMeshShape* concaveMesh = (btTriangleMeshShape*) shape;
+ //btVector3 aabbMax(1e30f,1e30f,1e30f);
+ //btVector3 aabbMax(100,100,100);//1e30f,1e30f,1e30f);
//todo pass camera, for some culling
- SimdVector3 aabbMax(1e30f,1e30f,1e30f);
- SimdVector3 aabbMin(-1e30f,-1e30f,-1e30f);
+ btVector3 aabbMax(1e30f,1e30f,1e30f);
+ btVector3 aabbMin(-1e30f,-1e30f,-1e30f);
GlDrawcallback drawCallback;
@@ -320,16 +320,17 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
if (shape->GetShapeType() == CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE)
{
- ConvexTriangleMeshShape* convexMesh = (ConvexTriangleMeshShape*) shape;
+ btConvexTriangleMeshShape* convexMesh = (btConvexTriangleMeshShape*) shape;
//todo: pass camera for some culling
- SimdVector3 aabbMax(1e30f,1e30f,1e30f);
- SimdVector3 aabbMin(-1e30f,-1e30f,-1e30f);
+ btVector3 aabbMax(1e30f,1e30f,1e30f);
+ btVector3 aabbMin(-1e30f,-1e30f,-1e30f);
TriangleGlDrawcallback drawCallback;
convexMesh->GetStridingMesh()->InternalProcessAllTriangles(&drawCallback,aabbMin,aabbMax);
}
+
glDisable(GL_DEPTH_BUFFER_BIT);
glRasterPos3f(0,0,0);//mvtx.x(), vtx.y(), vtx.z());
if (debugMode&IDebugDraw::DBG_DrawText)
@@ -342,7 +343,6 @@ void GL_ShapeDrawer::DrawOpenGL(float* m, const CollisionShape* shape, const Sim
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),shape->GetExtraDebugInfo());
}
glEnable(GL_DEPTH_BUFFER_BIT);
-
// glPopMatrix();
}
diff --git a/Demos/OpenGL/GL_ShapeDrawer.h b/Demos/OpenGL/GL_ShapeDrawer.h
index 2e1dfecc1..a37f3799e 100644
--- a/Demos/OpenGL/GL_ShapeDrawer.h
+++ b/Demos/OpenGL/GL_ShapeDrawer.h
@@ -15,15 +15,15 @@ subject to the following restrictions:
#ifndef GL_SHAPE_DRAWER_H
#define GL_SHAPE_DRAWER_H
-class CollisionShape;
-#include "LinearMath/SimdVector3.h"
+class btCollisionShape;
+#include "LinearMath/btVector3.h"
/// OpenGL shape drawing
class GL_ShapeDrawer
{
public:
- static void DrawOpenGL(float* m, const CollisionShape* shape, const SimdVector3& color,int debugMode);
+ static void DrawOpenGL(float* m, const btCollisionShape* shape, const btVector3& color,int debugMode);
static void DrawCoordSystem();
};
diff --git a/Demos/OpenGL/GL_Simplex1to4.cpp b/Demos/OpenGL/GL_Simplex1to4.cpp
index fc577a34b..93a744590 100644
--- a/Demos/OpenGL/GL_Simplex1to4.cpp
+++ b/Demos/OpenGL/GL_Simplex1to4.cpp
@@ -26,7 +26,7 @@ subject to the following restrictions:
#else
#include <GL/gl.h>
#endif
-#include "LinearMath/SimdTransform.h"
+#include "LinearMath/btTransform.h"
GL_Simplex1to4::GL_Simplex1to4()
:m_simplexSolver(0)
@@ -38,7 +38,7 @@ GL_Simplex1to4::GL_Simplex1to4()
///
void GL_Simplex1to4::CalcClosest(float* m)
{
- SimdTransform tr;
+ btTransform tr;
tr.setFromOpenGLMatrix(m);
@@ -50,12 +50,12 @@ void GL_Simplex1to4::CalcClosest(float* m)
m_simplexSolver->reset();
bool res;
- SimdVector3 v;
+ btVector3 v;
for (int i=0;i<m_numVertices;i++)
{
v = tr(m_vertices[i]);
- m_simplexSolver->addVertex(v,v,SimdPoint3(0.f,0.f,0.f));
+ m_simplexSolver->addVertex(v,v,btPoint3(0.f,0.f,0.f));
res = m_simplexSolver->closest(v);
}
diff --git a/Demos/OpenGL/GL_Simplex1to4.h b/Demos/OpenGL/GL_Simplex1to4.h
index 42ad58310..e59d30543 100644
--- a/Demos/OpenGL/GL_Simplex1to4.h
+++ b/Demos/OpenGL/GL_Simplex1to4.h
@@ -21,9 +21,9 @@ subject to the following restrictions:
///GL_Simplex1to4 is a class to debug a Simplex Solver with 1 to 4 points.
///Can be used by GJK.
-class GL_Simplex1to4 : public BU_Simplex1to4
+class GL_Simplex1to4 : public btBU_Simplex1to4
{
- SimplexSolverInterface* m_simplexSolver;
+ btSimplexSolverInterface* m_simplexSolver;
public:
@@ -31,7 +31,7 @@ class GL_Simplex1to4 : public BU_Simplex1to4
void CalcClosest(float* m);
- void SetSimplexSolver(SimplexSolverInterface* simplexSolver) {
+ void SetSimplexSolver(btSimplexSolverInterface* simplexSolver) {
m_simplexSolver = simplexSolver;
}
diff --git a/Demos/OpenGL/RenderTexture.cpp b/Demos/OpenGL/RenderTexture.cpp
index a0ea8ed30..b0baa40b2 100644
--- a/Demos/OpenGL/RenderTexture.cpp
+++ b/Demos/OpenGL/RenderTexture.cpp
@@ -30,7 +30,7 @@ RenderTexture::RenderTexture(int width,int height)
{
for (int y=0;y<m_height;y++)
{
- SetPixel(x,y,SimdVector4(float(x),float(y),0.f,1.f));
+ SetPixel(x,y,btVector4(float(x),float(y),0.f,1.f));
}
}
@@ -54,7 +54,7 @@ void RenderTexture::Printf(char* str, BMF_FontData* fontData, int startx,int sta
{
char packedColor = bitmap[y];
float colorf = packedColor & bit ? 1.f : 0.f;
- SimdVector4 rgba(colorf,colorf,colorf,1.f);
+ btVector4 rgba(colorf,colorf,colorf,1.f);
SetPixel(rasterposx+x,rasterposy+8-y-1,rgba);
bit >>=1;
}
diff --git a/Demos/OpenGL/RenderTexture.h b/Demos/OpenGL/RenderTexture.h
index 9ac636b2c..b6eea54d7 100644
--- a/Demos/OpenGL/RenderTexture.h
+++ b/Demos/OpenGL/RenderTexture.h
@@ -16,7 +16,7 @@ subject to the following restrictions:
#ifndef RENDER_TEXTURE_H
#define RENDER_TEXTURE_H
-#include "LinearMath/SimdVector3.h"
+#include "LinearMath/btVector3.h"
#include "BMF_FontData.h"
///
@@ -33,7 +33,7 @@ public:
RenderTexture(int width,int height);
~RenderTexture();
- inline void SetPixel(int x,int y,const SimdVector4& rgba)
+ inline void SetPixel(int x,int y,const btVector4& rgba)
{
unsigned char* pixel = &m_buffer[ (x+y*m_width) * 4];
diff --git a/Demos/Raytracer/Raytracer.cpp b/Demos/Raytracer/Raytracer.cpp
index 3c6e43031..d128f7a54 100644
--- a/Demos/Raytracer/Raytracer.cpp
+++ b/Demos/Raytracer/Raytracer.cpp
@@ -19,8 +19,8 @@ Very basic raytracer, rendering into a texture.
///Low level demo, doesn't include btBulletCollisionCommon.h
#include "GL_Simplex1to4.h"
-#include "LinearMath/SimdQuaternion.h"
-#include "LinearMath/SimdTransform.h"
+#include "LinearMath/btQuaternion.h"
+#include "LinearMath/btTransform.h"
#include "GL_ShapeDrawer.h"
#include "Raytracer.h"
@@ -48,7 +48,7 @@ Very basic raytracer, rendering into a texture.
#include "RenderTexture.h"
-VoronoiSimplexSolver simplexSolver;
+btVoronoiSimplexSolver simplexSolver;
float yaw=0.f,pitch=0.f,roll=0.f;
const int maxNumObjects = 4;
@@ -57,8 +57,8 @@ const int numObjects = 4;
/// simplex contains the vertices, and some extra code to draw and debug
GL_Simplex1to4 simplex;
-ConvexShape* shapePtr[maxNumObjects];
-SimdTransform transforms[maxNumObjects];
+btConvexShape* shapePtr[maxNumObjects];
+btTransform transforms[maxNumObjects];
RenderTexture* raytracePicture = 0;
@@ -66,12 +66,12 @@ int screenWidth = 128;
int screenHeight = 128;
GLuint glTextureId;
-SphereShape mySphere(1);
-BoxShape myBox(SimdVector3(0.4f,0.4f,0.4f));
-CylinderShape myCylinder(SimdVector3(0.3f,0.3f,0.3f));
-ConeShape myCone(1,1);
+btSphereShape mySphere(1);
+btBoxShape myBox(btVector3(0.4f,0.4f,0.4f));
+btCylinderShape myCylinder(btVector3(0.3f,0.3f,0.3f));
+btConeShape myCone(1,1);
-MinkowskiSumShape myMink(&myCylinder,&myBox);
+btMinkowskiSumShape myMink(&myCylinder,&myBox);
///
@@ -96,25 +96,25 @@ void Raytracer::initPhysics()
myCone.SetMargin(0.2f);
simplex.SetSimplexSolver(&simplexSolver);
- simplex.AddVertex(SimdPoint3(-1,0,-1));
- simplex.AddVertex(SimdPoint3(1,0,-1));
- simplex.AddVertex(SimdPoint3(0,0,1));
- simplex.AddVertex(SimdPoint3(0,1,0));
+ simplex.AddVertex(btPoint3(-1,0,-1));
+ simplex.AddVertex(btPoint3(1,0,-1));
+ simplex.AddVertex(btPoint3(0,0,1));
+ simplex.AddVertex(btPoint3(0,1,0));
/// convex hull of 5 spheres
#define NUM_SPHERES 5
- SimdVector3 inertiaHalfExtents(10.f,10.f,10.f);
- SimdVector3 positions[NUM_SPHERES] = {
- SimdVector3(-1.2f, -0.3f, 0.f),
- SimdVector3(0.8f, -0.3f, 0.f),
- SimdVector3(0.5f, 0.6f, 0.f),
- SimdVector3(-0.5f, 0.6f, 0.f),
- SimdVector3(0.f, 0.f, 0.f)
+ btVector3 inertiaHalfExtents(10.f,10.f,10.f);
+ btVector3 positions[NUM_SPHERES] = {
+ btVector3(-1.2f, -0.3f, 0.f),
+ btVector3(0.8f, -0.3f, 0.f),
+ btVector3(0.5f, 0.6f, 0.f),
+ btVector3(-0.5f, 0.6f, 0.f),
+ btVector3(0.f, 0.f, 0.f)
};
- // MultiSphereShape* multiSphereShape = new MultiSphereShape(inertiaHalfExtents,positions,radi,NUM_SPHERES);
- ConvexHullShape* convexHullShape = new ConvexHullShape(positions,3);
+ // btMultiSphereShape* multiSphereShape = new btMultiSphereShape(inertiaHalfExtents,positions,radi,NUM_SPHERES);
+ btConvexHullShape* convexHullShape = new btConvexHullShape(positions,3);
//choose shape
@@ -146,16 +146,16 @@ void Raytracer::displayCallback()
for (int i=0;i<numObjects;i++)
{
transforms[i].setIdentity();
- SimdVector3 pos(-3.5f+i*2.5f,0.f,0.f);
+ btVector3 pos(-3.5f+i*2.5f,0.f,0.f);
transforms[i].setOrigin( pos );
- SimdQuaternion orn;
+ btQuaternion orn;
if (i < 2)
{
orn.setEuler(yaw,pitch,roll);
transforms[i].setRotation(orn);
}
}
- myMink.SetTransformA(SimdTransform(transforms[0].getRotation()));
+ myMink.SetTransformA(btTransform(transforms[0].getRotation()));
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDisable(GL_LIGHTING);
@@ -184,7 +184,7 @@ void Raytracer::displayCallback()
- SimdVector4 rgba(1.f,0.f,0.f,0.5f);
+ btVector4 rgba(1.f,0.f,0.f,0.5f);
float top = 1.f;
float bottom = -1.f;
@@ -195,15 +195,15 @@ void Raytracer::displayCallback()
float fov = 2.0 * atanf (tanFov);
- SimdVector3 rayFrom = getCameraPosition();
- SimdVector3 rayForward = getCameraTargetPosition()-getCameraPosition();
+ btVector3 rayFrom = getCameraPosition();
+ btVector3 rayForward = getCameraTargetPosition()-getCameraPosition();
rayForward.normalize();
float farPlane = 600.f;
rayForward*= farPlane;
- SimdVector3 rightOffset;
- SimdVector3 vertical(0.f,1.f,0.f);
- SimdVector3 hor;
+ btVector3 rightOffset;
+ btVector3 vertical(0.f,1.f,0.f);
+ btVector3 hor;
hor = rayForward.cross(vertical);
hor.normalize();
vertical = hor.cross(rayForward);
@@ -214,20 +214,20 @@ void Raytracer::displayCallback()
hor *= 2.f * farPlane * tanfov;
vertical *= 2.f * farPlane * tanfov;
- SimdVector3 rayToCenter = rayFrom + rayForward;
+ btVector3 rayToCenter = rayFrom + rayForward;
- SimdVector3 dHor = hor * 1.f/float(screenWidth);
- SimdVector3 dVert = vertical * 1.f/float(screenHeight);
+ btVector3 dHor = hor * 1.f/float(screenWidth);
+ btVector3 dVert = vertical * 1.f/float(screenHeight);
- SimdTransform rayFromTrans;
+ btTransform rayFromTrans;
rayFromTrans.setIdentity();
rayFromTrans.setOrigin(rayFrom);
- SimdTransform rayFromLocal;
- SimdTransform rayToLocal;
+ btTransform rayFromLocal;
+ btTransform rayToLocal;
- SphereShape pointShape(0.0f);
+ btSphereShape pointShape(0.0f);
///clear texture
@@ -235,16 +235,16 @@ void Raytracer::displayCallback()
{
for (int y=0;y<screenHeight;y++)
{
- SimdVector4 rgba(0.f,0.f,0.f,0.f);
+ btVector4 rgba(0.f,0.f,0.f,0.f);
raytracePicture->SetPixel(x,y,rgba);
}
}
- ConvexCast::CastResult rayResult;
- SimdTransform rayToTrans;
+ btConvexCast::CastResult rayResult;
+ btTransform rayToTrans;
rayToTrans.setIdentity();
- SimdVector3 rayTo;
+ btVector3 rayTo;
for (int x=0;x<screenWidth;x++)
{
for (int y=0;y<screenHeight;y++)
@@ -259,11 +259,11 @@ void Raytracer::displayCallback()
// rayToLocal = transforms[s].inverse()* rayToTrans;
//choose the continuous collision detection method
- SubsimplexConvexCast convexCaster(&pointShape,shapePtr[s],&simplexSolver);
+ btSubsimplexConvexCast convexCaster(&pointShape,shapePtr[s],&simplexSolver);
//GjkConvexCast convexCaster(&pointShape,shapePtr[0],&simplexSolver);
//ContinuousConvexCollision convexCaster(&pointShape,shapePtr[0],&simplexSolver,0);
- // BU_Simplex1to4 ptShape(SimdVector3(0,0,0));//algebraic needs features, doesnt use 'supporting vertex'
+ // btBU_Simplex1to4 ptShape(btVector3(0,0,0));//algebraic needs features, doesnt use 'supporting vertex'
// BU_CollisionPair convexCaster(&ptShape,shapePtr[0]);
@@ -276,21 +276,21 @@ void Raytracer::displayCallback()
//float fog = 1.f - 0.1f * rayResult.m_fraction;
rayResult.m_normal.normalize();
- SimdVector3 worldNormal;
+ btVector3 worldNormal;
worldNormal = transforms[s].getBasis() *rayResult.m_normal;
- float light = worldNormal.dot(SimdVector3(0.4f,-1.f,-0.4f));
+ float light = worldNormal.dot(btVector3(0.4f,-1.f,-0.4f));
if (light < 0.2f)
light = 0.2f;
if (light > 1.f)
light = 1.f;
- rgba = SimdVector4(light,light,light,1.f);
+ rgba = btVector4(light,light,light,1.f);
raytracePicture->SetPixel(x,y,rgba);
} else
{
//clear is already done
- //rgba = SimdVector4(0.f,0.f,0.f,0.f);
+ //rgba = btVector4(0.f,0.f,0.f,0.f);
//raytracePicture->SetPixel(x,y,rgba);
}
@@ -386,7 +386,7 @@ void Raytracer::displayCallback()
transA.getOpenGLMatrix( m );
/// draw the simplex
- GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],SimdVector3(1,1,1));
+ GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],btVector3(1,1,1));
/// calculate closest point from simplex to the origin, and draw this vector
simplex.CalcClosest(m);
diff --git a/Demos/SimplexDemo/SimplexDemo.cpp b/Demos/SimplexDemo/SimplexDemo.cpp
index 5d31f2a2b..78fcfd5d1 100644
--- a/Demos/SimplexDemo/SimplexDemo.cpp
+++ b/Demos/SimplexDemo/SimplexDemo.cpp
@@ -19,15 +19,15 @@ subject to the following restrictions:
*/
#include "GL_Simplex1to4.h"
-#include "LinearMath/SimdQuaternion.h"
-#include "LinearMath/SimdTransform.h"
+#include "LinearMath/btQuaternion.h"
+#include "LinearMath/btTransform.h"
#include "GL_ShapeDrawer.h"
#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
#include "SimplexDemo.h"
#include "GlutStuff.h"
-VoronoiSimplexSolver simplexSolver;
+btVoronoiSimplexSolver simplexSolver;
@@ -40,7 +40,7 @@ int screenHeight = 480;
GL_Simplex1to4 simplex;
-PolyhedralConvexShape* shapePtr[maxNumObjects];
+btPolyhedralConvexShape* shapePtr[maxNumObjects];
///
@@ -78,17 +78,17 @@ void SimplexDemo::displayCallback()
for (i=0;i<numObjects;i++)
{
- SimdTransform transA;
+ btTransform transA;
transA.setIdentity();
- SimdVector3 dpos(0.f,5.f,0.f);
+ btVector3 dpos(0.f,5.f,0.f);
transA.setOrigin( dpos );
- SimdQuaternion orn;
+ btQuaternion orn;
orn.setEuler(yaw,pitch,roll);
transA.setRotation(orn);
transA.getOpenGLMatrix( m );
/// draw the simplex
- GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],SimdVector3(1,1,1),getDebugMode());
+ GL_ShapeDrawer::DrawOpenGL(m,shapePtr[i],btVector3(1,1,1),getDebugMode());
/// calculate closest point from simplex to the origin, and draw this vector
simplex.CalcClosest(m);
@@ -106,14 +106,14 @@ void SimplexDemo::initPhysics()
simplex.SetSimplexSolver(&simplexSolver);
- simplex.AddVertex(SimdPoint3(-2,0,-2));
- simplex.AddVertex(SimdPoint3(2,0,-2));
- simplex.AddVertex(SimdPoint3(0,0,2));
- simplex.AddVertex(SimdPoint3(0,2,0));
+ simplex.AddVertex(btPoint3(-2,0,-2));
+ simplex.AddVertex(btPoint3(2,0,-2));
+ simplex.AddVertex(btPoint3(0,0,2));
+ simplex.AddVertex(btPoint3(0,2,0));
shapePtr[0] = &simplex;
- SimdTransform tr;
+ btTransform tr;
tr.setIdentity();
}
diff --git a/Demos/UserCollisionAlgorithm/UserCollisionAlgorithm.cpp b/Demos/UserCollisionAlgorithm/UserCollisionAlgorithm.cpp
index 7eaa83d1b..e98549521 100644
--- a/Demos/UserCollisionAlgorithm/UserCollisionAlgorithm.cpp
+++ b/Demos/UserCollisionAlgorithm/UserCollisionAlgorithm.cpp
@@ -16,7 +16,7 @@ subject to the following restrictions:
#include "CcdPhysicsEnvironment.h"
#include "CcdPhysicsController.h"
#include "btBulletDynamicsCommon.h"
-#include "LinearMath/GenIDebugDraw.h"
+#include "LinearMath/btIDebugDraw.h"
#include "GLDebugDrawer.h"
#include "PHY_Pro.h"
#include "UserCollisionAlgorithm.h"
@@ -31,17 +31,17 @@ GLDebugDrawer debugDrawer;
static const int NUM_VERTICES = 5;
static const int NUM_TRIANGLES=4;
-SimdVector3 gVertices[NUM_VERTICES];
+btVector3 gVertices[NUM_VERTICES];
int gIndices[NUM_TRIANGLES*3];
const float TRIANGLE_SIZE=80.f;
-///User can override this material combiner by implementing gContactAddedCallback and setting body0->m_collisionFlags |= CollisionObject::customMaterialCallback;
-inline SimdScalar calculateCombinedFriction(float friction0,float friction1)
+///User can override this material combiner by implementing gContactAddedCallback and setting body0->m_collisionFlags |= btCollisionObject::customMaterialCallback;
+inline btScalar calculateCombinedFriction(float friction0,float friction1)
{
- SimdScalar friction = friction0 * friction1;
+ btScalar friction = friction0 * friction1;
- const SimdScalar MAX_FRICTION = 10.f;
+ const btScalar MAX_FRICTION = 10.f;
if (friction < -MAX_FRICTION)
friction = -MAX_FRICTION;
if (friction > MAX_FRICTION)
@@ -50,7 +50,7 @@ inline SimdScalar calculateCombinedFriction(float friction0,float friction1)
}
-inline SimdScalar calculateCombinedRestitution(float restitution0,float restitution1)
+inline btScalar calculateCombinedRestitution(float restitution0,float restitution1)
{
return restitution0 * restitution1;
}
@@ -74,7 +74,7 @@ void UserCollisionAlgorithm::initPhysics()
{
#define TRISIZE 10.f
- int vertStride = sizeof(SimdVector3);
+ int vertStride = sizeof(btVector3);
int indexStride = 3*sizeof(int);
const int NUM_VERTS_X = 50;
@@ -83,7 +83,7 @@ void UserCollisionAlgorithm::initPhysics()
const int totalTriangles = 2*(NUM_VERTS_X-1)*(NUM_VERTS_Y-1);
- SimdVector3* gVertices = new SimdVector3[totalVerts];
+ btVector3* gVertices = new btVector3[totalVerts];
int* gIndices = new int[totalTriangles*3];
int i;
@@ -111,41 +111,41 @@ void UserCollisionAlgorithm::initPhysics()
}
}
- TriangleIndexVertexArray* indexVertexArrays = new TriangleIndexVertexArray(totalTriangles,
+ btTriangleIndexVertexArray* indexVertexArrays = new btTriangleIndexVertexArray(totalTriangles,
gIndices,
indexStride,
totalVerts,(float*) &gVertices[0].x(),vertStride);
- CollisionShape* trimeshShape = new BvhTriangleMeshShape(indexVertexArrays);
+ btCollisionShape* trimeshShape = new btBvhTriangleMeshShape(indexVertexArrays);
- //ConstraintSolver* solver = new SequentialImpulseConstraintSolver;
+ //ConstraintSolver* solver = new btSequentialImpulseConstraintSolver;
- CollisionDispatcher* dispatcher = new CollisionDispatcher();
+ btCollisionDispatcher* dispatcher = new btCollisionDispatcher();
- SimdVector3 maxAabb(10000,10000,10000);
- OverlappingPairCache* broadphase = new AxisSweep3(-maxAabb,maxAabb);//SimpleBroadphase();
- dispatcher->RegisterCollisionCreateFunc(SPHERE_SHAPE_PROXYTYPE,SPHERE_SHAPE_PROXYTYPE,new SphereSphereCollisionAlgorithm::CreateFunc);
+ btVector3 maxAabb(10000,10000,10000);
+ btOverlappingPairCache* broadphase = new btAxisSweep3(-maxAabb,maxAabb);//SimpleBroadphase();
+ dispatcher->RegisterCollisionCreateFunc(SPHERE_SHAPE_PROXYTYPE,SPHERE_SHAPE_PROXYTYPE,new btSphereSphereCollisionAlgorithm::CreateFunc);
m_physicsEnvironmentPtr = new CcdPhysicsEnvironment(dispatcher,broadphase);
bool isDynamic = false;
float mass = 0.f;
- SimdTransform startTransform;
+ btTransform startTransform;
startTransform.setIdentity();
- startTransform.setOrigin(SimdVector3(0,-2,0));
+ startTransform.setOrigin(btVector3(0,-2,0));
CcdPhysicsController* staticTrimesh = LocalCreatePhysicsObject(isDynamic, mass, startTransform,trimeshShape);
//enable custom material callback
- staticTrimesh->GetRigidBody()->m_collisionFlags |= CollisionObject::customMaterialCallback;
+ staticTrimesh->GetRigidBody()->m_collisionFlags |= btCollisionObject::customMaterialCallback;
{
for (int i=0;i<10;i++)
{
- CollisionShape* sphereShape = new SphereShape(1);
- startTransform.setOrigin(SimdVector3(1,2*i,1));
+ btCollisionShape* sphereShape = new btSphereShape(1);
+ startTransform.setOrigin(btVector3(1,2*i,1));
LocalCreatePhysicsObject(true, 1, startTransform,sphereShape);
}
}
diff --git a/Demos/VehicleDemo/VehicleDemo.cpp b/Demos/VehicleDemo/VehicleDemo.cpp
index cb082567f..81836f87a 100644
--- a/Demos/VehicleDemo/VehicleDemo.cpp
+++ b/Demos/VehicleDemo/VehicleDemo.cpp
@@ -28,8 +28,8 @@ subject to the following restrictions:
#include "ParallelIslandDispatcher.h"
-#include "LinearMath/GenQuickprof.h"
-#include "LinearMath/GenIDebugDraw.h"
+#include "LinearMath/btQuickprof.h"
+#include "LinearMath/btIDebugDraw.h"
#include "GLDebugDrawer.h"
@@ -51,7 +51,7 @@ const int maxOverlap = 65535;
DefaultMotionState wheelMotionState[4];
-///PHY_IVehicle is the interface behind the constraint that implements the raycast vehicle (WrapperVehicle which holds a RaycastVehicle)
+///PHY_IVehicle is the interface behind the constraint that implements the raycast vehicle (WrapperVehicle which holds a btRaycastVehicle)
///notice that for higher-quality slow-moving vehicles, another approach might be better
///implementing explicit hinged-wheel constraints with cylinder collision, rather then raycasts
PHY_IVehicle* gVehicleConstraint=0;
@@ -67,9 +67,9 @@ float suspensionStiffness = 10.f;
float suspensionDamping = 1.3f;
float suspensionCompression = 2.4f;
float rollInfluence = 0.1f;
-SimdVector3 wheelDirectionCS0(0,-1,0);
-SimdVector3 wheelAxleCS(1,0,0);
-SimdScalar suspensionRestLength(0.6);
+btVector3 wheelDirectionCS0(0,-1,0);
+btVector3 wheelAxleCS(1,0,0);
+btScalar suspensionRestLength(0.6);
#define CUBE_HALF_EXTENTS 1
@@ -98,20 +98,20 @@ m_cameraHeight(4.f),
m_minCameraDistance(3.f),
m_maxCameraDistance(10.f)
{
- m_cameraPosition = SimdVector3(30,30,30);
+ m_cameraPosition = btVector3(30,30,30);
}
void VehicleDemo::setupPhysics()
{
- CollisionDispatcher* dispatcher = new CollisionDispatcher();
+ btCollisionDispatcher* dispatcher = new btCollisionDispatcher();
ParallelIslandDispatcher* dispatcher2 = new ParallelIslandDispatcher();
- SimdVector3 worldAabbMin(-30000,-30000,-30000);
- SimdVector3 worldAabbMax(30000,30000,30000);
+ btVector3 worldAabbMin(-30000,-30000,-30000);
+ btVector3 worldAabbMax(30000,30000,30000);
- OverlappingPairCache* broadphase = new AxisSweep3(worldAabbMin,worldAabbMax,maxProxies);
- //OverlappingPairCache* broadphase = new SimpleBroadphase(maxProxies,maxOverlap);
+ btOverlappingPairCache* broadphase = new btAxisSweep3(worldAabbMin,worldAabbMax,maxProxies);
+ //OverlappingPairCache* broadphase = new btSimpleBroadphase(maxProxies,maxOverlap);
#ifdef USE_PARALLEL_DISPATCHER
m_physicsEnvironmentPtr = new ParallelPhysicsEnvironment(dispatcher2,broadphase);
@@ -125,7 +125,7 @@ void VehicleDemo::setupPhysics()
m_physicsEnvironmentPtr->setGravity(0,-10,0);//0,0);//-10,0);
int i;
- CollisionShape* groundShape = new BoxShape(SimdVector3(50,3,50));
+ btCollisionShape* groundShape = new btBoxShape(btVector3(50,3,50));
#define USE_TRIMESH_GROUND 1
#ifdef USE_TRIMESH_GROUND
@@ -134,7 +134,7 @@ void VehicleDemo::setupPhysics()
const float TRIANGLE_SIZE=20.f;
//create a triangle-mesh ground
- int vertStride = sizeof(SimdVector3);
+ int vertStride = sizeof(btVector3);
int indexStride = 3*sizeof(int);
const int NUM_VERTS_X = 50;
@@ -143,7 +143,7 @@ const float TRIANGLE_SIZE=20.f;
const int totalTriangles = 2*(NUM_VERTS_X-1)*(NUM_VERTS_Y-1);
- SimdVector3* gVertices = new SimdVector3[totalVerts];
+ btVector3* gVertices = new btVector3[totalVerts];
int* gIndices = new int[totalTriangles*3];
@@ -171,25 +171,25 @@ const float TRIANGLE_SIZE=20.f;
}
}
- TriangleIndexVertexArray* indexVertexArrays = new TriangleIndexVertexArray(totalTriangles,
+ btTriangleIndexVertexArray* indexVertexArrays = new btTriangleIndexVertexArray(totalTriangles,
gIndices,
indexStride,
totalVerts,(float*) &gVertices[0].x(),vertStride);
- groundShape = new BvhTriangleMeshShape(indexVertexArrays);
+ groundShape = new btBvhTriangleMeshShape(indexVertexArrays);
#endif //
- SimdTransform tr;
+ btTransform tr;
tr.setIdentity();
- tr.setOrigin(SimdVector3(0,-20.f,0));
+ tr.setOrigin(btVector3(0,-20.f,0));
//create ground object
LocalCreatePhysicsObject(false,0,tr,groundShape);
- CollisionShape* chassisShape = new BoxShape(SimdVector3(1.f,0.5f,2.f));
- tr.setOrigin(SimdVector3(0,0.f,0));
+ btCollisionShape* chassisShape = new btBoxShape(btVector3(1.f,0.5f,2.f));
+ tr.setOrigin(btVector3(0,0.f,0));
m_carChassis = LocalCreatePhysicsObject(true,800,tr,chassisShape);
@@ -212,8 +212,8 @@ const float TRIANGLE_SIZE=20.f;
gVehicleConstraint = m_physicsEnvironmentPtr->getVehicleConstraint(constraintId);
- SimdVector3 connectionPointCS0(CUBE_HALF_EXTENTS-(0.3*wheelWidth),0,2*CUBE_HALF_EXTENTS-wheelRadius);
- RaycastVehicle::VehicleTuning tuning;
+ btVector3 connectionPointCS0(CUBE_HALF_EXTENTS-(0.3*wheelWidth),0,2*CUBE_HALF_EXTENTS-wheelRadius);
+ btRaycastVehicle::btVehicleTuning tuning;
bool isFrontWheel=true;
int rightIndex = 0;
int upIndex = 1;
@@ -225,18 +225,18 @@ const float TRIANGLE_SIZE=20.f;
(PHY__Vector3&)connectionPointCS0,
(PHY__Vector3&)wheelDirectionCS0,(PHY__Vector3&)wheelAxleCS,suspensionRestLength,wheelRadius,isFrontWheel);
- connectionPointCS0 = SimdVector3(-CUBE_HALF_EXTENTS+(0.3*wheelWidth),0,2*CUBE_HALF_EXTENTS-wheelRadius);
+ connectionPointCS0 = btVector3(-CUBE_HALF_EXTENTS+(0.3*wheelWidth),0,2*CUBE_HALF_EXTENTS-wheelRadius);
gVehicleConstraint->AddWheel(&wheelMotionState[1],
(PHY__Vector3&)connectionPointCS0,
(PHY__Vector3&)wheelDirectionCS0,(PHY__Vector3&)wheelAxleCS,suspensionRestLength,wheelRadius,isFrontWheel);
- connectionPointCS0 = SimdVector3(-CUBE_HALF_EXTENTS+(0.3*wheelWidth),0,-2*CUBE_HALF_EXTENTS+wheelRadius);
+ connectionPointCS0 = btVector3(-CUBE_HALF_EXTENTS+(0.3*wheelWidth),0,-2*CUBE_HALF_EXTENTS+wheelRadius);
isFrontWheel = false;
gVehicleConstraint->AddWheel(&wheelMotionState[2],
(PHY__Vector3&)connectionPointCS0,
(PHY__Vector3&)wheelDirectionCS0,(PHY__Vector3&)wheelAxleCS,suspensionRestLength,wheelRadius,isFrontWheel);
- connectionPointCS0 = SimdVector3(CUBE_HALF_EXTENTS-(0.3*wheelWidth),0,-2*CUBE_HALF_EXTENTS+wheelRadius);
+ connectionPointCS0 = btVector3(CUBE_HALF_EXTENTS-(0.3*wheelWidth),0,-2*CUBE_HALF_EXTENTS+wheelRadius);
gVehicleConstraint->AddWheel(&wheelMotionState[3],
(PHY__Vector3&)connectionPointCS0,
(PHY__Vector3&)wheelDirectionCS0,(PHY__Vector3&)wheelAxleCS,suspensionRestLength,wheelRadius,isFrontWheel);
@@ -281,8 +281,8 @@ void VehicleDemo::renderme()
float m[16];
int i;
- CylinderShapeX wheelShape(SimdVector3(wheelWidth,wheelRadius,wheelRadius));
- SimdVector3 wheelColor(1,0,0);
+ btCylinderShapeX wheelShape(btVector3(wheelWidth,wheelRadius,wheelRadius));
+ btVector3 wheelColor(1,0,0);
for (i=0;i<4;i++)
{
@@ -319,14 +319,14 @@ void VehicleDemo::clientMoveAndDisplay()
#ifdef USE_QUICKPROF
- Profiler::beginBlock("render");
+ btProfiler::beginBlock("render");
#endif //USE_QUICKPROF
renderme();
#ifdef USE_QUICKPROF
- Profiler::endBlock("render");
+ btProfiler::endBlock("render");
#endif
glFlush();
glutSwapBuffers();
@@ -420,7 +420,7 @@ void VehicleDemo::updateCamera()
//interpolate the camera height
m_cameraPosition[1] = (15.0*m_cameraPosition[1] + m_cameraTargetPosition[1] + m_cameraHeight)/16.0;
- SimdVector3 camToObject = m_cameraTargetPosition - m_cameraPosition;
+ btVector3 camToObject = m_cameraTargetPosition - m_cameraPosition;
//keep distance between min and max distance
float cameraDistance = camToObject.length();