Merge branch 'master' of https://github.com/erwincoumans/bullet3
This commit is contained in:
@@ -268,7 +268,8 @@ void b3PosixThreadSupport::stopThreads()
|
|||||||
for(size_t t=0; t < size_t(m_activeThreadStatus.size()); ++t)
|
for(size_t t=0; t < size_t(m_activeThreadStatus.size()); ++t)
|
||||||
{
|
{
|
||||||
b3ThreadStatus& spuStatus = m_activeThreadStatus[t];
|
b3ThreadStatus& spuStatus = m_activeThreadStatus[t];
|
||||||
printf("%s: Thread %i used: %ld\n", __FUNCTION__, int(t), spuStatus.threadUsed);
|
|
||||||
|
// printf("%s: Thread %i used: %ld\n", __FUNCTION__, int(t), spuStatus.threadUsed);
|
||||||
|
|
||||||
spuStatus.m_userPtr = 0;
|
spuStatus.m_userPtr = 0;
|
||||||
checkPThreadFunction(sem_post(spuStatus.startSemaphore));
|
checkPThreadFunction(sem_post(spuStatus.startSemaphore));
|
||||||
|
|||||||
@@ -201,7 +201,8 @@ struct MotionArgs
|
|||||||
{
|
{
|
||||||
m_vrControllerEvents[i].m_buttons[b]=0;
|
m_vrControllerEvents[i].m_buttons[b]=0;
|
||||||
}
|
}
|
||||||
|
m_vrControllerPos[i].setValue(0,0,0);
|
||||||
|
m_vrControllerOrn[i].setValue(0,0,0,1);
|
||||||
m_isVrControllerPicking[i] = false;
|
m_isVrControllerPicking[i] = false;
|
||||||
m_isVrControllerDragging[i] = false;
|
m_isVrControllerDragging[i] = false;
|
||||||
m_isVrControllerReleasing[i] = false;
|
m_isVrControllerReleasing[i] = false;
|
||||||
@@ -259,6 +260,8 @@ void MotionThreadFunc(void* userPtr,void* lsMemory)
|
|||||||
if (init)
|
if (init)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
unsigned int cachedSharedParam = eMotionIsInitialized;
|
||||||
|
|
||||||
args->m_cs->lock();
|
args->m_cs->lock();
|
||||||
args->m_cs->setSharedParam(0,eMotionIsInitialized);
|
args->m_cs->setSharedParam(0,eMotionIsInitialized);
|
||||||
args->m_cs->unlock();
|
args->m_cs->unlock();
|
||||||
@@ -268,6 +271,8 @@ void MotionThreadFunc(void* userPtr,void* lsMemory)
|
|||||||
int numCmdSinceSleep1ms = 0;
|
int numCmdSinceSleep1ms = 0;
|
||||||
unsigned long long int prevTime = clock.getTimeMicroseconds();
|
unsigned long long int prevTime = clock.getTimeMicroseconds();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@@ -467,7 +472,11 @@ void MotionThreadFunc(void* userPtr,void* lsMemory)
|
|||||||
numCmdSinceSleep1ms++;
|
numCmdSinceSleep1ms++;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (args->m_cs->getSharedParam(0)!=eRequestTerminateMotion);
|
args->m_cs->lock();
|
||||||
|
cachedSharedParam = args->m_cs->getSharedParam(0);
|
||||||
|
args->m_cs->unlock();
|
||||||
|
|
||||||
|
} while (cachedSharedParam!=eRequestTerminateMotion);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
args->m_cs->lock();
|
args->m_cs->lock();
|
||||||
@@ -1747,6 +1756,8 @@ void PhysicsServerExample::initPhysics()
|
|||||||
m_threadSupport = createMotionThreadSupport(MAX_MOTION_NUM_THREADS);
|
m_threadSupport = createMotionThreadSupport(MAX_MOTION_NUM_THREADS);
|
||||||
|
|
||||||
|
|
||||||
|
m_isConnected = m_physicsServer.connectSharedMemory( m_guiHelper);
|
||||||
|
|
||||||
|
|
||||||
for (int i=0;i<m_threadSupport->getNumTasks();i++)
|
for (int i=0;i<m_threadSupport->getNumTasks();i++)
|
||||||
{
|
{
|
||||||
@@ -1765,18 +1776,25 @@ void PhysicsServerExample::initPhysics()
|
|||||||
m_args[w].m_cs2 = m_threadSupport->createCriticalSection();
|
m_args[w].m_cs2 = m_threadSupport->createCriticalSection();
|
||||||
m_args[w].m_cs3 = m_threadSupport->createCriticalSection();
|
m_args[w].m_cs3 = m_threadSupport->createCriticalSection();
|
||||||
m_args[w].m_csGUI = m_threadSupport->createCriticalSection();
|
m_args[w].m_csGUI = m_threadSupport->createCriticalSection();
|
||||||
|
m_args[w].m_cs->lock();
|
||||||
m_args[w].m_cs->setSharedParam(0,eMotionIsUnInitialized);
|
m_args[w].m_cs->setSharedParam(0,eMotionIsUnInitialized);
|
||||||
|
m_args[w].m_cs->unlock();
|
||||||
int numMoving = 0;
|
int numMoving = 0;
|
||||||
m_args[w].m_positions.resize(numMoving);
|
m_args[w].m_positions.resize(numMoving);
|
||||||
m_args[w].m_physicsServerPtr = &m_physicsServer;
|
m_args[w].m_physicsServerPtr = &m_physicsServer;
|
||||||
//int index = 0;
|
//int index = 0;
|
||||||
|
|
||||||
m_threadSupport->runTask(B3_THREAD_SCHEDULE_TASK, (void*) &this->m_args[w], w);
|
m_threadSupport->runTask(B3_THREAD_SCHEDULE_TASK, (void*) &this->m_args[w], w);
|
||||||
|
bool isUninitialized = true;
|
||||||
|
|
||||||
while (m_args[w].m_cs->getSharedParam(0)==eMotionIsUnInitialized)
|
while (isUninitialized)
|
||||||
{
|
{
|
||||||
|
m_args[w].m_cs->lock();
|
||||||
|
isUninitialized = (m_args[w].m_cs->getSharedParam(0)==eMotionIsUnInitialized);
|
||||||
|
m_args[w].m_cs->unlock();
|
||||||
|
#ifdef _WIN32
|
||||||
b3Clock::usleep(1000);
|
b3Clock::usleep(1000);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1789,8 +1807,6 @@ void PhysicsServerExample::initPhysics()
|
|||||||
m_args[0].m_cs2->lock();
|
m_args[0].m_cs2->lock();
|
||||||
|
|
||||||
|
|
||||||
m_isConnected = m_physicsServer.connectSharedMemory( m_guiHelper);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -331,6 +331,22 @@ int MultiBodyTree::finalize() {
|
|||||||
rigid_body.m_parent_pos_parent_body_ref = joint.m_parent_pos_parent_child_ref;
|
rigid_body.m_parent_pos_parent_body_ref = joint.m_parent_pos_parent_child_ref;
|
||||||
rigid_body.m_joint_type = joint.m_type;
|
rigid_body.m_joint_type = joint.m_type;
|
||||||
|
|
||||||
|
int user_int;
|
||||||
|
if (-1 == m_init_cache->getUserInt(index, &user_int)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (-1 == m_impl->setUserInt(index, user_int)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* user_ptr;
|
||||||
|
if (-1 == m_init_cache->getUserPtr(index, &user_ptr)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (-1 == m_impl->setUserPtr(index, user_ptr)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Set joint Jacobians. Note that the dimension is always 3x1 here to avoid variable sized
|
// Set joint Jacobians. Note that the dimension is always 3x1 here to avoid variable sized
|
||||||
// matrices.
|
// matrices.
|
||||||
switch (rigid_body.m_joint_type) {
|
switch (rigid_body.m_joint_type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user