Skip to content

Documentation / scene / TransformNode

Class: TransformNode ​

Defined in: libs/scene/src/utility/blueprint/common/math.ts:718

Matrix-vector transformation node

Remarks ​

Performs matrix-vector or matrix-matrix multiplication using the shader's mul() function. Supports transformations for 2D, 3D, and 4D spaces:

  • mat2 * vec2 or vec2 * mat2
  • mat3 * vec3 or vec3 * mat3
  • mat4 * vec4 or vec4 * mat4
  • mat2 * mat2, mat3 * mat3, mat4 * mat4

Common uses:

  • Transform positions by model/view/projection matrices
  • Transform normals by inverse transpose matrices
  • Chain matrix transformations

Example ​

typescript
// Transform position by view-projection matrix
const transform = new TransformNode();
transform.connectInput(1, positionNode, 1); // vec4 position
transform.connectInput(2, viewProjMatrixNode, 1); // mat4 matrix

// Transform normal by normal matrix
const normalTransform = new TransformNode();
normalTransform.connectInput(1, normalNode, 1); // vec3 normal
normalTransform.connectInput(2, normalMatrixNode, 1); // mat3 matrix

Extends ​

Constructors ​

Constructor ​

new TransformNode(): TransformNode

Defined in: libs/scene/src/utility/blueprint/common/math.ts:725

Creates a new transform node

Returns ​

TransformNode

Remarks ​

Initializes with two required inputs: the value to transform (a) and the transformation matrix (b).

Overrides ​

BaseGraphNode.constructor

Properties ​

_inputs ​

protected _inputs: GraphNodeInput[]

Defined in: libs/scene/src/utility/blueprint/node.ts:336

Internal storage for input slot definitions

Inherited from ​

BaseGraphNode._inputs


_outputs ​

protected _outputs: GraphNodeOutput[]

Defined in: libs/scene/src/utility/blueprint/node.ts:338

Internal storage for output slot definitions

Inherited from ​

BaseGraphNode._outputs


_error ​

protected _error: string

Defined in: libs/scene/src/utility/blueprint/node.ts:340

Internal storage for error message

Inherited from ​

BaseGraphNode._error

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 ​

BaseGraphNode.isUniform


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 ​

BaseGraphNode.paramName


inputs ​

Get Signature ​

get inputs(): GraphNodeInput[]

Defined in: libs/scene/src/utility/blueprint/node.ts:380

Gets the input slot definitions array

Returns ​

GraphNodeInput[]

Array of input slot definitions

Inherited from ​

SpriteBlockNode.inputs


outputs ​

Get Signature ​

get outputs(): GraphNodeOutput[]

Defined in: libs/scene/src/utility/blueprint/node.ts:384

Gets the output slot definitions array

Returns ​

GraphNodeOutput[]

Array of output slot definitions

Inherited from ​

BaseGraphNode.outputs


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 ​

BaseGraphNode.error

Methods ​

on() ​

on<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:630

IEventTarget.on

Type Parameters ​

K ​

K extends "changed"

Parameters ​

type ​

K

listener ​

EventListener<{ changed: []; }, K>

context? ​

unknown

Returns ​

void

Inherited from ​

BaseGraphNode.on


once() ​

once<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:634

IEventTarget.once

Type Parameters ​

K ​

K extends "changed"

Parameters ​

type ​

K

listener ​

EventListener<{ changed: []; }, K>

context? ​

unknown

Returns ​

void

Inherited from ​

BaseGraphNode.once


off() ​

off<K>(type, listener?, context?): void

Defined in: libs/base/dist/index.d.ts:638

IEventTarget.off

Type Parameters ​

K ​

K extends "changed"

Parameters ​

type ​

K

listener? ​

EventListener<{ changed: []; }>

context? ​

unknown

Returns ​

void

Inherited from ​

BaseGraphNode.off


dispatchEvent() ​

dispatchEvent<K>(type, ...args): void

Defined in: libs/base/dist/index.d.ts:642

IEventTarget.dispatchEvent

Type Parameters ​

K ​

K extends "changed"

Parameters ​

type ​

K

args ​

...object[K]

Returns ​

void

Inherited from ​

BaseGraphNode.dispatchEvent


toString() ​

toString(): string

Defined in: libs/scene/src/utility/blueprint/common/math.ts:752

Generates a string representation of this node

Returns ​

string

'Transform'

Overrides ​

BaseGraphNode.toString


getSerializationCls() ​

static getSerializationCls(): object

Defined in: libs/scene/src/utility/blueprint/common/math.ts:763

Gets the serialization descriptor for this node type

Returns ​

object

Serialization class descriptor

ctor ​

ctor: typeof TransformNode = TransformNode

name ​

name: string = 'TransformNode'

getProps() ​

getProps(): any[]

Returns ​

any[]

Remarks ​

No properties need to be serialized beyond the base node data.


validate() ​

protected validate(): string

Defined in: libs/scene/src/utility/blueprint/common/math.ts:784

Validates the node state and input type compatibility

Returns ​

string

Error message if invalid, empty string if valid

Remarks ​

Validates that the input types are compatible for multiplication:

  • vec2 with mat2
  • vec3 with mat3
  • vec4 with mat4
  • Compatible matrix-matrix multiplications

Overrides ​

BaseGraphNode.validate


getType() ​

protected getType(): "" | "vec2" | "vec3" | "vec4" | "mat2" | "mat3" | "mat4"

Defined in: libs/scene/src/utility/blueprint/common/math.ts:835

Gets the output type based on input types

Returns ​

"" | "vec2" | "vec3" | "vec4" | "mat2" | "mat3" | "mat4"

The result type of the transformation, or empty string if invalid

Remarks ​

Result type rules:

  • vec * mat = vec (same dimension)
  • mat * vec = vec (same dimension)
  • mat * mat = mat (same dimension)

Overrides ​

BaseGraphNode.getType


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 ​

BaseGraphNode.getOutputType


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 ​

BaseGraphNode.check


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 ​

BaseGraphNode.reset


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 ​

BaseGraphNode

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 ​

typescript
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);

Inherited from ​

BaseGraphNode.setInput

Released under the MIT License.