mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-16 06:30:05 +00:00
enable CPU joint (non-contact) constraint solver in GPU rigid body pipeline
small change to BasicGpuDemo
This commit is contained in:
parent
25fe5f4a77
commit
4877a2af8a
@ -15,9 +15,9 @@ subject to the following restrictions:
|
||||
|
||||
|
||||
///create 125 (5x5x5) dynamic object
|
||||
#define ARRAY_SIZE_X 30
|
||||
#define ARRAY_SIZE_X 25
|
||||
#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)
|
||||
#define MAX_PROXIES (ARRAY_SIZE_X*ARRAY_SIZE_Y*ARRAY_SIZE_Z + 1024)
|
||||
@ -164,7 +164,7 @@ void BasicGpuDemo::exitCL()
|
||||
BasicGpuDemo::BasicGpuDemo()
|
||||
{
|
||||
m_clData = new btInternalData;
|
||||
setCameraDistance(btScalar(SCALING*120.));
|
||||
setCameraDistance(btScalar(SCALING*60.));
|
||||
this->setAzi(45);
|
||||
this->setEle(45);
|
||||
|
||||
@ -181,8 +181,8 @@ BasicGpuDemo::~BasicGpuDemo()
|
||||
void BasicGpuDemo::initPhysics()
|
||||
{
|
||||
setTexturing(true);
|
||||
setShadows(true);
|
||||
|
||||
setShadows(false);//too slow with many objects
|
||||
|
||||
|
||||
///collision configuration contains default setup for memory, collision setup
|
||||
m_collisionConfiguration = 0;
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define B3_RIGIDBODY_UPDATEAABB_PATH "src/Bullet3OpenCL/RigidBody/kernels/updateAabbsKernel.cl"
|
||||
|
||||
bool useDbvt = false;
|
||||
bool useBullet2CpuSolver = false;//false;
|
||||
bool useBullet2CpuSolver = true;
|
||||
bool dumpContactStats = false;
|
||||
|
||||
#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);
|
||||
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;
|
||||
@ -210,7 +211,6 @@ void b3GpuRigidBodyPipeline::stepSimulation(float deltaTime)
|
||||
b3AlignedObjectArray<b3Contact4> hostContacts;
|
||||
gpuContacts.copyToHost(hostContacts);
|
||||
{
|
||||
int numJoints = m_data->m_joints.size();
|
||||
b3TypedConstraint** joints = numJoints? &m_data->m_joints[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);
|
||||
|
Loading…
Reference in New Issue
Block a user