planetsim/src/render/Panels.hpp
Jonas Reith aa32e38dad Live World stage: clock, day/night, seasons, moons, tides & ocean currents
Adds the slow real-time "Live World" mode (key W on a settled world) that runs the
finished planet on an hours->weeks/months clock (liveTime/liveRate, [ / ] ramp the rate)
with geology frozen. Everything new is a derived per-cell field flowed over the fixed grid.

Day/night & seasons (PlanetLive.cpp): a raylib-free per-cell insolation field
(computeInsolation) drives a moving day/night terminator (N) from time-of-day rotation +
seasonal declination (axialTilt); a live seasonal temperature cycles the static summer/winter
fields over the year (computeLiveSeason); a moving snow/sea-ice line tracks it. Day/night +
snow are render overlays over any colour mode (3D + 2D). Save v8 stores the live clock.

Sky & tides (PlanetOcean.cpp): 1-3 random moons (separate RNG, saved v9) orbit on the
clock and, with the now small/distant sun, raise an equilibrium tide (computeTides -> sTide),
shown as a tide-coloured coastline (T, buildCoastline + tideColor). Moons render with sun-lit
phases, orbit rings and eclipses (solar shadow spot in the day/night overlay, lunar dimming).
The 2D map is left-aligned; the freed space holds a Live-World "Sky & tides" panel (per-moon
phase + a selected coastal tile's tidal phase).

Ocean currents + climate feedback (PlanetOcean.cpp): computeOceanCurrents builds a
per-ocean-cell tangent velocity from wind stress + Coriolis deflection + coast-following
(gyres); computeClimate feeds warm (poleward) / cold (equatorward) currents back into sTemp as
a bounded coastal anomaly (climateCurrentFactor) before seasons, so biomes shift. Rendered as
warm/cold current arrows (O).

Config: dayLengthHours/yearLengthDays/snowTemp/seaIceTemp/tideAmplitude/tideSunFactor/
climateCurrentFactor. Save header v7->v9 (version-gated; older saves load fine). Headless
test_live.cpp + test_ocean.cpp; test_logic/test_biota still pass; GUI build clean. Docs updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 10:04:45 +02:00

22 lines
1011 B
C++

#pragma once
#include "raylib.h"
#include "Planet.hpp"
#include <memory>
// Right-column UI panels: the tile detail panel (subtiles grid), the hover/
// selection info box, and the world-statistics panel.
// Tile detail panel: tile info header + the selected cell's subgrid drawn as a
// flat, hoverable grid of subtiles (neighbor-owned subtiles dimmed). hoveredSub
// is the grid index under the cursor (-1 if none).
void drawDetailPanel(const Planet& p, const std::shared_ptr<SubGrid>& sg,
int macro, double macroElev, double macroAge,
Rectangle panel, Rectangle grid, int hoveredSub);
// Top-right quadrant: info for the hovered cell (or the selected one if none).
void drawHoverPanel(const Planet& p, Rectangle r, int hovered, int selected);
// World statistics panel (shown in the subareas quadrant when no tile selected).
void drawStats(const Planet& p, Rectangle r, double elapsedMy, bool drifting,
bool live = false, double liveHours = 0.0);