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)| Parameter | Type | Default Value |
|---|---|---|
| structTypeNode | any | — |
| values | any | — |
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| structTypeNode | any | — | |
| values | any | — | |
| isStructNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | (builder: any) => any | |
| getMemberType | (builder: any, name: any) => any | |
| _getChildren | () => Array<…> | |
| generate | (builder: any) => any | |
Extends
NodeTSL function for creating a struct node.
| Parameter | Type | Default Value |
|---|---|---|
| membersLayout | Object | — |
| name? | null | string | null |
Returns
Function