diff --git a/Cargo.lock b/Cargo.lock index b3e0cba..d9fb567 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -44,6 +44,19 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +dependencies = [ + "cfg-if", + "getrandom", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "0.7.18" @@ -55,20 +68,23 @@ dependencies = [ [[package]] name = "android-activity" -version = "0.4.3" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64529721f27c2314ced0890ce45e469574a73e5e6fdd6e9da1860eb29285f5e0" +checksum = "052ad56e336bcc615a214bffbeca6c181ee9550acec193f0327e0b103b033a4d" dependencies = [ "android-properties", - "bitflags 1.3.2", + "bitflags 2.4.0", "cc", + "cesu8", + "jni", "jni-sys", "libc", "log", "ndk", "ndk-context", "ndk-sys", - "num_enum 0.6.1", + "num_enum", + "thiserror", ] [[package]] @@ -122,15 +138,27 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "as-raw-xcb-connection" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d5f312b0a56c5cdf967c0aeb67f6289603354951683bc97ddc595ab974ba9aa" + [[package]] name = "ash" version = "0.37.3+1.3.251" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39e9c3835d686b0a6084ab4234fcd1b07dbf6e4767dce60874b12356a25ecd4a" dependencies = [ - "libloading", + "libloading 0.7.3", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "atty" version = "0.2.14" @@ -214,21 +242,21 @@ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" [[package]] name = "block-sys" -version = "0.1.0-beta.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa55741ee90902547802152aaf3f8e5248aab7e21468089560d4c8840561146" +checksum = "2dd7cf50912cddc06dc5ea7c08c5e81c1b2c842a70d19def1848d54c586fed92" dependencies = [ "objc-sys", ] [[package]] name = "block2" -version = "0.2.0-alpha.6" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42" +checksum = "15b55663a85f33501257357e6421bb33e769d5c9ffb5ba0921c975a123e35e68" dependencies = [ "block-sys", - "objc2-encode", + "objc2", ] [[package]] @@ -254,7 +282,7 @@ checksum = "fdde5c9cd29ebd706ce1b35600920a33550e402fc998a2e53ad3b42c3c47a192" dependencies = [ "proc-macro2", "quote", - "syn 2.0.30", + "syn 2.0.32", ] [[package]] @@ -263,18 +291,36 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" + [[package]] name = "calloop" -version = "0.10.6" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e0d00eb1ea24371a97d2da6201c6747a633dc6dc1988ef503403b4c59504a8" +checksum = "7b50b5a44d59a98c55a9eeb518f39bf7499ba19fd98ee7d22618687f3f10adbf" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "log", - "nix 0.25.1", - "slotmap", + "polling", + "rustix", + "slab", "thiserror", - "vec_map", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" +dependencies = [ + "calloop", + "rustix", + "wayland-backend", + "wayland-client", ] [[package]] @@ -298,6 +344,12 @@ dependencies = [ "jobserver", ] +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + [[package]] name = "cfg-if" version = "1.0.0" @@ -327,16 +379,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642" [[package]] -name = "concept" -version = "0.1.0" +name = "combine" +version = "4.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" dependencies = [ - "fastrand 1.8.0", - "guppies", - "natura", - "regex", - "salvage", - "serde", - "serde_json", + "bytes", + "memchr", +] + +[[package]] +name = "concurrent-queue" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" +dependencies = [ + "crossbeam-utils", ] [[package]] @@ -377,14 +435,14 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "core-graphics" -version = "0.22.3" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" +checksum = "970a29baf4110c26fedbc7f82107d42c23f7e88e404c4577ed73fe99ff85a212" dependencies = [ "bitflags 1.3.2", "core-foundation", "core-graphics-types", - "foreign-types 0.3.2", + "foreign-types 0.5.0", "libc", ] @@ -409,6 +467,21 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "cursor-icon" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" + [[package]] name = "d3d12" version = "0.7.0" @@ -416,7 +489,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e16e44ab292b1dddfdaf7be62cfd8877df52f2f3fde5858d95bab606be259f20" dependencies = [ "bitflags 2.4.0", - "libloading", + "libloading 0.8.1", "winapi", ] @@ -447,7 +520,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading", + "libloading 0.8.1", ] [[package]] @@ -469,6 +542,22 @@ dependencies = [ "termcolor", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "euclid" version = "0.22.7" @@ -478,6 +567,20 @@ dependencies = [ "num-traits", ] +[[package]] +name = "experiment" +version = "0.1.0" +dependencies = [ + "fastrand 1.8.0", + "guppies", + "html-escape", + "natura", + "regex", + "salvage", + "serde", + "serde_json", +] + [[package]] name = "fastrand" version = "1.8.0" @@ -493,15 +596,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" -[[package]] -name = "fdeflate" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d329bdeac514ee06249dabc27877490f17f5d371ec693360768b838e19f3ae10" -dependencies = [ - "simd-adler32", -] - [[package]] name = "fixedbitset" version = "0.4.2" @@ -533,6 +627,18 @@ dependencies = [ "num-traits", ] +[[package]] +name = "flume" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "fontconfig-parser" version = "0.5.0" @@ -550,7 +656,7 @@ checksum = "122fa73a5566372f9df09768a16e8e3dad7ad18abe07835f1f0b71f84078ba4c" dependencies = [ "fontconfig-parser", "log", - "memmap2", + "memmap2 0.5.10", "ttf-parser 0.15.2", ] @@ -596,6 +702,28 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" +[[package]] +name = "futures-core" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" + +[[package]] +name = "futures-sink" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" + +[[package]] +name = "gethostname" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb65d4ba3173c56a500b555b532f72c42e8d1fe64962b518897f8959fae2c177" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "getrandom" version = "0.2.7" @@ -603,8 +731,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -613,6 +743,17 @@ version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + [[package]] name = "glam" version = "0.24.1" @@ -624,9 +765,9 @@ dependencies = [ [[package]] name = "glow" -version = "0.12.3" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca0fe580e4b60a8ab24a868bc08e2f03cbcb20d3d676601fa909386713333728" +checksum = "886c2a30b160c4c6fec8f987430c26b526b7988ca71f664e6a699ddf6f9601e4" dependencies = [ "js-sys", "slotmap", @@ -634,6 +775,15 @@ dependencies = [ "web-sys", ] +[[package]] +name = "glutin_wgl_sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8098adac955faa2d31079b65dc48841251f69efd3ac25477903fc424362ead" +dependencies = [ + "gl_generator", +] + [[package]] name = "gpu-alloc" version = "0.6.0" @@ -655,12 +805,13 @@ dependencies = [ [[package]] name = "gpu-allocator" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce95f9e2e11c2c6fadfce42b5af60005db06576f231f5c92550fdded43c423e8" +checksum = "40fe17c8a05d60c38c0a4e5a3c802f2f1ceb66b76c67d96ffb34bef0475a7fad" dependencies = [ "backtrace", "log", + "presser", "thiserror", "winapi", "windows", @@ -674,7 +825,7 @@ checksum = "0b0c02e1ba0bdb14e965058ca34e09c020f8e507a760df1121728e0aef68d57a" dependencies = [ "bitflags 1.3.2", "gpu-descriptor-types", - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -707,9 +858,15 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", ] +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" + [[package]] name = "hassle-rs" version = "0.10.0" @@ -719,7 +876,7 @@ dependencies = [ "bitflags 1.3.2", "com-rs", "libc", - "libloading", + "libloading 0.7.3", "thiserror", "widestring", "winapi", @@ -749,12 +906,32 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" +[[package]] +name = "html-escape" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d1ad449764d627e22bfd7cd5e8868264fc9236e07c752972b4080cd351cb476" +dependencies = [ + "utf8-width", +] + [[package]] name = "humantime" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "icrate" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d3aaff8a54577104bafdf686ff18565c3b6903ca5782a2026ef06e2c7aa319" +dependencies = [ + "block2", + "dispatch", + "objc2", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -768,7 +945,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", ] [[package]] @@ -778,9 +965,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", ] [[package]] @@ -789,6 +973,22 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", + "windows-sys 0.45.0", +] + [[package]] name = "jni-sys" version = "0.3.0" @@ -815,15 +1015,21 @@ dependencies = [ [[package]] name = "khronos-egl" -version = "4.1.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3" +checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" dependencies = [ "libc", - "libloading", + "libloading 0.8.1", "pkg-config", ] +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + [[package]] name = "kurbo" version = "0.8.3" @@ -838,7 +1044,7 @@ name = "layout" version = "0.1.0" dependencies = [ "android_logger", - "concept", + "experiment", "guppies", "log", "mobile-entry-point", @@ -859,9 +1065,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.148" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libloading" @@ -873,14 +1079,24 @@ dependencies = [ "winapi", ] +[[package]] +name = "libloading" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "life" version = "0.1.0" dependencies = [ "android_logger", "bytemuck", - "concept", "env_logger", + "experiment", "fastrand 2.0.0", "guppies", "log", @@ -889,12 +1105,18 @@ dependencies = [ "salvage", ] +[[package]] +name = "linux-raw-sys" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" + [[package]] name = "list" version = "0.1.0" dependencies = [ "android_logger", - "concept", + "experiment", "guppies", "log", "mobile-entry-point", @@ -1000,20 +1222,29 @@ dependencies = [ "libc", ] +[[package]] +name = "memmap2" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deaba38d7abf1d4cca21cc89e932e542ba2b9258664d2a9ef0e61512039c9375" +dependencies = [ + "libc", +] + [[package]] name = "memoffset" -version = "0.6.5" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" dependencies = [ "autocfg", ] [[package]] name = "metal" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "623b5e6cefd76e58f774bd3cc0c6f5c7615c58c03a97815245a25c3c9bdee318" +checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25" dependencies = [ "bitflags 2.4.0", "block", @@ -1048,28 +1279,6 @@ dependencies = [ "adler", ] -[[package]] -name = "miniz_oxide" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", - "simd-adler32", -] - -[[package]] -name = "mio" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.48.0", -] - [[package]] name = "mobile-entry-point" version = "0.1.1" @@ -1083,15 +1292,15 @@ dependencies = [ [[package]] name = "naga" -version = "0.13.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ceaaa4eedaece7e4ec08c55c640ba03dbb73fb812a6570a59bcf1930d0f70e" +checksum = "6cd05939c491da968a42986204b7431678be21fdcd4b10cc84997ba130ada5a4" dependencies = [ "bit-set", "bitflags 2.4.0", "codespan-reporting", "hexf-parse", - "indexmap", + "indexmap 2.1.0", "log", "num-traits", "petgraph", @@ -1102,6 +1311,15 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom", +] + [[package]] name = "natura" version = "0.1.0" @@ -1109,15 +1327,17 @@ source = "git+https://github.com/ziyasal/natura#15421c2dd9b55e2745ecd1c8d06d9ede [[package]] name = "ndk" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" +checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "jni-sys", + "log", "ndk-sys", - "num_enum 0.5.11", - "raw-window-handle", + "num_enum", + "raw-window-handle 0.5.2", + "raw-window-handle 0.6.0", "thiserror", ] @@ -1129,32 +1349,19 @@ checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" [[package]] name = "ndk-sys" -version = "0.4.1+23.1.7779620" +version = "0.5.0+25.2.9519653" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3" +checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" dependencies = [ "jni-sys", ] [[package]] name = "nix" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset", -] - -[[package]] -name = "nix" -version = "0.25.1" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" dependencies = [ - "autocfg", "bitflags 1.3.2", "cfg-if", "libc", @@ -1182,44 +1389,23 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" -dependencies = [ - "num_enum_derive 0.5.11", -] - -[[package]] -name = "num_enum" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" -dependencies = [ - "num_enum_derive 0.6.1", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.11" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +checksum = "683751d591e6d81200c39fb0d1032608b77724f34114db54f571ff1317b337c0" dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 1.0.99", + "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.6.1" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +checksum = "6c11e44798ad209ccdd91fc192f0526a369a01234f7373e1b141c96d7cee4f0e" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.30", + "syn 2.0.32", ] [[package]] @@ -1234,29 +1420,25 @@ dependencies = [ [[package]] name = "objc-sys" -version = "0.2.0-beta.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7" +checksum = "99e1d07c6eab1ce8b6382b8e3c7246fe117ff3f8b34be065f5ebace6749fe845" [[package]] name = "objc2" -version = "0.3.0-beta.3.patch-leaks.3" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e01640f9f2cb1220bbe80325e179e532cb3379ebcd1bf2279d703c19fe3a468" +checksum = "559c5a40fdd30eb5e344fbceacf7595a81e242529fb4e21cf5f43fb4f11ff98d" dependencies = [ - "block2", "objc-sys", "objc2-encode", ] [[package]] name = "objc2-encode" -version = "2.0.0-pre.2" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abfcac41015b00a120608fdaa6938c44cb983fee294351cc4bac7638b4e50512" -dependencies = [ - "objc-sys", -] +checksum = "d079845b37af429bfe5dfa76e6d087d788031045b25cfc6fd898486fd9847666" [[package]] name = "objc_exception" @@ -1342,7 +1524,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ "fixedbitset", - "indexmap", + "indexmap 1.9.3", ] [[package]] @@ -1357,6 +1539,12 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + [[package]] name = "pkg-config" version = "0.3.25" @@ -1364,16 +1552,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] -name = "png" -version = "0.17.10" +name = "polling" +version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd75bf2d8dd3702b9707cdbc56a5b9ef42cec752eb8b3bafc01234558442aa64" +checksum = "cf63fa624ab313c11656b4cda960bfc46c410187ad493c41f6ba2d8c1e991c9e" dependencies = [ - "bitflags 1.3.2", - "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide 0.7.1", + "cfg-if", + "concurrent-queue", + "pin-project-lite", + "rustix", + "tracing", + "windows-sys 0.52.0", ] [[package]] @@ -1382,6 +1571,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2" +[[package]] +name = "presser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" + [[package]] name = "proc-macro-crate" version = "1.2.1" @@ -1408,6 +1603,15 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f61dcf0b917cd75d4521d7343d1ffff3d1583054133c9b5cbea3375c703c40d" +[[package]] +name = "quick-xml" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" +dependencies = [ + "memchr", +] + [[package]] name = "quote" version = "1.0.33" @@ -1429,6 +1633,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" +[[package]] +name = "raw-window-handle" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544" + [[package]] name = "rctree" version = "0.4.0" @@ -1513,6 +1723,19 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustix" +version = "0.38.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a" +dependencies = [ + "bitflags 2.4.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + [[package]] name = "rustybuzz" version = "0.5.1" @@ -1552,6 +1775,15 @@ dependencies = [ "xmlwriter", ] +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "scoped-tls" version = "1.0.0" @@ -1566,13 +1798,13 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "sctk-adwaita" -version = "0.5.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda4e97be1fd174ccc2aae81c8b694e803fa99b34e8fd0f057a9d70698e3ed09" +checksum = "1729a30a469de249c6effc17ec8d039b0aa29b3af79b819b7f51cb6ab8046a90" dependencies = [ "ab_glyph", "log", - "memmap2", + "memmap2 0.9.0", "smithay-client-toolkit", "tiny-skia", ] @@ -1594,7 +1826,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.30", + "syn 2.0.32", ] [[package]] @@ -1608,12 +1840,6 @@ dependencies = [ "serde", ] -[[package]] -name = "simd-adler32" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" - [[package]] name = "simplecss" version = "0.2.1" @@ -1629,6 +1855,15 @@ version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "slotmap" version = "1.0.6" @@ -1646,21 +1881,45 @@ checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" [[package]] name = "smithay-client-toolkit" -version = "0.16.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" +checksum = "60e3d9941fa3bacf7c2bf4b065304faa14164151254cd16ce1b1bc8fc381600f" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "calloop", - "dlib", - "lazy_static", + "calloop-wayland-source", + "cursor-icon", + "libc", "log", - "memmap2", - "nix 0.24.3", - "pkg-config", + "memmap2 0.9.0", + "rustix", + "thiserror", + "wayland-backend", "wayland-client", + "wayland-csd-frame", "wayland-cursor", "wayland-protocols", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smol_str" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c" +dependencies = [ + "serde", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", ] [[package]] @@ -1707,9 +1966,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.30" +version = "2.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ddc1f908d32ec46858c2d3b3daa00cc35bf4b6841ce4355c7bb3eedf2283a68" +checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" dependencies = [ "proc-macro2", "quote", @@ -1761,23 +2020,23 @@ dependencies = [ [[package]] name = "tiny-skia" -version = "0.8.4" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8493a203431061e901613751931f047d1971337153f96d0e5e363d6dbf6a67" +checksum = "3b72a92a05db376db09fe6d50b7948d106011761c05a6a45e23e17ee9b556222" dependencies = [ "arrayref", "arrayvec", "bytemuck", "cfg-if", - "png", + "log", "tiny-skia-path", ] [[package]] name = "tiny-skia-path" -version = "0.8.4" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adbfb5d3f3dd57a0e11d12f4f13d4ebbbc1b5c15b7ab0a156d030b21da5f677c" +checksum = "6ac3865b9708fc7e1961a65c3a4fa55e984272f33092d3c859929f887fceb647" dependencies = [ "arrayref", "bytemuck", @@ -1793,6 +2052,22 @@ dependencies = [ "serde", ] +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" + [[package]] name = "ttf-parser" version = "0.15.2" @@ -1892,10 +2167,10 @@ dependencies = [ ] [[package]] -name = "vec_map" -version = "0.8.2" +name = "utf8-width" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +checksum = "5190c9442dcdaf0ddd50f37420417d219ae5261bbf5db120d0f9bab996c9cba1" [[package]] name = "version_check" @@ -1903,6 +2178,16 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "walkdir" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "walrus" version = "0.19.0" @@ -1956,7 +2241,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.30", + "syn 2.0.32", "wasm-bindgen-shared", ] @@ -2022,7 +2307,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.30", + "syn 2.0.32", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2083,75 +2368,111 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b35c86d22e720a07d954ebbed772d01180501afe7d03d464f413bb5f8914a8d6" [[package]] -name = "wayland-client" -version = "0.29.5" +name = "wayland-backend" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" +checksum = "19152ddd73f45f024ed4534d9ca2594e0ef252c1847695255dae47f34df9fbe4" dependencies = [ - "bitflags 1.3.2", + "cc", "downcast-rs", - "libc", - "nix 0.24.3", + "nix", "scoped-tls", - "wayland-commons", - "wayland-scanner", + "smallvec", "wayland-sys", ] [[package]] -name = "wayland-commons" -version = "0.29.5" +name = "wayland-client" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902" +checksum = "1ca7d52347346f5473bf2f56705f360e8440873052e575e55890c4fa57843ed3" dependencies = [ - "nix 0.24.3", - "once_cell", - "smallvec", - "wayland-sys", + "bitflags 2.4.0", + "nix", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-csd-frame" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" +dependencies = [ + "bitflags 2.4.0", + "cursor-icon", + "wayland-backend", ] [[package]] name = "wayland-cursor" -version = "0.29.5" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661" +checksum = "a44aa20ae986659d6c77d64d808a046996a932aa763913864dc40c359ef7ad5b" dependencies = [ - "nix 0.24.3", + "nix", "wayland-client", "xcursor", ] [[package]] name = "wayland-protocols" -version = "0.29.5" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" +checksum = "e253d7107ba913923dc253967f35e8561a3c65f914543e46843c88ddd729e21c" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-plasma" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479" +dependencies = [ + "bitflags 2.4.0", + "wayland-backend", "wayland-client", - "wayland-commons", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" +dependencies = [ + "bitflags 2.4.0", + "wayland-backend", + "wayland-client", + "wayland-protocols", "wayland-scanner", ] [[package]] name = "wayland-scanner" -version = "0.29.5" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" +checksum = "fb8e28403665c9f9513202b7e1ed71ec56fde5c107816843fb14057910b2c09c" dependencies = [ "proc-macro2", + "quick-xml", "quote", - "xml-rs", ] [[package]] name = "wayland-sys" -version = "0.29.5" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4" +checksum = "15a0c8eaff5216d07f226cb7a549159267f3467b289d9a2e52fd3ef5aae2b7af" dependencies = [ "dlib", - "lazy_static", + "log", + "once_cell", "pkg-config", ] @@ -2165,20 +2486,31 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57099a701fb3a8043f993e8228dc24229c7b942e2b009a1b962e54489ba1d3bf" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "wgpu" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7472f3b69449a8ae073f6ec41d05b6f846902d92a6c45313c50cb25857b736ce" +checksum = "30e7d227c9f961f2061c26f4cb0fbd4df0ef37e056edd0931783599d6c94ef24" dependencies = [ "arrayvec", "cfg-if", + "flume", "js-sys", "log", "naga", "parking_lot", "profiling", - "raw-window-handle", + "raw-window-handle 0.5.2", "smallvec", "static_assertions", "wasm-bindgen", @@ -2191,9 +2523,9 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "0.17.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecf7454d9386f602f7399225c92dd2fbdcde52c519bc8fb0bd6fbeb388075dc2" +checksum = "ef91c1d62d1e9e81c79e600131a258edf75c9531cbdbde09c44a011a47312726" dependencies = [ "arrayvec", "bit-vec", @@ -2203,7 +2535,7 @@ dependencies = [ "naga", "parking_lot", "profiling", - "raw-window-handle", + "raw-window-handle 0.5.2", "rustc-hash", "smallvec", "thiserror", @@ -2214,9 +2546,9 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "0.17.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6654a13885a17f475e8324efb46dc6986d7aaaa98353330f8de2077b153d0101" +checksum = "b84ecc802da3eb67b4cf3dd9ea6fe45bbb47ef13e6c49c5c3240868a9cc6cdd9" dependencies = [ "android_system_properties", "arrayvec", @@ -2227,6 +2559,7 @@ dependencies = [ "core-graphics-types", "d3d12", "glow", + "glutin_wgl_sys", "gpu-alloc", "gpu-allocator", "gpu-descriptor", @@ -2234,15 +2567,16 @@ dependencies = [ "js-sys", "khronos-egl", "libc", - "libloading", + "libloading 0.8.1", "log", "metal", "naga", "objc", + "once_cell", "parking_lot", "profiling", "range-alloc", - "raw-window-handle", + "raw-window-handle 0.5.2", "renderdoc-sys", "rustc-hash", "smallvec", @@ -2255,9 +2589,9 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee64d7398d0c2f9ca48922c902ef69c42d000c759f3db41e355f4a570b052b67" +checksum = "0d5ed5f0edf0de351fe311c53304986315ce866f394a2e6df0c4b3c70774bcdd" dependencies = [ "bitflags 2.4.0", "js-sys", @@ -2295,6 +2629,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "winapi-wsapoll" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -2303,11 +2646,21 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.44.0" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" +checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" dependencies = [ - "windows-targets 0.42.2", + "windows-core", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-core" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -2341,6 +2694,15 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", +] + [[package]] name = "windows-targets" version = "0.42.2" @@ -2371,6 +2733,21 @@ dependencies = [ "windows_x86_64_msvc 0.48.5", ] +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -2383,6 +2760,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.36.1" @@ -2401,6 +2784,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[package]] name = "windows_i686_gnu" version = "0.36.1" @@ -2419,6 +2808,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.36.1" @@ -2437,6 +2832,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[package]] name = "windows_x86_64_gnu" version = "0.36.1" @@ -2455,6 +2856,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -2467,6 +2874,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.36.1" @@ -2485,39 +2898,59 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + [[package]] name = "winit" -version = "0.28.6" +version = "0.29.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "866db3f712fffba75d31bf0cdecf357c8aeafd158c5b7ab51dba2a2b2d47f196" +checksum = "d25d662bb83b511acd839534bb2d88521b0bbc81440969cb077d23c4db9e62c7" dependencies = [ + "ahash 0.8.6", "android-activity", - "bitflags 1.3.2", + "atomic-waker", + "bitflags 2.4.0", + "bytemuck", + "calloop", "cfg_aliases", "core-foundation", "core-graphics", - "dispatch", - "instant", + "cursor-icon", + "icrate", + "js-sys", "libc", "log", - "mio", + "memmap2 0.9.0", "ndk", + "ndk-sys", "objc2", "once_cell", "orbclient", "percent-encoding", - "raw-window-handle", + "raw-window-handle 0.5.2", + "raw-window-handle 0.6.0", "redox_syscall 0.3.5", + "rustix", "sctk-adwaita", "smithay-client-toolkit", + "smol_str", + "unicode-segmentation", "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend", "wayland-client", - "wayland-commons", "wayland-protocols", - "wayland-scanner", + "wayland-protocols-plasma", "web-sys", - "windows-sys 0.45.0", + "web-time", + "windows-sys 0.48.0", "x11-dl", + "x11rb", + "xkbcommon-dl", ] [[package]] @@ -2531,6 +2964,32 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "x11rb" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1641b26d4dec61337c35a1b1aaf9e3cba8f46f0b43636c609ab0291a648040a" +dependencies = [ + "as-raw-xcb-connection", + "gethostname", + "libc", + "libloading 0.7.3", + "nix", + "once_cell", + "winapi", + "winapi-wsapoll", + "x11rb-protocol", +] + +[[package]] +name = "x11rb-protocol" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82d6c3f9a0fb6701fab8f6cea9b0c0bd5d6876f1f89f7fada07e558077c344bc" +dependencies = [ + "nix", +] + [[package]] name = "xcursor" version = "0.3.4" @@ -2540,6 +2999,25 @@ dependencies = [ "nom", ] +[[package]] +name = "xkbcommon-dl" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6924668544c48c0133152e7eec86d644a056ca3d09275eb8d5cdb9855f9d8699" +dependencies = [ + "bitflags 2.4.0", + "dlib", + "log", + "once_cell", + "xkeysym", +] + +[[package]] +name = "xkeysym" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "054a8e68b76250b253f671d1268cb7f1ae089ec35e195b2efb2a4e9a836d0621" + [[package]] name = "xml-rs" version = "0.8.18" @@ -2557,3 +3035,23 @@ name = "xmlwriter" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" + +[[package]] +name = "zerocopy" +version = "0.7.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d6f15f7ade05d2a4935e34a457b936c23dc70a05cc1d97133dc99e7a3fe0f0e" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbbad221e3f78500350ecbd7dfa4e63ef945c05f4c61cb7f4d3f84cd0bba649b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.32", +] diff --git a/Cargo.toml b/Cargo.toml index ee9e811..a48b221 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] resolver = "2" members = [ - "concept", + "experiment", "guppies", "salvage", "run-wasm", @@ -9,7 +9,6 @@ members = [ "examples/layout", "examples/list", ] -default-members = ["examples/layout"] [profile.release] lto = true diff --git a/README.md b/README.md index 2e824c0..29691f9 100644 --- a/README.md +++ b/README.md @@ -2,5 +2,8 @@ Using svg to generate dynamic vector graphics for GUI purpose +# Demo +`cargo run --bin layout` + # Status WIP: Don't look. It's a mess. diff --git a/concept/src/responsive/constraint.rs b/concept/src/responsive/constraint.rs deleted file mode 100644 index a155700..0000000 --- a/concept/src/responsive/constraint.rs +++ /dev/null @@ -1,199 +0,0 @@ -use guppies::glam::Mat4; -use serde::{Deserialize, Serialize}; -pub fn get_normalize_scale(display: Mat4) -> Mat4 { - // Y is flipped because the y axis is in different directions in GPU vs SVG - // doubling is necessary because GPU expectation left tip is -1 and right tip is at 1 - // so the width is 2, as opposed to 1 which is the standard used prior to this conversion. - // TODO: Why last doubling is necessary only god knows. - // I added it because it looked too small in comparison to figma's prototyping feature. - Mat4::from_scale([2., 2., 1.].into()) - * Mat4::from_scale([2., -2., 1.].into()) - * display.inverse() -} -#[derive(Debug, Clone, Copy, Serialize, Deserialize)] -pub enum XConstraint { - Left(f32), - Right(f32), - LeftAndRight { left: f32, right: f32 }, - Center(f32), //rightward_from_center - Scale, -} - -impl Default for XConstraint { - fn default() -> Self { - Self::LeftAndRight { - left: 0., - right: 0., - } - } -} - -impl XConstraint { - pub(crate) fn to_pre_post_transform( - self, - display: Mat4, - svg: Mat4, - bbox: Mat4, - ) -> (Mat4, Mat4) { - let (bbox_scale, _, bbox_translation) = bbox.to_scale_rotation_translation(); - let fill_x = Mat4::from_scale( - [ - display.to_scale_rotation_translation().0.x - / svg.to_scale_rotation_translation().0.x, - 1., - 1., - ] - .into(), - ); - let left_align = Mat4::from_translation([bbox_translation.x, 0.0, 0.0].into()).inverse(); - let right_align = - Mat4::from_translation([(bbox_translation.x + bbox_scale.x) as f32, 0.0, 0.0].into()) - .inverse(); - let center_x = Mat4::from_translation( - [(bbox_translation.x + bbox_scale.x / 2.) as f32, 0.0, 0.0].into(), - ) - .inverse(); - - let pre_scale_translate_x; - let pre_scale_scale_x; - let post_scale_translate_x; - match self { - XConstraint::Left(left) => { - pre_scale_translate_x = left_align * Mat4::from_translation([left, 0., 0.].into()); - pre_scale_scale_x = Mat4::IDENTITY; - post_scale_translate_x = Mat4::from_translation([-1.0, 0., 0.].into()); - } - XConstraint::Right(right) => { - pre_scale_translate_x = - right_align * Mat4::from_translation([right, 0., 0.].into()); - pre_scale_scale_x = Mat4::IDENTITY; - post_scale_translate_x = Mat4::from_translation([1.0, 0., 0.].into()); - } - XConstraint::Center(rightward_from_center) => { - pre_scale_translate_x = - center_x * Mat4::from_translation([rightward_from_center, 0., 0.].into()); - pre_scale_scale_x = Mat4::IDENTITY; - post_scale_translate_x = Mat4::IDENTITY; - } - XConstraint::LeftAndRight { left: _, right: _ } => { - todo!(); - } - XConstraint::Scale => { - pre_scale_translate_x = center_x; - pre_scale_scale_x = fill_x; - post_scale_translate_x = Mat4::IDENTITY; - } - }; - ( - pre_scale_scale_x * pre_scale_translate_x, - post_scale_translate_x, - ) - } -} - -#[derive(Debug, Clone, Copy, Serialize, Deserialize)] -pub enum YConstraint { - Top(f32), - Bottom(f32), - TopAndBottom { top: f32, bottom: f32 }, - Center(f32), //downward_from_center - Scale, -} - -impl Default for YConstraint { - fn default() -> Self { - Self::TopAndBottom { - top: 0., - bottom: 0., - } - } -} - -impl YConstraint { - pub(crate) fn to_pre_post_transform( - self, - display: Mat4, - svg: Mat4, - bbox: Mat4, - ) -> (Mat4, Mat4) { - let (bbox_scale, _, bbox_translation) = bbox.to_scale_rotation_translation(); - let fill_y = Mat4::from_scale( - [ - 1., - display.to_scale_rotation_translation().0.y - / svg.to_scale_rotation_translation().0.y, - 1., - ] - .into(), - ); - let top_align = - Mat4::from_translation([0.0, bbox_translation.y as f32, 0.0].into()).inverse(); - let bottom_align = - Mat4::from_translation([0.0, (bbox_translation.y + bbox_scale.y) as f32, 0.0].into()) - .inverse(); - let center_y = Mat4::from_translation( - [0.0, (bbox_translation.y + bbox_scale.y / 2.) as f32, 0.0].into(), - ) - .inverse(); - - let pre_scale_translate_y; - let pre_scale_scale_y; - let post_scale_translate_y; - match self { - YConstraint::Top(top) => { - pre_scale_translate_y = bottom_align * Mat4::from_translation([0., top, 0.].into()); - pre_scale_scale_y = Mat4::IDENTITY; - post_scale_translate_y = Mat4::from_translation([-1.0, 0., 0.].into()); - } - YConstraint::Bottom(bottom) => { - pre_scale_translate_y = - top_align * Mat4::from_translation([0., -bottom, 0.].into()); - pre_scale_scale_y = Mat4::IDENTITY; - post_scale_translate_y = Mat4::from_translation([1.0, 0., 0.].into()); - } - YConstraint::Center(downward_from_center) => { - pre_scale_translate_y = - center_y * Mat4::from_translation([0., downward_from_center, 0.].into()); - pre_scale_scale_y = Mat4::IDENTITY; - post_scale_translate_y = Mat4::IDENTITY; - } - YConstraint::TopAndBottom { top: _, bottom: _ } => { - todo!(); - } - YConstraint::Scale => { - pre_scale_translate_y = center_y; - pre_scale_scale_y = fill_y; - post_scale_translate_y = Mat4::IDENTITY; - } - }; - ( - pre_scale_scale_y * pre_scale_translate_y, - post_scale_translate_y, - ) - } -} - -#[derive(Debug, Clone, Copy, Serialize, Deserialize)] -pub struct Constraint { - pub x: XConstraint, - pub y: YConstraint, -} - -impl Constraint { - pub fn to_mat4(self, display: Mat4, svg: Mat4, bbox: Mat4) -> Mat4 { - let Constraint { - x: constraint_x, - y: constraint_y, - } = self; - - let (pre_x, post_x) = constraint_x.to_pre_post_transform(display, svg, bbox); - let (pre_y, post_y) = constraint_y.to_pre_post_transform(display, svg, bbox); - - let pre_xy = pre_x * pre_y; - let post_xy = post_x * post_y; - - let normalize_scale = get_normalize_scale(display); - - return post_xy * normalize_scale * pre_xy; - } -} diff --git a/concept/src/uses.rs b/concept/src/uses.rs deleted file mode 100644 index 8acfea9..0000000 --- a/concept/src/uses.rs +++ /dev/null @@ -1,11 +0,0 @@ -use salvage::{callback::PassDown, svg_set::SvgSet, usvg::Node}; - -use crate::svg_init::get_default_init_callback; - -pub fn use_svg(xml: String, mut callback: C) -> SvgSet { - let mut default_callback = get_default_init_callback(); - SvgSet::new(xml.to_string(), PassDown::default(), |node, passdown| { - callback(node.clone(), passdown); - default_callback(node, passdown) - }) -} diff --git a/examples/layout/Cargo.toml b/examples/layout/Cargo.toml index fc06340..19b5232 100644 --- a/examples/layout/Cargo.toml +++ b/examples/layout/Cargo.toml @@ -16,7 +16,7 @@ path = "src/main.rs" mobile-entry-point = "0.1.1" guppies = { path = "../../guppies" } salvage = { path = "../../salvage" } -concept = { path = "../../concept" } +experiment = { path = "../../experiment" } [target.'cfg(target_os = "android")'.dependencies] android_logger = "0.11.0" diff --git a/examples/layout/MenuBar.svg b/examples/layout/MenuBar.svg index 30dab5c..4b489aa 100644 --- a/examples/layout/MenuBar.svg +++ b/examples/layout/MenuBar.svg @@ -1,7 +1,7 @@ - + - + @@ -11,7 +11,7 @@ stroke-linejoin="round" /> - + - + diff --git a/examples/layout/src/main.rs b/examples/layout/src/main.rs index 1abbf8d..db5ce86 100644 --- a/examples/layout/src/main.rs +++ b/examples/layout/src/main.rs @@ -1,21 +1,17 @@ -use concept::{responsive::layout_machine::LayoutMachine, scroll::ScrollState, uses::use_svg}; +use experiment::{responsive::layout_machine::LayoutMachine, uses::use_svg}; use guppies::bytemuck::cast_slice; -use guppies::{ - glam::Mat4, - winit::event::{ElementState, WindowEvent}, - GpuRedraw, Guppy, -}; +use guppies::{GpuRedraw, Guppy}; use mobile_entry_point::mobile_entry_point; -use std::vec; pub fn main() { let mut layout_machine = LayoutMachine::default(); let svg_set = use_svg( include_str!("../MenuBar.svg").to_string(), - |node, _pass_down| { - layout_machine.add_node(node); + |node, mut _pass_down| { + layout_machine.add_node(&node, &mut _pass_down); }, + None, ); let mut guppy = Guppy::new([GpuRedraw::default()]); diff --git a/examples/life/Cargo.toml b/examples/life/Cargo.toml index c6362dd..323bb4f 100644 --- a/examples/life/Cargo.toml +++ b/examples/life/Cargo.toml @@ -13,10 +13,10 @@ name = "life" path = "src/main.rs" [dependencies] -mobile-entry-point = "0.1.0" +mobile-entry-point = "0.1.1" guppies = { path = "../../guppies" } salvage = { path = "../../salvage" } -concept = { path = "../../concept" } +experiment = { path = "../../experiment" } regex = "1" bytemuck = "1.13.1" fastrand = "2.0.0" diff --git a/examples/life/src/main.rs b/examples/life/src/main.rs index 59f3549..cb9c1bf 100644 --- a/examples/life/src/main.rs +++ b/examples/life/src/main.rs @@ -1,10 +1,10 @@ -use concept::scroll::ScrollState; -use concept::spring::SpringMat4; -use concept::svg_init::get_center; -use concept::uses::use_svg; +use experiment::scroll::ScrollState; +use experiment::spring::SpringMat4; +use experiment::svg_init::get_center; +use experiment::uses::use_svg; use guppies::bytemuck::{cast_slice, Pod, Zeroable}; use guppies::glam::{Mat4, Vec2}; -use guppies::winit::event::Event; +use guppies::winit::event::{Event, WindowEvent}; use guppies::{GpuRedraw, Guppy}; use regex::Regex; use salvage::svg_set::SvgSet; @@ -84,6 +84,7 @@ pub fn main() { } }; }, + None, ); let mut life_game = LifeGame { position_to_coordinates, @@ -99,16 +100,27 @@ pub fn main() { .map(|_| SpringMat4::default()); let start_center = Mat4::from_translation((life_game.position_to_coordinates[0], 0.).into()); let mut guppy = Guppy::new([GpuRedraw::default()]); + guppy.register(move |event, gpu_redraw| { let clicked = scroll_state.event_handler(event); - if let Event::RedrawRequested(_) = event { - tip_animation.update(&mut texture.tip_transform, &mut player_animations); - player_animations - .iter_mut() - .enumerate() - .for_each(|(i, animation)| { - animation.update(&mut texture.player_avatar_transforms[i], &mut svg_set); - }); + match event { + Event::WindowEvent { + window_id: _, + event, + } => match event { + WindowEvent::RedrawRequested => { + tip_animation.update(&mut texture.tip_transform, &mut player_animations); + player_animations + .iter_mut() + .enumerate() + .for_each(|(i, animation)| { + animation + .update(&mut texture.player_avatar_transforms[i], &mut svg_set); + }); + } + _ => {} + }, + _ => (), } if clicked { if tip_animation.is_animating diff --git a/examples/list/Cargo.toml b/examples/list/Cargo.toml index c2fa163..62d885d 100644 --- a/examples/list/Cargo.toml +++ b/examples/list/Cargo.toml @@ -13,10 +13,10 @@ name = "list" path = "src/main.rs" [dependencies] -mobile-entry-point = "0.1.0" +mobile-entry-point = "0.1.1" guppies = { path = "../../guppies" } salvage = { path = "../../salvage" } -concept = { path = "../../concept" } +experiment = { path = "../../experiment" } [target.'cfg(target_os = "android")'.dependencies] android_logger = "0.11.0" diff --git a/examples/list/Left.svg b/examples/list/Left.svg index a8d97bc..c84a248 100644 --- a/examples/list/Left.svg +++ b/examples/list/Left.svg @@ -1,39 +1,59 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + [ ] + + + diff --git a/examples/list/life.svg b/examples/list/life.svg deleted file mode 100644 index fc1b391..0000000 --- a/examples/list/life.svg +++ /dev/null @@ -1,116 +0,0 @@ - - - - -Life, I guess - - - - -Players -Player1: $888888888 -Player2: $888888888 -Player3: $888888888 -Player4: $888888888 - - - - - - - - - - - - - - - - - - - - - -START -You get a bonus -A car hits you -You buy a 
lot of junk food -You win a dance battle -You date
somebody
out of your league -You get a promotion
because
you look great -Your friend becomes a milionaire -You befriend an alien from Mars -Your cousin marries you -Coffee time! -You watch a circus show -Your mom calls you -You get arrested for driving drunk -You find money in a public restroom -Retirement! -STOP - - - - - - - - - - - - - - - - - - - -1 -2 -3 -4 -5 -6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/list/src/main.rs b/examples/list/src/main.rs index c59657b..83a7372 100644 --- a/examples/list/src/main.rs +++ b/examples/list/src/main.rs @@ -1,27 +1,44 @@ -use concept::{responsive::layout_machine::LayoutMachine, scroll::ScrollState, uses::use_svg}; +use experiment::{responsive::layout_machine::LayoutMachine, scroll::ScrollState, uses::use_svg}; use guppies::bytemuck::cast_slice; -use guppies::{glam::Mat4, primitives::Vertex, GpuRedraw, Guppy}; +use guppies::{GpuRedraw, Guppy}; use mobile_entry_point::mobile_entry_point; struct ListItem { word: String, icon: String, } + pub fn main() { let mut layout_machine = LayoutMachine::default(); let svg_set = use_svg( include_str!("../Left.svg").to_string(), - |node, _pass_down| { - layout_machine.add_node(node); + |node, mut pass_down| { + layout_machine.add_node(&node, &mut pass_down); }, + None, ); + // let list = use_svg( + // include_str!("../Left.svg").to_string(), + // |node, mut pass_down| { + // layout_machine.add_node(&node, &mut pass_down); + // }, + // Some("ListItem".to_string()), + // ); + let mut guppy = Guppy::new([GpuRedraw::default()]); + guppy.register(move |event, gpu_redraws| { layout_machine.event_handler(event); gpu_redraws[0].update_texture([cast_slice(&layout_machine.transforms[..])].concat()); - gpu_redraws[0].update_triangles(svg_set.get_combined_geometries().triangles, 0); + gpu_redraws[0].update_triangles( + svg_set + .get_combined_geometries() + // .extend(&list.get_combined_geometries()) + .triangles, + 0, + ); }); guppy.start(); diff --git a/concept/Cargo.lock b/experiment/Cargo.lock similarity index 98% rename from concept/Cargo.lock rename to experiment/Cargo.lock index 62b9af3..ade5284 100644 --- a/concept/Cargo.lock +++ b/experiment/Cargo.lock @@ -17,7 +17,7 @@ checksum = "144ec79496cbab6f84fa125dc67be9264aef22eb8a28da8454d9c33f15108da4" dependencies = ["proc-macro2", "quote", "syn"] [[package]] -name = "svg-gui-concept" +name = "svg-gui-experiment" version = "0.1.0" dependencies = ["enumflags2"] diff --git a/concept/Cargo.toml b/experiment/Cargo.toml similarity index 88% rename from concept/Cargo.toml rename to experiment/Cargo.toml index e75b184..e4432c2 100644 --- a/concept/Cargo.toml +++ b/experiment/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "concept" +name = "experiment" version = "0.1.0" edition = "2021" authors = ["cactice"] @@ -11,6 +11,7 @@ natura = { git = "https://github.com/ziyasal/natura" } regex = "1" serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } +html-escape = "0.2.13" [dev-dependencies] fastrand = "1.8.0" diff --git a/concept/readme.md b/experiment/readme.md similarity index 100% rename from concept/readme.md rename to experiment/readme.md diff --git a/concept/src/lib.rs b/experiment/src/lib.rs similarity index 100% rename from concept/src/lib.rs rename to experiment/src/lib.rs diff --git a/concept/src/responsive/clickable.rs b/experiment/src/responsive/clickable.rs similarity index 62% rename from concept/src/responsive/clickable.rs rename to experiment/src/responsive/clickable.rs index f446b77..c0db39d 100644 --- a/concept/src/responsive/clickable.rs +++ b/experiment/src/responsive/clickable.rs @@ -3,21 +3,26 @@ use super::layout::Layout; use guppies::glam::Mat4; use guppies::glam::Vec4; -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone)] pub enum ClickableBbox { Bbox(Mat4), Layout(Layout), } impl ClickableBbox { - pub fn click_detection(&self, click: Vec4, display: Mat4, svg: Mat4) -> bool { + pub fn click_detection(&self, click: Vec4, display: Mat4) -> bool { let bbox = match self { - ClickableBbox::Layout(layout) => layout.to_mat4(display, svg) * layout.bbox, + ClickableBbox::Layout(layout) => { + layout.to_mat4( + display, + Mat4::IDENTITY, /*FIXME: this is completely wrong, consider how to get parent bbox*/ + ) * layout.bbox + } ClickableBbox::Bbox(bbox) => *bbox, }; let click = Mat4::from_translation([-1., 1., 0.].into()) * Mat4::from_scale([0.5, 0.5, 1.].into()) - * get_normalize_scale(display) + * get_normalize_scale(display, Mat4::IDENTITY) * click; let click = bbox.inverse() * click; if click.x.abs() < 1. && click.y.abs() < 1. { diff --git a/experiment/src/responsive/common_constraint.rs b/experiment/src/responsive/common_constraint.rs new file mode 100644 index 0000000..1f7d902 --- /dev/null +++ b/experiment/src/responsive/common_constraint.rs @@ -0,0 +1,100 @@ +use super::constraint::{XConstraint, YConstraint}; +use guppies::glam::{Mat4, Vec3}; + +pub(crate) enum CommonConstraint { + Start(f32), + End(f32), + StartAndEnd { start: f32, end: f32 }, + Center(f32), + Scale, +} + +impl From for CommonConstraint { + fn from(x_constraint: XConstraint) -> Self { + match x_constraint { + XConstraint::Left(left) => CommonConstraint::Start(left), + XConstraint::Right(right) => CommonConstraint::End(right), + XConstraint::LeftAndRight { left, right } => CommonConstraint::StartAndEnd { + start: left, + end: right, + }, + XConstraint::Center(x) => CommonConstraint::Center(x), + XConstraint::Scale => CommonConstraint::Scale, + } + } +} +impl From for CommonConstraint { + fn from(y_constraint: YConstraint) -> Self { + match y_constraint { + YConstraint::Top(top) => CommonConstraint::End(top), + YConstraint::Bottom(bottom) => CommonConstraint::Start(bottom), + YConstraint::TopAndBottom { top, bottom } => CommonConstraint::StartAndEnd { + start: bottom, + end: top, + }, + YConstraint::Center(y) => CommonConstraint::Center(y), + YConstraint::Scale => CommonConstraint::Scale, + } + } +} +impl CommonConstraint { + pub(crate) fn to_transform f32, G: Fn(f32, f32) -> Vec3>( + self, + display: Mat4, + bbox: Mat4, + parent_bbox: Mat4, + accessor: F, + composer: G, + ) -> Mat4 { + let fill = Mat4::from_scale(composer( + accessor(parent_bbox.to_scale_rotation_translation().0) + / accessor(bbox.to_scale_rotation_translation().0), + 1.0, + )); + + let (left_align, right_align, center) = prepare_anchor_points(bbox, &accessor, &composer); + let (left_align, right_align, center) = ( + left_align.inverse(), + right_align.inverse(), + center.inverse(), + ); + let (parent_edge_left, parent_edge_right, parent_center) = + prepare_anchor_points(parent_bbox, &accessor, &composer); + + match self { + CommonConstraint::Start(left) => { + parent_edge_left * left_align * Mat4::from_translation(composer(left, 0.)) + } + CommonConstraint::End(right) => { + parent_edge_right * right_align * Mat4::from_translation(composer(right, 0.)) + } + CommonConstraint::Center(rightward_from_center) => { + parent_center * center * Mat4::from_translation(composer(rightward_from_center, 0.)) + } + CommonConstraint::StartAndEnd { start, end } => { + todo!(); + } + CommonConstraint::Scale => fill * center, + } + } +} + +fn prepare_anchor_points f32, G: Fn(f32, f32) -> Vec3>( + bbox: Mat4, + accessor: &F, + composer: &G, +) -> (Mat4, Mat4, Mat4) { + let (bbox_scale, _, bbox_translation) = bbox.to_scale_rotation_translation(); + + let start_align = Mat4::from_translation(composer(accessor(bbox_translation), 0.)); + let end_align = Mat4::from_translation(composer( + accessor(bbox_translation) + accessor(bbox_scale), + 0., + )); + let center = Mat4::from_translation(composer( + accessor(bbox_translation) + accessor(bbox_scale) / 2., + 0., + )); + + (start_align, end_align, center) +} diff --git a/experiment/src/responsive/constraint.rs b/experiment/src/responsive/constraint.rs new file mode 100644 index 0000000..45e90e3 --- /dev/null +++ b/experiment/src/responsive/constraint.rs @@ -0,0 +1,94 @@ +use super::common_constraint::CommonConstraint; +use guppies::glam::{Mat4, Vec3}; +use serde::{Deserialize, Serialize}; + +pub fn get_normalize_scale(display: Mat4, parent_bbox: Mat4) -> Mat4 { + display.inverse() +} + +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +pub enum XConstraint { + Left(f32), + Right(f32), + LeftAndRight { left: f32, right: f32 }, + Center(f32), //rightward_from_center + Scale, +} + +impl Default for XConstraint { + fn default() -> Self { + Self::LeftAndRight { + left: 0., + right: 0., + } + } +} + +impl XConstraint { + pub(crate) fn to_pre_post_transform( + self, + display: Mat4, + bbox: Mat4, + parent_bbox: Mat4, + ) -> Mat4 { + let accessor = |Vec3 { x, .. }| x; + let composer = |x, other| Vec3 { + x, + y: other, + z: other, + }; + CommonConstraint::from(self).to_transform(display, bbox, parent_bbox, accessor, composer) + } +} + +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +pub enum YConstraint { + Top(f32), + Bottom(f32), + TopAndBottom { top: f32, bottom: f32 }, + Center(f32), //downward_from_center + Scale, +} + +impl Default for YConstraint { + fn default() -> Self { + Self::TopAndBottom { + top: 0., + bottom: 0., + } + } +} + +impl YConstraint { + pub(crate) fn to_transform(self, display: Mat4, bbox: Mat4, parent_bbox: Mat4) -> Mat4 { + let accessor = |Vec3 { y, .. }| y; + let composer = |y, other| Vec3 { + x: other, + y, + z: other, + }; + CommonConstraint::from(self).to_transform(display, bbox, parent_bbox, accessor, composer) + } +} + +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +pub struct Constraint { + pub x: XConstraint, + pub y: YConstraint, +} + +impl Constraint { + pub fn to_mat4(self, display: Mat4, bbox: Mat4, parent_bbox: Mat4) -> Mat4 { + let Constraint { + x: constraint_x, + y: constraint_y, + } = self; + + let x = constraint_x.to_pre_post_transform(display, bbox, parent_bbox); + let y = constraint_y.to_transform(display, bbox, parent_bbox); + + let xy = x * y; + + return display.inverse() * xy; + } +} diff --git a/concept/src/responsive/layout.rs b/experiment/src/responsive/layout.rs similarity index 67% rename from concept/src/responsive/layout.rs rename to experiment/src/responsive/layout.rs index 6fa8a27..158b7e2 100644 --- a/concept/src/responsive/layout.rs +++ b/experiment/src/responsive/layout.rs @@ -1,16 +1,11 @@ use super::constraint::Constraint; use guppies::glam::Mat4; -use guppies::primitives::Rect; use guppies::winit::dpi::PhysicalSize; +use html_escape::decode_html_entities; use regex::Regex; -use salvage::svg_set::SvgSet; use salvage::usvg::{self}; use salvage::usvg::{NodeExt, PathBbox}; -pub(crate) fn svg_to_mat4(svg_scale: Rect) -> Mat4 { - Mat4::from_scale([svg_scale.size.x as f32, svg_scale.size.y as f32, 1.].into()) -} - pub(crate) fn size_to_mat4(size: PhysicalSize) -> Mat4 { Mat4::from_scale([size.width as f32, size.height as f32, 1.].into()) } @@ -22,19 +17,14 @@ pub struct Layout { } impl Layout { - pub fn to_mat4_new(self, p: &PhysicalSize, svg_set: &SvgSet) -> Mat4 { - let display = size_to_mat4(*p); - let svg = svg_to_mat4(svg_set.bbox); - self.constraint.to_mat4(display, svg, self.bbox) - } - pub fn to_mat4(self, display: Mat4, svg: Mat4) -> Mat4 { - self.constraint.to_mat4(display, svg, self.bbox) + pub fn to_mat4(self, display: Mat4, parent_bbox: Mat4) -> Mat4 { + self.constraint.to_mat4(display, self.bbox, parent_bbox) } pub fn new(node: &usvg::Node) -> Self { let id = node.id(); let re = Regex::new(r"#layout (.+)").unwrap(); let json = &re.captures(&id).unwrap()[1]; - let json = json.replace("'", "\""); + let json = decode_html_entities(json).to_string(); let constraint = serde_json::from_str::(&json).unwrap(); let bbox_mat4 = bbox_to_mat4( node.calculate_bbox() diff --git a/concept/src/responsive/layout_machine.rs b/experiment/src/responsive/layout_machine.rs similarity index 66% rename from concept/src/responsive/layout_machine.rs rename to experiment/src/responsive/layout_machine.rs index 6a52a66..1eda389 100644 --- a/concept/src/responsive/layout_machine.rs +++ b/experiment/src/responsive/layout_machine.rs @@ -4,25 +4,24 @@ use super::layout::bbox_to_mat4; use super::layout::size_to_mat4; use super::layout::Layout; use crate::scroll::ScrollState; +use crate::svg_init::PassDown; use crate::svg_init::CLICKABLE_REGEX; use crate::svg_init::LAYOUT_REGEX; use core::fmt::Debug; -use guppies::bytemuck::Pod; -use guppies::bytemuck::Zeroable; use guppies::glam::Mat4; +use guppies::glam::Vec3; use guppies::glam::Vec4; use guppies::winit::dpi::PhysicalSize; use guppies::winit::event::ElementState; use guppies::winit::event::Event; use guppies::winit::event::WindowEvent; -use guppies::GpuRedraw; use regex::Regex; use salvage::usvg::Node; use salvage::usvg::NodeExt; #[derive(Debug, Clone, Default)] pub struct LayoutMachine { - pub layouts: Vec, + pub layouts: Vec>, pub clickables: Vec, pub svg_mat4: Mat4, pub display_mat4: Mat4, @@ -53,24 +52,50 @@ impl LayoutMachine { } } pub fn resize(&mut self, p: &PhysicalSize) { - self.display_mat4 = size_to_mat4(*p); + self.display_mat4 = Mat4::from_scale([0.5, 0.5, 1.].into()) * size_to_mat4(*p); } pub fn get_transforms(&self) -> Vec { self.layouts .iter() - .map(|layout| layout.to_mat4(self.display_mat4, self.svg_mat4)) + .map(|parents| { + parents + .iter() + .enumerate() + .fold( + (Mat4::IDENTITY, self.display_bbox_generator()), + |(_parent_result, parent_bbox), (i, layout)| { + dbg!(parent_bbox.to_scale_rotation_translation()); + let layout_result = layout.to_mat4(self.display_mat4, parent_bbox); + ( + Mat4::from_scale([2., -2., 1.].into()) * layout_result, + self.display_mat4 * layout_result * layout.bbox, + ) + }, + ) + .0 + }) .collect() } + fn display_bbox_generator(&self) -> Mat4 { + let display = self.display_mat4.to_scale_rotation_translation(); + Mat4::from_scale_rotation_translation( + display.0, + display.1, + Vec3 { + x: -display.0.x / 2., + y: -display.0.y / 2., + z: 0., + }, + ) + } + pub fn click_detection(&self, scroll_state: &ScrollState) -> Vec { let click = Vec4::from((scroll_state.mouse_position, 1., 1.)); let clicked_ids = self .clickables .iter() .filter_map(|clickable| { - if clickable - .bbox - .click_detection(click, self.display_mat4, self.svg_mat4) - { + if clickable.bbox.click_detection(click, self.display_mat4) { Some(clickable.id.clone()) } else { None @@ -79,13 +104,14 @@ impl LayoutMachine { .collect::>(); clicked_ids } - pub fn add_node(&mut self, node: Node) { + pub fn add_node(&mut self, node: &Node, pass_down: &mut PassDown) { let clickable_regex = Regex::new(CLICKABLE_REGEX).unwrap(); let layout_regex = Regex::new(LAYOUT_REGEX).unwrap(); let id = &node.id().to_string(); if layout_regex.is_match(id) { let layout = Layout::new(&node); - self.layouts.push(layout); + pass_down.parent_layouts.push(layout); + self.layouts.push(pass_down.parent_layouts.clone()); if clickable_regex.is_match(&id) { let clickable = Clickable { bbox: ClickableBbox::Layout(layout), diff --git a/concept/src/responsive/mod.rs b/experiment/src/responsive/mod.rs similarity index 74% rename from concept/src/responsive/mod.rs rename to experiment/src/responsive/mod.rs index 358f88f..319d9d3 100644 --- a/concept/src/responsive/mod.rs +++ b/experiment/src/responsive/mod.rs @@ -1,4 +1,5 @@ pub mod clickable; +pub mod common_constraint; pub mod constraint; pub mod layout; pub mod layout_machine; diff --git a/concept/src/scroll.rs b/experiment/src/scroll.rs similarity index 95% rename from concept/src/scroll.rs rename to experiment/src/scroll.rs index 334cb34..2e6de8c 100644 --- a/concept/src/scroll.rs +++ b/experiment/src/scroll.rs @@ -7,8 +7,7 @@ use guppies::{ }; use salvage::svg_set::SvgSet; const UNMOVED_RADIUS: f32 = 40.; -pub fn get_scale(size: PhysicalSize, svg_scale: Vec2) -> Mat4 { - let ratio = f32::min(svg_scale.x, svg_scale.y) / f32::max(svg_scale.x, svg_scale.y); +pub fn get_scale(size: PhysicalSize) -> Mat4 { Mat4::from_scale([4.0 / size.width as f32, -4.0 / size.height as f32, 1.0].into()) } @@ -24,7 +23,7 @@ impl ScrollState { pub fn new_from_svg_set(svg_set: &SvgSet) -> Self { // Below scale should get overridden by guppies' redraw event forced on init let svg_scale = svg_set.bbox.size; - let scale: Mat4 = get_scale(PhysicalSize::::new(100, 100), svg_scale); + let scale: Mat4 = get_scale(PhysicalSize::::new(100, 100)); let translate = Mat4::from_translation([-1., 1.0, 0.0].into()); Self { transform: translate * scale, @@ -39,9 +38,7 @@ impl ScrollState { WindowEvent::Resized(p) => { let (_scale, rot, trans) = scroll_state.transform.to_scale_rotation_translation(); - let scale = get_scale(*p, scroll_state.display_image_size) - .to_scale_rotation_translation() - .0; + let scale = get_scale(*p).to_scale_rotation_translation().0; scroll_state.transform = Mat4::from_scale_rotation_translation(scale, rot, trans); } diff --git a/concept/src/spring.rs b/experiment/src/spring.rs similarity index 100% rename from concept/src/spring.rs rename to experiment/src/spring.rs diff --git a/concept/src/svg_init.rs b/experiment/src/svg_init.rs similarity index 50% rename from concept/src/svg_init.rs rename to experiment/src/svg_init.rs index 54bbcd0..85266f6 100644 --- a/concept/src/svg_init.rs +++ b/experiment/src/svg_init.rs @@ -2,10 +2,28 @@ use guppies::glam::Vec2; pub use regex; use regex::RegexSet; use salvage::{ - callback::{IndicesPriority, PassDown}, geometry::Geometry, usvg::{self, Node, NodeExt}, }; + +use crate::responsive::layout::Layout; +#[derive(Clone, Debug)] +pub struct PassDown { + pub transform_id: u32, + pub is_include: bool, + pub parent_layouts: Vec, +} + +impl Default for PassDown { + fn default() -> Self { + Self { + transform_id: 1, + is_include: true, + parent_layouts: [].to_vec(), + } + } +} + #[derive(Clone, Debug, Default)] pub struct RegexPattern { pub regex_pattern: String, @@ -29,47 +47,57 @@ impl RegexPatterns { pub const CLICKABLE_REGEX: &str = r"#clickable(?:$| |#)"; pub const TRANSFORM_REGEX: &str = r"#transform(?:$| |#)"; +pub const COMPONENT_REGEX: &str = r"#component(?:$| |#)"; pub const LAYOUT_REGEX: &str = r"#layout(?:$| |#)"; pub const DYNAMIC_TEXT_REGEX: &str = r"#dynamicText(?:$| |#)"; -pub fn get_default_init_callback() -> impl FnMut(Node, PassDown) -> (Option, PassDown) { - let mut transform_count = 1; +pub fn get_default_init_callback( + mut transform_count: u32, + include: Option, +) -> impl FnMut(Node, PassDown) -> (Option, PassDown) { let mut regex_patterns = RegexPatterns::default(); let _clickable_regex_pattern = regex_patterns.add(CLICKABLE_REGEX); let transform_regex_pattern = regex_patterns.add(TRANSFORM_REGEX); - let dynamic_text_regex_pattern = regex_patterns.add(DYNAMIC_TEXT_REGEX); + let include_regex_pattern = + regex_patterns.add(&include.clone().unwrap_or("xxxxxxxxx".to_string())); + let component_regex_pattern = regex_patterns.add(COMPONENT_REGEX); + let _dynamic_text_regex_pattern = regex_patterns.add(DYNAMIC_TEXT_REGEX); let defaults = RegexSet::new(regex_patterns.inner.iter().map(|r| &r.regex_pattern)).unwrap(); move |node, pass_down| { let PassDown { transform_id: parent_transform_id, - indices_priority: parent_priority, + is_include: parent_is_include, + parent_layouts, } = pass_down; let id = node.id(); let default_matches = defaults.matches(&id); - let transform_id = if default_matches.matched(transform_regex_pattern.index) { - transform_count += 1; - transform_count - } else { - parent_transform_id - }; - let indices_priority = if !default_matches.matched(dynamic_text_regex_pattern.index) { - IndicesPriority::Variable - } else { - IndicesPriority::Fixed + let component_matched = default_matches.matched(component_regex_pattern.index); + let include_matched = default_matches.matched(include_regex_pattern.index); + let is_include = match parent_is_include && !component_matched { + true => true, + false => include_matched, }; - let indices_priority = parent_priority.max(indices_priority); - let geometry = { - if let usvg::NodeKind::Path(ref p) = *node.borrow() { - Some(Geometry::new(p, transform_id, indices_priority)) - } else { - None + let transform_id = match default_matches.matched(transform_regex_pattern.index) { + true => { + transform_count += 1; + transform_count } + false => parent_transform_id, }; + let geometry = match is_include { + true => match *node.borrow() { + usvg::NodeKind::Path(ref p) => Some(Geometry::new(p, transform_id)), + _ => None, + }, + false => None, + }; + ( geometry, PassDown { - indices_priority, transform_id, + is_include, + parent_layouts, }, ) } diff --git a/experiment/src/uses.rs b/experiment/src/uses.rs new file mode 100644 index 0000000..5a3b9ed --- /dev/null +++ b/experiment/src/uses.rs @@ -0,0 +1,19 @@ +use salvage::{svg_set::SvgSet, usvg::Node}; + +use crate::svg_init::{get_default_init_callback, PassDown}; + +pub fn use_svg( + xml: String, + mut callback: C, + component: Option, +) -> SvgSet { + let initial_pass_down = PassDown { + is_include: component.is_none(), + ..Default::default() + }; + let mut default_callback = get_default_init_callback(1, component); + SvgSet::new(xml.to_string(), initial_pass_down, |node, mut passdown| { + callback(&node, &mut passdown); + default_callback(node, passdown) + }) +} diff --git a/guppies/Cargo.toml b/guppies/Cargo.toml index a2bf271..ed1320f 100644 --- a/guppies/Cargo.toml +++ b/guppies/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" edition = "2021" [dependencies] -winit = { version = "0.28.6", features = ["android-native-activity"] } -wgpu = { version = "0.17.0", features = ["spirv"] } +winit = { version = "0.29.4", features = ["android-native-activity", "rwh_05"] } +wgpu = { version = "0.18.0", features = ["spirv"] } pollster = "0.3" bytemuck = { version = "1.14", features = ["derive"] } glam = { version = "0.24", features = ["bytemuck"] } @@ -13,7 +13,7 @@ log = "0.4" [target.'cfg(target_arch = "wasm32")'.dependencies] -wgpu = { version = "0.17.0", features = ["webgl", "spirv"] } +wgpu = { version = "0.18.0", features = ["webgl", "spirv"] } web-sys = "0.3.64" console_error_panic_hook = "0.1.7" console_log = { version = "1.0" } diff --git a/guppies/src/lib.rs b/guppies/src/lib.rs index 4c640c9..8d9f28f 100644 --- a/guppies/src/lib.rs +++ b/guppies/src/lib.rs @@ -37,7 +37,7 @@ fn init_window(event_loop: &EventLoopWindowTarget<()>) -> winit::window::Window .and_then(|body| { body.remove_child(&body.last_element_child().unwrap()) .unwrap(); - body.append_child(&web_sys::Element::from(window.canvas())) + body.append_child(&web_sys::Element::from(window.canvas().unwrap())) .ok() }) .expect("Couldn't append canvas to document body"); @@ -114,109 +114,116 @@ pub fn render_loop( let mut last_frame_inst = Instant::now(); #[cfg(not(target_arch = "wasm32"))] let (mut frame_count, mut accum_time) = (0, 0.0); - event_loop.run(move |event, event_loop, control_flow| { - *control_flow = ControlFlow::Poll; - // FIXME: why do some OS not redraw automatically without explicit call - #[cfg(any(target_os = "ios", target_os = "android"))] - if let Some(window) = window.as_mut() { - window.request_redraw(); - } - if let (Some(ref mut gpu_redraw), Some(redraws), Some(redraw_machine)) = ( - gpu_redraw.as_mut(), - redraws.as_mut(), - redraw_machine.as_ref(), - ) { - render_loop_fn.iter_mut().for_each(|func| { - func(&event, gpu_redraw); - }); - redraws - .iter_mut() - .zip(gpu_redraw.iter_mut()) - .for_each(|(redraw, new_redraw)| { - if let Some(shader) = new_redraw.shader.take() { - redraw.update_shader(&shader, redraw_machine); - } + let _ = event_loop + .expect("event loop initialization failed") + .run(move |event, event_loop| { + // FIXME: why do some OS not redraw automatically without explicit call + #[cfg(any(target_os = "ios", target_os = "android"))] + if let Some(window) = window.as_mut() { + window.request_redraw(); + } + if let (Some(ref mut gpu_redraw), Some(redraws), Some(redraw_machine)) = ( + gpu_redraw.as_mut(), + redraws.as_mut(), + redraw_machine.as_ref(), + ) { + render_loop_fn.iter_mut().for_each(|func| { + func(&event, gpu_redraw); }); - } - match event { - #[cfg(target_os = "android")] - Event::Resumed => { - init_window(event_loop); + redraws + .iter_mut() + .zip(gpu_redraw.iter_mut()) + .for_each(|(redraw, new_redraw)| { + if let Some(shader) = new_redraw.shader.take() { + redraw.update_shader(&shader, redraw_machine); + } + }); } - #[cfg(not(target_os = "android"))] - Event::NewEvents(start_cause) => match start_cause { - winit::event::StartCause::Init => { - let new_window = init_window(event_loop); - let new_redraw_machine = pollster::block_on(RedrawMachine::new(&new_window)); - redraws = Some(array::from_fn(|i| { - Redraw::new( - &new_redraw_machine, - &Default::default(), - &Default::default(), - i, - ) - })); - redraw_machine = Some(new_redraw_machine); - gpu_redraw = Some([(); COUNT].map(|_| GpuRedraw::default())); - window = Some(new_window); + match event { + #[cfg(target_os = "android")] + Event::Resumed => { + init_window(event_loop); + } + #[cfg(not(target_os = "android"))] + Event::NewEvents(start_cause) => match start_cause { + winit::event::StartCause::Init => { + let new_window = init_window(event_loop); + let new_redraw_machine = + pollster::block_on(RedrawMachine::new(&new_window)); + redraws = Some(array::from_fn(|i| { + Redraw::new( + &new_redraw_machine, + &Default::default(), + &Default::default(), + i, + ) + })); + redraw_machine = Some(new_redraw_machine); + gpu_redraw = Some([(); COUNT].map(|_| GpuRedraw::default())); + window = Some(new_window); - // Below is necessary when running on mobile... - let size = window.as_ref().unwrap().inner_size(); - if let Some(gpu_redraw) = gpu_redraw.as_mut() { - render_loop_fn.iter_mut().for_each(|func| { - func( - &Event::WindowEvent { - window_id: unsafe { WindowId::dummy() }, - event: WindowEvent::Resized(size), - }, - gpu_redraw, - ); - }); + // Below is necessary when running on mobile... + let size = window.as_ref().unwrap().inner_size(); + if let Some(gpu_redraw) = gpu_redraw.as_mut() { + render_loop_fn.iter_mut().for_each(|func| { + func( + &Event::WindowEvent { + window_id: unsafe { WindowId::dummy() }, + event: WindowEvent::Resized(size), + }, + gpu_redraw, + ); + }); + } } - } - _ => (), - }, - Event::WindowEvent { - event: window_event, - .. - } => match window_event { - WindowEvent::CloseRequested => { - *control_flow = ControlFlow::Exit; - } - WindowEvent::Resized(p) => match redraw_machine.as_mut() { - Some(redraw_machine) => redraw_machine.resize(p), - _ => {} + _ => (), }, - _ => {} - }, - Event::RedrawRequested(_) => { - if let (Some(window), Some(gpu_redraw), Some(redraws), Some(redraw_machine)) = ( - window.as_mut(), - gpu_redraw.as_mut(), - redraws.as_mut(), - redraw_machine.as_mut(), - ) { - let mut frame = redraw_machine.get_frame(); - redraw_machine.redraw(gpu_redraw, redraws, &mut frame); - redraw_machine.submit(frame); - window.request_redraw(); - #[cfg(not(target_arch = "wasm32"))] - { - accum_time += last_frame_inst.elapsed().as_secs_f32(); - last_frame_inst = Instant::now(); - frame_count += 1; - if frame_count == 100 { - println!( - "Avg frame time {}ms", - accum_time * 1000.0 / frame_count as f32 - ); - accum_time = 0.0; - frame_count = 0; + Event::WindowEvent { + event: window_event, + .. + } => match window_event { + WindowEvent::CloseRequested => { + event_loop.exit(); + } + WindowEvent::Resized(p) => match redraw_machine.as_mut() { + Some(redraw_machine) => redraw_machine.resize(p), + _ => {} + }, + WindowEvent::RedrawRequested => { + if let ( + Some(window), + Some(gpu_redraw), + Some(redraws), + Some(redraw_machine), + ) = ( + window.as_mut(), + gpu_redraw.as_mut(), + redraws.as_mut(), + redraw_machine.as_mut(), + ) { + let mut frame = redraw_machine.get_frame(); + redraw_machine.redraw(gpu_redraw, redraws, &mut frame); + redraw_machine.submit(frame); + window.request_redraw(); + #[cfg(not(target_arch = "wasm32"))] + { + accum_time += last_frame_inst.elapsed().as_secs_f32(); + last_frame_inst = Instant::now(); + frame_count += 1; + if frame_count == 100 { + // println!( + // "Avg frame time {}ms", + // accum_time * 1000.0 / frame_count as f32 + // ); + accum_time = 0.0; + frame_count = 0; + } + } } } - } + _ => {} + }, + _ => {} } - _ => {} - } - }); + }); } diff --git a/guppies/src/setup.rs b/guppies/src/setup.rs index 7a8112b..4dec389 100644 --- a/guppies/src/setup.rs +++ b/guppies/src/setup.rs @@ -116,10 +116,11 @@ impl RedrawMachine { resolve_target: Some(view), ops: wgpu::Operations { load: load_color, - store: true, + store: wgpu::StoreOp::Store, }, })], depth_stencil_attachment: None, + ..Default::default() }); rpass.set_pipeline(render_pipeline); rpass.set_bind_group(0, bind_group, &[]); diff --git a/salvage/src/callback.rs b/salvage/src/callback.rs deleted file mode 100644 index f692805..0000000 --- a/salvage/src/callback.rs +++ /dev/null @@ -1,21 +0,0 @@ -#[derive(PartialEq, PartialOrd, Eq, Ord, Clone, Copy, Debug, Default)] -pub enum IndicesPriority { - Variable, - #[default] - Fixed, -} - -#[derive(PartialEq, PartialOrd, Eq, Ord, Clone, Copy, Debug)] -pub struct PassDown { - pub indices_priority: IndicesPriority, - pub transform_id: u32, -} - -impl Default for PassDown { - fn default() -> Self { - Self { - indices_priority: Default::default(), - transform_id: 1, - } - } -} diff --git a/salvage/src/geometry.rs b/salvage/src/geometry.rs index 2c15c8d..b069b89 100644 --- a/salvage/src/geometry.rs +++ b/salvage/src/geometry.rs @@ -1,11 +1,10 @@ -use crate::{callback::IndicesPriority, prepare_triangles_from_path::prepare_triangles_from_path}; +use crate::prepare_triangles_from_path::prepare_triangles_from_path; use guppies::primitives::{Indices, Triangles}; use usvg::{Path, Tree}; #[derive(Clone, Debug, Default)] pub struct Geometry { pub triangles: Triangles, - pub priority: IndicesPriority, pub id: String, } impl From for Geometry { @@ -16,20 +15,17 @@ impl From for Geometry { .into_iter() .filter_map(|node| { if let usvg::NodeKind::Path(ref p) = *node.borrow() { - Some(Geometry::new(p, 1, IndicesPriority::Variable)) + Some(Geometry::new(p, 1)) } else { None } }) - .fold(Geometry::default(), |mut acc, curr| { - acc.extend(&curr); - acc - }); + .fold(Geometry::default(), |acc, curr| acc.extend(&curr)); geometry } } impl Geometry { - pub fn extend(&mut self, other: &Self) { + pub fn extend(mut self, other: &Self) -> Self { let v_len = self.triangles.vertices.len() as u32; let other_indices_with_offset: Indices = other.triangles.indices.iter().map(|i| i + v_len).collect(); @@ -37,12 +33,12 @@ impl Geometry { .vertices .extend(other.triangles.vertices.iter()); self.triangles.indices.extend(other_indices_with_offset); + self } - pub fn new(p: &Path, transform_id: u32, priority: IndicesPriority) -> Self { + pub fn new(p: &Path, transform_id: u32) -> Self { let triangles = prepare_triangles_from_path(p, transform_id); Self { triangles, - priority, id: p.id.to_owned(), } } diff --git a/salvage/src/lib.rs b/salvage/src/lib.rs index 0353ba2..c814f2c 100644 --- a/salvage/src/lib.rs +++ b/salvage/src/lib.rs @@ -1,4 +1,3 @@ -pub mod callback; mod convert_path; mod fill; pub mod geometry; diff --git a/salvage/src/svg_set.rs b/salvage/src/svg_set.rs index 9f7b927..ca79886 100644 --- a/salvage/src/svg_set.rs +++ b/salvage/src/svg_set.rs @@ -1,11 +1,11 @@ use crate::geometry::Geometry; use guppies::{glam::Vec2, primitives::Rect}; use roxmltree::{Document, NodeId}; -use std::{collections::HashMap, sync::Arc}; -use usvg::{fontdb::Source, Node, Options, Tree}; +use std::{collections::HashMap, fmt::Debug, rc::Rc, sync::Arc}; +use usvg::{fontdb::Source, Node, NodeExt, Options, Tree}; use xmlwriter::XmlWriter; -fn recursive_svg (Option, P)>( +fn recursive_svg (Option, P)>( node: usvg::Node, pass_down: P, geometries: &mut Vec, @@ -34,7 +34,7 @@ fn find_text_node_path(node: roxmltree::Node, path: &mut Vec) } false } -#[derive(Debug, Default)] +#[derive(Debug, Default, Clone)] pub struct SvgSet { pub geometries: Vec, pub raw_xml: String, @@ -42,7 +42,7 @@ pub struct SvgSet { pub id_to_geometry_index: HashMap, pub current_text_map: HashMap, pub bbox: Rect, - usvg_options: Options, + usvg_options: Rc, } impl SvgSet { @@ -60,15 +60,13 @@ impl SvgSet { } } pub fn get_combined_geometries(&self) -> Geometry { - self.geometries.iter().fold( - Geometry::default(), - |mut acc: Geometry, geometry: &Geometry| { - acc.extend(&geometry); - acc - }, - ) + self.geometries + .iter() + .fold(Geometry::default(), |acc: Geometry, geometry: &Geometry| { + acc.extend(&geometry) + }) } - pub fn new (Option, P)>( + pub fn new (Option, P)>( xml: String, initial_pass_down: P, mut callback: C, @@ -80,6 +78,7 @@ impl SvgSet { opt.font_family = "Roboto Medium".to_string(); opt.keep_named_groups = true; let document = Document::parse(&xml).unwrap(); + let opt = get_usvg_options(); let tree = Tree::from_xmltree(&document, &opt.to_ref()).unwrap(); let id_to_svg = document @@ -97,7 +96,6 @@ impl SvgSet { &mut geometries, &mut callback, ); - geometries.sort_by_key(|a| a.priority); let id_to_geometry_index: HashMap = geometries .iter() @@ -117,7 +115,7 @@ impl SvgSet { id_to_svg, id_to_geometry_index, bbox, - usvg_options: opt, + usvg_options: Rc::new(opt), ..Default::default() } } @@ -157,10 +155,19 @@ impl SvgSet { "{}", &writer.end_document() ); - dbg!(&xml); let tree = Tree::from_str(&xml, &self.usvg_options.to_ref()).unwrap(); let geometry_to_update = &mut self.geometries[*self.id_to_geometry_index.get(id).unwrap() as usize]; *geometry_to_update = tree.into(); } } + +pub fn get_usvg_options() -> Options { + let font = include_bytes!("../fallback_font/Roboto-Medium.ttf"); + let mut opt = Options::default(); + opt.fontdb + .load_font_source(Source::Binary(Arc::new(font.as_ref()))); + opt.font_family = "Roboto Medium".to_string(); + opt.keep_named_groups = true; + opt +}