Capítulo 438 de 859
Base class for all nodes.
true when the node should be regenerated.float or vec3).Constructor
| Signature |
|---|
new Node( nodeType : string ) |
Properties
| Property | Description |
|---|---|
.global : boolean | Whether this node is global or not. This property is relevant for the internal node caching system. All nodes which should be declared just once should set this flag to true (a typical example is [… |
.id : number (readonly) | The unique ID of the node. |
.isNode : boolean (readonly) | This flag can be used for type testing. |
.name : string | The name of the node. |
.needsUpdate : boolean | Set this property to true when the node should be regenerated. |
.nodeType : string | The node type. This represents the result type of the node (e.g. float or vec3). |
.parents : boolean | Create a list of parents for this node during the build process. |
.stackTrace : string | The stack trace of the node for debugging purposes. |
.type : string (readonly) | The type of the class. The value is usually the constructor name. |
.updateAfterType : string | The update type of the node's Node#updateAfter method. Possible values are listed in NodeUpdateType. |
.updateBeforeType : string | The update type of the node's Node#updateBefore method. Possible values are listed in NodeUpdateType. |
.updateType : string | The update type of the node's Node#update method. Possible values are listed in NodeUpdateType. |
.uuid : string (readonly) | The UUID of the node. |
.version : number (readonly) | The version of the node. The version automatically is increased when Node#needsUpdate is set to true. |
.captureStackTrace : boolean | Enables or disables the automatic capturing of stack traces for nodes. |
Methods
| Method | Description |
|---|---|
.analyze( builder : NodeBuilder, output : Node ) | Represents the analyze stage which is the second step of the build process, see Node#build method. This stage analyzes the node hierarchy and ensures descendent nodes are built. |
| `.build( builder : NodeBuilder, output : string | Node ) : Node |
.customCacheKey() : number | Generate a custom cache key for this node. |
.deserialize( json : Object ) | Deserializes the node from the given JSON. |
.dispose() | Calling this method dispatches the dispose event. This event can be used to register event listeners for clean up tasks. |
.generate( builder : NodeBuilder, output : string ) : string | Represents the generate stage which is the third step of the build process, see Node#build method. This state builds the output node and returns the resulting shader string. |
.generateNodeType( builder : NodeBuilder, output : string ) : string | Returns the node's type. |
.getArrayCount( builder : NodeBuilder ) : number | Returns the number of elements in the node array. |
.getCacheKey( force : boolean, ignores : Set.<Node> ) : number | Returns the cache key for this node. |
.getChildren() : Node (generator) | Generator function that can be used to iterate over the child nodes. |
.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. |
.getHash( builder : NodeBuilder ) : string | Returns the hash of the node which is used to identify the node. By default it's the Node#uuid however derived node classes might have to overwrite this method depending on their im… |
.getMemberType( builder : NodeBuilder, name : string ) : string | Returns the node member type for the given name. |
.getNodeType( builder : NodeBuilder, output : string ) : string | Returns the node's type. |
.getScope() : Node | Returns the references to this node which is by default this. |
.getSerializeChildren() : Generator.<Object> | Returns the child nodes as a JSON object. |
.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 b… |
.getUpdateAfterType() : NodeUpdateType | Returns the update type of Node#updateAfter. |
.getUpdateBeforeType() : NodeUpdateType | Returns the update type of Node#updateBefore. |
.getUpdateType() : NodeUpdateType | Returns the update type of Node#update. |
.isGlobal( builder : NodeBuilder ) : boolean | By default this method returns the value of the Node#global flag. This method can be overwritten in derived classes if an analytical way is required to determine the global cache … |
.onFrameUpdate( callback : function ) : Node | Convenient method for defining Node#update. Similar to Node#onUpdate, but this method automatically sets the update type to FRAME. |
.onObjectUpdate( callback : function ) : Node | Convenient method for defining Node#update. Similar to Node#onUpdate, but this method automatically sets the update type to OBJECT. |
.onReference( callback : function ) : Node | Convenient method for defining Node#updateReference. |
.onRenderUpdate( callback : function ) : Node | Convenient method for defining Node#update. Similar to Node#onUpdate, but this method automatically sets the update type to RENDER. |
.onUpdate( callback : function, updateType : string ) : Node | Convenient method for defining Node#update. |
.serialize( json : Object ) | Serializes the node to JSON. |
.setup( builder : NodeBuilder ) : Node | Represents the setup stage which is the first step of the build process, see Node#build method. This method is often overwritten in derived modules to prepare the node which is use… |
.toJSON( meta : Object ) : Object | Serializes the node into the three.js JSON Object/Scene format. |
.traverse( callback : traverseCallback ) | Can be used to traverse through the node's hierarchy. |
.update( frame : NodeFrame ) : boolean (abstract) | The method can be implemented to update the node's internal state when it is used to render an object. The Node#updateType property defines how often the update is executed. |
.updateAfter( frame : NodeFrame ) : boolean (abstract) | The method can be implemented to update the node's internal state after it was used to render an object. The Node#updateAfterType property defines how often the update is… |
.updateBefore( frame : NodeFrame ) : boolean (abstract) | The method can be implemented to update the node's internal state before it is used to render an object. The Node#updateBeforeType property defines how often the update … |
.updateReference( state : any ) : 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). |