Window - #1007
Open
bjornbytes wants to merge 1 commit into
Open
Conversation
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.
Window
This adds support for OpenXR's new
XR_EXT_spatial_containerextension, which is basically a way for apps to create windows in VR.Windows can be both 2D panels and 3D boxes, and they can contain regular 3D content or 2D
Layerobjects.Note that this is still a proof of concept. It hasn't been tested on a real runtime yet, and the API is subject to change.
API
Spatial containers are exposed as a new
Windowobject. You can create a window and optionally give it a size:Once you have a window, you can query things about it, like its position, size, and whether it's visible, focused, or fullscreen:
You can request that the runtime show/hide the window, or make it fullscreen. These are just requests, the runtime doesn't have to listen to you (although hiding a window will always succeed).
To render stuff to a window, you can get its Texture or a Pass that renders to its texture.
You can manually fetch the camera info for the window as well, just like
lovr.headset.getViewPoseandlovr.headset.getViewAngles. However, the view angles will be "shrinkwrapped" around the window's bounds, so you won't waste time rendering things outside the window.You can give windows a background and
Layerobjects, similar to the corresponding methods onlovr.headset:Finally, if you're done with a window, you can close it. Once you close a window, it won't show up anymore, and its methods will generally return empty data or behave like noops:
Certain events are extended to report changes to windows as well:
Default Window
LÖVR places the existing scene in a "default" window.
The default window works even if the runtime doesn't support spatial containers -- LÖVR emulates the window functionality on top of regular OpenXR APIs. Certain top-level
lovr.headsetfunctions behave the exact same as calling the corresponding methods on the default window:This ensures that existing apps will behave the same way even when windows are enabled.