Compare commits
333
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
079d760740 | ||
|
|
7870cc6484 | ||
|
|
43bbb8b0f8 | ||
|
|
2c9928db63 | ||
|
|
81363b3602 | ||
|
|
a291226a46 | ||
|
|
2e1e5571d6 | ||
|
|
d6768d59a7 | ||
|
|
12cddd4d6f | ||
|
|
b284daca6a | ||
|
|
d4854d77b0 | ||
|
|
35eb409403 | ||
|
|
caba985ce1 | ||
|
|
26bdd6e85b | ||
|
|
b725f95a55 | ||
|
|
867c78d826 | ||
|
|
7e33152f43 | ||
|
|
1e488a8a9c | ||
|
|
6be85971ea | ||
|
|
fe8c320d67 | ||
|
|
eb99b474ae | ||
|
|
857e5fce2c | ||
|
|
c381a0a6d6 | ||
|
|
f383eb8e8d | ||
|
|
a3c7a604e0 | ||
|
|
416297f232 | ||
|
|
205c84b273 | ||
|
|
727d4fab4d | ||
|
|
633c696a80 | ||
|
|
21c04be1f8 | ||
|
|
08ebe00a4d | ||
|
|
1c3b6dd2e3 | ||
|
|
9df93b2cad | ||
|
|
1ec4340c74 | ||
|
|
ea56845aea | ||
|
|
6356f37f4d | ||
|
|
c217577b81 | ||
|
|
ea7ab55198 | ||
|
|
01bc6e8804 | ||
|
|
0393f7cb07 | ||
|
|
e41410bcc9 | ||
|
|
dce89d655f | ||
|
|
331b2e875c | ||
|
|
832df65d17 | ||
|
|
d1d6c343a3 | ||
|
|
36b4da49e8 | ||
|
|
3df615cb8a | ||
|
|
04507e36f6 | ||
|
|
2e1ed8d87e | ||
|
|
9d8f64e6f2 | ||
|
|
3a442d3a87 | ||
|
|
da9392c791 | ||
|
|
291ab85bd6 | ||
|
|
1e2823c019 | ||
|
|
d9884014e6 | ||
|
|
1a35e1f7fc | ||
|
|
f4c4021e20 | ||
|
|
6fc48c7d4f | ||
|
|
5370d24789 | ||
|
|
52eef0e02e | ||
|
|
2095ab6f7e | ||
|
|
65a02bb04f | ||
|
|
83f00ebcf0 | ||
|
|
fc6fcda0cd | ||
|
|
d407368f64 | ||
|
|
366792cf46 | ||
|
|
a1f186eb23 | ||
|
|
8940220fc2 | ||
|
|
4c2e24536d | ||
|
|
172ef89dea | ||
|
|
bb4d12ef33 | ||
|
|
4afb3b5786 | ||
|
|
06ad530e2f | ||
|
|
a32a4e4182 | ||
|
|
5329bfd28c | ||
|
|
e4df4191ce | ||
|
|
f89606f8a9 | ||
|
|
d43d864dee | ||
|
|
2b9e267fc8 | ||
|
|
24faf2cd3b | ||
|
|
18457b8e9b | ||
|
|
8e7192c767 | ||
|
|
2585754497 | ||
|
|
3d3b712ba0 | ||
|
|
c16478b940 | ||
|
|
c0532ce6e4 | ||
|
|
ba3d582c92 | ||
|
|
741298be97 | ||
|
|
e6e32ce39d | ||
|
|
0d865ffc14 | ||
|
|
e46c317f87 | ||
|
|
340c0d546b | ||
|
|
ad31a8dfcc | ||
|
|
67e2627116 | ||
|
|
e1d5f0e636 | ||
|
|
225a0db69e | ||
|
|
f340dc5940 | ||
|
|
06bd4e430a | ||
|
|
2057aff195 | ||
|
|
7587b6ae84 | ||
|
|
5a669e71f5 | ||
|
|
6f32f049d7 | ||
|
|
9b4a26b5a8 | ||
|
|
db345c832d | ||
|
|
0b526cef9d | ||
|
|
e0cbd202a8 | ||
|
|
b2f3b925d9 | ||
|
|
5ab7731be3 | ||
|
|
5c50b9a1ad | ||
|
|
375cced814 | ||
|
|
bf811ac65d | ||
|
|
099d68a83d | ||
|
|
db622b4252 | ||
|
|
6638cefb37 | ||
|
|
740dcfdcfb | ||
|
|
46d06413f7 | ||
|
|
281dd6000e | ||
|
|
bd907d8496 | ||
|
|
854e4c7b57 | ||
|
|
c2c4978275 | ||
|
|
e394cb0dcb | ||
|
|
4553379d74 | ||
|
|
ca45eed21e | ||
|
|
fad0a8feee | ||
|
|
bb07e5afd7 | ||
|
|
694def436c | ||
|
|
0a2c374b52 | ||
|
|
fadaf7600a | ||
|
|
afc9766840 | ||
|
|
e01f5326c4 | ||
|
|
2c7812069e | ||
|
|
007aed6310 | ||
|
|
aef6c1bced | ||
|
|
8874ea8753 | ||
|
|
7a6c53acf0 | ||
|
|
d1308bfbb8 | ||
|
|
a37498eedf | ||
|
|
24380867d4 | ||
|
|
f2a202f29d | ||
|
|
831bdf7a29 | ||
|
|
53d94d6c04 | ||
|
|
b1aaeb78e8 | ||
|
|
51d8742029 | ||
|
|
ac0a926811 | ||
|
|
a4e5475ff7 | ||
|
|
804f85e7b8 | ||
|
|
eadd9a1813 | ||
|
|
f0ab1284f3 | ||
|
|
fc4a2bf49d | ||
|
|
e94901043b | ||
|
|
3cf46e03e3 | ||
|
|
f12ebe14bc | ||
|
|
85cde18718 | ||
|
|
23b643422b | ||
|
|
dd7be5c830 | ||
|
|
c183857113 | ||
|
|
c05104ba82 | ||
|
|
9eb3ecb4d5 | ||
|
|
c4d5a235d8 | ||
|
|
ab2ee24e90 | ||
|
|
20cf6ea2e0 | ||
|
|
3621404e71 | ||
|
|
e51d653bd7 | ||
|
|
3afed5549e | ||
|
|
6317d77dba | ||
|
|
6f50ba3979 | ||
|
|
f99fb8fa18 | ||
|
|
ab82fb5866 | ||
|
|
91a41b306e | ||
|
|
fbfda1fc40 | ||
|
|
8d531cbc53 | ||
|
|
c96d600db2 | ||
|
|
b907eb63ad | ||
|
|
7dc1daaf73 | ||
|
|
8e60a03aaf | ||
|
|
a8fa6c3961 | ||
|
|
bd4f21ab67 | ||
|
|
3f37bd7570 | ||
|
|
2e8a83eb5a | ||
|
|
6cd65de21d | ||
|
|
34a4ffcb59 | ||
|
|
8d13d910e8 | ||
|
|
5bdcf783cf | ||
|
|
1939ed027c | ||
|
|
0626bacc10 | ||
|
|
6273a54776 | ||
|
|
658d4997f2 | ||
|
|
f28d70e7b3 | ||
|
|
bc1c0b9e93 | ||
|
|
7c2057ec9e | ||
|
|
01c4f0343a | ||
|
|
aff498bc2d | ||
|
|
9a55178b41 | ||
|
|
1755c4de0b | ||
|
|
ead740a8d5 | ||
|
|
60563ef0de | ||
|
|
c31d3537d8 | ||
|
|
518d4b24d0 | ||
|
|
59cab00c52 | ||
|
|
65894401c1 | ||
|
|
231e4c1cc0 | ||
|
|
91c72de89c | ||
|
|
2264b68553 | ||
|
|
0b368aed08 | ||
|
|
7c84b55b6a | ||
|
|
3ba9fae20d | ||
|
|
7bcad7804b | ||
|
|
b5e59dabfa | ||
|
|
98bb0c56c5 | ||
|
|
9edb8fd2ae | ||
|
|
f5c1f0af1b | ||
|
|
1393ff0f11 | ||
|
|
bca2e29dd8 | ||
|
|
1e1c6c4075 | ||
|
|
ec88bbf8b0 | ||
|
|
f8ca5a9161 | ||
|
|
6a6a8ad473 | ||
|
|
5caebf6067 | ||
|
|
e9b8fddac1 | ||
|
|
c0cfcbecc7 | ||
|
|
feecb97214 | ||
|
|
fd514bda6a | ||
|
|
f5f917dfe0 | ||
|
|
2dd07da12d | ||
|
|
bc0c7c745c | ||
|
|
33e8016048 | ||
|
|
11abd8d9fe | ||
|
|
2e9c380f78 | ||
|
|
ee8d6229b3 | ||
|
|
fb3f7a1599 | ||
|
|
57ba039f51 | ||
|
|
186362f4f5 | ||
|
|
f880a987b2 | ||
|
|
1af4ae760c | ||
|
|
673d55e8a7 | ||
|
|
8c131c7ef4 | ||
|
|
e1ecca7e0a | ||
|
|
a08d35d404 | ||
|
|
114f15c4f3 | ||
|
|
5c4a094357 | ||
|
|
6a40aa46f4 | ||
|
|
59281c970b | ||
|
|
3133b55edf | ||
|
|
c12d16ef86 | ||
|
|
1f3e7d7b86 | ||
|
|
4edac2143f | ||
|
|
3e8a78002e | ||
|
|
a9907e0810 | ||
|
|
c3b4ebd446 | ||
|
|
199d2a15f8 | ||
|
|
f26bf12c38 | ||
|
|
85fb560ad1 | ||
|
|
eb3b89dc21 | ||
|
|
122011e930 | ||
|
|
015b242e27 | ||
|
|
68f6bf5e48 | ||
|
|
2063cae3ae | ||
|
|
efde4bf247 | ||
|
|
f2b5bd506a | ||
|
|
ffd5cf882a | ||
|
|
d79ee4c43b | ||
|
|
286278dde0 | ||
|
|
c1be3d08af | ||
|
|
c83956748d | ||
|
|
09031b9aa5 | ||
|
|
b8ca0b524f | ||
|
|
1d481f7b77 | ||
|
|
87d024e78b | ||
|
|
b1a325c102 | ||
|
|
5337af4c56 | ||
|
|
eb156e82a0 | ||
|
|
793b0c8d81 | ||
|
|
99b883d747 | ||
|
|
39d50479b1 | ||
|
|
0ffd998896 | ||
|
|
9ebac86b75 | ||
|
|
391f69ba17 | ||
|
|
ffe02e6b46 | ||
|
|
59e3d41305 | ||
|
|
dee36472ef | ||
|
|
24847eb88f | ||
|
|
234ce61e23 | ||
|
|
dcf44dbf9b | ||
|
|
23d7067985 | ||
|
|
46b6f39a41 | ||
|
|
f5393d4fae | ||
|
|
6656547e6b | ||
|
|
7b23715310 | ||
|
|
4b7ebda75d | ||
|
|
78ee60620a | ||
|
|
12ecede0e7 | ||
|
|
b3fe3b23a3 | ||
|
|
a971949c9b | ||
|
|
77b44fb217 | ||
|
|
4e296d780a | ||
|
|
6e4f69b327 | ||
|
|
775f386db6 | ||
|
|
09e787493c | ||
|
|
c7e2a61cda | ||
|
|
c9f8e6a542 | ||
|
|
2696fa3b24 | ||
|
|
5d0b87afce | ||
|
|
b383aa4c20 | ||
|
|
a67673327b | ||
|
|
c4265d80a5 | ||
|
|
dd874eea4b | ||
|
|
b9c1320823 | ||
|
|
833e405060 | ||
|
|
e6c8488283 | ||
|
|
505de3d625 | ||
|
|
631025a513 | ||
|
|
a0bddec054 | ||
|
|
c0dc193247 | ||
|
|
aa3a1808f8 | ||
|
|
07bc8c9bac | ||
|
|
2375775a9c | ||
|
|
e23b571d7e | ||
|
|
7e014a7a33 | ||
|
|
c4e6cd623e | ||
|
|
6553036a73 | ||
|
|
a4201481aa | ||
|
|
209acc793d | ||
|
|
f77e6e669c | ||
|
|
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
|
||||
|
||||
@@ -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
|
||||
@@ -10,12 +10,11 @@ env:
|
||||
jobs:
|
||||
build-android-only:
|
||||
name: Android
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
if: ${{ vars.APK_ONLY != '' }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
hmd: ['Standard']
|
||||
buildtype: ['Release', 'Debug', 'DebugWithValidationLayer']
|
||||
|
||||
steps:
|
||||
@@ -33,13 +32,6 @@ 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
|
||||
@@ -68,10 +60,8 @@ jobs:
|
||||
|
||||
- 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 +74,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,7 +82,7 @@ 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
|
||||
|
||||
|
||||
+102
-201
@@ -5,40 +5,70 @@ 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 libpulse-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
|
||||
build-linux:
|
||||
name: Linux
|
||||
runs-on: ubuntu-24.04
|
||||
if: ${{ vars.APK_ONLY == '' }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
cmake_preset: ['server', 'server-no-systemd', 'server-no-system-boost']
|
||||
config:
|
||||
- preset: 'client'
|
||||
packages: libboost-all-dev libharfbuzz-dev libfreetype-dev libavcodec-dev libavutil-dev libswscale-dev librsvg2-bin gettext libcurl4-openssl-dev libfontconfig-dev
|
||||
# dashboard requires a more recent Ubuntu, have it out of this job
|
||||
- preset: 'dissector-no-system-boost'
|
||||
packages: libboost-all-dev wireshark-dev
|
||||
- preset: 'server'
|
||||
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
|
||||
|
||||
- name: Apt dependencies
|
||||
uses: awalsh128/cache-apt-pkgs-action@v1.6.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
packages: ccache ${{matrix.config.packages}} ${{ startsWith(matrix.config.preset, 'server') && env.SERVER_DEPS || ''}}
|
||||
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
create-symlink: true
|
||||
key: linux-${{matrix.config.preset}}
|
||||
job-summary: ""
|
||||
restore-keys: linux-
|
||||
append-timestamp: false
|
||||
|
||||
- uses: actions/cache@v4
|
||||
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
|
||||
if: ${{ 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: Prepare Vulkan SDK
|
||||
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
||||
uses: humbletim/setup-vulkan-sdk@v1.2.1
|
||||
with:
|
||||
vulkan-query-version: 1.3.296.0
|
||||
vulkan-components: Vulkan-Headers, Glslang, SPIRV-Tools
|
||||
vulkan-components: Vulkan-Headers, Vulkan-Loader, Glslang, SPIRV-Reflect, SPIRV-Tools
|
||||
vulkan-use-cache: true
|
||||
|
||||
- name: Configure CMake
|
||||
@@ -47,20 +77,23 @@ 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 *-src) > ${{github.workspace}}/server-build-deps.tar.xz
|
||||
|
||||
- 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' }}
|
||||
if: ${{ matrix.config.preset == 'server' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: server-build-deps
|
||||
@@ -68,7 +101,7 @@ jobs:
|
||||
|
||||
- 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
|
||||
@@ -76,26 +109,39 @@ jobs:
|
||||
files: server-build-deps.tar.xz
|
||||
|
||||
build-dashboard:
|
||||
name: Linux dashboard
|
||||
#FIXME: merge with the matrixed build once Ubuntu gets updated
|
||||
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: Prepare
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install --yes curl wget sudo jq cmake gcc g++ git pkgconf libboost-all-dev libkirigami-dev gettext libarchive-dev nlohmann-json3-dev qcoro-qt6-dev libkf6i18n-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev libvulkan-dev libssl-dev librsvg2-dev extra-cmake-modules qml6-module-org-kde-kirigamiaddons-formcard
|
||||
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
key: cmake-linux-dashboard
|
||||
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
|
||||
restore-keys: cmake-linux-
|
||||
|
||||
- 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.
|
||||
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
|
||||
run: >
|
||||
cmake -B ${{github.workspace}}/build
|
||||
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
-DCMAKE_INSTALL_PREFIX=/usr
|
||||
-DFETCHCONTENT_BASE_DIR=${{github.workspace}}/cmake-fetch
|
||||
--preset dashboard
|
||||
-DWIVRN_USE_SYSTEM_OPENXR=OFF
|
||||
|
||||
- name: Build
|
||||
# Build your program with the given configuration
|
||||
@@ -106,7 +152,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
if: ${{ vars.APK_ONLY == '' }}
|
||||
container:
|
||||
image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.8
|
||||
image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.9
|
||||
options: --privileged
|
||||
|
||||
steps:
|
||||
@@ -158,167 +204,13 @@ 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:
|
||||
@@ -327,18 +219,22 @@ jobs:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Prepare Vulkan SDK
|
||||
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
||||
uses: humbletim/setup-vulkan-sdk@v1.2.1
|
||||
with:
|
||||
vulkan-query-version: 1.3.296.0
|
||||
vulkan-components: Glslang, SPIRV-Tools
|
||||
vulkan-use-cache: true
|
||||
|
||||
- name: set up JDK
|
||||
uses: actions/setup-java@v4
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
cache: gradle
|
||||
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: Install dependencies
|
||||
run: |
|
||||
@@ -373,7 +269,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=""
|
||||
@@ -400,14 +296,19 @@ jobs:
|
||||
fi
|
||||
fi
|
||||
|
||||
sudo rm /usr/local/bin/cmake
|
||||
"${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager" --install "cmake;3.30.3"
|
||||
|
||||
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
|
||||
@@ -430,7 +331,7 @@ jobs:
|
||||
uses: actions/upload-artifact@v4
|
||||
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
|
||||
|
||||
@@ -438,7 +339,7 @@ jobs:
|
||||
if: ${{ matrix.buildtype != 'Release' && matrix.buildtype != 'Oculus' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: symbols-${{ matrix.hmd }}-${{ matrix.buildtype }}
|
||||
name: symbols-${{ matrix.buildtype }}
|
||||
path: debug/**/*.so
|
||||
retention-days: 30
|
||||
|
||||
@@ -459,7 +360,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,7 +376,7 @@ 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 libpulse-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
|
||||
|
||||
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
|
||||
@@ -537,7 +438,7 @@ 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:
|
||||
@@ -623,8 +524,8 @@ jobs:
|
||||
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
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Run clang-format style check for C/C++/Protobuf programs.
|
||||
uses: jidicula/clang-format-action@v4.13.0
|
||||
uses: jidicula/clang-format-action@2c659fea724e981e94741c0e7db663982cd7d3f4
|
||||
with:
|
||||
clang-format-version: '18'
|
||||
clang-format-version: '21'
|
||||
check-path: ${{ matrix.path }}
|
||||
|
||||
@@ -47,6 +47,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 +65,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 +80,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 +103,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. -->
|
||||
|
||||
+47
-47
@@ -26,9 +26,11 @@ include(GNUInstallDirs)
|
||||
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_SYSTEM_LIBKTX "Use system KTX-Software library" ON)
|
||||
option(WIVRN_USE_SYSTEMD "Use libsystemd" 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})
|
||||
@@ -52,10 +54,9 @@ set(OVR_COMPAT_SEARCH_PATH "/opt/xrizer:/usr/local/lib/OpenComposite:/usr/lib/Op
|
||||
|
||||
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,6 +67,7 @@ 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)
|
||||
|
||||
@@ -112,7 +114,7 @@ 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()
|
||||
|
||||
@@ -171,21 +173,17 @@ if (WIVRN_BUILD_DASHBOARD)
|
||||
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(RSVG_CONVERT rsvg-convert REQUIRED)
|
||||
find_program(TOKTX toktx REQUIRED)
|
||||
|
||||
if (WIVRN_COMPRESS_GLB)
|
||||
@@ -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.53 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()
|
||||
@@ -229,43 +230,42 @@ 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=203b64abc82e4d8697cc5aeedc93117fc1ee52d36e7cdcfc0854fa2c607edaae)
|
||||
FetchContent_Declare(openxr_loader EXCLUDE_FROM_ALL SYSTEM URL https://github.com/KhronosGroup/OpenXR-SDK/archive/refs/tags/release-1.1.54.tar.gz
|
||||
URL_HASH SHA256=2055688081066e37238be996534f349420ac52ed34f8514836704232121ee7f3)
|
||||
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)
|
||||
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.5.tar.gz
|
||||
URL_HASH SHA256=0eb50fe9aeba1a51f96b5843c7f630a32ed2e9362d693c61b87e4fa870cf826d
|
||||
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/v3.16.0.tar.gz
|
||||
URL_HASH SHA256=7d7b4037b737992342049ffab14f22fa10243e01664f8c3a0657aa247ac52f71)
|
||||
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)
|
||||
@@ -292,18 +292,18 @@ if (WIVRN_BUILD_SERVER OR WIVRN_BUILD_SERVER_LIBRARY)
|
||||
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}")
|
||||
message(STATUS "\tPulseaudio: ${WIVRN_USE_PULSEAUDIO}")
|
||||
message(STATUS "")
|
||||
message(STATUS "Optional features:")
|
||||
message(STATUS "\tsystemd: ${WIVRN_USE_SYSTEMD}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
"inherits": "everything",
|
||||
"binaryDir": "${sourceDir}/build-no-systemd",
|
||||
"cacheVariables": {
|
||||
"WIVRN_BUILD_WIVRNCTL": "OFF",
|
||||
"WIVRN_USE_SYSTEMD": "OFF"
|
||||
}
|
||||
},
|
||||
@@ -108,6 +109,7 @@
|
||||
"inherits": "server",
|
||||
"binaryDir": "${sourceDir}/build-server-no-systemd",
|
||||
"cacheVariables": {
|
||||
"WIVRN_BUILD_WIVRNCTL": "OFF",
|
||||
"WIVRN_USE_SYSTEMD": "OFF"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -49,38 +49,40 @@ systemctl enable --now avahi-daemon
|
||||
- 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**".
|
||||
|
||||
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:
|
||||
You can now start an OpenXR application on your computer. For Steam games, you may also need to set the launch options to be able to use WiVRn. If nothing related to Steam is displayed in the dashboard or wivrn-server output, then your system does not require it.
|
||||
- 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.
|
||||
|
||||
You can set an application to be started automatically when you connect your headset in the dashboard settings or [manually](docs/configuration.md#application)
|
||||
|
||||
### Application list
|
||||
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/`.
|
||||
|
||||
### OpenVR and Steam games
|
||||
|
||||
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.
|
||||
The flatpak also includes [OpenComposite](https://gitlab.com/znixian/OpenOVR/) and [xrizer](https://github.com/Supreeeme/xrizer/), used to translate the OpenVR API used by SteamVR to OpenXR used by WiVRn, see [SteamVR](docs/steamvr.md) for details.
|
||||
|
||||
If using Wine/Proton, it will probe for OpenVR at startup, so even for OpenXR applications, OpenComposite is required.
|
||||
If using Wine/Proton, it will probe for OpenVR at startup, so even for OpenXR applications, OpenComposite or xrizer is required.
|
||||
|
||||
When you start the server through flatpak, it will automatically configure the current OpenVR to use OpenComposite.
|
||||
When you start the server through flatpak, it will automatically configure the current OpenVR to use xrizer.
|
||||
|
||||
### Steam Flatpak
|
||||
|
||||
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
|
||||
```
|
||||
When using a user installation of flatpak Steam, user `override --user` instead of `override`.
|
||||
|
||||
### 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.
|
||||
|
||||
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.
Binary file not shown.
+14
-48
@@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ tasks.register("generatePngs", GeneratePngsTask) {
|
||||
|
||||
android {
|
||||
namespace = "org.meumeu.wivrn"
|
||||
ndkVersion = "28.1.13356709"
|
||||
ndkVersion = "28.2.13676358"
|
||||
|
||||
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,22 @@ 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] : []
|
||||
|
||||
externalNativeBuild {
|
||||
def css = project.hasProperty('wivrn_css') ? project.wivrn_css: "images/wivrn-local.css"
|
||||
|
||||
cmake {
|
||||
arguments '-DANDROID_TOOLCHAIN=clang',
|
||||
arguments = ['-DANDROID_TOOLCHAIN=clang',
|
||||
'-DANDROID_STL=c++_static',
|
||||
'-DCMAKE_ANDROID_NDK_VERSION=' + ndkVersion,
|
||||
'-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON',
|
||||
'-DCMAKE_EXPORT_COMPILE_COMMANDS=ON',
|
||||
'-DCMAKE_ANDROID_ASSETS_DIRECTORIES=' + layout.buildDirectory.dir("assets").get().asFile,
|
||||
'-DCMAKE_ANDROID_LIB_DIRECTORIES=' + layout.buildDirectory.dir("libs").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,9 +140,12 @@ android {
|
||||
'-DWIVRN_SHOW_IMGUI_DEMO_WINDOW=' + showImguiDemo,
|
||||
'-DWIVRN_CLIENT_DEBUG_MENU=' + showDebugMenu,
|
||||
'-DWIVRN_CSS=' + css,
|
||||
'-DWIVRN_COMPRESS_GLB=' + compressGlb
|
||||
'-DWIVRN_COMPRESS_GLB=' + compressGlb] +
|
||||
fetchcontentBaseDir
|
||||
resValue "string", "app_name", project.hasProperty('wivrn_app_name') ? project.wivrn_app_name : "WiVRn Local"
|
||||
abiFilters 'arm64-v8a'//, 'x86_64'
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,32 +208,19 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
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'
|
||||
assets.srcDirs = ['assets', layout.buildDirectory.dir("assets")]
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version = '3.30.3'
|
||||
version = '3.31.5'
|
||||
path 'CMakeLists.txt'
|
||||
}
|
||||
}
|
||||
@@ -237,32 +231,4 @@ android {
|
||||
// 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}" {
|
||||
jniLibs.srcDirs layout.buildDirectory.dir("libs${variant.name.capitalize()}")
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild{
|
||||
cmake {
|
||||
arguments '-DCMAKE_ANDROID_LIB_DIRECTORIES=' + layout.buildDirectory.dir("libs${variant.name.capitalize()}").get().asFile
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+49
-17
@@ -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)
|
||||
@@ -49,6 +65,15 @@ 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"
|
||||
@@ -65,7 +90,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")
|
||||
@@ -150,7 +175,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)
|
||||
|
||||
@@ -172,21 +197,22 @@ endif()
|
||||
if(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}
|
||||
${FETCHCONTENT_BASE_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
|
||||
@@ -237,11 +263,13 @@ 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 ${IMAGES_SRC_DIR}/wivrn-christmas.svg DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/wivrn-christmas.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 ${CMAKE_CURRENT_BINARY_DIR}/wivrn-christmas.png DESTINATION ${ASSETS_DIR}/wivrn-christmas.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,14 +278,18 @@ 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)
|
||||
|
||||
|
||||
# Add the VR splash screen (only used on Quest)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
LIBAPP {
|
||||
global:
|
||||
ANativeActivity_onCreate;
|
||||
android_main;
|
||||
Java_org_meumeu_wivrn_BroadcastReceiver_onReceive;
|
||||
Java_org_meumeu_wivrn_MainActivity_onRequestPermissionsResult;
|
||||
Java_org_meumeu_wivrn_MainActivity_onActivityResult;
|
||||
Java_org_meumeu_wivrn_MainActivity_onNewIntent;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
@@ -0,0 +1,427 @@
|
||||
#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);
|
||||
const int32_t dev = AInputEvent_getDeviceId(event);
|
||||
|
||||
if (type == AINPUT_EVENT_TYPE_KEY)
|
||||
{
|
||||
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)
|
||||
{
|
||||
// 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
|
||||
@@ -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
|
||||
+40
-4
@@ -25,6 +25,7 @@
|
||||
#include <tuple>
|
||||
|
||||
#include <jni.h>
|
||||
#include <type_traits>
|
||||
|
||||
namespace jni
|
||||
{
|
||||
@@ -171,6 +172,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 +219,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));
|
||||
}
|
||||
@@ -283,7 +297,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,7 +320,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));
|
||||
}
|
||||
@@ -327,7 +361,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));
|
||||
}
|
||||
|
||||
+107
-59
@@ -24,6 +24,7 @@
|
||||
#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"
|
||||
@@ -70,7 +71,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;
|
||||
@@ -761,6 +762,7 @@ void application::initialize_vulkan()
|
||||
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);
|
||||
@@ -884,24 +886,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);
|
||||
@@ -1053,6 +1061,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))
|
||||
@@ -1191,61 +1212,69 @@ void application::initialize()
|
||||
{
|
||||
// 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_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,
|
||||
// Disable foveation, doesn't seem useful
|
||||
// XR_FB_FOVEATION_CONFIGURATION_EXTENSION_NAME,
|
||||
// XR_FB_FOVEATION_EXTENSION_NAME,
|
||||
// XR_FB_FOVEATION_VULKAN_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())
|
||||
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 {}",
|
||||
@@ -1499,6 +1528,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
|
||||
@@ -1674,8 +1723,7 @@ void application::run()
|
||||
#else
|
||||
void application::run()
|
||||
{
|
||||
struct sigaction act
|
||||
{};
|
||||
struct sigaction act{};
|
||||
act.sa_handler = [](int) {
|
||||
instance().exit_requested = true;
|
||||
};
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "android/hid.h"
|
||||
#include <android_native_app_glue.h>
|
||||
#endif
|
||||
|
||||
@@ -81,6 +82,8 @@ class application : public singleton<application>
|
||||
#ifdef __ANDROID__
|
||||
ANativeWindow * native_window = nullptr;
|
||||
bool resumed = false;
|
||||
|
||||
android_hid::input_handler input_handler{};
|
||||
#endif
|
||||
|
||||
static inline const char engine_name[] = "No engine";
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "configuration.h"
|
||||
#include "application.h"
|
||||
#include "utils/json_string.h"
|
||||
#include "wivrn_packets.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <magic_enum.hpp>
|
||||
@@ -98,10 +99,33 @@ configuration::configuration(xr::system & system)
|
||||
{
|
||||
passthrough_enabled = system.passthrough_supported() == xr::passthrough_type::color;
|
||||
features[feature::hand_tracking] = system.hand_tracking_supported();
|
||||
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:
|
||||
high_power_mode = false;
|
||||
break;
|
||||
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_xr_elite:
|
||||
case model::htc_vive_focus_vision:
|
||||
case model::lynx_r1:
|
||||
case model::samsung_galaxy_xr:
|
||||
case model::unknown:
|
||||
high_power_mode = true;
|
||||
break;
|
||||
}
|
||||
try
|
||||
{
|
||||
simdjson::dom::parser parser;
|
||||
simdjson::dom::element root = parser.load(application::get_config_path() / "client.json");
|
||||
simdjson::dom::element root = parser.load((application::get_config_path() / "client.json").native());
|
||||
for (simdjson::dom::object i: simdjson::dom::array(root["servers"]))
|
||||
{
|
||||
server_data data{
|
||||
@@ -129,6 +153,27 @@ configuration::configuration(xr::system & system)
|
||||
if (auto val = root["resolution_scale"]; val.is_double())
|
||||
resolution_scale = val.get_double();
|
||||
|
||||
if (auto val = root["stream_scale"]; val.is_double())
|
||||
stream_scale = val.get_double();
|
||||
|
||||
if (auto val = root["codec"]; val.is_string())
|
||||
{
|
||||
const auto codec_str = val.get_string().value();
|
||||
for (const auto & [c, name]: magic_enum::enum_entries<wivrn::video_codec>())
|
||||
{
|
||||
if (codec_str == name)
|
||||
{
|
||||
codec = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (auto val = root["bit_depth"]; val.is_uint64())
|
||||
bit_depth = val.get_uint64();
|
||||
|
||||
if (auto val = root["bitrate_bps"]; val.is_number())
|
||||
bitrate_bps = val.get_uint64();
|
||||
|
||||
if (auto val = root["enable_stream_gui"]; val.is_bool())
|
||||
enable_stream_gui = val.get_bool();
|
||||
|
||||
@@ -175,18 +220,16 @@ configuration::configuration(xr::system & system)
|
||||
|
||||
if (auto val = root["environment_model"]; val.is_string())
|
||||
environment_model = (std::string_view)val.get_string();
|
||||
|
||||
if (auto val = root["high_power_mode"]; val.is_bool())
|
||||
high_power_mode = val.get_bool();
|
||||
|
||||
if (auto val = root["extended_config"]; val.is_bool())
|
||||
extended_config = val.get_bool();
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,6 +290,12 @@ void configuration::save()
|
||||
if (minimum_refresh_rate)
|
||||
json << ",\"minimum_refresh_rate\":" << *minimum_refresh_rate;
|
||||
json << ",\"resolution_scale\":" << resolution_scale;
|
||||
if (stream_scale)
|
||||
json << ",\"stream_scale\":" << *stream_scale;
|
||||
if (codec)
|
||||
json << ",\"codec\":" << json_string(magic_enum::enum_name(*codec));
|
||||
json << ",\"bit_depth\":" << (uint64_t)bit_depth;
|
||||
json << ",\"bitrate_bps\":" << bitrate_bps;
|
||||
json << ",\"openxr_post_processing\":";
|
||||
write_openxr_post_processing(json, openxr_post_processing);
|
||||
json << ",\"passthrough_enabled\":" << std::boolalpha << passthrough_enabled;
|
||||
@@ -263,5 +312,21 @@ void configuration::save()
|
||||
json << ",\"first_run\":" << std::boolalpha << first_run;
|
||||
json << ",\"locale\":" << json_string(locale);
|
||||
json << ",\"environment_model\":" << json_string(environment_model);
|
||||
json << ",\"high_power_mode\":" << std::boolalpha << high_power_mode;
|
||||
json << ",\"extended_config\":" << std::boolalpha << extended_config;
|
||||
json << "}";
|
||||
}
|
||||
|
||||
void configuration::set_stream_scale(float val)
|
||||
{
|
||||
stream_scale = val;
|
||||
}
|
||||
|
||||
float configuration::get_stream_scale() const
|
||||
{
|
||||
if (stream_scale)
|
||||
return *stream_scale;
|
||||
if (check_feature(feature::eye_gaze))
|
||||
return 0.3;
|
||||
return 0.5;
|
||||
}
|
||||
|
||||
+20
-1
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "hardware.h"
|
||||
#include "wivrn_discover.h"
|
||||
#include "wivrn_packets.h"
|
||||
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
@@ -49,7 +50,11 @@ public:
|
||||
std::map<std::string, server_data> servers;
|
||||
std::optional<float> preferred_refresh_rate;
|
||||
std::optional<float> minimum_refresh_rate;
|
||||
float resolution_scale = 1.4;
|
||||
float resolution_scale = 1.0;
|
||||
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;
|
||||
|
||||
@@ -74,6 +79,11 @@ public:
|
||||
float override_foveation_pitch = 10 * M_PI / 180;
|
||||
float override_foveation_distance = 3;
|
||||
|
||||
bool high_power_mode;
|
||||
|
||||
// Allow unsafe config values
|
||||
bool extended_config = false;
|
||||
|
||||
bool first_run = true;
|
||||
|
||||
std::string locale;
|
||||
@@ -84,6 +94,7 @@ 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);
|
||||
|
||||
@@ -92,4 +103,12 @@ public:
|
||||
configuration() = default;
|
||||
|
||||
void save();
|
||||
|
||||
void set_stream_scale(float);
|
||||
float get_stream_scale() const;
|
||||
|
||||
uint32_t max_bitrate() const
|
||||
{
|
||||
return extended_config ? 800'000'000u : 200'000'000u;
|
||||
}
|
||||
};
|
||||
|
||||
+20
-8
@@ -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";
|
||||
@@ -41,9 +42,12 @@ constexpr float scroll_ratio = 10;
|
||||
// Threshold on the trigger value to register a click
|
||||
constexpr float trigger_click_thd = 0.8;
|
||||
|
||||
// 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;
|
||||
@@ -67,7 +71,14 @@ constexpr uint32_t pointer_color_border = 0xff000000;
|
||||
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};
|
||||
@@ -76,7 +87,8 @@ constexpr glm::vec3 keyboard_position = {0, -0.3, 0.1};
|
||||
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;
|
||||
|
||||
@@ -107,8 +119,8 @@ constexpr float fade_delay = 3;
|
||||
constexpr float fade_duration = 0.25;
|
||||
|
||||
// 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;
|
||||
} // namespace constants::stream
|
||||
|
||||
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.fps));
|
||||
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");
|
||||
@@ -308,6 +312,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 +366,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 +413,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 +491,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 +574,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);
|
||||
|
||||
@@ -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,10 +65,6 @@ 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();
|
||||
};
|
||||
|
||||
@@ -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 : 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
|
||||
|
||||
+59
-7
@@ -103,6 +103,11 @@ static model guess_model_()
|
||||
if (model == "VIVE XR Series")
|
||||
return model::htc_vive_xr_elite;
|
||||
}
|
||||
if (manufacturer == "samsung")
|
||||
{
|
||||
if (model == "SM-I610")
|
||||
return model::samsung_galaxy_xr;
|
||||
}
|
||||
|
||||
spdlog::info("Unknown model, manufacturer={}, model={}, device={}", manufacturer, model, device);
|
||||
#endif
|
||||
@@ -165,6 +170,8 @@ XrViewConfigurationView override_view(XrViewConfigurationView view, model m)
|
||||
return scale_view(view, 2448);
|
||||
case model::htc_vive_xr_elite:
|
||||
return scale_view(view, 1920);
|
||||
case model::samsung_galaxy_xr:
|
||||
return scale_view(view, 3552);
|
||||
case model::lynx_r1:
|
||||
case model::unknown:
|
||||
return view;
|
||||
@@ -191,6 +198,7 @@ bool need_srgb_conversion(model m)
|
||||
case model::htc_vive_focus_3:
|
||||
case model::htc_vive_focus_vision:
|
||||
case model::htc_vive_xr_elite:
|
||||
case model::samsung_galaxy_xr:
|
||||
case model::unknown:
|
||||
return true;
|
||||
}
|
||||
@@ -204,6 +212,27 @@ const char * permission_name(feature f)
|
||||
case feature::microphone:
|
||||
return "android.permission.RECORD_AUDIO";
|
||||
case feature::hand_tracking:
|
||||
switch (guess_model())
|
||||
{
|
||||
case model::samsung_galaxy_xr:
|
||||
return "android.permission.HAND_TRACKING";
|
||||
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::lynx_r1:
|
||||
case model::unknown:
|
||||
break;
|
||||
}
|
||||
return nullptr;
|
||||
case feature::eye_gaze:
|
||||
switch (guess_model())
|
||||
@@ -220,6 +249,8 @@ const char * permission_name(feature f)
|
||||
case model::pico_4_pro:
|
||||
case model::pico_4_enterprise:
|
||||
return "com.picovr.permission.EYE_TRACKING";
|
||||
case model::samsung_galaxy_xr:
|
||||
return "android.permission.EYE_TRACKING_FINE";
|
||||
case model::htc_vive_focus_3:
|
||||
case model::htc_vive_focus_vision:
|
||||
case model::htc_vive_xr_elite:
|
||||
@@ -243,6 +274,8 @@ const char * permission_name(feature f)
|
||||
case model::pico_4_pro:
|
||||
case model::pico_4_enterprise:
|
||||
return "com.picovr.permission.FACE_TRACKING";
|
||||
case model::samsung_galaxy_xr:
|
||||
return "android.permission.FACE_TRACKING";
|
||||
case model::htc_vive_focus_3:
|
||||
case model::htc_vive_focus_vision:
|
||||
case model::htc_vive_xr_elite:
|
||||
@@ -286,14 +319,17 @@ std::string controller_name()
|
||||
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::pico_4s:
|
||||
return "pico-4u";
|
||||
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::samsung_galaxy_xr:
|
||||
return "samsung-galaxyxr";
|
||||
case model::lynx_r1:
|
||||
case model::unknown:
|
||||
return "generic-trigger-squeeze";
|
||||
@@ -356,12 +392,6 @@ std::pair<glm::vec3, glm::quat> controller_offset(std::string_view profile, xr::
|
||||
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;
|
||||
}
|
||||
@@ -391,6 +421,28 @@ std::pair<glm::vec3, glm::quat> controller_offset(std::string_view profile, xr::
|
||||
break;
|
||||
}
|
||||
|
||||
else if (profile == "pico-neo3")
|
||||
switch (space)
|
||||
{
|
||||
case xr::spaces::grip_left:
|
||||
case xr::spaces::grip_right:
|
||||
return {{0, 0.005, -0.051}, glm::angleAxis(glm::radians(-29.400f), glm::vec3{1, 0, 0})};
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
else if (profile == "samsung-galaxyxr")
|
||||
switch (space)
|
||||
{
|
||||
case xr::spaces::grip_left:
|
||||
return {{-0.005, 0.000, 0.035}, {1, 0, 0, 0}};
|
||||
case xr::spaces::grip_right:
|
||||
return {{0.005, 0.000, 0.035}, {1, 0, 0, 0}};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return {{0, 0, 0}, {1, 0, 0, 0}};
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ enum class model
|
||||
htc_vive_xr_elite,
|
||||
htc_vive_focus_vision,
|
||||
lynx_r1,
|
||||
samsung_galaxy_xr,
|
||||
unknown
|
||||
};
|
||||
|
||||
|
||||
@@ -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,7 +18,9 @@
|
||||
|
||||
#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>
|
||||
@@ -29,6 +31,8 @@ class gpu_buffer
|
||||
{
|
||||
std::vector<std::byte> bytes;
|
||||
vk::PhysicalDeviceLimits limits;
|
||||
vk::PhysicalDeviceIndexTypeUint8FeaturesEXT feat_uint8;
|
||||
|
||||
fastgltf::Asset & asset;
|
||||
vk::BufferUsageFlags usage;
|
||||
|
||||
@@ -58,8 +62,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 +90,7 @@ public:
|
||||
return add(alignment, data_to_add);
|
||||
}
|
||||
|
||||
size_t add_indices(const fastgltf::Accessor & accessor)
|
||||
std::pair<size_t, vk::IndexType> add_indices(const fastgltf::Accessor & accessor)
|
||||
{
|
||||
usage |= vk::BufferUsageFlagBits::eIndexBuffer;
|
||||
|
||||
@@ -90,7 +101,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 +113,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 +121,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());
|
||||
}
|
||||
+162
-78
@@ -146,7 +146,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);
|
||||
@@ -210,9 +210,6 @@ imgui_textures::imgui_textures(
|
||||
|
||||
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_)
|
||||
@@ -237,7 +234,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 +372,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,
|
||||
};
|
||||
@@ -552,97 +554,129 @@ 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>::infinity()};
|
||||
std::pair<std::optional<ImVec2>, float> palm_position{{}, std::numeric_limits<float>::infinity()};
|
||||
std::pair<std::optional<ImVec2>, float> controller_position{{}, std::numeric_limits<float>::infinity()};
|
||||
|
||||
// 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;
|
||||
}
|
||||
// TODO tunable
|
||||
/*if (new_state.trigger_value < 0.5)
|
||||
new_state.trigger_clicked = false;
|
||||
else */
|
||||
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>::infinity()};
|
||||
|
||||
if (ImGuiWindow * modal_popup = ImGui::GetTopMostAndVisiblePopupModal())
|
||||
{
|
||||
@@ -657,17 +691,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>::infinity()};
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -680,16 +709,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 +752,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;
|
||||
}
|
||||
@@ -1005,6 +1037,58 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_context::end_frame()
|
||||
return quads;
|
||||
}
|
||||
|
||||
std::vector<imgui_context::viewport> imgui_context::windows()
|
||||
{
|
||||
std::vector<imgui_context::viewport> w;
|
||||
|
||||
ImGuiWindow * modal_popup = ImGui::GetTopMostAndVisiblePopupModal();
|
||||
|
||||
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->ParentWindowInBeginStack != nullptr*/)
|
||||
continue;
|
||||
|
||||
if (modal_popup != nullptr and window != modal_popup and not layer.always_show_cursor)
|
||||
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(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,
|
||||
},
|
||||
.vp_origin = {min.x, min.y},
|
||||
.vp_size = {max.x - min.x, max.y - min.y},
|
||||
.always_show_cursor = layer.always_show_cursor,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
void imgui_context::vibrate_on_hover()
|
||||
{
|
||||
if (ImGui::IsItemHovered())
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
@@ -186,6 +183,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
|
||||
|
||||
@@ -216,6 +215,8 @@ public:
|
||||
return layers_;
|
||||
}
|
||||
|
||||
std::vector<viewport> windows();
|
||||
|
||||
viewport & layer(ImVec2 position);
|
||||
|
||||
void new_frame(XrTime display_time);
|
||||
@@ -227,7 +228,7 @@ 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);
|
||||
@@ -240,6 +241,10 @@ public:
|
||||
void set_hovered_item();
|
||||
void set_controllers_enabled(bool value);
|
||||
void tooltip(std::string_view text);
|
||||
std::array<bool, 2> is_aim_interaction() const
|
||||
{
|
||||
return {aim_interaction[0] == 1, aim_interaction[1] == 1};
|
||||
}
|
||||
};
|
||||
|
||||
void ScrollWhenDragging();
|
||||
|
||||
@@ -55,6 +55,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 +73,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;
|
||||
@@ -174,7 +180,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;
|
||||
|
||||
+108
-55
@@ -166,6 +166,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 +271,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 +334,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 +364,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 +424,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);
|
||||
@@ -441,7 +515,9 @@ struct : std::error_category
|
||||
|
||||
fastgltf::Asset load_gltf_asset(fastgltf::GltfDataBuffer & buffer, const std::filesystem::path & directory)
|
||||
{
|
||||
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 |
|
||||
@@ -750,37 +826,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);
|
||||
}
|
||||
@@ -808,30 +884,8 @@ 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;
|
||||
@@ -855,6 +909,7 @@ public:
|
||||
|
||||
int binding;
|
||||
|
||||
// Attributes that affect the vertices position go in a different buffer
|
||||
if (semantic == "POSITION" or
|
||||
semantic == "JOINTS" or
|
||||
semantic == "WEIGHTS")
|
||||
@@ -1089,8 +1144,6 @@ 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);
|
||||
@@ -1108,7 +1161,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);
|
||||
|
||||
@@ -138,7 +138,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 +261,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 +285,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);
|
||||
|
||||
@@ -148,7 +148,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
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "scene.h"
|
||||
|
||||
#include "application.h"
|
||||
#include "render/scene_components.h"
|
||||
#include "utils/contains.h"
|
||||
@@ -611,3 +612,28 @@ void scene::remove(entt::entity entity)
|
||||
void scene::on_unfocused() {}
|
||||
void scene::on_focused() {}
|
||||
void scene::on_xr_event(const xr::event &) {}
|
||||
|
||||
bool scene::on_input_key_down(uint8_t key_code)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool scene::on_input_key_up(uint8_t key_code)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool scene::on_input_mouse_move(float x, float y)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool scene::on_input_button_down(uint8_t button)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool scene::on_input_button_up(uint8_t button)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool scene::on_input_scroll(float h, float v)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -213,6 +213,13 @@ public:
|
||||
virtual void render(const XrFrameState &) = 0;
|
||||
virtual void on_xr_event(const xr::event &);
|
||||
|
||||
virtual bool on_input_key_down(uint8_t key_code);
|
||||
virtual bool on_input_key_up(uint8_t key_code);
|
||||
virtual bool on_input_mouse_move(float x, float y);
|
||||
virtual bool on_input_button_down(uint8_t button);
|
||||
virtual bool on_input_button_up(uint8_t button);
|
||||
virtual bool on_input_scroll(float h, float v);
|
||||
|
||||
entt::registry world;
|
||||
|
||||
std::shared_ptr<entt::registry> load_gltf(const std::filesystem::path & path, std::function<void(float)> progress_cb = {});
|
||||
|
||||
@@ -1,364 +0,0 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* 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 "blitter.h"
|
||||
|
||||
#include "application.h"
|
||||
#include "utils/ranges.h"
|
||||
#include "vk/pipeline.h"
|
||||
#include "vk/shader.h"
|
||||
#include "vk/specialization_constants.h"
|
||||
#include <format>
|
||||
#include <ranges>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
namespace wivrn
|
||||
{
|
||||
|
||||
static const uint32_t num_views = 2;
|
||||
|
||||
blitter::blitter(vk::raii::Device & device, size_t view) :
|
||||
device(device), view(view)
|
||||
{
|
||||
}
|
||||
|
||||
void blitter::reset(const to_headset::video_stream_description & desc)
|
||||
{
|
||||
using channels_t = to_headset::video_stream_description::channels_t;
|
||||
this->desc = desc;
|
||||
|
||||
current = {};
|
||||
target = image_allocation();
|
||||
image_view = nullptr;
|
||||
rp = nullptr;
|
||||
fb = nullptr;
|
||||
sampler = nullptr;
|
||||
pipelines.clear();
|
||||
passthrough_rgb = passthrough_a = -1;
|
||||
|
||||
auto w = desc.width / num_views;
|
||||
for (auto [i, item]: utils::enumerate(desc.items))
|
||||
{
|
||||
if (item.offset_x <= view * w and
|
||||
item.offset_y == 0 and
|
||||
item.offset_x + item.width * item.subsampling >= (view + 1) * w and
|
||||
item.height * item.subsampling >= desc.height)
|
||||
{
|
||||
spdlog::info("Stream {} is eligible for blit-less path on view {}", i, view);
|
||||
switch (item.channels)
|
||||
{
|
||||
case channels_t::colour:
|
||||
passthrough_rgb = i;
|
||||
break;
|
||||
case channels_t::alpha:
|
||||
passthrough_a = i;
|
||||
break;
|
||||
}
|
||||
const bool alpha = item.channels == to_headset::video_stream_description::channels_t::alpha;
|
||||
auto & r = alpha ? current.rect_a : current.rect_rgb;
|
||||
r = vk::Rect2D{
|
||||
.offset = {
|
||||
.x = int32_t(view * w) - item.offset_x,
|
||||
.y = 0,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (passthrough_rgb != -1 and passthrough_a != -1)
|
||||
return;
|
||||
|
||||
target = image_allocation(
|
||||
device,
|
||||
vk::ImageCreateInfo{
|
||||
.imageType = vk::ImageType::e2D,
|
||||
.format = vk::Format::eB8G8R8A8Srgb,
|
||||
.extent = {
|
||||
.width = w,
|
||||
.height = desc.height,
|
||||
.depth = 1,
|
||||
},
|
||||
.mipLevels = 1,
|
||||
.arrayLayers = 1,
|
||||
.usage = vk::ImageUsageFlagBits::eSampled | vk::ImageUsageFlagBits::eColorAttachment,
|
||||
},
|
||||
{
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
},
|
||||
std::format("blit image {}", view));
|
||||
|
||||
image_view = device.createImageView(vk::ImageViewCreateInfo{
|
||||
.image = vk::Image(target),
|
||||
.viewType = vk::ImageViewType::e2D,
|
||||
.format = target.info().format,
|
||||
.subresourceRange = {
|
||||
.aspectMask = vk::ImageAspectFlagBits::eColor,
|
||||
.levelCount = 1,
|
||||
.layerCount = 1,
|
||||
}});
|
||||
|
||||
// render pass
|
||||
{
|
||||
vk::AttachmentReference color_ref{
|
||||
.attachment = 0,
|
||||
.layout = vk::ImageLayout::eColorAttachmentOptimal,
|
||||
};
|
||||
|
||||
vk::SubpassDescription subpass{
|
||||
.pipelineBindPoint = vk::PipelineBindPoint::eGraphics,
|
||||
.colorAttachmentCount = 1,
|
||||
.pColorAttachments = &color_ref,
|
||||
};
|
||||
|
||||
vk::AttachmentDescription color_desc{
|
||||
.format = target.info().format,
|
||||
.loadOp = vk::AttachmentLoadOp::eDontCare,
|
||||
.finalLayout = vk::ImageLayout::eShaderReadOnlyOptimal,
|
||||
};
|
||||
|
||||
rp = device.createRenderPass(vk::RenderPassCreateInfo{
|
||||
.attachmentCount = 1,
|
||||
.pAttachments = &color_desc,
|
||||
.subpassCount = 1,
|
||||
.pSubpasses = &subpass,
|
||||
});
|
||||
}
|
||||
|
||||
fb = device.createFramebuffer(
|
||||
vk::FramebufferCreateInfo{
|
||||
.renderPass = *rp,
|
||||
.attachmentCount = 1,
|
||||
.pAttachments = &*image_view,
|
||||
.width = w,
|
||||
.height = desc.height,
|
||||
.layers = 1,
|
||||
});
|
||||
|
||||
sampler = device.createSampler(vk::SamplerCreateInfo{
|
||||
.magFilter = vk::Filter::eLinear,
|
||||
.minFilter = vk::Filter::eLinear,
|
||||
.addressModeU = vk::SamplerAddressMode::eClampToBorder,
|
||||
.addressModeV = vk::SamplerAddressMode::eClampToBorder,
|
||||
.addressModeW = vk::SamplerAddressMode::eClampToBorder,
|
||||
.borderColor = vk::BorderColor::eFloatOpaqueBlack,
|
||||
});
|
||||
|
||||
pipelines.resize(desc.items.size());
|
||||
for (auto [i, item]: utils::enumerate(desc.items))
|
||||
{
|
||||
pipelines[i].used = item.offset_x < (view + 1) * w and
|
||||
item.offset_x + item.width * item.subsampling > view * w;
|
||||
}
|
||||
|
||||
current.rgb = *image_view;
|
||||
current.sampler_rgb = *sampler;
|
||||
current.rect_rgb = vk::Rect2D{.extent = {w, desc.height}};
|
||||
current.layout_rgb = vk::ImageLayout::eShaderReadOnlyOptimal;
|
||||
}
|
||||
|
||||
void blitter::begin(vk::raii::CommandBuffer & cmd)
|
||||
{
|
||||
assert(not desc.items.empty());
|
||||
if (*fb == VK_NULL_HANDLE)
|
||||
{
|
||||
current.rgb = nullptr;
|
||||
current.a = nullptr;
|
||||
current.sampler_rgb = nullptr;
|
||||
current.sampler_a = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
current.rgb = *image_view;
|
||||
current.sampler_rgb = *sampler;
|
||||
|
||||
cmd.beginRenderPass(
|
||||
{
|
||||
.renderPass = *rp,
|
||||
.framebuffer = *fb,
|
||||
.renderArea = {
|
||||
.offset = {0, 0},
|
||||
.extent = {target.info().extent.width, target.info().extent.height},
|
||||
},
|
||||
},
|
||||
vk::SubpassContents::eInline);
|
||||
}
|
||||
|
||||
void blitter::push_image(vk::raii::CommandBuffer & cmd, uint8_t stream, vk::Sampler sampler, const vk::Extent2D & extent_, vk::ImageView image, vk::ImageLayout layout)
|
||||
{
|
||||
if (stream == passthrough_rgb)
|
||||
{
|
||||
current.rgb = image;
|
||||
current.sampler_rgb = sampler;
|
||||
current.layout_rgb = layout;
|
||||
current.rect_rgb.extent = vk::Extent2D{
|
||||
extent_.width * desc.items[stream].subsampling,
|
||||
extent_.height * desc.items[stream].subsampling,
|
||||
};
|
||||
return;
|
||||
}
|
||||
if (stream == passthrough_a)
|
||||
{
|
||||
current.a = image;
|
||||
current.sampler_a = sampler;
|
||||
current.layout_a = layout;
|
||||
current.rect_a.extent = vk::Extent2D{
|
||||
extent_.width * desc.items[stream].subsampling,
|
||||
extent_.height * desc.items[stream].subsampling,
|
||||
};
|
||||
return;
|
||||
}
|
||||
if (pipelines.empty())
|
||||
return;
|
||||
|
||||
assert(stream < pipelines.size());
|
||||
auto & p = pipelines[stream];
|
||||
if (not p.used)
|
||||
return;
|
||||
|
||||
const auto & extent = target.info().extent;
|
||||
const auto & description = desc.items[stream];
|
||||
if (not *p.pipeline)
|
||||
{
|
||||
const bool alpha = description.channels == to_headset::video_stream_description::channels_t::alpha;
|
||||
vk::DescriptorSetLayoutBinding sampler_layout_binding{
|
||||
.binding = 0,
|
||||
.descriptorType = vk::DescriptorType::eCombinedImageSampler,
|
||||
.descriptorCount = 1,
|
||||
.stageFlags = vk::ShaderStageFlagBits::eFragment,
|
||||
.pImmutableSamplers = &sampler,
|
||||
};
|
||||
|
||||
p.set_layout = device.createDescriptorSetLayout(vk::DescriptorSetLayoutCreateInfo{
|
||||
.flags = vk::DescriptorSetLayoutCreateFlagBits::ePushDescriptorKHR,
|
||||
.bindingCount = 1,
|
||||
.pBindings = &sampler_layout_binding,
|
||||
});
|
||||
|
||||
auto vert_constants = make_specialization_constants(
|
||||
float(description.width) / extent_.width,
|
||||
float(description.height) / extent_.height);
|
||||
|
||||
auto frag_constants = make_specialization_constants(
|
||||
VkBool32(alpha));
|
||||
|
||||
// Create graphics pipeline
|
||||
auto vertex_shader = load_shader(device, "stream.vert");
|
||||
auto fragment_shader = load_shader(device, "stream.frag");
|
||||
|
||||
p.layout = device.createPipelineLayout(vk::PipelineLayoutCreateInfo{
|
||||
.setLayoutCount = 1,
|
||||
.pSetLayouts = &*p.set_layout,
|
||||
});
|
||||
|
||||
vk::pipeline_builder pipeline_info{
|
||||
.Stages = {{
|
||||
.stage = vk::ShaderStageFlagBits::eVertex,
|
||||
.module = *vertex_shader,
|
||||
.pName = "main",
|
||||
.pSpecializationInfo = vert_constants,
|
||||
},
|
||||
{
|
||||
.stage = vk::ShaderStageFlagBits::eFragment,
|
||||
.module = *fragment_shader,
|
||||
.pName = "main",
|
||||
.pSpecializationInfo = frag_constants,
|
||||
}},
|
||||
.VertexBindingDescriptions = {},
|
||||
.VertexAttributeDescriptions = {},
|
||||
.InputAssemblyState = {{
|
||||
.topology = vk::PrimitiveTopology::eTriangleStrip,
|
||||
}},
|
||||
// With vk::DynamicState::eViewport, vk::DynamicState::eScissor the number of viewports
|
||||
// and scissors is still used, put a vector with one element
|
||||
.Viewports = {{}},
|
||||
.Scissors = {{}},
|
||||
.RasterizationState = {{
|
||||
.polygonMode = vk::PolygonMode::eFill,
|
||||
.lineWidth = 1,
|
||||
}},
|
||||
.MultisampleState = {{
|
||||
.rasterizationSamples = vk::SampleCountFlagBits::e1,
|
||||
}},
|
||||
.ColorBlendAttachments = {
|
||||
{.colorWriteMask = alpha ? vk::ColorComponentFlagBits::eA
|
||||
: vk::ColorComponentFlagBits::eA | vk::ColorComponentFlagBits::eR | vk::ColorComponentFlagBits::eG | vk::ColorComponentFlagBits::eB}},
|
||||
.DynamicStates = {vk::DynamicState::eViewport, vk::DynamicState::eScissor},
|
||||
.layout = *p.layout,
|
||||
.renderPass = *rp,
|
||||
.subpass = 0,
|
||||
};
|
||||
|
||||
p.pipeline = device.createGraphicsPipeline(application::get_pipeline_cache(), pipeline_info);
|
||||
spdlog::info("Created blit pipeline for stream {}, view {}", stream, view);
|
||||
}
|
||||
|
||||
cmd.bindPipeline(vk::PipelineBindPoint::eGraphics, *p.pipeline);
|
||||
|
||||
vk::DescriptorImageInfo image_info{
|
||||
.imageView = image,
|
||||
.imageLayout = layout,
|
||||
};
|
||||
cmd.pushDescriptorSetKHR(
|
||||
vk::PipelineBindPoint::eGraphics,
|
||||
*p.layout,
|
||||
0,
|
||||
vk::WriteDescriptorSet{
|
||||
.dstBinding = 0,
|
||||
.descriptorCount = 1,
|
||||
.descriptorType = vk::DescriptorType::eCombinedImageSampler,
|
||||
.pImageInfo = &image_info,
|
||||
});
|
||||
|
||||
int x0 = description.offset_x - view * extent.width;
|
||||
int y0 = description.offset_y;
|
||||
int x1 = x0 + description.width * description.subsampling;
|
||||
int y1 = y0 + description.height * description.subsampling;
|
||||
|
||||
cmd.setViewport(
|
||||
0,
|
||||
vk::Viewport{
|
||||
.x = (float)x0,
|
||||
.y = (float)y0,
|
||||
.width = float(description.width * description.subsampling),
|
||||
.height = float(description.height * description.subsampling),
|
||||
.minDepth = 0,
|
||||
.maxDepth = 1,
|
||||
});
|
||||
|
||||
x0 = std::clamp<int>(x0, 0, extent.width);
|
||||
x1 = std::clamp<int>(x1, 0, extent.width);
|
||||
y0 = std::clamp<int>(y0, 0, extent.height);
|
||||
y1 = std::clamp<int>(y1, 0, extent.height);
|
||||
|
||||
cmd.setScissor(
|
||||
0,
|
||||
vk::Rect2D{
|
||||
.offset = {.x = x0, .y = y0},
|
||||
.extent = {.width = uint32_t(x1 - x0), .height = uint32_t(y1 - y0)},
|
||||
});
|
||||
cmd.draw(3, 1, 0, 0);
|
||||
}
|
||||
|
||||
blitter::output blitter::end(vk::raii::CommandBuffer & cmd)
|
||||
{
|
||||
if (*fb)
|
||||
cmd.endRenderPass();
|
||||
return current;
|
||||
}
|
||||
|
||||
} // namespace wivrn
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "vk/allocation.h"
|
||||
#include "wivrn_packets.h"
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
|
||||
namespace wivrn
|
||||
{
|
||||
class blitter
|
||||
{
|
||||
public:
|
||||
struct output
|
||||
{
|
||||
vk::ImageView rgb;
|
||||
vk::Sampler sampler_rgb;
|
||||
vk::Rect2D rect_rgb;
|
||||
vk::ImageLayout layout_rgb;
|
||||
vk::ImageView a;
|
||||
vk::Sampler sampler_a;
|
||||
vk::Rect2D rect_a;
|
||||
vk::ImageLayout layout_a;
|
||||
};
|
||||
|
||||
private:
|
||||
vk::raii::Device & device;
|
||||
size_t view;
|
||||
to_headset::video_stream_description desc;
|
||||
// indices to simply passthrough, if -1 image needs to be blitted
|
||||
int passthrough_rgb = -1;
|
||||
int passthrough_a = -1;
|
||||
image_allocation target;
|
||||
vk::raii::ImageView image_view = nullptr;
|
||||
vk::raii::RenderPass rp = nullptr;
|
||||
vk::raii::Framebuffer fb = nullptr;
|
||||
vk::raii::Sampler sampler = nullptr;
|
||||
struct pipeline_t
|
||||
{
|
||||
vk::raii::DescriptorSetLayout set_layout = nullptr;
|
||||
vk::raii::PipelineLayout layout = nullptr;
|
||||
vk::raii::Pipeline pipeline = nullptr;
|
||||
bool used = false; // true if we need this image for blitting
|
||||
};
|
||||
std::vector<pipeline_t> pipelines;
|
||||
output current;
|
||||
|
||||
public:
|
||||
blitter(vk::raii::Device & device, size_t view);
|
||||
|
||||
void reset(const to_headset::video_stream_description & desc);
|
||||
void begin(vk::raii::CommandBuffer &);
|
||||
void push_image(vk::raii::CommandBuffer & buf, uint8_t stream, vk::Sampler sampler, const vk::Extent2D &, vk::ImageView image, vk::ImageLayout);
|
||||
output end(vk::raii::CommandBuffer &);
|
||||
};
|
||||
} // namespace wivrn
|
||||
@@ -397,15 +397,22 @@ static void set_clipping_planes(entt::registry & scene, entt::entity entity, std
|
||||
}
|
||||
}
|
||||
|
||||
void input_profile::apply(entt::registry & scene, XrSpace world_space, XrTime predicted_display_time, bool hide_left, bool hide_right, std::span<glm::vec4> pointer_limits)
|
||||
void input_profile::apply(
|
||||
entt::registry & scene,
|
||||
XrSpace world_space,
|
||||
XrTime predicted_display_time,
|
||||
bool hide_left_controller,
|
||||
bool hide_left_ray,
|
||||
bool hide_right_controller,
|
||||
bool hide_right_ray,
|
||||
std::span<glm::vec4> pointer_limits)
|
||||
{
|
||||
for (auto && [entity, node, space]: scene.view<components::node, bound_space>().each())
|
||||
{
|
||||
if ((space.space == xr::spaces::grip_left or space.space == xr::spaces::aim_left) and hide_left)
|
||||
{
|
||||
node.visible = false;
|
||||
}
|
||||
else if ((space.space == xr::spaces::grip_right or space.space == xr::spaces::aim_right) and hide_right)
|
||||
if ((space.space == xr::spaces::grip_left and hide_left_controller) or
|
||||
(space.space == xr::spaces::aim_left and hide_left_ray) or
|
||||
(space.space == xr::spaces::grip_right and hide_right_controller) or
|
||||
(space.space == xr::spaces::aim_right and hide_right_ray))
|
||||
{
|
||||
node.visible = false;
|
||||
}
|
||||
|
||||
@@ -40,5 +40,13 @@ struct input_profile
|
||||
input_profile(scene & scene, const std::filesystem::path & json_profile, uint32_t layer_mask_controller, uint32_t layer_mask_ray);
|
||||
|
||||
// application::poll_actions() must have been called before
|
||||
void apply(entt::registry & scene, XrSpace world_space, XrTime predicted_display_time, bool hide_left, bool hide_right, std::span<glm::vec4> pointer_limits);
|
||||
void apply(
|
||||
entt::registry & scene,
|
||||
XrSpace world_space,
|
||||
XrTime predicted_display_time,
|
||||
bool hide_left_controller,
|
||||
bool hide_left_ray,
|
||||
bool hide_right_controller,
|
||||
bool hide_right_ray,
|
||||
std::span<glm::vec4> pointer_limits);
|
||||
};
|
||||
|
||||
+387
-54
@@ -31,6 +31,7 @@
|
||||
#include "render/scene_components.h"
|
||||
#include "stream.h"
|
||||
#include "utils/files.h"
|
||||
#include "utils/glm_cast.h"
|
||||
#include "utils/i18n.h"
|
||||
#include "wivrn_client.h"
|
||||
#include "wivrn_discover.h"
|
||||
@@ -84,14 +85,38 @@ static const std::array supported_depth_formats{
|
||||
vk::Format::eX8D24UnormPack32,
|
||||
};
|
||||
|
||||
static float interpolate(float x, std::span<const std::pair<float, float>> arr)
|
||||
{
|
||||
assert(arr.size() >= 1);
|
||||
|
||||
if (x <= arr[0].first)
|
||||
return arr[0].second;
|
||||
|
||||
if (x >= arr.back().first)
|
||||
return arr.back().second;
|
||||
|
||||
for (size_t i = 0; i + 1 < arr.size(); i++)
|
||||
{
|
||||
assert(arr[i].first <= arr[i + 1].first);
|
||||
if (arr[i].first <= x and x < arr[i + 1].first)
|
||||
{
|
||||
auto t = (x - arr[i].first) / (arr[i + 1].first - arr[i].first);
|
||||
return std::lerp(arr[i].second, arr[i + 1].second, t);
|
||||
}
|
||||
}
|
||||
|
||||
return arr[0].second; // Should never happen
|
||||
}
|
||||
|
||||
static glm::quat compute_gui_orientation(glm::vec3 head_position, glm::vec3 new_gui_position)
|
||||
{
|
||||
using constants::lobby::gui_pitch;
|
||||
|
||||
glm::vec3 gui_direction = new_gui_position - head_position;
|
||||
|
||||
float gui_yaw = atan2(gui_direction.x, gui_direction.z) + M_PI;
|
||||
|
||||
float eye_gaze_elevation = atan2(gui_direction.y, glm::length(glm::vec2(gui_direction.x, gui_direction.z)));
|
||||
float gui_pitch = interpolate(eye_gaze_elevation * 180 / M_PI, constants::lobby::gui_pitches) * M_PI / 180;
|
||||
|
||||
return glm::quat(cos(gui_yaw / 2), 0, sin(gui_yaw / 2), 0) * glm::quat(cos(gui_pitch / 2), sin(gui_pitch / 2), 0, 0);
|
||||
}
|
||||
|
||||
@@ -403,27 +428,59 @@ void scenes::lobby::connect(const configuration::server_data & data)
|
||||
data.manual);
|
||||
}
|
||||
|
||||
std::optional<glm::vec3> scenes::lobby::check_recenter_gesture(xr::spaces space, const std::optional<std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT>> & joints)
|
||||
std::optional<glm::vec3> scenes::lobby::check_recenter_gesture(
|
||||
xr::spaces space,
|
||||
const std::optional<std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT>> & joints,
|
||||
const std::pair<glm::vec3, glm::quat> & head_pose)
|
||||
{
|
||||
if (recentering_context and std::get<0>(*recentering_context) != space)
|
||||
return std::nullopt;
|
||||
|
||||
if (not joints)
|
||||
if (joints)
|
||||
{
|
||||
recentering_context.reset();
|
||||
return std::nullopt;
|
||||
}
|
||||
const auto & palm = (*joints)[XR_HAND_JOINT_PALM_EXT].first;
|
||||
const auto palm_y = glm::rotate(glm_cast(palm.pose.orientation), glm::vec3(0, 1, 0));
|
||||
|
||||
const auto & palm = (*joints)[XR_HAND_JOINT_PALM_EXT].first;
|
||||
const auto & o = palm.pose.orientation;
|
||||
const auto & p = palm.pose.position;
|
||||
glm::quat q{o.w, o.x, o.y, o.z};
|
||||
glm::vec3 v{p.x, p.y, p.z};
|
||||
for (XrHandJointEXT index: {
|
||||
XR_HAND_JOINT_INDEX_PROXIMAL_EXT,
|
||||
XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT,
|
||||
XR_HAND_JOINT_INDEX_DISTAL_EXT,
|
||||
|
||||
if (glm::dot(q * glm::vec3(0, 1, 0), glm::vec3(0, -1, 0)) > constants::lobby::recenter_cosangle_min)
|
||||
{
|
||||
recentering_context.emplace(space, glm::vec3{}, 0);
|
||||
return v + glm::vec3(0, constants::lobby::recenter_distance_up, 0) + q * glm::vec3(0, 0, -constants::lobby::recenter_distance_front);
|
||||
XR_HAND_JOINT_MIDDLE_PROXIMAL_EXT,
|
||||
XR_HAND_JOINT_MIDDLE_INTERMEDIATE_EXT,
|
||||
XR_HAND_JOINT_MIDDLE_DISTAL_EXT,
|
||||
|
||||
XR_HAND_JOINT_RING_PROXIMAL_EXT,
|
||||
XR_HAND_JOINT_RING_INTERMEDIATE_EXT,
|
||||
XR_HAND_JOINT_RING_DISTAL_EXT,
|
||||
|
||||
XR_HAND_JOINT_LITTLE_PROXIMAL_EXT,
|
||||
XR_HAND_JOINT_LITTLE_INTERMEDIATE_EXT,
|
||||
XR_HAND_JOINT_LITTLE_DISTAL_EXT,
|
||||
})
|
||||
{
|
||||
const auto fingertip_y = glm::rotate(glm_cast((*joints)[index].first.pose.orientation), glm::vec3(0, 1, 0));
|
||||
|
||||
if (glm::dot(palm_y, fingertip_y) < constants::lobby::recenter_cos_fingertip_angle_max)
|
||||
{
|
||||
recentering_context.reset();
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
const auto q = glm_cast(palm.pose.orientation);
|
||||
const auto x = glm_cast(palm.pose.position);
|
||||
|
||||
// Make the up vector orthogonal to forward
|
||||
const glm::vec3 forward = glm::rotate(head_pose.second, glm::vec3{0, 0, -1});
|
||||
const glm::vec3 up = glm::normalize(glm::vec3{0, 1, 0} - forward * glm::dot(forward, {0, 1, 0}));
|
||||
|
||||
// Y is pointing to the back of the hand
|
||||
if (glm::dot(q * glm::vec3(0, -1, 0), up) > constants::lobby::recenter_cos_palm_angle_min)
|
||||
{
|
||||
recentering_context.emplace(space, glm::vec3{}, 0);
|
||||
return x + glm::rotate(q, glm::vec3{0, -constants::lobby::recenter_distance_up, -constants::lobby::recenter_distance_front});
|
||||
}
|
||||
}
|
||||
|
||||
recentering_context.reset();
|
||||
@@ -485,12 +542,11 @@ std::optional<glm::vec3> scenes::lobby::check_recenter_action(XrTime predicted_d
|
||||
{
|
||||
// First frame of recentering
|
||||
imgui_context::controller_state state{
|
||||
.active = true,
|
||||
.aim_position = aim->first,
|
||||
.aim_orientation = aim->second,
|
||||
};
|
||||
|
||||
imgui_ctx->compute_pointer_position(state);
|
||||
state.pointer_position = imgui_ctx->compute_pointer_position(state).first;
|
||||
|
||||
if (state.pointer_position) // TODO: check that the pointer is inside an imgui window
|
||||
{
|
||||
@@ -535,14 +591,21 @@ std::optional<glm::vec3> scenes::lobby::check_recenter_action(XrTime predicted_d
|
||||
// One step is usually enough, the solution will continuously improve in the next frames
|
||||
glm::vec3 gui_position = imgui_ctx->layers()[0].position;
|
||||
float eps = 0.01;
|
||||
glm::vec3 obj = f(gui_position);
|
||||
glm::vec3 obj_dx = (f(gui_position + glm::vec3(eps, 0, 0)) - obj) / eps;
|
||||
glm::vec3 obj_dy = (f(gui_position + glm::vec3(0, eps, 0)) - obj) / eps;
|
||||
glm::vec3 obj_dz = (f(gui_position + glm::vec3(0, 0, eps)) - obj) / eps;
|
||||
|
||||
glm::mat3 jacobian{obj_dx, obj_dy, obj_dz};
|
||||
glm::vec3 obj;
|
||||
int n_iter = 0;
|
||||
do
|
||||
{
|
||||
obj = f(gui_position);
|
||||
glm::vec3 obj_dx = (f(gui_position + glm::vec3(eps, 0, 0)) - obj) / eps;
|
||||
glm::vec3 obj_dy = (f(gui_position + glm::vec3(0, eps, 0)) - obj) / eps;
|
||||
glm::vec3 obj_dz = (f(gui_position + glm::vec3(0, 0, eps)) - obj) / eps;
|
||||
|
||||
gui_position -= glm::inverse(jacobian) * obj;
|
||||
glm::mat3 jacobian{obj_dx, obj_dy, obj_dz};
|
||||
|
||||
gui_position -= 0.01 * glm::inverse(jacobian) * obj;
|
||||
n_iter++;
|
||||
} while (glm::length(obj) > 0.0001 and n_iter < 1000);
|
||||
|
||||
return gui_position;
|
||||
}
|
||||
@@ -584,6 +647,240 @@ static glm::vec4 compute_ray_limits(const XrPosef & pose, float margin = 0)
|
||||
return glm::vec4(normal, -glm::dot(p, normal) - margin);
|
||||
}
|
||||
|
||||
static void stick_finger_to_gui(std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT> & hand, const std::vector<imgui_context::viewport> & layers)
|
||||
{
|
||||
// Move XR_HAND_JOINT_INDEX_{TIP,DISTAL,INTERMEDIATE,PROXIMAL}_EXT so that:
|
||||
// - Only the X rotation changes for distal and intermediate (relative to the parent bone)
|
||||
// - Only the X and Y rotation change for the proximal
|
||||
// - The orientation of the tip is the same as the distal
|
||||
// - The position stays constant in the frame of the parent bone
|
||||
// - The position of the tip is on the closest imgui window (considering the tip radius)
|
||||
// - The rotation on X for the index proximal is limited to [-90, +30]
|
||||
// - The rotation on Y for the index proximal is limited to [-30, +30]
|
||||
// - The rotation on X for the index intermediate are equal and limited to [-90, 0]
|
||||
|
||||
// Convert from OpenXR types to glm
|
||||
glm::vec3 tip_x{
|
||||
hand[XR_HAND_JOINT_INDEX_TIP_EXT].first.pose.position.x,
|
||||
hand[XR_HAND_JOINT_INDEX_TIP_EXT].first.pose.position.y,
|
||||
hand[XR_HAND_JOINT_INDEX_TIP_EXT].first.pose.position.z};
|
||||
|
||||
// Compute the target position of the tip
|
||||
std::vector<std::pair<glm::vec3, float>> intersections; // Target position of the finger tip, distance to the GUI plane
|
||||
for (const imgui_context::viewport & layer: layers)
|
||||
{
|
||||
// Ignore layers that are not absolutely positionned
|
||||
if (layer.space != xr::spaces::world)
|
||||
continue;
|
||||
|
||||
// Compute all vectors in the reference frame of the GUI plane
|
||||
// The normal of the GUI plane is +Z, the tip points toward -Z
|
||||
auto M = glm::mat3_cast(layer.orientation); // plane-to-world transform
|
||||
glm::vec3 ray_start = glm::transpose(M) * (tip_x - layer.position);
|
||||
|
||||
// Ignore this layer if the tip is outside the limits
|
||||
if (std::abs(ray_start.x) > layer.size.x / 2)
|
||||
continue;
|
||||
|
||||
if (std::abs(ray_start.y) > layer.size.y / 2)
|
||||
continue;
|
||||
|
||||
float distance = ray_start.z; // Positive when the point is in front of the plane
|
||||
|
||||
// Not near the plane: ignore
|
||||
if (distance > 0 or distance < constants::gui::fingertip_distance_stick_thd)
|
||||
continue;
|
||||
|
||||
glm::vec3 target_position = tip_x + M * glm::vec3{0, 0, -distance};
|
||||
|
||||
intersections.emplace_back(target_position, std::abs(distance));
|
||||
}
|
||||
|
||||
if (intersections.empty())
|
||||
return;
|
||||
|
||||
auto [target_position, distance] = *std::ranges::min_element(intersections, {}, &std::pair<glm::vec3, float>::second);
|
||||
|
||||
// Convert from OpenXR to glm
|
||||
glm::vec3 distal_x{
|
||||
hand[XR_HAND_JOINT_INDEX_DISTAL_EXT].first.pose.position.x,
|
||||
hand[XR_HAND_JOINT_INDEX_DISTAL_EXT].first.pose.position.y,
|
||||
hand[XR_HAND_JOINT_INDEX_DISTAL_EXT].first.pose.position.z};
|
||||
glm::vec3 intermediate_x{
|
||||
hand[XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT].first.pose.position.x,
|
||||
hand[XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT].first.pose.position.y,
|
||||
hand[XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT].first.pose.position.z};
|
||||
glm::vec3 proximal_x{
|
||||
hand[XR_HAND_JOINT_INDEX_PROXIMAL_EXT].first.pose.position.x,
|
||||
hand[XR_HAND_JOINT_INDEX_PROXIMAL_EXT].first.pose.position.y,
|
||||
hand[XR_HAND_JOINT_INDEX_PROXIMAL_EXT].first.pose.position.z};
|
||||
glm::vec3 metacarpal_x{
|
||||
hand[XR_HAND_JOINT_INDEX_METACARPAL_EXT].first.pose.position.x,
|
||||
hand[XR_HAND_JOINT_INDEX_METACARPAL_EXT].first.pose.position.y,
|
||||
hand[XR_HAND_JOINT_INDEX_METACARPAL_EXT].first.pose.position.z};
|
||||
glm::quat distal_q = glm::quat::wxyz(
|
||||
hand[XR_HAND_JOINT_INDEX_DISTAL_EXT].first.pose.orientation.w,
|
||||
hand[XR_HAND_JOINT_INDEX_DISTAL_EXT].first.pose.orientation.x,
|
||||
hand[XR_HAND_JOINT_INDEX_DISTAL_EXT].first.pose.orientation.y,
|
||||
hand[XR_HAND_JOINT_INDEX_DISTAL_EXT].first.pose.orientation.z);
|
||||
glm::quat intermediate_q = glm::quat::wxyz(
|
||||
hand[XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT].first.pose.orientation.w,
|
||||
hand[XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT].first.pose.orientation.x,
|
||||
hand[XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT].first.pose.orientation.y,
|
||||
hand[XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT].first.pose.orientation.z);
|
||||
glm::quat proximal_q = glm::quat::wxyz(
|
||||
hand[XR_HAND_JOINT_INDEX_PROXIMAL_EXT].first.pose.orientation.w,
|
||||
hand[XR_HAND_JOINT_INDEX_PROXIMAL_EXT].first.pose.orientation.x,
|
||||
hand[XR_HAND_JOINT_INDEX_PROXIMAL_EXT].first.pose.orientation.y,
|
||||
hand[XR_HAND_JOINT_INDEX_PROXIMAL_EXT].first.pose.orientation.z);
|
||||
glm::quat metacarpal_q = glm::quat::wxyz(
|
||||
hand[XR_HAND_JOINT_INDEX_METACARPAL_EXT].first.pose.orientation.w,
|
||||
hand[XR_HAND_JOINT_INDEX_METACARPAL_EXT].first.pose.orientation.x,
|
||||
hand[XR_HAND_JOINT_INDEX_METACARPAL_EXT].first.pose.orientation.y,
|
||||
hand[XR_HAND_JOINT_INDEX_METACARPAL_EXT].first.pose.orientation.z);
|
||||
|
||||
// Get relative positions and orientations
|
||||
const auto rel_tip_x = glm::rotate(glm::conjugate(distal_q), tip_x - distal_x);
|
||||
// relative tip orientation is always identity
|
||||
|
||||
const auto rel_distal_x = glm::rotate(glm::conjugate(intermediate_q), distal_x - intermediate_x);
|
||||
const auto rel_distal_q = glm::conjugate(intermediate_q) * distal_q;
|
||||
const auto rel_distal_θ = glm::eulerAngles(rel_distal_q);
|
||||
|
||||
const auto rel_intermediate_x = glm::rotate(glm::conjugate(proximal_q), intermediate_x - proximal_x);
|
||||
const auto rel_intermediate_q = glm::conjugate(proximal_q) * intermediate_q;
|
||||
const auto rel_intermediate_θ = glm::eulerAngles(rel_intermediate_q);
|
||||
|
||||
const auto rel_proximal_x = glm::rotate(glm::conjugate(metacarpal_q), proximal_x - metacarpal_x);
|
||||
const auto rel_proximal_q = glm::conjugate(metacarpal_q) * proximal_q;
|
||||
const auto rel_proximal_θ = glm::eulerAngles(rel_proximal_q);
|
||||
|
||||
// Forward kinematics
|
||||
auto f = [&](float proximal_θx, float proximal_θy, float intermediate_θx, float distal_θx) -> glm::vec3 {
|
||||
// Compute the absolute tip position
|
||||
const glm::quat new_rel_proximal_q = glm::quat(glm::vec3(proximal_θx, proximal_θy, rel_proximal_θ.z));
|
||||
const glm::quat new_rel_intermediate_q = glm::quat(glm::vec3(intermediate_θx, rel_intermediate_θ.y, rel_intermediate_θ.z));
|
||||
const glm::quat new_rel_distal_q = glm::quat(glm::vec3(distal_θx, rel_distal_θ.y, rel_distal_θ.z));
|
||||
|
||||
const glm::quat proximal_q = metacarpal_q * new_rel_proximal_q;
|
||||
const glm::quat intermediate_q = proximal_q * new_rel_intermediate_q;
|
||||
const glm::quat distal_q = intermediate_q * new_rel_distal_q;
|
||||
|
||||
const glm::vec3 tip_x = metacarpal_x +
|
||||
glm::rotate(metacarpal_q, rel_proximal_x) +
|
||||
glm::rotate(proximal_q, rel_intermediate_x) +
|
||||
glm::rotate(intermediate_q, rel_distal_x) +
|
||||
glm::rotate(distal_q, rel_tip_x);
|
||||
|
||||
return tip_x - target_position;
|
||||
};
|
||||
|
||||
// Inverse kinematics solver for the tip position
|
||||
float proximal_θx = rel_proximal_θ.x;
|
||||
float proximal_θy = rel_proximal_θ.y;
|
||||
float intermediate_θx = rel_intermediate_θ.x;
|
||||
float distal_θx = rel_distal_θ.x;
|
||||
|
||||
glm::vec3 objective = f(proximal_θx, proximal_θy, intermediate_θx, distal_θx);
|
||||
float eps = 0.01; // 10 milliradian ~ 0.57 deg
|
||||
int n = 0;
|
||||
|
||||
while (glm::length(objective) > 1e-4 and n++ < 1000)
|
||||
{
|
||||
glm::vec3 dobj_1 = (f(proximal_θx + eps, proximal_θy, intermediate_θx, distal_θx) - objective) / eps;
|
||||
glm::vec3 dobj_2 = (f(proximal_θx, proximal_θy + eps, intermediate_θx, distal_θx) - objective) / eps;
|
||||
glm::vec3 dobj_3 = (f(proximal_θx, proximal_θy, intermediate_θx + eps, distal_θx) - objective) / eps;
|
||||
glm::vec3 dobj_4 = (f(proximal_θx, proximal_θy, intermediate_θx, distal_θx + eps) - objective) / eps;
|
||||
|
||||
glm::mat4x3 jacobian(dobj_1, dobj_2, dobj_3, dobj_4);
|
||||
glm::mat3x4 jacobian_transpose = glm::transpose(jacobian);
|
||||
|
||||
glm::vec4 direction = -glm::normalize(jacobian_transpose * objective);
|
||||
glm::vec4 delta = 10 * direction * glm::length(objective);
|
||||
|
||||
float tmp = (delta.z + delta.w) / 2;
|
||||
delta.z = delta.w = tmp;
|
||||
|
||||
proximal_θx = std::clamp<float>(proximal_θx + delta.x, -M_PI / 2, M_PI / 6);
|
||||
proximal_θy = std::clamp<float>(proximal_θy + delta.y, -M_PI / 6, M_PI / 6);
|
||||
intermediate_θx = std::clamp<float>(intermediate_θx + delta.z, -M_PI / 2, 0);
|
||||
distal_θx = std::clamp<float>(distal_θx + delta.w, -M_PI / 2, 0);
|
||||
|
||||
objective = f(proximal_θx, proximal_θy, intermediate_θx, distal_θx);
|
||||
}
|
||||
|
||||
// Fill in the modified bones
|
||||
const glm::vec3 new_rel_proximal_θ(proximal_θx, proximal_θy, rel_proximal_θ.z);
|
||||
const glm::vec3 new_rel_intermediate_θ(intermediate_θx, rel_intermediate_θ.y, rel_intermediate_θ.z);
|
||||
const glm::vec3 new_rel_distal_θ(distal_θx, rel_distal_θ.y, rel_distal_θ.z);
|
||||
|
||||
const glm::quat new_rel_proximal_q = glm::quat(new_rel_proximal_θ);
|
||||
const glm::quat new_rel_intermediate_q = glm::quat(new_rel_intermediate_θ);
|
||||
const glm::quat new_rel_distal_q = glm::quat(new_rel_distal_θ);
|
||||
|
||||
proximal_q = metacarpal_q * new_rel_proximal_q;
|
||||
intermediate_q = proximal_q * new_rel_intermediate_q;
|
||||
distal_q = intermediate_q * new_rel_distal_q;
|
||||
|
||||
intermediate_x = proximal_x + glm::rotate(proximal_q, rel_intermediate_x);
|
||||
distal_x = intermediate_x + glm::rotate(intermediate_q, rel_distal_x);
|
||||
tip_x = distal_x + glm::rotate(distal_q, rel_tip_x);
|
||||
|
||||
hand[XR_HAND_JOINT_INDEX_PROXIMAL_EXT].first.pose.orientation = {
|
||||
proximal_q.x,
|
||||
proximal_q.y,
|
||||
proximal_q.z,
|
||||
proximal_q.w,
|
||||
};
|
||||
hand[XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT].first.pose = {
|
||||
.orientation = {
|
||||
intermediate_q.x,
|
||||
intermediate_q.y,
|
||||
intermediate_q.z,
|
||||
intermediate_q.w,
|
||||
},
|
||||
.position = {
|
||||
intermediate_x.x,
|
||||
intermediate_x.y,
|
||||
intermediate_x.z,
|
||||
},
|
||||
};
|
||||
hand[XR_HAND_JOINT_INDEX_DISTAL_EXT].first.pose = {
|
||||
.orientation = {
|
||||
distal_q.x,
|
||||
distal_q.y,
|
||||
distal_q.z,
|
||||
distal_q.w,
|
||||
},
|
||||
.position = {
|
||||
distal_x.x,
|
||||
distal_x.y,
|
||||
distal_x.z,
|
||||
},
|
||||
};
|
||||
hand[XR_HAND_JOINT_INDEX_TIP_EXT].first.pose = {
|
||||
.orientation = {
|
||||
distal_q.x,
|
||||
distal_q.y,
|
||||
distal_q.z,
|
||||
distal_q.w,
|
||||
},
|
||||
.position = {
|
||||
tip_x.x,
|
||||
tip_x.y,
|
||||
tip_x.z,
|
||||
},
|
||||
};
|
||||
|
||||
// Translate the whole hand if we cannot find an exact solution
|
||||
for (auto & hand_joint: hand)
|
||||
{
|
||||
hand_joint.first.pose.position.x -= objective.x;
|
||||
hand_joint.first.pose.position.y -= objective.y;
|
||||
hand_joint.first.pose.position.z -= objective.z;
|
||||
}
|
||||
}
|
||||
|
||||
void scenes::lobby::render(const XrFrameState & frame_state)
|
||||
{
|
||||
if (async_session.valid() && async_session.poll() == utils::future_status::ready)
|
||||
@@ -651,6 +948,8 @@ void scenes::lobby::render(const XrFrameState & frame_state)
|
||||
}
|
||||
|
||||
session.begin_frame();
|
||||
renderer->debug_draw_clear();
|
||||
|
||||
#if WIVRN_FEATURE_RENDERDOC
|
||||
renderdoc_begin(*vk_instance);
|
||||
#endif
|
||||
@@ -674,25 +973,32 @@ void scenes::lobby::render(const XrFrameState & frame_state)
|
||||
|
||||
if (left_hand and right_hand)
|
||||
{
|
||||
auto windows = imgui_ctx->windows();
|
||||
|
||||
auto left = left_hand->locate(world_space, frame_state.predictedDisplayTime);
|
||||
if (left and xr::hand_tracker::check_flags(*left, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
{
|
||||
stick_finger_to_gui(*left, windows);
|
||||
hide_left_controller = true;
|
||||
}
|
||||
|
||||
auto right = right_hand->locate(world_space, frame_state.predictedDisplayTime);
|
||||
if (right and xr::hand_tracker::check_flags(*right, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
{
|
||||
stick_finger_to_gui(*right, windows);
|
||||
hide_right_controller = true;
|
||||
}
|
||||
|
||||
hand_model::apply(world, left, right);
|
||||
|
||||
if (left and xr::hand_tracker::check_flags(*left, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
hide_left_controller = true;
|
||||
if (not new_gui_position and head_position)
|
||||
new_gui_position = check_recenter_gesture(xr::spaces::palm_left, left, *head_position);
|
||||
|
||||
if (right and xr::hand_tracker::check_flags(*right, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
hide_right_controller = true;
|
||||
|
||||
if (not new_gui_position)
|
||||
new_gui_position = check_recenter_gesture(xr::spaces::palm_left, left);
|
||||
|
||||
if (not new_gui_position)
|
||||
new_gui_position = check_recenter_gesture(xr::spaces::palm_right, right);
|
||||
if (not new_gui_position and head_position)
|
||||
new_gui_position = check_recenter_gesture(xr::spaces::palm_right, right, *head_position);
|
||||
}
|
||||
|
||||
if (head_position && new_gui_position)
|
||||
if (head_position and new_gui_position)
|
||||
{
|
||||
move_gui(head_position->first, *new_gui_position);
|
||||
}
|
||||
@@ -736,7 +1042,6 @@ void scenes::lobby::render(const XrFrameState & frame_state)
|
||||
}
|
||||
#endif
|
||||
|
||||
renderer->debug_draw_clear();
|
||||
std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_layers = draw_gui(frame_state.predictedDisplayTime);
|
||||
|
||||
#if WIVRN_CLIENT_DEBUG_MENU
|
||||
@@ -759,12 +1064,17 @@ void scenes::lobby::render(const XrFrameState & frame_state)
|
||||
ray_limits.push_back(compute_ray_limits(layer.pose));
|
||||
}
|
||||
|
||||
input->apply(world, world_space, frame_state.predictedDisplayTime, hide_left_controller, hide_right_controller, ray_limits);
|
||||
input->apply(world,
|
||||
world_space,
|
||||
frame_state.predictedDisplayTime,
|
||||
hide_left_controller,
|
||||
not imgui_ctx->is_aim_interaction()[0],
|
||||
hide_right_controller,
|
||||
not imgui_ctx->is_aim_interaction()[1],
|
||||
ray_limits);
|
||||
|
||||
renderer::animate(world, frame_state.predictedDisplayPeriod * 1.0e-9);
|
||||
|
||||
assert(renderer);
|
||||
|
||||
world.get<components::node>(lobby_entity).visible = not application::get_config().passthrough_enabled;
|
||||
|
||||
render_start(application::get_config().passthrough_enabled, frame_state.predictedDisplayTime);
|
||||
@@ -892,6 +1202,14 @@ void scenes::lobby::on_focused()
|
||||
recenter_left_action = get_action("recenter_left").first;
|
||||
recenter_right_action = get_action("recenter_right").first;
|
||||
|
||||
if (system.hand_tracking_supported())
|
||||
{
|
||||
left_hand = session.create_hand_tracker(XR_HAND_LEFT_EXT);
|
||||
right_hand = session.create_hand_tracker(XR_HAND_RIGHT_EXT);
|
||||
hand_model::add_hand(*this, XR_HAND_LEFT_EXT, "assets://left-hand.glb", layer_controllers);
|
||||
hand_model::add_hand(*this, XR_HAND_RIGHT_EXT, "assets://right-hand.glb", layer_controllers);
|
||||
}
|
||||
|
||||
std::vector imgui_inputs{
|
||||
imgui_context::controller{
|
||||
.aim = get_action_space("left_aim"),
|
||||
@@ -900,6 +1218,7 @@ void scenes::lobby::on_focused()
|
||||
.squeeze = get_action("left_squeeze").first,
|
||||
.scroll = get_action("left_scroll").first,
|
||||
.haptic_output = get_action("left_haptic").first,
|
||||
.hand = left_hand ? &*left_hand : nullptr,
|
||||
},
|
||||
imgui_context::controller{
|
||||
.aim = get_action_space("right_aim"),
|
||||
@@ -908,21 +1227,10 @@ void scenes::lobby::on_focused()
|
||||
.squeeze = get_action("right_squeeze").first,
|
||||
.scroll = get_action("right_scroll").first,
|
||||
.haptic_output = get_action("right_haptic").first,
|
||||
.hand = right_hand ? &*right_hand : nullptr,
|
||||
},
|
||||
};
|
||||
|
||||
if (system.hand_tracking_supported())
|
||||
{
|
||||
left_hand = session.create_hand_tracker(XR_HAND_LEFT_EXT);
|
||||
right_hand = session.create_hand_tracker(XR_HAND_RIGHT_EXT);
|
||||
hand_model::add_hand(*this, XR_HAND_LEFT_EXT, "assets://left-hand.glb", layer_controllers);
|
||||
hand_model::add_hand(*this, XR_HAND_RIGHT_EXT, "assets://right-hand.glb", layer_controllers);
|
||||
imgui_inputs.push_back({.hand = &*left_hand});
|
||||
imgui_inputs.push_back({.hand = &*right_hand});
|
||||
}
|
||||
|
||||
face_tracker = xr::make_face_tracker(instance, system, session);
|
||||
|
||||
// 0.4mm / pixel
|
||||
std::vector<imgui_context::viewport> vps{
|
||||
{
|
||||
@@ -973,11 +1281,22 @@ void scenes::lobby::on_focused()
|
||||
vps,
|
||||
image_cache);
|
||||
|
||||
supported_codecs = wivrn::decoder::supported_codecs();
|
||||
|
||||
auto t = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
||||
auto tm = std::localtime(&t);
|
||||
std::string image = tm->tm_mon == 5 ? "wivrn-pride" : "wivrn";
|
||||
|
||||
about_picture = imgui_ctx->load_texture("assets://" + image + ".ktx2");
|
||||
switch (tm->tm_mon)
|
||||
{
|
||||
case 5:
|
||||
about_picture = imgui_ctx->load_texture("assets://wivrn-pride.ktx2");
|
||||
break;
|
||||
case 11:
|
||||
about_picture = imgui_ctx->load_texture("assets://wivrn-christmas.ktx2");
|
||||
break;
|
||||
default:
|
||||
about_picture = imgui_ctx->load_texture("assets://wivrn.ktx2");
|
||||
break;
|
||||
}
|
||||
|
||||
default_environment_screenshot = imgui_ctx->load_texture("assets://default-environment.ktx2");
|
||||
|
||||
@@ -1024,6 +1343,9 @@ void scenes::lobby::on_focused()
|
||||
setup_passthrough();
|
||||
session.set_refresh_rate(application::get_config().preferred_refresh_rate.value_or(0));
|
||||
multicast = application::get_wifi_lock().get_multicast_lock();
|
||||
|
||||
session.set_performance_level(XR_PERF_SETTINGS_DOMAIN_CPU_EXT, XR_PERF_SETTINGS_LEVEL_SUSTAINED_HIGH_EXT);
|
||||
session.set_performance_level(XR_PERF_SETTINGS_DOMAIN_GPU_EXT, XR_PERF_SETTINGS_LEVEL_SUSTAINED_HIGH_EXT);
|
||||
}
|
||||
|
||||
void scenes::lobby::setup_passthrough()
|
||||
@@ -1136,6 +1458,17 @@ scene::meta & scenes::lobby::get_meta_scene()
|
||||
{"right_squeeze", "/user/hand/right/input/menu/click"},
|
||||
},
|
||||
},
|
||||
suggested_binding{
|
||||
{
|
||||
"/interaction_profiles/ext/hand_interaction_ext",
|
||||
},
|
||||
{
|
||||
{"left_aim", "/user/hand/left/input/aim/pose"},
|
||||
{"left_trigger", "/user/hand/left/input/aim_activate_ext"},
|
||||
{"right_aim", "/user/hand/right/input/aim/pose"},
|
||||
{"right_trigger", "/user/hand/right/input/aim_activate_ext"},
|
||||
},
|
||||
},
|
||||
}};
|
||||
|
||||
return m;
|
||||
|
||||
@@ -134,6 +134,9 @@ class lobby : public scene_impl<lobby>
|
||||
tab current_tab = tab::server_list;
|
||||
tab last_current_tab = tab::server_list;
|
||||
int optional_feature_index = 0; // Which step of the first run screen are we in
|
||||
|
||||
std::vector<wivrn::video_codec> supported_codecs;
|
||||
|
||||
ImTextureID about_picture;
|
||||
|
||||
virtual_keyboard keyboard;
|
||||
@@ -238,7 +241,7 @@ class lobby : public scene_impl<lobby>
|
||||
void connect(const configuration::server_data & data);
|
||||
std::unique_ptr<wivrn_session> connect_to_session(wivrn_discover::service service, bool manual_connection);
|
||||
|
||||
std::optional<glm::vec3> check_recenter_gesture(xr::spaces space, const std::optional<std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT>> & joints);
|
||||
std::optional<glm::vec3> check_recenter_gesture(xr::spaces space, const std::optional<std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT>> & joints, const std::pair<glm::vec3, glm::quat> & head_pose);
|
||||
std::optional<glm::vec3> check_recenter_action(XrTime predicted_display_time, glm::vec3 head_position);
|
||||
std::optional<glm::vec3> check_recenter_gui(glm::vec3 head_position, glm::quat head_orientation);
|
||||
|
||||
|
||||
+171
-39
@@ -32,12 +32,14 @@
|
||||
#include "utils/i18n.h"
|
||||
#include "utils/mapped_file.h"
|
||||
#include "utils/overloaded.h"
|
||||
#if WIVRN_CLIENT_DEBUG_MENU
|
||||
#include "utils/ranges.h"
|
||||
#endif
|
||||
#include "version.h"
|
||||
#include "xr/body_tracker.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <chrono>
|
||||
#include <chrono> // IWYU pragma: keep
|
||||
#include <entt/entity/fwd.hpp>
|
||||
#include <fastgltf/math.hpp>
|
||||
#include <fastgltf/types.hpp>
|
||||
@@ -566,6 +568,7 @@ void scenes::lobby::gui_settings()
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
}
|
||||
|
||||
if (instance.has_extension(XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME))
|
||||
@@ -642,20 +645,21 @@ void scenes::lobby::gui_settings()
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
}
|
||||
|
||||
// Render resolution
|
||||
{
|
||||
const auto current = config.resolution_scale;
|
||||
const auto width = stream_view.recommendedImageRectWidth;
|
||||
const auto height = stream_view.recommendedImageRectHeight;
|
||||
auto intScale = int(current * 100);
|
||||
auto intScale = int(current * 10);
|
||||
const auto slider = ImGui::SliderInt(
|
||||
_("Resolution scale").append("##resolution_scale").c_str(),
|
||||
_("Render resolution").append("##resolution_scale").c_str(),
|
||||
&intScale,
|
||||
50,
|
||||
350,
|
||||
fmt::format(_F("%d%% - {}x{} per eye"), int(width * current), int(height * current)).c_str());
|
||||
5,
|
||||
config.extended_config ? 35 : 15,
|
||||
fmt::format(_F("{}%% - {}x{} per eye"), intScale * 10, int(width * current), int(height * current)).c_str());
|
||||
if (slider)
|
||||
{
|
||||
config.resolution_scale = intScale * 0.01;
|
||||
config.resolution_scale = intScale * 0.1;
|
||||
config.save();
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
@@ -667,6 +671,122 @@ void scenes::lobby::gui_settings()
|
||||
}
|
||||
}
|
||||
|
||||
// foveation
|
||||
{
|
||||
const int step = 10;
|
||||
const auto current = config.get_stream_scale();
|
||||
int intval = round((1 - current) * 100 / step);
|
||||
const auto slider = ImGui::SliderInt(
|
||||
_("Foveated encoding").append("##stream_scale").c_str(),
|
||||
&intval,
|
||||
0,
|
||||
100 / step,
|
||||
fmt::format(_F("{}%%"), intval * step).c_str());
|
||||
if (slider)
|
||||
{
|
||||
// clamp out of the slider to have the 50% value centered
|
||||
intval = std::clamp(intval,
|
||||
config.extended_config ? 0 : 30 / step,
|
||||
80 / step);
|
||||
config.set_stream_scale(1 - intval * step * 0.01);
|
||||
config.save();
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
if (config.check_feature(feature::eye_gaze))
|
||||
imgui_ctx->tooltip(_("Higher values focus image quality where you look at,\n"
|
||||
"improving latency, power efficiency and quality."));
|
||||
else
|
||||
imgui_ctx->tooltip(_("Higher values focus image quality at the center,\n"
|
||||
"improving latency, power efficiency and quality."));
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
}
|
||||
|
||||
{
|
||||
auto codec_name = [](const std::optional<wivrn::video_codec> codec) {
|
||||
if (not codec)
|
||||
return _C("Codec", "Automatic");
|
||||
switch (*codec)
|
||||
{
|
||||
case wivrn::h264:
|
||||
return _C("Codec", "H.264");
|
||||
case wivrn::h265:
|
||||
return _C("Codec", "H.265");
|
||||
case wivrn::av1:
|
||||
return _C("Codec", "AV1");
|
||||
case wivrn::raw:
|
||||
break;
|
||||
}
|
||||
assert(false);
|
||||
__builtin_unreachable();
|
||||
};
|
||||
|
||||
if (ImGui::BeginCombo(_S("Codec"), codec_name(config.codec).c_str()))
|
||||
{
|
||||
if (ImGui::Selectable(codec_name({}).c_str(), not config.codec))
|
||||
{
|
||||
config.codec = std::nullopt;
|
||||
config.save();
|
||||
}
|
||||
for (auto codec: supported_codecs)
|
||||
{
|
||||
// don't show raw in GUI
|
||||
if (codec == wivrn::raw)
|
||||
continue;
|
||||
|
||||
if (ImGui::Selectable(codec_name(codec).c_str(), config.codec == codec))
|
||||
{
|
||||
config.codec = codec;
|
||||
config.save();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
|
||||
if (config.codec == wivrn::video_codec::av1 or config.codec == wivrn::video_codec::h265)
|
||||
{
|
||||
ImGui::SameLine(0.f, 10.f);
|
||||
bool ten_bit = config.bit_depth == 10;
|
||||
if (ImGui::Checkbox(_S("10-bit"), &ten_bit))
|
||||
{
|
||||
config.bit_depth = ten_bit ? 10 : 8;
|
||||
config.save();
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
}
|
||||
}
|
||||
|
||||
// Bitrate
|
||||
{
|
||||
const int mb = 1'000'000;
|
||||
const auto current = config.bitrate_bps;
|
||||
auto val = int(current / mb);
|
||||
const auto slider = ImGui::SliderInt(
|
||||
_("Bitrate").append("##bitrate").c_str(),
|
||||
&val,
|
||||
1,
|
||||
config.max_bitrate() / mb,
|
||||
fmt::format(_F("{}Mbit/s"), val).c_str());
|
||||
if (slider)
|
||||
{
|
||||
config.bitrate_bps = val * mb;
|
||||
config.save();
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
}
|
||||
|
||||
if (instance.has_extension(XR_EXT_PERFORMANCE_SETTINGS_EXTENSION_NAME))
|
||||
{
|
||||
if (ImGui::Checkbox(_S("High power mode"), &config.high_power_mode))
|
||||
config.save();
|
||||
if (ImGui::IsItemHovered())
|
||||
imgui_ctx->tooltip(_("Increase power usage to allow higher resolution and refresh rate"));
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
}
|
||||
|
||||
{
|
||||
bool enabled = config.check_feature(feature::microphone);
|
||||
if (ImGui::Checkbox(_S("Enable microphone"), &enabled))
|
||||
@@ -688,8 +808,8 @@ void scenes::lobby::gui_settings()
|
||||
ImGui::Unindent();
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
if (system.hand_tracking_supported())
|
||||
{
|
||||
ImGui::BeginDisabled(not system.hand_tracking_supported());
|
||||
bool enabled = config.check_feature(feature::hand_tracking);
|
||||
if (ImGui::Checkbox(_S("Enable hand tracking"), &enabled))
|
||||
{
|
||||
@@ -698,10 +818,9 @@ void scenes::lobby::gui_settings()
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) and (ImGui::GetItemFlags() & ImGuiItemFlags_Disabled))
|
||||
imgui_ctx->tooltip(_("This feature is not supported by your headset"));
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
if (application::get_eye_gaze_supported())
|
||||
{
|
||||
ImGui::BeginDisabled(not application::get_eye_gaze_supported());
|
||||
bool enabled = config.check_feature(feature::eye_gaze);
|
||||
if (ImGui::Checkbox(_S("Enable eye tracking"), &enabled))
|
||||
{
|
||||
@@ -710,30 +829,26 @@ void scenes::lobby::gui_settings()
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) and (ImGui::GetItemFlags() & ImGuiItemFlags_Disabled))
|
||||
imgui_ctx->tooltip(_("This feature is not supported by your headset"));
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
if (system.face_tracker_supported() != xr::face_tracker_type::none)
|
||||
{
|
||||
ImGui::BeginDisabled(std::holds_alternative<std::monostate>(face_tracker));
|
||||
bool enabled = config.check_feature(feature::face_tracking);
|
||||
if (ImGui::Checkbox(_S("Enable face tracking"), &enabled))
|
||||
{
|
||||
config.set_feature(feature::face_tracking, enabled);
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) and (ImGui::GetItemFlags() & ImGuiItemFlags_Disabled))
|
||||
imgui_ctx->tooltip(_("This feature is not supported by your headset"));
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
}
|
||||
|
||||
auto body_tracker = system.body_tracker_supported();
|
||||
if (auto body_tracker = system.body_tracker_supported(); body_tracker != xr::body_tracker_type::none)
|
||||
{
|
||||
ImGui::BeginDisabled(body_tracker == xr::body_tracker_type::none);
|
||||
bool enabled = config.check_feature(feature::body_tracking);
|
||||
if (ImGui::Checkbox(_S("Enable body tracking"), &enabled))
|
||||
{
|
||||
config.set_feature(feature::body_tracking, enabled);
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled))
|
||||
{
|
||||
if (ImGui::GetItemFlags() & ImGuiItemFlags_Disabled)
|
||||
@@ -748,31 +863,32 @@ void scenes::lobby::gui_settings()
|
||||
}
|
||||
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
}
|
||||
if (body_tracker == xr::body_tracker_type::fb)
|
||||
{
|
||||
ImGui::BeginDisabled(not config.check_feature(feature::body_tracking));
|
||||
ImGui::Indent();
|
||||
if (ImGui::Checkbox(_S("Enable lower body tracking"), &config.fb_lower_body))
|
||||
{
|
||||
config.save();
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
if (ImGui::IsItemHovered())
|
||||
imgui_ctx->tooltip(_("Estimate lower body joint positions using Generative Legs\nRequires 'Hand and body tracking' to be enabled in the Quest movement tracking settings"));
|
||||
|
||||
ImGui::BeginDisabled(not config.fb_lower_body);
|
||||
if (ImGui::Checkbox(_S("Enable hip tracking"), &config.fb_hip))
|
||||
if (body_tracker == xr::body_tracker_type::fb)
|
||||
{
|
||||
config.save();
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
if (ImGui::IsItemHovered())
|
||||
imgui_ctx->tooltip(_("Only takes affect with lower body tracking enabled\nMay be desired when using another source of hip tracking"));
|
||||
ImGui::EndDisabled();
|
||||
ImGui::BeginDisabled(not config.check_feature(feature::body_tracking));
|
||||
ImGui::Indent();
|
||||
if (ImGui::Checkbox(_S("Enable lower body tracking"), &config.fb_lower_body))
|
||||
{
|
||||
config.save();
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
if (ImGui::IsItemHovered())
|
||||
imgui_ctx->tooltip(_("Estimate lower body joint positions using Generative Legs\nRequires 'Hand and body tracking' to be enabled in the Quest movement tracking settings"));
|
||||
|
||||
ImGui::Unindent();
|
||||
ImGui::EndDisabled();
|
||||
ImGui::BeginDisabled(not config.fb_lower_body);
|
||||
if (ImGui::Checkbox(_S("Enable hip tracking"), &config.fb_hip))
|
||||
{
|
||||
config.save();
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
if (ImGui::IsItemHovered())
|
||||
imgui_ctx->tooltip(_("Only takes affect with lower body tracking enabled\nMay be desired when using another source of hip tracking"));
|
||||
ImGui::EndDisabled();
|
||||
|
||||
ImGui::Unindent();
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
@@ -782,6 +898,13 @@ void scenes::lobby::gui_settings()
|
||||
imgui_ctx->tooltip(_("Enables the configuration window to be shown while the game is streaming.\nIf enabled, the window is activated by pressing both thumbsticks."));
|
||||
}
|
||||
|
||||
{
|
||||
ImGui::Checkbox(_S("Extended configuration values"), &config.extended_config);
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
if (ImGui::IsItemHovered())
|
||||
imgui_ctx->tooltip(_("Allows unsafe configuration values, use at your own risk."));
|
||||
}
|
||||
|
||||
ImGui::PopStyleVar(); // ImGuiStyleVar_ItemSpacing
|
||||
}
|
||||
|
||||
@@ -1081,7 +1204,7 @@ void scenes::lobby::gui_debug()
|
||||
void scenes::lobby::gui_about()
|
||||
{
|
||||
ImGui::PushFont(nullptr, constants::gui::font_size_large);
|
||||
CenterTextH(std::string("WiVRn ") + wivrn::git_version);
|
||||
CenterTextH(std::string("WiVRn ") + wivrn::display_version());
|
||||
ImGui::PopFont();
|
||||
|
||||
ImGui::Dummy(ImVec2(0, 60));
|
||||
@@ -1134,6 +1257,8 @@ void scenes::lobby::gui_first_run()
|
||||
CenterTextH(_("Welcome to WiVRn"));
|
||||
ImGui::PopFont();
|
||||
|
||||
config.set_feature(feature::hand_tracking, true);
|
||||
|
||||
while (optional_feature_index < optional_features.size() and
|
||||
(not optional_features[optional_feature_index].supported or
|
||||
config.check_feature(optional_features[optional_feature_index].f)))
|
||||
@@ -1145,6 +1270,8 @@ void scenes::lobby::gui_first_run()
|
||||
current_tab = tab::server_list;
|
||||
config.first_run = false;
|
||||
config.save();
|
||||
ImGui::PopStyleVar(); // ImGuiStyleVar_ItemSpacing
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 10);
|
||||
@@ -1411,6 +1538,7 @@ static const char * get_face_icon(XrTime predicted_display_time, xr::face_tracke
|
||||
const char * result = nullptr;
|
||||
std::visit(utils::overloaded{
|
||||
[](std::monostate &) {},
|
||||
[&](xr::android_face_tracker &) { result = ICON_FA_FACE_SMILE_WINK; },
|
||||
[&](xr::htc_face_tracker &) { result = ICON_FA_FACE_SMILE_WINK; },
|
||||
[&](auto & ft) {
|
||||
ft.get_weights(predicted_display_time, expression);
|
||||
@@ -1493,6 +1621,10 @@ void scenes::lobby::draw_features_status(XrTime predicted_display_time)
|
||||
.icon_disabled = ICON_FA_FACE_MEH_BLANK,
|
||||
});
|
||||
}
|
||||
else if (system.face_tracker_supported() != xr::face_tracker_type::none and config.check_feature(feature::face_tracking))
|
||||
{
|
||||
face_tracker = xr::make_face_tracker(instance, system, session);
|
||||
}
|
||||
|
||||
if (system.body_tracker_supported() != xr::body_tracker_type::none)
|
||||
{
|
||||
|
||||
@@ -26,12 +26,18 @@
|
||||
#include "imgui.h"
|
||||
#include "imgui_internal.h"
|
||||
#include "imspinner.h"
|
||||
#include "render/image_writer.h"
|
||||
#include "render/scene_renderer.h"
|
||||
#include "utils/files.h"
|
||||
#include "utils/i18n.h"
|
||||
#include "utils/json_string.h"
|
||||
#include "vk/allocation.h"
|
||||
#include <algorithm>
|
||||
#include <boost/url/url.hpp>
|
||||
#include <boost/url/url_view.hpp>
|
||||
#include <chrono>
|
||||
#include <spdlog/fmt/chrono.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include "IconsFontAwesome6.h"
|
||||
|
||||
@@ -53,8 +59,12 @@ void scenes::lobby::save_environment_json()
|
||||
<< ",\"description\":" << json_string(model.description)
|
||||
<< ",\"screenshot\":" << json_string(model.screenshot_url)
|
||||
<< ",\"url\":" << json_string(model.gltf_url)
|
||||
<< ",\"size\":" << model.size
|
||||
<< "},";
|
||||
<< ",\"size\":" << model.size;
|
||||
|
||||
// TODO only if not the default value
|
||||
ss << ",\"local_screenshot\":" << json_string(model.local_screenshot_path.string());
|
||||
ss << ",\"local_path\":" << json_string(model.local_gltf_path.string());
|
||||
ss << "},";
|
||||
}
|
||||
if (not empty)
|
||||
ss.seekp(-1, ss.cur);
|
||||
@@ -112,8 +122,16 @@ std::vector<scenes::lobby::environment_model> scenes::lobby::load_environment_js
|
||||
model.size = val.get_int64();
|
||||
|
||||
model.builtin = false;
|
||||
model.local_screenshot_path = application::get_config_path() / "environments" / (model.name + ".png");
|
||||
model.local_gltf_path = application::get_config_path() / "environments" / (model.name + ".glb");
|
||||
|
||||
if (auto val = i["local_screenshot"]; val.is_string())
|
||||
model.local_screenshot_path = val.get_string().value();
|
||||
else
|
||||
model.local_screenshot_path = application::get_config_path() / "environments" / (model.name + ".png");
|
||||
|
||||
if (auto val = i["local_path"]; val.is_string())
|
||||
model.local_gltf_path = val.get_string().value();
|
||||
else
|
||||
model.local_gltf_path = application::get_config_path() / "environments" / (model.name + ".glb");
|
||||
|
||||
models.push_back(std::move(model));
|
||||
}
|
||||
@@ -178,26 +196,108 @@ void scenes::lobby::update_file_picker()
|
||||
try
|
||||
{
|
||||
load_environment_status = "";
|
||||
file_picker_result picked_file = lobby_file_picker_future.get();
|
||||
|
||||
if (not picked_file)
|
||||
return;
|
||||
|
||||
future_environment = utils::async<std::pair<std::string, std::shared_ptr<entt::registry>>, float>(
|
||||
[this](auto token, file_picker_result environment) {
|
||||
auto local_path = application::get_cache_path() / "local.glb";
|
||||
[this, picked_file = std::move(picked_file)](auto token) {
|
||||
auto t = std::chrono::system_clock::now();
|
||||
auto local_path = application::get_cache_path() / fmt::format("local-{:%F-%T}.glb", t);
|
||||
auto local_screenshot_path = application::get_cache_path() / fmt::format("local-{:%F-%T}.png", t);
|
||||
|
||||
utils::write_whole_file(local_path, (std::span<const std::byte>)environment.file);
|
||||
utils::write_whole_file(local_path, (std::span<const std::byte>)picked_file.file);
|
||||
|
||||
// TODO remove only local.glb from cache
|
||||
clear_gltf_cache();
|
||||
environment_model model{
|
||||
.name = _S("Locally loaded environment"),
|
||||
.author = "",
|
||||
.description = "",
|
||||
.screenshot_url = "",
|
||||
.gltf_url = fmt::format("local-{:%F-%T}", t), // Used as key
|
||||
.size = picked_file.file.size(),
|
||||
.local_screenshot_path = local_screenshot_path,
|
||||
.local_gltf_path = local_path,
|
||||
};
|
||||
|
||||
return std::make_pair(
|
||||
local_path,
|
||||
load_gltf(local_path, [&](float progress) {
|
||||
token.set_progress(progress);
|
||||
}));
|
||||
},
|
||||
lobby_file_picker_future.get());
|
||||
int n = 2;
|
||||
while (std::ranges::find(local_environments, model.name, &environment_model::name) != local_environments.end())
|
||||
{
|
||||
model.name = fmt::format(_F("Locally loaded environment ({})"), n++);
|
||||
}
|
||||
|
||||
local_environments.push_back(model);
|
||||
std::ranges::sort(local_environments, std::less{});
|
||||
save_environment_json();
|
||||
|
||||
std::shared_ptr<entt::registry> env = load_gltf(local_path, [&](float progress) { token.set_progress(progress); });
|
||||
|
||||
// Create a screenshot of the loaded environment
|
||||
scene_renderer::frame_info frame{
|
||||
.projection = projection_matrix(
|
||||
XrFovf{
|
||||
.angleLeft = -0.7,
|
||||
.angleRight = 0.7,
|
||||
.angleUp = 0.7,
|
||||
.angleDown = -0.7,
|
||||
},
|
||||
constants::lobby::near_plane),
|
||||
.view = view_matrix(XrPosef{
|
||||
.orientation = {0, 0, 0, 1},
|
||||
.position = {0, 1.6, 0},
|
||||
})};
|
||||
|
||||
image_allocation output{
|
||||
device,
|
||||
vk::ImageCreateInfo{
|
||||
.imageType = vk::ImageType::e2D,
|
||||
.format = vk::Format::eR8G8B8A8Srgb,
|
||||
.extent = {512, 512, 1},
|
||||
.mipLevels = 1,
|
||||
.arrayLayers = 1,
|
||||
.usage = vk::ImageUsageFlagBits::eColorAttachment | vk::ImageUsageFlagBits::eTransferSrc,
|
||||
},
|
||||
VmaAllocationCreateInfo{
|
||||
.usage = VmaMemoryUsage::VMA_MEMORY_USAGE_AUTO,
|
||||
},
|
||||
"Screenshot image",
|
||||
};
|
||||
|
||||
scene_renderer local_renderer{device, physical_device, queue, queue_family_index};
|
||||
local_renderer.start_frame();
|
||||
local_renderer.render(
|
||||
*env,
|
||||
{
|
||||
constants::lobby::sky_color.r,
|
||||
constants::lobby::sky_color.g,
|
||||
constants::lobby::sky_color.b,
|
||||
constants::lobby::sky_color.a,
|
||||
},
|
||||
layer_lobby,
|
||||
vk::Extent2D{
|
||||
output.info().extent.width,
|
||||
output.info().extent.height,
|
||||
|
||||
}, // Output size
|
||||
output.info().format, // Output format
|
||||
vk::Format::eD32Sfloat, // Depth format
|
||||
output, // Output image
|
||||
vk::Image{}, // Depth image
|
||||
vk::Image{}, // Foveation image
|
||||
{&frame, 1}, // View info
|
||||
false);
|
||||
local_renderer.end_frame();
|
||||
local_renderer.wait_idle(); // TODO get a semaphore from end_frame instead
|
||||
|
||||
write_image(device, queue, queue_family_index, local_screenshot_path, output);
|
||||
|
||||
return std::make_pair(local_path, env);
|
||||
});
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
spdlog::warn("Cannot load local environment: {}", e.what());
|
||||
load_environment_status = fmt::format(_F("Cannot load local environment: {}"), e.what());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,8 +329,8 @@ void scenes::lobby::download_environment_list()
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
spdlog::error("Cannot load custom environments: {}", e.what());
|
||||
downloadable_environment_list_status = fmt::format("Cannot load custom environments: {}", e.what());
|
||||
spdlog::error("Cannot load environment list: {}", e.what());
|
||||
downloadable_environment_list_status = fmt::format(_F("Cannot load environment list: {}"), e.what());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -549,7 +649,7 @@ void scenes::lobby::environment_list(std::vector<environment_model> & models, bo
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, constants::style::window_border_size);
|
||||
if (ImGui::BeginPopupModal("confirm delete model", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize))
|
||||
{
|
||||
ImGui::Text(_S("Really delete %s?"), environment_to_be_deleted->name.c_str());
|
||||
ImGui::Text("%s", fmt::format(_F("Really delete {}?"), environment_to_be_deleted->name).c_str());
|
||||
|
||||
const auto & style = ImGui::GetStyle();
|
||||
auto cancel_text = _("Cancel");
|
||||
|
||||
+171
-120
@@ -153,9 +153,11 @@ static const std::array supported_depth_formats{
|
||||
|
||||
scenes::stream::stream(std::string server_name, scene & parent_scene) :
|
||||
scene_impl<stream>(supported_color_formats, supported_depth_formats, parent_scene),
|
||||
apps{*this, std::move(server_name)},
|
||||
blitters{blitter(device, 0), blitter(device, 1)}
|
||||
apps{*this, std::move(server_name)}
|
||||
{
|
||||
auto views = system.view_configuration_views(viewconfig);
|
||||
width = views[0].recommendedImageRectWidth;
|
||||
height = views[0].recommendedImageRectHeight;
|
||||
}
|
||||
|
||||
static from_headset::visibility_mask_changed::masks get_visibility_mask(xr::instance & inst, xr::session & session, int view)
|
||||
@@ -198,31 +200,34 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
||||
.variant = application::get_messages_info().variant,
|
||||
};
|
||||
|
||||
auto view = self->system.view_configuration_views(self->viewconfig)[0];
|
||||
view = override_view(view, guess_model());
|
||||
|
||||
auto resolution_scale = application::get_config().resolution_scale;
|
||||
|
||||
view.recommendedImageRectWidth *= resolution_scale;
|
||||
view.recommendedImageRectHeight *= resolution_scale;
|
||||
|
||||
info.recommended_eye_width = view.recommendedImageRectWidth;
|
||||
info.recommended_eye_height = view.recommendedImageRectHeight;
|
||||
|
||||
auto [flags, views] = self->session.locate_views(
|
||||
XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO,
|
||||
self->instance.now(),
|
||||
application::space(xr::spaces::view));
|
||||
|
||||
assert(views.size() == info.fov.size());
|
||||
|
||||
for (auto [i, j]: std::views::zip(views, info.fov))
|
||||
{
|
||||
j = i.fov;
|
||||
auto [flags, views] = self->session.locate_views(
|
||||
XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO,
|
||||
self->instance.now(),
|
||||
application::space(xr::spaces::view));
|
||||
|
||||
assert(views.size() == info.fov.size());
|
||||
|
||||
for (auto [i, j]: std::views::zip(views, info.fov))
|
||||
j = i.fov;
|
||||
}
|
||||
|
||||
const auto & config = application::get_config();
|
||||
|
||||
{
|
||||
auto view = self->system.view_configuration_views(self->viewconfig)[0];
|
||||
view = override_view(view, guess_model());
|
||||
|
||||
info.render_eye_width = view.recommendedImageRectWidth * config.resolution_scale;
|
||||
info.render_eye_height = view.recommendedImageRectHeight * config.resolution_scale;
|
||||
}
|
||||
|
||||
{
|
||||
auto scale = config.get_stream_scale();
|
||||
info.stream_eye_width = info.render_eye_width * scale;
|
||||
info.stream_eye_height = info.render_eye_height * scale;
|
||||
}
|
||||
|
||||
if (self->instance.has_extension(XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME))
|
||||
{
|
||||
info.available_refresh_rates = self->session.get_refresh_rates();
|
||||
@@ -231,17 +236,13 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
||||
{
|
||||
if (config.preferred_refresh_rate and (config.preferred_refresh_rate == 0 or utils::contains(info.available_refresh_rates, *config.preferred_refresh_rate)))
|
||||
{
|
||||
info.preferred_refresh_rate = *config.preferred_refresh_rate;
|
||||
if (info.preferred_refresh_rate == 0)
|
||||
info.available_refresh_rates = {
|
||||
std::ranges::lower_bound(info.available_refresh_rates, config.minimum_refresh_rate),
|
||||
info.available_refresh_rates.end(),
|
||||
};
|
||||
info.settings.preferred_refresh_rate = *config.preferred_refresh_rate;
|
||||
info.settings.minimum_refresh_rate = config.minimum_refresh_rate.value_or(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Default to highest refresh rate
|
||||
info.preferred_refresh_rate = info.available_refresh_rates.back();
|
||||
info.settings.preferred_refresh_rate = info.available_refresh_rates.back();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -250,9 +251,11 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
||||
{
|
||||
spdlog::warn("Unable to detect refresh rates");
|
||||
info.available_refresh_rates = {guessed_fps};
|
||||
info.preferred_refresh_rate = guessed_fps;
|
||||
info.settings.preferred_refresh_rate = guessed_fps;
|
||||
}
|
||||
|
||||
info.settings.bitrate_bps = config.bitrate_bps;
|
||||
|
||||
info.hand_tracking = config.check_feature(feature::hand_tracking);
|
||||
info.eye_gaze = config.check_feature(feature::eye_gaze);
|
||||
|
||||
@@ -263,6 +266,9 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
||||
case xr::face_tracker_type::none:
|
||||
info.face_tracking = from_headset::face_type::none;
|
||||
break;
|
||||
case xr::face_tracker_type::android:
|
||||
info.face_tracking = from_headset::face_type::android;
|
||||
break;
|
||||
case xr::face_tracker_type::fb:
|
||||
case xr::face_tracker_type::pico:
|
||||
info.face_tracking = from_headset::face_type::fb2;
|
||||
@@ -300,10 +306,29 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
||||
if (not(config.check_feature(feature::microphone)))
|
||||
info.microphone = {};
|
||||
|
||||
info.supported_codecs = decoder::supported_codecs();
|
||||
if (config.codec)
|
||||
{
|
||||
info.supported_codecs = {*config.codec};
|
||||
switch (*config.codec)
|
||||
{
|
||||
case h264:
|
||||
case raw:
|
||||
break;
|
||||
case h265:
|
||||
case av1:
|
||||
info.bit_depth = config.bit_depth;
|
||||
}
|
||||
}
|
||||
else
|
||||
info.supported_codecs = decoder::supported_codecs();
|
||||
|
||||
return info;
|
||||
}());
|
||||
|
||||
self->network_session->send_control(from_headset::session_state_changed{
|
||||
.state = application::get_session_state(),
|
||||
});
|
||||
|
||||
if (self->instance.has_extension(XR_KHR_VISIBILITY_MASK_EXTENSION_NAME))
|
||||
{
|
||||
for (uint8_t view = 0; view < view_count; ++view)
|
||||
@@ -398,11 +423,6 @@ void scenes::stream::on_focused()
|
||||
{
|
||||
gui_status_last_change = instance.now();
|
||||
|
||||
auto views = system.view_configuration_views(viewconfig);
|
||||
// stream_view = override_view(views[0], guess_model());
|
||||
width = views[0].recommendedImageRectWidth;
|
||||
height = views[0].recommendedImageRectHeight;
|
||||
|
||||
std::string profile = controller_name();
|
||||
input.emplace(
|
||||
*this,
|
||||
@@ -478,16 +498,24 @@ void scenes::stream::on_focused()
|
||||
}
|
||||
recenter_left = get_action("recenter_left").first;
|
||||
recenter_right = get_action("recenter_right").first;
|
||||
foveation_pitch = get_action("foveation_pitch").first;
|
||||
settings_adjust = get_action("settings_adjust").first;
|
||||
foveation_distance = get_action("foveation_distance").first;
|
||||
foveation_ok = get_action("foveation_ok").first;
|
||||
foveation_cancel = get_action("foveation_cancel").first;
|
||||
|
||||
assert(video_stream_description);
|
||||
std::unique_lock lock(decoder_mutex);
|
||||
setup_reprojection_swapchain(
|
||||
video_stream_description->defoveated_width / view_count,
|
||||
video_stream_description->defoveated_height);
|
||||
|
||||
if (application::get_config().high_power_mode)
|
||||
{
|
||||
session.set_performance_level(XR_PERF_SETTINGS_DOMAIN_CPU_EXT, XR_PERF_SETTINGS_LEVEL_SUSTAINED_HIGH_EXT);
|
||||
session.set_performance_level(XR_PERF_SETTINGS_DOMAIN_GPU_EXT, XR_PERF_SETTINGS_LEVEL_SUSTAINED_HIGH_EXT);
|
||||
}
|
||||
else
|
||||
{
|
||||
session.set_performance_level(XR_PERF_SETTINGS_DOMAIN_CPU_EXT, XR_PERF_SETTINGS_LEVEL_SUSTAINED_LOW_EXT);
|
||||
session.set_performance_level(XR_PERF_SETTINGS_DOMAIN_GPU_EXT, XR_PERF_SETTINGS_LEVEL_SUSTAINED_LOW_EXT);
|
||||
}
|
||||
}
|
||||
|
||||
void scenes::stream::on_unfocused()
|
||||
@@ -531,9 +559,7 @@ void scenes::stream::push_blit_handle(shard_accumulator * decoder, std::shared_p
|
||||
std::swap(handle, decoders[stream].latest_frames[handle->feedback.frame_index % decoders[stream].latest_frames.size()]);
|
||||
}
|
||||
|
||||
if (state_ != state::streaming and std::ranges::all_of(decoders, [](accumulator_images & i) {
|
||||
return i.alpha() or not i.empty();
|
||||
}))
|
||||
if (state_ != state::streaming and not(decoders[0].empty() and decoders[1].empty()))
|
||||
{
|
||||
state_ = state::streaming;
|
||||
spdlog::info("Stream scene ready at t={}", instance.now());
|
||||
@@ -546,11 +572,6 @@ void scenes::stream::push_blit_handle(shard_accumulator * decoder, std::shared_p
|
||||
}
|
||||
}
|
||||
|
||||
bool scenes::stream::accumulator_images::alpha() const
|
||||
{
|
||||
return decoder->desc().channels == wivrn::to_headset::video_stream_description::channels_t::alpha;
|
||||
}
|
||||
|
||||
bool scenes::stream::accumulator_images::empty() const
|
||||
{
|
||||
for (const auto & frame: latest_frames)
|
||||
@@ -561,7 +582,7 @@ bool scenes::stream::accumulator_images::empty() const
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<shard_accumulator::blit_handle>> scenes::stream::common_frame(XrTime display_time)
|
||||
std::array<std::shared_ptr<shard_accumulator::blit_handle>, 3> scenes::stream::common_frame(XrTime display_time)
|
||||
{
|
||||
if (decoders.empty())
|
||||
return {};
|
||||
@@ -569,10 +590,8 @@ std::vector<std::shared_ptr<shard_accumulator::blit_handle>> scenes::stream::com
|
||||
thread_local std::vector<shard_accumulator::blit_handle *> common_frames;
|
||||
common_frames.clear();
|
||||
const bool alpha = decoders[0].latest_frames[0] and decoders[0].latest_frames[0]->view_info.alpha;
|
||||
for (size_t i = 0; i < decoders.size(); ++i)
|
||||
for (size_t i = 0; i < view_count + alpha; ++i)
|
||||
{
|
||||
if (decoders[i].alpha() and not alpha)
|
||||
continue;
|
||||
if (i == 0)
|
||||
{
|
||||
for (const auto & h: decoders[i].latest_frames)
|
||||
@@ -595,8 +614,7 @@ std::vector<std::shared_ptr<shard_accumulator::blit_handle>> scenes::stream::com
|
||||
// clang-format on
|
||||
}
|
||||
}
|
||||
std::vector<std::shared_ptr<shard_accumulator::blit_handle>> result;
|
||||
result.reserve(decoders.size());
|
||||
std::array<std::shared_ptr<shard_accumulator::blit_handle>, view_count + 1> result;
|
||||
if (not common_frames.empty())
|
||||
{
|
||||
auto min = std::ranges::min_element(common_frames,
|
||||
@@ -609,12 +627,10 @@ std::vector<std::shared_ptr<shard_accumulator::blit_handle>> scenes::stream::com
|
||||
|
||||
assert(*min);
|
||||
auto frame_index = (*min)->feedback.frame_index;
|
||||
for (const auto & decoder: decoders)
|
||||
for (auto [i, decoder]: utils::enumerate(decoders))
|
||||
{
|
||||
if (alpha or not decoder.alpha())
|
||||
result.emplace_back(decoder.frame(frame_index));
|
||||
else
|
||||
result.emplace_back(nullptr);
|
||||
if (alpha or i < view_count)
|
||||
result[i] = decoder.frame(frame_index);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -633,9 +649,9 @@ std::vector<std::shared_ptr<shard_accumulator::blit_handle>> scenes::stream::com
|
||||
spdlog::warn(frames);
|
||||
}
|
||||
|
||||
for (const auto & decoder: decoders)
|
||||
for (auto [i, decoder]: utils::enumerate(decoders))
|
||||
{
|
||||
if (alpha or not decoder.alpha())
|
||||
if (alpha or i < view_count)
|
||||
{
|
||||
auto min = std::ranges::min_element(decoder.latest_frames,
|
||||
std::ranges::less{},
|
||||
@@ -644,10 +660,8 @@ std::vector<std::shared_ptr<shard_accumulator::blit_handle>> scenes::stream::com
|
||||
return std::numeric_limits<XrTime>::max();
|
||||
return std::abs(frame->view_info.display_time - display_time);
|
||||
});
|
||||
result.emplace_back(*min);
|
||||
result[i] = *min;
|
||||
}
|
||||
else
|
||||
result.emplace_back(nullptr);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -727,6 +741,7 @@ bool scenes::stream::is_gui_interactable() const
|
||||
{
|
||||
case gui_status::stats:
|
||||
case gui_status::settings:
|
||||
case gui_status::bitrate_settings:
|
||||
case gui_status::foveation_settings:
|
||||
case gui_status::applications:
|
||||
case gui_status::application_launcher:
|
||||
@@ -753,19 +768,11 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
last_display_time = frame_state.predictedDisplayTime;
|
||||
|
||||
std::shared_lock lock(decoder_mutex);
|
||||
if (decoders.empty() or not frame_state.shouldRender)
|
||||
if (not frame_state.shouldRender or (decoders[0].empty() and decoders[1].empty()))
|
||||
{
|
||||
// TODO: stop/restart video stream
|
||||
session.begin_frame();
|
||||
session.end_frame(frame_state.predictedDisplayTime, {});
|
||||
|
||||
std::unique_lock lock(frames_mutex);
|
||||
for (auto & i: decoders)
|
||||
{
|
||||
for (auto & frame: i.latest_frames)
|
||||
frame.reset();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -781,14 +788,13 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
application::pop_scene();
|
||||
}
|
||||
|
||||
assert(swapchain);
|
||||
if (device.waitForFences(*fence, VK_TRUE, UINT64_MAX) == vk::Result::eTimeout)
|
||||
throw std::runtime_error("Vulkan fence timeout");
|
||||
|
||||
device.resetFences(*fence);
|
||||
|
||||
// We don't need those after vkWaitForFences
|
||||
current_blit_handles.clear();
|
||||
current_blit_handles.fill(nullptr);
|
||||
|
||||
gpu_timestamps timestamps;
|
||||
if (query_pool_filled)
|
||||
@@ -828,13 +834,15 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
// Search for frame with desired display time on all decoders
|
||||
// If no such frame exists, use the latest frame for each decoder
|
||||
current_blit_handles = common_frame(frame_state.predictedDisplayTime);
|
||||
std::array<XrPosef, 2> pose{};
|
||||
std::array<XrFovf, 2> fov{};
|
||||
std::array<wivrn::to_headset::foveation_parameter, 2> foveation{};
|
||||
std::array<XrPosef, view_count> pose;
|
||||
std::array<XrFovf, view_count> fov;
|
||||
std::array<wivrn::to_headset::foveation_parameter, view_count> foveation;
|
||||
bool use_alpha = false;
|
||||
|
||||
for (auto & blit_handle: current_blit_handles)
|
||||
std::array<stream_defoveator::input, view_count> images;
|
||||
for (size_t i = 0; i < view_count + use_alpha; ++i)
|
||||
{
|
||||
auto & blit_handle = current_blit_handles[i];
|
||||
if (not blit_handle)
|
||||
continue;
|
||||
|
||||
@@ -844,9 +852,6 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
++blit_handle->feedback.times_displayed;
|
||||
blit_handle->feedback.displayed = frame_state.predictedDisplayTime;
|
||||
|
||||
pose = blit_handle->view_info.pose;
|
||||
fov = blit_handle->view_info.fov;
|
||||
foveation = blit_handle->view_info.foveation;
|
||||
use_alpha = blit_handle->view_info.alpha;
|
||||
|
||||
if (blit_handle->current_layout == vk::ImageLayout::eUndefined)
|
||||
@@ -867,24 +872,44 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
command_buffer.pipelineBarrier(vk::PipelineStageFlagBits::eAllCommands, vk::PipelineStageFlagBits::eAllCommands, {}, {}, {}, barrier);
|
||||
blit_handle->current_layout = vk::ImageLayout::eGeneral;
|
||||
}
|
||||
}
|
||||
|
||||
// Blit images from the decoders
|
||||
std::array<blitter::output, view_count> blitted;
|
||||
for (auto [i, b]: utils::enumerate(blitters))
|
||||
{
|
||||
b.begin(command_buffer);
|
||||
for (auto [j, blit_handle]: utils::enumerate(current_blit_handles))
|
||||
if (i < view_count)
|
||||
{
|
||||
if (not blit_handle)
|
||||
continue;
|
||||
b.push_image(command_buffer, j, decoders[j].decoder->sampler(), decoders[j].decoder->extent(), blit_handle->image_view, blit_handle->current_layout);
|
||||
foveation[i] = blit_handle->view_info.foveation[i];
|
||||
pose[i] = blit_handle->view_info.pose[i];
|
||||
fov[i] = blit_handle->view_info.fov[i];
|
||||
// colour image
|
||||
images[i] = {
|
||||
.rgb = blit_handle->image_view,
|
||||
.sampler_rgb = decoders[i].decoder->sampler(),
|
||||
.rect_rgb = {
|
||||
.extent = blit_handle->extent,
|
||||
},
|
||||
.layout_rgb = blit_handle->current_layout,
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
// alpha image, must set for each view
|
||||
for (int j = 0; j < view_count; ++j)
|
||||
{
|
||||
images[j].a = blit_handle->image_view;
|
||||
images[j].sampler_a = decoders[i].decoder->sampler();
|
||||
images[j].rect_a = vk::Rect2D{
|
||||
// in full size pixels
|
||||
.offset = {
|
||||
.x = j * video_stream_description->width,
|
||||
},
|
||||
.extent = {
|
||||
.width = blit_handle->extent.width * 2,
|
||||
.height = blit_handle->extent.height * 2,
|
||||
},
|
||||
};
|
||||
images[j].layout_a = blit_handle->current_layout;
|
||||
}
|
||||
}
|
||||
blitted[i] = b.end(command_buffer);
|
||||
}
|
||||
|
||||
command_buffer.writeTimestamp(vk::PipelineStageFlagBits::eBottomOfPipe, *query_pool, 1);
|
||||
|
||||
XrExtent2Di extents[view_count];
|
||||
{
|
||||
int32_t max_width = 0;
|
||||
@@ -895,9 +920,11 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
max_width = std::max(max_width, extents[i].width);
|
||||
max_height = std::max(max_height, extents[i].height);
|
||||
}
|
||||
// If the defoveated image is larger than the swapchain, try to reallocate one
|
||||
if (swapchain.width() < max_width or swapchain.height() < max_height)
|
||||
if (not swapchain)
|
||||
setup_reprojection_swapchain(max_width, max_height);
|
||||
else if (swapchain.width() < max_width or swapchain.height() < max_height)
|
||||
{
|
||||
// If the defoveated image is larger than the swapchain, try to reallocate one
|
||||
try
|
||||
{
|
||||
spdlog::info("Recreating swapchain, from {}x{} to {}x{}",
|
||||
@@ -918,12 +945,13 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(swapchain);
|
||||
// defoveate the image
|
||||
int image_index = swapchain.acquire();
|
||||
swapchain.wait();
|
||||
defoveator->defoveate(command_buffer, foveation, blitted, image_index);
|
||||
defoveator->defoveate(command_buffer, foveation, images, image_index);
|
||||
|
||||
command_buffer.writeTimestamp(vk::PipelineStageFlagBits::eBottomOfPipe, *query_pool, 2);
|
||||
command_buffer.writeTimestamp(vk::PipelineStageFlagBits::eBottomOfPipe, *query_pool, 1);
|
||||
|
||||
command_buffer.end();
|
||||
vk::SubmitInfo submit_info;
|
||||
@@ -994,6 +1022,7 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
switch (gui_status)
|
||||
{
|
||||
case gui_status::hidden:
|
||||
case gui_status::bitrate_settings:
|
||||
case gui_status::foveation_settings:
|
||||
case gui_status::compact:
|
||||
case gui_status::overlay_only:
|
||||
@@ -1093,6 +1122,7 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
|
||||
case gui_status::stats:
|
||||
case gui_status::settings:
|
||||
case gui_status::bitrate_settings:
|
||||
case gui_status::foveation_settings:
|
||||
case gui_status::applications:
|
||||
case gui_status::application_launcher:
|
||||
@@ -1114,37 +1144,25 @@ void scenes::stream::setup(const to_headset::video_stream_description & descript
|
||||
{
|
||||
session.set_refresh_rate(description.fps);
|
||||
|
||||
spdlog::info("Creating decoders, size {}x{}", description.width, description.height);
|
||||
std::unique_lock lock(decoder_mutex);
|
||||
decoders.clear();
|
||||
|
||||
if (description.items.empty())
|
||||
{
|
||||
spdlog::info("Stopping video stream");
|
||||
return;
|
||||
}
|
||||
|
||||
video_stream_description = description;
|
||||
for (auto & b: blitters)
|
||||
b.reset(description);
|
||||
|
||||
for (const auto & [stream_index, item]: utils::enumerate(description.items))
|
||||
for (const auto & [stream_index, item]: utils::enumerate(decoders))
|
||||
{
|
||||
spdlog::info("Creating decoder size {}x{} offset {},{}", item.width, item.height, item.offset_x, item.offset_y);
|
||||
|
||||
decoders.push_back(accumulator_images{
|
||||
.decoder = std::make_unique<shard_accumulator>(device, physical_device, instance, queue_family_index, item, description.fps, shared_from_this(), stream_index),
|
||||
});
|
||||
item = accumulator_images{
|
||||
.decoder = std::make_unique<shard_accumulator>(device, physical_device, instance, queue_family_index, description, shared_from_this(), stream_index),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void scenes::stream::setup_reprojection_swapchain(uint32_t swapchain_width, uint32_t swapchain_height)
|
||||
{
|
||||
assert(swapchain_width);
|
||||
assert(swapchain_height);
|
||||
device.waitIdle();
|
||||
session.set_refresh_rate(video_stream_description->fps);
|
||||
|
||||
const uint32_t video_width = video_stream_description->width / view_count;
|
||||
const uint32_t video_height = video_stream_description->height;
|
||||
|
||||
auto views = system.view_configuration_views(viewconfig);
|
||||
|
||||
swapchain = xr::swapchain(instance, session, device, swapchain_format, swapchain_width, swapchain_height, 1, views.size());
|
||||
@@ -1191,7 +1209,7 @@ scene::meta & scenes::stream::get_meta_scene()
|
||||
{"recenter_left", XR_ACTION_TYPE_BOOLEAN_INPUT},
|
||||
{"recenter_right", XR_ACTION_TYPE_BOOLEAN_INPUT},
|
||||
|
||||
{"foveation_pitch", XR_ACTION_TYPE_FLOAT_INPUT},
|
||||
{"settings_adjust", XR_ACTION_TYPE_FLOAT_INPUT},
|
||||
{"foveation_distance", XR_ACTION_TYPE_FLOAT_INPUT},
|
||||
{"foveation_ok", XR_ACTION_TYPE_BOOLEAN_INPUT},
|
||||
{"foveation_cancel", XR_ACTION_TYPE_BOOLEAN_INPUT},
|
||||
@@ -1223,7 +1241,7 @@ scene::meta & scenes::stream::get_meta_scene()
|
||||
|
||||
{"recenter_left", "/user/hand/left/input/squeeze/value"},
|
||||
{"recenter_right", "/user/hand/right/input/squeeze/value"},
|
||||
{"foveation_pitch", "/user/hand/right/input/thumbstick/y"},
|
||||
{"settings_adjust", "/user/hand/right/input/thumbstick/y"},
|
||||
{"foveation_distance", "/user/hand/left/input/thumbstick/y"},
|
||||
{"foveation_ok", "/user/hand/right/input/a/click"},
|
||||
{"foveation_cancel", "/user/hand/right/input/b/click"},
|
||||
@@ -1287,3 +1305,36 @@ void scenes::stream::on_xr_event(const xr::event & event)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool scenes::stream::forward_hid_input(from_headset::hid::input_t packet)
|
||||
{
|
||||
if (not hid_forwarding)
|
||||
return false;
|
||||
network_session->send_control(from_headset::hid::input{packet});
|
||||
return true;
|
||||
}
|
||||
|
||||
bool scenes::stream::on_input_key_down(uint8_t key_code)
|
||||
{
|
||||
return forward_hid_input(from_headset::hid::key_down{key_code});
|
||||
}
|
||||
bool scenes::stream::on_input_key_up(uint8_t key_code)
|
||||
{
|
||||
return forward_hid_input(from_headset::hid::key_up{key_code});
|
||||
}
|
||||
bool scenes::stream::on_input_mouse_move(float x, float y)
|
||||
{
|
||||
return forward_hid_input(from_headset::hid::mouse_move{x, y});
|
||||
}
|
||||
bool scenes::stream::on_input_button_down(uint8_t button)
|
||||
{
|
||||
return forward_hid_input(from_headset::hid::button_down{button});
|
||||
}
|
||||
bool scenes::stream::on_input_button_up(uint8_t button)
|
||||
{
|
||||
return forward_hid_input(from_headset::hid::button_up{button});
|
||||
}
|
||||
bool scenes::stream::on_input_scroll(float h, float v)
|
||||
{
|
||||
return forward_hid_input(from_headset::hid::mouse_scroll{h, v});
|
||||
}
|
||||
|
||||
+21
-17
@@ -24,7 +24,6 @@
|
||||
#include "decoder/shard_accumulator.h"
|
||||
#include "render/imgui_impl.h"
|
||||
#include "scene.h"
|
||||
#include "scenes/blitter.h"
|
||||
#include "scenes/input_profile.h"
|
||||
#include "stream_defoveator.h"
|
||||
#include "utils/thread_safe.h"
|
||||
@@ -55,8 +54,6 @@ public:
|
||||
private:
|
||||
static const size_t view_count = 2;
|
||||
|
||||
using stream_description = wivrn::to_headset::video_stream_description::item;
|
||||
|
||||
struct accumulator_images
|
||||
{
|
||||
std::unique_ptr<wivrn::shard_accumulator> decoder;
|
||||
@@ -64,7 +61,6 @@ private:
|
||||
std::array<std::shared_ptr<wivrn::shard_accumulator::blit_handle>, image_buffer_size> latest_frames;
|
||||
|
||||
std::shared_ptr<wivrn::shard_accumulator::blit_handle> frame(uint64_t id) const;
|
||||
bool alpha() const;
|
||||
bool empty() const;
|
||||
};
|
||||
|
||||
@@ -72,7 +68,7 @@ private:
|
||||
|
||||
// for frames inside accumulator images
|
||||
std::mutex frames_mutex;
|
||||
std::vector<std::shared_ptr<wivrn::shard_accumulator::blit_handle>> common_frame(XrTime display_time);
|
||||
std::array<std::shared_ptr<wivrn::shard_accumulator::blit_handle>, view_count + 1> common_frame(XrTime display_time);
|
||||
|
||||
std::unique_ptr<wivrn_session> network_session;
|
||||
std::atomic<bool> exiting = false;
|
||||
@@ -81,6 +77,7 @@ private:
|
||||
std::array<std::atomic<interaction_profile>, 2> interaction_profiles; // left and right hand
|
||||
std::atomic<bool> interaction_profile_changed = false;
|
||||
std::atomic<bool> recenter_requested = false;
|
||||
std::atomic<bool> hid_forwarding = false;
|
||||
std::atomic<XrDuration> display_time_phase = 0;
|
||||
std::atomic<XrDuration> display_time_period = 0;
|
||||
XrTime last_display_time = 0;
|
||||
@@ -89,9 +86,7 @@ private:
|
||||
|
||||
std::shared_mutex decoder_mutex;
|
||||
std::optional<to_headset::video_stream_description> video_stream_description;
|
||||
std::vector<accumulator_images> decoders; // Locked by decoder_mutex
|
||||
|
||||
std::array<blitter, view_count> blitters;
|
||||
std::array<accumulator_images, view_count + 1> decoders; // Locked by decoder_mutex
|
||||
|
||||
std::optional<stream_defoveator> defoveator;
|
||||
|
||||
@@ -131,6 +126,7 @@ private:
|
||||
compact,
|
||||
stats,
|
||||
settings,
|
||||
bitrate_settings,
|
||||
foveation_settings,
|
||||
applications,
|
||||
application_launcher,
|
||||
@@ -140,7 +136,7 @@ private:
|
||||
|
||||
std::atomic<gui_status> gui_status = gui_status::hidden;
|
||||
enum gui_status last_gui_status = gui_status::hidden;
|
||||
enum gui_status next_gui_status = gui_status::stats;
|
||||
enum gui_status next_gui_status = gui_status::applications;
|
||||
XrTime gui_status_last_change;
|
||||
float dimming = 0;
|
||||
|
||||
@@ -148,7 +144,7 @@ private:
|
||||
XrAction plots_toggle_2 = XR_NULL_HANDLE;
|
||||
XrAction recenter_left = XR_NULL_HANDLE;
|
||||
XrAction recenter_right = XR_NULL_HANDLE;
|
||||
XrAction foveation_pitch = XR_NULL_HANDLE;
|
||||
XrAction settings_adjust = XR_NULL_HANDLE;
|
||||
XrAction foveation_distance = XR_NULL_HANDLE;
|
||||
XrAction foveation_ok = XR_NULL_HANDLE;
|
||||
XrAction foveation_cancel = XR_NULL_HANDLE;
|
||||
@@ -166,13 +162,15 @@ private:
|
||||
void update_gui_position(xr::spaces controller);
|
||||
|
||||
// Keep a reference to the resources needed to blit the images until vkWaitForFences
|
||||
std::vector<std::shared_ptr<wivrn::shard_accumulator::blit_handle>> current_blit_handles;
|
||||
std::array<std::shared_ptr<wivrn::shard_accumulator::blit_handle>, view_count + 1> current_blit_handles;
|
||||
|
||||
XrTime running_application_req = 0;
|
||||
thread_safe<to_headset::running_applications> running_applications;
|
||||
|
||||
stream(std::string server_name, scene & parent_scene);
|
||||
|
||||
bool forward_hid_input(from_headset::hid::input_t);
|
||||
|
||||
public:
|
||||
~stream();
|
||||
|
||||
@@ -187,6 +185,13 @@ public:
|
||||
void on_unfocused() override;
|
||||
void on_xr_event(const xr::event &) override;
|
||||
|
||||
bool on_input_key_down(uint8_t key_code) override;
|
||||
bool on_input_key_up(uint8_t key_code) override;
|
||||
bool on_input_mouse_move(float x, float y) override;
|
||||
bool on_input_button_down(uint8_t button) override;
|
||||
bool on_input_button_up(uint8_t button) override;
|
||||
bool on_input_scroll(float h, float v) override;
|
||||
|
||||
void operator()(to_headset::crypto_handshake &&) {};
|
||||
void operator()(to_headset::pin_check_2 &&) {};
|
||||
void operator()(to_headset::pin_check_4 &&) {};
|
||||
@@ -243,13 +248,11 @@ private:
|
||||
|
||||
struct gpu_timestamps
|
||||
{
|
||||
float gpu_barrier = 0;
|
||||
float gpu_time = 0;
|
||||
};
|
||||
|
||||
struct global_metric //: gpu_timestamps
|
||||
struct global_metric
|
||||
{
|
||||
float gpu_barrier;
|
||||
float gpu_time;
|
||||
float cpu_time = 0;
|
||||
float bandwidth_rx = 0;
|
||||
@@ -262,7 +265,7 @@ private:
|
||||
struct subplot
|
||||
{
|
||||
std::string title;
|
||||
float scenes::stream::global_metric::*data;
|
||||
float scenes::stream::global_metric::* data;
|
||||
};
|
||||
std::vector<subplot> subplots;
|
||||
const char * unit;
|
||||
@@ -298,10 +301,11 @@ private:
|
||||
float compact_cpu_time = 0;
|
||||
float compact_gpu_time = 0;
|
||||
|
||||
void accumulate_metrics(XrTime predicted_display_time, const std::vector<std::shared_ptr<wivrn::shard_accumulator::blit_handle>> & blit_handles, const gpu_timestamps & timestamps);
|
||||
void accumulate_metrics(XrTime predicted_display_time, const std::array<std::shared_ptr<wivrn::shard_accumulator::blit_handle>, view_count + 1> & blit_handles, const gpu_timestamps & timestamps);
|
||||
void gui_performance_metrics();
|
||||
void gui_compact_view();
|
||||
void gui_settings();
|
||||
void gui_settings(float predicted_display_period);
|
||||
void gui_bitrate_settings(float predicted_display_period);
|
||||
void gui_foveation_settings(float predicted_display_period);
|
||||
void gui_applications();
|
||||
void draw_gui(XrTime predicted_display_time, XrDuration predicted_display_period);
|
||||
|
||||
@@ -295,7 +295,7 @@ static size_t required_vertices(const wivrn::to_headset::foveation_parameter & p
|
||||
|
||||
void stream_defoveator::defoveate(vk::raii::CommandBuffer & command_buffer,
|
||||
const std::array<wivrn::to_headset::foveation_parameter, 2> & foveation,
|
||||
std::span<wivrn::blitter::output> inputs,
|
||||
const std::array<input, 2> & inputs,
|
||||
int destination)
|
||||
{
|
||||
if (destination < 0 || destination >= (int)output_images.size())
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "blitter.h"
|
||||
#include "vk/allocation.h"
|
||||
#include "wivrn_packets.h"
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
@@ -61,6 +60,18 @@ class stream_defoveator
|
||||
pipeline_t & ensure_pipeline(size_t view, vk::Sampler rgb, vk::Sampler a);
|
||||
|
||||
public:
|
||||
struct input
|
||||
{
|
||||
vk::ImageView rgb;
|
||||
vk::Sampler sampler_rgb;
|
||||
vk::Rect2D rect_rgb;
|
||||
vk::ImageLayout layout_rgb;
|
||||
vk::ImageView a;
|
||||
vk::Sampler sampler_a;
|
||||
vk::Rect2D rect_a;
|
||||
vk::ImageLayout layout_a;
|
||||
};
|
||||
|
||||
stream_defoveator(
|
||||
vk::raii::Device & device,
|
||||
vk::raii::PhysicalDevice & physical_device,
|
||||
@@ -73,7 +84,7 @@ public:
|
||||
void defoveate(
|
||||
vk::raii::CommandBuffer & command_buffer,
|
||||
const std::array<wivrn::to_headset::foveation_parameter, 2> & foveation,
|
||||
std::span<wivrn::blitter::output> inputs,
|
||||
const std::array<input, 2> & inputs,
|
||||
int destination);
|
||||
|
||||
XrExtent2Di defoveated_size(const wivrn::to_headset::foveation_parameter &) const;
|
||||
|
||||
+158
-29
@@ -26,6 +26,7 @@
|
||||
#include "imgui.h"
|
||||
#include "imgui_internal.h"
|
||||
#include "implot.h"
|
||||
#include "utils/contains.h"
|
||||
#include "utils/i18n.h"
|
||||
#include "utils/ranges.h"
|
||||
#include <IconsFontAwesome6.h>
|
||||
@@ -85,7 +86,7 @@ ImPlotPoint getter(int index, void * data_)
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void scenes::stream::accumulate_metrics(XrTime predicted_display_time, const std::vector<std::shared_ptr<shard_accumulator::blit_handle>> & blit_handles, const gpu_timestamps & timestamps)
|
||||
void scenes::stream::accumulate_metrics(XrTime predicted_display_time, const std::array<std::shared_ptr<shard_accumulator::blit_handle>, view_count + 1> & blit_handles, const gpu_timestamps & timestamps)
|
||||
{
|
||||
uint64_t rx = network_session->bytes_received();
|
||||
uint64_t tx = network_session->bytes_sent();
|
||||
@@ -166,12 +167,11 @@ void scenes::stream::gui_performance_metrics()
|
||||
|
||||
ImVec2 window_size = ImGui::GetWindowSize() - ImVec2(2, 2) * style.WindowPadding;
|
||||
|
||||
static const std::array plots = {
|
||||
const std::array plots = {
|
||||
// clang-format off
|
||||
plot(_("CPU time"), {{"", &global_metric::cpu_time}}, "s"),
|
||||
|
||||
plot(_("GPU time"), {{_("Reproject"), &global_metric::gpu_time},
|
||||
{_("Blit"), &global_metric::gpu_barrier}}, "s"),
|
||||
plot(_("GPU time"), {{_("Defoveate"), &global_metric::gpu_time}}, "s"),
|
||||
|
||||
plot(_("Network"), {{_("Download"), &global_metric::bandwidth_rx},
|
||||
{_("Upload"), &global_metric::bandwidth_tx}}, "bit/s"),
|
||||
@@ -223,7 +223,7 @@ void scenes::stream::gui_performance_metrics()
|
||||
for (const auto & [subtitle, data]: subplots)
|
||||
{
|
||||
getter_data gdata{
|
||||
.data = (uintptr_t) & (global_metrics.data()->*data),
|
||||
.data = (uintptr_t)&(global_metrics.data()->*data),
|
||||
.stride = sizeof(global_metric),
|
||||
.multiplier = multiplier,
|
||||
};
|
||||
@@ -260,57 +260,57 @@ void scenes::stream::gui_performance_metrics()
|
||||
ImPlot::SetupAxesLimits(0, metrics.size() - 1, min_v * 1e3f, axis_scale[n] * 1e3f, ImGuiCond_Always);
|
||||
|
||||
getter_data getter_encode_begin{
|
||||
.data = (uintptr_t) & (metrics.data()->encode_begin),
|
||||
.data = (uintptr_t)&(metrics.data()->encode_begin),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_encode_end{
|
||||
.data = (uintptr_t) & (metrics.data()->encode_end),
|
||||
.data = (uintptr_t)&(metrics.data()->encode_end),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_send_begin{
|
||||
.data = (uintptr_t) & (metrics.data()->send_begin),
|
||||
.data = (uintptr_t)&(metrics.data()->send_begin),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_send_end{
|
||||
.data = (uintptr_t) & (metrics.data()->send_end),
|
||||
.data = (uintptr_t)&(metrics.data()->send_end),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_received_first_packet{
|
||||
.data = (uintptr_t) & (metrics.data()->received_first_packet),
|
||||
.data = (uintptr_t)&(metrics.data()->received_first_packet),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_received_last_packet{
|
||||
.data = (uintptr_t) & (metrics.data()->received_last_packet),
|
||||
.data = (uintptr_t)&(metrics.data()->received_last_packet),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_sent_to_decoder{
|
||||
.data = (uintptr_t) & (metrics.data()->sent_to_decoder),
|
||||
.data = (uintptr_t)&(metrics.data()->sent_to_decoder),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_received_from_decoder{
|
||||
.data = (uintptr_t) & (metrics.data()->received_from_decoder),
|
||||
.data = (uintptr_t)&(metrics.data()->received_from_decoder),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_blitted{
|
||||
.data = (uintptr_t) & (metrics.data()->blitted),
|
||||
.data = (uintptr_t)&(metrics.data()->blitted),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_displayed{
|
||||
.data = (uintptr_t) & (metrics.data()->displayed),
|
||||
.data = (uintptr_t)&(metrics.data()->displayed),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_predicted{
|
||||
.data = (uintptr_t) & (metrics.data()->predicted_display),
|
||||
.data = (uintptr_t)&(metrics.data()->predicted_display),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
@@ -382,13 +382,98 @@ void scenes::stream::gui_compact_view()
|
||||
}
|
||||
}
|
||||
|
||||
std::string openxr_post_processing_flag_name(XrCompositionLayerSettingsFlagsFB flag); // TODO declaration in a .h file
|
||||
void scenes::stream::gui_settings()
|
||||
static void send_settings_changed_packet(xr::session & session, wivrn_session * network, const configuration & config, float predicted_display_period)
|
||||
{
|
||||
const auto & refresh_rates = session.get_refresh_rates();
|
||||
from_headset::settings_changed packet{
|
||||
.bitrate_bps = config.bitrate_bps,
|
||||
};
|
||||
if (config.preferred_refresh_rate and (config.preferred_refresh_rate == 0 or utils::contains(refresh_rates, *config.preferred_refresh_rate)))
|
||||
{
|
||||
packet.preferred_refresh_rate = *config.preferred_refresh_rate;
|
||||
packet.minimum_refresh_rate = config.minimum_refresh_rate.value_or(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
packet.preferred_refresh_rate = predicted_display_period;
|
||||
}
|
||||
network->send_control(std::move(packet));
|
||||
}
|
||||
|
||||
std::string openxr_post_processing_flag_name(XrCompositionLayerSettingsFlagsFB flag); // TODO declaration in a .h file
|
||||
void scenes::stream::gui_settings(float predicted_display_period)
|
||||
{
|
||||
const ImGuiStyle & style = ImGui::GetStyle();
|
||||
auto & config = application::get_config();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(20, 20));
|
||||
|
||||
if (instance.has_extension(XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME))
|
||||
{
|
||||
const auto & refresh_rates = session.get_refresh_rates();
|
||||
if (not refresh_rates.empty())
|
||||
{
|
||||
float active_rate = config.preferred_refresh_rate.value_or(refresh_rates.back());
|
||||
if (ImGui::BeginCombo(_S("Refresh rate"), active_rate ? fmt::format("{}", active_rate).c_str() : _cS("automatic refresh rate", "Automatic")))
|
||||
{
|
||||
if (ImGui::Selectable(_cS("automatic refresh rate", "Automatic"), config.preferred_refresh_rate == 0, ImGuiSelectableFlags_SelectOnRelease))
|
||||
{
|
||||
session.set_refresh_rate(0);
|
||||
config.preferred_refresh_rate = 0;
|
||||
send_settings_changed_packet(session, network_session.get(), config, predicted_display_period);
|
||||
config.save();
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
imgui_ctx->tooltip(_("Select refresh rate based on measured application performance.\nMay cause flicker when a change happens."));
|
||||
for (float rate: refresh_rates)
|
||||
{
|
||||
if (ImGui::Selectable(fmt::format("{}", rate).c_str(), rate == config.preferred_refresh_rate, ImGuiSelectableFlags_SelectOnRelease))
|
||||
{
|
||||
session.set_refresh_rate(rate);
|
||||
config.preferred_refresh_rate = rate;
|
||||
send_settings_changed_packet(session, network_session.get(), config, predicted_display_period);
|
||||
config.save();
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
|
||||
if (config.preferred_refresh_rate == 0 and refresh_rates.size() > 2)
|
||||
{
|
||||
float min_rate = config.minimum_refresh_rate.value_or(refresh_rates.front());
|
||||
if (ImGui::BeginCombo(_S("Minimum refresh rate"), fmt::format("{}", min_rate).c_str()))
|
||||
{
|
||||
for (float rate: refresh_rates | std::views::take(refresh_rates.size() - 1))
|
||||
{
|
||||
if (ImGui::Selectable(fmt::format("{}", rate).c_str(), rate == config.minimum_refresh_rate, ImGuiSelectableFlags_SelectOnRelease))
|
||||
{
|
||||
config.minimum_refresh_rate = rate;
|
||||
send_settings_changed_packet(session, network_session.get(), config, predicted_display_period);
|
||||
config.save();
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const auto text = _("Bitrate:");
|
||||
const auto size = ImGui::CalcTextSize(text.c_str());
|
||||
ImGui::Text("%s", text.c_str());
|
||||
|
||||
ImGui::SameLine(0.f, 10.f);
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + (size.y / 4.f) - style.FramePadding.y * 3.f);
|
||||
if (ImGui::Button(fmt::format("{}Mbit/s", config.bitrate_bps / 1'000'000).c_str()))
|
||||
gui_status = gui_status::bitrate_settings;
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
if (ImGui::IsItemHovered())
|
||||
imgui_ctx->tooltip(_("Click to adjust bitrate"));
|
||||
}
|
||||
|
||||
if (application::get_openxr_post_processing_supported())
|
||||
{
|
||||
ImGui::Text("%s", _S("OpenXR post-processing"));
|
||||
@@ -502,6 +587,31 @@ void scenes::stream::gui_settings()
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
void scenes::stream::gui_bitrate_settings(float predicted_display_period)
|
||||
{
|
||||
auto & config = application::get_config();
|
||||
ImGui::PushFont(nullptr, constants::gui::font_size_large);
|
||||
ImGui::Text("%s", _S("Use the right thumbstick to adjust the bitrate"));
|
||||
ImGui::Text("%s", _S("Press A to go back"));
|
||||
ImGui::Text("%s", fmt::format(_F("Bitrate: {}Mbit/s"), config.bitrate_bps / 1'000'000).c_str());
|
||||
ImGui::PopFont();
|
||||
|
||||
// Maximum speed of 20Mbit/s
|
||||
float delta = application::read_action_float(settings_adjust).value_or(std::pair{0, 0}).second * 20'000'000.f * predicted_display_period;
|
||||
|
||||
config.bitrate_bps = std::clamp(config.bitrate_bps + static_cast<int32_t>(delta), 1'000'000u, config.max_bitrate());
|
||||
|
||||
bool ok = application::read_action_bool(foveation_ok).value_or(std::pair{0, false}).second;
|
||||
|
||||
if (ok)
|
||||
{
|
||||
config.save();
|
||||
gui_status = gui_status::settings;
|
||||
}
|
||||
|
||||
send_settings_changed_packet(session, network_session.get(), application::get_config(), predicted_display_period);
|
||||
}
|
||||
|
||||
void scenes::stream::gui_foveation_settings(float predicted_display_period)
|
||||
{
|
||||
ImGui::PushFont(nullptr, constants::gui::font_size_large);
|
||||
@@ -512,7 +622,7 @@ void scenes::stream::gui_foveation_settings(float predicted_display_period)
|
||||
ImGui::PopFont();
|
||||
|
||||
// Maximum speed 1 rad/s
|
||||
float delta_pitch = application::read_action_float(foveation_pitch).value_or(std::pair{0, 0}).second * predicted_display_period;
|
||||
float delta_pitch = application::read_action_float(settings_adjust).value_or(std::pair{0, 0}).second * predicted_display_period;
|
||||
|
||||
// Maximum speed 2m/s @ 1m
|
||||
float delta_distance = std::exp(std::log(2) * application::read_action_float(foveation_distance).value_or(std::pair{0, 0}).second * predicted_display_period);
|
||||
@@ -622,12 +732,6 @@ void scenes::stream::gui_applications()
|
||||
if (ImGui::IsItemHovered())
|
||||
imgui_ctx->tooltip(_S("Request to quit, may be ignored by the application"));
|
||||
}
|
||||
|
||||
auto btn = _("Start");
|
||||
ImGui::SetCursorPos(ImGui::GetWindowSize() - ImGui::CalcTextSize(btn.c_str()) - ImVec2(50, 50));
|
||||
if (ImGui::Button(btn.c_str()))
|
||||
gui_status = gui_status::application_launcher;
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
ImGui::PopStyleVar(3);
|
||||
}
|
||||
|
||||
@@ -663,6 +767,7 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
|
||||
switch (gui_status)
|
||||
{
|
||||
case gui_status::hidden:
|
||||
case gui_status::bitrate_settings:
|
||||
case gui_status::foveation_settings:
|
||||
case gui_status::overlay_only:
|
||||
case gui_status::compact:
|
||||
@@ -725,6 +830,7 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
|
||||
glm::mat3 M = glm::mat3_cast(head_position->second);
|
||||
switch (gui_status)
|
||||
{
|
||||
case gui_status::bitrate_settings:
|
||||
case gui_status::foveation_settings:
|
||||
imgui_ctx->layers()[0].orientation = head_position->second;
|
||||
imgui_ctx->layers()[0].position = head_position->first + M * glm::vec3{0, -override_foveation_distance * sin(override_foveation_pitch), -override_foveation_distance};
|
||||
@@ -768,6 +874,7 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
|
||||
break;
|
||||
|
||||
case gui_status::hidden:
|
||||
case gui_status::bitrate_settings:
|
||||
case gui_status::foveation_settings:
|
||||
ImGui::SetNextWindowPos(ImGui::GetMainViewport()->Size / 2, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
always_auto_resize = true;
|
||||
@@ -838,10 +945,14 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
|
||||
case gui_status::settings:
|
||||
ImGui::SetCursorPos({tab_width + 20, 20});
|
||||
ImGui::BeginChild("Main", ImVec2(ImGui::GetWindowSize().x - ImGui::GetCursorPosX(), 0));
|
||||
gui_settings();
|
||||
gui_settings(predicted_display_period * 1.e-9f);
|
||||
ImGui::EndChild();
|
||||
break;
|
||||
|
||||
case gui_status::bitrate_settings:
|
||||
gui_bitrate_settings(predicted_display_period * 1.e-9f);
|
||||
break;
|
||||
|
||||
case gui_status::foveation_settings:
|
||||
gui_foveation_settings(predicted_display_period * 1.e-9f);
|
||||
break;
|
||||
@@ -868,13 +979,24 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
|
||||
ImGui::BeginChild("Tabs", {tab_width, ImGui::GetContentRegionMax().y - ImGui::GetWindowContentRegionMin().y});
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(10, 10));
|
||||
RadioButtonWithoutCheckBox(ICON_FA_COMPUTER " " + _("Stats"), gui_status, gui_status::stats, {tab_width, 0});
|
||||
|
||||
RadioButtonWithoutCheckBox(ICON_FA_LIST " " + _("Applications"), gui_status, gui_status::applications, {tab_width, 0});
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
|
||||
if (RadioButtonWithoutCheckBox(ICON_FA_ROCKET " " + _("Start"), gui_status, gui_status::application_launcher, {tab_width, 0}))
|
||||
{
|
||||
network_session->send_control(from_headset::get_application_list{
|
||||
.language = application::get_messages_info().language,
|
||||
.country = application::get_messages_info().country,
|
||||
.variant = application::get_messages_info().variant,
|
||||
});
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
|
||||
RadioButtonWithoutCheckBox(ICON_FA_GEARS " " + _("Settings"), gui_status, gui_status::settings, {tab_width, 0});
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
|
||||
RadioButtonWithoutCheckBox(ICON_FA_LIST " " + _("Applications"), gui_status, gui_status::applications, {tab_width, 0});
|
||||
RadioButtonWithoutCheckBox(ICON_FA_COMPUTER " " + _("Stats"), gui_status, gui_status::stats, {tab_width, 0});
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
|
||||
int n_items_at_end = 4;
|
||||
@@ -956,7 +1078,14 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
|
||||
hide_right_controller = true;
|
||||
}
|
||||
|
||||
input->apply(world, world_space, predicted_display_time, hide_left_controller, hide_right_controller, ray_limits);
|
||||
input->apply(world,
|
||||
world_space,
|
||||
predicted_display_time,
|
||||
hide_left_controller,
|
||||
hide_left_controller,
|
||||
hide_right_controller,
|
||||
hide_right_controller,
|
||||
ray_limits);
|
||||
|
||||
// Add the layer with the controllers
|
||||
if (composition_layer_depth_test_supported)
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "utils/named_thread.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <uni_algo/case.h>
|
||||
|
||||
@@ -78,6 +77,9 @@ void scenes::stream::operator()(to_headset::video_stream_description && desc)
|
||||
void scenes::stream::operator()(to_headset::refresh_rate_change && rate)
|
||||
{
|
||||
session.set_refresh_rate(rate.fps);
|
||||
std::shared_lock lock(decoder_mutex);
|
||||
if (video_stream_description)
|
||||
video_stream_description->fps = rate.fps;
|
||||
}
|
||||
|
||||
void scenes::stream::operator()(to_headset::timesync_query && query)
|
||||
|
||||
@@ -304,7 +304,7 @@ void scenes::stream::tracking()
|
||||
device_id::RIGHT_GRIP,
|
||||
device_id::RIGHT_PALM,
|
||||
};
|
||||
if (instance.has_extension("XR_EXT_hand_interaction"))
|
||||
if (instance.has_extension(XR_EXT_HAND_INTERACTION_EXTENSION_NAME))
|
||||
{
|
||||
spdlog::info("Adding hand_interaction poses to device list");
|
||||
ids.insert(ids.end(), {device_id::LEFT_PINCH_POSE, device_id::LEFT_POKE, device_id::RIGHT_PINCH_POSE, device_id::RIGHT_POKE});
|
||||
@@ -556,7 +556,7 @@ void scenes::stream::tracking()
|
||||
e.code().value() != XR_ERROR_TIME_INVALID)
|
||||
throw;
|
||||
}
|
||||
}
|
||||
} // end prediction loop
|
||||
|
||||
XrDuration busy_time = t.count();
|
||||
// Target: polling between 1 and 5ms, with 20% busy time
|
||||
@@ -658,6 +658,9 @@ void scenes::stream::operator()(to_headset::tracking_control && packet)
|
||||
if (audio_handle)
|
||||
audio_handle->set_mic_state(packet.enabled[m]);
|
||||
|
||||
auto n = size_t(wivrn::to_headset::tracking_control::id::hid_input);
|
||||
hid_forwarding = packet.enabled[n];
|
||||
|
||||
*locked = packet;
|
||||
locked->min_offset = std::min(locked->min_offset, locked->max_offset);
|
||||
}
|
||||
@@ -668,9 +671,13 @@ static device_id derived_from(device_id target)
|
||||
{
|
||||
case device_id::LEFT_AIM:
|
||||
case device_id::LEFT_PALM:
|
||||
case device_id::LEFT_PINCH_POSE:
|
||||
case device_id::LEFT_POKE:
|
||||
return device_id::LEFT_GRIP;
|
||||
case device_id::RIGHT_AIM:
|
||||
case device_id::RIGHT_PALM:
|
||||
case device_id::RIGHT_PINCH_POSE:
|
||||
case device_id::RIGHT_POKE:
|
||||
return device_id::RIGHT_GRIP;
|
||||
default:
|
||||
assert(false);
|
||||
@@ -722,6 +729,19 @@ void scenes::stream::on_interaction_profile_changed(const XrEventDataInteraction
|
||||
DO_PROFILE(meta, touch_controller_quest_2)
|
||||
DO_PROFILE(samsung, odyssey_controller)
|
||||
DO_PROFILE(valve, index_controller)
|
||||
|
||||
// FIXME: remove once support for pre-1.1 profiles is dropped
|
||||
if (profile == "/interaction_profiles/facebook/touch_controller_pro")
|
||||
{
|
||||
interaction_profiles[i] = interaction_profile::meta_touch_pro_controller;
|
||||
continue;
|
||||
}
|
||||
if (profile == "/interaction_profiles/meta/touch_controller_plus")
|
||||
{
|
||||
interaction_profiles[i] = interaction_profile::meta_touch_plus_controller;
|
||||
continue;
|
||||
}
|
||||
spdlog::warn("unknown interaction profile {}", profile);
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
@@ -734,12 +754,16 @@ void scenes::stream::on_interaction_profile_changed(const XrEventDataInteraction
|
||||
for (device_id target: {
|
||||
device_id::LEFT_AIM,
|
||||
device_id::LEFT_PALM,
|
||||
device_id::LEFT_PINCH_POSE,
|
||||
device_id::LEFT_POKE,
|
||||
device_id::RIGHT_AIM,
|
||||
device_id::RIGHT_PALM,
|
||||
device_id::RIGHT_PINCH_POSE,
|
||||
device_id::RIGHT_POKE,
|
||||
})
|
||||
{
|
||||
// don't do derived poses for hand interaction
|
||||
const bool right = target >= device_id::RIGHT_GRIP && target <= device_id::RIGHT_PALM;
|
||||
const bool right = (target >= device_id::RIGHT_GRIP && target <= device_id::RIGHT_PALM) || target == device_id::RIGHT_PINCH_POSE || target == device_id::RIGHT_POKE;
|
||||
if (interaction_profiles[right].load() == interaction_profile::ext_hand_interaction_ext)
|
||||
{
|
||||
network_session->send_control(from_headset::derived_pose{
|
||||
|
||||
@@ -5,7 +5,7 @@ const int nb_clipping = 4;
|
||||
const int nb_texcoords = 2;
|
||||
|
||||
const bool use_pbr = false;
|
||||
const bool use_normal_maps = false;
|
||||
const bool use_normal_maps = true;
|
||||
|
||||
layout(set = 0, binding = 0) uniform scene_ubo
|
||||
{
|
||||
@@ -33,7 +33,16 @@ layout(set = 0, binding = 4) uniform sampler2D metallic_roughness_texture;
|
||||
layout(set = 0, binding = 5) uniform sampler2D occlusion_texture;
|
||||
layout(set = 0, binding = 6) uniform sampler2D emissive_texture;
|
||||
layout(set = 0, binding = 7) uniform sampler2D normal_map_texture;
|
||||
layout(set = 0, binding = 8) uniform material_ubo
|
||||
|
||||
struct texture_info
|
||||
{
|
||||
int texcoord;
|
||||
float rotation;
|
||||
vec2 offset;
|
||||
vec2 scale;
|
||||
};
|
||||
|
||||
layout(std140, set = 0, binding = 8) uniform material_ubo
|
||||
{
|
||||
vec4 base_color_factor;
|
||||
vec4 base_emissive_factor;
|
||||
@@ -43,11 +52,11 @@ layout(set = 0, binding = 8) uniform material_ubo
|
||||
float normal_scale;
|
||||
float alpha_cutoff;
|
||||
|
||||
int base_color_texcoord;
|
||||
int metallic_roughness_texcoord;
|
||||
int occlusion_texcoord;
|
||||
int emissive_texcoord;
|
||||
int normal_texcoord;
|
||||
texture_info base_color;
|
||||
texture_info metallic_roughness;
|
||||
texture_info occlusion;
|
||||
texture_info emissive;
|
||||
texture_info normal;
|
||||
} material;
|
||||
|
||||
const float dither_pattern[4][4] = {
|
||||
@@ -91,6 +100,26 @@ vec4 dither(ivec2 frag_coord, vec4 colour)
|
||||
return colour + one_over_d_linear_to_srgb(colour) * vec4(dither_thd, dither_thd, dither_thd, 0) / 255.0f;
|
||||
}
|
||||
|
||||
vec2 compute_texcoord(texture_info info, vec2 in_texcoord)
|
||||
{
|
||||
mat3 translation = mat3(
|
||||
1, 0, 0,
|
||||
0, 1, 0,
|
||||
info.offset.x, info.offset.y, 1);
|
||||
mat3 rotation = mat3(
|
||||
cos(info.rotation), sin(info.rotation), 0,
|
||||
-sin(info.rotation), cos(info.rotation), 0,
|
||||
0, 0, 1);
|
||||
mat3 scale = mat3(
|
||||
info.scale.x, 0, 0,
|
||||
0, info.scale.y, 0,
|
||||
0, 0, 1);
|
||||
|
||||
mat3 matrix = translation * rotation * scale;
|
||||
|
||||
return (matrix * vec3(in_texcoord, 1)).xy;
|
||||
}
|
||||
|
||||
#ifdef FRAG_SHADER
|
||||
#define VS_TO_FS in
|
||||
#else
|
||||
@@ -102,4 +131,9 @@ layout(location = 0) VS_TO_FS vec3 normal;
|
||||
layout(location = 1) VS_TO_FS vec4 tangent;
|
||||
layout(location = 2) VS_TO_FS vec4 frag_pos;
|
||||
layout(location = 3) VS_TO_FS vec4 light_pos;
|
||||
layout(location = 4) VS_TO_FS vec2 texcoord[nb_texcoords];
|
||||
layout(location = 4) VS_TO_FS vec2 texcoord_base_color;
|
||||
layout(location = 5) VS_TO_FS vec2 texcoord_metallic_roughness;
|
||||
layout(location = 6) VS_TO_FS vec2 texcoord_occlusion;
|
||||
layout(location = 7) VS_TO_FS vec2 texcoord_emissive;
|
||||
layout(location = 8) VS_TO_FS vec2 texcoord_normal;
|
||||
layout(location = 9) VS_TO_FS vec4 vertex_color;
|
||||
|
||||
@@ -30,21 +30,21 @@ layout(early_fragment_tests) in;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 albedo = material.base_color_factor * texture(base_color_texture, texcoord[0]);
|
||||
vec3 emissive_color = (material.base_emissive_factor * texture(emissive_texture, texcoord[0])).rgb;
|
||||
vec4 albedo = vertex_color * material.base_color_factor * texture(base_color_texture, texcoord_base_color);
|
||||
vec3 emissive_color = (material.base_emissive_factor * texture(emissive_texture, texcoord_emissive)).rgb;
|
||||
|
||||
vec3 normal_unit;
|
||||
|
||||
if (use_normal_maps)
|
||||
{
|
||||
vec3 sampled_normal = normalize(vec3(material.normal_scale, material.normal_scale, 1) * (texture(normal_map_texture, texcoord[0]).xyz * 2 - 1));
|
||||
vec3 sampled_normal = normalize(vec3(material.normal_scale, material.normal_scale, 1) * (texture(normal_map_texture, texcoord_normal).xyz * 2 - 1));
|
||||
|
||||
// glTF spec §3.7.2.1
|
||||
vec3 bitangent = cross(normal, tangent.xyz) * tangent.w;
|
||||
mat3 TBN = mat3(tangent.xyz, bitangent, normal); // View space to tangent space?
|
||||
mat3 TBN = mat3(tangent.xyz, bitangent, normal);
|
||||
|
||||
// Normal in view space
|
||||
normal_unit = TBN * sampled_normal;
|
||||
normal_unit = normalize(TBN * sampled_normal);
|
||||
}
|
||||
else
|
||||
normal_unit = normalize(normal);
|
||||
@@ -54,8 +54,8 @@ void main()
|
||||
|
||||
if (use_pbr)
|
||||
{
|
||||
float ao = 1 + material.occlusion_strength * (texture(occlusion_texture, texcoord[0]).r - 1);
|
||||
vec4 mr = texture(metallic_roughness_texture, texcoord[0]);
|
||||
float ao = 1 + material.occlusion_strength * (texture(occlusion_texture, texcoord_occlusion).r - 1);
|
||||
vec4 mr = texture(metallic_roughness_texture, texcoord_metallic_roughness);
|
||||
|
||||
vec3 half_vec = normalize(light_dir + view_dir);
|
||||
|
||||
|
||||
@@ -34,14 +34,16 @@ layout(location = 5) in vec4 in_color;
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
float gl_ClipDistance[nb_clipping];
|
||||
float gl_ClipDistance[nb_clipping];
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
// TODO: use base_color_texcoord et al instead of always using texcoord 0
|
||||
for (int i = 0; i < nb_texcoords; i++)
|
||||
texcoord[i] = in_texcoord[i];
|
||||
texcoord_base_color = compute_texcoord(material.base_color, in_texcoord[material.base_color.texcoord]);
|
||||
texcoord_metallic_roughness = compute_texcoord(material.metallic_roughness, in_texcoord[material.metallic_roughness.texcoord]);
|
||||
texcoord_occlusion = compute_texcoord(material.occlusion, in_texcoord[material.occlusion.texcoord]);
|
||||
texcoord_emissive = compute_texcoord(material.emissive, in_texcoord[material.emissive.texcoord]);
|
||||
texcoord_normal = compute_texcoord(material.normal, in_texcoord[material.normal.texcoord]);
|
||||
|
||||
// TODO on CPU?
|
||||
mat3 mv = inverse(transpose(mat3(mesh.modelview[gl_ViewIndex])));
|
||||
@@ -56,9 +58,10 @@ void main()
|
||||
|
||||
frag_pos = mesh.modelview[gl_ViewIndex] * vec4(in_position, 1.0);
|
||||
light_pos = scene.view[gl_ViewIndex] * scene.light_position;
|
||||
vertex_color = in_color;
|
||||
|
||||
for(int i = 0; i < nb_clipping; i++)
|
||||
for (int i = 0; i < nb_clipping; i++)
|
||||
{
|
||||
gl_ClipDistance[i] = dot(mesh.clipping_plane[i], mesh.model * vec4(in_position, 1.0));
|
||||
gl_ClipDistance[i] = dot(mesh.clipping_plane[i], mesh.model * vec4(in_position, 1.0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,21 +30,21 @@ layout(location = 0) out vec4 out_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 albedo = material.base_color_factor * texture(base_color_texture, texcoord[0]);
|
||||
vec3 emissive_color = (material.base_emissive_factor * texture(emissive_texture, texcoord[0])).rgb;
|
||||
vec4 albedo = vertex_color * material.base_color_factor * texture(base_color_texture, texcoord_base_color);
|
||||
vec3 emissive_color = (material.base_emissive_factor * texture(emissive_texture, texcoord_emissive)).rgb;
|
||||
|
||||
vec3 normal_unit;
|
||||
|
||||
if (use_normal_maps)
|
||||
{
|
||||
vec3 sampled_normal = normalize(vec3(material.normal_scale, material.normal_scale, 1) * (texture(normal_map_texture, texcoord[0]).xyz * 2 - 1));
|
||||
vec3 sampled_normal = normalize(vec3(material.normal_scale, material.normal_scale, 1) * (texture(normal_map_texture, texcoord_normal).xyz * 2 - 1));
|
||||
|
||||
// glTF spec §3.7.2.1
|
||||
vec3 bitangent = cross(normal, tangent.xyz) * tangent.w;
|
||||
mat3 TBN = mat3(tangent.xyz, bitangent, normal); // View space to tangent space?
|
||||
mat3 TBN = mat3(tangent.xyz, bitangent, normal);
|
||||
|
||||
// Normal in view space
|
||||
normal_unit = TBN * sampled_normal;
|
||||
normal_unit = normalize(TBN * sampled_normal);
|
||||
}
|
||||
else
|
||||
normal_unit = normalize(normal);
|
||||
@@ -54,8 +54,8 @@ void main()
|
||||
|
||||
if (use_pbr)
|
||||
{
|
||||
float ao = 1 + material.occlusion_strength * (texture(occlusion_texture, texcoord[0]).r - 1);
|
||||
vec4 mr = texture(metallic_roughness_texture, texcoord[0]);
|
||||
float ao = 1 + material.occlusion_strength * (texture(occlusion_texture, texcoord_occlusion).r - 1);
|
||||
vec4 mr = texture(metallic_roughness_texture, texcoord_metallic_roughness);
|
||||
|
||||
vec3 half_vec = normalize(light_dir + view_dir);
|
||||
|
||||
|
||||
@@ -36,14 +36,16 @@ layout(location = 7) in vec4 in_weights;
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
float gl_ClipDistance[nb_clipping];
|
||||
float gl_ClipDistance[nb_clipping];
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
// TODO: use base_color_texcoord et al instead of always using texcoord 0
|
||||
for (int i = 0; i < nb_texcoords; i++)
|
||||
texcoord[i] = in_texcoord[i];
|
||||
texcoord_base_color = compute_texcoord(material.base_color, in_texcoord[material.base_color.texcoord]);
|
||||
texcoord_metallic_roughness = compute_texcoord(material.metallic_roughness, in_texcoord[material.metallic_roughness.texcoord]);
|
||||
texcoord_occlusion = compute_texcoord(material.occlusion, in_texcoord[material.occlusion.texcoord]);
|
||||
texcoord_emissive = compute_texcoord(material.emissive, in_texcoord[material.emissive.texcoord]);
|
||||
texcoord_normal = compute_texcoord(material.normal, in_texcoord[material.normal.texcoord]);
|
||||
|
||||
mat4 skinMatrix =
|
||||
in_weights.x * joints.joint_matrices[int(in_joints.x)] +
|
||||
@@ -65,6 +67,7 @@ void main()
|
||||
|
||||
frag_pos = mesh.modelview[gl_ViewIndex] * vec4(in_position, 1.0);
|
||||
light_pos = scene.view[gl_ViewIndex] * scene.light_position;
|
||||
vertex_color = in_color;
|
||||
|
||||
for(int i = 0; i < nb_clipping; i++)
|
||||
{
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2022 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
* Copyright (C) 2022 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/>.
|
||||
*/
|
||||
|
||||
#version 450
|
||||
|
||||
#ifdef VERT_SHADER
|
||||
|
||||
layout(constant_id = 0) const float useful_size_x = 1.0;
|
||||
layout(constant_id = 1) const float useful_size_y = 1.0;
|
||||
|
||||
vec2 positions[3] = vec2[](
|
||||
vec2(-1.0, -1.0),
|
||||
vec2(3.0, -1.0),
|
||||
vec2(-1.0, 3.0));
|
||||
|
||||
vec2 uvs[3] = vec2[](
|
||||
vec2(0.0, 0.0),
|
||||
vec2(2.0 * useful_size_x, 0.0),
|
||||
vec2(0.0, 2.0 * useful_size_y));
|
||||
|
||||
layout(location = 0) out vec2 outUV;
|
||||
|
||||
void main()
|
||||
{
|
||||
outUV = uvs[gl_VertexIndex];
|
||||
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAG_SHADER
|
||||
layout(binding = 0) uniform sampler2D texSampler;
|
||||
layout(constant_id = 0) const bool is_alpha = false;
|
||||
|
||||
layout(location = 0) in vec2 inUV;
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
outColor = texture(texSampler, inUV);
|
||||
outColor.a = outColor.r;
|
||||
if (!is_alpha)
|
||||
{
|
||||
outColor.a = 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -217,7 +217,7 @@ future<Result, Progress> async(F && f, Args &&... args)
|
||||
fut.shared_state = std::make_shared<typename future<Result, Progress>::state>();
|
||||
|
||||
fut.shared_state->thread = std::thread(
|
||||
[f](async_token<Result, Progress> token, Args &&... args) {
|
||||
[f = std::move(f)](async_token<Result, Progress> token, Args &&... args) {
|
||||
try
|
||||
{
|
||||
token.set_result(std::invoke(f, token, std::forward<Args>(args)...));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
* 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
|
||||
@@ -16,6 +16,17 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "rectangle_partitionner.h"
|
||||
#pragma once
|
||||
template <typename T>
|
||||
struct class_from_member
|
||||
{
|
||||
};
|
||||
|
||||
#include "moc_rectangle_partitionner.cpp"
|
||||
template <typename T, typename U>
|
||||
struct class_from_member<T U::*>
|
||||
{
|
||||
using type = U;
|
||||
};
|
||||
|
||||
template <typename pointer>
|
||||
using class_from_member_t = class_from_member<pointer>::type;
|
||||
@@ -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 <glm/gtc/quaternion.hpp>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
inline glm::quat glm_cast(const XrQuaternionf & q)
|
||||
{
|
||||
return glm::quat::wxyz(q.w, q.x, q.y, q.z);
|
||||
}
|
||||
|
||||
inline XrQuaternionf glm_cast(const glm::quat & q)
|
||||
{
|
||||
return XrQuaternionf(q.w, q.x, q.y, q.z);
|
||||
}
|
||||
|
||||
inline glm::vec3 glm_cast(const XrVector3f & v)
|
||||
{
|
||||
return glm::vec3(v.x, v.y, v.z);
|
||||
}
|
||||
|
||||
inline XrVector3f glm_cast(const glm::vec3 & v)
|
||||
{
|
||||
return XrVector3f(v.x, v.y, v.z);
|
||||
}
|
||||
+2
-1
@@ -24,7 +24,8 @@
|
||||
#define _(x) boost::locale::gettext(x)
|
||||
#define _F(x) fmt::runtime(boost::locale::gettext(x))
|
||||
#define _S(x) boost::locale::gettext(x).c_str()
|
||||
#define _cS(c, x) boost::locale::pgettext(c, x).c_str()
|
||||
#define _C(c, x) boost::locale::pgettext(c, x)
|
||||
#define _cS(c, x) _C(c, x).c_str()
|
||||
#define gettext_noop(x) x
|
||||
#define gettext_noop_context(c, x) x
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user