mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-14 05:40:05 +00:00
handle window closing in InProcessPhysicsClientSharedMemoryMainThread
This commit is contained in:
parent
3a8ffebc28
commit
bebe9a728b
@ -5,10 +5,10 @@
|
||||
#include"../ExampleBrowser/InProcessExampleBrowser.h"
|
||||
|
||||
|
||||
|
||||
class InProcessPhysicsClientSharedMemoryMainThread : public PhysicsClientSharedMemory
|
||||
{
|
||||
btInProcessExampleBrowserMainThreadInternalData* m_data;
|
||||
|
||||
public:
|
||||
|
||||
InProcessPhysicsClientSharedMemoryMainThread(int argc, char* argv[])
|
||||
@ -37,8 +37,15 @@ public:
|
||||
// return non-null if there is a status, nullptr otherwise
|
||||
virtual const struct SharedMemoryStatus* processServerStatus()
|
||||
{
|
||||
if (btIsExampleBrowserMainThreadTerminated(m_data))
|
||||
{
|
||||
PhysicsClientSharedMemory::disconnectSharedMemory();
|
||||
}
|
||||
|
||||
btUpdateInProcessExampleBrowserMainThread(m_data);
|
||||
return PhysicsClientSharedMemory::processServerStatus();
|
||||
|
||||
|
||||
}
|
||||
|
||||
virtual bool submitClientCommand(const struct SharedMemoryCommand& command)
|
||||
|
@ -165,11 +165,18 @@ void testSharedMemory(b3PhysicsClientHandle sm)
|
||||
b3SharedMemoryStatusHandle statusHandle;
|
||||
int statusType;
|
||||
|
||||
statusHandle = b3SubmitClientCommandAndWaitStatus(sm, b3InitStepSimulationCommand(sm));
|
||||
statusType = b3GetStatusType(statusHandle);
|
||||
ASSERT_EQ(statusType, CMD_STEP_FORWARD_SIMULATION_COMPLETED);
|
||||
if (b3CanSubmitCommand(sm))
|
||||
{
|
||||
statusHandle = b3SubmitClientCommandAndWaitStatus(sm, b3InitStepSimulationCommand(sm));
|
||||
statusType = b3GetStatusType(statusHandle);
|
||||
ASSERT_EQ(statusType, CMD_STEP_FORWARD_SIMULATION_COMPLETED);
|
||||
} else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (b3CanSubmitCommand(sm))
|
||||
{
|
||||
b3SharedMemoryStatusHandle state = b3SubmitClientCommandAndWaitStatus(sm, b3RequestActualStateCommandInit(sm,bodyIndex));
|
||||
|
||||
@ -197,13 +204,13 @@ void testSharedMemory(b3PhysicsClientHandle sm)
|
||||
sensorState.m_jointForceTorque[2]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
b3SharedMemoryStatusHandle statusHandle;
|
||||
statusHandle = b3SubmitClientCommandAndWaitStatus(sm, b3InitResetSimulationCommand(sm));
|
||||
ASSERT_EQ(b3GetStatusType(statusHandle), CMD_RESET_SIMULATION_COMPLETED);
|
||||
{
|
||||
b3SharedMemoryStatusHandle statusHandle;
|
||||
statusHandle = b3SubmitClientCommandAndWaitStatus(sm, b3InitResetSimulationCommand(sm));
|
||||
ASSERT_EQ(b3GetStatusType(statusHandle), CMD_RESET_SIMULATION_COMPLETED);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user