Class NodeMaterialDebugBlock
Hierarchy (View Summary)
- NodeMaterialBlock
- NodeMaterialDebugBlock
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Creates a new NodeMaterialDebugBlock
Parameters
- name: string
defines the block name
Returns NodeMaterialDebugBlock
- name: string
Properties
comments
Gets or sets the comments associated with this block
inputs Are Exclusive
Gets or sets a boolean indicating that only one input can be connected at a time
on Code Is Ready Observable
Observable raised when the block code is ready (if the code loading is async)
render Alpha
Gets or sets a boolean indicating if we want to render alpha when using a rgba input
unique Id
Gets or sets the unique id of the node
visible In Inspector
Gets or sets a boolean indicating that this input can be edited in the Inspector (false by default)
visible On Frame
Gets or sets a boolean indicating that this input can be edited from a collapsed frame
Accessors
build Id
-
get buildId(): number
Gets or sets the build Id
Returns number
-
set buildId(value: number): void
Parameters
- value: number
Returns void
code Is Ready
-
get codeIsReady(): boolean
Gets a boolean indicating that this block has is code ready to be used
Returns boolean
debug
-
Gets the rgba input component
Returns NodeMaterialConnectionPoint
inputs
-
Gets the list of input points
Returns NodeMaterialConnectionPoint[]
is Active
-
get isActive(): boolean
Gets or sets a boolean indicating that the block is active
Returns boolean
-
set isActive(value: boolean): void
Parameters
- value: boolean
Returns void
is Final Merger
-
get isFinalMerger(): boolean
Gets a boolean indicating that this block is an end block (e.g. it is generating a system value)
Returns boolean
is Input
-
get isInput(): boolean
Gets a boolean indicating that this block is an input (e.g. it sends data to the shader)
Returns boolean
is Loop
-
get isLoop(): boolean
Gets a boolean indicating if this block is a loop
Returns boolean
is Teleport In
-
get isTeleportIn(): boolean
Gets a boolean indicating if this block is a teleport in
Returns boolean
is Teleport Out
-
get isTeleportOut(): boolean
Gets a boolean indicating if this block is a teleport out
Returns boolean
is Unique
-
get isUnique(): boolean
Gets a boolean indicating that this block can only be used once per NodeMaterial
Returns boolean
name
-
get name(): string
Gets the name of the block
Returns string
-
set name(newName: string): void
Sets the name of the block. Will check if the name is valid.
Parameters
- newName: string
Returns void
outputs
-
Gets the list of output points
Returns NodeMaterialConnectionPoint[]
target
-
Gets or sets the target of the block
Returns NodeMaterialBlockTargets
-
Parameters
- value: NodeMaterialBlockTargets
Returns void
will Be Generated Into Vertex Shader From Fragment Shader
-
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
_ deserialize
-
Deserializes the block
Parameters
- serializationObject: any
the serialization object
- scene: Scene
the scene
- rootUrl: string
the root URL
Returns void
- serializationObject: any
auto Configure
-
autoConfigure(
material: NodeMaterial,
additionalFilteringInfo?: (node: NodeMaterialBlock) => boolean,
): voidLets the block try to connect some inputs automatically
Parameters
- material: NodeMaterial
defines the hosting NodeMaterial
- additionalFilteringInfo: (node: NodeMaterialBlock) => boolean = ...
optional additional filtering condition when looking for compatible blocks
Returns void
- material: NodeMaterial
bind
-
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
Optionalmesh: Meshdefines the mesh that will be rendered
OptionalsubMesh: SubMeshdefines the submesh that will be rendered
Returns void
- effect: Effect
build
-
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
- state: NodeMaterialBuildState
clone
-
Clone the current block to a new identical block
Parameters
- scene: Scene
defines the hosting scene
- rootUrl: string = ""
defines the root URL to use to load textures and relative dependencies
Returns NodeMaterialBlock | null
a copy of the current block
- scene: Scene
connect To
-
connectTo(
other: NodeMaterialBlock,
options?: { input?: string; output?: string; outputSwizzle?: string },
): NodeMaterialDebugBlock | undefinedConnect current block with another block
Parameters
- other: NodeMaterialBlock
defines the block to connect with
Optionaloptions: { input?: string; output?: string; outputSwizzle?: string }define the various options to help pick the right connections
Returns NodeMaterialDebugBlock | undefined
the current block
- other: NodeMaterialBlock
dispose
-
Release resources
Returns void
get Class Name
-
Gets the current class name
Returns string
the class name
get First Available Input
-
getFirstAvailableInput(
forOutput?: Nullable<NodeMaterialConnectionPoint>,
): NodeMaterialConnectionPoint | nullWill return the first available input e.g. the first one which is not an uniform or an attribute
Parameters
- forOutput: Nullable<NodeMaterialConnectionPoint> = null
defines an optional connection point to check compatibility with
Returns NodeMaterialConnectionPoint | null
the first available input or null
- forOutput: Nullable<NodeMaterialConnectionPoint> = null
get First Available Output
-
getFirstAvailableOutput(
forBlock?: Nullable<NodeMaterialBlock>,
): NodeMaterialConnectionPoint | nullWill return the first available output e.g. the first one which is not yet connected and not a varying
Parameters
- forBlock: Nullable<NodeMaterialBlock> = null
defines an optional block to check compatibility with
Returns NodeMaterialConnectionPoint | null
the first available input or null
- forBlock: Nullable<NodeMaterialBlock> = null
get Input By Name
-
Find an input by its name
Parameters
- name: string
defines the name of the input to look for
Returns NodeMaterialConnectionPoint | null
the input or null if not found
- name: string
get Output By Name
-
Find an output by its name
Parameters
- name: string
defines the name of the output to look for
Returns NodeMaterialConnectionPoint | null
the output or null if not found
- name: string
get Sibling Output
-
Gets the sibling of the given output
Parameters
- current: NodeMaterialConnectionPoint
defines the current output
Returns NodeMaterialConnectionPoint | null
the next output in the list or null
- current: NodeMaterialConnectionPoint
initialize
-
Initialize the block and prepare the context for build
Parameters
- state: NodeMaterialBuildState
defines the state that will be used for the build
Returns void
- state: NodeMaterialBuildState
initialize Defines
-
Initialize defines for shader compilation
Parameters
- defines: NodeMaterialDefines
defines the material defines to update
Returns void
- defines: NodeMaterialDefines
is An Ancestor Of
-
Checks if the current block is an ancestor of a given block
Parameters
- block: NodeMaterialBlock
defines the potential descendant block to check
Returns boolean
true if block is a descendant
- block: NodeMaterialBlock
is Connected In Fragment Shader
-
Gets a boolean indicating that this connection will be used in the fragment shader
Returns boolean
true if connected in fragment shader
is Ready
-
isReady(
mesh: AbstractMesh,
nodeMaterial: NodeMaterial,
defines: NodeMaterialDefines,
useInstances?: boolean,
): booleanChecks 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
- useInstances: boolean = false
specifies that instances should be used
Returns boolean
true if the block is ready
- mesh: AbstractMesh
prepare Defines
-
prepareDefines(
defines: NodeMaterialDefines,
nodeMaterial: NodeMaterial,
mesh?: AbstractMesh,
useInstances?: boolean,
subMesh?: SubMesh,
): voidUpdate defines for shader compilation
Parameters
- defines: NodeMaterialDefines
defines the material defines to update
- nodeMaterial: NodeMaterial
defines the node material requesting the update
Optionalmesh: AbstractMeshdefines the mesh to be rendered
- useInstances: boolean = false
specifies that instances should be used
OptionalsubMesh: SubMeshdefines which submesh to render
Returns void
- defines: NodeMaterialDefines
provide Fallbacks
-
Add potential fallbacks if shader compilation fails
Parameters
- fallbacks: EffectFallbacks
defines the current prioritized list of fallbacks
Optionalmesh: AbstractMeshdefines the mesh to be rendered
Returns void
- fallbacks: EffectFallbacks
register Input
-
registerInput(
name: string,
type: NodeMaterialBlockConnectionPointTypes,
isOptional?: boolean,
target?: NodeMaterialBlockTargets,
point?: NodeMaterialConnectionPoint,
): NodeMaterialDebugBlockRegister 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
- isOptional: boolean = false
defines a boolean indicating that this input can be omitted
Optionaltarget: NodeMaterialBlockTargetsdefines the target to use to limit the connection point (will be VertexAndFragment by default)
Optionalpoint: NodeMaterialConnectionPointan already created connection point. If not provided, create a new one
Returns NodeMaterialDebugBlock
the current block
- name: string
register Output
-
registerOutput(
name: string,
type: NodeMaterialBlockConnectionPointTypes,
target?: NodeMaterialBlockTargets,
point?: NodeMaterialConnectionPoint,
): NodeMaterialDebugBlockRegister a new output. Must be called inside a block constructor
Parameters
- name: string
defines the connection point name
- type: NodeMaterialBlockConnectionPointTypes
defines the connection point type
Optionaltarget: NodeMaterialBlockTargetsdefines the target to use to limit the connection point (will be VertexAndFragment by default)
Optionalpoint: NodeMaterialConnectionPointan already created connection point. If not provided, create a new one
Returns NodeMaterialDebugBlock
the current block
- name: string
replace Repeatable Content
-
replaceRepeatableContent(
vertexShaderState: NodeMaterialBuildState,
defines: NodeMaterialDefines,
mesh?: AbstractMesh,
): voidFunction called when a block is declared as repeatable content generator
Parameters
- vertexShaderState: NodeMaterialBuildState
defines the current compilation state for the vertex shader
- defines: NodeMaterialDefines
defines the material defines to update
Optionalmesh: AbstractMeshdefines the mesh to be rendered
Returns void
- vertexShaderState: NodeMaterialBuildState
serialize
-
Serializes the block
Returns any
the serialized object
update Uniforms And Samples
-
updateUniformsAndSamples(
state: NodeMaterialBuildState,
nodeMaterial: NodeMaterial,
defines: NodeMaterialDefines,
uniformBuffers: string[],
): voidAdd 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
- state: NodeMaterialBuildState
validate Block Name
-
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.
- newName: string
Block used to render intermediate debug values Please note that the node needs to be active to be generated in the shader Only one DebugBlock should be active at a time