Merge pull request #7534 from hyperlogic/tony/only-update-model-on-main-thread

Application: don't call Model::simulate on network thread.
This commit is contained in:
Brad Hefta-Gaub 2016-04-01 13:05:54 -07:00
commit 270a9b0483
2 changed files with 22 additions and 16 deletions

View file

@ -3215,6 +3215,25 @@ void Application::update(float deltaTime) {
updateLOD();
if (!_physicsEnabled && _processOctreeStatsCounter > 0) {
// process octree stats packets are sent in between full sends of a scene.
// We keep physics disabled until we've recieved a full scene and everything near the avatar in that
// scene is ready to compute its collision shape.
if (nearbyEntitiesAreReadyForPhysics()) {
_physicsEnabled = true;
getMyAvatar()->updateMotionBehaviorFromMenu();
} else {
auto characterController = getMyAvatar()->getCharacterController();
if (characterController) {
// if we have a character controller, disable it here so the avatar doesn't get stuck due to
// a non-loading collision hull.
characterController->setEnabled(false);
}
}
}
{
PerformanceTimer perfTimer("devices");
DeviceTracker::updateAll();
@ -4260,22 +4279,7 @@ int Application::processOctreeStats(ReceivedMessage& message, SharedNodePointer
});
});
if (!_physicsEnabled) {
if (nearbyEntitiesAreReadyForPhysics()) {
// These stats packets are sent in between full sends of a scene.
// We keep physics disabled until we've recieved a full scene and everything near the avatar in that
// scene is ready to compute its collision shape.
_physicsEnabled = true;
getMyAvatar()->updateMotionBehaviorFromMenu();
} else {
auto characterController = getMyAvatar()->getCharacterController();
if (characterController) {
// if we have a character controller, disable it here so the avatar doesn't get stuck due to
// a non-loading collision hull.
characterController->setEnabled(false);
}
}
}
_processOctreeStatsCounter++;
return statsMessageLength;
}

View file

@ -515,6 +515,8 @@ private:
std::map<void*, std::function<void()>> _preRenderLambdas;
std::mutex _preRenderLambdasLock;
std::atomic<uint32_t> _processOctreeStatsCounter { 0 };
};
#endif // hifi_Application_h