wip: engine enhancements and fixes

This commit is contained in:
reo 2025-08-24 18:49:41 +03:00
parent 9816f14f53
commit cc7921a5fe
27 changed files with 347 additions and 32 deletions

View file

@ -1,3 +1,10 @@
pub mod model_manager;
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))
};
}

View file

@ -1,14 +1,17 @@
use std::any::Any;
use std::cell::RefCell;
use std::path::Path;
use std::path::{Path, PathBuf};
use std::rc::Rc;
pub type ModelManagerRef = Rc<RefCell<Box<dyn ModelManager>>>;
pub type ModelID = PathBuf;
/// The asset manager trait of Raidillon.
pub trait ModelManager {
pub trait ModelManager: Any {
/// Loads a gltf model to VRAM.
fn load_gltf(&mut self, path: &Path);
/// Unloads the loaded model from VRAM.
fn unload_model(&mut self, path: &Path);
fn get_model(&self, id: &ModelID) -> Option<&dyn Any>;
}