Animate water and lava with gentle waves and flowing textures

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-05 14:56:38 +01:00
1 parent f4622d285d
commit f18af0d64c
2 files changed
+51 -10

No files matched your search

+7 -4
View File
@@ -609,9 +609,12 @@ fn gen_atlas() -> Image {
});
// ---- campaign terrain
for v in 0..4u32 {
// water: dark blue with lighter wave crests
// water: dark blue with lighter wave crests. Seamless (period 16): the shader lets it flow
// across the tiles, sampled in world space
cv.cell(T_WATER + v, |x, y| {
let wave = ((x as f32 * 0.8 + (y as f32 * 0.9 + v as f32 * 1.7).sin() * 2.2) as i32 + y * 2) % 9;
let tau = std::f32::consts::TAU;
let bend = ((y as f32 + v as f32 * 3.0) * tau / 16.0).sin() * 1.6 + ((x as f32) * tau / 8.0).sin() * 0.6;
let wave = (x + y * 2 + bend.round() as i32).rem_euclid(8);
let d = (rnd(x, y, v + 120) * 10.0) as i32 - 5;
Some(match wave {
0 => shade((70, 120, 170), d),
@@ -619,9 +622,9 @@ fn gen_atlas() -> Image {
_ => shade((24, 50, 88), d),
})
});
// lava: glowing orange with dark crust plates
// lava: glowing orange with dark crust plates (4x4 plates, seamless at the cell border)
cv.cell(T_LAVA + v, |x, y| {
let crust = rnd(x / 3 + (y / 3) % 2, y / 3, v + 130);
let crust = rnd((x / 4 + (y / 4) % 2) % 4, y / 4, v + 130);
let edge = rnd(x, y, v + 131) * 0.25;
if crust + edge > 0.85 {
Some(shade((60, 22, 14), (rnd(x, y, v + 132) * 14.0) as i32))