diff --git a/Cargo.lock b/Cargo.lock index 6caba97..f621a25 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,7 +35,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0bf66a7bf0b7ea4fd7742d50b64782a88f99217cf246b3f93b4162528dde520" dependencies = [ "accesskit", - "hashbrown 0.15.3", + "hashbrown 0.15.4", "immutable-chunkmap", ] @@ -47,7 +47,7 @@ checksum = "09e230718177753b4e4ad9e1d9f6cfc2f4921212d4c1c480b253f526babb258d" dependencies = [ "accesskit", "accesskit_consumer", - "hashbrown 0.15.3", + "hashbrown 0.15.4", "objc2", "objc2-app-kit", "objc2-foundation", @@ -61,7 +61,7 @@ checksum = "65178f3df98a51e4238e584fcb255cb1a4f9111820848eeddd37663be40a625f" dependencies = [ "accesskit", "accesskit_consumer", - "hashbrown 0.15.3", + "hashbrown 0.15.4", "paste", "static_assertions", "windows 0.58.0", @@ -92,9 +92,9 @@ dependencies = [ [[package]] name = "adler2" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "ahash" @@ -328,7 +328,7 @@ checksum = "f548ad2c4031f2902e3edc1f29c29e835829437de49562d8eb5dc5584d3a1043" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -437,7 +437,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -477,7 +477,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -497,7 +497,7 @@ checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -740,7 +740,7 @@ dependencies = [ "bevy_macro_utils", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -815,7 +815,7 @@ checksum = "1b837bf6c51806b10ebfa9edf1844ad80a3a0760d6c5fac4e90761df91a8901a" dependencies = [ "bevy_macro_utils", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -873,7 +873,7 @@ dependencies = [ "bevy_macro_utils", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -937,14 +937,13 @@ dependencies = [ "bevy_macro_utils", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] name = "bevy_gltf" version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a080237c0b8842ccc15a06d3379302c68580eeea4497b1c7387e470eda1f07" +source = "git+https://github.com/Schmarni-Dev/bevy?branch=gltf_backport#1f0b9587326db68611852c70b4c2d45382a51d05" dependencies = [ "base64 0.22.1", "bevy_animation", @@ -1108,7 +1107,7 @@ dependencies = [ "parking_lot 0.12.4", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", "toml_edit 0.22.27", ] @@ -1271,7 +1270,7 @@ dependencies = [ "critical-section", "foldhash", "getrandom 0.2.16", - "hashbrown 0.15.3", + "hashbrown 0.15.4", "portable-atomic", "portable-atomic-util", "serde", @@ -1321,7 +1320,7 @@ dependencies = [ "bevy_macro_utils", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", "uuid", ] @@ -1409,7 +1408,7 @@ dependencies = [ "bevy_macro_utils", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -1497,7 +1496,7 @@ dependencies = [ "bevy_macro_utils", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -1696,7 +1695,7 @@ dependencies = [ "bitflags 2.9.1", "cexpr", "clang-sys", - "itertools 0.11.0", + "itertools 0.13.0", "log", "prettyplease", "proc-macro2", @@ -1704,7 +1703,25 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.101", + "syn 2.0.103", +] + +[[package]] +name = "bindgen" +version = "0.72.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f72209734318d0b619a5e0f5129918b848c416e122a3c4ce054e03cb87b726f" +dependencies = [ + "bitflags 2.9.1", + "cexpr", + "clang-sys", + "itertools 0.13.0", + "proc-macro2", + "quote", + "regex", + "rustc-hash 2.1.1", + "shlex", + "syn 2.0.103", ] [[package]] @@ -1810,9 +1827,9 @@ checksum = "793db76d6187cd04dff33004d8e6c9cc4e05cd330500379d2394209271b4aeee" [[package]] name = "bytemuck" -version = "1.23.0" +version = "1.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9134a6ef01ce4b366b50689c94f82c14bc72bc5d0386829828a2e2752ef7958c" +checksum = "5c76a5792e44e4abe34d3abf15636779261d45a7450612059293d1d2cfc63422" dependencies = [ "bytemuck_derive", ] @@ -1825,7 +1842,7 @@ checksum = "7ecc273b49b3205b83d648f0690daa588925572cc5063745bfe547fe7ec8e1a1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -1887,9 +1904,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.26" +version = "1.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956a5e21988b87f372569b66183b78babf23ebc2e744b733e4350a752c4dafac" +checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc" dependencies = [ "jobserver", "libc", @@ -1923,9 +1940,9 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" [[package]] name = "cfg_aliases" @@ -1962,9 +1979,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.39" +version = "4.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd60e63e9be68e5fb56422e397cf9baddded06dae1d2e523401542383bc72a9f" +checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f" dependencies = [ "clap_builder", "clap_derive", @@ -1972,9 +1989,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.39" +version = "4.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89cc6392a1f72bbeb820d71f32108f61fdaf18bc526e1d23954168a67759ef51" +checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e" dependencies = [ "anstream", "anstyle", @@ -1984,21 +2001,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.32" +version = "4.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" +checksum = "d2c7947ae4cc3d851207c1adb5b5e260ff0cca11446b1d6d1423788e442257ce" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] name = "clap_lex" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" +checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" [[package]] name = "cluFlock" @@ -2236,11 +2253,11 @@ dependencies = [ [[package]] name = "coreaudio-sys" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ce857aa0b77d77287acc1ac3e37a05a8c95a2af3647d23b15f263bdaeb7562b" +checksum = "ceec7a6067e62d6f931a2baf6f3a751f4a892595bcec1461a3c94ef9949864b6" dependencies = [ - "bindgen", + "bindgen 0.72.0", ] [[package]] @@ -2418,7 +2435,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", "unicode-xid", ] @@ -2615,7 +2632,7 @@ checksum = "f97b51c5cc57ef7c5f7a0c57c250251c49ee4c28f819f87ac32f4aceabc36792" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -2626,9 +2643,9 @@ checksum = "a3d8a32ae18130a3c84dd492d4215c3d913c3b07c6b63c2eb3eb7ff1101ab7bf" [[package]] name = "enumflags2" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba2f4b465f5318854c6f8dd686ede6c0a9dc67d4b1ac241cf0eb51521a309147" +checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" dependencies = [ "enumflags2_derive", "serde", @@ -2636,13 +2653,13 @@ dependencies = [ [[package]] name = "enumflags2_derive" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4caf64a58d7a6d65ab00639b046ff54399a39f5f2554728895ace4b297cd79" +checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -2653,7 +2670,7 @@ checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -2771,9 +2788,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece" +checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d" dependencies = [ "crc32fast", "miniz_oxide", @@ -2854,7 +2871,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -2905,7 +2922,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -2945,7 +2962,7 @@ dependencies = [ "libc", "log", "rustversion", - "windows 0.61.1", + "windows 0.61.3", ] [[package]] @@ -2983,7 +3000,7 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi 0.11.1+wasi-snapshot-preview1", "wasm-bindgen", ] @@ -3030,7 +3047,7 @@ dependencies = [ "vec_map", "wasm-bindgen", "web-sys", - "windows 0.61.1", + "windows 0.61.3", ] [[package]] @@ -3112,7 +3129,7 @@ dependencies = [ "inflections", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -3175,7 +3192,7 @@ checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca" dependencies = [ "bitflags 2.9.1", "gpu-descriptor-types", - "hashbrown 0.15.3", + "hashbrown 0.15.4", ] [[package]] @@ -3261,9 +3278,9 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "hashbrown" -version = "0.15.3" +version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" +checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" dependencies = [ "equivalent", "foldhash", @@ -3302,9 +3319,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" [[package]] name = "hex" @@ -3480,7 +3497,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ "equivalent", - "hashbrown 0.15.3", + "hashbrown 0.15.4", "serde", ] @@ -3550,6 +3567,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.14.0" @@ -3708,9 +3734,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.172" +version = "0.2.173" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +checksum = "d8cfeafaffdbc32176b64fb251369d52ea9f0a8fbc6f8759edffef7b525d64bb" [[package]] name = "libloading" @@ -3719,7 +3745,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" dependencies = [ "cfg-if", - "windows-targets 0.53.0", + "windows-targets 0.53.2", ] [[package]] @@ -3736,7 +3762,7 @@ checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ "bitflags 2.9.1", "libc", - "redox_syscall 0.5.12", + "redox_syscall 0.5.13", ] [[package]] @@ -3810,7 +3836,7 @@ dependencies = [ "proc-macro2", "quote", "regex-syntax 0.8.5", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -3862,7 +3888,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -3882,9 +3908,9 @@ checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "memchr" -version = "2.7.4" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "memmap2" @@ -3951,7 +3977,7 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -3968,9 +3994,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ "adler2", "simd-adler32", @@ -3992,7 +4018,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" dependencies = [ "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi 0.11.1+wasi-snapshot-preview1", "windows-sys 0.59.0", ] @@ -4201,7 +4227,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -4250,10 +4276,10 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -4667,7 +4693,7 @@ checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.12", + "redox_syscall 0.5.13", "smallvec", "windows-targets 0.52.6", ] @@ -4746,7 +4772,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", "unicase", ] @@ -4783,7 +4809,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -4890,12 +4916,12 @@ checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" [[package]] name = "prettyplease" -version = "0.2.33" +version = "0.2.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dee91521343f4c5c6a63edd65e54f31f5c92fe8978c40a4282f8372194c6a7d" +checksum = "6837b9e10d61f45f987d50808f83d1ee3d206c66acf650c3e4ae2e1f6ddedf55" dependencies = [ "proc-macro2", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -4942,7 +4968,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30" dependencies = [ "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -4962,10 +4988,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" dependencies = [ "anyhow", - "itertools 0.11.0", + "itertools 0.14.0", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -5145,9 +5171,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.12" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "928fca9cf2aa042393a8325b9ead81d2f0df4cb12e1e24cef072922ccd99c5af" +checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6" dependencies = [ "bitflags 2.9.1", ] @@ -5243,9 +5269,9 @@ checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97" [[package]] name = "rustc-demangle" -version = "0.1.24" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" [[package]] name = "rustc-hash" @@ -5401,7 +5427,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -5424,7 +5450,7 @@ checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -5508,12 +5534,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] +checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d" [[package]] name = "slotmap" @@ -5526,9 +5549,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.15.0" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" dependencies = [ "serde", ] @@ -5536,7 +5559,7 @@ dependencies = [ [[package]] name = "smithay" version = "0.6.0" -source = "git+https://github.com/smithay/smithay.git#776ba424423584400e76317e688b160546e68ca7" +source = "git+https://github.com/smithay/smithay.git#52107d3d13bbfb7222e3d87cf2588374f83a2a0b" dependencies = [ "appendlist", "atomic_float", @@ -5831,7 +5854,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -5864,9 +5887,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.101" +version = "2.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +checksum = "e4307e30089d6fd6aff212f2da3a1f9e32f3223b1f010fb09b7c95f90f3ca1e8" dependencies = [ "proc-macro2", "quote", @@ -5972,7 +5995,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -5983,17 +6006,16 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] name = "thread_local" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" dependencies = [ "cfg-if", - "once_cell", ] [[package]] @@ -6072,7 +6094,7 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -6142,7 +6164,7 @@ dependencies = [ "serde_spanned", "toml_datetime", "toml_write", - "winnow 0.7.10", + "winnow 0.7.11", ] [[package]] @@ -6247,7 +6269,7 @@ checksum = "1b1ffbcf9c6f6b99d386e7444eb608ba646ae452a36b39737deb9663b610f662" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -6287,7 +6309,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528bdd1f0e27b5dd9a4ededf154e824b0532731e4af73bb531de46276e0aab1e" dependencies = [ - "bindgen", + "bindgen 0.70.1", "cc", "cfg-if", "once_cell", @@ -6383,9 +6405,9 @@ checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" [[package]] name = "twox-hash" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7b17f197b3050ba473acf9181f7b1d3b66d1cf7356c6cc57886662276e65908" +checksum = "8b907da542cbced5261bd3256de1b3a1bf340a3d37f93425a07362a1d687de56" [[package]] name = "typeid" @@ -6508,7 +6530,7 @@ checksum = "41b6d82be61465f97d42bd1d15bf20f3b0a3a0905018f38f9d6f6962055b0b5c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -6544,9 +6566,9 @@ dependencies = [ [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasi" @@ -6579,7 +6601,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", "wasm-bindgen-shared", ] @@ -6614,7 +6636,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6916,7 +6938,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -6957,9 +6979,9 @@ dependencies = [ [[package]] name = "windows" -version = "0.61.1" +version = "0.61.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5ee8f3d025738cb02bad7868bbb5f8a6327501e870bf51f1b455b0a2454a419" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" dependencies = [ "windows-collections", "windows-core 0.61.2", @@ -7044,7 +7066,7 @@ checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -7055,7 +7077,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -7066,7 +7088,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -7077,7 +7099,7 @@ checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -7088,7 +7110,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -7099,14 +7121,14 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] name = "windows-link" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" [[package]] name = "windows-numerics" @@ -7248,9 +7270,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.53.0" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" +checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" dependencies = [ "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", @@ -7514,9 +7536,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.7.10" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec" +checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd" dependencies = [ "memchr", ] @@ -7674,7 +7696,7 @@ dependencies = [ "tracing", "uds_windows", "windows-sys 0.59.0", - "winnow 0.7.10", + "winnow 0.7.11", "zbus_macros", "zbus_names", "zvariant", @@ -7689,7 +7711,7 @@ dependencies = [ "proc-macro-crate 3.3.0", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", "zbus_names", "zvariant", "zvariant_utils", @@ -7703,7 +7725,7 @@ checksum = "7be68e64bf6ce8db94f63e72f0c7eb9a60d733f7e0499e628dfab0f84d6bcb97" dependencies = [ "serde", "static_assertions", - "winnow 0.7.10", + "winnow 0.7.11", "zvariant", ] @@ -7730,7 +7752,7 @@ checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", ] [[package]] @@ -7742,7 +7764,7 @@ dependencies = [ "endi", "enumflags2", "serde", - "winnow 0.7.10", + "winnow 0.7.11", "zvariant_derive", "zvariant_utils", ] @@ -7756,7 +7778,7 @@ dependencies = [ "proc-macro-crate 3.3.0", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.103", "zvariant_utils", ] @@ -7770,6 +7792,6 @@ dependencies = [ "quote", "serde", "static_assertions", - "syn 2.0.101", - "winnow 0.7.10", + "syn 2.0.103", + "winnow 0.7.11", ] diff --git a/Cargo.toml b/Cargo.toml index 68d4506..df31df4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,6 +44,7 @@ opt-level = 3 [patch.crates-io] bevy_mod_openxr = { git = "https://github.com/Schmarni-Dev/bevy_openxr", branch = "non_default_wait_frame_system" } bevy_mod_xr = { git = "https://github.com/Schmarni-Dev/bevy_openxr", branch = "non_default_wait_frame_system" } +bevy_gltf = { git = "https://github.com/Schmarni-Dev/bevy", branch = "gltf_backport" } [dependencies] # small utility thingys diff --git a/src/main.rs b/src/main.rs index 756c246..970a8db 100644 --- a/src/main.rs +++ b/src/main.rs @@ -50,6 +50,7 @@ use directories::ProjectDirs; use nodes::drawable::model::ModelNodePlugin; use nodes::spatial::SpatialNodePlugin; use objects::ServerObjects; +use objects::input::sk_controller::ControllerPlugin; use objects::input::sk_hand::HandPlugin; use objects::play_space::PlaySpacePlugin; use openxr::{EnvironmentBlendMode, ReferenceSpaceType}; @@ -351,8 +352,7 @@ fn bevy_loop( .disable::() // we don't do any action stuff that needs to integrate with the ecosystem .disable::() - .disable::() - .disable::(), + .disable::(), ); app.add_plugins(( bevy_sk::hand::HandPlugin, @@ -390,8 +390,11 @@ fn bevy_loop( ModelNodePlugin, PlaySpacePlugin, HandPlugin, + ControllerPlugin, )); - ready_notifier.notify_waiters(); + app.add_systems(PostStartup, move || { + ready_notifier.notify_waiters(); + }); app.add_systems( XrFirst, xr_step diff --git a/src/nodes/drawable/model.rs b/src/nodes/drawable/model.rs index 1f99348..e893e05 100644 --- a/src/nodes/drawable/model.rs +++ b/src/nodes/drawable/model.rs @@ -146,7 +146,7 @@ fn gen_model_parts( mesh_entity: OnceLock::new(), path, space: spatial.clone(), - model: Arc::downgrade(&model), + _model: Arc::downgrade(&model), pending_material_parameters: Mutex::default(), pending_material_replacement: Mutex::default(), aliases: AliasList::default(), @@ -370,7 +370,7 @@ impl MaterialParameter { } } mat.alpha_mode = AlphaMode::AlphaToCoverage; - mat.use_stereokit_uvs = true; + mat.use_stereokit_uvs = false; } } } @@ -416,7 +416,7 @@ impl Material { .as_ref() .map(|p| asset_server.load(p.as_path())), spherical_harmonics: bevy_sk::skytext::SPHERICAL_HARMONICS_HANDLE, - use_stereokit_uvs: true, + use_stereokit_uvs: false, } } } @@ -426,7 +426,7 @@ pub struct ModelPart { mesh_entity: OnceLock, path: String, space: Arc, - model: Weak, + _model: Weak, pending_material_parameters: Mutex>, pending_material_replacement: Mutex>, aliases: AliasList, @@ -437,6 +437,11 @@ impl ModelPart { .lock() .replace(replacement); } + pub fn set_material_parameter(&self, parameter_name: String, value: MaterialParameter) { + self.pending_material_parameters + .lock() + .insert(parameter_name, value); + } } impl ModelPartAspect for ModelPart { #[doc = "Set this model part's material to one that cuts a hole in the world. Often used for overlays/passthrough where you want to show the background through an object."] @@ -465,11 +470,7 @@ impl ModelPartAspect for ModelPart { value: MaterialParameter, ) -> Result<()> { let model_part = node.get_aspect::()?; - model_part - .pending_material_parameters - .lock() - .insert(parameter_name, value); - + model_part.set_material_parameter(parameter_name, value); Ok(()) } } @@ -531,24 +532,15 @@ impl Model { node.add_aspect_raw(model.clone()); Ok(model) } -} -impl ModelAspect for Model { - #[doc = "Bind a model part to the node with the ID input."] - fn bind_model_part( - node: Arc, - calling_client: Arc, - id: u64, - part_path: String, - ) -> Result<()> { - let model = node.get_aspect::()?; - let part = match model + pub fn get_model_part(self: &Arc, part_path: String) -> Result> { + let part = match self .parts .get() .map(|v| v.iter().find(|p| p.path == part_path)) { Some(Some(part)) => part.clone(), Some(None) => { - let paths = model + let paths = self .parts .get() .unwrap() @@ -560,26 +552,38 @@ impl ModelAspect for Model { ); } None => { - let part_node = calling_client - .scenegraph - .add_node(Node::generate(&calling_client, false)); - let model = node.get_aspect::()?; + // TODO: this could be a denail of service vector + let client = self.space.node().unwrap().get_client().unwrap(); + let part_node = client.scenegraph.add_node(Node::generate(&client, false)); let spatial = - Spatial::add_to(&part_node, Some(model.space.clone()), Mat4::IDENTITY, false); + Spatial::add_to(&part_node, Some(self.space.clone()), Mat4::IDENTITY, false); let part = part_node.add_aspect(ModelPart { entity: OnceLock::new(), mesh_entity: OnceLock::new(), path: part_path, space: spatial, - model: Arc::downgrade(&model), + _model: Arc::downgrade(self), pending_material_parameters: Mutex::default(), pending_material_replacement: Mutex::default(), aliases: AliasList::default(), }); - model.pre_bound_parts.lock().push(part.clone()); + self.pre_bound_parts.lock().push(part.clone()); part } }; + Ok(part) + } +} +impl ModelAspect for Model { + #[doc = "Bind a model part to the node with the ID input."] + fn bind_model_part( + node: Arc, + calling_client: Arc, + id: u64, + part_path: String, + ) -> Result<()> { + let model = node.get_aspect::()?; + let part = model.get_model_part(part_path)?; Alias::create_with_id( &part.space.node().unwrap(), &calling_client, diff --git a/src/objects/input/sk_controller.rs b/src/objects/input/sk_controller.rs index ba35273..086192e 100644 --- a/src/objects/input/sk_controller.rs +++ b/src/objects/input/sk_controller.rs @@ -1,27 +1,236 @@ use super::{CaptureManager, get_sorted_handlers}; use crate::{ + DbusConnection, PreFrameWait, core::client::INTERNAL_CLIENT, nodes::{ Node, OwnedNode, + drawable::{ + MaterialParameter, + model::{Model, ModelPart}, + }, fields::{Field, FieldTrait}, input::{INPUT_HANDLER_REGISTRY, InputDataType, InputHandler, InputMethod, Tip}, spatial::Spatial, }, objects::{ObjectHandle, SpatialRef, Tracked}, }; +use bevy::{asset::Handle, ecs::resource::Resource}; +use bevy::{math::Affine3, prelude::*}; +use bevy_mod_openxr::{ + action_binding::{OxrSendActionBindings, OxrSuggestActionBinding}, + helper_traits::{ToIsometry3d, ToVec2}, + resources::{OxrFrameState, OxrInstance}, + session::OxrSession, +}; +use bevy_mod_xr::{ + hands::HandSide, + session::{XrPreDestroySession, XrSessionCreated, XrSessionCreatedEvent}, + spaces::{XrPrimaryReferenceSpace, XrReferenceSpace, XrSpace}, +}; +use bevy_sk::vr_materials::PbrMaterial; use color_eyre::eyre::Result; -use glam::{Mat4, Vec2, Vec3}; +use glam::{Affine3A, Mat4, Vec2, Vec3}; +use openxr::{Action, ActiveActionSet, SpaceLocationFlags}; use serde::{Deserialize, Serialize}; -use stardust_xr::values::Datamap; -use std::sync::Arc; +use stardust_xr::values::{Datamap, ResourceID, color::Rgb}; +use std::{ + borrow::Cow, + fs, + path::{Path, PathBuf}, + str::FromStr, + sync::Arc, +}; use stereokit_rust::{ material::Material, - model::Model, sk::MainThreadToken, system::{Handed, Input}, util::Color128, }; use zbus::Connection; +pub struct ControllerPlugin; +const CURSOR_MODEL_PATH: &str = "/tmp/stardust_server/models/cursor.glb"; +impl Plugin for ControllerPlugin { + fn build(&self, app: &mut App) { + let cursor = include_bytes!("cursor.glb"); + fs::create_dir_all( + PathBuf::from_str(CURSOR_MODEL_PATH) + .unwrap() + .parent() + .unwrap(), + ); + fs::write(CURSOR_MODEL_PATH, cursor).expect("can't write tmp cursor model file"); + app.add_systems(OxrSendActionBindings, suggest_bindings.run_if(run_once)); + app.add_systems( + PostUpdate, + create_spaces.run_if(on_event::), + ); + app.add_systems(XrPreDestroySession, destroy_spaces); + app.add_systems(Startup, setup.run_if(resource_exists::)); + app.add_systems(PreFrameWait, update); + } +} + +// the api is just slightly nicer when using the bevy_mod_openxr solution okay? +fn suggest_bindings( + instance: Res, + actions: Res, + mut suggest: EventWriter, +) { + let mut bind_all = |interaction_profile: &'static str, + bindings: &[(openxr::sys::Action, &[&'static str])]| { + for (action, bindings) in bindings { + suggest.write(OxrSuggestActionBinding { + action: *action, + interaction_profile: interaction_profile.into(), + bindings: bindings.iter().copied().map(Cow::Borrowed).collect(), + }); + } + }; + bind_all( + "/interaction_profiles/oculus/touch_controller", + &[ + ( + actions.trigger.as_raw(), + &[ + "/user/hand/left/input/trigger/value", + "/user/hand/right/input/trigger/value", + ], + ), + ( + actions.stick_click.as_raw(), + &[ + "/user/hand/left/input/thumbstick/click", + "/user/hand/right/input/thumbstick/click", + ], + ), + ( + actions.button.as_raw(), + &[ + "/user/hand/left/input/x/click", + "/user/hand/left/input/y/click", + "/user/hand/right/input/a/click", + "/user/hand/right/input/b/click", + ], + ), + ( + actions.grip.as_raw(), + &[ + "/user/hand/left/input/squeeze/value", + "/user/hand/right/input/squeeze/value", + ], + ), + ( + actions.stick.as_raw(), + &[ + "/user/hand/left/input/thumbstick", + "/user/hand/right/input/thumbstick", + ], + ), + ( + actions.space.as_raw(), + &[ + "/user/hand/left/input/aim/pose", + "/user/hand/right/input/aim/pose", + ], + ), + ], + ); +} + +fn update( + mut controllers: ResMut, + actions: Res, + session: Option>, + ref_space: Option>, + state: Option>, +) { + info!("calling update"); + let (Some(session), Some(state), Some(ref_space)) = (session, state, ref_space) else { + info!("something is missing"); + controllers.left.set_enabled(false); + controllers.right.set_enabled(false); + return; + }; + session + .sync_actions(&[ActiveActionSet::new(&actions.set)]) + .unwrap(); + let time = state.predicted_display_time; + // stupid bevy gltf loading issue (rotated 180 degrees on the y axis) + controllers + .left + .update(&session, &actions, time, ref_space.0); + controllers + .right + .update(&session, &actions, time, ref_space.0); +} + +fn create_spaces( + session: Res, + mut controllers: ResMut, + actions: Res, +) { + // if we ever need more actions than just these we should fully swith to the + // bevy_mod_openxr provided stuff + session.attach_action_sets(&[&actions.set]); + session + .sync_actions(&[ActiveActionSet::new(&actions.set)]) + .unwrap(); + + let instance = session.instance(); + let left = instance.string_to_path("/user/hand/left").unwrap(); + let right = instance.string_to_path("/user/hand/right").unwrap(); + let left = session + .create_action_space(&actions.space, left, Isometry3d::IDENTITY) + .unwrap(); + let right = session + .create_action_space(&actions.space, right, Isometry3d::IDENTITY) + .unwrap(); + controllers.left.space = Some(left); + controllers.right.space = Some(right); +} + +fn destroy_spaces(session: Res, mut controllers: ResMut) { + if let Some(space) = controllers.left.space.take() { + session.destroy_space(space); + } + if let Some(space) = controllers.right.space.take() { + session.destroy_space(space); + } +} + +fn setup(instance: Res, connection: Res, mut cmds: Commands) { + tokio::task::spawn({ + let connection = connection.clone(); + async move { + connection + .request_name("org.stardustxr.Controllers") + .await + .unwrap(); + } + }); + let set = instance + .create_action_set("input_method_actions", "Input Method Action Source", 0) + .unwrap(); + let paths = &[ + instance.string_to_path("/user/hand/left").unwrap(), + instance.string_to_path("/user/hand/right").unwrap(), + ]; + let actions = Actions { + trigger: set.create_action("trigger", "Select", paths).unwrap(), + stick_click: set.create_action("stick_click", "Middle", paths).unwrap(), + button: set.create_action("face_button", "Context", paths).unwrap(), + grip: set.create_action("grip", "Grab", paths).unwrap(), + stick: set.create_action("stick", "Scroll", paths).unwrap(), + space: set.create_action("pose", "Location", paths).unwrap(), + set, + }; + let controllers = Controllers { + left: SkController::new(&connection, HandSide::Left).unwrap(), + right: SkController::new(&connection, HandSide::Right).unwrap(), + }; + cmds.insert_resource(controllers); + cmds.insert_resource(actions); +} #[derive(Default, Debug, Deserialize, Serialize)] struct ControllerDatamap { @@ -31,58 +240,64 @@ struct ControllerDatamap { grab: f32, scroll: Vec2, } +#[derive(Resource)] +struct Actions { + set: openxr::ActionSet, + trigger: openxr::Action, + stick_click: openxr::Action, + button: openxr::Action, + grip: openxr::Action, + space: openxr::Action, + stick: openxr::Action, +} +#[derive(Resource)] +struct Controllers { + left: SkController, + right: SkController, +} pub struct SkController { object_handle: ObjectHandle, input: Arc, - handed: Handed, - model: Model, - material: Material, + side: HandSide, + model: Arc, + model_part: Arc, capture_manager: CaptureManager, datamap: ControllerDatamap, tracked: ObjectHandle, + space: Option, } impl SkController { - pub fn new(connection: &Connection, handed: Handed) -> Result { - Input::set_controller_model(handed, Some(Model::new())); + fn new(connection: &Connection, side: HandSide) -> Result { let path = "/org/stardustxr/Controller/".to_string() - + match handed { - Handed::Left => "left", - _ => "right", + + match side { + HandSide::Left => "left", + HandSide::Right => "right", }; let (spatial, object_handle) = SpatialRef::create(connection, &path); let tracked = Tracked::new(connection, &path); - let model = Model::copy(&Model::from_memory( - "cursor.glb", - include_bytes!("cursor.glb"), - None, - )?); - let model_nodes = model.get_nodes(); - let mut model_node = model_nodes.visuals().next().unwrap(); - let material = Material::copy(&model_node.get_material().unwrap()); - model_node.material(&material); let tip = InputDataType::Tip(Tip::default()); + let node = spatial.node().unwrap(); + let model = Model::add_to(&node, ResourceID::Direct(CURSOR_MODEL_PATH.into())).unwrap(); + let model_part = model.get_model_part("Cursor".to_string()).unwrap(); let input = InputMethod::add_to( - &spatial.node().unwrap(), + &node, tip, Datamap::from_typed(ControllerDatamap::default())?, )?; Ok(SkController { object_handle, input, - handed, + side, model, - material, + model_part, capture_manager: CaptureManager::default(), datamap: Default::default(), tracked, + space: None, }) } - pub fn update(&mut self, token: &MainThreadToken) { - let controller = Input::controller(self.handed); - let input_node = self.input.spatial.node().unwrap(); - input_node.set_enabled(controller.tracked.is_active()); - let enabled = input_node.enabled(); + pub fn set_enabled(&self, enabled: bool) { tokio::spawn({ // this is suboptimal since it probably allocates a fresh string every frame let handle = self.tracked.clone(); @@ -90,32 +305,77 @@ impl SkController { handle.set_tracked(enabled).await; } }); + } + fn update( + &mut self, + session: &OxrSession, + actions: &Actions, + time: openxr::Time, + ref_space: XrReferenceSpace, + ) { + let Some(space) = self.space.as_ref() else { + info!("no space 3:"); + return; + }; + let Ok(location) = session + .locate_space(space, &ref_space, time) + .inspect_err(|err| error!("error while locating controller space: {err}")) + else { + return; + }; + let enabled = location.location_flags.contains( + SpaceLocationFlags::POSITION_VALID + | SpaceLocationFlags::POSITION_TRACKED + | SpaceLocationFlags::ORIENTATION_VALID + | SpaceLocationFlags::ORIENTATION_TRACKED, + ); + info!("{:#?}", location.location_flags); + self.set_enabled(enabled); if enabled { - let world_transform = Mat4::from_rotation_translation( - controller.aim.orientation.into(), - controller.aim.position.into(), + info!("update"); + let world_transform = Mat4::from(Affine3A::from(location.pose.to_xr_pose())); + self.model_part + .set_material_parameter("roughness".to_string(), MaterialParameter::Float(1.0)); + // self.model_part + // .set_material_parameter("metallic".to_string(), MaterialParameter::Float(0.0)); + self.model_part.set_material_parameter( + "color".to_string(), + MaterialParameter::Color(stardust_xr::values::Color::new( + if self.capture_manager.capture.upgrade().is_none() { + Rgb::new(1.0, 1.0, 1.0) + } else { + Rgb::new(0.0, 1.0, 0.75) + }, + 1.0, + )), ); - self.material - .color_tint(if self.capture_manager.capture.upgrade().is_none() { - Color128::new_rgb(1.0, 1.0, 1.0) - } else { - Color128::new_rgb(0.0, 1.0, 0.75) - }); - self.model.draw( - token, - world_transform * Mat4::from_scale(Vec3::ONE * 0.02), - None, - None, - ); - self.input.spatial.set_local_transform(world_transform); + self.input + .spatial + .set_local_transform(world_transform * Mat4::from_scale(Vec3::splat(0.02))); + } + let path = session + .instance() + .string_to_path(match self.side { + HandSide::Left => "/user/hand/left", + HandSide::Right => "/user/hand/right", + }) + .unwrap(); + fn get( + session: &OxrSession, + path: openxr::Path, + action: &Action, + ) -> T { + action + .state(session, path) + .map(|v| v.current_state) + .unwrap_or_default() } - self.datamap = ControllerDatamap { - select: controller.trigger, - middle: controller.stick_click.is_active() as u32 as f32, - context: controller.is_x2_pressed() as u32 as f32, - grab: controller.grip, - scroll: controller.stick.into(), + select: get(session, path, &actions.trigger), + middle: get(session, path, &actions.stick_click) as u32 as f32, + context: get(session, path, &actions.button) as u32 as f32, + grab: get(session, path, &actions.grip), + scroll: get(session, path, &actions.stick).to_vec2(), }; *self.input.datamap.lock() = Datamap::from_typed(&self.datamap).unwrap(); diff --git a/src/objects/mod.rs b/src/objects/mod.rs index aae5d36..dba3085 100644 --- a/src/objects/mod.rs +++ b/src/objects/mod.rs @@ -33,8 +33,8 @@ pub mod play_space; enum Inputs { XR { - controller_left: SkController, - controller_right: SkController, + // controller_left: SkController, + // controller_right: SkController, // hand_left: SkHand, // hand_right: SkHand, eye_pointer: Option, @@ -95,8 +95,6 @@ impl ServerObjects { let inputs = if sk.get_active_display_mode() == DisplayMode::MixedReality { Inputs::XR { - controller_left: SkController::new(&connection, Handed::Left).unwrap(), - controller_right: SkController::new(&connection, Handed::Right).unwrap(), // hand_left: SkHand::new(&connection, Handed::Left).unwrap(), // hand_right: SkHand::new(&connection, Handed::Right).unwrap(), eye_pointer: Device::has_eye_gaze() @@ -166,14 +164,14 @@ impl ServerObjects { match &mut self.inputs { Inputs::XR { - controller_left, - controller_right, + // controller_left, + // controller_right, eye_pointer, } => { - if !self.disable_controllers { - controller_left.update(token); - controller_right.update(token); - } + // if !self.disable_controllers { + // controller_left.update(token); + // controller_right.update(token); + // } Input::hand_visible(Handed::Left, !self.disable_hands); Input::hand_visible(Handed::Right, !self.disable_hands); // if !self.disable_hands {