Skip to content

Commit

Permalink
fix renderTime
Browse files Browse the repository at this point in the history
Signed-off-by: FurryR <[email protected]>
  • Loading branch information
FurryR committed Oct 26, 2024
1 parent 1aa486b commit ea7fd17
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/engine/tw-frame-loop.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class FrameLoop {
if (!document.hidden) {
this.runtime._renderInterpolatedPositions();
}
this.runtime.screenRefreshTime = renderTime - this._lastRenderTime; // Screen refresh time (from rate)
this._lastRenderTime = renderTime;
} else if (
renderTime - this._lastRenderTime >=
this.runtime.currentStepTime
Expand All @@ -101,12 +103,12 @@ class FrameLoop {
if (this.runtime.profiler !== null) {
this.runtime.profiler.stop();
}
this.runtime.screenRefreshTime = renderTime - this._lastRenderTime; // Screen refresh time (from rate)
this._lastRenderTime = renderTime;
if (this.framerate === 0) {
this.runtime.currentStepTime = this.runtime.screenRefreshTime;
}
}
this.runtime.screenRefreshTime = renderTime - this._lastRenderTime; // Screen refresh time (from rate)
if (this.framerate === 0) {
this.runtime.currentStepTime = this.runtime.screenRefreshTime;
}
this._lastRenderTime = renderTime;
}
}

Expand Down

0 comments on commit ea7fd17

Please sign in to comment.