wip
This commit is contained in:
parent
cc7921a5fe
commit
3692736a61
22 changed files with 447 additions and 44 deletions
|
|
@ -1,10 +1,22 @@
|
|||
pub mod model_manager;
|
||||
|
||||
use std::path::PathBuf;
|
||||
pub use crate::model_manager::{ModelManager, ModelManagerRef};
|
||||
|
||||
pub use crate::model_manager::ModelID;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! include_shader {
|
||||
($path:expr) => {
|
||||
include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../assets/shaders/", $path))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
pub fn model_path(path: &str) -> PathBuf {
|
||||
let manifest_dir = env!("CARGO_MANIFEST_DIR");
|
||||
PathBuf::from(manifest_dir)
|
||||
.join("..")
|
||||
.join("assets")
|
||||
.join("models")
|
||||
.join(path)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use std::path::{Path, PathBuf};
|
|||
use std::rc::Rc;
|
||||
|
||||
pub type ModelManagerRef = Rc<RefCell<Box<dyn ModelManager>>>;
|
||||
pub type ModelID = PathBuf;
|
||||
pub type ModelID = &'static str;
|
||||
|
||||
/// The asset manager trait of Raidillon.
|
||||
pub trait ModelManager: Any {
|
||||
/// Loads a gltf model to VRAM.
|
||||
fn load_gltf(&mut self, path: &Path);
|
||||
fn load_gltf(&mut self, id: ModelID, path: &Path);
|
||||
/// Unloads the loaded model from VRAM.
|
||||
fn unload_model(&mut self, path: &Path);
|
||||
fn unload_model(&mut self, id: ModelID);
|
||||
|
||||
fn get_model(&self, id: &ModelID) -> Option<&dyn Any>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue