Skip to content

Commit

Permalink
fix: change the name and signature of System::doRenderLoop (to System…
Browse files Browse the repository at this point in the history
…::startRenderLoop)

BREAKING CHANGE: change the name and signature from System::doRenderLoop to System::startRenderLoop
  • Loading branch information
Yuki Shimada committed Sep 24, 2021
1 parent 2c3f2e5 commit a01e225
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/foundation/system/System.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ export default class System {
private __animationFrameId = -1;

private __renderLoopFunc?: Function;
private __args?: unknown[];
private __args: unknown[] = [];

private constructor() {}

doRenderLoop(renderLoopFunc: Function, time: number, ...args: unknown[]) {
startRenderLoop(renderLoopFunc: Function, ...args: unknown[]) {
this.__renderLoopFunc = renderLoopFunc;
this.__args = args;
const animationFrameObject = this.__getAnimationFrameObject();
Expand All @@ -57,7 +57,7 @@ export default class System {
if (Is.exist(rnVRModule)) {
let webVRSystem: WebVRSystem;
if (webXRSystem.isReadyForWebXR) {
webXRSystem._preRender(time, xrFrame);
webXRSystem._preRender(_time, xrFrame);
} else {
webVRSystem = rnVRModule.WebVRSystem.getInstance();
if (webVRSystem.isReadyForWebVR) {
Expand All @@ -66,8 +66,7 @@ export default class System {
}
}

args.splice(0, 0, time);
renderLoopFunc.apply(renderLoopFunc, args);
renderLoopFunc.apply(renderLoopFunc, [_time, ...args]);

if (Is.exist(rnVRModule)) {
if (webXRSystem.isReadyForWebXR) {
Expand All @@ -79,7 +78,7 @@ export default class System {
}
}
}
this.doRenderLoop(renderLoopFunc, _time, args);
this.startRenderLoop(renderLoopFunc, args);
}) as FrameRequestCallback);
}

Expand Down Expand Up @@ -112,7 +111,7 @@ export default class System {

restartRenderLoop() {
if (this.__renderLoopFunc != null) {
this.doRenderLoop(this.__renderLoopFunc, 0, this.__args);
this.startRenderLoop(this.__renderLoopFunc, 0, this.__args);
}
}

Expand Down

0 comments on commit a01e225

Please sign in to comment.