lyra-engine/lyra-resource/src/loader/model.rs

29 lines
722 B
Rust
Raw Normal View History

2023-09-21 18:22:46 +00:00
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!()
}
}