All notable changes to bresenham-lighting-engine are documented here.
This project follows Semantic Versioning.
- The engine emits transport masks only (ADR-0010, main repo issue #110).
putnow returns a white radial-falloff mask — RGB always 255, alpha = linear attenuation (curve shaping is renderer-side) — andput_ambientlost itsr/g/bparameters, returning an opaque-white room-fill mask. Colour and intensity are applied renderer-side (tint× mask).
ColorMode(Solid/Custom/Rgb),hsv2rgb, and every colour-carrying light API:put_solid_color,put_custom_color,put_rgband theirupdate_or_add_light_with_*counterparts. There is no colour path left in the engine to collapse (#72 fixed by construction).
LightingEnginetype (src/engine.rs). Construct one withLightingEngine::new()and call methods on it directly. Each engine owns its own tile map, block map, collision system, and light registry — multiple engines can coexist in one process. This unlocks two things that were previously impossible:- Parallel tests: each test builds its own engine, so the default
cargo testthread pool no longer races on shared globals. - Embedding: Rust callers (servers, level editors, comparison harnesses) can hold more than one scene at a time. See ADR-0007.
- Parallel tests: each test builds its own engine, so the default
LightingEngine::render_canvas_text(light_id)— ASCII-matrix view of a light's canvas, suitable for stdout, panic messages, or piping to other tools.- Scenarios module (
src/scenarios/) — plain Rust functions likesingle_lightandobject_shadowthat populate aLightingEngine. Shared between the exploration CLI and the regression tests so the same scene definition drives both. scenarioexample —cargo run --example scenario -- --listenumerates the available scenarios;--name <NAME>prints the ASCII matrix;--output-format png --out path.pngrenders a PNG.CONTEXT.md— canonical vocabulary (Tile, Cell, Wall, Object, Room, LightingEngine, Light, Canvas, Ray). Read this before contributing..cargo/config.tomlsetsRUST_MIN_STACK=8388608socargo testworks without remembering the env var.
lighting::*,collision::*, andblock_map::*free functions are now thin shims that forward to a process-wideDEFAULT_ENGINEsingleton. WASM/JS callers are unaffected — every#[wasm_bindgen]function keeps its current name and signature, includingput,put_solid_color,put_custom_color,set_tile,set_map_data,set_pixel,set_pixel_batch,clear_pixel_collisions,get_tiles, andget_blockmap.- New Rust code should prefer
LightingEnginemethods; the free functions exist for back-compat and operate on a shared global, which serialises callers under aRwLock.
IsBlockedFnandreset_is_blocked_fn(dead since the collision-system rewrite — they were never read at runtime).TileCollisionMap(superseded by the unifiedHybridCollisionMapin ADR-0006; was no longer reachable from any code path).VISUAL_TESTING.md,tests/output_mechanisms.rs,tests/README.md, thetest_output/andtest_output.before/directories, andbenches/collision_performance.rs. The PNG-snapshot harness they described had silently broken when the collision modes were unified — every "obstacle" snapshot in version control was either from pre-unification code or from post-unification code with no occlusion wired up. Replaced by the scenarios CLI andtests/scenarios.rs.
- JS / WASM callers: no change required. The
pkg/artifact keeps the same exports and ABI. - Rust callers using free functions: still work, but each call now
takes the global write lock. For tests or any code that wants
independent scenes, switch to
LightingEngine::new()and call methods on the instance directly. - Test authors: do not use
DEFAULT_ENGINEfrom tests. Each test must construct its ownLightingEngine— that is what makes parallel test execution safe.
See git log for prior history.