Преглед изворни кода

TSL: Improve `dispose()` of some FX addons. (#33126)

Michael Herzog пре 1 месец
родитељ
комит
9657ec4376

+ 10 - 0
examples/jsm/tsl/display/AfterImageNode.js

@@ -80,6 +80,14 @@ class AfterImageNode extends TempNode {
 		 */
 		this._textureNodeOld = texture( this._oldRT.texture );
 
+		/**
+		 * The material for the composite pass.
+		 *
+		 * @private
+		 * @type {?NodeMaterial}
+		 */
+		this._materialComposed = null;
+
 		/**
 		 * The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders
 		 * its effect once per frame in `updateBefore()`.
@@ -226,6 +234,8 @@ class AfterImageNode extends TempNode {
 		this._compRT.dispose();
 		this._oldRT.dispose();
 
+		if ( this._materialComposed !== null ) this._materialComposed.dispose();
+
 	}
 
 }

+ 11 - 0
examples/jsm/tsl/display/AnamorphicNode.js

@@ -98,6 +98,15 @@ class AnamorphicNode extends TempNode {
 		 */
 		this._textureNode = passTexture( this, this._renderTarget.texture );
 
+		/**
+		 * The material for the anamorphic pass.
+		 *
+		 * @private
+		 * @type {?NodeMaterial}
+		 */
+		this._material = null;
+
+
 		/**
 		 * The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders
 		 * its effect once per frame in `updateBefore()`.
@@ -239,6 +248,8 @@ class AnamorphicNode extends TempNode {
 
 		this._renderTarget.dispose();
 
+		if ( this._material !== null ) this._material.dispose();
+
 	}
 
 	/**

+ 10 - 0
examples/jsm/tsl/display/BilateralBlurNode.js

@@ -112,6 +112,14 @@ class BilateralBlurNode extends TempNode {
 		this._textureNode = passTexture( this, this._verticalRT.texture );
 		this._textureNode.uvNode = textureNode.uvNode;
 
+		/**
+		 * The material for the blur pass.
+		 *
+		 * @private
+		 * @type {?NodeMaterial}
+		 */
+		this._material = null;
+
 		/**
 		 * The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders
 		 * its effect once per frame in `updateBefore()`.
@@ -318,6 +326,8 @@ class BilateralBlurNode extends TempNode {
 		this._horizontalRT.dispose();
 		this._verticalRT.dispose();
 
+		if ( this._material !== null ) this._material.dispose();
+
 	}
 
 	/**

+ 10 - 0
examples/jsm/tsl/display/GaussianBlurNode.js

@@ -98,6 +98,14 @@ class GaussianBlurNode extends TempNode {
 		this._textureNode = passTexture( this, this._verticalRT.texture );
 		this._textureNode.uvNode = textureNode.uvNode;
 
+		/**
+		 * The material for the blur pass.
+		 *
+		 * @private
+		 * @type {?NodeMaterial}
+		 */
+		this._material = null;
+
 		/**
 		 * The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders
 		 * its effect once per frame in `updateBefore()`.
@@ -303,6 +311,8 @@ class GaussianBlurNode extends TempNode {
 		this._horizontalRT.dispose();
 		this._verticalRT.dispose();
 
+		if ( this._material !== null ) this._material.dispose();
+
 	}
 
 	/**

粤ICP备19079148号