Lighting2DPass class final

Lights the frame when the world has a Lighting2D on: the frame and its normals (RenderSystem.renderNormals) drawn through shaders/lighting_2d.frag, lit by up to maxLights Light2Ds — those reaching the view, the nearest its middle first — over the ambient light. Lights that cast shadows are stopped by what casts them (ShadowCaster2D, Level Map layers that cast them): their shapes drawn into a mask (RenderSystem.renderOccluders), how far each light reaches every way found from it (shaders/shadow_map_2d.frag). What the engine puts first in RenderingEngine.screenPasses.

Implemented types

Constructors

Lighting2DPass(World? world(), {double clock()?})
A pass over the world world gives (null for none).

Properties

active → bool
Whether it draws this frame; asked once a frame, before anything is.
no setteroverride
clock → double Function()?
Seconds into the game; null stands still.
final
enabled ↔ bool
Whether it lights at all: an editor turns it off to see the scene unlit while it is worked on.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
lastHadShadows → bool
Whether the last frame had shadows: a light casting them, and something they were cast by.
no setter
lastLights → List<Light2D>
The lights drawn in the last frame, nearest the view's middle first. For tests and an editor's overlay.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
showNormals ↔ bool
Whether it draws the normals the frame is lit by instead of lighting it — an editor's view of them, as a normal map draws them: red, green the normal's x and y (green up), blue its z; flat is (0.5, 0.5, 1).
getter/setter pair
world → World? Function()
The world that is lit.
final

Methods

dispose() → void
Lets go of the shaders and images.
filter(Size size, double pixelRatio) → ImageFilter?
Never a layer filter: it draws from more than the frame — its normals and shadows, drawn from what the frame holds.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paint(Canvas canvas, Image frame, Size size, double pixelRatio) → void
Draws frame — the frame so far, drawn into an image pixelRatio times the view's size — over the view onto canvas, in logical pixels.
override
toString() → String
A string representation of this object.
inherited

Operators

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

Constants

fullNormalsPixels → const int
The most pixels the frame's normals are drawn at in full: past this (a big window), at half its size each way. Every buffer is a render target, which a GPU has only so much room for — Impeller on OpenGL ES aborts when one cannot be made — and light is smooth.
maskScale → const double
How big the mask of what casts shadows is, to the view.
maxLights → const int
The most lights drawn at once.
shadowDirections → const int
Directions round a light its shadows are found in.
uniformFloats → const int
How many floats lighting_2d.frag's uniforms hold.