getConstNodeType
An internal TSL JavaScript helper function whose core task is to infer the corresponding TSL/GLSL type string (e.g., 'float', 'vec3') by inspecting a JS value.
Core Advantages
It encapsulates complex type inference logic, making TSL's internal code cleaner, more consistent, and easier to maintain. It's one of the behind-the-scenes heroes that enables TSL's convenient "syntax sugar" (like `add(node, 0.5)`).
Common Uses
Internally in `const()` or `toNode()` to decide what type of constant node to create.
Internally in math functions (like `add()`) to help resolve overloaded parameter types.
As part of the type validation system within the TSL compiler (NodeBuilder).
How to adjust
This is a stateless, internal pure function and cannot be "adjusted". Its behavior is determined entirely by the input JS value. For example, passing a `vec3()` node returns 'vec3', while passing a plain number returns `null`, triggering different subsequent type-handling logic within the TSL system.
Code Examples
1// Example usage (conceptual):
2getConstNodeType( vec3( 1, 0, 0 ) ); // Returns 'vec3'
3getConstNodeType( 'color' ); // Returns 'color'
4getConstNodeType( 123.45 ); // Returns null (handled by other checks)