load textures and meshes in ascending order
This commit is contained in:
parent
0705e879db
commit
fa7e7d58bf
18
src/map.rs
18
src/map.rs
@ -264,13 +264,19 @@ impl<R:BinReaderExt> StreamableMap<R>{
|
||||
}
|
||||
pub fn into_complete_map(mut self)->Result<strafesnet_common::map::CompleteMap,Error>{
|
||||
//load all meshes
|
||||
let meshes=self.resource_blocks.meshes.into_values().map(|block_id|
|
||||
read_mesh(&mut self.file,block_id)
|
||||
).collect::<Result<Vec<_>,_>>()?;
|
||||
let mut meshes=Vec::with_capacity(self.resource_blocks.meshes.len());
|
||||
for mesh_id in 0..self.resource_blocks.meshes.len() as u32{
|
||||
let mesh_id=model::MeshId::new(mesh_id);
|
||||
let block_id=self.resource_blocks.meshes[&mesh_id];
|
||||
meshes.push(read_mesh(&mut self.file,block_id)?);
|
||||
};
|
||||
//load all textures
|
||||
let textures=self.resource_blocks.textures.into_values().map(|block_id|
|
||||
read_texture(&mut self.file,block_id)
|
||||
).collect::<Result<Vec<_>,_>>()?;
|
||||
let mut textures=Vec::with_capacity(self.resource_blocks.textures.len());
|
||||
for texture_id in 0..self.resource_blocks.textures.len() as u32{
|
||||
let texture_id=model::TextureId::new(texture_id);
|
||||
let block_id=self.resource_blocks.textures[&texture_id];
|
||||
textures.push(read_texture(&mut self.file,block_id)?);
|
||||
}
|
||||
let mut block_ids=Vec::new();
|
||||
self.bvh.into_visitor(&mut |block_id|block_ids.push(block_id));
|
||||
//load all regions
|
||||
|
Loading…
Reference in New Issue
Block a user