Skip to content

Commit

Permalink
WebXRManager: Further improvements to WebXR layers feature testing. (#…
Browse files Browse the repository at this point in the history
…30282)

* Further improvements to WebXR layers feature testing

* Update webxr_vr_layers.html

Clean up.

* Update WebXRManager.js

Clean up.

* Updated E2E screenshot.

---------

Co-authored-by: Michael Herzog <[email protected]>
  • Loading branch information
toji and Mugen87 authored Jan 10, 2025
1 parent 5fb35c7 commit e648b56
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
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

0 comments on commit e648b56

Please sign in to comment.