nodeProxy
An internal TSL factory function used to efficiently define new node functions and is the core mechanism that enables the fluent, chainable API (e.g., .mul()).
Core Advantages
Drastically simplifies the internal definition of TSL nodes through code abstraction and reuse (DRY principle), providing end-developers with an intuitive and fluent chainable syntax.
Common Uses
(Internal Tool) Defining basic math functions within the library (e.g., sin, abs)
(Internal Tool) Creating core input nodes (e.g., uv, positionWorld)
(Internal Tool) Wrapping node classes that require parameters (e.g., texture)
How to adjust
Adjustment is done at the library development stage by changing the arguments passed to `nodeProxy`. For example, changing the second argument from `MathNode.SIN` to `MathNode.ABS` will change the resulting function from calculating a sine value to calculating an absolute value, thus defining a new node with completely different functionality.
Code Examples
1// Inside the TSL library, a new function is defined like this:
2const saturate = nodeProxy( MathNode, MathNode.SATURATE );