SkyEnvironment class Lighting and environment
Drives Scene.environment from a sky on a refresh policy.
Assign one to Scene.skyEnvironment to have the scene bake source into
its image-based lighting (specular reflections plus diffuse irradiance)
and keep it fresh per refresh. While set, the binding owns
Scene.environment: each due bake replaces it. The visible background
(Scene.skybox) is independent and cheap; the same source can drive both
so the lit scene always matches what is on screen:
final sky = await loadFmatSky('assets/gradient_sky.fmat');
scene.skybox = Skybox(sky);
scene.skyEnvironment = SkyEnvironment(sky);
// ... later, after changing the sky's parameters:
scene.skyEnvironment!.invalidate();
Constructors
- SkyEnvironment(ShaderSkySource source, {SkyEnvironmentRefresh refresh = SkyEnvironmentRefresh.manual, Duration interval = const Duration(seconds: 1), int faceResolution = 128, int equirectWidth = 512})
Properties
- equirectWidth ↔ int
-
Width of the assembled equirect the prefilter and SH projection read.
getter/setter pair
- faceResolution ↔ int
-
Cube-face capture resolution for the bake. Lower values make frequent
re-bakes cheaper at the cost of lighting detail.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- interval ↔ Duration
-
Minimum time between bakes for SkyEnvironmentRefresh.interval.
getter/setter pair
- refresh ↔ SkyEnvironmentRefresh
-
When the bake re-runs. See SkyEnvironmentRefresh.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- source ↔ ShaderSkySource
-
The sky baked into the lighting.
getter/setter pair
Methods
-
bakeIfDue(
DateTime now) → EnvironmentMap? - Advances the bake and returns a fresh environment when one completes, or null to keep the current one. Called by the engine once per frame before the render graph is built; not part of the app-facing API.
-
invalidate(
) → void - Requests a re-bake on the next frame regardless of refresh. Call after changing the sky's parameters under SkyEnvironmentRefresh.manual.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited