A per-cell humidity/cloud/rain cycle advanced on the live clock (PlanetWeather.cpp, raylib-free): evaporate over warm sunlit seas -> advect humidity & cloud along the prevailing wind (upwind differencing) -> condense into cloud (saturation vs temperature + windward orographic lift) -> rain out thick cloud -> dissipate. Bounded exp-rate forms keep it stable at any timestep, so it runs cleanly from hours/sec up to a month/sec. initWeather() spins the fields up from the moisture climatology; fully deterministic (no RNG). Render: a translucent cloud shell over the 3D globe (white -> dark slate where it rains, alpha = cover) plus a matching drawWeather2D layer on the 2D map (shared drawMapTris rasterizer), toggled with K (default on). stepSim runs stepWeather each live frame at the sim-hours added to liveTime (held when paused). Cell-info shows cloud/humidity/raining. Saved as v10 (humidity/cloud/rain, flag-gated; pre-v10 saves spin weather up live). New weather* config knobs. Reseed/regen now also drops out of Live World. test_weather.cpp: fields in range, clouds form + rain falls, oceans moister than land, determinism, v10 round-trip; the other four suites still pass; GUI build clean. Docs updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
62 lines
1.8 KiB
CMake
62 lines
1.8 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
project(PlanetSim CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
include(FetchContent)
|
|
FetchContent_Declare(
|
|
raylib
|
|
GIT_REPOSITORY https://github.com/raysan5/raylib.git
|
|
GIT_TAG 5.5
|
|
)
|
|
# Build raylib as a static lib, no examples.
|
|
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
|
set(BUILD_GAMES OFF CACHE BOOL "" FORCE)
|
|
FetchContent_MakeAvailable(raylib)
|
|
|
|
add_executable(planetsim
|
|
src/main.cpp
|
|
# Engine (raylib-free, testable headless) -- src/sim
|
|
src/sim/IcoSphere.cpp
|
|
src/sim/Planet.cpp
|
|
src/sim/PlanetTectonics.cpp
|
|
src/sim/PlanetDrift.cpp
|
|
src/sim/PlanetErosion.cpp
|
|
src/sim/PlanetHydrology.cpp
|
|
src/sim/PlanetBiomes.cpp
|
|
src/sim/PlanetClimate.cpp
|
|
src/sim/PlanetLive.cpp
|
|
src/sim/PlanetOcean.cpp
|
|
src/sim/PlanetWeather.cpp
|
|
src/sim/PlanetBiota.cpp
|
|
src/sim/PlanetFloraGen.cpp
|
|
src/sim/PlanetFaunaGen.cpp
|
|
src/sim/PlanetFungiGen.cpp
|
|
src/sim/PlanetIO.cpp
|
|
# Viewer (raylib) -- src/render
|
|
src/render/Colors.cpp
|
|
src/render/Map2D.cpp
|
|
src/render/Overlays.cpp
|
|
src/render/Picking.cpp
|
|
src/render/Panels.cpp
|
|
src/render/Viewer.cpp
|
|
src/render/ViewerInput.cpp
|
|
src/render/ViewerRender.cpp
|
|
)
|
|
# Flat includes ("Planet.hpp", "Viewer.hpp", ...) resolve across both folders.
|
|
target_include_directories(planetsim PRIVATE src/sim src/render)
|
|
target_link_libraries(planetsim PRIVATE raylib)
|
|
|
|
# OpenMP parallelizes the per-cell passes in Planet::step(). Optional: without
|
|
# it the #pragma omp lines are ignored and the sim runs (correctly) serial.
|
|
find_package(OpenMP)
|
|
if(OpenMP_CXX_FOUND)
|
|
target_link_libraries(planetsim PRIVATE OpenMP::OpenMP_CXX)
|
|
endif()
|
|
|
|
# Linux system libs raylib needs at link time.
|
|
if(UNIX AND NOT APPLE)
|
|
target_link_libraries(planetsim PRIVATE m pthread dl)
|
|
endif()
|