Compare commits

...

3 Commits

Author SHA1 Message Date
1cdaa5d53a fake IBSP 2023-10-02 22:29:57 -07:00
55a1ef0d14 load_bsp module 2023-10-02 15:29:32 -07:00
03a97bfa3e add bsp dep 2023-10-02 15:29:04 -07:00
4 changed files with 90 additions and 9 deletions

65
Cargo.lock generated
View File

@ -92,6 +92,15 @@ version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545"
[[package]]
name = "arrayvec"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9"
dependencies = [
"nodrop",
]
[[package]]
name = "arrayvec"
version = "0.7.4"
@ -197,7 +206,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5"
dependencies = [
"arrayref",
"arrayvec",
"arrayvec 0.7.4",
"cc",
"cfg-if",
"constant_time_eq",
@ -238,12 +247,33 @@ dependencies = [
"objc2-encode",
]
[[package]]
name = "bsp"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9d6d699bcff31f0c8a5951d29b9a7edfe3270218c20f6c3509f90ae7e1c46e7"
dependencies = [
"arrayvec 0.4.12",
"bitflags 1.3.2",
"bv",
"byteorder 0.5.3",
]
[[package]]
name = "bumpalo"
version = "3.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
[[package]]
name = "bv"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340"
dependencies = [
"feature-probe",
]
[[package]]
name = "bytemuck"
version = "1.13.1"
@ -264,6 +294,12 @@ dependencies = [
"syn 2.0.29",
]
[[package]]
name = "byteorder"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855"
[[package]]
name = "byteorder"
version = "1.4.3"
@ -423,7 +459,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "594ecd967c2f40db5dde8da4c356975fc1fe030e951c7c3962f6dc2e80042e87"
dependencies = [
"bitflags 1.3.2",
"byteorder",
"byteorder 1.4.3",
"enum_primitive",
]
@ -532,6 +568,12 @@ dependencies = [
"simd-adler32",
]
[[package]]
name = "feature-probe"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da"
[[package]]
name = "flate2"
version = "1.0.27"
@ -1058,6 +1100,12 @@ dependencies = [
"memoffset",
]
[[package]]
name = "nodrop"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
[[package]]
name = "nom"
version = "7.1.3"
@ -1506,7 +1554,7 @@ version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20"
dependencies = [
"byteorder",
"byteorder 1.4.3",
"num-traits 0.2.16",
"paste",
]
@ -1517,7 +1565,7 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a"
dependencies = [
"byteorder",
"byteorder 1.4.3",
"rmp",
"serde",
]
@ -1662,6 +1710,7 @@ name = "strafe-client"
version = "0.7.0"
dependencies = [
"async-executor",
"bsp",
"bytemuck",
"ddsfile",
"env_logger",
@ -1748,7 +1797,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df8493a203431061e901613751931f047d1971337153f96d0e5e363d6dbf6a67"
dependencies = [
"arrayref",
"arrayvec",
"arrayvec 0.7.4",
"bytemuck",
"cfg-if",
"png",
@ -1992,7 +2041,7 @@ version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7472f3b69449a8ae073f6ec41d05b6f846902d92a6c45313c50cb25857b736ce"
dependencies = [
"arrayvec",
"arrayvec 0.7.4",
"cfg-if",
"js-sys",
"log",
@ -2016,7 +2065,7 @@ version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecf7454d9386f602f7399225c92dd2fbdcde52c519bc8fb0bd6fbeb388075dc2"
dependencies = [
"arrayvec",
"arrayvec 0.7.4",
"bit-vec",
"bitflags 2.4.0",
"codespan-reporting",
@ -2040,7 +2089,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6654a13885a17f475e8324efb46dc6986d7aaaa98353330f8de2077b153d0101"
dependencies = [
"android_system_properties",
"arrayvec",
"arrayvec 0.7.4",
"ash",
"bit-set",
"bitflags 2.4.0",

View File

@ -7,6 +7,7 @@ edition = "2021"
[dependencies]
async-executor = "1.5.1"
bsp = "0.1.2"
bytemuck = { version = "1.13.1", features = ["derive"] }
ddsfile = "0.5.1"
env_logger = "0.10.0"

16
src/load_bsp.rs Normal file
View File

@ -0,0 +1,16 @@
pub fn generate_indexed_models<R:std::io::Read+std::io::Seek>(input:R) -> crate::model::IndexedModelInstances{
let mut spawn_point=glam::Vec3::ZERO;
let mut indexed_models=Vec::new();
match bsp::Bsp::read(input){
Ok(guac)=>println!("we got the guac {:?}", guac),
Err(e)=>println!("rotten {:?}",e),
}
crate::model::IndexedModelInstances{
textures:Vec::new(),
models:indexed_models,
spawn_point,
}
}

View File

@ -10,6 +10,7 @@ mod zeroes;
mod framework;
mod primitives;
mod instruction;
mod load_bsp;
mod load_roblox;
struct Entity {
@ -811,7 +812,21 @@ impl framework::Example for GraphicsData {
},
}
},
//b"VBSP"=>Some(load_bsp::generate_indexed_models(input)),
b"VBSP"=>{
let mut entire_file=Vec::new();
match std::io::Read::read_to_end(&mut input, &mut entire_file){
Ok(_)=>{
//haha yes this is a quake file what do you mean
entire_file[0]=b'I';
entire_file[4..8].copy_from_slice(&0x2ei32.to_le_bytes());
Some(load_bsp::generate_indexed_models(&mut std::io::Cursor::new(entire_file)))
},
Err(e)=>{
println!("Error loading \"valve\" file:{:?}",e);
None
},
}
},
//b"SNFM"=>Some(sniffer::generate_indexed_models(input)),
//b"SNFB"=>Some(sniffer::load_bot(input)),
other=>{