Lighting class Lighting and environment

The lighting state handed to a Material when it binds for a draw.

Bundles the image-based-lighting EnvironmentMap (and the scene's environmentIntensity multiplier) with the analytic lights and shadow resources, so material code has everything it needs in one place.

Constructors

Lighting({required EnvironmentMap environmentMap, EnvironmentMap? environmentMapB, double environmentBlend = 0.0, double environmentIntensity = 1.0, Matrix3? environmentTransform, Texture? diffuseShTexture, DirectionalLight? directionalLight, Vector3? directionalLightDirection, Texture? punctualParamsTexture, Texture? punctualIndexTexture, int punctualParamsCount = 0, int punctualIndexWidth = 0, int punctualIndexHeight = 0, int spotShadowCount = 0, double spotShadowDepthBias = 0.0, double spotShadowNormalBias = 0.0, double spotShadowSoftness = 0.0, Texture? shadowMap, List<ShadowCascade> cascades = const [], Texture? ssaoMap, double specularOcclusionMode = 0.0, Size viewportSize = ui.Size.zero, Fog? fog, Texture? sceneDepthLinear, Vector3? cameraPosition, Vector3? cameraForward, double tanHalfFovX = 0.0, double tanHalfFovY = 0.0, double time = 0.0})

Properties

cameraForward → Vector3?
final
cameraPosition → Vector3?
Camera world position and normalized forward direction for this view, letting a material compute its fragment's planar view depth (dot(worldPos - cameraPosition, cameraForward)) to compare against sceneDepthLinear. Null when no material requests scene inputs.
final
cascades List<ShadowCascade>
The shadow cascades matching shadowMap, near-to-far, or empty when there is no shadow map this frame.
final
diffuseShTexture Texture?
The diffuse-SH coefficient texture to bind for this draw. During an environment cross-fade this is a 9x2 composite (row 0 primary, row 1 environmentMapB); otherwise null, and environmentMap's own 9x1 texture is bound.
final
directionalLight DirectionalLight?
The scene's directional light, or null when there isn't one.
final
directionalLightDirection → Vector3?
The world-space travel direction of directionalLight, derived from the light node's transform. Null when there is no directional light; consumers fall back to DirectionalLight.direction in that case.
final
environmentBlend double
The factor blending environmentMap toward environmentMapB (0 uses only environmentMap, 1 only environmentMapB). Ignored when environmentMapB is null.
final
environmentIntensity double
Scalar multiplier applied to environmentMap's contribution (the scene's environmentIntensity).
final
environmentMap EnvironmentMap
The image-based-lighting environment in effect for this draw.
final
environmentMapB EnvironmentMap?
A secondary environment cross-faded with environmentMap by environmentBlend, or null when a single environment is in effect.
final
environmentTransform → Matrix3
Rotation applied to the image-based-lighting environment (the scene's environmentTransform). Identity leaves it unrotated.
final
fog Fog?
The scene's distance fog, or null when fog is off for this frame. Applied per-fragment by every material in linear HDR before tone mapping.
final
hashCode int
The hash code for this object.
no setterinherited
opaqueSceneColor Texture?
The scene color snapshot taken between the opaque and translucent phases, for materials that declare RenderInput.opaqueSceneColor (refraction). Null during the opaque phase and when unrequested; the scene pass sets it before translucent draws encode.
getter/setter pair
punctualIndexHeight int
final
punctualIndexTexture Texture?
The per-frame light-index texture: each item's [lightListOffset, +lightListCount) slice indexes into punctualParamsTexture. Null when no item is reached by any light.
final
punctualIndexWidth int
Dimensions of punctualIndexTexture, for the shader's fetch-coordinate normalization.
final
punctualParamsCount int
Number of light rows in punctualParamsTexture. Zero leaves punctual lighting off (only directionalLight and the ambient term contribute).
final
punctualParamsTexture Texture?
The per-frame parameters texture holding every additional analytic light (point and spot lights, plus any directional lights past the first shadowed one), one per RGBA32F row, or null when there are none. Built by PunctualLightBuffer and shared across every lit draw this frame; a draw reads only the rows its per-object index slice selects.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sceneDepthLinear Texture?
The opaque geometry's linear (planar view-space) depth texture for materials that declare RenderInput.depth in Material.sceneInputs (depth-fade, absorption, shoreline foam), or null when no visible material asked for it. Same texture the SSAO/SSR passes consume.
final
shadowMap Texture?
The cascaded shadow map atlas (a depth-in-.r texture holding the cascade tiles as a horizontal strip) for directionalLight, or null when shadows are off for this frame. Sampled with cascades.
final
specularOcclusionMode double
How indirect specular is occluded: 0 leaves it on the diffuse occlusion factor, 1 derives a dedicated specular occlusion. Mirrors SpecularAmbientOcclusionMode.index.
final
spotShadowCount int
Number of shadow-casting spots this frame; their tiles follow the directional cascades in shadowMap and their matrices ride in punctualParamsTexture. Zero disables spot shadow sampling.
final
spotShadowDepthBias double
Shared spot-shadow sampling parameters.
final
spotShadowNormalBias double
final
spotShadowSoftness double
final
ssaoMap Texture?
The screen-space ambient-occlusion texture for this frame (occlusion factor in .r), or null when occlusion is off. When set, it modulates indirect lighting in the shader.
final
tanHalfFovX double
Tangents of the half field of view (x and y), letting a material project world positions to screen UV (screen-space marches). Zero for non-perspective cameras; materials treat that as unavailable.
final
tanHalfFovY double
final
time double
Seconds since the scene started rendering, for engine-driven material animation (the same clock custom post passes receive).
final
viewportSize Size
The color-pass render-target size, used to map gl_FragCoord into the occlusion texture's UV. Zero when occlusion is off.
final

Methods

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