A6: Sea, sky and weather

Weather.at(tide, tick) derives the weather from the tide's schedule
alone, so every client sees the same sky with nothing new on the wire:
the storm builds from calm at the first tide to a gale at sudden death,
and the light runs from mid-afternoon to dusk at the time limit.
WeatherView applies it each sync to the sky, sun, fog, ambient light,
the sea's roughness and rain around the camera (CPUParticles3D, for
both renderers). Under water the view closes into SEA_MURK, the rain
stops and the surface is a rippled ceiling seen from below.

The sea shader darkens open water and adds chop and whitecaps with the
storm, and keeps a breathing foam band at the waterline with a fainter
line beyond. In the Compatibility renderer, whose depth texture the
shader can't read (the sea came out all foam), water depth comes from
a texture of the terrain's heights instead. Sea colours move into
Palette; the rain and wind beds follow the weather.

Tests: test_weather (7). make check passes (611 tests). Captures:
make sea-captures (every tide phase, calm beach, the last land in the
gale, under water, and three in the Compatibility renderer).

Closes #46

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-13 18:05:42 -05:00
co-authored by Claude Opus 5.5
parent a282ca8e40
commit a4e81479bb
29 changed files with 703 additions and 22 deletions
+23
View File
@@ -620,3 +620,26 @@ is a piece placed. Being in the air waits `AIR_DELAY` before it shows, so steps
slope don't flicker. `EntityView.animate_live = false` lets captures pose figures
exactly.
## Sea, sky and weather (A6)
`Weather.at(tide, tick)` works out the moment's weather from the tide's schedule alone,
so every client agrees with nothing new on the wire: `storm` builds from calm at the
first tide to a gale at sudden death, and `day` runs from mid-afternoon to dusk at the
time limit. Sky colours, the sun's height, colour and strength, fog, rain and wind all
follow from those two (colours from `Palette`). Before the tide starts it's a clear
afternoon.
`WeatherView`, made by `MatchView`, applies a Weather on every sync: the procedural
sky's colours, the sun, the environment's fog and ambient light, `WaterView`'s
`sea_state`, and rain as `CPUParticles3D` around the camera, which works in both
renderers. When the camera is below the drawn sea (`WaterView.is_under`), the fog
turns to `SEA_MURK` and closes in, and the rain stops. `ClientSession` passes the rain
and wind to `SoundDirector`'s rain and wind beds.
The sea shader darkens open water toward `SEA_STORM`, lengthens and steepens the chop
and raises whitecaps with `sea_state`, and keeps a breathing foam band at the
waterline with a fainter second line beyond it. Water depth comes from the depth
buffer in Forward+ (which also sees pieces and props) and from a texture of the
terrain's heights (`WaterView.set_ground`) in the Compatibility renderer, whose depth
texture the shader can't read. Seen from below, the surface is drawn as a rippled
ceiling of murk.