forked from LeenkxTeam/LNXSDK
Repe [T3DU] and Moises Jpelaez updates
This commit is contained in:
@ -24,11 +24,11 @@ class App {
|
||||
public static var renderPathTime: Float;
|
||||
public static var endFrameCallbacks: Array<Void->Void> = [];
|
||||
#end
|
||||
static var last = 0.0;
|
||||
static var time = 0.0;
|
||||
static var lastw = -1;
|
||||
static var lasth = -1;
|
||||
public static var onResize: Void->Void = null;
|
||||
public static var onResize: Void->Void = null; // TODO: deprecate this. Use leenkx.system.Signal 'resized' instead.
|
||||
public static var resized: leenkx.system.Signal = new leenkx.system.Signal(); // args: (w: Int, h: Int)
|
||||
|
||||
public static function init(done: Void->Void) {
|
||||
new App(done);
|
||||
@ -75,6 +75,7 @@ class App {
|
||||
lasth = App.h();
|
||||
}
|
||||
if (lastw != App.w() || lasth != App.h()) {
|
||||
resized.emit(App.w(), App.h());
|
||||
if (onResize != null) onResize();
|
||||
else {
|
||||
if (Scene.active != null && Scene.active.camera != null) {
|
||||
@ -93,7 +94,6 @@ class App {
|
||||
|
||||
Scene.active.updateFrame();
|
||||
|
||||
|
||||
time += iron.system.Time.delta;
|
||||
|
||||
while (time >= iron.system.Time.fixedStep) {
|
||||
@ -101,16 +101,19 @@ class App {
|
||||
time -= iron.system.Time.fixedStep;
|
||||
}
|
||||
|
||||
@:privateAccess iron.system.Time._fixedStepInterpolation = time / iron.system.Time.fixedStep;
|
||||
|
||||
var i = 0;
|
||||
var l = traitUpdates.length;
|
||||
while (i < l) {
|
||||
if (traitInits.length > 0) {
|
||||
for (f in traitInits) {
|
||||
traitInits.length > 0 ? f() : break;
|
||||
}
|
||||
traitInits.splice(0, traitInits.length);
|
||||
while (traitInits.length > 0) {
|
||||
var f = traitInits.shift();
|
||||
if (f != null) f();
|
||||
}
|
||||
// Re-check bounds after processing inits (scene switch may have removed traits)
|
||||
if (i < traitUpdates.length) {
|
||||
traitUpdates[i]();
|
||||
}
|
||||
traitUpdates[i]();
|
||||
// Account for removed traits
|
||||
l <= traitUpdates.length ? i++ : l = traitUpdates.length;
|
||||
}
|
||||
@ -146,11 +149,9 @@ class App {
|
||||
startTime = kha.Scheduler.realTime();
|
||||
#end
|
||||
|
||||
if (traitInits.length > 0) {
|
||||
for (f in traitInits) {
|
||||
traitInits.length > 0 ? f() : break;
|
||||
}
|
||||
traitInits.splice(0, traitInits.length);
|
||||
while (traitInits.length > 0) {
|
||||
var f = traitInits.shift();
|
||||
if (f != null) f();
|
||||
}
|
||||
|
||||
// skip for XR callback to handle rendering
|
||||
|
||||
Reference in New Issue
Block a user