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>{
|
pub fn into_complete_map(mut self)->Result<strafesnet_common::map::CompleteMap,Error>{
|
||||||
//load all meshes
|
//load all meshes
|
||||||
let meshes=self.resource_blocks.meshes.into_values().map(|block_id|
|
let mut meshes=Vec::with_capacity(self.resource_blocks.meshes.len());
|
||||||
read_mesh(&mut self.file,block_id)
|
for mesh_id in 0..self.resource_blocks.meshes.len() as u32{
|
||||||
).collect::<Result<Vec<_>,_>>()?;
|
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
|
//load all textures
|
||||||
let textures=self.resource_blocks.textures.into_values().map(|block_id|
|
let mut textures=Vec::with_capacity(self.resource_blocks.textures.len());
|
||||||
read_texture(&mut self.file,block_id)
|
for texture_id in 0..self.resource_blocks.textures.len() as u32{
|
||||||
).collect::<Result<Vec<_>,_>>()?;
|
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();
|
let mut block_ids=Vec::new();
|
||||||
self.bvh.into_visitor(&mut |block_id|block_ids.push(block_id));
|
self.bvh.into_visitor(&mut |block_id|block_ids.push(block_id));
|
||||||
//load all regions
|
//load all regions
|
||||||
|
Loading…
Reference in New Issue
Block a user