enable CPU joint (non-contact) constraint solver in GPU rigid body pipeline
small change to BasicGpuDemo
This commit is contained in:
@@ -15,9 +15,9 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
|
|
||||||
///create 125 (5x5x5) dynamic object
|
///create 125 (5x5x5) dynamic object
|
||||||
#define ARRAY_SIZE_X 30
|
#define ARRAY_SIZE_X 25
|
||||||
#define ARRAY_SIZE_Y 20
|
#define ARRAY_SIZE_Y 20
|
||||||
#define ARRAY_SIZE_Z 30
|
#define ARRAY_SIZE_Z 25
|
||||||
|
|
||||||
//maximum number of objects (and allow user to shoot additional boxes)
|
//maximum number of objects (and allow user to shoot additional boxes)
|
||||||
#define MAX_PROXIES (ARRAY_SIZE_X*ARRAY_SIZE_Y*ARRAY_SIZE_Z + 1024)
|
#define MAX_PROXIES (ARRAY_SIZE_X*ARRAY_SIZE_Y*ARRAY_SIZE_Z + 1024)
|
||||||
@@ -164,7 +164,7 @@ void BasicGpuDemo::exitCL()
|
|||||||
BasicGpuDemo::BasicGpuDemo()
|
BasicGpuDemo::BasicGpuDemo()
|
||||||
{
|
{
|
||||||
m_clData = new btInternalData;
|
m_clData = new btInternalData;
|
||||||
setCameraDistance(btScalar(SCALING*120.));
|
setCameraDistance(btScalar(SCALING*60.));
|
||||||
this->setAzi(45);
|
this->setAzi(45);
|
||||||
this->setEle(45);
|
this->setEle(45);
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ BasicGpuDemo::~BasicGpuDemo()
|
|||||||
void BasicGpuDemo::initPhysics()
|
void BasicGpuDemo::initPhysics()
|
||||||
{
|
{
|
||||||
setTexturing(true);
|
setTexturing(true);
|
||||||
setShadows(true);
|
setShadows(false);//too slow with many objects
|
||||||
|
|
||||||
|
|
||||||
///collision configuration contains default setup for memory, collision setup
|
///collision configuration contains default setup for memory, collision setup
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#define B3_RIGIDBODY_UPDATEAABB_PATH "src/Bullet3OpenCL/RigidBody/kernels/updateAabbsKernel.cl"
|
#define B3_RIGIDBODY_UPDATEAABB_PATH "src/Bullet3OpenCL/RigidBody/kernels/updateAabbsKernel.cl"
|
||||||
|
|
||||||
bool useDbvt = false;
|
bool useDbvt = false;
|
||||||
bool useBullet2CpuSolver = false;//false;
|
bool useBullet2CpuSolver = true;
|
||||||
bool dumpContactStats = false;
|
bool dumpContactStats = false;
|
||||||
|
|
||||||
#ifdef TEST_OTHER_GPU_SOLVER
|
#ifdef TEST_OTHER_GPU_SOLVER
|
||||||
@@ -200,7 +200,8 @@ void b3GpuRigidBodyPipeline::stepSimulation(float deltaTime)
|
|||||||
b3OpenCLArray<b3Contact4> gpuContacts(m_data->m_context,m_data->m_queue,0,true);
|
b3OpenCLArray<b3Contact4> gpuContacts(m_data->m_context,m_data->m_queue,0,true);
|
||||||
gpuContacts.setFromOpenCLBuffer(m_data->m_narrowphase->getContactsGpu(),m_data->m_narrowphase->getNumContactsGpu());
|
gpuContacts.setFromOpenCLBuffer(m_data->m_narrowphase->getContactsGpu(),m_data->m_narrowphase->getNumContactsGpu());
|
||||||
|
|
||||||
if (useBullet2CpuSolver)
|
int numJoints = m_data->m_joints.size();
|
||||||
|
if (useBullet2CpuSolver && numJoints)
|
||||||
{
|
{
|
||||||
|
|
||||||
b3AlignedObjectArray<b3RigidBodyCL> hostBodies;
|
b3AlignedObjectArray<b3RigidBodyCL> hostBodies;
|
||||||
@@ -210,7 +211,6 @@ void b3GpuRigidBodyPipeline::stepSimulation(float deltaTime)
|
|||||||
b3AlignedObjectArray<b3Contact4> hostContacts;
|
b3AlignedObjectArray<b3Contact4> hostContacts;
|
||||||
gpuContacts.copyToHost(hostContacts);
|
gpuContacts.copyToHost(hostContacts);
|
||||||
{
|
{
|
||||||
int numJoints = m_data->m_joints.size();
|
|
||||||
b3TypedConstraint** joints = numJoints? &m_data->m_joints[0] : 0;
|
b3TypedConstraint** joints = numJoints? &m_data->m_joints[0] : 0;
|
||||||
b3Contact4* contacts = numContacts? &hostContacts[0]: 0;
|
b3Contact4* contacts = numContacts? &hostContacts[0]: 0;
|
||||||
// m_data->m_solver->solveContacts(m_data->m_narrowphase->getNumBodiesGpu(),&hostBodies[0],&hostInertias[0],numContacts,contacts,numJoints, joints);
|
// m_data->m_solver->solveContacts(m_data->m_narrowphase->getNumBodiesGpu(),&hostBodies[0],&hostInertias[0],numContacts,contacts,numJoints, joints);
|
||||||
|
|||||||
Reference in New Issue
Block a user