scene library

3D rendering for Flutter, built on Flutter GPU and Impeller.

The entry points most applications need are:

Flutter Scene currently requires the Flutter master channel because it depends on the Flutter GPU API.

Classes

Animation
A reusable description of an animation, parsed from a model.
AnimationChannel
One keyframed track within an Animation, pairing a BindKey target with a PropertyResolver that produces values over time.
AnimationClip
An instance of an Animation that has been bound to a specific Node.
AnimationPlayer
Drives playback and blending for the AnimationClips on a single node subtree.
AnimationTransforms
Per-node animation state held by an AnimationPlayer.
BezierPath
A path of joined cubic Bezier segments.
BindKey
Identifies a single animation target as a (node name, property) pair.
Camera
Base class for camera implementations passed to Scene.render.
CatmullRomPath
A smooth curve passing through every one of a list of points.
Component
A unit of data or behavior attached to a Node.
CuboidGeometry
An axis-aligned box geometry spanning -extents/2 to +extents/2 on each axis.
DashPattern
A repeating dash-and-gap pattern for a PolylineGeometry, measured in scene units along the line's arc length.
DecomposedTransform
A decomposed animation transform consisting of a translation, rotation, and scale.
DirectionalLight
An infinitely-distant light source (e.g. the sun) that illuminates the whole scene from a single direction.
EnvironmentMap
A source of image-based lighting: diffuse irradiance plus prefiltered specular radiance, both derived from an equirectangular environment.
ExtrudeGeometry
An arbitrary closed 2D profile swept along a ScenePath.
Geometry
Vertex (and optional index) data along with the vertex shader used to transform it.
GeometryBuilder
Assembles a MeshGeometry one vertex and triangle at a time.
InstancedMesh
Many copies of one Geometry / Material pair, each placed by its own model transform.
InstancedMeshComponent
An engine Component that draws an InstancedMesh.
Lighting
The lighting state handed to a Material when it binds for a draw.
Material
Base class for shading a MeshPrimitive.
Mesh
Defines the shape and appearance of a 3D model in the scene.
MeshComponent
An engine Component that draws a Mesh.
MeshGeometry
A triangle mesh built at runtime from vertex attribute arrays.
MeshPrimitive
Represents a single part of a Mesh, containing both Geometry and Material properties.
Node
A Node represents a single element in a 3D scene graph.
PerspectiveCamera
A standard pinhole-style perspective camera.
PhysicallyBasedMaterial
A glTF-style metallic-roughness physically based material with image-based lighting.
PlaneGeometry
A flat rectangular grid in the XZ plane, centered on the origin, with its surface facing +Y.
PolylineGeometry
A thick, camera-facing line through a list of points.
PolylinePath
A path of straight segments connecting a list of points.
PropertyResolver
Computes a per-property animated value from a timeline of keyframes.
RibbonGeometry
A flat strip of constant width swept along a ScenePath.
RotationTimelineResolver
Resolves a rotation timeline with spherical linear interpolation, slerping the current animated rotation toward the keyframed rotation by the supplied weight.
ScaleTimelineResolver
Resolves a scale timeline with per-component linear interpolation.
Scene
Represents a 3D scene, which is a collection of nodes that can be rendered onto the screen.
SceneEncoder
Records draw calls for one frame's color pass into a single gpu.RenderPass.
ScenePath
A curve through 3D space, independent of any geometry or rendering.
ScenePathFrame
An oriented coordinate frame at a point along a ScenePath.
ShaderMaterial
A Material backed by a caller-supplied fragment shader.
ShadowCascade
One cascade of a cascaded shadow map, produced by DirectionalLight.computeCascades.
Skin
A skeletal binding used by skinned meshes for animation.
SkinnedGeometry
Geometry whose vertices use the skinned 80-byte layout: the unskinned attributes followed by 4 joint indices and 4 joint weights.
SphereGeometry
A UV sphere centered on the origin.
Surface
Manages the swapchain color textures a Scene composites onto the Flutter canvas, plus the pool of transient render-graph attachments.
TimelineResolver
Shared keyframe lookup for the per-property timeline resolvers.
TranslationTimelineResolver
Resolves a translation timeline with per-component linear interpolation, blended into AnimationTransforms.animatedPose as an offset from the bind pose.
TubeGeometry
A round cross-section of constant radius swept along a ScenePath.
UnlitMaterial
A material that draws geometry with a flat color or texture, ignoring scene lighting.
UnskinnedGeometry
Geometry whose vertices use the unskinned 48-byte layout: position (vec3), normal (vec3), tex coords (vec2), color (vec4).

Enums

AlphaMode
How a PhysicallyBasedMaterial's alpha channel is interpreted, matching glTF's alphaMode.
AnimationProperty
One of the three node-local transform components an animation channel can drive.
AntiAliasingMode
Anti-aliasing strategy used when rendering a Scene.
GeometryStorage
How a MeshGeometry manages its GPU buffers over its lifetime.
PolylineCap
How a PolylineGeometry finishes its two end points.
PolylineWidthMode
How a PolylineGeometry's width is measured.
RibbonAlignment
How a RibbonGeometry orients its strip across the path.
ToneMappingMode
Tone mapping operator applied when resolving the linear HDR scene color to the display-referred image (see Scene.toneMapping).

Mixins

SceneGraph
Defines a common interface for managing a scene graph, allowing the addition and removal of Nodes.

Extensions

QuaternionSlerp on Quaternion
Spherical interpolation helpers on Quaternion.
Vector3Lerp on Vector3
Per-component arithmetic helpers on Vector3.

Constants

kDiffuseShCoefficientCount → const int
Number of L2 spherical-harmonic coefficients used for diffuse irradiance (bands 0..2).
kPrefilterBandCount → const int
Number of roughness bands in a prefiltered-radiance atlas (band 0 = mirror, band kPrefilterBandCount - 1 = fully rough; band i covers perceptual roughness i / (kPrefilterBandCount - 1)).
kPrefilterBandHeight → const int
Equirectangular height of a single roughness band in the atlas.
kPrefilterBandWidth → const int
Equirectangular width of a single roughness band in the atlas.

Properties

baseShaderLibrary ShaderLibrary
The shader bundle shipped with flutter_scene.
no setter

Functions

gpuTextureFromAsset(String assetPath) Future<Texture>
Loads an image from the asset bundle at assetPath and uploads it as a Flutter GPU texture.
gpuTextureFromImage(Image image) Future<Texture>
Uploads a decoded dart:ui ui.Image to a Flutter GPU texture.
imageFromAsset(String assetPath) Future<Image>
Loads and decodes an image from the asset bundle at assetPath.
loadBaseShaderLibrary() Future<void>
Asynchronously loads and caches the base shader bundle. Idempotent. Called by Scene.initializeStaticResources so the synchronous baseShaderLibrary getter has a cached library to return (required on web, where shader assets can't be read synchronously).
prefilterEquirectRadiance(Texture sourceEquirect, {bool sourceIsLinear = false}) Texture
Prefilters an equirectangular radiance texture into a vertical roughness-band atlas for image-based specular lighting.

Typedefs

GltfResourceResolver = Future<Uint8List> Function(String uri)
Resolves an external resource referenced by a multi-file glTF document (a .bin buffer or an image file).