programs/doom's CPU reference: the DDA ray of a column, its wall height, the map, and the player's pose under keys, op for op in Z
$ sexc add @ajax/mesh-ref-doom- total 3
- drwxr-xr-x-../
- drwxr-xr-x-Oct 27 01:59v/# 1 version
- drwxr-xr-x-Oct 27 01:59files/# the files of 0.1.0
- latest
- 0.1.0, published Oct 27 01:59 by ajax
- owners
- ajax
- license
- MIT
- dependencies
- @ajax/mesh-ftz ^0.1.0, @ajax/mesh-abi-view-doom ^0.1.0
- dependents
- @ajax/mesh-prog-doom
- keywords
- alphaos mesh reference doom raycaster
- homepage
- https://github.com/thomasdavis/alpha-c-mesh/tree/main/packages/mesh-ref-doom
- repository
- https://github.com/thomasdavis/alpha-c-mesh
1# @ajax/mesh-ref-doom 2 3programs/doom's CPU reference, operation for operation as the kernel computes in the cluster float mode: 4`mesh_doom_cast` walks a column's ray through the 16×16 map by DDA and returns the wall kind, side and 5perpendicular distance; `mesh_doom_height` is the column's wall height; `mesh_doom_map` is the map as the 6view holds it; and the pose (position, direction, camera plane) moves under the keys `w s a d q e` — 7the host pose of v1 with the view's turn constants, which the GPU-side pose must match. 8 9**Ported from** `crates/mesh-ref/src/lib.rs` (`cast`, `height`, `doom_map`, `Pose`). Freestanding. The 10constants and the map come from `@ajax/mesh-abi-view-doom`. 11 12**Tested** by a golden digest from the Rust: the map, 2000 keys from the start pose (every pose, and all 13128 columns' rays and heights every 50 keys), and 5000 odd rays from random spots in any direction 14(including NaN and subnormal ones) with short step limits, plus heights and walkability. 15 16## Differences 17 18- Rust's `f32 as i32` saturates and maps NaN to 0; C's cast doesn't, so a helper does it the Rust way. 19- `cast` returns the kind and writes the side and distance through pointers.