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.
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
SimdVector3 GetRayTo(int x,int y);
|
||||
btVector3 GetRayTo(int x,int y);
|
||||
|
||||
CcdPhysicsController* LocalCreatePhysicsObject(bool isDynamic, float mass, const SimdTransform& startTransform,CollisionShape* shape);
|
||||
CcdPhysicsController* LocalCreatePhysicsObject(bool isDynamic, float mass, const btTransform& startTransform,btCollisionShape* shape);
|
||||
|
||||
btRigidBody* LocalCreateRigidBody(bool isDynamic, float mass, const btTransform& startTransform,btCollisionShape* shape);
|
||||
|
||||
///callback methods by glut
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user