don't allocate models twice
This commit is contained in:
parent
5d9c124e76
commit
9cc099a6eb
11
src/map.rs
11
src/map.rs
@ -267,15 +267,12 @@ impl<R:BinReaderExt> StreamableMap<R>{
|
|||||||
let textures=self.resource_blocks.textures.into_values().map(|block_id|
|
let textures=self.resource_blocks.textures.into_values().map(|block_id|
|
||||||
read_texture(&mut self.file,block_id)
|
read_texture(&mut self.file,block_id)
|
||||||
).collect::<Result<Vec<_>,_>>()?;
|
).collect::<Result<Vec<_>,_>>()?;
|
||||||
|
let mut block_ids=Vec::new();
|
||||||
|
self.bvh.into_visitor(&mut |block_id|block_ids.push(block_id));
|
||||||
//load all regions
|
//load all regions
|
||||||
let mut region_results=Vec::new();
|
|
||||||
self.bvh.into_visitor(&mut |block_id|
|
|
||||||
region_results.push(read_region(&mut self.file,block_id))
|
|
||||||
);
|
|
||||||
//allocate twice :'(
|
|
||||||
let mut models=Vec::new();
|
let mut models=Vec::new();
|
||||||
for region_result in region_results{
|
for block_id in block_ids{
|
||||||
models.append(&mut region_result?);
|
models.append(&mut read_region(&mut self.file,block_id)?);
|
||||||
}
|
}
|
||||||
Ok(strafesnet_common::map::CompleteMap{
|
Ok(strafesnet_common::map::CompleteMap{
|
||||||
modes:self.modes,
|
modes:self.modes,
|
||||||
|
Loading…
Reference in New Issue
Block a user