forked from StrafesNET/strafe-client
fix invisible walls
This commit is contained in:
parent
db6e1e43c1
commit
b1d860edf1
@ -218,13 +218,10 @@ impl GraphicsState{
|
|||||||
color:GraphicsModelColor4::new(model.color),
|
color:GraphicsModelColor4::new(model.color),
|
||||||
};
|
};
|
||||||
//get or create owned mesh map
|
//get or create owned mesh map
|
||||||
if let Some(owned_mesh_map)=owned_mesh_id_from_mesh_id_render_config_id.get(&model.mesh){
|
let owned_mesh_map=if let Some(owned_mesh_map)=owned_mesh_id_from_mesh_id_render_config_id.get(&model.mesh){
|
||||||
//the mesh has already been split into a set of unique renderconfig meshes
|
//the mesh has already been split into a set of unique renderconfig meshes
|
||||||
//simply add one instance to each of them
|
//simply add one instance to each of them
|
||||||
for owned_mesh_id in owned_mesh_map.values(){
|
owned_mesh_map
|
||||||
let owned_mesh=unique_render_config_models.get_mut(owned_mesh_id.get() as usize).unwrap();
|
|
||||||
owned_mesh.instances.push(instance.clone());
|
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
let mut owned_mesh_map=HashMap::new();
|
let mut owned_mesh_map=HashMap::new();
|
||||||
//add mesh if renderid never before seen for this model
|
//add mesh if renderid never before seen for this model
|
||||||
@ -233,10 +230,6 @@ impl GraphicsState{
|
|||||||
//check each group, if it's using a new render config then make a new clone of the model
|
//check each group, if it's using a new render config then make a new clone of the model
|
||||||
if let Some(mesh)=map.meshes.get(model.mesh.get() as usize){
|
if let Some(mesh)=map.meshes.get(model.mesh.get() as usize){
|
||||||
for graphics_group in mesh.graphics_groups.iter(){
|
for graphics_group in mesh.graphics_groups.iter(){
|
||||||
let render_config=&map.render_configs[graphics_group.render.get() as usize];
|
|
||||||
if model.color.w==0.0&&render_config.texture.is_none(){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//get or create owned mesh
|
//get or create owned mesh
|
||||||
let owned_mesh_id=if let Some(&owned_mesh_id)=owned_mesh_map.get(&graphics_group.render){
|
let owned_mesh_id=if let Some(&owned_mesh_id)=owned_mesh_map.get(&graphics_group.render){
|
||||||
owned_mesh_id
|
owned_mesh_id
|
||||||
@ -252,7 +245,7 @@ impl GraphicsState{
|
|||||||
unique_vertices:mesh.unique_vertices.clone(),
|
unique_vertices:mesh.unique_vertices.clone(),
|
||||||
render_config:graphics_group.render,
|
render_config:graphics_group.render,
|
||||||
polys:model::PolygonGroup::PolygonList(model::PolygonList::new(Vec::new())),
|
polys:model::PolygonGroup::PolygonList(model::PolygonList::new(Vec::new())),
|
||||||
instances:vec![instance.clone()],
|
instances:Vec::new(),
|
||||||
});
|
});
|
||||||
owned_mesh_id
|
owned_mesh_id
|
||||||
};
|
};
|
||||||
@ -270,7 +263,16 @@ impl GraphicsState{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
owned_mesh_id_from_mesh_id_render_config_id.insert(model.mesh,owned_mesh_map);
|
owned_mesh_id_from_mesh_id_render_config_id.insert(model.mesh,owned_mesh_map);
|
||||||
|
owned_mesh_id_from_mesh_id_render_config_id.get(&model.mesh).unwrap()
|
||||||
};
|
};
|
||||||
|
for owned_mesh_id in owned_mesh_map.values(){
|
||||||
|
let owned_mesh=unique_render_config_models.get_mut(owned_mesh_id.get() as usize).unwrap();
|
||||||
|
let render_config=&map.render_configs[owned_mesh.render_config.get() as usize];
|
||||||
|
if model.color.w==0.0&&render_config.texture.is_none(){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
owned_mesh.instances.push(instance.clone());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//check every model to see if it's using the same (texture,color) but has few instances,if it is combine it into one model
|
//check every model to see if it's using the same (texture,color) but has few instances,if it is combine it into one model
|
||||||
//1. collect unique instances of texture and color,note model id
|
//1. collect unique instances of texture and color,note model id
|
||||||
|
Loading…
Reference in New Issue
Block a user