|
| 1 | +# Change Log |
| 2 | + |
| 3 | +All notable changes to `bresenham-lighting-engine` are documented here. |
| 4 | +This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
| 5 | + |
| 6 | +## [Unreleased] — 2026-05-25 |
| 7 | + |
| 8 | +### Added |
| 9 | + |
| 10 | +- **`LightingEngine` type** ([`src/engine.rs`](src/engine.rs)). Construct one |
| 11 | + with `LightingEngine::new()` and call methods on it directly. Each engine |
| 12 | + owns its own tile map, block map, collision system, and light registry — |
| 13 | + multiple engines can coexist in one process. This unlocks two things that |
| 14 | + were previously impossible: |
| 15 | + - **Parallel tests**: each test builds its own engine, so the default |
| 16 | + `cargo test` thread pool no longer races on shared globals. |
| 17 | + - **Embedding**: Rust callers (servers, level editors, comparison |
| 18 | + harnesses) can hold more than one scene at a time. See |
| 19 | + [ADR-0007](docs/decisions/0007-extract-lighting-engine-type.md). |
| 20 | +- **`LightingEngine::render_canvas_text(light_id)`** — ASCII-matrix view of a |
| 21 | + light's canvas, suitable for stdout, panic messages, or piping to other |
| 22 | + tools. |
| 23 | +- **Scenarios module** ([`src/scenarios/`](src/scenarios/mod.rs)) — plain Rust |
| 24 | + functions like `single_light` and `object_shadow` that populate a |
| 25 | + `LightingEngine`. Shared between the exploration CLI and the regression |
| 26 | + tests so the same scene definition drives both. |
| 27 | +- **`scenario` example** — `cargo run --example scenario -- --list` enumerates |
| 28 | + the available scenarios; `--name <NAME>` prints the ASCII matrix; |
| 29 | + `--output-format png --out path.png` renders a PNG. |
| 30 | +- **`CONTEXT.md`** — canonical vocabulary (Tile, Cell, Wall, Object, Room, |
| 31 | + LightingEngine, Light, Canvas, Ray). Read this before contributing. |
| 32 | +- **`.cargo/config.toml`** sets `RUST_MIN_STACK=8388608` so `cargo test` |
| 33 | + works without remembering the env var. |
| 34 | + |
| 35 | +### Changed |
| 36 | + |
| 37 | +- `lighting::*`, `collision::*`, and `block_map::*` free functions are now |
| 38 | + thin shims that forward to a process-wide `DEFAULT_ENGINE` singleton. |
| 39 | + **WASM/JS callers are unaffected** — every `#[wasm_bindgen]` function |
| 40 | + keeps its current name and signature, including `put`, `put_solid_color`, |
| 41 | + `put_custom_color`, `set_tile`, `set_map_data`, `set_pixel`, |
| 42 | + `set_pixel_batch`, `clear_pixel_collisions`, `get_tiles`, and |
| 43 | + `get_blockmap`. |
| 44 | +- New Rust code should prefer `LightingEngine` methods; the free functions |
| 45 | + exist for back-compat and operate on a shared global, which serialises |
| 46 | + callers under a `RwLock`. |
| 47 | + |
| 48 | +### Removed |
| 49 | + |
| 50 | +- `IsBlockedFn` and `reset_is_blocked_fn` (dead since the collision-system |
| 51 | + rewrite — they were never read at runtime). |
| 52 | +- `TileCollisionMap` (superseded by the unified `HybridCollisionMap` in |
| 53 | + [ADR-0006](docs/decisions/0006-unify-collision-detection.md); was no |
| 54 | + longer reachable from any code path). |
| 55 | +- `VISUAL_TESTING.md`, `tests/output_mechanisms.rs`, `tests/README.md`, the |
| 56 | + `test_output/` and `test_output.before/` directories, and |
| 57 | + `benches/collision_performance.rs`. The PNG-snapshot harness they |
| 58 | + described had silently broken when the collision modes were unified — |
| 59 | + every "obstacle" snapshot in version control was either from |
| 60 | + pre-unification code or from post-unification code with no occlusion |
| 61 | + wired up. Replaced by the scenarios CLI and `tests/scenarios.rs`. |
| 62 | + |
| 63 | +### Migration notes |
| 64 | + |
| 65 | +- **JS / WASM callers**: no change required. The `pkg/` artifact keeps the |
| 66 | + same exports and ABI. |
| 67 | +- **Rust callers using free functions**: still work, but each call now |
| 68 | + takes the global write lock. For tests or any code that wants |
| 69 | + independent scenes, switch to `LightingEngine::new()` and call methods |
| 70 | + on the instance directly. |
| 71 | +- **Test authors**: do **not** use `DEFAULT_ENGINE` from tests. Each test |
| 72 | + must construct its own `LightingEngine` — that is what makes parallel |
| 73 | + test execution safe. |
| 74 | + |
| 75 | +## [0.2.7] and earlier |
| 76 | + |
| 77 | +See `git log` for prior history. |
0 commit comments