From dcad5fc8ec459cafe03e774b34e3012a38a924c2 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 30 Sep 2024 10:49:29 -0700 Subject: [PATCH] update common --- Cargo.lock | 119 ++++++++++++++++++++++++++++++++-------------- Cargo.toml | 2 +- src/mesh.rs | 8 ++-- src/primitives.rs | 50 +++++++++---------- src/rbx.rs | 36 +++++++------- 5 files changed, 131 insertions(+), 84 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 30e739d..c3e40d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,9 +31,9 @@ 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 = "base64" @@ -90,6 +90,12 @@ dependencies = [ "constant_time_eq", ] +[[package]] +name = "bnum" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50202def95bf36cb7d1d7a7962cea1c36a3f8ad42425e5d2b71d7acb8041b5b8" + [[package]] name = "bstr" version = "1.10.0" @@ -114,9 +120,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cc" -version = "1.1.19" +version = "1.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d74707dde2ba56f86ae90effb3b43ddd369504387e718014de010cec7959800" +checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938" dependencies = [ "shlex", ] @@ -139,6 +145,18 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +[[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 = "getrandom" version = "0.2.15" @@ -164,7 +182,7 @@ checksum = "2337e7a6c273082b672e377e159d7a168fb51438461b7c4033c79a515dd7a25a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -187,7 +205,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -198,9 +216,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libloading" @@ -212,6 +230,17 @@ dependencies = [ "windows-targets", ] +[[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 = "log" version = "0.4.22" @@ -229,18 +258,18 @@ dependencies = [ [[package]] name = "lz4" -version = "1.27.0" +version = "1.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a231296ca742e418c43660cb68e082486ff2538e8db432bc818580f3965025ed" +checksum = "4d1febb2b4a79ddd1980eede06a8f7902197960aa0383ffcfdd62fe723036725" dependencies = [ "lz4-sys", ] [[package]] name = "lz4-sys" -version = "1.11.0" +version = "1.11.1+lz4-1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb44a01837a858d47e5a630d2ccf304c8efcc4b83b8f9f75b7a9ee4fcc6e57d" +checksum = "6bd8c0d6c6ed0cd30b3652886bb8711dc4bb01d637a68105a3d5158039b418e6" dependencies = [ "cc", "libc", @@ -289,9 +318,12 @@ dependencies = [ [[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" @@ -307,9 +339,15 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" + +[[package]] +name = "portable-atomic" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" [[package]] name = "ppv-lite86" @@ -345,7 +383,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd" dependencies = [ "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -387,6 +425,12 @@ dependencies = [ "getrandom", ] +[[package]] +name = "ratio_ops" +version = "0.1.0" +source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" +checksum = "01239195d6afe0509e7e3511b716c0540251dfe7ece0a9a5a27116afb766c42c" + [[package]] name = "rbx_binary" version = "0.7.4" @@ -476,9 +520,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ "aho-corasick", "memchr", @@ -488,9 +532,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", @@ -499,9 +543,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rmp" @@ -527,9 +571,9 @@ dependencies = [ [[package]] name = "roblox_emulator" -version = "0.2.1" +version = "0.2.2" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "1e58c0b42dbe1d5b91439131e108a8ded2d2b1613ebb2718149d84e0a4a6bfb8" +checksum = "1f084d8b843fd96371cca381799313c9b3d0634d2da23ac0c6334bdaf0a2225e" dependencies = [ "glam", "mlua", @@ -562,7 +606,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -573,14 +617,17 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "strafesnet_common" -version = "0.4.1" +version = "0.5.1" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "9a2621612e675a8f804abbbbe3b60caeafe58a2422cccbe453268d6f457df4f3" +checksum = "eaf0b69648e1b6b61b6f05868a5fc5496bc90b0586cfc69533b5cd7a3c006f86" dependencies = [ "arrayvec", "bitflags 2.6.0", + "fixed_wide", "glam", "id", + "linear_ops", + "ratio_ops", ] [[package]] @@ -612,9 +659,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.77" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -623,22 +670,22 @@ dependencies = [ [[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.77", + "syn 2.0.79", ] [[package]] @@ -741,5 +788,5 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] diff --git a/Cargo.toml b/Cargo.toml index 64e01f7..ff23049 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,4 +19,4 @@ rbx_mesh = "0.1.2" rbx_reflection_database = { version = "0.2.10", registry = "strafesnet" } rbx_xml = { version = "0.13.3", registry = "strafesnet" } roblox_emulator = { version = "0.2.1", registry = "strafesnet" } -strafesnet_common = { version = "0.4.0", registry = "strafesnet" } +strafesnet_common = { version = "0.5.1", registry = "strafesnet" } diff --git a/src/mesh.rs b/src/mesh.rs index 3215118..ae5d161 100644 --- a/src/mesh.rs +++ b/src/mesh.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use rbx_mesh::mesh::{Vertex2, Vertex2Truncated}; -use strafesnet_common::{integer::Planar64Vec3,model::{self, ColorId, IndexedVertex, NormalId, PolygonGroup, PolygonList, PositionId, TextureCoordinateId, VertexId}}; +use strafesnet_common::{integer::vec3,model::{self, ColorId, IndexedVertex, NormalId, PolygonGroup, PolygonList, PositionId, TextureCoordinateId, VertexId}}; #[derive(Debug)] pub enum Error{ @@ -108,7 +108,7 @@ pub fn convert(roblox_mesh_bytes:crate::data::RobloxMeshBytes)->ResultResultResultMesh{ unit_cube(render) diff --git a/src/rbx.rs b/src/rbx.rs index 46b5476..0535724 100644 --- a/src/rbx.rs +++ b/src/rbx.rs @@ -5,7 +5,7 @@ use strafesnet_common::model; use strafesnet_common::gameplay_modes; use strafesnet_common::gameplay_style; use strafesnet_common::gameplay_attributes as attr; -use strafesnet_common::integer::{Planar64,Planar64Vec3,Planar64Mat3,Planar64Affine3}; +use strafesnet_common::integer::{self,vec3,Planar64,Planar64Vec3,Planar64Mat3,Planar64Affine3}; use strafesnet_common::model::RenderConfigId; use strafesnet_common::updatable::Updatable; @@ -36,15 +36,15 @@ fn recursive_collect_superclass(objects: &mut std::vec::VecPlanar64Affine3{ Planar64Affine3::new( - Planar64Mat3::from_cols( - Planar64Vec3::try_from([cf.orientation.x.x,cf.orientation.y.x,cf.orientation.z.x]).unwrap() - *Planar64::try_from(size.x/2.0).unwrap(), - Planar64Vec3::try_from([cf.orientation.x.y,cf.orientation.y.y,cf.orientation.z.y]).unwrap() - *Planar64::try_from(size.y/2.0).unwrap(), - Planar64Vec3::try_from([cf.orientation.x.z,cf.orientation.y.z,cf.orientation.z.z]).unwrap() - *Planar64::try_from(size.z/2.0).unwrap(), - ), - Planar64Vec3::try_from([cf.position.x,cf.position.y,cf.position.z]).unwrap() + Planar64Mat3::from_cols([ + vec3::try_from_f32_array([cf.orientation.x.x,cf.orientation.y.x,cf.orientation.z.x]).unwrap() + *integer::try_from_f32(size.x/2.0).unwrap(), + vec3::try_from_f32_array([cf.orientation.x.y,cf.orientation.y.y,cf.orientation.z.y]).unwrap() + *integer::try_from_f32(size.y/2.0).unwrap(), + vec3::try_from_f32_array([cf.orientation.x.z,cf.orientation.y.z,cf.orientation.z.z]).unwrap() + *integer::try_from_f32(size.z/2.0).unwrap(), + ].map(|t|t.fix_1())), + vec3::try_from_f32_array([cf.position.x,cf.position.y,cf.position.z]).unwrap() ) } struct ModeBuilder{ @@ -317,7 +317,7 @@ fn get_attributes(name:&str,can_collide:bool,velocity:Planar64Vec3,model_id:mode } } //need some way to skip this - if velocity!=Planar64Vec3::ZERO{ + if velocity!=vec3::ZERO{ general.booster=Some(attr::Booster::Velocity(velocity)); } match force_can_collide{ @@ -473,7 +473,7 @@ where { let model_transform=planar64_affine3_from_roblox(cf,size); - if model_transform.matrix3.determinant()==Planar64::ZERO{ + if model_transform.matrix3.det().is_zero(){ let mut parent_ref=object.parent(); let mut full_path=object.name.clone(); while let Some(parent)=dom.get_by_ref(parent_ref){ @@ -708,7 +708,7 @@ where deferred_attributes:GetAttributesArgs{ name:object.name.as_str().into(), can_collide:*can_collide, - velocity:Planar64Vec3::try_from([velocity.x,velocity.y,velocity.z]).unwrap(), + velocity:vec3::try_from_f32_array([velocity.x,velocity.y,velocity.z]).unwrap(), }, }; match availability{ @@ -806,11 +806,11 @@ impl PartialMap1{ deferred_attributes:deferred_model_deferred_attributes.model.deferred_attributes, color:deferred_model_deferred_attributes.model.color, transform:Planar64Affine3::new( - Planar64Mat3::from_cols( - deferred_model_deferred_attributes.model.transform.matrix3.x_axis*2/size.x(), - deferred_model_deferred_attributes.model.transform.matrix3.y_axis*2/size.y(), - deferred_model_deferred_attributes.model.transform.matrix3.z_axis*2/size.z() - ), + Planar64Mat3::from_cols([ + (deferred_model_deferred_attributes.model.transform.matrix3.x_axis*2/size.x).divide().fix_1(), + (deferred_model_deferred_attributes.model.transform.matrix3.y_axis*2/size.y).divide().fix_1(), + (deferred_model_deferred_attributes.model.transform.matrix3.z_axis*2/size.z).divide().fix_1() + ]), deferred_model_deferred_attributes.model.transform.translation ), })