material backface culling

This commit is contained in:
Robin Appelman 2023-12-21 16:05:24 +01:00
commit 31b0ff9b10
2 changed files with 4 additions and 4 deletions

View file

@ -73,7 +73,7 @@ pub fn push_material(buffer: &mut Vec<u8>, gltf: &mut Root, material: MaterialDa
.alpha_test
.map(AlphaCutoff)
.filter(|_| alpha_mode == AlphaMode::Mask),
double_sided: true,
double_sided: material.no_cull,
alpha_mode: Valid(alpha_mode),
pbr_metallic_roughness: PbrMetallicRoughness {
base_color_factor: PbrBaseColorFactor(

View file

@ -29,6 +29,7 @@ pub struct MaterialData {
pub alpha_test: Option<f32>,
pub bump_map: Option<TextureData>,
pub translucent: bool,
pub no_cull: bool,
}
#[derive(Debug)]
@ -80,10 +81,8 @@ pub fn load_material(
color: [82, 180, 217, 128],
name: name.into(),
path,
texture: None,
bump_map: None,
alpha_test: None,
translucent: true,
..MaterialData::default()
});
}
@ -112,6 +111,7 @@ pub fn load_material(
bump_map,
alpha_test,
translucent: translucent | glass,
no_cull: material.no_cull(),
})
}