StructNode

Last modified: Mar 5, 2026

StructNode allows to create custom structures with multiple members. This can also be used to define structures in attribute and uniform data.

// Define a custom struct
const BoundingBox = struct( { min: 'vec3', max: 'vec3' } );

// Create a new instance of the struct
const bb = BoundingBox( vec3( 0 ), vec3( 1 ) ); // style 1
Cannot redeclare block-scoped variable 'bb'. (2451)const bb = BoundingBox( { min: vec3( 0 ), max: vec3( 1 ) } ); // style 2
Cannot redeclare block-scoped variable 'bb'. (2451)
// Access the struct members
const min = bb.get( 'min' );

// Assign a new value to a member
min.assign( vec3() );
export {}

Constructor

new StructNode(structTypeNode, values)
ParameterTypeDefault Value
structTypeNodeany
valuesany
AccessorType

Properties

PropertyTypeDefault Value
structTypeNodeany
valuesany
isStructNodeboolean
MethodType

Extends

Node

struct

TSL function for creating a struct node.

ParameterTypeDefault Value
membersLayoutObject
name?null | stringnull

Returns

Function