This commit is contained in:
Robin Appelman 2023-12-19 18:42:53 +01:00
commit ba871ebfcc
5 changed files with 12 additions and 14 deletions

View file

@ -13,7 +13,7 @@ pub fn load_map(data: &[u8], loader: &mut Loader) -> Result<Vec<CpuModel>, Error
let props = load_props(loader, bsp.static_props())?;
let mut models = Vec::with_capacity(props.len() + 1);
models.push(world);
models.extend(props.into_iter());
models.extend(props);
Ok(models)
}

View file

@ -71,7 +71,7 @@ impl Loader {
}
}
if let Some(pack) = &self.pack {
if let Some(_) = pack.get(name).ok().flatten() {
if pack.get(name).ok().flatten().is_some() {
return true;
}
}

View file

@ -50,7 +50,7 @@ pub fn load_material(
.map(|dir| {
format!(
"materials/{}",
dir.to_ascii_lowercase().trim_start_matches("/")
dir.to_ascii_lowercase().trim_start_matches('/')
)
})
.collect::<Vec<_>>();
@ -96,7 +96,7 @@ pub fn load_material(
let bump_map = material.bump_map().and_then(|path| {
Some(TextureData {
image: load_texture(&path, loader).ok()?,
image: load_texture(path, loader).ok()?,
name: path.into(),
})
});

View file

@ -108,9 +108,7 @@ impl<C: Control> Renderer<C> {
.iter()
.enumerate()
.filter_map(|(i, model)| {
if !self.gui.show_bsp && i == 0 {
None
} else if !self.gui.show_props && i > 0 {
if (!self.gui.show_bsp && i == 0) || (!self.gui.show_props && i > 0) {
None
} else {
Some(model)