add source_legacy texture loading

This commit is contained in:
Quaternions 2024-02-14 00:35:31 -08:00
parent 6a8f34098d
commit f58cf4ec2a

View File

@ -41,7 +41,15 @@ impl Loader{
impl Loader{
pub fn load_textures(&self)->Result<Textures,std::io::Error>{
Ok(Textures::new(Vec::new()))
let mut texture_data=vec![Vec::<u8>::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
/*