Expand description
Runtime parsers for PSoXide cooked-asset blobs.
Pairs with editor/crates/psxed, the host-side tool that
produces these files. Format structs live in psxed-format
(shared by both sides so drift is impossible).
Usage pattern:
ⓘ
// At compile time, embed the cooked blob into the MIPS binary.
static TEAPOT: &[u8] = include_bytes!("assets/teapot.psxm");
// At runtime, parse into a typed view. Zero-copy -- the view
// just borrows slices into the original byte stream.
let mesh = psx_asset::Mesh::from_bytes(TEAPOT).expect("cooked mesh");
for tri_idx in 0..mesh.face_count() {
let (ia, ib, ic) = mesh.face(tri_idx);
let v0 = mesh.vertex(ia);
let v1 = mesh.vertex(ib);
let v2 = mesh.vertex(ic);
let (r, g, b) = mesh.face_color(tri_idx).unwrap_or((128, 128, 128));
// project + draw …
}Design:
- Zero-copy:
Mesh::from_bytesborrows into the caller’s byte slice. No allocation, no memcpy; the static blob stays where it was embedded. no_std-clean: all parsing is manual LE decode, nostd::io.- Bounds-checked: every accessor validates its index
against the counts in the header. Malformed blobs produce
Nonerather than panics at integer level, so consumers see errors at load time, not in the render loop.
Modules§
- hma1
- HMA1: per-bone local quaternion animation tracks (the HMD8 pose-palette
replacement cooked by
psx-anim-cook). - hmd8
- HMD8: a merged model container carrying mesh, bone ranges and every clip’s composed bone palettes in one blob.
- world_
topology - Shared topology helpers for cooked world quads and wall shapes.
Structs§
- Animation
- A parsed rigid-skeletal animation backed by slices into the
caller’s cooked
.psxanimblob. - Animation
Pose Sample - Reusable frame-pair sampler for one animation phase.
- Audio
- A parsed
.psauSPU audio sample backed by the caller’s cooked blob. - GteJoint
Pose - Compact joint pose that can feed GTE vector inputs directly.
- Joint
Pose - Decoded joint pose matrix.
- Mesh
- A parsed 3D mesh backed by slices into the caller’s cooked blob.
- Model
- A parsed textured 3D model backed by slices into the caller’s
cooked
.psxmdlblob. - Model
Face - Decoded textured model face.
- Model
Face Corner - One textured triangle corner in a cooked model face.
- Model
Joint - Decoded model joint record.
- Model
Material - Decoded model material record.
- Model
Part - Decoded rigid part record.
- Model
Pose Blend - Crossfade source: a second animation sample blended toward a primary pose.
- Model
Vertex - Decoded textured model vertex. Word alignment lets the GTE projection path load XY in one MIPS load. These are decoded records, not a view into the cooked byte format.
- Texture
- A parsed 2D texture backed by slices into the caller’s cooked blob. Pixel data is already packed into the halfword-nibble layout the PSX GPU reads; the CLUT (if any) is a slice of RGB555 halfwords.
- World
- A parsed
.psxwgrid-world backed by slices into the cooked blob. - World
Quad Uvs - Four PS1 UV coordinates for one world quad.
- World
Sector - One decoded world sector record.
- World
Sector Collision Probe - Minimal sector data for camera/wall collision probes.
- World
Sector Floor Collision - Minimal decoded floor triangle used by character and camera collision.
- World
Surface Light - Four RGB vertex colours for one world quad.
- World
Wall - One decoded world wall record.
Enums§
- Parse
Error - Errors
Mesh::from_bytescan return for a malformed blob.
Constants§
- NO_
JOIN T8 - Sentinel value for
ModelVertex::joint1meaning “no secondary blend bone”. Re-exported frompsxed_format::modelso runtime code does not need to depend on the editor crate. - WORLD_
SPLIT_ NORTH_ EAST_ SOUTH_ WEST - World split id from north-east to south-west.
- WORLD_
SPLIT_ NORTH_ WEST_ SOUTH_ EAST - World split id from north-west to south-east.
- WORLD_
WALL_ SHAPE_ DROP_ BOTTOM_ LEFT - World-wall shape with the bottom-left corner removed.
- WORLD_
WALL_ SHAPE_ DROP_ BOTTOM_ RIGHT - World-wall shape with the bottom-right corner removed.
- WORLD_
WALL_ SHAPE_ DROP_ TOP_ LEFT - World-wall shape with the top-left corner removed.
- WORLD_
WALL_ SHAPE_ DROP_ TOP_ RIGHT - World-wall shape with the top-right corner removed.
- WORLD_
WALL_ SHAPE_ QUAD - Full four-corner world-wall shape.