UWAL / Scene
Type Aliases
Camera
type Camera = Camera2D | PerspectiveCamera | OrthographicCamera;Type Parameters
| Type Parameter |
|---|
SceneNode
type SceneNode = Node | Node2D;Type Parameters
| Type Parameter |
|---|
Classes
Scene
Content manager for the canvas element. Used to add, search, update and remove Nodes, 2D Shapes, and 3D Meshes within the rendering pipeline.
Properties
Label
Label: string;Name of the scene.
Children
Children: SceneNode[] = [];List of all elements in the scene graph.
MainCamera
MainCamera: Camera | undefined;Camera from whose point of view the scene will be rendered.
Constructors
Constructor
new Scene(label?): Scene;Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
label? | string | "Scene" | Name of the scene |
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[] | List of elements 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[] | List of elements 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.
NOTE: The scene itself will be excluded from the iteration.
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | (node) => unknown | Function to call with the reference of the child element |
Returns
void
Destroy()
Destroy(): void;Call the Destroy method on every element of the scene graph when 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 camera's view projection matrix.