Package-level declarations

Types

Link copied to clipboard

Common surface shared by OrbitCameraController, MapCameraController and FlightCameraController — the operations that make sense for any manipulator-driven camera, so generic UI (a "reset view" button, save/restore of viewpoints) can drive whichever controller is active without caring about the control scheme. Mode-specific extras — flight's per-frame FlightCameraController.update — live on the concrete types, not here.

Link copied to clipboard
interface EntityScope

Receiver for the onCreate callback of entity-producing scene composables — Group and the primitives (Cube, Sphere, Plane, Cylinder, Mesh). Exposes the created entity together with the engine, so one-time setup (manager operations, pick registries) needs no extra plumbing — the same scope-receiver shape as GltfInstance's richer GltfInstanceScope.

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.

Properties

Link copied to clipboard

The Engine backing the enclosing rememberFilamentScene, or null outside one.

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(engine: Engine, environment: Environment, modifier: Modifier = Modifier, cameraState: CameraState = rememberCameraState(), viewState: FilamentViewState = rememberFilamentViewState(), postProcessing: PostProcessing = PostProcessing(), frustumCullingEnabled: Boolean = true, shadows: Shadows? = Shadows.Pcf, screenSpaceRefractionEnabled: Boolean = false, stencilBufferEnabled: Boolean = false, transparent: Boolean = false, content: @Composable FilamentSceneScope.() -> Unit)

Overload wiring a loaded io.github.erkko68.filament.compose.scene.Environment (from rememberKTXEnvironment / rememberHDREnvironment) into the all-in-one view without threading its two states by hand. engine and environment are required and therefore lead the list — the engine must be the same one the environment's textures were loaded on. modifier keeps its place as the first optional parameter; all other parameters match the primary overload.

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, shadows: Shadows? = Shadows.Pcf, screenSpaceRefractionEnabled: Boolean = false, stencilBufferEnabled: Boolean = false, transparent: 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, shadows: Shadows? = Shadows.Pcf, screenSpaceRefractionEnabled: Boolean = false, stencilBufferEnabled: Boolean = false, transparent: 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, rememberFlightCameraController, 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 an Engine for the lifetime of the composition.

Link copied to clipboard

Overload wiring a loaded Environment (from rememberKTXEnvironment / rememberHDREnvironment) into the scene in one argument, instead of threading its two states by hand:

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 rememberFlightCameraController(cameraState: CameraState, startPitch: Float = 0.0f, startYaw: Float = 0.0f, maxMoveSpeed: Float = 10.0f, initialMoveSpeed: Float = 1.0f, speedSteps: Int = 20, moveDamping: Float = 15.0f, panSpeedX: Float = 0.01f, panSpeedY: Float = 0.01f): FlightCameraController

Creates and remembers a FlightCameraController driving cameraState in FLIGHT mode.

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

Creates and remembers a MapCameraController driving cameraState in MAP mode.

Link copied to clipboard
fun rememberOrbitCameraController(cameraState: CameraState, zoomSpeed: Float = 0.01f, orbitSpeedX: Float = 0.01f, orbitSpeedY: Float = 0.01f, panningEnabled: Boolean = true): OrbitCameraController

Creates and remembers an OrbitCameraController that drives cameraState.

Link copied to clipboard
fun rememberRenderTargetTexture(scene: FilamentScene, cameraState: CameraState = rememberCameraState(), width: Int = 512, height: Int = 512, postProcessing: PostProcessing = PostProcessing(enabled = 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: