Fix rare case where script would fail to set LOD after disabling auto LOD

This commit is contained in:
sabrina-shanman 2019-07-25 11:33:19 -07:00
parent 4b5a45209e
commit 94e725dc2a
2 changed files with 5 additions and 0 deletions

View file

@ -54,6 +54,7 @@ void LODManager::setRenderTimes(float presentTime, float engineRunTime, float ba
}
void LODManager::autoAdjustLOD(float realTimeDelta) {
std::lock_guard<std::mutex> { _automaticLODLock };
// The "render time" is the worse of:
// - engineRunTime: Time spent in the render thread in the engine producing the gpu::Frame N
@ -235,6 +236,7 @@ void LODManager::resetLODAdjust() {
}
void LODManager::setAutomaticLODAdjust(bool value) {
std::lock_guard<std::mutex> { _automaticLODLock };
_automaticLODAdjust = value;
emit autoLODChanged();
}

View file

@ -12,6 +12,8 @@
#ifndef hifi_LODManager_h
#define hifi_LODManager_h
#include <mutex>
#include <DependencyManager.h>
#include <NumericalConstants.h>
#include <OctreeConstants.h>
@ -230,6 +232,7 @@ signals:
private:
LODManager();
std::mutex _automaticLODLock;
bool _automaticLODAdjust = true;
float _presentTime{ 0.0f }; // msec