From dbb05bd4ef57dee581e9f41419714c896d72198b Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 13 Feb 2024 00:12:55 -0800 Subject: [PATCH 01/36] Initial commit --- .gitignore | 1 + Cargo.lock | 70 ++++++++++++++++++++ Cargo.toml | 14 ++++ LICENSE-APACHE | 176 +++++++++++++++++++++++++++++++++++++++++++++++++ LICENSE-MIT | 23 +++++++ README.md | 19 ++++++ 6 files changed, 303 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 LICENSE-APACHE create mode 100644 LICENSE-MIT create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..c478da1 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,70 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "glam" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151665d9be52f9bb40fc7966565d39666f2d1e69233571b71b87791c7e0528b3" + +[[package]] +name = "id" +version = "0.1.0" +source = "git+https://git.itzana.me/Quaternions/id?rev=1f710976cc786c8853dab73d6e1cee53158deeb0#1f710976cc786c8853dab73d6e1cee53158deeb0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "strafesnet_common" +version = "0.1.0" +source = "git+https://git.itzana.me/StrafesNET/common?rev=43f771fb0f19a3751875df1f25bf9cb5874f75f4#43f771fb0f19a3751875df1f25bf9cb5874f75f4" +dependencies = [ + "glam", + "id", +] + +[[package]] +name = "syn" +version = "2.0.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "texture_loader" +version = "0.1.0" +dependencies = [ + "strafesnet_common", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..10a71e7 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "texture_loader" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[features] +legacy = [] +#roblox = [] +#source = [] + +[dependencies] +strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "43f771fb0f19a3751875df1f25bf9cb5874f75f4" } diff --git a/LICENSE-APACHE b/LICENSE-APACHE new file mode 100644 index 0000000..a7e77cb --- /dev/null +++ b/LICENSE-APACHE @@ -0,0 +1,176 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/LICENSE-MIT b/LICENSE-MIT new file mode 100644 index 0000000..468cd79 --- /dev/null +++ b/LICENSE-MIT @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..f33b955 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +Texture Loader +============== + +## Texture loader, designed to be used in conjunction with rbx_loader, bsp_loader or Strafe Client + +#### License + + +Licensed under either of Apache License, Version +2.0 or MIT license at your option. + + +
+ + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in this crate by you, as defined in the Apache-2.0 license, shall +be dual licensed as above, without any additional terms or conditions. + \ No newline at end of file From aba7fbdb8ac3a3c81d5be4d5ff0098ca92f463f1 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 13 Feb 2024 00:14:56 -0800 Subject: [PATCH 02/36] Initial commit mistake --- Cargo.lock | 14 +++++++------- Cargo.toml | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c478da1..35a1a76 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -45,6 +45,13 @@ dependencies = [ "id", ] +[[package]] +name = "strafesnet_texture_loader" +version = "0.1.0" +dependencies = [ + "strafesnet_common", +] + [[package]] name = "syn" version = "2.0.48" @@ -56,13 +63,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "texture_loader" -version = "0.1.0" -dependencies = [ - "strafesnet_common", -] - [[package]] name = "unicode-ident" version = "1.0.12" diff --git a/Cargo.toml b/Cargo.toml index 10a71e7..a606919 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "texture_loader" +name = "strafesnet_texture_loader" version = "0.1.0" edition = "2021" From 2f70b11abde1969acd1724c6406935a73fb7e9f5 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 13 Feb 2024 00:13:04 -0800 Subject: [PATCH 03/36] v1 --- src/legacy.rs | 34 +++++++++++++++++++++ src/lib.rs | 21 +++++++++++++ src/roblox.rs | 0 src/source.rs | 0 src/texture_loader.rs | 71 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 126 insertions(+) create mode 100644 src/legacy.rs create mode 100644 src/lib.rs create mode 100644 src/roblox.rs create mode 100644 src/source.rs create mode 100644 src/texture_loader.rs diff --git a/src/legacy.rs b/src/legacy.rs new file mode 100644 index 0000000..56ee92a --- /dev/null +++ b/src/legacy.rs @@ -0,0 +1,34 @@ +use std::io::Read; +use std::collections::HashMap; +use crate::texture_loader::{Texture,Textures}; +use strafesnet_common::model::TextureId; + +pub struct TextureLoader{ + texture_names:HashMap, +} +impl TextureLoader{ + pub fn new()->Self{ + Self{ + texture_names:HashMap::new(), + } + } +} + +impl crate::texture_loader::TextureLoaderTrait for TextureLoader{ + type Error=std::io::Error; + fn acquire_id(&mut self,name:&str)->TextureId{ + let texture_id=TextureId::new(self.texture_names.len() as u32); + *self.texture_names.entry(name.to_owned()).or_insert(texture_id) + } + fn load(&self)->Result{ + let mut texture_data=vec![Vec::::new();self.texture_names.len()]; + for (texture_name,texture_id) in &self.texture_names{ + let path=std::path::PathBuf::from(format!("textures/{}.dds",texture_name.as_str())); + if let Ok(mut file)=std::fs::File::open(path){ + //TODO: parallel + file.read_to_end(texture_data.get_mut(texture_id.get() as usize).unwrap())?; + } + } + Ok(Textures::new(texture_data.into_iter().map(Texture::ImageDDS).collect())) + } +} \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..136fdf2 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,21 @@ +#[cfg(feature="legacy")] +mod legacy; +#[cfg(feature="roblox")] +mod roblox; +#[cfg(feature="source")] +mod source; + +pub mod texture_loader; + +#[cfg(feature="legacy")] +pub fn legacy()->texture_loader::TextureLoader{ + texture_loader::TextureLoader::Legacy(legacy::TextureLoader::new()) +} +#[cfg(feature="roblox")] +pub fn roblox()->texture_loader::TextureLoader{ + texture_loader::TextureLoader::Roblox(roblox::TextureLoader::new()) +} +#[cfg(feature="source")] +pub fn source()->texture_loader::TextureLoader{ + texture_loader::TextureLoader::Source(source::TextureLoader::new()) +} \ No newline at end of file diff --git a/src/roblox.rs b/src/roblox.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/source.rs b/src/source.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/texture_loader.rs b/src/texture_loader.rs new file mode 100644 index 0000000..90f1742 --- /dev/null +++ b/src/texture_loader.rs @@ -0,0 +1,71 @@ +use strafesnet_common::model::TextureId; + +pub enum TextureLoader{ + #[cfg(feature="legacy")] + Legacy(crate::legacy::TextureLoader), + #[cfg(feature="roblox")] + Roblox(crate::roblox::TextureLoader), + #[cfg(feature="source")] + Source(crate::source::TextureLoader), +} + +pub enum Texture{ + Image(Vec), + ImageDDS(Vec), +} + +pub struct Textures{ + textures:Vec, +} +impl Textures{ + pub(crate) const fn new(textures:Vec)->Self{ + Self{ + textures, + } + } + pub fn get_texture(&self,texture_id:TextureId)->Option<&Texture>{ + self.textures.get(texture_id.get() as usize) + } +} + +pub trait TextureLoaderTrait{ + type Error; + //write down the name of a texture to be fetched later, return a unique id for that texture + fn acquire_id(&mut self,name:&str)->TextureId; + fn load(&self)->Result; +} + +pub enum TextureLoaderError{ + #[cfg(feature="legacy")] + Legacy(::Error), + #[cfg(feature="roblox")] + Roblox(::Error), + #[cfg(feature="source")] + Source(::Error), +} + +impl TextureLoaderTrait for TextureLoader{ + type Error=TextureLoaderError; + fn acquire_id(&mut self,name:&str)->TextureId{ + match self{ + #[cfg(feature="legacy")] + TextureLoader::Legacy(loader)=>loader.acquire_id(name), + #[cfg(feature="roblox")] + TextureLoader::Roblox(loader)=>loader.acquire_id(name), + #[cfg(feature="source")] + TextureLoader::Source(loader)=>loader.acquire_id(name), + _=>unreachable!(), + } + } + fn load(&self)->Result{ + match self{ + #[cfg(feature="legacy")] + TextureLoader::Legacy(loader)=>loader.load().map_err(TextureLoaderError::Legacy), + #[cfg(feature="roblox")] + TextureLoader::Roblox(loader)=>loader.load().map_err(TextureLoaderError::Roblox), + #[cfg(feature="source")] + TextureLoader::Source(loader)=>loader.load().map_err(TextureLoaderError::Source), + _=>unreachable!(), + } + } +} \ No newline at end of file From 8c9af0e2056df5ec65450e85666227555a5b8623 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 13 Feb 2024 00:48:30 -0800 Subject: [PATCH 04/36] mega errors --- Cargo.lock | 74 +++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 3 +- src/legacy.rs | 38 ++++++++++++++++++---- src/texture_loader.rs | 57 +++++++++++++++++++++++---------- 4 files changed, 149 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 35a1a76..ada2d87 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,15 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + [[package]] name = "glam" version = "0.25.0" @@ -18,6 +27,41 @@ dependencies = [ "syn", ] +[[package]] +name = "lazy-regex" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d12be4595afdf58bd19e4a9f4e24187da2a66700786ff660a418e9059937a4c" +dependencies = [ + "lazy-regex-proc_macros", + "once_cell", + "regex", +] + +[[package]] +name = "lazy-regex-proc_macros" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44bcd58e6c97a7fcbaffcdc95728b393b8d98933bfadad49ed4097845b57ef0b" +dependencies = [ + "proc-macro2", + "quote", + "regex", + "syn", +] + +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + [[package]] name = "proc-macro2" version = "1.0.78" @@ -36,6 +80,35 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "regex" +version = "1.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + [[package]] name = "strafesnet_common" version = "0.1.0" @@ -49,6 +122,7 @@ dependencies = [ name = "strafesnet_texture_loader" version = "0.1.0" dependencies = [ + "lazy-regex", "strafesnet_common", ] diff --git a/Cargo.toml b/Cargo.toml index a606919..3740f77 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,9 +6,10 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -legacy = [] +legacy = ["dep:lazy-regex"] #roblox = [] #source = [] [dependencies] +lazy-regex = { version = "3.1.0", optional = true } strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "43f771fb0f19a3751875df1f25bf9cb5874f75f4" } diff --git a/src/legacy.rs b/src/legacy.rs index 56ee92a..20f80b1 100644 --- a/src/legacy.rs +++ b/src/legacy.rs @@ -3,8 +3,33 @@ use std::collections::HashMap; use crate::texture_loader::{Texture,Textures}; use strafesnet_common::model::TextureId; +#[derive(Hash,Eq,PartialEq)] +struct RobloxAssetId(u64); +#[derive(Debug)] +pub struct RobloxAssetIdParseErr(String); +impl std::str::FromStr for RobloxAssetId{ + type Err=RobloxAssetIdParseErr; + fn from_str(s:&str)->Result{ + let regman=lazy_regex::regex!(r"(\d+)$"); + if let Some(captures)=regman.captures(s){ + if captures.len()==2{//captures[0] is all captures concatenated, and then each individual capture + if let Ok(id)=captures[0].parse::(){ + return Ok(Self(id)); + } + } + } + Err(RobloxAssetIdParseErr(s.to_owned())) + } +} +impl std::fmt::Display for RobloxAssetIdParseErr{ + fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{ + write!(f,"{self:?}") + } +} +impl std::error::Error for RobloxAssetIdParseErr{} + pub struct TextureLoader{ - texture_names:HashMap, + texture_names:HashMap, } impl TextureLoader{ pub fn new()->Self{ @@ -15,15 +40,16 @@ impl TextureLoader{ } impl crate::texture_loader::TextureLoaderTrait for TextureLoader{ - type Error=std::io::Error; - fn acquire_id(&mut self,name:&str)->TextureId{ + type AcquireError=RobloxAssetIdParseErr; + type LoadError=std::io::Error; + fn acquire_id(&mut self,name:&str)->Result{ let texture_id=TextureId::new(self.texture_names.len() as u32); - *self.texture_names.entry(name.to_owned()).or_insert(texture_id) + Ok(*self.texture_names.entry(name.parse::()?).or_insert(texture_id)) } - fn load(&self)->Result{ + fn load(&self)->Result{ let mut texture_data=vec![Vec::::new();self.texture_names.len()]; for (texture_name,texture_id) in &self.texture_names{ - let path=std::path::PathBuf::from(format!("textures/{}.dds",texture_name.as_str())); + let path=std::path::PathBuf::from(format!("textures/{}.dds",texture_name.0)); if let Ok(mut file)=std::fs::File::open(path){ //TODO: parallel file.read_to_end(texture_data.get_mut(texture_id.get() as usize).unwrap())?; diff --git a/src/texture_loader.rs b/src/texture_loader.rs index 90f1742..aa9c9b6 100644 --- a/src/texture_loader.rs +++ b/src/texture_loader.rs @@ -29,42 +29,67 @@ impl Textures{ } pub trait TextureLoaderTrait{ - type Error; + type AcquireError; + type LoadError; //write down the name of a texture to be fetched later, return a unique id for that texture - fn acquire_id(&mut self,name:&str)->TextureId; - fn load(&self)->Result; + fn acquire_id(&mut self,name:&str)->Result; + fn load(&self)->Result; } -pub enum TextureLoaderError{ +#[derive(Debug)] +pub enum TextureLoaderAcquireError{ #[cfg(feature="legacy")] - Legacy(::Error), + Legacy(::AcquireError), #[cfg(feature="roblox")] - Roblox(::Error), + Roblox(::AcquireError), #[cfg(feature="source")] - Source(::Error), + Source(::AcquireError), } +impl std::fmt::Display for TextureLoaderAcquireError{ + fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{ + write!(f,"{self:?}") + } +} +impl std::error::Error for TextureLoaderAcquireError{} + +#[derive(Debug)] +pub enum TextureLoaderLoadError{ + #[cfg(feature="legacy")] + Legacy(::LoadError), + #[cfg(feature="roblox")] + Roblox(::LoadError), + #[cfg(feature="source")] + Source(::LoadError), +} +impl std::fmt::Display for TextureLoaderLoadError{ + fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{ + write!(f,"{self:?}") + } +} +impl std::error::Error for TextureLoaderLoadError{} impl TextureLoaderTrait for TextureLoader{ - type Error=TextureLoaderError; - fn acquire_id(&mut self,name:&str)->TextureId{ + type AcquireError=TextureLoaderAcquireError; + type LoadError=TextureLoaderLoadError; + fn acquire_id(&mut self,name:&str)->Result{ match self{ #[cfg(feature="legacy")] - TextureLoader::Legacy(loader)=>loader.acquire_id(name), + TextureLoader::Legacy(loader)=>loader.acquire_id(name).map_err(TextureLoaderAcquireError::Legacy), #[cfg(feature="roblox")] - TextureLoader::Roblox(loader)=>loader.acquire_id(name), + TextureLoader::Roblox(loader)=>loader.acquire_id(name).map_err(TextureLoaderAcquireError::Roblox), #[cfg(feature="source")] - TextureLoader::Source(loader)=>loader.acquire_id(name), + TextureLoader::Source(loader)=>loader.acquire_id(name).map_err(TextureLoaderAcquireError::Source), _=>unreachable!(), } } - fn load(&self)->Result{ + fn load(&self)->Result{ match self{ #[cfg(feature="legacy")] - TextureLoader::Legacy(loader)=>loader.load().map_err(TextureLoaderError::Legacy), + TextureLoader::Legacy(loader)=>loader.load().map_err(TextureLoaderLoadError::Legacy), #[cfg(feature="roblox")] - TextureLoader::Roblox(loader)=>loader.load().map_err(TextureLoaderError::Roblox), + TextureLoader::Roblox(loader)=>loader.load().map_err(TextureLoaderLoadError::Roblox), #[cfg(feature="source")] - TextureLoader::Source(loader)=>loader.load().map_err(TextureLoaderError::Source), + TextureLoader::Source(loader)=>loader.load().map_err(TextureLoaderLoadError::Source), _=>unreachable!(), } } From 274cca6568cd44a89337b06ad26188dfcecffcb1 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 13 Feb 2024 01:50:08 -0800 Subject: [PATCH 05/36] don't need this rn --- src/texture_loader.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/texture_loader.rs b/src/texture_loader.rs index aa9c9b6..4b2aee9 100644 --- a/src/texture_loader.rs +++ b/src/texture_loader.rs @@ -10,7 +10,6 @@ pub enum TextureLoader{ } pub enum Texture{ - Image(Vec), ImageDDS(Vec), } From 6043c23c19c0369acc1a47b9f4de75dd5ae459ae Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 13 Feb 2024 01:50:10 -0800 Subject: [PATCH 06/36] couple tools --- src/texture_loader.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/texture_loader.rs b/src/texture_loader.rs index 4b2aee9..7f74f0d 100644 --- a/src/texture_loader.rs +++ b/src/texture_loader.rs @@ -12,6 +12,13 @@ pub enum TextureLoader{ pub enum Texture{ ImageDDS(Vec), } +impl AsRef<[u8]> for Texture{ + fn as_ref(&self)->&[u8]{ + match self{ + Texture::ImageDDS(data)=>data.as_ref(), + } + } +} pub struct Textures{ textures:Vec, @@ -25,6 +32,9 @@ impl Textures{ pub fn get_texture(&self,texture_id:TextureId)->Option<&Texture>{ self.textures.get(texture_id.get() as usize) } + pub fn into_iter(self)->impl Iterator{ + self.textures.into_iter().enumerate().map(|(texture_id,texture)|(TextureId::new(texture_id as u32),texture)) + } } pub trait TextureLoaderTrait{ From c182e46001a095b245fe80e5c9912e58f51b0276 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 13 Feb 2024 02:12:54 -0800 Subject: [PATCH 07/36] update common --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ada2d87..e447d38 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -112,7 +112,7 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "strafesnet_common" version = "0.1.0" -source = "git+https://git.itzana.me/StrafesNET/common?rev=43f771fb0f19a3751875df1f25bf9cb5874f75f4#43f771fb0f19a3751875df1f25bf9cb5874f75f4" +source = "git+https://git.itzana.me/StrafesNET/common?rev=47cdea0c8a5d10a2440ca6270a975d560aa3642d#47cdea0c8a5d10a2440ca6270a975d560aa3642d" dependencies = [ "glam", "id", diff --git a/Cargo.toml b/Cargo.toml index 3740f77..5322416 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,4 +12,4 @@ legacy = ["dep:lazy-regex"] [dependencies] lazy-regex = { version = "3.1.0", optional = true } -strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "43f771fb0f19a3751875df1f25bf9cb5874f75f4" } +strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "47cdea0c8a5d10a2440ca6270a975d560aa3642d" } From 2c7ced715192f0656c6ef44aa477a46527702562 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 13 Feb 2024 19:48:47 -0800 Subject: [PATCH 08/36] refactor api --- Cargo.lock | 4 +- Cargo.toml | 4 +- src/legacy.rs | 14 +++--- src/lib.rs | 14 +++--- src/texture.rs | 29 ++++++++++++ src/texture_loader.rs | 105 ------------------------------------------ 6 files changed, 46 insertions(+), 124 deletions(-) create mode 100644 src/texture.rs delete mode 100644 src/texture_loader.rs diff --git a/Cargo.lock b/Cargo.lock index e447d38..ab45f8b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,8 +119,8 @@ dependencies = [ ] [[package]] -name = "strafesnet_texture_loader" -version = "0.1.0" +name = "strafesnet_deferred_loader" +version = "0.2.0" dependencies = [ "lazy-regex", "strafesnet_common", diff --git a/Cargo.toml b/Cargo.toml index 5322416..f7e925f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "strafesnet_texture_loader" -version = "0.1.0" +name = "strafesnet_deferred_loader" +version = "0.2.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/legacy.rs b/src/legacy.rs index 20f80b1..50ae79a 100644 --- a/src/legacy.rs +++ b/src/legacy.rs @@ -1,6 +1,6 @@ use std::io::Read; use std::collections::HashMap; -use crate::texture_loader::{Texture,Textures}; +use crate::texture::{Texture,Textures}; use strafesnet_common::model::TextureId; #[derive(Hash,Eq,PartialEq)] @@ -28,10 +28,10 @@ impl std::fmt::Display for RobloxAssetIdParseErr{ } impl std::error::Error for RobloxAssetIdParseErr{} -pub struct TextureLoader{ +pub struct Loader{ texture_names:HashMap, } -impl TextureLoader{ +impl Loader{ pub fn new()->Self{ Self{ texture_names:HashMap::new(), @@ -39,14 +39,12 @@ impl TextureLoader{ } } -impl crate::texture_loader::TextureLoaderTrait for TextureLoader{ - type AcquireError=RobloxAssetIdParseErr; - type LoadError=std::io::Error; - fn acquire_id(&mut self,name:&str)->Result{ +impl Loader{ + pub fn acquire_texture_id(&mut self,name:&str)->Result{ let texture_id=TextureId::new(self.texture_names.len() as u32); Ok(*self.texture_names.entry(name.parse::()?).or_insert(texture_id)) } - fn load(&self)->Result{ + pub fn load_textures(&self)->Result{ let mut texture_data=vec![Vec::::new();self.texture_names.len()]; for (texture_name,texture_id) in &self.texture_names{ let path=std::path::PathBuf::from(format!("textures/{}.dds",texture_name.0)); diff --git a/src/lib.rs b/src/lib.rs index 136fdf2..8ee012b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,17 +5,17 @@ mod roblox; #[cfg(feature="source")] mod source; -pub mod texture_loader; +pub mod texture; #[cfg(feature="legacy")] -pub fn legacy()->texture_loader::TextureLoader{ - texture_loader::TextureLoader::Legacy(legacy::TextureLoader::new()) +pub fn legacy()->legacy::Loader{ + legacy::Loader::new() } #[cfg(feature="roblox")] -pub fn roblox()->texture_loader::TextureLoader{ - texture_loader::TextureLoader::Roblox(roblox::TextureLoader::new()) +pub fn roblox()->roblox::Loader{ + roblox::Loader::new() } #[cfg(feature="source")] -pub fn source()->texture_loader::TextureLoader{ - texture_loader::TextureLoader::Source(source::TextureLoader::new()) +pub fn source()->source::Loader{ + source::Loader::new() } \ No newline at end of file diff --git a/src/texture.rs b/src/texture.rs new file mode 100644 index 0000000..59c9b6e --- /dev/null +++ b/src/texture.rs @@ -0,0 +1,29 @@ +use strafesnet_common::model::TextureId; + +pub enum Texture{ + ImageDDS(Vec), +} +impl AsRef<[u8]> for Texture{ + fn as_ref(&self)->&[u8]{ + match self{ + Texture::ImageDDS(data)=>data.as_ref(), + } + } +} + +pub struct Textures{ + textures:Vec, +} +impl Textures{ + pub(crate) const fn new(textures:Vec)->Self{ + Self{ + textures, + } + } + pub fn get_texture(&self,texture_id:TextureId)->Option<&Texture>{ + self.textures.get(texture_id.get() as usize) + } + pub fn into_iter(self)->impl Iterator{ + self.textures.into_iter().enumerate().map(|(texture_id,texture)|(TextureId::new(texture_id as u32),texture)) + } +} diff --git a/src/texture_loader.rs b/src/texture_loader.rs deleted file mode 100644 index 7f74f0d..0000000 --- a/src/texture_loader.rs +++ /dev/null @@ -1,105 +0,0 @@ -use strafesnet_common::model::TextureId; - -pub enum TextureLoader{ - #[cfg(feature="legacy")] - Legacy(crate::legacy::TextureLoader), - #[cfg(feature="roblox")] - Roblox(crate::roblox::TextureLoader), - #[cfg(feature="source")] - Source(crate::source::TextureLoader), -} - -pub enum Texture{ - ImageDDS(Vec), -} -impl AsRef<[u8]> for Texture{ - fn as_ref(&self)->&[u8]{ - match self{ - Texture::ImageDDS(data)=>data.as_ref(), - } - } -} - -pub struct Textures{ - textures:Vec, -} -impl Textures{ - pub(crate) const fn new(textures:Vec)->Self{ - Self{ - textures, - } - } - pub fn get_texture(&self,texture_id:TextureId)->Option<&Texture>{ - self.textures.get(texture_id.get() as usize) - } - pub fn into_iter(self)->impl Iterator{ - self.textures.into_iter().enumerate().map(|(texture_id,texture)|(TextureId::new(texture_id as u32),texture)) - } -} - -pub trait TextureLoaderTrait{ - type AcquireError; - type LoadError; - //write down the name of a texture to be fetched later, return a unique id for that texture - fn acquire_id(&mut self,name:&str)->Result; - fn load(&self)->Result; -} - -#[derive(Debug)] -pub enum TextureLoaderAcquireError{ - #[cfg(feature="legacy")] - Legacy(::AcquireError), - #[cfg(feature="roblox")] - Roblox(::AcquireError), - #[cfg(feature="source")] - Source(::AcquireError), -} -impl std::fmt::Display for TextureLoaderAcquireError{ - fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{ - write!(f,"{self:?}") - } -} -impl std::error::Error for TextureLoaderAcquireError{} - -#[derive(Debug)] -pub enum TextureLoaderLoadError{ - #[cfg(feature="legacy")] - Legacy(::LoadError), - #[cfg(feature="roblox")] - Roblox(::LoadError), - #[cfg(feature="source")] - Source(::LoadError), -} -impl std::fmt::Display for TextureLoaderLoadError{ - fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{ - write!(f,"{self:?}") - } -} -impl std::error::Error for TextureLoaderLoadError{} - -impl TextureLoaderTrait for TextureLoader{ - type AcquireError=TextureLoaderAcquireError; - type LoadError=TextureLoaderLoadError; - fn acquire_id(&mut self,name:&str)->Result{ - match self{ - #[cfg(feature="legacy")] - TextureLoader::Legacy(loader)=>loader.acquire_id(name).map_err(TextureLoaderAcquireError::Legacy), - #[cfg(feature="roblox")] - TextureLoader::Roblox(loader)=>loader.acquire_id(name).map_err(TextureLoaderAcquireError::Roblox), - #[cfg(feature="source")] - TextureLoader::Source(loader)=>loader.acquire_id(name).map_err(TextureLoaderAcquireError::Source), - _=>unreachable!(), - } - } - fn load(&self)->Result{ - match self{ - #[cfg(feature="legacy")] - TextureLoader::Legacy(loader)=>loader.load().map_err(TextureLoaderLoadError::Legacy), - #[cfg(feature="roblox")] - TextureLoader::Roblox(loader)=>loader.load().map_err(TextureLoaderLoadError::Roblox), - #[cfg(feature="source")] - TextureLoader::Source(loader)=>loader.load().map_err(TextureLoaderLoadError::Source), - _=>unreachable!(), - } - } -} \ No newline at end of file From c1ac2eb1d8d534951997a36f926caa369c7c6a00 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 13 Feb 2024 19:48:53 -0800 Subject: [PATCH 09/36] add source --- Cargo.toml | 2 +- src/source.rs | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index f7e925f..1faa702 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" [features] legacy = ["dep:lazy-regex"] #roblox = [] -#source = [] +source = [] [dependencies] lazy-regex = { version = "3.1.0", optional = true } diff --git a/src/source.rs b/src/source.rs index e69de29..70d8b7d 100644 --- a/src/source.rs +++ b/src/source.rs @@ -0,0 +1,51 @@ +use std::io::Read; +use std::path::PathBuf; +use std::collections::HashMap; +use crate::texture::{Texture,Textures}; +use strafesnet_common::model::{MeshId,TextureId}; + +pub struct TextureLoader{ + texture_paths:HashMap, +} +impl TextureLoader{ + pub fn acquire_texture_id(&mut self,name:&str)->TextureId{ + let texture_id=TextureId::new(self.texture_paths.len() as u32); + *self.texture_paths.entry(name.into()).or_insert(texture_id) + } +} +pub struct MeshLoader{ + mesh_paths:HashMap, +} +impl MeshLoader{ + pub fn acquire_mesh_id(&mut self,name:&str)->MeshId{ + let texture_id=MeshId::new(self.mesh_paths.len() as u32); + *self.mesh_paths.entry(name.into()).or_insert(texture_id) + } +} + +pub struct Loader{ + texture_loader:TextureLoader, + mesh_loader:MeshLoader, +} +impl Loader{ + pub fn new()->Self{ + Self{ + texture_loader:TextureLoader{texture_paths:HashMap::new()}, + mesh_loader:MeshLoader{mesh_paths:HashMap::new()}, + } + } + pub fn get_inner_mut(&mut self)->(&mut TextureLoader,&mut MeshLoader){ + (&mut self.texture_loader,&mut self.mesh_loader) + } +} + +impl Loader{ + pub fn load_textures(&self)->Result{ + Ok(Textures::new(Vec::new())) + } + //load_meshes should look like load_textures + /* + pub fn load_meshes(&mut self)->Result{ + } + */ +} From 6a8f34098d1667581886b80caacd69aefba6ed32 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 14 Feb 2024 00:35:11 -0800 Subject: [PATCH 10/36] rename files --- Cargo.toml | 2 +- src/lib.rs | 12 +++++++++--- src/{legacy.rs => roblox_legacy.rs} | 0 src/{source.rs => source_legacy.rs} | 0 4 files changed, 10 insertions(+), 4 deletions(-) rename src/{legacy.rs => roblox_legacy.rs} (100%) rename src/{source.rs => source_legacy.rs} (100%) diff --git a/Cargo.toml b/Cargo.toml index 1faa702..f7e925f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" [features] legacy = ["dep:lazy-regex"] #roblox = [] -source = [] +#source = [] [dependencies] lazy-regex = { version = "3.1.0", optional = true } diff --git a/src/lib.rs b/src/lib.rs index 8ee012b..fec640b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,7 @@ #[cfg(feature="legacy")] -mod legacy; +mod roblox_legacy; +#[cfg(feature="legacy")] +mod source_legacy; #[cfg(feature="roblox")] mod roblox; #[cfg(feature="source")] @@ -8,8 +10,12 @@ mod source; pub mod texture; #[cfg(feature="legacy")] -pub fn legacy()->legacy::Loader{ - legacy::Loader::new() +pub fn roblox_legacy()->roblox_legacy::Loader{ + roblox_legacy::Loader::new() +} +#[cfg(feature="legacy")] +pub fn source_legacy()->source_legacy::Loader{ + source_legacy::Loader::new() } #[cfg(feature="roblox")] pub fn roblox()->roblox::Loader{ diff --git a/src/legacy.rs b/src/roblox_legacy.rs similarity index 100% rename from src/legacy.rs rename to src/roblox_legacy.rs diff --git a/src/source.rs b/src/source_legacy.rs similarity index 100% rename from src/source.rs rename to src/source_legacy.rs From f58cf4ec2ab73f517ed9f0edec3e9d8afcfee281 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 14 Feb 2024 00:35:31 -0800 Subject: [PATCH 11/36] add source_legacy texture loading --- src/source_legacy.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/source_legacy.rs b/src/source_legacy.rs index 70d8b7d..5ccd98b 100644 --- a/src/source_legacy.rs +++ b/src/source_legacy.rs @@ -41,7 +41,15 @@ impl Loader{ impl Loader{ pub fn load_textures(&self)->Result{ - Ok(Textures::new(Vec::new())) + let mut texture_data=vec![Vec::::new();self.texture_loader.texture_paths.len()]; + for (texture_path,texture_id) in &self.texture_loader.texture_paths{ + let path=std::path::PathBuf::from(format!("textures/{}.dds",texture_path.display())); + if let Ok(mut file)=std::fs::File::open(path){ + //TODO: parallel + file.read_to_end(texture_data.get_mut(texture_id.get() as usize).unwrap())?; + } + } + Ok(Textures::new(texture_data.into_iter().map(Texture::ImageDDS).collect())) } //load_meshes should look like load_textures /* From f3174cd191fe641c720a5ab547846bf06653dc00 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 14 Feb 2024 14:45:10 -0800 Subject: [PATCH 12/36] use boxed str --- src/source_legacy.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/source_legacy.rs b/src/source_legacy.rs index 5ccd98b..c6eadd2 100644 --- a/src/source_legacy.rs +++ b/src/source_legacy.rs @@ -1,11 +1,10 @@ use std::io::Read; -use std::path::PathBuf; use std::collections::HashMap; use crate::texture::{Texture,Textures}; use strafesnet_common::model::{MeshId,TextureId}; pub struct TextureLoader{ - texture_paths:HashMap, + texture_paths:HashMap,TextureId>, } impl TextureLoader{ pub fn acquire_texture_id(&mut self,name:&str)->TextureId{ @@ -14,7 +13,7 @@ impl TextureLoader{ } } pub struct MeshLoader{ - mesh_paths:HashMap, + mesh_paths:HashMap,MeshId>, } impl MeshLoader{ pub fn acquire_mesh_id(&mut self,name:&str)->MeshId{ @@ -43,7 +42,7 @@ impl Loader{ pub fn load_textures(&self)->Result{ let mut texture_data=vec![Vec::::new();self.texture_loader.texture_paths.len()]; for (texture_path,texture_id) in &self.texture_loader.texture_paths{ - let path=std::path::PathBuf::from(format!("textures/{}.dds",texture_path.display())); + let path=std::path::PathBuf::from(format!("textures/{}.dds",texture_path)); if let Ok(mut file)=std::fs::File::open(path){ //TODO: parallel file.read_to_end(texture_data.get_mut(texture_id.get() as usize).unwrap())?; From a2eac572824959e9ffe264e544431f0117da010b Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 14 Feb 2024 23:45:16 -0800 Subject: [PATCH 13/36] new loading api --- Cargo.lock | 425 ++++++++++++++++++++++++++++++++++++++++++- Cargo.toml | 9 +- src/lib.rs | 1 + src/roblox_legacy.rs | 65 +++++-- src/source_legacy.rs | 105 ++++++++--- src/texture.rs | 32 ++-- src/valve_mesh.rs | 60 ++++++ 7 files changed, 637 insertions(+), 60 deletions(-) create mode 100644 src/valve_mesh.rs diff --git a/Cargo.lock b/Cargo.lock index ab45f8b..baa55d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,19 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ahash" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" +dependencies = [ + "cfg-if", + "getrandom", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.2" @@ -11,12 +24,177 @@ dependencies = [ "memchr", ] +[[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]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[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]] +name = "bitflags" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" + +[[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.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f" + +[[package]] +name = "byteorder" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cgmath" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a98d30140e3296250832bbaaff83b27dcd6fa3cc70fb6f1f3e5c9c0023b5317" +dependencies = [ + "approx", + "num-traits", +] + +[[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]] +name = "crossbeam-utils" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" + +[[package]] +name = "either" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "feature-probe" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" + +[[package]] +name = "getrandom" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + [[package]] name = "glam" version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "151665d9be52f9bb40fc7966565d39666f2d1e69233571b71b87791c7e0528b3" +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" + [[package]] name = "id" version = "0.1.0" @@ -24,7 +202,26 @@ source = "git+https://git.itzana.me/Quaternions/id?rev=1f710976cc786c8853dab73d6 dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.48", +] + +[[package]] +name = "indexmap" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", ] [[package]] @@ -47,7 +244,32 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn", + "syn 2.0.48", +] + +[[package]] +name = "libc" +version = "0.2.153" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" + +[[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]] @@ -56,12 +278,57 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +[[package]] +name = "num-traits" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "once_cell" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "owo-colors" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" + +[[package]] +name = "proc-macro-crate" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +dependencies = [ + "toml_edit", +] + [[package]] name = "proc-macro2" version = "1.0.78" @@ -109,10 +376,16 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "strafesnet_common" version = "0.1.0" -source = "git+https://git.itzana.me/StrafesNET/common?rev=47cdea0c8a5d10a2440ca6270a975d560aa3642d#47cdea0c8a5d10a2440ca6270a975d560aa3642d" +source = "git+https://git.itzana.me/StrafesNET/common?rev=093a54c527134ef7020a22a0f5778df8cba60228#093a54c527134ef7020a22a0f5778df8cba60228" dependencies = [ "glam", "id", @@ -124,6 +397,18 @@ version = "0.2.0" dependencies = [ "lazy-regex", "strafesnet_common", + "vbsp", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] @@ -137,8 +422,142 @@ 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 = "thiserror" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "toml_datetime" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" + +[[package]] +name = "toml_edit" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "vbsp" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9267540dab0c93bb5201c40ba3b2d027e2717bf355a8f9bf25377b06a5b32f6" +dependencies = [ + "ahash", + "arrayvec", + "binrw", + "bitflags", + "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]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "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", +] diff --git a/Cargo.toml b/Cargo.toml index f7e925f..9217831 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,10 +6,11 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -legacy = ["dep:lazy-regex"] -#roblox = [] -#source = [] +legacy = ["dep:lazy-regex", "dep:vbsp"] +#roblox = ["dep:lazy-regex"] +#source = ["dep:vbsp"] [dependencies] lazy-regex = { version = "3.1.0", optional = true } -strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "47cdea0c8a5d10a2440ca6270a975d560aa3642d" } +strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "093a54c527134ef7020a22a0f5778df8cba60228" } +vbsp = { version = "0.5.0", optional = true } diff --git a/src/lib.rs b/src/lib.rs index fec640b..4fed855 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,6 +8,7 @@ mod roblox; mod source; pub mod texture; +pub mod valve_mesh; #[cfg(feature="legacy")] pub fn roblox_legacy()->roblox_legacy::Loader{ diff --git a/src/roblox_legacy.rs b/src/roblox_legacy.rs index 50ae79a..5c67ffc 100644 --- a/src/roblox_legacy.rs +++ b/src/roblox_legacy.rs @@ -1,7 +1,7 @@ use std::io::Read; use std::collections::HashMap; -use crate::texture::{Texture,Textures}; -use strafesnet_common::model::TextureId; +use crate::texture::{Texture,RenderConfigs}; +use strafesnet_common::model::{TextureId,RenderConfigId,RenderConfig}; #[derive(Hash,Eq,PartialEq)] struct RobloxAssetId(u64); @@ -29,30 +29,65 @@ impl std::fmt::Display for RobloxAssetIdParseErr{ impl std::error::Error for RobloxAssetIdParseErr{} pub struct Loader{ - texture_names:HashMap, + texture_count:u32, + render_configs:Vec, + render_config_id_from_asset_id:HashMap,RenderConfigId>, } impl Loader{ pub fn new()->Self{ Self{ - texture_names:HashMap::new(), + texture_count:0, + render_configs:Vec::new(), + render_config_id_from_asset_id:HashMap::new(), } } } impl Loader{ - pub fn acquire_texture_id(&mut self,name:&str)->Result{ - let texture_id=TextureId::new(self.texture_names.len() as u32); - Ok(*self.texture_names.entry(name.parse::()?).or_insert(texture_id)) + pub fn acquire_render_config_id(&mut self,name:Option<&str>)->RenderConfigId{ + let render_id=RenderConfigId::new(self.render_config_id_from_asset_id.len() as u32); + let index=name.and_then(|name|{ + match name.parse::(){ + Ok(asset_id)=>Some(asset_id), + Err(e)=>{ + println!("Failed to parse AssetId: {e}"); + None + }, + } + }); + *self.render_config_id_from_asset_id.entry(index).or_insert_with(||{ + //create the render config. + let render_config=if name.is_some(){ + let render_config=RenderConfig::texture(TextureId::new(self.texture_count)); + self.texture_count+=1; + render_config + }else{ + RenderConfig::default() + }; + self.render_configs.push(render_config); + render_id + }) } - pub fn load_textures(&self)->Result{ - let mut texture_data=vec![Vec::::new();self.texture_names.len()]; - for (texture_name,texture_id) in &self.texture_names{ - let path=std::path::PathBuf::from(format!("textures/{}.dds",texture_name.0)); - if let Ok(mut file)=std::fs::File::open(path){ - //TODO: parallel - file.read_to_end(texture_data.get_mut(texture_id.get() as usize).unwrap())?; + pub fn into_render_configs(mut self)->Result{ + let mut sorted_textures=vec![None;self.texture_count as usize]; + for (asset_id,render_config_id) in self.render_config_id_from_asset_id{ + let render_config=self.render_configs.get_mut(render_config_id.get() as usize).unwrap(); + if let (Some(asset_id),Some(texture_id))=(asset_id,render_config.texture){ + let path=std::path::PathBuf::from(format!("textures/{}.dds",asset_id.0)); + if let Ok(mut file)=std::fs::File::open(path){ + //TODO: parallel + let mut data=Vec::::new(); + file.read_to_end(&mut data)?; + sorted_textures[texture_id.get() as usize]=Some(Texture::ImageDDS(data)); + }else{ + //texture failed to load + render_config.texture=None; + } } } - Ok(Textures::new(texture_data.into_iter().map(Texture::ImageDDS).collect())) + Ok(RenderConfigs::new( + sorted_textures, + self.render_configs, + )) } } \ No newline at end of file diff --git a/src/source_legacy.rs b/src/source_legacy.rs index c6eadd2..d24959f 100644 --- a/src/source_legacy.rs +++ b/src/source_legacy.rs @@ -1,15 +1,29 @@ use std::io::Read; use std::collections::HashMap; -use crate::texture::{Texture,Textures}; -use strafesnet_common::model::{MeshId,TextureId}; +use crate::valve_mesh; +use crate::texture::{Texture,RenderConfigs}; +use strafesnet_common::model::{MeshId,TextureId,RenderConfig,RenderConfigId}; -pub struct TextureLoader{ - texture_paths:HashMap,TextureId>, +pub struct RenderConfigLoader{ + texture_count:u32, + render_configs:Vec, + texture_paths:HashMap>,RenderConfigId>, } -impl TextureLoader{ - pub fn acquire_texture_id(&mut self,name:&str)->TextureId{ - let texture_id=TextureId::new(self.texture_paths.len() as u32); - *self.texture_paths.entry(name.into()).or_insert(texture_id) +impl RenderConfigLoader{ + pub fn acquire_render_config_id(&mut self,name:Option<&str>)->RenderConfigId{ + let render_id=RenderConfigId::new(self.texture_paths.len() as u32); + *self.texture_paths.entry(name.map(Into::into)).or_insert_with(||{ + //create the render config. + let render_config=if name.is_some(){ + let render_config=RenderConfig::texture(TextureId::new(self.texture_count)); + self.texture_count+=1; + render_config + }else{ + RenderConfig::default() + }; + self.render_configs.push(render_config); + render_id + }) } } pub struct MeshLoader{ @@ -17,42 +31,79 @@ pub struct MeshLoader{ } impl MeshLoader{ pub fn acquire_mesh_id(&mut self,name:&str)->MeshId{ - let texture_id=MeshId::new(self.mesh_paths.len() as u32); - *self.mesh_paths.entry(name.into()).or_insert(texture_id) + let mesh_id=MeshId::new(self.mesh_paths.len() as u32); + *self.mesh_paths.entry(name.into()).or_insert(mesh_id) + } + //load_meshes should look like load_textures + pub fn load_meshes(&mut self,bsp:&vbsp::Bsp)->valve_mesh::Meshes{ + let mut mesh_data=vec![None;self.mesh_paths.len()]; + for (mesh_path,mesh_id) in &self.mesh_paths{ + let mesh_path_lower=mesh_path.to_lowercase(); + //.mdl, .vvd, .dx90.vtx + let mut path=std::path::PathBuf::from(mesh_path_lower.as_str()); + let file_name=std::path::PathBuf::from(path.file_stem().unwrap()); + path.pop(); + path.push(file_name); + let mut vvd_path=path.clone(); + let mut vtx_path=path.clone(); + vvd_path.set_extension("vvd"); + vtx_path.set_extension("dx90.vtx"); + match (bsp.pack.get(mesh_path_lower.as_str()),bsp.pack.get(vvd_path.as_os_str().to_str().unwrap()),bsp.pack.get(vtx_path.as_os_str().to_str().unwrap())){ + (Ok(Some(mdl_file)),Ok(Some(vvd_file)),Ok(Some(vtx_file)))=>{ + mesh_data[mesh_id.get() as usize]=Some(valve_mesh::ModelData{ + mdl:valve_mesh::MdlData::new(mdl_file), + vtx:valve_mesh::VtxData::new(vtx_file), + vvd:valve_mesh::VvdData::new(vvd_file), + }); + }, + _=>println!("no model name={}",mesh_path), + } + } + valve_mesh::Meshes::new(mesh_data) } } pub struct Loader{ - texture_loader:TextureLoader, + render_config_loader:RenderConfigLoader, mesh_loader:MeshLoader, } impl Loader{ pub fn new()->Self{ Self{ - texture_loader:TextureLoader{texture_paths:HashMap::new()}, + render_config_loader:RenderConfigLoader{ + texture_count:0, + texture_paths:HashMap::new(), + render_configs:Vec::new(), + }, mesh_loader:MeshLoader{mesh_paths:HashMap::new()}, } } - pub fn get_inner_mut(&mut self)->(&mut TextureLoader,&mut MeshLoader){ - (&mut self.texture_loader,&mut self.mesh_loader) + pub fn get_inner_mut(&mut self)->(&mut RenderConfigLoader,&mut MeshLoader){ + (&mut self.render_config_loader,&mut self.mesh_loader) } } impl Loader{ - pub fn load_textures(&self)->Result{ - let mut texture_data=vec![Vec::::new();self.texture_loader.texture_paths.len()]; - for (texture_path,texture_id) in &self.texture_loader.texture_paths{ - let path=std::path::PathBuf::from(format!("textures/{}.dds",texture_path)); - if let Ok(mut file)=std::fs::File::open(path){ - //TODO: parallel - file.read_to_end(texture_data.get_mut(texture_id.get() as usize).unwrap())?; + pub fn into_render_configs(mut self)->Result{ + let mut sorted_textures=vec![None;self.render_config_loader.texture_count as usize]; + for (texture_path,render_config_id) in self.render_config_loader.texture_paths{ + let render_config=self.render_config_loader.render_configs.get_mut(render_config_id.get() as usize).unwrap(); + if let (Some(texture_path),Some(texture_id))=(texture_path,render_config.texture){ + let path=std::path::PathBuf::from(format!("textures/{}.dds",texture_path)); + if let Ok(mut file)=std::fs::File::open(path){ + //TODO: parallel + let mut data=Vec::::new(); + file.read_to_end(&mut data)?; + sorted_textures[texture_id.get() as usize]=Some(Texture::ImageDDS(data)); + }else{ + //texture failed to load + render_config.texture=None; + } } } - Ok(Textures::new(texture_data.into_iter().map(Texture::ImageDDS).collect())) + Ok(RenderConfigs::new( + sorted_textures, + self.render_config_loader.render_configs, + )) } - //load_meshes should look like load_textures - /* - pub fn load_meshes(&mut self)->Result{ - } - */ } diff --git a/src/texture.rs b/src/texture.rs index 59c9b6e..d737618 100644 --- a/src/texture.rs +++ b/src/texture.rs @@ -1,5 +1,6 @@ -use strafesnet_common::model::TextureId; +use strafesnet_common::model::{TextureId,RenderConfigId,RenderConfig}; +#[derive(Clone)] pub enum Texture{ ImageDDS(Vec), } @@ -11,19 +12,28 @@ impl AsRef<[u8]> for Texture{ } } -pub struct Textures{ - textures:Vec, +pub struct RenderConfigs{ + textures:Vec>, + render_configs:Vec, } -impl Textures{ - pub(crate) const fn new(textures:Vec)->Self{ +impl RenderConfigs{ + pub(crate) const fn new(textures:Vec>,render_configs:Vec)->Self{ Self{ textures, + render_configs, } } - pub fn get_texture(&self,texture_id:TextureId)->Option<&Texture>{ - self.textures.get(texture_id.get() as usize) + pub fn consume(self)->( + impl Iterator, + impl Iterator + ){ + ( + self.textures.into_iter().enumerate().filter_map(|(texture_id,maybe_texture)| + maybe_texture.map(|texture|(TextureId::new(texture_id as u32),texture)) + ), + self.render_configs.into_iter().enumerate().map(|(render_id,render)| + (RenderConfigId::new(render_id as u32),render) + ), + ) } - pub fn into_iter(self)->impl Iterator{ - self.textures.into_iter().enumerate().map(|(texture_id,texture)|(TextureId::new(texture_id as u32),texture)) - } -} +} \ No newline at end of file diff --git a/src/valve_mesh.rs b/src/valve_mesh.rs new file mode 100644 index 0000000..15d7f40 --- /dev/null +++ b/src/valve_mesh.rs @@ -0,0 +1,60 @@ +use strafesnet_common::model::MeshId; + +//duplicate this code for now +#[derive(Clone)] +pub struct MdlData(Vec); +impl MdlData{ + pub const fn new(value:Vec)->Self{ + Self(value) + } + pub fn get(self)->Vec{ + self.0 + } +} +#[derive(Clone)] +pub struct VtxData(Vec); +impl VtxData{ + pub const fn new(value:Vec)->Self{ + Self(value) + } + pub fn get(self)->Vec{ + self.0 + } +} +#[derive(Clone)] +pub struct VvdData(Vec); +impl VvdData{ + pub const fn new(value:Vec)->Self{ + Self(value) + } + pub fn get(self)->Vec{ + self.0 + } +} + +#[derive(Clone)] +pub struct ModelData{ + pub mdl:MdlData, + pub vtx:VtxData, + pub vvd:VvdData, +} + +//meshes is more prone to failure +pub struct Meshes{ + meshes:Vec>, +} +impl Meshes{ + pub(crate) const fn new(meshes:Vec>)->Self{ + Self{ + meshes, + } + } + pub fn get_texture(&self,texture_id:MeshId)->Option<&ModelData>{ + self.meshes.get(texture_id.get() as usize)?.as_ref() + } + pub fn into_iter(self)->impl Iterator{ + self.meshes.into_iter().enumerate().filter_map(|(mesh_id,maybe_mesh)| + maybe_mesh.map(|mesh|(MeshId::new(mesh_id as u32),mesh)) + ) + } +} \ No newline at end of file From 5a0893cbb9007afa40943835adc2ada18c60482c Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 14 Feb 2024 23:46:32 -0800 Subject: [PATCH 14/36] convenience --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 9217831..8ebe995 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] +default = ["legacy"] legacy = ["dep:lazy-regex", "dep:vbsp"] #roblox = ["dep:lazy-regex"] #source = ["dep:vbsp"] From c03cd0e905daf70b03b60b3e12509f96ee94a658 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 14 Feb 2024 23:47:30 -0800 Subject: [PATCH 15/36] v0.3.0 new loading api --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index baa55d1..27402c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -393,7 +393,7 @@ dependencies = [ [[package]] name = "strafesnet_deferred_loader" -version = "0.2.0" +version = "0.3.0" dependencies = [ "lazy-regex", "strafesnet_common", diff --git a/Cargo.toml b/Cargo.toml index 8ebe995..ad02449 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strafesnet_deferred_loader" -version = "0.2.0" +version = "0.3.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html From 2273f881b2ebcd404e400f0a3aded0661bb29389 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Sat, 17 Feb 2024 22:05:03 -0800 Subject: [PATCH 16/36] unneeded path operations --- src/roblox_legacy.rs | 3 +-- src/source_legacy.rs | 8 ++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/roblox_legacy.rs b/src/roblox_legacy.rs index 5c67ffc..d4f70a2 100644 --- a/src/roblox_legacy.rs +++ b/src/roblox_legacy.rs @@ -73,8 +73,7 @@ impl Loader{ for (asset_id,render_config_id) in self.render_config_id_from_asset_id{ let render_config=self.render_configs.get_mut(render_config_id.get() as usize).unwrap(); if let (Some(asset_id),Some(texture_id))=(asset_id,render_config.texture){ - let path=std::path::PathBuf::from(format!("textures/{}.dds",asset_id.0)); - if let Ok(mut file)=std::fs::File::open(path){ + if let Ok(mut file)=std::fs::File::open(format!("textures/{}.dds",asset_id.0)){ //TODO: parallel let mut data=Vec::::new(); file.read_to_end(&mut data)?; diff --git a/src/source_legacy.rs b/src/source_legacy.rs index d24959f..efb2b3a 100644 --- a/src/source_legacy.rs +++ b/src/source_legacy.rs @@ -40,10 +40,7 @@ impl MeshLoader{ for (mesh_path,mesh_id) in &self.mesh_paths{ let mesh_path_lower=mesh_path.to_lowercase(); //.mdl, .vvd, .dx90.vtx - let mut path=std::path::PathBuf::from(mesh_path_lower.as_str()); - let file_name=std::path::PathBuf::from(path.file_stem().unwrap()); - path.pop(); - path.push(file_name); + let path=std::path::PathBuf::from(mesh_path_lower.as_str()); let mut vvd_path=path.clone(); let mut vtx_path=path.clone(); vvd_path.set_extension("vvd"); @@ -89,8 +86,7 @@ impl Loader{ for (texture_path,render_config_id) in self.render_config_loader.texture_paths{ let render_config=self.render_config_loader.render_configs.get_mut(render_config_id.get() as usize).unwrap(); if let (Some(texture_path),Some(texture_id))=(texture_path,render_config.texture){ - let path=std::path::PathBuf::from(format!("textures/{}.dds",texture_path)); - if let Ok(mut file)=std::fs::File::open(path){ + if let Ok(mut file)=std::fs::File::open(format!("textures/{}.dds",texture_path)){ //TODO: parallel let mut data=Vec::::new(); file.read_to_end(&mut data)?; From 3979eec34c19a4da75889198c18966f6bb1a6e69 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 22 Feb 2024 00:24:14 -0800 Subject: [PATCH 17/36] why is this split --- src/source_legacy.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/source_legacy.rs b/src/source_legacy.rs index efb2b3a..fc1474e 100644 --- a/src/source_legacy.rs +++ b/src/source_legacy.rs @@ -78,9 +78,6 @@ impl Loader{ pub fn get_inner_mut(&mut self)->(&mut RenderConfigLoader,&mut MeshLoader){ (&mut self.render_config_loader,&mut self.mesh_loader) } -} - -impl Loader{ pub fn into_render_configs(mut self)->Result{ let mut sorted_textures=vec![None;self.render_config_loader.texture_count as usize]; for (texture_path,render_config_id) in self.render_config_loader.texture_paths{ From a1aafed513e6a765a0f231b2535e28327ea721da Mon Sep 17 00:00:00 2001 From: Quaternions Date: Sat, 2 Mar 2024 05:01:22 -0800 Subject: [PATCH 18/36] update common --- Cargo.lock | 25 +++++++++++++------------ Cargo.toml | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 27402c3..e7e0702 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ahash" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" +checksum = "8b79b82693f705137f8fb9b37871d99e4f9a7df12b917eed79c3d3954830a60b" dependencies = [ "cfg-if", "getrandom", @@ -202,14 +202,14 @@ source = "git+https://git.itzana.me/Quaternions/id?rev=1f710976cc786c8853dab73d6 dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] name = "indexmap" -version = "2.2.3" +version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" +checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" dependencies = [ "equivalent", "hashbrown", @@ -244,7 +244,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] @@ -305,7 +305,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] @@ -385,8 +385,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strafesnet_common" version = "0.1.0" -source = "git+https://git.itzana.me/StrafesNET/common?rev=093a54c527134ef7020a22a0f5778df8cba60228#093a54c527134ef7020a22a0f5778df8cba60228" +source = "git+https://git.itzana.me/StrafesNET/common?rev=ef922135e6d19f296d8e4d90df0d0d71fa3412e2#ef922135e6d19f296d8e4d90df0d0d71fa3412e2" dependencies = [ + "bitflags", "glam", "id", ] @@ -413,9 +414,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", @@ -450,7 +451,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] @@ -547,7 +548,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.52", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index ad02449..a512dcd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,5 +13,5 @@ legacy = ["dep:lazy-regex", "dep:vbsp"] [dependencies] lazy-regex = { version = "3.1.0", optional = true } -strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "093a54c527134ef7020a22a0f5778df8cba60228" } +strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "ef922135e6d19f296d8e4d90df0d0d71fa3412e2" } vbsp = { version = "0.5.0", optional = true } From e37d8540c247e043878dae978e394fbccf3246db Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 12 Mar 2024 21:59:36 -0700 Subject: [PATCH 19/36] update common --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e7e0702..f4bd484 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -385,7 +385,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strafesnet_common" version = "0.1.0" -source = "git+https://git.itzana.me/StrafesNET/common?rev=ef922135e6d19f296d8e4d90df0d0d71fa3412e2#ef922135e6d19f296d8e4d90df0d0d71fa3412e2" +source = "git+https://git.itzana.me/StrafesNET/common?rev=db142d125b5b8f41b6b65f2c23e2a815e28ee7f9#db142d125b5b8f41b6b65f2c23e2a815e28ee7f9" dependencies = [ "bitflags", "glam", diff --git a/Cargo.toml b/Cargo.toml index a512dcd..c4f49f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,5 +13,5 @@ legacy = ["dep:lazy-regex", "dep:vbsp"] [dependencies] lazy-regex = { version = "3.1.0", optional = true } -strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "ef922135e6d19f296d8e4d90df0d0d71fa3412e2" } +strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "db142d125b5b8f41b6b65f2c23e2a815e28ee7f9" } vbsp = { version = "0.5.0", optional = true } From 790c72a1b82840bcdb7f1afe02554b12aa0c1ba9 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 13 Mar 2024 10:17:59 -0700 Subject: [PATCH 20/36] implement legacy roblox mesh loader --- src/lib.rs | 3 ++ src/roblox_legacy.rs | 80 ++++++++++++++++++++++++++++++++++---------- src/roblox_mesh.rs | 30 +++++++++++++++++ 3 files changed, 95 insertions(+), 18 deletions(-) create mode 100644 src/roblox_mesh.rs diff --git a/src/lib.rs b/src/lib.rs index 4fed855..c8b5e99 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,7 +8,10 @@ mod roblox; mod source; pub mod texture; +#[cfg(any(feature="source",feature="legacy"))] pub mod valve_mesh; +#[cfg(any(feature="roblox",feature="legacy"))] +pub mod roblox_mesh; #[cfg(feature="legacy")] pub fn roblox_legacy()->roblox_legacy::Loader{ diff --git a/src/roblox_legacy.rs b/src/roblox_legacy.rs index d4f70a2..9da167e 100644 --- a/src/roblox_legacy.rs +++ b/src/roblox_legacy.rs @@ -1,7 +1,8 @@ use std::io::Read; use std::collections::HashMap; -use crate::texture::{Texture,RenderConfigs}; -use strafesnet_common::model::{TextureId,RenderConfigId,RenderConfig}; +use crate::roblox_mesh; +use crate::texture::{RenderConfigs,Texture}; +use strafesnet_common::model::{MeshId,RenderConfig,RenderConfigId,TextureId}; #[derive(Hash,Eq,PartialEq)] struct RobloxAssetId(u64); @@ -28,22 +29,14 @@ impl std::fmt::Display for RobloxAssetIdParseErr{ } impl std::error::Error for RobloxAssetIdParseErr{} -pub struct Loader{ +#[derive(Default)] +pub struct RenderConfigLoader{ texture_count:u32, render_configs:Vec, render_config_id_from_asset_id:HashMap,RenderConfigId>, } -impl Loader{ - pub fn new()->Self{ - Self{ - texture_count:0, - render_configs:Vec::new(), - render_config_id_from_asset_id:HashMap::new(), - } - } -} -impl Loader{ +impl RenderConfigLoader{ pub fn acquire_render_config_id(&mut self,name:Option<&str>)->RenderConfigId{ let render_id=RenderConfigId::new(self.render_config_id_from_asset_id.len() as u32); let index=name.and_then(|name|{ @@ -68,11 +61,62 @@ impl Loader{ render_id }) } +} + +#[derive(Default)] +pub struct MeshLoader{ + mesh_id_from_asset_id:HashMap,MeshId>, +} + +impl MeshLoader{ + pub fn acquire_mesh_id(&mut self,name:&str)->MeshId{ + let mesh_id=MeshId::new(self.mesh_id_from_asset_id.len() as u32); + let index=match name.parse::(){ + Ok(asset_id)=>Some(asset_id), + Err(e)=>{ + println!("Failed to parse AssetId: {e}"); + None + }, + }; + *self.mesh_id_from_asset_id.entry(index).or_insert(mesh_id) + } + pub fn load_meshes(&mut self)->Result{ + let mut mesh_data=vec![None;self.mesh_id_from_asset_id.len()]; + for (asset_id_option,mesh_id) in &self.mesh_id_from_asset_id{ + if let Some(asset_id)=asset_id_option{ + if let Ok(mut file)=std::fs::File::open(format!("meshes/{}",asset_id.0)){ + //TODO: parallel + let mut data=Vec::::new(); + file.read_to_end(&mut data)?; + mesh_data[mesh_id.get() as usize]=Some(roblox_mesh::RobloxMeshData::new(data)); + }else{ + println!("no model name={}",asset_id.0); + } + } + } + Ok(roblox_mesh::Meshes::new(mesh_data)) + } +} + +pub struct Loader{ + render_config_loader:RenderConfigLoader, + mesh_loader:MeshLoader, +} +impl Loader{ + pub fn new()->Self{ + Self{ + render_config_loader:RenderConfigLoader::default(), + mesh_loader:MeshLoader::default(), + } + } + pub fn get_inner_mut(&mut self)->(&mut RenderConfigLoader,&mut MeshLoader){ + (&mut self.render_config_loader,&mut self.mesh_loader) + } pub fn into_render_configs(mut self)->Result{ - let mut sorted_textures=vec![None;self.texture_count as usize]; - for (asset_id,render_config_id) in self.render_config_id_from_asset_id{ - let render_config=self.render_configs.get_mut(render_config_id.get() as usize).unwrap(); - if let (Some(asset_id),Some(texture_id))=(asset_id,render_config.texture){ + let mut sorted_textures=vec![None;self.render_config_loader.texture_count as usize]; + for (asset_id_option,render_config_id) in self.render_config_loader.render_config_id_from_asset_id{ + let render_config=self.render_config_loader.render_configs.get_mut(render_config_id.get() as usize).unwrap(); + if let (Some(asset_id),Some(texture_id))=(asset_id_option,render_config.texture){ if let Ok(mut file)=std::fs::File::open(format!("textures/{}.dds",asset_id.0)){ //TODO: parallel let mut data=Vec::::new(); @@ -86,7 +130,7 @@ impl Loader{ } Ok(RenderConfigs::new( sorted_textures, - self.render_configs, + self.render_config_loader.render_configs, )) } } \ No newline at end of file diff --git a/src/roblox_mesh.rs b/src/roblox_mesh.rs new file mode 100644 index 0000000..cdb545f --- /dev/null +++ b/src/roblox_mesh.rs @@ -0,0 +1,30 @@ +use strafesnet_common::model::MeshId; + +#[derive(Clone)] +pub struct RobloxMeshData(Vec); +impl RobloxMeshData{ + pub(crate) fn new(data:Vec)->Self{ + Self(data) + } + pub fn get(self)->Vec{ + self.0 + } +} +pub struct Meshes{ + meshes:Vec>, +} +impl Meshes{ + pub(crate) const fn new(meshes:Vec>)->Self{ + Self{ + meshes, + } + } + pub fn get_texture(&self,texture_id:MeshId)->Option<&RobloxMeshData>{ + self.meshes.get(texture_id.get() as usize)?.as_ref() + } + pub fn into_iter(self)->impl Iterator{ + self.meshes.into_iter().enumerate().filter_map(|(mesh_id,maybe_mesh)| + maybe_mesh.map(|mesh|(MeshId::new(mesh_id as u32),mesh)) + ) + } +} \ No newline at end of file From acaeaccf68e9ecc8a42a8b1a82b8f6cccba7499e Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 13 Mar 2024 11:29:28 -0700 Subject: [PATCH 21/36] update common --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f4bd484..12a6203 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -385,7 +385,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strafesnet_common" version = "0.1.0" -source = "git+https://git.itzana.me/StrafesNET/common?rev=db142d125b5b8f41b6b65f2c23e2a815e28ee7f9#db142d125b5b8f41b6b65f2c23e2a815e28ee7f9" +source = "git+https://git.itzana.me/StrafesNET/common?rev=a9f3e61f2bb1074025b6cb466a5e3f2abc988c34#a9f3e61f2bb1074025b6cb466a5e3f2abc988c34" dependencies = [ "bitflags", "glam", diff --git a/Cargo.toml b/Cargo.toml index c4f49f8..ab11c02 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,5 +13,5 @@ legacy = ["dep:lazy-regex", "dep:vbsp"] [dependencies] lazy-regex = { version = "3.1.0", optional = true } -strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "db142d125b5b8f41b6b65f2c23e2a815e28ee7f9" } +strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "a9f3e61f2bb1074025b6cb466a5e3f2abc988c34" } vbsp = { version = "0.5.0", optional = true } From 874984fd9808f9549609893f0cae5074c0b76dc2 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 29 Mar 2024 02:12:56 -0700 Subject: [PATCH 22/36] use strafesnet registry --- .cargo/config.toml | 2 ++ Cargo.lock | 8 +++++--- Cargo.toml | 6 +++++- 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..8b662bc --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[registries.strafesnet] +index = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 12a6203..9383e5e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -198,7 +198,8 @@ checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "id" version = "0.1.0" -source = "git+https://git.itzana.me/Quaternions/id?rev=1f710976cc786c8853dab73d6e1cee53158deeb0#1f710976cc786c8853dab73d6e1cee53158deeb0" +source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" +checksum = "2337e7a6c273082b672e377e159d7a168fb51438461b7c4033c79a515dd7a25a" dependencies = [ "proc-macro2", "quote", @@ -384,8 +385,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strafesnet_common" -version = "0.1.0" -source = "git+https://git.itzana.me/StrafesNET/common?rev=a9f3e61f2bb1074025b6cb466a5e3f2abc988c34#a9f3e61f2bb1074025b6cb466a5e3f2abc988c34" +version = "0.1.2" +source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" +checksum = "0704e795010e6ca97f3d3dd6c24e76bf2d23f91186e1807ad4c7cb84ba6b8239" dependencies = [ "bitflags", "glam", diff --git a/Cargo.toml b/Cargo.toml index ab11c02..0f8a7fb0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,10 @@ name = "strafesnet_deferred_loader" version = "0.3.0" edition = "2021" +repository = "https://git.itzana.me/StrafesNET/deferred_loader" +license = "MIT OR Apache-2.0" +description = "Acquire IDs for objects before loading them in bulk." +authors = ["Rhys Lloyd "] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -13,5 +17,5 @@ legacy = ["dep:lazy-regex", "dep:vbsp"] [dependencies] lazy-regex = { version = "3.1.0", optional = true } -strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "a9f3e61f2bb1074025b6cb466a5e3f2abc988c34" } +strafesnet_common = { version = "0.1.2", registry = "strafesnet" } vbsp = { version = "0.5.0", optional = true } From a0afea050b19e4f8b509761a0c40f5e949e794a1 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 29 Jul 2024 16:43:08 -0700 Subject: [PATCH 23/36] update deps --- Cargo.lock | 144 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 4 +- 2 files changed, 74 insertions(+), 74 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9383e5e..f39c575 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ahash" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b79b82693f705137f8fb9b37871d99e4f9a7df12b917eed79c3d3954830a60b" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "getrandom", @@ -17,9 +17,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -47,9 +47,9 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "binrw" @@ -77,9 +77,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.4.2" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bv" @@ -92,9 +92,9 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.14.3" +version = "1.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f" +checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" [[package]] name = "byteorder" @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "crc" -version = "3.0.1" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" dependencies = [ "crc-catalog", ] @@ -141,24 +141,24 @@ checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "crc32fast" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-utils" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "either" -version = "1.10.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "equivalent" @@ -174,9 +174,9 @@ checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -185,15 +185,15 @@ dependencies = [ [[package]] name = "glam" -version = "0.25.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "151665d9be52f9bb40fc7966565d39666f2d1e69233571b71b87791c7e0528b3" +checksum = "779ae4bf7e8421cf91c0b3b64e7e8b40b862fba4d393f59150042de7c4965a94" [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "id" @@ -203,14 +203,14 @@ checksum = "2337e7a6c273082b672e377e159d7a168fb51438461b7c4033c79a515dd7a25a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.72", ] [[package]] name = "indexmap" -version = "2.2.5" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown", @@ -227,9 +227,9 @@ dependencies = [ [[package]] name = "lazy-regex" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d12be4595afdf58bd19e4a9f4e24187da2a66700786ff660a418e9059937a4c" +checksum = "576c8060ecfdf2e56995cf3274b4f2d71fa5e4fa3607c1c0b63c10180ee58741" dependencies = [ "lazy-regex-proc_macros", "once_cell", @@ -238,21 +238,21 @@ dependencies = [ [[package]] name = "lazy-regex-proc_macros" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bcd58e6c97a7fcbaffcdc95728b393b8d98933bfadad49ed4097845b57ef0b" +checksum = "9efb9e65d4503df81c615dc33ff07042a9408ac7f26b45abee25566f7fbfd12c" dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.52", + "syn 2.0.72", ] [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "lzma" @@ -275,38 +275,38 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "num_enum" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" +checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.72", ] [[package]] @@ -332,27 +332,27 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] [[package]] name = "regex" -version = "1.10.3" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", @@ -362,9 +362,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", @@ -373,9 +373,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "static_assertions" @@ -385,9 +385,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strafesnet_common" -version = "0.1.2" +version = "0.2.0" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "0704e795010e6ca97f3d3dd6c24e76bf2d23f91186e1807ad4c7cb84ba6b8239" +checksum = "74580c59a09194ce39db49cd814a5c2fc2d61513c88c6b811b5b40c0da6de057" dependencies = [ "bitflags", "glam", @@ -396,7 +396,7 @@ dependencies = [ [[package]] name = "strafesnet_deferred_loader" -version = "0.3.0" +version = "0.3.1" dependencies = [ "lazy-regex", "strafesnet_common", @@ -416,9 +416,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.52" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", @@ -438,29 +438,29 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.72", ] [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "f8fb9f64314842840f1d940ac544da178732128f1c78c21772e876579e0da1db" [[package]] name = "toml_edit" @@ -514,9 +514,9 @@ dependencies = [ [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wasi" @@ -535,22 +535,22 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.72", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 0f8a7fb0..7af1063 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strafesnet_deferred_loader" -version = "0.3.0" +version = "0.3.1" edition = "2021" repository = "https://git.itzana.me/StrafesNET/deferred_loader" license = "MIT OR Apache-2.0" @@ -17,5 +17,5 @@ legacy = ["dep:lazy-regex", "dep:vbsp"] [dependencies] lazy-regex = { version = "3.1.0", optional = true } -strafesnet_common = { version = "0.1.2", registry = "strafesnet" } +strafesnet_common = { version = "0.2.0", registry = "strafesnet" } vbsp = { version = "0.5.0", optional = true } From 8e24d5af144900f0bf056b5aaf79ded1dcab62b5 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 7 Aug 2024 18:39:54 -0700 Subject: [PATCH 24/36] update deps --- Cargo.lock | 23 ++++++++++++----------- Cargo.toml | 4 ++-- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f39c575..e2a2d34 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -92,9 +92,9 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.16.1" +version = "1.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" +checksum = "102087e286b4677862ea56cf8fc58bb2cdfa8725c40ffb80fe3a008eb7f2fc83" [[package]] name = "byteorder" @@ -208,9 +208,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" dependencies = [ "equivalent", "hashbrown", @@ -350,9 +350,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.5" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", @@ -385,10 +385,11 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strafesnet_common" -version = "0.2.0" +version = "0.3.0" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "74580c59a09194ce39db49cd814a5c2fc2d61513c88c6b811b5b40c0da6de057" +checksum = "1077d45a0b064964906a57de765a5a2bfe47b41f2f807d13b18c70765e76d3dd" dependencies = [ + "arrayvec", "bitflags", "glam", "id", @@ -396,7 +397,7 @@ dependencies = [ [[package]] name = "strafesnet_deferred_loader" -version = "0.3.1" +version = "0.3.2" dependencies = [ "lazy-regex", "strafesnet_common", @@ -458,9 +459,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fb9f64314842840f1d940ac544da178732128f1c78c21772e876579e0da1db" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" diff --git a/Cargo.toml b/Cargo.toml index 7af1063..68ca88b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strafesnet_deferred_loader" -version = "0.3.1" +version = "0.3.2" edition = "2021" repository = "https://git.itzana.me/StrafesNET/deferred_loader" license = "MIT OR Apache-2.0" @@ -17,5 +17,5 @@ legacy = ["dep:lazy-regex", "dep:vbsp"] [dependencies] lazy-regex = { version = "3.1.0", optional = true } -strafesnet_common = { version = "0.2.0", registry = "strafesnet" } +strafesnet_common = { version = "0.3.0", registry = "strafesnet" } vbsp = { version = "0.5.0", optional = true } From 46ceab5526e471d85e61bb273470a7eaba89e4b1 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 9 Aug 2024 14:28:13 -0700 Subject: [PATCH 25/36] update deps --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e2a2d34..bc23597 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -385,9 +385,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strafesnet_common" -version = "0.3.0" +version = "0.4.0" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "1077d45a0b064964906a57de765a5a2bfe47b41f2f807d13b18c70765e76d3dd" +checksum = "ea4126f6fbf9aecf89c9e319290f0221d177dcaa8659b4b9e3d82acc37829f12" dependencies = [ "arrayvec", "bitflags", diff --git a/Cargo.toml b/Cargo.toml index 68ca88b..fdc7a38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,5 +17,5 @@ legacy = ["dep:lazy-regex", "dep:vbsp"] [dependencies] lazy-regex = { version = "3.1.0", optional = true } -strafesnet_common = { version = "0.3.0", registry = "strafesnet" } +strafesnet_common = { version = "0.4.0", registry = "strafesnet" } vbsp = { version = "0.5.0", optional = true } From eb022b128cc80e5bb0cff80d9e20ae35fa913dd0 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 9 Aug 2024 14:28:39 -0700 Subject: [PATCH 26/36] v0.3.3 update common --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bc23597..87fd2a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -397,7 +397,7 @@ dependencies = [ [[package]] name = "strafesnet_deferred_loader" -version = "0.3.2" +version = "0.3.3" dependencies = [ "lazy-regex", "strafesnet_common", diff --git a/Cargo.toml b/Cargo.toml index fdc7a38..f3f8e82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strafesnet_deferred_loader" -version = "0.3.2" +version = "0.3.3" edition = "2021" repository = "https://git.itzana.me/StrafesNET/deferred_loader" license = "MIT OR Apache-2.0" From e525a80b91445a59b840771fc90a0d0210699037 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Sat, 28 Sep 2024 21:38:43 -0700 Subject: [PATCH 27/36] change print --- src/roblox_legacy.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/roblox_legacy.rs b/src/roblox_legacy.rs index 9da167e..3cfdbdb 100644 --- a/src/roblox_legacy.rs +++ b/src/roblox_legacy.rs @@ -90,7 +90,7 @@ impl MeshLoader{ file.read_to_end(&mut data)?; mesh_data[mesh_id.get() as usize]=Some(roblox_mesh::RobloxMeshData::new(data)); }else{ - println!("no model name={}",asset_id.0); + println!("[roblox_legacy] no mesh name={}",asset_id.0); } } } From 72caf29ad8e305bc04ac206d0f823212722b5d49 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 1 Oct 2024 12:37:14 -0700 Subject: [PATCH 28/36] parse as url rather than regex --- Cargo.lock | 129 ++++++++++++++++++++++--------------------- Cargo.toml | 4 +- src/roblox_legacy.rs | 32 +++++++---- 3 files changed, 90 insertions(+), 75 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 87fd2a6..f194721 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,15 +15,6 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - [[package]] name = "approx" version = "0.4.0" @@ -172,6 +163,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + [[package]] name = "getrandom" version = "0.2.15" @@ -206,6 +206,16 @@ dependencies = [ "syn 2.0.72", ] +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "indexmap" version = "2.3.0" @@ -225,29 +235,6 @@ dependencies = [ "either", ] -[[package]] -name = "lazy-regex" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "576c8060ecfdf2e56995cf3274b4f2d71fa5e4fa3607c1c0b63c10180ee58741" -dependencies = [ - "lazy-regex-proc_macros", - "once_cell", - "regex", -] - -[[package]] -name = "lazy-regex-proc_macros" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9efb9e65d4503df81c615dc33ff07042a9408ac7f26b45abee25566f7fbfd12c" -dependencies = [ - "proc-macro2", - "quote", - "regex", - "syn 2.0.72", -] - [[package]] name = "libc" version = "0.2.155" @@ -321,6 +308,12 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + [[package]] name = "proc-macro-crate" version = "3.1.0" @@ -348,35 +341,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "regex" -version = "1.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" - [[package]] name = "static_assertions" version = "1.1.0" @@ -399,8 +363,8 @@ dependencies = [ name = "strafesnet_deferred_loader" version = "0.3.3" dependencies = [ - "lazy-regex", "strafesnet_common", + "url", "vbsp", ] @@ -457,6 +421,21 @@ dependencies = [ "syn 2.0.72", ] +[[package]] +name = "tinyvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "toml_datetime" version = "0.6.8" @@ -474,12 +453,38 @@ dependencies = [ "winnow", ] +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "url" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + [[package]] name = "vbsp" version = "0.5.0" diff --git a/Cargo.toml b/Cargo.toml index f3f8e82..d14377d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,11 +11,11 @@ authors = ["Rhys Lloyd "] [features] default = ["legacy"] -legacy = ["dep:lazy-regex", "dep:vbsp"] +legacy = ["dep:url","dep:vbsp"] #roblox = ["dep:lazy-regex"] #source = ["dep:vbsp"] [dependencies] -lazy-regex = { version = "3.1.0", optional = true } strafesnet_common = { version = "0.4.0", registry = "strafesnet" } +url = { version = "2.5.2", optional = true } vbsp = { version = "0.5.0", optional = true } diff --git a/src/roblox_legacy.rs b/src/roblox_legacy.rs index 3cfdbdb..18263c7 100644 --- a/src/roblox_legacy.rs +++ b/src/roblox_legacy.rs @@ -7,19 +7,29 @@ use strafesnet_common::model::{MeshId,RenderConfig,RenderConfigId,TextureId}; #[derive(Hash,Eq,PartialEq)] struct RobloxAssetId(u64); #[derive(Debug)] -pub struct RobloxAssetIdParseErr(String); +#[allow(dead_code)] +pub enum RobloxAssetIdParseErr{ + Url(url::ParseError), + UnknownScheme(String), + ParseInt(std::num::ParseIntError), + MissingAssetId(String), +} impl std::str::FromStr for RobloxAssetId{ type Err=RobloxAssetIdParseErr; fn from_str(s:&str)->Result{ - let regman=lazy_regex::regex!(r"(\d+)$"); - if let Some(captures)=regman.captures(s){ - if captures.len()==2{//captures[0] is all captures concatenated, and then each individual capture - if let Ok(id)=captures[0].parse::(){ - return Ok(Self(id)); - } - } - } - Err(RobloxAssetIdParseErr(s.to_owned())) + let url=url::Url::parse(s).map_err(RobloxAssetIdParseErr::Url)?; + let parsed_asset_id=match url.scheme(){ + "rbxassetid"=>url.domain().ok_or_else(||RobloxAssetIdParseErr::MissingAssetId(s.to_owned()))?.parse(), + "http"|"https"=>{ + let (_,asset_id)=url.query_pairs() + .find(|(id,_)| + id.to_lowercase()=="id" + ).ok_or_else(||RobloxAssetIdParseErr::MissingAssetId(s.to_owned()))?; + asset_id.parse() + }, + _=>Err(RobloxAssetIdParseErr::UnknownScheme(s.to_owned()))?, + }; + Ok(Self(parsed_asset_id.map_err(RobloxAssetIdParseErr::ParseInt)?)) } } impl std::fmt::Display for RobloxAssetIdParseErr{ @@ -133,4 +143,4 @@ impl Loader{ self.render_config_loader.render_configs, )) } -} \ No newline at end of file +} From 7ada66ffbf01e9f88bb9345b77930c1b95576c79 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 1 Oct 2024 13:00:54 -0700 Subject: [PATCH 29/36] split out rbxasset --- src/lib.rs | 5 ++++- src/rbxassetid.rs | 34 ++++++++++++++++++++++++++++++++++ src/roblox_legacy.rs | 36 +----------------------------------- 3 files changed, 39 insertions(+), 36 deletions(-) create mode 100644 src/rbxassetid.rs diff --git a/src/lib.rs b/src/lib.rs index c8b5e99..767528a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,6 +7,9 @@ mod roblox; #[cfg(feature="source")] mod source; +#[cfg(any(feature="roblox",feature="legacy"))] +pub mod rbxassetid; + pub mod texture; #[cfg(any(feature="source",feature="legacy"))] pub mod valve_mesh; @@ -28,4 +31,4 @@ pub fn roblox()->roblox::Loader{ #[cfg(feature="source")] pub fn source()->source::Loader{ source::Loader::new() -} \ No newline at end of file +} diff --git a/src/rbxassetid.rs b/src/rbxassetid.rs new file mode 100644 index 0000000..daf227c --- /dev/null +++ b/src/rbxassetid.rs @@ -0,0 +1,34 @@ +#[derive(Hash,Eq,PartialEq)] +pub struct RobloxAssetId(pub u64); +#[derive(Debug)] +#[allow(dead_code)] +pub enum RobloxAssetIdParseErr{ + Url(url::ParseError), + UnknownScheme(String), + ParseInt(std::num::ParseIntError), + MissingAssetId(String), +} +impl std::str::FromStr for RobloxAssetId{ + type Err=RobloxAssetIdParseErr; + fn from_str(s:&str)->Result{ + let url=url::Url::parse(s).map_err(RobloxAssetIdParseErr::Url)?; + let parsed_asset_id=match url.scheme(){ + "rbxassetid"=>url.domain().ok_or_else(||RobloxAssetIdParseErr::MissingAssetId(s.to_owned()))?.parse(), + "http"|"https"=>{ + let (_,asset_id)=url.query_pairs() + .find(|(id,_)| + id.to_lowercase()=="id" + ).ok_or_else(||RobloxAssetIdParseErr::MissingAssetId(s.to_owned()))?; + asset_id.parse() + }, + _=>Err(RobloxAssetIdParseErr::UnknownScheme(s.to_owned()))?, + }; + Ok(Self(parsed_asset_id.map_err(RobloxAssetIdParseErr::ParseInt)?)) + } +} +impl std::fmt::Display for RobloxAssetIdParseErr{ + fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{ + write!(f,"{self:?}") + } +} +impl std::error::Error for RobloxAssetIdParseErr{} diff --git a/src/roblox_legacy.rs b/src/roblox_legacy.rs index 18263c7..a6480fe 100644 --- a/src/roblox_legacy.rs +++ b/src/roblox_legacy.rs @@ -3,41 +3,7 @@ use std::collections::HashMap; use crate::roblox_mesh; use crate::texture::{RenderConfigs,Texture}; use strafesnet_common::model::{MeshId,RenderConfig,RenderConfigId,TextureId}; - -#[derive(Hash,Eq,PartialEq)] -struct RobloxAssetId(u64); -#[derive(Debug)] -#[allow(dead_code)] -pub enum RobloxAssetIdParseErr{ - Url(url::ParseError), - UnknownScheme(String), - ParseInt(std::num::ParseIntError), - MissingAssetId(String), -} -impl std::str::FromStr for RobloxAssetId{ - type Err=RobloxAssetIdParseErr; - fn from_str(s:&str)->Result{ - let url=url::Url::parse(s).map_err(RobloxAssetIdParseErr::Url)?; - let parsed_asset_id=match url.scheme(){ - "rbxassetid"=>url.domain().ok_or_else(||RobloxAssetIdParseErr::MissingAssetId(s.to_owned()))?.parse(), - "http"|"https"=>{ - let (_,asset_id)=url.query_pairs() - .find(|(id,_)| - id.to_lowercase()=="id" - ).ok_or_else(||RobloxAssetIdParseErr::MissingAssetId(s.to_owned()))?; - asset_id.parse() - }, - _=>Err(RobloxAssetIdParseErr::UnknownScheme(s.to_owned()))?, - }; - Ok(Self(parsed_asset_id.map_err(RobloxAssetIdParseErr::ParseInt)?)) - } -} -impl std::fmt::Display for RobloxAssetIdParseErr{ - fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{ - write!(f,"{self:?}") - } -} -impl std::error::Error for RobloxAssetIdParseErr{} +use crate::rbxassetid::RobloxAssetId; #[derive(Default)] pub struct RenderConfigLoader{ From fabd53423e8c2ae1d2b137467341a0a4af94dd2a Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 1 Oct 2024 12:37:41 -0700 Subject: [PATCH 30/36] v0.3.4 parse rbxasset better --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f194721..6e4ddf2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -361,7 +361,7 @@ dependencies = [ [[package]] name = "strafesnet_deferred_loader" -version = "0.3.3" +version = "0.3.4" dependencies = [ "strafesnet_common", "url", diff --git a/Cargo.toml b/Cargo.toml index d14377d..44f20fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strafesnet_deferred_loader" -version = "0.3.3" +version = "0.3.4" edition = "2021" repository = "https://git.itzana.me/StrafesNET/deferred_loader" license = "MIT OR Apache-2.0" From b96b26bb2d75646fb8d60feaa7d75335d6e4c31e Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 1 Oct 2024 13:21:26 -0700 Subject: [PATCH 31/36] directly match string instead of allocating a complete lowercase string --- src/rbxassetid.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/rbxassetid.rs b/src/rbxassetid.rs index daf227c..53eb682 100644 --- a/src/rbxassetid.rs +++ b/src/rbxassetid.rs @@ -16,9 +16,10 @@ impl std::str::FromStr for RobloxAssetId{ "rbxassetid"=>url.domain().ok_or_else(||RobloxAssetIdParseErr::MissingAssetId(s.to_owned()))?.parse(), "http"|"https"=>{ let (_,asset_id)=url.query_pairs() - .find(|(id,_)| - id.to_lowercase()=="id" - ).ok_or_else(||RobloxAssetIdParseErr::MissingAssetId(s.to_owned()))?; + .find(|(id,_)|match id.as_ref(){ + "ID"|"id"|"Id"|"iD"=>true, + _=>false, + }).ok_or_else(||RobloxAssetIdParseErr::MissingAssetId(s.to_owned()))?; asset_id.parse() }, _=>Err(RobloxAssetIdParseErr::UnknownScheme(s.to_owned()))?, From 315fa962f2ed86923071f84740d0e0a74430118e Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 1 Oct 2024 16:23:09 -0700 Subject: [PATCH 32/36] update deps --- Cargo.lock | 356 +++++++++++++++++++++++++++++++++++++++++++---------- Cargo.toml | 4 +- 2 files changed, 295 insertions(+), 65 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6e4ddf2..22aa6b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,6 +15,15 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + [[package]] name = "approx" version = "0.4.0" @@ -32,21 +41,27 @@ checksum = "3d62b7694a562cdf5a74227903507c56ab2cc8bdd1f781ed5cb4cf9c9f810bfc" [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "beef" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" [[package]] name = "binrw" -version = "0.13.3" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "173901312e9850391d4d7c1318c4e099fdc037d61870fca427429830efdb4e5f" +checksum = "3f36b7cb3ab9ff6a2858650d8dc360e783a5d14dc29594db48c56a3c233cc265" dependencies = [ "array-init", "binrw_derive", @@ -55,9 +70,9 @@ dependencies = [ [[package]] name = "binrw_derive" -version = "0.13.3" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb515fdd6f8d3a357c8e19b8ec59ef53880807864329b1cb1cba5c53bf76557e" +checksum = "20ea7a8c5c8eeffffac6d54d172444e15beffac6f817fac714460a9a9aa88da3" dependencies = [ "either", "owo-colors", @@ -72,6 +87,12 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +[[package]] +name = "bnum" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50202def95bf36cb7d1d7a7962cea1c36a3f8ad42425e5d2b71d7acb8041b5b8" + [[package]] name = "bv" version = "0.11.1" @@ -83,9 +104,9 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.16.3" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "102087e286b4677862ea56cf8fc58bb2cdfa8725c40ffb80fe3a008eb7f2fc83" +checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" [[package]] name = "byteorder" @@ -163,6 +184,24 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" +[[package]] +name = "fixed_wide" +version = "0.1.1" +source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" +checksum = "d9c2cf115b3785ede870fada07e8b1aeba3378345b4ca86fe3c772ecabc05c0f" +dependencies = [ + "arrayvec", + "bnum", + "paste", + "ratio_ops", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -203,7 +242,7 @@ checksum = "2337e7a6c273082b672e377e159d7a168fb51438461b7c4033c79a515dd7a25a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] @@ -218,9 +257,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.3.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown", @@ -228,18 +267,68 @@ dependencies = [ [[package]] name = "itertools" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] [[package]] -name = "libc" -version = "0.2.155" +name = "lazy_static" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.159" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" + +[[package]] +name = "linear_ops" +version = "0.1.0" +source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" +checksum = "b2e6977ac24f47086d8a7a2d4ae1c720e86dfdc8407cf5e34c18bfa01053c456" +dependencies = [ + "fixed_wide", + "paste", + "ratio_ops", +] + +[[package]] +name = "logos" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c6b6e02facda28ca5fb8dbe4b152496ba3b1bd5a4b40bb2b1b2d8ad74e0f39b" +dependencies = [ + "logos-derive", +] + +[[package]] +name = "logos-codegen" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b32eb6b5f26efacd015b000bfc562186472cd9b34bdba3f6b264e2a052676d10" +dependencies = [ + "beef", + "fnv", + "lazy_static", + "proc-macro2", + "quote", + "regex-syntax", + "syn 2.0.79", +] + +[[package]] +name = "logos-derive" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e5d0c5463c911ef55624739fc353238b4e310f0144be1f875dc42fec6bfd5ec" +dependencies = [ + "logos-codegen", +] [[package]] name = "lzma" @@ -266,6 +355,29 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "miette" +version = "7.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4edc8853320c2a0dab800fbda86253c8938f6ea88510dc92c5f1ed20e794afc1" +dependencies = [ + "cfg-if", + "miette-derive", + "thiserror", + "unicode-width", +] + +[[package]] +name = "miette-derive" +version = "7.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf09caffaac8068c346b6df2a7fc27a177fd20b39421a39ce0a211bde679a6c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -293,14 +405,17 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" +dependencies = [ + "portable-atomic", +] [[package]] name = "owo-colors" @@ -308,6 +423,37 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" +[[package]] +name = "parse-display" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "914a1c2265c98e2446911282c6ac86d8524f495792c38c5bd884f80499c7538a" +dependencies = [ + "parse-display-derive", + "regex", + "regex-syntax", +] + +[[package]] +name = "parse-display-derive" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ae7800a4c974efd12df917266338e79a7a74415173caf7e70aa0a0707345281" +dependencies = [ + "proc-macro2", + "quote", + "regex", + "regex-syntax", + "structmeta", + "syn 2.0.79", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + [[package]] name = "percent-encoding" version = "2.3.1" @@ -315,10 +461,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] -name = "proc-macro-crate" -version = "3.1.0" +name = "portable-atomic" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" + +[[package]] +name = "proc-macro-crate" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ "toml_edit", ] @@ -334,13 +486,68 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] +[[package]] +name = "ratio_ops" +version = "0.1.0" +source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" +checksum = "01239195d6afe0509e7e3511b716c0540251dfe7ece0a9a5a27116afb766c42c" + +[[package]] +name = "regex" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "serde" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -349,14 +556,17 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strafesnet_common" -version = "0.4.0" +version = "0.5.1" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "ea4126f6fbf9aecf89c9e319290f0221d177dcaa8659b4b9e3d82acc37829f12" +checksum = "eaf0b69648e1b6b61b6f05868a5fc5496bc90b0586cfc69533b5cd7a3c006f86" dependencies = [ "arrayvec", "bitflags", + "fixed_wide", "glam", "id", + "linear_ops", + "ratio_ops", ] [[package]] @@ -368,6 +578,29 @@ dependencies = [ "vbsp", ] +[[package]] +name = "structmeta" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e1575d8d40908d70f6fd05537266b90ae71b15dbbe7a8b7dffa2b759306d329" +dependencies = [ + "proc-macro2", + "quote", + "structmeta-derive", + "syn 2.0.79", +] + +[[package]] +name = "structmeta-derive" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "syn" version = "1.0.109" @@ -381,44 +614,33 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.72" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", "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 = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] @@ -444,9 +666,9 @@ checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" -version = "0.21.1" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", "toml_datetime", @@ -461,9 +683,9 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" @@ -474,6 +696,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + [[package]] name = "url" version = "2.5.2" @@ -487,9 +715,9 @@ dependencies = [ [[package]] name = "vbsp" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9267540dab0c93bb5201c40ba3b2d027e2717bf355a8f9bf25377b06a5b32f6" +checksum = "f14a5685e0bb386aac9b9c6046a05152a46a0bc58d53afb3fbe577f1a1c2bb05" dependencies = [ "ahash", "arrayvec", @@ -500,22 +728,24 @@ dependencies = [ "itertools", "lzma-rs", "num_enum", + "serde", "static_assertions", "thiserror", - "vbsp-derive", + "vdf-reader", "zip-lzma", ] [[package]] -name = "vbsp-derive" -version = "0.1.0" +name = "vdf-reader" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ade687fadf34b1b7502387fc9eb7b4032ddc9b93022d31356e9984c957abaad" +checksum = "543945fdc3d51b20e3e0f5fd845ddeca4a270e56522035cf152105bc144ffd65" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "syn_util", + "logos", + "miette", + "parse-display", + "serde", + "thiserror", ] [[package]] @@ -532,9 +762,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "winnow" -version = "0.5.40" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -556,7 +786,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 44f20fa..b060d91 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,6 @@ legacy = ["dep:url","dep:vbsp"] #source = ["dep:vbsp"] [dependencies] -strafesnet_common = { version = "0.4.0", registry = "strafesnet" } +strafesnet_common = { version = "0.5.1", registry = "strafesnet" } url = { version = "2.5.2", optional = true } -vbsp = { version = "0.5.0", optional = true } +vbsp = { version = "0.6.0", optional = true } From ac48fb8a0d14e61f108f50197c6267ac93124a3f Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 1 Oct 2024 16:37:43 -0700 Subject: [PATCH 33/36] 0.4.0 update deps --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 22aa6b2..8547cb4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -571,7 +571,7 @@ dependencies = [ [[package]] name = "strafesnet_deferred_loader" -version = "0.3.4" +version = "0.4.0" dependencies = [ "strafesnet_common", "url", diff --git a/Cargo.toml b/Cargo.toml index b060d91..4cc6a0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strafesnet_deferred_loader" -version = "0.3.4" +version = "0.4.0" edition = "2021" repository = "https://git.itzana.me/StrafesNET/deferred_loader" license = "MIT OR Apache-2.0" From a6485263841115cbc1044a312a6b4a8642bbb72a Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 3 Oct 2024 14:37:16 -0700 Subject: [PATCH 34/36] include input string with every error --- src/rbxassetid.rs | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/rbxassetid.rs b/src/rbxassetid.rs index 53eb682..2cf43d7 100644 --- a/src/rbxassetid.rs +++ b/src/rbxassetid.rs @@ -2,34 +2,47 @@ pub struct RobloxAssetId(pub u64); #[derive(Debug)] #[allow(dead_code)] +pub struct StringWithError{ + string:String, + error:RobloxAssetIdParseErr, +} +impl std::fmt::Display for StringWithError{ + fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{ + write!(f,"{self:?}") + } +} +impl std::error::Error for StringWithError{} +impl StringWithError{ + const fn new( + string:String, + error:RobloxAssetIdParseErr, + )->Self{ + Self{string,error} + } +} +#[derive(Debug)] pub enum RobloxAssetIdParseErr{ Url(url::ParseError), - UnknownScheme(String), + UnknownScheme, ParseInt(std::num::ParseIntError), - MissingAssetId(String), + MissingAssetId, } impl std::str::FromStr for RobloxAssetId{ - type Err=RobloxAssetIdParseErr; + type Err=StringWithError; fn from_str(s:&str)->Result{ - let url=url::Url::parse(s).map_err(RobloxAssetIdParseErr::Url)?; + let url=url::Url::parse(s).map_err(|e|StringWithError::new(s.to_owned(),RobloxAssetIdParseErr::Url(e)))?; let parsed_asset_id=match url.scheme(){ - "rbxassetid"=>url.domain().ok_or_else(||RobloxAssetIdParseErr::MissingAssetId(s.to_owned()))?.parse(), + "rbxassetid"=>url.domain().ok_or_else(||StringWithError::new(s.to_owned(),RobloxAssetIdParseErr::MissingAssetId))?.parse(), "http"|"https"=>{ let (_,asset_id)=url.query_pairs() .find(|(id,_)|match id.as_ref(){ "ID"|"id"|"Id"|"iD"=>true, _=>false, - }).ok_or_else(||RobloxAssetIdParseErr::MissingAssetId(s.to_owned()))?; + }).ok_or_else(||StringWithError::new(s.to_owned(),RobloxAssetIdParseErr::MissingAssetId))?; asset_id.parse() }, - _=>Err(RobloxAssetIdParseErr::UnknownScheme(s.to_owned()))?, + _=>Err(StringWithError::new(s.to_owned(),RobloxAssetIdParseErr::UnknownScheme))?, }; - Ok(Self(parsed_asset_id.map_err(RobloxAssetIdParseErr::ParseInt)?)) + Ok(Self(parsed_asset_id.map_err(|e|StringWithError::new(s.to_owned(),RobloxAssetIdParseErr::ParseInt(e)))?)) } } -impl std::fmt::Display for RobloxAssetIdParseErr{ - fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{ - write!(f,"{self:?}") - } -} -impl std::error::Error for RobloxAssetIdParseErr{} From a8d439f3430d700dc0e14b1833d07289c9645f2d Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 3 Oct 2024 14:39:10 -0700 Subject: [PATCH 35/36] v0.4.1 improve rbxassetid error --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8547cb4..cc09efd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -571,7 +571,7 @@ dependencies = [ [[package]] name = "strafesnet_deferred_loader" -version = "0.4.0" +version = "0.4.1" dependencies = [ "strafesnet_common", "url", diff --git a/Cargo.toml b/Cargo.toml index 4cc6a0d..a9939f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strafesnet_deferred_loader" -version = "0.4.0" +version = "0.4.1" edition = "2021" repository = "https://git.itzana.me/StrafesNET/deferred_loader" license = "MIT OR Apache-2.0" From 0ee333cb7139660eab31964cb50b782523ae3947 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 2 Jan 2025 19:48:20 -0800 Subject: [PATCH 36/36] deferred_loader: move into folder --- .gitignore => lib/deferred_loader/.gitignore | 0 Cargo.lock => lib/deferred_loader/Cargo.lock | 0 Cargo.toml => lib/deferred_loader/Cargo.toml | 0 LICENSE-APACHE => lib/deferred_loader/LICENSE-APACHE | 0 LICENSE-MIT => lib/deferred_loader/LICENSE-MIT | 0 README.md => lib/deferred_loader/README.md | 0 {src => lib/deferred_loader/src}/lib.rs | 0 {src => lib/deferred_loader/src}/rbxassetid.rs | 0 {src => lib/deferred_loader/src}/roblox.rs | 0 {src => lib/deferred_loader/src}/roblox_legacy.rs | 0 {src => lib/deferred_loader/src}/roblox_mesh.rs | 0 {src => lib/deferred_loader/src}/source_legacy.rs | 0 {src => lib/deferred_loader/src}/texture.rs | 0 {src => lib/deferred_loader/src}/valve_mesh.rs | 0 14 files changed, 0 insertions(+), 0 deletions(-) rename .gitignore => lib/deferred_loader/.gitignore (100%) rename Cargo.lock => lib/deferred_loader/Cargo.lock (100%) rename Cargo.toml => lib/deferred_loader/Cargo.toml (100%) rename LICENSE-APACHE => lib/deferred_loader/LICENSE-APACHE (100%) rename LICENSE-MIT => lib/deferred_loader/LICENSE-MIT (100%) rename README.md => lib/deferred_loader/README.md (100%) rename {src => lib/deferred_loader/src}/lib.rs (100%) rename {src => lib/deferred_loader/src}/rbxassetid.rs (100%) rename {src => lib/deferred_loader/src}/roblox.rs (100%) rename {src => lib/deferred_loader/src}/roblox_legacy.rs (100%) rename {src => lib/deferred_loader/src}/roblox_mesh.rs (100%) rename {src => lib/deferred_loader/src}/source_legacy.rs (100%) rename {src => lib/deferred_loader/src}/texture.rs (100%) rename {src => lib/deferred_loader/src}/valve_mesh.rs (100%) diff --git a/.gitignore b/lib/deferred_loader/.gitignore similarity index 100% rename from .gitignore rename to lib/deferred_loader/.gitignore diff --git a/Cargo.lock b/lib/deferred_loader/Cargo.lock similarity index 100% rename from Cargo.lock rename to lib/deferred_loader/Cargo.lock diff --git a/Cargo.toml b/lib/deferred_loader/Cargo.toml similarity index 100% rename from Cargo.toml rename to lib/deferred_loader/Cargo.toml diff --git a/LICENSE-APACHE b/lib/deferred_loader/LICENSE-APACHE similarity index 100% rename from LICENSE-APACHE rename to lib/deferred_loader/LICENSE-APACHE diff --git a/LICENSE-MIT b/lib/deferred_loader/LICENSE-MIT similarity index 100% rename from LICENSE-MIT rename to lib/deferred_loader/LICENSE-MIT diff --git a/README.md b/lib/deferred_loader/README.md similarity index 100% rename from README.md rename to lib/deferred_loader/README.md diff --git a/src/lib.rs b/lib/deferred_loader/src/lib.rs similarity index 100% rename from src/lib.rs rename to lib/deferred_loader/src/lib.rs diff --git a/src/rbxassetid.rs b/lib/deferred_loader/src/rbxassetid.rs similarity index 100% rename from src/rbxassetid.rs rename to lib/deferred_loader/src/rbxassetid.rs diff --git a/src/roblox.rs b/lib/deferred_loader/src/roblox.rs similarity index 100% rename from src/roblox.rs rename to lib/deferred_loader/src/roblox.rs diff --git a/src/roblox_legacy.rs b/lib/deferred_loader/src/roblox_legacy.rs similarity index 100% rename from src/roblox_legacy.rs rename to lib/deferred_loader/src/roblox_legacy.rs diff --git a/src/roblox_mesh.rs b/lib/deferred_loader/src/roblox_mesh.rs similarity index 100% rename from src/roblox_mesh.rs rename to lib/deferred_loader/src/roblox_mesh.rs diff --git a/src/source_legacy.rs b/lib/deferred_loader/src/source_legacy.rs similarity index 100% rename from src/source_legacy.rs rename to lib/deferred_loader/src/source_legacy.rs diff --git a/src/texture.rs b/lib/deferred_loader/src/texture.rs similarity index 100% rename from src/texture.rs rename to lib/deferred_loader/src/texture.rs diff --git a/src/valve_mesh.rs b/lib/deferred_loader/src/valve_mesh.rs similarity index 100% rename from src/valve_mesh.rs rename to lib/deferred_loader/src/valve_mesh.rs