Creates a new AddShaderNode with the specified composition and component types.
The composition type (Scalar, Vec2, Vec3, or Vec4)
The component type (Float, Int, etc.)
Protected
Optional
__commonProtected
__inputProtected
__inputsProtected
__outputsProtected
__shaderProtected
__shaderCollection of tags associated with this object
Static
Readonly
InvalidInvalid object UID constant
Static
_shaderStatic
currentCurrent maximum object count for UID generation
Gets all input connections for this node.
An array of input connection configurations
Gets the unique object identifier
The object's UID
Gets the shader function name for this node.
The function name used in shader code
Gets the unique identifier for this shader node.
The unique node identifier
Gets the unique name of this object
The unique name string
Internal
Copies tag data from another RnObject instance to this object
The source RnObject to copy tags from
Adds an input connection to this node from another shader node. This establishes a data flow connection between the output of one node and the input of this node.
The composition type enum
The component type enum
The source shader node to connect from
The output socket of the source node
The input socket of this node to connect to
Returns the default value for a given composition type. This is used to initialize input sockets with appropriate zero values.
The composition type to get the default value for
The default value (zero) for the specified composition type
Finds and returns an input socket by name.
The name of the input socket to find
The input socket if found, undefined otherwise
Gets all input sockets for this node.
An array of all input sockets
Finds and returns an output socket by name.
The name of the output socket to find
The output socket if found, undefined otherwise
Gets all output sockets for this node.
An array of all output sockets
Retrieves the shader code for the specified shader stage. Returns appropriate code based on the current rendering approach (WebGL/WebGPU).
The shader stage (vertex or fragment) to get code for
The shader code string for the specified stage
Generates the appropriate shader function name derivative based on the current rendering backend and input socket types.
For WebGPU, this method generates type-specific function names to handle different combinations of composition and component types. For WebGL, it returns the base shader function name.
The shader function name derivative for the current configuration
Gets the left-hand side input socket. This socket represents the first operand in the addition operation.
The left-hand side input socket
Gets the right-hand side input socket. This socket represents the second operand in the addition operation.
The right-hand side input socket
Gets the output socket that contains the result of the addition operation.
The output socket containing the addition result
Generates a function call statement for this shader node in the final shader code. This method constructs the appropriate function call syntax with proper parameter passing for both WebGL and WebGPU rendering approaches.
The index of this node in the execution order
The shader node to generate the call for
The name of the function to call
Array of input variable names for each node
Array of output variable names for each node
The generated function call statement string
Checks if this object has all the specified tags with exactly matching values
Object containing tag names as keys and expected values
True if all specified tags exist with matching values, false otherwise
Checks if the object's combined tag string contains all the provided search strings. This allows for flexible searching within tag names and values.
Array of strings that must all be present in the combined tag string
True if all strings are found in the combined tag string, false otherwise
Attempts to set a tag on this object. If the tag already exists, it will be replaced.
The tag object containing the name and value to set
True if the tag was successfully set, false if the tag name contains invalid characters
Attempts to set a unique name for this object
The desired unique name
If true, appends UID to make name unique when conflicts occur; if false, fails on conflict
True if the name was successfully set, false if there was a conflict and toAddNameIfConflict was false
Static
_resetStatic
getStatic
getStatic
getRetrieves a shader node by its unique identifier.
The unique identifier of the shader node
The shader node with the specified UID
Static
searchSearches for the first object that has a specific tag with the given value
The tag name to search for
The tag value to match
WeakRef to the first matching object, or undefined if not found
A shader node that performs addition operations between two input values. Supports scalar, Vec2, Vec3, and Vec4 compositions with appropriate component types.
This node creates two input sockets (lhs and rhs) and one output socket, all of the same composition and component type. The node generates shader code for both WebGL (GLSL) and WebGPU (WGSL) backends.
Example