Documentation / scene / LengthNode
Class: LengthNode
Defined in: libs/scene/src/utility/blueprint/common/math.ts:2347
Calculates the length of a vector
Remarks
Returns sqrt(x.x + x.y + x.z + ...), the Euclidean length of the vector. Supports vector inputs (vec2, vec3, vec4). Always returns a float scalar.
Extends
Constructors
Constructor
new LengthNode():
LengthNode
Defined in: libs/scene/src/utility/blueprint/common/math.ts:2348
Returns
LengthNode
Overrides
Properties
func
readonlyfunc:string
Defined in: libs/scene/src/utility/blueprint/common/math.ts:1027
The shader function name (e.g., 'sin', 'add', 'normalize')
Inherited from
outType
readonlyoutType:string
Defined in: libs/scene/src/utility/blueprint/common/math.ts:1029
The explicit output type, if specified (otherwise inferred from inputs)
Inherited from
explicitInTypes
readonlyexplicitInTypes:Nullable<Record<number,string[]>>
Defined in: libs/scene/src/utility/blueprint/common/math.ts:1031
Maps input slot IDs to allowed types for that specific slot
Inherited from
GenericMathNode.explicitInTypes
additionalInTypes
readonlyadditionalInTypes:Nullable<Record<number,string[]>>
Defined in: libs/scene/src/utility/blueprint/common/math.ts:1033
Maps input slot IDs to additional allowed types beyond the common type
Inherited from
GenericMathNode.additionalInTypes
_inputs
protected_inputs:GraphNodeInput[]
Defined in: libs/scene/src/utility/blueprint/node.ts:336
Internal storage for input slot definitions
Inherited from
_outputs
protected_outputs:GraphNodeOutput[]
Defined in: libs/scene/src/utility/blueprint/node.ts:338
Internal storage for output slot definitions
Inherited from
_error
protected_error:string
Defined in: libs/scene/src/utility/blueprint/node.ts:340
Internal storage for error message
Inherited from
Accessors
isUniform
Get Signature
get isUniform():
boolean
Defined in: libs/scene/src/utility/blueprint/node.ts:357
Whether this node contains uniform value/texture
Returns
boolean
Whether this node has uniform value
Inherited from
paramName
Get Signature
get paramName():
string
Defined in: libs/scene/src/utility/blueprint/node.ts:363
Uniform parameter name
Returns
string
Uniform parameter name
Inherited from
inputs
Get Signature
get inputs():
GraphNodeInput[]
Defined in: libs/scene/src/utility/blueprint/node.ts:380
Gets the input slot definitions array
Returns
Array of input slot definitions
Inherited from
outputs
Get Signature
get outputs():
GraphNodeOutput[]
Defined in: libs/scene/src/utility/blueprint/node.ts:384
Gets the output slot definitions array
Returns
Array of output slot definitions
Inherited from
error
Get Signature
get error():
string
Defined in: libs/scene/src/utility/blueprint/node.ts:388
Gets the current error message
Returns
string
Set Signature
set error(
str):void
Defined in: libs/scene/src/utility/blueprint/node.ts:391
Current error message, empty string if no error
Parameters
str
string
Returns
void
Current error message, empty string if no error
Inherited from
Methods
on()
on<
K>(type,listener,context?):void
Defined in: libs/base/dist/index.d.ts:594
IEventTarget.on
Type Parameters
K
K extends "changed"
Parameters
type
K
listener
EventListener<{ changed: []; }, K>
context?
unknown
Returns
void
Inherited from
once()
once<
K>(type,listener,context?):void
Defined in: libs/base/dist/index.d.ts:598
IEventTarget.once
Type Parameters
K
K extends "changed"
Parameters
type
K
listener
EventListener<{ changed: []; }, K>
context?
unknown
Returns
void
Inherited from
off()
off<
K>(type,listener?,context?):void
Defined in: libs/base/dist/index.d.ts:602
IEventTarget.off
Type Parameters
K
K extends "changed"
Parameters
type
K
listener?
EventListener<{ changed: []; }>
context?
unknown
Returns
void
Inherited from
dispatchEvent()
dispatchEvent<
K>(type, ...args):void
Defined in: libs/base/dist/index.d.ts:606
IEventTarget.dispatchEvent
Type Parameters
K
K extends "changed"
Parameters
type
K
args
...object[K]
Returns
void
Inherited from
toString()
toString():
string
Defined in: libs/scene/src/utility/blueprint/common/math.ts:1085
Generates a string representation of this node
Returns
string
The function name
Inherited from
validate()
protectedvalidate():string
Defined in: libs/scene/src/utility/blueprint/common/math.ts:1099
Validates the node state and input type compatibility
Returns
string
Error message if invalid, empty string if valid
Remarks
Ensures all inputs:
- Have determinable types
- Have allowed types for their slot
- Share a common type (unless explicitly or additionally typed)
Inherited from
getType()
protectedgetType():string
Defined in: libs/scene/src/utility/blueprint/common/math.ts:1135
Gets the output type based on input types
Returns
string
The output type, or empty string if invalid
Remarks
Returns the explicit output type if specified, otherwise infers the common type from non-explicit, non-additional inputs.
Inherited from
getSerializationCls()
staticgetSerializationCls():object
Defined in: libs/scene/src/utility/blueprint/common/math.ts:2351
Returns
object
ctor
ctor: typeof
LengthNode=LengthNode
name
name:
string='LengthNode'
getProps()
getProps():
any[]
Returns
any[]
getOutputType()
getOutputType(
id):string
Defined in: libs/scene/src/utility/blueprint/node.ts:376
Gets the output type for a specific output slot
Parameters
id
number
The output slot ID
Returns
string
The type name of the output
Remarks
Default implementation delegates to the abstract getType() method. Can be overridden for more complex type logic.
Inherited from
check()
check():
void
Defined in: libs/scene/src/utility/blueprint/node.ts:413
Validates the node and updates error state
Returns
void
Remarks
Calls the validate() method and stores the result in _error. Emits a 'changed' event if the error state changes.
Inherited from
reset()
reset():
void
Defined in: libs/scene/src/utility/blueprint/node.ts:422
Clears the error state
Returns
void
Remarks
Sets _error to an empty string.
Inherited from
setInput()
setInput(
id,node,inputId):void
Defined in: libs/scene/src/utility/blueprint/node.ts:443
Connects an input slot to another node's output
Parameters
id
number
The input slot ID to connect
node
The source node to connect from
inputId
number
The output slot ID of the source node
Returns
void
Throws
Error if the input slot with the given ID doesn't exist
Example
const addNode = new AddNode();
const constantNode = new ConstantNode(5.0);
// Connect constantNode's output 0 to addNode's input 0
addNode.setInput(0, constantNode, 0);