roxlap_formats/lib.rs
1//! Voxlap on-disk formats and data manipulation.
2//!
3//! New to roxlap? **[The roxlap book](https://ncrashed.github.io/roxlap/)**
4//! is the guide — its asset-pipeline chapter tours every format here;
5//! this page is the API reference.
6//!
7//! Parsers for `.vxl` (heightmap + slab voxel columns), `.kv6` / `.kvx`
8//! (sprite voxel data), and `.kfa` (kv6 transform / animation). Lands
9//! across the R2.* sub-substages of `PORTING-RUST.md`:
10//!
11//! - R2.1: `.kvx`
12//! - R2.2: `.kv6`
13//! - R2.3: `.vxl`
14//! - R2.4: `.kfa`
15//!
16//! [`edit`] hosts voxel-edit primitives (delslab/insslab/expandrle/
17//! compilerle/`ScumCtx`) and high-level wrappers (`set_spans`,
18//! `set_cube`, `set_sphere`, `set_rect`). They live with the data
19//! they manipulate; rendering stays in `roxlap-core`.
20
21mod bytes;
22
23/// Rigged-character container (`.rkc`) — meshes + skeleton + clips, the
24/// on-disk form of a complete animated voxel character. Built on
25/// [`kfa`] / [`kv6`] / [`sprite`].
26pub mod character;
27pub mod color;
28pub mod edit;
29/// Voxlap's `univec[256]` surface-normal direction table + the
30/// `normal → dir` quantiser ([`equivec::nearest_dir`]). Lives here (not
31/// roxlap-core) so [`kv6`] model builders can fill per-voxel `dir`
32/// without a circular dependency; roxlap-core re-exports it.
33pub mod equivec;
34/// Animated-GIF → [`voxel_clip::VoxelClip`] importer for Doom-style
35/// billboard sprites (stage BB). Feature-gated behind `gif`; see
36/// [`gif_import`] + `PORTING-BILLBOARD.md`.
37#[cfg(feature = "gif")]
38pub mod gif_import;
39pub mod kfa;
40pub mod kv6;
41pub mod kvx;
42/// Voxel materials — per-voxel opacity + blend mode (alpha / additive) for
43/// transparent voxels (smoke, glass, water, spell glows). See [`material`]
44/// + `PORTING-TRANSPARENCY.md`.
45pub mod material;
46pub mod palette;
47/// PNG-sequence / APNG → [`voxel_clip::VoxelClip`] importer for billboard
48/// sprites (stage BB). Feature-gated behind `png`; see [`png_import`].
49#[cfg(feature = "png")]
50pub mod png_import;
51/// Shared image → flat-voxel-slab voxelization for the billboard importers
52/// (BB). Internal; the `gif`/`png` decoders feed composited RGBA frames in.
53#[cfg(any(feature = "gif", feature = "png"))]
54mod slab;
55pub mod sprite;
56/// MagicaVoxel `.vox` importer (QE.6a) — models + palette → [`kv6::Kv6`]
57/// sprite models. The bridge from the industry-standard voxel editor.
58pub mod vox;
59/// Animated voxel-sprite clips (`.rvc`) — keyframe + diff "GIF/MP4 for
60/// voxel models" for effects (flame, spells). Frames use the GPU sprite
61/// model's dense-column layout; see [`voxel_clip`] + `PORTING-VOXEL-CLIP.md`.
62pub mod voxel_clip;
63pub mod vxl;
64pub mod xform;
65
66pub use color::{OverlayColor, Rgb, VoxColor};
67pub use material::{material_for_color, BlendMode, Material, MaterialTable};
68pub use palette::Rgb6;