FilamentEffect

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.

The block runs on entry and re-runs whenever any keys change, with DisposableEffect semantics: create resources in block, destroy them in FilamentEffectScope.onDispose. Use FilamentEffectScope.onFrame for per-frame work.

rememberFilamentScene {
FilamentEffect {
val entity = engine.getEntityManager().create()
scene.addEntity(entity)
onFrame { frame -> /* drive a material parameter, transform, etc. */}
onDispose {
scene.removeEntity(entity)
engine.getEntityManager().destroy(entity)
}
}
}