Parcourir la source

TSL: Deprecated `.temp()` (#29516)

* deprecated `.temp()`

* update examples

* cleanup

* Update VarNode.js

* Update VarNode.js
sunag il y a 1 an
Parent
commit
9355893362

+ 1 - 1
examples/webgpu_compute_points.html

@@ -66,7 +66,7 @@
 					const pointer = uniform( pointerVector );
 					const limit = uniform( scaleVector );
 
-					const position = particle.add( velocity ).temp();
+					const position = particle.add( velocity ).toVar();
 
 					velocity.x = position.x.abs().greaterThanEqual( limit.x ).select( velocity.x.negate(), velocity.x );
 					velocity.y = position.y.abs().greaterThanEqual( limit.y ).select( velocity.y.negate(), velocity.y );

+ 1 - 1
examples/webgpu_materials.html

@@ -218,7 +218,7 @@
 				const loopCount = 10;
 				material.colorNode = Loop( loopCount, ( { i } ) => {
 
-					const output = vec4().temp();
+					const output = vec4().toVar();
 					const scale = oscSine().mul( .09 ); // just a value to test
 
 					const scaleI = scale.mul( i );

+ 15 - 3
src/nodes/core/VarNode.js

@@ -54,7 +54,19 @@ class VarNode extends Node {
 
 export default VarNode;
 
-export const temp = /*@__PURE__*/ nodeProxy( VarNode );
+const createVar = /*@__PURE__*/ nodeProxy( VarNode );
+
+addMethodChaining( 'toVar', ( ...params ) => createVar( ...params ).append() );
+
+// Deprecated
+
+export const temp = ( node ) => { // @deprecated, r170
+
+	console.warn( 'TSL: "temp" is deprecated. Use ".toVar()" instead.' );
+
+	return createVar( node );
+
+};
+
+addMethodChaining( 'temp', temp );
 
-addMethodChaining( 'temp', temp ); // @TODO: Will be removed in the future
-addMethodChaining( 'toVar', ( ...params ) => temp( ...params ).append() );

粤ICP备19079148号