Skip to main content

Crate bread_format

Crate bread_format 

Source
Expand description

Reads and writes .bread files: triangle meshes and the scene that places them, stored small and without losing anything. The format is described in SPEC.md, in the repository.

read_file and write_file read and write a whole file as a BreadFile: the scene, its meshes, and the documents programs keep about them, such as editable supports.

A .bread file is a short header followed by chunks. Each chunk has a four-byte tag, its own version, and a payload compressed with zstd and guarded by a CRC-32. container reads and writes chunks without knowing what they hold; scene and mesh are the codecs of the scene chunk and of the mesh chunks it places, app carries the documents of the application chunks, preview the meshes that show supports to readers that do not rebuild them, and surface the paint on the faces of models. stl reads STL files into meshes, to be written as .bread.

Re-exports§

pub use app::DecodeDocumentsError;
pub use app::EncodeDocumentsError;
pub use app::HOLLOWS_TAG;
pub use app::HOLLOWS_VERSION;
pub use app::HollowEntry;
pub use app::SETTINGS_TAG;
pub use app::SETTINGS_VERSION;
pub use app::SUPPORTS_TAG;
pub use app::SUPPORTS_VERSION;
pub use app::SupportEntry;
pub use app::decode_hollows;
pub use app::decode_supports;
pub use app::encode_hollows;
pub use app::encode_supports;
pub use container::BreadReader;
pub use container::BreadWriter;
pub use container::Chunk;
pub use container::ChunkTag;
pub use container::ReadBreadError;
pub use file::BreadFile;
pub use file::ReadFileError;
pub use file::THUMBNAIL_TAG;
pub use file::THUMBNAIL_VERSION;
pub use file::WriteFileError;
pub use file::read_file;
pub use file::supported_version;
pub use file::write_file;
pub use mesh::DecodeMeshError;
pub use mesh::EncodeMeshError;
pub use mesh::MESH_TAG;
pub use mesh::MESH_VERSION;
pub use mesh::Mesh;
pub use mesh::decode_mesh;
pub use mesh::encode_mesh;
pub use mesh_v2::Connectivity;
pub use mesh_v2::MeshCoding;
pub use mesh_v2::VertexCoding;
pub use mesh_v2::decode_mesh_v2;
pub use mesh_v2::encode_mesh_v2;
pub use mesh_v2::encode_mesh_v2_with;
pub use preview::DecodePreviewsError;
pub use preview::EncodePreviewsError;
pub use preview::SUPPORT_PREVIEW_TAG;
pub use preview::SUPPORT_PREVIEW_VERSION;
pub use preview::SupportPreview;
pub use preview::decode_previews;
pub use preview::encode_previews;
pub use scene::DecodeSceneError;
pub use scene::EncodeSceneError;
pub use scene::Node;
pub use scene::NodeKind;
pub use scene::SCENE_TAG;
pub use scene::SCENE_VERSION;
pub use scene::Scene;
pub use scene::Transform;
pub use scene::decode_scene;
pub use scene::encode_scene;
pub use stl::ReadStlError;
pub use stl::read_stl;
pub use surface::DecodeSurfaceError;
pub use surface::EncodeSurfaceError;
pub use surface::SURFACE_TAG;
pub use surface::SURFACE_VERSION;
pub use surface::SurfaceEntry;
pub use surface::decode_surface;
pub use surface::encode_surface;

Modules§

app
The application chunks (SPEC.md, section 7.3): documents that belong to one program, carried without being read.
container
The chunked container.
file
A whole .bread file: the thumbnail when there is one, the scene chunk, the project settings, the supports, the hollows and the surface paint when there are any, then one mesh chunk per mesh of the scene, in its order, and last the support previews when there are any.
mesh
The mesh chunk: one triangle mesh, lossless (SPEC.md, section 6).
mesh_v2
Mesh chunk version 2 (SPEC.md, sections 6.6 to 6.9): the same mesh as version 1, kept as exactly, in fewer bytes.
preview
The support preview chunk (SPEC.md, section 9): for support leaves, which are stored with an empty mesh, the mesh of the supports as they were when the file was written, so that any reader can show them.
scene
The scene chunk: the tree of nodes that places the meshes (SPEC.md, section 5).
stl
STL in: binary and ASCII STL files read into a Mesh, to be written as .bread.
surface
The surface paint chunk (SPEC.md, section 10): what a person painted on the faces of models, one mask per leaf and kind.

Structs§

Meta
A name, and free text that came with it, such as an STL header.