scene: ridge and terrain scenes follow the sky state #47

Merged
void merged 4 commits from nibu/sky-consumer into dev 2026-11-09 22:35:18 +00:00 AGit
Member

Consumer for the sky seam (#43): the scene now follows getSkyState. Branched from dev a1298662. Touches no title-bar control, theme wiring or auth styles.

  • index.ts (the door): reads getSkyState() at start, subscribes, and on a change disposes the scene and builds a new one on the same canvas; the returned scene's dispose unsubscribes. A login() already made is replayed on the rebuilt scene. A change that lands mid-build, or after dispose, is dropped by generation. The ray-march scene (Scene.ts, one fixed PALETTE dusk) ignores the state and is not rebuilt.
  • skyForState.ts: state to the scene's own sky option. auto returns nothing (ridge skyColours(), terrain clock plus ?sky= ?sun= ?az=), so auto is today's behaviour. dusk is the ridge dusk (skyColours()); day/night take top, middle and horizon stops from the baked noonday/midnight gradients that skyBackdrop bounds. Terrain: day = sky:'noonday', night = sky:'midnight', dusk = a sun at 2 degrees.
  • Tests: skyForState.test.ts (10) and index.test.ts (8): drawn colours lie inside skyBackdrop(state); auto passes no sky; subscribe on start, rebuild on change, dispose removes the subscription; login replay; stale and quick-succession changes. Mutations: deleting off() fails 2, the generation guard 2, the login replay fails its test.
  • Scene suite 21 files / 334 tests pass; prettier and eslint clean on touched files.

Not rendered in a browser: nothing was drawn. Not seen: the rebuilt ridge or terrain on a real canvas (the tests mock the scene modules), the rebuild flash and restart of the pull-back on a state change, a WebGL scene rebuilt on its existing context, or whether the terrain dusk (sun at 2 degrees) looks like the ridge dusk. The terrain dusk is not inside skyBackdrop('dusk') by construction (that bound is the ridge dusk), so its containment is untested. chooseSky precedence is unchanged: a ?sun= in the URL beats day/night. If the rebuild yields no scene the host's data-scene stays set (no callback for that).

Consumer for the sky seam (#43): the scene now follows `getSkyState`. Branched from dev a1298662. Touches no title-bar control, theme wiring or auth styles. - `index.ts` (the door): reads `getSkyState()` at start, subscribes, and on a change disposes the scene and builds a new one on the same canvas; the returned scene's `dispose` unsubscribes. A `login()` already made is replayed on the rebuilt scene. A change that lands mid-build, or after dispose, is dropped by generation. The ray-march scene (`Scene.ts`, one fixed PALETTE dusk) ignores the state and is not rebuilt. - `skyForState.ts`: state to the scene's own sky option. `auto` returns nothing (ridge `skyColours()`, terrain clock plus `?sky=` `?sun=` `?az=`), so auto is today's behaviour. `dusk` is the ridge dusk (`skyColours()`); `day`/`night` take top, middle and horizon stops from the baked noonday/midnight gradients that `skyBackdrop` bounds. Terrain: `day` = `sky:'noonday'`, `night` = `sky:'midnight'`, `dusk` = a sun at 2 degrees. - Tests: `skyForState.test.ts` (10) and `index.test.ts` (8): drawn colours lie inside `skyBackdrop(state)`; auto passes no sky; subscribe on start, rebuild on change, dispose removes the subscription; login replay; stale and quick-succession changes. Mutations: deleting `off()` fails 2, the generation guard 2, the login replay fails its test. - Scene suite 21 files / 334 tests pass; prettier and eslint clean on touched files. Not rendered in a browser: nothing was drawn. Not seen: the rebuilt ridge or terrain on a real canvas (the tests mock the scene modules), the rebuild flash and restart of the pull-back on a state change, a WebGL scene rebuilt on its existing context, or whether the terrain dusk (sun at 2 degrees) looks like the ridge dusk. The terrain dusk is not inside `skyBackdrop('dusk')` by construction (that bound is the ridge dusk), so its containment is untested. `chooseSky` precedence is unchanged: a `?sun=` in the URL beats `day`/`night`. If the rebuild yields no scene the host's `data-scene` stays set (no callback for that).
scene: the ridge and terrain scenes follow the sky state
Some checks failed
Build pull request / Build pull request (pull_request) Has been cancelled
0e0cff66ae
The door (index.ts) reads getSkyState, subscribes on start and rebuilds the
scene on the same canvas when it changes; the returned scene's dispose
unsubscribes. skyForState.ts maps a state to the scene's sky option: auto
leaves it unset (today's behaviour), dusk is the ridge dusk, day and night
are the baked gradients skyBackdrop bounds.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
scene: a failed sky-state rebuild restores the ground; an explicit sky beats the URL
Some checks failed
Build pull request / Build pull request (pull_request) Has been cancelled
6c22d4f1dc
The door tells the host (onInactive/onActive) when a rebuild makes no scene or
makes one again. chooseSky takes an explicit sun or sky option before ?sun=,
?az= and ?sky=; only auto, which passes none, is steered by the URL.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
scene: catch a state change during the first build; skyBackdrop is the union of what the scenes draw
Some checks failed
Build pull request / Build pull request (pull_request) Has been cancelled
edc6a9a8f1
index.ts compares the current state with the built one after subscribing and
rebuilds if they differ. skyBackdrop unions the ridge sky and the terrain sky
(skyColour sampled over the sphere, from chooseSky(terrainSkyFor(state))), so
terrain dusk's sun glow and terrain day's darker zenith are inside the range.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
void merged commit 78f5f4dbb2 into dev 2026-11-09 22:35:18 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
GameCult/Ratatoskr!47
No description provided.