planetsim/src/render/Map2D.hpp
Jonas Reith acc0e5eec9 Initial commit: fanworgen planet sim
C++/raylib semi-realistic fantasy/sci-fi planet generator on a fixed icosphere
grid (Eulerian: properties flow over fixed cells). World-creation stages:
tectonics, continental drift & erosion, hydrology (rivers/lakes), climate
(temperature + orographic precipitation), and biome classification. Engine in
src/sim (raylib-free, headless-testable), viewer in src/render. See CLAUDE.md
and docs/ (design-notes.md, fauna-flora-plan.md = next step).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 15:08:25 +02:00

24 lines
895 B
C++

#pragma once
#include "raylib.h"
#include "Planet.hpp"
#include <vector>
// Equal Earth 2D map: per-cell screen positions + the projection/draw helpers.
struct Map2D {
std::vector<Vector2> pos; // screen position per cell (fast path)
std::vector<double> lon; // longitude per cell (radians, for seam detection)
std::vector<double> lat; // latitude per cell (radians)
};
void buildMap2D(const Planet& p, Rectangle r, Map2D& m);
double wrapPi(double l);
// Project a (lon,lat) onto the map with the longitude pan applied.
Vector2 projLonLat(double lon, double lat, double lonOffset, Rectangle r);
Vector2 mapScreen(const Map2D& m, int idx, Rectangle r, double lonOffset);
// lonOffset pans the map east/west (radians); y is unchanged by the pan.
void drawMap2D(const Planet& p, const std::vector<Color>& vc,
const Map2D& m, Rectangle r, double lonOffset);