29 lines
722 B
Rust
29 lines
722 B
Rust
|
use crate::{ResourceLoader, LoaderError};
|
||
|
|
||
|
impl From<gltf::Error> for LoaderError {
|
||
|
fn from(value: gltf::Error) -> Self {
|
||
|
LoaderError::DecodingError(value.into())
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#[derive(Default)]
|
||
|
pub struct ModelLoader;
|
||
|
|
||
|
impl ResourceLoader for ModelLoader {
|
||
|
fn extensions(&self) -> &[&str] {
|
||
|
&[
|
||
|
"gltf"
|
||
|
]
|
||
|
}
|
||
|
|
||
|
fn load(&self, path: &str) -> Result<std::sync::Arc<dyn crate::ResourceStorage>, crate::LoaderError> {
|
||
|
// check if the file is supported by this loader
|
||
|
if !self.does_support_file(path) {
|
||
|
return Err(LoaderError::UnsupportedExtension(path.to_string()));
|
||
|
}
|
||
|
|
||
|
let gltf = gltf::Gltf::open(path)?;
|
||
|
|
||
|
todo!()
|
||
|
}
|
||
|
}
|