Documentation Index
Fetch the complete documentation index at: https://mintlify.com/danielitoCode/Spatial/llms.txt
Use this file to discover all available pages before exploring further.
Scene is the root composable that establishes the OpenGL rendering surface and collects 3D elements from its content block. Internally it wraps an AndroidView, pipes the composable element graph into the render host on every frame, and wires touch gestures to the CameraState you supply. Everything inside the content lambda — Element.Cube, Element.Sphere, Element.Plane — is collected into a scene graph and rendered via an OpenGL ES 3.0 backend on each recomposition.
Import
Signature
Parameters
Standard Jetpack Compose
Modifier applied to the AndroidView container. Use it to control layout size, padding, clipping, and other UI-layer properties — for example Modifier.fillMaxSize().Factory that creates the Android-side render host responsible for the OpenGL surface and runtime. Pass
DefaultSceneRenderHostFactory from the spatial-compose-runtime-adapter artifact for the standard OpenGL ES 3.0 renderer. The host is created once inside the AndroidView factory lambda and disposed automatically when the composable leaves the composition via onRelease.Observable orbit-camera state. Defaults to
rememberCameraState() which initialises the camera at yaw 0°, pitch 0°, zoom 1.0. Provide a remembered or hoisted CameraState to read or programmatically drive the camera from outside the Scene.Gesture configuration passed to the scene’s pointer-input handler. Defaults to
Gestures.orbit(), which enables one-finger drag-to-orbit with adaptive sensitivity. Use Gestures.orbitAndZoom() to additionally enable two-finger pinch zoom, or Gestures.none() to disable all touch input.Composable lambda in which you declare 3D elements using
Element.Cube, Element.Sphere, and Element.Plane. The runtime collects calls made inside this block into a scene graph on every recomposition and submits it to the render host.Example
Notes
Scene wraps an AndroidView internally. The render host is created once in the factory lambda and disposed in the onRelease callback — you do not need to manage its lifecycle manually.