This commit is contained in:
2026-02-21 22:17:44 -08:00
parent 423807c62f
commit 0adcafd697
14 changed files with 981 additions and 59 deletions

View File

@ -53,6 +53,21 @@ class App {
static function update() {
if (Scene.active == null || !Scene.active.ready) return;
// VR is handling it so we prevent double updates
// TODO: avoid js.Syntax
#if (kha_webgl && lnx_vr)
var vrActive = false;
js.Syntax.code("
if (typeof kha !== 'undefined' && kha.vr && kha.vr.VrInterface) {
const vr = kha.vr.VrInterface.instance;
if (vr && vr.IsPresenting && vr.IsPresenting()) {
{0} = true;
}
}
", vrActive);
if (vrActive) return;
#end
iron.system.Time.update();
if (lastw == -1) {
@ -138,6 +153,21 @@ class App {
traitInits.splice(0, traitInits.length);
}
// skip for XR callback to handle rendering
// TODO: avoid js Syntax
#if (kha_webgl && lnx_vr)
var vrActive = false;
js.Syntax.code("
if (typeof kha !== 'undefined' && kha.vr && kha.vr.VrInterface) {
const vr = kha.vr.VrInterface.instance;
if (vr && vr.IsPresenting && vr.IsPresenting()) {
{0} = true;
}
}
", vrActive);
if (!vrActive) {
#end
Scene.active.renderFrame(frame.g4);
for (f in traitRenders) {
@ -146,6 +176,10 @@ class App {
render2D(frame);
#if (kha_webgl && lnx_vr)
}
#end
#if lnx_debug
renderPathTime = kha.Scheduler.realTime() - startTime;
#end