Skip to content

Commit

Permalink
Add support for compositor VR layers.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarcos committed Nov 8, 2024
1 parent 6757a08 commit d2f2d6d
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/renderers/webxr/WebXRManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class WebXRManager extends EventDispatcher {
let _currentDepthFar = null;

//

this.cameraAutoUpdate = true;
this.layersEnabled = false;
this.enabled = false;

this.isPresenting = false;
Expand Down Expand Up @@ -381,8 +381,29 @@ class WebXRManager extends EventDispatcher {
return session.environmentBlendMode;

}
}

};
this.addLayer = function(layer) {
if (!window.XRWebGLBinding || !this.layersEnabled || !session) { return; }

layers.push( layer );
this.updateLayers();
}

this.removeLayer = function(layer) {

layers.splice( layers.indexOf(layer), 1 );
if (!window.XRWebGLBinding || !this.layersEnabled || !session) { return; }

this.updateLayers();
}

this.updateLayers = function() {
var layersCopy = layers.map(function (x) { return x; });

layersCopy.unshift( session.renderState.layers[0] );
session.updateRenderState( { layers: layersCopy } );
}

this.getDepthTexture = function () {

Expand Down

0 comments on commit d2f2d6d

Please sign in to comment.