Skip to main content

draco_io/
lib.rs

1//! Mesh interchange formats for the `draco-core` geometry model: OBJ, PLY,
2//! STL and FBX, read and written end to end.
3//!
4//! Nothing here touches the Draco codec. These formats carry geometry in their
5//! own encodings, so a reader ends at a [`draco_core::mesh::Mesh`] and a writer
6//! starts from one; whether that mesh is ever Draco-compressed is the caller's
7//! business. glTF is the one format that carries a Draco bitstream itself, and
8//! it lives in `draco-gltf` together with its containers and accessors.
9
10#![cfg_attr(docsrs, feature(doc_cfg))]
11#![deny(missing_docs)]
12
13#[cfg(feature = "fbx-reader")]
14/// FBX ASCII container reader.
15pub mod fbx_ascii;
16#[cfg(any(feature = "fbx-reader", feature = "fbx-writer"))]
17mod fbx_ascii_syntax;
18#[cfg(feature = "fbx-writer")]
19mod fbx_ascii_writer;
20#[cfg(feature = "fbx-reader")]
21/// FBX binary container decoder.
22pub mod fbx_container;
23#[cfg(feature = "fbx-writer")]
24mod fbx_encoder;
25#[cfg(any(feature = "fbx-reader", feature = "fbx-writer"))]
26pub mod fbx_node;
27#[cfg(feature = "fbx-reader")]
28/// Byte order, resource limits, and read options for the FBX reader.
29pub mod fbx_options;
30#[cfg(feature = "fbx-reader")]
31/// FBX binary reader.
32pub mod fbx_reader;
33#[cfg(any(feature = "fbx-reader", feature = "fbx-writer"))]
34/// Polygon-corner-domain expansion of FBX geometry.
35pub mod fbx_render_mesh;
36
37// Shared by the two readers that intern corners into points; see the module.
38#[cfg(any(feature = "fbx-reader", feature = "fbx-writer"))]
39mod fbx_scene;
40#[cfg(feature = "fbx-reader")]
41mod fbx_templates;
42#[cfg(any(feature = "fbx-reader", feature = "fbx-writer"))]
43/// Composition of the FBX transform stack into a local matrix.
44mod fbx_transform;
45#[cfg(feature = "fbx-writer")]
46/// FBX binary writer.
47pub mod fbx_writer;
48#[cfg(feature = "fbx-writer")]
49mod fbx_writer_6100;
50// Reader-level regression tests for `Mesh::finalize`, which every reader here
51// that builds a mesh from scratch ends with. The operation itself is
52// `draco-core`'s -- it composes three of that crate's own passes and the order
53// is load-bearing -- but what it buys is only visible through a reader, so the
54// tests that pin it sit on this side.
55#[cfg(test)]
56mod mesh_finalize;
57// The only remaining user of the hashable-tuple weld: OBJ interns `(v, vt,
58// vn)` index triples into points during parsing. FBX used to key one on
59// resolved attribute *values* here too, before it moved onto the same
60// `Mesh::finalize` pass every other from-scratch reader ends with.
61#[cfg(feature = "obj-reader")]
62mod mesh_weld;
63#[cfg(feature = "obj-reader")]
64/// Wavefront OBJ reader.
65pub mod obj_reader;
66#[cfg(feature = "obj-writer")]
67/// Wavefront OBJ writer.
68pub mod obj_writer;
69/// PLY format configuration.
70pub mod ply_format;
71#[cfg(feature = "ply-reader")]
72/// PLY reader.
73pub mod ply_reader;
74#[cfg(feature = "ply-writer")]
75/// PLY writer.
76pub mod ply_writer;
77// Shared by the readers that pack typed component arrays into an attribute
78// buffer themselves -- OBJ, PLY and STL. glTF decodes accessors straight into
79// native byte layout and never needs this.
80#[cfg(any(feature = "obj-reader", feature = "ply-reader", feature = "stl-reader"))]
81mod raw_attribute;
82#[cfg(feature = "stl-reader")]
83/// STL reader.
84pub mod stl_reader;
85#[cfg(feature = "stl-writer")]
86/// STL writer.
87pub mod stl_writer;
88/// Shared reader and writer traits.
89pub mod traits;
90
91#[cfg(feature = "fbx-reader")]
92pub use fbx_options::{FbxByteOrder, FbxDecodeLimits, FbxReadOptions};
93#[cfg(feature = "fbx-reader")]
94pub use fbx_reader::{FbxMemoryReader, FbxReader};
95#[cfg(any(feature = "fbx-reader", feature = "fbx-writer"))]
96pub use fbx_render_mesh::{FbxGeometryLayers, FbxRenderLayer, FbxRenderMesh};
97#[cfg(any(feature = "fbx-reader", feature = "fbx-writer"))]
98pub use fbx_scene::{
99    FbxAnimChannel, FbxAnimChannelPath, FbxAnimInterpolation, FbxAnimSampler, FbxAnimation,
100    FbxBinormalSet, FbxCamera, FbxColorSet, FbxCreaseKind, FbxCreaseLayer, FbxGeometricTransform,
101    FbxGlobalSettings, FbxLayerSet, FbxLight, FbxMaterial, FbxMeshInstance, FbxMeshLayers,
102    FbxMorphTarget, FbxNodeAttribute, FbxNodeId, FbxNodeKind, FbxNormalSet, FbxScene, FbxSceneNode,
103    FbxSkin, FbxSkinCluster, FbxSmoothingLayer, FbxTangentSet, FbxTexture, FbxTextureBinding,
104    FbxTextureSlot, FbxTransform, FbxTransformStack, FbxUvSet, FbxWarning, FbxWarningCode,
105};
106#[cfg(feature = "fbx-writer")]
107pub use fbx_writer::{FbxFormat, FbxWriteStats, FbxWriter};
108#[cfg(feature = "obj-reader")]
109pub use obj_reader::ObjReader;
110#[cfg(feature = "obj-writer")]
111pub use obj_writer::ObjWriter;
112pub use ply_format::PlyFormat;
113#[cfg(feature = "ply-reader")]
114pub use ply_reader::PlyReader;
115#[cfg(feature = "ply-writer")]
116pub use ply_writer::PlyWriter;
117#[cfg(feature = "stl-reader")]
118pub use stl_reader::StlReader;
119#[cfg(feature = "stl-writer")]
120pub use stl_writer::{StlFormat, StlWriter};
121pub use traits::{PointCloudReader, PointCloudWriter, ReadFromBytes, Reader, WriteToBytes, Writer};