Expand description
Utilities for working with voxels.
voxcore’s VoxState is the in-memory representation of
a voxj document. This crate converts between the two, both at the value level
(vox_state_from_voxj_codec_main / voxj_codec_main_from_vox_state) and
straight to and from .voxj / .voxjz bytes
(vox_state_from_voxj_bytes, vox_state_to_voxj_bytes,
vox_state_to_voxjz_bytes).
Functions§
- vox_
state_ from_ voxj_ bytes - Loads a
.voxjor.voxjzdocument into aVoxState. The container form is detected from the leading bytes, the encoded geometry is decoded, and the result is loaded into voxcore’s in-memory form. - vox_
state_ from_ voxj_ codec_ main - Loads a
VoxjCodecMaininto aVoxState. Entities take ids in listing order, so each id equals its voxj array index and cross-references carry over. - vox_
state_ to_ voxj_ bytes - Writes a
VoxStateto compact.voxjJSON bytes, choosing the smallest block encodings per object. The document is stamped with the current voxj format version. - vox_
state_ to_ voxjz_ bytes - Writes a
VoxStateto a.voxjzzip archive holding one compact.voxjmember, choosing the smallest block encodings per object. The document is stamped with the current voxj format version. - voxj_
codec_ main_ from_ vox_ state - Writes a
VoxStateback into aVoxjCodecMain(decoded voxj geometry). Objects, palettes, and hierarchy nodes are emitted in id order, so each lands at its original array index and the cross references carry over unchanged. Each object emits one voxel per live cell, in ascending raster order.