CameraBackground

actual class CameraBackground(engine: Engine, session: ArSession)(source)

Draws the session's camera image behind everything else in a Filament scene, filling the viewport. This is what makes rendered content look placed in the real world.

Add entity to the scene, call update with every new frame, and destroy it before the engine. The view does not need to be transparent.

On Android it draws the external texture ARCore writes. On iOS it draws the two planes of ARKit's YCbCr pixel buffer as Metal textures and converts them to RGB.

Parameters

engine

must come from createEngine of the same session; an engine created any other way cannot see the camera image

session

the session whose camera image is drawn

expect class CameraBackground(engine: Engine, session: ArSession)(source)

Draws the session's camera image behind everything else in a Filament scene, filling the viewport. This is what makes rendered content look placed in the real world.

Add entity to the scene, call update with every new frame, and destroy it before the engine. The view does not need to be transparent.

On Android it draws the external texture ARCore writes. On iOS it draws the two planes of ARKit's YCbCr pixel buffer as Metal textures and converts them to RGB.

Parameters

engine

must come from createEngine of the same session; an engine created any other way cannot see the camera image

session

the session whose camera image is drawn

actual class CameraBackground(engine: Engine, session: ArSession)(source)

ARKit delivers the camera image as a pixel buffer with a luma and a chroma plane. Each plane becomes a Metal texture that shares the buffer's memory, imported into Filament for the one frame it is drawn in; the material converts to RGB.

Constructors

Link copied to clipboard
actual constructor(engine: Engine, session: ArSession)
expect constructor(engine: Engine, session: ArSession)
actual constructor(engine: Engine, session: ArSession)

Properties

Link copied to clipboard
actual val entity: Int

The renderable to add to the Filament scene.

expect val entity: Int

The renderable to add to the Filament scene.

actual val entity: Int

The renderable to add to the Filament scene.

Functions

Link copied to clipboard
actual fun destroy()

Releases the Filament resources. Remove entity from the scene first, and call this before destroying the engine.

expect fun destroy()

Releases the Filament resources. Remove entity from the scene first, and call this before destroying the engine.

actual fun destroy()

Releases the Filament resources. Remove entity from the scene first, and call this before destroying the engine.

Link copied to clipboard
actual fun update(frame: ArFrame)

Shows the camera image of frame, fitted to the viewport set with ArSession.setDisplayGeometry. Call it once for every frame returned by ArSession.update.

expect fun update(frame: ArFrame)

Shows the camera image of frame, fitted to the viewport set with ArSession.setDisplayGeometry. Call it once for every frame returned by ArSession.update.

actual fun update(frame: ArFrame)

Shows the camera image of frame, fitted to the viewport set with ArSession.setDisplayGeometry. Call it once for every frame returned by ArSession.update.