@@ -589,7 +589,6 @@ bool GwenUserInterface::keyboardCallback(int bulletKey, int state)
|
|||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
bool bDown = (state == 1);
|
|
||||||
|
|
||||||
if (gwenKey>=0)
|
if (gwenKey>=0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ struct PhysicsClientSharedMemoryInternalData
|
|||||||
btAlignedObjectArray<btVector3> m_debugLinesTo;
|
btAlignedObjectArray<btVector3> m_debugLinesTo;
|
||||||
btAlignedObjectArray<btVector3> m_debugLinesColor;
|
btAlignedObjectArray<btVector3> m_debugLinesColor;
|
||||||
|
|
||||||
|
|
||||||
int m_counter;
|
int m_counter;
|
||||||
bool m_serverLoadUrdfOK;
|
bool m_serverLoadUrdfOK;
|
||||||
bool m_isConnected;
|
bool m_isConnected;
|
||||||
@@ -219,9 +218,8 @@ bool PhysicsClientSharedMemory::processServerStatus(SharedMemoryStatus& serverSt
|
|||||||
{
|
{
|
||||||
b3JointInfo info;
|
b3JointInfo info;
|
||||||
info.m_flags = 0;
|
info.m_flags = 0;
|
||||||
info.m_qIndex = qOffset;
|
info.m_qIndex = (0 < mb->m_links[link].m_posVarCount) ? qOffset : -1;
|
||||||
info.m_uIndex = uOffset;
|
info.m_uIndex = (0 < mb->m_links[link].m_dofCount) ? uOffset : -1;
|
||||||
info.m_linkIndex = link;
|
|
||||||
|
|
||||||
if (mb->m_links[link].m_linkName)
|
if (mb->m_links[link].m_linkName)
|
||||||
{
|
{
|
||||||
@@ -267,8 +265,8 @@ bool PhysicsClientSharedMemory::processServerStatus(SharedMemoryStatus& serverSt
|
|||||||
{
|
{
|
||||||
b3JointInfo info;
|
b3JointInfo info;
|
||||||
info.m_flags = 0;
|
info.m_flags = 0;
|
||||||
info.m_qIndex = qOffset;
|
info.m_qIndex = (0 < mb->m_links[link].m_posVarCount) ? qOffset : -1;
|
||||||
info.m_uIndex = uOffset;
|
info.m_uIndex = (0 < mb->m_links[link].m_dofCount) ? uOffset : -1;
|
||||||
|
|
||||||
if (mb->m_links[link].m_linkName)
|
if (mb->m_links[link].m_linkName)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -80,6 +80,16 @@ int b3InitStepSimulationCommand(struct SharedMemoryCommand* command)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int b3InitResetSimulationCommand(struct SharedMemoryCommand* command)
|
||||||
|
{
|
||||||
|
b3Assert(command);
|
||||||
|
command->m_type = CMD_RESET_SIMULATION;
|
||||||
|
command->m_updateFlags = 0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int b3JointControlCommandInit(struct SharedMemoryCommand* command, int controlMode)
|
int b3JointControlCommandInit(struct SharedMemoryCommand* command, int controlMode)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ int b3PhysicsParamSetTimeStep(struct SharedMemoryCommand* command, double timeSt
|
|||||||
|
|
||||||
int b3InitStepSimulationCommand(struct SharedMemoryCommand* command);
|
int b3InitStepSimulationCommand(struct SharedMemoryCommand* command);
|
||||||
|
|
||||||
|
int b3InitResetSimulationCommand(struct SharedMemoryCommand* command);
|
||||||
|
|
||||||
int b3LoadUrdfCommandInit(struct SharedMemoryCommand* command, const char* urdfFileName);
|
int b3LoadUrdfCommandInit(struct SharedMemoryCommand* command, const char* urdfFileName);
|
||||||
///all those commands are optional, except for the *Init
|
///all those commands are optional, except for the *Init
|
||||||
int b3LoadUrdfCommandSetStartPosition(struct SharedMemoryCommand* command, double startPosX,double startPosY,double startPosZ);
|
int b3LoadUrdfCommandSetStartPosition(struct SharedMemoryCommand* command, double startPosX,double startPosY,double startPosZ);
|
||||||
|
|||||||
@@ -975,6 +975,10 @@ void PhysicsServerSharedMemory::processClientCommands()
|
|||||||
|
|
||||||
case CMD_SEND_PHYSICS_SIMULATION_PARAMETERS:
|
case CMD_SEND_PHYSICS_SIMULATION_PARAMETERS:
|
||||||
{
|
{
|
||||||
|
if (clientCmd.m_updateFlags&SIM_PARAM_UPDATE_DELTA_TIME)
|
||||||
|
{
|
||||||
|
m_data->m_physicsDeltaTime = clientCmd.m_physSimParamArgs.m_deltaTime;
|
||||||
|
}
|
||||||
if (clientCmd.m_updateFlags&SIM_PARAM_UPDATE_GRAVITY)
|
if (clientCmd.m_updateFlags&SIM_PARAM_UPDATE_GRAVITY)
|
||||||
{
|
{
|
||||||
btVector3 grav(clientCmd.m_physSimParamArgs.m_gravityAcceleration[0],
|
btVector3 grav(clientCmd.m_physSimParamArgs.m_gravityAcceleration[0],
|
||||||
@@ -1010,7 +1014,6 @@ void PhysicsServerSharedMemory::processClientCommands()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case CMD_RESET_SIMULATION:
|
case CMD_RESET_SIMULATION:
|
||||||
{
|
{
|
||||||
//clean up all data
|
//clean up all data
|
||||||
|
|||||||
@@ -30,7 +30,13 @@ struct SharedMemoryBlock
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void InitSharedMemoryBlock(struct SharedMemoryBlock* sharedMemoryBlock)
|
//http://stackoverflow.com/questions/24736304/unable-to-use-inline-in-declaration-get-error-c2054
|
||||||
|
#ifdef _WIN32
|
||||||
|
__inline
|
||||||
|
#else
|
||||||
|
inline
|
||||||
|
#endif
|
||||||
|
void InitSharedMemoryBlock(struct SharedMemoryBlock* sharedMemoryBlock)
|
||||||
{
|
{
|
||||||
sharedMemoryBlock->m_numClientCommands = 0;
|
sharedMemoryBlock->m_numClientCommands = 0;
|
||||||
sharedMemoryBlock->m_numServerCommands = 0;
|
sharedMemoryBlock->m_numServerCommands = 0;
|
||||||
|
|||||||
@@ -287,7 +287,6 @@ struct b3JointInfo
|
|||||||
int m_jointType;
|
int m_jointType;
|
||||||
int m_qIndex;
|
int m_qIndex;
|
||||||
int m_uIndex;
|
int m_uIndex;
|
||||||
int m_linkIndex;
|
|
||||||
///
|
///
|
||||||
int m_flags;
|
int m_flags;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ int main(int argc, char* argv[])
|
|||||||
b3CommandLineArgs myArgs(argc,argv);
|
b3CommandLineArgs myArgs(argc,argv);
|
||||||
|
|
||||||
|
|
||||||
SimpleOpenGL3App* app = new SimpleOpenGL3App("SimpleOpenGL3App",1024,768);
|
SimpleOpenGL3App* app = new SimpleOpenGL3App("SimpleOpenGL3App",1024,768,true);
|
||||||
app->m_instancingRenderer->getActiveCamera()->setCameraDistance(13);
|
app->m_instancingRenderer->getActiveCamera()->setCameraDistance(13);
|
||||||
app->m_instancingRenderer->getActiveCamera()->setCameraPitch(0);
|
app->m_instancingRenderer->getActiveCamera()->setCameraPitch(0);
|
||||||
app->m_instancingRenderer->getActiveCamera()->setCameraTargetPosition(0,0,0);
|
app->m_instancingRenderer->getActiveCamera()->setCameraTargetPosition(0,0,0);
|
||||||
|
|||||||
@@ -149,7 +149,14 @@ int main(int argc, char* argv[])
|
|||||||
status.m_sendActualStateArgs.m_jointReactionForces[6*sensorJointIndexRight+2]);
|
status.m_sendActualStateArgs.m_jointReactionForces[6*sensorJointIndexRight+2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = b3InitResetSimulationCommand(&command);
|
||||||
|
ret = b3SubmitClientCommand(sm, &command);
|
||||||
|
timeout = MAX_TIMEOUT;
|
||||||
|
while ((timeout-- > 0) && b3ProcessServerStatus(sm, &status)==0) {}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
b3DisconnectSharedMemory(sm);
|
b3DisconnectSharedMemory(sm);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user