Class NodeGeometry
Constructors
constructor
-
Creates a new geometry
Parameters
- name: string
defines the name of the geometry
Returns NodeGeometry
- name: string
Properties
attached Blocks
Gets an array of blocks that needs to be serialized even if they are not yet connected
comment
A free comment about the geometry
editor Data
Gets or sets data used by visual editor
name
The name of the geometry
on Build Observable
Observable raised when the geometry is built
output Block
Gets or sets the GeometryOutputBlock used to gather the final geometry data
snippet Id
Snippet ID if the material was created from the snippet server
StaticEditor URL
Define the Url to load node editor script
StaticSnippet Url
Define the Url to load snippets
Accessors
build Execution Time
-
get buildExecutionTime(): number
Gets the time spent to build this block (in ms)
Returns number
vertex Data
-
Gets the vertex data. This needs to be done after build() was called. This is used to access vertexData when creating a mesh is not required.
Returns Nullable<VertexData>
Methods
build
-
Build the final geometry. Please note that the geometry MAY not be ready until the onBuildObservable is raised.
Parameters
- verbose: boolean = false
defines if the build should log activity
- updateBuildId: boolean = true
defines if the internal build Id should be updated (default is true)
- autoConfigure: boolean = false
defines if the autoConfigure method should be called when initializing blocks (default is false)
Returns void
- verbose: boolean = false
clear
-
Clear the current geometry
Returns void
clone
-
Makes a duplicate of the current geometry.
Parameters
- name: string
defines the name to use for the new geometry
Returns NodeGeometry
the new geometry
- name: string
create Mesh
dispose
-
Disposes the resources
Returns void
edit
-
Launch the node geometry editor
Parameters
Optionalconfig: INodeGeometryEditorOptionsDefine the configuration of the editor
Returns Promise<void>
a promise fulfilled when the node editor is visible
generate Code
-
Generate a string containing the code declaration required to create an equivalent of this geometry
Returns string
a string
get Block By Name
-
Get a block by its name
Parameters
- name: string
defines the name of the block to retrieve
Returns NodeGeometryBlock | null
the required block or null if not found
- name: string
get Block By Predicate
-
Get a block using a predicate
Parameters
- predicate: (block: NodeGeometryBlock) => boolean
defines the predicate used to find the good candidate
Returns NodeGeometryBlock | null
the required block or null if not found
- predicate: (block: NodeGeometryBlock) => boolean
get Class Name
-
Gets the current class name of the geometry e.g. "NodeGeometry"
Returns string
the class name
get Input Blocks
-
Gets the list of input blocks attached to this material
Returns GeometryInputBlock[]
an array of InputBlocks
parse Serialized Object
-
Clear the current graph and load a new one from a serialization object
Parameters
- source: any
defines the JSON representation of the geometry
- merge: boolean = false
defines whether or not the source must be merged or replace the current content
Returns void
- source: any
remove Block
-
Remove a block from the current geometry
Parameters
- block: NodeGeometryBlock
defines the block to remove
Returns void
- block: NodeGeometryBlock
serialize
-
Serializes this geometry in a JSON representation
Parameters
OptionalselectedBlocks: NodeGeometryBlock[]defines the list of blocks to save (if null the whole geometry will be saved)
Returns any
the serialized geometry object
set To Default
-
Clear the current geometry and set it to a default state
Returns void
update Mesh
StaticCreate Default
-
Creates a new node geometry set to default basic configuration
Parameters
- name: string
defines the name of the geometry
Returns NodeGeometry
a new NodeGeometry
- name: string
StaticParse
-
Creates a node geometry from parsed geometry data
Parameters
- source: any
defines the JSON representation of the geometry
Returns NodeGeometry
a new node geometry
- source: any
StaticParse From Snippet Async
-
ParseFromSnippetAsync(
snippetId: string,
nodeGeometry?: NodeGeometry,
skipBuild?: boolean,
): Promise<NodeGeometry>Creates a node geometry from a snippet saved by the node geometry editor
Parameters
- snippetId: string
defines the snippet to load
OptionalnodeGeometry: NodeGeometrydefines a node geometry to update (instead of creating a new one)
- skipBuild: boolean = false
defines whether to build the node geometry
Returns Promise<NodeGeometry>
a promise that will resolve to the new node geometry
- snippetId: string
Defines a node based geometry
See
demo at https://playground.babylonjs.com#PYY6XE#69