Skip to content

@tmrw-realityos/charmDocs


@tmrw-realityos/charm / TransformGizmo

Class: TransformGizmo

Extends

Constructors

new TransformGizmo()

new TransformGizmo(renderer): TransformGizmo

Parameters

renderer: WebGPURenderer

Returns

TransformGizmo

Overrides

Node.constructor

Defined in

packages/charm/src/helpers/transformGizmo.ts:72

Properties

_rayDir

_rayDir: vec3

Defined in

packages/charm/src/helpers/transformGizmo.ts:70


_rayOrigin

_rayOrigin: vec3

Defined in

packages/charm/src/helpers/transformGizmo.ts:69


arrow

arrow: WebGPUMesh

Defined in

packages/charm/src/helpers/transformGizmo.ts:46


bounding

bounding: AABB

Inherited from

Node.bounding

Defined in

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


box

box: WebGPUMesh

Defined in

packages/charm/src/helpers/transformGizmo.ts:49


children

children: Node[]

Inherited from

Node.children

Defined in

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


childrenBounding

childrenBounding: AABB

Inherited from

Node.childrenBounding

Defined in

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


clickCollision

clickCollision: vec3

Defined in

packages/charm/src/helpers/transformGizmo.ts:61


clickPosition

clickPosition: vec2

Defined in

packages/charm/src/helpers/transformGizmo.ts:60


clickStartTransform

clickStartTransform: Transform

Defined in

packages/charm/src/helpers/transformGizmo.ts:63


currentAction

currentAction: GizmoActions = GizmoActions.None

Defined in

packages/charm/src/helpers/transformGizmo.ts:59


enabled

enabled: boolean = true

Inherited from

Node.enabled

Defined in

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


enabledActions

enabledActions: number = defaultActions

Defined in

packages/charm/src/helpers/transformGizmo.ts:65


hover

hover: boolean = false

Defined in

packages/charm/src/helpers/transformGizmo.ts:55


hoverAction

hoverAction: GizmoActions = GizmoActions.None

Defined in

packages/charm/src/helpers/transformGizmo.ts:58


id

id: number

Inherited from

Node.id

Defined in

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


index

index: number = -1

Inherited from

Node.index

Defined in

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


is_hover

is_hover: boolean = false

Inherited from

Node.is_hover

Defined in

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


lastCamera?

optional lastCamera: Camera

Defined in

packages/charm/src/helpers/transformGizmo.ts:66


lastRadius

lastRadius: number = 1

Defined in

packages/charm/src/helpers/transformGizmo.ts:56


lastViewport

lastViewport: vec4

Defined in

packages/charm/src/helpers/transformGizmo.ts:67


layers

layers: number = 3

Inherited from

Node.layers

Defined in

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


mesh?

optional mesh: Mesh

Inherited from

Node.mesh

Defined in

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


name

name: string

Inherited from

Node.name

Defined in

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


nearestPosition

nearestPosition: vec3

Defined in

packages/charm/src/helpers/transformGizmo.ts:57


outline

outline: boolean = false

Inherited from

Node.outline

Defined in

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


owner?

optional owner: unknown

Inherited from

Node.owner

Defined in

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


parent

parent: null | Node

Inherited from

Node.parent

Defined in

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


primitives

primitives: IPrimitive[]

Inherited from

Node.primitives

Defined in

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


renderer

renderer: WebGPURenderer

Defined in

packages/charm/src/helpers/transformGizmo.ts:51


ring

ring: WebGPUMesh

Defined in

packages/charm/src/helpers/transformGizmo.ts:48


size

size: number = 2

Defined in

packages/charm/src/helpers/transformGizmo.ts:54


skin?

optional skin: Skin

Inherited from

Node.skin

Defined in

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


sphere

sphere: WebGPUMesh

Defined in

packages/charm/src/helpers/transformGizmo.ts:47


targets

targets: Node[] = []

Defined in

packages/charm/src/helpers/transformGizmo.ts:52


transform

transform: Transform

Inherited from

Node.transform

Defined in

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


last_index

static last_index: number = 0

Inherited from

Node.last_index

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

Inherited from

Node.material

Defined in

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


siblings

get siblings(): Node[]

Returns

Node[]

Inherited from

Node.siblings

Defined in

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

Methods

addChild()

addChild(node): void

Parameters

node: Node

Returns

void

Inherited from

Node.addChild

Defined in

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


applyRotation()

applyRotation(axis, angle): void

Parameters

axis: vec3

angle: number

Returns

void

Defined in

packages/charm/src/helpers/transformGizmo.ts:261


applyScale()

applyScale(v): void

Parameters

v: vec3

Returns

void

Defined in

packages/charm/src/helpers/transformGizmo.ts:241


applyTranslation()

applyTranslation(v): void

Parameters

v: vec3

Returns

void

Defined in

packages/charm/src/helpers/transformGizmo.ts:250


centerIn()

centerIn(parent): void

Parameters

parent: Node

Returns

void

Inherited from

Node.centerIn

Defined in

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


clear()

clear(): void

Removes all children and sets up transform to identity

Returns

void

Inherited from

Node.clear

Defined in

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


clone()

clone(inDepth): Node

Parameters

inDepth: boolean = true

Returns

Node

Inherited from

Node.clone

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

Inherited from

Node.collectMaterials

Defined in

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


computeRay()

computeRay(camera, mousepos, origin, direction): void

returns a camera ray that passes through a mouse position

Parameters

camera: Camera

mousepos: vec2

origin: vec3

direction: vec3

Returns

void

Defined in

packages/charm/src/helpers/transformGizmo.ts:274


copyFrom()

copyFrom(n): void

doesnt copy children, just node properties

Parameters

n: Node

Returns

void

Inherited from

Node.copyFrom

Defined in

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


destroy()

destroy(): void

Returns

void

Inherited from

Node.destroy

Defined in

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


findNearestToRay()

findNearestToRay(center, direction, result): void

Parameters

center: vec3

direction: vec3

result: vec3

Returns

void

Defined in

packages/charm/src/helpers/transformGizmo.ts:496


findNodeByName()

findNodeByName(name): undefined | Node

Parameters

name: string

Returns

undefined | Node

Inherited from

Node.findNodeByName

Defined in

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


getOwner()

getOwner(): unknown

Used in case this node is attached to some entity

Returns

unknown

Inherited from

Node.getOwner

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

Inherited from

Node.getWorldPosition

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

Inherited from

Node.globalToLocal

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

Inherited from

Node.globalToLocalVector

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

Inherited from

Node.localToGlobal

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

Inherited from

Node.localToGlobalVector

Defined in

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


onMouse()

onMouse(e): boolean

Parameters

e: PointerEvent

Returns

boolean

Defined in

packages/charm/src/helpers/transformGizmo.ts:108


orientTo()

orientTo(pos, cylindric): void

Parameters

pos: vec3

cylindric: boolean = true

Returns

void

Inherited from

Node.orientTo

Defined in

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


querySelector()

querySelector(selector): undefined | Node

Parameters

selector: string

Returns

undefined | Node

Inherited from

Node.querySelector

Defined in

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


recomputePosition()

recomputePosition(camera, output): vec3

Parameters

camera: Camera

output: GPUTexture

Returns

vec3

Defined in

packages/charm/src/helpers/transformGizmo.ts:294


removeChild()

removeChild(node): void

Parameters

node: Node

Returns

void

Inherited from

Node.removeChild

Defined in

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


render()

render(renderer, mousepos): void

Parameters

renderer: WebGPURenderer

mousepos: number[] | vec2

Returns

void

Defined in

packages/charm/src/helpers/transformGizmo.ts:321


setLayerBit()

setLayerBit(bit, v, recursive): void

Parameters

bit: number

v: boolean

recursive: boolean = true

Returns

void

Inherited from

Node.setLayerBit

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

Inherited from

Node.setLayers

Defined in

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


setTargets()

setTargets(nodes): void

Parameters

nodes: Node[]

Returns

void

Defined in

packages/charm/src/helpers/transformGizmo.ts:99


testSphere()

testSphere(center, radius): boolean

Parameters

center: vec3

radius: number

Returns

boolean

Defined in

packages/charm/src/helpers/transformGizmo.ts:491


updateBounding()

updateBounding(): void

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

Returns

void

Inherited from

Node.updateBounding

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

Inherited from

Node.updateChildrenBounding

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

Inherited from

Node.updateTransforms

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

Inherited from

Node.updateWorldMatrix

Defined in

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