浏览代码

WebGPURenderer: Avoid object creation in PassNode.updateBefore (#28505)

Co-authored-by: aardgoose <[email protected]>
aardgoose 1 年之前
父节点
当前提交
a3c4bc086b
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      examples/jsm/nodes/display/PassNode.js

+ 3 - 1
examples/jsm/nodes/display/PassNode.js

@@ -7,6 +7,8 @@ import { uniform } from '../core/UniformNode.js';
 import { viewZToOrthographicDepth, perspectiveDepthToViewZ } from './ViewportDepthNode.js';
 import { RenderTarget, Vector2, HalfFloatType, DepthTexture, NoToneMapping/*, FloatType*/ } from 'three';
 
+const _size = new Vector2();
+
 class PassTextureNode extends TextureNode {
 
 	constructor( passNode, texture ) {
@@ -135,7 +137,7 @@ class PassNode extends TempNode {
 
 		this._pixelRatio = renderer.getPixelRatio();
 
-		const size = renderer.getSize( new Vector2() );
+		const size = renderer.getSize( _size );
 
 		this.setSize( size.width, size.height );