SimpleWorld<T, U, S>
A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
Extends
Type parameters
| Type parameter | Value | Description |
|---|---|---|
T extends BaseScene | BaseScene | The type of the scene. Default is BaseScene. |
U extends BaseCamera | BaseCamera | The type of the camera. Default is BaseCamera. |
S extends BaseRenderer | BaseRenderer | The type of the renderer. Default is BaseRenderer. |
Implements
Properties
enabled
enabled:
boolean=true
Indicates whether the world is currently enabled. When disabled, the world will not be updated.
isDisposing
isDisposing:
boolean=false
Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
Implementation of
meshes
readonlymeshes:Set<Mesh<BufferGeometry<NormalBufferAttributes>,Material|Material[],Object3DEventMap>>
All the loaded meshes. These meshes will be taken into account in operations like raycasting.
Implementation of
name?
optionalname:string
An optional name for the world.
onAfterUpdate
readonlyonAfterUpdate:Event<unknown>
Implementation of
onBeforeUpdate
readonlyonBeforeUpdate:Event<unknown>
Implementation of
onDisposed
readonlyonDisposed:Event<unknown>
Implementation of
uuid
readonlyuuid:string
A unique identifier for the world. Is not meant to be changed at any moment.
Implementation of
Accessors
camera
getcamera():U
Getter for the camera. If no camera is initialized, it throws an error.
setcamera(camera):void
Setter for the camera. It sets the current camera, adds the world to the camera's worlds set, sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
Parameters
| Parameter | Type | Description |
|---|---|---|
camera | U | The new camera to be set. |
Returns
U
The current camera.
renderer
getrenderer():null|S
Getter for the renderer.
setrenderer(renderer):void
Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set, sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action. If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
Parameters
| Parameter | Type | Description |
|---|---|---|
renderer | null | S | The new renderer to be set or null to remove the current renderer. |
Returns
null | S
The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
scene
getscene():T
Getter for the scene. If no scene is initialized, it throws an error.
setscene(scene):void
Setter for the scene. It sets the current scene, adds the world to the scene's worlds set, sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
Parameters
| Parameter | Type | Description |
|---|---|---|
scene | T | The new scene to be set. |
Returns
T
The current scene.
Methods
dispose()
dispose(
disposeResources):void
Parameters
| Parameter | Type | Default value |
|---|---|---|
disposeResources | boolean | true |
Returns
void
Implementation of
isConfigurable()
isConfigurable():
this is Configurable<any, any>
Whether is component is Configurable.
Returns
this is Configurable<any, any>
Inherited from
isDisposeable()
isDisposeable():
this is Disposable
Whether is component is Disposable.
Returns
this is Disposable
Inherited from
isHideable()
isHideable():
this is Hideable
Whether is component is Hideable.
Returns
this is Hideable
Inherited from
isResizeable()
isResizeable():
this is Resizeable
Whether is component is Resizeable.
Returns
this is Resizeable
Inherited from
isUpdateable()
isUpdateable():
this is Updateable
Whether is component is Updateable.
Returns
this is Updateable
Inherited from
update()
update(
delta?):void
Parameters
| Parameter | Type |
|---|---|
delta? | number |
Returns
void