| ▸onUpdate | (callback: Function, updateType: string) => Node | — |
Convenient method for defining {@link Node#update}. |
| callback | Function | — | | updateType | string | — |
|
| ▸onFrameUpdate | (callback: Function) => Node | — |
Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but
this method automatically sets the update type to FRAME. |
| ▸onRenderUpdate | (callback: Function) => Node | — |
Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but
this method automatically sets the update type to RENDER. |
| ▸onObjectUpdate | (callback: Function) => Node | — |
Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but
this method automatically sets the update type to OBJECT. |
| ▸onReference | (callback: Function) => Node | — |
Convenient method for defining {@link Node#updateReference}. |
| ▸updateReference | () => any | — |
Nodes might refer to other objects like materials. This method allows to dynamically update the reference
to such objects based on a given state (e.g. the current node frame or builder). |
| ▸isGlobal | () => boolean | — |
By default this method returns the value of the {@link Node#global} flag. This method
can be overwritten in derived classes if an analytical way is required to determine the
global cache referring to the current shader-stage. |
| ▸getChildren | () => Generator<…> | — |
Generator function that can be used to iterate over the child nodes. Returns Generator<any, void, unknown> |
| ▸dispose | () => void | — |
Calling this method dispatches the dispose event. This event can be used
to register event listeners for clean up tasks. |
| ▸traverse | (callback: traverseCallback) => void | — |
Callback for {@link Node#traverse}.
Can be used to traverse through the node’s hierarchy. |
| callback | traverseCallback | — |
|
| ▸_getChildren | (ignores?: Set<…>) => Array<…> | — |
Returns the child nodes of this node. |
| ignores? | Set<Node> | new Set() |
|
| ▸getCacheKey | (force?: boolean, ignores?: Set<…>) => number | — |
Returns the cache key for this node. |
| force? | boolean | false | | ignores? | Set<Node> | null |
|
| ▸customCacheKey | () => number | — |
Generate a custom cache key for this node. |
| ▸getScope | () => Node | — |
Returns the references to this node which is by default this. |
| ▸getHash | () => string | — |
Returns the hash of the node which is used to identify the node. By default it’s
the {@link Node#uuid} however derived node classes might have to overwrite this method
depending on their implementation. |
| ▸getUpdateType | () => { NONE: string; FRAME: string; RENDER: string; OBJECT: string; } | — |
Returns the update type of {@link Node#update}. Returns |
| NONE | string | — | | FRAME | string | — | | RENDER | string | — | | OBJECT | string | — |
|
| ▸getUpdateBeforeType | () => { NONE: string; FRAME: string; RENDER: string; OBJECT: string; } | — |
Returns the update type of {@link Node#updateBefore}. Returns |
| NONE | string | — | | FRAME | string | — | | RENDER | string | — | | OBJECT | string | — |
|
| ▸getUpdateAfterType | () => { NONE: string; FRAME: string; RENDER: string; OBJECT: string; } | — |
Returns the update type of {@link Node#updateAfter}. Returns |
| NONE | string | — | | FRAME | string | — | | RENDER | string | — | | OBJECT | string | — |
|
| ▸getElementType | (builder: NodeBuilder) => string | — |
Certain types are composed of multiple elements. For example a vec3
is composed of three float values. This method returns the type of
these elements. |
| ▸getMemberType | () => string | — |
Returns the node member type for the given name. |
| ▸getNodeType | (builder: NodeBuilder) => string | — |
|
| ▸getShared | (builder: NodeBuilder) => Node | — |
This method is used during the build process of a node and ensures
equal nodes are not built multiple times but just once. For example if
attribute( 'uv' ) is used multiple times by the user, the build
process makes sure to process just the first node. |
| ▸getArrayCount | () => null | number | — |
Returns the number of elements in the node array. |
| ▸setup | (builder: NodeBuilder) => null | Node | — |
Represents the setup stage which is the first step of the build process, see {@link Node#build} method.
This method is often overwritten in derived modules to prepare the node which is used as a node’s output/result.
If an output node is prepared, then it must be returned in the return statement of the derived module’s setup function. |
| ▸analyze | (builder: NodeBuilder, output?: null | Node) => void | — |
Represents the analyze stage which is the second step of the build process, see {@link Node#build} method.
This stage analyzes the node hierarchy and ensures descendent nodes are built. |
| builder | NodeBuilder | — | | output? | null | Node | null |
|
| ▸generate | (builder: NodeBuilder, output?: null | string) => null | string | — |
Represents the generate stage which is the third step of the build process, see {@link Node#build} method.
This state builds the output node and returns the resulting shader string. |
| builder | NodeBuilder | — | | output? | null | string | — |
|
| ▸updateBefore | () => null | boolean | — |
The method can be implemented to update the node’s internal state before it is used to render an object.
The {@link Node#updateBeforeType} property defines how often the update is executed. |
| ▸updateAfter | () => null | boolean | — |
The method can be implemented to update the node’s internal state after it was used to render an object.
The {@link Node#updateAfterType} property defines how often the update is executed. |
| ▸update | () => null | boolean | — |
The method can be implemented to update the node’s internal state when it is used to render an object.
The {@link Node#updateType} property defines how often the update is executed. |
| ▸before | (node: any) => this | — |
|
| ▸build | (builder: NodeBuilder, output?: null | string | Node) => null | string | Node | — |
This method performs the build of a node. The behavior and return value depend on the current build stage:
-
setup
: Prepares the node and its children for the build process. This process can also create new nodes. Returns the node itself or a variant.
-
analyze
: Analyzes the node hierarchy for optimizations in the code generation stage. Returns
null
.
-
generate
: Generates the shader code for the node. Returns the generated shader string.
|
| builder | NodeBuilder | — | | output? | null | string | Node | null |
Returns null | string | Node |
| ▸getSerializeChildren | () => Generator<…> | — |
Returns the child nodes as a JSON object. Returns Generator<Object, any, any> |
| ▸serialize | (json: Object) => void | — |
Serializes the node to JSON. |
| ▸deserialize | (json: Object) => void | — |
Deserializes the node from the given JSON. |
| ▸toJSON | (meta: null | Object) => Object | — |
Serializes the node into the three.js JSON Object/Scene format. |