From 9f6b7a10e7e00edf6ab50a9cf162b377d84a43f6 Mon Sep 17 00:00:00 2001 From: tcmal Date: Sun, 25 Aug 2024 17:44:21 +0100 Subject: feat(render) WIP: textures, using a fixed size texture array currently using an 8 long texture array with seperate samplers. also move to a trait for resolving textures from the bsp file rather than adding them manually. currently stuck with one static implementation though. this means all textures in the file are loaded when the map is. not currently drawing with anything other than the first texture array, so files with >8 textures will fail. --- examples/render-bsp/src/main.rs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'examples/render-bsp/src/main.rs') diff --git a/examples/render-bsp/src/main.rs b/examples/render-bsp/src/main.rs index 51fc80f..0d81759 100644 --- a/examples/render-bsp/src/main.rs +++ b/examples/render-bsp/src/main.rs @@ -19,6 +19,7 @@ extern crate stockton_types; extern crate stockton_levels; extern crate stockton_render; extern crate winit; +extern crate log; extern crate simple_logger; extern crate image; @@ -93,7 +94,7 @@ impl KeyState { } fn main() { - simple_logger::init().unwrap(); + simple_logger::init_with_level(log::Level::Debug).unwrap(); // Load the world and renderer let event_loop = EventLoop::new(); @@ -112,17 +113,17 @@ fn main() { let world = World::new(bsp); let mut renderer = Renderer::new(world, &window).unwrap(); - { - renderer.context.add_texture( - load_from_memory(include_bytes!("../../render-quad/data/test1.png")) - .expect("Couldn't load test texture 1") - .into_rgba()).unwrap(); - - renderer.context.add_texture( - load_from_memory(include_bytes!("../../render-quad/data/test2.png")) - .expect("Couldn't load test texture 2") - .into_rgba()).unwrap(); - } + // { + // renderer.context.add_texture( + // load_from_memory(include_bytes!("../../render-quad/data/test1.png")) + // .expect("Couldn't load test texture 1") + // .into_rgba()).unwrap(); + + // renderer.context.add_texture( + // load_from_memory(include_bytes!("../../render-quad/data/test2.png")) + // .expect("Couldn't load test texture 2") + // .into_rgba()).unwrap(); + // } let mut last_update = SystemTime::now(); let mut key_state = KeyState::new(); -- cgit v1.2.3