Compare commits

...

3 Commits

Author SHA1 Message Date
d9a8e72301 lib expects u8 slice 2023-10-09 21:37:07 -07:00
7f8c977642 load_bsp module 2023-10-09 21:12:19 -07:00
96f8360292 add vbsp dep 2023-10-09 21:11:42 -07:00
4 changed files with 198 additions and 4 deletions

174
Cargo.lock generated
View File

@ -86,6 +86,21 @@ dependencies = [
"libc",
]
[[package]]
name = "approx"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f2a05fd1bd10b2527e20a2cd32d8873d115b8b39fe219ee25f42a8aca6ba278"
dependencies = [
"num-traits 0.2.16",
]
[[package]]
name = "array-init"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d62b7694a562cdf5a74227903507c56ab2cc8bdd1f781ed5cb4cf9c9f810bfc"
[[package]]
name = "arrayref"
version = "0.3.7"
@ -163,6 +178,30 @@ version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "binrw"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f846d8732b2a55b569b885852ecc925a2b1f24568f4707f8b1ccd5dc6805ea9b"
dependencies = [
"array-init",
"binrw_derive",
"bytemuck",
]
[[package]]
name = "binrw_derive"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c2aa66a5e35daf7f91ed44c945886597ef4c327f34f68b6bbf22951a250ceeb"
dependencies = [
"either",
"owo-colors",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "bit-set"
version = "0.5.3"
@ -238,12 +277,27 @@ dependencies = [
"objc2-encode",
]
[[package]]
name = "build_const"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ae4235e6dac0694637c763029ecea1a2ec9e4e06ec2729bd21ba4d9c863eb7"
[[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 +318,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"
@ -306,6 +366,16 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
[[package]]
name = "cgmath"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a98d30140e3296250832bbaaff83b27dcd6fa3cc70fb6f1f3e5c9c0023b5317"
dependencies = [
"approx",
"num-traits 0.2.16",
]
[[package]]
name = "codespan-reporting"
version = "0.11.1"
@ -383,6 +453,15 @@ dependencies = [
"libc",
]
[[package]]
name = "crc"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb"
dependencies = [
"build_const",
]
[[package]]
name = "crc32fast"
version = "1.3.2"
@ -429,7 +508,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",
]
@ -465,6 +544,12 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
[[package]]
name = "either"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
[[package]]
name = "enum_primitive"
version = "0.1.1"
@ -538,6 +623,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"
@ -937,6 +1028,25 @@ dependencies = [
"libc",
]
[[package]]
name = "lzma"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "782ba3f542e8bc1349386c15e9dc3119ae6da96479f96b3863cc7a88bbdfd4e4"
dependencies = [
"byteorder 0.5.3",
]
[[package]]
name = "lzma-rs"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aba8ecb0450dfabce4ad72085eed0a75dffe8f21f7ada05638564ea9db2d7fb1"
dependencies = [
"byteorder 1.4.3",
"crc",
]
[[package]]
name = "malloc_buf"
version = "0.0.6"
@ -1241,6 +1351,12 @@ dependencies = [
"ttf-parser",
]
[[package]]
name = "owo-colors"
version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
[[package]]
name = "parking"
version = "2.1.0"
@ -1535,7 +1651,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",
]
@ -1546,7 +1662,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",
]
@ -1705,6 +1821,7 @@ dependencies = [
"rbx_dom_weak",
"rbx_reflection_database",
"rbx_xml",
"vbsp",
"wgpu",
"winit",
]
@ -1743,6 +1860,17 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "syn_util"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6754c4559b79657554e9d8a0d56e65e490c76d382b9c23108364ec4125dea23c"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "termcolor"
version = "1.2.0"
@ -1844,6 +1972,35 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "vbsp"
version = "0.1.0"
source = "git+https://github.com/icewind1991/vbsp?rev=0850bb8dbd695a770d39a06f2cc880aa9d626bf7#0850bb8dbd695a770d39a06f2cc880aa9d626bf7"
dependencies = [
"arrayvec",
"binrw",
"bitflags 1.3.2",
"bv",
"cgmath",
"lzma-rs",
"num_enum 0.5.11",
"static_assertions",
"thiserror",
"vbsp-derive",
"zip",
]
[[package]]
name = "vbsp-derive"
version = "0.1.0"
source = "git+https://github.com/icewind1991/vbsp?rev=0850bb8dbd695a770d39a06f2cc880aa9d626bf7#0850bb8dbd695a770d39a06f2cc880aa9d626bf7"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
"syn_util",
]
[[package]]
name = "vec_map"
version = "0.8.2"
@ -2363,3 +2520,14 @@ name = "xml-rs"
version = "0.8.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1"
[[package]]
name = "zip"
version = "0.6.3"
source = "git+https://github.com/icewind1991/zip?branch=lzma-decompression#67239e847f4fbe3a5b847707ee3228ac370388f5"
dependencies = [
"byteorder 1.4.3",
"crc32fast",
"crossbeam-utils",
"lzma",
]

View File

@ -21,6 +21,7 @@ rbx_binary = "0.7.1"
rbx_dom_weak = "2.5.0"
rbx_reflection_database = "0.2.7"
rbx_xml = "0.13.1"
vbsp = { git="https://github.com/icewind1991/vbsp", rev = "0850bb8dbd695a770d39a06f2cc880aa9d626bf7" }
wgpu = "0.17.0"
winit = "0.28.6"

24
src/load_bsp.rs Normal file
View File

@ -0,0 +1,24 @@
pub fn generate_indexed_models<R:std::io::Read+std::io::Seek>(input:&mut R) -> crate::model::IndexedModelInstances{
let mut spawn_point=glam::Vec3::ZERO;
let mut indexed_models=Vec::new();
let mut s=Vec::new();
match input.read_to_end(&mut s){
Ok(guac)=>println!("readed to string {:?}", guac),
Err(e)=>println!("faile {:?}",e),
}
match vbsp::Bsp::read(s.as_slice()){
Ok(guac)=>println!("we got the guac {:?}", guac),
Err(e)=>println!("rotten {:?}",e),
}
crate::model::IndexedModelInstances{
textures:Vec::new(),
models:indexed_models,
spawn_point,
modes:Vec::new(),
}
}

View File

@ -14,6 +14,7 @@ mod settings;
mod framework;
mod primitives;
mod instruction;
mod load_bsp;
mod load_roblox;
struct Entity {
@ -878,7 +879,7 @@ impl framework::Example for GlobalState {
},
}
},
//b"VBSP"=>Some(load_bsp::generate_indexed_models(input)),
b"VBSP"=>Some(load_bsp::generate_indexed_models(&mut input)),
//b"SNFM"=>Some(sniffer::generate_indexed_models(input)),
//b"SNFB"=>Some(sniffer::load_bot(input)),
other=>{