32 lines
943 B
Rust
32 lines
943 B
Rust
//! File import loaders — each behind a feature flag.
|
|
//!
|
|
//! | Feature | Function | Format |
|
|
//!|---------|----------|--------|
|
|
//!| `import-obj` | `load_obj(path)` | Wavefront OBJ |
|
|
//!| `import-gltf` | `load_gltf(path)` | glTF 2.0 / GLB |
|
|
|
|
#[cfg(feature = "import-obj")]
|
|
pub mod obj;
|
|
#[cfg(feature = "import-gltf")]
|
|
#[path = "gltf.rs"]
|
|
pub mod gltf_loader;
|
|
|
|
#[cfg(feature = "import-obj")]
|
|
pub use obj::{load_obj, parse_obj};
|
|
#[cfg(feature = "import-gltf")]
|
|
pub use gltf_loader::load_gltf;
|
|
|
|
/// Error type for mesh file import.
|
|
#[derive(thiserror::Error, Debug)]
|
|
pub enum MeshImportError {
|
|
/// The file could not be read (I/O error).
|
|
#[error("IO error: {0}")]
|
|
Io(#[from] std::io::Error),
|
|
/// The file content is malformed or cannot be parsed.
|
|
#[error("parse error: {0}")]
|
|
Parse(String),
|
|
/// The file uses features not supported by this loader.
|
|
#[error("unsupported format: {0}")]
|
|
Unsupported(String),
|
|
}
|