add .bullet loader for GPU demo
This commit is contained in:
28
demo/donttouch/Bullet2GpuDemo.cpp
Normal file
28
demo/donttouch/Bullet2GpuDemo.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "Bullet2GpuDemo.h"
|
||||
#include "../btGpuDynamicsWorld.h"
|
||||
#include "GpuRigidBodyDemoInternalData.h"
|
||||
#include "BulletCollision/CollisionShapes/btBoxShape.h"
|
||||
#include "gpu_rigidbody/host/btRigidBody.h"
|
||||
|
||||
void Bullet2GpuDemo::setupScene(const ConstructionInfo& ci)
|
||||
{
|
||||
|
||||
// m_data->m_np = np;
|
||||
// m_data->m_bp = bp;
|
||||
// m_data->m_rigidBodyPipeline
|
||||
m_gpuDynamicsWorld = new btGpuDynamicsWorld(m_data->m_bp,m_data->m_np,m_data->m_rigidBodyPipeline);
|
||||
|
||||
btVector3 halfExtents(100,1,100);
|
||||
btBoxShape* boxShape = new btBoxShape(halfExtents);
|
||||
btVector3 localInertia;
|
||||
btScalar mass=1.f;
|
||||
boxShape->calculateLocalInertia(mass,localInertia);
|
||||
btRigidBody* body = new btRigidBody(mass,0,boxShape,localInertia);
|
||||
m_gpuDynamicsWorld->addRigidBody(body);
|
||||
}
|
||||
|
||||
void Bullet2GpuDemo::destroyScene()
|
||||
{
|
||||
delete m_gpuDynamicsWorld;
|
||||
m_gpuDynamicsWorld = 0;
|
||||
}
|
||||
31
demo/donttouch/Bullet2GpuDemo.h
Normal file
31
demo/donttouch/Bullet2GpuDemo.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef BULLET2_GPU_DEMO_H
|
||||
#define BULLET2_GPU_DEMO_H
|
||||
|
||||
#include "GpuRigidBodyDemo.h"
|
||||
|
||||
class Bullet2GpuDemo : public GpuRigidBodyDemo
|
||||
{
|
||||
protected:
|
||||
|
||||
class btGpuDynamicsWorld* m_gpuDynamicsWorld;
|
||||
|
||||
public:
|
||||
|
||||
Bullet2GpuDemo(){}
|
||||
virtual ~Bullet2GpuDemo(){}
|
||||
virtual const char* getName()
|
||||
{
|
||||
return "Bullet2Gpu";
|
||||
}
|
||||
|
||||
static GpuDemo* MyCreateFunc()
|
||||
{
|
||||
GpuDemo* demo = new Bullet2GpuDemo;
|
||||
return demo;
|
||||
}
|
||||
|
||||
virtual void setupScene(const ConstructionInfo& ci);
|
||||
virtual void destroyScene();
|
||||
};
|
||||
#endif //BULLET2_GPU_DEMO_H
|
||||
|
||||
Reference in New Issue
Block a user