programs/pathtrace's scene format: the u32 header and records, the layout, validation, settable parameters and tiles
$ sexc add @ajax/pathtrace-scene- 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
- none
- dependents
- @ajax/mesh-assemble, @ajax/mesh-blobd, @ajax/mesh-prog-pathtrace, @ajax/mesh-prog-pathtrace-wasm, @ajax/mesh-ref-pathtrace, @ajax/pathtrace-digest, @ajax/pathtrace-intersect, @ajax/pathtrace-job-scene, @ajax/pathtrace-sample, @ajax/pathtrace-tile, @ajax/pathtrace-tonemap, @ajax/pathtrace-view
- keywords
- alphaos mesh pathtrace scene format
- homepage
- https://github.com/thomasdavis/alpha-c-mesh/tree/main/packages/pathtrace-scene
- repository
- https://github.com/thomasdavis/alpha-c-mesh
1# @ajax/pathtrace-scene 2 3programs/pathtrace's scene format. A scene is u32 words (floats as their bits): a 32-word header (magic 4"PTSC", version, image size, samples per pass, passes, depth, seed, record counts, the light, exposure, 5clamp, length, the pinhole camera, the mesh's bounding sphere), then materials, quads, spheres and 6triangles. `pt_layout_of` finds each part, `pt_validate` checks every index and size (returning the 7Rust's error codes 1–10), and `pt_set_param` applies a fleet job's `OP_SET` to one of the six settable 8words. The image is cut into 32×24 tiles (`pt_tiles`, `pt_tile_origin`). 9 10**Ported from** `crates/pathtrace-core/src/lib.rs` (the scene constants, `Layout`, `layout`, `validate`, 11`validate_in`, `SETTABLE`, `set_arg`, `set_param`, `tiles`, `tiles_x`, `tile_origin`). Freestanding. 12 13**Tested** in `@ajax/pathtrace-job-scene`'s tests (they need the default scene): every validation rule 14on a mutated default scene, with the codes the Rust returns, and the settable words. 15 16## Differences 17 18- `validate` takes the slice's length explicitly, and computes the tile count in 64 bits: a header with an 19 absurd width × height that overflows u32 is rejected here, where a Rust release build would wrap.