Rust voxel sandbox (wgpu + wasm + axum multiplayer)
New modules:
src/sim/lighting.rs - DAY_PERIOD, SUN_OFFSET constants; sun_direction,
day_strength, twilight_amount, LightingFrame::at;
is_in_direct_sun(world, p, t) via 3D DDA — the
mechanical sunlight predicate that future mob
burn / plant growth / shade pathfinding will all
consume. Mirrors the shader's sun math exactly
(Phase 2 will wire the WGSL side to consume the
same constants from this module).
src/sim/visibility.rs - compute_visible_chunks moved out of state.rs;
frustum_planes + chunk_in_frustum decomposed.
Moves into mesh.rs:
emit_oriented_box, name_hash + their tests. These are mesh utilities
(Vertex output, color hash for remote-player boxes), not GPU shell.
state.rs:
- drops the moved functions
- imports compute_visible_chunks / emit_oriented_box / name_hash from
their new homes
- 230 lines lighter
Tests: 51 passing (up from 45). New coverage: sun-below-horizon=>night,
open-sky-at-noon-is-lit, occluded-by-overhead-block, ramp shapes match
the WGSL smoothstep, name_hash determinism.
|
||
|---|---|---|
| server | ||
| src | ||
| web | ||
| .dockerignore | ||
| .gitignore | ||
| build-web.sh | ||
| Caddyfile | ||
| Cargo.lock | ||
| Cargo.toml | ||
| DEPLOY.md | ||
| docker-compose.prod.yml | ||
| docker-compose.yml | ||
| Dockerfile | ||
| run.sh | ||