mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 16:26:17 +02:00
Track hysteresis for next model separately, but just in case, don't use
recursion to fall back on hysteresis value. Closes #2209.
This commit is contained in:
parent
3930b3e824
commit
ad25455f86
3 changed files with 12 additions and 3 deletions
|
@ -343,7 +343,14 @@ QSharedPointer<NetworkGeometry> NetworkGeometry::getLODOrFallback(float distance
|
|||
// if we previously selected a different distance, make sure we've moved far enough to justify switching
|
||||
const float HYSTERESIS_PROPORTION = 0.1f;
|
||||
if (glm::abs(distance - qMax(hysteresis, lodDistance)) / fabsf(hysteresis - lodDistance) < HYSTERESIS_PROPORTION) {
|
||||
return getLODOrFallback(hysteresis, hysteresis);
|
||||
lod = _lodParent;
|
||||
lodDistance = 0.0f;
|
||||
it = _lods.upperBound(hysteresis);
|
||||
if (it != _lods.constBegin()) {
|
||||
it = it - 1;
|
||||
lod = it.value();
|
||||
lodDistance = it.key();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lod->isLoaded()) {
|
||||
|
|
|
@ -416,6 +416,7 @@ void Model::setURL(const QUrl& url, const QUrl& fallback, bool retainCurrent, bo
|
|||
|
||||
// if so instructed, keep the current geometry until the new one is loaded
|
||||
_nextBaseGeometry = _nextGeometry = Application::getInstance()->getGeometryCache()->getGeometry(url, fallback, delayLoad);
|
||||
_nextLODHysteresis = NetworkGeometry::NO_HYSTERESIS;
|
||||
if (!retainCurrent || !isActive() || _nextGeometry->isLoaded()) {
|
||||
applyNextGeometry();
|
||||
}
|
||||
|
@ -784,7 +785,7 @@ void Model::applyCollision(CollisionInfo& collision) {
|
|||
QVector<Model::JointState> Model::updateGeometry(bool delayLoad) {
|
||||
QVector<JointState> newJointStates;
|
||||
if (_nextGeometry) {
|
||||
_nextGeometry = _nextGeometry->getLODOrFallback(_lodDistance, _lodHysteresis, delayLoad);
|
||||
_nextGeometry = _nextGeometry->getLODOrFallback(_lodDistance, _nextLODHysteresis, delayLoad);
|
||||
if (!delayLoad) {
|
||||
_nextGeometry->setLoadPriority(this, -_lodDistance);
|
||||
_nextGeometry->ensureLoading();
|
||||
|
@ -827,7 +828,7 @@ void Model::applyNextGeometry() {
|
|||
// delete our local geometry and custom textures
|
||||
deleteGeometry();
|
||||
_dilatedTextures.clear();
|
||||
_lodHysteresis = NetworkGeometry::NO_HYSTERESIS;
|
||||
_lodHysteresis = _nextLODHysteresis;
|
||||
|
||||
// we retain a reference to the base geometry so that its reference count doesn't fall to zero
|
||||
_baseGeometry = _nextBaseGeometry;
|
||||
|
|
|
@ -247,6 +247,7 @@ private:
|
|||
QSharedPointer<NetworkGeometry> _nextGeometry;
|
||||
float _lodDistance;
|
||||
float _lodHysteresis;
|
||||
float _nextLODHysteresis;
|
||||
|
||||
float _pupilDilation;
|
||||
std::vector<float> _blendshapeCoefficients;
|
||||
|
|
Loading…
Reference in a new issue