Skip to content

Commit

Permalink
Reuse "renderBackground" flag
Browse files Browse the repository at this point in the history
  • Loading branch information
gkjohnson committed May 20, 2024
1 parent cc2106d commit 0d5251a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ class WebGLRenderer {

let _clippingEnabled = false;
let _localClippingEnabled = false;
let _renderBackground = false;

// camera matrices cache

Expand Down Expand Up @@ -1153,8 +1154,8 @@ class WebGLRenderer {

}

const renderBackground = xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false;
if ( renderBackground ) {
_renderBackground = xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false;
if ( _renderBackground ) {

background.addToRenderList( currentRenderList, scene );

Expand Down Expand Up @@ -1199,7 +1200,7 @@ class WebGLRenderer {

}

if ( renderBackground ) background.render( scene );
if ( _renderBackground ) background.render( scene );

for ( let i = 0, l = cameras.length; i < l; i ++ ) {

Expand All @@ -1213,7 +1214,7 @@ class WebGLRenderer {

if ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );

if ( renderBackground ) background.render( scene );
if ( _renderBackground ) background.render( scene );

renderScene( currentRenderList, scene, camera );

Expand Down Expand Up @@ -1462,8 +1463,7 @@ class WebGLRenderer {

_this.clear();

const renderBackground = xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false;
if ( renderBackground ) background.render( scene );
if ( _renderBackground ) background.render( scene );

// Turn off the features which can affect the frag color for opaque objects pass.
// Otherwise they are applied twice in opaque objects pass and transmission objects pass.
Expand Down

0 comments on commit 0d5251a

Please sign in to comment.