Skip to content

@tmrw-realityos/charmDocs


@tmrw-realityos/charm / Node

Class: Node

Extended by

Constructors

new Node()

new Node(): Node

Returns

Node

Defined in

packages/charm/src/scene/node.ts:55

Properties

bounding

bounding: AABB

Defined in

packages/charm/src/scene/node.ts:48


children

children: Node[]

Defined in

packages/charm/src/scene/node.ts:44


childrenBounding

childrenBounding: AABB

Defined in

packages/charm/src/scene/node.ts:49


enabled

enabled: boolean = true

Defined in

packages/charm/src/scene/node.ts:37


id

id: number

Defined in

packages/charm/src/scene/node.ts:31


index

index: number = -1

Defined in

packages/charm/src/scene/node.ts:32


is_hover

is_hover: boolean = false

Defined in

packages/charm/src/scene/node.ts:53


layers

layers: number = 3

Defined in

packages/charm/src/scene/node.ts:34


mesh?

optional mesh: Mesh

Defined in

packages/charm/src/scene/node.ts:40


name

name: string

Defined in

packages/charm/src/scene/node.ts:33


outline

outline: boolean = false

Defined in

packages/charm/src/scene/node.ts:38


owner?

optional owner: unknown

Defined in

packages/charm/src/scene/node.ts:51


parent

parent: null | Node

Defined in

packages/charm/src/scene/node.ts:43


primitives

primitives: IPrimitive[]

Defined in

packages/charm/src/scene/node.ts:41


skin?

optional skin: Skin

Defined in

packages/charm/src/scene/node.ts:46


transform

transform: Transform

Defined in

packages/charm/src/scene/node.ts:35


last_index

static last_index: number = 0

Defined in

packages/charm/src/scene/node.ts:29

Accessors

material

get material(): null | Material

set material(m): void

Parameters

m: Material

Returns

null | Material

Defined in

packages/charm/src/scene/node.ts:68


siblings

get siblings(): Node[]

Returns

Node[]

Defined in

packages/charm/src/scene/node.ts:181

Methods

addChild()

addChild(node): void

Parameters

node: Node

Returns

void

Defined in

packages/charm/src/scene/node.ts:127


centerIn()

centerIn(parent): void

Parameters

parent: Node

Returns

void

Defined in

packages/charm/src/scene/node.ts:139


clear()

clear(): void

Removes all children and sets up transform to identity

Returns

void

Defined in

packages/charm/src/scene/node.ts:85


clone()

clone(inDepth): Node

Parameters

inDepth: boolean = true

Returns

Node

Defined in

packages/charm/src/scene/node.ts:168


collectMaterials()

collectMaterials(materials): void

Used to get a list of materials used in this branch of the scene tree

Parameters

materials: Map<string, Material>

Returns

void

Defined in

packages/charm/src/scene/node.ts:316


copyFrom()

copyFrom(n): void

doesnt copy children, just node properties

Parameters

n: Node

Returns

void

Defined in

packages/charm/src/scene/node.ts:112


destroy()

destroy(): void

Returns

void

Defined in

packages/charm/src/scene/node.ts:123


findNodeByName()

findNodeByName(name): undefined | Node

Parameters

name: string

Returns

undefined | Node

Defined in

packages/charm/src/scene/node.ts:302


getOwner()

getOwner(): unknown

Used in case this node is attached to some entity

Returns

unknown

Defined in

packages/charm/src/scene/node.ts:328


getWorldPosition()

getWorldPosition(out?): vec3

Calculates the world space position by applying all ancestor transformations in the scene graph.

Parameters

out?: vec3

Returns

vec3

Defined in

packages/charm/src/scene/node.ts:101


globalToLocal()

globalToLocal(v, out?): vec3

converts a global coordinate to local coordinates (slow: generates the inverse matrix!)

Parameters

v: vec3

out?: vec3

Returns

vec3

Defined in

packages/charm/src/scene/node.ts:232


globalToLocalVector()

globalToLocalVector(v, out?): vec3

converts a global vector to local coordinates (slow: generates the inverse matrix!)

Parameters

v: vec3

out?: vec3

Returns

vec3

Defined in

packages/charm/src/scene/node.ts:239


localToGlobal()

localToGlobal(v, out?): vec3

converts a local coordinate to globals coordinates

Parameters

v: vec3

out?: vec3

Returns

vec3

Defined in

packages/charm/src/scene/node.ts:211


localToGlobalVector()

localToGlobalVector(v, out?): vec3

converts a local vector to globals coordinates

Parameters

v: vec3

out?: vec3

Returns

vec3

Defined in

packages/charm/src/scene/node.ts:217


orientTo()

orientTo(pos, cylindric): void

Parameters

pos: vec3

cylindric: boolean = true

Returns

void

Defined in

packages/charm/src/scene/node.ts:254


querySelector()

querySelector(selector): undefined | Node

Parameters

selector: string

Returns

undefined | Node

Defined in

packages/charm/src/scene/node.ts:289


removeChild()

removeChild(node): void

Parameters

node: Node

Returns

void

Defined in

packages/charm/src/scene/node.ts:156


setLayerBit()

setLayerBit(bit, v, recursive): void

Parameters

bit: number

v: boolean

recursive: boolean = true

Returns

void

Defined in

packages/charm/src/scene/node.ts:343


setLayers()

setLayers(v, recursive): void

assign a layer bitmask to this node (and its children)

Parameters

v: number

recursive: boolean = true

Returns

void

Defined in

packages/charm/src/scene/node.ts:335


updateBounding()

updateBounding(): void

Updates the bounding taking into account mesh bounding and transfrom (not including children)

Returns

void

Defined in

packages/charm/src/scene/node.ts:273


updateChildrenBounding()

updateChildrenBounding(): void

Updates the bounding taking into account node.bounding and all children childrenBoundings

Returns

void

Defined in

packages/charm/src/scene/node.ts:280


updateTransforms()

updateTransforms(): void

iterates through every transform and updates world matrix and bounding, it propagates to children

Returns

void

Defined in

packages/charm/src/scene/node.ts:199


updateWorldMatrix()

updateWorldMatrix(fast): mat4

Updates the global matrix in transform taking into account the node ierarchy

Parameters

fast: boolean = false

if true it asumes the parent global matrix is already updated

Returns

mat4

Defined in

packages/charm/src/scene/node.ts:190