Package-level declarations

Types

Link copied to clipboard
annotation class FilamentDsl

Restricts the implicit-receiver search inside nested scene declarations. See FilamentSceneScope.

Link copied to clipboard
Link copied to clipboard

A handle to a Filament Scene and its Engine, produced by rememberFilamentScene and consumed by one or more FilamentViews. The scene is the world — entities, lights, skybox, IBL — and knows nothing about cameras or viewports.

Link copied to clipboard

Receiver for the content lambda of rememberFilamentScene. Scene-content composables (io.github.erkko68.filament.compose.scene.Light, GltfInstance, Group, primitives, FilamentEffect, …) are extensions on this scope, so they only compile inside a scene declaration.

Link copied to clipboard

Hoisted handle to a FilamentView's live Filament objects. Create with rememberFilamentViewState, pass to a FilamentView, and use it for imperative access — picking, reading the viewport, or reaching the raw View/Renderer for advanced work.

Link copied to clipboard

Drives a CameraState using a Filament Manipulator in FLIGHT mode (first-person).

Link copied to clipboard
data class FrameInfo(val frameTimeNanos: Long, val deltaSeconds: Float, val elapsedSeconds: Float)

Timing passed to an OnFrame callback, computed once per display refresh.

Link copied to clipboard

Drives a CameraState using a Filament Manipulator in MAP mode (top-down 2-D pan/zoom). Pair with Projection.Orthographic on the CameraState.

Link copied to clipboard

Drives a CameraState using a Filament Manipulator in ORBIT mode.

Functions

Link copied to clipboard
fun FilamentApp(content: @Composable () -> Unit)

Entry point for Filament-powered Compose web apps.

Link copied to clipboard

Escape hatch for direct Filament API access inside rememberFilamentScene. Use it to add custom renderables to the scene or drive per-frame updates that the scene composables don't cover. For per-view, imperative access (picking, the raw View/Renderer), use FilamentViewState instead; for the camera, use io.github.erkko68.filament.compose.scene.CameraState.

Link copied to clipboard
fun FilamentSceneView(modifier: Modifier = Modifier, engine: Engine = rememberFilamentEngine(), cameraState: CameraState = rememberCameraState(), viewState: FilamentViewState = rememberFilamentViewState(), skyboxState: SkyboxState? = null, indirectLightState: IndirectLightState? = null, postProcessing: PostProcessing = PostProcessing(), frustumCullingEnabled: Boolean = true, shadowingEnabled: Boolean = true, screenSpaceRefractionEnabled: Boolean = false, stencilBufferEnabled: Boolean = false, content: @Composable FilamentSceneScope.() -> Unit)

All-in-one entry point for the common single-view case: declares a scene and renders it through one viewport in a single call. Equivalent to a rememberFilamentScene feeding one FilamentView — reach for those directly when you need multiple views over one scene, or to hoist the scene as a value.

Link copied to clipboard
fun FilamentView(scene: FilamentScene, modifier: Modifier = Modifier, cameraState: CameraState = rememberCameraState(), viewState: FilamentViewState = rememberFilamentViewState(), postProcessing: PostProcessing = PostProcessing(), frustumCullingEnabled: Boolean = true, shadowingEnabled: Boolean = true, screenSpaceRefractionEnabled: Boolean = false, stencilBufferEnabled: Boolean = false)

A viewport onto a FilamentScene. Each FilamentView owns one Filament View, Camera, Renderer, and platform surface, and renders the given scene through them. Place several FilamentViews — anywhere in your layout — to render one scene through different cameras and post-processing setups.

Link copied to clipboard

Attaches flight camera gesture and keyboard handling to this element.

Link copied to clipboard

Attaches map gesture handling to this element.

Link copied to clipboard
fun OnFrame(onFrame: (FrameInfo) -> Unit)

The single per-frame primitive for filament-compose: runs onFrame once per display refresh (via withFrameNanos) without triggering recomposition. Every other per-frame helper — rememberSceneClock, FilamentEffect's onFrame, rememberFlightCameraState, io.github.erkko68.filament.compose.scene.rememberAnimationState — is built on this.

Link copied to clipboard

Attaches orbit gesture handling to this element.

Link copied to clipboard

Issues a Filament picking query at every tap position and delivers the result to onPick.

Link copied to clipboard
fun rememberFilamentEngine(backend: Engine.Backend = Engine.Backend.DEFAULT): Engine

Creates and remembers a Engine for the lifetime of the composition.

Link copied to clipboard
fun rememberFilamentScene(engine: Engine = rememberFilamentEngine(), skyboxState: SkyboxState? = null, indirectLightState: IndirectLightState? = null, content: @Composable FilamentSceneScope.() -> Unit): FilamentScene

Declares a Filament Scene as a value. The content lambda declares the world — lights, models, primitives, groups — via scene composables; it emits no UI and runs once at this call site regardless of how many FilamentViews later render the scene.

Link copied to clipboard
fun rememberFlightCameraState(cameraState: CameraState, startPitch: Float = 0.0f, startYaw: Float = 0.0f, maxMoveSpeed: Float = 10.0f, moveDamping: Float = 15.0f, panSpeedX: Float = 0.01f, panSpeedY: Float = 0.01f): FlightCameraState

Creates and remembers a FlightCameraState driving cameraState in FLIGHT mode.

Link copied to clipboard
fun rememberMapCameraState(cameraState: CameraState, mapWidth: Float = 512.0f, mapHeight: Float = 512.0f, minDistance: Float = 1.0f, zoomSpeed: Float = 0.01f): MapCameraState

Creates and remembers a MapCameraState driving cameraState in MAP mode.

Link copied to clipboard
fun rememberOrbitCameraState(cameraState: CameraState, zoomSpeed: Float = 0.01f, orbitSpeedX: Float = 0.01f, orbitSpeedY: Float = 0.01f, enablePanning: Boolean = true): OrbitCameraState

Creates and remembers an OrbitCameraState that drives cameraState.

Link copied to clipboard
fun rememberRenderTarget(scene: FilamentScene, cameraState: CameraState = rememberCameraState(), width: Int = 512, height: Int = 512, postProcessingEnabled: Boolean = false): Texture?

Renders a FilamentScene off-screen through its own camera into a Texture that you can feed back into a material — the building block for mini-maps, security-camera monitors, portals and thumbnails. Returns the color attachment as a sampleable Texture (null until valid).

Link copied to clipboard

A monotonic per-frame clock as a State<Float> — seconds elapsed since the composable entered the composition. Reading the value triggers recomposition every frame, so use it with a by delegate inside scene composables to drive animations cheaply: