GradientEnvironment
A vertical background gradient with 2, 3 or 4 stops.
| Inherits | IEnvironment |
Declared in src/libs/libconstruct/construct/rendering/GradientEnvironment.hpp.
Detailed description
ONE class, three registered instances (`gradient-2`, `gradient-3`, `gradient-4`) rather than three near-identical classes. The stop count changes where the colors land and nothing else — the unprojection, the sRGB→linear conversion and the sampleSnippet are the same maths in all three, and three copies of it would be three places for a horizon to drift.
What each stop count is for
`t` runs 0 at the nadir to 1 at the zenith, from the world-space view direction. ⚠ Not `max(dir.y, 0)` — the environment this replaced graded only the upper hemisphere and left everything below the horizon a single flat color, so a "gradient" had no gradient in the bottom half of frame.
- **2 stops** — nadir → zenith, one continuous ramp. - **3 stops** — nadir → horizon → zenith, continuous THROUGH the horizon color. - **4 stops** — nadir → horizon(ground) ‖ horizon(sky) → zenith, with a deliberate DISCONTINUITY at t = 0.5. That break is the feature: it is what puts a brown ground against a blue sky meeting at a hard horizon line, which no continuous ramp can express.
Why the colors are not shared between stop counts
Each instance owns its own colors and the settings that feed them are registered under separate ids (`envGrad2*`, `envGrad3*`, `envGrad4*`). These are three different backgrounds, not one background with a stop count: tuning a two-stop pair and then trying four must leave the pair untouched when you switch back.