Skip to content

Commit

Permalink
WebXRManager: Revert support of EffectComposer. (#26904)
Browse files Browse the repository at this point in the history
* Revert "Examples: Clean up. (#26901)"

This reverts commit 306fb93.

* Revert "Updated builds."

This reverts commit 7aba3d2.

* Revert "WebGLRenderer: Improve offscreen rendering in WebXR. (#26160)"

This reverts commit afdfa33.
  • Loading branch information
Mugen87 authored Oct 6, 2023
1 parent 306fb93 commit d2d3eed
Show file tree
Hide file tree
Showing 12 changed files with 4 additions and 268 deletions.
28 changes: 0 additions & 28 deletions build/three.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -26437,9 +26437,6 @@ class WebXRManager extends EventDispatcher {
const controllers = [];
const controllerInputSources = [];

const currentSize = new Vector2();
let currentPixelRatio = null;

//

const cameraL = new PerspectiveCamera();
Expand Down Expand Up @@ -26572,9 +26569,6 @@ class WebXRManager extends EventDispatcher {

//

renderer.setPixelRatio( currentPixelRatio );
renderer.setSize( currentSize.width, currentSize.height, false );

animation.stop();

scope.isPresenting = false;
Expand Down Expand Up @@ -26631,12 +26625,6 @@ class WebXRManager extends EventDispatcher {

};

this._getRenderTarget = function () {

return newRenderTarget;

};

this.getFrame = function () {

return xrFrame;
Expand Down Expand Up @@ -26686,9 +26674,6 @@ class WebXRManager extends EventDispatcher {

session.updateRenderState( { baseLayer: glBaseLayer } );

renderer.setPixelRatio( 1 );
renderer.setSize( glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, false );

newRenderTarget = new WebGLRenderTarget(
glBaseLayer.framebufferWidth,
glBaseLayer.framebufferHeight,
Expand Down Expand Up @@ -26726,9 +26711,6 @@ class WebXRManager extends EventDispatcher {

session.updateRenderState( { layers: [ glProjLayer ] } );

renderer.setPixelRatio( 1 );
renderer.setSize( glProjLayer.textureWidth, glProjLayer.textureHeight, false );

newRenderTarget = new WebGLRenderTarget(
glProjLayer.textureWidth,
glProjLayer.textureHeight,
Expand All @@ -26753,9 +26735,6 @@ class WebXRManager extends EventDispatcher {
customReferenceSpace = null;
referenceSpace = await session.requestReferenceSpace( referenceSpaceType );

currentPixelRatio = renderer.getPixelRatio();
renderer.getSize( currentSize );

animation.setContext( session );
animation.start();

Expand Down Expand Up @@ -30148,13 +30127,6 @@ class WebGLRenderer {

this.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {

// Render to base layer instead of canvas in WebXR
if ( renderTarget === null && this.xr.isPresenting ) {

renderTarget = this.xr._getRenderTarget();

}

_currentRenderTarget = renderTarget;
_currentActiveCubeFace = activeCubeFace;
_currentActiveMipmapLevel = activeMipmapLevel;
Expand Down
28 changes: 0 additions & 28 deletions build/three.js
Original file line number Diff line number Diff line change
Expand Up @@ -26442,9 +26442,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
const controllers = [];
const controllerInputSources = [];

const currentSize = new Vector2();
let currentPixelRatio = null;

//

const cameraL = new PerspectiveCamera();
Expand Down Expand Up @@ -26577,9 +26574,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated

//

renderer.setPixelRatio( currentPixelRatio );
renderer.setSize( currentSize.width, currentSize.height, false );

animation.stop();

scope.isPresenting = false;
Expand Down Expand Up @@ -26636,12 +26630,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated

};

this._getRenderTarget = function () {

return newRenderTarget;

};

this.getFrame = function () {

return xrFrame;
Expand Down Expand Up @@ -26691,9 +26679,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated

session.updateRenderState( { baseLayer: glBaseLayer } );

renderer.setPixelRatio( 1 );
renderer.setSize( glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, false );

newRenderTarget = new WebGLRenderTarget(
glBaseLayer.framebufferWidth,
glBaseLayer.framebufferHeight,
Expand Down Expand Up @@ -26731,9 +26716,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated

session.updateRenderState( { layers: [ glProjLayer ] } );

renderer.setPixelRatio( 1 );
renderer.setSize( glProjLayer.textureWidth, glProjLayer.textureHeight, false );

newRenderTarget = new WebGLRenderTarget(
glProjLayer.textureWidth,
glProjLayer.textureHeight,
Expand All @@ -26758,9 +26740,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
customReferenceSpace = null;
referenceSpace = await session.requestReferenceSpace( referenceSpaceType );

currentPixelRatio = renderer.getPixelRatio();
renderer.getSize( currentSize );

animation.setContext( session );
animation.start();

Expand Down Expand Up @@ -30153,13 +30132,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated

this.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {

// Render to base layer instead of canvas in WebXR
if ( renderTarget === null && this.xr.isPresenting ) {

renderTarget = this.xr._getRenderTarget();

}

_currentRenderTarget = renderTarget;
_currentActiveCubeFace = activeCubeFace;
_currentActiveMipmapLevel = activeMipmapLevel;
Expand Down
2 changes: 1 addition & 1 deletion build/three.min.js

Large diffs are not rendered by default.

28 changes: 0 additions & 28 deletions build/three.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -26435,9 +26435,6 @@ class WebXRManager extends EventDispatcher {
const controllers = [];
const controllerInputSources = [];

const currentSize = new Vector2();
let currentPixelRatio = null;

//

const cameraL = new PerspectiveCamera();
Expand Down Expand Up @@ -26570,9 +26567,6 @@ class WebXRManager extends EventDispatcher {

//

renderer.setPixelRatio( currentPixelRatio );
renderer.setSize( currentSize.width, currentSize.height, false );

animation.stop();

scope.isPresenting = false;
Expand Down Expand Up @@ -26629,12 +26623,6 @@ class WebXRManager extends EventDispatcher {

};

this._getRenderTarget = function () {

return newRenderTarget;

};

this.getFrame = function () {

return xrFrame;
Expand Down Expand Up @@ -26684,9 +26672,6 @@ class WebXRManager extends EventDispatcher {

session.updateRenderState( { baseLayer: glBaseLayer } );

renderer.setPixelRatio( 1 );
renderer.setSize( glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, false );

newRenderTarget = new WebGLRenderTarget(
glBaseLayer.framebufferWidth,
glBaseLayer.framebufferHeight,
Expand Down Expand Up @@ -26724,9 +26709,6 @@ class WebXRManager extends EventDispatcher {

session.updateRenderState( { layers: [ glProjLayer ] } );

renderer.setPixelRatio( 1 );
renderer.setSize( glProjLayer.textureWidth, glProjLayer.textureHeight, false );

newRenderTarget = new WebGLRenderTarget(
glProjLayer.textureWidth,
glProjLayer.textureHeight,
Expand All @@ -26751,9 +26733,6 @@ class WebXRManager extends EventDispatcher {
customReferenceSpace = null;
referenceSpace = await session.requestReferenceSpace( referenceSpaceType );

currentPixelRatio = renderer.getPixelRatio();
renderer.getSize( currentSize );

animation.setContext( session );
animation.start();

Expand Down Expand Up @@ -30146,13 +30125,6 @@ class WebGLRenderer {

this.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {

// Render to base layer instead of canvas in WebXR
if ( renderTarget === null && this.xr.isPresenting ) {

renderTarget = this.xr._getRenderTarget();

}

_currentRenderTarget = renderTarget;
_currentActiveCubeFace = activeCubeFace;
_currentActiveMipmapLevel = activeMipmapLevel;
Expand Down
2 changes: 1 addition & 1 deletion build/three.module.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion examples/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@
"webxr_vr_handinput_pressbutton",
"webxr_vr_layers",
"webxr_vr_panorama",
"webxr_vr_postprocessing",
"webxr_vr_panorama_depth",
"webxr_vr_rollercoaster",
"webxr_vr_sandbox",
Expand Down
25 changes: 2 additions & 23 deletions examples/jsm/postprocessing/EffectComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { ShaderPass } from './ShaderPass.js';
import { MaskPass } from './MaskPass.js';
import { ClearMaskPass } from './MaskPass.js';

const size = /* @__PURE__ */ new Vector2();

class EffectComposer {

constructor( renderer, renderTarget ) {
Expand All @@ -22,7 +20,7 @@ class EffectComposer {

if ( renderTarget === undefined ) {

renderer.getSize( size );
const size = renderer.getSize( new Vector2() );
this._width = size.width;
this._height = size.height;

Expand Down Expand Up @@ -52,22 +50,6 @@ class EffectComposer {

this.clock = new Clock();

this.onSessionStateChange = this.onSessionStateChange.bind( this );
this.renderer.xr.addEventListener( 'sessionstart', this.onSessionStateChange );
this.renderer.xr.addEventListener( 'sessionend', this.onSessionStateChange );

}

onSessionStateChange() {

this.renderer.getSize( size );
this._width = size.width;
this._height = size.height;

this._pixelRatio = this.renderer.xr.isPresenting ? 1 : this.renderer.getPixelRatio();

this.setSize( this._width, this._height );

}

swapBuffers() {
Expand Down Expand Up @@ -188,7 +170,7 @@ class EffectComposer {

if ( renderTarget === undefined ) {

this.renderer.getSize( size );
const size = this.renderer.getSize( new Vector2() );
this._pixelRatio = this.renderer.getPixelRatio();
this._width = size.width;
this._height = size.height;
Expand Down Expand Up @@ -242,9 +224,6 @@ class EffectComposer {

this.copyPass.dispose();

this.renderer.xr.removeEventListener( 'sessionstart', this.onSessionStateChange );
this.renderer.xr.removeEventListener( 'sessionend', this.onSessionStateChange );

}

}
Expand Down
6 changes: 0 additions & 6 deletions examples/jsm/postprocessing/Pass.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,7 @@ class FullScreenQuad {

render( renderer ) {

// Disable XR projection for fullscreen effects
// https://github.com/mrdoob/three.js/pull/18846
const xrEnabled = renderer.xr.enabled;

renderer.xr.enabled = false;
renderer.render( this._mesh, _camera );
renderer.xr.enabled = xrEnabled;

}

Expand Down
Binary file removed examples/screenshots/webxr_vr_postprocessing.jpg
Binary file not shown.
Loading

0 comments on commit d2d3eed

Please sign in to comment.