render3d: terrain_baked_at - a map's terrain and sun shadow taken from its bakes at start and on a swap

The game names the tiles' and the shadow's bake files (key, version) before the map is made; r3d_init's
terrain step and terrain_reload then open them with terrain_from_baked / terrain_shadow_from_bytes and
generate nothing, and fall back to the survey (saying so once) when a bake is missing or stale. Without
the call nothing changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 17:42:16 +03:00
parent f02eab5c51
commit 06d828a296
5 changed files with 53 additions and 2 deletions

View file

@ -143,7 +143,7 @@ function r3d_load_step(render3d_st: mut Render3dState, i: int) -> bool {
daylight_init(render3d_st)
} else if t >= 0 and t < TERRAIN_INIT_STEPS {
if render3d_st.r3d_plate { return true }
if t == 0 {
if t == 0 and not terrain_baked_try(render3d_st) {
if render3d_st.r3d_dem_path != null { terrain_use_dem(render3d_st, render3d_st.r3d_dem_path, render3d_st.r3d_dem_min, render3d_st.r3d_dem_max, render3d_st.r3d_dem_base, render3d_st.r3d_dem_ox, render3d_st.r3d_dem_oz) }
if render3d_st.r3d_ortho_path != null { terrain_use_ortho(render3d_st, render3d_st.r3d_ortho_path) }
}