Browse Source

Renderer: Move quad out of module scope. (#28800)

Michael Herzog 1 year ago
parent
commit
2f900fc55b
1 changed files with 12 additions and 7 deletions
  1. 12 7
      src/renderers/common/Renderer.js

+ 12 - 7
src/renderers/common/Renderer.js

@@ -32,7 +32,6 @@ const _screen = new Vector4();
 const _frustum = new Frustum();
 const _frustum = new Frustum();
 const _projScreenMatrix = new Matrix4();
 const _projScreenMatrix = new Matrix4();
 const _vector3 = new Vector3();
 const _vector3 = new Vector3();
-const _quad = new QuadMesh( new NodeMaterial() );
 
 
 class Renderer {
 class Renderer {
 
 
@@ -99,6 +98,8 @@ class Renderer {
 		this._textures = null;
 		this._textures = null;
 		this._background = null;
 		this._background = null;
 
 
+		this._quad = new QuadMesh( new NodeMaterial() );
+
 		this._currentRenderContext = null;
 		this._currentRenderContext = null;
 
 
 		this._opaqueSort = null;
 		this._opaqueSort = null;
@@ -679,14 +680,16 @@ class Renderer {
 
 
 			this.setRenderTarget( outputRenderTarget, activeCubeFace, activeMipmapLevel );
 			this.setRenderTarget( outputRenderTarget, activeCubeFace, activeMipmapLevel );
 
 
+			const quad = this._quad;
+
 			if ( this._nodes.hasOutputChange( renderTarget.texture ) ) {
 			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 );
 
 
 		}
 		}
 
 
@@ -967,14 +970,16 @@ class Renderer {
 			// If a color space transform or tone mapping is required,
 			// 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.
 			// 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 ) ) {
 			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 );
 
 
 		}
 		}