diff --git a/.gitignore b/.gitignore index ebd1e64..d83fc7c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,13 +2,7 @@ # will have compiled files and executables /target/ -# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries -# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock - -# These are backup files generated by rustfmt **/*.rs.bk -Cargo.lock *.blend1 .vscode \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 45215b3..5d0cf95 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,12 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" - [[package]] name = "addr2line" version = "0.20.0" @@ -83,16 +77,15 @@ dependencies = [ [[package]] name = "anstream" -version = "0.3.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] @@ -122,14 +115,31 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.1" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", "windows-sys", ] +[[package]] +name = "app_grid" +version = "0.1.0" +dependencies = [ + "clap", + "color-eyre", + "glam", + "manifest-dir-macros", + "mint", + "protostar", + "stardust-xr-fusion", + "stardust-xr-molecules", + "tokio", + "tracing-subscriber", + "tween", +] + [[package]] name = "arrayref" version = "0.3.7" @@ -150,7 +160,7 @@ checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.32", ] [[package]] @@ -204,12 +214,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "bitflags" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" - [[package]] name = "bumpalo" version = "3.13.0" @@ -292,30 +296,26 @@ checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" dependencies = [ "android-tzdata", "iana-time-zone", - "js-sys", "num-traits", "serde", - "time 0.1.45", - "wasm-bindgen", "winapi", ] [[package]] name = "clap" -version = "4.3.19" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.19" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" dependencies = [ "anstream", "anstyle", @@ -325,14 +325,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.12" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.32", ] [[package]] @@ -377,9 +377,9 @@ dependencies = [ [[package]] name = "color-rs" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d6cda18d80350d6a6d15d1f2dd6f5c88b3d61882e08801e8d68f506434b808" +checksum = "3415c18b81f66b23614db9fcccbf19d2af434e04d9a6c7ac10e49930f39d89f8" dependencies = [ "angle", "half 1.8.2", @@ -521,7 +521,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.27", + "syn 2.0.32", ] [[package]] @@ -543,7 +543,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote", - "syn 2.0.27", + "syn 2.0.32", ] [[package]] @@ -632,7 +632,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.32", ] [[package]] @@ -641,27 +641,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "errno" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "exr" version = "1.7.0" @@ -721,7 +700,7 @@ version = "23.5.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dac53e22462d78c16d64a1cd22371b54cc3fe94aa15e7886a2fa6e5d1ab8640" dependencies = [ - "bitflags 1.3.2", + "bitflags", "rustc_version", ] @@ -741,7 +720,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15d14128f06405808ce75bfebe11e9b0f9da18719ede6d7bdb1702d6bfe0f7e8" dependencies = [ - "bitflags 1.3.2", + "bitflags", "byteorder", "num_enum", "serde", @@ -894,7 +873,7 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "wasm-bindgen", ] @@ -916,13 +895,23 @@ checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "glam" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42218cb640844e3872cc3c153dc975229e080a6c4733b34709ef445610550226" +checksum = "b5418c17512bdf42730f9032c74e1ae39afc408745ebb2acf72fbc4691c17945" dependencies = [ "mint", ] +[[package]] +name = "global_counter" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a77c0a6d353621e0ba32c0eb64a5ed3832d900135712779e38bd2ea31d6509f" +dependencies = [ + "once_cell", + "parking_lot 0.11.2", +] + [[package]] name = "half" version = "1.8.2" @@ -986,6 +975,23 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hexagon_launcher" +version = "0.1.0" +dependencies = [ + "clap", + "color-eyre", + "glam", + "manifest-dir-macros", + "mint", + "protostar", + "stardust-xr-fusion", + "stardust-xr-molecules", + "tokio", + "tracing-subscriber", + "tween", +] + [[package]] name = "iana-time-zone" version = "0.1.57" @@ -1076,17 +1082,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "is-terminal" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi", - "rustix", - "windows-sys", -] - [[package]] name = "itertools" version = "0.11.0" @@ -1150,6 +1145,15 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" +[[package]] +name = "lerp" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc56a024593ecbcacb6bb4f8f4ace719eb08ae9b701535640ef3efb0e706260" +dependencies = [ + "num-traits", +] + [[package]] name = "libc" version = "0.2.147" @@ -1166,12 +1170,6 @@ dependencies = [ "rust-ini 0.17.0", ] -[[package]] -name = "linux-raw-sys" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" - [[package]] name = "lock_api" version = "0.4.10" @@ -1190,14 +1188,14 @@ checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "manifest-dir-macros" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "450e5ef583bc05177c4975b9ea907047091a9f62e74e81fcafb99dbffac51e7e" +checksum = "9c6d40de1ccdbf8bde2eaa0750595478a368f7b3a3f89c426e3454f64e29f593" dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.32", ] [[package]] @@ -1283,7 +1281,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys", ] @@ -1311,7 +1309,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cfg-if", "libc", "memoffset 0.7.1", @@ -1443,25 +1441,27 @@ dependencies = [ [[package]] name = "ouroboros" -version = "0.15.6" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1358bd1558bd2a083fed428ffeda486fbfb323e698cdda7794259d592ca72db" +checksum = "1c86de06555b970aec45229b27291b53154f21a5743a163419f4e4c0b065dcde" dependencies = [ "aliasable", "ouroboros_macro", + "static_assertions", ] [[package]] name = "ouroboros_macro" -version = "0.15.6" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f7d21ccd03305a674437ee1248f3ab5d4b1db095cf1caf49f1713ddf61956b7" +checksum = "8cad0c4b129e9696e37cb712b243777b90ef489a0bfaa0ac34e7d9b860e4f134" dependencies = [ - "Inflector", + "heck", + "itertools", "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.32", ] [[package]] @@ -1547,14 +1547,14 @@ checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.32", ] [[package]] name = "pin-project-lite" -version = "0.2.10" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -1568,7 +1568,7 @@ version = "0.17.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59871cc5b6cce7eaccca5a802b4173377a1c2ba90654246789a8fa2334426d11" dependencies = [ - "bitflags 1.3.2", + "bitflags", "crc32fast", "fdeflate", "flate2", @@ -1778,7 +1778,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] @@ -1787,7 +1787,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] @@ -1945,26 +1945,13 @@ dependencies = [ "semver", ] -[[package]] -name = "rustix" -version = "0.38.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" -dependencies = [ - "bitflags 2.3.3", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", -] - [[package]] name = "rustybuzz" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "162bdf42e261bee271b3957691018634488084ef577dddeb6420a9684cab2a6a" dependencies = [ - "bitflags 1.3.2", + "bitflags", "bytemuck", "smallvec", "ttf-parser", @@ -2003,22 +1990,22 @@ checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" [[package]] name = "serde" -version = "1.0.175" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d25439cd7397d044e2748a6fe2432b5e85db703d6d097bd014b3c0ad1ebff0b" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.175" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b23f7ade6f110613c0d63858ddb8b94c1041f550eab58a16b371bdf2c9c80ab4" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.32", ] [[package]] @@ -2034,13 +2021,13 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e168eaaf71e8f9bd6037feb05190485708e019f4fd87d161b3c0a0d37daf85e5" +checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.32", ] [[package]] @@ -2056,7 +2043,7 @@ dependencies = [ "serde", "serde_json", "serde_with_macros", - "time 0.3.23", + "time", ] [[package]] @@ -2068,7 +2055,7 @@ dependencies = [ "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.32", ] [[package]] @@ -2104,12 +2091,47 @@ dependencies = [ "log", ] +[[package]] +name = "single" +version = "0.1.0" +dependencies = [ + "clap", + "color-eyre", + "glam", + "manifest-dir-macros", + "mint", + "protostar", + "stardust-xr-fusion", + "stardust-xr-molecules", + "tokio", + "tracing-subscriber", + "tween", +] + [[package]] name = "siphasher" version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +[[package]] +name = "sirius" +version = "0.1.0" +dependencies = [ + "clap", + "color-eyre", + "glam", + "manifest-dir-macros", + "mint", + "protostar", + "stardust-xr-fusion", + "stardust-xr-molecules", + "tokio", + "tracing-subscriber", + "tween", + "walkdir", +] + [[package]] name = "smallvec" version = "1.11.0" @@ -2118,12 +2140,12 @@ checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "socket2" -version = "0.4.9" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" dependencies = [ "libc", - "winapi", + "windows-sys", ] [[package]] @@ -2137,15 +2159,15 @@ dependencies = [ [[package]] name = "stardust-xr" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0efaf53544cca5e641ba51928f492a8639cf62399207f8d5c1e3f917e4fc4aa1" +version = "0.14.1" +source = "git+https://github.com/StardustXR/core.git#7b6c7b1b77075a7035f8a3ef07b430863ed9d60e" dependencies = [ - "chrono", "cluFlock", "color-rs", "dirs 5.0.1", + "global_counter", "mint", + "nix", "parking_lot 0.12.1", "rustc-hash", "serde", @@ -2157,9 +2179,8 @@ dependencies = [ [[package]] name = "stardust-xr-fusion" -version = "0.40.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10dc289847fa08d3a67bd2be88abbc04584c6cab0081cc43bf4d56fe3cf43b5a" +version = "0.43.2" +source = "git+https://github.com/StardustXR/core.git#7b6c7b1b77075a7035f8a3ef07b430863ed9d60e" dependencies = [ "color-eyre", "color-rs", @@ -2179,13 +2200,13 @@ dependencies = [ [[package]] name = "stardust-xr-molecules" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "724a92e67765300651d165950b70ec4800d4ad6450f473882f6024d5a559ea9d" +version = "0.29.0" +source = "git+https://github.com/StardustXR/molecules.git#6e389f837375a34a10dfd35a633072a77a9f14d8" dependencies = [ "color-rs", "glam", "lazy_static", + "lerp", "map-range", "mint", "rustc-hash", @@ -2198,9 +2219,8 @@ dependencies = [ [[package]] name = "stardust-xr-schemas" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd65a40d6e6e8dc993ea9832666cf4cdc09c1a329f38b48ec9704af26cba229b" +version = "1.5.3" +source = "git+https://github.com/StardustXR/core.git#7b6c7b1b77075a7035f8a3ef07b430863ed9d60e" dependencies = [ "flatbuffers", "flexbuffers", @@ -2277,9 +2297,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.27" +version = "2.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" +checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" dependencies = [ "proc-macro2", "quote", @@ -2313,7 +2333,7 @@ checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.32", ] [[package]] @@ -2337,17 +2357,6 @@ dependencies = [ "weezl", ] -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - [[package]] name = "time" version = "0.3.23" @@ -2402,11 +2411,10 @@ dependencies = [ [[package]] name = "tokio" -version = "1.29.1" +version = "1.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" dependencies = [ - "autocfg", "backtrace", "bytes", "libc", @@ -2428,7 +2436,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.32", ] [[package]] @@ -2468,7 +2476,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.32", ] [[package]] @@ -2639,20 +2647,14 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", ] -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2680,7 +2682,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.32", "wasm-bindgen-shared", ] @@ -2702,7 +2704,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.32", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2842,13 +2844,20 @@ checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546" [[package]] name = "xkbcommon" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52db25b599e92bf6e3904134618728eeb7b49a5a4f38f107f92399bb9c496b88" +checksum = "c286371c44b3572d19b09196c129a8fff47d7704d6494daefb44fec10f0278ab" dependencies = [ "libc", + "xkeysym", ] +[[package]] +name = "xkeysym" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "054a8e68b76250b253f671d1268cb7f1ae089ec35e195b2efb2a4e9a836d0621" + [[package]] name = "xmlparser" version = "0.13.5" diff --git a/Cargo.toml b/Cargo.toml index 96e4bfc..2ce82d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,37 +1,2 @@ -[package] -name = "protostar" -version = "0.4.0" -edition = "2021" - -[dependencies] -cached = "0.43.0" -clap = { version = "4.1.3", features = ["derive"] } -color-eyre = "0.6.2" -directories = "5.0.0" -dirs = "5.0.0" -ez-pixmap = "0.2.2" -freedesktop-icons-greedy = "0.2.6" -glam = { version = "0.24.0", features = ["mint"] } -image = "0.24.5" -itertools = "0.11.0" -lazy_static = "1.4.0" -linicon-theme = "1.2.0" -manifest-dir-macros = "0.1.16" -mint = "0.5.9" -nix = "0.26.1" -regex = "1.7.1" -resvg = "0.29.0" -rustc-hash = "1.1.0" -serde = "1.0.155" -serde_json = "1.0.94" -serde_with = "2.3.1" -stardust-xr-fusion = "0.40.2" -stardust-xr-molecules = "0.24.3" -tokio = { version = "1.24.1", features = ["full"] } -tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } -tween = "2.0.0" -ustr = "0.9.0" -walkdir = "2.3.3" - -[dev-dependencies] -tempdir = "0.3.7" +[workspace] +members = ["app_grid", "hexagon_launcher", "protostar", "single", "sirius"] diff --git a/app_grid/Cargo.toml b/app_grid/Cargo.toml new file mode 100644 index 0000000..de34f34 --- /dev/null +++ b/app_grid/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "app_grid" +version = "0.1.0" +edition = "2021" + +[dependencies] +tokio = { version = "1.32.0", features = ["rt", "tokio-macros", "sync"] } +protostar = { path = "../protostar" } +color-eyre = "0.6.2" +clap = "4.4.6" +manifest-dir-macros = "0.1.18" +glam = "0.24.2" +mint = "0.5.9" +tween = "2.0.1" +tracing-subscriber = "0.3.17" + +[dependencies.stardust-xr-fusion] +git = "https://github.com/StardustXR/core.git" +# path = "../../core/fusion" + +[dependencies.stardust-xr-molecules] +git = "https://github.com/StardustXR/molecules.git" +# path = "../../molecules" diff --git a/res/protostar/cartridge.glb b/app_grid/res/protostar/cartridge.glb similarity index 100% rename from res/protostar/cartridge.glb rename to app_grid/res/protostar/cartridge.glb diff --git a/res/protostar/default_icon.glb b/app_grid/res/protostar/default_icon.glb similarity index 100% rename from res/protostar/default_icon.glb rename to app_grid/res/protostar/default_icon.glb diff --git a/examples/app_grid.rs b/app_grid/src/main.rs similarity index 95% rename from examples/app_grid.rs rename to app_grid/src/main.rs index c124942..b91d3d4 100644 --- a/examples/app_grid.rs +++ b/app_grid/src/main.rs @@ -7,14 +7,14 @@ use protostar::{ xdg::{get_desktop_files, parse_desktop_file, DesktopFile, Icon, IconType}, }; use stardust_xr_fusion::{ - client::{Client, FrameInfo, RootHandler}, + client::{Client, ClientState, FrameInfo, RootHandler}, core::values::Transform, drawable::{Alignment, Bounds, MaterialParameter, Model, ResourceID, Text, TextFit, TextStyle}, fields::BoxField, node::NodeType, spatial::Spatial, }; -use stardust_xr_molecules::{GrabData, Grabbable}; +use stardust_xr_molecules::{Grabbable, GrabbableSettings}; use std::f32::consts::PI; const APP_LIMIT: usize = 300; @@ -75,6 +75,9 @@ impl RootHandler for AppGrid { app.frame(info); } } + fn save_state(&mut self) -> ClientState { + ClientState::default() + } } fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result { @@ -124,15 +127,14 @@ impl App { ) -> Result { let root = Spatial::create(parent, Transform::from_position(position), false)?; let field = BoxField::create(&root, Transform::default(), [APP_SIZE; 3])?; - let application = Application::create(&parent.client()?, desktop_file)?; + let application = Application::create(desktop_file)?; let icon = application.icon(128, true); let grabbable = Grabbable::create( &root, Transform::identity(), &field, - GrabData { + GrabbableSettings { max_distance: 0.01, - frame_cancel_threshold: 50, ..Default::default() }, )?; @@ -186,8 +188,7 @@ impl App { .set_transform(Some(&self.root), Transform::identity()) .unwrap(); } -} -impl RootHandler for App { + fn frame(&mut self, info: FrameInfo) { let _ = self.grabbable.update(&info); diff --git a/examples/README.md b/examples/README.md deleted file mode 100644 index 087c2b8..0000000 --- a/examples/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Running the examples: - -``` -cargo run --example=sirius -cargo run --example=app_grid -cargo run --example=hexagon_launcher - -``` \ No newline at end of file diff --git a/hexagon_launcher/Cargo.toml b/hexagon_launcher/Cargo.toml new file mode 100644 index 0000000..767428b --- /dev/null +++ b/hexagon_launcher/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "hexagon_launcher" +version = "0.1.0" +edition = "2021" + +[dependencies] +tokio = { version = "1.32.0", features = ["rt", "tokio-macros", "sync"] } +protostar = { path = "../protostar" } +color-eyre = "0.6.2" +clap = "4.4.6" +manifest-dir-macros = "0.1.18" +glam = "0.24.2" +mint = "0.5.9" +tween = "2.0.1" +tracing-subscriber = "0.3.17" + +[dependencies.stardust-xr-fusion] +git = "https://github.com/StardustXR/core.git" +# path = "../../core/fusion" + +[dependencies.stardust-xr-molecules] +git = "https://github.com/StardustXR/molecules.git" +# path = "../../molecules" diff --git a/res/protostar/button.glb b/hexagon_launcher/res/protostar/button.glb similarity index 100% rename from res/protostar/button.glb rename to hexagon_launcher/res/protostar/button.glb diff --git a/hexagon_launcher/res/protostar/cartridge.glb b/hexagon_launcher/res/protostar/cartridge.glb new file mode 100644 index 0000000..507a60f Binary files /dev/null and b/hexagon_launcher/res/protostar/cartridge.glb differ diff --git a/hexagon_launcher/res/protostar/default_icon.glb b/hexagon_launcher/res/protostar/default_icon.glb new file mode 100755 index 0000000..7f2b2b2 Binary files /dev/null and b/hexagon_launcher/res/protostar/default_icon.glb differ diff --git a/res/protostar/hexagon/hex_atlas.png b/hexagon_launcher/res/protostar/hexagon/hex_atlas.png similarity index 100% rename from res/protostar/hexagon/hex_atlas.png rename to hexagon_launcher/res/protostar/hexagon/hex_atlas.png diff --git a/res/protostar/hexagon/hexagon.bin b/hexagon_launcher/res/protostar/hexagon/hexagon.bin similarity index 100% rename from res/protostar/hexagon/hexagon.bin rename to hexagon_launcher/res/protostar/hexagon/hexagon.bin diff --git a/res/protostar/hexagon/hexagon.gltf b/hexagon_launcher/res/protostar/hexagon/hexagon.gltf similarity index 100% rename from res/protostar/hexagon/hexagon.gltf rename to hexagon_launcher/res/protostar/hexagon/hexagon.gltf diff --git a/res/protostar/hexagon/icon_test.png b/hexagon_launcher/res/protostar/hexagon/icon_test.png similarity index 100% rename from res/protostar/hexagon/icon_test.png rename to hexagon_launcher/res/protostar/hexagon/icon_test.png diff --git a/hexagon_launcher/src/hex.rs b/hexagon_launcher/src/hex.rs new file mode 100644 index 0000000..b76ed89 --- /dev/null +++ b/hexagon_launcher/src/hex.rs @@ -0,0 +1,44 @@ +use crate::{APP_SIZE, PADDING}; +use tween::TweenTime; + +#[derive(Clone)] +pub struct Hex { + q: isize, + r: isize, + s: isize, +} + +pub const HEX_CENTER: Hex = Hex { q: 0, r: 0, s: 0 }; +pub const HEX_DIRECTION_VECTORS: [Hex; 6] = [ + Hex { q: 1, r: 0, s: -1 }, + Hex { q: 1, r: -1, s: 0 }, + Hex { q: 0, r: -1, s: 1 }, + Hex { q: -1, r: 0, s: 1 }, + Hex { q: -1, r: 1, s: 0 }, + Hex { q: 0, r: 1, s: -1 }, +]; + +impl Hex { + pub fn new(q: isize, r: isize, s: isize) -> Self { + Hex { q, r, s } + } + + pub fn get_coords(&self) -> [f32; 3] { + let x = 3.0 / 2.0 * (APP_SIZE + PADDING) / 2.0 * (-self.q - self.s).to_f32(); + let y = 3.0_f32.sqrt() * (APP_SIZE + PADDING) / 2.0 + * ((-self.q - self.s).to_f32() / 2.0 + self.s.to_f32()); + [x, y, 0.0] + } + + pub fn add(self, vec: &Hex) -> Self { + Hex::new(self.q + vec.q, self.r + vec.r, self.s + vec.s) + } + + pub fn neighbor(self, direction: usize) -> Self { + self.add(&HEX_DIRECTION_VECTORS[direction]) + } + + pub fn scale(self, factor: isize) -> Self { + Hex::new(self.q * factor, self.r * factor, self.s * factor) + } +} diff --git a/examples/hexagon_launcher.rs b/hexagon_launcher/src/main.rs similarity index 89% rename from examples/hexagon_launcher.rs rename to hexagon_launcher/src/main.rs index 549d7a8..5f0054c 100644 --- a/examples/hexagon_launcher.rs +++ b/hexagon_launcher/src/main.rs @@ -1,5 +1,8 @@ +pub mod hex; + use color_eyre::eyre::Result; use glam::{Quat, Vec3}; +use hex::{HEX_CENTER, HEX_DIRECTION_VECTORS}; use manifest_dir_macros::directory_relative_path; use mint::Vector3; use protostar::{ @@ -7,7 +10,7 @@ use protostar::{ xdg::{get_desktop_files, parse_desktop_file, DesktopFile, Icon, IconType}, }; use stardust_xr_fusion::{ - client::{Client, FrameInfo, RootHandler}, + client::{Client, ClientState, FrameInfo, RootHandler}, core::values::Transform, drawable::{Alignment, Bounds, MaterialParameter, Model, ResourceID, Text, TextFit, TextStyle}, fields::BoxField, @@ -15,9 +18,8 @@ use stardust_xr_fusion::{ node::NodeType, spatial::Spatial, }; -use stardust_xr_molecules::{touch_plane::TouchPlane, GrabData, Grabbable}; +use stardust_xr_molecules::{touch_plane::TouchPlane, Grabbable, GrabbableSettings}; use std::f32::consts::PI; -use tween::TweenTime; use tween::{QuartInOut, Tweener}; const APP_SIZE: f32 = 0.06; @@ -29,48 +31,6 @@ const CYAN: [f32; 4] = [0.0, 1.0, 1.0, 1.0]; const BTN_SELECTED_COLOR: [f32; 4] = [0.0, 1.0, 0.0, 1.0]; const BTN_COLOR: [f32; 4] = [1.0, 1.0, 0.0, 1.0]; -#[derive(Clone)] -struct Hex { - q: isize, - r: isize, - s: isize, -} - -const HEX_CENTER: Hex = Hex { q: 0, r: 0, s: 0 }; -const HEX_DIRECTION_VECTORS: [Hex; 6] = [ - Hex { q: 1, r: 0, s: -1 }, - Hex { q: 1, r: -1, s: 0 }, - Hex { q: 0, r: -1, s: 1 }, - Hex { q: -1, r: 0, s: 1 }, - Hex { q: -1, r: 1, s: 0 }, - Hex { q: 0, r: 1, s: -1 }, -]; - -impl Hex { - fn new(q: isize, r: isize, s: isize) -> Self { - Hex { q, r, s } - } - - fn get_coords(&self) -> [f32; 3] { - let x = 3.0 / 2.0 * (APP_SIZE + PADDING) / 2.0 * (-self.q - self.s).to_f32(); - let y = 3.0_f32.sqrt() * (APP_SIZE + PADDING) / 2.0 - * ((-self.q - self.s).to_f32() / 2.0 + self.s.to_f32()); - [x, y, 0.0] - } - - fn add(self, vec: &Hex) -> Self { - Hex::new(self.q + vec.q, self.r + vec.r, self.s + vec.s) - } - - fn neighbor(self, direction: usize) -> Self { - self.add(&HEX_DIRECTION_VECTORS[direction]) - } - - fn scale(self, factor: isize) -> Self { - Hex::new(self.q * factor, self.r * factor, self.s * factor) - } -} - #[tokio::main(flavor = "current_thread")] async fn main() -> Result<()> { color_eyre::install().unwrap(); @@ -157,6 +117,10 @@ impl RootHandler for AppHexGrid { app.frame(info); } } + + fn save_state(&mut self) -> ClientState { + ClientState::default() + } } struct Button { @@ -171,7 +135,7 @@ impl Button { client.get_root(), Transform::default(), &field, - GrabData { + GrabbableSettings { max_distance: 0.01, ..Default::default() }, @@ -203,8 +167,7 @@ impl Button { model, }) } -} -impl RootHandler for Button { + fn frame(&mut self, info: FrameInfo) { let _ = self.grabbable.update(&info); if self.grabbable.grab_action().actor_started() { @@ -218,7 +181,6 @@ impl RootHandler for Button { } // Model handling - fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result { match &icon.icon_type { IconType::Png => { @@ -271,15 +233,14 @@ impl App { ) -> Result { let position = position.into(); let field = BoxField::create(parent, Transform::default(), [APP_SIZE; 3])?; - let application = Application::create(&parent.client()?, desktop_file)?; + let application = Application::create(desktop_file)?; let icon = application.icon(128, false); let grabbable = Grabbable::create( parent, Transform::from_position(position), &field, - GrabData { + GrabbableSettings { max_distance: 0.01, - frame_cancel_threshold: 50, ..Default::default() }, )?; @@ -350,8 +311,7 @@ impl App { } self.currently_shown = !self.currently_shown; } -} -impl RootHandler for App { + fn frame(&mut self, info: FrameInfo) { let _ = self.grabbable.update(&info); @@ -435,6 +395,7 @@ impl RootHandler for App { let distance = Vec3::from(distance_vector).length_squared(); if distance > ACTIVATION_DISTANCE { + let _ = space.set_scale(None, [1.0; 3]); let _ = application.launch(&space); } }); diff --git a/protostar/Cargo.toml b/protostar/Cargo.toml new file mode 100644 index 0000000..84c53d8 --- /dev/null +++ b/protostar/Cargo.toml @@ -0,0 +1,44 @@ +[package] +name = "protostar" +version = "0.4.0" +edition = "2021" + +[dependencies] +cached = "0.43.0" +clap = { version = "4.1.3", features = ["derive"] } +color-eyre = "0.6.2" +directories = "5.0.0" +dirs = "5.0.0" +ez-pixmap = "0.2.2" +freedesktop-icons-greedy = "0.2.5" +glam = { version = "0.24.0", features = ["mint"] } +image = "0.24.5" +itertools = "0.11.0" +lazy_static = "1.4.0" +linicon-theme = "1.2.0" +manifest-dir-macros = "0.1.16" +mint = "0.5.9" +nix = "0.26.1" +regex = "1.7.1" +resvg = "0.29.0" +rustc-hash = "1.1.0" +serde = "1.0.155" +serde_json = "1.0.94" +serde_with = "2.3.1" +tokio = { version = "1.24.1", features = ["full"] } +tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } +tween = "2.0.0" +ustr = "0.9.0" +walkdir = "2.3.3" + +[dependencies.stardust-xr-fusion] +git = "https://github.com/StardustXR/core.git" +# path = "../../core/fusion" + +[dependencies.stardust-xr-molecules] +git = "https://github.com/StardustXR/molecules.git" +# path = "../../molecules" + + +[dev-dependencies] +tempdir = "0.3.7" diff --git a/protostar/res/protostar/default_icon.glb b/protostar/res/protostar/default_icon.glb new file mode 100755 index 0000000..7f2b2b2 Binary files /dev/null and b/protostar/res/protostar/default_icon.glb differ diff --git a/src/application.rs b/protostar/src/application.rs similarity index 77% rename from src/application.rs rename to protostar/src/application.rs index 2f5492d..f948ec2 100644 --- a/src/application.rs +++ b/protostar/src/application.rs @@ -2,33 +2,26 @@ use crate::xdg::{DesktopFile, Icon, IconType}; use nix::unistd::setsid; use regex::Regex; use stardust_xr_fusion::{ - client::Client, + client::ClientState, node::{NodeError, NodeType}, spatial::Spatial, - startup_settings::StartupSettings, }; use std::{ os::unix::process::CommandExt, process::{Command, Stdio}, - sync::Arc, }; #[derive(Debug, Clone)] pub struct Application { desktop_file: DesktopFile, - startup_settings: Arc, } impl Application { - pub fn create(client: &Arc, desktop_file: DesktopFile) -> Result { + pub fn create(desktop_file: DesktopFile) -> Result { if desktop_file.no_display { return Err(NodeError::DoesNotExist); } - let startup_settings = Arc::new(StartupSettings::create(client)?); - Ok(Application { - desktop_file, - startup_settings, - }) + Ok(Application { desktop_file }) } pub fn name(&self) -> Option<&str> { @@ -52,13 +45,12 @@ impl Application { } pub fn launch(&self, launch_space: &Spatial) -> Result<(), NodeError> { - self.startup_settings.set_root(launch_space)?; - let future_startup_token = self.startup_settings.generate_startup_token()?; - let future_connection_env = self - .startup_settings - .node() - .client()? - .get_connection_environment()?; + let client = launch_space.node().client()?; + let future_startup_token = client.state_token(&ClientState { + root: Some(launch_space.alias()), + ..Default::default() + })?; + let future_connection_env = client.get_connection_environment()?; let executable = self .desktop_file @@ -68,7 +60,6 @@ impl Application { tokio::task::spawn(async move { let Ok(startup_token) = future_startup_token.await else {return}; let Ok(connection_env) = future_connection_env.await else {return}; - dbg!(&connection_env); for (k, v) in connection_env.into_iter() { std::env::set_var(k, v); } diff --git a/src/lib.rs b/protostar/src/lib.rs similarity index 64% rename from src/lib.rs rename to protostar/src/lib.rs index c9c8dfe..575d35f 100644 --- a/src/lib.rs +++ b/protostar/src/lib.rs @@ -1,3 +1,2 @@ pub mod application; -pub mod protostar; pub mod xdg; diff --git a/src/xdg.rs b/protostar/src/xdg.rs similarity index 100% rename from src/xdg.rs rename to protostar/src/xdg.rs diff --git a/single/Cargo.toml b/single/Cargo.toml new file mode 100644 index 0000000..facb36f --- /dev/null +++ b/single/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "single" +version = "0.1.0" +edition = "2021" + +[dependencies] +tokio = { version = "1.32.0", features = ["rt", "tokio-macros", "sync"] } +protostar = { path = "../protostar" } +color-eyre = "0.6.2" +clap = "4.4.6" +manifest-dir-macros = "0.1.18" +glam = "0.24.2" +mint = "0.5.9" +tween = "2.0.1" +tracing-subscriber = "0.3.17" + +[dependencies.stardust-xr-fusion] +git = "https://github.com/StardustXR/core.git" +# path = "../../core/fusion" + +[dependencies.stardust-xr-molecules] +git = "https://github.com/StardustXR/molecules.git" +# path = "../../molecules" diff --git a/single/res/protostar/default_icon.glb b/single/res/protostar/default_icon.glb new file mode 100755 index 0000000..7f2b2b2 Binary files /dev/null and b/single/res/protostar/default_icon.glb differ diff --git a/single/res/protostar/hexagon/hex_atlas.png b/single/res/protostar/hexagon/hex_atlas.png new file mode 100644 index 0000000..5376c46 Binary files /dev/null and b/single/res/protostar/hexagon/hex_atlas.png differ diff --git a/single/res/protostar/hexagon/hexagon.bin b/single/res/protostar/hexagon/hexagon.bin new file mode 100644 index 0000000..f56fec4 Binary files /dev/null and b/single/res/protostar/hexagon/hexagon.bin differ diff --git a/single/res/protostar/hexagon/hexagon.gltf b/single/res/protostar/hexagon/hexagon.gltf new file mode 100644 index 0000000..f0480e3 --- /dev/null +++ b/single/res/protostar/hexagon/hexagon.gltf @@ -0,0 +1,286 @@ +{ + "asset":{ + "generator":"Khronos glTF Blender I/O v3.5.30", + "version":"2.0" + }, + "extensionsUsed":[ + "KHR_materials_unlit" + ], + "scene":0, + "scenes":[ + { + "name":"Scene", + "nodes":[ + 0, + 1 + ] + } + ], + "nodes":[ + { + "mesh":0, + "name":"Icon" + }, + { + "mesh":1, + "name":"Hex" + } + ], + "materials":[ + { + "alphaCutoff":0.5, + "alphaMode":"MASK", + "extensions":{ + "KHR_materials_unlit":{} + }, + "name":"Icon", + "pbrMetallicRoughness":{ + "baseColorTexture":{ + "index":0, + "texCoord":0 + }, + "metallicFactor":0, + "roughnessFactor":0.9 + } + }, + { + "alphaMode":"BLEND", + "extensions":{ + "KHR_materials_unlit":{} + }, + "name":"Hex", + "pbrMetallicRoughness":{ + "baseColorFactor":[ + 1, + 0, + 0, + 1 + ], + "baseColorTexture":{ + "index":1, + "texCoord":0 + }, + "metallicFactor":0, + "roughnessFactor":0.9 + } + } + ], + "meshes":[ + { + "name":"Circle", + "primitives":[ + { + "attributes":{ + "COLOR_0":0, + "POSITION":1, + "TEXCOORD_0":2, + "NORMAL":3 + }, + "indices":4, + "material":0 + } + ] + }, + { + "name":"Circle.001", + "primitives":[ + { + "attributes":{ + "COLOR_0":5, + "POSITION":6, + "TEXCOORD_0":7, + "NORMAL":8 + }, + "indices":9, + "material":1 + } + ] + } + ], + "textures":[ + { + "sampler":0, + "source":0 + }, + { + "sampler":1, + "source":1 + } + ], + "images":[ + { + "mimeType":"image/png", + "name":"icon_test", + "uri":"icon_test.png" + }, + { + "mimeType":"image/png", + "name":"hex_atlas", + "uri":"hex_atlas.png" + } + ], + "accessors":[ + { + "bufferView":0, + "componentType":5123, + "count":4, + "normalized":true, + "type":"VEC4" + }, + { + "bufferView":1, + "componentType":5126, + "count":4, + "max":[ + 0.5853440165519714, + 0.05000000074505806, + 0.5853440165519714 + ], + "min":[ + -0.5853440165519714, + 0.05000000074505806, + -0.5853440165519714 + ], + "type":"VEC3" + }, + { + "bufferView":2, + "componentType":5126, + "count":4, + "type":"VEC2" + }, + { + "bufferView":3, + "componentType":5126, + "count":4, + "type":"VEC3" + }, + { + "bufferView":4, + "componentType":5123, + "count":6, + "type":"SCALAR" + }, + { + "bufferView":5, + "componentType":5123, + "count":54, + "normalized":true, + "type":"VEC4" + }, + { + "bufferView":6, + "componentType":5126, + "count":54, + "max":[ + 1.0441828966140747, + 0.05000000074505806, + 0.9042890667915344 + ], + "min":[ + -1.0441828966140747, + 0, + -0.9042890667915344 + ], + "type":"VEC3" + }, + { + "bufferView":7, + "componentType":5126, + "count":54, + "type":"VEC2" + }, + { + "bufferView":8, + "componentType":5126, + "count":54, + "type":"VEC3" + }, + { + "bufferView":9, + "componentType":5123, + "count":84, + "type":"SCALAR" + } + ], + "bufferViews":[ + { + "buffer":0, + "byteLength":32, + "byteOffset":0, + "target":34962 + }, + { + "buffer":0, + "byteLength":48, + "byteOffset":32, + "target":34962 + }, + { + "buffer":0, + "byteLength":32, + "byteOffset":80, + "target":34962 + }, + { + "buffer":0, + "byteLength":48, + "byteOffset":112, + "target":34962 + }, + { + "buffer":0, + "byteLength":12, + "byteOffset":160, + "target":34963 + }, + { + "buffer":0, + "byteLength":432, + "byteOffset":172, + "target":34962 + }, + { + "buffer":0, + "byteLength":648, + "byteOffset":604, + "target":34962 + }, + { + "buffer":0, + "byteLength":432, + "byteOffset":1252, + "target":34962 + }, + { + "buffer":0, + "byteLength":648, + "byteOffset":1684, + "target":34962 + }, + { + "buffer":0, + "byteLength":168, + "byteOffset":2332, + "target":34963 + } + ], + "samplers":[ + { + "magFilter":9729, + "minFilter":9987, + "wrapS":33071, + "wrapT":33071 + }, + { + "magFilter":9729, + "minFilter":9987 + } + ], + "buffers":[ + { + "byteLength":2500, + "uri":"hexagon.bin" + } + ] +} diff --git a/single/res/protostar/hexagon/icon_test.png b/single/res/protostar/hexagon/icon_test.png new file mode 100644 index 0000000..68f4809 Binary files /dev/null and b/single/res/protostar/hexagon/icon_test.png differ diff --git a/src/main.rs b/single/src/main.rs similarity index 71% rename from src/main.rs rename to single/src/main.rs index 1c2e4ea..014afdc 100644 --- a/src/main.rs +++ b/single/src/main.rs @@ -1,9 +1,14 @@ +mod single; + use clap::Parser; use color_eyre::{eyre::Result, Report}; use manifest_dir_macros::directory_relative_path; -use protostar::{protostar::ProtoStar, xdg::parse_desktop_file}; +use protostar::xdg::parse_desktop_file; use stardust_xr_fusion::client::Client; use std::path::PathBuf; +use tracing_subscriber::EnvFilter; + +use crate::single::Single; #[derive(Debug, Parser)] #[clap(author, version, about, long_about = None)] @@ -14,18 +19,22 @@ struct Args { #[tokio::main(flavor = "current_thread")] async fn main() -> Result<()> { + tracing_subscriber::fmt() + .compact() + .with_env_filter(EnvFilter::from_env("LOG_LEVEL")) + .init(); color_eyre::install()?; let args = Args::parse(); let (client, event_loop) = Client::connect_with_async_loop().await?; client.set_base_prefixes(&[directory_relative_path!("res")]); - let protostar = ProtoStar::create_from_desktop_file( + let protostar = Single::create_from_desktop_file( client.get_root(), [0.0, 0.0, 0.0], parse_desktop_file(args.desktop_file).map_err(Report::msg)?, )?; - let _root = client.wrap_root(protostar); + let _root = client.wrap_root(protostar)?; tokio::select! { _ = tokio::signal::ctrl_c() => (), diff --git a/src/protostar.rs b/single/src/single.rs similarity index 92% rename from src/protostar.rs rename to single/src/single.rs index f943445..bea6795 100644 --- a/src/protostar.rs +++ b/single/src/single.rs @@ -1,23 +1,23 @@ -use crate::{ - application::Application, - xdg::{DesktopFile, Icon, IconType}, -}; use color_eyre::eyre::Result; use glam::{Quat, Vec3}; use mint::Vector3; +use protostar::{ + application::Application, + xdg::{DesktopFile, Icon, IconType}, +}; use stardust_xr_fusion::{ - client::{FrameInfo, RootHandler}, + client::{ClientState, FrameInfo, RootHandler}, core::values::Transform, drawable::{Alignment, Bounds, MaterialParameter, Model, ResourceID, Text, TextFit, TextStyle}, fields::BoxField, node::NodeType, spatial::Spatial, }; -use stardust_xr_molecules::{GrabData, Grabbable}; +use stardust_xr_molecules::{Grabbable, GrabbableSettings}; use std::f32::consts::PI; use tween::{QuartInOut, Tweener}; -const MODEL_SCALE: f32 = 0.03; +const MODEL_SCALE: f32 = 0.05; const ACTIVATION_DISTANCE: f32 = 0.5; fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result { @@ -51,7 +51,7 @@ fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result { } } -pub struct ProtoStar { +pub struct Single { application: Application, parent: Spatial, position: Vector3, @@ -65,7 +65,7 @@ pub struct ProtoStar { currently_shown: bool, } -impl ProtoStar { +impl Single { pub fn create_from_desktop_file( parent: &Spatial, position: impl Into>, @@ -73,13 +73,13 @@ impl ProtoStar { ) -> Result { let position = position.into(); let field = BoxField::create(parent, Transform::default(), [MODEL_SCALE * 2.0; 3])?; - let application = Application::create(&parent.client()?, desktop_file)?; + let application = Application::create(desktop_file)?; let icon = application.icon(128, false); let grabbable = Grabbable::create( parent, Transform::from_position(position), &field, - GrabData { + GrabbableSettings { max_distance: 0.01, ..Default::default() }, @@ -91,11 +91,8 @@ impl ProtoStar { .unwrap_or_else(|| { Ok(Model::create( grabbable.content_parent(), - Transform::from_rotation_scale( - Quat::from_rotation_x(PI / 2.0) * Quat::from_rotation_y(PI), - [MODEL_SCALE; 3], - ), - &ResourceID::new_namespaced("protostar", "hexagon/hexagon"), + Transform::from_scale([MODEL_SCALE; 3]), + &ResourceID::new_namespaced("protostar", "default_icon"), )?) })?; @@ -121,7 +118,7 @@ impl ProtoStar { ) .ok() }); - Ok(ProtoStar { + Ok(Single { parent: parent.alias(), position, grabbable, @@ -139,7 +136,7 @@ impl ProtoStar { self.grabbable.content_parent() } } -impl RootHandler for ProtoStar { +impl RootHandler for Single { fn frame(&mut self, info: FrameInfo) { let _ = self.grabbable.update(&info); @@ -235,4 +232,8 @@ impl RootHandler for ProtoStar { }); } } + + fn save_state(&mut self) -> ClientState { + ClientState::default() + } } diff --git a/sirius/Cargo.toml b/sirius/Cargo.toml new file mode 100644 index 0000000..831e652 --- /dev/null +++ b/sirius/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "sirius" +version = "0.1.0" +edition = "2021" + +[dependencies] +tokio = { version = "1.32.0", features = ["rt", "tokio-macros", "sync"] } +protostar = { path = "../protostar" } +color-eyre = "0.6.2" +clap = "4.4.6" +manifest-dir-macros = "0.1.18" +glam = "0.24.2" +mint = "0.5.9" +tween = "2.0.1" +tracing-subscriber = "0.3.17" +walkdir = "2.4.0" + +[dependencies.stardust-xr-fusion] +git = "https://github.com/StardustXR/core.git" +# path = "../../core/fusion" + +[dependencies.stardust-xr-molecules] +git = "https://github.com/StardustXR/molecules.git" +# path = "../../molecules" diff --git a/sirius/res/protostar/button.glb b/sirius/res/protostar/button.glb new file mode 100644 index 0000000..ed080ba Binary files /dev/null and b/sirius/res/protostar/button.glb differ diff --git a/sirius/res/protostar/default_icon.glb b/sirius/res/protostar/default_icon.glb new file mode 100755 index 0000000..7f2b2b2 Binary files /dev/null and b/sirius/res/protostar/default_icon.glb differ diff --git a/sirius/res/protostar/hexagon/hex_atlas.png b/sirius/res/protostar/hexagon/hex_atlas.png new file mode 100644 index 0000000..5376c46 Binary files /dev/null and b/sirius/res/protostar/hexagon/hex_atlas.png differ diff --git a/sirius/res/protostar/hexagon/hexagon.bin b/sirius/res/protostar/hexagon/hexagon.bin new file mode 100644 index 0000000..f56fec4 Binary files /dev/null and b/sirius/res/protostar/hexagon/hexagon.bin differ diff --git a/sirius/res/protostar/hexagon/hexagon.gltf b/sirius/res/protostar/hexagon/hexagon.gltf new file mode 100644 index 0000000..f0480e3 --- /dev/null +++ b/sirius/res/protostar/hexagon/hexagon.gltf @@ -0,0 +1,286 @@ +{ + "asset":{ + "generator":"Khronos glTF Blender I/O v3.5.30", + "version":"2.0" + }, + "extensionsUsed":[ + "KHR_materials_unlit" + ], + "scene":0, + "scenes":[ + { + "name":"Scene", + "nodes":[ + 0, + 1 + ] + } + ], + "nodes":[ + { + "mesh":0, + "name":"Icon" + }, + { + "mesh":1, + "name":"Hex" + } + ], + "materials":[ + { + "alphaCutoff":0.5, + "alphaMode":"MASK", + "extensions":{ + "KHR_materials_unlit":{} + }, + "name":"Icon", + "pbrMetallicRoughness":{ + "baseColorTexture":{ + "index":0, + "texCoord":0 + }, + "metallicFactor":0, + "roughnessFactor":0.9 + } + }, + { + "alphaMode":"BLEND", + "extensions":{ + "KHR_materials_unlit":{} + }, + "name":"Hex", + "pbrMetallicRoughness":{ + "baseColorFactor":[ + 1, + 0, + 0, + 1 + ], + "baseColorTexture":{ + "index":1, + "texCoord":0 + }, + "metallicFactor":0, + "roughnessFactor":0.9 + } + } + ], + "meshes":[ + { + "name":"Circle", + "primitives":[ + { + "attributes":{ + "COLOR_0":0, + "POSITION":1, + "TEXCOORD_0":2, + "NORMAL":3 + }, + "indices":4, + "material":0 + } + ] + }, + { + "name":"Circle.001", + "primitives":[ + { + "attributes":{ + "COLOR_0":5, + "POSITION":6, + "TEXCOORD_0":7, + "NORMAL":8 + }, + "indices":9, + "material":1 + } + ] + } + ], + "textures":[ + { + "sampler":0, + "source":0 + }, + { + "sampler":1, + "source":1 + } + ], + "images":[ + { + "mimeType":"image/png", + "name":"icon_test", + "uri":"icon_test.png" + }, + { + "mimeType":"image/png", + "name":"hex_atlas", + "uri":"hex_atlas.png" + } + ], + "accessors":[ + { + "bufferView":0, + "componentType":5123, + "count":4, + "normalized":true, + "type":"VEC4" + }, + { + "bufferView":1, + "componentType":5126, + "count":4, + "max":[ + 0.5853440165519714, + 0.05000000074505806, + 0.5853440165519714 + ], + "min":[ + -0.5853440165519714, + 0.05000000074505806, + -0.5853440165519714 + ], + "type":"VEC3" + }, + { + "bufferView":2, + "componentType":5126, + "count":4, + "type":"VEC2" + }, + { + "bufferView":3, + "componentType":5126, + "count":4, + "type":"VEC3" + }, + { + "bufferView":4, + "componentType":5123, + "count":6, + "type":"SCALAR" + }, + { + "bufferView":5, + "componentType":5123, + "count":54, + "normalized":true, + "type":"VEC4" + }, + { + "bufferView":6, + "componentType":5126, + "count":54, + "max":[ + 1.0441828966140747, + 0.05000000074505806, + 0.9042890667915344 + ], + "min":[ + -1.0441828966140747, + 0, + -0.9042890667915344 + ], + "type":"VEC3" + }, + { + "bufferView":7, + "componentType":5126, + "count":54, + "type":"VEC2" + }, + { + "bufferView":8, + "componentType":5126, + "count":54, + "type":"VEC3" + }, + { + "bufferView":9, + "componentType":5123, + "count":84, + "type":"SCALAR" + } + ], + "bufferViews":[ + { + "buffer":0, + "byteLength":32, + "byteOffset":0, + "target":34962 + }, + { + "buffer":0, + "byteLength":48, + "byteOffset":32, + "target":34962 + }, + { + "buffer":0, + "byteLength":32, + "byteOffset":80, + "target":34962 + }, + { + "buffer":0, + "byteLength":48, + "byteOffset":112, + "target":34962 + }, + { + "buffer":0, + "byteLength":12, + "byteOffset":160, + "target":34963 + }, + { + "buffer":0, + "byteLength":432, + "byteOffset":172, + "target":34962 + }, + { + "buffer":0, + "byteLength":648, + "byteOffset":604, + "target":34962 + }, + { + "buffer":0, + "byteLength":432, + "byteOffset":1252, + "target":34962 + }, + { + "buffer":0, + "byteLength":648, + "byteOffset":1684, + "target":34962 + }, + { + "buffer":0, + "byteLength":168, + "byteOffset":2332, + "target":34963 + } + ], + "samplers":[ + { + "magFilter":9729, + "minFilter":9987, + "wrapS":33071, + "wrapT":33071 + }, + { + "magFilter":9729, + "minFilter":9987 + } + ], + "buffers":[ + { + "byteLength":2500, + "uri":"hexagon.bin" + } + ] +} diff --git a/sirius/res/protostar/hexagon/icon_test.png b/sirius/res/protostar/hexagon/icon_test.png new file mode 100644 index 0000000..68f4809 Binary files /dev/null and b/sirius/res/protostar/hexagon/icon_test.png differ diff --git a/examples/sirius.rs b/sirius/src/main.rs similarity index 96% rename from examples/sirius.rs rename to sirius/src/main.rs index 6c916db..3c8e163 100644 --- a/examples/sirius.rs +++ b/sirius/src/main.rs @@ -8,7 +8,7 @@ use protostar::{ xdg::{parse_desktop_file, DesktopFile, Icon, IconType}, }; use stardust_xr_fusion::{ - client::{Client, FrameInfo, RootHandler}, + client::{Client, ClientState, FrameInfo, RootHandler}, core::values::Transform, drawable::{Alignment, Bounds, MaterialParameter, Model, ResourceID, Text, TextFit, TextStyle}, fields::BoxField, @@ -16,7 +16,7 @@ use stardust_xr_fusion::{ node::NodeType, spatial::Spatial, }; -use stardust_xr_molecules::{touch_plane::TouchPlane, GrabData, Grabbable}; +use stardust_xr_molecules::{touch_plane::TouchPlane, Grabbable, GrabbableSettings}; use std::{f32::consts::PI, path::PathBuf}; use tween::{QuartInOut, Tweener}; @@ -68,8 +68,12 @@ impl Sirius { let root = Spatial::create(client.get_root(), Transform::default(), false).unwrap(); let field = BoxField::create(&root, Transform::default(), [0.1; 3]).unwrap(); - let grabbable = - Grabbable::create(&root, Transform::default(), &field, GrabData::default())?; + let grabbable = Grabbable::create( + &root, + Transform::default(), + &field, + GrabbableSettings::default(), + )?; let touch_plane = TouchPlane::create( grabbable.content_parent(), Transform::default(), @@ -194,6 +198,10 @@ impl RootHandler for Sirius { .unwrap(); } } + + fn save_state(&mut self) -> ClientState { + ClientState::default() + } } fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result { @@ -248,15 +256,14 @@ impl App { ) -> Result { let position = position.into(); let field = BoxField::create(parent, Transform::default(), [APP_SIZE; 3])?; - let application = Application::create(&parent.client()?, desktop_file)?; + let application = Application::create(desktop_file)?; let icon = application.icon(128, false); let grabbable = Grabbable::create( parent, Transform::from_position(position), &field, - GrabData { + GrabbableSettings { max_distance: 0.01, - frame_cancel_threshold: 50, ..Default::default() }, )?; @@ -327,8 +334,7 @@ impl App { } self.currently_shown = !self.currently_shown; } -} -impl RootHandler for App { + fn frame(&mut self, info: FrameInfo) { let _ = self.grabbable.update(&info);