From f2a7b4488499369a165bd4c4e27b24b41c1eb5de Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 18 Mar 2024 20:50:39 -0700 Subject: [PATCH] print texture load error --- src/graphics.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/graphics.rs b/src/graphics.rs index d6ec94c..ebdfbbd 100644 --- a/src/graphics.rs +++ b/src/graphics.rs @@ -151,7 +151,13 @@ impl GraphicsState{ //generate texture view per texture let texture_views:HashMap=map.textures.iter().enumerate().filter_map(|(texture_id,texture_data)|{ let texture_id=model::TextureId::new(texture_id as u32); - let image=ddsfile::Dds::read(std::io::Cursor::new(texture_data)).ok()?; + let image=match ddsfile::Dds::read(std::io::Cursor::new(texture_data)){ + Ok(image)=>image, + Err(e)=>{ + println!("Error loading texture: {e}"); + return None; + }, + }; let (mut width,mut height)=(image.get_width(),image.get_height());