check transparency when generating models

This commit is contained in:
Quaternions 2023-10-03 16:32:50 -07:00
parent de0eb0790a
commit bb8c53aee2
2 changed files with 9 additions and 8 deletions

View File

@ -153,9 +153,6 @@ pub fn generate_indexed_models(dom:rbx_dom_weak::WeakDom) -> crate::model::Index
spawn_point=model_transform.transform_point3(-glam::Vec3::Y)+glam::vec3(0.0,2.5+0.1,0.0); spawn_point=model_transform.transform_point3(-glam::Vec3::Y)+glam::vec3(0.0,2.5+0.1,0.0);
println!("Found MapStart{:?}",spawn_point); println!("Found MapStart{:?}",spawn_point);
} }
if *transparency==1.0 {
continue;
}
//TODO: also detect "CylinderMesh" etc here //TODO: also detect "CylinderMesh" etc here
let shape=match &object.class[..]{ let shape=match &object.class[..]{

View File

@ -164,11 +164,15 @@ impl GraphicsData {
let mut unique_texture_models=Vec::with_capacity(indexed_models_len); let mut unique_texture_models=Vec::with_capacity(indexed_models_len);
for mut model in indexed_models.models.into_iter(){ for mut model in indexed_models.models.into_iter(){
//convert ModelInstance into ModelGraphicsInstance //convert ModelInstance into ModelGraphicsInstance
let instances:Vec<ModelGraphicsInstance>=model.instances.iter().map(|instance|{ let instances:Vec<ModelGraphicsInstance>=model.instances.into_iter().filter_map(|instance|{
ModelGraphicsInstance{ if instance.color.w==0.0{
transform: glam::Mat4::from(instance.transform), None
normal_transform: glam::Mat4::from(instance.transform.inverse()).transpose(), }else{
color: instance.color, Some(ModelGraphicsInstance{
transform: glam::Mat4::from(instance.transform),
normal_transform: glam::Mat4::from(instance.transform.inverse()).transpose(),
color: instance.color,
})
} }
}).collect(); }).collect();
//check each group, if it's using a new texture then make a new clone of the model //check each group, if it's using a new texture then make a new clone of the model