mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 10:28:22 +02:00
cap
This commit is contained in:
parent
481fe5a7d0
commit
faec4639b1
1 changed files with 12 additions and 6 deletions
|
@ -111,7 +111,7 @@ void AvatarManager::init() {
|
|||
_renderDistanceController.setKP(0.0008f); // Usually about 0.6 of largest that doesn't oscillate when other parameters 0.
|
||||
_renderDistanceController.setKI(0.0006f); // Big enough to bring us to target with the above KP.
|
||||
_renderDistanceController.setKD(0.000001f); // A touch of kd increases the speed by which we get there.
|
||||
//_renderDistanceController.setHistorySize("av", 240); //FIXME
|
||||
_renderDistanceController.setHistorySize("av", 240); //FIXME
|
||||
}
|
||||
|
||||
void AvatarManager::updateMyAvatar(float deltaTime) {
|
||||
|
@ -155,17 +155,23 @@ void AvatarManager::updateOtherAvatars(float deltaTime) {
|
|||
const float instantaneousFps = qApp->getLastInstanteousFps();
|
||||
const float paintWait = qApp->getLastPaintWait();
|
||||
const float actual = 1.0f / instantaneousFps;
|
||||
const float firstAdjusted = actual - paintWait + 0.002f;
|
||||
const float machinery = (paintWait > 0.0001f) ? fmod(1.0f / targetFps, paintWait) : 0.0f;
|
||||
const float target = 1.0f / targetFps;
|
||||
const float firstAdjusted = actual - paintWait /*+ 0.002f*/;
|
||||
const float machinery = (paintWait > target) ? fmod(paintWait, target) : 0.0f;
|
||||
const float secondAdjusted = firstAdjusted + machinery;
|
||||
const float deduced = 1.0f / secondAdjusted;
|
||||
qCDebug(interfaceapp) << "dump " << instantaneousFps << (1000.0f * paintWait)
|
||||
const float modulus = (instantaneousFps >= targetFps) ?
|
||||
(1.0f + floor(instantaneousFps / targetFps)) :
|
||||
(1.0f / floor(targetFps / instantaneousFps));
|
||||
const float cap = modulus * targetFps;
|
||||
const float capped = glm::min(cap, deduced);
|
||||
/*qCDebug(interfaceapp) << "dump " << instantaneousFps << (1000.0f * paintWait)
|
||||
<< "(" << paintWait << actual
|
||||
<< "(" << firstAdjusted << machinery << secondAdjusted
|
||||
<< ")" << deduced << ")";
|
||||
<< ")" << deduced << ")";*/
|
||||
|
||||
//const float deduced = qApp->getLastDeducedNonVSyncFps();
|
||||
const float distance = 1.0f / _renderDistanceController.update(deduced, deltaTime, false, paintWait, instantaneousFps);
|
||||
const float distance = 1.0f / _renderDistanceController.update(capped, deltaTime, false, paintWait, instantaneousFps);
|
||||
_renderDistanceAverage.updateAverage(distance);
|
||||
_renderDistance = _renderDistanceAverage.getAverage();
|
||||
int renderableCount = 0;
|
||||
|
|
Loading…
Reference in a new issue