reduce size of SharedMemoryStatus by moving state details into shared memory streaming block.
This commit is contained in:
@@ -70,6 +70,8 @@ struct PhysicsClientSharedMemoryInternalData
|
||||
|
||||
SharedMemoryStatus m_lastServerStatus;
|
||||
|
||||
SendActualStateSharedMemoryStorage m_cachedState;
|
||||
|
||||
int m_counter;
|
||||
|
||||
bool m_isConnected;
|
||||
@@ -79,6 +81,8 @@ struct PhysicsClientSharedMemoryInternalData
|
||||
bool m_verboseOutput;
|
||||
double m_timeOutInSeconds;
|
||||
|
||||
|
||||
|
||||
PhysicsClientSharedMemoryInternalData()
|
||||
: m_sharedMemory(0),
|
||||
m_ownsSharedMemory(false),
|
||||
@@ -524,6 +528,15 @@ const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus()
|
||||
m_data->m_testBlock1->m_numProcessedServerCommands + 1);
|
||||
|
||||
const SharedMemoryStatus& serverCmd = m_data->m_testBlock1->m_serverCommands[0];
|
||||
|
||||
if (serverCmd.m_type==CMD_ACTUAL_STATE_UPDATE_COMPLETED)
|
||||
{
|
||||
SendActualStateSharedMemoryStorage* serverState = (SendActualStateSharedMemoryStorage*)m_data->m_testBlock1->m_bulletStreamDataServerToClientRefactor;
|
||||
m_data->m_cachedState = *serverState;
|
||||
//ideally we provided a 'getCachedState' but that would require changing the API, so we store a pointer instead.
|
||||
m_data->m_testBlock1->m_serverCommands[0].m_sendActualStateArgs.m_stateDetails = &m_data->m_cachedState;
|
||||
}
|
||||
|
||||
m_data->m_lastServerStatus = serverCmd;
|
||||
|
||||
// EnumSharedMemoryServerStatus s = (EnumSharedMemoryServerStatus)serverCmd.m_type;
|
||||
@@ -827,6 +840,7 @@ const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus()
|
||||
case CMD_ACTUAL_STATE_UPDATE_COMPLETED:
|
||||
{
|
||||
B3_PROFILE("CMD_ACTUAL_STATE_UPDATE_COMPLETED");
|
||||
|
||||
if (m_data->m_verboseOutput)
|
||||
{
|
||||
b3Printf("Received actual state\n");
|
||||
@@ -845,12 +859,12 @@ const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus()
|
||||
if (i < numQ - 1)
|
||||
{
|
||||
sprintf(msg, "%s%f,", msg,
|
||||
command.m_sendActualStateArgs.m_actualStateQ[i]);
|
||||
m_data->m_cachedState.m_actualStateQ[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(msg, "%s%f", msg,
|
||||
command.m_sendActualStateArgs.m_actualStateQ[i]);
|
||||
m_data->m_cachedState.m_actualStateQ[i]);
|
||||
}
|
||||
}
|
||||
sprintf(msg, "%s]", msg);
|
||||
@@ -864,12 +878,12 @@ const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus()
|
||||
if (i < numU - 1)
|
||||
{
|
||||
sprintf(msg, "%s%f,", msg,
|
||||
command.m_sendActualStateArgs.m_actualStateQdot[i]);
|
||||
m_data->m_cachedState.m_actualStateQdot[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(msg, "%s%f", msg,
|
||||
command.m_sendActualStateArgs.m_actualStateQdot[i]);
|
||||
m_data->m_cachedState.m_actualStateQdot[i]);
|
||||
}
|
||||
}
|
||||
sprintf(msg, "%s]", msg);
|
||||
|
||||
Reference in New Issue
Block a user