CameraState

Hoisted, observable camera state. Create with rememberCameraState and pass to io.github.erkko68.filament.compose.FilamentView for full control over the camera.

All fields are observable androidx.compose.runtime.MutableState — read them inside a composable to subscribe to changes, or write them from anywhere on the main thread to drive the camera imperatively.

Read-only matrices (viewMatrix, projectionMatrix) reflect the underlying Filament camera and are valid only while the state is attached to a FilamentView.

val cameraState = rememberCameraState(eye = Position(0f, 2f, 5f))
FilamentView(scene = scene, cameraState = cameraState)

// Read the view matrix from anywhere
LaunchedEffect(cameraState.eye) {
val v = cameraState.viewMatrix // may be null until attached
}

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

4×4 column-major projection matrix (view→clip) computed by Filament. Null until this state is attached to a io.github.erkko68.filament.compose.FilamentView.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

4×4 column-major view matrix (world→view) computed by Filament. Null until this state is attached to a io.github.erkko68.filament.compose.FilamentView.