From cd9cf164e9dd87ae82607c65d76829be15e25511 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 16 Oct 2023 17:08:25 -0700 Subject: [PATCH] into_iter collect deindex models --- src/main.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index f0a98de..d3d0628 100644 --- a/src/main.rs +++ b/src/main.rs @@ -428,8 +428,7 @@ impl GlobalState{ //de-index models let deduplicated_models_len=deduplicated_models.len(); - let mut models=Vec::with_capacity(deduplicated_models_len); - for model in deduplicated_models.into_iter(){ + let models:Vec=deduplicated_models.into_iter().map(|model|{ let mut vertices = Vec::new(); let mut index_from_vertex = std::collections::HashMap::new();//:: let mut entities = Vec::new(); @@ -459,13 +458,13 @@ impl GlobalState{ } } entities.push(indices); - models.push(model_graphics::ModelGraphicsSingleTexture{ + model_graphics::ModelGraphicsSingleTexture{ instances:model.instances, vertices, entities, texture:model.texture, - }); - } + } + }).collect(); //.into_iter() the modeldata vec so entities can be /moved/ to models.entities let mut model_count=0; let mut instance_count=0;