File: VarNode.md | Updated: 11/15/2025
Class for representing shader variables as nodes. Variables are created from existing nodes like the following:
const depth = sampleDepth( uvNode ).toVar( 'depth' );
Constructs a new variable node.
node | The node for which a variable should be created.
---|---
name | The name of the variable in the shader. Default is null.
readOnly | The read-only flag. Default is false.
VarNode sets this property to true by default.
Default is true.
Overrides: Node#global
This flag is used to indicate that this node is used for intent.
Default is false.
This flag can be used for type testing.
Default is true.
The name of the variable in the shader. If no name is defined, the node system auto-generates one.
Default is null.
Overrides: Node#name
The node for which a variable should be created.
Add this flag to the node system to indicate that this node require parents.
Default is true.
Overrides: Node#parents
The read-only flag.
Default is false.
Returns the intent flag of this node.
Returns: The intent flag.
Sets the intent flag for this node.
This flag is used to indicate that this node is used for intent and should not be built directly. Instead, it is used to indicate that the node should be treated as a variable intent.
It's useful for assigning variables without needing creating a new variable node.
value | The value to set for the intent flag.
---|---
Returns: This node.