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

14
Cargo.lock generated
View file

@ -2371,18 +2371,18 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.50" version = "1.0.51"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.50" version = "1.0.51"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2720,7 +2720,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]] [[package]]
name = "vmdl" name = "vmdl"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/icewind1991/vmdl#ab311b7f60bb0b9b7bd1c5e5bc4939446c3b8f8f" source = "git+https://github.com/icewind1991/vmdl#585a4850319e67555c10f9fad8f158e9e3d18c15"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags 1.3.2", "bitflags 1.3.2",
@ -3187,9 +3187,9 @@ dependencies = [
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.5.28" version = "0.5.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c830786f7720c2fd27a1a0e27a709dbd3c4d009b56d098fc742d4f4eab91fe2" checksum = "9b5c3db89721d50d0e2a673f5043fc4722f76dcc352d7b1ab8b8288bed4ed2c5"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]

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 props = load_props(loader, bsp.static_props())?;
let mut models = Vec::with_capacity(props.len() + 1); let mut models = Vec::with_capacity(props.len() + 1);
models.push(world); models.push(world);
models.extend(props.into_iter()); models.extend(props);
Ok(models) Ok(models)
} }

View file

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

View file

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

View file

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