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§
- Children
Reader - An iterator over a chunk’s children.
- Chunk
- 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.
- Chunk
IdParse Error - Chunk
Writer - This struct is used to write out chunks to a file.
- Content
Reader - A reader for a chunk’s contents.
- Content
Writer - This implements
Write
andSeek
on a restricted range of offsets in the underlying reader of the chunk you’re writing to.
Enums§
- ChunkId
- A chunk ID. It’s either a pre-defined ID (that is used for VOX), or
Unsupported
.
Functions§
- chunk_
writer - This creates a
ChunkWriter
and will the closure you passed in with it. This allows you to write contents and children to theChunkWriter
. After you return from the closure this function will make sure that the chunk headers are upates. - read_
chunk_ at - Reads a chunk from
reader
at the specified offset. - read_
main_ chunk - Reads the VOX file’s header, verifies it, and then reads the MAIN chunk.
Type Aliases§
- Child
Writer - Short-hand for a
ChunkWriter
wrapping aContentWriter
. The underlying content-writer writes to the chunk’s children data blob.