fancy pants rust ownership avoids allocation
This commit is contained in:
parent
cfc71fac67
commit
9f68960b28
@ -218,7 +218,7 @@ async fn gimme_them_textures(path:PathBuf,vpk_list:&[vpk::VPK],send_texture:toki
|
||||
|
||||
let mut mesh_loader=strafesnet_bsp_loader::loader::ModelLoader::new(finder);
|
||||
// load models and collect requested textures
|
||||
for &model_path in mesh_deferred_loader.indices(){
|
||||
for model_path in mesh_deferred_loader.into_indices(){
|
||||
let model:vmdl::Model=mesh_loader.load(model_path)?;
|
||||
for texture in model.textures(){
|
||||
for search_path in &texture.search_paths{
|
||||
@ -230,10 +230,10 @@ async fn gimme_them_textures(path:PathBuf,vpk_list:&[vpk::VPK],send_texture:toki
|
||||
}
|
||||
}
|
||||
|
||||
for texture_path in texture_deferred_loader.indices(){
|
||||
match load_texture(finder,texture_path.as_ref()){
|
||||
for texture_path in texture_deferred_loader.into_indices(){
|
||||
match load_texture(finder,&texture_path){
|
||||
Ok(Some(texture))=>send_texture.send(
|
||||
(texture.into_owned(),texture_path.as_ref().to_owned())
|
||||
(texture.into_owned(),texture_path.into_owned())
|
||||
).await.unwrap(),
|
||||
Ok(None)=>(),
|
||||
Err(e)=>println!("Load error: {e}"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user