completely ignore meshes that fail to load
This commit is contained in:
parent
e4cd556f94
commit
5faac6b2b3
15
src/rbx.rs
15
src/rbx.rs
@ -760,8 +760,9 @@ impl PartialMap1{
|
|||||||
).collect();
|
).collect();
|
||||||
|
|
||||||
let mut mesh_id_from_render_config_id=HashMap::new();
|
let mut mesh_id_from_render_config_id=HashMap::new();
|
||||||
|
//ignore meshes that fail to load completely for now
|
||||||
let mut acquire_mesh_id_from_render_config_id=|old_mesh_id,render|{
|
let mut acquire_mesh_id_from_render_config_id=|old_mesh_id,render|{
|
||||||
let mesh=&loaded_meshes[&old_mesh_id];
|
loaded_meshes.get(&old_mesh_id).map(|mesh|
|
||||||
*mesh_id_from_render_config_id.entry(old_mesh_id).or_insert_with(||HashMap::new())
|
*mesh_id_from_render_config_id.entry(old_mesh_id).or_insert_with(||HashMap::new())
|
||||||
.entry(render).or_insert_with(||{
|
.entry(render).or_insert_with(||{
|
||||||
let mesh_id=model::MeshId::new(self.primitive_meshes.len() as u32);
|
let mesh_id=model::MeshId::new(self.primitive_meshes.len() as u32);
|
||||||
@ -775,18 +776,22 @@ impl PartialMap1{
|
|||||||
self.primitive_meshes.push(mesh_clone);
|
self.primitive_meshes.push(mesh_clone);
|
||||||
mesh_id
|
mesh_id
|
||||||
})
|
})
|
||||||
|
)
|
||||||
};
|
};
|
||||||
//now that the meshes are loaded, these models can be generated
|
//now that the meshes are loaded, these models can be generated
|
||||||
let models_owned_attributes:Vec<ModelOwnedAttributes>=
|
let models_owned_attributes:Vec<ModelOwnedAttributes>=
|
||||||
self.deferred_models_deferred_attributes.into_iter().map(|deferred_model_deferred_attributes|{
|
self.deferred_models_deferred_attributes.into_iter().flat_map(|deferred_model_deferred_attributes|{
|
||||||
//meshes need to be cloned from loaded_meshes with a new id when they are used with a new render_id
|
//meshes need to be cloned from loaded_meshes with a new id when they are used with a new render_id
|
||||||
//insert into primitive_meshes
|
//insert into primitive_meshes
|
||||||
ModelDeferredAttributes{
|
Some(ModelDeferredAttributes{
|
||||||
mesh:acquire_mesh_id_from_render_config_id(deferred_model_deferred_attributes.model.mesh,deferred_model_deferred_attributes.render),
|
mesh:acquire_mesh_id_from_render_config_id(
|
||||||
|
deferred_model_deferred_attributes.model.mesh,
|
||||||
|
deferred_model_deferred_attributes.render
|
||||||
|
)?,
|
||||||
deferred_attributes:deferred_model_deferred_attributes.model.deferred_attributes,
|
deferred_attributes:deferred_model_deferred_attributes.model.deferred_attributes,
|
||||||
color:deferred_model_deferred_attributes.model.color,
|
color:deferred_model_deferred_attributes.model.color,
|
||||||
transform:deferred_model_deferred_attributes.model.transform,
|
transform:deferred_model_deferred_attributes.model.transform,
|
||||||
}
|
})
|
||||||
}).chain(self.primitive_models_deferred_attributes.into_iter())
|
}).chain(self.primitive_models_deferred_attributes.into_iter())
|
||||||
.enumerate().map(|(model_id,model_deferred_attributes)|{
|
.enumerate().map(|(model_id,model_deferred_attributes)|{
|
||||||
let model_id=model::ModelId::new(model_id as u32);
|
let model_id=model::ModelId::new(model_id as u32);
|
||||||
|
Loading…
Reference in New Issue
Block a user