Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebXRManager: Further improvements to WebXR layers feature testing. #30282

Merged
merged 4 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified examples/screenshots/webxr_vr_layers.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions examples/webxr_vr_layers.html
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,12 @@
const gl = renderer.getContext();

// Init layers once in immersive mode and video is ready.
const useLayers = session.enabledFeatures !== undefined && session.enabledFeatures.includes('layers');
const useLayers = session &&
session.enabledFeatures !== undefined &&
session.enabledFeatures.includes('layers') &&
XRMediaBinding !== undefined;

if ( session && ! useLayers ) {
if ( ! useLayers ) {

errorMesh.visible = true;

Expand Down
4 changes: 3 additions & 1 deletion src/renderers/webxr/WebXRManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,9 @@ class WebXRManager extends EventDispatcher {
currentPixelRatio = renderer.getPixelRatio();
renderer.getSize( currentSize );

const useLayers = session.enabledFeatures !== undefined && session.enabledFeatures.includes( 'layers' );
// Check that the browser implements the necessary APIs to use an
// XRProjectionLayer rather than an XRWebGLLayer
const useLayers = XRWebGLBinding !== undefined && 'createProjectionLayer' in XRWebGLBinding.prototype;

if ( ! useLayers ) {

Expand Down
Loading