refactor to allow various gfx backends (work-in-progress)
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
|
||||
static const float scaling=0.35f;
|
||||
|
||||
BasicDemo::BasicDemo(SimpleOpenGL3App* app, CommonPhysicsSetup* physicsSetup)
|
||||
BasicDemo::BasicDemo(CommonGraphicsApp* app, CommonPhysicsSetup* physicsSetup)
|
||||
:Bullet2RigidBodyDemo(app,physicsSetup)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ class BasicDemo : public Bullet2RigidBodyDemo
|
||||
|
||||
public:
|
||||
|
||||
static BulletDemoInterface* MyCreateFunc(SimpleOpenGL3App* app)
|
||||
static BulletDemoInterface* MyCreateFunc(CommonGraphicsApp* app)
|
||||
{
|
||||
CommonPhysicsSetup* physicsSetup = new BasicDemoPhysicsSetup();
|
||||
return new BasicDemo(app, physicsSetup);
|
||||
}
|
||||
|
||||
BasicDemo(SimpleOpenGL3App* app, CommonPhysicsSetup* physicsSetup);
|
||||
BasicDemo(CommonGraphicsApp* app, CommonPhysicsSetup* physicsSetup);
|
||||
virtual ~BasicDemo();
|
||||
|
||||
void createGround(int cubeShapeId);
|
||||
|
||||
@@ -19,35 +19,35 @@ class HingeDemo : public BasicDemo
|
||||
int m_hingeMethod;
|
||||
|
||||
public:
|
||||
static BulletDemoInterface* FeatherstoneCreateFunc(SimpleOpenGL3App* app)
|
||||
static BulletDemoInterface* FeatherstoneCreateFunc(CommonGraphicsApp* app)
|
||||
{
|
||||
return new HingeDemo(app, FEATHERSTONE_HINGE);
|
||||
}
|
||||
static BulletDemoInterface* DantzigCreateFunc(SimpleOpenGL3App* app)
|
||||
static BulletDemoInterface* DantzigCreateFunc(CommonGraphicsApp* app)
|
||||
{
|
||||
return new HingeDemo(app, DANTZIG_HINGE);
|
||||
}
|
||||
static BulletDemoInterface* LemkeCreateFunc(SimpleOpenGL3App* app)
|
||||
static BulletDemoInterface* LemkeCreateFunc(CommonGraphicsApp* app)
|
||||
{
|
||||
return new HingeDemo(app, LEMKE_HINGE);
|
||||
}
|
||||
static BulletDemoInterface* PGSCreateFunc(SimpleOpenGL3App* app)
|
||||
static BulletDemoInterface* PGSCreateFunc(CommonGraphicsApp* app)
|
||||
{
|
||||
return new HingeDemo(app, PGS_HINGE);
|
||||
}
|
||||
|
||||
static BulletDemoInterface* SICreateFunc(SimpleOpenGL3App* app)
|
||||
static BulletDemoInterface* SICreateFunc(CommonGraphicsApp* app)
|
||||
{
|
||||
return new HingeDemo(app, SI_HINGE);
|
||||
}
|
||||
|
||||
|
||||
static BulletDemoInterface* InertiaCreateFunc(SimpleOpenGL3App* app)
|
||||
static BulletDemoInterface* InertiaCreateFunc(CommonGraphicsApp* app)
|
||||
{
|
||||
return new HingeDemo(app, INERTIA_HINGE);
|
||||
}
|
||||
|
||||
HingeDemo(SimpleOpenGL3App* app, HINGE_CREATION_METHOD hingeMethod);
|
||||
HingeDemo(CommonGraphicsApp* app, HINGE_CREATION_METHOD hingeMethod);
|
||||
|
||||
class btMultiBody* createFeatherstoneHinge(class btMultiBodyDynamicsWorld* world, const struct btMultiBodySettings2& settings);
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@ class ChainDemo : public Bullet2RigidBodyDemo
|
||||
|
||||
public:
|
||||
|
||||
static BulletDemoInterface* MyCreateFunc(SimpleOpenGL3App* app)
|
||||
static BulletDemoInterface* MyCreateFunc(CommonGraphicsApp* app)
|
||||
{
|
||||
return new ChainDemo(app);
|
||||
}
|
||||
|
||||
ChainDemo(SimpleOpenGL3App* app);
|
||||
ChainDemo(CommonGraphicsApp* app);
|
||||
virtual ~ChainDemo();
|
||||
|
||||
void createGround(int cubeShapeId);
|
||||
|
||||
@@ -48,7 +48,7 @@ static btVector4 colors[4] =
|
||||
|
||||
|
||||
|
||||
Bullet2MultiBodyDemo::Bullet2MultiBodyDemo(SimpleOpenGL3App* app)
|
||||
Bullet2MultiBodyDemo::Bullet2MultiBodyDemo(CommonGraphicsApp* app)
|
||||
:m_glApp(app),
|
||||
m_pickedBody(0),
|
||||
m_pickedConstraint(0),
|
||||
@@ -97,7 +97,7 @@ Bullet2MultiBodyDemo::~Bullet2MultiBodyDemo()
|
||||
|
||||
btVector3 Bullet2MultiBodyDemo::getRayTo(int x,int y)
|
||||
{
|
||||
if (!m_glApp->m_instancingRenderer)
|
||||
if (!m_glApp->m_renderer)
|
||||
{
|
||||
btAssert(0);
|
||||
return btVector3(0,0,0);
|
||||
@@ -110,8 +110,8 @@ btVector3 Bullet2MultiBodyDemo::getRayTo(int x,int y)
|
||||
float fov = b3Scalar(2.0) * b3Atan(tanFov);
|
||||
|
||||
btVector3 camPos,camTarget;
|
||||
m_glApp->m_instancingRenderer->getCameraPosition(camPos);
|
||||
m_glApp->m_instancingRenderer->getCameraTargetPosition(camTarget);
|
||||
m_glApp->m_renderer->getCameraPosition(camPos);
|
||||
m_glApp->m_renderer->getCameraTargetPosition(camTarget);
|
||||
|
||||
btVector3 rayFrom = camPos;
|
||||
btVector3 rayForward = (camTarget-camPos);
|
||||
@@ -136,8 +136,8 @@ btVector3 Bullet2MultiBodyDemo::getRayTo(int x,int y)
|
||||
vertical *= 2.f * farPlane * tanfov;
|
||||
|
||||
b3Scalar aspect;
|
||||
float width = m_glApp->m_instancingRenderer->getScreenWidth();
|
||||
float height = m_glApp->m_instancingRenderer->getScreenHeight();
|
||||
float width = m_glApp->m_renderer->getScreenWidth();
|
||||
float height = m_glApp->m_renderer->getScreenHeight();
|
||||
|
||||
aspect = width / height;
|
||||
|
||||
@@ -171,7 +171,7 @@ bool Bullet2MultiBodyDemo::mouseMoveCallback(float x,float y)
|
||||
btVector3 rayFrom;
|
||||
// btVector3 oldPivotInB = pickCon->getPivotInB();
|
||||
btVector3 newPivotB;
|
||||
m_glApp->m_instancingRenderer->getCameraPosition(rayFrom);
|
||||
m_glApp->m_renderer->getCameraPosition(rayFrom);
|
||||
btVector3 dir = newRayTo-rayFrom;
|
||||
dir.normalize();
|
||||
dir *= m_oldPickingDist;
|
||||
@@ -189,7 +189,7 @@ bool Bullet2MultiBodyDemo::mouseMoveCallback(float x,float y)
|
||||
// btVector3 oldPivotInB = m_pickingMultiBodyPoint2Point->getPivotInB();
|
||||
btVector3 newPivotB;
|
||||
btVector3 camPos;
|
||||
m_glApp->m_instancingRenderer->getCameraPosition(camPos);
|
||||
m_glApp->m_renderer->getCameraPosition(camPos);
|
||||
rayFrom = camPos;
|
||||
btVector3 dir = newRayTo-rayFrom;
|
||||
dir.normalize();
|
||||
@@ -210,7 +210,7 @@ bool Bullet2MultiBodyDemo::mouseButtonCallback(int button, int state, float x, f
|
||||
if(button==0)// && (m_data->m_altPressed==0 && m_data->m_controlPressed==0))
|
||||
{
|
||||
btVector3 camPos;
|
||||
m_glApp->m_instancingRenderer->getCameraPosition(camPos);
|
||||
m_glApp->m_renderer->getCameraPosition(camPos);
|
||||
|
||||
btVector3 rayFrom = camPos;
|
||||
btVector3 rayTo = getRayTo(x,y);
|
||||
@@ -314,7 +314,7 @@ bool Bullet2MultiBodyDemo::mouseButtonCallback(int button, int state, float x, f
|
||||
|
||||
|
||||
|
||||
FeatherstoneDemo1::FeatherstoneDemo1(SimpleOpenGL3App* app)
|
||||
FeatherstoneDemo1::FeatherstoneDemo1(CommonGraphicsApp* app)
|
||||
:Bullet2MultiBodyDemo(app)
|
||||
{
|
||||
}
|
||||
@@ -329,7 +329,7 @@ btMultiBody* FeatherstoneDemo1::createFeatherstoneMultiBody(class btMultiBodyDyn
|
||||
int curColor=0;
|
||||
|
||||
|
||||
int cubeShapeId = m_glApp->registerCubeShape();
|
||||
int cubeShapeId = m_glApp->registerCubeShape(1,1,1);
|
||||
|
||||
int n_links = settings.m_numLinks;
|
||||
float mass = 13.5*scaling;
|
||||
@@ -458,7 +458,7 @@ btMultiBody* FeatherstoneDemo1::createFeatherstoneMultiBody(class btMultiBodyDyn
|
||||
btVector4 color = colors[curColor++];
|
||||
curColor&=3;
|
||||
|
||||
int index = m_glApp->m_instancingRenderer->registerGraphicsInstance(cubeShapeId,tr.getOrigin(),tr.getRotation(),color,halfExtents);
|
||||
int index = m_glApp->m_renderer->registerGraphicsInstance(cubeShapeId,tr.getOrigin(),tr.getRotation(),color,halfExtents);
|
||||
col->setUserIndex(index);
|
||||
|
||||
|
||||
@@ -503,7 +503,7 @@ btMultiBody* FeatherstoneDemo1::createFeatherstoneMultiBody(class btMultiBodyDyn
|
||||
btVector4 color = colors[curColor++];
|
||||
curColor&=3;
|
||||
|
||||
int index = m_glApp->m_instancingRenderer->registerGraphicsInstance(cubeShapeId,tr.getOrigin(),tr.getRotation(),color,halfExtents);
|
||||
int index = m_glApp->m_renderer->registerGraphicsInstance(cubeShapeId,tr.getOrigin(),tr.getRotation(),color,halfExtents);
|
||||
col->setUserIndex(index);
|
||||
|
||||
|
||||
@@ -530,7 +530,7 @@ void FeatherstoneDemo1::addBoxes_testMultiDof()
|
||||
void FeatherstoneDemo1::createGround()
|
||||
{
|
||||
//create ground
|
||||
int cubeShapeId = m_glApp->registerCubeShape();
|
||||
int cubeShapeId = m_glApp->registerCubeShape(1,1,1);
|
||||
//float pos[]={0,0,0};
|
||||
//float orn[]={0,0,0,1};
|
||||
|
||||
@@ -555,7 +555,7 @@ void FeatherstoneDemo1::createGround()
|
||||
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,groundShape,localInertia);
|
||||
btRigidBody* body = new btRigidBody(rbInfo);
|
||||
|
||||
int index = m_glApp->m_instancingRenderer->registerGraphicsInstance(cubeShapeId,groundTransform.getOrigin(),groundTransform.getRotation(),color,halfExtents);
|
||||
int index = m_glApp->m_renderer->registerGraphicsInstance(cubeShapeId,groundTransform.getOrigin(),groundTransform.getRotation(),color,halfExtents);
|
||||
body ->setUserIndex(index);
|
||||
|
||||
//add the body to the dynamics world
|
||||
@@ -579,7 +579,7 @@ void FeatherstoneDemo1::initPhysics()
|
||||
createFeatherstoneMultiBody(m_dynamicsWorld,settings);
|
||||
|
||||
|
||||
m_glApp->m_instancingRenderer->writeTransforms();
|
||||
m_glApp->m_renderer->writeTransforms();
|
||||
}
|
||||
|
||||
|
||||
@@ -602,13 +602,13 @@ void FeatherstoneDemo1::renderScene()
|
||||
int index = col->getUserIndex();
|
||||
if (index>=0)
|
||||
{
|
||||
m_glApp->m_instancingRenderer->writeSingleInstanceTransformToCPU(pos,orn,index);
|
||||
m_glApp->m_renderer->writeSingleInstanceTransformToCPU(pos,orn,index);
|
||||
}
|
||||
}
|
||||
m_glApp->m_instancingRenderer->writeTransforms();
|
||||
m_glApp->m_renderer->writeTransforms();
|
||||
}
|
||||
|
||||
m_glApp->m_instancingRenderer->renderScene();
|
||||
m_glApp->m_renderer->renderScene();
|
||||
}
|
||||
|
||||
void FeatherstoneDemo1::physicsDebugDraw()
|
||||
@@ -646,7 +646,7 @@ void FeatherstoneDemo1::stepSimulation(float deltaTime)
|
||||
|
||||
|
||||
|
||||
FeatherstoneDemo2::FeatherstoneDemo2(SimpleOpenGL3App* app)
|
||||
FeatherstoneDemo2::FeatherstoneDemo2(CommonGraphicsApp* app)
|
||||
:FeatherstoneDemo1(app)
|
||||
{
|
||||
}
|
||||
@@ -1032,7 +1032,7 @@ void FeatherstoneDemo2::initPhysics()
|
||||
//RagDoll2* doll = new RagDoll2(m_dynamicsWorld,offset,m_glApp);
|
||||
|
||||
|
||||
m_glApp->m_instancingRenderer->writeTransforms();
|
||||
m_glApp->m_renderer->writeTransforms();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class Bullet2MultiBodyDemo : public BulletDemoInterface
|
||||
{
|
||||
protected:
|
||||
|
||||
SimpleOpenGL3App* m_glApp;
|
||||
CommonGraphicsApp* m_glApp;
|
||||
|
||||
class btRigidBody* m_pickedBody;
|
||||
class btTypedConstraint* m_pickedConstraint;
|
||||
@@ -53,7 +53,7 @@ protected:
|
||||
//btAlignedObjectArray<btMultiBodyLinkCollider*> m_linkColliders;
|
||||
|
||||
public:
|
||||
Bullet2MultiBodyDemo(SimpleOpenGL3App* app);
|
||||
Bullet2MultiBodyDemo(CommonGraphicsApp* app);
|
||||
virtual void initPhysics();
|
||||
virtual void exitPhysics();
|
||||
virtual ~Bullet2MultiBodyDemo();
|
||||
@@ -71,11 +71,11 @@ class FeatherstoneDemo1 : public Bullet2MultiBodyDemo
|
||||
|
||||
public:
|
||||
|
||||
FeatherstoneDemo1(SimpleOpenGL3App* app);
|
||||
FeatherstoneDemo1(CommonGraphicsApp* app);
|
||||
virtual ~FeatherstoneDemo1();
|
||||
|
||||
|
||||
static BulletDemoInterface* MyCreateFunc(SimpleOpenGL3App* app)
|
||||
static BulletDemoInterface* MyCreateFunc(CommonGraphicsApp* app)
|
||||
{
|
||||
return new FeatherstoneDemo1(app);
|
||||
}
|
||||
@@ -100,11 +100,11 @@ class FeatherstoneDemo2 : public FeatherstoneDemo1
|
||||
|
||||
public:
|
||||
|
||||
FeatherstoneDemo2(SimpleOpenGL3App* app);
|
||||
FeatherstoneDemo2(CommonGraphicsApp* app);
|
||||
virtual ~FeatherstoneDemo2();
|
||||
|
||||
|
||||
static BulletDemoInterface* MyCreateFunc(SimpleOpenGL3App* app)
|
||||
static BulletDemoInterface* MyCreateFunc(CommonGraphicsApp* app)
|
||||
{
|
||||
return new FeatherstoneDemo2(app);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ static float friction = 1.;
|
||||
|
||||
|
||||
|
||||
MultiDofDemo::MultiDofDemo(SimpleOpenGL3App* app)
|
||||
MultiDofDemo::MultiDofDemo(CommonGraphicsApp* app)
|
||||
:FeatherstoneDemo1(app)
|
||||
{
|
||||
}
|
||||
@@ -75,8 +75,8 @@ void MultiDofDemo::initPhysics()
|
||||
|
||||
if(g_firstInit)
|
||||
{
|
||||
this->m_glApp->m_instancingRenderer->setCameraDistance(btScalar(10.*scaling));
|
||||
this->m_glApp->m_instancingRenderer->setCameraPitch(50);
|
||||
this->m_glApp->m_renderer->setCameraDistance(btScalar(10.*scaling));
|
||||
this->m_glApp->m_renderer->setCameraPitch(50);
|
||||
g_firstInit = false;
|
||||
}
|
||||
///collision configuration contains default setup for memory, collision setup
|
||||
@@ -159,7 +159,7 @@ void MultiDofDemo::initPhysics()
|
||||
///
|
||||
addColliders_testMultiDof(mbC, world, baseHalfExtents, linkHalfExtents);
|
||||
|
||||
int cubeShapeId = m_glApp->registerCubeShape();
|
||||
int cubeShapeId = m_glApp->registerCubeShape(1,1,1);
|
||||
/////////////////////////////////////////////////////////////////
|
||||
btScalar groundHeight = -51.55;
|
||||
if (!multibodyOnly)
|
||||
@@ -183,7 +183,7 @@ void MultiDofDemo::initPhysics()
|
||||
//add the body to the dynamics world
|
||||
m_dynamicsWorld->addRigidBody(body,1,1+2);//,1,1+2);
|
||||
|
||||
int index = m_glApp->m_instancingRenderer->registerGraphicsInstance(cubeShapeId,groundTransform.getOrigin(),groundTransform.getRotation(),btVector4(0,1,0,1),groundHalfExtents);
|
||||
int index = m_glApp->m_renderer->registerGraphicsInstance(cubeShapeId,groundTransform.getOrigin(),groundTransform.getRotation(),btVector4(0,1,0,1),groundHalfExtents);
|
||||
body->setUserIndex(index);
|
||||
|
||||
|
||||
@@ -223,12 +223,12 @@ void MultiDofDemo::initPhysics()
|
||||
|
||||
m_dynamicsWorld->addRigidBody(body);//,1,1+2);
|
||||
|
||||
int index = m_glApp->m_instancingRenderer->registerGraphicsInstance(cubeShapeId,startTransform.getOrigin(),startTransform.getRotation(),btVector4(1,1,0,1),halfExtents);
|
||||
int index = m_glApp->m_renderer->registerGraphicsInstance(cubeShapeId,startTransform.getOrigin(),startTransform.getRotation(),btVector4(1,1,0,1),halfExtents);
|
||||
body->setUserIndex(index);
|
||||
|
||||
}
|
||||
|
||||
m_glApp->m_instancingRenderer->writeTransforms();
|
||||
m_glApp->m_renderer->writeTransforms();
|
||||
/////////////////////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ btMultiBody* MultiDofDemo::createFeatherstoneMultiBody_testMultiDof(btMultiBodyD
|
||||
|
||||
void MultiDofDemo::addColliders_testMultiDof(btMultiBody *pMultiBody, btMultiBodyDynamicsWorld *pWorld, const btVector3 &baseHalfExtents, const btVector3 &linkHalfExtents)
|
||||
{
|
||||
int cubeShapeId = m_glApp->registerCubeShape();
|
||||
int cubeShapeId = m_glApp->registerCubeShape(1,1,1);
|
||||
|
||||
btAlignedObjectArray<btQuaternion> world_to_local;
|
||||
world_to_local.resize(pMultiBody->getNumLinks() + 1);
|
||||
@@ -325,7 +325,7 @@ void MultiDofDemo::addColliders_testMultiDof(btMultiBody *pMultiBody, btMultiBod
|
||||
|
||||
pWorld->addCollisionObject(col, 2,1+2);
|
||||
|
||||
int index = m_glApp->m_instancingRenderer->registerGraphicsInstance(cubeShapeId,tr.getOrigin(),tr.getRotation(),btVector4(0,0,1,1),baseHalfExtents);
|
||||
int index = m_glApp->m_renderer->registerGraphicsInstance(cubeShapeId,tr.getOrigin(),tr.getRotation(),btVector4(0,0,1,1),baseHalfExtents);
|
||||
col->setUserIndex(index);
|
||||
|
||||
|
||||
@@ -363,7 +363,7 @@ void MultiDofDemo::addColliders_testMultiDof(btMultiBody *pMultiBody, btMultiBod
|
||||
col->setWorldTransform(tr);
|
||||
col->setFriction(friction);
|
||||
pWorld->addCollisionObject(col,2,1+2);
|
||||
int index = m_glApp->m_instancingRenderer->registerGraphicsInstance(cubeShapeId,tr.getOrigin(),tr.getRotation(),btVector4(0,0,1,1),linkHalfExtents);
|
||||
int index = m_glApp->m_renderer->registerGraphicsInstance(cubeShapeId,tr.getOrigin(),tr.getRotation(),btVector4(0,0,1,1),linkHalfExtents);
|
||||
col->setUserIndex(index);
|
||||
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ class MultiDofDemo : public FeatherstoneDemo1
|
||||
|
||||
public:
|
||||
|
||||
MultiDofDemo(SimpleOpenGL3App* app);
|
||||
MultiDofDemo(CommonGraphicsApp* app);
|
||||
virtual ~MultiDofDemo();
|
||||
|
||||
|
||||
static BulletDemoInterface* MyCreateFunc(SimpleOpenGL3App* app)
|
||||
static BulletDemoInterface* MyCreateFunc(CommonGraphicsApp* app)
|
||||
{
|
||||
return new MultiDofDemo(app);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ static btVector4 colors[4] =
|
||||
btVector4(1,1,0,1),
|
||||
};
|
||||
|
||||
LuaPhysicsSetup::LuaPhysicsSetup(class SimpleOpenGL3App* app)
|
||||
LuaPhysicsSetup::LuaPhysicsSetup(struct CommonGraphicsApp* app)
|
||||
:m_glApp(app),
|
||||
m_config(0),
|
||||
m_dispatcher(0),
|
||||
@@ -93,7 +93,7 @@ static int gCreateCubeShape(lua_State *L)
|
||||
btCollisionShape* colShape = new btBoxShape(halfExtents);
|
||||
|
||||
CustomShapeData* shapeData = new CustomShapeData();
|
||||
shapeData->m_shapeIndex = sLuaDemo->m_glApp->registerCubeShape();
|
||||
shapeData->m_shapeIndex = sLuaDemo->m_glApp->registerCubeShape(1,1,1);
|
||||
shapeData->m_localScaling = halfExtents;
|
||||
|
||||
colShape->setUserPointer(shapeData);
|
||||
@@ -252,7 +252,7 @@ static int gCreateRigidBody (lua_State *L)
|
||||
if (shapeData)
|
||||
{
|
||||
|
||||
rbd ->m_graphicsInstanceIndex = sLuaDemo->m_glApp->m_instancingRenderer->registerGraphicsInstance(shapeData->m_shapeIndex,startTransform.getOrigin(),startTransform.getRotation(),color,shapeData->m_localScaling);
|
||||
rbd ->m_graphicsInstanceIndex = sLuaDemo->m_glApp->m_renderer->registerGraphicsInstance(shapeData->m_shapeIndex,startTransform.getOrigin(),startTransform.getRotation(),color,shapeData->m_localScaling);
|
||||
body->setUserIndex(rbd->m_graphicsInstanceIndex);
|
||||
}
|
||||
}
|
||||
@@ -389,7 +389,7 @@ void LuaPhysicsSetup::initPhysics(GraphicsPhysicsBridge& gfxBridge)
|
||||
b3Error("Cannot find Lua file%s\n",sLuaFileName);
|
||||
}
|
||||
|
||||
m_glApp->m_instancingRenderer->writeTransforms();
|
||||
m_glApp->m_renderer->writeTransforms();
|
||||
}
|
||||
|
||||
|
||||
@@ -447,10 +447,10 @@ void LuaPhysicsSetup::syncPhysicsToGraphics(GraphicsPhysicsBridge& gfxBridge)
|
||||
int index = colObj->getUserIndex();
|
||||
if (index >= 0)
|
||||
{
|
||||
m_glApp->m_instancingRenderer->writeSingleInstanceTransformToCPU(pos, orn, index);
|
||||
m_glApp->m_renderer->writeSingleInstanceTransformToCPU(pos, orn, index);
|
||||
}
|
||||
}
|
||||
m_glApp->m_instancingRenderer->writeTransforms();
|
||||
m_glApp->m_renderer->writeTransforms();
|
||||
}
|
||||
|
||||
btRigidBody* LuaPhysicsSetup::createRigidBody(float mass, const btTransform& startTransform,btCollisionShape* shape, const btVector4& color)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
struct LuaPhysicsSetup : public CommonPhysicsSetup
|
||||
{
|
||||
|
||||
LuaPhysicsSetup(class SimpleOpenGL3App* app);
|
||||
LuaPhysicsSetup(struct CommonGraphicsApp* app);
|
||||
virtual ~LuaPhysicsSetup();
|
||||
|
||||
class btDefaultCollisionConfiguration* m_config;
|
||||
@@ -17,7 +17,7 @@ struct LuaPhysicsSetup : public CommonPhysicsSetup
|
||||
class btDbvtBroadphase* m_bp;
|
||||
class btNNCGConstraintSolver* m_solver;
|
||||
class btDiscreteDynamicsWorld* m_dynamicsWorld;
|
||||
class SimpleOpenGL3App* m_glApp;
|
||||
struct CommonGraphicsApp* m_glApp;
|
||||
|
||||
virtual void initPhysics(GraphicsPhysicsBridge& gfxBridge);
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
#include "../BasicDemo/BasicDemo.h"
|
||||
|
||||
struct BulletDemoInterface;
|
||||
struct SimpleOpenGL3App;
|
||||
struct CommonGraphicsApp;
|
||||
|
||||
class RagDollSetup : public CommonRigidBodySetup
|
||||
{
|
||||
public:
|
||||
|
||||
static BulletDemoInterface* MyCreateFunc(SimpleOpenGL3App* app)
|
||||
static BulletDemoInterface* MyCreateFunc(CommonGraphicsApp* app)
|
||||
{
|
||||
CommonPhysicsSetup* physicsSetup = new RagDollSetup();
|
||||
return new BasicDemo(app, physicsSetup);
|
||||
|
||||
Reference in New Issue
Block a user