Module vox_format::chunk [−][src]
Expand description
This modules provides utilities to read and write VOX files as chunks, but is agnostic to the content of these chunks.
VOX files use a binary format that is similar to that of RIFF files.
Unfortunately it’s different enough that the riff
crate can’t be used.
The file format consists of so-called chunks, which contain specific data
(e.g. palette data). Chunks have IDs consisting of 4 bytes. A file
starts with a root-chunk MAIN
. The MAIN
chunk then contains other chunks
that contain the voxel data. The format is specified here, but not all chunk IDs are described.
Structs
An iterator over a chunk’s children.
Chunk meta-data. This doesn’t contain contents or children, but information needed to read the chunk from a file. You will still need a reader to read the contents though.
This struct is used to write out chunks to a file.
A reader for a chunk’s contents.
This implements Write
and Seek
on a restricted range of offsets in the
underlying reader of the chunk you’re writing to.
Enums
A chunk ID. It’s either a pre-defined ID (that is used for VOX), or
Unsupported
.
Functions
This creates a ChunkWriter
and will the closure you passed in with it.
This allows you to write contents and children to the ChunkWriter
. After
you return from the closure this function will make sure that the chunk
headers are upates.
Reads a chunk from reader
at the specified offset.
Reads the VOX file’s header, verifies it, and then reads the MAIN chunk.
Type Definitions
Short-hand for a ChunkWriter
wrapping a ContentWriter
. The
underlying content-writer writes to the chunk’s children data blob.