EnvironmentMapData class final

What lights a scene from all round, ready for the GPU: a small cube map of what surrounds it — level 0 the sky itself, each smaller level blurred for a rougher surface (GGX, prefiltered here on the CPU) — and its diffuse light as nine spherical-harmonic coefficients.

Directions are the engine's (+Y down). The faces follow the cube-map convention every graphics API shares (+X, -X, +Y, -Y, +Z, -Z; see directionOf), so a world direction samples the cube as it is.

Properties

hashCode → int
The hash code for this object.
no setterinherited
levelCount → int
How many levels it has.
no setter
levels → List<List<Float32List>>
The levels, largest first; each six faces of RGBA floats (four a pixel, rows from the first in memory).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sh → Float32List
Diffuse light: nine RGB coefficients (27 floats), already scaled so that Σ sh[i]·Yᵢ(n) is the light a white Lambert surface facing n gives back.
final
size → int
Width and height of a face of level 0, in pixels.
final

Methods

halfFloatsOf(int level, int face) → ByteData
Level level's face face as half floats (RGBA, 8 bytes a pixel): what an rgba16f texture takes.
irradiance(double nx, double ny, double nz) → (double, double, double)
Diffuse light (RGB, for a white Lambert surface) facing n (unit).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sample(int level, double x, double y, double z, Float32List out) → void
Level level's colour in direction (x, y, z), nearest texel.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

build(void radiance(double x, double y, double z, Float32List out), {int size = 32}) → EnvironmentMapData
Builds a map from what radiance says each direction holds.
directionOf(int face, double s, double t) → (double, double, double)
The direction (not normalized) a face's texel at s, t (0–1, s along a row, t down the rows) stands for.
faceOf(double x, double y, double z) → (int, double, double)
The face and texel coordinates (0–1) direction (x, y, z) falls on: directionOf undone.
fromEquirect(HdrImage image, {int size = 64}) → Future<EnvironmentMapData>
The surroundings in an equirectangular panorama image (the top row straight up, the middle column ahead along +Z).
fromGradient((double, double, double) zenith, (double, double, double) horizon, (double, double, double) ground, {int size = 32}) → Future<EnvironmentMapData>
The surroundings of a gradient sky, as the sky shader draws it: zenith overhead, horizon around, ground below (linear RGB).
gradientNow((double, double, double) zenith, (double, double, double) horizon, (double, double, double) ground, {int size = 32}) → EnvironmentMapData
fromGradient on this isolate.
toHalf(double value) → int
value as an IEEE half float's bits (rounded; clamped to its range).