Skip to content

@fibbojs / core / FScene

Class: abstract FScene

A scene which contains the components and the camera. Also contains the Rapier world if physics is enabled.

Constructors

new FScene()

new FScene(options?): FScene

Parameters

options?: FSceneOptions

Returns

FScene

Defined in

core/src/FScene.ts:71

Methods

addComponent()

addComponent(component): void

Add a component to the scene.

Parameters

component: FComponent

Returns

void

Defined in

core/src/FScene.ts:126


addLight()

addLight(light): void

Add a light to the scene.

Parameters

light: FLight

Returns

void

Defined in

core/src/FScene.ts:145


frame()

frame(delta): void

Compute a frame with the given delta time. By default, it is called every frame, but this behavior can be changed by giving the autoLoop option as false when creating the scene.

Parameters

delta: number

The time in seconds since the last frame.

Returns

void

Defined in

core/src/FScene.ts:166


onComponentAdded()

onComponentAdded(callback): void

Add a callback to be called when a component is added to the scene.

Parameters

callback

Returns

void

Defined in

core/src/FScene.ts:181


onComponentRemoved()

onComponentRemoved(callback): void

Add a callback to be called when a component is removed from the scene.

Parameters

callback

Returns

void

Defined in

core/src/FScene.ts:188


onFrame()

onFrame(callback): void

Add a callback to be called when a frame is rendered.

Parameters

callback

Returns

void

Defined in

core/src/FScene.ts:174


onLightAdded()

onLightAdded(callback): void

Add a callback to be called when a light is added to the scene.

Parameters

callback

Returns

void

Defined in

core/src/FScene.ts:203


onLightRemoved()

onLightRemoved(callback): void

Add a callback to be called when a light is removed from the scene.

Parameters

callback

Returns

void

Defined in

core/src/FScene.ts:210


onReady()

onReady(callback): void

Add a callback to be called when the scene is ready. The scene is ready when the init method has finished.

Parameters

callback

Returns

void

Defined in

core/src/FScene.ts:196


removeComponent()

removeComponent(component): void

Remove a component from the scene.

Parameters

component: FComponent

Returns

void

Defined in

core/src/FScene.ts:134


removeLight()

removeLight(light): void

Remove a light from the scene.

Parameters

light: FLight

Returns

void

Defined in

core/src/FScene.ts:153

Properties

__CALLBACKS_ON_COMPONENT_ADDED__

__CALLBACKS_ON_COMPONENT_ADDED__: (component) => void[] = []

Callbacks for when a component is added to the scene.

Defined in

core/src/FScene.ts:53


__CALLBACKS_ON_COMPONENT_REMOVED__

__CALLBACKS_ON_COMPONENT_REMOVED__: (component) => void[] = []

Callbacks for when a component is remove from the scene.

Defined in

core/src/FScene.ts:57


__CALLBACKS_ON_FRAME__

__CALLBACKS_ON_FRAME__: (delta) => void[] = []

Callbacks for when a frame is rendered.

Defined in

core/src/FScene.ts:49


__CALLBACKS_ON_LIGHT_ADDED__

__CALLBACKS_ON_LIGHT_ADDED__: (light) => void[] = []

Callbacks for when a light is added to the scene.

Defined in

core/src/FScene.ts:65


__CALLBACKS_ON_LIGHT_REMOVED__

__CALLBACKS_ON_LIGHT_REMOVED__: (light) => void[] = []

Callbacks for when a light is added to the scene.

Defined in

core/src/FScene.ts:69


__CALLBACKS_ON_READY__

__CALLBACKS_ON_READY__: () => void[] = []

Callbacks for when the scene is ready.

Defined in

core/src/FScene.ts:61


__DOM_NODE__

__DOM_NODE__: HTMLElement

DOM element that the renderer will be appended to

Defined in

core/src/FScene.ts:27


__IS_2D__

__IS_2D__: boolean = false

Defined in

core/src/FScene.ts:22


__IS_3D__

__IS_3D__: boolean = false

Internal flags

Defined in

core/src/FScene.ts:21


__RAPIER_TO_COMPONENT__

__RAPIER_TO_COMPONENT__: Map<number, FComponent>

Defined in

core/src/FScene.ts:43


components

components: FComponent[]

The components in the scene.

Defined in

core/src/FScene.ts:32


eventQueue

eventQueue: EventQueue | EventQueue

Defined in

core/src/FScene.ts:42


gravity

gravity: object | object

Defined in

core/src/FScene.ts:40


lights

lights: FLight[] = []

The lights in the scene.

Defined in

core/src/FScene.ts:37


world

world: World | World

Defined in

core/src/FScene.ts:41