M1c: weather, snap building, shelter, beds and regrowth

- Seeded weather (clear/cloudy/rain/storm, snow and blizzards on cold days
  and above the snowline), lightning, synthesised rain/wind/thunder sound
- Rain/snow particles stopped by roofs; wet ground, settled snow and wind
  via global shader uniforms
- Snap-together wood floor, wall, door, roof and gable with structural
  support, collapse and X to dismantle
- Shelter detection: dry under a roof, warmer and Rested inside with a fire;
  rain burns an uncovered campfire faster
- Bed sets the spawn point and lets you sleep through the night
- Trees, boulders and ground pickups regrow; timers saved
- Grass cleared under floors; shorter HUD hint
- New test_weather_building suite (62 checks) and tests/run_all.sh, which
  also fails on script errors
This commit is contained in:
Paul Bailey
2026-11-04 10:16:41 +00:00
parent fc7eb3cfed
commit fed96ef118
36 changed files with 2421 additions and 58 deletions

View File

@@ -18,8 +18,9 @@ void vertex() {
float phase = dot(inst_pos.xz, vec2(0.13, 0.17));
float gust = nz(inst_pos.xz * 0.012 + vec2(TIME * 0.02, TIME * 0.013));
vec3 sway = vec3(sin(TIME * 0.9 + phase), 0.0, cos(TIME * 0.7 + phase * 1.3) * 0.6);
sway *= wind_strength * h * (0.4 + gust);
sway += vec3(sin(TIME * 3.7 + dot(VERTEX, vec3(3.1, 1.7, 2.3)) + phase)) * flutter * clamp(VERTEX.y, 0.0, 1.0);
float wk = min(weather_wind, 2.2); // storms bend crowns, but not into the ground
sway *= wind_strength * wk * h * (0.4 + gust);
sway += vec3(sin(TIME * 3.7 * (0.7 + 0.3 * wk) + dot(VERTEX, vec3(3.1, 1.7, 2.3)) + phase)) * flutter * wk * clamp(VERTEX.y, 0.0, 1.0);
VERTEX += (inverse(MODEL_MATRIX) * vec4(sway, 0.0)).xyz;
}
@@ -27,6 +28,10 @@ void fragment() {
float v = nz(inst_pos.xz * 0.045);
vec3 tint = mix(vec3(0.88, 1.0, 0.85), vec3(1.12, 1.04, 0.78), v);
vec3 col = to_linear(COLOR.rgb) * tint;
// Snow on the upper faces of the crowns.
float up = (INV_VIEW_MATRIX * vec4(NORMAL, 0.0)).y;
col = mix(col, vec3(0.86, 0.89, 0.93), snow_mask(up, v) * 0.9);
col = wet_albedo(col, weather_wet * 0.5);
ALBEDO = col;
ROUGHNESS = 0.85;
SPECULAR = 0.3;