mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 23:09:52 +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
|
// if we previously selected a different distance, make sure we've moved far enough to justify switching
|
||||||
const float HYSTERESIS_PROPORTION = 0.1f;
|
const float HYSTERESIS_PROPORTION = 0.1f;
|
||||||
if (glm::abs(distance - qMax(hysteresis, lodDistance)) / fabsf(hysteresis - lodDistance) < HYSTERESIS_PROPORTION) {
|
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()) {
|
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
|
// if so instructed, keep the current geometry until the new one is loaded
|
||||||
_nextBaseGeometry = _nextGeometry = Application::getInstance()->getGeometryCache()->getGeometry(url, fallback, delayLoad);
|
_nextBaseGeometry = _nextGeometry = Application::getInstance()->getGeometryCache()->getGeometry(url, fallback, delayLoad);
|
||||||
|
_nextLODHysteresis = NetworkGeometry::NO_HYSTERESIS;
|
||||||
if (!retainCurrent || !isActive() || _nextGeometry->isLoaded()) {
|
if (!retainCurrent || !isActive() || _nextGeometry->isLoaded()) {
|
||||||
applyNextGeometry();
|
applyNextGeometry();
|
||||||
}
|
}
|
||||||
|
@ -784,7 +785,7 @@ void Model::applyCollision(CollisionInfo& collision) {
|
||||||
QVector<Model::JointState> Model::updateGeometry(bool delayLoad) {
|
QVector<Model::JointState> Model::updateGeometry(bool delayLoad) {
|
||||||
QVector<JointState> newJointStates;
|
QVector<JointState> newJointStates;
|
||||||
if (_nextGeometry) {
|
if (_nextGeometry) {
|
||||||
_nextGeometry = _nextGeometry->getLODOrFallback(_lodDistance, _lodHysteresis, delayLoad);
|
_nextGeometry = _nextGeometry->getLODOrFallback(_lodDistance, _nextLODHysteresis, delayLoad);
|
||||||
if (!delayLoad) {
|
if (!delayLoad) {
|
||||||
_nextGeometry->setLoadPriority(this, -_lodDistance);
|
_nextGeometry->setLoadPriority(this, -_lodDistance);
|
||||||
_nextGeometry->ensureLoading();
|
_nextGeometry->ensureLoading();
|
||||||
|
@ -827,7 +828,7 @@ void Model::applyNextGeometry() {
|
||||||
// delete our local geometry and custom textures
|
// delete our local geometry and custom textures
|
||||||
deleteGeometry();
|
deleteGeometry();
|
||||||
_dilatedTextures.clear();
|
_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
|
// we retain a reference to the base geometry so that its reference count doesn't fall to zero
|
||||||
_baseGeometry = _nextBaseGeometry;
|
_baseGeometry = _nextBaseGeometry;
|
||||||
|
|
|
@ -247,6 +247,7 @@ private:
|
||||||
QSharedPointer<NetworkGeometry> _nextGeometry;
|
QSharedPointer<NetworkGeometry> _nextGeometry;
|
||||||
float _lodDistance;
|
float _lodDistance;
|
||||||
float _lodHysteresis;
|
float _lodHysteresis;
|
||||||
|
float _nextLODHysteresis;
|
||||||
|
|
||||||
float _pupilDilation;
|
float _pupilDilation;
|
||||||
std::vector<float> _blendshapeCoefficients;
|
std::vector<float> _blendshapeCoefficients;
|
||||||
|
|
Loading…
Reference in a new issue