Skip to main content

Crate voxj_codec

Crate voxj_codec 

Source

Enums§

Error
An error decoding or encoding a Voxel Json (.voxj / .voxjz) document.
PositionEncoding
The encoding used for a voxel-position block.
SampleEncoding
The encoding used for a voxel-sample block.

Functions§

decode_voxj_file
Decodes a VoxjSerdeFile (encoded .voxj blocks) into a VoxjCodecFile (decoded geometry), the inverse of encode_voxj_file. Each object’s palette cell counts come from the palettes it references; the palettes, hierarchy, roots, and ext carry over unchanged.
decode_voxj_object
Decodes one VoxjSerdeObject back into a VoxjCodecObject, the inverse of encode_voxj_object. cell_counts[p] is the cell count of the palette referenced by object.palette_refs[p], needed to recover the bit width of packed-base64 samples; voxj_palette_cell_counts computes it from the document’s palettes.
encode_voxj_file
Encodes a VoxjCodecFile (decoded geometry) into a VoxjSerdeFile (encoded .voxj blocks) with fixed position and sample encodings, ready to serialize with to_voxj_file_bytes. Each object’s palette cell counts come from the palettes it references; the palettes, hierarchy, roots, and ext carry over unchanged. Errors if an object references a palette outside the document’s palettes.
encode_voxj_file_smallest
Encodes a VoxjCodecFile (decoded geometry) into a VoxjSerdeFile (encoded .voxj blocks), choosing each object’s block encodings by the smallest-deflated search (encode_voxj_object_smallest). The canonical shipping form. Each object’s palette cell counts come from the palettes it references; the palettes, hierarchy, roots, and ext carry over unchanged. Errors if an object references a palette outside the document’s palettes.
encode_voxj_object
Encodes one VoxjCodecObject’s geometry into a VoxjSerdeObject with the given fixed position and sample encodings. cell_counts[p] is the cell count of the palette referenced by object.palette_refs[p], used to derive the bit width of packed-base64 samples; voxj_palette_cell_counts computes it from the document’s palettes.
encode_voxj_object_smallest
Encodes one VoxjCodecObject’s geometry into a VoxjSerdeObject, trying every applicable non-raw encoding pairing, deflating each, and keeping the smallest. The canonical shipping form. cell_counts[p] is the cell count of the palette referenced by object.palette_refs[p]; voxj_palette_cell_counts computes it from the document’s palettes.
from_voxj_file_bytes
Decodes .voxj JSON bytes into a VoxjSerdeFile. Any main.ext extension namespace is carried on VoxjMain::ext.
from_voxj_or_voxjz_file_bytes
Decodes either a .voxj (JSON, leading {) or .voxjz (zip, leading PK) document, detecting the container by its leading bytes.
from_voxjz_file_bytes
Decodes .voxjz (zip) bytes by inflating the single .voxj member and decoding it.
to_voxj_file_bytes
Serializes file to compact .voxj JSON bytes with a trailing newline.
to_voxj_pretty_file_bytes
Serializes file to pretty-printed .voxj JSON bytes with a trailing newline.
to_voxjz_file_bytes
Serializes file to a .voxjz zip archive holding one compact .voxj member.
voxj_palette_cell_counts
The cell count of each referenced palette, in palette_refs order, ready to pass as the cell_counts argument of encode_voxj_object and decode_voxj_object. A ref that points outside palettes is an error: the object would sample a palette that does not exist.

Type Aliases§

Result
A Result whose error is a voxj-codec Error.