diff --git a/src/Three.TSL.js b/src/Three.TSL.js index c99f306c3dc111..296e3e0fa43b1e 100644 --- a/src/Three.TSL.js +++ b/src/Three.TSL.js @@ -52,7 +52,6 @@ export const anisotropy = TSL.anisotropy; export const anisotropyB = TSL.anisotropyB; export const anisotropyT = TSL.anisotropyT; export const any = TSL.any; -export const append = TSL.append; export const array = TSL.array; export const asin = TSL.asin; export const asinh = TSL.asinh; diff --git a/src/renderers/common/Renderer.js b/src/renderers/common/Renderer.js index c08d24c0438d1d..b906c1eaca6d54 100644 --- a/src/renderers/common/Renderer.js +++ b/src/renderers/common/Renderer.js @@ -1552,12 +1552,7 @@ class Renderer { */ _getFrameBufferTarget() { - const { currentToneMapping, currentColorSpace } = this; - - const useToneMapping = currentToneMapping !== NoToneMapping; - const useColorSpace = currentColorSpace !== ColorManagement.workingColorSpace; - - if ( useToneMapping === false && useColorSpace === false ) return null; + if ( this.needsFrameBufferTarget === false ) return null; const { width, height } = this.getDrawingBufferSize( _drawingBufferSize ); const { depth, stencil } = this; @@ -2601,6 +2596,7 @@ class Renderer { * Returns `true` if a framebuffer target is needed to perform tone mapping or color space conversion. * If this is the case, the renderer allocates an internal render target for that purpose. * + * @type {boolean} */ get needsFrameBufferTarget() { diff --git a/src/renderers/common/XRManager.js b/src/renderers/common/XRManager.js index b320a717f40359..62529f08dc2d57 100644 --- a/src/renderers/common/XRManager.js +++ b/src/renderers/common/XRManager.js @@ -238,6 +238,15 @@ class XRManager extends EventDispatcher { */ this._currentSize = new Vector2(); + /** + * Holds a reference to the user camera and its current settings. + * + * @private + * @type {?Object} + * @default null + */ + this._currentCameraSettings = null; + /** * The default event listener for handling events inside a XR session. * @@ -1428,6 +1437,12 @@ class XRManager extends EventDispatcher { // update user camera and its children + if ( this._currentCameraSettings === null && camera.isPerspectiveCamera ) { + + this._currentCameraSettings = { camera: camera, fov: camera.fov, zoom: camera.zoom }; + + } + updateUserCamera( camera, cameraXR, parent ); @@ -1713,6 +1728,18 @@ function onSessionEnd() { renderer.setPixelRatio( this._currentPixelRatio ); renderer.setSize( this._currentSize.width, this._currentSize.height, false ); + if ( this._currentCameraSettings !== null ) { + + const camera = this._currentCameraSettings.camera; + + camera.fov = this._currentCameraSettings.fov; + camera.zoom = this._currentCameraSettings.zoom; + camera.updateProjectionMatrix(); + + this._currentCameraSettings = null; + + } + this.dispatchEvent( { type: 'sessionend' } ); } diff --git a/src/renderers/webxr/WebXRManager.js b/src/renderers/webxr/WebXRManager.js index f66eff10afd86e..6acad3bd051e7b 100644 --- a/src/renderers/webxr/WebXRManager.js +++ b/src/renderers/webxr/WebXRManager.js @@ -67,6 +67,7 @@ class WebXRManager extends EventDispatcher { const currentSize = new Vector2(); let currentPixelRatio = null; + let currentCameraSettings = null; // @@ -262,6 +263,18 @@ class WebXRManager extends EventDispatcher { renderer.setPixelRatio( currentPixelRatio ); renderer.setSize( currentSize.width, currentSize.height, false ); + if ( currentCameraSettings !== null ) { + + const camera = currentCameraSettings.camera; + + camera.fov = currentCameraSettings.fov; + camera.zoom = currentCameraSettings.zoom; + camera.updateProjectionMatrix(); + + currentCameraSettings = null; + + } + scope.dispatchEvent( { type: 'sessionend' } ); } @@ -783,6 +796,12 @@ class WebXRManager extends EventDispatcher { // update user camera and its children + if ( currentCameraSettings === null && camera.isPerspectiveCamera ) { + + currentCameraSettings = { camera: camera, fov: camera.fov, zoom: camera.zoom }; + + } + updateUserCamera( camera, cameraXR, parent ); };