.
This commit is contained in:
@@ -282,11 +282,9 @@ void PhysicsClientSharedMemory::removeCachedBody(int bodyUniqueId)
|
|||||||
m_data->m_bodyJointMap.remove(bodyUniqueId);
|
m_data->m_bodyJointMap.remove(bodyUniqueId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void PhysicsClientSharedMemory::resetData()
|
|
||||||
|
void PhysicsClientSharedMemory::clearCachedBodies()
|
||||||
{
|
{
|
||||||
m_data->m_debugLinesFrom.clear();
|
|
||||||
m_data->m_debugLinesTo.clear();
|
|
||||||
m_data->m_debugLinesColor.clear();
|
|
||||||
for (int i = 0; i < m_data->m_bodyJointMap.size(); i++)
|
for (int i = 0; i < m_data->m_bodyJointMap.size(); i++)
|
||||||
{
|
{
|
||||||
BodyJointInfoCache** bodyJointsPtr = m_data->m_bodyJointMap.getAtIndex(i);
|
BodyJointInfoCache** bodyJointsPtr = m_data->m_bodyJointMap.getAtIndex(i);
|
||||||
@@ -296,10 +294,18 @@ void PhysicsClientSharedMemory::resetData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_data->m_bodyJointMap.clear();
|
m_data->m_bodyJointMap.clear();
|
||||||
m_data->m_userConstraintInfoMap.clear();
|
|
||||||
m_data->m_userDataHandleLookup.clear();
|
m_data->m_userDataHandleLookup.clear();
|
||||||
m_data->m_userDataMap.clear();
|
m_data->m_userDataMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PhysicsClientSharedMemory::resetData()
|
||||||
|
{
|
||||||
|
m_data->m_debugLinesFrom.clear();
|
||||||
|
m_data->m_debugLinesTo.clear();
|
||||||
|
m_data->m_debugLinesColor.clear();
|
||||||
|
m_data->m_userConstraintInfoMap.clear();
|
||||||
|
clearCachedBodies();
|
||||||
|
}
|
||||||
void PhysicsClientSharedMemory::setSharedMemoryKey(int key)
|
void PhysicsClientSharedMemory::setSharedMemoryKey(int key)
|
||||||
{
|
{
|
||||||
m_data->m_sharedMemoryKey = key;
|
m_data->m_sharedMemoryKey = key;
|
||||||
@@ -1270,7 +1276,7 @@ const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus()
|
|||||||
|
|
||||||
case CMD_SYNC_BODY_INFO_COMPLETED:
|
case CMD_SYNC_BODY_INFO_COMPLETED:
|
||||||
{
|
{
|
||||||
m_data->m_bodyJointMap.clear();
|
clearCachedBodies();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CMD_STATE_LOGGING_START_COMPLETED:
|
case CMD_STATE_LOGGING_START_COMPLETED:
|
||||||
@@ -1554,8 +1560,6 @@ const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus()
|
|||||||
{
|
{
|
||||||
B3_PROFILE("CMD_SYNC_USER_DATA_COMPLETED");
|
B3_PROFILE("CMD_SYNC_USER_DATA_COMPLETED");
|
||||||
// Remove all cached user data entries.
|
// Remove all cached user data entries.
|
||||||
m_data->m_userDataMap.clear();
|
|
||||||
m_data->m_userDataHandleLookup.clear();
|
|
||||||
for (int i = 0; i < m_data->m_bodyJointMap.size(); i++)
|
for (int i = 0; i < m_data->m_bodyJointMap.size(); i++)
|
||||||
{
|
{
|
||||||
BodyJointInfoCache** bodyJointsPtr = m_data->m_bodyJointMap.getAtIndex(i);
|
BodyJointInfoCache** bodyJointsPtr = m_data->m_bodyJointMap.getAtIndex(i);
|
||||||
@@ -1564,6 +1568,8 @@ const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus()
|
|||||||
(*bodyJointsPtr)->m_userDataIds.clear();
|
(*bodyJointsPtr)->m_userDataIds.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_data->m_userDataMap.clear();
|
||||||
|
m_data->m_userDataHandleLookup.clear();
|
||||||
const int numIdentifiers = serverCmd.m_syncUserDataArgs.m_numUserDataIdentifiers;
|
const int numIdentifiers = serverCmd.m_syncUserDataArgs.m_numUserDataIdentifiers;
|
||||||
if (numIdentifiers > 0)
|
if (numIdentifiers > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ protected:
|
|||||||
void processBodyJointInfo(int bodyUniqueId, const struct SharedMemoryStatus& serverCmd);
|
void processBodyJointInfo(int bodyUniqueId, const struct SharedMemoryStatus& serverCmd);
|
||||||
void resetData();
|
void resetData();
|
||||||
void removeCachedBody(int bodyUniqueId);
|
void removeCachedBody(int bodyUniqueId);
|
||||||
|
void clearCachedBodies();
|
||||||
virtual void renderSceneInternal(){};
|
virtual void renderSceneInternal(){};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -142,6 +142,12 @@ void PhysicsDirect::resetData()
|
|||||||
m_data->m_debugLinesFrom.clear();
|
m_data->m_debugLinesFrom.clear();
|
||||||
m_data->m_debugLinesTo.clear();
|
m_data->m_debugLinesTo.clear();
|
||||||
m_data->m_debugLinesColor.clear();
|
m_data->m_debugLinesColor.clear();
|
||||||
|
m_data->m_userConstraintInfoMap.clear();
|
||||||
|
clearCachedBodies();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhysicsDirect::clearCachedBodies()
|
||||||
|
{
|
||||||
for (int i = 0; i < m_data->m_bodyJointMap.size(); i++)
|
for (int i = 0; i < m_data->m_bodyJointMap.size(); i++)
|
||||||
{
|
{
|
||||||
BodyJointInfoCache2** bodyJointsPtr = m_data->m_bodyJointMap.getAtIndex(i);
|
BodyJointInfoCache2** bodyJointsPtr = m_data->m_bodyJointMap.getAtIndex(i);
|
||||||
@@ -151,7 +157,8 @@ void PhysicsDirect::resetData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_data->m_bodyJointMap.clear();
|
m_data->m_bodyJointMap.clear();
|
||||||
m_data->m_userConstraintInfoMap.clear();
|
m_data->m_userDataMap.clear();
|
||||||
|
m_data->m_userDataHandleLookup.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// return true if connection succesfull, can also check 'isConnected'
|
// return true if connection succesfull, can also check 'isConnected'
|
||||||
@@ -912,7 +919,7 @@ void PhysicsDirect::postProcessStatus(const struct SharedMemoryStatus& serverCmd
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CMD_SYNC_BODY_INFO_COMPLETED:
|
case CMD_SYNC_BODY_INFO_COMPLETED:
|
||||||
m_data->m_bodyJointMap.clear();
|
clearCachedBodies();
|
||||||
case CMD_MJCF_LOADING_COMPLETED:
|
case CMD_MJCF_LOADING_COMPLETED:
|
||||||
case CMD_SDF_LOADING_COMPLETED:
|
case CMD_SDF_LOADING_COMPLETED:
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ protected:
|
|||||||
|
|
||||||
void removeCachedBody(int bodyUniqueId);
|
void removeCachedBody(int bodyUniqueId);
|
||||||
|
|
||||||
|
void clearCachedBodies();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PhysicsDirect(class PhysicsCommandProcessorInterface* physSdk, bool passSdkOwnership);
|
PhysicsDirect(class PhysicsCommandProcessorInterface* physSdk, bool passSdkOwnership);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user