Continue new platform/glium implementations

- Assets, asset manager system
- Rendering system trait
- Kick off glium platform implementation
- And more
This commit is contained in:
reo 2025-08-07 17:56:35 +03:00 committed by Emre
parent f7d5c14caf
commit e817abf8ab
18 changed files with 2557 additions and 32 deletions

View file

@ -1,11 +1,11 @@
use std::path::Path;
pub type ModelHandle = usize;
/// The asset manager trait of Raidillon.
pub trait AssetManager {
type Model;
/// Loads a gltf model to VRAM.
fn load_gltf(&mut self, path: &Path) -> ModelHandle;
fn load_gltf(&mut self, path: &Path);
/// Unloads the loaded model from VRAM.
fn unload_model(&mut self, model_handle: ModelHandle);
fn unload_model(&mut self, path: &Path);
fn get_model(&mut self, path: &Path) -> &Self::Model;
}

View file

@ -1,11 +1,7 @@
use winit::event::Event;
use crate::AssetManager;
pub struct FrameContext {
pub event: Event<()>,
}
pub struct PlatformContext {
pub frame_context: FrameContext,
pub asset_manager: dyn AssetManager,
pub struct PlatformContext<AM: AssetManager> {
pub current_event: Event<()>,
pub asset_manager: AM,
}

View file

@ -1,5 +1,5 @@
pub trait Platform {
/// Initialize platform.
fn initialize(title: String, width: u32, height: u32) -> Self;
fn run(self);
}