UWAL / Scene
Type Aliases
SceneNode
type SceneNode = Node2D | Node;Type Parameters
| Type Parameter |
|---|
Camera
type Camera =
| Camera2D
| OrthographicCamera
| PerspectiveCamera;Type Parameters
| Type Parameter |
|---|
Classes
Scene
Content manager for objects rendered onto the canvas element. Used to add, search, update, and remove nodes, 2D shapes, and 3D meshes within the rendering pipeline.
Properties
Label
Label: string;Scene name.
Children
Children: SceneNode[] = [];List of all elements in the scene graph.
MainCamera
MainCamera: Camera | undefined;Camera from the point of view of which the scene will be rendered.
Constructors
Constructor
new Scene(label?): Scene;Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
label? | string | "Scene" | Scene name. |
Returns
Methods
Add()
Add(children): void;Add any Mesh, Shape or SceneNode element(s) to the scene graph.
Parameters
| Parameter | Type | Description |
|---|---|---|
children | SceneNode | SceneNode[] | Element(s) to add. |
Returns
void
Remove()
Remove(children): void;Remove any Mesh, Shape or SceneNode element(s) from the scene graph. Only unlinking is performed, the Destroy method on removed element(s) is not called.
Parameters
| Parameter | Type | Description |
|---|---|---|
children | SceneNode | SceneNode[] | Element(s) to remove. |
Returns
void
AddMainCamera()
AddMainCamera(camera): void;Add a Camera as a child of the scene and assign it to the MainCamera property. To switch to a different camera, simply assign it to the MainCamera member.
Parameters
| Parameter | Type | Description |
|---|---|---|
camera | Camera | Camera to use. |
Returns
void
See
Cameras / UV Mapping for reference.
UpdateWorldMatrix()
UpdateWorldMatrix(): void;Update local and world matrices of all elements in the scene graph. Its use is discouraged since this method is called internally on every render.
Returns
void
Traverse()
Traverse(callback): void;Perform the callback function on every element of the scene graph. The scene itself will be excluded from the iteration.
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | (node) => unknown | Function to call with the child element. |
Returns
void
Destroy()
Destroy(): void;Call the Destroy method on every element of the scene graph if available. Remove all children and reset the MainCamera member.
Returns
void
Accessors
WorldMatrix
Get Signature
get WorldMatrix(): Float32Array<ArrayBufferLike>;Returns
Float32Array<ArrayBufferLike>
The world matrix of the scene. Its use is discouraged since this getter is called internally when updating the camera's view projection matrix.