Skip to content

Commit

Permalink
Renderer: Move quad out of module scope. (#28800)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 authored Jul 4, 2024
1 parent baf57f5 commit 2f900fc
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/renderers/common/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const _screen = new Vector4();
const _frustum = new Frustum();
const _projScreenMatrix = new Matrix4();
const _vector3 = new Vector3();
const _quad = new QuadMesh( new NodeMaterial() );

class Renderer {

Expand Down Expand Up @@ -99,6 +98,8 @@ class Renderer {
this._textures = null;
this._background = null;

this._quad = new QuadMesh( new NodeMaterial() );

this._currentRenderContext = null;

this._opaqueSort = null;
Expand Down Expand Up @@ -679,14 +680,16 @@ class Renderer {

this.setRenderTarget( outputRenderTarget, activeCubeFace, activeMipmapLevel );

const quad = this._quad;

if ( this._nodes.hasOutputChange( renderTarget.texture ) ) {

_quad.material.fragmentNode = this._nodes.getOutputNode( renderTarget.texture );
_quad.material.needsUpdate = true;
quad.material.fragmentNode = this._nodes.getOutputNode( renderTarget.texture );
quad.material.needsUpdate = true;

}

this._renderScene( _quad, _quad.camera, false );
this._renderScene( quad, quad.camera, false );

}

Expand Down Expand Up @@ -967,14 +970,16 @@ class Renderer {
// If a color space transform or tone mapping is required,
// the clear operation clears the intermediate renderTarget texture, but does not update the screen canvas.

const quad = this._quad;

if ( this._nodes.hasOutputChange( renderTarget.texture ) ) {

_quad.material.fragmentNode = this._nodes.getOutputNode( renderTarget.texture );
_quad.material.needsUpdate = true;
quad.material.fragmentNode = this._nodes.getOutputNode( renderTarget.texture );
quad.material.needsUpdate = true;

}

this._renderScene( _quad, _quad.camera, false );
this._renderScene( quad, quad.camera, false );

}

Expand Down

0 comments on commit 2f900fc

Please sign in to comment.