Options
All
  • Public
  • Public/Protected
  • All
Menu

Defines a block that can be used inside a node based material

Hierarchy

Index

Constructors

  • Creates a new NodeMaterialBlock

    Parameters

    • name: string

      defines the block name

    • Optional target: NodeMaterialBlockTargets

      defines the target of that block (Vertex by default)

    • Optional isFinalMerger: boolean

      defines a boolean indicating that this block is an end block (e.g. it is generating a system value). Default is false

    • Optional isInput: boolean

      defines a boolean indicating that this block is an input (e.g. it sends data to the shader). Default is false

    Returns NodeMaterialBlock

Properties

comments: string

Gets or sets the comments associated with this block

inputsAreExclusive: boolean

Gets or sets a boolean indicating that only one input can be connected at a time

uniqueId: number

Gets or sets the unique id of the node

visibleInInspector: boolean

Gets or sets a boolean indicating that this input can be edited in the Inspector (false by default)

visibleOnFrame: boolean

Gets or sets a boolean indicating that this input can be edited from a collapsed frame

Accessors

  • get buildId(): number
  • set buildId(value: number): void
  • Gets or sets the build Id

    Returns number

  • Gets or sets the build Id

    Parameters

    • value: number

    Returns void

  • get isFinalMerger(): boolean
  • Gets a boolean indicating that this block is an end block (e.g. it is generating a system value)

    Returns boolean

  • get isInput(): boolean
  • Gets a boolean indicating that this block is an input (e.g. it sends data to the shader)

    Returns boolean

  • get isUnique(): boolean
  • Gets a boolean indicating that this block can only be used once per NodeMaterial

    Returns boolean

  • get name(): string
  • set name(newName: string): void
  • Gets the name of the block

    Returns string

  • Sets the name of the block. Will check if the name is valid.

    Parameters

    • newName: string

    Returns void

  • Gets or sets the target of the block

    Returns NodeMaterialBlockTargets

  • Gets or sets the target of the block

    Parameters

    Returns void

  • get willBeGeneratedIntoVertexShaderFromFragmentShader(): boolean
  • Gets a boolean indicating that the code of this block will be promoted to vertex shader even if connected to fragment output

    Returns boolean

Methods

  • Lets the block try to connect some inputs automatically

    Parameters

    Returns void

  • Bind data to effect. Will only be called for blocks with isBindable === true

    Parameters

    • effect: Effect

      defines the effect to bind data to

    • nodeMaterial: NodeMaterial

      defines the hosting NodeMaterial

    • Optional mesh: Mesh

      defines the mesh that will be rendered

    • Optional subMesh: SubMesh

      defines the submesh that will be rendered

    Returns void

  • Compile the current node and generate the shader code

    Parameters

    • state: NodeMaterialBuildState

      defines the current compilation state (uniforms, samplers, current string)

    • activeBlocks: NodeMaterialBlock[]

      defines the list of active blocks (i.e. blocks to compile)

    Returns boolean

    true if already built

  • Clone the current block to a new identical block

    Parameters

    • scene: Scene

      defines the hosting scene

    • Optional rootUrl: string

      defines the root URL to use to load textures and relative dependencies

    Returns null | NodeMaterialBlock

    a copy of the current block

  • Connect current block with another block

    Parameters

    • other: NodeMaterialBlock

      defines the block to connect with

    • Optional options: { input?: string; output?: string; outputSwizzle?: string }

      define the various options to help pick the right connections

      • Optional input?: string
      • Optional output?: string
      • Optional outputSwizzle?: string

    Returns undefined | NodeMaterialBlock

    the current block

  • dispose(): void
  • Release resources

    Returns void

  • getClassName(): string
  • Gets the current class name e.g. "NodeMaterialBlock"

    Returns string

    the class name

  • Will return the first available input e.g. the first one which is not an uniform or an attribute

    Parameters

    Returns null | NodeMaterialConnectionPoint

    the first available input or null

  • Will return the first available output e.g. the first one which is not yet connected and not a varying

    Parameters

    Returns null | NodeMaterialConnectionPoint

    the first available input or null

  • Find an input by its name

    Parameters

    • name: string

      defines the name of the input to look for

    Returns null | NodeMaterialConnectionPoint

    the input or null if not found

  • Find an output by its name

    Parameters

    • name: string

      defines the name of the output to look for

    Returns null | NodeMaterialConnectionPoint

    the output or null if not found

  • Initialize the block and prepare the context for build

    Parameters

    Returns void

  • initializeDefines(mesh: AbstractMesh, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines, useInstances?: boolean): void
  • Initialize defines for shader compilation

    Parameters

    • mesh: AbstractMesh

      defines the mesh to be rendered

    • nodeMaterial: NodeMaterial

      defines the node material requesting the update

    • defines: NodeMaterialDefines

      defines the material defines to update

    • Optional useInstances: boolean

      specifies that instances should be used

    Returns void

  • Checks if the current block is an ancestor of a given block

    Parameters

    Returns boolean

    true if block is a descendant

  • Checks if the block is ready

    Parameters

    • mesh: AbstractMesh

      defines the mesh to be rendered

    • nodeMaterial: NodeMaterial

      defines the node material requesting the update

    • defines: NodeMaterialDefines

      defines the material defines to update

    • Optional useInstances: boolean

      specifies that instances should be used

    Returns boolean

    true if the block is ready

  • Update defines for shader compilation

    Parameters

    • mesh: AbstractMesh

      defines the mesh to be rendered

    • nodeMaterial: NodeMaterial

      defines the node material requesting the update

    • defines: NodeMaterialDefines

      defines the material defines to update

    • Optional useInstances: boolean

      specifies that instances should be used

    • Optional subMesh: SubMesh

      defines which submesh to render

    Returns void

  • Add potential fallbacks if shader compilation fails

    Parameters

    Returns void

  • Register a new input. Must be called inside a block constructor

    Parameters

    • name: string

      defines the connection point name

    • type: NodeMaterialBlockConnectionPointTypes

      defines the connection point type

    • Optional isOptional: boolean

      defines a boolean indicating that this input can be omitted

    • Optional target: NodeMaterialBlockTargets

      defines the target to use to limit the connection point (will be VertexAndFragment by default)

    • Optional point: NodeMaterialConnectionPoint

      an already created connection point. If not provided, create a new one

    Returns NodeMaterialBlock

    the current block

  • Register a new output. Must be called inside a block constructor

    Parameters

    Returns NodeMaterialBlock

    the current block

  • Function called when a block is declared as repeatable content generator

    Parameters

    • vertexShaderState: NodeMaterialBuildState

      defines the current compilation state for the vertex shader

    • fragmentShaderState: NodeMaterialBuildState

      defines the current compilation state for the fragment shader

    • mesh: AbstractMesh

      defines the mesh to be rendered

    • defines: NodeMaterialDefines

      defines the material defines to update

    Returns void

  • serialize(): any
  • Serializes this block in a JSON representation

    Returns any

    the serialized block object

  • Add uniforms, samplers and uniform buffers at compilation time

    Parameters

    • state: NodeMaterialBuildState

      defines the state to update

    • nodeMaterial: NodeMaterial

      defines the node material requesting the update

    • defines: NodeMaterialDefines

      defines the material defines to update

    • uniformBuffers: string[]

      defines the list of uniform buffer names

    Returns void

  • validateBlockName(newName: string): boolean
  • Validates the new name for the block node.

    Parameters

    • newName: string

      the new name to be given to the node.

    Returns boolean

    false if the name is a reserve word, else true.

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Inherited constructor
  • Static method

Settings

Theme