From f58cf4ec2ab73f517ed9f0edec3e9d8afcfee281 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 14 Feb 2024 00:35:31 -0800 Subject: [PATCH] add source_legacy texture loading --- src/source_legacy.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/source_legacy.rs b/src/source_legacy.rs index 70d8b7d..5ccd98b 100644 --- a/src/source_legacy.rs +++ b/src/source_legacy.rs @@ -41,7 +41,15 @@ impl Loader{ impl Loader{ pub fn load_textures(&self)->Result{ - Ok(Textures::new(Vec::new())) + let mut texture_data=vec![Vec::::new();self.texture_loader.texture_paths.len()]; + for (texture_path,texture_id) in &self.texture_loader.texture_paths{ + let path=std::path::PathBuf::from(format!("textures/{}.dds",texture_path.display())); + if let Ok(mut file)=std::fs::File::open(path){ + //TODO: parallel + file.read_to_end(texture_data.get_mut(texture_id.get() as usize).unwrap())?; + } + } + Ok(Textures::new(texture_data.into_iter().map(Texture::ImageDDS).collect())) } //load_meshes should look like load_textures /*