lol idk #1

Open
Quaternions wants to merge 99 commits from StrafesNET/strafe-client:master into master
3 changed files with 259 additions and 5 deletions
Showing only changes of commit 746d3eb7ee - Show all commits

241
Cargo.lock generated
View File

@ -82,6 +82,21 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "approx"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f2a05fd1bd10b2527e20a2cd32d8873d115b8b39fe219ee25f42a8aca6ba278"
dependencies = [
"num-traits",
]
[[package]]
name = "array-init"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d62b7694a562cdf5a74227903507c56ab2cc8bdd1f781ed5cb4cf9c9f810bfc"
[[package]] [[package]]
name = "arrayref" name = "arrayref"
version = "0.3.7" version = "0.3.7"
@ -127,6 +142,30 @@ version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "binrw"
version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "173901312e9850391d4d7c1318c4e099fdc037d61870fca427429830efdb4e5f"
dependencies = [
"array-init",
"binrw_derive",
"bytemuck",
]
[[package]]
name = "binrw_derive"
version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb515fdd6f8d3a357c8e19b8ec59ef53880807864329b1cb1cba5c53bf76557e"
dependencies = [
"either",
"owo-colors",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]] [[package]]
name = "bit-set" name = "bit-set"
version = "0.5.3" version = "0.5.3"
@ -198,6 +237,15 @@ version = "3.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
[[package]]
name = "bv"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340"
dependencies = [
"feature-probe",
]
[[package]] [[package]]
name = "bytemuck" name = "bytemuck"
version = "1.14.1" version = "1.14.1"
@ -218,6 +266,12 @@ dependencies = [
"syn 2.0.48", "syn 2.0.48",
] ]
[[package]]
name = "byteorder"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855"
[[package]] [[package]]
name = "byteorder" name = "byteorder"
version = "1.5.0" version = "1.5.0"
@ -284,6 +338,16 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" 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",
]
[[package]] [[package]]
name = "codespan-reporting" name = "codespan-reporting"
version = "0.11.1" version = "0.11.1"
@ -396,6 +460,30 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "crc"
version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe"
dependencies = [
"crc-catalog",
]
[[package]]
name = "crc-catalog"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
[[package]]
name = "crc32fast"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa"
dependencies = [
"cfg-if",
]
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.8.19" version = "0.8.19"
@ -426,7 +514,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "479dfe1e6737aa9e96c6ac7b69689dc4c32da8383f2c12744739d76afa8b66c4" checksum = "479dfe1e6737aa9e96c6ac7b69689dc4c32da8383f2c12744739d76afa8b66c4"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.4.2",
"byteorder", "byteorder 1.5.0",
"enum-primitive-derive", "enum-primitive-derive",
"num-traits", "num-traits",
] ]
@ -452,6 +540,12 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
[[package]]
name = "either"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
[[package]] [[package]]
name = "enum-primitive-derive" name = "enum-primitive-derive"
version = "0.2.2" version = "0.2.2"
@ -479,6 +573,12 @@ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]]
name = "feature-probe"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da"
[[package]] [[package]]
name = "foreign-types" name = "foreign-types"
version = "0.5.0" version = "0.5.0"
@ -679,6 +779,15 @@ dependencies = [
"hashbrown", "hashbrown",
] ]
[[package]]
name = "itertools"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
dependencies = [
"either",
]
[[package]] [[package]]
name = "jni" name = "jni"
version = "0.21.1" version = "0.21.1"
@ -844,6 +953,25 @@ dependencies = [
"libc", "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.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "297e814c836ae64db86b36cf2a557ba54368d03f6afcd7d947c266692f71115e"
dependencies = [
"byteorder 1.5.0",
"crc",
]
[[package]] [[package]]
name = "malloc_buf" name = "malloc_buf"
version = "0.0.6" version = "0.0.6"
@ -1028,6 +1156,12 @@ dependencies = [
"ttf-parser", "ttf-parser",
] ]
[[package]]
name = "owo-colors"
version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.12.1" version = "0.12.1"
@ -1340,7 +1474,7 @@ version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20" checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20"
dependencies = [ dependencies = [
"byteorder", "byteorder 1.5.0",
"num-traits", "num-traits",
"paste", "paste",
] ]
@ -1351,7 +1485,7 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a" checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a"
dependencies = [ dependencies = [
"byteorder", "byteorder 1.5.0",
"rmp", "rmp",
"serde", "serde",
] ]
@ -1513,6 +1647,7 @@ dependencies = [
"id", "id",
"parking_lot", "parking_lot",
"pollster", "pollster",
"strafesnet_bsp_loader",
"strafesnet_common", "strafesnet_common",
"strafesnet_deferred_loader", "strafesnet_deferred_loader",
"strafesnet_rbx_loader", "strafesnet_rbx_loader",
@ -1520,6 +1655,17 @@ dependencies = [
"winit", "winit",
] ]
[[package]]
name = "strafesnet_bsp_loader"
version = "0.1.0"
source = "git+https://git.itzana.me/StrafesNET/bsp_loader?rev=00df8288849f8da4a61ff96a9d3f7fc8e6162c2a#00df8288849f8da4a61ff96a9d3f7fc8e6162c2a"
dependencies = [
"glam",
"strafesnet_common",
"vbsp",
"vmdl",
]
[[package]] [[package]]
name = "strafesnet_common" name = "strafesnet_common"
version = "0.1.0" version = "0.1.0"
@ -1532,7 +1678,7 @@ dependencies = [
[[package]] [[package]]
name = "strafesnet_deferred_loader" name = "strafesnet_deferred_loader"
version = "0.2.0" version = "0.2.0"
source = "git+https://git.itzana.me/StrafesNET/deferred_loader?rev=cfe62fc998704c06f3afb555ee2e2075219f2f9e#cfe62fc998704c06f3afb555ee2e2075219f2f9e" source = "git+https://git.itzana.me/StrafesNET/deferred_loader?rev=8049c737ed73c3196337e33c659f8942549ef1cd#8049c737ed73c3196337e33c659f8942549ef1cd"
dependencies = [ dependencies = [
"lazy-regex", "lazy-regex",
"strafesnet_common", "strafesnet_common",
@ -1580,6 +1726,17 @@ dependencies = [
"unicode-ident", "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]] [[package]]
name = "termcolor" name = "termcolor"
version = "1.4.1" version = "1.4.1"
@ -1658,14 +1815,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
dependencies = [ dependencies = [
"pin-project-lite", "pin-project-lite",
"tracing-attributes",
"tracing-core", "tracing-core",
] ]
[[package]]
name = "tracing-attributes"
version = "0.1.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.48",
]
[[package]] [[package]]
name = "tracing-core" name = "tracing-core"
version = "0.1.32" version = "0.1.32"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
dependencies = [
"once_cell",
]
[[package]] [[package]]
name = "ttf-parser" name = "ttf-parser"
@ -1697,12 +1869,61 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "vbsp"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9267540dab0c93bb5201c40ba3b2d027e2717bf355a8f9bf25377b06a5b32f6"
dependencies = [
"ahash",
"arrayvec",
"binrw",
"bitflags 2.4.2",
"bv",
"cgmath",
"itertools",
"lzma-rs",
"num_enum",
"static_assertions",
"thiserror",
"vbsp-derive",
"zip-lzma",
]
[[package]]
name = "vbsp-derive"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ade687fadf34b1b7502387fc9eb7b4032ddc9b93022d31356e9984c957abaad"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
"syn_util",
]
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.4" version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "vmdl"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "892922743c4c107372331efd8f67c57282590f8c18c26b4465c4b0e1e6678664"
dependencies = [
"arrayvec",
"bitflags 2.4.2",
"bytemuck",
"cgmath",
"itertools",
"static_assertions",
"thiserror",
"tracing",
]
[[package]] [[package]]
name = "walkdir" name = "walkdir"
version = "2.4.0" version = "2.4.0"
@ -2413,3 +2634,15 @@ dependencies = [
"quote", "quote",
"syn 2.0.48", "syn 2.0.48",
] ]
[[package]]
name = "zip-lzma"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b480cb31fccfb2786565c0e0712865fd6f1ea0ea850c50316f643c3948196e63"
dependencies = [
"byteorder 1.5.0",
"crc32fast",
"crossbeam-utils",
"lzma",
]

View File

@ -14,8 +14,9 @@ id = { git = "https://git.itzana.me/Quaternions/id", rev = "1f710976cc786c8853da
parking_lot = "0.12.1" parking_lot = "0.12.1"
pollster = "0.3.0" pollster = "0.3.0"
strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "47cdea0c8a5d10a2440ca6270a975d560aa3642d" } strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "47cdea0c8a5d10a2440ca6270a975d560aa3642d" }
strafesnet_bsp_loader = { git = "https://git.itzana.me/StrafesNET/bsp_loader", rev = "00df8288849f8da4a61ff96a9d3f7fc8e6162c2a" }
strafesnet_rbx_loader = { git = "https://git.itzana.me/StrafesNET/rbx_loader", rev = "0b630576d4b2402277d55f0a53e9d048a31af9aa" } strafesnet_rbx_loader = { git = "https://git.itzana.me/StrafesNET/rbx_loader", rev = "0b630576d4b2402277d55f0a53e9d048a31af9aa" }
strafesnet_deferred_loader = { git = "https://git.itzana.me/StrafesNET/deferred_loader", rev = "cfe62fc998704c06f3afb555ee2e2075219f2f9e", features = ["legacy", "source"] } strafesnet_deferred_loader = { git = "https://git.itzana.me/StrafesNET/deferred_loader", rev = "8049c737ed73c3196337e33c659f8942549ef1cd", features = ["legacy", "source"] }
wgpu = "0.19.0" wgpu = "0.19.0"
winit = "0.29.2" winit = "0.29.2"

View File

@ -3,6 +3,7 @@ use std::io::Read;
#[derive(Debug)] #[derive(Debug)]
pub enum ReadError{ pub enum ReadError{
Roblox(strafesnet_rbx_loader::ReadError), Roblox(strafesnet_rbx_loader::ReadError),
Source(strafesnet_bsp_loader::ReadError),
Io(std::io::Error), Io(std::io::Error),
UnknownFileFormat, UnknownFileFormat,
} }
@ -15,6 +16,7 @@ impl std::error::Error for ReadError{}
pub enum DataStructure{ pub enum DataStructure{
Roblox(strafesnet_rbx_loader::Dom), Roblox(strafesnet_rbx_loader::Dom),
Source(strafesnet_bsp_loader::Bsp)
} }
pub fn read<R:Read>(input:R)->Result<DataStructure,ReadError>{ pub fn read<R:Read>(input:R)->Result<DataStructure,ReadError>{
@ -22,6 +24,7 @@ pub fn read<R:Read>(input:R)->Result<DataStructure,ReadError>{
let peek=std::io::BufRead::fill_buf(&mut buf).map_err(ReadError::Io)?; let peek=std::io::BufRead::fill_buf(&mut buf).map_err(ReadError::Io)?;
match &peek[0..4]{ match &peek[0..4]{
b"<rob"=>Ok(DataStructure::Roblox(strafesnet_rbx_loader::read(buf).map_err(ReadError::Roblox)?)), b"<rob"=>Ok(DataStructure::Roblox(strafesnet_rbx_loader::read(buf).map_err(ReadError::Roblox)?)),
b"VBSP"=>Ok(DataStructure::Source(strafesnet_bsp_loader::read(buf).map_err(ReadError::Source)?)),
_=>Err(ReadError::UnknownFileFormat), _=>Err(ReadError::UnknownFileFormat),
} }
} }
@ -58,6 +61,23 @@ pub fn load(path:&std::path::Path)->Result<(strafesnet_common::map::CompleteMap,
let textures=legacy_loader.load_textures().map_err(LoadError::Io)?; let textures=legacy_loader.load_textures().map_err(LoadError::Io)?;
Ok((map,textures))
},
DataStructure::Source(something)=>{
let mut source_loader=strafesnet_deferred_loader::source();
let (texture_loader,mesh_loader)=source_loader.get_inner_mut();
let map=strafesnet_bsp_loader::convert(
&something,
//acquire_texture_id
|name|texture_loader.acquire_texture_id(name),
//acquire_mesh_id
|name|mesh_loader.acquire_mesh_id(name),
);
let textures=source_loader.load_textures().map_err(LoadError::Io)?;
Ok((map,textures)) Ok((map,textures))
}, },
} }