Skip to main content

Interface: Engine

Extends

  • PointerHolder

Properties

clearSkybox()

clearSkybox: () => void

Removed the skybox from the scene.

Returns

void

Defined in

src/types/Engine.ts:123


createAndSetSkyboxByColor()

createAndSetSkyboxByColor: (colorInHex, showSun, envIntensity) => void

Skybox

When added to a Scene, the Skybox fills all untouched pixels. By default the scene has no skybox and will be rendered as translucent. When using a skybox make sure to pass enableTransparentRendering as false.

Parameters

colorInHex: string

showSun: undefined | boolean

Indicates whether the sun should be rendered. The sun can only be rendered if there is at least one light of type SUN in the scene. Default: false

envIntensity: undefined | number

Skybox intensity when no IndirectLight is set on the Scene. This call is ignored when an IndirectLight is set on the Scene, and the intensity of the IndirectLight is used instead. Scale factor applied to the skybox texel values such that the result is in lux, or lumen/m^2 (default = 30000)

Returns

void

Defined in

src/types/Engine.ts:100


createAndSetSkyboxByTexture()

createAndSetSkyboxByTexture: (buffer, showSun, envIntensity) => void

Skybox

When added to a Scene, the Skybox fills all untouched pixels. By default the scene has no skybox and will be rendered as translucent. When using a skybox make sure to pass enableTransparentRendering as false.

Parameters

buffer: FilamentBuffer

showSun: undefined | boolean

Indicates whether the sun should be rendered. The sun can only be rendered if there is at least one light of type SUN in the scene. Default: false

envIntensity: undefined | number

Skybox intensity when no IndirectLight is set on the Scene. This call is ignored when an IndirectLight is set on the Scene, and the intensity of the IndirectLight is used instead. Scale factor applied to the skybox texel values such that the result is in lux, or lumen/m^2 (default = 30000)

Returns

void

Defined in

src/types/Engine.ts:118


isValid

readonly isValid: boolean

Get if the refernce to the native pointer is still valid and strong.

If this is false, this object has been manually released with release() and all other methods on this object will throw an Error.

Inherited from

PointerHolder.isValid

Defined in

src/types/PointerHolder.ts:37

Methods

createLightManager()

createLightManager(): LightManager

Per engine instance you only need one LightManager. You should never need to call this manually, use instead from useFilamentContext().

Returns

LightManager

Defined in

src/types/Engine.ts:76


createMaterial()

createMaterial(matcBuffer): Material

Creates a new material from the given FilamentBuffer.

Parameters

matcBuffer: FilamentBuffer

Returns

Material

Worklet

Defined in

src/types/Engine.ts:82


createOrbitCameraManipulator()

createOrbitCameraManipulator(config): CameraManipulator

Parameters

config: OrbitCameraManipulatorConfig

Returns

CameraManipulator

Defined in

src/types/Engine.ts:56


createRenderableManager()

createRenderableManager(): RenderableManager

Per engine instance you only need one RenderableManager. You should never need to call this manually, use instead from useFilamentContext().

Returns

RenderableManager

Defined in

src/types/Engine.ts:71


createRenderer()

createRenderer(): Renderer

Returns

Renderer

Defined in

src/types/Engine.ts:52


createSwapChainForRecorder()

createSwapChainForRecorder(recorder): SwapChain

Parameters

recorder: TFilamentRecorder

Returns

SwapChain

Defined in

src/types/Engine.ts:23


createSwapChainForSurface()

createSwapChainForSurface(surface, enableTransparentRendering): SwapChain

Parameters

surface: SurfaceProvider

enableTransparentRendering: boolean

Returns

SwapChain

Defined in

src/types/Engine.ts:21


createTransformManager()

createTransformManager(): TransformManager

Per engine instance you only need one TransformManager. You should never need to call this manually, use instead from useFilamentContext().

Returns

TransformManager

Defined in

src/types/Engine.ts:66


flushAndWait()

flushAndWait(): void

Kicks the hardware thread (e.g. the OpenGL, Vulkan or Metal thread) and blocks until all commands to this point are executed. Note that does guarantee that the hardware is actually finished. Note: during on screen rendering this is handled automatically, typically used for offscreen rendering (recording).

Returns

void

Defined in

src/types/Engine.ts:144


getCamera()

getCamera(): RNFCamera

Returns

RNFCamera

Defined in

src/types/Engine.ts:54


getScene()

getScene(): Scene

Returns

Scene

Defined in

src/types/Engine.ts:53


getView()

getView(): View

Returns

View

Defined in

src/types/Engine.ts:55


loadAsset()

loadAsset(buffer)

loadAsset(buffer): FilamentAsset

Given a FilamentBuffer (e.g. from a .glb file), load the asset into the engine.

Parameters

buffer: FilamentBuffer

Returns

FilamentAsset

Defined in

src/types/Engine.ts:29

loadAsset(buffer)

loadAsset(buffer): FilamentAsset

Given a

Parameters

buffer: FilamentBuffer

Returns

FilamentAsset

See

FilamentBuffer (e.g. from a .glb file), load the asset into the engine. This will by default add all entities from the asset to the attached default scene.

Worklet
Defined in

src/types/Engine.ts:50


loadInstancedAsset()

loadInstancedAsset(buffer, instanceCount): FilamentAsset

Given a

Parameters

buffer: FilamentBuffer

instanceCount: number

Returns

FilamentAsset

See

FilamentBuffer (e.g. from a .glb file), load the asset into the engine. It will create multiple instances of the asset.

Defined in

src/types/Engine.ts:35


release()

release(): void

Manually release this reference to the native pointer. This will ensure that JS will no longer hold a strong reference, and memory can be safely cleaned up.

If the native pointer is still referenced elsewhere in native code, the underlying memory will not be deleted unless the other references are also released.

If this is not called, the memory will only be cleaned once the JS gabage collector decides to delete this object, which might be at any point in the future.

Calling release() is not required as the GC will destroy this object eventually anyways, but it is recommended to optimize memory usage.

After manually releasing a pointer, all future methods on this object will throw an Error.

Returns

void

Inherited from

PointerHolder.release

Defined in

src/types/PointerHolder.ts:30


setAutomaticInstancingEnabled()

setAutomaticInstancingEnabled(enabled): void

Enables or disables automatic instancing of render primitives. Instancing of render primitives can greatly reduce CPU overhead but requires the instanced primitives to be identical (i.e. use the same geometry) and use the same MaterialInstance. If it is known that the scene doesn't contain any identical primitives, automatic instancing can have some overhead and it is then best to disable it.

Disabled by default.

Parameters

enabled: boolean

Returns

void

Defined in

src/types/Engine.ts:136


setIndirectLight()

setIndirectLight(iblBuffer, intensity, irradianceBands): void

Set the indirect light for the scene.

Parameters

iblBuffer: FilamentBuffer

A buffer containing the IBL data (e.g. from a .ktx file)

intensity: undefined | number

The intensity of the indirect light. Default: 30_000

irradianceBands: undefined | number

Number of spherical harmonics bands. Must be 1, 2 or 3. Default: 3

Returns

void

Defined in

src/types/Engine.ts:43


setSurfaceProvider()

setSurfaceProvider(surfaceProvider): void

Parameters

surfaceProvider: SurfaceProvider

Returns

void

Defined in

src/types/Engine.ts:19


setSwapChain()

setSwapChain(swapChain): void

Parameters

swapChain: SwapChain

Returns

void

Defined in

src/types/Engine.ts:24