Skip to content

Commit 3817179

Browse files
committed
Maximum FPS rate removed from TimeStep. When the delta resets it now resets to zero. Target FPS used as limiter during recovery from browser raf idle period.
1 parent 9e10fca commit 3817179

2 files changed

Lines changed: 5 additions & 9 deletions

File tree

v3/src/boot/TimeStep.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ var RequestAnimationFrame = require('../dom/RequestAnimationFrame');
77
// fps: {
88
// min: 10,
99
// target: 60,
10-
// max: 120
1110
// forceSetTimeOut: false,
1211
// deltaHistory: 10,
1312
// panicMax: 120
@@ -29,11 +28,9 @@ var TimeStep = new Class({
2928
this.running = false;
3029

3130
this.minFps = GetValue(config, 'min', 5);
32-
this.maxFps = GetValue(config, 'max', 120);
3331
this.targetFps = GetValue(config, 'target', 60);
3432

3533
this._min = 1000 / this.minFps; // 200ms between frames (i.e. super slow!)
36-
this._max = 1000 / this.maxFps; // 8.333ms between frames (i.e. super fast, 120Hz displays)
3734
this._target = 1000 / this.targetFps; // 16.666ms between frames (i.e. normal)
3835

3936
// 200 / 1000 = 0.2 (5fps)
@@ -124,7 +121,7 @@ var TimeStep = new Class({
124121

125122
for (var i = 0; i < this.deltaSmoothingMax; i++)
126123
{
127-
this.deltaHistory[i] = this._target;
124+
this.deltaHistory[i] = 0;
128125
}
129126

130127
this.delta = 0;
@@ -185,8 +182,7 @@ var TimeStep = new Class({
185182
// debug = (time - this.lastTime);
186183
}
187184

188-
// min / max range (yes, the < and > should be this way around)
189-
if (dt > this._min || dt < this._max)
185+
if (dt > this._min)
190186
{
191187
// Probably super bad start time or browser tab context loss,
192188
// so use the last 'sane' dt value
@@ -195,8 +191,8 @@ var TimeStep = new Class({
195191

196192
dt = history[idx];
197193

198-
// Clamp delta to min max range (in case history has become corrupted somehow)
199-
dt = Math.max(Math.min(dt, this._max), this._min);
194+
// Clamp delta to min (in case history has become corrupted somehow)
195+
dt = Math.min(dt, this._min);
200196
}
201197

202198
// Smooth out the delta over the previous X frames

v3/src/checksum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
var CHECKSUM = {
2-
build: 'f30debd0-733b-11e7-b23c-ef3e3e85b72b'
2+
build: 'dd878880-73a3-11e7-bde8-3599ac24a2cf'
33
};
44
module.exports = CHECKSUM;

0 commit comments

Comments
 (0)