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
15 changes: 15 additions & 0 deletions src/renderers/common/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2225,6 +2225,21 @@ class Renderer {

}

/**
* Resets the renderer to the initial state before WebXR started.
*
*/
XRResetState() {

this.backend.setXRTarget( null );
this.setOutputRenderTarget( null );
this.setRenderTarget( null );

this._frameBufferTarget.dispose();
this._frameBufferTarget = null;

}

/**
* Callback for {@link Renderer#setRenderObjectFunction}.
*
Expand Down
1 change: 1 addition & 0 deletions src/renderers/common/Textures.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class Textures extends DataMap {
depthTexture.image.width = mipWidth;
depthTexture.image.height = mipHeight;
depthTexture.image.depth = size.depth;
depthTexture.isArrayTexture = renderTarget.multiview === true && size.depth > 1;

depthTextureMips[ activeMipmapLevel ] = depthTexture;

Expand Down
7 changes: 3 additions & 4 deletions src/renderers/common/XRManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1260,9 +1260,7 @@ function onSessionEnd() {

// restore framebuffer/rendering state

renderer.backend.setXRTarget( null );
renderer.setOutputRenderTarget( null );
renderer.setRenderTarget( null );
renderer.XRResetState();

this._session = null;
this._xrRenderTarget = null;
Expand Down Expand Up @@ -1300,6 +1298,8 @@ function onSessionEnd() {

layer.plane.material = layer.material;
layer.material.map = layer.renderTarget.texture;
layer.material.map.offset.y = 1;
layer.material.map.repeat.y = - 1;
delete layer.xrlayer;

}
Expand All @@ -1312,7 +1312,6 @@ function onSessionEnd() {
this._useMultiview = false;

renderer._animation.stop();

renderer._animation.setAnimationLoop( this._currentAnimationLoop );
renderer._animation.setContext( this._currentAnimationContext );
renderer._animation.start();
Expand Down
3 changes: 2 additions & 1 deletion src/renderers/common/nodes/Nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class Nodes extends DataMap {
nodeBuilder.environmentNode = this.getEnvironmentNode( renderObject.scene );
nodeBuilder.fogNode = this.getFogNode( renderObject.scene );
nodeBuilder.clippingContext = renderObject.clippingContext;
if ( this.renderer.getRenderTarget() ? this.renderer.getRenderTarget().multiview : false ) {
if ( this.renderer.getOutputRenderTarget() ? this.renderer.getOutputRenderTarget().multiview : false ) {

nodeBuilder.enableMultiview();

Expand Down Expand Up @@ -410,6 +410,7 @@ class Nodes extends DataMap {
if ( environmentNode ) _cacheKeyValues.push( environmentNode.getCacheKey() );
if ( fogNode ) _cacheKeyValues.push( fogNode.getCacheKey() );

_cacheKeyValues.push( this.renderer.getOutputRenderTarget() && this.renderer.getOutputRenderTarget().multiview ? 1 : 0 );
_cacheKeyValues.push( this.renderer.shadowMap.enabled ? 1 : 0 );

cacheKeyData.callId = callId;
Expand Down