refactor(xr): route XR framebuffer through XrBridge; refresh VR LOD example#8713
Merged
Conversation
…xample Move WebGL XR default framebuffer binding out of AppBase into XrBridge beginFrame/endFrame, invoked from XrManager and cleared on bridge destroy. Update the Gaussian splatting VR LOD example to use shared XR scripts and an XR control panel for Enter/Exit VR.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors WebXR framebuffer binding so that per-frame backend render target setup is handled by XrBridge (instead of AppBase), and updates the Gaussian splatting VR LOD example to use shared ESM XR helpers and the examples control panel for entering/exiting VR.
Changes:
- Add
XrBridge.beginFrame()/endFrame()and callbeginFrame()fromXrManager.update()each XR frame; reset state viaendFrame()during bridge destruction. - Remove per-tick
graphicsDevice.defaultFramebufferassignment fromAppBase.tick(). - Update the VR LOD example to use
xr-session.mjs/xr-navigation.mjsand add an “XR” panel with Enter/Exit VR.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/platform/graphics/xr-bridge.js | Adds beginFrame/endFrame to the bridge API and ensures endFrame() is invoked during destruction. |
| src/platform/graphics/webgpu/webgpu-xr-bridge.js | Adds no-op beginFrame/endFrame stubs for WebGPU. |
| src/platform/graphics/webgl/webgl-xr-bridge.js | Implements per-frame default framebuffer routing to the XR base layer and resets back to canvas. |
| src/framework/xr/xr-manager.js | Calls xrBridge.beginFrame(frame) once per XR frame after XR update processing. |
| src/framework/app-base.js | Removes per-tick XR framebuffer binding / reset from the main loop. |
| examples/src/examples/gaussian-splatting-xr/vr-lod.example.mjs | Switches VR entry/exit to shared XR session/navigation scripts and observer-driven UI events. |
| examples/src/examples/gaussian-splatting-xr/vr-lod.controls.mjs | Adds an “XR” panel with a VR enter/exit toggle button driven by xrActive. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WebGL XR presentation now binds the session framebuffer inside the graphics XR bridge each frame, instead of in
AppBase. The Gaussian splatting VR LOD example is aligned with shared ESM XR helpers and uses the examples control panel for session entry and exit.Changes:
XrBridge.beginFrame/endFrameand wire WebGL to setdefaultFramebufferfrom the XR base layer; WebGPU stubs are no-ops.xrBridge.beginFrameat the end ofXrManager.update; callendFramefromXrBridge.destroybefore tearing down the implementation.defaultFramebufferassignment fromAppBase.xr-session.mjsandxr-navigation.mjs; XR panel titled XR with Enter VR / Exit VR (observerxrActive); remove click-to-enter on the canvas; touch still exits when already in VR.Examples:
examples/src/examples/gaussian-splatting-xr/vr-lod.example.mjsandvr-lod.controls.mjs.related to #7404