Compare commits

..

21 Commits

Author SHA1 Message Date
4765a14641 lowest lod number is highest quality 2024-03-13 11:45:01 -07:00
0c5f47d1af calculate mesh size and plumb it through to compose with the transform 2024-03-13 11:44:45 -07:00
f4f9bb47a7 update common 2024-03-13 11:43:51 -07:00
7e0d402012 scale vertex color properly 2024-03-13 10:48:00 -07:00
28a47e2daf arrays end at #-1 2024-03-13 10:42:21 -07:00
5faac6b2b3 completely ignore meshes that fail to load 2024-03-12 22:35:47 -07:00
e4cd556f94 update deps 2024-03-12 22:28:18 -07:00
02c678359a oopsie 2024-03-12 22:27:52 -07:00
fe1313c70f holy smokes 2024-03-12 21:51:28 -07:00
1d20fb2c23 make ? visible (not offscreen LOL) 2024-03-12 21:18:38 -07:00
117546deeb complete mesh converter 2024-03-12 21:11:04 -07:00
c1062449b2 surely it needs to be a mutable reference to avoid copying the function 2024-03-12 20:40:25 -07:00
d50c15c187 implement Error trait 2024-03-12 20:40:02 -07:00
1b196dc831 hash by rbx_mesh VertexId2 2024-03-12 20:39:50 -07:00
9b131ee857 some uhh mesh stuff 2024-03-12 20:31:36 -07:00
3784f5aacf on a better track 2024-03-12 20:31:30 -07:00
b14d5a7e56 not quite right 2024-03-12 18:25:18 -07:00
f6d5972743 getting there 2024-03-12 18:08:44 -07:00
7dfb421016 insanity 2024-03-12 17:12:32 -07:00
118ce9b239 wip 2024-03-12 16:15:34 -07:00
a103a3c034 add rbx_mesh dep 2024-03-12 16:15:34 -07:00
7 changed files with 177 additions and 469 deletions

View File

@ -1,2 +0,0 @@
[registries.strafesnet]
index = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"

441
Cargo.lock generated
View File

@ -4,9 +4,9 @@ version = 3
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "1.1.3" version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@ -19,21 +19,21 @@ checksum = "3d62b7694a562cdf5a74227903507c56ab2cc8bdd1f781ed5cb4cf9c9f810bfc"
[[package]] [[package]]
name = "arrayref" name = "arrayref"
version = "0.3.9" version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545"
[[package]] [[package]]
name = "arrayvec" name = "arrayvec"
version = "0.7.6" version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.4.0" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]] [[package]]
name = "base64" name = "base64"
@ -43,9 +43,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]] [[package]]
name = "binrw" name = "binrw"
version = "0.14.0" version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f36b7cb3ab9ff6a2858650d8dc360e783a5d14dc29594db48c56a3c233cc265" checksum = "173901312e9850391d4d7c1318c4e099fdc037d61870fca427429830efdb4e5f"
dependencies = [ dependencies = [
"array-init", "array-init",
"binrw_derive", "binrw_derive",
@ -54,9 +54,9 @@ dependencies = [
[[package]] [[package]]
name = "binrw_derive" name = "binrw_derive"
version = "0.14.0" version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20ea7a8c5c8eeffffac6d54d172444e15beffac6f817fac714460a9a9aa88da3" checksum = "cb515fdd6f8d3a357c8e19b8ec59ef53880807864329b1cb1cba5c53bf76557e"
dependencies = [ dependencies = [
"either", "either",
"owo-colors", "owo-colors",
@ -73,15 +73,15 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "2.6.0" version = "2.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
[[package]] [[package]]
name = "blake3" name = "blake3"
version = "1.5.4" version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d82033247fd8e890df8f740e407ad4d038debb9eb1f40533fffb32e7d17dc6f7" checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87"
dependencies = [ dependencies = [
"arrayref", "arrayref",
"arrayvec", "arrayvec",
@ -90,27 +90,11 @@ dependencies = [
"constant_time_eq", "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"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c"
dependencies = [
"memchr",
"serde",
]
[[package]] [[package]]
name = "bytemuck" name = "bytemuck"
version = "1.18.0" version = "1.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f"
[[package]] [[package]]
name = "byteorder" name = "byteorder"
@ -120,12 +104,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.1.24" version = "1.0.88"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938" checksum = "02f341c093d19155a6e41631ce5971aac4e9a868262212153124c15fa22d1cdc"
dependencies = [
"shlex",
]
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
@ -135,33 +116,21 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "constant_time_eq" name = "constant_time_eq"
version = "0.3.1" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2"
[[package]] [[package]]
name = "either" name = "either"
version = "1.13.0" version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
[[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]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.15" version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
@ -170,26 +139,25 @@ dependencies = [
[[package]] [[package]]
name = "glam" name = "glam"
version = "0.29.0" version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c28091a37a5d09b555cb6628fd954da299b536433834f5b8e59eba78e0cbbf8a" checksum = "151665d9be52f9bb40fc7966565d39666f2d1e69233571b71b87791c7e0528b3"
[[package]] [[package]]
name = "id" name = "id"
version = "0.1.0" version = "0.1.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "git+https://git.itzana.me/Quaternions/id?rev=1f710976cc786c8853dab73d6e1cee53158deeb0#1f710976cc786c8853dab73d6e1cee53158deeb0"
checksum = "2337e7a6c273082b672e377e159d7a168fb51438461b7c4033c79a515dd7a25a"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.79", "syn 2.0.52",
] ]
[[package]] [[package]]
name = "lazy-regex" name = "lazy-regex"
version = "3.3.0" version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d8e41c97e6bc7ecb552016274b99fbb5d035e8de288c582d9b933af6677bfda" checksum = "5d12be4595afdf58bd19e4a9f4e24187da2a66700786ff660a418e9059937a4c"
dependencies = [ dependencies = [
"lazy-regex-proc_macros", "lazy-regex-proc_macros",
"once_cell", "once_cell",
@ -198,78 +166,49 @@ dependencies = [
[[package]] [[package]]
name = "lazy-regex-proc_macros" name = "lazy-regex-proc_macros"
version = "3.3.0" version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76e1d8b05d672c53cb9c7b920bbba8783845ae4f0b076e02a3db1d02c81b4163" checksum = "44bcd58e6c97a7fcbaffcdc95728b393b8d98933bfadad49ed4097845b57ef0b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"regex", "regex",
"syn 2.0.79", "syn 2.0.52",
] ]
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.5.0" version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.159" version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "libloading"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
dependencies = [
"cfg-if",
"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]] [[package]]
name = "log" name = "log"
version = "0.4.22" version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
[[package]]
name = "luau0-src"
version = "0.10.3+luau640"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f39d12b514a676c943990cfbe6200fedcb9c293c8c9219d29be512a6969be92"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "lz4" name = "lz4"
version = "1.28.0" version = "1.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d1febb2b4a79ddd1980eede06a8f7902197960aa0383ffcfdd62fe723036725" checksum = "7e9e2dd86df36ce760a60f6ff6ad526f7ba1f14ba0356f8254fb6905e6494df1"
dependencies = [ dependencies = [
"libc",
"lz4-sys", "lz4-sys",
] ]
[[package]] [[package]]
name = "lz4-sys" name = "lz4-sys"
version = "1.11.1+lz4-1.10.0" version = "1.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bd8c0d6c6ed0cd30b3652886bb8711dc4bb01d637a68105a3d5158039b418e6" checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
@ -277,53 +216,24 @@ dependencies = [
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.7.4" version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
[[package]]
name = "mlua"
version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d111deb18a9c9bd33e1541309f4742523bfab01d276bfa9a27519f6de9c11dc7"
dependencies = [
"bstr",
"libloading",
"mlua-sys",
"num-traits",
"once_cell",
"rustc-hash",
]
[[package]]
name = "mlua-sys"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebe026d6bd1583a9cf9080e189030ddaea7e6f5f0deb366a8e26f8a26c4135b8"
dependencies = [
"cc",
"cfg-if",
"luau0-src",
"pkg-config",
]
[[package]] [[package]]
name = "num-traits" name = "num-traits"
version = "0.2.19" version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
dependencies = [ dependencies = [
"autocfg", "autocfg",
] ]
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.20.1" version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
dependencies = [
"portable-atomic",
]
[[package]] [[package]]
name = "owo-colors" name = "owo-colors"
@ -333,36 +243,21 @@ checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
[[package]] [[package]]
name = "paste" name = "paste"
version = "1.0.15" version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
[[package]]
name = "pkg-config"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
[[package]]
name = "portable-atomic"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2"
[[package]] [[package]]
name = "ppv-lite86" name = "ppv-lite86"
version = "0.2.20" version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
dependencies = [
"zerocopy",
]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.86" version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@ -383,14 +278,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd" checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd"
dependencies = [ dependencies = [
"quote", "quote",
"syn 2.0.79", "syn 2.0.52",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.37" version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@ -425,17 +320,10 @@ dependencies = [
"getrandom", "getrandom",
] ]
[[package]]
name = "ratio_ops"
version = "0.1.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "01239195d6afe0509e7e3511b716c0540251dfe7ece0a9a5a27116afb766c42c"
[[package]] [[package]]
name = "rbx_binary" name = "rbx_binary"
version = "0.7.4" version = "0.7.4"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "git+https://github.com/krakow10/rbx-dom?rev=841643178680c9f3143422778f9c52f949b222b9#841643178680c9f3143422778f9c52f949b222b9"
checksum = "18b401155b93f7151217bf51e36bdfa7bddcaf5f0d26b563c9ac3b08a3701c27"
dependencies = [ dependencies = [
"log", "log",
"lz4", "lz4",
@ -448,9 +336,8 @@ dependencies = [
[[package]] [[package]]
name = "rbx_dom_weak" name = "rbx_dom_weak"
version = "2.9.0" version = "2.7.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "git+https://github.com/krakow10/rbx-dom?rev=841643178680c9f3143422778f9c52f949b222b9#841643178680c9f3143422778f9c52f949b222b9"
checksum = "2a6b916687c98aaea36f9c03e80906bfafab057bebee248628c8c04def807f43"
dependencies = [ dependencies = [
"rbx_types", "rbx_types",
"serde", "serde",
@ -458,9 +345,8 @@ dependencies = [
[[package]] [[package]]
name = "rbx_mesh" name = "rbx_mesh"
version = "0.1.2" version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/krakow10/rbx_mesh?rev=0e1c66d9acc7e1f2c187dd0899a9434d93ae0453#0e1c66d9acc7e1f2c187dd0899a9434d93ae0453"
checksum = "864ead0e98afce28c960f653d6203483834890d07f87b60e2f01415530a2fe9d"
dependencies = [ dependencies = [
"binrw", "binrw",
"lazy-regex", "lazy-regex",
@ -468,9 +354,8 @@ dependencies = [
[[package]] [[package]]
name = "rbx_reflection" name = "rbx_reflection"
version = "4.7.0" version = "4.5.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "git+https://github.com/krakow10/rbx-dom?rev=841643178680c9f3143422778f9c52f949b222b9#841643178680c9f3143422778f9c52f949b222b9"
checksum = "c1b43fe592a4ce6fe54eb215fb82735efbb516d2cc045a94e3dc0234ff293620"
dependencies = [ dependencies = [
"rbx_types", "rbx_types",
"serde", "serde",
@ -479,9 +364,8 @@ dependencies = [
[[package]] [[package]]
name = "rbx_reflection_database" name = "rbx_reflection_database"
version = "0.2.12+roblox-638" version = "0.2.10+roblox-607"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "git+https://github.com/krakow10/rbx-dom?rev=841643178680c9f3143422778f9c52f949b222b9#841643178680c9f3143422778f9c52f949b222b9"
checksum = "2e772bb9e1bc0ebe65d338f876d1bb1ea22e15a8f9a82e8245028010c2fea3c9"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"rbx_reflection", "rbx_reflection",
@ -491,9 +375,8 @@ dependencies = [
[[package]] [[package]]
name = "rbx_types" name = "rbx_types"
version = "1.10.0" version = "1.8.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "git+https://github.com/krakow10/rbx-dom?rev=841643178680c9f3143422778f9c52f949b222b9#841643178680c9f3143422778f9c52f949b222b9"
checksum = "d7a390c44034fa448c53bd0983dfc2d70d8d6b2f65be4f164d4bec8b6a2a2d09"
dependencies = [ dependencies = [
"base64", "base64",
"bitflags 1.3.2", "bitflags 1.3.2",
@ -507,8 +390,7 @@ dependencies = [
[[package]] [[package]]
name = "rbx_xml" name = "rbx_xml"
version = "0.13.3" version = "0.13.3"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "git+https://github.com/krakow10/rbx-dom?rev=841643178680c9f3143422778f9c52f949b222b9#841643178680c9f3143422778f9c52f949b222b9"
checksum = "d6d1a15f58a1e4b4f578abe6eb5e1461cb16eea82fb4a147d5995c9b79f08d1f"
dependencies = [ dependencies = [
"base64", "base64",
"log", "log",
@ -520,9 +402,9 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.11.0" version = "1.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@ -532,9 +414,9 @@ dependencies = [
[[package]] [[package]]
name = "regex-automata" name = "regex-automata"
version = "0.4.8" version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@ -543,15 +425,15 @@ dependencies = [
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.8.5" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]] [[package]]
name = "rmp" name = "rmp"
version = "0.8.14" version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "228ed7c16fa39782c3b3468e974aec2795e9089153cd08ee2e9aefb3613334c4" checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"num-traits", "num-traits",
@ -560,79 +442,48 @@ dependencies = [
[[package]] [[package]]
name = "rmp-serde" name = "rmp-serde"
version = "1.3.0" version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52e599a477cf9840e92f2cde9a7189e67b42c57532749bf90aea6ec10facd4db" checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"rmp", "rmp",
"serde", "serde",
] ]
[[package]]
name = "roblox_emulator"
version = "0.4.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "df647d25a9bc8871a838a830ae90776cd31c44d1a74268bd783d1cadcd8fcd93"
dependencies = [
"glam",
"mlua",
"rbx_dom_weak",
"rbx_reflection",
"rbx_reflection_database",
"rbx_types",
]
[[package]]
name = "rustc-hash"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.210" version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.210" version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.79", "syn 2.0.52",
] ]
[[package]]
name = "shlex"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]] [[package]]
name = "strafesnet_common" name = "strafesnet_common"
version = "0.5.2" version = "0.1.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "git+https://git.itzana.me/StrafesNET/common?rev=a9f3e61f2bb1074025b6cb466a5e3f2abc988c34#a9f3e61f2bb1074025b6cb466a5e3f2abc988c34"
checksum = "91cc1f3699bd8248da18bf5d11273264396a257b5d47b8558acb2cb4e1761219"
dependencies = [ dependencies = [
"arrayvec", "bitflags 2.4.2",
"bitflags 2.6.0",
"fixed_wide",
"glam", "glam",
"id", "id",
"linear_ops",
"ratio_ops",
] ]
[[package]] [[package]]
name = "strafesnet_rbx_loader" name = "strafesnet_rbx_loader"
version = "0.5.2" version = "0.2.0"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"glam", "glam",
@ -642,7 +493,6 @@ dependencies = [
"rbx_mesh", "rbx_mesh",
"rbx_reflection_database", "rbx_reflection_database",
"rbx_xml", "rbx_xml",
"roblox_emulator",
"strafesnet_common", "strafesnet_common",
] ]
@ -659,9 +509,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.79" version = "2.0.52"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -670,29 +520,29 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.64" version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.64" version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.79", "syn 2.0.52",
] ]
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.13" version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]] [[package]]
name = "wasi" name = "wasi"
@ -700,93 +550,8 @@ version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]] [[package]]
name = "xml-rs" name = "xml-rs"
version = "0.8.22" version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af4e2e2f7cba5a093896c1e150fbfe177d1883e7448200efb81d40b9d339ef26" checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a"
[[package]]
name = "zerocopy"
version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
dependencies = [
"byteorder",
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.79",
]

View File

@ -1,22 +1,17 @@
[package] [package]
name = "strafesnet_rbx_loader" name = "strafesnet_rbx_loader"
version = "0.5.2" version = "0.2.0"
edition = "2021" edition = "2021"
repository = "https://git.itzana.me/StrafesNET/rbx_loader"
license = "MIT OR Apache-2.0"
description = "Convert Roblox place and model files to StrafesNET data structures."
authors = ["Rhys Lloyd <krakow20@gmail.com>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
bytemuck = "1.14.3" glam = "0.25.0"
glam = "0.29.0"
lazy-regex = "3.1.0" lazy-regex = "3.1.0"
rbx_binary = { version = "0.7.4", registry = "strafesnet" } rbx_binary = { git = "https://github.com/krakow10/rbx-dom", rev = "841643178680c9f3143422778f9c52f949b222b9" }
rbx_dom_weak = { version = "2.7.0", registry = "strafesnet" } rbx_dom_weak = { git = "https://github.com/krakow10/rbx-dom", rev = "841643178680c9f3143422778f9c52f949b222b9" }
rbx_mesh = "0.1.2" rbx_reflection_database = { git = "https://github.com/krakow10/rbx-dom", rev = "841643178680c9f3143422778f9c52f949b222b9" }
rbx_reflection_database = { version = "0.2.10", registry = "strafesnet" } rbx_xml = { git = "https://github.com/krakow10/rbx-dom", rev = "841643178680c9f3143422778f9c52f949b222b9" }
rbx_xml = { version = "0.13.3", registry = "strafesnet" } rbx_mesh = { git = "https://github.com/krakow10/rbx_mesh", rev = "0e1c66d9acc7e1f2c187dd0899a9434d93ae0453" }
roblox_emulator = { version = "0.4.0", registry = "strafesnet" } strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "a9f3e61f2bb1074025b6cb466a5e3f2abc988c34" }
strafesnet_common = { version = "0.5.1", registry = "strafesnet" } bytemuck = "1.14.3"

View File

@ -1,5 +1,4 @@
use std::io::Read; use std::io::Read;
use rbx_dom_weak::WeakDom;
mod rbx; mod rbx;
mod mesh; mod mesh;
@ -17,56 +16,7 @@ pub mod data{
} }
} }
pub struct Model{ pub struct Dom(rbx_dom_weak::WeakDom);
dom:WeakDom,
}
impl Model{
fn new(dom:WeakDom)->Self{
Self{dom}
}
pub fn into_place(self)->Place{
let Self{mut dom}=self;
let context=roblox_emulator::context::Context::from_mut(&mut dom);
let services=context.convert_into_place();
Place{dom,services}
}
}
impl AsRef<WeakDom> for Model{
fn as_ref(&self)->&WeakDom{
&self.dom
}
}
pub struct Place{
dom:WeakDom,
services:roblox_emulator::context::Services,
}
impl Place{
fn new(dom:WeakDom)->Option<Self>{
let context=roblox_emulator::context::Context::from_ref(&dom);
Some(Self{
services:context.find_services()?,
dom,
})
}
pub fn run_scripts(&mut self){
let Place{dom,services}=self;
let runner=roblox_emulator::runner::Runner::new().unwrap();
let context=roblox_emulator::context::Context::from_mut(dom);
let scripts=context.scripts();
let runnable=runner.runnable_context_with_services(context,services).unwrap();
for script in scripts{
if let Err(e)=runnable.run_script(script){
println!("runner error: {e}");
}
}
}
}
impl AsRef<WeakDom> for Place{
fn as_ref(&self)->&WeakDom{
&self.dom
}
}
#[derive(Debug)] #[derive(Debug)]
pub enum ReadError{ pub enum ReadError{
@ -82,12 +32,12 @@ impl std::fmt::Display for ReadError{
} }
impl std::error::Error for ReadError{} impl std::error::Error for ReadError{}
pub fn read<R:Read>(input:R)->Result<Model,ReadError>{ pub fn read<R:Read>(input:R)->Result<Dom,ReadError>{
let mut buf=std::io::BufReader::new(input); let mut buf=std::io::BufReader::new(input);
let peek=std::io::BufRead::fill_buf(&mut buf).map_err(ReadError::Io)?; let peek=std::io::BufRead::fill_buf(&mut buf).map_err(ReadError::Io)?;
match &peek[0..8]{ match &peek[0..8]{
b"<roblox!"=>rbx_binary::from_reader(buf).map(Model::new).map_err(ReadError::RbxBinary), b"<roblox!"=>rbx_binary::from_reader(buf).map(Dom).map_err(ReadError::RbxBinary),
b"<roblox "=>rbx_xml::from_reader_default(buf).map(Model::new).map_err(ReadError::RbxXml), b"<roblox "=>rbx_xml::from_reader_default(buf).map(Dom).map_err(ReadError::RbxXml),
_=>Err(ReadError::UnknownFileFormat), _=>Err(ReadError::UnknownFileFormat),
} }
} }
@ -95,7 +45,7 @@ pub fn read<R:Read>(input:R)->Result<Model,ReadError>{
//ConvertError //ConvertError
pub fn convert<AcquireRenderConfigId,AcquireMeshId>( pub fn convert<AcquireRenderConfigId,AcquireMeshId>(
dom:impl AsRef<WeakDom>, dom:&Dom,
acquire_render_config_id:AcquireRenderConfigId, acquire_render_config_id:AcquireRenderConfigId,
acquire_mesh_id:AcquireMeshId acquire_mesh_id:AcquireMeshId
)->rbx::PartialMap1 )->rbx::PartialMap1
@ -103,5 +53,5 @@ where
AcquireRenderConfigId:FnMut(Option<&str>)->strafesnet_common::model::RenderConfigId, AcquireRenderConfigId:FnMut(Option<&str>)->strafesnet_common::model::RenderConfigId,
AcquireMeshId:FnMut(&str)->strafesnet_common::model::MeshId, AcquireMeshId:FnMut(&str)->strafesnet_common::model::MeshId,
{ {
rbx::convert(&dom.as_ref(),acquire_render_config_id,acquire_mesh_id) rbx::convert(&dom.0,acquire_render_config_id,acquire_mesh_id)
} }

View File

@ -1,7 +1,7 @@
use std::collections::HashMap; use std::collections::HashMap;
use rbx_mesh::mesh::{Vertex2, Vertex2Truncated}; use rbx_mesh::mesh::{Vertex2, Vertex2Truncated};
use strafesnet_common::{integer::vec3,model::{self, ColorId, IndexedVertex, NormalId, PolygonGroup, PolygonList, PositionId, TextureCoordinateId, VertexId}}; use strafesnet_common::{integer::Planar64Vec3,model::{self, ColorId, IndexedVertex, NormalId, PolygonGroup, PolygonList, PositionId, TextureCoordinateId, VertexId}};
#[derive(Debug)] #[derive(Debug)]
pub enum Error{ pub enum Error{
@ -108,7 +108,7 @@ pub fn convert(roblox_mesh_bytes:crate::data::RobloxMeshBytes)->Result<model::Me
let mut vertex_id_from=HashMap::new(); let mut vertex_id_from=HashMap::new();
let mut polygon_groups=Vec::new(); let mut polygon_groups=Vec::new();
let mut acquire_pos_id=|pos|{ let mut acquire_pos_id=|pos|{
let p=vec3::try_from_f32_array(pos).map_err(Error::Planar64Vec3)?; let p=Planar64Vec3::try_from(pos).map_err(Error::Planar64Vec3)?;
Ok(PositionId::new(*pos_id_from.entry(p).or_insert_with(||{ Ok(PositionId::new(*pos_id_from.entry(p).or_insert_with(||{
let pos_id=unique_pos.len(); let pos_id=unique_pos.len();
unique_pos.push(p); unique_pos.push(p);
@ -124,7 +124,7 @@ pub fn convert(roblox_mesh_bytes:crate::data::RobloxMeshBytes)->Result<model::Me
}) as u32) }) as u32)
}; };
let mut acquire_normal_id=|normal|{ let mut acquire_normal_id=|normal|{
let n=vec3::try_from_f32_array(normal).map_err(Error::Planar64Vec3)?; let n=Planar64Vec3::try_from(normal).map_err(Error::Planar64Vec3)?;
Ok(NormalId::new(*normal_id_from.entry(n).or_insert_with(||{ Ok(NormalId::new(*normal_id_from.entry(n).or_insert_with(||{
let normal_id=unique_normal.len(); let normal_id=unique_normal.len();
unique_normal.push(n); unique_normal.push(n);
@ -207,4 +207,4 @@ pub fn convert(roblox_mesh_bytes:crate::data::RobloxMeshBytes)->Result<model::Me
graphics_groups:Vec::new(), graphics_groups:Vec::new(),
physics_groups:Vec::new(), physics_groups:Vec::new(),
}) })
} }

View File

@ -1,5 +1,5 @@
use strafesnet_common::model::{Color4,TextureCoordinate,Mesh,IndexedGraphicsGroup,IndexedPhysicsGroup,IndexedVertex,PolygonGroupId,PolygonGroup,PolygonList,IndexedVertexList,PositionId,TextureCoordinateId,NormalId,ColorId,VertexId,RenderConfigId}; use strafesnet_common::model::{Color4,TextureCoordinate,Mesh,IndexedGraphicsGroup,IndexedPhysicsGroup,IndexedVertex,PolygonGroupId,PolygonGroup,PolygonList,IndexedVertexList,PositionId,TextureCoordinateId,NormalId,ColorId,VertexId,RenderConfigId};
use strafesnet_common::integer::{vec3,Planar64Vec3}; use strafesnet_common::integer::Planar64Vec3;
#[derive(Debug)] #[derive(Debug)]
pub enum Primitives{ pub enum Primitives{
@ -25,22 +25,22 @@ const CUBE_DEFAULT_TEXTURE_COORDS:[TextureCoordinate;4]=[
TextureCoordinate::new(0.0,1.0), TextureCoordinate::new(0.0,1.0),
]; ];
const CUBE_DEFAULT_VERTICES:[Planar64Vec3;8]=[ const CUBE_DEFAULT_VERTICES:[Planar64Vec3;8]=[
vec3::int(-1,-1, 1),//0 left bottom back Planar64Vec3::int(-1,-1, 1),//0 left bottom back
vec3::int( 1,-1, 1),//1 right bottom back Planar64Vec3::int( 1,-1, 1),//1 right bottom back
vec3::int( 1, 1, 1),//2 right top back Planar64Vec3::int( 1, 1, 1),//2 right top back
vec3::int(-1, 1, 1),//3 left top back Planar64Vec3::int(-1, 1, 1),//3 left top back
vec3::int(-1, 1,-1),//4 left top front Planar64Vec3::int(-1, 1,-1),//4 left top front
vec3::int( 1, 1,-1),//5 right top front Planar64Vec3::int( 1, 1,-1),//5 right top front
vec3::int( 1,-1,-1),//6 right bottom front Planar64Vec3::int( 1,-1,-1),//6 right bottom front
vec3::int(-1,-1,-1),//7 left bottom front Planar64Vec3::int(-1,-1,-1),//7 left bottom front
]; ];
const CUBE_DEFAULT_NORMALS:[Planar64Vec3;6]=[ const CUBE_DEFAULT_NORMALS:[Planar64Vec3;6]=[
vec3::int( 1, 0, 0),//CubeFace::Right Planar64Vec3::int( 1, 0, 0),//CubeFace::Right
vec3::int( 0, 1, 0),//CubeFace::Top Planar64Vec3::int( 0, 1, 0),//CubeFace::Top
vec3::int( 0, 0, 1),//CubeFace::Back Planar64Vec3::int( 0, 0, 1),//CubeFace::Back
vec3::int(-1, 0, 0),//CubeFace::Left Planar64Vec3::int(-1, 0, 0),//CubeFace::Left
vec3::int( 0,-1, 0),//CubeFace::Bottom Planar64Vec3::int( 0,-1, 0),//CubeFace::Bottom
vec3::int( 0, 0,-1),//CubeFace::Front Planar64Vec3::int( 0, 0,-1),//CubeFace::Front
]; ];
const CUBE_DEFAULT_POLYS:[[[u32;3];4];6]=[ const CUBE_DEFAULT_POLYS:[[[u32;3];4];6]=[
// right (1, 0, 0) // right (1, 0, 0)
@ -96,11 +96,11 @@ pub enum WedgeFace{
Bottom, Bottom,
} }
const WEDGE_DEFAULT_NORMALS:[Planar64Vec3;5]=[ const WEDGE_DEFAULT_NORMALS:[Planar64Vec3;5]=[
vec3::int( 1, 0, 0),//Wedge::Right Planar64Vec3::int( 1, 0, 0),//Wedge::Right
vec3::int( 0, 1,-1),//Wedge::TopFront Planar64Vec3::int( 0, 1,-1),//Wedge::TopFront
vec3::int( 0, 0, 1),//Wedge::Back Planar64Vec3::int( 0, 0, 1),//Wedge::Back
vec3::int(-1, 0, 0),//Wedge::Left Planar64Vec3::int(-1, 0, 0),//Wedge::Left
vec3::int( 0,-1, 0),//Wedge::Bottom Planar64Vec3::int( 0,-1, 0),//Wedge::Bottom
]; ];
/* /*
local cornerWedgeVerticies = { local cornerWedgeVerticies = {
@ -120,11 +120,11 @@ pub enum CornerWedgeFace{
Front, Front,
} }
const CORNERWEDGE_DEFAULT_NORMALS:[Planar64Vec3;5]=[ const CORNERWEDGE_DEFAULT_NORMALS:[Planar64Vec3;5]=[
vec3::int( 1, 0, 0),//CornerWedge::Right Planar64Vec3::int( 1, 0, 0),//CornerWedge::Right
vec3::int( 0, 1, 1),//CornerWedge::BackTop Planar64Vec3::int( 0, 1, 1),//CornerWedge::BackTop
vec3::int(-1, 1, 0),//CornerWedge::LeftTop Planar64Vec3::int(-1, 1, 0),//CornerWedge::LeftTop
vec3::int( 0,-1, 0),//CornerWedge::Bottom Planar64Vec3::int( 0,-1, 0),//CornerWedge::Bottom
vec3::int( 0, 0,-1),//CornerWedge::Front Planar64Vec3::int( 0, 0,-1),//CornerWedge::Front
]; ];
pub fn unit_sphere(render:RenderConfigId)->Mesh{ pub fn unit_sphere(render:RenderConfigId)->Mesh{
unit_cube(render) unit_cube(render)

View File

@ -5,7 +5,7 @@ use strafesnet_common::model;
use strafesnet_common::gameplay_modes; use strafesnet_common::gameplay_modes;
use strafesnet_common::gameplay_style; use strafesnet_common::gameplay_style;
use strafesnet_common::gameplay_attributes as attr; use strafesnet_common::gameplay_attributes as attr;
use strafesnet_common::integer::{self,vec3,Planar64,Planar64Vec3,Planar64Mat3,Planar64Affine3}; use strafesnet_common::integer::{Planar64,Planar64Vec3,Planar64Mat3,Planar64Affine3};
use strafesnet_common::model::RenderConfigId; use strafesnet_common::model::RenderConfigId;
use strafesnet_common::updatable::Updatable; use strafesnet_common::updatable::Updatable;
@ -36,15 +36,15 @@ fn recursive_collect_superclass(objects: &mut std::vec::Vec<rbx_dom_weak::types:
} }
fn planar64_affine3_from_roblox(cf:&rbx_dom_weak::types::CFrame,size:&rbx_dom_weak::types::Vector3)->Planar64Affine3{ fn planar64_affine3_from_roblox(cf:&rbx_dom_weak::types::CFrame,size:&rbx_dom_weak::types::Vector3)->Planar64Affine3{
Planar64Affine3::new( Planar64Affine3::new(
Planar64Mat3::from_cols([ Planar64Mat3::from_cols(
vec3::try_from_f32_array([cf.orientation.x.x,cf.orientation.y.x,cf.orientation.z.x]).unwrap() Planar64Vec3::try_from([cf.orientation.x.x,cf.orientation.y.x,cf.orientation.z.x]).unwrap()
*integer::try_from_f32(size.x/2.0).unwrap(), *Planar64::try_from(size.x/2.0).unwrap(),
vec3::try_from_f32_array([cf.orientation.x.y,cf.orientation.y.y,cf.orientation.z.y]).unwrap() Planar64Vec3::try_from([cf.orientation.x.y,cf.orientation.y.y,cf.orientation.z.y]).unwrap()
*integer::try_from_f32(size.y/2.0).unwrap(), *Planar64::try_from(size.y/2.0).unwrap(),
vec3::try_from_f32_array([cf.orientation.x.z,cf.orientation.y.z,cf.orientation.z.z]).unwrap() Planar64Vec3::try_from([cf.orientation.x.z,cf.orientation.y.z,cf.orientation.z.z]).unwrap()
*integer::try_from_f32(size.z/2.0).unwrap(), *Planar64::try_from(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() Planar64Vec3::try_from([cf.position.x,cf.position.y,cf.position.z]).unwrap()
) )
} }
struct ModeBuilder{ struct ModeBuilder{
@ -63,7 +63,7 @@ impl ModesBuilder{
//collect modes and stages into contiguous arrays //collect modes and stages into contiguous arrays
let mut unique_modes:Vec<(gameplay_modes::ModeId,gameplay_modes::Mode)> let mut unique_modes:Vec<(gameplay_modes::ModeId,gameplay_modes::Mode)>
=self.modes.into_iter().collect(); =self.modes.into_iter().collect();
unique_modes.sort_by_key(|&(mode_id,_)|mode_id); unique_modes.sort_by(|a,b|a.0.cmp(&b.0));
let (mut modes,final_mode_id_from_builder_mode_id):(Vec<ModeBuilder>,HashMap<gameplay_modes::ModeId,gameplay_modes::ModeId>) let (mut modes,final_mode_id_from_builder_mode_id):(Vec<ModeBuilder>,HashMap<gameplay_modes::ModeId,gameplay_modes::ModeId>)
=unique_modes.into_iter().enumerate() =unique_modes.into_iter().enumerate()
.map(|(final_mode_id,(builder_mode_id,mut mode))|{ .map(|(final_mode_id,(builder_mode_id,mut mode))|{
@ -163,7 +163,7 @@ fn get_attributes(name:&str,can_collide:bool,velocity:Planar64Vec3,model_id:mode
force_intersecting=true; force_intersecting=true;
modes_builder.insert_mode( modes_builder.insert_mode(
gameplay_modes::ModeId::MAIN, gameplay_modes::ModeId::MAIN,
gameplay_modes::Mode::empty( gameplay_modes::Mode::new(
gameplay_style::StyleModifiers::roblox_bhop(), gameplay_style::StyleModifiers::roblox_bhop(),
model_id model_id
) )
@ -209,7 +209,7 @@ fn get_attributes(name:&str,can_collide:bool,velocity:Planar64Vec3,model_id:mode
force_intersecting=true; force_intersecting=true;
modes_builder.insert_mode( modes_builder.insert_mode(
gameplay_modes::ModeId::new(captures[2].parse::<u32>().unwrap()), gameplay_modes::ModeId::new(captures[2].parse::<u32>().unwrap()),
gameplay_modes::Mode::empty( gameplay_modes::Mode::new(
gameplay_style::StyleModifiers::roblox_bhop(), gameplay_style::StyleModifiers::roblox_bhop(),
model_id model_id
) )
@ -241,7 +241,7 @@ fn get_attributes(name:&str,can_collide:bool,velocity:Planar64Vec3,model_id:mode
modes_builder.insert_stage( modes_builder.insert_stage(
gameplay_modes::ModeId::MAIN, gameplay_modes::ModeId::MAIN,
stage_id, stage_id,
gameplay_modes::Stage::empty(model_id), gameplay_modes::Stage::new(model_id),
); );
//TODO: let denormalize handle this //TODO: let denormalize handle this
gameplay_modes::StageElementBehaviour::SpawnAt gameplay_modes::StageElementBehaviour::SpawnAt
@ -317,7 +317,7 @@ fn get_attributes(name:&str,can_collide:bool,velocity:Planar64Vec3,model_id:mode
} }
} }
//need some way to skip this //need some way to skip this
if velocity!=vec3::ZERO{ if velocity!=Planar64Vec3::ZERO{
general.booster=Some(attr::Booster::Velocity(velocity)); general.booster=Some(attr::Booster::Velocity(velocity));
} }
match force_can_collide{ match force_can_collide{
@ -328,13 +328,13 @@ fn get_attributes(name:&str,can_collide:bool,velocity:Planar64Vec3,model_id:mode
"Ladder"=>contacting.contact_behaviour=Some(attr::ContactingBehaviour::Ladder(attr::ContactingLadder{sticky:true})), "Ladder"=>contacting.contact_behaviour=Some(attr::ContactingBehaviour::Ladder(attr::ContactingLadder{sticky:true})),
_=>(), _=>(),
} }
attr::CollisionAttributes::Contact(attr::ContactAttributes{contacting,general}) attr::CollisionAttributes::Contact{contacting,general}
}, },
false=>if force_intersecting false=>if force_intersecting
||general.any() ||general.any()
||intersecting.any() ||intersecting.any()
{ {
attr::CollisionAttributes::Intersect(attr::IntersectAttributes{intersecting,general}) attr::CollisionAttributes::Intersect{intersecting,general}
}else{ }else{
attr::CollisionAttributes::Decoration attr::CollisionAttributes::Decoration
}, },
@ -473,7 +473,7 @@ where
{ {
let model_transform=planar64_affine3_from_roblox(cf,size); let model_transform=planar64_affine3_from_roblox(cf,size);
if model_transform.matrix3.det().is_zero(){ if model_transform.matrix3.determinant()==Planar64::ZERO{
let mut parent_ref=object.parent(); let mut parent_ref=object.parent();
let mut full_path=object.name.clone(); let mut full_path=object.name.clone();
while let Some(parent)=dom.get_by_ref(parent_ref){ while let Some(parent)=dom.get_by_ref(parent_ref){
@ -708,7 +708,7 @@ where
deferred_attributes:GetAttributesArgs{ deferred_attributes:GetAttributesArgs{
name:object.name.as_str().into(), name:object.name.as_str().into(),
can_collide:*can_collide, can_collide:*can_collide,
velocity:vec3::try_from_f32_array([velocity.x,velocity.y,velocity.z]).unwrap(), velocity:Planar64Vec3::try_from([velocity.x,velocity.y,velocity.z]).unwrap(),
}, },
}; };
match availability{ match availability{
@ -806,11 +806,11 @@ impl PartialMap1{
deferred_attributes:deferred_model_deferred_attributes.model.deferred_attributes, deferred_attributes:deferred_model_deferred_attributes.model.deferred_attributes,
color:deferred_model_deferred_attributes.model.color, color:deferred_model_deferred_attributes.model.color,
transform:Planar64Affine3::new( transform:Planar64Affine3::new(
Planar64Mat3::from_cols([ 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.x_axis*2/size.x(),
(deferred_model_deferred_attributes.model.transform.matrix3.y_axis*2/size.y).divide().fix_1(), deferred_model_deferred_attributes.model.transform.matrix3.y_axis*2/size.y(),
(deferred_model_deferred_attributes.model.transform.matrix3.z_axis*2/size.z).divide().fix_1() deferred_model_deferred_attributes.model.transform.matrix3.z_axis*2/size.z()
]), ),
deferred_model_deferred_attributes.model.transform.translation deferred_model_deferred_attributes.model.transform.translation
), ),
}) })
@ -840,14 +840,14 @@ impl PartialMap1{
if let Some(wormhole_id)=wormhole_in_model_to_id.get(&model_id){ if let Some(wormhole_id)=wormhole_in_model_to_id.get(&model_id){
if let Some(&wormhole_out_model_id)=wormhole_id_to_out_model.get(wormhole_id){ if let Some(&wormhole_out_model_id)=wormhole_id_to_out_model.get(wormhole_id){
match &mut model_owned_attributes.attributes{ match &mut model_owned_attributes.attributes{
attr::CollisionAttributes::Contact(attr::ContactAttributes{contacting:_,general}) attr::CollisionAttributes::Contact{contacting:_,general}
|attr::CollisionAttributes::Intersect(attr::IntersectAttributes{intersecting:_,general}) |attr::CollisionAttributes::Intersect{intersecting:_,general}
=>general.wormhole=Some(attr::Wormhole{destination_model:wormhole_out_model_id}), =>general.wormhole=Some(attr::Wormhole{destination_model:wormhole_out_model_id}),
attr::CollisionAttributes::Decoration=>println!("Not a wormhole"), attr::CollisionAttributes::Decoration=>println!("Not a wormhole"),
} }
} }
} }
//index the attributes //index the attributes
let attributes_id=if let Some(&attributes_id)=attributes_id_from_attributes.get(&model_owned_attributes.attributes){ let attributes_id=if let Some(&attributes_id)=attributes_id_from_attributes.get(&model_owned_attributes.attributes){
attributes_id attributes_id
@ -901,9 +901,9 @@ impl PartialMap2{
attributes:self.attributes, attributes:self.attributes,
meshes:self.meshes, meshes:self.meshes,
models:self.models, models:self.models,
//the roblox legacy texture thing always works //the roblox legacy texture thing always works
textures, textures,
render_configs, render_configs,
} }
} }
} }