Compare commits
945
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
291f31adb2 | ||
|
|
e2cc93f90e | ||
|
|
eb9fd869cb | ||
|
|
33fe0146cb | ||
|
|
5671c463a7 | ||
|
|
395c5f921b | ||
|
|
d3db1aecf8 | ||
|
|
1ba4d78f2d | ||
|
|
e906c4a88b | ||
|
|
3ea447b9e2 | ||
|
|
15d72d0698 | ||
|
|
4adb97806b | ||
|
|
9fdc79af9f | ||
|
|
e9b574327b | ||
|
|
ed7ae70b1d | ||
|
|
deb1d3e346 | ||
|
|
dc9ad50c7c | ||
|
|
6a04765718 | ||
|
|
11ffdab312 | ||
|
|
064b2706a3 | ||
|
|
98d6dc92e2 | ||
|
|
14ec355d60 | ||
|
|
121c322082 | ||
|
|
95ea865cb7 | ||
|
|
324aae6c68 | ||
|
|
fb3fbc720f | ||
|
|
105c6008f0 | ||
|
|
3aff86b7ae | ||
|
|
40f2079268 | ||
|
|
c78bca4ddc | ||
|
|
6f9e146aa3 | ||
|
|
dcc7579273 | ||
|
|
312a7b2373 | ||
|
|
c64af3ac90 | ||
|
|
6b48898774 | ||
|
|
07657d7281 | ||
|
|
b27f8dd831 | ||
|
|
58c0e015a0 | ||
|
|
8eff464261 | ||
|
|
a5837b47c7 | ||
|
|
a052aac4ca | ||
|
|
55c6cd2ecd | ||
|
|
e0f5a84d8d | ||
|
|
2a15f372a5 | ||
|
|
fdd6182414 | ||
|
|
332ca1a7f5 | ||
|
|
bbc6e4cc36 | ||
|
|
49b8758b8c | ||
|
|
88640364b0 | ||
|
|
0fa471d688 | ||
|
|
a1d2e6a135 | ||
|
|
0654a9ab79 | ||
|
|
3c927dd80b | ||
|
|
116e9e5454 | ||
|
|
ad7391d51b | ||
|
|
42b3417ba9 | ||
|
|
3663709b69 | ||
|
|
f187cdda9d | ||
|
|
f3af24ba57 | ||
|
|
d81be2ae03 | ||
|
|
9e9fc859f5 | ||
|
|
474e55ba68 | ||
|
|
5d7acfc265 | ||
|
|
1085f79072 | ||
|
|
ed1e751f00 | ||
|
|
affbbe2b46 | ||
|
|
762e0dc4ee | ||
|
|
28a8fbd743 | ||
|
|
15716d04c6 | ||
|
|
9bad971d8a | ||
|
|
8f4cac3735 | ||
|
|
f9d976a8f9 | ||
|
|
8738131fb1 | ||
|
|
8333322cd2 | ||
|
|
1a49cee5d0 | ||
|
|
5204b61ad6 | ||
|
|
7836d15322 | ||
|
|
c7881fbc9e | ||
|
|
6e8c4df34f | ||
|
|
ea7e345d2c | ||
|
|
c564436377 | ||
|
|
e604848409 | ||
|
|
88fd1dfed2 | ||
|
|
2150a117f4 | ||
|
|
cb60fe1d94 | ||
|
|
7448b2b22c | ||
|
|
84bd79a736 | ||
|
|
16bb157163 | ||
|
|
075ed2dfe0 | ||
|
|
8242baf0ae | ||
|
|
f5fd1ecb9e | ||
|
|
da950e0857 | ||
|
|
57da74d69f | ||
|
|
874ee96589 | ||
|
|
3bdd7a46be | ||
|
|
b52ab171be | ||
|
|
2f70558d31 | ||
|
|
ba4d708bc1 | ||
|
|
0bea16fd53 | ||
|
|
ef0f6373b1 | ||
|
|
d44e7aba9c | ||
|
|
85a635069f | ||
|
|
434f84e5f7 | ||
|
|
ca59f46751 | ||
|
|
4749c15aa4 | ||
|
|
a6da4e6dc9 | ||
|
|
80e838f7c5 | ||
|
|
12bb615e35 | ||
|
|
981e9587a2 | ||
|
|
2027dd04d0 | ||
|
|
21e14ea14e | ||
|
|
486abef4a6 | ||
|
|
8c8bd6bd1a | ||
|
|
333e080d1c | ||
|
|
774ca3a19e | ||
|
|
c99db1ccd0 | ||
|
|
6b3d67eb7a | ||
|
|
daea840c48 | ||
|
|
4fb50ed556 | ||
|
|
49276fd5d8 | ||
|
|
aa3a94e76d | ||
|
|
bd624e8258 | ||
|
|
3ecb9d5069 | ||
|
|
d462ce4f27 | ||
|
|
f172737b91 | ||
|
|
8f166bb993 | ||
|
|
48e6704303 | ||
|
|
e44ae9d4e2 | ||
|
|
79fed879e2 | ||
|
|
bf77b93a17 | ||
|
|
2d2f064576 | ||
|
|
7e93d25ce0 | ||
|
|
96abf3e99e | ||
|
|
44915ffd8f | ||
|
|
b61d991a62 | ||
|
|
a54ed2d090 | ||
|
|
b33de5ef4b | ||
|
|
66a2ffda82 | ||
|
|
e0fc008936 | ||
|
|
3994a91636 | ||
|
|
c59d4486bc | ||
|
|
3a71509ff8 | ||
|
|
3c56ff7403 | ||
|
|
a91b8982d2 | ||
|
|
3dc1547721 | ||
|
|
6452447d9c | ||
|
|
54b4aba7af | ||
|
|
c40d9eeddc | ||
|
|
741114272a | ||
|
|
f5a0554384 | ||
|
|
6ce05184af | ||
|
|
ef233a66da | ||
|
|
c414be0087 | ||
|
|
08643d6a14 | ||
|
|
001f91b607 | ||
|
|
fe516ccc24 | ||
|
|
0a049b163a | ||
|
|
37c40d3b6f | ||
|
|
1ca43be072 | ||
|
|
9b220e6f70 | ||
|
|
84d172f2e8 | ||
|
|
80ee73128d | ||
|
|
5e359fe983 | ||
|
|
b7d17db0c7 | ||
|
|
dba182ea51 | ||
|
|
2e9f2c8646 | ||
|
|
4226485c57 | ||
|
|
9352db046a | ||
|
|
e4b4bfa66d | ||
|
|
12834824ab | ||
|
|
a5b1b6dbeb | ||
|
|
45710151aa | ||
|
|
44879e45ab | ||
|
|
d747f4dd04 | ||
|
|
04639417c4 | ||
|
|
86e58449c2 | ||
|
|
f1abbfd490 | ||
|
|
8e03841b94 | ||
|
|
e3a5496599 | ||
|
|
52e53f0591 | ||
|
|
6ff72e0425 | ||
|
|
eb94356092 | ||
|
|
ed8316f320 | ||
|
|
32724d359f | ||
|
|
d30ddc96e9 | ||
|
|
3c148bd1dd | ||
|
|
00d2727049 | ||
|
|
8b54ba1643 | ||
|
|
b5c5f0e09d | ||
|
|
9491f02bc0 | ||
|
|
4d1de2eab9 | ||
|
|
eed9e052fc | ||
|
|
82b6ebc7a7 | ||
|
|
d6f9cca646 | ||
|
|
e57577d675 | ||
|
|
294b9f7937 | ||
|
|
64b1eba5a5 | ||
|
|
bcf4645b88 | ||
|
|
b30d6e64d0 | ||
|
|
4f66da278f | ||
|
|
af6340d8a8 | ||
|
|
22f3dfda88 | ||
|
|
1118028125 | ||
|
|
6bdc1f57cd | ||
|
|
37fa09899e | ||
|
|
79a53343ce | ||
|
|
1d1c040299 | ||
|
|
c32375b0e0 | ||
|
|
1cc61fd07a | ||
|
|
727445520e | ||
|
|
10cefe65b9 | ||
|
|
e611fdcc51 | ||
|
|
881450867a | ||
|
|
bf551bd198 | ||
|
|
534b4c23e3 | ||
|
|
2e28b0a4ad | ||
|
|
41c2c0b727 | ||
|
|
42711e08ef | ||
|
|
d609d039d8 | ||
|
|
40ce419b4b | ||
|
|
041239d58f | ||
|
|
58b1c76999 | ||
|
|
91f6e69ffb | ||
|
|
aeecc857de | ||
|
|
9935203cfb | ||
|
|
6ad8f4546b | ||
|
|
1689715a69 | ||
|
|
c4a54b29ec | ||
|
|
b9c8a54d92 | ||
|
|
b11655fdee | ||
|
|
79ee65e158 | ||
|
|
52dc629310 | ||
|
|
1ae6453e56 | ||
|
|
065ae948ce | ||
|
|
f434d52f7f | ||
|
|
f7e0f9824c | ||
|
|
4fd59be90a | ||
|
|
75e0158040 | ||
|
|
3eb94d0518 | ||
|
|
8fe89569ab | ||
|
|
39ba5041e2 | ||
|
|
c3d491a414 | ||
|
|
32b4baff70 | ||
|
|
a5bca21706 | ||
|
|
7908627cfa | ||
|
|
5f734fd1dd | ||
|
|
d294a80678 | ||
|
|
51e887ed1f | ||
|
|
fc394dc3b9 | ||
|
|
40fc20f3b4 | ||
|
|
79d57a35d7 | ||
|
|
6d6353fe49 | ||
|
|
29b1770ba0 | ||
|
|
0f6da3498e | ||
|
|
6a1bccd569 | ||
|
|
8c39434961 | ||
|
|
3f1874bdba | ||
|
|
9940580fbd | ||
|
|
43395e6e40 | ||
|
|
c485bd10d3 | ||
|
|
1c1215da20 | ||
|
|
f8841585eb | ||
|
|
1fc70945cb | ||
|
|
e16e713cb6 | ||
|
|
a3b40a1b6c | ||
|
|
b387623aac | ||
|
|
245c45b9f9 | ||
|
|
dc678fc1df | ||
|
|
fdb7ace47a | ||
|
|
11d166d518 | ||
|
|
4afcadf19d | ||
|
|
f01ffd9182 | ||
|
|
95a5283b51 | ||
|
|
d279699b05 | ||
|
|
d356d22ce4 | ||
|
|
ba5c4181dc | ||
|
|
2d99c4a1a3 | ||
|
|
64ece0d31d | ||
|
|
cf65ac0b23 | ||
|
|
24e9b12dec | ||
|
|
9efa9e47d6 | ||
|
|
9cad31511e | ||
|
|
4d67661a2f | ||
|
|
3d1e2f9d0b | ||
|
|
eac6348bc2 | ||
|
|
26c71371a8 | ||
|
|
485d7d82aa | ||
|
|
fe6c74a996 | ||
|
|
478fd88cd4 | ||
|
|
637754517c | ||
|
|
9d3ace4a97 | ||
|
|
0f980265da | ||
|
|
71779a142f | ||
|
|
dfc7a57565 | ||
|
|
15ce383d5c | ||
|
|
91e1665cb7 | ||
|
|
57cc65db19 | ||
|
|
7b021a838d | ||
|
|
8313423b66 | ||
|
|
d394c802ee | ||
|
|
df83e1b1b9 | ||
|
|
fc8f84bedd | ||
|
|
df1f7be784 | ||
|
|
468b30dec4 | ||
|
|
c8dce26740 | ||
|
|
cef62ddeb5 | ||
|
|
3cd64e458e | ||
|
|
1d8f8b4779 | ||
|
|
65a9032894 | ||
|
|
28c72c8e64 | ||
|
|
6a72c537c2 | ||
|
|
18d685976e | ||
|
|
a870344405 | ||
|
|
eca2949a5c | ||
|
|
1f71ade4f1 | ||
|
|
9313ccbc1d | ||
|
|
8d6245330a | ||
|
|
e79621d377 | ||
|
|
f54be85c26 | ||
|
|
6efd5d0145 | ||
|
|
27b92bba1c | ||
|
|
2b93c1e4ef | ||
|
|
2910658c58 | ||
|
|
85e04c7f76 | ||
|
|
9dfb821853 | ||
|
|
f3ebe5798e | ||
|
|
aa8968e1f4 | ||
|
|
dbb7df207f | ||
|
|
b9f2fde119 | ||
|
|
b0994c54f5 | ||
|
|
9778f0e9b7 | ||
|
|
1b9b74cce1 | ||
|
|
50a0f1a0ed | ||
|
|
1685bbde2c | ||
|
|
d8fbbb23ab | ||
|
|
209145ce0d | ||
|
|
a82ba58bf9 | ||
|
|
527a094c32 | ||
|
|
83eb6ff849 | ||
|
|
d70c1fb414 | ||
|
|
86c19fc5cc | ||
|
|
54b96430f6 | ||
|
|
e3be6294c8 | ||
|
|
b5226f0480 | ||
|
|
6dfe43e0b6 | ||
|
|
5a8f0b0d99 | ||
|
|
1420c167fe | ||
|
|
e2e2c6526b | ||
|
|
e6996d168f | ||
|
|
590adfe566 | ||
|
|
7e81f23f0f | ||
|
|
077a6552ef | ||
|
|
6d70dca173 | ||
|
|
7722ed45b3 | ||
|
|
f1c02d8f68 | ||
|
|
296ea5dc54 | ||
|
|
0351e0f090 | ||
|
|
f2ee7b0fd9 | ||
|
|
74c360ebe1 | ||
|
|
5a205c15ae | ||
|
|
51e3dd5adc | ||
|
|
63a22d32db | ||
|
|
e21b1adf1d | ||
|
|
775022d065 | ||
|
|
28cffac9bd | ||
|
|
e452488666 | ||
|
|
0e38707cac | ||
|
|
d910750387 | ||
|
|
a4b3099113 | ||
|
|
502343d4af | ||
|
|
fe40d578d7 | ||
|
|
bb01f396f2 | ||
|
|
28505f0e61 | ||
|
|
10387b9b00 | ||
|
|
6d072e30cd | ||
|
|
71a9793f9a | ||
|
|
f57b5bc5fc | ||
|
|
72dca53617 | ||
|
|
3f732a70f8 | ||
|
|
00f0553dc7 | ||
|
|
ecc2b19609 | ||
|
|
542b38365f | ||
|
|
cf602beefb | ||
|
|
6aa7c9759a | ||
|
|
1f23c81cd5 | ||
|
|
c2a234d48a | ||
|
|
51947c3aa1 | ||
|
|
8f3f2d4900 | ||
|
|
19c5285479 | ||
|
|
1f6e237f21 | ||
|
|
9bb39c4809 | ||
|
|
b3479eb418 | ||
|
|
6ab58430e2 | ||
|
|
d535f38938 | ||
|
|
9c3615dd0b | ||
|
|
a70caa529e | ||
|
|
ce83e8fb03 | ||
|
|
fe414c4450 | ||
|
|
74e94c75e8 | ||
|
|
2180ec5784 | ||
|
|
6db5b8aeb3 | ||
|
|
e1f1e7b800 | ||
|
|
a63aba7155 | ||
|
|
bf510a0f76 | ||
|
|
e7450df991 | ||
|
|
5e1998c28a | ||
|
|
6c6519fab5 | ||
|
|
2ede05dafb | ||
|
|
3a6f4d0bdf | ||
|
|
d1cbb730a2 | ||
|
|
eab4686fb1 | ||
|
|
88d2e03f49 | ||
|
|
b5d5a5928c | ||
|
|
7ad6a2451f | ||
|
|
0e20f5bfae | ||
|
|
c01de0a3d2 | ||
|
|
6b58b63a33 | ||
|
|
9d0bbdc357 | ||
|
|
0aaf736b48 | ||
|
|
3149ced724 | ||
|
|
b71a1eddf5 | ||
|
|
392ed5c4dd | ||
|
|
cd9b3fc031 | ||
|
|
706f76b18d | ||
|
|
14089200ab | ||
|
|
4f00287c6e | ||
|
|
eda77c9273 | ||
|
|
2dd6f0e6f9 | ||
|
|
53d2079801 | ||
|
|
78b449e84b | ||
|
|
6cabcfb047 | ||
|
|
fc56ced616 | ||
|
|
1edae28630 | ||
|
|
91953fbef7 | ||
|
|
5c60d70d24 | ||
|
|
796ec69728 | ||
|
|
23689abaa7 | ||
|
|
22a819b8c8 | ||
|
|
b2f95938e6 | ||
|
|
36a0377dc8 | ||
|
|
fb7703cb76 | ||
|
|
456d65ef8c | ||
|
|
902a665c36 | ||
|
|
a491561271 | ||
|
|
78d7fc40f2 | ||
|
|
7164a7dbeb | ||
|
|
45907329c7 | ||
|
|
515010aeab | ||
|
|
caa191ff06 | ||
|
|
78addc1f22 | ||
|
|
26f21348f3 | ||
|
|
7d9031e843 | ||
|
|
79df7370f3 | ||
|
|
2b7409b363 | ||
|
|
b3b2c49da4 | ||
|
|
13a94f3dec | ||
|
|
94ef8945cc | ||
|
|
02d06562a6 | ||
|
|
9690633030 | ||
|
|
bc115b9969 | ||
|
|
be75748d5c | ||
|
|
0ad6cf0507 | ||
|
|
8a4edf46af | ||
|
|
33fac50895 | ||
|
|
6859db7c34 | ||
|
|
f32d6f4710 | ||
|
|
dfa0fff46d | ||
|
|
65cc572fde | ||
|
|
ce3e54b2d0 | ||
|
|
822f28ab23 | ||
|
|
3ac94dc320 | ||
|
|
7f5d254d8e | ||
|
|
51855e195c | ||
|
|
34ce871f2d | ||
|
|
4a1c58a137 | ||
|
|
1903d5c910 | ||
|
|
b96833cc9b | ||
|
|
93ee0cc577 | ||
|
|
9a2f31e011 | ||
|
|
b5e93607df | ||
|
|
9a81bc8213 | ||
|
|
a823df96d3 | ||
|
|
c44940d004 | ||
|
|
7d11674b2a | ||
|
|
adf4b1fc84 | ||
|
|
5b6e172b41 | ||
|
|
a8504545e9 | ||
|
|
e81393fe87 | ||
|
|
bfe44c6b8d | ||
|
|
9df870a7fa | ||
|
|
8a7cc105cb | ||
|
|
1e6937d4a4 | ||
|
|
0f21191e9b | ||
|
|
6254386370 | ||
|
|
e32d3bbf36 | ||
|
|
63cb9ff179 | ||
|
|
a16a0df1c0 | ||
|
|
f476f9a1db | ||
|
|
ea84391ba3 | ||
|
|
71ee653312 | ||
|
|
19ac929be9 | ||
|
|
4ff91f1e13 | ||
|
|
e837396944 | ||
|
|
51ee0b46ac | ||
|
|
eddda44def | ||
|
|
f8a6db5834 | ||
|
|
42c64a6569 | ||
|
|
b4349767ce | ||
|
|
b8e9c79180 | ||
|
|
df6667fd0d | ||
|
|
7732dc87df | ||
|
|
1f42c0cfb8 | ||
|
|
01caa4e7c5 | ||
|
|
e97618e99e | ||
|
|
a651f1b252 | ||
|
|
31e98fceab | ||
|
|
07f50572ea | ||
|
|
a94edf52e2 | ||
|
|
6b9e1e108c | ||
|
|
749649d868 | ||
|
|
9353646b55 | ||
|
|
219146e763 | ||
|
|
6c202db59e | ||
|
|
df76543fb7 | ||
|
|
b09af79edc | ||
|
|
627e87c144 | ||
|
|
66a56dac82 | ||
|
|
1158afdad5 | ||
|
|
b5d4f67860 | ||
|
|
067d3a7679 | ||
|
|
fc5f0b9c6c | ||
|
|
17bae9459a | ||
|
|
b80814adb5 | ||
|
|
bb6280a9c3 | ||
|
|
a1dad6962c | ||
|
|
ed433905c0 | ||
|
|
2d45d53cc7 | ||
|
|
4cd6862c1a | ||
|
|
b34aa59876 | ||
|
|
2f54a74b05 | ||
|
|
0b7cf25a93 | ||
|
|
3bbaf8b8e2 | ||
|
|
fe46fc4545 | ||
|
|
5d1ba50e92 | ||
|
|
74946403f0 | ||
|
|
9af70baa58 | ||
|
|
c0a061b4be | ||
|
|
c19056498d | ||
|
|
6f6ccefbf3 | ||
|
|
06d771b89e | ||
|
|
50ae773fec | ||
|
|
6cf46a6b73 | ||
|
|
f0e3e8d4ad | ||
|
|
399477edf5 | ||
|
|
0ec0de4509 | ||
|
|
a8657f7f91 | ||
|
|
87b11d6817 | ||
|
|
6ccf6eaf26 | ||
|
|
375d06dee2 | ||
|
|
6b407a2d1c | ||
|
|
a712eec83a | ||
|
|
be96c4da4f | ||
|
|
8b4b021048 | ||
|
|
a610fef6ac | ||
|
|
d81734f7e2 | ||
|
|
7166e06ada | ||
|
|
e1392fef3a | ||
|
|
1a3a81201b | ||
|
|
5ac1e06291 | ||
|
|
915aed8df1 | ||
|
|
3acf9f26f2 | ||
|
|
1398b9ebfd | ||
|
|
5d87ce04fc | ||
|
|
a9b065df55 | ||
|
|
994f67d5fe | ||
|
|
e1c12b8720 | ||
|
|
9e8f231714 | ||
|
|
3fc3dfa575 | ||
|
|
ab7e497735 | ||
|
|
6d49f409ad | ||
|
|
2ec78da729 | ||
|
|
bb92a5e388 | ||
|
|
2fdb21ed68 | ||
|
|
e46e8f26b4 | ||
|
|
a8148378d9 | ||
|
|
48c480e303 | ||
|
|
edf00c5f35 | ||
|
|
fe64caf273 | ||
|
|
363b487d74 | ||
|
|
3285a485e8 | ||
|
|
dec566f3d2 | ||
|
|
628a19a3e1 | ||
|
|
e878896595 | ||
|
|
30fddf7518 | ||
|
|
67f4ced505 | ||
|
|
02b212483c | ||
|
|
25f7a3dddb | ||
|
|
6bb842cc2d | ||
|
|
5837fa3a12 | ||
|
|
bd7fd535fe | ||
|
|
829d7c0b7a | ||
|
|
3a1f47285a | ||
|
|
cda9595a27 | ||
|
|
ead0150932 | ||
|
|
c0b78c1ec4 | ||
|
|
c693993748 | ||
|
|
6961485430 | ||
|
|
0d5aa4d887 | ||
|
|
542b9822cf | ||
|
|
ef21074d29 | ||
|
|
d5e4e3cfce | ||
|
|
18b00fde24 | ||
|
|
5aa90f5d0a | ||
|
|
e3b4dfd29a | ||
|
|
7ae5dd2921 | ||
|
|
7e50e6a38f | ||
|
|
370b7e87a8 | ||
|
|
6afa5fc67f | ||
|
|
bd264e23b6 | ||
|
|
2919f7d820 | ||
|
|
f6d151c040 | ||
|
|
0efa540ce0 | ||
|
|
f3cfa0d747 | ||
|
|
2d8c5002ec | ||
|
|
3d24faa47a | ||
|
|
2d400d9314 | ||
|
|
30f472bdb4 | ||
|
|
f5597a81fd | ||
|
|
47d7322070 | ||
|
|
3f58345cf0 | ||
|
|
fc01002317 | ||
|
|
0a71756024 | ||
|
|
4e3eff6505 | ||
|
|
25c2449a5e | ||
|
|
97d6a19199 | ||
|
|
254f32b262 | ||
|
|
c846cb1ed2 | ||
|
|
20a81ed004 | ||
|
|
6fcc19d198 | ||
|
|
cd614c2361 | ||
|
|
4831e8847d | ||
|
|
2ee3306d6a | ||
|
|
2893ab857d | ||
|
|
94457a566a | ||
|
|
740b255461 | ||
|
|
cc773294e3 | ||
|
|
514c44b0a1 | ||
|
|
5e4108f1c1 | ||
|
|
62a626e35e | ||
|
|
e06d0d0943 | ||
|
|
b632502da5 | ||
|
|
25a532bc15 | ||
|
|
70adbafdc9 | ||
|
|
317cd6bb91 | ||
|
|
3702cc05b8 | ||
|
|
eeb624875e | ||
|
|
a49cc3dea8 | ||
|
|
cd8abacd7b | ||
|
|
6a49861b50 | ||
|
|
061039b645 | ||
|
|
f963d336ab | ||
|
|
bf0a1bc184 | ||
|
|
cdc4a8f3d6 | ||
|
|
5bb7310093 | ||
|
|
1de1b19201 | ||
|
|
ae740acbb5 | ||
|
|
f58f9c7e0b | ||
|
|
0b134102d2 | ||
|
|
7870cc6484 | ||
|
|
43bbb8b0f8 | ||
|
|
2c9928db63 | ||
|
|
81363b3602 | ||
|
|
a291226a46 | ||
|
|
2e1e5571d6 | ||
|
|
d6768d59a7 | ||
|
|
12cddd4d6f | ||
|
|
b284daca6a | ||
|
|
d4854d77b0 | ||
|
|
caba985ce1 | ||
|
|
26bdd6e85b | ||
|
|
867c78d826 | ||
|
|
1e488a8a9c | ||
|
|
6be85971ea | ||
|
|
fe8c320d67 | ||
|
|
eb99b474ae | ||
|
|
857e5fce2c | ||
|
|
f383eb8e8d | ||
|
|
a3c7a604e0 | ||
|
|
416297f232 | ||
|
|
205c84b273 | ||
|
|
727d4fab4d | ||
|
|
21c04be1f8 | ||
|
|
08ebe00a4d | ||
|
|
1c3b6dd2e3 | ||
|
|
9df93b2cad | ||
|
|
1ec4340c74 | ||
|
|
6356f37f4d | ||
|
|
c217577b81 | ||
|
|
ea7ab55198 | ||
|
|
01bc6e8804 | ||
|
|
0393f7cb07 | ||
|
|
e41410bcc9 | ||
|
|
dce89d655f | ||
|
|
832df65d17 | ||
|
|
d1d6c343a3 | ||
|
|
3df615cb8a | ||
|
|
2e1ed8d87e | ||
|
|
9d8f64e6f2 | ||
|
|
da9392c791 | ||
|
|
291ab85bd6 | ||
|
|
1e2823c019 | ||
|
|
1a35e1f7fc | ||
|
|
f4c4021e20 | ||
|
|
6fc48c7d4f | ||
|
|
52eef0e02e | ||
|
|
2095ab6f7e | ||
|
|
65a02bb04f | ||
|
|
fc6fcda0cd | ||
|
|
366792cf46 | ||
|
|
a1f186eb23 | ||
|
|
8940220fc2 | ||
|
|
4c2e24536d | ||
|
|
172ef89dea | ||
|
|
bb4d12ef33 | ||
|
|
06ad530e2f | ||
|
|
a32a4e4182 | ||
|
|
5329bfd28c | ||
|
|
e4df4191ce | ||
|
|
f89606f8a9 | ||
|
|
d43d864dee | ||
|
|
2b9e267fc8 | ||
|
|
24faf2cd3b | ||
|
|
8e7192c767 | ||
|
|
2585754497 | ||
|
|
c16478b940 | ||
|
|
c0532ce6e4 | ||
|
|
ba3d582c92 | ||
|
|
741298be97 | ||
|
|
e6e32ce39d | ||
|
|
0d865ffc14 | ||
|
|
e46c317f87 | ||
|
|
340c0d546b | ||
|
|
ad31a8dfcc | ||
|
|
e1d5f0e636 | ||
|
|
225a0db69e | ||
|
|
f340dc5940 | ||
|
|
2057aff195 | ||
|
|
7587b6ae84 | ||
|
|
5a669e71f5 | ||
|
|
6f32f049d7 | ||
|
|
9b4a26b5a8 | ||
|
|
db345c832d | ||
|
|
0b526cef9d | ||
|
|
e0cbd202a8 | ||
|
|
b2f3b925d9 | ||
|
|
5ab7731be3 | ||
|
|
5c50b9a1ad | ||
|
|
bf811ac65d | ||
|
|
099d68a83d | ||
|
|
db622b4252 | ||
|
|
6638cefb37 | ||
|
|
740dcfdcfb | ||
|
|
281dd6000e | ||
|
|
bd907d8496 | ||
|
|
854e4c7b57 | ||
|
|
e394cb0dcb | ||
|
|
4553379d74 | ||
|
|
ca45eed21e | ||
|
|
fad0a8feee | ||
|
|
bb07e5afd7 | ||
|
|
0a2c374b52 | ||
|
|
fadaf7600a | ||
|
|
afc9766840 | ||
|
|
2c7812069e | ||
|
|
007aed6310 | ||
|
|
aef6c1bced | ||
|
|
8874ea8753 | ||
|
|
d1308bfbb8 | ||
|
|
a37498eedf | ||
|
|
24380867d4 | ||
|
|
f2a202f29d | ||
|
|
831bdf7a29 | ||
|
|
53d94d6c04 | ||
|
|
b1aaeb78e8 | ||
|
|
51d8742029 | ||
|
|
ac0a926811 | ||
|
|
a4e5475ff7 | ||
|
|
804f85e7b8 | ||
|
|
eadd9a1813 | ||
|
|
f0ab1284f3 | ||
|
|
fc4a2bf49d | ||
|
|
e94901043b | ||
|
|
3cf46e03e3 | ||
|
|
f12ebe14bc | ||
|
|
85cde18718 | ||
|
|
23b643422b | ||
|
|
c183857113 | ||
|
|
c05104ba82 | ||
|
|
9eb3ecb4d5 | ||
|
|
ab2ee24e90 | ||
|
|
20cf6ea2e0 | ||
|
|
3621404e71 | ||
|
|
e51d653bd7 | ||
|
|
3afed5549e | ||
|
|
6317d77dba | ||
|
|
6f50ba3979 | ||
|
|
f99fb8fa18 | ||
|
|
ab82fb5866 | ||
|
|
91a41b306e | ||
|
|
8d531cbc53 | ||
|
|
b907eb63ad | ||
|
|
8e60a03aaf | ||
|
|
a8fa6c3961 | ||
|
|
3f37bd7570 | ||
|
|
6cd65de21d | ||
|
|
34a4ffcb59 | ||
|
|
5bdcf783cf | ||
|
|
1939ed027c | ||
|
|
6273a54776 | ||
|
|
658d4997f2 | ||
|
|
f28d70e7b3 | ||
|
|
bc1c0b9e93 | ||
|
|
7c2057ec9e | ||
|
|
01c4f0343a | ||
|
|
aff498bc2d | ||
|
|
9a55178b41 | ||
|
|
ead740a8d5 | ||
|
|
60563ef0de | ||
|
|
c31d3537d8 | ||
|
|
518d4b24d0 | ||
|
|
59cab00c52 | ||
|
|
65894401c1 | ||
|
|
231e4c1cc0 | ||
|
|
91c72de89c | ||
|
|
2264b68553 | ||
|
|
0b368aed08 | ||
|
|
3ba9fae20d | ||
|
|
7bcad7804b | ||
|
|
b5e59dabfa | ||
|
|
98bb0c56c5 | ||
|
|
9edb8fd2ae | ||
|
|
1393ff0f11 | ||
|
|
bca2e29dd8 | ||
|
|
1e1c6c4075 | ||
|
|
ec88bbf8b0 | ||
|
|
f8ca5a9161 | ||
|
|
6a6a8ad473 | ||
|
|
5caebf6067 | ||
|
|
e9b8fddac1 | ||
|
|
c0cfcbecc7 | ||
|
|
feecb97214 | ||
|
|
fd514bda6a | ||
|
|
f5f917dfe0 | ||
|
|
2dd07da12d | ||
|
|
33e8016048 | ||
|
|
11abd8d9fe | ||
|
|
2e9c380f78 | ||
|
|
ee8d6229b3 | ||
|
|
fb3f7a1599 | ||
|
|
57ba039f51 | ||
|
|
186362f4f5 | ||
|
|
f880a987b2 | ||
|
|
1af4ae760c | ||
|
|
673d55e8a7 | ||
|
|
8c131c7ef4 | ||
|
|
e1ecca7e0a | ||
|
|
a08d35d404 | ||
|
|
114f15c4f3 | ||
|
|
6a40aa46f4 | ||
|
|
59281c970b | ||
|
|
c12d16ef86 | ||
|
|
1f3e7d7b86 | ||
|
|
4edac2143f | ||
|
|
3e8a78002e | ||
|
|
a9907e0810 | ||
|
|
c3b4ebd446 | ||
|
|
f26bf12c38 | ||
|
|
85fb560ad1 | ||
|
|
eb3b89dc21 | ||
|
|
015b242e27 | ||
|
|
68f6bf5e48 | ||
|
|
2063cae3ae | ||
|
|
efde4bf247 | ||
|
|
ffd5cf882a | ||
|
|
d79ee4c43b | ||
|
|
286278dde0 | ||
|
|
c1be3d08af | ||
|
|
c83956748d | ||
|
|
09031b9aa5 | ||
|
|
1d481f7b77 | ||
|
|
87d024e78b | ||
|
|
b1a325c102 | ||
|
|
5337af4c56 | ||
|
|
793b0c8d81 | ||
|
|
99b883d747 | ||
|
|
39d50479b1 | ||
|
|
0ffd998896 | ||
|
|
391f69ba17 | ||
|
|
59e3d41305 | ||
|
|
dee36472ef | ||
|
|
24847eb88f | ||
|
|
234ce61e23 | ||
|
|
dcf44dbf9b | ||
|
|
23d7067985 | ||
|
|
46b6f39a41 | ||
|
|
f5393d4fae | ||
|
|
6656547e6b | ||
|
|
7b23715310 | ||
|
|
78ee60620a | ||
|
|
12ecede0e7 | ||
|
|
a971949c9b | ||
|
|
4e296d780a | ||
|
|
6e4f69b327 | ||
|
|
775f386db6 | ||
|
|
09e787493c | ||
|
|
c9f8e6a542 | ||
|
|
2696fa3b24 | ||
|
|
5d0b87afce | ||
|
|
b383aa4c20 | ||
|
|
a67673327b | ||
|
|
c4265d80a5 | ||
|
|
dd874eea4b | ||
|
|
b9c1320823 | ||
|
|
833e405060 | ||
|
|
e6c8488283 | ||
|
|
505de3d625 | ||
|
|
631025a513 | ||
|
|
c0dc193247 | ||
|
|
aa3a1808f8 | ||
|
|
07bc8c9bac | ||
|
|
e23b571d7e | ||
|
|
7e014a7a33 | ||
|
|
6553036a73 | ||
|
|
a4201481aa | ||
|
|
209acc793d | ||
|
|
16076a05c8 | ||
|
|
3c91e4eca8 | ||
|
|
1635bdabce | ||
|
|
4908f50a00 | ||
|
|
442e09dcfc | ||
|
|
855539fab0 | ||
|
|
ba39b4da0b | ||
|
|
13ff9231f0 | ||
|
|
1696512385 | ||
|
|
4604b061d7 |
+1
-1
@@ -106,6 +106,6 @@ SpacesInAngles: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
Standard: Latest
|
||||
TabWidth: 8
|
||||
UseTab: ForIndentation
|
||||
|
||||
@@ -9,7 +9,10 @@ body:
|
||||
attributes:
|
||||
label: Describe the bug
|
||||
description: A clear and concise description of what the bug is.
|
||||
placeholder: Please describe the bug here...
|
||||
placeholder: |
|
||||
Please describe the bug here...
|
||||
*** Do NOT use AI to generate a bug report ***
|
||||
Write down what is wrong, attach logs and screenshots when relevant.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -22,12 +25,6 @@ body:
|
||||
2. Click on '...'
|
||||
3. See error
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
description: A clear and concise description of what you expected to happen.
|
||||
placeholder: Please describe what you expected to happen.
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: WiVRn Version
|
||||
@@ -42,20 +39,6 @@ body:
|
||||
description: Describe how WiVRn and OpenComposite/xrizer were installed
|
||||
placeholder: flatpak --user, flatpak, AUR, Gentoo/Guru, built from sources...
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Server Config
|
||||
description: |
|
||||
Provide the content of `config.json` for the server.
|
||||
Located in `${XDG_CONFIG_HOME-${HOME}/.config}/wivrn/config.json`
|
||||
or `~/.var/app/io.github.wivrn.wivrn/config/wivrn/config.json` for the flatpak version
|
||||
placeholder: |
|
||||
{
|
||||
"encoders": [
|
||||
{"codec": "h264"}
|
||||
]
|
||||
}
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Server Logs
|
||||
@@ -64,18 +47,6 @@ body:
|
||||
Add the output of the wivrn-server here.
|
||||
If more than a few lines, prefer file attachment.
|
||||
|
||||
- type: dropdown
|
||||
id: gpu
|
||||
attributes:
|
||||
label: What GPU did the bug occur on?
|
||||
options:
|
||||
- NVIDIA
|
||||
- AMD
|
||||
- Intel
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Vulkan Info
|
||||
@@ -107,5 +78,5 @@ body:
|
||||
attributes:
|
||||
label: ADB Logs
|
||||
description: Provide the output of `adb logcat` command.
|
||||
render: plain
|
||||
render: text
|
||||
placeholder: Attach the output of adb logcat as a file.
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
version: "1"
|
||||
rules:
|
||||
- base: master
|
||||
upstream: WiVRn:master
|
||||
mergeMethod: hardreset
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
# Disable hand tracking
|
||||
set left hand_tracking_active false
|
||||
set right hand_tracking_active false
|
||||
|
||||
# Reset positions
|
||||
set head position 0.0 1.5 0.2
|
||||
set head rotation 0.0 0.0 0.0 1.0
|
||||
set left position -0.2 1.3 -0.3
|
||||
set left rotation 0.4 0 0 0.9
|
||||
set right position 0.2 1.3 -0.3
|
||||
set right rotation 0.4 0 0 0.9
|
||||
|
||||
# Server list
|
||||
set right direction -1.8 1.55 -1
|
||||
sleep 1
|
||||
set right trigger_value 1
|
||||
sleep 1
|
||||
set right trigger_value 0
|
||||
sleep 1
|
||||
exec grim -g "0,0 2560x1440" ${LANG}/screenshot-01-list.png
|
||||
|
||||
|
||||
# Connect to the first server
|
||||
set right direction 0.2 1.42 -1
|
||||
sleep 1
|
||||
set right trigger_value 1
|
||||
sleep 1
|
||||
set right trigger_value 0
|
||||
sleep 5
|
||||
exec grim -g "0,0 2560x1440" ${LANG}/screenshot-02-connect.png
|
||||
|
||||
# Cancel
|
||||
set right direction -0.3 1.25 -1
|
||||
sleep 1
|
||||
set right trigger_value 1
|
||||
sleep 1
|
||||
set right trigger_value 0
|
||||
sleep 1
|
||||
|
||||
|
||||
# Add server
|
||||
set right direction -1.45 1.55 -1
|
||||
sleep 1
|
||||
set right trigger_value 1
|
||||
sleep 1
|
||||
set right trigger_value 0
|
||||
sleep 1
|
||||
set right rotation 0.4 0 0 0.9
|
||||
|
||||
set head position 0.0 1.5 0.5
|
||||
set left position -0.2 1.4 0.2
|
||||
set left direction -0.1 -0.3 -1
|
||||
set right position 0.2 1.4 0.2
|
||||
set right direction -0.1 -0.3 -1
|
||||
|
||||
sleep 1
|
||||
exec grim -g "0,0 2560x1440" ${LANG}/screenshot-03-add-server.png
|
||||
set head position 0.0 1.5 0.2
|
||||
set left position -0.2 1.3 -0.3
|
||||
set left rotation 0.4 0 0 0.9
|
||||
set right position 0.2 1.3 -0.3
|
||||
set right rotation 0.4 0 0 0.9
|
||||
|
||||
|
||||
# Cancel
|
||||
set right direction -2.2 1.05 -1
|
||||
sleep 1
|
||||
set right trigger_value 1
|
||||
sleep 1
|
||||
set right trigger_value 0
|
||||
sleep 1
|
||||
|
||||
|
||||
# Settings
|
||||
set right direction -1.9 1.5 -1
|
||||
sleep 1
|
||||
set right trigger_value 1
|
||||
sleep 1
|
||||
set right trigger_value 0
|
||||
sleep 1
|
||||
set right rotation 0.4 0 0 0.9
|
||||
sleep 1
|
||||
exec grim -g "0,0 2560x1440" ${LANG}/screenshot-04-settings.png
|
||||
|
||||
# Post-processing
|
||||
set right direction -1.95 1.45 -1
|
||||
sleep 1
|
||||
set right trigger_value 1
|
||||
sleep 1
|
||||
set right trigger_value 0
|
||||
sleep 1
|
||||
set right rotation 0.4 0 0 0.9
|
||||
sleep 1
|
||||
exec grim -g "0,0 2560x1440" ${LANG}/screenshot-07-post-processing.png
|
||||
|
||||
# About
|
||||
set right direction -2.4 0.45 -1
|
||||
sleep 1
|
||||
set right trigger_value 1
|
||||
sleep 1
|
||||
set right trigger_value 0
|
||||
sleep 1
|
||||
set right rotation 0.4 0 0 0.9
|
||||
sleep 1
|
||||
exec grim -g "0,0 2560x1440" ${LANG}/screenshot-05-about.png
|
||||
|
||||
# Licences
|
||||
set right direction -2.4 0.32 -1
|
||||
sleep 1
|
||||
set right trigger_value 1
|
||||
sleep 1
|
||||
set right trigger_value 0
|
||||
sleep 1
|
||||
exec grim -g "0,0 2560x1440" ${LANG}/screenshot-06-licence.png
|
||||
@@ -2,30 +2,35 @@ name: Release APK Only
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches: [ "apk-build" ]
|
||||
|
||||
env:
|
||||
BUILD_TYPE: RelWithDebInfo
|
||||
CSS: images/wivrn-${{(github.ref_type == 'tag' && 'release') || 'nightly'}}.css
|
||||
|
||||
jobs:
|
||||
build-android-only:
|
||||
name: Android
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04-full
|
||||
if: ${{ vars.APK_ONLY != '' }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hmd: ['Standard']
|
||||
buildtype: ['Release', 'Debug', 'DebugWithValidationLayer']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# Checkout from upstream instead of WiVRn-APK to ensure the GIT_DESC variable is set correctly
|
||||
repository: 'WiVRn/WiVRn'
|
||||
repository: 'gitea/WiVRn'
|
||||
ref: ${{ github.sha }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install CMake
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y cmake build-essential
|
||||
|
||||
- name: Prepare Vulkan SDK
|
||||
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
||||
with:
|
||||
@@ -33,16 +38,9 @@ jobs:
|
||||
vulkan-components: Glslang, SPIRV-Tools
|
||||
vulkan-use-cache: true
|
||||
|
||||
- name: set up JDK
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
cache: gradle
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install glslang-tools librsvg2-bin gettext npm
|
||||
sudo apt-get update && sudo apt-get install -y glslang-tools librsvg2-bin gettext npm
|
||||
wget https://github.com/KhronosGroup/KTX-Software/releases/download/v4.4.0/KTX-Software-4.4.0-Linux-x86_64.deb
|
||||
sudo dpkg --install KTX-Software-4.4.0-Linux-x86_64.deb
|
||||
npm install --global @gltf-transform/cli@4.1.1
|
||||
@@ -66,12 +64,16 @@ jobs:
|
||||
echo signingKeyPassword="$APK_SIGNINGKEYPASSWORD" > gradle.properties
|
||||
echo "$APK_KEYSTORE_BASE64" | base64 --decode --ignore-garbage > ks.keystore
|
||||
|
||||
# - name: Setup Java
|
||||
# uses: actions/setup-java@v6
|
||||
# with:
|
||||
# distribution: temurin
|
||||
# java-version: '25'
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
sudo rm /usr/local/bin/cmake
|
||||
"${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager" --install "cmake;3.30.3"
|
||||
chmod +x gradlew
|
||||
./gradlew -Psuffix=".github.nightly" -Pwivrn_css=images/wivrn-nightly.css -Pwivrn_app_name="WiVRn Nightly" -Pwivrn_compress_glb=ON assemble${{ matrix.hmd }}${{ matrix.buildtype }}
|
||||
./gradlew -Psuffix=".github.nightly" -Pwivrn_css=images/wivrn-nightly.css -Pwivrn_app_name="WiVRn Nightly" -Pwivrn_compress_glb=ON assemble${{ matrix.buildtype }}
|
||||
|
||||
- name: Prepare before archiving artifacts
|
||||
run: |
|
||||
@@ -84,7 +86,7 @@ jobs:
|
||||
- name: Archive APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: apk-${{ matrix.hmd }}-${{ (github.event_name == 'pull_request' && matrix.buildtype == 'Release') && 'Release-unsigned' || matrix.buildtype }}
|
||||
name: apk-${{ (github.event_name == 'pull_request' && matrix.buildtype == 'Release') && 'Release-unsigned' || matrix.buildtype }}
|
||||
path: apk/*.apk
|
||||
retention-days: 7
|
||||
|
||||
@@ -92,10 +94,77 @@ jobs:
|
||||
if: ${{ matrix.buildtype != 'Release' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: symbols-${{ matrix.hmd }}-${{ matrix.buildtype }}
|
||||
name: symbols-${{ matrix.buildtype }}
|
||||
path: debug/**/*.so
|
||||
retention-days: 7
|
||||
|
||||
# build-steam-frame:
|
||||
# name: Steam Frame
|
||||
# runs-on: ubuntu-24.04-arm
|
||||
# if: ${{ vars.APK_ONLY != '' }}
|
||||
# container:
|
||||
# image: registry.gitlab.steamos.cloud/steamrt/steamrt4/sdk/arm64:4.0.20260805.254769
|
||||
# volumes:
|
||||
# - ${{github.workspace}}/install:/tmp/install
|
||||
#
|
||||
# steps:
|
||||
# - uses: actions/checkout@v6
|
||||
# with:
|
||||
# fetch-depth: 0
|
||||
# fetch-tags: true
|
||||
#
|
||||
# - name: Apt dependencies
|
||||
# uses: awalsh128/cache-apt-pkgs-action@v1.6.1
|
||||
# with:
|
||||
# packages: librsvg2-bin npm
|
||||
#
|
||||
# - name: ccache
|
||||
# uses: hendrikmuhs/ccache-action@v1.2.23
|
||||
# with:
|
||||
# key: steam-frame
|
||||
# job-summary: ""
|
||||
#
|
||||
# - uses: actions/cache@v5
|
||||
# with:
|
||||
# key: cmake-frame
|
||||
# path: |
|
||||
# ${{github.workspace}}/cmake-fetch/*-subbuild/*-populate-prefix/src/*.tar.*
|
||||
# ${{github.workspace}}/cmake-fetch/*-subbuild/*-populate-prefix/src/*.zip
|
||||
# ${{github.workspace}}/cmake-fetch/*.tar.*
|
||||
# ${{github.workspace}}/cmake-fetch/*.tgz
|
||||
# ${{github.workspace}}/cmake-fetch/*-src/.git
|
||||
#
|
||||
# - name: Install dependencies
|
||||
# run: |
|
||||
# wget https://github.com/KhronosGroup/KTX-Software/releases/download/v4.4.2/KTX-Software-4.4.2-Linux-arm64.deb
|
||||
# sudo dpkg --install KTX-Software-4.4.2-Linux-arm64.deb
|
||||
# npm install --global @gltf-transform/cli@4.1.1
|
||||
#
|
||||
# - name: Configure CMake
|
||||
# run: >
|
||||
# cmake -B "$GITHUB_WORKSPACE/build"
|
||||
# -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
# -DWIVRN_CSS=${{env.CSS}}
|
||||
# -DFETCHCONTENT_BASE_DIR="$GITHUB_WORKSPACE/cmake-fetch"
|
||||
# -DCMAKE_C_COMPILER_LAUNCHER=ccache
|
||||
# -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
# -DCMAKE_INSTALL_PREFIX=/usr
|
||||
# --preset frame
|
||||
#
|
||||
# - name: Build
|
||||
# run: |
|
||||
# git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
# cd "$GITHUB_WORKSPACE/build"
|
||||
# DESTDIR="$GITHUB_WORKSPACE/install" ninja install
|
||||
#
|
||||
# - name: Archive
|
||||
# uses: actions/upload-artifact@v7
|
||||
# with:
|
||||
# name: wivrn-frame-client.zip
|
||||
# path: install/usr
|
||||
# if-no-files-found: error
|
||||
# retention-days: 30
|
||||
|
||||
release:
|
||||
name: Create APK release
|
||||
runs-on: ubuntu-24.04
|
||||
@@ -110,13 +179,13 @@ jobs:
|
||||
pattern: 'apk-*'
|
||||
merge-multiple: true
|
||||
|
||||
- name: Rename APK artifacts
|
||||
run: |
|
||||
cd apk
|
||||
for f in *.apk; do
|
||||
BASENAME=`echo ${f}|awk -F '-APK-' '{print $2}'`
|
||||
mv "${f}" "org.meumeu.wivrn-${BASENAME}"
|
||||
done
|
||||
# - name: Rename APK artifacts
|
||||
# run: |
|
||||
# cd apk
|
||||
# for f in *.apk; do
|
||||
# BASENAME=`echo ${f}|awk -F '-APK-' '{print $2}'`
|
||||
# mv "${f}" "org.meumeu.wivrn-${BASENAME}"
|
||||
# done
|
||||
|
||||
- name: Download APK debug artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
@@ -130,6 +199,13 @@ jobs:
|
||||
cd symbols
|
||||
zip -r ../debug-symbols.zip .
|
||||
|
||||
# - name: Download Steam Frame artifacts
|
||||
# uses: actions/download-artifact@v4
|
||||
# with:
|
||||
# path: install/usr
|
||||
# pattern: 'wivrn-frame-client.zip'
|
||||
# merge-multiple: true
|
||||
|
||||
- name: APK Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
@@ -142,3 +218,4 @@ jobs:
|
||||
files: |
|
||||
apk/*.apk
|
||||
debug-symbols.zip
|
||||
|
||||
|
||||
+134
-270
@@ -5,41 +5,80 @@ on:
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Release
|
||||
SERVER_DEPS: libx264-dev libavcodec-dev libavutil-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev nlohmann-json3-dev librsvg2-dev libdrm-dev libglib2.0-dev-bin libpipewire-0.3-dev libcli11-dev libnotify-dev libarchive-dev libudev-dev
|
||||
|
||||
jobs:
|
||||
build-server:
|
||||
name: Linux server
|
||||
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
|
||||
# You can convert this to a matrix build if you need cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: ubuntu-24.04
|
||||
build-linux:
|
||||
name: Linux
|
||||
runs-on: ubuntu-26.04
|
||||
if: ${{ vars.APK_ONLY == '' }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
cmake_preset: ['server', 'server-no-systemd', 'server-no-system-boost']
|
||||
config:
|
||||
- preset: 'client-no-system-boost'
|
||||
packages: libharfbuzz-dev libfreetype-dev libavcodec-dev libavutil-dev libswscale-dev librsvg2-bin gettext libcurl4-openssl-dev libfontconfig-dev
|
||||
- preset: 'dashboard'
|
||||
packages: extra-cmake-modules libarchive-dev libboost-all-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev libkirigami-dev librsvg2-dev nlohmann-json3-dev qcoro-qt6-dev qml6-module-org-kde-kirigamiaddons-formcard
|
||||
- preset: 'dissector-no-system-boost'
|
||||
packages: libboost-all-dev wireshark-dev
|
||||
- preset: 'server'
|
||||
packages: libboost-all-dev libsystemd-dev
|
||||
# tracing is opt-in and rarely built; build it here so the instrumentation and the
|
||||
# Perfetto SDK glue don't bitrot (WIVRN_TRACE_MONADO needs percetto, not packaged in CI)
|
||||
- preset: 'server-tracing'
|
||||
packages: libboost-all-dev libsystemd-dev
|
||||
- preset: 'server-no-systemd'
|
||||
packages: libboost-all-dev
|
||||
- preset: 'server-no-system-boost'
|
||||
packages: libsystemd-dev
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Apt dependencies
|
||||
uses: awalsh128/cache-apt-pkgs-action@v1.6.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
packages: ccache libvulkan-dev glslang-tools spirv-tools libwayland-dev libxrandr-dev ${{matrix.config.packages}} ${{ startsWith(matrix.config.preset, 'server') && env.SERVER_DEPS || ''}}
|
||||
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
uses: hendrikmuhs/ccache-action@v1.2.23
|
||||
with:
|
||||
create-symlink: true
|
||||
key: linux-${{matrix.config.preset}}
|
||||
job-summary: ""
|
||||
restore-keys: linux-
|
||||
|
||||
- uses: actions/cache@v5
|
||||
with:
|
||||
key: cmake-linux-${{matrix.config.preset}}
|
||||
path: |
|
||||
${{github.workspace}}/cmake-fetch/*-subbuild/*-populate-prefix/src/*.tar.*
|
||||
${{github.workspace}}/cmake-fetch/*-subbuild/*-populate-prefix/src/*.zip
|
||||
${{github.workspace}}/cmake-fetch/*.tar.*
|
||||
${{github.workspace}}/cmake-fetch/*.tgz
|
||||
${{github.workspace}}/cmake-fetch/*-src/.git
|
||||
restore-keys: cmake-linux-
|
||||
|
||||
- name: Install dependencies
|
||||
run: >
|
||||
sudo apt-get update && sudo apt-get install libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev libboost-all-dev librsvg2-bin libssl-dev libnotify-dev librsvg2-dev libarchive-dev
|
||||
- name: Prepare Vulkan SDK
|
||||
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
||||
with:
|
||||
vulkan-query-version: 1.3.296.0
|
||||
vulkan-components: Vulkan-Headers, Glslang, SPIRV-Tools
|
||||
vulkan-use-cache: true
|
||||
if: ${{ startswith(matrix.config.preset, 'client') }}
|
||||
run: |
|
||||
wget https://github.com/KhronosGroup/KTX-Software/releases/download/v4.4.2/KTX-Software-4.4.2-Linux-x86_64.deb
|
||||
sudo dpkg --install KTX-Software-4.4.2-Linux-x86_64.deb
|
||||
npm install --global @gltf-transform/cli@4.1.1
|
||||
|
||||
- name: Fetch Perfetto SDK
|
||||
if: ${{ matrix.config.preset == 'server-tracing' }}
|
||||
# The amalgamated SDK is two files; install them where server/CMakeLists.txt looks.
|
||||
env:
|
||||
PERFETTO_TAG: v51.0
|
||||
run: |
|
||||
sudo mkdir -p /usr/share/perfetto/sdk
|
||||
for f in perfetto.h perfetto.cc; do
|
||||
sudo curl -fsSL -o /usr/share/perfetto/sdk/$f \
|
||||
https://raw.githubusercontent.com/google/perfetto/${PERFETTO_TAG}/sdk/$f
|
||||
done
|
||||
|
||||
- name: Configure CMake
|
||||
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
|
||||
@@ -47,70 +86,48 @@ jobs:
|
||||
run: >
|
||||
cmake -B ${{github.workspace}}/build
|
||||
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
-DCMAKE_INSTALL_PREFIX=/usr
|
||||
--preset ${{ matrix.cmake_preset }}
|
||||
-DFETCHCONTENT_BASE_DIR=${{github.workspace}}/cmake-fetch
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
--preset ${{ matrix.config.preset }}
|
||||
-DWIVRN_USE_SYSTEM_OPENXR=OFF
|
||||
|
||||
- name: Package build dependencies
|
||||
if: ${{ matrix.cmake_preset == 'server' }}
|
||||
if: ${{ matrix.config.preset == 'server' }}
|
||||
# For easier packaging, build dependencies are made available as a separate archive
|
||||
run: (cd ${{github.workspace}}/build/_deps/ ; tar --create --xz *-src) > ${{github.workspace}}/server-build-deps.tar.xz
|
||||
run: cd ${{github.workspace}}/cmake-fetch ; tar --create --xz --exclude .git --file ${{github.workspace}}/server-build-deps.tar.xz *-src
|
||||
|
||||
- name: Build
|
||||
# Build your program with the given configuration
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
|
||||
- name: Publish build dependencies
|
||||
if: ${{ matrix.cmake_preset == 'server' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
if: ${{ matrix.config.preset == 'server' }}
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: server-build-deps
|
||||
path: server-build-deps.tar.xz
|
||||
|
||||
- name: Release build dependencies
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/') && matrix.cmake_preset == 'server'
|
||||
if: startsWith(github.ref, 'refs/tags/') && matrix.config.preset == 'server'
|
||||
with:
|
||||
tag_name: ${{ inputs.ref }}
|
||||
generate_release_notes: true
|
||||
draft: true
|
||||
files: server-build-deps.tar.xz
|
||||
|
||||
build-dashboard:
|
||||
name: Linux dashboard
|
||||
runs-on: ubuntu-24.04
|
||||
container: ubuntu:plucky
|
||||
if: ${{ vars.APK_ONLY == '' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install dependencies
|
||||
run: >
|
||||
apt-get update && apt-get install --yes libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev qt6-base-dev qt6-tools-dev libcap-dev pkexec libboost-all-dev librsvg2-bin libssl-dev libnotify-dev qt6-declarative-dev extra-cmake-modules libkirigami-dev libkf6i18n-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev jq sudo cmake gcc g++ git qcoro-qt6-dev librsvg2-dev libarchive-dev libglm-dev glslang-tools
|
||||
# runtime: qml6-module-qtqml-workerscript qml6-module-qtquick-dialogs
|
||||
|
||||
- name: Configure CMake
|
||||
run: >
|
||||
cmake -B ${{github.workspace}}/build
|
||||
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
-DCMAKE_INSTALL_PREFIX=/usr
|
||||
--preset dashboard
|
||||
|
||||
- name: Build
|
||||
# Build your program with the given configuration
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
|
||||
build-server-flatpak:
|
||||
name: Linux server (flatpak)
|
||||
runs-on: ubuntu-24.04
|
||||
if: ${{ vars.APK_ONLY == '' }}
|
||||
container:
|
||||
image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.8
|
||||
# Tag matches runtime-version in the manifest.
|
||||
image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.10
|
||||
options: --privileged
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -121,22 +138,18 @@ jobs:
|
||||
tools/gen_flatpak_manifest.py --gitlocal --out flatpak
|
||||
cat flatpak/io.github.wivrn.wivrn.yml
|
||||
|
||||
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6.4
|
||||
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6.7
|
||||
with:
|
||||
manifest-path: flatpak/io.github.wivrn.wivrn.yml
|
||||
bundle: wivrn-server.flatpak
|
||||
upload-artifact: false
|
||||
|
||||
# Upload manually instead of using flatpak/flatpak-github-actions/flatpak-builder because
|
||||
# it uses upload-artifact@v3
|
||||
- name: Publish artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: wivrn-flatpak-x86_64
|
||||
path: wivrn-server.flatpak
|
||||
# The manifest is regenerated on every commit with the git hash embedded,
|
||||
# so its default (manifest-hash) cache key never hits. Key on the files
|
||||
# that actually define the dependency set instead, so the toolchain
|
||||
# downloads and build cache persist across commits.
|
||||
cache-key: flatpak-builder-${{ hashFiles('flatpak/io.github.wivrn.wivrn.yml.in', 'flatpak/ct-ng-x86_64.config', 'flatpak/ct-ng-aarch64.config', 'monado-rev', 'CMakeLists.txt') }}
|
||||
|
||||
- name: Debug bundle
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
if: failure()
|
||||
with:
|
||||
name: flatpak-debug
|
||||
@@ -150,7 +163,7 @@ jobs:
|
||||
if: ${{ vars.APK_ONLY == '' }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -158,191 +171,43 @@ jobs:
|
||||
- run: nix flake check
|
||||
- run: nix build --print-build-logs
|
||||
|
||||
build-test-client:
|
||||
name: Linux client
|
||||
runs-on: ubuntu-24.04
|
||||
if: ${{ vars.APK_ONLY == '' }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
create-symlink: true
|
||||
|
||||
- name: Prepare Vulkan SDK
|
||||
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
||||
with:
|
||||
vulkan-query-version: 1.3.296.0
|
||||
vulkan-components: Vulkan-Headers, Glslang, SPIRV-Tools
|
||||
vulkan-use-cache: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev libxcb-glx0-dev gettext libfontconfig-dev libboost-all-dev librsvg2-bin libssl-dev sway grim mesa-vulkan-drivers wayland-protocols fonts-noto-cjk fonts-roboto libcurl4-openssl-dev
|
||||
|
||||
wget https://github.com/KhronosGroup/KTX-Software/releases/download/v4.4.0/KTX-Software-4.4.0-Linux-x86_64.deb
|
||||
sudo dpkg --install KTX-Software-4.4.0-Linux-x86_64.deb
|
||||
npm install --global @gltf-transform/cli@4.1.1
|
||||
|
||||
- name: install server dependencies
|
||||
run: >
|
||||
sudo apt-get update && sudo apt-get install libavahi-glib-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev qt6-base-dev qt6-tools-dev libcap-dev pkexec libnotify-dev librsvg2-dev libarchive-dev
|
||||
|
||||
- name: Configure CMake
|
||||
run: >
|
||||
cmake -B ${{github.workspace}}/build
|
||||
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
-DCMAKE_INSTALL_PREFIX=/usr
|
||||
-DWIVRN_USE_SYSTEM_OPENXR=OFF
|
||||
--preset everything
|
||||
-DWIVRN_BUILD_DASHBOARD=OFF
|
||||
-DWIVRN_BUILD_DISSECTOR=OFF
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
|
||||
- name: Build Monado
|
||||
# Disable XRT_FEATURE_OPENXR_VISIBILITY_MASK because of https://gitlab.freedesktop.org/monado/monado/-/issues/480
|
||||
run: |
|
||||
mkdir monado
|
||||
curl https://gitlab.freedesktop.org/Meumeu/monado/-/archive/5bdb51697685320e3f5d494210f25fb2967c9fc3/monado-main.tar.gz | tar -xz -C monado --strip-components=1
|
||||
patch --directory=${{github.workspace}}/monado --strip=1 < ${{github.workspace}}/patches/monado-ci/0001-remote-resolution.patch
|
||||
|
||||
DRIVERS=$(grep -oE "XRT_BUILD_DRIVER_[A-Z0-9_]*" monado/CMakeLists.txt | sort -u | grep -v XRT_BUILD_DRIVER_REMOTE | sed 's/\(.*\)/-D\1=OFF/')
|
||||
cmake monado -B ${{github.workspace}}/build-monado -DCMAKE_BUILD_TYPE=Release -DXRT_FEATURE_SERVICE_SYSTEMD=OFF -DXRT_FEATURE_SERVICE=OFF -DXRT_BUILD_DRIVER_REMOTE=ON -DXRT_MODULE_COMPOSITOR_MAIN=ON -DXRT_HAVE_WAYLAND=ON $DRIVERS -DXRT_MODULE_MONADO_REMOTECTL=ON -DBUILD_TESTING=OFF -DXRT_FEATURE_OPENXR_VISIBILITY_MASK=OFF
|
||||
|
||||
cmake --build ${{github.workspace}}/build-monado
|
||||
|
||||
- name: Take screenshots
|
||||
continue-on-error: true
|
||||
env:
|
||||
WLR_BACKENDS: headless
|
||||
WLR_RENDERER: pixman
|
||||
WLR_LIBINPUT_NO_DEVICES: 1
|
||||
XR_RUNTIME_JSON: ${{github.workspace}}/build-monado/openxr_monado-dev.json
|
||||
P_OVERRIDE_ACTIVE_CONFIG: remote
|
||||
WIVRN_CONTROLLER: meta-quest-touch-plus
|
||||
WIVRN_GRIP_LEFT_OFFSET: '0 0 0 0 45 0'
|
||||
WIVRN_GRIP_RIGHT_OFFSET: '0 0 0 0 45 0'
|
||||
XRT_COMPOSITOR_SCALE_PERCENTAGE: '100'
|
||||
run: |
|
||||
echo "xwayland disable" > sway-config
|
||||
echo -e "output HEADLESS-1 {\n mode 2560x1440@60Hz\n}" >> sway-config
|
||||
sway -c sway-config &
|
||||
sleep 10
|
||||
export WAYLAND_DISPLAY=$(cd "${XDG_RUNTIME_DIR}" && ls -tr wayland* | tail -1)
|
||||
|
||||
mkdir -p ~/.config/fontconfig
|
||||
cp ${{github.workspace}}/.github/fonts.conf ~/.config/fontconfig/fonts.conf
|
||||
|
||||
${{github.workspace}}/build/server/wivrn-server --no-encrypt --no-publish-service &
|
||||
WIVRN_SERVER_PID=$!
|
||||
|
||||
mkdir -p ~/.config/wivrn
|
||||
echo '{"servers": [{"autoconnect": false, "manual": true, "pretty_name": "Deep Thought", "hostname": "localhost", "port": 9757, "tcp_only": false, "cookie": ""}], "first_run": false}' > ~/.config/wivrn/client.json.in
|
||||
|
||||
for LANG in en $(basename -a ${{github.workspace}}/locale/*)
|
||||
do
|
||||
mkdir ${LANG}
|
||||
|
||||
if [ ${LANG} = fr ]
|
||||
then
|
||||
cat ~/.config/wivrn/client.json.in | jq .virtual_keyboard_layout=\"AZERTY\" > ~/.config/wivrn/client.json
|
||||
else
|
||||
cat ~/.config/wivrn/client.json.in | jq .virtual_keyboard_layout=\"QWERTY\" > ~/.config/wivrn/client.json
|
||||
fi
|
||||
|
||||
${{github.workspace}}/build/bin/wivrn &
|
||||
WIVRN_PID=$!
|
||||
sleep 10
|
||||
${{github.workspace}}/build-monado/src/xrt/targets/remotectl/monado-remotectl 127.0.0.1 4242 < ${{github.workspace}}/.github/screenshot-script.txt
|
||||
killall wivrn
|
||||
wait $WIVRN_PID || true
|
||||
done
|
||||
|
||||
killall wivrn-server
|
||||
wait $WIVRN_SERVER_PID || true
|
||||
|
||||
- name: Upload screenshots
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Screenshots
|
||||
path: "*/screenshot-*.png"
|
||||
|
||||
build-dissector:
|
||||
name: Wireshark dissector
|
||||
runs-on: ubuntu-24.04
|
||||
if: ${{ vars.APK_ONLY == '' }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
# Ubuntu 24.04 has boost 1.83, the dissector requires 1.84
|
||||
# cmake_preset: ['dissector', 'dissector-no-system-boost']
|
||||
cmake_preset: ['dissector-no-system-boost']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Prepare Vulkan SDK
|
||||
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
||||
with:
|
||||
vulkan-query-version: 1.3.296.0
|
||||
vulkan-components: Vulkan-Headers, Glslang, SPIRV-Tools
|
||||
vulkan-use-cache: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: >
|
||||
sudo apt-get update && sudo apt-get install libvulkan-dev libopenxr-dev wireshark wireshark-dev libssl-dev
|
||||
|
||||
- name: Configure CMake
|
||||
run: >
|
||||
cmake -B ${{github.workspace}}/build
|
||||
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
-DCMAKE_INSTALL_PREFIX=/usr
|
||||
--preset ${{ matrix.cmake_preset }}
|
||||
-DWIVRN_USE_SYSTEM_OPENXR=OFF
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
|
||||
build-android:
|
||||
name: Android
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
if: ${{ vars.APK_ONLY == '' }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hmd: ['Standard']
|
||||
buildtype: ['Release', 'Debug', 'DebugWithValidationLayer', 'Oculus']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Prepare Vulkan SDK
|
||||
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
||||
- uses: actions/cache@v5
|
||||
with:
|
||||
vulkan-query-version: 1.3.296.0
|
||||
vulkan-components: Glslang, SPIRV-Tools
|
||||
vulkan-use-cache: true
|
||||
key: cmake-android-${{matrix.buildtype}}
|
||||
path: |
|
||||
${{github.workspace}}/cmake-fetch/*-subbuild/*-populate-prefix/src/*.tar.*
|
||||
${{github.workspace}}/cmake-fetch/*-subbuild/*-populate-prefix/src/*.zip
|
||||
${{github.workspace}}/cmake-fetch/*.tar.*
|
||||
${{github.workspace}}/cmake-fetch/*.zip
|
||||
${{github.workspace}}/cmake-fetch/*.tgz
|
||||
restore-keys: cmake-android-
|
||||
|
||||
- name: set up JDK
|
||||
uses: actions/setup-java@v4
|
||||
# Gradle distribution and the Android plugin's dependencies.
|
||||
- uses: actions/cache@v5
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
cache: gradle
|
||||
key: gradle-android-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }}
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
restore-keys: gradle-android-
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install glslang-tools librsvg2-bin gettext
|
||||
sudo apt-get update && sudo apt-get install glslang-tools spirv-tools librsvg2-bin gettext
|
||||
wget https://github.com/KhronosGroup/KTX-Software/releases/download/v4.3.2/KTX-Software-4.3.2-Linux-x86_64.deb
|
||||
sudo dpkg --install KTX-Software-4.3.2-Linux-x86_64.deb
|
||||
npm install --global @gltf-transform/cli
|
||||
@@ -373,7 +238,7 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
VERSION=$(git describe --tags --always)
|
||||
VERSION=$(git describe --tags --always | sed "s/^v\([0-9]\)/\1/")
|
||||
if [ ${{ matrix.buildtype }} = 'Oculus' ]
|
||||
then
|
||||
SUFFIX=""
|
||||
@@ -383,7 +248,6 @@ jobs:
|
||||
VERSION_CODE=$(( $VERSION_CODE + 1 ))
|
||||
fi
|
||||
|
||||
CSS=images/wivrn-release.css
|
||||
APPNAME=WiVRn
|
||||
else
|
||||
VERSION_CODE=1
|
||||
@@ -391,26 +255,36 @@ jobs:
|
||||
if [ ${{ github.ref_type }} = 'tag' ]
|
||||
then
|
||||
SUFFIX=".github"
|
||||
CSS=images/wivrn-release.css
|
||||
APPNAME="WiVRn"
|
||||
else
|
||||
SUFFIX=".github.testing"
|
||||
CSS=images/wivrn-nightly.css
|
||||
APPNAME="WiVRn Testing"
|
||||
fi
|
||||
fi
|
||||
|
||||
sudo rm /usr/local/bin/cmake
|
||||
"${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager" --install "cmake;3.30.3"
|
||||
if [ ${{ github.ref_type }} = 'tag' ]
|
||||
then
|
||||
CSS=images/wivrn-release.css
|
||||
else
|
||||
CSS=images/wivrn-nightly.css
|
||||
fi
|
||||
|
||||
echo Setting version $VERSION and version code $VERSION_CODE in manifest
|
||||
echo Using stylesheet $CSS and name $APPNAME
|
||||
|
||||
chmod +x gradlew
|
||||
./gradlew -Pwivrn_version=$VERSION -Pwivrn_versionCode=$VERSION_CODE -Psuffix=$SUFFIX -Pwivrn_css=$CSS -Pwivrn_app_name="$APPNAME" -Pwivrn_compress_glb=ON assemble${{ matrix.hmd }}${{ matrix.buildtype }}
|
||||
./gradlew \
|
||||
-Pwivrn_version=$VERSION \
|
||||
-Pwivrn_versionCode=$VERSION_CODE \
|
||||
-Psuffix=$SUFFIX \
|
||||
-Pwivrn_css=$CSS \
|
||||
-Pwivrn_app_name="$APPNAME" \
|
||||
-Pwivrn_compress_glb=ON \
|
||||
-Pfetchcontent_base_dir=${{github.workspace}}/cmake-fetch \
|
||||
assemble${{ matrix.buildtype }}
|
||||
|
||||
- name: Upload build dir
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
if: failure()
|
||||
with:
|
||||
name: android-cxx-debug-${{ matrix.buildtype }}
|
||||
@@ -427,20 +301,18 @@ jobs:
|
||||
find debug -name libopenxr_loader.so -delete
|
||||
|
||||
- name: Archive APK
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
if: ${{ matrix.buildtype != 'Oculus' }}
|
||||
with:
|
||||
name: apk-${{ matrix.hmd }}-${{ (steps.secret-check.outputs.available == 'false' && matrix.buildtype == 'Release') && 'Release-unsigned' || matrix.buildtype }}
|
||||
name: apk-${{ (steps.secret-check.outputs.available == 'false' && matrix.buildtype == 'Release') && 'Release-unsigned' || matrix.buildtype }}
|
||||
path: apk/*.apk
|
||||
retention-days: 30
|
||||
|
||||
- name: Archive debug symbols
|
||||
if: ${{ matrix.buildtype != 'Release' && matrix.buildtype != 'Oculus' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: symbols-${{ matrix.hmd }}-${{ matrix.buildtype }}
|
||||
name: symbols-${{ matrix.buildtype }}
|
||||
path: debug/**/*.so
|
||||
retention-days: 30
|
||||
|
||||
- name: Push to Oculus store
|
||||
if: ${{ matrix.buildtype == 'Oculus' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master') && steps.secret-check.outputs.oculus-token == 'true' }}
|
||||
@@ -459,7 +331,7 @@ jobs:
|
||||
IS_DRAFT=
|
||||
fi
|
||||
|
||||
./ovr-platform-util upload-quest-build --app-id 7959676140827574 --token $OCULUS_TOKEN --apk apk/WiVRn-standard-oculus.apk --channel $CHANNEL --age-group TEENS_AND_ADULTS $IS_DRAFT --debug_symbols_dir debug/ --debug-symbols-pattern '*.so'
|
||||
./ovr-platform-util upload-quest-build --app-id 7959676140827574 --token $OCULUS_TOKEN --apk apk/WiVRn-oculus.apk --channel $CHANNEL --age-group TEENS_AND_ADULTS $IS_DRAFT --debug_symbols_dir debug/ --debug-symbols-pattern '*.so'
|
||||
|
||||
build-ubuntu:
|
||||
name: Build Ubuntu package
|
||||
@@ -475,13 +347,13 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apt update
|
||||
apt install --yes libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev qt6-base-dev qt6-tools-dev libcap-dev pkexec libboost-all-dev librsvg2-bin dpkg-dev pkg-config debhelper-compat build-essential lintian cmake libnotify-dev qt6-declarative-dev extra-cmake-modules libkirigami-dev libkf6i18n-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev jq sudo cmake gcc g++ git wget libssl-dev qcoro-qt6-dev librsvg2-dev libarchive-dev npm
|
||||
apt install --yes libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev xz-utils libpipewire-0.3-dev libcli11-dev qt6-base-dev qt6-tools-dev pkexec libboost-all-dev librsvg2-bin dpkg-dev pkg-config debhelper-compat build-essential lintian cmake libnotify-dev qt6-declarative-dev extra-cmake-modules libkirigami-dev libkf6i18n-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev jq sudo cmake gcc g++ git wget libssl-dev qcoro-qt6-dev librsvg2-dev libarchive-dev npm qml6-module-org-kde-kirigamiaddons-formcard
|
||||
|
||||
wget https://github.com/KhronosGroup/KTX-Software/releases/download/v4.3.2/KTX-Software-4.3.2-Linux-x86_64.deb
|
||||
sudo dpkg --install KTX-Software-4.3.2-Linux-x86_64.deb
|
||||
npm install --global @gltf-transform/cli
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
path: wivrn
|
||||
@@ -523,7 +395,7 @@ jobs:
|
||||
run: dpkg-buildpackage --build=binary --no-sign
|
||||
|
||||
- name: Publish package
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: wivrn-${{ matrix.distro }}
|
||||
path: |
|
||||
@@ -537,11 +409,11 @@ jobs:
|
||||
release:
|
||||
name: Create release
|
||||
runs-on: ubuntu-22.04
|
||||
needs: [build-server, build-android, build-test-client, build-dissector, build-server-flatpak, build-ubuntu, build-dashboard]
|
||||
needs: [build-linux, build-android, build-server-flatpak, build-ubuntu]
|
||||
if: success() && startsWith(github.ref, 'refs/tags/')
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
path: wivrn
|
||||
@@ -556,7 +428,7 @@ jobs:
|
||||
echo "available=false" >> $GITHUB_OUTPUT;
|
||||
fi
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
if: ${{ steps.flathub-token-check.outputs.available == 'true' }}
|
||||
with:
|
||||
fetch-depth: 0
|
||||
@@ -565,20 +437,19 @@ jobs:
|
||||
token: ${{ secrets.FLATHUB_TOKEN }}
|
||||
|
||||
- name: Download artifacts (APK)
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: apk-Release
|
||||
path: apk
|
||||
pattern: '*-Release'
|
||||
merge-multiple: true
|
||||
|
||||
- name: Download artifacts (flatpak)
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: wivrn-flatpak-x86_64
|
||||
name: wivrn-server-x86_64.flatpak
|
||||
path: flatpak
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
uses: softprops/action-gh-release@v3
|
||||
with:
|
||||
tag_name: ${{ inputs.ref }}
|
||||
generate_release_notes: true
|
||||
@@ -613,18 +484,11 @@ jobs:
|
||||
|
||||
git show
|
||||
|
||||
- name: Update release branch
|
||||
run: |
|
||||
cd wivrn
|
||||
if git fetch origin release; then
|
||||
git push origin HEAD:release
|
||||
fi
|
||||
|
||||
sync_fork_downstream:
|
||||
name: Sync fork downstream
|
||||
runs-on: ubuntu-24.04
|
||||
needs: [build-server, build-android]
|
||||
if: ${{ vars.APK_ONLY == '' }} && github.branch == 'master'
|
||||
needs: [build-linux, build-android]
|
||||
if: ${{ vars.APK_ONLY == '' && github.ref == 'refs/heads/master' }}
|
||||
steps:
|
||||
- name: Check for DOWNSTREAM_GITHUB_TOKEN
|
||||
id: downstream-secret-check
|
||||
|
||||
@@ -15,9 +15,27 @@ jobs:
|
||||
- 'common'
|
||||
- 'tools/wireshark'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
- name: Run clang-format style check for C/C++/Protobuf programs.
|
||||
uses: jidicula/clang-format-action@v4.13.0
|
||||
uses: jidicula/clang-format-action@v4.16.0
|
||||
with:
|
||||
clang-format-version: '18'
|
||||
clang-format-version: '21'
|
||||
check-path: ${{ matrix.path }}
|
||||
|
||||
python-format-check:
|
||||
name: Python lint (ruff)
|
||||
runs-on: ubuntu-24.04
|
||||
if: ${{ vars.APK_ONLY == '' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
# Scope set by `include` in ruff.toml.
|
||||
- name: Run ruff lint check
|
||||
uses: astral-sh/ruff-action@v3
|
||||
with:
|
||||
version: "0.16.0"
|
||||
args: "check"
|
||||
- name: Run ruff format check
|
||||
uses: astral-sh/ruff-action@v3
|
||||
with:
|
||||
version: "0.16.0"
|
||||
args: "format --check"
|
||||
|
||||
@@ -6,17 +6,27 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
if: ${{ vars.APK_ONLY == '' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Apt dependencies
|
||||
uses: awalsh128/cache-apt-pkgs-action@v1.6.1
|
||||
with:
|
||||
packages: gettext
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install gettext
|
||||
pip install polib PyGithub
|
||||
|
||||
- name: Check that .po files are up to date
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
if [[ "${{github.ref}}" == 'refs/heads/master' ]] ; then
|
||||
tools/check_po.py --manage-issues --github-repository "${{ github.repository }}" --github-token "${{ github.token }}"
|
||||
elif [[ "${{github.base_ref}}" != "" ]] ; then
|
||||
FILES=$(gh api repos/${{github.repository}}/pulls/${{github.event.pull_request.number}}/files | jq --raw-output '[.[].filename | select(. | startswith("locale/"))] | join(",")')
|
||||
echo "Locale files changed by pull request: ${FILES}"
|
||||
tools/check_po.py --fail-on "${FILES}"
|
||||
else
|
||||
tools/check_po.py
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
name: Sync Fork with Upstream
|
||||
|
||||
env:
|
||||
UPSTREAM_URL: "https://github.com/wivrn/wivrn.git"
|
||||
WORKFLOW_TOKEN: ${{ secrets.DOWNSTREAM_GITHUB_TOKEN }}
|
||||
UPSTREAM_BRANCH: "master"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
upstream_repo: vindicus999/wivrn
|
||||
fetch-depth: 0
|
||||
token: ${{ env.WORKFLOW_TOKEN }}
|
||||
|
||||
- name: Add upstream
|
||||
run: |
|
||||
git remote add upstream ${{ env.UPSTREAM_URL }}
|
||||
|
||||
- name: Fetch all
|
||||
run: |
|
||||
git fetch origin
|
||||
git fetch upstream
|
||||
|
||||
- name: Update sync branch
|
||||
run: |
|
||||
git checkout -B master upstream/master
|
||||
git push origin master --force
|
||||
|
||||
- name: Copy master -> apk-build
|
||||
run: |
|
||||
git checkout -B apk-build master
|
||||
git push origin apk-build --force
|
||||
|
||||
- name: Apply sneed changes
|
||||
run: |
|
||||
git merge origin/sneed --no-edit
|
||||
|
||||
- name: Push apk build
|
||||
run: |
|
||||
git push origin build --force
|
||||
@@ -11,11 +11,13 @@ build/
|
||||
build-*/
|
||||
**/result
|
||||
|
||||
__pycache__/
|
||||
*.so
|
||||
a.out
|
||||
*.pgm
|
||||
*.zip
|
||||
*.keystore
|
||||
*.pftrace
|
||||
gradle.properties
|
||||
local.properties
|
||||
compile_commands.json
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
|
||||
<!-- Required for WiFi locking, see https://developer.android.com/reference/android/net/wifi/WifiManager.WifiLock -->
|
||||
@@ -47,6 +48,9 @@
|
||||
<uses-permission android:name="com.oculus.permission.FACE_TRACKING" />
|
||||
<uses-permission android:name="com.picovr.permission.FACE_TRACKING" />
|
||||
<uses-permission android:name="com.oculus.permission.BODY_TRACKING" />
|
||||
<uses-permission android:name="android.permission.EYE_TRACKING_FINE" />
|
||||
<uses-permission android:name="android.permission.FACE_TRACKING" />
|
||||
<uses-permission android:name="android.permission.HAND_TRACKING" />
|
||||
|
||||
<!-- Required for XR_FB_render_model -->
|
||||
<uses-feature android:name="com.oculus.feature.RENDER_MODEL" android:required="false" />
|
||||
@@ -62,6 +66,12 @@
|
||||
<uses-feature android:name="wave.feature.lipexpression" android:required="false" />
|
||||
<uses-feature android:name="wave.feature.tracker" android:required="false" />
|
||||
|
||||
<!-- See https://developer.android.com/develop/xr/get-started -->
|
||||
<uses-feature android:name="android.software.xr.api.openxr" android:version="0x00010000" android:required="true" />
|
||||
<uses-feature android:name="android.hardware.xr.input.controller" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.xr.input.hand_tracking" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.xr.input.eye_tracking" android:required="false" />
|
||||
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
android:hasCode="true"
|
||||
@@ -71,6 +81,9 @@
|
||||
|
||||
<profileable android:shell="true" />
|
||||
|
||||
<!-- https://developer.android.com/develop/xr/get-started#uses-native-library_openxr -->
|
||||
<uses-native-library android:name="libopenxr.google.so" android:required="false" />
|
||||
|
||||
<meta-data android:name="pvr.app.type" android:value="vr" />
|
||||
<meta-data android:name="pvr.sdk.version" android:value="OpenXR" />
|
||||
<meta-data android:name="picovr.software.eye_tracking" android:value="true" />
|
||||
@@ -91,6 +104,14 @@
|
||||
<!-- https://developers.meta.com/horizon/documentation/native/android/mobile-passthrough-loading-screens -->
|
||||
<meta-data android:name="com.oculus.ossplash.background" android:value="passthrough-contextual"/>
|
||||
|
||||
<!-- https://developer.android.com/develop/xr/get-started#xr_activity_start_mode_full_space_unmanaged -->
|
||||
<property
|
||||
android:name="android.window.PROPERTY_XR_ACTIVITY_START_MODE"
|
||||
android:value="XR_ACTIVITY_START_MODE_FULL_SPACE_UNMANAGED" />
|
||||
<property
|
||||
android:name="android.window.PROPERTY_XR_BOUNDARY_TYPE_RECOMMENDED"
|
||||
android:value="XR_BOUNDARY_TYPE_LARGE" />
|
||||
|
||||
<!-- The activity is the built-in NativeActivity framework class. -->
|
||||
<!-- launchMode is set to singleTask because there should never be multiple copies of the app running. -->
|
||||
<!-- Theme.Black.NoTitleBar.Fullscreen gives solid black instead of a (bad stereoscopic) gradient on app transition. -->
|
||||
|
||||
+97
-81
@@ -23,12 +23,21 @@ include(FetchContent)
|
||||
include(ExternalProject)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(GIT_TAG "" CACHE STRING "Build for a tag (from git if empty)")
|
||||
set(GIT_DESC "" CACHE STRING "Version to show in UI (from git if empty, exclusive with GIT_TAG)")
|
||||
set(GIT_COMMIT "" CACHE STRING "Git SHA used to fetch client APK (from git if empty, exclusive with GIT_TAG)")
|
||||
|
||||
if (GIT_TAG AND (GIT_DESC OR GIT_COMMIT))
|
||||
message(FATAL_ERROR "cannot use GIT_DESC or GIT_COMMIT when using GIT_TAG")
|
||||
endif()
|
||||
|
||||
option(WIVRN_USE_SYSTEM_FREETYPE "Use system FreeType" ON)
|
||||
option(WIVRN_USE_SYSTEM_BOOST "Use system Boost headers" ON)
|
||||
option(WIVRN_USE_SYSTEM_OPENXR "Use system OpenXR headers" ON)
|
||||
option(WIVRN_USE_SYSTEMD "Use libsystemd" ON)
|
||||
option(WIVRN_USE_SYSTEM_LIBKTX "Use system KTX-Software library" ON)
|
||||
option(WIVRN_COMPRESS_GLB "Compress textures in GLB files with gltf-transform" OFF)
|
||||
option(WIVRN_USE_ANDROID_VALIDATION_LAYER "Download the android version of the Vulkan validation layer" OFF)
|
||||
option(WIVRN_USE_ANDROID_BIN_LIBKTX "Download the prebuilt libktx for android" OFF)
|
||||
option(WIVRN_BUILD_CLIENT "Build WiVRn client" OFF)
|
||||
option(WIVRN_BUILD_SERVER "Build WiVRn server" ON)
|
||||
option(WIVRN_BUILD_SERVER_LIBRARY "Build OpenXR library for WiVRn server" ${WIVRN_BUILD_SERVER})
|
||||
@@ -37,25 +46,35 @@ option(WIVRN_BUILD_WIVRNCTL "Build wivrnctl" ON)
|
||||
option(WIVRN_BUILD_DISSECTOR "Build Wireshark dissector" OFF)
|
||||
option(WIVRN_BUILD_TEST "Build test binaries" OFF)
|
||||
option(WIVRN_WERROR "Treat warnings as errors" OFF)
|
||||
option(WIVRN_OPTIMIZE_SHADERS "Run siprv-opt on compiled shaders" ON)
|
||||
option(WIVRN_OPTIMIZE_SHADERS "Run spirv-opt on compiled shaders" ON)
|
||||
option(WIVRN_DEBUG_SHADERS "Compile shaders with debug information" OFF)
|
||||
option(WIVRN_ADDRESS_SANITIZER "Use address sanitizer" OFF)
|
||||
|
||||
if(WIVRN_OPTIMIZE_SHADERS AND WIVRN_DEBUG_SHADERS)
|
||||
message(FATAL_ERROR "WIVRN_OPTIMIZE_SHADERS and WIVRN_DEBUG_SHADERS are incompatible")
|
||||
endif()
|
||||
|
||||
option(WIVRN_USE_NVENC "Enable nvenc (Nvidia) hardware encoder" ON)
|
||||
option(WIVRN_USE_VAAPI "Enable vaapi (AMD/Intel) hardware encoder" ON)
|
||||
option(WIVRN_USE_VULKAN_ENCODE "Enable vulkan video encoder" ON)
|
||||
option(WIVRN_USE_X264 "Enable x264 software encoder" ON)
|
||||
|
||||
option(WIVRN_USE_PIPEWIRE "Enable pipewire backend" ON)
|
||||
option(WIVRN_USE_PULSEAUDIO "Enable pulseaudio backend" OFF)
|
||||
option(WIVRN_USE_PERFETTO "Enable Perfetto tracing via the Perfetto SDK (server only)" OFF)
|
||||
option(WIVRN_TRACE_MONADO "Also instrument Monado (percetto) under the same WIVRN_TRACING switch; pulls in a second Perfetto runtime, system backend only. Requires WIVRN_USE_PERFETTO" OFF)
|
||||
if(WIVRN_TRACE_MONADO AND NOT WIVRN_USE_PERFETTO)
|
||||
message(FATAL_ERROR "WIVRN_TRACE_MONADO=ON requires WIVRN_USE_PERFETTO=ON")
|
||||
endif()
|
||||
|
||||
set(OVR_COMPAT_SEARCH_PATH "/opt/xrizer:/usr/local/lib/OpenComposite:/usr/lib/OpenComposite:/opt/OpenComposite:/opt/opencomposite"
|
||||
option(WIVRN_USE_PIPEWIRE "Enable pipewire backend" ON)
|
||||
|
||||
set(OVR_COMPAT_SEARCH_PATH "/opt/xrizer:/usr/local/lib/OpenComposite:/usr/lib/OpenComposite:/opt/OpenComposite:/opt/opencomposite:/opt/VapoR:/usr/local/lib/VapoR"
|
||||
CACHE STRING "List of places to search for the OpenVR compatibility layer, separated by :")
|
||||
|
||||
option(WIVRN_FEATURE_DEBUG_GUI "Enable Monado debug GUI" OFF)
|
||||
option(WIVRN_FEATURE_RENDERDOC "Support renderdoc" OFF)
|
||||
set(WIVRN_FEATURE_SOLARXR OFF) # Will be added back when merged in upstream Monado
|
||||
option(WIVRN_FEATURE_STEAMVR_LIGHTHOUSE "Enable SteamVR Lighthouse driver" OFF)
|
||||
option(WIVRN_FEATURE_SOLARXR "Enable SolarXR driver" ON)
|
||||
option(WIVRN_FEATURE_STEAMVR_LIGHTHOUSE "Enable SteamVR Lighthouse driver" ON)
|
||||
|
||||
option(WIVRN_CHECK_CAPSYSNICE "Check if CAP_SYS_NICE is available at startup" ON)
|
||||
set(WIVRN_CSS "${CMAKE_SOURCE_DIR}/images/wivrn-local.css" CACHE STRING "Stylesheet to use to render SVGs" )
|
||||
|
||||
option(WIVRN_SHOW_IMGUI_DEMO_WINDOW "Show the Dear ImGui demo window in the client" OFF)
|
||||
@@ -66,10 +85,11 @@ set(WIVRN_OPENXR_MANIFEST_TYPE "relative" CACHE STRING "How to reference librari
|
||||
if (NOT WIVRN_OPENXR_MANIFEST_TYPE IN_LIST WIVRN_OPENXR_MANIFEST_TYPE_VALUES)
|
||||
message(FATAL_ERROR "WIVRN_OPENXR_MANIFEST_TYPE must be one of ${WIVRN_OPENXR_MANIFEST_TYPE_VALUES}")
|
||||
endif()
|
||||
option(WIVRN_OPENXR_MANIFEST_ABI "Generate an ABI specific OpenXR manifest")
|
||||
|
||||
option(ENABLE_COLOURED_OUTPUT "Always produce ANSI-coloured output (GNU/Clang only)." ON)
|
||||
|
||||
set(WIVRN_ENVIRONMENTS_URL "https://github.com/WiVRn/WiVRn-environments/releases/latest/download/index.json" CACHE STRING "URL hosting the custom environments json file")
|
||||
set(WIVRN_ENVIRONMENTS_URL "https://github.com/Vindicus999/WiVRn-environments/releases/latest/download/index.json" CACHE STRING "URL hosting the custom environments json file")
|
||||
|
||||
if (WIVRN_BUILD_CLIENT OR WIVRN_BUILD_SERVER OR WIVRN_BUILD_DASHBOARD OR WIVRN_BUILD_DISSECTOR)
|
||||
set(NEED_COMMON TRUE)
|
||||
@@ -94,17 +114,17 @@ endif()
|
||||
include(VulkanVersion)
|
||||
|
||||
if (WIVRN_USE_SYSTEM_BOOST AND NEED_COMMON)
|
||||
if (WIVRN_BUILD_DISSECTOR)
|
||||
find_package(Boost 1.84.0 REQUIRED COMPONENTS locale url)
|
||||
if (WIVRN_BUILD_DISSECTOR OR WIVRN_BUILD_CLIENT)
|
||||
find_package(Boost 1.84.0 REQUIRED COMPONENTS locale url iostreams)
|
||||
else()
|
||||
find_package(Boost 1.75.0 REQUIRED COMPONENTS locale url)
|
||||
find_package(Boost 1.75.0 REQUIRED COMPONENTS locale url iostreams)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIVRN_BUILD_SERVER)
|
||||
find_program(GDBUS_CODEGEN gdbus-codegen REQUIRED)
|
||||
if (Vulkan_VERSION VERSION_LESS "1.3.261")
|
||||
message(FATAL_ERROR "Vulkan version must be at least 1.3.261, found ${Vulkan_VERSION}")
|
||||
if (Vulkan_VERSION VERSION_LESS "1.4.304")
|
||||
message(FATAL_ERROR "Vulkan version must be at least 1.4.304, found ${Vulkan_VERSION}")
|
||||
endif()
|
||||
|
||||
if (NOT WIVRN_USE_NVENC AND NOT WIVRN_USE_VAAPI AND NOT WIVRN_USE_X264 AND NOT WIVRN_USE_VULKAN_ENCODE)
|
||||
@@ -112,32 +132,18 @@ if (WIVRN_BUILD_SERVER)
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_VAAPI)
|
||||
pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET libavcodec libavutil libswscale libavfilter)
|
||||
pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET libavcodec libavutil)
|
||||
pkg_check_modules(LIBDRM REQUIRED IMPORTED_TARGET libdrm)
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_VULKAN_ENCODE)
|
||||
if (Vulkan_VERSION VERSION_LESS 1.3.283)
|
||||
message(FATAL_ERROR "Vulkan video encode requires 1.3.283, found ${Vulkan_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_X264)
|
||||
pkg_check_modules(X264 REQUIRED IMPORTED_TARGET x264)
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_SYSTEMD)
|
||||
pkg_check_modules(SYSTEMD REQUIRED IMPORTED_TARGET libsystemd)
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_PIPEWIRE)
|
||||
pkg_check_modules(libpipewire REQUIRED IMPORTED_TARGET libpipewire-0.3)
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_PULSEAUDIO)
|
||||
pkg_check_modules(libpulse REQUIRED IMPORTED_TARGET libpulse)
|
||||
endif()
|
||||
|
||||
pkg_check_modules(AVAHI REQUIRED IMPORTED_TARGET avahi-client avahi-glib)
|
||||
find_package(Eigen3 REQUIRED)
|
||||
find_package(nlohmann_json REQUIRED)
|
||||
@@ -170,23 +176,15 @@ if (WIVRN_BUILD_DASHBOARD)
|
||||
find_package(nlohmann_json REQUIRED)
|
||||
find_package(QCoro6 REQUIRED COMPONENTS Core Network Qml)
|
||||
qcoro_enable_coroutines()
|
||||
|
||||
if (WIVRN_CHECK_CAPSYSNICE)
|
||||
pkg_check_modules(libcap REQUIRED IMPORTED_TARGET libcap)
|
||||
endif()
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
endif()
|
||||
|
||||
if (WIVRN_BUILD_CLIENT OR WIVRN_BUILD_DASHBOARD)
|
||||
find_program(RSVG_CONVERT rsvg-convert REQUIRED)
|
||||
find_package(Gettext REQUIRED)
|
||||
endif()
|
||||
|
||||
if (WIVRN_BUILD_CLIENT)
|
||||
find_program(TOKTX toktx REQUIRED)
|
||||
find_program(RSVG_CONVERT rsvg-convert REQUIRED)
|
||||
find_program(KTX ktx REQUIRED)
|
||||
|
||||
if (WIVRN_COMPRESS_GLB)
|
||||
find_program(GLTF_TRANSFORM gltf-transform REQUIRED)
|
||||
@@ -198,13 +196,16 @@ if (WIVRN_BUILD_CLIENT)
|
||||
endif()
|
||||
|
||||
if (WIVRN_BUILD_CLIENT AND NOT ANDROID)
|
||||
pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET libavcodec libavutil libswscale libavfilter)
|
||||
pkg_check_modules(LIBAV_CLIENT REQUIRED IMPORTED_TARGET libavcodec libavutil libswscale)
|
||||
find_package(Fontconfig REQUIRED)
|
||||
|
||||
if (WIVRN_USE_SYSTEM_OPENXR)
|
||||
find_package(OpenXR 1.1.48 REQUIRED)
|
||||
find_package(OpenXR 1.1.58 REQUIRED)
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_SYSTEM_LIBKTX)
|
||||
find_package(Ktx REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
@@ -216,7 +217,7 @@ endif()
|
||||
|
||||
if (WIVRN_BUILD_DISSECTOR)
|
||||
if (WIVRN_USE_SYSTEM_OPENXR)
|
||||
find_package(OpenXR 1.1.48 REQUIRED)
|
||||
find_package(OpenXR 1.1.53 REQUIRED)
|
||||
endif()
|
||||
find_package(Wireshark REQUIRED)
|
||||
endif()
|
||||
@@ -227,45 +228,42 @@ if (WIVRN_BUILD_WIVRNCTL)
|
||||
endif()
|
||||
|
||||
# Common dependencies
|
||||
FetchContent_Declare(boostpfr EXCLUDE_FROM_ALL SYSTEM URL https://github.com/boostorg/pfr/archive/refs/tags/2.2.0.tar.gz
|
||||
URL_HASH SHA256=6f490ec1383de5855dcf801c23f0a967f888eb6e1440b6ca0bf36c12d4ae7ac7)
|
||||
FetchContent_Declare(boost EXCLUDE_FROM_ALL SYSTEM URL https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.xz
|
||||
URL_HASH SHA256=2e64e5d79a738d0fa6fb546c6e5c2bd28f88d268a2a080546f74e5ff98f29d0e)
|
||||
FetchContent_Declare(boost EXCLUDE_FROM_ALL SYSTEM URL https://github.com/boostorg/boost/releases/download/boost-1.89.0/boost-1.89.0-cmake.tar.xz
|
||||
URL_HASH SHA256=67acec02d0d118b5de9eb441f5fb707b3a1cdd884be00ca24b9a73c995511f74)
|
||||
|
||||
# Client dependencies
|
||||
FetchContent_Declare(simdjson EXCLUDE_FROM_ALL SYSTEM URL https://github.com/simdjson/simdjson/archive/refs/tags/v3.10.1.tar.gz
|
||||
URL_HASH SHA256=1e8f881cb2c0f626c56cd3665832f1e97b9d4ffc648ad9e1067c134862bba060)
|
||||
FetchContent_Declare(simdjson EXCLUDE_FROM_ALL SYSTEM URL https://github.com/simdjson/simdjson/archive/refs/tags/v4.2.2.tar.gz
|
||||
URL_HASH SHA256=3efae22cb41f83299fe0b2e8a187af543d3dda93abbb910586f897df670f9eaa)
|
||||
FetchContent_Declare(fastgltf EXCLUDE_FROM_ALL SYSTEM URL https://github.com/spnda/fastgltf/archive/refs/tags/v0.9.0.tar.gz
|
||||
URL_HASH SHA256=0bb564e127b14c22f062db50f89381dd2e0a20dbaf4987ca138a4ae8728712f9)
|
||||
FetchContent_Declare(glm EXCLUDE_FROM_ALL SYSTEM URL https://github.com/g-truc/glm/archive/refs/tags/1.0.1.tar.gz
|
||||
URL_HASH SHA256=9f3174561fd26904b23f0db5e560971cbf9b3cbda0b280f04d5c379d03bf234c)
|
||||
FetchContent_Declare(openxr_loader EXCLUDE_FROM_ALL SYSTEM URL https://github.com/KhronosGroup/OpenXR-SDK/archive/refs/tags/release-1.1.48.tar.gz
|
||||
URL_HASH SHA256=c9372992dcdfac643e28796e41d4dbd36c4cdf0388d01fa89245628edae9d411)
|
||||
FetchContent_Declare(spdlog EXCLUDE_FROM_ALL SYSTEM URL https://github.com/gabime/spdlog/archive/refs/tags/v1.15.3.tar.gz
|
||||
URL_HASH SHA256=15a04e69c222eb6c01094b5c7ff8a249b36bb22788d72519646fb85feb267e67)
|
||||
FetchContent_Declare(glm EXCLUDE_FROM_ALL SYSTEM URL https://github.com/g-truc/glm/releases/download/1.0.2/glm-1.0.2.zip
|
||||
URL_HASH SHA256=77fff075c5ab0caf076fade41558c5458d9a242aba2b2076bb72008bdb51a35e)
|
||||
FetchContent_Declare(openxr_loader EXCLUDE_FROM_ALL SYSTEM URL https://github.com/KhronosGroup/OpenXR-SDK/archive/refs/tags/release-1.1.58.tar.gz
|
||||
URL_HASH SHA256=815b933219c398314366c289221526428418d799205a73a9640c97ca4242602b)
|
||||
FetchContent_Declare(spdlog EXCLUDE_FROM_ALL SYSTEM URL https://github.com/gabime/spdlog/archive/refs/tags/v1.16.0.tar.gz
|
||||
URL_HASH SHA256=8741753e488a78dd0d0024c980e1fb5b5c85888447e309d9cb9d949bdb52aa3e)
|
||||
FetchContent_Declare(stb EXCLUDE_FROM_ALL SYSTEM URL https://github.com/nothings/stb/archive/013ac3beddff3dbffafd5177e7972067cd2b5083.zip
|
||||
URL_HASH SHA256=b7f476902bbef1b30f8ecc2d9d95c459c32302c8b559d09b589b5955463b7af8)
|
||||
file(GLOB LIBKTX_PATCHES CONFIGURE_DEPENDS patches/libktx/*)
|
||||
set(KTX_GIT_VERSION_FULL "v4.4.0")
|
||||
FetchContent_Declare(libktx EXCLUDE_FROM_ALL SYSTEM URL https://github.com/KhronosGroup/KTX-Software/archive/refs/tags/${KTX_GIT_VERSION_FULL}.tar.gz
|
||||
URL_HASH SHA256=3585d76edcdcbe3a671479686f8c81c1c10339f419e4b02a9a6f19cc6e4e0612
|
||||
PATCH_COMMAND ${CMAKE_CURRENT_LIST_DIR}/patches/apply.sh ${LIBKTX_PATCHES}
|
||||
set(KTX_VERSION "4.4.2")
|
||||
set(KTX_VERSION_FULL "v${KTX_VERSION}")
|
||||
FetchContent_Declare(libktx EXCLUDE_FROM_ALL SYSTEM URL https://github.com/KhronosGroup/KTX-Software/archive/refs/tags/${KTX_VERSION_FULL}.tar.gz
|
||||
URL_HASH SHA256=9412cb45045a503005acd47d98f9e8b47154634a50b4df21e17a1dfa8971d323
|
||||
)
|
||||
FetchContent_Declare(implot EXCLUDE_FROM_ALL SYSTEM URL https://github.com/epezent/implot/archive/3da8bd34299965d3b0ab124df743fe3e076fa222.zip
|
||||
URL_HASH SHA256=e9b439a94aa6f09fcf12ed9c2cd784efe5e99e96242122aa683e690b29f7a59f)
|
||||
FetchContent_Declare(implot EXCLUDE_FROM_ALL SYSTEM URL https://github.com/epezent/implot/releases/download/v1.0/implot-v1.0.tar.gz
|
||||
URL_HASH SHA256=20ca14d5a46f36a650746096c74eba8bea99c9432cd3c877343b96b17a6ae566)
|
||||
file(GLOB IMGUI_PATCHES CONFIGURE_DEPENDS patches/imgui/*)
|
||||
FetchContent_Declare(imgui EXCLUDE_FROM_ALL SYSTEM URL https://github.com/ocornut/imgui/archive/refs/tags/v1.92.3.tar.gz
|
||||
URL_HASH SHA256=9212ee7c4718b1466a5d99e64bce3ef1965704afea4ba651f8d978d0791b7c7c
|
||||
FetchContent_Declare(imgui EXCLUDE_FROM_ALL SYSTEM URL https://github.com/ocornut/imgui/archive/refs/tags/v1.92.9.tar.gz
|
||||
URL_HASH SHA256=af97ed649182c39314320514a672b82008ab462b9293fe23d37b30bfa5d05519
|
||||
PATCH_COMMAND ${CMAKE_CURRENT_LIST_DIR}/patches/apply.sh ${IMGUI_PATCHES}
|
||||
)
|
||||
FetchContent_Declare(uni-algo EXCLUDE_FROM_ALL SYSTEM URL https://github.com/uni-algo/uni-algo/archive/v1.2.0.tar.gz
|
||||
URL_HASH SHA256=f2a1539cd8635bc6088d05144a73ecfe7b4d74ee0361fabed6f87f9f19e74ca9)
|
||||
FetchContent_Declare(entt EXCLUDE_FROM_ALL SYSTEM URL https://github.com/skypjack/entt/archive/refs/tags/v3.15.0.tar.gz
|
||||
URL_HASH SHA256=01466fcbf77618a79b62891510c0bbf25ac2804af5751c84982b413852234d66)
|
||||
FetchContent_Declare(curl EXCLUDE_FROM_ALL SYSTEM URL https://github.com/curl/curl/releases/download/curl-8_15_0/curl-8.15.0.tar.xz
|
||||
URL_HASH SHA256=6cd0a8a5b126ddfda61c94dc2c3fc53481ba7a35461cf7c5ab66aa9d6775b609)
|
||||
FetchContent_Declare(spirv-reflect EXCLUDE_FROM_ALL SYSTEM URL https://github.com/KhronosGroup/SPIRV-Reflect/archive/refs/tags/vulkan-sdk-1.4.321.0.tar.gz
|
||||
URL_HASH SHA256=254ed36128e7abe8fb12ef804319d0790e059093c116e9fe55d4003880515f85)
|
||||
FetchContent_Declare(entt EXCLUDE_FROM_ALL SYSTEM URL https://github.com/skypjack/entt/archive/refs/tags/v4.0.0.tar.gz
|
||||
URL_HASH SHA256=32a2ff2c72cb047dfd57306006ef238820b70da7c6ce4e7e8a507ac63365212e)
|
||||
FetchContent_Declare(curl EXCLUDE_FROM_ALL SYSTEM URL https://github.com/curl/curl/releases/download/curl-8_17_0/curl-8.17.0.tar.xz
|
||||
URL_HASH SHA256=955f6e729ad6b3566260e8fef68620e76ba3c31acf0a18524416a185acf77992)
|
||||
FetchContent_Declare(spirv-reflect EXCLUDE_FROM_ALL SYSTEM URL https://github.com/KhronosGroup/SPIRV-Reflect/archive/refs/tags/vulkan-sdk-1.4.328.1.tar.gz
|
||||
URL_HASH SHA256=77f4b5b5630d960d7c17e39ddd5bf2e7dd62e6d8da24259ed14ca5b59783ea35)
|
||||
|
||||
file(GLOB MONADO_PATCHES CONFIGURE_DEPENDS patches/monado/*)
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS monado-rev)
|
||||
@@ -279,6 +277,21 @@ FetchContent_Declare(monado
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
|
||||
add_custom_target(wivrn-version ALL
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-D GIT_EXECUTABLE=${GIT_EXECUTABLE}
|
||||
-D INPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/common/version.cpp.in
|
||||
-D OUTPUT_FILE=${CMAKE_BINARY_DIR}/version.cpp
|
||||
-D INPUT_FILE_1=${CMAKE_CURRENT_SOURCE_DIR}/server/u_git_tag.cpp.in
|
||||
-D OUTPUT_FILE_1=${CMAKE_BINARY_DIR}/u_git_tag.cpp
|
||||
-D GIT_TAG="${GIT_TAG}"
|
||||
-D GIT_DESC="${GIT_DESC}"
|
||||
-D GIT_COMMIT="${GIT_COMMIT}"
|
||||
-P ${CMAKE_SOURCE_DIR}/cmake/GitVersion.cmake
|
||||
BYPRODUCTS ${CMAKE_BINARY_DIR}/version.cpp ${CMAKE_BINARY_DIR}/u_git_tag.cpp
|
||||
SOURCES common/version.cpp.in server/u_git_tag.cpp.in
|
||||
)
|
||||
|
||||
add_subdirectory(external)
|
||||
if (NEED_COMMON)
|
||||
add_subdirectory(common)
|
||||
@@ -289,21 +302,18 @@ if (WIVRN_BUILD_CLIENT)
|
||||
endif()
|
||||
|
||||
if (WIVRN_BUILD_SERVER OR WIVRN_BUILD_SERVER_LIBRARY)
|
||||
find_package(Python3 REQUIRED Interpreter)
|
||||
add_subdirectory(server)
|
||||
|
||||
if (WIVRN_BUILD_SERVER)
|
||||
message("Selected encoders:")
|
||||
message("\tNVENC : ${WIVRN_USE_NVENC}")
|
||||
message("\tVAAPI : ${WIVRN_USE_VAAPI}")
|
||||
message("\tVulkan: ${WIVRN_USE_VULKAN_ENCODE}")
|
||||
message("\tx264 : ${WIVRN_USE_X264}")
|
||||
message("")
|
||||
message("Audio backends:")
|
||||
message("\tPipewire : ${WIVRN_USE_PIPEWIRE}")
|
||||
message("\tPulseaudio: ${WIVRN_USE_PULSEAUDIO}")
|
||||
message("")
|
||||
message("Optional features:")
|
||||
message("\tsystemd: ${WIVRN_USE_SYSTEMD}")
|
||||
message(STATUS "Selected encoders:")
|
||||
message(STATUS "\tNVENC : ${WIVRN_USE_NVENC}")
|
||||
message(STATUS "\tVAAPI : ${WIVRN_USE_VAAPI}")
|
||||
message(STATUS "\tVulkan: ${WIVRN_USE_VULKAN_ENCODE}")
|
||||
message(STATUS "\tx264 : ${WIVRN_USE_X264}")
|
||||
message(STATUS "")
|
||||
message(STATUS "Audio backends:")
|
||||
message(STATUS "\tPipewire : ${WIVRN_USE_PIPEWIRE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -318,6 +328,7 @@ foreach(TARGET_NAME wivrn wivrn-server wivrn-dashboard wivrn-common wivrn-dissec
|
||||
if(TARGET ${TARGET_NAME})
|
||||
target_compile_options(${TARGET_NAME} PRIVATE
|
||||
-fdiagnostics-color -Wall -Wextra -pedantic
|
||||
-ffast-math
|
||||
-Wundef
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-unused-parameter
|
||||
@@ -332,5 +343,10 @@ foreach(TARGET_NAME wivrn wivrn-server wivrn-dashboard wivrn-common wivrn-dissec
|
||||
target_compile_options(${TARGET_NAME} PRIVATE -Werror)
|
||||
endif()
|
||||
|
||||
if (WIVRN_ADDRESS_SANITIZER AND NOT ${TARGET_NAME} STREQUAL wivrn-dissector)
|
||||
target_compile_options(${TARGET_NAME} PRIVATE -fsanitize=address -fno-omit-frame-pointer)
|
||||
target_link_options(${TARGET_NAME} PRIVATE -fsanitize=address)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
+30
-1
@@ -9,6 +9,7 @@
|
||||
{
|
||||
"name": "base",
|
||||
"hidden": true,
|
||||
"generator": "Ninja",
|
||||
"cacheVariables": {
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
|
||||
"CMAKE_INTERPROCEDURAL_OPTIMIZATION": "ON",
|
||||
@@ -25,7 +26,6 @@
|
||||
"WIVRN_USE_NVENC": "ON",
|
||||
"WIVRN_USE_SYSTEMD": "ON",
|
||||
"WIVRN_USE_SYSTEM_BOOST": "ON",
|
||||
"WIVRN_USE_PULSEAUDIO": "ON",
|
||||
"WIVRN_USE_PIPEWIRE": "ON",
|
||||
"WIVRN_WERROR": "ON"
|
||||
}
|
||||
@@ -65,6 +65,24 @@
|
||||
"WIVRN_BUILD_WIVRNCTL": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "server-tracing",
|
||||
"displayName": "Server with Perfetto tracing",
|
||||
"inherits": "server",
|
||||
"binaryDir": "${sourceDir}/build-server-tracing",
|
||||
"cacheVariables": {
|
||||
"WIVRN_USE_PERFETTO": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "server-tracing-monado",
|
||||
"displayName": "Server with Perfetto tracing (incl. Monado)",
|
||||
"inherits": "server-tracing",
|
||||
"binaryDir": "${sourceDir}/build-server-tracing-monado",
|
||||
"cacheVariables": {
|
||||
"WIVRN_TRACE_MONADO": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dashboard",
|
||||
"displayName": "Dashboard only",
|
||||
@@ -90,6 +108,7 @@
|
||||
"inherits": "everything",
|
||||
"binaryDir": "${sourceDir}/build-no-systemd",
|
||||
"cacheVariables": {
|
||||
"WIVRN_BUILD_WIVRNCTL": "OFF",
|
||||
"WIVRN_USE_SYSTEMD": "OFF"
|
||||
}
|
||||
},
|
||||
@@ -108,9 +127,19 @@
|
||||
"inherits": "server",
|
||||
"binaryDir": "${sourceDir}/build-server-no-systemd",
|
||||
"cacheVariables": {
|
||||
"WIVRN_BUILD_WIVRNCTL": "OFF",
|
||||
"WIVRN_USE_SYSTEMD": "OFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "client-no-system-boost",
|
||||
"displayName": "Client only (no system Boost)",
|
||||
"inherits": "client",
|
||||
"binaryDir": "${sourceDir}/build-client-no-system-boost",
|
||||
"cacheVariables": {
|
||||
"WIVRN_USE_SYSTEM_BOOST": "OFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "server-no-system-boost",
|
||||
"displayName": "Server only (no system Boost)",
|
||||
|
||||
@@ -1,33 +1,71 @@
|
||||
# WiVRn
|
||||
<h1 align="center"> WiVRn </h1>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://www.gnu.org/licenses/gpl-3.0)  
|
||||
|
||||
|
||||
</div>
|
||||
<p align="center"><img src="images/wivrn.svg" width="180"></p>
|
||||
<h3 align="center">Fully FOSS PCVR streamer</h3>
|
||||
|
||||
WiVRn wirelessly connects a standalone VR headset to a Linux computer. You can then play PCVR games on the headset while processing is done on the computer.
|
||||
# About
|
||||
|
||||
It supports a wide range of headsets such as Quest 1 / 2 / Pro / 3 / 3S, Pico Neo 3, Pico 4, HTC Vive Focus 3, HTC Vive XR elite and most other Android based headsets.
|
||||
WiVRn is an application that wirelessly streams a virtual reality game to a standalone VR headset from a <b>Linux</b> computer.
|
||||
|
||||
WiVRn support a wide range of VR devices:
|
||||
|
||||
| Headset | Supported | Notes |
|
||||
|:--------:|:--------:|:--------:|
|
||||
| Quest 1 | ✓ | |
|
||||
| Quest 2 | ✓ | |
|
||||
| Quest 3 | ✓ | |
|
||||
| Quest 3s | ✓ | |
|
||||
| Quest Pro | ✓ | |
|
||||
| Pico Neo 3 | ✓ | |
|
||||
| Pico 4 | ✓ | |
|
||||
| HTC Vive Focus 3 | ✓ | Laggy |
|
||||
| HTC Vive XR Elite | ✓ | Laggy |
|
||||
| Samsung Galaxy XR | ✓ | |
|
||||
| Other Android VR | ? | Cannot know |
|
||||
| Play for Dream | ✖ | https://github.com/WiVRn/WiVRn/issues/465 |
|
||||
| Non-Android VR | ✖ | Not Android |
|
||||
| Non-VR Android | ✖ | VR required |
|
||||
|
||||
<sup>A Linux client does exist, only for debugging. It has no audio or hardware decoding.</sup>
|
||||
|
||||
# Getting started
|
||||
|
||||
|
||||
## Server and dashboard
|
||||
## PC Server/Dashboard
|
||||
|
||||
We recommend using the flatpak package from Flathub:
|
||||
We recommend using native packages if available for your distribution:
|
||||
- [Arch User Repository](https://aur.archlinux.org/packages/wivrn-dashboard)
|
||||
- [Fedora](https://packages.fedoraproject.org/pkgs/wivrn/wivrn/)
|
||||
- [Gentoo Guru](https://gitweb.gentoo.org/repo/proj/guru.git/tree/media-libs/wivrn)
|
||||
- [NixOS](https://search.nixos.org/packages?show=wivrn)
|
||||
- [Ubuntu PPA](https://launchpad.net/~lvra/+archive/ubuntu/wivrn)
|
||||
|
||||
For OpenVR and Steam compatibility, you also need a compatibility library such as [xrizer](https://github.com/Supreeeme/xrizer/) or [OpenComposite](https://gitlab.com/znixian/OpenOVR/).
|
||||
|
||||
A Flatpak is available on Flathub for all distributions:
|
||||
|
||||
[](https://flathub.org/apps/io.github.wivrn.wivrn)
|
||||
|
||||
Alternatively, packages are available:
|
||||
- [AUR for Arch](https://aur.archlinux.org/packages/wivrn-dashboard)
|
||||
- [Fedora](https://packages.fedoraproject.org/pkgs/wivrn/wivrn/)
|
||||
- [Guru for Gentoo](https://gitweb.gentoo.org/repo/proj/guru.git/tree/media-libs/wivrn).
|
||||
The Flatpak contains both xrizer and OpenComposite.
|
||||
|
||||
Note that due to Flatpak sandboxing, some features such as support for SteamVR tracked (Lighthouse) devices, or virtual gamepad/keyboard/input devices forwarded from the headset, may not be available.
|
||||
|
||||
## Headset app
|
||||
## Headset Client/App
|
||||
|
||||
Follow the wizard in the dashboard to install the client app on the headset: it will either lead you to the [Meta Store](https://www.meta.com/experiences/7959676140827574/) or download the correct APK.
|
||||
Follow the wizard in the PC dashboard to install the client on your VR headset.
|
||||
|
||||
⚠️ You will need to have a compatible version: if the headset fails to connect to your computer, see [troubleshooting](#troubleshooting).
|
||||
It should either lead you to the [Meta Store](https://www.meta.com/experiences/7959676140827574/) (for Meta Quest headsets) or to download the correct APK (for other headsets).
|
||||
|
||||
> [!WARNING]
|
||||
> The VR client and PC server need to be on the same version of WiVRn
|
||||
|
||||
> [!TIP]
|
||||
> If the headset fails to connect to the computer, see [troubleshooting](#troubleshooting).
|
||||
|
||||
|
||||
|
||||
@@ -41,52 +79,57 @@ Avahi must be running:
|
||||
systemctl enable --now avahi-daemon
|
||||
```
|
||||
|
||||
- If a firewall is installed, open port 5353/UDP for avahi and ports 9757/UDP+TCP for WiVRn itself.
|
||||
- In the case of ufw, use `ufw allow 5353/udp` and `ufw allow 9757`.
|
||||
On SteamOS, the Avahi configuration needs to be modified to allow user services such as WiVRn to publish services on the network; see https://github.com/WiVRn/WiVRn/issues/1001#issuecomment-4940906113 for instructions on how to do so.
|
||||
|
||||
### Running
|
||||
- On your computer, run "WiVRn server" application, or `wivrn-dashboard` from the command line, it will show the connection wizard the first time you launch it.
|
||||
- On your headset, run WiVRn from the App Library. If you are using a Quest and you have installed it from an APK instead of the Meta Store, it will be in the "unknown sources" section.
|
||||
- You should now see your computer in the list: click connect, the screen will show "Connection ready. Start a VR application on **your computer's name**".
|
||||
- If a firewall is installed, open port 5353/UDP for Avahi and ports 9757/UDP+TCP for WiVRn.
|
||||
- For example, if using UFW run `ufw allow 5353/udp` and `ufw allow 9757`.
|
||||
|
||||
You can now start an OpenXR application on your computer. For Steam games, you will also need to set the launch options to be able to use WiVRn:
|
||||
- Right-click on the game you want to play in VR in Steam and click "Properties".
|
||||
- In the "General" tab, set the launch options to the value given in the dashboard.
|
||||
### Start the PC server process
|
||||
The graphical frontend is listed as "WiVRn server" in the application list, and is `wivrn-dashboard` on command line. On first start, a wizard will guide you through the initial steps.
|
||||
|
||||
You can set an application to be started automatically when you connect your headset in the dashboard settings or [manually](docs/configuration.md#application)
|
||||
The actual server for headless usage is `wivrn-server`. When installed through your distribution's package manager, a systemd user service named `wivrn` is also installed, which can be enabled to automatically start on login with `systemctl --user enable --now wivrn`.
|
||||
|
||||
### OpenVR and Steam games
|
||||
For Steam games, depending on the installation method, you may need to set launch options in the Steam properties for each game you want to run. Either the dashboard or command line output will display the launch command if it is required.
|
||||
|
||||
The flatpak also includes [OpenComposite](https://gitlab.com/znixian/OpenOVR/), used to translate the OpenVR API used by SteamVR to OpenXR used by WiVRn, see [SteamVR](docs/steamvr.md) for details.
|
||||
### Start the headset application
|
||||
On the headset, when installed from the store, simply start `WiVRn`. If you installed the app via the dashboard, or manually via `adb`, it will be in an "unknown sources" section.
|
||||
|
||||
If using Wine/Proton, it will probe for OpenVR at startup, so even for OpenXR applications, OpenComposite is required.
|
||||
On first start, it will ask if you want to enable some features such as microphone, hand tracking, eye tracking, etc., as they will require permissions to be granted. It is possible to grant those later from the Settings tab.
|
||||
|
||||
When you start the server through flatpak, it will automatically configure the current OpenVR to use OpenComposite.
|
||||
It is highly recommended to use default settings and only tweak them if you experience issues.
|
||||
|
||||
### Steam Flatpak
|
||||
### Connect to the server
|
||||
The headset application will start on a server list. Your computer should be visible and have a connect button. Simply click it to start streaming.
|
||||
|
||||
When the headset is connected, wivrn-server sets the OpenXR and OpenVR configuration to use WiVRn. Thus, applications will only be able to run in VR once the headset connection is established. The configuration is reverted once the connection ends and all running VR applications are closed.
|
||||
|
||||
The headset connection also triggers the creation of a virtual speaker and, if enabled in the headset app settings, a microphone. You will have to set them as the default output and input devices in your system audio configuration. This setting persists to future sessions until you change the defaults to other devices.
|
||||
|
||||
### Start an application
|
||||
When the headset is connected and no XR application is running, it will show an application launcher. Applications in that list are sourced from:
|
||||
- Steam games that are flagged as VR. Steam may need to be restarted for the list to be updated when new games are installed.
|
||||
- .desktop files that contain `X-WiVRn-VR` in the `Categories` section. Files are searched in [standard locations](https://specifications.freedesktop.org/desktop-entry/latest/file-naming.html#desktop-file-id) which usually include `~/.local/share/applications` and `/usr/share/applications/`.
|
||||
|
||||
You can set an application to be started automatically when your headset is connected, in the dashboard settings or [manually](docs/configuration.md#application).
|
||||
|
||||
## Steam Flatpak
|
||||
Flatpak applications are only able to access the Flatpak version of WiVRn.
|
||||
|
||||
If you're using the Steam Flatpak, you'll need to grant read only access to the following paths:
|
||||
|
||||
```bash
|
||||
flatpak override --user \
|
||||
flatpak override \
|
||||
--filesystem=xdg-run/wivrn:ro \
|
||||
--filesystem=xdg-data/flatpak/app/io.github.wivrn.wivrn:ro \
|
||||
--filesystem=/var/lib/flatpak/app/io.github.wivrn.wivrn:ro \
|
||||
--filesystem=xdg-config/openxr:ro \
|
||||
--filesystem=xdg-config/openvr:ro \
|
||||
com.valvesoftware.Steam
|
||||
```
|
||||
|
||||
Then create a symlink for the OpenXR configuration file (the directory `~/.var/app/com.valvesoftware.Steam/.config/openxr` will need to be created if it doesn't already exist):
|
||||
|
||||
```bash
|
||||
ln -s ~/.config/openxr/1 ~/.var/app/com.valvesoftware.Steam/.config/openxr/1
|
||||
```
|
||||
|
||||
### Audio
|
||||
When the headset is connected, WiVRn will create a virtual output device named WiVRn. It is not selected as default and you should either assign the application to the device when it is running, or mark it as default. To do so you can use `pavucontrol` or your desktop environment's configuration panel. Please note that in `pavucontrol` it will appear as a virtual device.
|
||||
|
||||
For microphone, you first have to enable it on the settings tabs on the headset (and give permission when prompted). It will then appear as a virtual input device named WiVRn(microphone) and also needs to be assigned like for output device.
|
||||
When using a user installation of flatpak Steam, use `override --user` instead of `override`.
|
||||
|
||||
The same overrides should work for other VR applications distributed as Flatpaks.
|
||||
|
||||
# Building
|
||||
|
||||
@@ -94,24 +137,22 @@ See [building](docs/building.md) for building the [dashboard](docs/building.md#d
|
||||
|
||||
|
||||
# Configuration
|
||||
Configuration can be done from the dashboard.
|
||||
|
||||
See [configuration](docs/configuration.md) for editing the configuration manually.
|
||||
Most settings are controlled through the headset app, while the server has configuration for items that are specific to the server. Use the dashboard to edit the latter, or see [configuration](docs/configuration.md) for editing it manually.
|
||||
|
||||
# Troubleshooting
|
||||
|
||||
## My computer is not seen by the headset
|
||||
<details><summary>My computer is not seen by the headset</summary>
|
||||
|
||||
If the server list is empty in the headset app:
|
||||
- Make sure your computer is connected on the same network as your headset
|
||||
- Check that avahi is running with `systemctl status avahi-daemon`, if it is not, enable it with `systemctl enable --now avahi-daemon`
|
||||
- If you have a firewall, check that port 5353 (UDP) is open
|
||||
- If you have a firewall, check that port 5353 (UDP) is open</details>
|
||||
|
||||
## My headset does not connect to my computer
|
||||
<details><summary>My headset does not connect to my computer</summary>
|
||||
|
||||
- If you have a firewall, check that port 9757 (UDP and TCP) is open
|
||||
- The server and client must be compatible.
|
||||
- The server and client must be the same version.</details>
|
||||
|
||||
## How do I use a wired connection?
|
||||
<details><summary>How do I use a wired connection manually?</summary>
|
||||
|
||||
- Make sure the WiVRn Server is installed and running on your computer
|
||||
- Make sure you have the WiVRn app installed on your headset
|
||||
@@ -125,15 +166,20 @@ If the server list is empty in the headset app:
|
||||
- `org.meumeu.wivrn.github.nighly` for Github nightlies (wirvn-apk [repository](https://github.com/WiVRn/WiVRn-APK/releases))
|
||||
- `org.meumeu.wivrn.github.testing` for Github CI builds
|
||||
- `org.meumeu.wivrn.local` for developer builds
|
||||
- You can now continue the pairing process as documented in the running section.
|
||||
- You can now continue the pairing process as documented in the running section.</details>
|
||||
|
||||
## How do I see server logs when using the dashboard?
|
||||
<details><summary>How do I see server logs when using the dashboard?</summary>
|
||||
|
||||
- Click Troubleshoot > Open server logs, or
|
||||
- Navigate to `${XDG_STATE_HOME}/wivrn/wivrn-dashboard` (with fallback to `${HOME}/.local/state` for `${XDG_STATE_HOME}`, or
|
||||
- For flatpak, navigate to `${HOME}/.var/app/io.github.wivrn.wivrn/.local/state/wivrn/wivrn-dashboard`.
|
||||
- Click **Troubleshoot > Open server logs**
|
||||
- Or, navigate to `${XDG_STATE_HOME}/wivrn/wivrn-dashboard`
|
||||
- In other words, on common setups, the dashboard writes logs to `~/.local/state/wivrn/wivrn-dashboard`
|
||||
- For WiVRn Flatpak, the dashboard writes logs to `~/.var/app/io.github.wivrn.wivrn/.local/state/wivrn/wivrn-dashboard`</details>
|
||||
|
||||
## I have high motion latency, black borders following my view, hear corrupted audio or see a corrupted, pixelated image
|
||||
<details><summary>My NVIDIA GPU P-State is limited to P2 instead of reaching the highest P0 while using the NVIDIA NVENC encoder</summary>
|
||||
|
||||
- See [nvenc](docs/nvenc.md) for troubleshooting.</details>
|
||||
|
||||
<details><summary>I have high motion latency, black borders following my view, hear corrupted audio or see a corrupted, pixelated image</summary>
|
||||
|
||||
- When connecting through USB, make sure the headset isn't connected through WiFi (switch off WiFi)
|
||||
- Reset the settings using the button at the bottom of the settings tab
|
||||
@@ -142,7 +188,16 @@ If the server list is empty in the headset app:
|
||||
- Decrease the resolution in the WiVRn app
|
||||
- Connect through USB or use a better WiFi router.
|
||||
|
||||
Note: WiVRn isn't properly optimized for NVIDIA GPUs due to the lack of developers with NVIDIA hardware. Motion latency may be significantly worse at rendering resolutions higher than default.
|
||||
Note: WiVRn isn't properly optimized for NVIDIA GPUs due to the lack of developers with NVIDIA hardware. Motion latency may be significantly worse at rendering resolutions higher than default.</details>
|
||||
|
||||
# Community Support
|
||||
|
||||
We are available on either **Discord** or **Matrix space**:
|
||||
|
||||
[](https://discord.gg/EHAYe3tTYa) [](https://matrix.to/#/#linux-vr-adventures:matrix.org)
|
||||
|
||||
Please use the `wivrn` chat room for questions or issues specific to WiVRn.
|
||||
|
||||
|
||||
# Contributing
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,168 +0,0 @@
|
||||
{
|
||||
"profileId": "generic-trigger-squeeze",
|
||||
"fallbackProfileIds": [],
|
||||
"layouts": {
|
||||
"left": {
|
||||
"selectComponentId": "xr-standard-trigger",
|
||||
"components": {
|
||||
"xr-standard-trigger": {
|
||||
"type": "trigger",
|
||||
"gamepadIndices": {
|
||||
"button": 0
|
||||
},
|
||||
"rootNodeName": "xr_standard_trigger",
|
||||
"visualResponses": {
|
||||
"xr_standard_trigger_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_trigger_pressed_value",
|
||||
"minNodeName": "xr_standard_trigger_pressed_min",
|
||||
"maxNodeName": "xr_standard_trigger_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-squeeze": {
|
||||
"type": "squeeze",
|
||||
"gamepadIndices": {
|
||||
"button": 1
|
||||
},
|
||||
"rootNodeName": "xr_standard_squeeze",
|
||||
"visualResponses": {
|
||||
"xr_standard_squeeze_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_max"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gamepadMapping": "xr-standard",
|
||||
"rootNodeName": "generic-trigger-squeeze-left",
|
||||
"assetPath": "left.glb"
|
||||
},
|
||||
"right": {
|
||||
"selectComponentId": "xr-standard-trigger",
|
||||
"components": {
|
||||
"xr-standard-trigger": {
|
||||
"type": "trigger",
|
||||
"gamepadIndices": {
|
||||
"button": 0
|
||||
},
|
||||
"rootNodeName": "xr_standard_trigger",
|
||||
"visualResponses": {
|
||||
"xr_standard_trigger_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_trigger_pressed_value",
|
||||
"minNodeName": "xr_standard_trigger_pressed_min",
|
||||
"maxNodeName": "xr_standard_trigger_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-squeeze": {
|
||||
"type": "squeeze",
|
||||
"gamepadIndices": {
|
||||
"button": 1
|
||||
},
|
||||
"rootNodeName": "xr_standard_squeeze",
|
||||
"visualResponses": {
|
||||
"xr_standard_squeeze_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_max"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gamepadMapping": "xr-standard",
|
||||
"rootNodeName": "generic-trigger-squeeze-right",
|
||||
"assetPath": "right.glb"
|
||||
},
|
||||
"none": {
|
||||
"selectComponentId": "xr-standard-trigger",
|
||||
"components": {
|
||||
"xr-standard-trigger": {
|
||||
"type": "trigger",
|
||||
"gamepadIndices": {
|
||||
"button": 0
|
||||
},
|
||||
"rootNodeName": "xr_standard_trigger",
|
||||
"visualResponses": {
|
||||
"xr_standard_trigger_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_trigger_pressed_value",
|
||||
"minNodeName": "xr_standard_trigger_pressed_min",
|
||||
"maxNodeName": "xr_standard_trigger_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-squeeze": {
|
||||
"type": "squeeze",
|
||||
"gamepadIndices": {
|
||||
"button": 1
|
||||
},
|
||||
"rootNodeName": "xr_standard_squeeze",
|
||||
"visualResponses": {
|
||||
"xr_standard_squeeze_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_max"
|
||||
},
|
||||
"xr_standard_squeeze_pressed_mirror": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_mirror_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_mirror_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_mirror_max"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gamepadMapping": "xr-standard",
|
||||
"rootNodeName": "generic-trigger-squeeze-none",
|
||||
"assetPath": "none.glb"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,286 +0,0 @@
|
||||
{
|
||||
"profileId": "htc-vive-focus-3",
|
||||
"fallbackProfileIds": [
|
||||
"generic-trigger-squeeze-thumbstick"
|
||||
],
|
||||
"layouts": {
|
||||
"left": {
|
||||
"selectComponentId": "xr-standard-trigger",
|
||||
"components": {
|
||||
"xr-standard-trigger": {
|
||||
"type": "trigger",
|
||||
"gamepadIndices": {
|
||||
"button": 0
|
||||
},
|
||||
"rootNodeName": "xr_standard_trigger",
|
||||
"visualResponses": {
|
||||
"xr_standard_trigger_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_trigger_pressed_value",
|
||||
"minNodeName": "xr_standard_trigger_pressed_min",
|
||||
"maxNodeName": "xr_standard_trigger_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-squeeze": {
|
||||
"type": "squeeze",
|
||||
"gamepadIndices": {
|
||||
"button": 1
|
||||
},
|
||||
"rootNodeName": "xr_standard_squeeze",
|
||||
"visualResponses": {
|
||||
"xr_standard_squeeze_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-thumbstick": {
|
||||
"type": "thumbstick",
|
||||
"gamepadIndices": {
|
||||
"button": 3,
|
||||
"xAxis": 2,
|
||||
"yAxis": 3
|
||||
},
|
||||
"rootNodeName": "xr_standard_thumbstick",
|
||||
"visualResponses": {
|
||||
"xr_standard_thumbstick_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_xaxis_pressed": {
|
||||
"componentProperty": "xAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_xaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_yaxis_pressed": {
|
||||
"componentProperty": "yAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_yaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 4
|
||||
},
|
||||
"rootNodeName": "x_button",
|
||||
"visualResponses": {
|
||||
"x_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "x_button_pressed_value",
|
||||
"minNodeName": "x_button_pressed_min",
|
||||
"maxNodeName": "x_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"y-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 5
|
||||
},
|
||||
"rootNodeName": "y_button",
|
||||
"visualResponses": {
|
||||
"y_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "y_button_pressed_value",
|
||||
"minNodeName": "y_button_pressed_min",
|
||||
"maxNodeName": "y_button_pressed_max"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gamepadMapping": "xr-standard",
|
||||
"rootNodeName": "htc-vive-focus-3-left",
|
||||
"assetPath": "left.glb"
|
||||
},
|
||||
"right": {
|
||||
"selectComponentId": "xr-standard-trigger",
|
||||
"components": {
|
||||
"xr-standard-trigger": {
|
||||
"type": "trigger",
|
||||
"gamepadIndices": {
|
||||
"button": 0
|
||||
},
|
||||
"rootNodeName": "xr_standard_trigger",
|
||||
"visualResponses": {
|
||||
"xr_standard_trigger_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_trigger_pressed_value",
|
||||
"minNodeName": "xr_standard_trigger_pressed_min",
|
||||
"maxNodeName": "xr_standard_trigger_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-squeeze": {
|
||||
"type": "squeeze",
|
||||
"gamepadIndices": {
|
||||
"button": 1
|
||||
},
|
||||
"rootNodeName": "xr_standard_squeeze",
|
||||
"visualResponses": {
|
||||
"xr_standard_squeeze_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-thumbstick": {
|
||||
"type": "thumbstick",
|
||||
"gamepadIndices": {
|
||||
"button": 3,
|
||||
"xAxis": 2,
|
||||
"yAxis": 3
|
||||
},
|
||||
"rootNodeName": "xr_standard_thumbstick",
|
||||
"visualResponses": {
|
||||
"xr_standard_thumbstick_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_xaxis_pressed": {
|
||||
"componentProperty": "xAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_xaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_yaxis_pressed": {
|
||||
"componentProperty": "yAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_yaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"a-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 4
|
||||
},
|
||||
"rootNodeName": "a_button",
|
||||
"visualResponses": {
|
||||
"a_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "a_button_pressed_value",
|
||||
"minNodeName": "a_button_pressed_min",
|
||||
"maxNodeName": "a_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"b-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 5
|
||||
},
|
||||
"rootNodeName": "b_button",
|
||||
"visualResponses": {
|
||||
"b_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "b_button_pressed_value",
|
||||
"minNodeName": "b_button_pressed_min",
|
||||
"maxNodeName": "b_button_pressed_max"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gamepadMapping": "xr-standard",
|
||||
"rootNodeName": "htc-vive-focus-3-right",
|
||||
"assetPath": "right.glb"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,330 +0,0 @@
|
||||
{
|
||||
"profileId": "meta-quest-touch-plus",
|
||||
"fallbackProfileIds": [
|
||||
"oculus-touch-v3",
|
||||
"oculus-touch",
|
||||
"generic-trigger-squeeze-thumbstick"
|
||||
],
|
||||
"layouts": {
|
||||
"left": {
|
||||
"selectComponentId": "xr-standard-trigger",
|
||||
"components": {
|
||||
"xr-standard-trigger": {
|
||||
"type": "trigger",
|
||||
"gamepadIndices": {
|
||||
"button": 0
|
||||
},
|
||||
"rootNodeName": "xr_standard_trigger",
|
||||
"visualResponses": {
|
||||
"xr_standard_trigger_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_trigger_pressed_value",
|
||||
"minNodeName": "xr_standard_trigger_pressed_min",
|
||||
"maxNodeName": "xr_standard_trigger_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-squeeze": {
|
||||
"type": "squeeze",
|
||||
"gamepadIndices": {
|
||||
"button": 1
|
||||
},
|
||||
"rootNodeName": "xr_standard_squeeze",
|
||||
"visualResponses": {
|
||||
"xr_standard_squeeze_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-thumbstick": {
|
||||
"type": "thumbstick",
|
||||
"gamepadIndices": {
|
||||
"button": 3,
|
||||
"xAxis": 2,
|
||||
"yAxis": 3
|
||||
},
|
||||
"rootNodeName": "xr_standard_thumbstick",
|
||||
"visualResponses": {
|
||||
"xr_standard_thumbstick_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_xaxis_pressed": {
|
||||
"componentProperty": "xAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_xaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_yaxis_pressed": {
|
||||
"componentProperty": "yAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_yaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 4
|
||||
},
|
||||
"rootNodeName": "x_button",
|
||||
"visualResponses": {
|
||||
"x_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "x_button_pressed_value",
|
||||
"minNodeName": "x_button_pressed_min",
|
||||
"maxNodeName": "x_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"y-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 5
|
||||
},
|
||||
"rootNodeName": "y_button",
|
||||
"visualResponses": {
|
||||
"y_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "y_button_pressed_value",
|
||||
"minNodeName": "y_button_pressed_min",
|
||||
"maxNodeName": "y_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"thumbrest": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 6
|
||||
},
|
||||
"rootNodeName": "thumbrest",
|
||||
"visualResponses": {
|
||||
"thumbrest_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "thumbrest_pressed_value",
|
||||
"minNodeName": "thumbrest_pressed_min",
|
||||
"maxNodeName": "thumbrest_pressed_max"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gamepadMapping": "xr-standard",
|
||||
"rootNodeName": "meta-quest-touch-plus-left",
|
||||
"assetPath": "left.glb"
|
||||
},
|
||||
"right": {
|
||||
"selectComponentId": "xr-standard-trigger",
|
||||
"components": {
|
||||
"xr-standard-trigger": {
|
||||
"type": "trigger",
|
||||
"gamepadIndices": {
|
||||
"button": 0
|
||||
},
|
||||
"rootNodeName": "xr_standard_trigger",
|
||||
"visualResponses": {
|
||||
"xr_standard_trigger_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_trigger_pressed_value",
|
||||
"minNodeName": "xr_standard_trigger_pressed_min",
|
||||
"maxNodeName": "xr_standard_trigger_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-squeeze": {
|
||||
"type": "squeeze",
|
||||
"gamepadIndices": {
|
||||
"button": 1
|
||||
},
|
||||
"rootNodeName": "xr_standard_squeeze",
|
||||
"visualResponses": {
|
||||
"xr_standard_squeeze_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-thumbstick": {
|
||||
"type": "thumbstick",
|
||||
"gamepadIndices": {
|
||||
"button": 3,
|
||||
"xAxis": 2,
|
||||
"yAxis": 3
|
||||
},
|
||||
"rootNodeName": "xr_standard_thumbstick",
|
||||
"visualResponses": {
|
||||
"xr_standard_thumbstick_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_xaxis_pressed": {
|
||||
"componentProperty": "xAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_xaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_yaxis_pressed": {
|
||||
"componentProperty": "yAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_yaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"a-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 4
|
||||
},
|
||||
"rootNodeName": "a_button",
|
||||
"visualResponses": {
|
||||
"a_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "a_button_pressed_value",
|
||||
"minNodeName": "a_button_pressed_min",
|
||||
"maxNodeName": "a_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"b-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 5
|
||||
},
|
||||
"rootNodeName": "b_button",
|
||||
"visualResponses": {
|
||||
"b_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "b_button_pressed_value",
|
||||
"minNodeName": "b_button_pressed_min",
|
||||
"maxNodeName": "b_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"thumbrest": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 6
|
||||
},
|
||||
"rootNodeName": "thumbrest",
|
||||
"visualResponses": {
|
||||
"thumbrest_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "thumbrest_pressed_value",
|
||||
"minNodeName": "thumbrest_pressed_min",
|
||||
"maxNodeName": "thumbrest_pressed_max"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gamepadMapping": "xr-standard",
|
||||
"rootNodeName": "meta-quest-touch-plus-right",
|
||||
"assetPath": "right.glb"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,330 +0,0 @@
|
||||
{
|
||||
"profileId": "meta-quest-touch-pro",
|
||||
"fallbackProfileIds": [
|
||||
"oculus-touch-v2",
|
||||
"oculus-touch",
|
||||
"generic-trigger-squeeze-thumbstick"
|
||||
],
|
||||
"layouts": {
|
||||
"left": {
|
||||
"selectComponentId": "xr-standard-trigger",
|
||||
"components": {
|
||||
"xr-standard-trigger": {
|
||||
"type": "trigger",
|
||||
"gamepadIndices": {
|
||||
"button": 0
|
||||
},
|
||||
"rootNodeName": "xr_standard_trigger",
|
||||
"visualResponses": {
|
||||
"xr_standard_trigger_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_trigger_pressed_value",
|
||||
"minNodeName": "xr_standard_trigger_pressed_min",
|
||||
"maxNodeName": "xr_standard_trigger_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-squeeze": {
|
||||
"type": "squeeze",
|
||||
"gamepadIndices": {
|
||||
"button": 1
|
||||
},
|
||||
"rootNodeName": "xr_standard_squeeze",
|
||||
"visualResponses": {
|
||||
"xr_standard_squeeze_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-thumbstick": {
|
||||
"type": "thumbstick",
|
||||
"gamepadIndices": {
|
||||
"button": 3,
|
||||
"xAxis": 2,
|
||||
"yAxis": 3
|
||||
},
|
||||
"rootNodeName": "xr_standard_thumbstick",
|
||||
"visualResponses": {
|
||||
"xr_standard_thumbstick_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_xaxis_pressed": {
|
||||
"componentProperty": "xAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_xaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_yaxis_pressed": {
|
||||
"componentProperty": "yAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_yaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 4
|
||||
},
|
||||
"rootNodeName": "x_button",
|
||||
"visualResponses": {
|
||||
"x_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "x_button_pressed_value",
|
||||
"minNodeName": "x_button_pressed_min",
|
||||
"maxNodeName": "x_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"y-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 5
|
||||
},
|
||||
"rootNodeName": "y_button",
|
||||
"visualResponses": {
|
||||
"y_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "y_button_pressed_value",
|
||||
"minNodeName": "y_button_pressed_min",
|
||||
"maxNodeName": "y_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"thumbrest": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 6
|
||||
},
|
||||
"rootNodeName": "thumbrest",
|
||||
"visualResponses": {
|
||||
"thumbrest_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "thumbrest_pressed_value",
|
||||
"minNodeName": "thumbrest_pressed_min",
|
||||
"maxNodeName": "thumbrest_pressed_max"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gamepadMapping": "xr-standard",
|
||||
"rootNodeName": "meta-quest-touch-pro-left",
|
||||
"assetPath": "left.glb"
|
||||
},
|
||||
"right": {
|
||||
"selectComponentId": "xr-standard-trigger",
|
||||
"components": {
|
||||
"xr-standard-trigger": {
|
||||
"type": "trigger",
|
||||
"gamepadIndices": {
|
||||
"button": 0
|
||||
},
|
||||
"rootNodeName": "xr_standard_trigger",
|
||||
"visualResponses": {
|
||||
"xr_standard_trigger_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_trigger_pressed_value",
|
||||
"minNodeName": "xr_standard_trigger_pressed_min",
|
||||
"maxNodeName": "xr_standard_trigger_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-squeeze": {
|
||||
"type": "squeeze",
|
||||
"gamepadIndices": {
|
||||
"button": 1
|
||||
},
|
||||
"rootNodeName": "xr_standard_squeeze",
|
||||
"visualResponses": {
|
||||
"xr_standard_squeeze_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-thumbstick": {
|
||||
"type": "thumbstick",
|
||||
"gamepadIndices": {
|
||||
"button": 3,
|
||||
"xAxis": 2,
|
||||
"yAxis": 3
|
||||
},
|
||||
"rootNodeName": "xr_standard_thumbstick",
|
||||
"visualResponses": {
|
||||
"xr_standard_thumbstick_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_xaxis_pressed": {
|
||||
"componentProperty": "xAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_xaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_yaxis_pressed": {
|
||||
"componentProperty": "yAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_yaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"a-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 4
|
||||
},
|
||||
"rootNodeName": "a_button",
|
||||
"visualResponses": {
|
||||
"a_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "a_button_pressed_value",
|
||||
"minNodeName": "a_button_pressed_min",
|
||||
"maxNodeName": "a_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"b-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 5
|
||||
},
|
||||
"rootNodeName": "b_button",
|
||||
"visualResponses": {
|
||||
"b_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "b_button_pressed_value",
|
||||
"minNodeName": "b_button_pressed_min",
|
||||
"maxNodeName": "b_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"thumbrest": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 6
|
||||
},
|
||||
"rootNodeName": "thumbrest",
|
||||
"visualResponses": {
|
||||
"thumbrest_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "thumbrest_pressed_value",
|
||||
"minNodeName": "thumbrest_pressed_min",
|
||||
"maxNodeName": "thumbrest_pressed_max"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gamepadMapping": "xr-standard",
|
||||
"rootNodeName": "meta-quest-touch-pro-right",
|
||||
"assetPath": "right.glb"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,329 +0,0 @@
|
||||
{
|
||||
"profileId": "oculus-touch-v2",
|
||||
"fallbackProfileIds": [
|
||||
"oculus-touch",
|
||||
"generic-trigger-squeeze-thumbstick"
|
||||
],
|
||||
"layouts": {
|
||||
"left": {
|
||||
"selectComponentId": "xr-standard-trigger",
|
||||
"components": {
|
||||
"xr-standard-trigger": {
|
||||
"type": "trigger",
|
||||
"gamepadIndices": {
|
||||
"button": 0
|
||||
},
|
||||
"rootNodeName": "xr_standard_trigger",
|
||||
"visualResponses": {
|
||||
"xr_standard_trigger_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_trigger_pressed_value",
|
||||
"minNodeName": "xr_standard_trigger_pressed_min",
|
||||
"maxNodeName": "xr_standard_trigger_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-squeeze": {
|
||||
"type": "squeeze",
|
||||
"gamepadIndices": {
|
||||
"button": 1
|
||||
},
|
||||
"rootNodeName": "xr_standard_squeeze",
|
||||
"visualResponses": {
|
||||
"xr_standard_squeeze_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-thumbstick": {
|
||||
"type": "thumbstick",
|
||||
"gamepadIndices": {
|
||||
"button": 3,
|
||||
"xAxis": 2,
|
||||
"yAxis": 3
|
||||
},
|
||||
"rootNodeName": "xr_standard_thumbstick",
|
||||
"visualResponses": {
|
||||
"xr_standard_thumbstick_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_xaxis_pressed": {
|
||||
"componentProperty": "xAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_xaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_yaxis_pressed": {
|
||||
"componentProperty": "yAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_yaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 4
|
||||
},
|
||||
"rootNodeName": "x_button",
|
||||
"visualResponses": {
|
||||
"x_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "x_button_pressed_value",
|
||||
"minNodeName": "x_button_pressed_min",
|
||||
"maxNodeName": "x_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"y-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 5
|
||||
},
|
||||
"rootNodeName": "y_button",
|
||||
"visualResponses": {
|
||||
"y_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "y_button_pressed_value",
|
||||
"minNodeName": "y_button_pressed_min",
|
||||
"maxNodeName": "y_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"thumbrest": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 6
|
||||
},
|
||||
"rootNodeName": "thumbrest",
|
||||
"visualResponses": {
|
||||
"thumbrest_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "thumbrest_pressed_value",
|
||||
"minNodeName": "thumbrest_pressed_min",
|
||||
"maxNodeName": "thumbrest_pressed_max"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gamepadMapping": "xr-standard",
|
||||
"rootNodeName": "oculus-touch-v2-left",
|
||||
"assetPath": "left.glb"
|
||||
},
|
||||
"right": {
|
||||
"selectComponentId": "xr-standard-trigger",
|
||||
"components": {
|
||||
"xr-standard-trigger": {
|
||||
"type": "trigger",
|
||||
"gamepadIndices": {
|
||||
"button": 0
|
||||
},
|
||||
"rootNodeName": "xr_standard_trigger",
|
||||
"visualResponses": {
|
||||
"xr_standard_trigger_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_trigger_pressed_value",
|
||||
"minNodeName": "xr_standard_trigger_pressed_min",
|
||||
"maxNodeName": "xr_standard_trigger_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-squeeze": {
|
||||
"type": "squeeze",
|
||||
"gamepadIndices": {
|
||||
"button": 1
|
||||
},
|
||||
"rootNodeName": "xr_standard_squeeze",
|
||||
"visualResponses": {
|
||||
"xr_standard_squeeze_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-thumbstick": {
|
||||
"type": "thumbstick",
|
||||
"gamepadIndices": {
|
||||
"button": 3,
|
||||
"xAxis": 2,
|
||||
"yAxis": 3
|
||||
},
|
||||
"rootNodeName": "xr_standard_thumbstick",
|
||||
"visualResponses": {
|
||||
"xr_standard_thumbstick_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_xaxis_pressed": {
|
||||
"componentProperty": "xAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_xaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_yaxis_pressed": {
|
||||
"componentProperty": "yAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_yaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"a-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 4
|
||||
},
|
||||
"rootNodeName": "a_button",
|
||||
"visualResponses": {
|
||||
"a_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "a_button_pressed_value",
|
||||
"minNodeName": "a_button_pressed_min",
|
||||
"maxNodeName": "a_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"b-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 5
|
||||
},
|
||||
"rootNodeName": "b_button",
|
||||
"visualResponses": {
|
||||
"b_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "b_button_pressed_value",
|
||||
"minNodeName": "b_button_pressed_min",
|
||||
"maxNodeName": "b_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"thumbrest": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 6
|
||||
},
|
||||
"rootNodeName": "thumbrest",
|
||||
"visualResponses": {
|
||||
"thumbrest_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "thumbrest_pressed_value",
|
||||
"minNodeName": "thumbrest_pressed_min",
|
||||
"maxNodeName": "thumbrest_pressed_max"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gamepadMapping": "xr-standard",
|
||||
"rootNodeName": "oculus-touch-v2-right",
|
||||
"assetPath": "right.glb"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,330 +0,0 @@
|
||||
{
|
||||
"profileId": "oculus-touch-v3",
|
||||
"fallbackProfileIds": [
|
||||
"oculus-touch-v2",
|
||||
"oculus-touch",
|
||||
"generic-trigger-squeeze-thumbstick"
|
||||
],
|
||||
"layouts": {
|
||||
"left": {
|
||||
"selectComponentId": "xr-standard-trigger",
|
||||
"components": {
|
||||
"xr-standard-trigger": {
|
||||
"type": "trigger",
|
||||
"gamepadIndices": {
|
||||
"button": 0
|
||||
},
|
||||
"rootNodeName": "xr_standard_trigger",
|
||||
"visualResponses": {
|
||||
"xr_standard_trigger_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_trigger_pressed_value",
|
||||
"minNodeName": "xr_standard_trigger_pressed_min",
|
||||
"maxNodeName": "xr_standard_trigger_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-squeeze": {
|
||||
"type": "squeeze",
|
||||
"gamepadIndices": {
|
||||
"button": 1
|
||||
},
|
||||
"rootNodeName": "xr_standard_squeeze",
|
||||
"visualResponses": {
|
||||
"xr_standard_squeeze_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-thumbstick": {
|
||||
"type": "thumbstick",
|
||||
"gamepadIndices": {
|
||||
"button": 3,
|
||||
"xAxis": 2,
|
||||
"yAxis": 3
|
||||
},
|
||||
"rootNodeName": "xr_standard_thumbstick",
|
||||
"visualResponses": {
|
||||
"xr_standard_thumbstick_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_xaxis_pressed": {
|
||||
"componentProperty": "xAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_xaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_yaxis_pressed": {
|
||||
"componentProperty": "yAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_yaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 4
|
||||
},
|
||||
"rootNodeName": "x_button",
|
||||
"visualResponses": {
|
||||
"x_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "x_button_pressed_value",
|
||||
"minNodeName": "x_button_pressed_min",
|
||||
"maxNodeName": "x_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"y-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 5
|
||||
},
|
||||
"rootNodeName": "y_button",
|
||||
"visualResponses": {
|
||||
"y_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "y_button_pressed_value",
|
||||
"minNodeName": "y_button_pressed_min",
|
||||
"maxNodeName": "y_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"thumbrest": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 6
|
||||
},
|
||||
"rootNodeName": "thumbrest",
|
||||
"visualResponses": {
|
||||
"thumbrest_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "thumbrest_pressed_value",
|
||||
"minNodeName": "thumbrest_pressed_min",
|
||||
"maxNodeName": "thumbrest_pressed_max"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gamepadMapping": "xr-standard",
|
||||
"rootNodeName": "oculus-touch-v3-left",
|
||||
"assetPath": "left.glb"
|
||||
},
|
||||
"right": {
|
||||
"selectComponentId": "xr-standard-trigger",
|
||||
"components": {
|
||||
"xr-standard-trigger": {
|
||||
"type": "trigger",
|
||||
"gamepadIndices": {
|
||||
"button": 0
|
||||
},
|
||||
"rootNodeName": "xr_standard_trigger",
|
||||
"visualResponses": {
|
||||
"xr_standard_trigger_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_trigger_pressed_value",
|
||||
"minNodeName": "xr_standard_trigger_pressed_min",
|
||||
"maxNodeName": "xr_standard_trigger_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-squeeze": {
|
||||
"type": "squeeze",
|
||||
"gamepadIndices": {
|
||||
"button": 1
|
||||
},
|
||||
"rootNodeName": "xr_standard_squeeze",
|
||||
"visualResponses": {
|
||||
"xr_standard_squeeze_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-thumbstick": {
|
||||
"type": "thumbstick",
|
||||
"gamepadIndices": {
|
||||
"button": 3,
|
||||
"xAxis": 2,
|
||||
"yAxis": 3
|
||||
},
|
||||
"rootNodeName": "xr_standard_thumbstick",
|
||||
"visualResponses": {
|
||||
"xr_standard_thumbstick_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_xaxis_pressed": {
|
||||
"componentProperty": "xAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_xaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_yaxis_pressed": {
|
||||
"componentProperty": "yAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_yaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"a-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 4
|
||||
},
|
||||
"rootNodeName": "a_button",
|
||||
"visualResponses": {
|
||||
"a_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "a_button_pressed_value",
|
||||
"minNodeName": "a_button_pressed_min",
|
||||
"maxNodeName": "a_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"b-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 5
|
||||
},
|
||||
"rootNodeName": "b_button",
|
||||
"visualResponses": {
|
||||
"b_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "b_button_pressed_value",
|
||||
"minNodeName": "b_button_pressed_min",
|
||||
"maxNodeName": "b_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"thumbrest": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 6
|
||||
},
|
||||
"rootNodeName": "thumbrest",
|
||||
"visualResponses": {
|
||||
"thumbrest_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "thumbrest_pressed_value",
|
||||
"minNodeName": "thumbrest_pressed_min",
|
||||
"maxNodeName": "thumbrest_pressed_max"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gamepadMapping": "xr-standard",
|
||||
"rootNodeName": "oculus-touch-v3-right",
|
||||
"assetPath": "right.glb"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,286 +0,0 @@
|
||||
{
|
||||
"profileId": "pico-4",
|
||||
"fallbackProfileIds": [
|
||||
"generic-trigger-squeeze-thumbstick"
|
||||
],
|
||||
"layouts": {
|
||||
"left": {
|
||||
"selectComponentId": "xr-standard-trigger",
|
||||
"components": {
|
||||
"xr-standard-trigger": {
|
||||
"type": "trigger",
|
||||
"gamepadIndices": {
|
||||
"button": 0
|
||||
},
|
||||
"rootNodeName": "xr_standard_trigger",
|
||||
"visualResponses": {
|
||||
"xr_standard_trigger_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_trigger_pressed_value",
|
||||
"minNodeName": "xr_standard_trigger_pressed_min",
|
||||
"maxNodeName": "xr_standard_trigger_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-squeeze": {
|
||||
"type": "squeeze",
|
||||
"gamepadIndices": {
|
||||
"button": 1
|
||||
},
|
||||
"rootNodeName": "xr_standard_squeeze",
|
||||
"visualResponses": {
|
||||
"xr_standard_squeeze_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-thumbstick": {
|
||||
"type": "thumbstick",
|
||||
"gamepadIndices": {
|
||||
"button": 3,
|
||||
"xAxis": 2,
|
||||
"yAxis": 3
|
||||
},
|
||||
"rootNodeName": "xr_standard_thumbstick",
|
||||
"visualResponses": {
|
||||
"xr_standard_thumbstick_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_xaxis_pressed": {
|
||||
"componentProperty": "xAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_xaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_yaxis_pressed": {
|
||||
"componentProperty": "yAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_yaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 4
|
||||
},
|
||||
"rootNodeName": "x_button",
|
||||
"visualResponses": {
|
||||
"x_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "x_button_pressed_value",
|
||||
"minNodeName": "x_button_pressed_min",
|
||||
"maxNodeName": "x_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"y-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 5
|
||||
},
|
||||
"rootNodeName": "y_button",
|
||||
"visualResponses": {
|
||||
"y_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "y_button_pressed_value",
|
||||
"minNodeName": "y_button_pressed_min",
|
||||
"maxNodeName": "y_button_pressed_max"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gamepadMapping": "xr-standard",
|
||||
"rootNodeName": "pico-4-left",
|
||||
"assetPath": "left.glb"
|
||||
},
|
||||
"right": {
|
||||
"selectComponentId": "xr-standard-trigger",
|
||||
"components": {
|
||||
"xr-standard-trigger": {
|
||||
"type": "trigger",
|
||||
"gamepadIndices": {
|
||||
"button": 0
|
||||
},
|
||||
"rootNodeName": "xr_standard_trigger",
|
||||
"visualResponses": {
|
||||
"xr_standard_trigger_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_trigger_pressed_value",
|
||||
"minNodeName": "xr_standard_trigger_pressed_min",
|
||||
"maxNodeName": "xr_standard_trigger_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-squeeze": {
|
||||
"type": "squeeze",
|
||||
"gamepadIndices": {
|
||||
"button": 1
|
||||
},
|
||||
"rootNodeName": "xr_standard_squeeze",
|
||||
"visualResponses": {
|
||||
"xr_standard_squeeze_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-thumbstick": {
|
||||
"type": "thumbstick",
|
||||
"gamepadIndices": {
|
||||
"button": 3,
|
||||
"xAxis": 2,
|
||||
"yAxis": 3
|
||||
},
|
||||
"rootNodeName": "xr_standard_thumbstick",
|
||||
"visualResponses": {
|
||||
"xr_standard_thumbstick_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_xaxis_pressed": {
|
||||
"componentProperty": "xAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_xaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_yaxis_pressed": {
|
||||
"componentProperty": "yAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_yaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"a-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 4
|
||||
},
|
||||
"rootNodeName": "a_button",
|
||||
"visualResponses": {
|
||||
"a_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "a_button_pressed_value",
|
||||
"minNodeName": "a_button_pressed_min",
|
||||
"maxNodeName": "a_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"b-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 5
|
||||
},
|
||||
"rootNodeName": "b_button",
|
||||
"visualResponses": {
|
||||
"b_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "b_button_pressed_value",
|
||||
"minNodeName": "b_button_pressed_min",
|
||||
"maxNodeName": "b_button_pressed_max"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gamepadMapping": "xr-standard",
|
||||
"rootNodeName": "pico-4-right",
|
||||
"assetPath": "right.glb"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,286 +0,0 @@
|
||||
{
|
||||
"profileId": "pico-neo3",
|
||||
"fallbackProfileIds": [
|
||||
"generic-trigger-squeeze-thumbstick"
|
||||
],
|
||||
"layouts": {
|
||||
"left": {
|
||||
"selectComponentId": "xr-standard-trigger",
|
||||
"components": {
|
||||
"xr-standard-trigger": {
|
||||
"type": "trigger",
|
||||
"gamepadIndices": {
|
||||
"button": 0
|
||||
},
|
||||
"rootNodeName": "xr_standard_trigger",
|
||||
"visualResponses": {
|
||||
"xr_standard_trigger_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_trigger_pressed_value",
|
||||
"minNodeName": "xr_standard_trigger_pressed_min",
|
||||
"maxNodeName": "xr_standard_trigger_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-squeeze": {
|
||||
"type": "squeeze",
|
||||
"gamepadIndices": {
|
||||
"button": 1
|
||||
},
|
||||
"rootNodeName": "xr_standard_squeeze",
|
||||
"visualResponses": {
|
||||
"xr_standard_squeeze_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-thumbstick": {
|
||||
"type": "thumbstick",
|
||||
"gamepadIndices": {
|
||||
"button": 3,
|
||||
"xAxis": 2,
|
||||
"yAxis": 3
|
||||
},
|
||||
"rootNodeName": "xr_standard_thumbstick",
|
||||
"visualResponses": {
|
||||
"xr_standard_thumbstick_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_xaxis_pressed": {
|
||||
"componentProperty": "xAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_xaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_yaxis_pressed": {
|
||||
"componentProperty": "yAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_yaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 4
|
||||
},
|
||||
"rootNodeName": "x_button",
|
||||
"visualResponses": {
|
||||
"x_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "x_button_pressed_value",
|
||||
"minNodeName": "x_button_pressed_min",
|
||||
"maxNodeName": "x_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"y-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 5
|
||||
},
|
||||
"rootNodeName": "y_button",
|
||||
"visualResponses": {
|
||||
"y_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "y_button_pressed_value",
|
||||
"minNodeName": "y_button_pressed_min",
|
||||
"maxNodeName": "y_button_pressed_max"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gamepadMapping": "xr-standard",
|
||||
"rootNodeName": "pico-neo3-left",
|
||||
"assetPath": "left.glb"
|
||||
},
|
||||
"right": {
|
||||
"selectComponentId": "xr-standard-trigger",
|
||||
"components": {
|
||||
"xr-standard-trigger": {
|
||||
"type": "trigger",
|
||||
"gamepadIndices": {
|
||||
"button": 0
|
||||
},
|
||||
"rootNodeName": "xr_standard_trigger",
|
||||
"visualResponses": {
|
||||
"xr_standard_trigger_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_trigger_pressed_value",
|
||||
"minNodeName": "xr_standard_trigger_pressed_min",
|
||||
"maxNodeName": "xr_standard_trigger_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-squeeze": {
|
||||
"type": "squeeze",
|
||||
"gamepadIndices": {
|
||||
"button": 1
|
||||
},
|
||||
"rootNodeName": "xr_standard_squeeze",
|
||||
"visualResponses": {
|
||||
"xr_standard_squeeze_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_squeeze_pressed_value",
|
||||
"minNodeName": "xr_standard_squeeze_pressed_min",
|
||||
"maxNodeName": "xr_standard_squeeze_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xr-standard-thumbstick": {
|
||||
"type": "thumbstick",
|
||||
"gamepadIndices": {
|
||||
"button": 3,
|
||||
"xAxis": 2,
|
||||
"yAxis": 3
|
||||
},
|
||||
"rootNodeName": "xr_standard_thumbstick",
|
||||
"visualResponses": {
|
||||
"xr_standard_thumbstick_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_xaxis_pressed": {
|
||||
"componentProperty": "xAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_xaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max"
|
||||
},
|
||||
"xr_standard_thumbstick_yaxis_pressed": {
|
||||
"componentProperty": "yAxis",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value",
|
||||
"minNodeName": "xr_standard_thumbstick_yaxis_pressed_min",
|
||||
"maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"a-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 4
|
||||
},
|
||||
"rootNodeName": "a_button",
|
||||
"visualResponses": {
|
||||
"a_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "a_button_pressed_value",
|
||||
"minNodeName": "a_button_pressed_min",
|
||||
"maxNodeName": "a_button_pressed_max"
|
||||
}
|
||||
}
|
||||
},
|
||||
"b-button": {
|
||||
"type": "button",
|
||||
"gamepadIndices": {
|
||||
"button": 5
|
||||
},
|
||||
"rootNodeName": "b_button",
|
||||
"visualResponses": {
|
||||
"b_button_pressed": {
|
||||
"componentProperty": "button",
|
||||
"states": [
|
||||
"default",
|
||||
"touched",
|
||||
"pressed"
|
||||
],
|
||||
"valueNodeProperty": "transform",
|
||||
"valueNodeName": "b_button_pressed_value",
|
||||
"minNodeName": "b_button_pressed_min",
|
||||
"maxNodeName": "b_button_pressed_max"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gamepadMapping": "xr-standard",
|
||||
"rootNodeName": "pico-neo3-right",
|
||||
"assetPath": "right.glb"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 930 B After Width: | Height: | Size: 856 B |
Binary file not shown.
|
After Width: | Height: | Size: 292 B |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+52
-60
@@ -4,7 +4,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.12.1'
|
||||
classpath 'com.android.tools.build:gradle:8.13.0'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,11 +92,11 @@ tasks.register("generatePngs", GeneratePngsTask) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def use_asan = project.hasProperty('wivrn_address_sanitizer') && wivrn_address_sanitizer == 'ON'
|
||||
|
||||
android {
|
||||
namespace = "org.meumeu.wivrn"
|
||||
ndkVersion = "28.1.13356709"
|
||||
ndkVersion = "29.0.14206865"
|
||||
|
||||
lint {
|
||||
disable += "ExpiredTargetSdkVersion"
|
||||
@@ -107,7 +107,7 @@ android {
|
||||
// for Vulkan, need at least 24
|
||||
// for AImage_getHardwareBuffer, API 26
|
||||
minSdkVersion 29
|
||||
compileSdkVersion 32
|
||||
compileSdkVersion 34
|
||||
targetSdkVersion 32 // for Oculus Store
|
||||
|
||||
versionName = project.hasProperty('wivrn_version') ? wivrn_version : "1.0"
|
||||
@@ -115,18 +115,25 @@ android {
|
||||
def showImguiDemo = project.hasProperty('wivrn_show_imgui_demo') ? wivrn_show_imgui_demo : 'OFF'
|
||||
def showDebugMenu = project.hasProperty('wivrn_show_debug_menu') ? wivrn_show_debug_menu : 'OFF'
|
||||
def compressGlb = project.hasProperty('wivrn_compress_glb') ? wivrn_compress_glb : 'OFF'
|
||||
def fetchcontentBaseDir = project.hasProperty('fetchcontent_base_dir') ? ['-DFETCHCONTENT_BASE_DIR=' + fetchcontent_base_dir] : []
|
||||
|
||||
def asan = use_asan ? 'ON': 'OFF'
|
||||
def stl = use_asan ? 'c++_shared' : "c++_static"
|
||||
|
||||
externalNativeBuild {
|
||||
def css = project.hasProperty('wivrn_css') ? project.wivrn_css: "images/wivrn-local.css"
|
||||
|
||||
cmake {
|
||||
arguments '-DANDROID_TOOLCHAIN=clang',
|
||||
'-DANDROID_STL=c++_static',
|
||||
arguments = ['-DANDROID_TOOLCHAIN=clang',
|
||||
'-DANDROID_STL=' + stl,
|
||||
'-DCMAKE_ANDROID_NDK_VERSION=' + ndkVersion,
|
||||
'-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON',
|
||||
'-DCMAKE_EXPORT_COMPILE_COMMANDS=ON',
|
||||
'-DCMAKE_ANDROID_ASSETS_DIRECTORIES=' + layout.buildDirectory.dir("assets").get().asFile,
|
||||
'-DRESOURCES_DIRECTORIES=' + layout.buildDirectory.dir("resources").get().asFile,
|
||||
'-DWIVRN_USE_SYSTEM_BOOST=OFF',
|
||||
'-DWIVRN_USE_SYSTEM_FREETYPE=OFF',
|
||||
'-DWIVRN_USE_ANDROID_BIN_LIBKTX=ON',
|
||||
'-DWIVRN_BUILD_CLIENT=ON',
|
||||
'-DWIVRN_BUILD_SERVER=OFF',
|
||||
'-DWIVRN_BUILD_SERVER_LIBRARY=OFF',
|
||||
@@ -136,8 +143,18 @@ android {
|
||||
'-DWIVRN_SHOW_IMGUI_DEMO_WINDOW=' + showImguiDemo,
|
||||
'-DWIVRN_CLIENT_DEBUG_MENU=' + showDebugMenu,
|
||||
'-DWIVRN_CSS=' + css,
|
||||
'-DWIVRN_COMPRESS_GLB=' + compressGlb
|
||||
'-DWIVRN_COMPRESS_GLB=' + compressGlb,
|
||||
'-DWIVRN_ADDRESS_SANITIZER=' + asan,
|
||||
] +
|
||||
fetchcontentBaseDir
|
||||
resValue "string", "app_name", project.hasProperty('wivrn_app_name') ? project.wivrn_app_name : "WiVRn Local"
|
||||
abiFilters 'arm64-v8a'//, 'x86_64'
|
||||
}
|
||||
|
||||
}
|
||||
packaging {
|
||||
jniLibs {
|
||||
useLegacyPackaging = use_asan
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -195,63 +212,12 @@ android {
|
||||
initWith debug
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments '-DUSE_ANDROID_VALIDATION_LAYER=ON'
|
||||
arguments '-DWIVRN_USE_ANDROID_VALIDATION_LAYER=ON'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flavorDimensions "device"
|
||||
|
||||
productFlavors {
|
||||
standard {
|
||||
dimension "device"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
abiFilters 'arm64-v8a'//, 'x86_64'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['client/java']
|
||||
res.srcDirs = [ 'resources', layout.buildDirectory.dir('generated_resources') ]
|
||||
|
||||
assets.srcDirs 'assets'
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version = '3.30.3'
|
||||
path 'CMakeLists.txt'
|
||||
}
|
||||
}
|
||||
|
||||
tasks["preBuild"].dependsOn "generatePngs"
|
||||
|
||||
applicationVariants.all { variant ->
|
||||
// It probably works with merge${variant.name.capitalize()}Assets too
|
||||
tasks["generate${variant.name.capitalize()}Assets"].dependsOn "externalNativeBuild${variant.name.capitalize()}"
|
||||
}
|
||||
|
||||
productFlavors.all { variant ->
|
||||
sourceSets {
|
||||
"${variant.name}" {
|
||||
assets.srcDirs layout.buildDirectory.dir("assets${variant.name.capitalize()}")
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild{
|
||||
cmake {
|
||||
arguments '-DCMAKE_ANDROID_ASSETS_DIRECTORIES=' + layout.buildDirectory.dir("assets${variant.name.capitalize()}").get().asFile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes.all { variant ->
|
||||
sourceSets {
|
||||
"${variant.name}" {
|
||||
@@ -261,8 +227,34 @@ android {
|
||||
|
||||
externalNativeBuild{
|
||||
cmake {
|
||||
arguments '-DCMAKE_ANDROID_LIB_DIRECTORIES=' + layout.buildDirectory.dir("libs${variant.name.capitalize()}").get().asFile
|
||||
arguments '-DANDROID_LIB_DIRECTORIES=' + layout.buildDirectory.dir("libs${variant.name.capitalize()}").get().asFile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['client/java']
|
||||
res.srcDirs = [ 'resources', layout.buildDirectory.dir('generated_resources') ]
|
||||
resources.srcDirs = [layout.buildDirectory.dir('resources')]
|
||||
|
||||
assets.srcDirs = ['assets', layout.buildDirectory.dir("assets")]
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version = '3.31.5'
|
||||
path 'CMakeLists.txt'
|
||||
}
|
||||
}
|
||||
|
||||
tasks["preBuild"].dependsOn "generatePngs"
|
||||
|
||||
applicationVariants.all { variant ->
|
||||
// It probably works with merge${variant.name.capitalize()}Assets too
|
||||
tasks["generate${variant.name.capitalize()}Assets"].dependsOn "externalNativeBuild${variant.name.capitalize()}"
|
||||
tasks["merge${variant.name.capitalize()}Resources"].dependsOn "externalNativeBuild${variant.name.capitalize()}"
|
||||
}
|
||||
}
|
||||
|
||||
+68
-26
@@ -11,7 +11,23 @@ set(SPIRV_REFLECT_EXECUTABLE OFF)
|
||||
set(SPIRV_REFLECT_STATIC_LIB ON)
|
||||
set(SPIRV_REFLECT_INSTALL OFF)
|
||||
|
||||
FetchContent_MakeAvailable(simdjson spdlog glm fastgltf imgui stb implot uni-algo entt libktx spirv-reflect)
|
||||
FetchContent_MakeAvailable(simdjson spdlog glm fastgltf imgui stb implot uni-algo entt spirv-reflect)
|
||||
if(ANDROID AND WIVRN_USE_ANDROID_BIN_LIBKTX)
|
||||
if(NOT EXISTS ${FETCHCONTENT_BASE_DIR}/KTX-Software-${KTX_VERSION}-Android.zip)
|
||||
file(DOWNLOAD
|
||||
https://github.com/KhronosGroup/KTX-Software/releases/download/${KTX_VERSION_FULL}/KTX-Software-${KTX_VERSION}-Android.zip
|
||||
${FETCHCONTENT_BASE_DIR}/KTX-Software-${KTX_VERSION}-Android.zip
|
||||
EXPECTED_HASH SHA256=9f84a395f37a185e2e21e77cfd3893e67271b616edf5feb39125f09ab4c06b29
|
||||
)
|
||||
endif()
|
||||
file(ARCHIVE_EXTRACT INPUT ${FETCHCONTENT_BASE_DIR}/KTX-Software-${KTX_VERSION}-Android.zip DESTINATION ${FETCHCONTENT_BASE_DIR})
|
||||
add_library(ktx INTERFACE)
|
||||
target_link_libraries(ktx INTERFACE ${FETCHCONTENT_BASE_DIR}/KTX-Software-${KTX_VERSION}-Android/${ANDROID_ABI}/lib/libktx.so)
|
||||
target_include_directories(ktx INTERFACE ${FETCHCONTENT_BASE_DIR}/KTX-Software-${KTX_VERSION}-Android/${ANDROID_ABI}/include)
|
||||
elseif(WIVRN_USE_SYSTEM_LIBKTX AND NOT ANDROID)
|
||||
else()
|
||||
FetchContent_MakeAvailable(libktx)
|
||||
endif()
|
||||
|
||||
include(FreetypeHarfbuzz)
|
||||
include(CompileGLSL)
|
||||
@@ -22,6 +38,7 @@ add_library(stb INTERFACE)
|
||||
target_include_directories(stb INTERFACE ${stb_SOURCE_DIR})
|
||||
|
||||
if(ANDROID)
|
||||
file(REMOVE_RECURSE ${RESOURCES_DIRECTORIES}/lib ${ANDROID_LIB_DIRECTORIES})
|
||||
add_library(wivrn MODULE)
|
||||
|
||||
find_library(ANDROID_LIBRARY NAMES android REQUIRED)
|
||||
@@ -49,12 +66,38 @@ if(ANDROID)
|
||||
target_compile_definitions(wivrn PRIVATE -DXR_USE_PLATFORM_ANDROID -DVK_USE_PLATFORM_ANDROID_KHR)
|
||||
target_link_options(wivrn PRIVATE -Wl,--undefined=ANativeActivity_onCreate)
|
||||
|
||||
target_link_options(wivrn
|
||||
PRIVATE
|
||||
-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/android/exported_symbols.txt
|
||||
# This causes the linker to emit an error when a version script names a
|
||||
# symbol that is not found, rather than silently ignoring that line.
|
||||
-Wl,--no-undefined-version
|
||||
)
|
||||
set_target_properties(wivrn PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/android/exported_symbols.txt)
|
||||
|
||||
file(GLOB PLATFORM_SOURCE CONFIGURE_DEPENDS
|
||||
"android/*.cpp"
|
||||
"audio/android/*.cpp"
|
||||
"decoder/android/*.cpp"
|
||||
)
|
||||
target_sources(wivrn PRIVATE ${PLATFORM_SOURCE})
|
||||
|
||||
if (WIVRN_ADDRESS_SANITIZER)
|
||||
file(MAKE_DIRECTORY
|
||||
${RESOURCES_DIRECTORIES}/lib/${CMAKE_ANDROID_ARCH_ABI}
|
||||
${ANDROID_LIB_DIRECTORIES}/${CMAKE_ANDROID_ARCH_ABI})
|
||||
file(GLOB _asan_location
|
||||
${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/*/lib/linux/libclang_rt.asan-${CMAKE_SYSTEM_PROCESSOR}-android.so
|
||||
)
|
||||
file(COPY
|
||||
${_asan_location}
|
||||
DESTINATION ${ANDROID_LIB_DIRECTORIES}/${CMAKE_ANDROID_ARCH_ABI}
|
||||
)
|
||||
file(COPY_FILE
|
||||
${ANDROID_NDK}/wrap.sh/asan.sh
|
||||
${RESOURCES_DIRECTORIES}/lib/${CMAKE_ANDROID_ARCH_ABI}/wrap.sh
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
add_executable(wivrn)
|
||||
|
||||
@@ -65,7 +108,7 @@ else()
|
||||
target_link_libraries(wivrn openxr_loader)
|
||||
endif()
|
||||
|
||||
target_link_libraries(wivrn PkgConfig::LIBAV Fontconfig::Fontconfig CURL::libcurl)
|
||||
target_link_libraries(wivrn PkgConfig::LIBAV_CLIENT Fontconfig::Fontconfig CURL::libcurl)
|
||||
|
||||
file(GLOB PLATFORM_SOURCE CONFIGURE_DEPENDS
|
||||
"decoder/ffmpeg/*.cpp")
|
||||
@@ -81,8 +124,6 @@ endif()
|
||||
#
|
||||
target_compile_definitions(wivrn PRIVATE "XR_USE_TIMESPEC=1")
|
||||
|
||||
set_target_properties(wivrn PROPERTIES CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
file(GLOB LOCAL_SOURCE CONFIGURE_DEPENDS
|
||||
"*.cpp"
|
||||
"decoder/*.cpp"
|
||||
@@ -119,6 +160,7 @@ target_link_libraries(wivrn
|
||||
target_compile_definitions(wivrn PRIVATE -DXR_USE_GRAPHICS_API_VULKAN)
|
||||
target_compile_definitions(wivrn PRIVATE -DVMA_STATS_STRING_ENABLED=0)
|
||||
target_compile_definitions(wivrn PRIVATE -DGLM_ENABLE_EXPERIMENTAL)
|
||||
target_compile_definitions(wivrn PRIVATE IMGUI_DEFINE_MATH_OPERATORS)
|
||||
|
||||
target_include_directories(wivrn PRIVATE .)
|
||||
|
||||
@@ -150,7 +192,7 @@ target_compile_definitions(wivrn-imgui PUBLIC IMGUI_ENABLE_FREETYPE)
|
||||
# target_compile_definitions(wivrn-imgui PUBLIC IMGUI_DISABLE_OBSOLETE_FUNCTIONS) # incompatible with implot
|
||||
# target_compile_definitions(wivrn-imgui PUBLIC IMGUI_ENABLE_FREETYPE_LUNASVG)
|
||||
target_compile_features(wivrn-imgui PRIVATE cxx_std_23)
|
||||
target_link_libraries(wivrn-imgui FreetypeHarfbuzz)
|
||||
target_link_libraries(wivrn-imgui FreetypeHarfbuzz Vulkan::Vulkan)
|
||||
|
||||
target_link_libraries(wivrn wivrn-imgui)
|
||||
|
||||
@@ -169,28 +211,26 @@ khronos_validation.enables = VK_VALIDATION_FEATURE_ENABLE_THREAD_SAFETY_EXT
|
||||
")
|
||||
endif()
|
||||
|
||||
if(USE_ANDROID_VALIDATION_LAYER)
|
||||
if(WIVRN_USE_ANDROID_VALIDATION_LAYER)
|
||||
set(VVL_VERSION "1.4.321.0")
|
||||
|
||||
if(NOT EXISTS ${CMAKE_BINARY_DIR}/Vulkan-ValidationLayers-${VVL_VERSION}.zip)
|
||||
if(NOT EXISTS ${FETCHCONTENT_BASE_DIR}/Vulkan-ValidationLayers-${VVL_VERSION}.zip)
|
||||
if (EXISTS ${CMAKE_SOURCE_DIR}/Vulkan-ValidationLayers-${VVL_VERSION}.zip)
|
||||
file(CREATE_LINK ${CMAKE_SOURCE_DIR}/Vulkan-ValidationLayers-${VVL_VERSION}.zip ${CMAKE_BINARY_DIR}/Vulkan-ValidationLayers-${VVL_VERSION}.zip SYMBOLIC)
|
||||
file(CREATE_LINK ${CMAKE_SOURCE_DIR}/Vulkan-ValidationLayers-${VVL_VERSION}.zip ${FETCHCONTENT_BASE_DIR}/Vulkan-ValidationLayers-${VVL_VERSION}.zip SYMBOLIC)
|
||||
else()
|
||||
file(DOWNLOAD https://github.com/KhronosGroup/Vulkan-ValidationLayers/releases/download/vulkan-sdk-${VVL_VERSION}/android-binaries-${VVL_VERSION}.zip ${CMAKE_BINARY_DIR}/Vulkan-ValidationLayers-${VVL_VERSION}.zip
|
||||
EXPECTED_HASH SHA256=75f2881ba7af0507c8cec13b4bf6c95556c6333485cdb8be41f608fccf762128)
|
||||
file(DOWNLOAD https://github.com/KhronosGroup/Vulkan-ValidationLayers/releases/download/vulkan-sdk-${VVL_VERSION}/android-binaries-${VVL_VERSION}.zip
|
||||
${FETCHCONTENT_BASE_DIR}/Vulkan-ValidationLayers-${VVL_VERSION}.zip
|
||||
EXPECTED_HASH SHA256=75f2881ba7af0507c8cec13b4bf6c95556c6333485cdb8be41f608fccf762128)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(VVL_ZIPFILE ${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-ValidationLayers-${VVL_VERSION}.zip)
|
||||
|
||||
file(ARCHIVE_EXTRACT INPUT ${CMAKE_BINARY_DIR}/Vulkan-ValidationLayers-${VVL_VERSION}.zip DESTINATION ${CMAKE_BINARY_DIR}/Vulkan-ValidationLayer)
|
||||
file(ARCHIVE_EXTRACT INPUT ${FETCHCONTENT_BASE_DIR}/Vulkan-ValidationLayers-${VVL_VERSION}.zip DESTINATION ${FETCHCONTENT_BASE_DIR}/Vulkan-ValidationLayer)
|
||||
|
||||
file(COPY
|
||||
${CMAKE_BINARY_DIR}/Vulkan-ValidationLayer/android-binaries-${VVL_VERSION}/${CMAKE_ANDROID_ARCH_ABI}
|
||||
DESTINATION ${CMAKE_ANDROID_LIB_DIRECTORIES})
|
||||
else()
|
||||
# silence "Manually-specified variables were not used by the project" warning
|
||||
set(_unused ${CMAKE_ANDROID_LIB_DIRECTORIES})
|
||||
${FETCHCONTENT_BASE_DIR}/Vulkan-ValidationLayer/android-binaries-${VVL_VERSION}/${CMAKE_ANDROID_ARCH_ABI}
|
||||
DESTINATION ${ANDROID_LIB_DIRECTORIES})
|
||||
endif()
|
||||
|
||||
|
||||
@@ -236,12 +276,10 @@ set(IMAGES_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../images)
|
||||
set(ASSETS_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../assets-source)
|
||||
|
||||
wivrn_rasterize_svg(SOURCE ${IMAGES_SRC_DIR}/wivrn.svg DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/wivrn.png WIDTH 540 HEIGHT 540 CSS ${WIVRN_CSS_ABS})
|
||||
wivrn_rasterize_svg(SOURCE ${IMAGES_SRC_DIR}/wivrn-pride.svg DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/wivrn-pride.png WIDTH 540 HEIGHT 540 CSS ${WIVRN_CSS_ABS})
|
||||
wivrn_rasterize_svg(SOURCE ${ASSETS_SRC_DIR}/passthrough.svg DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/passthrough.png WIDTH 256 HEIGHT 256)
|
||||
wivrn_rasterize_svg(SOURCE ${ASSETS_SRC_DIR}/default-environment.svg DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/default-environment.png WIDTH 256 HEIGHT 256)
|
||||
|
||||
wivrn_generate_ktx( SOURCE ${CMAKE_CURRENT_BINARY_DIR}/wivrn.png DESTINATION ${ASSETS_DIR}/wivrn.ktx2 TARGET wivrn)
|
||||
wivrn_generate_ktx( SOURCE ${CMAKE_CURRENT_BINARY_DIR}/wivrn-pride.png DESTINATION ${ASSETS_DIR}/wivrn-pride.ktx2 TARGET wivrn)
|
||||
wivrn_generate_ktx( SOURCE ${ASSETS_SRC_DIR}/default_icon.png DESTINATION ${ASSETS_DIR}/default_icon.ktx2 TARGET wivrn)
|
||||
wivrn_generate_ktx( SOURCE ${CMAKE_CURRENT_BINARY_DIR}/passthrough.png DESTINATION ${ASSETS_DIR}/passthrough.ktx2 TARGET wivrn)
|
||||
wivrn_generate_ktx( SOURCE ${CMAKE_CURRENT_BINARY_DIR}/default-environment.png DESTINATION ${ASSETS_DIR}/default-environment.ktx2 TARGET wivrn)
|
||||
@@ -250,15 +288,19 @@ if(WIVRN_COMPRESS_GLB)
|
||||
else()
|
||||
wivrn_copy_file( SOURCE ${ASSETS_SRC_DIR}/ground.glb DESTINATION ${ASSETS_DIR}/ground.glb TARGET wivrn)
|
||||
endif()
|
||||
wivrn_webxr_controller( SOURCE ${ASSETS_SRC_DIR}/controllers/generic-trigger-squeeze DESTINATION ${ASSETS_DIR}/controllers/generic-trigger-squeeze TARGET wivrn)
|
||||
wivrn_webxr_controller( SOURCE ${ASSETS_SRC_DIR}/controllers/htc-vive-focus-3 DESTINATION ${ASSETS_DIR}/controllers/htc-vive-focus-3 TARGET wivrn)
|
||||
wivrn_webxr_controller( SOURCE ${ASSETS_SRC_DIR}/controllers/meta-quest-touch-plus DESTINATION ${ASSETS_DIR}/controllers/meta-quest-touch-plus TARGET wivrn)
|
||||
wivrn_webxr_controller( SOURCE ${ASSETS_SRC_DIR}/controllers/meta-quest-touch-pro DESTINATION ${ASSETS_DIR}/controllers/meta-quest-touch-pro TARGET wivrn)
|
||||
wivrn_webxr_controller( SOURCE ${ASSETS_SRC_DIR}/controllers/oculus-touch-v2 DESTINATION ${ASSETS_DIR}/controllers/oculus-touch-v2 TARGET wivrn)
|
||||
wivrn_webxr_controller( SOURCE ${ASSETS_SRC_DIR}/controllers/oculus-touch-v3 DESTINATION ${ASSETS_DIR}/controllers/oculus-touch-v3 TARGET wivrn)
|
||||
wivrn_webxr_controller( SOURCE ${ASSETS_SRC_DIR}/controllers/pico-4 DESTINATION ${ASSETS_DIR}/controllers/pico-4 TARGET wivrn)
|
||||
wivrn_webxr_controller( SOURCE ${ASSETS_SRC_DIR}/controllers/pico-neo3 DESTINATION ${ASSETS_DIR}/controllers/pico-neo3 TARGET wivrn)
|
||||
|
||||
wivrn_webxr_download()
|
||||
wivrn_webxr_controller(PROFILE generic-trigger-squeeze DESTINATION ${ASSETS_DIR}/controllers TARGET wivrn)
|
||||
wivrn_webxr_controller(PROFILE htc-vive-focus-3 DESTINATION ${ASSETS_DIR}/controllers TARGET wivrn)
|
||||
wivrn_webxr_controller(PROFILE meta-quest-touch-plus DESTINATION ${ASSETS_DIR}/controllers TARGET wivrn)
|
||||
wivrn_webxr_controller(PROFILE meta-quest-touch-pro DESTINATION ${ASSETS_DIR}/controllers TARGET wivrn)
|
||||
wivrn_webxr_controller(PROFILE oculus-touch-v2 DESTINATION ${ASSETS_DIR}/controllers TARGET wivrn)
|
||||
wivrn_webxr_controller(PROFILE oculus-touch-v3 DESTINATION ${ASSETS_DIR}/controllers TARGET wivrn)
|
||||
wivrn_webxr_controller(PROFILE pico-4 DESTINATION ${ASSETS_DIR}/controllers TARGET wivrn)
|
||||
wivrn_webxr_controller(PROFILE pico-4u DESTINATION ${ASSETS_DIR}/controllers TARGET wivrn)
|
||||
wivrn_webxr_controller(PROFILE pico-neo3 DESTINATION ${ASSETS_DIR}/controllers TARGET wivrn)
|
||||
wivrn_webxr_controller(PROFILE samsung-galaxyxr DESTINATION ${ASSETS_DIR}/controllers TARGET wivrn)
|
||||
wivrn_webxr_controller(PROFILE yvr-touch-v2 DESTINATION ${ASSETS_DIR}/controllers TARGET wivrn)
|
||||
|
||||
# Add the VR splash screen (only used on Quest)
|
||||
if(ANDROID)
|
||||
|
||||
@@ -35,7 +35,7 @@ battery_status get_battery_status()
|
||||
return last_status;
|
||||
}
|
||||
|
||||
extern "C" __attribute__((visibility("default"))) void Java_org_meumeu_wivrn_BroadcastReceiver_onReceive(JNIEnv * env, jobject instance, jobject ctxt_obj, jobject intent_obj)
|
||||
extern "C" void Java_org_meumeu_wivrn_BroadcastReceiver_onReceive(JNIEnv * env, jobject instance, jobject ctxt_obj, jobject intent_obj)
|
||||
{
|
||||
jni::jni_thread::setup_thread(env);
|
||||
jni::object<"android/content/Intent"> intent{intent_obj};
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
LIBAPP {
|
||||
global:
|
||||
ANativeActivity_onCreate;
|
||||
android_main;
|
||||
Java_org_meumeu_wivrn*;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
@@ -0,0 +1,434 @@
|
||||
#include "hid.h"
|
||||
|
||||
#include "scene.h"
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#define NUM_KEYCODES 226
|
||||
/// Maps Android KeyCodes to Linux key event codes
|
||||
static const int KEYCODE_TO_VK[NUM_KEYCODES] = {
|
||||
0, // KEYCODE_UNKNOWN
|
||||
0, // KEYCODE_SOFT_LEFT
|
||||
0, // KEYCODE_SOFT_RIGHT
|
||||
0, // KEYCODE_HOME
|
||||
0, // KEYCODE_BACK
|
||||
0, // KEYCODE_CALL
|
||||
0, // KEYCODE_ENDCALL
|
||||
KEY_0, // KEYCODE_0
|
||||
KEY_1, // KEYCODE_1
|
||||
KEY_2, // KEYCODE_2
|
||||
KEY_3, // KEYCODE_3
|
||||
KEY_4, // KEYCODE_4
|
||||
KEY_5, // KEYCODE_5
|
||||
KEY_6, // KEYCODE_6
|
||||
KEY_7, // KEYCODE_7
|
||||
KEY_8, // KEYCODE_8
|
||||
KEY_9, // KEYCODE_9
|
||||
0, // KEYCODE_STAR
|
||||
0, // KEYCODE_POUND
|
||||
KEY_UP, // KEYCODE_DPAD_UP
|
||||
KEY_DOWN, // KEYCODE_DPAD_DOWN
|
||||
KEY_LEFT, // KEYCODE_DPAD_LEFT
|
||||
KEY_RIGHT, // KEYCODE_DPAD_RIGHT
|
||||
0, // KEYCODE_DPAD_CENTER
|
||||
|
||||
// there's no way to discern between BT keyboard & device buttons using NDK,
|
||||
// so having these mapped consumes all events from the HMD volume rocker.
|
||||
// alternatively, move the handling to stream.cpp
|
||||
0, // KEYCODE_VOLUME_UP // KEY_VOLUMEUP
|
||||
0, // KEYCODE_VOLUME_DOWN // KEY_VOLUMEDOWN
|
||||
|
||||
0, // KEYCODE_POWER - device power button, do not consume
|
||||
0, // KEYCODE_CAMERA
|
||||
0, // KEYCODE_CLEAR
|
||||
KEY_A, // KEYCODE_A
|
||||
KEY_B, // KEYCODE_B
|
||||
KEY_C, // KEYCODE_C
|
||||
KEY_D, // KEYCODE_D
|
||||
KEY_E, // KEYCODE_E
|
||||
KEY_F, // KEYCODE_F
|
||||
KEY_G, // KEYCODE_G
|
||||
KEY_H, // KEYCODE_H
|
||||
KEY_I, // KEYCODE_I
|
||||
KEY_J, // KEYCODE_J
|
||||
KEY_K, // KEYCODE_K
|
||||
KEY_L, // KEYCODE_L
|
||||
KEY_M, // KEYCODE_M
|
||||
KEY_N, // KEYCODE_N
|
||||
KEY_O, // KEYCODE_O
|
||||
KEY_P, // KEYCODE_P
|
||||
KEY_Q, // KEYCODE_Q
|
||||
KEY_R, // KEYCODE_R
|
||||
KEY_S, // KEYCODE_S
|
||||
KEY_T, // KEYCODE_T
|
||||
KEY_U, // KEYCODE_U
|
||||
KEY_V, // KEYCODE_V
|
||||
KEY_W, // KEYCODE_W
|
||||
KEY_X, // KEYCODE_X
|
||||
KEY_Y, // KEYCODE_Y
|
||||
KEY_Z, // KEYCODE_Z
|
||||
KEY_COMMA, // KEYCODE_COMMA
|
||||
KEY_DOT, // KEYCODE_PERIOD
|
||||
KEY_LEFTALT, // KEYCODE_ALT_LEFT
|
||||
KEY_RIGHTALT, // KEYCODE_ALT_RIGHT
|
||||
KEY_LEFTSHIFT, // KEYCODE_SHIFT_LEFT
|
||||
KEY_RIGHTSHIFT, // KEYCODE_SHIFT_RIGHT
|
||||
KEY_TAB, // KEYCODE_TAB
|
||||
KEY_SPACE, // KEYCODE_SPACE
|
||||
0, // KEYCODE_SYM
|
||||
KEY_WWW, // KEYCODE_EXPLORER
|
||||
KEY_MAIL, // KEYCODE_ENVELOPE
|
||||
KEY_ENTER, // KEYCODE_ENTER
|
||||
KEY_BACKSPACE, // KEYCODE_DEL
|
||||
KEY_GRAVE, // KEYCODE_GRAVE
|
||||
KEY_MINUS, // KEYCODE_MINUS
|
||||
KEY_EQUAL, // KEYCODE_EQUALS
|
||||
KEY_LEFTBRACE, // KEYCODE_LEFT_BRACKET
|
||||
KEY_RIGHTBRACE, // KEYCODE_RIGHT_BRACKET
|
||||
KEY_BACKSLASH, // KEYCODE_BACKSLASH
|
||||
KEY_SEMICOLON, // KEYCODE_SEMICOLON
|
||||
KEY_APOSTROPHE, // KEYCODE_APOSTROPHE
|
||||
KEY_SLASH, // KEYCODE_SLASH
|
||||
0, // KEYCODE_AT
|
||||
0, // KEYCODE_NUM
|
||||
0, // KEYCODE_HEADSETHOOK
|
||||
0, // KEYCODE_FOCUS
|
||||
KEY_EQUAL, // KEYCODE_PLUS
|
||||
KEY_MENU, // KEYCODE_MENU
|
||||
0, // KEYCODE_NOTIFICATION
|
||||
KEY_SEARCH, // KEYCODE_SEARCH
|
||||
KEY_PLAYPAUSE, // KEYCODE_MEDIA_PLAY_PAUSE
|
||||
KEY_STOPCD, // KEYCODE_MEDIA_STOP
|
||||
KEY_NEXTSONG, // KEYCODE_MEDIA_NEXT
|
||||
KEY_PREVIOUSSONG, // KEYCODE_MEDIA_PREVIOUS
|
||||
KEY_REWIND, // KEYCODE_MEDIA_REWIND
|
||||
KEY_FASTFORWARD, // KEYCODE_MEDIA_FAST_FORWARD
|
||||
KEY_MUTE, // KEYCODE_MUTE
|
||||
KEY_PAGEUP, // KEYCODE_PAGE_UP
|
||||
KEY_PAGEDOWN, // KEYCODE_PAGE_DOWN
|
||||
0, // KEYCODE_PICTSYMBOLS
|
||||
0, // KEYCODE_SWITCH_CHARSET
|
||||
0, // KEYCODE_BUTTON_A
|
||||
0, // KEYCODE_BUTTON_B
|
||||
0, // KEYCODE_BUTTON_C
|
||||
0, // KEYCODE_BUTTON_X
|
||||
0, // KEYCODE_BUTTON_Y
|
||||
0, // KEYCODE_BUTTON_Z
|
||||
0, // KEYCODE_BUTTON_L1
|
||||
0, // KEYCODE_BUTTON_R1
|
||||
0, // KEYCODE_BUTTON_L2
|
||||
0, // KEYCODE_BUTTON_R2
|
||||
0, // KEYCODE_BUTTON_THUMBL
|
||||
0, // KEYCODE_BUTTON_THUMBR
|
||||
0, // KEYCODE_BUTTON_START
|
||||
0, // KEYCODE_BUTTON_SELECT
|
||||
0, // KEYCODE_BUTTON_MODE
|
||||
KEY_ESC, // KEYCODE_ESCAPE
|
||||
KEY_DELETE, // KEYCODE_FORWARD_DEL
|
||||
KEY_LEFTCTRL, // KEYCODE_CTRL_LEFT
|
||||
KEY_RIGHTCTRL, // KEYCODE_CTRL_RIGHT
|
||||
KEY_CAPSLOCK, // KEYCODE_CAPS_LOCK
|
||||
KEY_SCROLLLOCK, // KEYCODE_SCROLL_LOCK
|
||||
KEY_LEFTMETA, // KEYCODE_META_LEFT
|
||||
KEY_RIGHTMETA, // KEYCODE_META_RIGHT
|
||||
0, // KEYCODE_FUNCTION
|
||||
KEY_SYSRQ, // KEYCODE_SYSRQ
|
||||
KEY_PAUSE, // KEYCODE_BREAK
|
||||
KEY_HOME, // KEYCODE_MOVE_HOME
|
||||
KEY_END, // KEYCODE_MOVE_END
|
||||
KEY_INSERT, // KEYCODE_INSERT
|
||||
KEY_FORWARD, // KEYCODE_FORWARD
|
||||
KEY_PLAYCD, // KEYCODE_MEDIA_PLAY
|
||||
KEY_PAUSECD, // KEYCODE_MEDIA_PAUSE
|
||||
KEY_CLOSECD, // KEYCODE_MEDIA_CLOSE
|
||||
KEY_EJECTCD, // KEYCODE_MEDIA_EJECT
|
||||
KEY_RECORD, // KEYCODE_MEDIA_RECORD
|
||||
KEY_F1, // KEYCODE_F1
|
||||
KEY_F2, // KEYCODE_F2
|
||||
KEY_F3, // KEYCODE_F3
|
||||
KEY_F4, // KEYCODE_F4
|
||||
KEY_F5, // KEYCODE_F5
|
||||
KEY_F6, // KEYCODE_F6
|
||||
KEY_F7, // KEYCODE_F7
|
||||
KEY_F8, // KEYCODE_F8
|
||||
KEY_F9, // KEYCODE_F9
|
||||
KEY_F10, // KEYCODE_F10
|
||||
KEY_F11, // KEYCODE_F11
|
||||
KEY_F12, // KEYCODE_F12
|
||||
KEY_NUMLOCK, // KEYCODE_NUM_LOCK
|
||||
KEY_KP0, // KEYCODE_NUMPAD_0
|
||||
KEY_KP1, // KEYCODE_NUMPAD_1
|
||||
KEY_KP2, // KEYCODE_NUMPAD_2
|
||||
KEY_KP3, // KEYCODE_NUMPAD_3
|
||||
KEY_KP4, // KEYCODE_NUMPAD_4
|
||||
KEY_KP5, // KEYCODE_NUMPAD_5
|
||||
KEY_KP6, // KEYCODE_NUMPAD_6
|
||||
KEY_KP7, // KEYCODE_NUMPAD_7
|
||||
KEY_KP8, // KEYCODE_NUMPAD_8
|
||||
KEY_KP9, // KEYCODE_NUMPAD_9
|
||||
KEY_KPSLASH, // KEYCODE_NUMPAD_DIVIDE
|
||||
KEY_KPASTERISK, // KEYCODE_NUMPAD_MULTIPLY
|
||||
KEY_KPMINUS, // KEYCODE_NUMPAD_SUBTRACT
|
||||
KEY_KPPLUS, // KEYCODE_NUMPAD_ADD
|
||||
KEY_KPDOT, // KEYCODE_NUMPAD_DOT
|
||||
KEY_KPCOMMA, // KEYCODE_NUMPAD_COMMA
|
||||
KEY_KPENTER, // KEYCODE_NUMPAD_ENTER
|
||||
KEY_KPEQUAL, // KEYCODE_NUMPAD_EQUALS
|
||||
KEY_KPLEFTPAREN, // KEYCODE_NUMPAD_LEFT_PAREN
|
||||
KEY_KPRIGHTPAREN, // KEYCODE_NUMPAD_RIGHT_PAREN
|
||||
KEY_MUTE, // KEYCODE_VOLUME_MUTE
|
||||
0, // KEYCODE_INFO
|
||||
0, // KEYCODE_CHANNEL_UP
|
||||
0, // KEYCODE_CHANNEL_DOWN
|
||||
0, // KEYCODE_ZOOM_IN
|
||||
0, // KEYCODE_ZOOM_OUT
|
||||
0, // KEYCODE_TV
|
||||
0, // KEYCODE_WINDOW
|
||||
0, // KEYCODE_GUIDE
|
||||
0, // KEYCODE_DVR
|
||||
KEY_BOOKMARKS, // KEYCODE_BOOKMARK
|
||||
0, // KEYCODE_CAPTIONS
|
||||
0, // KEYCODE_SETTINGS
|
||||
0, // KEYCODE_TV_POWER
|
||||
0, // KEYCODE_TV_INPUT
|
||||
0, // KEYCODE_STB_POWER
|
||||
0, // KEYCODE_STB_INPUT
|
||||
0, // KEYCODE_AVR_POWER
|
||||
0, // KEYCODE_AVR_INPUT
|
||||
0, // KEYCODE_PROG_RED
|
||||
0, // KEYCODE_PROG_GREEN
|
||||
0, // KEYCODE_PROG_YELLOW
|
||||
0, // KEYCODE_PROG_BLUE
|
||||
0, // KEYCODE_APP_SWITCH
|
||||
0, // KEYCODE_BUTTON_1
|
||||
0, // KEYCODE_BUTTON_2
|
||||
0, // KEYCODE_BUTTON_3
|
||||
0, // KEYCODE_BUTTON_4
|
||||
0, // KEYCODE_BUTTON_5
|
||||
0, // KEYCODE_BUTTON_6
|
||||
0, // KEYCODE_BUTTON_7
|
||||
0, // KEYCODE_BUTTON_8
|
||||
0, // KEYCODE_BUTTON_9
|
||||
0, // KEYCODE_BUTTON_10
|
||||
0, // KEYCODE_BUTTON_11
|
||||
0, // KEYCODE_BUTTON_12
|
||||
0, // KEYCODE_BUTTON_13
|
||||
0, // KEYCODE_BUTTON_14
|
||||
0, // KEYCODE_BUTTON_15
|
||||
0, // KEYCODE_BUTTON_16
|
||||
KEY_LANGUAGE, // KEYCODE_LANGUAGE_SWITCH
|
||||
0, // KEYCODE_MANNER_MODE
|
||||
0, // KEYCODE_3D_MODE
|
||||
0, // KEYCODE_CONTACTS
|
||||
KEY_CALENDAR, // KEYCODE_CALENDAR
|
||||
0, // KEYCODE_MUSIC
|
||||
KEY_CALC, // KEYCODE_CALCULATOR
|
||||
KEY_ZENKAKUHANKAKU, // KEYCODE_ZENKAKU_HANKAKU
|
||||
0, // KEYCODE_EISU
|
||||
KEY_MUHENKAN, // KEYCODE_MUHENKAN
|
||||
KEY_HENKAN, // KEYCODE_HENKAN
|
||||
KEY_KATAKANAHIRAGANA, // KEYCODE_KATAKANA_HIRAGANA
|
||||
KEY_YEN, // KEYCODE_YEN
|
||||
KEY_RO, // KEYCODE_RO
|
||||
KEY_KATAKANAHIRAGANA, // KEYCODE_KANA
|
||||
KEY_ASSISTANT, // KEYCODE_ASSIST
|
||||
KEY_BRIGHTNESSDOWN, // KEYCODE_BRIGHTNESS_DOWN
|
||||
KEY_BRIGHTNESSUP, // KEYCODE_BRIGHTNESS_UP
|
||||
0, // KEYCODE_MEDIA_AUDIO_TRACK
|
||||
KEY_SLEEP, // KEYCODE_SLEEP
|
||||
KEY_WAKEUP, // KEYCODE_WAKEUP
|
||||
};
|
||||
|
||||
uint8_t key_code_to_vk(int16_t key_code)
|
||||
{
|
||||
if (key_code < 0 || key_code >= NUM_KEYCODES)
|
||||
return 0;
|
||||
return KEYCODE_TO_VK[key_code];
|
||||
}
|
||||
|
||||
bool android_hid::input_handler::handle_input(scene * current_scene, AInputEvent * event)
|
||||
{
|
||||
const int32_t type = AInputEvent_getType(event);
|
||||
const int32_t src = AInputEvent_getSource(event);
|
||||
|
||||
if (type == AINPUT_EVENT_TYPE_KEY)
|
||||
{
|
||||
// Gamepad input is read through the OpenXR microsoft/xbox_controller profile, not here.
|
||||
if ((src & AINPUT_SOURCE_GAMEPAD) == AINPUT_SOURCE_GAMEPAD)
|
||||
return false;
|
||||
|
||||
int32_t flags = AKeyEvent_getFlags(event);
|
||||
if ((flags & AKEY_EVENT_FLAG_SOFT_KEYBOARD) != 0)
|
||||
return false; // ignore soft keyboards
|
||||
|
||||
if ((src & AINPUT_SOURCE_KEYBOARD) == 0)
|
||||
return false; // event is not from keyboard
|
||||
|
||||
int32_t keycode = AKeyEvent_getKeyCode(event);
|
||||
int32_t action = AKeyEvent_getAction(event);
|
||||
|
||||
bool pressed;
|
||||
switch (action)
|
||||
{
|
||||
case AKEY_EVENT_ACTION_DOWN:
|
||||
pressed = true;
|
||||
break;
|
||||
case AKEY_EVENT_ACTION_UP:
|
||||
pressed = false;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t vk = key_code_to_vk(keycode);
|
||||
if (vk == 0)
|
||||
return false;
|
||||
|
||||
if (pressed)
|
||||
return current_scene->on_input_key_down(vk);
|
||||
else
|
||||
return current_scene->on_input_key_up(vk);
|
||||
}
|
||||
|
||||
if (type == AINPUT_EVENT_TYPE_MOTION)
|
||||
{
|
||||
// Gamepad axes are read through the OpenXR microsoft/xbox_controller profile, not here.
|
||||
if ((src & AINPUT_SOURCE_JOYSTICK) == AINPUT_SOURCE_JOYSTICK)
|
||||
return false;
|
||||
|
||||
// don't care about absolute mouse due to mapping difficulties
|
||||
if ((src & AINPUT_SOURCE_MOUSE_RELATIVE) == 0)
|
||||
return false;
|
||||
|
||||
int32_t actionMasked = AMotionEvent_getAction(event) & AMOTION_EVENT_ACTION_MASK;
|
||||
switch (actionMasked)
|
||||
{
|
||||
case AMOTION_EVENT_ACTION_HOVER_MOVE: // mouse move with no buttons pressed
|
||||
case AMOTION_EVENT_ACTION_MOVE: { // mouse move with buttons pressed
|
||||
float x = AMotionEvent_getX(event, 0);
|
||||
float y = AMotionEvent_getY(event, 0);
|
||||
return current_scene->on_input_mouse_move(x, y);
|
||||
}
|
||||
case AMOTION_EVENT_ACTION_BUTTON_PRESS:
|
||||
case AMOTION_EVENT_ACTION_BUTTON_RELEASE: {
|
||||
uint32_t buttons = (uint32_t)AMotionEvent_getButtonState(event);
|
||||
auto button_diff = buttons ^ buttons_before;
|
||||
bool ret_val = false;
|
||||
|
||||
for (uint8_t i = 0; i < 3; ++i)
|
||||
{
|
||||
auto i_shifted = (1u << i);
|
||||
if ((button_diff & i_shifted) != 0)
|
||||
{
|
||||
if ((buttons & i_shifted) != 0)
|
||||
ret_val = current_scene->on_input_button_down(i);
|
||||
else
|
||||
ret_val = current_scene->on_input_button_up(i);
|
||||
}
|
||||
}
|
||||
|
||||
buttons_before = buttons;
|
||||
return ret_val;
|
||||
}
|
||||
case AMOTION_EVENT_ACTION_SCROLL: {
|
||||
float h = AMotionEvent_getAxisValue(event, AMOTION_EVENT_AXIS_HSCROLL, 0);
|
||||
float v = AMotionEvent_getAxisValue(event, AMOTION_EVENT_AXIS_VSCROLL, 0);
|
||||
return current_scene->on_input_scroll(h, v);
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool try_clear_exception(JNIEnv * env, const char * where)
|
||||
{
|
||||
if (env->ExceptionCheck())
|
||||
{
|
||||
spdlog::error("[pointer_capture] Exception at {}", where);
|
||||
env->ExceptionDescribe(); // logs to logcat
|
||||
env->ExceptionClear();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void make_decor_view_call(ANativeActivity * activity, const char * method_name)
|
||||
{
|
||||
if (!activity || !activity->vm || !activity->env || !activity->clazz)
|
||||
{
|
||||
spdlog::error("[pointer_capture] Invalid ANativeActivity* or missing VM/Activity");
|
||||
return;
|
||||
}
|
||||
|
||||
JNIEnv * env = activity->env;
|
||||
jobject act = activity->clazz;
|
||||
jclass clsActivity = env->GetObjectClass(act);
|
||||
jclass clsWindow = 0;
|
||||
jobject window = 0;
|
||||
jclass clsView = 0;
|
||||
jobject decor = 0;
|
||||
|
||||
do
|
||||
{
|
||||
if (try_clear_exception(env, "GetObjectClass(Activity)") || not clsActivity)
|
||||
break; // goto cleanup
|
||||
|
||||
jmethodID midGetWindow = env->GetMethodID(clsActivity, "getWindow", "()Landroid/view/Window;");
|
||||
if (try_clear_exception(env, "Activity.getWindow() method lookup") || not midGetWindow)
|
||||
break; // goto cleanup
|
||||
|
||||
window = env->CallObjectMethod(act, midGetWindow);
|
||||
if (try_clear_exception(env, "Activity.getWindow() call") || not window)
|
||||
break; // goto cleanup
|
||||
|
||||
clsWindow = env->GetObjectClass(window);
|
||||
if (try_clear_exception(env, "GetObjectClass(Window)") || not clsWindow)
|
||||
break; // goto cleanup
|
||||
|
||||
jmethodID midGetDecor = env->GetMethodID(clsWindow, "getDecorView", "()Landroid/view/View;");
|
||||
if (try_clear_exception(env, "Window.getDecorView() method lookup") || not midGetDecor)
|
||||
break; // goto cleanup
|
||||
|
||||
decor = env->CallObjectMethod(window, midGetDecor);
|
||||
if (try_clear_exception(env, "Window.getDecorView() call") || not decor)
|
||||
break; // goto cleanup
|
||||
|
||||
clsView = env->GetObjectClass(decor);
|
||||
if (try_clear_exception(env, "GetObjectClass(DecorView)") || not clsView)
|
||||
break; // goto cleanup
|
||||
|
||||
jmethodID midAction = env->GetMethodID(clsView, method_name, "()V");
|
||||
if (try_clear_exception(env, "View method lookup") || not midAction)
|
||||
break; // goto cleanup
|
||||
|
||||
env->CallVoidMethod(decor, midAction);
|
||||
if (try_clear_exception(env, "View method call"))
|
||||
break; // goto cleanup
|
||||
|
||||
spdlog::info("[pointer_capture] {}() invoked successfully", method_name);
|
||||
} while (false);
|
||||
|
||||
// cleanup
|
||||
if (clsView)
|
||||
env->DeleteLocalRef(clsView);
|
||||
if (decor)
|
||||
env->DeleteLocalRef(decor);
|
||||
if (clsWindow)
|
||||
env->DeleteLocalRef(clsWindow);
|
||||
if (window)
|
||||
env->DeleteLocalRef(window);
|
||||
if (clsActivity)
|
||||
env->DeleteLocalRef(clsActivity);
|
||||
}
|
||||
|
||||
void android_hid::request_pointer_capture(ANativeActivity * activity)
|
||||
{
|
||||
make_decor_view_call(activity, "requestPointerCapture");
|
||||
}
|
||||
|
||||
void android_hid::release_pointer_capture(ANativeActivity * activity)
|
||||
{
|
||||
make_decor_view_call(activity, "releasePointerCapture");
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "scene.h"
|
||||
#include <android_native_app_glue.h>
|
||||
#include <cstdint>
|
||||
#include <linux/input-event-codes.h>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
namespace android_hid
|
||||
{
|
||||
|
||||
void request_pointer_capture(ANativeActivity * activity);
|
||||
void release_pointer_capture(ANativeActivity * activity);
|
||||
|
||||
class input_handler
|
||||
{
|
||||
uint32_t buttons_before = 0;
|
||||
|
||||
public:
|
||||
bool handle_input(scene * current_scene, AInputEvent * event);
|
||||
};
|
||||
|
||||
} // namespace android_hid
|
||||
@@ -59,7 +59,7 @@ jni::object<"android/net/Uri"> intent::get_uri()
|
||||
return obj.call<jni::object<"android/net/Uri">>("getData");
|
||||
}
|
||||
|
||||
extern "C" __attribute__((visibility("default"))) void Java_org_meumeu_wivrn_MainActivity_onActivityResult(JNIEnv * env, jobject instance, int request_code, int result_code, jobject data_obj)
|
||||
extern "C" void Java_org_meumeu_wivrn_MainActivity_onActivityResult(JNIEnv * env, jobject instance, int request_code, int result_code, jobject data_obj)
|
||||
{
|
||||
auto it = callbacks.find(request_code);
|
||||
if (it == callbacks.end())
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2025 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "jnipp.h"
|
||||
|
||||
namespace jni::details
|
||||
{
|
||||
void handle_java_exception()
|
||||
{
|
||||
auto & env = jni_thread::env();
|
||||
if (auto exc = env.ExceptionOccurred())
|
||||
{
|
||||
env.ExceptionClear();
|
||||
|
||||
std::string str = object<"java/lang/Object">{exc}.call<jni::string>("toString");
|
||||
|
||||
throw std::runtime_error("Java exception " + str);
|
||||
}
|
||||
}
|
||||
} // namespace jni::details
|
||||
+51
-4
@@ -25,6 +25,7 @@
|
||||
#include <tuple>
|
||||
|
||||
#include <jni.h>
|
||||
#include <type_traits>
|
||||
|
||||
namespace jni
|
||||
{
|
||||
@@ -88,6 +89,7 @@ struct Void
|
||||
struct Int
|
||||
{
|
||||
constexpr static auto static_field = &_JNIEnv::GetStaticIntField;
|
||||
constexpr static auto obj_field = &_JNIEnv::GetIntField;
|
||||
constexpr static const auto call_method = &_JNIEnv::CallIntMethod;
|
||||
constexpr static const auto call_static_method = &_JNIEnv::CallStaticIntMethod;
|
||||
|
||||
@@ -171,6 +173,9 @@ struct type_map<int>
|
||||
|
||||
template <typename T>
|
||||
using type_map_t = type_map<T>::type;
|
||||
|
||||
void handle_java_exception();
|
||||
|
||||
} // namespace details
|
||||
|
||||
struct klass
|
||||
@@ -215,7 +220,17 @@ struct klass
|
||||
assert(method_id);
|
||||
auto handles = details::handle(std::forward<Args>(args)...);
|
||||
return R(std::apply([&](auto &... t) {
|
||||
return (env.*R1::call_static_method)(*this, method_id, t...);
|
||||
if constexpr (std::is_void_v<R>)
|
||||
{
|
||||
(env.*R1::call_static_method)(*this, method_id, t...);
|
||||
details::handle_java_exception();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto res = (env.*R1::call_static_method)(*this, method_id, t...);
|
||||
details::handle_java_exception();
|
||||
return res;
|
||||
}
|
||||
},
|
||||
handles));
|
||||
}
|
||||
@@ -263,6 +278,7 @@ struct object
|
||||
}
|
||||
std::unique_ptr<std::remove_pointer_t<jobject>, details::deleter> self;
|
||||
|
||||
constexpr static auto obj_field = &_JNIEnv::GetObjectField;
|
||||
constexpr static const auto call_method = &_JNIEnv::CallObjectMethod;
|
||||
constexpr static const auto call_static_method = &_JNIEnv::CallStaticObjectMethod;
|
||||
|
||||
@@ -283,7 +299,17 @@ struct object
|
||||
assert(method_id);
|
||||
auto handles = details::handle(std::forward<Args>(args)...);
|
||||
return R(std::apply([&](auto &... t) {
|
||||
return (env.*R1::call_method)(*this, method_id, t...);
|
||||
if constexpr (std::is_void_v<R>)
|
||||
{
|
||||
(env.*R1::call_method)(*this, method_id, t...);
|
||||
details::handle_java_exception();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto res = (env.*R1::call_method)(*this, method_id, t...);
|
||||
details::handle_java_exception();
|
||||
return res;
|
||||
}
|
||||
},
|
||||
handles));
|
||||
}
|
||||
@@ -296,11 +322,29 @@ struct object
|
||||
assert(method_id);
|
||||
auto handles = details::handle(std::forward<Args>(args)...);
|
||||
return R(std::apply([&](auto &... t) {
|
||||
return (env.*R1::call_method)(*this, method_id, t...);
|
||||
if constexpr (std::is_void_v<R>)
|
||||
{
|
||||
(env.*R1::call_method)(*this, method_id, t...);
|
||||
details::handle_java_exception();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto res = (env.*R1::call_method)(*this, method_id, t...);
|
||||
details::handle_java_exception();
|
||||
return res;
|
||||
}
|
||||
},
|
||||
handles));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T field(const std::string & name)
|
||||
{
|
||||
auto & env = jni_thread::env();
|
||||
jfieldID id = env.GetFieldID(klass(), name.c_str(), T::type().c_str());
|
||||
return T((env.*T::obj_field)(*this, id));
|
||||
}
|
||||
|
||||
jobject handle() const
|
||||
{
|
||||
return *this;
|
||||
@@ -327,7 +371,9 @@ static object<Type> new_object(Args &&... args)
|
||||
assert(method_id);
|
||||
auto handles = details::handle(std::forward<Args>(args)...);
|
||||
return object<Type>(std::apply([&](auto &... t) {
|
||||
return env.NewObject(klass, method_id, t...);
|
||||
auto res = env.NewObject(klass, method_id, t...);
|
||||
details::handle_java_exception();
|
||||
return res;
|
||||
},
|
||||
handles));
|
||||
}
|
||||
@@ -338,6 +384,7 @@ struct string : public string_t
|
||||
{
|
||||
using string_t::type;
|
||||
constexpr static auto static_field = &_JNIEnv::GetStaticObjectField;
|
||||
constexpr static auto obj_field = &_JNIEnv::GetObjectField;
|
||||
|
||||
operator jstring()
|
||||
{
|
||||
|
||||
@@ -93,7 +93,7 @@ void request_permission(const char * permission, std::function<void(bool)> callb
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" __attribute__((visibility("default"))) void Java_org_meumeu_wivrn_MainActivity_onRequestPermissionsResult(
|
||||
extern "C" void Java_org_meumeu_wivrn_MainActivity_onRequestPermissionsResult(
|
||||
JNIEnv * env,
|
||||
jobject instance,
|
||||
int requestCode,
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2026 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "application.h"
|
||||
#include "jni.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
std::atomic_bool link_properties_changed = false;
|
||||
|
||||
extern "C" void Java_org_meumeu_wivrn_NetworkInfoCallback_onAvailable(JNIEnv * env, jobject instance, jobject network)
|
||||
{
|
||||
spdlog::info("NetworkInfoCallback_onAvailable");
|
||||
}
|
||||
extern "C" void Java_org_meumeu_wivrn_NetworkInfoCallback_onBlockedStatusChanged(JNIEnv * env, jobject instance, jobject network, jboolean blocked)
|
||||
{
|
||||
spdlog::info("NetworkInfoCallback_onBlockedStatusChanged");
|
||||
}
|
||||
extern "C" void Java_org_meumeu_wivrn_NetworkInfoCallback_onCapabilitiesChanged(JNIEnv * env, jobject instance, jobject network, jobject caps)
|
||||
{
|
||||
spdlog::info("NetworkInfoCallback_onCapabitilitiesChanged");
|
||||
}
|
||||
extern "C" void Java_org_meumeu_wivrn_NetworkInfoCallback_onLinkPropertiesChanged(JNIEnv * env, jobject instance, jobject network, jobject jprops)
|
||||
{
|
||||
link_properties_changed = true;
|
||||
}
|
||||
extern "C" void Java_org_meumeu_wivrn_NetworkInfoCallback_onLosing(JNIEnv * env, jobject instance, jobject network, jint ms)
|
||||
{
|
||||
spdlog::info("NetworkInfoCallback_onLosing");
|
||||
}
|
||||
extern "C" void Java_org_meumeu_wivrn_NetworkInfoCallback_onLost(JNIEnv * env, jobject instance, jobject network)
|
||||
{
|
||||
spdlog::info("NetworkInfoCallback_onLost");
|
||||
link_properties_changed = true;
|
||||
}
|
||||
extern "C" void Java_org_meumeu_wivrn_NetworkInfoCallback_onUnavailable(JNIEnv * env, jobject instance)
|
||||
{
|
||||
spdlog::info("NetworkInfoCallback_onUnavailable");
|
||||
application::get_config().usb_network = false;
|
||||
}
|
||||
|
||||
bool usb_link_properties_changed()
|
||||
{
|
||||
return link_properties_changed.exchange(false);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2026 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
bool usb_link_properties_changed();
|
||||
+264
-108
@@ -19,11 +19,11 @@
|
||||
|
||||
#include "application.h"
|
||||
|
||||
#include "hardware.h"
|
||||
#include "openxr/openxr.h"
|
||||
#include "scene.h"
|
||||
#include "spdlog/common.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "utils/class_from_member.h"
|
||||
#include "utils/contains.h"
|
||||
#include "utils/files.h"
|
||||
#include "utils/i18n.h"
|
||||
@@ -34,12 +34,12 @@
|
||||
#include "xr/check.h"
|
||||
#include "xr/htc_exts.h"
|
||||
#include "xr/htc_face_tracker.h"
|
||||
#include "xr/meta_body_tracking_fidelity.h"
|
||||
#include "xr/to_string.h"
|
||||
#include <algorithm>
|
||||
#include <boost/locale.hpp>
|
||||
#include <boost/url/parse.hpp>
|
||||
#include <chrono>
|
||||
#include <cstring>
|
||||
#include <ctype.h>
|
||||
#include <exception>
|
||||
#include <magic_enum.hpp>
|
||||
@@ -70,7 +70,7 @@ using namespace std::chrono_literals;
|
||||
struct interaction_profile
|
||||
{
|
||||
std::string profile_name;
|
||||
std::vector<std::string> required_extensions;
|
||||
std::vector<const char *> required_extensions;
|
||||
XrVersion min_version = XR_MAKE_VERSION(1, 0, 0);
|
||||
std::vector<std::string> input_sources;
|
||||
bool available;
|
||||
@@ -477,6 +477,47 @@ static std::vector<interaction_profile> interaction_profiles{
|
||||
"/user/hand/right/input/squeeze/value",
|
||||
},
|
||||
},
|
||||
interaction_profile{
|
||||
.profile_name = "/interaction_profiles/yvr/touch_controller_yvr",
|
||||
.input_sources = {
|
||||
"/user/hand/left/output/haptic",
|
||||
"/user/hand/right/output/haptic",
|
||||
|
||||
"/user/hand/left/input/grip/pose",
|
||||
"/user/hand/left/input/aim/pose",
|
||||
|
||||
"/user/hand/right/input/grip/pose",
|
||||
"/user/hand/right/input/aim/pose",
|
||||
|
||||
"/user/hand/left/input/x/click",
|
||||
"/user/hand/left/input/x/touch",
|
||||
"/user/hand/left/input/y/click",
|
||||
"/user/hand/left/input/y/touch",
|
||||
"/user/hand/left/input/menu/click",
|
||||
"/user/hand/left/input/squeeze/value",
|
||||
"/user/hand/left/input/squeeze/click",
|
||||
"/user/hand/left/input/trigger/value",
|
||||
"/user/hand/left/input/trigger/touch",
|
||||
"/user/hand/left/input/thumbstick",
|
||||
"/user/hand/left/input/thumbstick/click",
|
||||
"/user/hand/left/input/thumbstick/touch",
|
||||
"/user/hand/left/input/thumbrest/touch",
|
||||
|
||||
"/user/hand/right/input/a/click",
|
||||
"/user/hand/right/input/a/touch",
|
||||
"/user/hand/right/input/b/click",
|
||||
"/user/hand/right/input/b/touch",
|
||||
"/user/hand/right/input/system/click",
|
||||
"/user/hand/right/input/squeeze/value",
|
||||
"/user/hand/right/input/squeeze/click",
|
||||
"/user/hand/right/input/trigger/value",
|
||||
"/user/hand/right/input/trigger/touch",
|
||||
"/user/hand/right/input/thumbstick",
|
||||
"/user/hand/right/input/thumbstick/click",
|
||||
"/user/hand/right/input/thumbstick/touch",
|
||||
"/user/hand/right/input/thumbrest/touch",
|
||||
},
|
||||
},
|
||||
interaction_profile{
|
||||
.profile_name = "/interaction_profiles/htc/vive_focus3_controller",
|
||||
.required_extensions = {XR_HTC_VIVE_FOCUS3_CONTROLLER_INTERACTION_EXTENSION_NAME},
|
||||
@@ -562,6 +603,35 @@ static std::vector<interaction_profile> interaction_profiles{
|
||||
"/user/eyes_ext/input/gaze_ext/pose",
|
||||
},
|
||||
},
|
||||
interaction_profile{
|
||||
.profile_name = "/interaction_profiles/microsoft/xbox_controller",
|
||||
.input_sources = {
|
||||
"/user/gamepad/input/menu/click",
|
||||
"/user/gamepad/input/view/click",
|
||||
"/user/gamepad/input/a/click",
|
||||
"/user/gamepad/input/b/click",
|
||||
"/user/gamepad/input/x/click",
|
||||
"/user/gamepad/input/y/click",
|
||||
"/user/gamepad/input/dpad_up/click",
|
||||
"/user/gamepad/input/dpad_down/click",
|
||||
"/user/gamepad/input/dpad_left/click",
|
||||
"/user/gamepad/input/dpad_right/click",
|
||||
"/user/gamepad/input/shoulder_left/click",
|
||||
"/user/gamepad/input/shoulder_right/click",
|
||||
"/user/gamepad/input/thumbstick_left/click",
|
||||
"/user/gamepad/input/thumbstick_right/click",
|
||||
"/user/gamepad/input/trigger_left/value",
|
||||
"/user/gamepad/input/trigger_right/value",
|
||||
"/user/gamepad/input/thumbstick_left/x",
|
||||
"/user/gamepad/input/thumbstick_left/y",
|
||||
"/user/gamepad/input/thumbstick_right/x",
|
||||
"/user/gamepad/input/thumbstick_right/y",
|
||||
"/user/gamepad/output/haptic_left",
|
||||
"/user/gamepad/output/haptic_right",
|
||||
"/user/gamepad/output/haptic_left_trigger",
|
||||
"/user/gamepad/output/haptic_right_trigger",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static const std::pair<std::string_view, XrActionType> action_suffixes[] =
|
||||
@@ -594,11 +664,15 @@ static const std::pair<std::string_view, XrActionType> action_suffixes[] =
|
||||
{"/ready_ext", XR_ACTION_TYPE_BOOLEAN_INPUT},
|
||||
|
||||
// Output paths
|
||||
{"/haptic", XR_ACTION_TYPE_VIBRATION_OUTPUT},
|
||||
{"/haptic_trigger", XR_ACTION_TYPE_VIBRATION_OUTPUT},
|
||||
{"/haptic_trigger_fb",XR_ACTION_TYPE_VIBRATION_OUTPUT},
|
||||
{"/haptic_thumb", XR_ACTION_TYPE_VIBRATION_OUTPUT},
|
||||
{"/haptic_thumb_fb", XR_ACTION_TYPE_VIBRATION_OUTPUT},
|
||||
{"/haptic", XR_ACTION_TYPE_VIBRATION_OUTPUT},
|
||||
{"/haptic_trigger", XR_ACTION_TYPE_VIBRATION_OUTPUT},
|
||||
{"/haptic_trigger_fb", XR_ACTION_TYPE_VIBRATION_OUTPUT},
|
||||
{"/haptic_thumb", XR_ACTION_TYPE_VIBRATION_OUTPUT},
|
||||
{"/haptic_thumb_fb", XR_ACTION_TYPE_VIBRATION_OUTPUT},
|
||||
{"/haptic_left", XR_ACTION_TYPE_VIBRATION_OUTPUT},
|
||||
{"/haptic_right", XR_ACTION_TYPE_VIBRATION_OUTPUT},
|
||||
{"/haptic_left_trigger", XR_ACTION_TYPE_VIBRATION_OUTPUT},
|
||||
{"/haptic_right_trigger",XR_ACTION_TYPE_VIBRATION_OUTPUT},
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
@@ -721,11 +795,13 @@ void application::initialize_vulkan()
|
||||
}
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
#ifdef __ANDROID__
|
||||
if (validation_layer_found)
|
||||
{
|
||||
spdlog::info("Using Vulkan validation layer");
|
||||
layers.push_back("VK_LAYER_KHRONOS_validation");
|
||||
}
|
||||
#endif
|
||||
bool debug_report_found = false;
|
||||
bool debug_utils_found = false;
|
||||
#endif
|
||||
@@ -746,21 +822,18 @@ void application::initialize_vulkan()
|
||||
instance_extensions.push_back(VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
|
||||
}
|
||||
|
||||
if (!strcmp(i.extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME) and
|
||||
guess_model() != model::oculus_quest) // Quest 1 lies, the extension won't load
|
||||
if (!strcmp(i.extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME) and get_hmd_traits().vk_debug_ext_allowed)
|
||||
{
|
||||
debug_utils_found = true;
|
||||
instance_extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
std::ranges::sort(extensions);
|
||||
for (const auto & [extension_name, spec_version]: extensions)
|
||||
spdlog::info(" {} (version {})", extension_name, spec_version);
|
||||
|
||||
vk_device_extensions.push_back(VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME);
|
||||
vk_device_extensions.push_back(VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME);
|
||||
vk_device_extensions.push_back(VK_KHR_MULTIVIEW_EXTENSION_NAME);
|
||||
optional_device_extensions.emplace(VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME);
|
||||
optional_device_extensions.emplace(VK_IMG_FILTER_CUBIC_EXTENSION_NAME);
|
||||
optional_device_extensions.emplace(VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME);
|
||||
optional_device_extensions.emplace(VK_EXT_FRAGMENT_DENSITY_MAP_EXTENSION_NAME);
|
||||
@@ -777,6 +850,19 @@ void application::initialize_vulkan()
|
||||
instance_extensions.push_back(VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME);
|
||||
#endif
|
||||
|
||||
std::ranges::sort(extensions);
|
||||
for (const auto & [extension_name, spec_version]: extensions)
|
||||
{
|
||||
if (runtime_hmd_traits.blacklisted_extensions.contains(extension_name))
|
||||
{
|
||||
spdlog::info(" {} (version {}) (blacklisted)", extension_name, spec_version);
|
||||
if (std::ranges::find(instance_extensions, extension_name) != instance_extensions.end())
|
||||
throw std::runtime_error("Required Vulkan instance extension is blacklisted");
|
||||
}
|
||||
else
|
||||
spdlog::info(" {} (version {})", extension_name, spec_version);
|
||||
}
|
||||
|
||||
vk::ApplicationInfo application_info{
|
||||
.pApplicationName = app_info.name.c_str(),
|
||||
.applicationVersion = (uint32_t)app_info.version,
|
||||
@@ -836,9 +922,19 @@ void application::initialize_vulkan()
|
||||
spdlog::info("Available Vulkan device extensions:");
|
||||
for (const auto & [extension_name, spec_version]: extensions)
|
||||
{
|
||||
spdlog::info(" {} (version {})", extension_name, spec_version);
|
||||
if (auto it = optional_device_extensions.find(extension_name); it != optional_device_extensions.end())
|
||||
vk_device_extensions.push_back(it->data());
|
||||
if (runtime_hmd_traits.blacklisted_extensions.contains(extension_name))
|
||||
{
|
||||
spdlog::info(" {} (version {}) (blacklisted)", extension_name, spec_version);
|
||||
|
||||
if (std::ranges::find(vk_device_extensions, extension_name) != instance_extensions.end())
|
||||
throw std::runtime_error("Required Vulkan device extension is blacklisted");
|
||||
}
|
||||
else
|
||||
{
|
||||
spdlog::info(" {} (version {})", extension_name, spec_version);
|
||||
if (auto it = optional_device_extensions.find(extension_name); it != optional_device_extensions.end())
|
||||
vk_device_extensions.push_back(it->data());
|
||||
}
|
||||
}
|
||||
|
||||
spdlog::info("Initializing Vulkan with device {}", physical_device_properties.deviceName.data());
|
||||
@@ -884,24 +980,30 @@ void application::initialize_vulkan()
|
||||
vk::PhysicalDeviceSamplerYcbcrConversionFeaturesKHR{
|
||||
.samplerYcbcrConversion = true,
|
||||
},
|
||||
vk::PhysicalDeviceTimelineSemaphoreFeaturesKHR{
|
||||
.timelineSemaphore = true,
|
||||
},
|
||||
vk::PhysicalDeviceTimelineSemaphoreFeaturesKHR{},
|
||||
vk::PhysicalDeviceMultiviewFeaturesKHR{
|
||||
.multiview = true,
|
||||
},
|
||||
vk::PhysicalDeviceIndexTypeUint8FeaturesEXT{}};
|
||||
|
||||
auto check_feature_flag = [&](auto feature_flag, const char * extension_name) -> bool {
|
||||
using FeatureStruct = class_from_member_t<decltype(feature_flag)>;
|
||||
|
||||
if (utils::contains(vk_device_extensions, extension_name) and
|
||||
vk_physical_device.getFeatures2<vk::PhysicalDeviceFeatures2, FeatureStruct>().template get<FeatureStruct>().*feature_flag)
|
||||
{
|
||||
device_create_info.get<FeatureStruct>().*feature_flag = true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
device_create_info.unlink<FeatureStruct>();
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
if (utils::contains(vk_device_extensions, VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME))
|
||||
{
|
||||
auto [_, feat] = vk_physical_device.getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceTimelineSemaphoreFeaturesKHR>();
|
||||
auto & create_feat = device_create_info.get<vk::PhysicalDeviceTimelineSemaphoreFeaturesKHR>();
|
||||
create_feat.timelineSemaphore = feat.timelineSemaphore;
|
||||
}
|
||||
else
|
||||
{
|
||||
device_create_info.unlink<vk::PhysicalDeviceTimelineSemaphoreFeaturesKHR>();
|
||||
}
|
||||
check_feature_flag(&vk::PhysicalDeviceTimelineSemaphoreFeaturesKHR::timelineSemaphore, VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME);
|
||||
check_feature_flag(&vk::PhysicalDeviceIndexTypeUint8FeaturesEXT::indexTypeUint8, VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME);
|
||||
|
||||
vk_device = xr_system_id.create_device(vk_physical_device, device_create_info.get());
|
||||
*vk_queue.lock() = vk_device.getQueue(vk_queue_family_index, 0);
|
||||
@@ -996,21 +1098,8 @@ void application::initialize_actions()
|
||||
profile.available = std::ranges::all_of(profile.required_extensions, [&](auto & ext) { return xr_instance.has_extension(ext); }) and
|
||||
profile.min_version <= api_version;
|
||||
|
||||
if (profile.profile_name.ends_with("khr/simple_controller"))
|
||||
{
|
||||
switch (guess_model())
|
||||
{
|
||||
// Quest hand tracking creates a fake khr/simple_controller when hand tracking
|
||||
// is enabled, this messes with native hand tracking
|
||||
case model::meta_quest_3:
|
||||
case model::meta_quest_pro:
|
||||
case model::meta_quest_3s:
|
||||
case model::oculus_quest_2:
|
||||
profile.available = false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (profile.profile_name.ends_with("khr/simple_controller") and not get_hmd_traits().bind_simple_controller)
|
||||
profile.available = false;
|
||||
|
||||
if (!profile.available)
|
||||
continue;
|
||||
@@ -1018,21 +1107,8 @@ void application::initialize_actions()
|
||||
// Patch profile to add grip_surface or palm_ext
|
||||
bool add_palms = true;
|
||||
if (profile.profile_name.ends_with("ext/hand_interaction_ext"))
|
||||
{
|
||||
switch (guess_model())
|
||||
{
|
||||
// Quest breaks spec and does not support grip_surface for ext/hand_interaction_ext
|
||||
case model::meta_quest_3:
|
||||
case model::meta_quest_pro:
|
||||
case model::meta_quest_3s:
|
||||
case model::oculus_quest_2:
|
||||
case model::oculus_quest:
|
||||
add_palms = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
add_palms = get_hmd_traits().hand_interaction_grip_surface;
|
||||
|
||||
if (add_palms)
|
||||
{
|
||||
if ((api_version >= XR_MAKE_VERSION(1, 1, 0) or xr_instance.has_extension(XR_KHR_MAINTENANCE1_EXTENSION_NAME)) //
|
||||
@@ -1053,6 +1129,19 @@ void application::initialize_actions()
|
||||
}
|
||||
}
|
||||
|
||||
// Patch profile to add pinch_ext/pose and poke_ext/pose
|
||||
if (xr_instance.has_extension(XR_EXT_HAND_INTERACTION_EXTENSION_NAME) //
|
||||
and utils::contains(profile.input_sources, "/user/hand/left/input/grip/pose") //
|
||||
and not utils::contains(profile.input_sources, "/user/hand/left/input/pinch_ext/pose"))
|
||||
{
|
||||
spdlog::info("Adding pinch_ext/pose for interaction profile {}", profile.profile_name);
|
||||
profile.input_sources.push_back("/user/hand/left/input/pinch_ext/pose");
|
||||
profile.input_sources.push_back("/user/hand/right/input/pinch_ext/pose");
|
||||
spdlog::info("Adding poke_ext/pose for interaction profile {}", profile.profile_name);
|
||||
profile.input_sources.push_back("/user/hand/left/input/poke_ext/pose");
|
||||
profile.input_sources.push_back("/user/hand/right/input/poke_ext/pose");
|
||||
}
|
||||
|
||||
// Dynamically add VIVE XR Trackers to the profile if available
|
||||
if (utils::contains(profile.required_extensions, XR_HTC_VIVE_XR_TRACKER_INTERACTION_EXTENSION_NAME) and
|
||||
xr_instance.has_extension(XR_HTC_PATH_ENUMERATION_EXTENSION_NAME))
|
||||
@@ -1189,63 +1278,69 @@ void application::initialize_actions()
|
||||
|
||||
void application::initialize()
|
||||
{
|
||||
runtime_hmd_traits.init();
|
||||
// LogLayersAndExtensions
|
||||
assert(!xr_instance);
|
||||
std::vector<std::string> xr_extensions;
|
||||
|
||||
// Required extensions
|
||||
xr_extensions.push_back(XR_KHR_CONVERT_TIMESPEC_TIME_EXTENSION_NAME);
|
||||
std::vector<const char *> xr_extensions{
|
||||
// Required extensions
|
||||
XR_KHR_CONVERT_TIMESPEC_TIME_EXTENSION_NAME,
|
||||
};
|
||||
|
||||
// Optional extensions
|
||||
std::vector<std::string> opt_extensions;
|
||||
opt_extensions.push_back(XR_KHR_LOCATE_SPACES_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_KHR_MAINTENANCE1_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_EXT_HAND_TRACKING_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_EXT_HAND_INTERACTION_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_FB_PASSTHROUGH_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_HTC_PASSTHROUGH_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_HTC_FACIAL_TRACKING_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_HTC_PATH_ENUMERATION_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_HTC_VIVE_XR_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_FB_FACE_TRACKING2_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_FB_BODY_TRACKING_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_META_BODY_TRACKING_FULL_BODY_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_META_BODY_TRACKING_FIDELITY_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_BD_BODY_TRACKING_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_EXT_PALM_POSE_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_FB_COMPOSITION_LAYER_DEPTH_TEST_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_KHR_COMPOSITION_LAYER_COLOR_SCALE_BIAS_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_EXT_USER_PRESENCE_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_KHR_VISIBILITY_MASK_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_FB_COMPOSITION_LAYER_SETTINGS_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_FB_SWAPCHAIN_UPDATE_STATE_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_FB_FOVEATION_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_FB_FOVEATION_CONFIGURATION_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_FB_FOVEATION_VULKAN_EXTENSION_NAME);
|
||||
std::vector<const char *> opt_extensions{
|
||||
XR_KHR_COMPOSITION_LAYER_COLOR_SCALE_BIAS_EXTENSION_NAME,
|
||||
XR_KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME,
|
||||
XR_KHR_LOCATE_SPACES_EXTENSION_NAME,
|
||||
XR_KHR_MAINTENANCE1_EXTENSION_NAME,
|
||||
XR_KHR_VISIBILITY_MASK_EXTENSION_NAME,
|
||||
|
||||
XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME,
|
||||
XR_EXT_HAND_INTERACTION_EXTENSION_NAME,
|
||||
XR_EXT_HAND_TRACKING_EXTENSION_NAME,
|
||||
XR_FB_HAND_TRACKING_MESH_EXTENSION_NAME,
|
||||
XR_EXT_PALM_POSE_EXTENSION_NAME,
|
||||
XR_EXT_PERFORMANCE_SETTINGS_EXTENSION_NAME,
|
||||
XR_EXT_USER_PRESENCE_EXTENSION_NAME,
|
||||
|
||||
XR_ANDROID_FACE_TRACKING_EXTENSION_NAME,
|
||||
|
||||
XR_BD_BODY_TRACKING_EXTENSION_NAME,
|
||||
|
||||
XR_FB_BODY_TRACKING_EXTENSION_NAME,
|
||||
XR_FB_COMPOSITION_LAYER_DEPTH_TEST_EXTENSION_NAME,
|
||||
XR_FB_COMPOSITION_LAYER_SETTINGS_EXTENSION_NAME,
|
||||
XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME,
|
||||
XR_FB_FACE_TRACKING2_EXTENSION_NAME,
|
||||
XR_FB_PASSTHROUGH_EXTENSION_NAME,
|
||||
XR_FB_SWAPCHAIN_UPDATE_STATE_EXTENSION_NAME,
|
||||
|
||||
XR_HTC_PASSTHROUGH_EXTENSION_NAME,
|
||||
XR_HTC_PATH_ENUMERATION_EXTENSION_NAME,
|
||||
XR_HTC_FACIAL_TRACKING_EXTENSION_NAME,
|
||||
XR_HTC_VIVE_XR_TRACKER_INTERACTION_EXTENSION_NAME,
|
||||
|
||||
XR_META_BODY_TRACKING_FIDELITY_EXTENSION_NAME,
|
||||
XR_META_BODY_TRACKING_FULL_BODY_EXTENSION_NAME,
|
||||
XR_META_LOCAL_DIMMING_EXTENSION_NAME,
|
||||
};
|
||||
|
||||
for (const auto & i: interaction_profiles)
|
||||
opt_extensions.insert(opt_extensions.end(), i.required_extensions.begin(), i.required_extensions.end());
|
||||
|
||||
for (const auto & i: xr::instance::extensions())
|
||||
for (const auto & ext: xr::instance::extensions())
|
||||
{
|
||||
if (utils::contains(opt_extensions, i.extensionName))
|
||||
xr_extensions.push_back(i.extensionName);
|
||||
}
|
||||
|
||||
std::vector<const char *> extensions;
|
||||
for (const auto & i: xr_extensions)
|
||||
{
|
||||
extensions.push_back(i.c_str());
|
||||
auto it = std::find_if(opt_extensions.begin(),
|
||||
opt_extensions.end(),
|
||||
[&ext](const char * i) { return strcmp(i, ext.extensionName) == 0; });
|
||||
if (it != opt_extensions.end() and not runtime_hmd_traits.blacklisted_extensions.contains(ext.extensionName))
|
||||
xr_extensions.push_back(*it);
|
||||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
xr_instance =
|
||||
xr::instance(app_info.name, app_info.native_app->activity->vm, app_info.native_app->activity->clazz, extensions);
|
||||
xr::instance(app_info.name, app_info.native_app->activity->vm, app_info.native_app->activity->clazz, xr_extensions);
|
||||
#else
|
||||
xr_instance = xr::instance(app_info.name, extensions);
|
||||
xr_instance = xr::instance(app_info.name, xr_extensions);
|
||||
#endif
|
||||
|
||||
spdlog::info("Created OpenXR instance, runtime {}, version {}, API version {}",
|
||||
@@ -1309,7 +1404,12 @@ void application::initialize()
|
||||
spaces[size_t(xr::spaces::view)] = xr_session.create_reference_space(XR_REFERENCE_SPACE_TYPE_VIEW);
|
||||
spaces[size_t(xr::spaces::world)] = xr_session.create_reference_space(XR_REFERENCE_SPACE_TYPE_STAGE);
|
||||
|
||||
config.emplace(xr_system_id);
|
||||
config.emplace(xr_system_id, xr_session, application::get_config_path() / "client.json");
|
||||
default_config.emplace(xr_system_id, xr_session);
|
||||
|
||||
#ifdef __ANDROID__
|
||||
set_usb_networking(config->usb_network);
|
||||
#endif
|
||||
|
||||
// HTC face tracker fails if created later
|
||||
// we can destroy it right away, it actually stores static handles
|
||||
@@ -1391,7 +1491,7 @@ std::pair<XrAction, XrActionType> application::get_action(std::string_view reque
|
||||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
extern "C" __attribute__((visibility("default"))) void Java_org_meumeu_wivrn_MainActivity_onNewIntent(JNIEnv * env, jobject instance, jobject intent_obj)
|
||||
extern "C" void Java_org_meumeu_wivrn_MainActivity_onNewIntent(JNIEnv * env, jobject instance, jobject intent_obj)
|
||||
{
|
||||
jni::jni_thread::setup_thread(env);
|
||||
jni::object<"android/content/Intent"> intent{intent_obj};
|
||||
@@ -1499,6 +1599,26 @@ application::application(application_info info) :
|
||||
}
|
||||
};
|
||||
|
||||
// capture pointer to receive relative mouse events
|
||||
app_info.native_app->activity->callbacks->onWindowFocusChanged = [](ANativeActivity * activity, int has_focus) {
|
||||
if (has_focus)
|
||||
android_hid::request_pointer_capture(activity);
|
||||
else
|
||||
android_hid::release_pointer_capture(activity);
|
||||
};
|
||||
|
||||
app_info.native_app->onInputEvent = [](android_app * app, AInputEvent * event) {
|
||||
auto app_instance = static_cast<application *>(app->userData);
|
||||
|
||||
std::unique_lock _{app_instance->scene_stack_lock};
|
||||
if (!app_instance->scene_stack.empty())
|
||||
{
|
||||
auto scene = app_instance->scene_stack.back();
|
||||
return app_instance->input_handler.handle_input(scene.get(), event) ? 1 : 0;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
wifi = wifi_lock::make_wifi_lock(app_info.native_app->activity->clazz);
|
||||
|
||||
// Initialize the loader for this platform
|
||||
@@ -1561,6 +1681,9 @@ void application::cleanup()
|
||||
|
||||
#ifdef __ANDROID__
|
||||
jni::jni_thread::detach();
|
||||
app_info.native_app->onAppCmd = nullptr;
|
||||
app_info.native_app->onInputEvent = nullptr;
|
||||
app_info.native_app->userData = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1656,8 +1779,10 @@ void application::run()
|
||||
while (ALooper_pollOnce(100, nullptr, &events, (void **)&source) >= 0)
|
||||
{
|
||||
// Process this event.
|
||||
if (source != nullptr)
|
||||
source->process(app_info.native_app, source);
|
||||
if (source == nullptr)
|
||||
continue;
|
||||
|
||||
source->process(app_info.native_app, source);
|
||||
}
|
||||
|
||||
if (app_info.native_app->destroyRequested)
|
||||
@@ -1674,8 +1799,7 @@ void application::run()
|
||||
#else
|
||||
void application::run()
|
||||
{
|
||||
struct sigaction act
|
||||
{};
|
||||
struct sigaction act{};
|
||||
act.sa_handler = [](int) {
|
||||
instance().exit_requested = true;
|
||||
};
|
||||
@@ -1710,6 +1834,38 @@ void application::push_scene(std::shared_ptr<scene> s)
|
||||
instance().scene_stack.push_back(std::move(s));
|
||||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
void application::set_usb_networking(bool enabled)
|
||||
{
|
||||
jni::object<""> act(app_info.native_app->activity->clazz);
|
||||
auto app = act.call<jni::object<"android/app/Application">>("getApplication");
|
||||
auto ctx = app.call<jni::object<"android/content/Context">>("getApplicationContext");
|
||||
auto system_service = ctx.call<jni::object<"java/lang/Object">>("getSystemService", jni::string("connectivity"));
|
||||
|
||||
auto cb = act.field<jni::object<"android/net/ConnectivityManager$NetworkCallback">>("netcb");
|
||||
try
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
auto req = jni::new_object<"android/net/NetworkRequest$Builder">()
|
||||
.call<jni::object<"android/net/NetworkRequest$Builder">>("removeCapability", jni::Int(12) /*NET_CAPABILITY_INTERNET*/)
|
||||
.call<jni::object<"android/net/NetworkRequest$Builder">>("removeCapability", jni::Int(14) /*NET_CAPABILITY_TRUSTED*/)
|
||||
.call<jni::object<"android/net/NetworkRequest$Builder">>("addTransportType", jni::Int(8) /*TRANSPORT_USB*/)
|
||||
.call<jni::object<"android/net/NetworkRequest">>("build");
|
||||
|
||||
// system_service.call<void>("requestNetwork", req, jni::new_object<"org/meumeu/wivrn/NetworkInfoCallback">());
|
||||
system_service.call<void>("requestNetwork", req, cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
system_service.call<void>("unregisterNetworkCallback", cb);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{}
|
||||
}
|
||||
#endif
|
||||
|
||||
void application::poll_actions()
|
||||
{
|
||||
std::array<XrActionSet, 2> action_sets{
|
||||
|
||||
+33
-8
@@ -20,10 +20,12 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "android/hid.h"
|
||||
#include <android_native_app_glue.h>
|
||||
#endif
|
||||
|
||||
#include "configuration.h"
|
||||
#include "hmd_traits.h"
|
||||
#include "utils/singleton.h"
|
||||
#include "utils/thread_safe.h"
|
||||
#include "vk/vk_allocator.h"
|
||||
@@ -53,7 +55,7 @@
|
||||
class scene;
|
||||
|
||||
#ifdef __ANDROID__
|
||||
extern "C" __attribute__((visibility("default"))) void Java_org_meumeu_wivrn_MainActivity_onNewIntent(JNIEnv * env, jobject instance, jobject intent_obj);
|
||||
extern "C" void Java_org_meumeu_wivrn_MainActivity_onNewIntent(JNIEnv * env, jobject instance, jobject intent_obj);
|
||||
#endif
|
||||
|
||||
struct application_info
|
||||
@@ -73,14 +75,17 @@ class application : public singleton<application>
|
||||
{
|
||||
friend class scene;
|
||||
|
||||
private:
|
||||
#ifdef __ANDROID__
|
||||
friend __attribute__((visibility("default"))) void Java_org_meumeu_wivrn_MainActivity_onNewIntent(JNIEnv * env, jobject instance, jobject intent_obj);
|
||||
friend void Java_org_meumeu_wivrn_MainActivity_onNewIntent(JNIEnv * env, jobject instance, jobject intent_obj);
|
||||
#endif
|
||||
|
||||
application_info app_info;
|
||||
#ifdef __ANDROID__
|
||||
ANativeWindow * native_window = nullptr;
|
||||
bool resumed = false;
|
||||
|
||||
android_hid::input_handler input_handler{};
|
||||
#endif
|
||||
|
||||
static inline const char engine_name[] = "No engine";
|
||||
@@ -151,9 +156,11 @@ class application : public singleton<application>
|
||||
std::chrono::nanoseconds last_scene_cpu_time;
|
||||
|
||||
std::optional<configuration> config;
|
||||
std::optional<configuration> default_config;
|
||||
|
||||
boost::locale::generator gen;
|
||||
boost::locale::gnu_gettext::messages_info messages_info;
|
||||
hmd_traits runtime_hmd_traits;
|
||||
|
||||
private:
|
||||
void loop();
|
||||
@@ -200,6 +207,11 @@ public:
|
||||
{
|
||||
return instance().app_info.native_app;
|
||||
}
|
||||
|
||||
static android_hid::input_handler & get_input_handler()
|
||||
{
|
||||
return instance().input_handler;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool is_session_running()
|
||||
@@ -300,6 +312,10 @@ public:
|
||||
return *instance().wifi;
|
||||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
void set_usb_networking(bool enabled);
|
||||
#endif
|
||||
|
||||
static void ignore_debug_reports_for(void * object)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
@@ -319,8 +335,9 @@ public:
|
||||
template <typename T>
|
||||
static void set_debug_reports_name(const T & object, std::string name)
|
||||
{
|
||||
// #ifndef NDEBUG
|
||||
// if (instance().debug_utils_found)
|
||||
if (not vk_allocator::instance().has_debug_utils)
|
||||
return;
|
||||
|
||||
const vk::DebugUtilsObjectNameInfoEXT name_info{
|
||||
.objectType = T::objectType,
|
||||
.objectHandle = (uint64_t)(typename T::NativeType)object,
|
||||
@@ -328,10 +345,6 @@ public:
|
||||
};
|
||||
|
||||
instance().vk_device.setDebugUtilsObjectNameEXT(name_info);
|
||||
|
||||
// printf("set_debug_reports_name %p, %s\n", object, name.c_str());
|
||||
// instance().debug_report_object_name[(uint64_t)object] = std::move(name);
|
||||
// #endif
|
||||
}
|
||||
|
||||
static thread_safe<vk::raii::Queue> & get_queue()
|
||||
@@ -399,6 +412,12 @@ public:
|
||||
return instance().openxr_post_processing_supported;
|
||||
}
|
||||
|
||||
static const hmd_traits & get_hmd_traits()
|
||||
{
|
||||
assert(instance().runtime_hmd_traits.is_initialized());
|
||||
return instance().runtime_hmd_traits;
|
||||
}
|
||||
|
||||
static auto & get_generic_trackers()
|
||||
{
|
||||
return instance().generic_trackers;
|
||||
@@ -415,6 +434,12 @@ public:
|
||||
return *instance().config;
|
||||
}
|
||||
|
||||
static configuration & get_default_config()
|
||||
{
|
||||
assert(instance().default_config);
|
||||
return *instance().default_config;
|
||||
}
|
||||
|
||||
static XrSessionState get_session_state()
|
||||
{
|
||||
return instance().session_state;
|
||||
|
||||
@@ -80,11 +80,7 @@ int32_t wivrn::android::audio::speaker_data_cb(AAudioStream * stream, void * use
|
||||
{
|
||||
// Buffer underrun: add 5ms buffer
|
||||
size_t target_buffer_size = frame_size * AAudioStream_getSampleRate(stream) * 0.005;
|
||||
#if __cpp_lib_shared_ptr_arrays >= 201707L
|
||||
self->speaker_tmp.data.c = std::make_shared<uint8_t[]>(target_buffer_size, 0);
|
||||
#else
|
||||
self->speaker_tmp.data.c.reset(new uint8_t[target_buffer_size]());
|
||||
#endif
|
||||
self->speaker_tmp.payload = std::span(self->speaker_tmp.data.c.get(), target_buffer_size);
|
||||
self->buffer_size_bytes += target_buffer_size;
|
||||
spdlog::debug("Audio sync: underrun, add {} bytes buffer",
|
||||
@@ -159,9 +155,9 @@ void wivrn::android::audio::build_microphone(AAudioStreamBuilder * builder, int3
|
||||
AAudioStreamBuilder_setSharingMode(builder, AAUDIO_SHARING_MODE_EXCLUSIVE);
|
||||
AAudioStreamBuilder_setFormat(builder, AAUDIO_FORMAT_PCM_I16);
|
||||
if (application::get_config().mic_unprocessed_audio)
|
||||
{
|
||||
AAudioStreamBuilder_setInputPreset(builder, AAUDIO_INPUT_PRESET_UNPROCESSED);
|
||||
}
|
||||
else
|
||||
AAudioStreamBuilder_setInputPreset(builder, AAUDIO_INPUT_PRESET_VOICE_COMMUNICATION);
|
||||
|
||||
AAudioStreamBuilder_setDataCallback(builder, µphone_data_cb, this);
|
||||
AAudioStreamBuilder_setErrorCallback(builder, µphone_error_cb, this);
|
||||
|
||||
+246
-98
@@ -19,15 +19,139 @@
|
||||
|
||||
#include "configuration.h"
|
||||
#include "application.h"
|
||||
#include "utils/contains.h"
|
||||
#include "utils/json_string.h"
|
||||
#include "wivrn_packets.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <magic_enum.hpp>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "android/permissions.h"
|
||||
#endif
|
||||
|
||||
// If no refresh rate is configured, don't select a too high one
|
||||
static const float max_default_rate = 100;
|
||||
|
||||
// key <-> member serialization descriptor for scalar settings (see config_fields()).
|
||||
// The few settings that aren't scalars are handled explicitly in save()/load().
|
||||
struct config_field
|
||||
{
|
||||
std::function<void(std::ostream &, const configuration &)> save;
|
||||
std::function<void(simdjson::dom::element, configuration &)> load;
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
template <typename>
|
||||
inline constexpr bool is_optional_v = false;
|
||||
template <typename T>
|
||||
inline constexpr bool is_optional_v<std::optional<T>> = true;
|
||||
|
||||
template <typename T>
|
||||
struct remove_optional
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
template <typename T>
|
||||
struct remove_optional<std::optional<T>>
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
|
||||
std::ostream & operator<<(std::ostream & stream, feature f)
|
||||
{
|
||||
return stream << "\"" << magic_enum::enum_name(f) << "\"";
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void write_value(std::ostream & json, const T & value)
|
||||
{
|
||||
if constexpr (std::is_same_v<T, bool>)
|
||||
json << std::boolalpha << value;
|
||||
else if constexpr (std::is_same_v<T, std::string>)
|
||||
json << json_string(value);
|
||||
else if constexpr (std::is_enum_v<T>)
|
||||
json << json_string(magic_enum::enum_name(value));
|
||||
else if constexpr (std::is_integral_v<T>)
|
||||
json << (uint64_t)value;
|
||||
else // floating point
|
||||
json << value;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::optional<T> read_value(simdjson::simdjson_result<simdjson::dom::element> val)
|
||||
{
|
||||
if constexpr (std::is_same_v<T, bool>)
|
||||
{
|
||||
if (val.is_bool())
|
||||
return val.get_bool();
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, std::string>)
|
||||
{
|
||||
if (val.is_string())
|
||||
return std::string(std::string_view(val.get_string().value()));
|
||||
}
|
||||
else if constexpr (std::is_enum_v<T>)
|
||||
{
|
||||
if (val.is_string())
|
||||
{
|
||||
auto name = val.get_string().value();
|
||||
for (const auto & [e, n]: magic_enum::enum_entries<T>())
|
||||
if (name == n)
|
||||
return e;
|
||||
}
|
||||
}
|
||||
else if constexpr (std::is_integral_v<T>)
|
||||
{
|
||||
if (val.is_uint64())
|
||||
return (T)val.get_uint64();
|
||||
if (val.is_int64() and int64_t(val.get_int64()) >= 0)
|
||||
return (T)val.get_int64();
|
||||
}
|
||||
else // floating point
|
||||
{
|
||||
if (val.is_double())
|
||||
return (T)val.get_double();
|
||||
if (val.is_int64())
|
||||
return (T)val.get_int64();
|
||||
if (val.is_uint64())
|
||||
return (T)val.get_uint64();
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// build a field for a plain member: bool / float / integral / std::string / enum,
|
||||
// optionally wrapped in std::optional (only written when set)
|
||||
template <typename T>
|
||||
config_field scalar(const char * key, T configuration::* member)
|
||||
{
|
||||
return {
|
||||
.save = [key, member](std::ostream & json, const configuration & c) {
|
||||
if constexpr (is_optional_v<T>)
|
||||
{
|
||||
if (c.*member)
|
||||
{
|
||||
json << ",\"" << key << "\":";
|
||||
write_value(json, *(c.*member));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
json << ",\"" << key << "\":";
|
||||
write_value(json, c.*member);
|
||||
} },
|
||||
.load = [key, member](simdjson::dom::element root, configuration & c) {
|
||||
if (auto v = read_value<typename remove_optional<T>::type>(root[key]))
|
||||
c.*member = *v; },
|
||||
};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
bool configuration::check_feature(feature f) const
|
||||
{
|
||||
{
|
||||
@@ -65,7 +189,7 @@ bool configuration::check_feature(feature f) const
|
||||
}
|
||||
}
|
||||
#ifdef __ANDROID__
|
||||
return check_permission(permission_name(f));
|
||||
return check_permission(application::get_hmd_traits().permission_name(f));
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
@@ -76,7 +200,7 @@ void configuration::set_feature(feature f, bool state)
|
||||
#ifdef __ANDROID__
|
||||
if (state)
|
||||
{
|
||||
request_permission(permission_name(f), [this, f](bool granted) {
|
||||
request_permission(application::get_hmd_traits().permission_name(f), [this, f](bool granted) {
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
features[f] = granted;
|
||||
@@ -94,14 +218,28 @@ void configuration::set_feature(feature f, bool state)
|
||||
save();
|
||||
}
|
||||
|
||||
configuration::configuration(xr::system & system)
|
||||
configuration::configuration(xr::system & system, xr::session & session)
|
||||
{
|
||||
passthrough_enabled = system.passthrough_supported() == xr::passthrough_type::color;
|
||||
features[feature::hand_tracking] = system.hand_tracking_supported();
|
||||
|
||||
const auto & rates = session.get_refresh_rates();
|
||||
preferred_refresh_rate = rates.empty() ? 0 : rates[0];
|
||||
for (auto rate: rates)
|
||||
{
|
||||
if (rate >= max_default_rate)
|
||||
break;
|
||||
preferred_refresh_rate = rate;
|
||||
}
|
||||
}
|
||||
|
||||
configuration::configuration(xr::system & system, xr::session & session, const std::filesystem::path & config_path) :
|
||||
configuration(system, session)
|
||||
{
|
||||
try
|
||||
{
|
||||
simdjson::dom::parser parser;
|
||||
simdjson::dom::element root = parser.load(application::get_config_path() / "client.json");
|
||||
simdjson::dom::element root = parser.load(config_path.native());
|
||||
for (simdjson::dom::object i: simdjson::dom::array(root["servers"]))
|
||||
{
|
||||
server_data data{
|
||||
@@ -120,97 +258,97 @@ configuration::configuration(xr::system & system)
|
||||
servers.emplace(data.service.txt["cookie"], data);
|
||||
}
|
||||
|
||||
if (auto val = root["preferred_refresh_rate"]; val.is_double())
|
||||
preferred_refresh_rate = val.get_double();
|
||||
float default_refresh_rate = preferred_refresh_rate;
|
||||
|
||||
if (auto val = root["minimum_refresh_rate"]; val.is_double())
|
||||
minimum_refresh_rate = val.get_double();
|
||||
for (const auto & f: config_fields())
|
||||
f.load(root, *this);
|
||||
|
||||
if (auto val = root["resolution_scale"]; val.is_double())
|
||||
resolution_scale = val.get_double();
|
||||
// refresh rate must be supported by this headset, otherwise fall back to the default
|
||||
const auto & rates = session.get_refresh_rates();
|
||||
if (preferred_refresh_rate != 0 and not utils::contains(rates, preferred_refresh_rate))
|
||||
preferred_refresh_rate = default_refresh_rate;
|
||||
|
||||
if (auto val = root["enable_stream_gui"]; val.is_bool())
|
||||
enable_stream_gui = val.get_bool();
|
||||
|
||||
if (auto val = root["openxr_post_processing"]; val.is_object())
|
||||
parse_openxr_post_processing_options(val.get_object());
|
||||
|
||||
if (auto val = root["passthrough_enabled"]; val.is_bool())
|
||||
passthrough_enabled = val.get_bool();
|
||||
|
||||
if (auto val = root["mic_unprocessed_audio"]; val.is_bool())
|
||||
mic_unprocessed_audio = val.get_bool();
|
||||
|
||||
if (auto val = root["fb_lower_body"]; val.is_bool())
|
||||
fb_lower_body = val.get_bool();
|
||||
if (auto val = root["fb_hip"]; val.is_bool())
|
||||
fb_hip = val.get_bool();
|
||||
|
||||
if (auto val = root["virtual_keyboard_layout"]; val.is_string())
|
||||
virtual_keyboard_layout = val.get_string().value();
|
||||
|
||||
for (const auto & [i, name]: magic_enum::enum_entries<feature>())
|
||||
if (auto val = root["body_parts"]; val.is_object())
|
||||
{
|
||||
if (auto val = root[name]; val.is_bool())
|
||||
features[i] = val.get_bool();
|
||||
for (const auto & [b, name]: magic_enum::enum_entries<wivrn::from_headset::body_part_mask>())
|
||||
{
|
||||
const auto & body_part = val[name];
|
||||
if (!body_part.is_bool())
|
||||
continue;
|
||||
|
||||
if (body_part.get_bool())
|
||||
{
|
||||
body_part_mask |= std::to_underlying(b);
|
||||
}
|
||||
else
|
||||
{
|
||||
body_part_mask &= ~std::to_underlying(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// nested object
|
||||
if (auto val = root["openxr_post_processing"]; val.is_object())
|
||||
{
|
||||
auto obj = val.get_object();
|
||||
openxr_post_processing = {};
|
||||
if (auto v = obj["super_sampling"]; v.is_int64())
|
||||
openxr_post_processing.super_sampling = v.get_int64();
|
||||
if (auto v = obj["sharpening"]; v.is_int64())
|
||||
openxr_post_processing.sharpening = v.get_int64();
|
||||
}
|
||||
|
||||
// feature flags, keyed by enum name
|
||||
for (const auto & [f, name]: magic_enum::enum_entries<feature>())
|
||||
if (auto val = root[name]; val.is_bool())
|
||||
features[f] = val.get_bool();
|
||||
|
||||
if (system.passthrough_supported() == xr::passthrough_type::none)
|
||||
passthrough_enabled = false;
|
||||
|
||||
if (auto val = root["override_foveation_enable"]; val.is_bool())
|
||||
override_foveation_enable = val.get_bool();
|
||||
|
||||
if (auto val = root["override_foveation_pitch"]; val.is_double())
|
||||
override_foveation_pitch = val.get_double();
|
||||
|
||||
if (auto val = root["override_foveation_distance"]; val.is_double())
|
||||
override_foveation_distance = val.get_double();
|
||||
|
||||
if (auto val = root["first_run"]; val.is_bool())
|
||||
first_run = val.get_bool();
|
||||
|
||||
if (auto val = root["locale"]; val.is_string())
|
||||
locale = val.get_string().value();
|
||||
|
||||
if (auto val = root["environment_model"]; val.is_string())
|
||||
environment_model = (std::string_view)val.get_string();
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
spdlog::warn("Cannot read configuration: {}", e.what());
|
||||
|
||||
// Restore default configuration
|
||||
servers.clear();
|
||||
preferred_refresh_rate.reset();
|
||||
minimum_refresh_rate.reset();
|
||||
resolution_scale = 1.4;
|
||||
openxr_post_processing = {};
|
||||
passthrough_enabled = system.passthrough_supported() == xr::passthrough_type::color;
|
||||
}
|
||||
}
|
||||
|
||||
void configuration::parse_openxr_post_processing_options(simdjson::simdjson_result<simdjson::dom::object> openxr_post_processing_root)
|
||||
const std::vector<config_field> & configuration::config_fields()
|
||||
{
|
||||
openxr_post_processing = {};
|
||||
if (auto val = openxr_post_processing_root["super_sampling"]; val.is_int64())
|
||||
openxr_post_processing.super_sampling = val.get_int64();
|
||||
|
||||
if (auto val = openxr_post_processing_root["sharpening"]; val.is_int64())
|
||||
openxr_post_processing.sharpening = val.get_int64();
|
||||
}
|
||||
|
||||
static std::ostream & operator<<(std::ostream & stream, feature f)
|
||||
{
|
||||
return stream << "\"" << magic_enum::enum_name(f) << "\"";
|
||||
}
|
||||
|
||||
static std::ostream & write_openxr_post_processing(std::ofstream & stream, const configuration::openxr_post_processing_settings & openxr_post_processing)
|
||||
{
|
||||
stream << "{\"super_sampling\":" << openxr_post_processing.super_sampling;
|
||||
stream << ",\"sharpening\":" << openxr_post_processing.sharpening;
|
||||
stream << "}";
|
||||
return stream;
|
||||
static const std::vector<config_field> fields = {
|
||||
scalar("resolution_scale", &configuration::resolution_scale),
|
||||
scalar("bitrate_bps", &configuration::bitrate_bps),
|
||||
scalar("enable_stream_gui", &configuration::enable_stream_gui),
|
||||
scalar("app_list_view", &configuration::app_list_view),
|
||||
scalar("app_icon_size", &configuration::app_icon_size),
|
||||
scalar("theme_preset", &configuration::theme_preset),
|
||||
scalar("theme_accent", &configuration::theme_accent),
|
||||
scalar("theme_rounding", &configuration::theme_rounding),
|
||||
scalar("theme_card_rounding", &configuration::theme_card_rounding),
|
||||
scalar("theme_font_scale", &configuration::theme_font_scale),
|
||||
scalar("theme_background_alpha", &configuration::theme_background_alpha),
|
||||
scalar("passthrough_enabled", &configuration::passthrough_enabled),
|
||||
scalar("mic_unprocessed_audio", &configuration::mic_unprocessed_audio),
|
||||
scalar("forward_keyboard", &configuration::forward_keyboard),
|
||||
scalar("forward_mouse", &configuration::forward_mouse),
|
||||
scalar("forward_gamepad", &configuration::forward_gamepad),
|
||||
scalar("virtual_keyboard_layout", &configuration::virtual_keyboard_layout),
|
||||
scalar("override_foveation_enable", &configuration::override_foveation_enable),
|
||||
scalar("override_foveation_pitch", &configuration::override_foveation_pitch),
|
||||
scalar("override_foveation_distance", &configuration::override_foveation_distance),
|
||||
scalar("first_run", &configuration::first_run),
|
||||
scalar("locale", &configuration::locale),
|
||||
scalar("environment_model", &configuration::environment_model),
|
||||
scalar("high_power_mode", &configuration::high_power_mode),
|
||||
scalar("fps_divider", &configuration::fps_divider),
|
||||
scalar("extended_config", &configuration::extended_config),
|
||||
scalar("preferred_refresh_rate", &configuration::preferred_refresh_rate),
|
||||
scalar("minimum_refresh_rate", &configuration::minimum_refresh_rate),
|
||||
scalar("stream_scale", &configuration::stream_scale),
|
||||
scalar("codec", &configuration::codec),
|
||||
scalar("bit_depth", &configuration::bit_depth),
|
||||
scalar("usb_network", &configuration::usb_network),
|
||||
};
|
||||
return fields;
|
||||
}
|
||||
|
||||
void configuration::save()
|
||||
@@ -242,26 +380,36 @@ void configuration::save()
|
||||
std::ofstream json(application::get_config_path() / "client.json");
|
||||
|
||||
json << "{\"servers\":[" << servers_str << "]";
|
||||
if (preferred_refresh_rate)
|
||||
json << ",\"preferred_refresh_rate\":" << *preferred_refresh_rate;
|
||||
if (minimum_refresh_rate)
|
||||
json << ",\"minimum_refresh_rate\":" << *minimum_refresh_rate;
|
||||
json << ",\"resolution_scale\":" << resolution_scale;
|
||||
json << ",\"openxr_post_processing\":";
|
||||
write_openxr_post_processing(json, openxr_post_processing);
|
||||
json << ",\"passthrough_enabled\":" << std::boolalpha << passthrough_enabled;
|
||||
json << ",\"mic_unprocessed_audio\":" << std::boolalpha << mic_unprocessed_audio;
|
||||
json << ",\"fb_lower_body\":" << std::boolalpha << fb_lower_body;
|
||||
json << ",\"fb_hip\":" << std::boolalpha << fb_hip;
|
||||
json << ",\"enable_stream_gui\":" << std::boolalpha << enable_stream_gui;
|
||||
|
||||
for (const auto & f: config_fields())
|
||||
f.save(json, *this);
|
||||
|
||||
// nested object
|
||||
json << ",\"openxr_post_processing\":{\"super_sampling\":" << openxr_post_processing.super_sampling;
|
||||
json << ",\"sharpening\":" << openxr_post_processing.sharpening << "}";
|
||||
|
||||
// feature flags, keyed by enum name
|
||||
for (auto & [key, value]: features)
|
||||
json << "," << key << ":" << std::boolalpha << value;
|
||||
json << ",\"virtual_keyboard_layout\":" << json_string(virtual_keyboard_layout);
|
||||
json << ",\"override_foveation_enable\":" << std::boolalpha << override_foveation_enable;
|
||||
json << ",\"override_foveation_pitch\":" << override_foveation_pitch;
|
||||
json << ",\"override_foveation_distance\":" << override_foveation_distance;
|
||||
json << ",\"first_run\":" << std::boolalpha << first_run;
|
||||
json << ",\"locale\":" << json_string(locale);
|
||||
json << ",\"environment_model\":" << json_string(environment_model);
|
||||
|
||||
json << "}";
|
||||
}
|
||||
|
||||
void configuration::set_stream_scale(float val)
|
||||
{
|
||||
stream_scale = val;
|
||||
}
|
||||
|
||||
float configuration::get_stream_scale() const
|
||||
{
|
||||
if (stream_scale)
|
||||
return *stream_scale;
|
||||
return get_default_stream_scale();
|
||||
}
|
||||
|
||||
float configuration::get_default_stream_scale() const
|
||||
{
|
||||
if (check_feature(feature::eye_gaze))
|
||||
return 0.3;
|
||||
return 0.5;
|
||||
}
|
||||
|
||||
+71
-10
@@ -19,19 +19,36 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "hardware.h"
|
||||
#include "wivrn_discover.h"
|
||||
#include "wivrn_packets.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <simdjson.h>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
namespace xr
|
||||
{
|
||||
class session;
|
||||
class system;
|
||||
}
|
||||
} // namespace xr
|
||||
|
||||
// key <-> member serialization descriptor, defined in configuration.cpp
|
||||
struct config_field;
|
||||
|
||||
enum class feature
|
||||
{
|
||||
microphone,
|
||||
hand_tracking,
|
||||
eye_gaze,
|
||||
face_tracking,
|
||||
body_tracking,
|
||||
};
|
||||
|
||||
class configuration
|
||||
{
|
||||
@@ -47,17 +64,37 @@ public:
|
||||
};
|
||||
|
||||
std::map<std::string, server_data> servers;
|
||||
std::optional<float> preferred_refresh_rate;
|
||||
float preferred_refresh_rate = 0;
|
||||
std::optional<float> minimum_refresh_rate;
|
||||
float resolution_scale = 1.4;
|
||||
float resolution_scale = 1.2;
|
||||
std::optional<wivrn::video_codec> codec;
|
||||
uint32_t bitrate_bps = 50'000'000;
|
||||
uint8_t bit_depth = 10;
|
||||
|
||||
bool passthrough_enabled = false;
|
||||
bool mic_unprocessed_audio = false;
|
||||
|
||||
bool fb_lower_body = false;
|
||||
bool fb_hip = true;
|
||||
// Input forwarding, per device. Off by default; only effective if the server permits it.
|
||||
bool forward_keyboard = false;
|
||||
bool forward_mouse = false;
|
||||
bool forward_gamepad = false;
|
||||
|
||||
std::underlying_type_t<wivrn::from_headset::body_part_mask> body_part_mask = ~0;
|
||||
|
||||
bool enable_stream_gui = true;
|
||||
|
||||
// application launcher: list vs grid, and grid icon size, 0 small 1 medium 2 large
|
||||
bool app_list_view = false;
|
||||
uint32_t app_icon_size = 0;
|
||||
|
||||
// interface theme, defaults match the built-in "Dark" preset and "Blue" accent
|
||||
std::string theme_preset = "Dark";
|
||||
std::string theme_accent = "Blue";
|
||||
float theme_rounding = 8;
|
||||
float theme_card_rounding = 14;
|
||||
float theme_font_scale = 1.0;
|
||||
float theme_background_alpha = 0.75;
|
||||
|
||||
// XR_FB_composition_layer_settings extension flags
|
||||
struct openxr_post_processing_settings
|
||||
{
|
||||
@@ -71,9 +108,17 @@ public:
|
||||
std::string environment_model = "assets://ground.glb";
|
||||
|
||||
bool override_foveation_enable = false;
|
||||
float override_foveation_pitch = 10 * M_PI / 180;
|
||||
float override_foveation_pitch = -10 * M_PI / 180;
|
||||
float override_foveation_distance = 3;
|
||||
|
||||
bool high_power_mode = true;
|
||||
uint32_t fps_divider = 1;
|
||||
|
||||
bool usb_network = false;
|
||||
|
||||
// Allow unsafe config values
|
||||
bool extended_config = false;
|
||||
|
||||
bool first_run = true;
|
||||
|
||||
std::string locale;
|
||||
@@ -84,12 +129,28 @@ public:
|
||||
private:
|
||||
mutable std::mutex mutex;
|
||||
std::map<feature, bool> features;
|
||||
std::optional<float> stream_scale;
|
||||
|
||||
void parse_openxr_post_processing_options(simdjson::simdjson_result<simdjson::dom::object> root);
|
||||
// table of scalar settings shared by save()/load(); non-scalar settings are explicit
|
||||
static const std::vector<config_field> & config_fields();
|
||||
|
||||
public:
|
||||
configuration(xr::system &);
|
||||
configuration() = default;
|
||||
configuration(xr::system &, xr::session &);
|
||||
configuration(xr::system &, xr::session &, const std::filesystem::path &);
|
||||
|
||||
void save();
|
||||
|
||||
void set_stream_scale(float);
|
||||
float get_stream_scale() const;
|
||||
float get_default_stream_scale() const;
|
||||
|
||||
uint32_t max_bitrate(bool extended) const
|
||||
{
|
||||
return extended ? 800'000'000u : 200'000'000u;
|
||||
}
|
||||
|
||||
uint32_t max_bitrate() const
|
||||
{
|
||||
return max_bitrate(extended_config);
|
||||
}
|
||||
};
|
||||
|
||||
+48
-40
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <glm/glm.hpp>
|
||||
#include <imgui.h>
|
||||
@@ -26,7 +27,7 @@
|
||||
namespace constants::gui
|
||||
{
|
||||
// Minimum distance between a GUI layer and a fingertip/controller to register a click
|
||||
constexpr float min_pointer_distance = -0.1;
|
||||
constexpr float min_controller_distance = -0.02;
|
||||
|
||||
// Font to use (desktop only)
|
||||
constexpr const char font_name[] = "Noto Sans";
|
||||
@@ -39,19 +40,21 @@ constexpr int font_size_large = 75;
|
||||
constexpr float scroll_ratio = 10;
|
||||
|
||||
// Threshold on the trigger value to register a click
|
||||
constexpr float trigger_click_thd = 0.8;
|
||||
constexpr float trigger_click_thd = 0.7;
|
||||
|
||||
// Thresholds on the distance between the fingertip and GUI layers
|
||||
constexpr float fingertip_distance_hovering_thd = 0.15;
|
||||
constexpr float fingertip_distance_touching_thd = 0.0;
|
||||
// Thresholds on the distance between the fingertip and GUI layers (positive: in front of the GUI, negative: behind the GUI)
|
||||
constexpr float palm_distance_close_thd_lo = 0.18; // Distance to switch between touch and aim interaction
|
||||
constexpr float palm_distance_close_thd_hi = 0.22; // Distance to switch between touch and aim interaction
|
||||
constexpr float fingertip_distance_touching_thd_hi = -0.01; // Distance to register a click
|
||||
constexpr float fingertip_distance_touching_thd_lo = -0.15; // Distance to register a click
|
||||
constexpr float fingertip_distance_stick_thd = -0.02; // Max distance where the fingertip is moved to be on the GUI
|
||||
|
||||
// Minimum scroll value to enable a controller
|
||||
constexpr float scroll_value_thd = 0.01;
|
||||
|
||||
// Pointer radius
|
||||
constexpr float pointer_radius_in = 10;
|
||||
constexpr float pointer_radius_out = 12;
|
||||
constexpr float pointer_thickness = 4;
|
||||
constexpr float pointer_thickness = 2;
|
||||
constexpr float pointer_radius_in = 6;
|
||||
|
||||
// Pointer transparency
|
||||
constexpr float pointer_alpha = 0.8;
|
||||
@@ -59,24 +62,37 @@ constexpr float pointer_alpha_disabled = 0.25;
|
||||
constexpr float pointer_fading_distance = 40;
|
||||
|
||||
// Pointer color
|
||||
constexpr uint32_t pointer_color_pressed = 0xffff3300;
|
||||
constexpr uint32_t pointer_color_unpressed = 0xffffffff;
|
||||
constexpr uint32_t pointer_color = 0x40ffffff;
|
||||
constexpr uint32_t pointer_color_border = 0xff000000;
|
||||
|
||||
// offset of a popup layer in front of its main GUI panel
|
||||
constexpr glm::vec3 popup_position = {0, 0, 0.05};
|
||||
|
||||
// world-space offset of a hover tooltip layer from the hovered item
|
||||
constexpr glm::vec3 tooltip_distance = {0, 0.004, 0.005};
|
||||
|
||||
} // namespace constants::gui
|
||||
|
||||
namespace constants::lobby
|
||||
{
|
||||
// Position and orientation of the GUI layers
|
||||
constexpr float gui_pitch = -0.2;
|
||||
constexpr auto gui_pitches = std::to_array<std::pair<float, float>>({
|
||||
{-90, -90},
|
||||
{-50, -90},
|
||||
{-30, -12},
|
||||
{30, -12},
|
||||
{50, 78},
|
||||
{90, 78},
|
||||
});
|
||||
constexpr float keyboard_pitch = -0.6;
|
||||
constexpr glm::vec3 popup_position = {0, 0, 0.05};
|
||||
constexpr glm::vec3 keyboard_position = {0, -0.3, 0.1};
|
||||
|
||||
// Position of the near plane
|
||||
constexpr float near_plane = 0.02;
|
||||
|
||||
// Recenter gesture thresholds
|
||||
constexpr float recenter_cosangle_min = 0.8;
|
||||
constexpr float recenter_cos_palm_angle_min = 0.7;
|
||||
constexpr float recenter_cos_fingertip_angle_max = 0.3;
|
||||
constexpr float recenter_distance_up = 0.3;
|
||||
constexpr float recenter_distance_front = 0.2;
|
||||
|
||||
@@ -89,16 +105,13 @@ constexpr float initial_gui_distance = 0.5;
|
||||
// Skybox color
|
||||
constexpr XrColor4f sky_color = {0, 0.25, 0.5, 1};
|
||||
|
||||
// Dimming scale/bias when a popup window is shown
|
||||
constexpr XrColor4f dimming_scale = {0.5, 0.5, 0.5, 1};
|
||||
constexpr XrColor4f dimming_bias = {0.25, 0.25, 0.25, 0};
|
||||
|
||||
// Z-indices of composition layers
|
||||
constexpr int zindex_passthrough = -2;
|
||||
constexpr int zindex_lobby = -1;
|
||||
constexpr int zindex_gui = 0;
|
||||
constexpr int zindex_controllers = 1;
|
||||
constexpr int zindex_recenter_tip = 2;
|
||||
constexpr int zindex_tooltip = 2;
|
||||
constexpr int zindex_recenter_tip = 3;
|
||||
} // namespace constants::lobby
|
||||
|
||||
namespace constants::stream
|
||||
@@ -106,27 +119,22 @@ namespace constants::stream
|
||||
constexpr float fade_delay = 3;
|
||||
constexpr float fade_duration = 0.25;
|
||||
|
||||
constexpr float urgent_fade_delay = 5;
|
||||
constexpr ImVec4 urgent_border_color = {8.f, .6f, 0.f, .8f};
|
||||
|
||||
// Dimming for the streamed video when the GUI is interactable
|
||||
constexpr float dimming_scale = 0.7;
|
||||
constexpr float dimming_bias = 0.15;
|
||||
constexpr float dimming_scale = 0.4;
|
||||
constexpr float dimming_bias = 0.01;
|
||||
|
||||
constexpr float gui_max_foveation_speed = 2; // Maximum speed (@ 1m) when changing the foveation distance with the thumbstick
|
||||
constexpr float gui_min_foveation_distance = 0.5;
|
||||
constexpr float gui_max_foveation_distance = 100;
|
||||
|
||||
constexpr float gui_min_foveation_pitch = -M_PI / 3;
|
||||
constexpr float gui_max_foveation_pitch = M_PI / 3;
|
||||
|
||||
constexpr float gui_max_layer_speed = 10; // Maximum speed (@ 1m) when changing the GUI distance with the thumbstick
|
||||
constexpr float gui_min_layer_distance = 0.5;
|
||||
constexpr float gui_max_layer_distance = 3;
|
||||
|
||||
} // namespace constants::stream
|
||||
|
||||
namespace constants::style
|
||||
{
|
||||
constexpr ImVec2 window_padding = {20, 20};
|
||||
constexpr float window_border_size = 2;
|
||||
constexpr float window_rounding = 10;
|
||||
|
||||
constexpr ImVec2 tooltip_padding = {5, 5};
|
||||
constexpr float tooltip_rounding = 0;
|
||||
constexpr float tooltip_distance = 10;
|
||||
|
||||
constexpr ImVec2 button_size = {220, 80};
|
||||
constexpr ImVec2 icon_button_size = {80, 80};
|
||||
constexpr float connection_popup_width = 1000;
|
||||
|
||||
constexpr ImVec2 pin_entry_key_size = {90, 70};
|
||||
constexpr ImVec2 pin_entry_item_spacing = {10, 10};
|
||||
constexpr float pin_entry_popup_width = 3 * pin_entry_key_size.x + 2 * pin_entry_item_spacing.x;
|
||||
|
||||
} // namespace constants::style
|
||||
|
||||
@@ -42,6 +42,7 @@ struct wivrn::android::decoder::mapped_hardware_buffer
|
||||
{
|
||||
vk::raii::DeviceMemory memory = nullptr;
|
||||
vk::raii::Image vimage = nullptr;
|
||||
vk::Extent2D extent{};
|
||||
vk::raii::ImageView image_view = nullptr;
|
||||
vk::ImageLayout layout = vk::ImageLayout::eUndefined;
|
||||
};
|
||||
@@ -85,11 +86,12 @@ struct android_blit_handle : public decoder::blit_handle
|
||||
const wivrn::to_headset::video_stream_data_shard::view_info_t & view_info,
|
||||
vk::ImageView image_view,
|
||||
vk::Image image,
|
||||
vk::Extent2D extent,
|
||||
vk::ImageLayout & current_layout,
|
||||
decltype(vk_data) vk_data,
|
||||
decltype(image_reader) image_reader,
|
||||
decltype(aimage) aimage) :
|
||||
decoder::blit_handle(feedback, view_info, image_view, image, current_layout),
|
||||
decoder::blit_handle(feedback, view_info, image_view, image, extent, current_layout),
|
||||
vk_data(vk_data),
|
||||
image_reader(image_reader),
|
||||
aimage(std::move(aimage)) {}
|
||||
@@ -103,19 +105,21 @@ namespace wivrn::android
|
||||
decoder::decoder(
|
||||
vk::raii::Device & device,
|
||||
vk::raii::PhysicalDevice & physical_device,
|
||||
const wivrn::to_headset::video_stream_description::item & description,
|
||||
float fps,
|
||||
const wivrn::to_headset::video_stream_description & description,
|
||||
uint8_t stream_index,
|
||||
std::weak_ptr<scenes::stream> weak_scene,
|
||||
shard_accumulator * accumulator) :
|
||||
wivrn::decoder(description), stream_index(stream_index), fps(fps), device(device), weak_scene(weak_scene), accumulator(accumulator)
|
||||
stream_index(stream_index), device(device), weak_scene(weak_scene), accumulator(accumulator)
|
||||
{
|
||||
spdlog::info("hbm_mutex.native_handle() = {}", (void *)hbm_mutex.native_handle());
|
||||
|
||||
auto width = description.width;
|
||||
auto height = description.height / (stream_index == 2 ? 2 : 1);
|
||||
|
||||
AImageReader * ir;
|
||||
check(AImageReader_newWithUsage(
|
||||
description.video_width,
|
||||
description.video_height,
|
||||
width,
|
||||
height,
|
||||
AIMAGE_FORMAT_PRIVATE,
|
||||
AHARDWAREBUFFER_USAGE_CPU_READ_NEVER | AHARDWAREBUFFER_USAGE_CPU_WRITE_NEVER | AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE,
|
||||
scenes::stream::image_buffer_size + 4 /* maxImages */,
|
||||
@@ -131,18 +135,18 @@ decoder::decoder(
|
||||
"vkGetAndroidHardwareBufferPropertiesANDROID");
|
||||
{
|
||||
AMediaFormat_ptr format(AMediaFormat_new());
|
||||
AMediaFormat_setString(format.get(), AMEDIAFORMAT_KEY_MIME, mime(description.codec));
|
||||
AMediaFormat_setString(format.get(), AMEDIAFORMAT_KEY_MIME, mime(description.codec[stream_index]));
|
||||
// AMediaFormat_setInt32(format.get(), "vendor.qti-ext-dec-low-latency.enable", 1); // Qualcomm low
|
||||
// latency mode
|
||||
AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_WIDTH, description.video_width);
|
||||
AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_HEIGHT, description.video_height);
|
||||
AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_OPERATING_RATE, std::ceil(fps));
|
||||
AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_WIDTH, width);
|
||||
AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_HEIGHT, height);
|
||||
AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_OPERATING_RATE, std::ceil(description.frame_rate));
|
||||
AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_PRIORITY, 0);
|
||||
|
||||
media_codec.reset(AMediaCodec_createDecoderByType(mime(description.codec)));
|
||||
media_codec.reset(AMediaCodec_createDecoderByType(mime(description.codec[stream_index])));
|
||||
|
||||
if (not media_codec)
|
||||
throw std::runtime_error(std::string("Cannot create decoder for MIME type ") + mime(description.codec));
|
||||
throw std::runtime_error(std::string("Cannot create decoder for MIME type ") + mime(description.codec[stream_index]));
|
||||
|
||||
char * codec_name;
|
||||
check(AMediaCodec_getName(media_codec.get(), &codec_name), "AMediaCodec_getName");
|
||||
@@ -191,6 +195,8 @@ decoder::decoder(
|
||||
|
||||
decoder::~decoder()
|
||||
{
|
||||
if (image_reader)
|
||||
AImageReader_setImageListener(image_reader.get(), nullptr);
|
||||
if (media_codec)
|
||||
{
|
||||
AMediaCodec_stop(media_codec.get());
|
||||
@@ -308,6 +314,7 @@ void decoder::on_image_available(AImageReader * reader)
|
||||
info->view_info,
|
||||
*vk_data->image_view,
|
||||
*vk_data->vimage,
|
||||
vk_data->extent,
|
||||
vk_data->layout,
|
||||
std::move(vk_data),
|
||||
image_reader,
|
||||
@@ -361,11 +368,8 @@ void decoder::create_sampler(const AHardwareBuffer_Desc & buffer_desc, vk::Andro
|
||||
};
|
||||
|
||||
// suggested values from decoder don't actually read the metadata, so it's garbage
|
||||
if (description.range)
|
||||
ycbcr_create_info.get<vk::SamplerYcbcrConversionCreateInfo>().ycbcrRange = vk::SamplerYcbcrRange(*description.range);
|
||||
|
||||
if (description.color_model)
|
||||
ycbcr_create_info.get<vk::SamplerYcbcrConversionCreateInfo>().ycbcrModel = vk::SamplerYcbcrModelConversion(*description.color_model);
|
||||
ycbcr_create_info.get<vk::SamplerYcbcrConversionCreateInfo>().ycbcrRange = vk::SamplerYcbcrRange::eItuFull;
|
||||
ycbcr_create_info.get<vk::SamplerYcbcrConversionCreateInfo>().ycbcrModel = vk::SamplerYcbcrModelConversion::eYcbcr709;
|
||||
|
||||
ycbcr_conversion = vk::raii::SamplerYcbcrConversion(device, ycbcr_create_info.get<vk::SamplerYcbcrConversionCreateInfo>());
|
||||
|
||||
@@ -411,7 +415,6 @@ std::shared_ptr<decoder::mapped_hardware_buffer> decoder::map_hardware_buffer(AI
|
||||
if (!*ycbcr_sampler || memcmp(&ahb_format, &format_properties, sizeof(format_properties)))
|
||||
{
|
||||
memcpy(&ahb_format, &format_properties, sizeof(format_properties));
|
||||
extent_ = {buffer_desc.width, buffer_desc.height};
|
||||
spdlog::info("decoded image size: {}x{}", buffer_desc.width, buffer_desc.height);
|
||||
create_sampler(buffer_desc, ahb_format);
|
||||
hardware_buffer_map.clear();
|
||||
@@ -490,6 +493,10 @@ std::shared_ptr<decoder::mapped_hardware_buffer> decoder::map_hardware_buffer(AI
|
||||
handle->vimage = std::move(vimage);
|
||||
handle->image_view = std::move(image_view);
|
||||
handle->memory = std::move(memory);
|
||||
handle->extent = vk::Extent2D{
|
||||
.width = buffer_desc.width,
|
||||
.height = buffer_desc.height,
|
||||
};
|
||||
|
||||
hardware_buffer_map[hardware_buffer] = handle;
|
||||
return handle;
|
||||
@@ -569,8 +576,8 @@ void decoder::supported_codecs(std::vector<wivrn::video_codec> & result)
|
||||
// In order or preference, from preferred to least preferred
|
||||
for (auto codec: {
|
||||
wivrn::video_codec::av1,
|
||||
wivrn::video_codec::h264,
|
||||
wivrn::video_codec::h265,
|
||||
wivrn::video_codec::h264,
|
||||
})
|
||||
{
|
||||
AMediaCodec_ptr media_codec(AMediaCodec_createDecoderByType(mime(codec)));
|
||||
|
||||
@@ -67,7 +67,6 @@ public:
|
||||
|
||||
private:
|
||||
uint8_t stream_index;
|
||||
float fps;
|
||||
|
||||
vk::raii::Device & device;
|
||||
|
||||
@@ -122,8 +121,7 @@ private:
|
||||
public:
|
||||
decoder(vk::raii::Device & device,
|
||||
vk::raii::PhysicalDevice & physical_device,
|
||||
const wivrn::to_headset::video_stream_description::item & description,
|
||||
float fps,
|
||||
const wivrn::to_headset::video_stream_description & description,
|
||||
uint8_t stream_index,
|
||||
std::weak_ptr<scenes::stream> scene,
|
||||
shard_accumulator * accumulator);
|
||||
|
||||
@@ -31,13 +31,12 @@ std::shared_ptr<wivrn::decoder> wivrn::decoder::make(
|
||||
vk::raii::Device & device,
|
||||
vk::raii::PhysicalDevice & phys_dev,
|
||||
uint32_t vk_queue_family_index,
|
||||
const wivrn::to_headset::video_stream_description::item & description,
|
||||
float fps,
|
||||
const wivrn::to_headset::video_stream_description & description,
|
||||
uint8_t stream_index,
|
||||
std::weak_ptr<scenes::stream> scene,
|
||||
shard_accumulator * acc)
|
||||
{
|
||||
switch (description.codec)
|
||||
switch (description.codec[stream_index])
|
||||
{
|
||||
case h264:
|
||||
case h265:
|
||||
@@ -47,7 +46,6 @@ std::shared_ptr<wivrn::decoder> wivrn::decoder::make(
|
||||
device,
|
||||
phys_dev,
|
||||
description,
|
||||
fps,
|
||||
stream_index,
|
||||
scene,
|
||||
acc);
|
||||
@@ -73,14 +71,20 @@ std::shared_ptr<wivrn::decoder> wivrn::decoder::make(
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
std::vector<wivrn::video_codec> wivrn::decoder::supported_codecs()
|
||||
static std::vector<wivrn::video_codec> supported_codecs_()
|
||||
{
|
||||
std::vector<wivrn::video_codec> res;
|
||||
#ifdef __ANDROID__
|
||||
android::decoder::supported_codecs(res);
|
||||
wivrn::android::decoder::supported_codecs(res);
|
||||
#else
|
||||
ffmpeg::decoder::supported_codecs(res);
|
||||
wivrn::ffmpeg::decoder::supported_codecs(res);
|
||||
#endif
|
||||
res.push_back(video_codec::raw);
|
||||
res.push_back(wivrn::video_codec::raw);
|
||||
return res;
|
||||
}
|
||||
|
||||
const std::vector<wivrn::video_codec> & wivrn::decoder::supported_codecs()
|
||||
{
|
||||
static std::vector<wivrn::video_codec> res = supported_codecs_();
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -42,25 +42,18 @@ public:
|
||||
wivrn::to_headset::video_stream_data_shard::view_info_t view_info;
|
||||
vk::ImageView image_view = nullptr;
|
||||
vk::Image image = nullptr;
|
||||
vk::Extent2D extent{};
|
||||
vk::ImageLayout & current_layout;
|
||||
vk::Semaphore semaphore = nullptr;
|
||||
uint64_t * semaphore_val = nullptr;
|
||||
};
|
||||
|
||||
const wivrn::to_headset::video_stream_description::item description;
|
||||
|
||||
protected:
|
||||
decoder(const wivrn::to_headset::video_stream_description::item & description) :
|
||||
description(description) {}
|
||||
vk::Extent2D extent_; // Must be populated when sampler is set
|
||||
|
||||
public:
|
||||
static std::shared_ptr<decoder> make(
|
||||
vk::raii::Device &,
|
||||
vk::raii::PhysicalDevice &,
|
||||
uint32_t vk_queue_family_index,
|
||||
const wivrn::to_headset::video_stream_description::item & description,
|
||||
float fps,
|
||||
const wivrn::to_headset::video_stream_description & description,
|
||||
uint8_t stream_index,
|
||||
std::weak_ptr<scenes::stream>,
|
||||
shard_accumulator *);
|
||||
@@ -72,11 +65,7 @@ public:
|
||||
const to_headset::video_stream_data_shard::view_info_t & view_info) = 0;
|
||||
|
||||
virtual vk::Sampler sampler() = 0;
|
||||
const vk::Extent2D extent()
|
||||
{
|
||||
return extent_;
|
||||
}
|
||||
|
||||
static std::vector<wivrn::video_codec> supported_codecs();
|
||||
static const std::vector<wivrn::video_codec> & supported_codecs();
|
||||
};
|
||||
} // namespace wivrn
|
||||
|
||||
@@ -73,6 +73,7 @@ struct decoder::ffmpeg_blit_handle : public wivrn::decoder::blit_handle
|
||||
const wivrn::to_headset::video_stream_data_shard::view_info_t & view_info,
|
||||
vk::ImageView image_view,
|
||||
vk::Image image,
|
||||
vk::Extent2D extent,
|
||||
vk::ImageLayout & current_layout,
|
||||
int image_index,
|
||||
wivrn::ffmpeg::decoder * self) :
|
||||
@@ -81,6 +82,7 @@ struct decoder::ffmpeg_blit_handle : public wivrn::decoder::blit_handle
|
||||
view_info,
|
||||
image_view,
|
||||
image,
|
||||
extent,
|
||||
current_layout,
|
||||
},
|
||||
image_index(image_index),
|
||||
@@ -100,16 +102,19 @@ struct decoder::ffmpeg_blit_handle : public wivrn::decoder::blit_handle
|
||||
decoder::decoder(
|
||||
vk::raii::Device & device,
|
||||
vk::raii::PhysicalDevice & physical_device,
|
||||
const wivrn::to_headset::video_stream_description::item & description,
|
||||
const wivrn::to_headset::video_stream_description & description,
|
||||
uint8_t stream_index,
|
||||
std::weak_ptr<scenes::stream> scene,
|
||||
shard_accumulator * accumulator) :
|
||||
wivrn::decoder(description),
|
||||
device(device),
|
||||
codec(nullptr, free_codec_context),
|
||||
sws(nullptr, sws_freeContext),
|
||||
weak_scene(scene),
|
||||
accumulator(accumulator)
|
||||
accumulator(accumulator),
|
||||
extent{
|
||||
.width = description.width,
|
||||
.height = description.height / (stream_index == 2 ? 2u : 1u),
|
||||
}
|
||||
{
|
||||
free_images.resize(image_count);
|
||||
|
||||
@@ -121,8 +126,8 @@ decoder::decoder(
|
||||
.imageType = vk::ImageType::e2D,
|
||||
.format = vk::Format::eA8B8G8R8SrgbPack32,
|
||||
.extent = {
|
||||
.width = description.width,
|
||||
.height = description.height,
|
||||
.width = extent.width,
|
||||
.height = extent.height,
|
||||
.depth = 1,
|
||||
},
|
||||
.mipLevels = 1,
|
||||
@@ -139,7 +144,6 @@ decoder::decoder(
|
||||
decoded_images[i].image = image_allocation(device, image_info, alloc_info);
|
||||
|
||||
decoded_images[i].image.map();
|
||||
extent_ = vk::Extent2D{description.width, description.height};
|
||||
|
||||
vk::ImageSubresource resource;
|
||||
resource.aspectMask = vk::ImageAspectFlagBits::eColor;
|
||||
@@ -164,7 +168,7 @@ decoder::decoder(
|
||||
decoded_images[i].current_layout = vk::ImageLayout::eUndefined;
|
||||
}
|
||||
|
||||
auto avcodec = avcodec_find_decoder(codec_id(description.codec));
|
||||
auto avcodec = avcodec_find_decoder(codec_id(description.codec[stream_index]));
|
||||
if (avcodec == nullptr)
|
||||
{
|
||||
throw std::runtime_error{"avcodec_find_decoder failed"};
|
||||
@@ -192,6 +196,8 @@ decoder::decoder(
|
||||
|
||||
void decoder::push_data(std::span<std::span<const uint8_t>> data, uint64_t frame_index, bool partial)
|
||||
{
|
||||
if (frame_index != this->frame_index)
|
||||
packet.clear();
|
||||
for (const auto & d: data)
|
||||
packet.insert(packet.end(), d.begin(), d.end());
|
||||
this->frame_index = frame_index;
|
||||
@@ -231,7 +237,7 @@ void decoder::frame_completed(const wivrn::from_headset::feedback & feedback, co
|
||||
|
||||
if (!sws)
|
||||
{
|
||||
sws.reset(sws_getContext(frame->width, frame->height, (AVPixelFormat)frame->format, description.width, description.height, AV_PIX_FMT_RGB0, SWS_BILINEAR, nullptr, nullptr, nullptr));
|
||||
sws.reset(sws_getContext(frame->width, frame->height, (AVPixelFormat)frame->format, extent.width, extent.height, AV_PIX_FMT_RGB0, SWS_BILINEAR, nullptr, nullptr, nullptr));
|
||||
}
|
||||
|
||||
std::unique_lock lock(mutex);
|
||||
@@ -257,6 +263,7 @@ void decoder::frame_completed(const wivrn::from_headset::feedback & feedback, co
|
||||
view_info,
|
||||
*decoded_images[index].image_view,
|
||||
decoded_images[index].image,
|
||||
extent,
|
||||
decoded_images[index].current_layout,
|
||||
index,
|
||||
this);
|
||||
@@ -267,6 +274,7 @@ void decoder::frame_completed(const wivrn::from_headset::feedback & feedback, co
|
||||
|
||||
void decoder::supported_codecs(std::vector<wivrn::video_codec> & res)
|
||||
{
|
||||
// As long as we do software decoding, prefer faster ones
|
||||
res.push_back(wivrn::video_codec::h264);
|
||||
res.push_back(wivrn::video_codec::h265);
|
||||
res.push_back(wivrn::video_codec::av1);
|
||||
|
||||
@@ -73,13 +73,14 @@ private:
|
||||
uint64_t frame_index;
|
||||
std::weak_ptr<scenes::stream> weak_scene;
|
||||
shard_accumulator * accumulator;
|
||||
const vk::Extent2D extent;
|
||||
|
||||
std::mutex mutex;
|
||||
|
||||
public:
|
||||
decoder(vk::raii::Device & device,
|
||||
vk::raii::PhysicalDevice & physical_device,
|
||||
const wivrn::to_headset::video_stream_description::item & description,
|
||||
const wivrn::to_headset::video_stream_description & description,
|
||||
uint8_t stream_index,
|
||||
std::weak_ptr<scenes::stream> scene,
|
||||
shard_accumulator * accumulator);
|
||||
|
||||
@@ -32,11 +32,12 @@ struct raw_blit_handle : public wivrn::decoder::blit_handle
|
||||
const wivrn::to_headset::video_stream_data_shard::view_info_t & view_info,
|
||||
vk::ImageView image_view,
|
||||
vk::Image image,
|
||||
vk::Extent2D extent,
|
||||
vk::ImageLayout & current_layout,
|
||||
vk::Semaphore semaphore,
|
||||
uint64_t & semaphore_val,
|
||||
std::atomic_bool & free) :
|
||||
wivrn::decoder::blit_handle{feedback, view_info, image_view, image, current_layout, semaphore, &semaphore_val},
|
||||
wivrn::decoder::blit_handle{feedback, view_info, image_view, image, extent, current_layout, semaphore, &semaphore_val},
|
||||
free(free) {}
|
||||
~raw_blit_handle()
|
||||
{
|
||||
@@ -46,8 +47,7 @@ struct raw_blit_handle : public wivrn::decoder::blit_handle
|
||||
|
||||
vk::raii::Sampler make_sampler(
|
||||
vk::raii::Device & device,
|
||||
vk::raii::SamplerYcbcrConversion & ycbcr_conversion,
|
||||
to_headset::video_stream_description::channels_t channels)
|
||||
vk::SamplerYcbcrConversion ycbcr_conversion)
|
||||
{
|
||||
vk::StructureChain info{
|
||||
vk::SamplerCreateInfo{
|
||||
@@ -60,17 +60,11 @@ vk::raii::Sampler make_sampler(
|
||||
.maxAnisotropy = 1,
|
||||
},
|
||||
vk::SamplerYcbcrConversionInfo{
|
||||
.conversion = *ycbcr_conversion,
|
||||
.conversion = ycbcr_conversion,
|
||||
},
|
||||
};
|
||||
switch (channels)
|
||||
{
|
||||
case wivrn::to_headset::video_stream_description::channels_t::colour:
|
||||
break;
|
||||
case wivrn::to_headset::video_stream_description::channels_t::alpha:
|
||||
info.unlink<vk::SamplerYcbcrConversionInfo>();
|
||||
break;
|
||||
}
|
||||
if (ycbcr_conversion == VK_NULL_HANDLE)
|
||||
info.unlink<vk::SamplerYcbcrConversionInfo>();
|
||||
return vk::raii::Sampler(device, info.get());
|
||||
}
|
||||
} // namespace
|
||||
@@ -81,20 +75,18 @@ raw_decoder::raw_decoder(
|
||||
vk::raii::Device & device,
|
||||
vk::raii::PhysicalDevice & physical_device,
|
||||
uint32_t vk_queue_family_index,
|
||||
const wivrn::to_headset::video_stream_description::item & description,
|
||||
const wivrn::to_headset::video_stream_description & description,
|
||||
uint8_t stream_index,
|
||||
std::weak_ptr<scenes::stream> scene,
|
||||
shard_accumulator * accumulator) :
|
||||
decoder(description),
|
||||
device(device),
|
||||
ycbcr_conversion(device,
|
||||
{
|
||||
.format = vk::Format::eG8B8R82Plane420Unorm,
|
||||
.ycbcrModel = vk::SamplerYcbcrModelConversion(description.color_model.value_or(VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709)),
|
||||
.ycbcrRange = vk::SamplerYcbcrRange(description.range.value_or(VK_SAMPLER_YCBCR_RANGE_ITU_FULL)),
|
||||
.chromaFilter = vk::Filter::eNearest,
|
||||
}),
|
||||
sampler_(make_sampler(device, ycbcr_conversion, description.channels)),
|
||||
ycbcr_conversion(stream_index == 2 ? nullptr : vk::raii::SamplerYcbcrConversion(device, {
|
||||
.format = vk::Format::eG8B8R82Plane420Unorm,
|
||||
.ycbcrModel = vk::SamplerYcbcrModelConversion::eYcbcr709,
|
||||
.ycbcrRange = vk::SamplerYcbcrRange::eItuFull,
|
||||
.chromaFilter = vk::Filter::eNearest,
|
||||
})),
|
||||
sampler_(make_sampler(device, *ycbcr_conversion)),
|
||||
command_pool(device, vk::CommandPoolCreateInfo{
|
||||
.flags = vk::CommandPoolCreateFlagBits::eResetCommandBuffer,
|
||||
.queueFamilyIndex = vk_queue_family_index,
|
||||
@@ -105,22 +97,24 @@ raw_decoder::raw_decoder(
|
||||
})[0]
|
||||
.release()),
|
||||
fence(device, vk::FenceCreateInfo{.flags = vk::FenceCreateFlagBits::eSignaled}),
|
||||
stream_index(stream_index),
|
||||
extent{
|
||||
.width = description.width,
|
||||
.height = description.height / (stream_index == 2 ? 2u : 1u),
|
||||
},
|
||||
weak_scene(scene),
|
||||
accumulator(accumulator)
|
||||
{
|
||||
extent_ = vk::Extent2D{
|
||||
.width = description.width,
|
||||
.height = description.height,
|
||||
};
|
||||
vk::DeviceSize buffer_size = description.width * description.height;
|
||||
vk::DeviceSize buffer_size = extent.width * extent.height;
|
||||
vk::Format format{};
|
||||
switch (description.channels)
|
||||
switch (stream_index)
|
||||
{
|
||||
case to_headset::video_stream_description::channels_t::colour:
|
||||
buffer_size += (description.width * description.height) / 2;
|
||||
case 0: // colour left
|
||||
case 1: // colour right
|
||||
buffer_size += buffer_size / 2;
|
||||
format = vk::Format::eG8B8R82Plane420Unorm;
|
||||
break;
|
||||
case to_headset::video_stream_description::channels_t::alpha:
|
||||
case 2: // alpha (monochrome)
|
||||
format = vk::Format::eR8Unorm;
|
||||
break;
|
||||
}
|
||||
@@ -148,8 +142,8 @@ raw_decoder::raw_decoder(
|
||||
.imageType = vk::ImageType::e2D,
|
||||
.format = format,
|
||||
.extent = {
|
||||
.width = description.width,
|
||||
.height = description.height,
|
||||
.width = extent.width,
|
||||
.height = extent.height,
|
||||
.depth = 1,
|
||||
},
|
||||
.mipLevels = 1,
|
||||
@@ -220,6 +214,7 @@ void raw_decoder::frame_completed(
|
||||
view_info,
|
||||
*item->view_full,
|
||||
item->image,
|
||||
extent,
|
||||
item->current_layout,
|
||||
*item->semaphore,
|
||||
item->semaphore_val,
|
||||
@@ -263,20 +258,20 @@ void raw_decoder::frame_completed(
|
||||
.layerCount = 1,
|
||||
},
|
||||
.imageExtent = {
|
||||
.width = description.width,
|
||||
.height = description.height,
|
||||
.width = extent.width,
|
||||
.height = extent.height,
|
||||
.depth = 1,
|
||||
},
|
||||
},
|
||||
vk::BufferImageCopy{
|
||||
.bufferOffset = vk::DeviceSize(description.width * description.height),
|
||||
.bufferOffset = vk::DeviceSize(extent.width * extent.height),
|
||||
.imageSubresource = {
|
||||
.aspectMask = vk::ImageAspectFlagBits::ePlane1,
|
||||
.layerCount = 1,
|
||||
},
|
||||
.imageExtent = {
|
||||
.width = description.width / 2u,
|
||||
.height = description.height / 2u,
|
||||
.width = extent.width / 2u,
|
||||
.height = extent.height / 2u,
|
||||
.depth = 1,
|
||||
},
|
||||
},
|
||||
@@ -286,7 +281,7 @@ void raw_decoder::frame_completed(
|
||||
input[0],
|
||||
item->image,
|
||||
item->current_layout,
|
||||
description.channels == to_headset::video_stream_description::channels_t::colour ? 2 : 1,
|
||||
stream_index < 2 ? 2 : 1,
|
||||
regions.data());
|
||||
|
||||
vk::ImageMemoryBarrier barrier{
|
||||
|
||||
@@ -48,6 +48,9 @@ private:
|
||||
vk::CommandBuffer cmd;
|
||||
vk::raii::Fence fence;
|
||||
|
||||
uint8_t stream_index;
|
||||
const vk::Extent2D extent;
|
||||
|
||||
std::array<image, image_count> image_pool;
|
||||
|
||||
std::weak_ptr<scenes::stream> weak_scene;
|
||||
@@ -57,13 +60,12 @@ private:
|
||||
std::array<buffer_allocation, 2> input;
|
||||
uint8_t * input_pos;
|
||||
from_headset::feedback feedback;
|
||||
to_headset::video_stream_data_shard::view_info_t view_info;
|
||||
|
||||
public:
|
||||
raw_decoder(vk::raii::Device & device,
|
||||
vk::raii::PhysicalDevice & physical_device,
|
||||
uint32_t vk_queue_family_index,
|
||||
const wivrn::to_headset::video_stream_description::item & description,
|
||||
const wivrn::to_headset::video_stream_description & description,
|
||||
uint8_t stream_index,
|
||||
std::weak_ptr<scenes::stream> scene,
|
||||
shard_accumulator * accumulator);
|
||||
@@ -79,14 +81,6 @@ public:
|
||||
return *sampler_;
|
||||
}
|
||||
|
||||
vk::Extent2D image_size()
|
||||
{
|
||||
return {
|
||||
description.width,
|
||||
description.height,
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<wivrn::video_codec> supported_codecs();
|
||||
|
||||
private:
|
||||
|
||||
@@ -55,7 +55,7 @@ static bool is_complete(const shard_set & shards)
|
||||
const auto & frame = shards.data;
|
||||
if (frame.empty())
|
||||
return false;
|
||||
if (not(frame.back() and frame.back()->flags & video_stream_data_shard::end_of_frame))
|
||||
if (not(frame.back() and frame.back()->timing_info))
|
||||
return false;
|
||||
for (const auto & shard: frame)
|
||||
if (not shard)
|
||||
@@ -99,7 +99,7 @@ static void debug_why_not_sent(const shard_set & shards)
|
||||
++missing;
|
||||
}
|
||||
|
||||
bool end = frame.back() and frame.back()->flags & video_stream_data_shard::end_of_frame;
|
||||
bool end = frame.back() and frame.back()->timing_info;
|
||||
spdlog::info("frame {} was not sent with {} data shards, {}{} missing", frame_idx, data, end ? "" : "at least ", missing);
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ void shard_accumulator::try_submit_frame(uint16_t shard_idx)
|
||||
for (size_t idx = shard_idx; idx < last_idx; ++idx)
|
||||
payload.emplace_back(data_shards[idx]->payload);
|
||||
|
||||
bool frame_complete = last_idx == data_shards.size() and data_shards.back()->flags & video_stream_data_shard::end_of_frame;
|
||||
bool frame_complete = last_idx == data_shards.size() and data_shards.back()->timing_info;
|
||||
decoder_->push_data(payload, data_shards[shard_idx]->frame_idx, not frame_complete);
|
||||
|
||||
if (not frame_complete)
|
||||
|
||||
@@ -81,11 +81,10 @@ public:
|
||||
vk::raii::PhysicalDevice & physical_device,
|
||||
xr::instance & instance,
|
||||
uint32_t vk_queue_family_index,
|
||||
const wivrn::to_headset::video_stream_description::item & description,
|
||||
float fps,
|
||||
const wivrn::to_headset::video_stream_description & description,
|
||||
std::weak_ptr<scenes::stream> scene,
|
||||
uint8_t stream_index) :
|
||||
decoder_(decoder::make(device, physical_device, vk_queue_family_index, description, fps, stream_index, scene, this)),
|
||||
decoder_(decoder::make(device, physical_device, vk_queue_family_index, description, stream_index, scene, this)),
|
||||
current(stream_index),
|
||||
next(stream_index),
|
||||
weak_scene(scene),
|
||||
@@ -96,21 +95,11 @@ public:
|
||||
|
||||
void push_shard(wivrn::to_headset::video_stream_data_shard &&);
|
||||
|
||||
auto & desc() const
|
||||
{
|
||||
return decoder_->description;
|
||||
}
|
||||
|
||||
vk::Sampler sampler()
|
||||
{
|
||||
return decoder_->sampler();
|
||||
}
|
||||
|
||||
const vk::Extent2D extent()
|
||||
{
|
||||
return decoder_->extent();
|
||||
}
|
||||
|
||||
using blit_handle = decoder::blit_handle;
|
||||
|
||||
private:
|
||||
|
||||
+21
-16
@@ -43,26 +43,31 @@ std::future<file_picker_result> file_picker::open()
|
||||
open_doc.start([promise](int result_code, intent && data) mutable {
|
||||
try
|
||||
{
|
||||
if (result_code != -1 /* Activity.RESULT_OK */)
|
||||
return;
|
||||
if (result_code == -1 /* Activity.RESULT_OK */)
|
||||
{
|
||||
auto uri = data.get_uri();
|
||||
auto uri_string = (std::string)uri.call<jni::string>("toString");
|
||||
|
||||
auto uri = data.get_uri();
|
||||
auto uri_string = (std::string)uri.call<jni::string>("toString");
|
||||
jni::object<""> activity(application::native_app()->activity->clazz);
|
||||
auto content_resolver = activity.call<jni::object<"android/content/ContentResolver">>("getContentResolver");
|
||||
|
||||
jni::object<""> activity(application::native_app()->activity->clazz);
|
||||
auto content_resolver = activity.call<jni::object<"android/content/ContentResolver">>("getContentResolver");
|
||||
content_resolver.call<void>("takePersistableUriPermission", uri, jni::Int{1} /* Intent.FLAG_GRANT_READ_URI_PERMISSION */);
|
||||
|
||||
content_resolver.call<void>("takePersistableUriPermission", uri, jni::Int{1} /* Intent.FLAG_GRANT_READ_URI_PERMISSION */);
|
||||
auto pfd = content_resolver.call<jni::object<"android/os/ParcelFileDescriptor">>("openFileDescriptor", uri, jni::string{"r"});
|
||||
int fd = pfd.call<int>("getFd");
|
||||
|
||||
auto pfd = content_resolver.call<jni::object<"android/os/ParcelFileDescriptor">>("openFileDescriptor", uri, jni::string{"r"});
|
||||
int fd = pfd.call<int>("getFd");
|
||||
|
||||
// The file descriptor is owned by the ParcelFileDescriptor, dup it before
|
||||
// passing it to mapped_file to ensure the original fd is not closed
|
||||
promise->set_value(file_picker_result{
|
||||
.path = uri_string,
|
||||
.file = utils::mapped_file{fd},
|
||||
});
|
||||
// The file descriptor is owned by the ParcelFileDescriptor, dup it before
|
||||
// passing it to mapped_file to ensure the original fd is not closed
|
||||
promise->set_value({
|
||||
.accepted = true,
|
||||
.path = uri_string,
|
||||
.file = utils::mapped_file{fd},
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
promise->set_value({.accepted = false});
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
||||
@@ -23,8 +23,14 @@
|
||||
|
||||
struct file_picker_result
|
||||
{
|
||||
bool accepted = false;
|
||||
std::filesystem::path path;
|
||||
utils::mapped_file file;
|
||||
|
||||
operator bool() const
|
||||
{
|
||||
return accepted;
|
||||
}
|
||||
};
|
||||
|
||||
class file_picker
|
||||
|
||||
@@ -1,411 +0,0 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2023 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
* Copyright (C) 2023 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "hardware.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <glm/ext/quaternion_trigonometric.hpp>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "utils/wrap_lambda.h"
|
||||
|
||||
#include <sys/system_properties.h>
|
||||
|
||||
static std::string get_property(const char * property)
|
||||
{
|
||||
auto info = __system_property_find(property);
|
||||
std::string result;
|
||||
wrap_lambda cb = [&result](const char * name, const char * value, uint32_t serial) {
|
||||
result = value;
|
||||
};
|
||||
|
||||
__system_property_read_callback(info, cb.userdata_first(), cb);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
static model guess_model_()
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
const auto device = get_property("ro.product.device");
|
||||
const auto manufacturer = get_property("ro.product.manufacturer");
|
||||
const auto model = get_property("ro.product.model");
|
||||
|
||||
spdlog::info("Guessing HMD model from:");
|
||||
spdlog::info(" ro.product.device = \"{}\":", device);
|
||||
spdlog::info(" ro.product.manufacturer = \"{}\":", manufacturer);
|
||||
spdlog::info(" ro.product.model = \"{}\":", model);
|
||||
|
||||
if (device == "monterey")
|
||||
return model::oculus_quest;
|
||||
if (device == "hollywood")
|
||||
return model::oculus_quest_2;
|
||||
if (device == "seacliff")
|
||||
return model::meta_quest_pro;
|
||||
if (device == "eureka")
|
||||
return model::meta_quest_3;
|
||||
if (device == "panther")
|
||||
return model::meta_quest_3s;
|
||||
if (model == "Lynx-R1")
|
||||
return model::lynx_r1;
|
||||
|
||||
if (manufacturer == "Pico")
|
||||
{
|
||||
const auto pico_model = get_property("pxr.vendorhw.product.model");
|
||||
spdlog::info(" pxr.vendorhw.product.model = \"{}\":", pico_model);
|
||||
|
||||
if (pico_model == "Pico Neo 3")
|
||||
return model::pico_neo_3;
|
||||
|
||||
if (pico_model == "PICO 4")
|
||||
return model::pico_4;
|
||||
|
||||
if (pico_model == "PICO 4 Ultra")
|
||||
return model::pico_4s;
|
||||
|
||||
if (pico_model == "PICO 4 Pro")
|
||||
return model::pico_4_pro;
|
||||
|
||||
if (pico_model == "PICO 4 Enterprise")
|
||||
return model::pico_4_enterprise;
|
||||
|
||||
spdlog::info("manufacturer={}, model={}, device={}, pico_model={} assuming Pico 4", manufacturer, model, device, pico_model);
|
||||
return model::pico_4;
|
||||
}
|
||||
if (manufacturer == "HTC")
|
||||
{
|
||||
if (model == "VIVE Focus 3")
|
||||
return model::htc_vive_focus_3;
|
||||
|
||||
if (model == "VIVE Focus Vision")
|
||||
return model::htc_vive_focus_vision;
|
||||
|
||||
if (model == "VIVE XR Series")
|
||||
return model::htc_vive_xr_elite;
|
||||
}
|
||||
|
||||
spdlog::info("Unknown model, manufacturer={}, model={}, device={}", manufacturer, model, device);
|
||||
#endif
|
||||
return model::unknown;
|
||||
}
|
||||
|
||||
model guess_model()
|
||||
{
|
||||
static model m = guess_model_();
|
||||
return m;
|
||||
}
|
||||
|
||||
std::string model_name()
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
const auto manufacturer = get_property("ro.product.manufacturer");
|
||||
const auto model = get_property("ro.product.model");
|
||||
|
||||
return manufacturer + " " + model;
|
||||
#else
|
||||
return "Unknown headset";
|
||||
#endif
|
||||
}
|
||||
|
||||
static XrViewConfigurationView scale_view(XrViewConfigurationView view, uint32_t width)
|
||||
{
|
||||
double ratio = double(width) / view.recommendedImageRectWidth;
|
||||
view.recommendedImageRectWidth = width;
|
||||
view.recommendedImageRectHeight *= ratio;
|
||||
spdlog::info("Using panel size: {}x{}", view.recommendedImageRectWidth, view.recommendedImageRectHeight);
|
||||
return view;
|
||||
}
|
||||
|
||||
XrViewConfigurationView override_view(XrViewConfigurationView view, model m)
|
||||
{
|
||||
// Standalone headsets tend to report a lower resolution
|
||||
// as the GPU can't handle full res.
|
||||
// Return the panel resolution instead.
|
||||
spdlog::debug("Recommended image size: {}x{}", view.recommendedImageRectWidth, view.recommendedImageRectHeight);
|
||||
switch (m)
|
||||
{
|
||||
case model::oculus_quest:
|
||||
return scale_view(view, 1440);
|
||||
case model::oculus_quest_2:
|
||||
case model::meta_quest_3s:
|
||||
return scale_view(view, 1832);
|
||||
case model::meta_quest_pro:
|
||||
return scale_view(view, 1800);
|
||||
case model::meta_quest_3:
|
||||
return scale_view(view, 2064);
|
||||
case model::pico_neo_3:
|
||||
return scale_view(view, 1832);
|
||||
case model::pico_4:
|
||||
case model::pico_4s:
|
||||
case model::pico_4_pro:
|
||||
case model::pico_4_enterprise:
|
||||
return scale_view(view, 2160);
|
||||
case model::htc_vive_focus_3:
|
||||
case model::htc_vive_focus_vision:
|
||||
return scale_view(view, 2448);
|
||||
case model::htc_vive_xr_elite:
|
||||
return scale_view(view, 1920);
|
||||
case model::lynx_r1:
|
||||
case model::unknown:
|
||||
return view;
|
||||
}
|
||||
throw std::range_error("invalid model " + std::to_string((int)m));
|
||||
}
|
||||
|
||||
bool need_srgb_conversion(model m)
|
||||
{
|
||||
switch (m)
|
||||
{
|
||||
case model::lynx_r1:
|
||||
return false;
|
||||
case model::oculus_quest:
|
||||
case model::oculus_quest_2:
|
||||
case model::meta_quest_pro:
|
||||
case model::meta_quest_3:
|
||||
case model::meta_quest_3s:
|
||||
case model::pico_neo_3:
|
||||
case model::pico_4:
|
||||
case model::pico_4s:
|
||||
case model::pico_4_pro:
|
||||
case model::pico_4_enterprise:
|
||||
case model::htc_vive_focus_3:
|
||||
case model::htc_vive_focus_vision:
|
||||
case model::htc_vive_xr_elite:
|
||||
case model::unknown:
|
||||
return true;
|
||||
}
|
||||
throw std::range_error("invalid model " + std::to_string((int)m));
|
||||
}
|
||||
|
||||
const char * permission_name(feature f)
|
||||
{
|
||||
switch (f)
|
||||
{
|
||||
case feature::microphone:
|
||||
return "android.permission.RECORD_AUDIO";
|
||||
case feature::hand_tracking:
|
||||
return nullptr;
|
||||
case feature::eye_gaze:
|
||||
switch (guess_model())
|
||||
{
|
||||
case model::oculus_quest:
|
||||
case model::oculus_quest_2:
|
||||
case model::meta_quest_pro:
|
||||
case model::meta_quest_3:
|
||||
case model::meta_quest_3s:
|
||||
return "com.oculus.permission.EYE_TRACKING";
|
||||
case model::pico_neo_3:
|
||||
case model::pico_4:
|
||||
case model::pico_4s:
|
||||
case model::pico_4_pro:
|
||||
case model::pico_4_enterprise:
|
||||
return "com.picovr.permission.EYE_TRACKING";
|
||||
case model::htc_vive_focus_3:
|
||||
case model::htc_vive_focus_vision:
|
||||
case model::htc_vive_xr_elite:
|
||||
case model::lynx_r1:
|
||||
case model::unknown:
|
||||
return nullptr;
|
||||
}
|
||||
__builtin_unreachable();
|
||||
case feature::face_tracking:
|
||||
switch (guess_model())
|
||||
{
|
||||
case model::oculus_quest:
|
||||
case model::oculus_quest_2:
|
||||
case model::meta_quest_pro:
|
||||
case model::meta_quest_3:
|
||||
case model::meta_quest_3s:
|
||||
return "com.oculus.permission.FACE_TRACKING";
|
||||
case model::pico_neo_3:
|
||||
case model::pico_4:
|
||||
case model::pico_4s:
|
||||
case model::pico_4_pro:
|
||||
case model::pico_4_enterprise:
|
||||
return "com.picovr.permission.FACE_TRACKING";
|
||||
case model::htc_vive_focus_3:
|
||||
case model::htc_vive_focus_vision:
|
||||
case model::htc_vive_xr_elite:
|
||||
case model::lynx_r1:
|
||||
case model::unknown:
|
||||
return nullptr;
|
||||
}
|
||||
__builtin_unreachable();
|
||||
case feature::body_tracking:
|
||||
switch (guess_model())
|
||||
{
|
||||
case model::meta_quest_3:
|
||||
case model::meta_quest_3s:
|
||||
return "com.oculus.permission.BODY_TRACKING";
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
std::string controller_name()
|
||||
{
|
||||
#ifndef __ANDROID__
|
||||
const char * controller = std::getenv("WIVRN_CONTROLLER");
|
||||
if (controller && strcmp(controller, ""))
|
||||
return controller;
|
||||
#endif
|
||||
|
||||
switch (guess_model())
|
||||
{
|
||||
case model::oculus_quest:
|
||||
return "oculus-touch-v2";
|
||||
case model::oculus_quest_2:
|
||||
return "oculus-touch-v3";
|
||||
case model::meta_quest_pro:
|
||||
return "meta-quest-touch-pro";
|
||||
case model::meta_quest_3:
|
||||
case model::meta_quest_3s:
|
||||
return "meta-quest-touch-plus";
|
||||
case model::pico_neo_3:
|
||||
return "pico-neo3";
|
||||
case model::pico_4:
|
||||
case model::pico_4s: // TODO: split when we have the pico-4s 3d model
|
||||
case model::pico_4_pro:
|
||||
case model::pico_4_enterprise:
|
||||
return "pico-4";
|
||||
case model::htc_vive_focus_3:
|
||||
case model::htc_vive_focus_vision:
|
||||
case model::htc_vive_xr_elite:
|
||||
return "htc-vive-focus-3";
|
||||
case model::lynx_r1:
|
||||
case model::unknown:
|
||||
return "generic-trigger-squeeze";
|
||||
}
|
||||
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
std::pair<glm::vec3, glm::quat> controller_offset(std::string_view profile, xr::spaces space)
|
||||
{
|
||||
#ifndef __ANDROID__
|
||||
if (const char * offset = [space]() -> const char * {
|
||||
switch (space)
|
||||
{
|
||||
case xr::spaces::grip_left:
|
||||
return std::getenv("WIVRN_GRIP_LEFT_OFFSET");
|
||||
case xr::spaces::grip_right:
|
||||
return std::getenv("WIVRN_GRIP_RIGHT_OFFSET");
|
||||
case xr::spaces::aim_left:
|
||||
return std::getenv("WIVRN_AIM_LEFT_OFFSET");
|
||||
case xr::spaces::aim_right:
|
||||
return std::getenv("WIVRN_AIM_RIGHT_OFFSET");
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}())
|
||||
{
|
||||
float x, y, z, yaw, pitch, roll;
|
||||
if (sscanf(offset, "%f %f %f %f %f %f", &x, &y, &z, &yaw, &pitch, &roll) == 6)
|
||||
{
|
||||
return {{x, y, z},
|
||||
glm::angleAxis(glm::radians(yaw), glm::vec3{0, 1, 0}) *
|
||||
glm::angleAxis(glm::radians(pitch), glm::vec3{1, 0, 0}) *
|
||||
glm::angleAxis(glm::radians(roll), glm::vec3{0, 0, 1})};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (profile == "oculus-touch-v2")
|
||||
switch (space)
|
||||
{
|
||||
case xr::spaces::grip_left:
|
||||
case xr::spaces::grip_right:
|
||||
return {{0, -0.006, -0.025}, glm::angleAxis(glm::radians(-15.f), glm::vec3{1, 0, 0})};
|
||||
|
||||
case xr::spaces::aim_left:
|
||||
return {{-0.010, 0, 0.025}, {1, 0, 0, 0}};
|
||||
|
||||
case xr::spaces::aim_right:
|
||||
return {{0.010, 0, 0.025}, {1, 0, 0, 0}};
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
else if (profile == "meta-quest-touch-plus")
|
||||
{
|
||||
switch (space)
|
||||
{
|
||||
case xr::spaces::grip_left:
|
||||
case xr::spaces::grip_right:
|
||||
return {{0, -0.010, -0.025}, glm::angleAxis(glm::radians(-12.f), glm::vec3{1, 0, 0})};
|
||||
|
||||
case xr::spaces::aim_left:
|
||||
return {{0, 0, 0.03}, {1, 0, 0, 0}};
|
||||
|
||||
case xr::spaces::aim_right:
|
||||
return {{0, 0, 0.03}, {1, 0, 0, 0}};
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (profile == "htc-vive-focus-3")
|
||||
switch (space)
|
||||
{
|
||||
case xr::spaces::grip_left:
|
||||
case xr::spaces::grip_right:
|
||||
return {{0, 0.007, -0.030}, {1, 0, 0, 0}};
|
||||
|
||||
case xr::spaces::aim_left:
|
||||
case xr::spaces::aim_right:
|
||||
return {{0, -0.025, 0.005}, {1, 0, 0, 0}};
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
else if (profile == "pico-4" || profile == "pico-4s")
|
||||
switch (space)
|
||||
{
|
||||
case xr::spaces::grip_left:
|
||||
case xr::spaces::grip_right:
|
||||
return {{0, -0.014, -0.048}, glm::angleAxis(glm::radians(-35.060f), glm::vec3{1, 0, 0})};
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return {{0, 0, 0}, {1, 0, 0, 0}};
|
||||
}
|
||||
|
||||
std::string controller_ray_model_name()
|
||||
{
|
||||
switch (guess_model())
|
||||
{
|
||||
case model::htc_vive_focus_3:
|
||||
case model::htc_vive_focus_vision:
|
||||
case model::htc_vive_xr_elite:
|
||||
// XR Elite's runtime always assume alpha is unpremultiplied in the composition layers
|
||||
// Assume it's the same for all HTC headsets
|
||||
return "assets://ray-htc.glb";
|
||||
|
||||
default:
|
||||
return "assets://ray.glb";
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2023 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
* Copyright (C) 2023 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "xr/space.h"
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
enum class model
|
||||
{
|
||||
oculus_quest,
|
||||
oculus_quest_2,
|
||||
meta_quest_pro,
|
||||
meta_quest_3,
|
||||
meta_quest_3s,
|
||||
pico_neo_3,
|
||||
pico_4,
|
||||
pico_4s,
|
||||
pico_4_pro,
|
||||
pico_4_enterprise,
|
||||
htc_vive_focus_3,
|
||||
htc_vive_xr_elite,
|
||||
htc_vive_focus_vision,
|
||||
lynx_r1,
|
||||
unknown
|
||||
};
|
||||
|
||||
enum class feature
|
||||
{
|
||||
microphone,
|
||||
hand_tracking,
|
||||
eye_gaze,
|
||||
face_tracking,
|
||||
body_tracking,
|
||||
};
|
||||
|
||||
model guess_model();
|
||||
std::string model_name();
|
||||
|
||||
XrViewConfigurationView override_view(XrViewConfigurationView, model = guess_model());
|
||||
|
||||
bool need_srgb_conversion(model);
|
||||
|
||||
// Return nullptr if no permission is required
|
||||
const char * permission_name(feature f);
|
||||
|
||||
std::string controller_name();
|
||||
std::string controller_ray_model_name();
|
||||
std::pair<glm::vec3, glm::quat> controller_offset(std::string_view profile, xr::spaces space);
|
||||
@@ -0,0 +1,608 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2023 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
* Copyright (C) 2023 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "hmd_traits.h"
|
||||
|
||||
#include "utils/overloaded.h"
|
||||
#include "utils/strings.h"
|
||||
#include "xr/to_string.h"
|
||||
|
||||
#include <boost/pfr.hpp>
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <format>
|
||||
#include <glm/ext/quaternion_trigonometric.hpp>
|
||||
#include <limits>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "utils/wrap_lambda.h"
|
||||
|
||||
#include <sys/system_properties.h>
|
||||
|
||||
static std::optional<std::string> get_property(const char * property)
|
||||
{
|
||||
auto info = __system_property_find(property);
|
||||
if (not info)
|
||||
return std::nullopt;
|
||||
|
||||
std::string result;
|
||||
wrap_lambda cb = [&result](const char * name, const char * value, uint32_t serial) {
|
||||
result = value;
|
||||
};
|
||||
|
||||
__system_property_read_callback(info, cb.userdata_first(), cb);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
std::optional<T> env(std::string_view name);
|
||||
|
||||
template <>
|
||||
std::optional<std::string> env(std::string_view name)
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
auto android_sysprop_name = std::format("debug.wivrn.{}", name);
|
||||
return get_property(android_sysprop_name.c_str());
|
||||
#else
|
||||
std::string env_name = "WIVRN_";
|
||||
env_name.reserve(env_name.size() + name.size());
|
||||
for (const auto & c: name)
|
||||
env_name += std::toupper(c);
|
||||
const char * value = std::getenv(env_name.c_str());
|
||||
if (value)
|
||||
return value;
|
||||
return std::nullopt;
|
||||
#endif
|
||||
}
|
||||
|
||||
template <>
|
||||
std::optional<uint32_t> env(std::string_view name)
|
||||
{
|
||||
const auto value = env<std::string>(name);
|
||||
if (not value)
|
||||
return std::nullopt;
|
||||
try
|
||||
{
|
||||
const unsigned long parsed = std::stoul(*value);
|
||||
if (parsed > std::numeric_limits<uint32_t>::max())
|
||||
return std::nullopt;
|
||||
return static_cast<uint32_t>(parsed);
|
||||
}
|
||||
catch (std::runtime_error & e)
|
||||
{
|
||||
spdlog::warn("failed to parse {} (value: {}: {}", name, *value, e.what());
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
std::optional<bool> env(std::string_view name)
|
||||
{
|
||||
const auto value = env<std::string>(name);
|
||||
if (not value)
|
||||
return std::nullopt;
|
||||
if (strcmp(value->c_str(), "1") == 0 || strcasecmp(value->c_str(), "true") == 0 || strcasecmp(value->c_str(), "yes") == 0 || strcasecmp(value->c_str(), "on") == 0)
|
||||
return true;
|
||||
if (strcmp(value->c_str(), "0") == 0 || strcasecmp(value->c_str(), "false") == 0 || strcasecmp(value->c_str(), "no") == 0 || strcasecmp(value->c_str(), "off") == 0)
|
||||
return false;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
template <>
|
||||
std::optional<std::unordered_map<std::string, std::string>> env(std::string_view name)
|
||||
{
|
||||
const auto values = env<std::string>(name);
|
||||
if (not values)
|
||||
return std::nullopt;
|
||||
|
||||
std::unordered_map<std::string, std::string> map;
|
||||
for (auto value: utils::split(*values, ","))
|
||||
{
|
||||
if (auto pos = value.find('='); pos != std::string::npos)
|
||||
map.insert(std::make_pair(value.substr(0, pos), value.substr(pos + 1)));
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
template <>
|
||||
std::optional<std::unordered_set<std::string>> env(std::string_view name)
|
||||
{
|
||||
const auto values = env<std::string>(name);
|
||||
if (not values)
|
||||
return std::nullopt;
|
||||
|
||||
return std::unordered_set<std::string>{std::from_range, utils::split(*values, ",")};
|
||||
}
|
||||
|
||||
void hmd_traits::init()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
assert(not initialized_);
|
||||
initialized_ = true;
|
||||
#endif
|
||||
#ifdef __ANDROID__
|
||||
const auto device = get_property("ro.product.device");
|
||||
const auto manufacturer = get_property("ro.product.manufacturer");
|
||||
const auto model = get_property("ro.product.model");
|
||||
|
||||
spdlog::info("Guessing HMD model from:");
|
||||
spdlog::info(" ro.product.device = \"{}\":", device.value_or("<unset>"));
|
||||
spdlog::info(" ro.product.manufacturer = \"{}\":", manufacturer.value_or("<unset>"));
|
||||
spdlog::info(" ro.product.model = \"{}\":", model.value_or("<unset>"));
|
||||
|
||||
permissions[feature::microphone] = "android.permission.RECORD_AUDIO";
|
||||
|
||||
if (manufacturer == "Oculus")
|
||||
{
|
||||
permissions[feature::eye_gaze] = "com.oculus.permission.EYE_TRACKING";
|
||||
permissions[feature::face_tracking] = "com.oculus.permission.FACE_TRACKING";
|
||||
|
||||
// Quest hand tracking creates a fake khr/simple_controller when hand tracking
|
||||
// is enabled, this messes with native hand tracking
|
||||
bind_simple_controller = false;
|
||||
|
||||
// Quest breaks spec and does not support grip_surface for ext/hand_interaction_ext
|
||||
hand_interaction_grip_surface = false;
|
||||
|
||||
if (device == "monterey") // Quest 1
|
||||
{
|
||||
panel_width_override = 1440;
|
||||
controller_profile = "oculus-touch-v2";
|
||||
vk_debug_ext_allowed = false; // Quest 1 lies, the extension won't load
|
||||
}
|
||||
else if (device == "hollywood") // Quest 2
|
||||
{
|
||||
panel_width_override = 1832;
|
||||
controller_profile = "oculus-touch-v3";
|
||||
}
|
||||
else if (device == "seacliff")
|
||||
{
|
||||
panel_width_override = 1800; // Quest pro
|
||||
controller_profile = "meta-quest-touch-pro";
|
||||
}
|
||||
else if (device == "eureka")
|
||||
{
|
||||
panel_width_override = 2064; // Quest 3
|
||||
controller_profile = "meta-quest-touch-plus";
|
||||
usb_net = true;
|
||||
}
|
||||
else if (device == "panther") // Quest 3S
|
||||
{
|
||||
panel_width_override = 1832;
|
||||
controller_profile = "meta-quest-touch-plus";
|
||||
}
|
||||
|
||||
if (auto v = get_property("ro.hzos.build.display_name"))
|
||||
{
|
||||
auto digits = utils::split(*v, ".");
|
||||
try
|
||||
{
|
||||
auto major = std::stoi(digits.at(0));
|
||||
auto minor = std::stoi(digits.at(1));
|
||||
usb_net = major > 2 or (major == 2 and minor >= 6);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
spdlog::warn("Failed to parse Horizon OS version {}", *v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (model == "Lynx-R1")
|
||||
{
|
||||
needs_srgb_conversion = false;
|
||||
}
|
||||
|
||||
else if (manufacturer == "Play For Dream" and model == "PFDM MR")
|
||||
{
|
||||
controller_profile = "yvr-touch-v2";
|
||||
}
|
||||
|
||||
else if (manufacturer == "Pico")
|
||||
{
|
||||
permissions[feature::eye_gaze] = "com.picovr.permission.EYE_TRACKING";
|
||||
permissions[feature::face_tracking] = "com.picovr.permission.FACE_TRACKING";
|
||||
view_locate = false;
|
||||
discard_frame = false;
|
||||
const auto pico_model = get_property("pxr.vendorhw.product.model");
|
||||
spdlog::info(" pxr.vendorhw.product.model = \"{}\":", pico_model.value_or("<unset>"));
|
||||
|
||||
if (pico_model == "Pico Neo 3")
|
||||
{
|
||||
panel_width_override = 1832;
|
||||
controller_profile = "pico-neo3";
|
||||
}
|
||||
|
||||
else if (pico_model and pico_model->starts_with("PICO 4"))
|
||||
{
|
||||
panel_width_override = 2160;
|
||||
if (pico_model == "PICO 4 Ultra")
|
||||
controller_profile = "pico-4u";
|
||||
else
|
||||
controller_profile = "pico-4";
|
||||
|
||||
if (pico_model == "PICO 4 Pro" or pico_model == "PICO 4 Enterprise")
|
||||
pico_face_tracker = true;
|
||||
}
|
||||
}
|
||||
if (manufacturer == "HTC")
|
||||
{
|
||||
// Accepts OpenXR 1.1 but doesn't actually implement it
|
||||
max_openxr_api_version = XR_API_VERSION_1_0;
|
||||
|
||||
// Doesn't handle additive blend, so needs specific ray model
|
||||
// Fixed in XR elite firmware version 2.0
|
||||
bool need_htc_ray = true;
|
||||
const auto version = get_property("ro.product.version");
|
||||
if (version)
|
||||
{
|
||||
auto digits = utils::split(*version, ".");
|
||||
if (not digits.empty())
|
||||
{
|
||||
try
|
||||
{
|
||||
auto major = std::stoi(digits[0]);
|
||||
if (major >= 2 and model == "VIVE XR Series")
|
||||
need_htc_ray = false;
|
||||
}
|
||||
catch (...)
|
||||
{}
|
||||
}
|
||||
}
|
||||
if (need_htc_ray)
|
||||
override_shader = {
|
||||
{"ray.frag", "ray_htc.frag"},
|
||||
{"ray_skinned.vert", "ray_skinned_htc.vert"},
|
||||
{"ray.vert", "ray_htc.vert"},
|
||||
};
|
||||
|
||||
controller_profile = "htc-vive-focus-3";
|
||||
|
||||
if (model == "VIVE Focus 3")
|
||||
{
|
||||
panel_width_override = 2448;
|
||||
|
||||
// Reports VK_EXT_debug_utils but does not expose vkSetDebugUtilsObjectNameEXT
|
||||
vk_debug_ext_allowed = false;
|
||||
}
|
||||
|
||||
if (model == "VIVE Focus Vision")
|
||||
panel_width_override = 2448;
|
||||
|
||||
if (model == "VIVE XR Series")
|
||||
panel_width_override = 1920;
|
||||
}
|
||||
if (manufacturer == "samsung")
|
||||
{
|
||||
if (model == "SM-I610") // Galaxy XR
|
||||
{
|
||||
panel_width_override = 3552;
|
||||
controller_profile = "samsung-galaxyxr";
|
||||
permissions[feature::hand_tracking] = "android.permission.HAND_TRACKING";
|
||||
permissions[feature::eye_gaze] = "android.permission.EYE_TRACKING_FINE";
|
||||
permissions[feature::face_tracking] = "android.permission.FACE_TRACKING";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
spdlog::info("HMD traits initialized");
|
||||
|
||||
boost::pfr::for_each_field_with_name(
|
||||
*this,
|
||||
utils::overloaded{
|
||||
[](std::string_view name, auto & field) {
|
||||
if (auto val = env<std::remove_cvref_t<decltype(field)>>(name))
|
||||
{
|
||||
spdlog::info("\t{} override: {} -> {}", name, field, *val);
|
||||
field = *val;
|
||||
}
|
||||
else
|
||||
{
|
||||
spdlog::info("\t{}: {}", name, field);
|
||||
}
|
||||
},
|
||||
[](std::string_view name, XrVersion & field) {
|
||||
if (auto val = env<std::string>(name))
|
||||
{
|
||||
XrVersion v;
|
||||
if (val == "1.1")
|
||||
v = XR_API_VERSION_1_1;
|
||||
else if (val == "1.0")
|
||||
v = XR_API_VERSION_1_0;
|
||||
else
|
||||
{
|
||||
spdlog::warn("XrVersion {} not recognized", *val);
|
||||
v = field;
|
||||
}
|
||||
spdlog::info("\t{} override: {} -> {}", name, xr::to_string(field), xr::to_string(v));
|
||||
field = v;
|
||||
}
|
||||
else
|
||||
{
|
||||
spdlog::info("\t{}: {}", name, xr::to_string(field));
|
||||
}
|
||||
},
|
||||
[](std::string_view name, std::unordered_map<std::string, std::string> & field) {
|
||||
if (auto val = env<std::unordered_map<std::string, std::string>>(name))
|
||||
{
|
||||
for (const auto & [original, overridden]: *val)
|
||||
field.insert_or_assign(original, overridden);
|
||||
}
|
||||
std::erase_if(field, [](const std::pair<std::string, std::string> & kv) { return kv.second == ""; });
|
||||
|
||||
for (const auto & [original, overridden]: field)
|
||||
{
|
||||
spdlog::info("\t{}: {} -> {}", name, original, overridden);
|
||||
}
|
||||
},
|
||||
|
||||
[](std::string_view name, std::unordered_set<std::string> & field) {
|
||||
if (auto val = env<std::unordered_set<std::string>>(name))
|
||||
{
|
||||
for (const auto & i: *val)
|
||||
{
|
||||
if (i.starts_with("-"))
|
||||
field.erase(i.substr(1));
|
||||
else
|
||||
field.insert(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto & i: field)
|
||||
{
|
||||
spdlog::info("\t{}: {}", name, i);
|
||||
}
|
||||
},
|
||||
[](std::string_view, hmd_permissions) {},
|
||||
});
|
||||
}
|
||||
|
||||
static XrViewConfigurationView scale_view(XrViewConfigurationView view, uint32_t width)
|
||||
{
|
||||
double ratio = double(width) / view.recommendedImageRectWidth;
|
||||
view.recommendedImageRectWidth = width;
|
||||
view.recommendedImageRectHeight *= ratio;
|
||||
spdlog::info("Using panel size: {}x{}", view.recommendedImageRectWidth, view.recommendedImageRectHeight);
|
||||
return view;
|
||||
}
|
||||
|
||||
std::string hmd_traits::model_name() const
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
const auto manufacturer = get_property("ro.product.manufacturer").value_or("");
|
||||
const auto model = get_property("ro.product.model").value_or("");
|
||||
|
||||
return manufacturer + " " + model;
|
||||
#else
|
||||
return "Unknown headset";
|
||||
#endif
|
||||
}
|
||||
|
||||
XrViewConfigurationView hmd_traits::override_view(XrViewConfigurationView view) const
|
||||
{
|
||||
// Standalone headsets tend to report a lower resolution
|
||||
// as the GPU can't handle full res.
|
||||
// Return the panel resolution instead.
|
||||
spdlog::debug("Recommended image size: {}x{}", view.recommendedImageRectWidth, view.recommendedImageRectHeight);
|
||||
if (panel_width_override > 0)
|
||||
return scale_view(view, panel_width_override);
|
||||
return view;
|
||||
}
|
||||
|
||||
std::pair<glm::vec3, glm::quat> hmd_traits::controller_offset(xr::spaces space) const
|
||||
{
|
||||
#ifndef __ANDROID__
|
||||
if (const char * offset = [space]() -> const char * {
|
||||
switch (space)
|
||||
{
|
||||
case xr::spaces::grip_left:
|
||||
return std::getenv("WIVRN_GRIP_LEFT_OFFSET");
|
||||
case xr::spaces::grip_right:
|
||||
return std::getenv("WIVRN_GRIP_RIGHT_OFFSET");
|
||||
case xr::spaces::aim_left:
|
||||
return std::getenv("WIVRN_AIM_LEFT_OFFSET");
|
||||
case xr::spaces::aim_right:
|
||||
return std::getenv("WIVRN_AIM_RIGHT_OFFSET");
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}())
|
||||
{
|
||||
float x, y, z, yaw, pitch, roll;
|
||||
if (sscanf(offset, "%f %f %f %f %f %f", &x, &y, &z, &yaw, &pitch, &roll) == 6)
|
||||
{
|
||||
return {{x, y, z},
|
||||
glm::angleAxis(glm::radians(yaw), glm::vec3{0, 1, 0}) *
|
||||
glm::angleAxis(glm::radians(pitch), glm::vec3{1, 0, 0}) *
|
||||
glm::angleAxis(glm::radians(roll), glm::vec3{0, 0, 1})};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
std::string_view profile = controller_profile;
|
||||
|
||||
if (profile == "oculus-touch-v2")
|
||||
switch (space)
|
||||
{
|
||||
case xr::spaces::grip_left:
|
||||
case xr::spaces::grip_right:
|
||||
return {{0, -0.006, -0.025}, glm::angleAxis(glm::radians(-15.f), glm::vec3{1, 0, 0})};
|
||||
|
||||
case xr::spaces::aim_left:
|
||||
return {{-0.010, 0, 0.02}, {1, 0, 0, 0}};
|
||||
|
||||
case xr::spaces::aim_right:
|
||||
return {{0.010, 0, 0.02}, {1, 0, 0, 0}};
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
else if (profile == "meta-quest-touch-plus")
|
||||
{
|
||||
switch (space)
|
||||
{
|
||||
case xr::spaces::grip_left:
|
||||
case xr::spaces::grip_right:
|
||||
return {{0, -0.006, -0.025}, glm::angleAxis(glm::radians(-14.f), glm::vec3{1, 0, 0})};
|
||||
|
||||
case xr::spaces::aim_left:
|
||||
return {{-0.010, 0, 0.02}, {1, 0, 0, 0}};
|
||||
|
||||
case xr::spaces::aim_right:
|
||||
return {{0.010, 0, 0.02}, {1, 0, 0, 0}};
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (profile == "meta-quest-touch-pro")
|
||||
{
|
||||
switch (space)
|
||||
{
|
||||
case xr::spaces::grip_left:
|
||||
case xr::spaces::grip_right:
|
||||
return {{0, 0, 0}, glm::angleAxis(glm::radians(-20.f), glm::vec3{1, 0, 0})};
|
||||
|
||||
case xr::spaces::aim_left:
|
||||
return {{0, 0, 0}, {1, 0, 0, 0}};
|
||||
|
||||
case xr::spaces::aim_right:
|
||||
return {{0, 0, 0}, {1, 0, 0, 0}};
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (profile == "oculus-touch-v3")
|
||||
{
|
||||
switch (space)
|
||||
{
|
||||
case xr::spaces::grip_left:
|
||||
case xr::spaces::grip_right:
|
||||
return {{0, -0.003, -0.047}, glm::angleAxis(glm::radians(-20.f), glm::vec3{1, 0, 0})};
|
||||
|
||||
case xr::spaces::aim_left:
|
||||
return {{-0.006, 0, 0.015}, {1, 0, 0, 0}};
|
||||
|
||||
case xr::spaces::aim_right:
|
||||
return {{0.006, 0, 0.015}, {1, 0, 0, 0}};
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (profile == "pico-neo3")
|
||||
{
|
||||
switch (space)
|
||||
{
|
||||
case xr::spaces::grip_left:
|
||||
case xr::spaces::grip_right:
|
||||
return {{0, -0.016, -0.05}, glm::angleAxis(glm::radians(-15.f), glm::vec3{1, 0, 0})};
|
||||
|
||||
case xr::spaces::aim_left:
|
||||
case xr::spaces::aim_right:
|
||||
return {{0, 0, 0}, {1, 0, 0, 0}};
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (profile == "pico-4")
|
||||
{
|
||||
switch (space)
|
||||
{
|
||||
case xr::spaces::grip_left:
|
||||
case xr::spaces::grip_right:
|
||||
return {{0, -0.02, -0.05}, glm::angleAxis(glm::radians(-30.f), glm::vec3{1, 0, 0})};
|
||||
|
||||
case xr::spaces::aim_left:
|
||||
return {{-0.005, 0, 0.02}, {1, 0, 0, 0}};
|
||||
|
||||
case xr::spaces::aim_right:
|
||||
return {{0.005, 0, 0.02}, {1, 0, 0, 0}};
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (profile == "pico-4u")
|
||||
{
|
||||
switch (space)
|
||||
{
|
||||
case xr::spaces::grip_left:
|
||||
case xr::spaces::grip_right:
|
||||
return {{0, -0.042, -0.042}, glm::angleAxis(glm::radians(-8.f), glm::vec3{1, 0, 0})};
|
||||
|
||||
case xr::spaces::aim_left:
|
||||
return {{-0.005, 0, 0.02}, {1, 0, 0, 0}};
|
||||
|
||||
case xr::spaces::aim_right:
|
||||
return {{0.005, 0, 0.02}, {1, 0, 0, 0}};
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (profile == "htc-vive-focus-3")
|
||||
{
|
||||
switch (space)
|
||||
{
|
||||
case xr::spaces::grip_left:
|
||||
case xr::spaces::grip_right:
|
||||
return {{0, 0, 0}, {1, 0, 0, 0}};
|
||||
|
||||
case xr::spaces::aim_left:
|
||||
case xr::spaces::aim_right:
|
||||
return {{0, -0.045, 0.035}, {1, 0, 0, 0}};
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (profile == "samsung-galaxyxr")
|
||||
{
|
||||
switch (space)
|
||||
{
|
||||
case xr::spaces::grip_left:
|
||||
case xr::spaces::grip_right:
|
||||
return {{0, -0.01, -0.02}, glm::angleAxis(glm::radians(-20.f), glm::vec3{1, 0, 0})};
|
||||
|
||||
case xr::spaces::aim_left:
|
||||
return {{-0.003, 0, 0.028}, {1, 0, 0, 0}};
|
||||
|
||||
case xr::spaces::aim_right:
|
||||
return {{0.003, 0, 0.028}, {1, 0, 0, 0}};
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return {{0, 0, 0}, {1, 0, 0, 0}};
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2026 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
* Copyright (C) 2026 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "configuration.h"
|
||||
#include "xr/space.h"
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <magic_enum_containers.hpp>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
using hmd_permissions = magic_enum::containers::array<feature, const char *>;
|
||||
|
||||
class hmd_traits
|
||||
{
|
||||
public:
|
||||
// Properties have the defaults below
|
||||
// The cpp file has per-headset values
|
||||
// it is possible to override values:
|
||||
// on Android:
|
||||
// adb setprop debug.wivrn.{property-name} {property-value}
|
||||
// i.e. adb setprop debug.wivrn.view_locate false
|
||||
// on Linux:
|
||||
// export WIVRN_{PROPERTY-NAME}={property-value}
|
||||
// i.e. export WIVRN_VIEW_LOCATE=false
|
||||
std::string controller_profile = "generic-trigger-squeeze";
|
||||
std::string controller_ray_model = "assets://ray.glb";
|
||||
hmd_permissions permissions{};
|
||||
XrVersion max_openxr_api_version = XR_API_VERSION_1_1;
|
||||
uint32_t panel_width_override = 0;
|
||||
bool needs_srgb_conversion = true;
|
||||
bool view_locate = true; // can locate relative to view
|
||||
bool vk_debug_ext_allowed = true;
|
||||
bool bind_simple_controller = true;
|
||||
bool hand_interaction_grip_surface = true;
|
||||
bool pico_face_tracker = false;
|
||||
bool discard_frame = true; // can do xrBeginFrame twice to discard the first one
|
||||
bool usb_net = false;
|
||||
std::unordered_map<std::string, std::string> override_shader;
|
||||
std::unordered_set<std::string> blacklisted_extensions;
|
||||
#ifndef NDEBUG
|
||||
bool initialized_ = false;
|
||||
#endif
|
||||
|
||||
public:
|
||||
void init();
|
||||
|
||||
const char * permission_name(feature f) const
|
||||
{
|
||||
return permissions[f];
|
||||
}
|
||||
|
||||
std::string model_name() const;
|
||||
std::pair<glm::vec3, glm::quat> controller_offset(xr::spaces space) const;
|
||||
XrViewConfigurationView override_view(XrViewConfigurationView) const;
|
||||
|
||||
bool is_initialized() const
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
return initialized_;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
@@ -17,6 +17,7 @@ public class MainActivity extends android.app.NativeActivity
|
||||
public native void onActivityResult(int requestCode, int resultCode, android.content.Intent data);
|
||||
|
||||
private android.content.BroadcastReceiver BatteryInfoReceiver = null;
|
||||
public android.net.ConnectivityManager.NetworkCallback netcb = null;
|
||||
|
||||
@Override
|
||||
protected void onCreate(android.os.Bundle savedInstanceState)
|
||||
@@ -24,6 +25,7 @@ public class MainActivity extends android.app.NativeActivity
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
this.BatteryInfoReceiver = new BroadcastReceiver();
|
||||
this.netcb = new org.meumeu.wivrn.NetworkInfoCallback();
|
||||
|
||||
this.registerReceiver(this.BatteryInfoReceiver, new android.content.IntentFilter(android.content.Intent.ACTION_BATTERY_CHANGED));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.meumeu.wivrn;
|
||||
|
||||
public class NetworkInfoCallback extends android.net.ConnectivityManager.NetworkCallback
|
||||
{
|
||||
@Override
|
||||
public native void onAvailable(android.net.Network network);
|
||||
|
||||
@Override
|
||||
public native void onBlockedStatusChanged(android.net.Network network, boolean blocked);
|
||||
|
||||
@Override
|
||||
public native void onCapabilitiesChanged(android.net.Network network, android.net.NetworkCapabilities caps);
|
||||
|
||||
@Override
|
||||
public native void onLinkPropertiesChanged(android.net.Network network, android.net.LinkProperties props);
|
||||
|
||||
@Override
|
||||
public native void onLosing(android.net.Network network, int maxMsToLive);
|
||||
|
||||
@Override
|
||||
public native void onLost(android.net.Network network);
|
||||
|
||||
@Override
|
||||
public native void onUnavailable();
|
||||
}
|
||||
|
||||
+15
-8
@@ -65,7 +65,7 @@ void libcurl::curl_thread_fn()
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
// For Android, read all the certificates at start-up, the file names are not
|
||||
// in the correct format for the current verion of OpenSSL.
|
||||
// in the correct format for the current version of OpenSSL.
|
||||
// See https://stackoverflow.com/questions/25253823/how-to-make-ssl-peer-verify-work-on-android
|
||||
std::string ca_bundle;
|
||||
for (const std::filesystem::directory_entry & entry: std::filesystem::directory_iterator{"/system/etc/security/cacerts"})
|
||||
@@ -95,7 +95,7 @@ void libcurl::curl_thread_fn()
|
||||
};
|
||||
#endif
|
||||
|
||||
std::string user_agent = std::string("WiVRn/") + wivrn::git_version;
|
||||
std::string user_agent = std::string("WiVRn/") + wivrn::display_version();
|
||||
|
||||
// We can't use auto here because of curl_easy_setopt
|
||||
size_t (*write_callback)(void *, size_t, size_t, void *) = [](void * buffer, size_t size, size_t nmemb, void * userp) -> size_t {
|
||||
@@ -158,8 +158,10 @@ void libcurl::curl_thread_fn()
|
||||
|
||||
if (msg->data.result == CURLE_OK)
|
||||
{
|
||||
xfer.current_state = state::done;
|
||||
xfer.finish();
|
||||
if (xfer.finish())
|
||||
xfer.current_state = state::done;
|
||||
else
|
||||
xfer.current_state = state::error;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -299,17 +301,21 @@ size_t libcurl::transfer_file::write(void * data, size_t size) noexcept
|
||||
return size;
|
||||
}
|
||||
|
||||
void libcurl::transfer_file::finish() noexcept
|
||||
bool libcurl::transfer_file::finish() noexcept
|
||||
{
|
||||
stream.close();
|
||||
std::filesystem::rename(temporary_path, final_path);
|
||||
std::error_code ec{};
|
||||
std::filesystem::rename(temporary_path, final_path, ec);
|
||||
if (ec)
|
||||
return false;
|
||||
|
||||
curl_off_t remote_timestamp;
|
||||
if (curl_easy_getinfo(curl, CURLINFO_FILETIME_T, &remote_timestamp) == CURLE_OK)
|
||||
{
|
||||
auto time = std::chrono::file_clock::from_sys(std::chrono::system_clock::from_time_t(remote_timestamp));
|
||||
std::filesystem::last_write_time(final_path, time);
|
||||
std::filesystem::last_write_time(final_path, time, ec); // ignore errors
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void libcurl::transfer_file::cancel() noexcept
|
||||
@@ -343,8 +349,9 @@ size_t libcurl::transfer_buffer::write(void * data, size_t size) noexcept
|
||||
return size;
|
||||
}
|
||||
|
||||
void libcurl::transfer_buffer::finish() noexcept
|
||||
bool libcurl::transfer_buffer::finish() noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void libcurl::transfer_buffer::cancel() noexcept
|
||||
|
||||
+4
-3
@@ -25,6 +25,7 @@
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
@@ -68,7 +69,7 @@ private:
|
||||
virtual ~transfer();
|
||||
|
||||
virtual size_t write(void * data, size_t size) noexcept = 0;
|
||||
virtual void finish() noexcept = 0;
|
||||
virtual bool finish() noexcept = 0;
|
||||
virtual void cancel() noexcept = 0;
|
||||
};
|
||||
|
||||
@@ -81,7 +82,7 @@ private:
|
||||
std::fstream stream;
|
||||
|
||||
size_t write(void * data, size_t size) noexcept override;
|
||||
void finish() noexcept override;
|
||||
bool finish() noexcept override;
|
||||
void cancel() noexcept override;
|
||||
};
|
||||
|
||||
@@ -92,7 +93,7 @@ private:
|
||||
std::string buffer;
|
||||
|
||||
size_t write(void * data, size_t size) noexcept override;
|
||||
void finish() noexcept override;
|
||||
bool finish() noexcept override;
|
||||
void cancel() noexcept override;
|
||||
};
|
||||
|
||||
|
||||
+5
-1
@@ -20,6 +20,7 @@
|
||||
#include "application.h"
|
||||
#include "scenes/lobby.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
@@ -40,6 +41,10 @@ void real_main(android_app * native_app)
|
||||
void real_main()
|
||||
#endif
|
||||
{
|
||||
if (wivrn::is_tag)
|
||||
spdlog::info("Starting WiVRn version {}", wivrn::display_version());
|
||||
else
|
||||
spdlog::info("Starting WiVRn version {} ({})", wivrn::display_version(), wivrn::git_commit);
|
||||
try
|
||||
{
|
||||
application_info info;
|
||||
@@ -84,7 +89,6 @@ void real_main()
|
||||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
void android_main(android_app * native_app) __attribute__((visibility("default")));
|
||||
void android_main(android_app * native_app)
|
||||
{
|
||||
static auto logger = spdlog::android_logger_mt("WiVRn", "WiVRn");
|
||||
|
||||
@@ -74,7 +74,7 @@ glm::quat cubic_spline(const glm::quat & a, const glm::quat & vb, const glm::qua
|
||||
td * (t3 - t2) * va);
|
||||
}
|
||||
|
||||
template <auto components::node::*Field>
|
||||
template <auto components::node::* Field>
|
||||
void apply_track(entt::registry & scene, const components::animation_track_impl<Field> & track, float current_time)
|
||||
{
|
||||
entt::entity target = track.target;
|
||||
|
||||
@@ -18,10 +18,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "application.h"
|
||||
#include "utils/alignment.h"
|
||||
#include "utils/contains.h"
|
||||
#include "vk/allocation.h"
|
||||
#include <fastgltf/tools.hpp>
|
||||
#include <fastgltf/types.hpp>
|
||||
#include <span>
|
||||
#include <vector>
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
@@ -29,6 +32,8 @@ class gpu_buffer
|
||||
{
|
||||
std::vector<std::byte> bytes;
|
||||
vk::PhysicalDeviceLimits limits;
|
||||
vk::PhysicalDeviceIndexTypeUint8FeaturesEXT feat_uint8;
|
||||
|
||||
fastgltf::Asset & asset;
|
||||
vk::BufferUsageFlags usage;
|
||||
|
||||
@@ -58,8 +63,15 @@ class gpu_buffer
|
||||
}
|
||||
|
||||
public:
|
||||
gpu_buffer(vk::PhysicalDeviceProperties properties, fastgltf::Asset & asset) :
|
||||
limits(properties.limits), asset(asset), usage(0) {}
|
||||
gpu_buffer(vk::raii::PhysicalDevice physical_device, fastgltf::Asset & asset) :
|
||||
asset(asset),
|
||||
usage(0)
|
||||
{
|
||||
limits = physical_device.getProperties().limits;
|
||||
|
||||
if (utils::contains(application::instance().get_vk_device_extensions(), VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME))
|
||||
std::tie(std::ignore, feat_uint8) = physical_device.getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceIndexTypeUint8FeaturesEXT>();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
size_t add_uniform(const T & data_to_add)
|
||||
@@ -79,7 +91,13 @@ public:
|
||||
return add(alignment, data_to_add);
|
||||
}
|
||||
|
||||
size_t add_indices(const fastgltf::Accessor & accessor)
|
||||
size_t add_indices(std::span<const uint16_t> indices)
|
||||
{
|
||||
usage |= vk::BufferUsageFlagBits::eIndexBuffer;
|
||||
return add(4, indices.data(), indices.size_bytes());
|
||||
}
|
||||
|
||||
std::pair<size_t, vk::IndexType> add_indices(const fastgltf::Accessor & accessor)
|
||||
{
|
||||
usage |= vk::BufferUsageFlagBits::eIndexBuffer;
|
||||
|
||||
@@ -90,7 +108,11 @@ public:
|
||||
std::vector<uint8_t> indices(accessor.count);
|
||||
using index_t = std::remove_cvref_t<decltype(*indices.data())>;
|
||||
fastgltf::copyFromAccessor<index_t>(asset, accessor, indices.data());
|
||||
return add(4, indices);
|
||||
|
||||
if (feat_uint8.indexTypeUint8)
|
||||
return {add(4, indices), vk::IndexType::eUint8EXT};
|
||||
else
|
||||
return {add(4, std::vector<uint16_t>{indices.begin(), indices.end()}), vk::IndexType::eUint16};
|
||||
}
|
||||
|
||||
case fastgltf::ComponentType::Short:
|
||||
@@ -98,7 +120,7 @@ public:
|
||||
std::vector<uint16_t> indices(accessor.count);
|
||||
using index_t = std::remove_cvref_t<decltype(*indices.data())>;
|
||||
fastgltf::copyFromAccessor<index_t>(asset, accessor, indices.data());
|
||||
return add(4, indices);
|
||||
return {add(4, indices), vk::IndexType::eUint16};
|
||||
}
|
||||
|
||||
case fastgltf::ComponentType::Int:
|
||||
@@ -106,7 +128,7 @@ public:
|
||||
std::vector<uint32_t> indices(accessor.count);
|
||||
using index_t = std::remove_cvref_t<decltype(*indices.data())>;
|
||||
fastgltf::copyFromAccessor<index_t>(asset, accessor, indices.data());
|
||||
return add(4, indices);
|
||||
return {add(4, indices), vk::IndexType::eUint32};
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
@@ -23,13 +23,11 @@
|
||||
#include "utils/thread_safe.h"
|
||||
#include "vk/allocation.h"
|
||||
#include "vk/vk_allocator.h"
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <ktx.h>
|
||||
#include <ktxvulkan.h>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <spdlog/fmt/chrono.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <stdexcept>
|
||||
#include <tuple>
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2025 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "image_writer.h"
|
||||
|
||||
#include "utils/thread_safe.h"
|
||||
#include <cassert>
|
||||
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||
#include "stb_image_write.h"
|
||||
|
||||
void write_image(
|
||||
vk::raii::Device & device,
|
||||
thread_safe<vk::raii::Queue> & queue,
|
||||
uint32_t queue_family_index,
|
||||
const std::filesystem::path & path,
|
||||
vk::Image image,
|
||||
const vk::ImageCreateInfo & info)
|
||||
{
|
||||
assert(info.usage & vk::ImageUsageFlagBits::eTransferSrc);
|
||||
assert(info.extent.depth == 1);
|
||||
assert(info.format == vk::Format::eR8G8B8A8Srgb);
|
||||
|
||||
buffer_allocation output_buffer{
|
||||
device,
|
||||
vk::BufferCreateInfo{
|
||||
.size = info.extent.height * info.extent.width * 4,
|
||||
.usage = vk::BufferUsageFlagBits::eTransferDst,
|
||||
},
|
||||
VmaAllocationCreateInfo{
|
||||
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT,
|
||||
.usage = VmaMemoryUsage::VMA_MEMORY_USAGE_AUTO,
|
||||
},
|
||||
"Saved image buffer"};
|
||||
|
||||
vk::raii::CommandPool cp{
|
||||
device,
|
||||
vk::CommandPoolCreateInfo{
|
||||
.queueFamilyIndex = queue_family_index,
|
||||
}};
|
||||
|
||||
vk::raii::CommandBuffer command_buffer = std::move(device.allocateCommandBuffers(
|
||||
{
|
||||
.commandPool = *cp,
|
||||
.level = vk::CommandBufferLevel::ePrimary,
|
||||
.commandBufferCount = 1,
|
||||
})[0]);
|
||||
|
||||
vk::raii::Fence fence = device.createFence({});
|
||||
|
||||
command_buffer.begin(vk::CommandBufferBeginInfo{});
|
||||
|
||||
command_buffer.pipelineBarrier(
|
||||
vk::PipelineStageFlagBits::eColorAttachmentOutput,
|
||||
vk::PipelineStageFlagBits::eTransfer,
|
||||
vk::DependencyFlags{},
|
||||
{},
|
||||
{},
|
||||
vk::ImageMemoryBarrier{
|
||||
.srcAccessMask = vk::AccessFlagBits::eColorAttachmentWrite,
|
||||
.dstAccessMask = vk::AccessFlagBits::eTransferRead,
|
||||
.oldLayout = vk::ImageLayout::eColorAttachmentOptimal,
|
||||
.newLayout = vk::ImageLayout::eTransferSrcOptimal,
|
||||
.image = image,
|
||||
.subresourceRange = {
|
||||
.aspectMask = vk::ImageAspectFlagBits::eColor,
|
||||
.baseMipLevel = 0,
|
||||
.levelCount = 1,
|
||||
.baseArrayLayer = 0,
|
||||
.layerCount = 1,
|
||||
},
|
||||
});
|
||||
|
||||
command_buffer.copyImageToBuffer(
|
||||
image,
|
||||
vk::ImageLayout::eTransferSrcOptimal,
|
||||
output_buffer,
|
||||
vk::BufferImageCopy{
|
||||
.bufferOffset = 0,
|
||||
.bufferRowLength = 0,
|
||||
.bufferImageHeight = 0,
|
||||
.imageSubresource = {
|
||||
.aspectMask = vk::ImageAspectFlagBits::eColor,
|
||||
.mipLevel = 0,
|
||||
.baseArrayLayer = 0,
|
||||
.layerCount = 1,
|
||||
},
|
||||
.imageOffset = {0, 0, 0},
|
||||
.imageExtent = info.extent,
|
||||
});
|
||||
|
||||
command_buffer.end();
|
||||
queue.lock()->submit(vk::SubmitInfo{
|
||||
.commandBufferCount = 1,
|
||||
.pCommandBuffers = &*command_buffer,
|
||||
},
|
||||
*fence);
|
||||
|
||||
if (auto result = device.waitForFences(*fence, true, 1'000'000'000); result == vk::Result::eSuccess)
|
||||
stbi_write_png(path.c_str(), info.extent.width, info.extent.height, 4, output_buffer.data(), 0);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2025 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "utils/thread_safe.h"
|
||||
#include "vk/allocation.h"
|
||||
#include <filesystem>
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
void write_image(
|
||||
vk::raii::Device & device,
|
||||
thread_safe<vk::raii::Queue> & queue,
|
||||
uint32_t queue_family_index,
|
||||
const std::filesystem::path & path,
|
||||
vk::Image image,
|
||||
const vk::ImageCreateInfo & info);
|
||||
|
||||
inline void write_image(
|
||||
vk::raii::Device & device,
|
||||
thread_safe<vk::raii::Queue> & queue,
|
||||
uint32_t queue_family_index,
|
||||
const std::filesystem::path & path,
|
||||
const image_allocation & image)
|
||||
{
|
||||
write_image(device, queue, queue_family_index, path, (vk::Image)image, image.info());
|
||||
}
|
||||
+300
-241
@@ -16,7 +16,6 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#include "imgui_impl.h"
|
||||
#include "implot.h"
|
||||
|
||||
@@ -24,6 +23,7 @@
|
||||
#include "constants.h"
|
||||
#include "image_loader.h"
|
||||
#include "openxr/openxr.h"
|
||||
#include "ui_theme.h"
|
||||
#include "utils/mapped_file.h"
|
||||
#include "utils/ranges.h"
|
||||
#include "utils/strings.h"
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <glm/gtc/matrix_access.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <imgui.h>
|
||||
#include <imgui_internal.h>
|
||||
#include <limits>
|
||||
@@ -146,7 +147,7 @@ static bool in_viewport(const imgui_context::viewport & viewport, ImVec2 positio
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool window_intersects_viewport(ImGuiWindow * window, imgui_context::viewport & viewport)
|
||||
static bool window_intersects_viewport(ImGuiWindow * window, const imgui_context::viewport & viewport)
|
||||
{
|
||||
ImRect w{window->Pos.x, window->Pos.y, window->Pos.x + window->Size.x, window->Pos.y + window->Size.y};
|
||||
ImRect v(viewport.vp_origin.x, viewport.vp_origin.y, viewport.vp_origin.x + viewport.vp_size.x, viewport.vp_origin.y + viewport.vp_size.y);
|
||||
@@ -157,7 +158,7 @@ static bool window_intersects_viewport(ImGuiWindow * window, imgui_context::view
|
||||
static float distance_to_window(ImGuiWindow * window, ImVec2 position)
|
||||
{
|
||||
if (window->Hidden or not window->Active)
|
||||
return std::numeric_limits<float>::infinity();
|
||||
return std::numeric_limits<float>::max();
|
||||
|
||||
float dx;
|
||||
if (position.x < window->Pos.x)
|
||||
@@ -181,7 +182,7 @@ static float distance_to_window(ImGuiWindow * window, ImVec2 position)
|
||||
static const std::array layout_bindings = {
|
||||
vk::DescriptorSetLayoutBinding{
|
||||
.binding = 0,
|
||||
.descriptorType = vk::DescriptorType::eCombinedImageSampler,
|
||||
.descriptorType = vk::DescriptorType::eSampledImage,
|
||||
.descriptorCount = 1,
|
||||
.stageFlags = vk::ShaderStageFlagBits::eFragment,
|
||||
}};
|
||||
@@ -208,16 +209,18 @@ imgui_textures::imgui_textures(
|
||||
this->image_cache = std::make_shared<image_cache_type>(device, physical_device, queue, queue_family_index);
|
||||
}
|
||||
|
||||
imgui_textures::~imgui_textures()
|
||||
{
|
||||
device.waitIdle();
|
||||
}
|
||||
|
||||
std::vector<std::pair<ImVec2, float>> imgui_context::ray_plane_intersection(const imgui_context::controller_state & in) const
|
||||
{
|
||||
if (!in.active)
|
||||
return {};
|
||||
|
||||
std::vector<std::pair<ImVec2, float>> intersections;
|
||||
|
||||
for (const auto & i: layers_)
|
||||
{
|
||||
if (i.space != xr::spaces::world)
|
||||
if (i.space != xr::spaces::world or i.tooltip_viewport)
|
||||
continue;
|
||||
|
||||
auto M = glm::transpose(glm::mat3_cast(i.orientation)); // world-to-plane transform
|
||||
@@ -237,7 +240,10 @@ std::vector<std::pair<ImVec2, float>> imgui_context::ray_plane_intersection(cons
|
||||
// => ray_start.z + distance × ray_dir.z = 0
|
||||
float distance = -ray_start.z / ray_dir.z;
|
||||
|
||||
if (distance < constants::gui::min_pointer_distance)
|
||||
if (distance < constants::gui::min_controller_distance and in.source == ImGuiMouseSource_VRController)
|
||||
continue;
|
||||
|
||||
if (distance < constants::gui::fingertip_distance_touching_thd_lo and in.source == ImGuiMouseSource_VRHandTracking)
|
||||
continue;
|
||||
|
||||
coord.x = ray_start.x + distance * ray_dir.x;
|
||||
@@ -372,9 +378,11 @@ imgui_context::imgui_context(
|
||||
.MinImageCount = 2,
|
||||
.ImageCount = (uint32_t)swapchain.images().size(), // used to cycle between VkBuffers in ImGui_ImplVulkan_RenderDrawData
|
||||
.PipelineCache = *application::get_pipeline_cache(),
|
||||
.RenderPass = *renderpass,
|
||||
.Subpass = 0,
|
||||
.MSAASamples = VK_SAMPLE_COUNT_1_BIT,
|
||||
.PipelineInfoMain = {
|
||||
.RenderPass = *renderpass,
|
||||
.Subpass = 0,
|
||||
.MSAASamples = VK_SAMPLE_COUNT_1_BIT,
|
||||
},
|
||||
.Allocator = nullptr,
|
||||
.CheckVkResultFn = check_vk_result,
|
||||
};
|
||||
@@ -527,11 +535,13 @@ void imgui_context::initialize_fonts()
|
||||
}
|
||||
}
|
||||
|
||||
utils::mapped_file font_awesome_regular("assets://Font Awesome 6 Free-Regular-400.otf");
|
||||
utils::mapped_file font_awesome_solid("assets://Font Awesome 6 Free-Solid-900.otf");
|
||||
assert(font_awesome.empty());
|
||||
font_awesome.emplace_back("assets://Font Awesome 7 Free-Regular-400.otf");
|
||||
font_awesome.emplace_back("assets://Font Awesome 7 Free-Solid-900.otf");
|
||||
font_awesome.emplace_back("assets://Font Awesome 7 Brands-Regular-400.otf");
|
||||
|
||||
ImFontConfig config;
|
||||
config.FontDataOwnedByAtlas = false;
|
||||
config.FontDataOwnedByAtlas = true;
|
||||
|
||||
for (auto & font: fonts)
|
||||
{
|
||||
@@ -540,10 +550,11 @@ void imgui_context::initialize_fonts()
|
||||
config.MergeMode = true;
|
||||
}
|
||||
|
||||
config.FontDataOwnedByAtlas = false;
|
||||
config.MergeMode = true;
|
||||
config.GlyphMinAdvanceX = 40; // Use if you want to make the icon monospaced
|
||||
io.Fonts->AddFontFromMemoryTTF(const_cast<std::byte *>(font_awesome_regular.data()), font_awesome_regular.size(), constants::gui::font_size_small, &config);
|
||||
io.Fonts->AddFontFromMemoryTTF(const_cast<std::byte *>(font_awesome_solid.data()), font_awesome_solid.size(), constants::gui::font_size_small, &config);
|
||||
for (auto & fa: font_awesome)
|
||||
io.Fonts->AddFontFromMemoryTTF(const_cast<std::byte *>(fa.data()), fa.size(), constants::gui::font_size_small, &config);
|
||||
}
|
||||
|
||||
std::vector<imgui_context::controller_state> imgui_context::read_controllers_state(XrTime display_time)
|
||||
@@ -552,97 +563,125 @@ std::vector<imgui_context::controller_state> imgui_context::read_controllers_sta
|
||||
size_t new_focused_controller = focused_controller;
|
||||
|
||||
std::vector<controller_state> new_states;
|
||||
new_states.resize(controllers.size());
|
||||
if (not controllers_enabled)
|
||||
return new_states;
|
||||
|
||||
aim_interaction = {1, 1};
|
||||
|
||||
// Get the hand/controller state from OpenXR
|
||||
for (auto && [index, controller]: utils::enumerate(controllers))
|
||||
for (const auto & [controller, state, current_aim_interaction]: std::ranges::zip_view(controllers, new_states, aim_interaction))
|
||||
{
|
||||
auto & [ctrl, state] = controller;
|
||||
|
||||
controller_state & new_state = new_states.emplace_back();
|
||||
|
||||
if (not controllers_enabled)
|
||||
continue;
|
||||
const auto & ctrl = controller.first;
|
||||
std::pair<std::optional<ImVec2>, float> index_tip_position{{}, std::numeric_limits<float>::max()};
|
||||
std::pair<std::optional<ImVec2>, float> palm_position{{}, std::numeric_limits<float>::max()};
|
||||
std::pair<std::optional<ImVec2>, float> controller_position{{}, std::numeric_limits<float>::max()};
|
||||
|
||||
// First hands, so we can set aim_interaction
|
||||
current_aim_interaction = 1;
|
||||
if (ctrl.hand)
|
||||
{
|
||||
if (auto joints = ctrl.hand->locate(world, display_time))
|
||||
{
|
||||
XrHandJointLocationEXT & index_tip = (*joints)[XR_HAND_JOINT_INDEX_TIP_EXT].first;
|
||||
if (index_tip.locationFlags & XR_SPACE_LOCATION_POSITION_TRACKED_BIT)
|
||||
XrHandJointLocationEXT & palm = (*joints)[XR_HAND_JOINT_PALM_EXT].first;
|
||||
|
||||
if (index_tip.locationFlags & XR_SPACE_LOCATION_POSITION_VALID_BIT)
|
||||
{
|
||||
new_state.aim_position = {
|
||||
index_tip.pose.position.x,
|
||||
index_tip.pose.position.y,
|
||||
index_tip.pose.position.z};
|
||||
// aim_orientation is ignored by ray_plane_intersection() for hands
|
||||
|
||||
new_state.active = true;
|
||||
new_state.source = ImGuiMouseSource_VRHandTracking;
|
||||
index_tip_position = compute_pointer_position(controller_state{
|
||||
.aim_position = {
|
||||
index_tip.pose.position.x,
|
||||
index_tip.pose.position.y,
|
||||
index_tip.pose.position.z,
|
||||
},
|
||||
// aim_orientation is ignored by ray_plane_intersection() for hands
|
||||
.source = ImGuiMouseSource_VRHandTracking,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
if (palm.locationFlags & XR_SPACE_LOCATION_POSITION_VALID_BIT)
|
||||
{
|
||||
palm_position = compute_pointer_position(controller_state{
|
||||
.aim_position = {
|
||||
palm.pose.position.x,
|
||||
palm.pose.position.y,
|
||||
palm.pose.position.z,
|
||||
},
|
||||
.source = ImGuiMouseSource_VRHandTracking,
|
||||
});
|
||||
}
|
||||
|
||||
if (index_tip_position.second < constants::gui::fingertip_distance_touching_thd_hi and
|
||||
index_tip_position.second > constants::gui::fingertip_distance_touching_thd_lo)
|
||||
state.fingertip_touching = true;
|
||||
|
||||
if (palm_position.second < constants::gui::palm_distance_close_thd_lo)
|
||||
current_aim_interaction = 0;
|
||||
else if (palm_position.second > constants::gui::palm_distance_close_thd_hi)
|
||||
current_aim_interaction = 1;
|
||||
else
|
||||
current_aim_interaction =
|
||||
(palm_position.second - constants::gui::palm_distance_close_thd_lo) /
|
||||
(constants::gui::palm_distance_close_thd_hi - constants::gui::palm_distance_close_thd_lo);
|
||||
}
|
||||
}
|
||||
|
||||
new_state.source = ImGuiMouseSource_VRController;
|
||||
|
||||
// Then controllers
|
||||
if (auto location = application::locate_controller(ctrl.aim, world, display_time))
|
||||
{
|
||||
new_state.active = true;
|
||||
new_state.aim_position = location->first + glm::mat3_cast(location->second * ctrl.offset.second) * ctrl.offset.first;
|
||||
new_state.aim_orientation = location->second * ctrl.offset.second;
|
||||
controller_position = compute_pointer_position(controller_state{
|
||||
.aim_position = location->first + glm::mat3_cast(location->second * ctrl.offset.second) * ctrl.offset.first,
|
||||
.aim_orientation = location->second * ctrl.offset.second,
|
||||
.source = ImGuiMouseSource_VRController,
|
||||
});
|
||||
|
||||
if (ctrl.trigger)
|
||||
if (current_aim_interaction == 1)
|
||||
{
|
||||
auto trigger = application::read_action_float(ctrl.trigger).value_or(std::pair{0, 0});
|
||||
new_state.trigger_value = trigger.second;
|
||||
if (ctrl.trigger)
|
||||
{
|
||||
auto trigger = application::read_action_float(ctrl.trigger).value_or(std::pair{0, 0});
|
||||
state.trigger_value = trigger.second;
|
||||
|
||||
// TODO tunable
|
||||
/*if (new_state.trigger_value < 0.5)
|
||||
new_state.trigger_clicked = false;
|
||||
else */
|
||||
if (new_state.trigger_value > constants::gui::trigger_click_thd)
|
||||
new_state.trigger_clicked = true;
|
||||
}
|
||||
if (state.trigger_value > constants::gui::trigger_click_thd)
|
||||
state.trigger_clicked = true;
|
||||
}
|
||||
|
||||
if (ctrl.scroll)
|
||||
{
|
||||
if (auto act = application::read_action_vec2(ctrl.scroll); act)
|
||||
new_state.scroll_value = {-act->second.x * scroll_scale, act->second.y * scroll_scale};
|
||||
else
|
||||
new_state.scroll_value = {0, 0};
|
||||
if (ctrl.scroll)
|
||||
{
|
||||
if (auto act = application::read_action_vec2(ctrl.scroll); act)
|
||||
state.scroll_value = {-act->second.x * scroll_scale, act->second.y * scroll_scale};
|
||||
else
|
||||
state.scroll_value = {0, 0};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Compute the position in imgui frame according to the currently displayed windows (from the last frame)
|
||||
for (auto & state: new_states)
|
||||
{
|
||||
compute_pointer_position(state);
|
||||
|
||||
if (state.source == ImGuiMouseSource_VRHandTracking)
|
||||
if (current_aim_interaction == 0 or not controller_position.first)
|
||||
state.pointer_position = index_tip_position.first;
|
||||
else if (current_aim_interaction == 1 or not index_tip_position.first)
|
||||
state.pointer_position = controller_position.first;
|
||||
else
|
||||
{
|
||||
if (state.hover_distance < constants::gui::fingertip_distance_hovering_thd)
|
||||
state.fingertip_hovering = true;
|
||||
|
||||
if (state.hover_distance < constants::gui::fingertip_distance_touching_thd)
|
||||
state.fingertip_touching = true;
|
||||
assert(index_tip_position.first);
|
||||
assert(controller_position.first);
|
||||
state.pointer_position = *index_tip_position.first + (*controller_position.first - *index_tip_position.first) * current_aim_interaction;
|
||||
}
|
||||
|
||||
if (current_aim_interaction < 1)
|
||||
state.source = ImGuiMouseSource_VRHandTracking;
|
||||
else
|
||||
state.source = ImGuiMouseSource_VRController;
|
||||
}
|
||||
|
||||
return new_states;
|
||||
}
|
||||
|
||||
void imgui_context::compute_pointer_position(imgui_context::controller_state & state)
|
||||
std::pair<std::optional<ImVec2>, float> imgui_context::compute_pointer_position(const imgui_context::controller_state & state) const
|
||||
{
|
||||
auto intersections = ray_plane_intersection(state);
|
||||
|
||||
if (intersections.empty())
|
||||
{
|
||||
state.hover_distance = std::numeric_limits<float>::infinity();
|
||||
state.pointer_position = std::nullopt;
|
||||
return;
|
||||
}
|
||||
return {std::nullopt, std::numeric_limits<float>::max()};
|
||||
|
||||
if (ImGuiWindow * modal_popup = ImGui::GetTopMostAndVisiblePopupModal())
|
||||
{
|
||||
@@ -657,17 +696,12 @@ void imgui_context::compute_pointer_position(imgui_context::controller_state & s
|
||||
for (auto [position, distance]: intersections)
|
||||
{
|
||||
if (in_viewport(i, position))
|
||||
{
|
||||
state.hover_distance = distance;
|
||||
state.pointer_position = position;
|
||||
return;
|
||||
}
|
||||
return {position, distance};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
state.hover_distance = std::numeric_limits<float>::infinity();
|
||||
state.pointer_position = std::nullopt;
|
||||
return {std::nullopt, std::numeric_limits<float>::max()};
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -680,16 +714,12 @@ void imgui_context::compute_pointer_position(imgui_context::controller_state & s
|
||||
continue;
|
||||
|
||||
if (in_window(window, position))
|
||||
{
|
||||
state.hover_distance = distance;
|
||||
state.pointer_position = position;
|
||||
return;
|
||||
}
|
||||
return {position, distance};
|
||||
}
|
||||
}
|
||||
|
||||
// If the pointer isn't in any window, take the farthest one
|
||||
std::tie(state.pointer_position, state.hover_distance) = intersections.back();
|
||||
return intersections.back();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -727,6 +757,13 @@ size_t imgui_context::choose_focused_controller(const std::vector<controller_sta
|
||||
return index;
|
||||
}
|
||||
|
||||
// scrolling?
|
||||
for (auto && [index, state]: utils::enumerate(new_states))
|
||||
{
|
||||
if (glm::length(state.scroll_value) > constants::gui::scroll_value_thd)
|
||||
return index;
|
||||
}
|
||||
|
||||
// Else, keep the last controller active
|
||||
return focused_controller;
|
||||
}
|
||||
@@ -811,7 +848,7 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_context::end_frame()
|
||||
application::haptic_start(haptic_output, XR_NULL_PATH, 10'000'000, 1000, 1);
|
||||
}
|
||||
|
||||
vk::Image destination = swapchain.images()[image_index].image;
|
||||
vk::Image destination = swapchain.image(image_index);
|
||||
|
||||
ImGui::SetCurrentContext(context);
|
||||
ImPlot::SetCurrentContext(plot_context);
|
||||
@@ -875,7 +912,7 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_context::end_frame()
|
||||
}
|
||||
|
||||
// Compute the distance to the closest window
|
||||
float distance = std::numeric_limits<float>::infinity();
|
||||
float distance = std::numeric_limits<float>::max();
|
||||
for (ImGuiWindow * window: context->Windows)
|
||||
{
|
||||
distance = std::min(distance, distance_to_window(window, *position));
|
||||
@@ -883,24 +920,44 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_context::end_frame()
|
||||
|
||||
float alpha = std::clamp<float>(1 - distance / constants::gui::pointer_fading_distance, 0, 1);
|
||||
|
||||
if (&controller == &controllers[focused_controller])
|
||||
if (focused_controller != (size_t)-1 and &controller == &controllers[focused_controller])
|
||||
alpha *= constants::gui::pointer_alpha;
|
||||
else
|
||||
alpha *= constants::gui::pointer_alpha_disabled;
|
||||
|
||||
ImU32 color_pressed = ImGui::GetColorU32(constants::gui::pointer_color_pressed, alpha);
|
||||
ImU32 color_unpressed = ImGui::GetColorU32(constants::gui::pointer_color_unpressed, alpha);
|
||||
|
||||
bool pressed = controller.second.trigger_clicked || controller.second.fingertip_touching;
|
||||
float radius_in = constants::gui::pointer_radius_in;
|
||||
float radius_out = radius_in + constants::gui::pointer_thickness * 0.5;
|
||||
|
||||
ImDrawList * draw_list = ImGui::GetForegroundDrawList();
|
||||
draw_list->PushClipRect(clip_rect_min, clip_rect_max);
|
||||
draw_list->AddCircleFilled(*position, constants::gui::pointer_radius_in, pressed ? color_pressed : color_unpressed);
|
||||
draw_list->AddCircle(*position, constants::gui::pointer_radius_out, ImGui::GetColorU32(constants::gui::pointer_color_border, alpha), 0, constants::gui::pointer_thickness);
|
||||
draw_list->AddCircleFilled(*position, radius_in, ImGui::GetColorU32(constants::gui::pointer_color, alpha));
|
||||
draw_list->AddCircle(*position, radius_out, ImGui::GetColorU32(constants::gui::pointer_color_border, alpha), 0, constants::gui::pointer_thickness);
|
||||
draw_list->PopClipRect();
|
||||
}
|
||||
}
|
||||
|
||||
if (auto modal_popup = ImGui::GetTopMostAndVisiblePopupModal(); modal_popup != nullptr)
|
||||
{
|
||||
ImDrawList * draw_list = ImGui::GetForegroundDrawList();
|
||||
for (ImGuiWindow * window: context->Windows)
|
||||
{
|
||||
if (window == modal_popup or window->ParentWindow != nullptr or not window->Active or window->Hidden or window->IsFallbackWindow)
|
||||
continue;
|
||||
|
||||
static const auto virtual_keyboard_id = ImHashStr("VirtualKeyboard");
|
||||
if (window->ID == virtual_keyboard_id)
|
||||
continue;
|
||||
|
||||
ImRect window_rect{
|
||||
window->Pos.x,
|
||||
window->Pos.y,
|
||||
window->Pos.x + window->Size.x,
|
||||
window->Pos.y + window->Size.y};
|
||||
|
||||
draw_list->AddRectFilled(window_rect.Min, window_rect.Max, ImGui::ColorConvertFloat4ToU32(wivrn::ui::current().dimming), window->WindowRounding);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Render();
|
||||
|
||||
current_command_buffer = (current_command_buffer + 1) % command_buffers.size();
|
||||
@@ -951,15 +1008,47 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_context::end_frame()
|
||||
for (auto & i: layers_)
|
||||
{
|
||||
bool visible = false;
|
||||
|
||||
ImRect layer_rect(
|
||||
i.vp_origin.x,
|
||||
i.vp_origin.y,
|
||||
i.vp_origin.x + i.vp_size.x,
|
||||
i.vp_origin.y + i.vp_size.y);
|
||||
|
||||
ImRect all_windows_rect{
|
||||
std::numeric_limits<float>::max(),
|
||||
std::numeric_limits<float>::max(),
|
||||
std::numeric_limits<float>::lowest(),
|
||||
std::numeric_limits<float>::lowest(),
|
||||
};
|
||||
|
||||
for (ImGuiWindow * window: context->Windows)
|
||||
{
|
||||
if (window->Active and not window->Hidden and window_intersects_viewport(window, i))
|
||||
ImRect window_rect{
|
||||
window->Pos.x,
|
||||
window->Pos.y,
|
||||
window->Pos.x + window->Size.x,
|
||||
window->Pos.y + window->Size.y};
|
||||
|
||||
if (window->Active and not window->Hidden and layer_rect.Overlaps(window_rect))
|
||||
{
|
||||
visible = true;
|
||||
break;
|
||||
|
||||
// Take the union of all visible windows in this layer
|
||||
all_windows_rect.Add(window_rect);
|
||||
}
|
||||
}
|
||||
|
||||
// Take the intersection with the layer
|
||||
all_windows_rect.ClipWithFull(layer_rect);
|
||||
|
||||
glm::vec2 pixel_size = i.size / glm::vec2(i.vp_size);
|
||||
glm::vec2 all_windows_center(all_windows_rect.GetCenter().x, all_windows_rect.GetCenter().y);
|
||||
glm::vec2 layer_center(layer_rect.GetCenter().x, layer_rect.GetCenter().y);
|
||||
|
||||
glm::vec3 new_position = i.position + i.orientation * glm::vec3((all_windows_center - layer_center) * pixel_size, 0);
|
||||
glm::vec2 new_size = glm::vec2(all_windows_rect.GetWidth(), all_windows_rect.GetHeight()) * pixel_size;
|
||||
|
||||
if (not visible)
|
||||
continue;
|
||||
|
||||
@@ -974,12 +1063,12 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_context::end_frame()
|
||||
.swapchain = swapchain,
|
||||
.imageRect = {
|
||||
.offset = {
|
||||
.x = i.vp_origin.x,
|
||||
.y = i.vp_origin.y,
|
||||
.x = int(all_windows_rect.Min.x),
|
||||
.y = int(all_windows_rect.Min.y),
|
||||
},
|
||||
.extent = {
|
||||
.width = i.vp_size.x,
|
||||
.height = i.vp_size.y,
|
||||
.width = int(all_windows_rect.Max.x - all_windows_rect.Min.x),
|
||||
.height = int(all_windows_rect.Max.y - all_windows_rect.Min.y),
|
||||
}},
|
||||
},
|
||||
.pose = {
|
||||
@@ -990,14 +1079,14 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_context::end_frame()
|
||||
.w = i.orientation.w,
|
||||
},
|
||||
.position = {
|
||||
.x = i.position.x,
|
||||
.y = i.position.y,
|
||||
.z = i.position.z,
|
||||
.x = new_position.x,
|
||||
.y = new_position.y,
|
||||
.z = new_position.z,
|
||||
},
|
||||
},
|
||||
.size = {
|
||||
.width = i.size.x,
|
||||
.height = i.size.y,
|
||||
.width = new_size.x,
|
||||
.height = new_size.y,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1005,6 +1094,50 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_context::end_frame()
|
||||
return quads;
|
||||
}
|
||||
|
||||
std::vector<imgui_context::window_viewport> imgui_context::windows()
|
||||
{
|
||||
std::vector<imgui_context::window_viewport> w;
|
||||
|
||||
for (const imgui_context::viewport & layer: layers_)
|
||||
{
|
||||
if (layer.space != xr::spaces::world)
|
||||
continue;
|
||||
|
||||
ImRect v(layer.vp_origin.x, layer.vp_origin.y, layer.vp_origin.x + layer.vp_size.x, layer.vp_origin.y + layer.vp_size.y);
|
||||
|
||||
for (ImGuiWindow * window: context->Windows)
|
||||
{
|
||||
if (not window->Active or window->Hidden or (window->Flags & ImGuiWindowFlags_ChildWindow))
|
||||
continue;
|
||||
|
||||
if (not window_intersects_viewport(window, layer))
|
||||
continue;
|
||||
|
||||
// The window intersects the viewport: compute the window position in the real world
|
||||
ImVec2 max = ImMin(v.Max, window->Pos + window->Size);
|
||||
ImVec2 min = ImMax(v.Min, window->Pos);
|
||||
ImVec2 center = (min + max) / 2;
|
||||
|
||||
w.push_back(window_viewport{
|
||||
.space = layer.space,
|
||||
.position = layer.position +
|
||||
glm::mat3_cast(layer.orientation) *
|
||||
glm::vec3(
|
||||
((center.x - layer.vp_origin.x) / layer.vp_size.x - 0.5) * layer.size.x,
|
||||
(-(center.y - layer.vp_origin.y) / layer.vp_size.y + 0.5) * layer.size.y,
|
||||
0),
|
||||
.orientation = layer.orientation,
|
||||
.size = {
|
||||
(max.x - min.x) * layer.size.x / layer.vp_size.x,
|
||||
(max.y - min.y) * layer.size.y / layer.vp_size.y,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
void imgui_context::vibrate_on_hover()
|
||||
{
|
||||
if (ImGui::IsItemHovered())
|
||||
@@ -1039,12 +1172,12 @@ imgui_context::~imgui_context()
|
||||
ImGui::DestroyContext(context);
|
||||
}
|
||||
|
||||
ImTextureID imgui_textures::load_texture(const std::string & filename, vk::raii::Sampler && sampler)
|
||||
ImTextureID imgui_textures::load_texture(const std::string & filename)
|
||||
{
|
||||
return load_texture(utils::mapped_file{filename}, std::move(sampler), filename);
|
||||
return load_texture(utils::mapped_file{filename}, filename);
|
||||
}
|
||||
|
||||
ImTextureID imgui_textures::load_texture(const std::span<const std::byte> & bytes, vk::raii::Sampler && sampler, const std::string & name)
|
||||
ImTextureID imgui_textures::load_texture(const std::span<const std::byte> & bytes, const std::string & name)
|
||||
{
|
||||
bool srgb = true;
|
||||
|
||||
@@ -1057,7 +1190,6 @@ ImTextureID imgui_textures::load_texture(const std::span<const std::byte> & byte
|
||||
std::shared_ptr<vk::raii::DescriptorSet> ds = descriptor_pool.allocate();
|
||||
|
||||
vk::DescriptorImageInfo image_info{
|
||||
.sampler = *sampler,
|
||||
.imageView = *image->image_view,
|
||||
.imageLayout = vk::ImageLayout::eShaderReadOnlyOptimal,
|
||||
};
|
||||
@@ -1065,7 +1197,7 @@ ImTextureID imgui_textures::load_texture(const std::span<const std::byte> & byte
|
||||
vk::WriteDescriptorSet ds_write{
|
||||
.dstSet = **ds,
|
||||
.descriptorCount = 1,
|
||||
.descriptorType = vk::DescriptorType::eCombinedImageSampler,
|
||||
.descriptorType = vk::DescriptorType::eSampledImage,
|
||||
.pImageInfo = &image_info};
|
||||
|
||||
device.updateDescriptorSets(ds_write, nullptr);
|
||||
@@ -1075,7 +1207,6 @@ ImTextureID imgui_textures::load_texture(const std::span<const std::byte> & byte
|
||||
textures.emplace(
|
||||
id,
|
||||
texture_data{
|
||||
.sampler = std::move(sampler),
|
||||
.image = image,
|
||||
.descriptor_set = std::move(ds),
|
||||
});
|
||||
@@ -1083,43 +1214,6 @@ ImTextureID imgui_textures::load_texture(const std::span<const std::byte> & byte
|
||||
return id;
|
||||
}
|
||||
|
||||
ImTextureID imgui_textures::load_texture(const std::span<const std::byte> & bytes, const std::string & name)
|
||||
{
|
||||
return load_texture(
|
||||
bytes,
|
||||
vk::raii::Sampler{
|
||||
device,
|
||||
vk::SamplerCreateInfo{
|
||||
.magFilter = vk::Filter::eLinear,
|
||||
.minFilter = vk::Filter::eLinear,
|
||||
.mipmapMode = vk::SamplerMipmapMode::eLinear,
|
||||
.addressModeU = vk::SamplerAddressMode::eClampToEdge,
|
||||
.addressModeV = vk::SamplerAddressMode::eClampToEdge,
|
||||
.addressModeW = vk::SamplerAddressMode::eClampToEdge,
|
||||
.borderColor = vk::BorderColor::eFloatTransparentBlack,
|
||||
},
|
||||
},
|
||||
name);
|
||||
}
|
||||
|
||||
ImTextureID imgui_textures::load_texture(const std::string & filename)
|
||||
{
|
||||
return load_texture(
|
||||
filename,
|
||||
vk::raii::Sampler{
|
||||
device,
|
||||
vk::SamplerCreateInfo{
|
||||
.magFilter = vk::Filter::eLinear,
|
||||
.minFilter = vk::Filter::eLinear,
|
||||
.mipmapMode = vk::SamplerMipmapMode::eLinear,
|
||||
.addressModeU = vk::SamplerAddressMode::eClampToEdge,
|
||||
.addressModeV = vk::SamplerAddressMode::eClampToEdge,
|
||||
.addressModeW = vk::SamplerAddressMode::eClampToEdge,
|
||||
.borderColor = vk::BorderColor::eFloatTransparentBlack,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
void imgui_textures::free_texture(ImTextureID texture)
|
||||
{
|
||||
textures.erase(texture);
|
||||
@@ -1136,11 +1230,6 @@ void imgui_context::set_controllers_enabled(bool value)
|
||||
controllers_enabled = value;
|
||||
}
|
||||
|
||||
bool imgui_context::is_modal_popup_shown() const
|
||||
{
|
||||
return ImGui::GetTopMostAndVisiblePopupModal() != nullptr;
|
||||
}
|
||||
|
||||
imgui_context::viewport & imgui_context::layer(ImVec2 position)
|
||||
{
|
||||
for (auto & layer: layers_)
|
||||
@@ -1152,51 +1241,72 @@ imgui_context::viewport & imgui_context::layer(ImVec2 position)
|
||||
return layers_.front();
|
||||
}
|
||||
|
||||
void imgui_context::tooltip(std::string_view text)
|
||||
void imgui_context::place_layer_relative(size_t layer, size_t base, glm::vec3 offset, glm::quat extra_rotation)
|
||||
{
|
||||
const viewport & b = layers_[base];
|
||||
viewport & l = layers_[layer];
|
||||
l.orientation = b.orientation * extra_rotation;
|
||||
l.position = b.position + glm::mat3_cast(b.orientation) * offset;
|
||||
}
|
||||
|
||||
void imgui_context::tooltip(std::string_view text, std::optional<ImVec2> anchor)
|
||||
{
|
||||
// FIXME: this is incorrect if we use the docking branch of imgui
|
||||
ImGuiViewport * viewport = ImGui::GetMainViewport();
|
||||
auto & current_layer = layer(ImGui::GetMousePos());
|
||||
auto & current_layer = layer(anchor.value_or(ImGui::GetMousePos()));
|
||||
|
||||
assert(std::ranges::contains(layers_, true, &viewport::tooltip_viewport));
|
||||
auto & tooltip_layer = *std::ranges::find(layers_, true, &viewport::tooltip_viewport);
|
||||
|
||||
// anchor above the given display point, or above the last item's rect (top center)
|
||||
ImVec2 item_position = anchor.value_or(ImVec2{
|
||||
(ImGui::GetItemRectMin().x + ImGui::GetItemRectMax().x) / 2,
|
||||
ImGui::GetItemRectMin().y,
|
||||
});
|
||||
|
||||
auto pos_backup = viewport->Pos;
|
||||
auto size_backup = viewport->Size;
|
||||
viewport->Pos = ImVec2(current_layer.vp_origin.x, current_layer.vp_origin.y);
|
||||
viewport->Size = ImVec2(current_layer.vp_size.x, current_layer.vp_size.y);
|
||||
|
||||
ImVec2 pos{
|
||||
(ImGui::GetItemRectMin().x + ImGui::GetItemRectMax().x) / 2,
|
||||
ImGui::GetItemRectMin().y - constants::style::tooltip_distance,
|
||||
};
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, constants::style::tooltip_padding);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, constants::style::tooltip_rounding);
|
||||
viewport->Pos = ImVec2(tooltip_layer.vp_origin.x, tooltip_layer.vp_origin.y);
|
||||
viewport->Size = ImVec2(tooltip_layer.vp_size.x, tooltip_layer.vp_size.y);
|
||||
|
||||
// Draw the tooltip in the tooltip layer, themed
|
||||
// Clamp position to avoid overflowing on the left or the right
|
||||
const wivrn::ui::theme & t = wivrn::ui::current();
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, wivrn::ui::metrics::tooltip_padding);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, t.card_rounding);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, t.border_size);
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, t.card);
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, t.border);
|
||||
|
||||
auto & style = ImGui::GetStyle();
|
||||
const ImVec2 text_size = ImGui::CalcTextSize(text.data(), text.data() + text.size(), true);
|
||||
const ImVec2 size = {text_size.x + style.WindowPadding.x * 2.0f, text_size.y + style.WindowPadding.y * 2.0f};
|
||||
pos.x = std::clamp<float>(pos.x, viewport->Pos.x + size.x / 2, viewport->Pos.x + viewport->Size.x - size.x / 2);
|
||||
ImVec2 pivot = {0.5, 1};
|
||||
const ImVec2 tooltip_size = {text_size.x + style.WindowPadding.x * 2.0f, text_size.y + style.WindowPadding.y * 2.0f};
|
||||
|
||||
// Move tooltip below the item if it overflows on the top
|
||||
if (pos.y - size.y <= viewport->Pos.y)
|
||||
{
|
||||
pos.y = ImGui::GetItemRectMax().y + constants::style::tooltip_distance;
|
||||
pivot.y = 0;
|
||||
}
|
||||
|
||||
ImGui::SetNextWindowPos(pos, ImGuiCond_Always, pivot);
|
||||
ImGui::SetNextWindowPos(viewport->Pos + viewport->Size * 0.5, ImGuiCond_Always, {0.5, 0.5});
|
||||
ImGui::SetNextWindowSizeConstraints({0, 0}, viewport->Size);
|
||||
if (ImGui::BeginTooltip())
|
||||
{
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, 0xffffffff);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, t.col(t.text));
|
||||
ImGui::TextUnformatted(text.data(), text.data() + text.size());
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
ImGui::PopStyleVar(2);
|
||||
ImGui::PopStyleColor(2);
|
||||
ImGui::PopStyleVar(3);
|
||||
|
||||
viewport->Pos = pos_backup;
|
||||
viewport->Size = size_backup;
|
||||
|
||||
// Compute the tooltip position
|
||||
glm::quat tooltip_orientation = current_layer.orientation;
|
||||
auto M = glm::mat3_cast(tooltip_orientation);
|
||||
|
||||
float pixel_size = current_layer.size.y / current_layer.vp_size.y;
|
||||
glm::vec3 tooltip_position_centre = rw_from_vp(item_position) + M * (glm::vec3(0, tooltip_size.y / 2, 0) * pixel_size + constants::gui::tooltip_distance);
|
||||
|
||||
// Position the tooltip layer
|
||||
tooltip_layer.position = tooltip_position_centre;
|
||||
tooltip_layer.orientation = tooltip_orientation;
|
||||
}
|
||||
|
||||
// https://github.com/ocornut/imgui/issues/3379#issuecomment-2943903877
|
||||
@@ -1213,9 +1323,15 @@ void ScrollWhenDragging()
|
||||
static int active_id;
|
||||
static ImVec2 cumulated_delta;
|
||||
|
||||
// don't drag while a popup is open or just closed: the ray snaps back and synthesises a click
|
||||
static bool popup_was_open;
|
||||
const bool popup_open = ImGui::IsPopupOpen(nullptr, ImGuiPopupFlags_AnyPopupId | ImGuiPopupFlags_AnyPopupLevel);
|
||||
|
||||
bool HoveredIdAllowOverlap_backup = std::exchange(g.HoveredIdAllowOverlap, true);
|
||||
bool ActiveIdAllowOverlap_backup = std::exchange(g.ActiveIdAllowOverlap, true);
|
||||
if (active_id == 0 and ImGui::ItemHoverable(window->Rect(), 0, g.CurrentItemFlags) and ImGui::IsMouseClicked(mouse_button, ImGuiInputFlags_None, /*id*/ ImGuiKeyOwner_Any))
|
||||
// start only over this window or a child card, and only with no active widget
|
||||
const bool over = ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows);
|
||||
if (active_id == 0 and g.ActiveId == 0 and not popup_open and not popup_was_open and over and ImGui::IsMouseClicked(mouse_button, ImGuiInputFlags_None, /*id*/ ImGuiKeyOwner_Any))
|
||||
{
|
||||
active_id = id;
|
||||
|
||||
@@ -1241,6 +1357,8 @@ void ScrollWhenDragging()
|
||||
|
||||
g.HoveredIdAllowOverlap = HoveredIdAllowOverlap_backup;
|
||||
g.ActiveIdAllowOverlap = ActiveIdAllowOverlap_backup;
|
||||
|
||||
popup_was_open = popup_open;
|
||||
}
|
||||
|
||||
void CenterTextH(const std::string & text)
|
||||
@@ -1281,62 +1399,3 @@ void CenterTextHV(const std::string & text)
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
void InputText(const char * label, std::string & text, const ImVec2 & size, ImGuiInputTextFlags flags)
|
||||
{
|
||||
auto callback = [](ImGuiInputTextCallbackData * data) -> int {
|
||||
std::string & text = *reinterpret_cast<std::string *>(data->UserData);
|
||||
|
||||
if (data->EventFlag == ImGuiInputTextFlags_CallbackResize)
|
||||
{
|
||||
assert(text.data() == data->Buf);
|
||||
text.resize(data->BufTextLen);
|
||||
data->Buf = text.data();
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
ImGui::InputTextEx(label, nullptr, text.data(), text.size() + 1, size, flags | ImGuiInputTextFlags_CallbackResize, callback, &text);
|
||||
}
|
||||
|
||||
bool RadioButtonWithoutCheckBox(const std::string & label, bool active, ImVec2 size_arg)
|
||||
{
|
||||
ImGuiWindow * window = ImGui::GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
|
||||
ImGuiContext & g = *GImGui;
|
||||
const ImGuiStyle & style = g.Style;
|
||||
const ImGuiID id = window->GetID(label.c_str());
|
||||
const ImVec2 label_size = ImGui::CalcTextSize(label.c_str(), NULL, true);
|
||||
|
||||
const ImVec2 pos = window->DC.CursorPos;
|
||||
|
||||
ImVec2 size = ImGui::CalcItemSize(size_arg, label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f);
|
||||
|
||||
const ImRect bb(pos, pos + size);
|
||||
ImGui::ItemSize(bb, style.FramePadding.y);
|
||||
if (!ImGui::ItemAdd(bb, id))
|
||||
return false;
|
||||
|
||||
bool hovered, held;
|
||||
bool pressed = ImGui::ButtonBehavior(bb, id, &hovered, &held);
|
||||
|
||||
ImGuiCol_ col;
|
||||
if ((held && hovered) || active)
|
||||
col = ImGuiCol_ButtonActive;
|
||||
else if (hovered)
|
||||
col = ImGuiCol_ButtonHovered;
|
||||
else
|
||||
col = ImGuiCol_Button;
|
||||
|
||||
ImGui::RenderNavHighlight(bb, id);
|
||||
ImGui::RenderFrame(bb.Min, bb.Max, ImGui::GetColorU32(col), true, style.FrameRounding);
|
||||
|
||||
ImVec2 TextAlign{0, 0.5f};
|
||||
ImGui::RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label.c_str(), NULL, &label_size, TextAlign, &bb);
|
||||
|
||||
IMGUI_TEST_ENGINE_ITEM_INFO(id, label.c_str(), g.LastItemData.StatusFlags);
|
||||
return pressed;
|
||||
}
|
||||
|
||||
+29
-24
@@ -21,6 +21,7 @@
|
||||
#include "image_loader.h"
|
||||
#include "render/growable_descriptor_pool.h"
|
||||
#include "utils/cache.h"
|
||||
#include "utils/mapped_file.h"
|
||||
#include "utils/thread_safe.h"
|
||||
#include "wivrn_config.h"
|
||||
#include "xr/hand_tracker.h"
|
||||
@@ -30,6 +31,7 @@
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <imgui.h>
|
||||
#include <implot.h>
|
||||
#include <inplace_vector.hpp>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <unordered_map>
|
||||
@@ -42,7 +44,6 @@ class imgui_textures
|
||||
{
|
||||
struct texture_data
|
||||
{
|
||||
vk::raii::Sampler sampler;
|
||||
std::shared_ptr<loaded_image> image;
|
||||
std::shared_ptr<vk::raii::DescriptorSet> descriptor_set;
|
||||
};
|
||||
@@ -68,9 +69,8 @@ public:
|
||||
uint32_t queue_family_index,
|
||||
thread_safe<vk::raii::Queue> & queue,
|
||||
std::shared_ptr<image_cache_type> image_cache = {});
|
||||
ImTextureID load_texture(const std::string & filename, vk::raii::Sampler && sampler);
|
||||
~imgui_textures();
|
||||
ImTextureID load_texture(const std::string & filename);
|
||||
ImTextureID load_texture(const std::span<const std::byte> & bytes, vk::raii::Sampler && sampler, const std::string & name = "");
|
||||
ImTextureID load_texture(const std::span<const std::byte> & bytes, const std::string & name = "");
|
||||
void free_texture(ImTextureID);
|
||||
};
|
||||
@@ -108,8 +108,6 @@ public:
|
||||
|
||||
struct controller_state
|
||||
{
|
||||
bool active = false;
|
||||
|
||||
glm::vec3 aim_position = {0, 0, 0};
|
||||
glm::quat aim_orientation = {1, 0, 0, 0};
|
||||
|
||||
@@ -117,11 +115,10 @@ public:
|
||||
glm::vec2 scroll_value = {0, 0};
|
||||
|
||||
std::optional<ImVec2> pointer_position;
|
||||
float hover_distance = 1e10;
|
||||
// float hover_distance = 1e10;
|
||||
|
||||
bool squeeze_clicked = false;
|
||||
bool trigger_clicked = false;
|
||||
bool fingertip_hovering = false;
|
||||
bool fingertip_touching = false;
|
||||
ImGuiMouseSource source = ImGuiMouseSource_Mouse;
|
||||
};
|
||||
@@ -139,6 +136,7 @@ public:
|
||||
glm::ivec2 vp_size;
|
||||
|
||||
bool always_show_cursor = false; // Show the cursor in this viewport even if there is a modal popup elsewhere (eg. this is a virtual keyboard)
|
||||
bool tooltip_viewport = false; // Choose this viewport to display the tooltip, ignore mouse events
|
||||
|
||||
int z_index = 0;
|
||||
|
||||
@@ -148,6 +146,15 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
struct window_viewport
|
||||
{
|
||||
// Position of this window in the world
|
||||
xr::spaces space;
|
||||
glm::vec3 position;
|
||||
glm::quat orientation;
|
||||
glm::vec2 size;
|
||||
};
|
||||
|
||||
private:
|
||||
uint32_t queue_family_index;
|
||||
|
||||
@@ -186,6 +193,8 @@ private:
|
||||
bool button_pressed = false;
|
||||
bool fingertip_touching = false;
|
||||
|
||||
std::array<float, 2> aim_interaction = {1, 1}; // left, right, floating point to fade the cursor position between poking and hand interaction
|
||||
|
||||
ImGuiID hovered_item = 0; // Hovered item in the current frame, reset at the beginning of the frame
|
||||
ImGuiID hovered_item_prev = 0; // Hovered item at the previous frame
|
||||
|
||||
@@ -193,6 +202,7 @@ private:
|
||||
bool show_demo_window = true;
|
||||
#endif
|
||||
|
||||
beman::inplace_vector::inplace_vector<utils::mapped_file, 3> font_awesome;
|
||||
void initialize_fonts();
|
||||
|
||||
std::vector<controller_state> read_controllers_state(XrTime display_time);
|
||||
@@ -216,6 +226,11 @@ public:
|
||||
return layers_;
|
||||
}
|
||||
|
||||
// place a satellite layer at base orientation (optionally post-rotated), offset in the base's local frame
|
||||
void place_layer_relative(size_t layer, size_t base, glm::vec3 offset, glm::quat extra_rotation = glm::quat(1, 0, 0, 0));
|
||||
|
||||
std::vector<window_viewport> windows();
|
||||
|
||||
viewport & layer(ImVec2 position);
|
||||
|
||||
void new_frame(XrTime display_time);
|
||||
@@ -227,19 +242,22 @@ public:
|
||||
}
|
||||
|
||||
std::vector<std::pair<ImVec2, float>> ray_plane_intersection(const controller_state & in) const;
|
||||
void compute_pointer_position(controller_state & state);
|
||||
[[nodiscard]] std::pair<std::optional<ImVec2>, float> compute_pointer_position(const controller_state & state) const;
|
||||
|
||||
// Convert position from viewport coordinates to real-world
|
||||
glm::vec3 rw_from_vp(const ImVec2 & position);
|
||||
|
||||
void set_current();
|
||||
|
||||
bool is_modal_popup_shown() const;
|
||||
|
||||
void vibrate_on_hover();
|
||||
void set_hovered_item();
|
||||
void set_controllers_enabled(bool value);
|
||||
void tooltip(std::string_view text);
|
||||
// anchor, if set, positions the tooltip above that display point instead of above the last item's rect
|
||||
void tooltip(std::string_view text, std::optional<ImVec2> anchor = std::nullopt);
|
||||
std::array<bool, 2> is_aim_interaction() const
|
||||
{
|
||||
return {aim_interaction[0] == 1, aim_interaction[1] == 1};
|
||||
}
|
||||
};
|
||||
|
||||
void ScrollWhenDragging();
|
||||
@@ -247,16 +265,3 @@ void ScrollWhenDragging();
|
||||
void CenterTextH(const std::string & text);
|
||||
|
||||
void CenterTextHV(const std::string & text);
|
||||
|
||||
void InputText(const char * label, std::string & text, const ImVec2 & size, ImGuiInputTextFlags flags);
|
||||
|
||||
bool RadioButtonWithoutCheckBox(const std::string & label, bool active, ImVec2 size_arg);
|
||||
|
||||
template <typename T, typename U>
|
||||
static bool RadioButtonWithoutCheckBox(const std::string & label, T & v, U v_button, ImVec2 size_arg)
|
||||
{
|
||||
const bool pressed = RadioButtonWithoutCheckBox(label, v == v_button, size_arg);
|
||||
if (pressed)
|
||||
v = v_button;
|
||||
return pressed;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <inplace_vector.hpp>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
@@ -55,6 +56,14 @@ struct texture
|
||||
|
||||
struct material
|
||||
{
|
||||
struct alignas(16) texture_info
|
||||
{
|
||||
alignas(4) uint32_t texcoord = 0;
|
||||
alignas(4) float rotation = 0;
|
||||
alignas(8) glm::vec2 offset = {0, 0};
|
||||
alignas(8) glm::vec2 scale = {1, 1};
|
||||
};
|
||||
|
||||
struct gpu_data
|
||||
{
|
||||
glm::vec4 base_color_factor = glm::vec4(1, 1, 1, 1);
|
||||
@@ -65,13 +74,11 @@ struct material
|
||||
float normal_scale = 1;
|
||||
float alpha_cutoff = 0.5;
|
||||
|
||||
uint32_t base_color_texcoord = 0;
|
||||
uint32_t metallic_roughness_texcoord = 0;
|
||||
uint32_t occlusion_texcoord = 0;
|
||||
uint32_t emissive_texcoord = 0;
|
||||
uint32_t normal_texcoord = 0;
|
||||
|
||||
// TODO: add fastgltf::TextureTransform?
|
||||
texture_info base_color;
|
||||
texture_info metallic_roughness;
|
||||
texture_info occlusion;
|
||||
texture_info emissive;
|
||||
texture_info normal;
|
||||
};
|
||||
|
||||
std::shared_ptr<texture> base_color_texture;
|
||||
@@ -94,7 +101,7 @@ struct material
|
||||
size_t offset;
|
||||
|
||||
std::string name;
|
||||
std::string fragment_shader_name = "lit.frag";
|
||||
std::string fragment_shader = "lit.frag";
|
||||
};
|
||||
|
||||
struct primitive
|
||||
@@ -104,7 +111,7 @@ struct primitive
|
||||
uint32_t vertex_count;
|
||||
vk::IndexType index_type;
|
||||
vk::DeviceSize index_offset;
|
||||
std::vector<vk::DeviceSize> vertex_offset; // TODO: inplace_vector
|
||||
beman::inplace_vector::inplace_vector<vk::DeviceSize, 8> vertex_offset; // See VkPhysicalDeviceLimits::maxVertexInputBindings
|
||||
vertex_layout layout;
|
||||
|
||||
glm::vec3 obb_min;
|
||||
@@ -149,11 +156,24 @@ struct node
|
||||
bool visible = true;
|
||||
uint32_t layer_mask = -1;
|
||||
|
||||
std::array<glm::vec4, 4> clipping_planes;
|
||||
|
||||
// TODO: separate component?
|
||||
std::vector<std::pair<entt::entity, glm::mat4>> joints; // Node index, inverse bind matrix of each joint
|
||||
|
||||
std::vector<std::byte> extra_shader_data;
|
||||
template <typename T>
|
||||
void set_extra_shader_data(const T & data)
|
||||
{
|
||||
extra_shader_data.resize(sizeof(std::decay_t<T>));
|
||||
memcpy(extra_shader_data.data(), &data, sizeof(std::decay_t<T>));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T & get_extra_shader_data()
|
||||
{
|
||||
assert(extra_shader_data.size() == sizeof(std::decay_t<T>));
|
||||
return *reinterpret_cast<T *>(extra_shader_data.data());
|
||||
}
|
||||
|
||||
// For internal use by the renderer
|
||||
glm::mat4 transform_to_root;
|
||||
bool global_visible;
|
||||
@@ -174,7 +194,7 @@ struct animation_track_base
|
||||
interpolation_t interpolation;
|
||||
};
|
||||
|
||||
template <auto node::*Field>
|
||||
template <auto node::* Field>
|
||||
struct animation_track_impl : animation_track_base
|
||||
{
|
||||
static const constexpr auto field = Field;
|
||||
|
||||
+155
-67
@@ -19,6 +19,7 @@
|
||||
#include "scene_loader.h"
|
||||
|
||||
#include "gpu_buffer.h"
|
||||
#include "hmd_traits.h"
|
||||
#include "image_loader.h"
|
||||
#include "render/scene_components.h"
|
||||
#include "render/vertex_layout.h"
|
||||
@@ -45,6 +46,9 @@
|
||||
#include <limits>
|
||||
#include <ranges>
|
||||
#include <simdjson/dom.h>
|
||||
#include <simdjson/dom/element.h>
|
||||
#include <simdjson/dom/object.h>
|
||||
#include <simdjson/error.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <string>
|
||||
#include <vulkan/vulkan_format_traits.hpp>
|
||||
@@ -166,6 +170,11 @@ glm::vec3 convert(const fastgltf::math::nvec3 & v)
|
||||
return {v[0], v[1], v[2]};
|
||||
}
|
||||
|
||||
glm::vec2 convert(const fastgltf::math::nvec2 & v)
|
||||
{
|
||||
return {v[0], v[1]};
|
||||
}
|
||||
|
||||
components::animation_track_base::interpolation_t convert(fastgltf::AnimationInterpolation interpolation)
|
||||
{
|
||||
switch (interpolation)
|
||||
@@ -266,19 +275,45 @@ void write_vertex_attribute_aux(std::byte * output, size_t stride, int component
|
||||
{
|
||||
case 1:
|
||||
for (size_t i = 0, n = input.size(); i < n; i++, output += stride)
|
||||
*reinterpret_cast<glm::vec<1, T> *>(output) = glm::vec<1, T>(input[i].x);
|
||||
*reinterpret_cast<glm::vec<1, T> *>(output) = input[i];
|
||||
break;
|
||||
case 2:
|
||||
for (size_t i = 0, n = input.size(); i < n; i++, output += stride)
|
||||
*reinterpret_cast<glm::vec<2, T> *>(output) = glm::vec<2, T>(input[i].x, input[i].y);
|
||||
*reinterpret_cast<glm::vec<2, T> *>(output) = input[i];
|
||||
break;
|
||||
case 3:
|
||||
for (size_t i = 0, n = input.size(); i < n; i++, output += stride)
|
||||
*reinterpret_cast<glm::vec<3, T> *>(output) = glm::vec<3, T>(input[i].x, input[i].y, input[i].z);
|
||||
*reinterpret_cast<glm::vec<3, T> *>(output) = input[i];
|
||||
break;
|
||||
case 4:
|
||||
for (size_t i = 0, n = input.size(); i < n; i++, output += stride)
|
||||
*reinterpret_cast<glm::vec<3, T> *>(output) = glm::vec<4, T>(input[i].x, input[i].y, input[i].z, input[i].w);
|
||||
*reinterpret_cast<glm::vec<4, T> *>(output) = input[i];
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void write_vertex_attribute_aux(std::byte * output, size_t stride, int components, glm::vec4 value, size_t size)
|
||||
{
|
||||
switch (components)
|
||||
{
|
||||
case 1:
|
||||
for (size_t i = 0, n = size; i < n; i++, output += stride)
|
||||
*reinterpret_cast<glm::vec<1, T> *>(output) = value;
|
||||
break;
|
||||
case 2:
|
||||
for (size_t i = 0, n = size; i < n; i++, output += stride)
|
||||
*reinterpret_cast<glm::vec<2, T> *>(output) = value;
|
||||
break;
|
||||
case 3:
|
||||
for (size_t i = 0, n = size; i < n; i++, output += stride)
|
||||
*reinterpret_cast<glm::vec<3, T> *>(output) = value;
|
||||
break;
|
||||
case 4:
|
||||
for (size_t i = 0, n = size; i < n; i++, output += stride)
|
||||
*reinterpret_cast<glm::vec<4, T> *>(output) = value;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
@@ -303,6 +338,24 @@ void write_vertex_attribute(std::vector<std::byte> & output, size_t offset, size
|
||||
}
|
||||
}
|
||||
|
||||
void write_vertex_attribute(std::vector<std::byte> & output, size_t offset, size_t stride, vk::Format format, glm::vec4 value, size_t size)
|
||||
{
|
||||
assert(output.size() >= size * stride);
|
||||
|
||||
switch (format)
|
||||
{
|
||||
case vk::Format::eR32Sfloat:
|
||||
case vk::Format::eR32G32Sfloat:
|
||||
case vk::Format::eR32G32B32Sfloat:
|
||||
case vk::Format::eR32G32B32A32Sfloat:
|
||||
write_vertex_attribute_aux<float>(output.data() + offset, stride, vk::componentCount(format), value, size);
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void copy_vertex_attributes(
|
||||
const fastgltf::Asset & asset,
|
||||
const fastgltf::Accessor & accessor,
|
||||
@@ -315,6 +368,18 @@ void copy_vertex_attributes(
|
||||
write_vertex_attribute(buffer, attribute.offset, binding.stride, attribute.format, read_vertex_attribute(asset, accessor));
|
||||
}
|
||||
|
||||
void fill_vertex_attributes(
|
||||
glm::vec4 value,
|
||||
size_t size,
|
||||
std::vector<std::byte> & buffer,
|
||||
const vk::VertexInputBindingDescription & binding,
|
||||
const vk::VertexInputAttributeDescription & attribute)
|
||||
{
|
||||
assert(buffer.size() >= size * binding.stride);
|
||||
|
||||
write_vertex_attribute(buffer, attribute.offset, binding.stride, attribute.format, value, size);
|
||||
}
|
||||
|
||||
std::pair<size_t, std::vector<std::vector<std::byte>>> create_vertex_buffers(
|
||||
const renderer::vertex_layout & layout,
|
||||
const fastgltf::Asset & asset,
|
||||
@@ -363,7 +428,20 @@ std::pair<size_t, std::vector<std::vector<std::byte>>> create_vertex_buffers(
|
||||
gltf_attribute = primitive.findAttribute(name + "_0");
|
||||
|
||||
if (gltf_attribute == primitive.attributes.cend())
|
||||
{
|
||||
// If the attribute is not specified in the glTF, use the default value or 0 if none is found
|
||||
static const std::unordered_map<std::string_view, glm::vec4> default_values = {
|
||||
std::pair{"COLOR", glm::vec4{1, 1, 1, 1}}};
|
||||
|
||||
if (auto iter = default_values.find(name); iter != default_values.end())
|
||||
fill_vertex_attributes(iter->second, vertex_count, buffer, binding, attribute);
|
||||
else
|
||||
{
|
||||
// The buffer is already initialized at 0
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
const fastgltf::Accessor & accessor = asset.accessors.at(gltf_attribute->accessorIndex);
|
||||
@@ -439,15 +517,23 @@ struct : std::error_category
|
||||
} fastgltf_error_category;
|
||||
// END
|
||||
|
||||
fastgltf::Asset load_gltf_asset(fastgltf::GltfDataBuffer & buffer, const std::filesystem::path & directory)
|
||||
fastgltf::Asset load_gltf_asset(fastgltf::GltfDataBuffer & buffer, const std::filesystem::path & directory, std::function<void(simdjson::dom::object &, std::size_t, fastgltf::Category)> extra_callback)
|
||||
{
|
||||
fastgltf::Parser parser(fastgltf::Extensions::KHR_texture_basisu);
|
||||
fastgltf::Parser parser(
|
||||
fastgltf::Extensions::KHR_texture_basisu |
|
||||
fastgltf::Extensions::KHR_texture_transform);
|
||||
|
||||
auto gltf_options =
|
||||
fastgltf::Options::DontRequireValidAssetMember |
|
||||
fastgltf::Options::AllowDouble |
|
||||
fastgltf::Options::DecomposeNodeMatrices;
|
||||
|
||||
parser.setUserPointer(&extra_callback);
|
||||
parser.setExtrasParseCallback([](simdjson::dom::object * extras, std::size_t object_index, fastgltf::Category category, void * user_pointer) {
|
||||
auto f = reinterpret_cast<std::function<void(simdjson::dom::object &, std::size_t, fastgltf::Category)> *>(user_pointer);
|
||||
(*f)(*extras, object_index, category);
|
||||
});
|
||||
|
||||
auto expected_asset = parser.loadGltf(buffer, directory, gltf_options);
|
||||
|
||||
if (auto error = expected_asset.error(); error != fastgltf::Error::None)
|
||||
@@ -464,7 +550,8 @@ class loader_context
|
||||
vk::raii::PhysicalDevice physical_device;
|
||||
vk::raii::Device & device;
|
||||
thread_safe<vk::raii::Queue> & queue;
|
||||
image_loader & loader;
|
||||
image_loader loader;
|
||||
const std::map<std::tuple<fastgltf::Category, size_t, std::string>, std::string> & extras;
|
||||
|
||||
std::vector<utils::mapped_file> loaded_assets;
|
||||
utils::mapped_file & load_from_asset(const std::filesystem::path & path)
|
||||
@@ -487,14 +574,16 @@ public:
|
||||
vk::raii::PhysicalDevice physical_device,
|
||||
vk::raii::Device & device,
|
||||
thread_safe<vk::raii::Queue> & queue,
|
||||
image_loader & loader) :
|
||||
uint32_t queue_family_index,
|
||||
std::map<std::tuple<fastgltf::Category, size_t, std::string>, std::string> & extras) :
|
||||
base_directory(std::move(base_directory)),
|
||||
name(std::move(name)),
|
||||
gltf(gltf),
|
||||
physical_device(physical_device),
|
||||
device(device),
|
||||
queue(queue),
|
||||
loader(loader)
|
||||
loader(device, physical_device, queue, queue_family_index),
|
||||
extras(extras)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -717,6 +806,8 @@ public:
|
||||
materials.reserve(gltf.materials.size());
|
||||
for (const fastgltf::Material & gltf_material: gltf.materials)
|
||||
{
|
||||
size_t material_id = materials.size();
|
||||
|
||||
// Copy the default material, without references to its buffer or descriptor set
|
||||
auto & material = *materials.emplace_back(std::make_shared<renderer::material>(default_material));
|
||||
material.name = gltf_material.name;
|
||||
@@ -727,21 +818,27 @@ public:
|
||||
switch (gltf_material.alphaMode)
|
||||
{
|
||||
case fastgltf::AlphaMode::Opaque:
|
||||
material.fragment_shader_name = "lit.frag";
|
||||
material.fragment_shader = "lit.frag";
|
||||
material.blend_enable = false;
|
||||
break;
|
||||
|
||||
case fastgltf::AlphaMode::Mask:
|
||||
material.fragment_shader_name = "lit_mask.frag";
|
||||
material.fragment_shader = "lit_mask.frag";
|
||||
material.blend_enable = false;
|
||||
break;
|
||||
|
||||
case fastgltf::AlphaMode::Blend:
|
||||
material.fragment_shader_name = "lit.frag";
|
||||
material.fragment_shader = "lit.frag";
|
||||
material.blend_enable = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (auto it = extras.find({fastgltf::Category::Materials, material_id, "fragment_shader"}); it != extras.end())
|
||||
material.fragment_shader = it->second;
|
||||
|
||||
if (auto it = application::get_hmd_traits().override_shader.find(material.fragment_shader); it != application::get_hmd_traits().override_shader.end())
|
||||
material.fragment_shader = it->second;
|
||||
|
||||
renderer::material::gpu_data & material_data = material.staging;
|
||||
|
||||
material_data.base_color_factor = convert(gltf_material.pbrData.baseColorFactor);
|
||||
@@ -750,37 +847,37 @@ public:
|
||||
material_data.roughness_factor = gltf_material.pbrData.roughnessFactor;
|
||||
material_data.alpha_cutoff = gltf_material.alphaCutoff;
|
||||
|
||||
if (gltf_material.pbrData.baseColorTexture)
|
||||
{
|
||||
material.base_color_texture = textures.at(gltf_material.pbrData.baseColorTexture->textureIndex);
|
||||
material_data.base_color_texcoord = gltf_material.pbrData.baseColorTexture->texCoordIndex;
|
||||
}
|
||||
auto f = [&](const auto & texture_info,
|
||||
std::shared_ptr<renderer::texture> & texture,
|
||||
renderer::material::texture_info & info) {
|
||||
if (not texture_info)
|
||||
return;
|
||||
|
||||
if (gltf_material.pbrData.metallicRoughnessTexture)
|
||||
{
|
||||
material.metallic_roughness_texture = textures.at(gltf_material.pbrData.metallicRoughnessTexture->textureIndex);
|
||||
material_data.metallic_roughness_texcoord = gltf_material.pbrData.metallicRoughnessTexture->texCoordIndex;
|
||||
}
|
||||
texture = textures.at(texture_info->textureIndex);
|
||||
info.texcoord = texture_info->texCoordIndex;
|
||||
|
||||
if (auto & xform = texture_info->transform)
|
||||
{
|
||||
if (xform->texCoordIndex)
|
||||
info.texcoord = *xform->texCoordIndex;
|
||||
|
||||
info.rotation = xform->rotation;
|
||||
info.offset = convert(xform->uvOffset);
|
||||
info.scale = convert(xform->uvScale);
|
||||
}
|
||||
};
|
||||
|
||||
f(gltf_material.pbrData.baseColorTexture, material.base_color_texture, material_data.base_color);
|
||||
f(gltf_material.pbrData.metallicRoughnessTexture, material.metallic_roughness_texture, material_data.metallic_roughness);
|
||||
f(gltf_material.occlusionTexture, material.occlusion_texture, material_data.occlusion);
|
||||
f(gltf_material.emissiveTexture, material.emissive_texture, material_data.emissive);
|
||||
f(gltf_material.normalTexture, material.normal_texture, material_data.normal);
|
||||
|
||||
if (gltf_material.occlusionTexture)
|
||||
{
|
||||
material.occlusion_texture = textures.at(gltf_material.occlusionTexture->textureIndex);
|
||||
material_data.occlusion_texcoord = gltf_material.occlusionTexture->texCoordIndex;
|
||||
material_data.occlusion_strength = gltf_material.occlusionTexture->strength;
|
||||
}
|
||||
|
||||
if (gltf_material.emissiveTexture)
|
||||
{
|
||||
material.emissive_texture = textures.at(gltf_material.emissiveTexture->textureIndex);
|
||||
material_data.emissive_texcoord = gltf_material.emissiveTexture->texCoordIndex;
|
||||
}
|
||||
|
||||
if (gltf_material.normalTexture)
|
||||
{
|
||||
material.normal_texture = textures.at(gltf_material.normalTexture->textureIndex);
|
||||
material_data.normal_texcoord = gltf_material.normalTexture->texCoordIndex;
|
||||
material_data.normal_scale = gltf_material.normalTexture->scale;
|
||||
}
|
||||
|
||||
material.offset = staging_buffer.add_uniform(material_data);
|
||||
}
|
||||
@@ -794,6 +891,7 @@ public:
|
||||
meshes.reserve(gltf.meshes.size());
|
||||
for (const fastgltf::Mesh & gltf_mesh: gltf.meshes)
|
||||
{
|
||||
size_t mesh_id = meshes.size();
|
||||
std::shared_ptr<renderer::mesh> & mesh_ref = meshes.emplace_back();
|
||||
mesh_ref = std::make_shared<renderer::mesh>();
|
||||
|
||||
@@ -808,41 +906,24 @@ public:
|
||||
fastgltf::Accessor & indices_accessor = gltf.accessors.at(*gltf_primitive.indicesAccessor);
|
||||
|
||||
primitive_ref.indexed = true;
|
||||
primitive_ref.index_offset = staging_buffer.add_indices(indices_accessor);
|
||||
std::tie(primitive_ref.index_offset, primitive_ref.index_type) = staging_buffer.add_indices(indices_accessor);
|
||||
primitive_ref.index_count = indices_accessor.count;
|
||||
|
||||
switch (indices_accessor.componentType)
|
||||
{
|
||||
case fastgltf::ComponentType::Byte:
|
||||
case fastgltf::ComponentType::UnsignedByte:
|
||||
primitive_ref.index_type = vk::IndexType::eUint8EXT;
|
||||
break;
|
||||
|
||||
case fastgltf::ComponentType::Short:
|
||||
case fastgltf::ComponentType::UnsignedShort:
|
||||
primitive_ref.index_type = vk::IndexType::eUint16;
|
||||
break;
|
||||
|
||||
case fastgltf::ComponentType::Int:
|
||||
case fastgltf::ComponentType::UnsignedInt:
|
||||
primitive_ref.index_type = vk::IndexType::eUint32;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw std::runtime_error("Invalid index type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
primitive_ref.indexed = false;
|
||||
|
||||
renderer::vertex_layout & layout = primitive_ref.layout;
|
||||
|
||||
if (gltf_primitive.findAttribute("JOINTS_0") == gltf_primitive.attributes.cend())
|
||||
if (auto it = extras.find({fastgltf::Category::Meshes, mesh_id, "vertex_shader"}); it != extras.end())
|
||||
primitive_ref.vertex_shader = it->second;
|
||||
else if (gltf_primitive.findAttribute("JOINTS_0") == gltf_primitive.attributes.cend())
|
||||
primitive_ref.vertex_shader = "lit.vert";
|
||||
else
|
||||
primitive_ref.vertex_shader = "lit_skinned.vert";
|
||||
|
||||
if (auto it = application::get_hmd_traits().override_shader.find(primitive_ref.vertex_shader); it != application::get_hmd_traits().override_shader.end())
|
||||
primitive_ref.vertex_shader = it->second;
|
||||
|
||||
// For attributes types, see https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#meshes-overview (§ 3.7.2.1)
|
||||
auto shader = shader_loader{device}(primitive_ref.vertex_shader);
|
||||
for (const auto & input: shader->inputs)
|
||||
@@ -855,6 +936,7 @@ public:
|
||||
|
||||
int binding;
|
||||
|
||||
// Attributes that affect the vertices position go in a different buffer
|
||||
if (semantic == "POSITION" or
|
||||
semantic == "JOINTS" or
|
||||
semantic == "WEIGHTS")
|
||||
@@ -952,7 +1034,6 @@ public:
|
||||
node.orientation = glm::make_quat(TRS.rotation.data());
|
||||
node.scale = glm::make_vec3(TRS.scale.data());
|
||||
node.visible = true;
|
||||
std::ranges::fill(node.clipping_planes, glm::vec4{0, 0, 0, 1});
|
||||
}
|
||||
|
||||
return entities;
|
||||
@@ -1089,16 +1170,23 @@ std::shared_ptr<entt::registry> scene_loader::operator()(
|
||||
const std::filesystem::path & gltf_texture_cache,
|
||||
std::function<void(float)> progress_cb)
|
||||
{
|
||||
vk::PhysicalDeviceProperties physical_device_properties = physical_device.getProperties();
|
||||
|
||||
auto data_buffer = fastgltf::GltfDataBuffer::FromBytes(data.data(), data.size());
|
||||
if (auto error = data_buffer.error(); error != fastgltf::Error::None)
|
||||
throw std::system_error((int)error, fastgltf_error_category);
|
||||
|
||||
fastgltf::Asset asset = load_gltf_asset(data_buffer.get(), parent_path);
|
||||
std::map<std::tuple<fastgltf::Category, size_t, std::string>, std::string> gltf_extras;
|
||||
|
||||
image_loader loader{device, physical_device, queue, queue_family_index};
|
||||
loader_context ctx{parent_path, name, asset, physical_device, device, queue, loader};
|
||||
fastgltf::Asset asset = load_gltf_asset(data_buffer.get(), parent_path, [&](simdjson::dom::object & extras, std::size_t object_index, fastgltf::Category category) {
|
||||
std::string_view value;
|
||||
|
||||
for (const auto & kv: extras)
|
||||
{
|
||||
if (kv.value.get_string().get(value) == simdjson::SUCCESS)
|
||||
gltf_extras.emplace(std::tuple{category, object_index, kv.key}, value);
|
||||
}
|
||||
});
|
||||
|
||||
loader_context ctx{parent_path, name, asset, physical_device, device, queue, queue_family_index, gltf_extras};
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (auto error = fastgltf::validate(asset); error != fastgltf::Error::None)
|
||||
@@ -1108,7 +1196,7 @@ std::shared_ptr<entt::registry> scene_loader::operator()(
|
||||
// Load all buffers from URIs
|
||||
ctx.load_all_buffers();
|
||||
|
||||
gpu_buffer staging_buffer(physical_device_properties, asset);
|
||||
gpu_buffer staging_buffer(physical_device, asset);
|
||||
|
||||
// Load all textures
|
||||
auto textures = ctx.load_all_textures(gltf_texture_cache, progress_cb);
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "vk/pipeline.h"
|
||||
#include "vk/shader.h"
|
||||
#include "vk/specialization_constants.h"
|
||||
#include <algorithm>
|
||||
#include <boost/pfr/core.hpp>
|
||||
#include <entt/entity/entity.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
@@ -138,7 +139,7 @@ std::shared_ptr<renderer::texture> scene_renderer::create_default_texture(image_
|
||||
return std::make_shared<renderer::texture>(image_view, renderer::sampler_info{});
|
||||
}
|
||||
|
||||
std::shared_ptr<renderer::material> scene_renderer::create_default_material(vk::raii::CommandPool & cb_pool)
|
||||
std::shared_ptr<renderer::material> scene_renderer::create_default_material()
|
||||
{
|
||||
image_loader loader(device, physical_device, queue, queue_family_index);
|
||||
|
||||
@@ -261,7 +262,7 @@ static std::array layout_bindings_0{
|
||||
.binding = 8,
|
||||
.descriptorType = vk::DescriptorType::eUniformBuffer,
|
||||
.descriptorCount = 1,
|
||||
.stageFlags = vk::ShaderStageFlagBits::eFragment,
|
||||
.stageFlags = vk::ShaderStageFlagBits::eVertex | vk::ShaderStageFlagBits::eFragment,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -285,7 +286,7 @@ scene_renderer::scene_renderer(
|
||||
layout_0(create_descriptor_set_layout(layout_bindings_0, vk::DescriptorSetLayoutCreateFlagBits::ePushDescriptorKHR))
|
||||
{
|
||||
// Create the default material
|
||||
default_material = create_default_material(cb_pool);
|
||||
default_material = create_default_material();
|
||||
|
||||
// Create Vulkan resources
|
||||
frame_resources.resize(frames_in_flight);
|
||||
@@ -339,7 +340,7 @@ scene_renderer::renderpass & scene_renderer::get_renderpass(const renderpass_inf
|
||||
|
||||
scene_renderer::renderpass scene_renderer::create_renderpass(const renderpass_info & info_)
|
||||
{
|
||||
vk::StructureChain<vk::RenderPassCreateInfo, vk::RenderPassFragmentDensityMapCreateInfoEXT, vk::RenderPassMultiviewCreateInfo> info;
|
||||
vk::StructureChain<vk::RenderPassCreateInfo, vk::RenderPassMultiviewCreateInfo> info;
|
||||
scene_renderer::renderpass rp;
|
||||
|
||||
std::vector<vk::AttachmentDescription> attachments;
|
||||
@@ -391,29 +392,6 @@ scene_renderer::renderpass scene_renderer::create_renderpass(const renderpass_in
|
||||
});
|
||||
}
|
||||
|
||||
if (info_.fragment_density_map)
|
||||
{
|
||||
vk::RenderPassFragmentDensityMapCreateInfoEXT & fragment_density_info = info.get<vk::RenderPassFragmentDensityMapCreateInfoEXT>();
|
||||
rp.fragment_density_attachment = {
|
||||
.attachment = (uint32_t)attachments.size(),
|
||||
.layout = vk::ImageLayout::eFragmentDensityMapOptimalEXT,
|
||||
};
|
||||
fragment_density_info.fragmentDensityMapAttachment = {
|
||||
.attachment = (uint32_t)attachments.size(),
|
||||
.layout = vk::ImageLayout::eFragmentDensityMapOptimalEXT,
|
||||
};
|
||||
attachments.push_back(vk::AttachmentDescription{
|
||||
.format = vk::Format::eR8G8Unorm,
|
||||
.samples = vk::SampleCountFlagBits::e1,
|
||||
.loadOp = vk::AttachmentLoadOp::eLoad,
|
||||
.storeOp = vk::AttachmentStoreOp::eDontCare,
|
||||
.initialLayout = vk::ImageLayout::eFragmentDensityMapOptimalEXT,
|
||||
.finalLayout = vk::ImageLayout::eFragmentDensityMapOptimalEXT,
|
||||
});
|
||||
}
|
||||
else
|
||||
info.unlink<vk::RenderPassFragmentDensityMapCreateInfoEXT>();
|
||||
|
||||
info.get().setAttachments(attachments);
|
||||
|
||||
vk::SubpassDescription subpasses{
|
||||
@@ -572,27 +550,6 @@ scene_renderer::output_image scene_renderer::create_output_image_data(const outp
|
||||
});
|
||||
}
|
||||
|
||||
if (info.renderpass.fragment_density_map)
|
||||
{
|
||||
assert(info.foveation != VK_NULL_HANDLE);
|
||||
|
||||
out.foveation_view = vk::raii::ImageView(
|
||||
device,
|
||||
vk::ImageViewCreateInfo{
|
||||
.image = info.foveation,
|
||||
.viewType = vk::ImageViewType::e2DArray,
|
||||
.format = vk::Format::eR8G8Unorm,
|
||||
.components{},
|
||||
.subresourceRange = {
|
||||
.aspectMask = vk::ImageAspectFlagBits::eColor,
|
||||
.baseMipLevel = 0,
|
||||
.levelCount = 1,
|
||||
.baseArrayLayer = 0,
|
||||
.layerCount = info.renderpass.multiview_count,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
vk::FramebufferCreateInfo fb_info{
|
||||
.renderPass = *get_renderpass(info.renderpass).renderpass,
|
||||
.width = info.output_size.width,
|
||||
@@ -617,9 +574,6 @@ scene_renderer::output_image scene_renderer::create_output_image_data(const outp
|
||||
|
||||
attachments[rp.depth_attachment.attachment] = vk::ImageView{*out.depth_view};
|
||||
|
||||
if (rp.fragment_density_attachment)
|
||||
attachments[rp.fragment_density_attachment->attachment] = vk::ImageView{*out.foveation_view};
|
||||
|
||||
fb_info.setAttachments(attachments);
|
||||
out.framebuffer = vk::raii::Framebuffer(device, fb_info);
|
||||
return out;
|
||||
@@ -675,8 +629,8 @@ vk::raii::Pipeline scene_renderer::create_pipeline(const pipeline_info & info)
|
||||
{
|
||||
spdlog::debug("Creating pipeline");
|
||||
|
||||
auto vertex_shader = shader_loader{device}(info.vertex_shader_name);
|
||||
auto fragment_shader = shader_loader{device}(info.fragment_shader_name);
|
||||
auto vertex_shader = load_shader(device, info.vertex_shader_name);
|
||||
auto fragment_shader = load_shader(device, info.fragment_shader_name);
|
||||
|
||||
auto specialization = make_specialization_constants(
|
||||
int32_t(info.nb_texcoords),
|
||||
@@ -732,7 +686,7 @@ vk::raii::Pipeline scene_renderer::create_pipeline(const pipeline_info & info)
|
||||
.ColorBlendState = {vk::PipelineColorBlendStateCreateInfo{}},
|
||||
.ColorBlendAttachments = {vk::PipelineColorBlendAttachmentState{
|
||||
.blendEnable = info.blend_enable,
|
||||
.srcColorBlendFactor = vk::BlendFactor::eSrcAlpha,
|
||||
.srcColorBlendFactor = vk::BlendFactor::eOne,
|
||||
.dstColorBlendFactor = vk::BlendFactor::eOneMinusSrcAlpha,
|
||||
.colorBlendOp = vk::BlendOp::eAdd,
|
||||
.srcAlphaBlendFactor = vk::BlendFactor::eOne,
|
||||
@@ -910,7 +864,6 @@ void scene_renderer::render(
|
||||
vk::Format depth_format,
|
||||
vk::Image color_buffer,
|
||||
vk::Image depth_buffer,
|
||||
vk::Image foveation_image,
|
||||
std::span<frame_info> frames,
|
||||
bool render_debug_draws)
|
||||
{
|
||||
@@ -963,7 +916,6 @@ void scene_renderer::render(
|
||||
.keep_depth_buffer = depth_buffer != vk::Image{},
|
||||
.msaa_samples = vk::SampleCountFlagBits::e1,
|
||||
// .msaa_samples = vk::SampleCountFlagBits::e4, // FIXME: MSAA does not work
|
||||
.fragment_density_map = foveation_image != vk::Image{},
|
||||
.multiview_count = (uint32_t)frames.size(),
|
||||
};
|
||||
vk::raii::RenderPass & renderpass = get_renderpass(rp_info).renderpass;
|
||||
@@ -1050,7 +1002,7 @@ void scene_renderer::render(
|
||||
return false;
|
||||
|
||||
// If blending is disabled (std::get<0> == false), put the closest objects first
|
||||
// If blending is enabled (std::get<0> == true), put the farthest objeccts first
|
||||
// If blending is enabled (std::get<0> == true), put the farthest objects first
|
||||
return std::get<0>(a) ^ (std::get<1>(a) > std::get<1>(b));
|
||||
});
|
||||
|
||||
@@ -1059,7 +1011,6 @@ void scene_renderer::render(
|
||||
.output_size = output_size,
|
||||
.color = color_buffer,
|
||||
.depth = depth_buffer,
|
||||
.foveation = foveation_image,
|
||||
});
|
||||
|
||||
vk::DeviceSize frame_ubo_offset = resources.uniform_buffer_offset;
|
||||
@@ -1106,8 +1057,12 @@ void scene_renderer::render(
|
||||
|
||||
// TODO: reuse the UBO if another primitive of the same mesh has already been drawn
|
||||
vk::DeviceSize instance_ubo_offset = resources.uniform_buffer_offset;
|
||||
vk::DeviceSize instance_ubo_size = sizeof(instance_gpu_data) + node.extra_shader_data.size();
|
||||
|
||||
instance_gpu_data & object_ubo = *reinterpret_cast<instance_gpu_data *>(ubo + resources.uniform_buffer_offset);
|
||||
resources.uniform_buffer_offset += utils::align_up(buffer_alignment, sizeof(instance_gpu_data));
|
||||
std::span<std::byte> extra_shader_data{reinterpret_cast<std::byte *>(ubo + resources.uniform_buffer_offset + sizeof(instance_gpu_data)), node.extra_shader_data.size()};
|
||||
|
||||
resources.uniform_buffer_offset += utils::align_up(buffer_alignment, sizeof(instance_gpu_data) + node.extra_shader_data.size());
|
||||
|
||||
vk::DeviceSize joints_ubo_offset = 0;
|
||||
if (!node.joints.empty())
|
||||
@@ -1130,7 +1085,7 @@ void scene_renderer::render(
|
||||
object_ubo.modelview[frame_index] = frame.view * transform;
|
||||
object_ubo.modelviewproj[frame_index] = viewproj[frame_index] * transform;
|
||||
}
|
||||
object_ubo.clipping_planes = node.clipping_planes;
|
||||
std::ranges::copy(node.extra_shader_data, extra_shader_data.begin());
|
||||
|
||||
// Get the material
|
||||
std::shared_ptr<renderer::material> material = primitive.material_ ? primitive.material_ : default_material;
|
||||
@@ -1139,7 +1094,7 @@ void scene_renderer::render(
|
||||
pipeline_info info{
|
||||
.renderpass = rp_info,
|
||||
.vertex_shader_name = primitive.vertex_shader,
|
||||
.fragment_shader_name = material->fragment_shader_name,
|
||||
.fragment_shader_name = material->fragment_shader,
|
||||
.vertex_layout = primitive.layout,
|
||||
.cull_mode = primitive.cull_mode,
|
||||
.front_face = primitive.front_face,
|
||||
@@ -1187,7 +1142,7 @@ void scene_renderer::render(
|
||||
vk::DescriptorBufferInfo buffer_info_2{
|
||||
.buffer = resources.uniform_buffer,
|
||||
.offset = instance_ubo_offset,
|
||||
.range = sizeof(instance_gpu_data),
|
||||
.range = instance_ubo_size,
|
||||
};
|
||||
vk::DescriptorBufferInfo buffer_info_3{
|
||||
.buffer = resources.uniform_buffer,
|
||||
|
||||
@@ -44,7 +44,6 @@ struct renderpass_info
|
||||
vk::Format depth_format;
|
||||
bool keep_depth_buffer;
|
||||
vk::SampleCountFlagBits msaa_samples = vk::SampleCountFlagBits::e1;
|
||||
bool fragment_density_map;
|
||||
uint32_t multiview_count;
|
||||
|
||||
bool operator==(const renderpass_info & other) const noexcept = default;
|
||||
@@ -81,7 +80,6 @@ struct output_image_info
|
||||
vk::Extent2D output_size;
|
||||
VkImage color;
|
||||
VkImage depth;
|
||||
VkImage foveation;
|
||||
|
||||
bool operator==(const output_image_info & other) const noexcept = default;
|
||||
};
|
||||
@@ -127,8 +125,6 @@ class scene_renderer
|
||||
|
||||
image_allocation multisample_image;
|
||||
vk::raii::ImageView multisample_view = nullptr;
|
||||
|
||||
vk::raii::ImageView foveation_view = nullptr;
|
||||
};
|
||||
|
||||
struct renderpass
|
||||
@@ -148,7 +144,7 @@ class scene_renderer
|
||||
vk::raii::Pipeline create_pipeline(const pipeline_info & info);
|
||||
|
||||
std::shared_ptr<renderer::texture> create_default_texture(image_loader & loader, std::vector<uint8_t> pixel, const std::string & name);
|
||||
std::shared_ptr<renderer::material> create_default_material(vk::raii::CommandPool & cb_pool);
|
||||
std::shared_ptr<renderer::material> create_default_material();
|
||||
vk::raii::DescriptorSetLayout create_descriptor_set_layout(std::span<vk::DescriptorSetLayoutBinding> bindings, vk::DescriptorSetLayoutCreateFlags flags = {});
|
||||
|
||||
// Caches
|
||||
@@ -199,7 +195,6 @@ class scene_renderer
|
||||
glm::mat4 model;
|
||||
std::array<glm::mat4, 2> modelview;
|
||||
std::array<glm::mat4, 2> modelviewproj;
|
||||
std::array<glm::vec4, 4> clipping_planes;
|
||||
};
|
||||
|
||||
struct debug_draw_vertex
|
||||
@@ -280,7 +275,6 @@ public:
|
||||
vk::Format depth_format,
|
||||
vk::Image color_buffer,
|
||||
vk::Image depth_buffer,
|
||||
vk::Image foveation_image,
|
||||
std::span<frame_info> info,
|
||||
bool render_debug_draws = false);
|
||||
void end_frame();
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2026 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
* Copyright (C) 2026 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ui_theme.h"
|
||||
#include "utils/i18n.h"
|
||||
|
||||
namespace wivrn::ui
|
||||
{
|
||||
|
||||
static ImVec4 rgb(int r, int g, int b, float a = 1)
|
||||
{
|
||||
return {r / 255.f, g / 255.f, b / 255.f, a};
|
||||
}
|
||||
|
||||
static theme dark_default()
|
||||
{
|
||||
theme t;
|
||||
t.name = "Dark";
|
||||
t.localized_name = _C("theme name", "Dark");
|
||||
|
||||
t.accent = rgb(30, 115, 255);
|
||||
t.accent_hovered = rgb(64, 140, 255);
|
||||
t.accent_active = rgb(18, 95, 228);
|
||||
t.on_accent = rgb(255, 255, 255);
|
||||
|
||||
t.background = rgb(10, 11, 13);
|
||||
t.card = rgb(22, 24, 29);
|
||||
t.card_hovered = rgb(28, 30, 36);
|
||||
t.control = rgb(35, 38, 46);
|
||||
t.control_hovered = rgb(44, 48, 57);
|
||||
t.control_active = rgb(52, 57, 68);
|
||||
|
||||
t.text = rgb(244, 245, 248);
|
||||
t.text_muted = rgb(150, 156, 167);
|
||||
t.border = rgb(40, 43, 51);
|
||||
|
||||
t.danger = rgb(239, 68, 68);
|
||||
t.danger_hovered = rgb(248, 96, 96);
|
||||
t.success = rgb(52, 199, 123);
|
||||
t.warning = rgb(249, 115, 6);
|
||||
|
||||
t.dimming = rgb(128, 128, 128, 0.5f);
|
||||
|
||||
t.rounding = 8;
|
||||
t.card_rounding = 14;
|
||||
t.border_size = 1;
|
||||
t.font_scale = 1.0; // user multiplier, 100% maps to metrics::font_base
|
||||
return t;
|
||||
}
|
||||
|
||||
static theme midnight()
|
||||
{
|
||||
theme t = dark_default();
|
||||
t.name = "Midnight";
|
||||
t.localized_name = _C("theme name", "Midnight");
|
||||
t.background = rgb(6, 8, 16);
|
||||
t.card = rgb(16, 20, 34);
|
||||
t.card_hovered = rgb(22, 27, 44);
|
||||
t.control = rgb(28, 34, 54);
|
||||
t.control_hovered = rgb(36, 43, 66);
|
||||
t.control_active = rgb(44, 52, 78);
|
||||
t.border = rgb(30, 37, 58);
|
||||
return t;
|
||||
}
|
||||
|
||||
static theme slate_light()
|
||||
{
|
||||
theme t = dark_default();
|
||||
t.name = "Slate";
|
||||
t.localized_name = _C("theme name", "Slate");
|
||||
t.background = rgb(28, 30, 36);
|
||||
t.card = rgb(38, 41, 49);
|
||||
t.card_hovered = rgb(46, 50, 60);
|
||||
t.control = rgb(54, 59, 70);
|
||||
t.control_hovered = rgb(64, 70, 83);
|
||||
t.control_active = rgb(74, 81, 96);
|
||||
t.text = rgb(236, 238, 242);
|
||||
t.text_muted = rgb(168, 174, 186);
|
||||
t.border = rgb(58, 63, 75);
|
||||
return t;
|
||||
}
|
||||
|
||||
// True black, ideal for OLED panels
|
||||
static theme oled()
|
||||
{
|
||||
theme t = dark_default();
|
||||
t.name = "OLED";
|
||||
t.localized_name = _C("theme name", "OLED");
|
||||
t.background = rgb(0, 0, 0);
|
||||
t.card = rgb(6, 6, 8);
|
||||
t.card_hovered = rgb(11, 12, 14);
|
||||
t.control = rgb(22, 24, 28);
|
||||
t.control_hovered = rgb(30, 32, 38);
|
||||
t.control_active = rgb(40, 43, 50);
|
||||
t.border = rgb(26, 28, 33);
|
||||
return t;
|
||||
}
|
||||
|
||||
// Neutral dark gray
|
||||
static theme graphite()
|
||||
{
|
||||
theme t = dark_default();
|
||||
t.name = "Graphite";
|
||||
t.localized_name = _C("theme name", "Graphite");
|
||||
t.background = rgb(20, 21, 23);
|
||||
t.card = rgb(31, 33, 36);
|
||||
t.card_hovered = rgb(39, 41, 45);
|
||||
t.control = rgb(48, 51, 56);
|
||||
t.control_hovered = rgb(58, 62, 68);
|
||||
t.control_active = rgb(68, 72, 80);
|
||||
t.text = rgb(238, 240, 243);
|
||||
t.text_muted = rgb(160, 164, 172);
|
||||
t.border = rgb(50, 53, 59);
|
||||
return t;
|
||||
}
|
||||
|
||||
// Light surfaces, dark text
|
||||
static theme light()
|
||||
{
|
||||
theme t = dark_default();
|
||||
t.name = "Light";
|
||||
t.localized_name = _C("theme name", "Light");
|
||||
t.background = rgb(188, 193, 202);
|
||||
t.card = rgb(252, 252, 253);
|
||||
t.card_hovered = rgb(242, 243, 246);
|
||||
t.control = rgb(206, 210, 219);
|
||||
t.control_hovered = rgb(193, 198, 208);
|
||||
t.control_active = rgb(178, 184, 196);
|
||||
t.text = rgb(14, 16, 20);
|
||||
t.text_muted = rgb(66, 72, 84);
|
||||
t.border = rgb(176, 182, 194);
|
||||
t.success = rgb(36, 147, 90);
|
||||
return t;
|
||||
}
|
||||
|
||||
std::vector<theme> presets()
|
||||
{
|
||||
return {oled(), dark_default(), midnight(), graphite(), slate_light(), light()};
|
||||
}
|
||||
|
||||
std::vector<accent_swatch> accent_swatches()
|
||||
{
|
||||
return {
|
||||
{"Blue", rgb(30, 115, 255), rgb(64, 140, 255), rgb(18, 95, 228)},
|
||||
{"Violet", rgb(132, 72, 255), rgb(152, 98, 255), rgb(112, 52, 232)},
|
||||
{"Emerald", rgb(0, 200, 132), rgb(28, 214, 150), rgb(0, 172, 112)},
|
||||
{"Amber", rgb(255, 160, 0), rgb(255, 176, 36), rgb(228, 140, 0)},
|
||||
{"Rose", rgb(255, 40, 82), rgb(255, 74, 108), rgb(230, 28, 68)},
|
||||
{"Cyan", rgb(0, 190, 225), rgb(34, 205, 236), rgb(0, 168, 200)},
|
||||
};
|
||||
}
|
||||
|
||||
void set_accent(const accent_swatch & swatch)
|
||||
{
|
||||
theme & t = current();
|
||||
t.accent = swatch.base;
|
||||
t.accent_hovered = swatch.hovered;
|
||||
t.accent_active = swatch.active;
|
||||
}
|
||||
|
||||
theme & current()
|
||||
{
|
||||
static theme t = dark_default();
|
||||
return t;
|
||||
}
|
||||
|
||||
void set_theme(const theme & t)
|
||||
{
|
||||
current() = t;
|
||||
}
|
||||
|
||||
float & background_alpha()
|
||||
{
|
||||
static float alpha = 0.75f; // translucent panels by default
|
||||
return alpha;
|
||||
}
|
||||
|
||||
void theme::apply() const
|
||||
{
|
||||
ImGuiStyle & style = ImGui::GetStyle();
|
||||
|
||||
style.FontScaleMain = font_scale;
|
||||
style.WindowRounding = card_rounding;
|
||||
style.ChildRounding = card_rounding;
|
||||
style.PopupRounding = card_rounding;
|
||||
style.FrameRounding = rounding;
|
||||
style.GrabRounding = rounding;
|
||||
style.TabRounding = rounding;
|
||||
style.FrameBorderSize = border_size;
|
||||
style.WindowBorderSize = border_size;
|
||||
|
||||
ImVec4 * c = style.Colors;
|
||||
c[ImGuiCol_Text] = text;
|
||||
c[ImGuiCol_TextDisabled] = text_muted;
|
||||
c[ImGuiCol_WindowBg] = background;
|
||||
c[ImGuiCol_ChildBg] = card;
|
||||
c[ImGuiCol_PopupBg] = card;
|
||||
c[ImGuiCol_Border] = border;
|
||||
c[ImGuiCol_FrameBg] = control;
|
||||
c[ImGuiCol_FrameBgHovered] = control_hovered;
|
||||
c[ImGuiCol_FrameBgActive] = control_active;
|
||||
c[ImGuiCol_Button] = control;
|
||||
c[ImGuiCol_ButtonHovered] = control_hovered;
|
||||
c[ImGuiCol_ButtonActive] = accent;
|
||||
c[ImGuiCol_Header] = control_hovered;
|
||||
c[ImGuiCol_HeaderHovered] = control_hovered;
|
||||
c[ImGuiCol_HeaderActive] = accent;
|
||||
c[ImGuiCol_SliderGrab] = accent;
|
||||
c[ImGuiCol_SliderGrabActive] = accent_active;
|
||||
c[ImGuiCol_CheckMark] = accent;
|
||||
c[ImGuiCol_ScrollbarBg] = {0, 0, 0, 0};
|
||||
c[ImGuiCol_ScrollbarGrab] = control;
|
||||
c[ImGuiCol_ScrollbarGrabHovered] = control_hovered;
|
||||
c[ImGuiCol_ScrollbarGrabActive] = control_active;
|
||||
c[ImGuiCol_Separator] = border;
|
||||
}
|
||||
|
||||
} // namespace wivrn::ui
|
||||
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2026 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
* Copyright (C) 2026 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <imgui.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wivrn::ui
|
||||
{
|
||||
|
||||
struct theme
|
||||
{
|
||||
std::string name;
|
||||
std::string localized_name;
|
||||
|
||||
// Accent
|
||||
ImVec4 accent;
|
||||
ImVec4 accent_hovered;
|
||||
ImVec4 accent_active;
|
||||
ImVec4 on_accent; // text/icon on an accent fill
|
||||
|
||||
// Surfaces, back to front
|
||||
ImVec4 background;
|
||||
ImVec4 card;
|
||||
ImVec4 card_hovered;
|
||||
ImVec4 control; // slider rail, secondary button, input
|
||||
ImVec4 control_hovered;
|
||||
ImVec4 control_active;
|
||||
|
||||
// Content
|
||||
ImVec4 text;
|
||||
ImVec4 text_muted;
|
||||
ImVec4 border;
|
||||
|
||||
// Semantic
|
||||
ImVec4 danger;
|
||||
ImVec4 danger_hovered;
|
||||
ImVec4 success;
|
||||
ImVec4 warning;
|
||||
|
||||
// Dimming when a modal popup is visible
|
||||
ImVec4 dimming;
|
||||
|
||||
// Shape, in pixels
|
||||
float rounding; // buttons, inputs, sliders
|
||||
float card_rounding; // cards
|
||||
float border_size;
|
||||
|
||||
float font_scale; // global text size multiplier
|
||||
|
||||
// packed color with the current global alpha applied, so draw-list widgets dim with BeginDisabled()
|
||||
ImU32 col(const ImVec4 & c) const
|
||||
{
|
||||
ImVec4 v = c;
|
||||
v.w *= ImGui::GetStyle().Alpha;
|
||||
return ImGui::ColorConvertFloat4ToU32(v);
|
||||
}
|
||||
|
||||
// push colors and metrics into the global ImGui style
|
||||
void apply() const;
|
||||
};
|
||||
|
||||
// fixed design tokens shared by the widgets
|
||||
namespace metrics
|
||||
{
|
||||
constexpr float font_base = 0.765; // user-facing 100% text scale
|
||||
constexpr float font_title = 1.7; // page header, x base font size
|
||||
constexpr float font_description = 0.82; // muted secondary text, x base font size
|
||||
|
||||
constexpr ImVec2 button_padding = {26, 14};
|
||||
constexpr ImVec2 card_padding = {28, 22}; // regular cards
|
||||
constexpr ImVec2 list_card_padding = {18, 18}; // cards holding a list of rows
|
||||
|
||||
// shared height of every full-width control so they line up in a setting row, x frame height
|
||||
constexpr float control_height = 1.65;
|
||||
|
||||
constexpr float toggle_aspect = 1.9; // track width / height
|
||||
constexpr float toggle_knob_inset = 3; // gap between track edge and knob
|
||||
|
||||
constexpr float slider_grab_width = 14;
|
||||
|
||||
constexpr float segmented_inset = 3; // gap around the active segment
|
||||
|
||||
constexpr float icon_button_glyph = 0.58; // glyph height as a fraction of the button side
|
||||
constexpr float button_label_glyph = 1.35; // leading icon size in a labeled button, x base text size
|
||||
|
||||
constexpr float combo_row_height = 2.2; // x frame height, big touch rows in the modal
|
||||
constexpr float combo_chevron = 12; // chevron size in the closed box
|
||||
constexpr float combo_modal_min_width = 460; // popup never narrower than this
|
||||
constexpr ImVec2 combo_padding = {16, 0}; // horizontal inner padding of box and rows
|
||||
|
||||
constexpr float list_row_box = 52; // leading icon/thumbnail size in a list row
|
||||
constexpr float list_row_box_large = 80; // min thumbnail size for full-height list rows
|
||||
constexpr float list_row_pad = 12; // inner padding of a list row, both axes
|
||||
constexpr ImVec2 chip_padding = {12, 6}; // inner padding of a chip/badge
|
||||
constexpr float chip_pill_padding_x = 18; // roomier horizontal padding for top-bar pill chips
|
||||
constexpr float input_padding_x = 14; // horizontal text padding inside inputs
|
||||
constexpr float font_modal_title = 1.2; // modal heading, x base font size
|
||||
|
||||
constexpr float label_line_gap = 5; // title to description
|
||||
constexpr float label_bottom_pad = 6; // breathing room below the description
|
||||
constexpr float nav_section_gap = 18; // space above a sidebar section header
|
||||
|
||||
constexpr ImVec2 card_item_spacing = {12, 10}; // ItemSpacing pushed around a card section
|
||||
constexpr float setting_control_width = 480; // width of the control in a setting row
|
||||
|
||||
// application shell: top bar, sidebar, content panel, shared by lobby and in-stream window
|
||||
constexpr float sidebar_width = 300;
|
||||
constexpr float top_bar_height = 72;
|
||||
constexpr float content_margin = 20; // gap around the main content panel
|
||||
|
||||
// application launcher grid
|
||||
constexpr float app_icon_small = 120;
|
||||
constexpr float app_icon_medium = 176;
|
||||
constexpr float app_icon_large = 240;
|
||||
constexpr float app_tile_margin = 24; // horizontal slack each side of the icon in a tile
|
||||
constexpr float app_view_toggle_width = 150; // grid/list segmented control
|
||||
constexpr float app_size_toggle_width = 300; // small/medium/large segmented control
|
||||
constexpr float app_spinner_radius = 110; // app-starting spinner
|
||||
constexpr float app_spinner_thickness = 22;
|
||||
|
||||
// modal/popup windows not yet on the card system (first-run, confirm dialogs, loading popup)
|
||||
constexpr ImVec2 window_padding = {20, 20};
|
||||
constexpr float window_rounding = 10;
|
||||
constexpr float window_border_size = 2;
|
||||
|
||||
constexpr ImVec2 tooltip_padding = {16, 12}; // hover tooltip window padding
|
||||
constexpr ImVec2 button_size = {220, 80}; // big touch buttons in confirm dialogs
|
||||
|
||||
// PIN entry keypad
|
||||
constexpr ImVec2 pin_entry_key_size = {90, 70};
|
||||
constexpr ImVec2 pin_entry_item_spacing = {10, 10};
|
||||
constexpr float pin_entry_popup_width = 3 * pin_entry_key_size.x + 2 * pin_entry_item_spacing.x;
|
||||
} // namespace metrics
|
||||
|
||||
// theme in effect, call current().apply() after mutating
|
||||
theme & current();
|
||||
void set_theme(const theme & t);
|
||||
|
||||
// panel and card background opacity, 0..1, kept out of the presets so switching palette keeps it
|
||||
float & background_alpha();
|
||||
|
||||
std::vector<theme> presets();
|
||||
|
||||
struct accent_swatch
|
||||
{
|
||||
const char * name;
|
||||
ImVec4 base;
|
||||
ImVec4 hovered;
|
||||
ImVec4 active;
|
||||
};
|
||||
std::vector<accent_swatch> accent_swatches();
|
||||
void set_accent(const accent_swatch & swatch);
|
||||
|
||||
} // namespace wivrn::ui
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user