Skip to content

Commit

Permalink
TSL: Deprecated .temp() (#29516)
Browse files Browse the repository at this point in the history
* deprecated `.temp()`

* update examples

* cleanup

* Update VarNode.js

* Update VarNode.js
  • Loading branch information
sunag authored Sep 28, 2024
1 parent 64072a1 commit 9355893
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/webgpu_compute_points.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion examples/webgpu_materials.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
18 changes: 15 additions & 3 deletions src/nodes/core/VarNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() );

0 comments on commit 9355893

Please sign in to comment.