Skip to content

Scene

What’s in the game: entities, each a kind and a stable key, with their components. Setting one makes the entity. It goes when removed, with the plugin, or after a couple of seconds of the plugin’s frames without being set. Wraith never moves the game itself. Any thread.

Get it with Api.scene().

set(entity: import("salamander").Given<Wraith.Scene.Id>, component: import("salamander").Given<Wraith.Scene.Component>): void
clear(entity: import("salamander").Given<Wraith.Scene.Id>, kind: Wraith.Scene.ComponentKind | Wraith.Scene.ComponentKindName): void
remove(entity: import("salamander").Given<Wraith.Scene.Id>): void
handle(kind: Wraith.Scene.ComponentKind | Wraith.Scene.ComponentKindName, add: Wraith.Scene.Add | null, rename: Wraith.Scene.Rename | null, show: Wraith.Scene.Show | null): void

Gives the entity the component, or changes it.

Uses Scene.Id, Scene.Component.

Uses Scene.Id, Scene.ComponentKind.

It and every component it has.

Uses Scene.Id.

What the plugin does when asked, for its entities with a kind component. Each callback adds a button; a later call replaces them.

Uses Scene.ComponentKind, Scene.Add, Scene.Rename, Scene.Show.

What an entity is, so ids of different kinds never clash: camera 0 and character 0 are two.

An enum of u8.

Value Name
0 camera
1 character
2 object Anything else, like a prop or a weapon

An entity, unique among the plugin’s.

A struct, 0x10 bytes, aligned to 8.

Offset Field Type
0x0 kind Scene.Kind
0x8 key u64 The plugin’s own, stable while the thing’s around, like its address
kind: Wraith.Scene.Kind | Wraith.Scene.KindName
key: bigint

A struct, 0x18 bytes, aligned to 8.

Offset Field Type
0x0 name string Kept by it, so keep it stable across frames
0x10 parent i32 Its parent’s index, which must come before it, or -1
name: string
parent: number

One blend shape, or morph target, on one of a character’s meshes.

A struct, 0x28 bytes, aligned to 8.

Offset Field Type
0x0 name string Edits are kept by it and its mesh, so keep both stable
0x10 mesh string Which mesh it’s on, like the face or the body
0x20 toggle bool Only ever on or off: a checkbox, and its weight’s 0 or 1
name: string
mesh: string
toggle: boolean

What the game projects its view through. Its transform is where it is, the view’s inverse.

A struct, 0x4c bytes, aligned to 4.

Offset Field Type
0x0 projection Mat4 The game’s own, exactly, row-vector style, since each engine’s differs
0x40 fov f32 Vertical, in radians
0x44 near f32
0x48 far f32
projection: Wraith.Mat4
fov: number
near: number
far: number

An enum of u8.

Value Name
0 name
1 parent
2 transform
3 skeleton
4 attachment
5 camera
6 shapes

A struct, 0x58 bytes, aligned to 8.

Offset Field Type
0x0 tag Scene.ComponentKind
0x8 payload Scene.Component.Members
tag: Wraith.Scene.ComponentKind | Wraith.Scene.ComponentKindName
payload: Wraith.Scene.Component.Members

The player asked for a new one, like a camera where the view is. Render thread.

Wraith.Scene.Add

The player renamed entity. Set its new name. Render thread.

Wraith.Scene.Rename

The player wants entity in use, or key 0 for the game’s own. Render thread.

Wraith.Scene.Show

Made with ♥ by Asgard