Skip to content

@fibbojs / core / FScene

Class: abstract FScene

A scene which contains the components, lights and cameras. Also contains the Rapier world if physics is enabled.

Accessors

camera

get camera(): FCamera

The camera of the scene.

set camera(camera): void

The camera of the scene.

Parameters

camera: FCamera

Returns

FCamera

Defined in

core/src/FScene.ts:240

Constructors

new FScene()

new FScene(options?): FScene

Parameters

options?: FSceneOptions

Returns

FScene

Defined in

core/src/FScene.ts:96

Methods

addComponent()

addComponent(component): void

Add a component to the scene.

Parameters

component: FComponent

Returns

void

Defined in

core/src/FScene.ts:166


addLight()

addLight(light): void

Add a light to the scene.

Parameters

light: FLight

Returns

void

Defined in

core/src/FScene.ts:199


frame()

frame(delta): void

Compute a frame with the given delta time. By default, it is called every frame in the main pipeline, 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:151


init()

abstract init(): void

Initialize the scene.

Returns

void

Defined in

core/src/FScene.ts:139


initPhysics()

abstract initPhysics(): Promise<void>

Initialize the physics world.

Returns

Promise<void>

Defined in

core/src/FScene.ts:144


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:185


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:192


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:159


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:218


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:225


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:233


removeComponent()

removeComponent(component): void

Remove a component from the scene.

Parameters

component: FComponent

Returns

void

Defined in

core/src/FScene.ts:174


removeLight()

removeLight(light): void

Remove a light from the scene.

Parameters

light: FLight

Returns

void

Defined in

core/src/FScene.ts:207

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:78


__CALLBACKS_ON_COMPONENT_REMOVED__

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

Callbacks for when a component is removed from the scene.

Defined in

core/src/FScene.ts:82


__CALLBACKS_ON_FRAME__

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

Callbacks for when a frame is rendered.

Defined in

core/src/FScene.ts:74


__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:90


__CALLBACKS_ON_LIGHT_REMOVED__

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

Callbacks for when a light is removed from the scene.

Defined in

core/src/FScene.ts:94


__CALLBACKS_ON_READY__

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

Callbacks for when the scene is ready.

Defined in

core/src/FScene.ts:86


__CAMERA__?

optional __CAMERA__: FCamera

The camera of the scene.

Defined in

core/src/FScene.ts:57


__DOM_NODE__

__DOM_NODE__: HTMLElement

DOM element that the renderer will be appended to

Defined in

core/src/FScene.ts:42


__IS_2D__

__IS_2D__: boolean = false

Defined in

core/src/FScene.ts:26


__IS_3D__

__IS_3D__: boolean = false

Defined in

core/src/FScene.ts:25


__PHYSIC_CONTROLLERS__

__PHYSIC_CONTROLLERS__: FController[] = []

Controllers that will run in the physic pipeline.

Defined in

core/src/FScene.ts:62


__PHYSIC_FRAME_RATE__

__PHYSIC_FRAME_RATE__: number

Physic frame rate. It is stored here as the initialisation of the physics pipeline is handled by child classes.

Defined in

core/src/FScene.ts:37


__PIPELINE_MANAGER__

__PIPELINE_MANAGER__: PipelineManager

Pipeline manager that manages the pipelines of the scene. By default, it contains the main pipeline.

Defined in

core/src/FScene.ts:32


__RAPIER_TO_COMPONENT__

__RAPIER_TO_COMPONENT__: Map<number, FComponent>

Defined in

core/src/FScene.ts:68


components

components: FComponent[]

The components in the scene.

Defined in

core/src/FScene.ts:47


eventQueue

eventQueue: EventQueue | EventQueue

Defined in

core/src/FScene.ts:67


gravity

gravity: object | object

Defined in

core/src/FScene.ts:65


lights

lights: FLight[]

The lights in the scene.

Defined in

core/src/FScene.ts:52


world

world: World | World

Defined in

core/src/FScene.ts:66