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, surface the paint on the faces of models (with
paint for the masks themselves), and
role which leaves are supports or a raft rather than models.
metadata says who made a file and how it may be used, and gives its
parts lasting ids, and program keeps each program’s own documents.
volume keeps the volumes that act on a model without printing: support
enforcers and blockers, modifiers and negative volumes. ownership
checks, before saving, that an edit changed only what its program owns.
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 metadata::EncodeMetadataError;pub use metadata::METADATA_TAG;pub use metadata::METADATA_VERSION;pub use metadata::MetadataEntry;pub use metadata::TEXT_KEYS;pub use metadata::UUID_KEY;pub use metadata::decode_metadata;pub use metadata::encode_metadata;pub use ownership::BREADSLICER;pub use ownership::Change;pub use ownership::Data;pub use ownership::Editor;pub use ownership::Remap;pub use ownership::Violation;pub use ownership::check_edit;pub use ownership::check_edit_remapped;pub use paint::mesh_fingerprint;pub use paint::DecodePaintError;pub use paint::EncodePaintError;pub use paint::FINGERPRINT_SIZE;pub use paint::MAX_PAINT_DEPTH;pub use paint::MUST_NOT_TOUCH;pub use paint::MUST_TOUCH;pub use paint::PAINT_DETAIL;pub use paint::PAINT_SUPPORTS_BOTH_WAYS;pub use paint::PAINT_SUPPORTS_MUST_NOT_TOUCH;pub use paint::PAINT_SUPPORTS_MUST_TOUCH;pub use paint::PaintDocument;pub use paint::PaintNode;pub use paint::PaintPiece;pub use paint::PaintRun;pub use paint::PaintRuns;pub use paint::PaintTrees;pub use paint::PaintedTriangle;pub use paint::decode_paint;pub use paint::encode_paint;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 program::DecodeProgramDataError;pub use program::EncodeProgramDataError;pub use program::PROGRAM_TAG;pub use program::PROGRAM_VERSION;pub use program::ProgramEntry;pub use program::decode_program_data;pub use program::encode_program_data;pub use program::is_program_name;pub use role::DecodeRolesError;pub use role::EncodeRolesError;pub use role::ROLE_RAFT;pub use role::ROLE_SUPPORTS;pub use role::ROLE_TAG;pub use role::ROLE_VERSION;pub use role::RoleEntry;pub use role::decode_roles;pub use role::encode_roles;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::decode_surface_v1;pub use surface::encode_surface;pub use volume::DecodeVolumesError;pub use volume::EncodeVolumesError;pub use volume::VOLUME_MODIFIER;pub use volume::VOLUME_NEGATIVE;pub use volume::VOLUME_SUPPORT_BLOCKER;pub use volume::VOLUME_SUPPORT_ENFORCER;pub use volume::VOLUME_TAG;pub use volume::VOLUME_UNCUT;pub use volume::VOLUME_VERSION;pub use volume::VolumeEntry;pub use volume::decode_volumes;pub use volume::encode_volumes;
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
.breadfile: the thumbnail when there is one, the scene chunk, the metadata when there is any, the project settings, the supports, the hollows, the program data and the surface paint when there are any, the roles of leaves that are not models, the volumes that act on models when there are any, then one mesh chunk per mesh of the scene, in its order, the support previews when there are any, and last the chunks this build does not know. - 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. - metadata
- The metadata chunk (
SPEC.md, section 12): who made a file, how it may be used, and lasting ids for its parts, as entries of a subject, a key and a value. - ownership
- Checks that an edit changed only what the editor owns (
SPEC.md, section 7.4). Nothing in a file can stop a program from changing another program’s data, but a program that writes through this crate can callcheck_editbefore saving, and its tests can too. - paint
- The documents of the surface paint chunk (
SPEC.md, section 10.1): the masks themselves, whichcrate::surfacecarries without reading. - 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. - program
- The program data chunk (
SPEC.md, section 13): each program’s own documents, by program name and subject, a node or the whole file. - role
- The role chunk (
SPEC.md, section 11): which leaves are not models, but supports or a raft. - 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 program, leaf and kind. - volume
- The volume chunk (
SPEC.md, section 14): meshes that belong to a model and act on it without being printed. Support enforcers and blockers, modifiers, and negative volumes, which the model’s leaf shows already cut, with the model as it was before the cut beside them.
Structs§
- Meta
- A name, and free text that came with it, such as an STL header.