Skip to content
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
1 change: 0 additions & 1 deletion src/Three.TSL.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 2 additions & 6 deletions src/renderers/common/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {

Expand Down
27 changes: 27 additions & 0 deletions src/renderers/common/XRManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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 );


Expand Down Expand Up @@ -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' } );

}
Expand Down
19 changes: 19 additions & 0 deletions src/renderers/webxr/WebXRManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class WebXRManager extends EventDispatcher {

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

//

Expand Down Expand Up @@ -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' } );

}
Expand Down Expand Up @@ -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 );

};
Expand Down