Compare commits
85
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0a8df2a60 | ||
|
|
4bb40296fc | ||
|
|
c34e8c6961 | ||
|
|
1999e953dd | ||
|
|
40f83a2b60 | ||
|
|
8af5b3eb29 | ||
|
|
3485593e56 | ||
|
|
6c3563904c | ||
|
|
66435957bb | ||
|
|
1550a346c3 | ||
|
|
4fd6d6d816 | ||
|
|
be2027ce9a | ||
|
|
fa3313e293 | ||
|
|
7e0ea37b3c | ||
|
|
b0d9bd2ab7 | ||
|
|
42755dbb7c | ||
|
|
b9ff08d893 | ||
|
|
b997ff3a17 | ||
|
|
63aa862a67 | ||
|
|
52646de23e | ||
|
|
6e8e78b912 | ||
|
|
a7a56d0873 | ||
|
|
59a241de63 | ||
|
|
4740848ca5 | ||
|
|
651c9d5a0f | ||
|
|
bc5d80a13a | ||
|
|
b1db340227 | ||
|
|
8377d617cf | ||
|
|
f94e46ed24 | ||
|
|
aa1f3b39bd | ||
|
|
680dd34529 | ||
|
|
2b9287c042 | ||
|
|
dcc1c82f54 | ||
|
|
dda5c94051 | ||
|
|
6f47b7669c | ||
|
|
ce77a67354 | ||
|
|
3648224f09 | ||
|
|
b72554ea02 | ||
|
|
4fa33b183f | ||
|
|
f8f4b8643e | ||
|
|
e5ba1f7394 | ||
|
|
25ca41cfcf | ||
|
|
066d195c83 | ||
|
|
45e0fce476 | ||
|
|
93a2f1c10b | ||
|
|
ec63c8a395 | ||
|
|
ac2044dffc | ||
|
|
adbbd71557 | ||
|
|
aa4f9ac265 | ||
|
|
c3ec979dde | ||
|
|
ce437ce2b4 | ||
|
|
3a04c52484 | ||
|
|
a04a0f5d03 | ||
|
|
344cb7e572 | ||
|
|
794f2e3468 | ||
|
|
96083cd02e | ||
|
|
366bc2c793 | ||
|
|
db3832aadc | ||
|
|
f25aa9d7d2 | ||
|
|
54f91405a6 | ||
|
|
a69bd596d1 | ||
|
|
62894b178d | ||
|
|
e414c82d6c | ||
|
|
6f039a6bac | ||
|
|
f0e625e095 | ||
|
|
74ea5cfe19 | ||
|
|
8b42be80ee | ||
|
|
b2d49dddb3 | ||
|
|
fa6e768783 | ||
|
|
44bbf00bf1 | ||
|
|
e358230a25 | ||
|
|
a1cdbbe0ba | ||
|
|
d3e10dc31b | ||
|
|
2f5496c06e | ||
|
|
286268d2c6 | ||
|
|
b845f30454 | ||
|
|
84ef968dc3 | ||
|
|
d8c8020d84 | ||
|
|
f301ba393a | ||
|
|
0ccc8b6239 | ||
|
|
adcf159916 | ||
|
|
4125cad44e | ||
|
|
6969e5f972 | ||
|
|
d0250abbc9 | ||
|
|
7485cd0880 |
@@ -0,0 +1,6 @@
|
||||
version: "1"
|
||||
rules:
|
||||
- base: master
|
||||
upstream: WiVRn:master
|
||||
mergeMethod: hardreset
|
||||
|
||||
@@ -22,9 +22,14 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# Checkout from upstream instead of WiVRn-APK to ensure the GIT_DESC variable is set correctly
|
||||
repository: 'WiVRn/WiVRn'
|
||||
repository: 'Vindicus999/WiVRn'
|
||||
ref: ${{ github.sha }}
|
||||
fetch-depth: 0
|
||||
#
|
||||
# - uses: actions/checkout@v4
|
||||
# with:
|
||||
# repository: 'Vindicus999/WiVRn'
|
||||
# ref: sneed
|
||||
|
||||
- name: set up JDK
|
||||
uses: actions/setup-java@v4
|
||||
@@ -68,7 +73,9 @@ jobs:
|
||||
- name: Prepare before archiving artifacts
|
||||
run: |
|
||||
mkdir apk
|
||||
ls build/outputs/apk/
|
||||
mv $(find build/outputs/apk/ -name "*.apk") apk/
|
||||
ls apk/
|
||||
mkdir debug
|
||||
mv build/intermediates/merged_native_libs/*/*/out/lib/* debug/
|
||||
find debug -name libopenxr_loader.so -delete
|
||||
@@ -102,13 +109,15 @@ jobs:
|
||||
pattern: 'apk-*'
|
||||
merge-multiple: true
|
||||
|
||||
- name: Rename APK artifacts
|
||||
run: |
|
||||
cd apk
|
||||
for f in *.apk; do
|
||||
BASENAME=`echo ${f}|awk -F '-APK-' '{print $2}'`
|
||||
mv "${f}" "org.meumeu.wivrn-${BASENAME}"
|
||||
done
|
||||
# - name: Rename APK artifacts
|
||||
# run: |
|
||||
# cd apk
|
||||
# ls
|
||||
# for f in *.apk; do
|
||||
# BASENAME=`echo ${f}|awk -F '-APK-' '{print $2}'`
|
||||
# mv "${f}" "org.meumeu.wivrn-${BASENAME}"
|
||||
# done
|
||||
# ls
|
||||
|
||||
- name: Download APK debug artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
@@ -122,6 +131,11 @@ jobs:
|
||||
cd symbols
|
||||
zip -r ../debug-symbols.zip .
|
||||
|
||||
- name: How the hell doesnt it work
|
||||
run: |
|
||||
ls apk
|
||||
ls
|
||||
|
||||
- name: APK Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
|
||||
@@ -244,7 +244,7 @@ jobs:
|
||||
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": ""}]}' > ~/.config/wivrn/client.json.in
|
||||
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
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
name: Sync Upstream
|
||||
|
||||
env:
|
||||
UPSTREAM_URL: "https://github.com/wivrn/wivrn.git"
|
||||
WORKFLOW_TOKEN: ${{ secrets.DOWNSTREAM_GITHUB_TOKEN }}
|
||||
UPSTREAM_BRANCH: "master"
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 5/6 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: GitHub Sync to Upstream Repository
|
||||
uses: dabreadman/sync-upstream-repo@v1.3.0
|
||||
with:
|
||||
upstream_repo: ${{ env.UPSTREAM_URL }}
|
||||
upstream_branch: ${{ env.UPSTREAM_BRANCH }}
|
||||
token: ${{ env.WORKFLOW_TOKEN }}
|
||||
|
||||
- name: Checkout stuff
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Merge sneed -> master
|
||||
uses: devmasx/merge-branch@master
|
||||
with:
|
||||
type: now
|
||||
from_branch: sneed
|
||||
target_branch: master
|
||||
github_token: ${{ env.WORKFLOW_TOKEN }}
|
||||
|
||||
+9
-6
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.25)
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(WiVRn VERSION 0.0.0 LANGUAGES C CXX)
|
||||
|
||||
# Set default for FetchContent projects
|
||||
@@ -31,6 +31,7 @@ option(WIVRN_BUILD_SERVER_LIBRARY "Build OpenXR library for WiVRn server" ${WIVR
|
||||
option(WIVRN_BUILD_DASHBOARD "Build WiVRn dashboard" OFF)
|
||||
option(WIVRN_BUILD_WIVRNCTL "Build wivrnctl" ON)
|
||||
option(WIVRN_BUILD_DISSECTOR "Build Wireshark dissector" OFF)
|
||||
option(WIVRN_BUILD_TEST "Build test binaries" OFF)
|
||||
option(WIVRN_WERROR "Treat warnings as errors" OFF)
|
||||
|
||||
option(WIVRN_USE_NVENC "Enable nvenc (Nvidia) hardware encoder" ON)
|
||||
@@ -46,7 +47,7 @@ set(OVR_COMPAT_SEARCH_PATH "/usr/local/lib/OpenComposite:/usr/lib/OpenComposite:
|
||||
|
||||
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_SOLARXR "Enable SolarXR driver" OFF)
|
||||
option(WIVRN_FEATURE_STEAMVR_LIGHTHOUSE "Enable SteamVR Lighthouse driver" OFF)
|
||||
|
||||
option(WIVRN_CHECK_CAPSYSNICE "Check if CAP_SYS_NICE is available at startup" ON)
|
||||
@@ -273,15 +274,17 @@ FetchContent_Declare(stb EXCLUDE_FROM_ALL SYSTEM URL https://github.co
|
||||
FetchContent_Declare(libktx EXCLUDE_FROM_ALL SYSTEM
|
||||
GIT_REPOSITORY https://github.com/KhronosGroup/KTX-Software
|
||||
GIT_TAG 91ace88675ac59a97e55d0378a6602a9ae6b98bd)
|
||||
FetchContent_Declare(implot EXCLUDE_FROM_ALL SYSTEM URL https://github.com/epezent/implot/archive/refs/tags/v0.16.tar.gz
|
||||
URL_HASH SHA256=961df327d8a756304d1b0a67316eebdb1111d13d559f0d3415114ec0eb30abd1)
|
||||
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.91.3.tar.gz
|
||||
URL_HASH SHA256=29949d7b300c30565fbcd66398100235b63aa373acfee0b76853a7aeacd1be28
|
||||
FetchContent_Declare(imgui EXCLUDE_FROM_ALL SYSTEM URL https://github.com/ocornut/imgui/archive/refs/tags/v1.92.1.tar.gz
|
||||
URL_HASH SHA256=32c237c2abf67a2ffccaac17192f711d4a787554b4133187a153d49057d6109c
|
||||
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)
|
||||
|
||||
file(GLOB MONADO_PATCHES CONFIGURE_DEPENDS patches/monado/*)
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS monado-rev)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 581 B After Width: | Height: | Size: 292 B |
@@ -72,6 +72,7 @@ android {
|
||||
versionName = project.hasProperty('wivrn_version') ? wivrn_version : "1.0"
|
||||
versionCode = project.hasProperty('wivrn_versionCode') ? wivrn_versionCode.toInteger() : 1
|
||||
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'
|
||||
|
||||
externalNativeBuild {
|
||||
def css = project.hasProperty('wivrn_css') ? project.wivrn_css: "images/wivrn-local.css"
|
||||
@@ -90,6 +91,7 @@ android {
|
||||
'-DWIVRN_BUILD_DASHBOARD=OFF',
|
||||
'-DWIVRN_WERROR=ON',
|
||||
'-DWIVRN_SHOW_IMGUI_DEMO_WINDOW=' + showImguiDemo,
|
||||
'-DWIVRN_CLIENT_DEBUG_MENU=' + showDebugMenu,
|
||||
'-DWIVRN_CSS=' + css
|
||||
resValue "string", "app_name", project.hasProperty('wivrn_app_name') ? project.wivrn_app_name : "WiVRn Local"
|
||||
}
|
||||
|
||||
+8
-14
@@ -7,7 +7,7 @@ set(KTX_FEATURE_LOADTEST_APPS OFF)
|
||||
|
||||
set(FASTGLTF_COMPILE_AS_CPP20 ON)
|
||||
|
||||
FetchContent_MakeAvailable(simdjson spdlog glm fastgltf imgui stb implot uni-algo)
|
||||
FetchContent_MakeAvailable(simdjson spdlog glm fastgltf imgui stb implot uni-algo entt)
|
||||
|
||||
if (WIVRN_USE_LIBKTX)
|
||||
FetchContent_MakeAvailable(libktx)
|
||||
@@ -140,6 +140,10 @@ target_link_libraries(wivrn-imgui FreetypeHarfbuzz)
|
||||
target_link_libraries(wivrn wivrn-imgui)
|
||||
|
||||
|
||||
##############################################################################
|
||||
# EnTT
|
||||
#
|
||||
target_link_libraries(wivrn EnTT::EnTT)
|
||||
|
||||
##############################################################################
|
||||
# Vulkan Validation Layer
|
||||
@@ -225,14 +229,8 @@ add_custom_command(OUTPUT ${ASSETS_DIR}/wivrn.png
|
||||
COMMAND ${RSVG_CONVERT} ${IMG_SRC_DIR}/wivrn.svg -w 540 -h 540 -o ${ASSETS_DIR}/wivrn.png ${RSVG_OPTS}
|
||||
DEPENDS ${IMG_SRC_DIR}/wivrn.svg ${WIVRN_CSS_ABS})
|
||||
|
||||
add_custom_command(OUTPUT ${ASSETS_DIR}/wivrn-pride.png
|
||||
COMMAND ${RSVG_CONVERT} ${IMG_SRC_DIR}/wivrn-pride.svg -w 540 -h 540 -o ${ASSETS_DIR}/wivrn-pride.png ${RSVG_OPTS}
|
||||
DEPENDS ${IMG_SRC_DIR}/wivrn-pride.svg ${WIVRN_CSS_ABS})
|
||||
|
||||
add_custom_target(assets ALL DEPENDS
|
||||
${ASSETS_DIR}/wivrn.png
|
||||
${ASSETS_DIR}/wivrn-pride.png
|
||||
)
|
||||
${ASSETS_DIR}/wivrn.png)
|
||||
|
||||
add_dependencies(wivrn assets)
|
||||
|
||||
@@ -241,9 +239,6 @@ if(ANDROID)
|
||||
add_custom_command(OUTPUT ${ASSETS_DIR}/wivrn.ktx2
|
||||
COMMAND ${TOKTX} --encode astc --astc_blk_d 4x4 --astc_quality 100 --genmipmap ${ASSETS_DIR}/wivrn.ktx2 ${ASSETS_DIR}/wivrn.png
|
||||
DEPENDS ${ASSETS_DIR}/wivrn.png)
|
||||
add_custom_command(OUTPUT ${ASSETS_DIR}/wivrn-pride.ktx2
|
||||
COMMAND ${TOKTX} --encode astc --astc_blk_d 4x4 --astc_quality 100 --genmipmap ${ASSETS_DIR}/wivrn-pride.ktx2 ${ASSETS_DIR}/wivrn-pride.png
|
||||
DEPENDS ${ASSETS_DIR}/wivrn-pride.png)
|
||||
|
||||
add_custom_command(OUTPUT ${ASSETS_DIR}/WoodFloor051_1K-JPG_Color.ktx2
|
||||
COMMAND ${TOKTX} --encode astc --astc_blk_d 12x12 --astc_quality 100 --genmipmap ${ASSETS_DIR}/WoodFloor051_1K-JPG_Color.ktx2 ${AST_SRC_DIR}/WoodFloor051_1K-JPG_Color.jpg
|
||||
@@ -255,10 +250,9 @@ if(ANDROID)
|
||||
|
||||
add_custom_target(assets-android ALL DEPENDS
|
||||
${ASSETS_DIR}/wivrn.ktx2
|
||||
${ASSETS_DIR}/wivrn-pride.ktx2
|
||||
${ASSETS_DIR}/WoodFloor051_1K-JPG_Color.ktx2
|
||||
${ASSETS_DIR}/vr_splash.png
|
||||
)
|
||||
${ASSETS_DIR}/vr_splash.png)
|
||||
|
||||
add_dependencies(assets-android assets)
|
||||
add_dependencies(wivrn assets-android)
|
||||
endif()
|
||||
|
||||
+20
-10
@@ -727,9 +727,10 @@ void application::initialize_vulkan()
|
||||
bool debug_utils_found = false;
|
||||
#endif
|
||||
spdlog::info("Available Vulkan instance extensions:");
|
||||
std::vector<std::pair<std::string, int>> extensions;
|
||||
for (vk::ExtensionProperties & i: vk_context.enumerateInstanceExtensionProperties(nullptr))
|
||||
{
|
||||
spdlog::info(" {} (version {})", i.extensionName.data(), i.specVersion);
|
||||
extensions.emplace_back(i.extensionName.data(), i.specVersion);
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (!strcmp(i.extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME))
|
||||
@@ -739,6 +740,9 @@ void application::initialize_vulkan()
|
||||
debug_utils_found = true;
|
||||
#endif
|
||||
}
|
||||
std::ranges::sort(extensions);
|
||||
for (const auto & [extension_name, spec_version]: extensions)
|
||||
spdlog::info(" {} (version {})", extension_name, spec_version);
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (debug_utils_found && debug_report_found)
|
||||
@@ -817,11 +821,16 @@ void application::initialize_vulkan()
|
||||
vk_physical_device = xr_system_id.physical_device(vk_instance);
|
||||
physical_device_properties = vk_physical_device.getProperties();
|
||||
|
||||
spdlog::info("Available Vulkan device extensions:");
|
||||
extensions.clear();
|
||||
for (vk::ExtensionProperties & i: vk_physical_device.enumerateDeviceExtensionProperties())
|
||||
extensions.emplace_back(i.extensionName.data(), i.specVersion);
|
||||
std::ranges::sort(extensions);
|
||||
|
||||
spdlog::info("Available Vulkan device extensions:");
|
||||
for (const auto & [extension_name, spec_version]: extensions)
|
||||
{
|
||||
spdlog::info(" {}", i.extensionName.data());
|
||||
if (auto it = optional_device_extensions.find(i.extensionName); it != optional_device_extensions.end())
|
||||
spdlog::info(" {} (version {})", extension_name, spec_version);
|
||||
if (auto it = optional_device_extensions.find(extension_name); it != optional_device_extensions.end())
|
||||
vk_device_extensions.push_back(it->data());
|
||||
}
|
||||
|
||||
@@ -1285,7 +1294,7 @@ void application::initialize()
|
||||
XrSystemFaceTrackingProperties2FB fb_face2_properties = xr_system_id.fb_face_tracking2_properties();
|
||||
spdlog::info(" FB face tracking support: {}", (bool)fb_face2_properties.supportsVisualFaceTracking);
|
||||
if (fb_face2_properties.supportsVisualFaceTracking)
|
||||
face_tracker = xr_session.create_fb_face_tracker2();
|
||||
face_tracker.emplace<xr::fb_face_tracker2>(xr_instance, xr_session);
|
||||
}
|
||||
|
||||
if (std::holds_alternative<std::monostate>(face_tracker) && utils::contains(xr_extensions, XR_HTC_FACIAL_TRACKING_EXTENSION_NAME))
|
||||
@@ -1293,7 +1302,8 @@ void application::initialize()
|
||||
XrSystemFacialTrackingPropertiesHTC htc_face_properties = xr_system_id.htc_face_tracking_properties();
|
||||
spdlog::info(" HTC eye tracking support: {}", (bool)htc_face_properties.supportEyeFacialTracking);
|
||||
spdlog::info(" HTC lip tracking support: {}", (bool)htc_face_properties.supportLipFacialTracking);
|
||||
face_tracker = xr_session.create_htc_face_tracker(htc_face_properties.supportEyeFacialTracking, htc_face_properties.supportLipFacialTracking);
|
||||
if (htc_face_properties.supportEyeFacialTracking || htc_face_properties.supportLipFacialTracking)
|
||||
face_tracker.emplace<xr::htc_face_tracker>(xr_instance, xr_session, htc_face_properties.supportEyeFacialTracking, htc_face_properties.supportLipFacialTracking);
|
||||
}
|
||||
|
||||
if (std::holds_alternative<std::monostate>(face_tracker) && eye_gaze_supported)
|
||||
@@ -1303,7 +1313,7 @@ void application::initialize()
|
||||
case model::pico_4_pro:
|
||||
case model::pico_4_enterprise:
|
||||
spdlog::info(" PICO face tracking support: true");
|
||||
face_tracker = xr_session.create_pico_face_tracker();
|
||||
face_tracker.emplace<xr::pico_face_tracker>(xr_instance, xr_session);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1315,13 +1325,13 @@ void application::initialize()
|
||||
XrSystemBodyTrackingPropertiesFB fb_body_properties = xr_system_id.fb_body_tracking_properties();
|
||||
spdlog::info(" FB body tracking support: {}", (bool)fb_body_properties.supportsBodyTracking);
|
||||
if (fb_body_properties.supportsBodyTracking)
|
||||
body_tracker = xr_session.create_fb_body_tracker();
|
||||
body_tracker.emplace<xr::fb_body_tracker>(xr_instance, xr_session);
|
||||
}
|
||||
|
||||
if (std::holds_alternative<std::monostate>(body_tracker) && utils::contains_all(xr_extensions, std::array{XR_HTC_PATH_ENUMERATION_EXTENSION_NAME, XR_HTC_VIVE_XR_TRACKER_INTERACTION_EXTENSION_NAME}))
|
||||
{
|
||||
spdlog::info(" HTC body tracking support: true");
|
||||
body_tracker = xr_session.create_htc_body_tracker();
|
||||
body_tracker.emplace<xr::htc_body_tracker>(xr_instance, xr_session);
|
||||
}
|
||||
|
||||
if (std::holds_alternative<std::monostate>(body_tracker) && utils::contains(xr_extensions, XR_BD_BODY_TRACKING_EXTENSION_NAME))
|
||||
@@ -1329,7 +1339,7 @@ void application::initialize()
|
||||
XrSystemBodyTrackingPropertiesBD bd_body_properties = xr_system_id.bd_body_tracking_properties();
|
||||
spdlog::info(" PICO body tracking support: {}", (bool)bd_body_properties.supportsBodyTracking);
|
||||
if (bd_body_properties.supportsBodyTracking)
|
||||
body_tracker = xr_session.create_pico_body_tracker();
|
||||
body_tracker.emplace<xr::pico_body_tracker>(xr_instance, xr_session);
|
||||
}
|
||||
|
||||
vk::CommandPoolCreateInfo cmdpool_create_info;
|
||||
|
||||
@@ -476,6 +476,11 @@ public:
|
||||
return *instance().config;
|
||||
}
|
||||
|
||||
static XrSessionState get_session_state()
|
||||
{
|
||||
return instance().session_state;
|
||||
}
|
||||
|
||||
static boost::locale::gnu_gettext::messages_info & get_messages_info()
|
||||
{
|
||||
return instance().messages_info;
|
||||
|
||||
@@ -205,9 +205,6 @@ configuration::configuration(xr::system & system)
|
||||
servers.emplace(data.service.txt["cookie"], data);
|
||||
}
|
||||
|
||||
if (auto val = root["show_performance_metrics"]; val.is_bool())
|
||||
show_performance_metrics = val.get_bool();
|
||||
|
||||
if (auto val = root["preferred_refresh_rate"]; val.is_double())
|
||||
preferred_refresh_rate = val.get_double();
|
||||
|
||||
@@ -245,6 +242,18 @@ configuration::configuration(xr::system & system)
|
||||
|
||||
if (system.passthrough_supported() == xr::system::passthrough_type::no_passthrough)
|
||||
passthrough_enabled = false;
|
||||
|
||||
if (auto val = root["override_foveation_enable"]; val.is_bool())
|
||||
override_foveation_enable = val.get_bool();
|
||||
|
||||
if (auto val = root["override_foveation_pitch"]; val.is_double())
|
||||
override_foveation_pitch = val.get_double();
|
||||
|
||||
if (auto val = root["override_foveation_distance"]; val.is_double())
|
||||
override_foveation_distance = val.get_double();
|
||||
|
||||
if (auto val = root["first_run"]; val.is_bool())
|
||||
first_run = val.get_bool();
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
@@ -257,7 +266,6 @@ configuration::configuration(xr::system & system)
|
||||
resolution_scale = 1.4;
|
||||
sgsr = {};
|
||||
openxr_post_processing = {};
|
||||
show_performance_metrics = false;
|
||||
passthrough_enabled = system.passthrough_supported() == xr::system::passthrough_type::color;
|
||||
}
|
||||
}
|
||||
@@ -343,8 +351,7 @@ void configuration::save()
|
||||
|
||||
std::ofstream json(application::get_config_path() / "client.json");
|
||||
|
||||
json << "{\"servers\":[" << servers_str << "],"
|
||||
<< "\"show_performance_metrics\":" << std::boolalpha << show_performance_metrics;
|
||||
json << "{\"servers\":[" << servers_str << "]";
|
||||
if (preferred_refresh_rate)
|
||||
json << ",\"preferred_refresh_rate\":" << *preferred_refresh_rate;
|
||||
if (minimum_refresh_rate)
|
||||
@@ -361,5 +368,9 @@ void configuration::save()
|
||||
for (auto & [key, value]: features)
|
||||
json << "," << key << ":" << std::boolalpha << value;
|
||||
json << ",\"virtual_keyboard_layout\":" << json_string(virtual_keyboard_layout);
|
||||
json << ",\"override_foveation_enable\":" << std::boolalpha << override_foveation_enable;
|
||||
json << ",\"override_foveation_pitch\":" << override_foveation_pitch;
|
||||
json << ",\"override_foveation_distance\":" << override_foveation_distance;
|
||||
json << ",\"first_run\":" << std::boolalpha << first_run;
|
||||
json << "}";
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ public:
|
||||
std::optional<float> preferred_refresh_rate;
|
||||
std::optional<float> minimum_refresh_rate;
|
||||
float resolution_scale = 1.4;
|
||||
bool show_performance_metrics = false;
|
||||
bool passthrough_enabled = false;
|
||||
bool mic_unprocessed_audio = false;
|
||||
|
||||
@@ -78,6 +77,12 @@ public:
|
||||
|
||||
std::string virtual_keyboard_layout = "QWERTY";
|
||||
|
||||
bool override_foveation_enable = false;
|
||||
float override_foveation_pitch = 10 * M_PI / 180;
|
||||
float override_foveation_distance = 3;
|
||||
|
||||
bool first_run = true;
|
||||
|
||||
bool check_feature(feature f) const;
|
||||
void set_feature(feature f, bool state);
|
||||
|
||||
@@ -90,6 +95,7 @@ private:
|
||||
|
||||
public:
|
||||
configuration(xr::system &);
|
||||
configuration() = default;
|
||||
|
||||
void save();
|
||||
};
|
||||
|
||||
+11
-2
@@ -18,7 +18,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <glm/glm.hpp>
|
||||
#include <imgui.h>
|
||||
@@ -91,7 +90,7 @@ constexpr float recenter_action_distance = 0.3;
|
||||
constexpr float initial_gui_distance = 0.5;
|
||||
|
||||
// Skybox color
|
||||
constexpr std::array<float, 4> sky_color = {0, 0.25, 0.5, 1};
|
||||
constexpr XrColor4f sky_color = {0, 0.25, 0.5, 1};
|
||||
|
||||
// Dimming scale/bias when a popup window is shown
|
||||
constexpr XrColor4f dimming_scale = {0.5, 0.5, 0.5, 1};
|
||||
@@ -105,6 +104,16 @@ constexpr int zindex_controllers = 1;
|
||||
constexpr int zindex_recenter_tip = 2;
|
||||
} // namespace constants::lobby
|
||||
|
||||
namespace constants::stream
|
||||
{
|
||||
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;
|
||||
} // namespace constants::stream
|
||||
|
||||
namespace constants::style
|
||||
{
|
||||
constexpr ImVec2 window_padding = {20, 20};
|
||||
|
||||
+115
-139
@@ -382,46 +382,9 @@ imgui_context::imgui_context(vk::raii::PhysicalDevice physical_device, vk::raii:
|
||||
style.Colors[ImGuiCol_ModalWindowDimBg] = {0, 0, 0, 0};
|
||||
}
|
||||
|
||||
void imgui_context::add_chars(std::string_view sv)
|
||||
{
|
||||
for (auto it = sv.begin(); it != sv.end();)
|
||||
{
|
||||
ImWchar c = (ImWchar)*it;
|
||||
if (c < 0x80)
|
||||
++it;
|
||||
else
|
||||
it += ImTextCharFromUtf8(&c, it, sv.end());
|
||||
|
||||
if (!glyph_range_builder.GetBit(c))
|
||||
{
|
||||
glyph_range_builder.AddChar(c);
|
||||
glyph_range_dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
static std::vector<std::string> find_font(const ImFontGlyphRangesBuilder & glyph_range_builder, const std::string & locale)
|
||||
static std::vector<std::string> find_font(std::u16string_view sample_text, const std::string & locale)
|
||||
{
|
||||
std::u16string wtext;
|
||||
std::u16string_view wtextview;
|
||||
for (int i = 0; i < glyph_range_builder.UsedChars.Size; ++i)
|
||||
{
|
||||
std::uint32_t used_chars = glyph_range_builder.UsedChars[i];
|
||||
if (used_chars == 0)
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < 32; ++j)
|
||||
{
|
||||
ImWchar c = i * 32 + j;
|
||||
if (used_chars & (1 << j))
|
||||
{
|
||||
wtext += c;
|
||||
}
|
||||
}
|
||||
}
|
||||
wtextview = wtext;
|
||||
|
||||
AFontMatcher * font_matcher = AFontMatcher_create();
|
||||
if (!font_matcher)
|
||||
throw std::runtime_error("AFontMatcher_create");
|
||||
@@ -432,18 +395,18 @@ static std::vector<std::string> find_font(const ImFontGlyphRangesBuilder & glyph
|
||||
|
||||
std::vector<std::string> fonts;
|
||||
|
||||
while (!wtextview.empty())
|
||||
while (!sample_text.empty())
|
||||
{
|
||||
uint32_t runlength = 0;
|
||||
|
||||
AFont * font = AFontMatcher_match(font_matcher, "sans-serif", (uint16_t *)wtextview.data(), wtextview.size(), &runlength);
|
||||
AFont * font = AFontMatcher_match(font_matcher, "sans-serif", (uint16_t *)sample_text.data(), sample_text.size(), &runlength);
|
||||
fonts.emplace_back(AFont_getFontFilePath(font));
|
||||
AFont_close(font);
|
||||
|
||||
if (runlength == 0)
|
||||
break;
|
||||
|
||||
wtextview = wtextview.substr(runlength);
|
||||
sample_text = sample_text.substr(runlength);
|
||||
}
|
||||
|
||||
AFontMatcher_destroy(font_matcher);
|
||||
@@ -451,7 +414,7 @@ static std::vector<std::string> find_font(const ImFontGlyphRangesBuilder & glyph
|
||||
return fonts;
|
||||
}
|
||||
#else
|
||||
static std::vector<std::string> find_font(ImFontGlyphRangesBuilder glyph_range_builder, const std::string & locale)
|
||||
static std::vector<std::string> find_font(std::u16string sample_text, const std::string & locale)
|
||||
{
|
||||
// See https://www.camconn.cc/post/how-to-fontconfig-lib-c/
|
||||
|
||||
@@ -470,21 +433,8 @@ static std::vector<std::string> find_font(ImFontGlyphRangesBuilder glyph_range_b
|
||||
// Add the text to the pattern (to determine appropriate characters)
|
||||
FcCharSet * charset = FcCharSetCreate();
|
||||
|
||||
for (int i = 8; i < glyph_range_builder.UsedChars.Size; ++i)
|
||||
{
|
||||
std::uint32_t used_chars = glyph_range_builder.UsedChars[i];
|
||||
if (used_chars == 0)
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < 32; ++j)
|
||||
{
|
||||
ImWchar c = i * 32 + j;
|
||||
if (used_chars & (1 << j))
|
||||
{
|
||||
FcCharSetAddChar(charset, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (char16_t c: sample_text)
|
||||
FcCharSetAddChar(charset, c);
|
||||
|
||||
FcPatternAddCharSet(pattern, FC_CHARSET, charset);
|
||||
FcCharSetDestroy(charset);
|
||||
@@ -513,28 +463,26 @@ static std::vector<std::string> find_font(ImFontGlyphRangesBuilder glyph_range_b
|
||||
continue;
|
||||
|
||||
bool keep_this_font = false;
|
||||
for (int i = 0; i < glyph_range_builder.UsedChars.Size; ++i)
|
||||
{
|
||||
std::uint32_t & used_chars = glyph_range_builder.UsedChars[i];
|
||||
if (used_chars == 0)
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < 32; ++j)
|
||||
std::u16string tmp = sample_text;
|
||||
for (int i = 0; i < tmp.size();)
|
||||
{
|
||||
char16_t c = tmp[i];
|
||||
|
||||
if (FcCharSetHasChar(font_charset, c))
|
||||
{
|
||||
ImWchar c = i * 32 + j;
|
||||
if (used_chars & (1 << j))
|
||||
{
|
||||
if (FcCharSetHasChar(font_charset, c))
|
||||
{
|
||||
keep_this_font = true;
|
||||
used_chars &= ~(1 << j);
|
||||
}
|
||||
}
|
||||
keep_this_font = true;
|
||||
|
||||
tmp[i] = tmp[tmp.size() - 1];
|
||||
tmp.resize(tmp.size() - 1);
|
||||
}
|
||||
else
|
||||
++i;
|
||||
}
|
||||
|
||||
if (keep_this_font)
|
||||
fonts.emplace_back((const char *)font_file);
|
||||
break;
|
||||
}
|
||||
|
||||
FcFontSetDestroy(fs);
|
||||
@@ -546,29 +494,19 @@ static std::vector<std::string> find_font(ImFontGlyphRangesBuilder glyph_range_b
|
||||
|
||||
void imgui_context::initialize_fonts()
|
||||
{
|
||||
glyph_ranges.clear();
|
||||
std::u16string sample_text = u"Hello world";
|
||||
|
||||
// Always include Basic Latin and Latin-1 Supplement without control characters
|
||||
ImWchar default_ranges[] = {0x20, 0x7f, 0xa0, 0xff, 0};
|
||||
glyph_range_builder.AddRanges(default_ranges);
|
||||
const auto & locale = application::get_messages_info();
|
||||
auto it = glyph_set_per_language.find(locale.language + "_" + locale.country);
|
||||
if (it == glyph_set_per_language.end())
|
||||
it = glyph_set_per_language.find(locale.language);
|
||||
|
||||
{
|
||||
const auto & locale = application::get_messages_info();
|
||||
auto it = glyph_set_per_language.find(locale.language + "_" + locale.country);
|
||||
if (it == glyph_set_per_language.end())
|
||||
it = glyph_set_per_language.find(locale.language);
|
||||
|
||||
if (it != glyph_set_per_language.end())
|
||||
{
|
||||
for (ImWchar c: it->second)
|
||||
glyph_range_builder.AddChar(c);
|
||||
}
|
||||
}
|
||||
|
||||
glyph_range_builder.BuildRanges(&glyph_ranges);
|
||||
if (it != glyph_set_per_language.end())
|
||||
for (char16_t c: it->second)
|
||||
sample_text += c;
|
||||
|
||||
// Load Fonts
|
||||
auto fonts = find_font(glyph_range_builder, application::get_messages_info().language);
|
||||
auto fonts = find_font(sample_text, application::get_messages_info().language);
|
||||
for (auto & i: fonts)
|
||||
{
|
||||
spdlog::info("Font {}", i);
|
||||
@@ -577,40 +515,20 @@ void imgui_context::initialize_fonts()
|
||||
asset font_awesome_regular("Font Awesome 6 Free-Regular-400.otf");
|
||||
asset font_awesome_solid("Font Awesome 6 Free-Solid-900.otf");
|
||||
|
||||
IM_DELETE(io.Fonts);
|
||||
io.Fonts = IM_NEW(ImFontAtlas);
|
||||
ImFontConfig config;
|
||||
config.FontDataOwnedByAtlas = false;
|
||||
|
||||
for (auto & font: fonts)
|
||||
{
|
||||
ImFontConfig config;
|
||||
config.FontDataOwnedByAtlas = false;
|
||||
|
||||
for (auto & font: fonts)
|
||||
{
|
||||
spdlog::info("Using font {}", font, application::get_messages_info().language);
|
||||
io.Fonts->AddFontFromFileTTF(font.c_str(), constants::gui::font_size_small, &config, glyph_ranges.Data);
|
||||
config.MergeMode = true;
|
||||
}
|
||||
|
||||
spdlog::info("Using font {}", font, application::get_messages_info().language);
|
||||
io.Fonts->AddFontFromFileTTF(font.c_str(), constants::gui::font_size_small, &config);
|
||||
config.MergeMode = true;
|
||||
config.GlyphMinAdvanceX = 40; // Use if you want to make the icon monospaced
|
||||
static const ImWchar icon_ranges[] = {ICON_MIN_FA, ICON_MAX_FA, 0};
|
||||
io.Fonts->AddFontFromMemoryTTF(const_cast<std::byte *>(font_awesome_regular.data()), font_awesome_regular.size(), constants::gui::font_size_small, &config, icon_ranges);
|
||||
io.Fonts->AddFontFromMemoryTTF(const_cast<std::byte *>(font_awesome_solid.data()), font_awesome_solid.size(), constants::gui::font_size_small, &config, icon_ranges);
|
||||
}
|
||||
|
||||
{
|
||||
ImFontConfig config;
|
||||
config.FontDataOwnedByAtlas = false;
|
||||
for (auto & font: fonts)
|
||||
{
|
||||
large_font = io.Fonts->AddFontFromFileTTF(font.c_str(), constants::gui::font_size_large, &config, glyph_ranges.Data);
|
||||
config.MergeMode = true;
|
||||
}
|
||||
}
|
||||
|
||||
glyph_range_dirty = false;
|
||||
|
||||
ImGui_ImplVulkan_CreateFontsTexture();
|
||||
config.MergeMode = true;
|
||||
config.GlyphMinAdvanceX = 40; // Use if you want to make the icon monospaced
|
||||
io.Fonts->AddFontFromMemoryTTF(const_cast<std::byte *>(font_awesome_regular.data()), font_awesome_regular.size(), constants::gui::font_size_small, &config);
|
||||
io.Fonts->AddFontFromMemoryTTF(const_cast<std::byte *>(font_awesome_solid.data()), font_awesome_solid.size(), constants::gui::font_size_small, &config);
|
||||
}
|
||||
|
||||
std::vector<imgui_context::controller_state> imgui_context::read_controllers_state(XrTime display_time)
|
||||
@@ -627,6 +545,9 @@ std::vector<imgui_context::controller_state> imgui_context::read_controllers_sta
|
||||
|
||||
controller_state & new_state = new_states.emplace_back();
|
||||
|
||||
if (not controllers_enabled)
|
||||
continue;
|
||||
|
||||
if (ctrl.hand)
|
||||
{
|
||||
if (auto joints = ctrl.hand->locate(world, display_time))
|
||||
@@ -841,24 +762,6 @@ void imgui_context::new_frame(XrTime display_time)
|
||||
controller.second = next_state;
|
||||
}
|
||||
|
||||
// Force recreation of the font atlas
|
||||
if (glyph_range_dirty)
|
||||
{
|
||||
// Wait for fences before ImGui_ImplVulkan_DestroyFontsTexture is called
|
||||
std::vector<vk::Fence> fences;
|
||||
for (auto & f: command_buffers)
|
||||
{
|
||||
fences.push_back(*f.fence);
|
||||
}
|
||||
|
||||
if (auto result = device.waitForFences(fences, true, 1'000'000'000); result != vk::Result::eSuccess)
|
||||
spdlog::error("vkWaitForfences: {}", vk::to_string(result));
|
||||
|
||||
ImGui_ImplVulkan_DestroyFontsTexture();
|
||||
initialize_fonts();
|
||||
ImGui_ImplVulkan_CreateFontsTexture();
|
||||
}
|
||||
|
||||
// Start the Dear ImGui frame
|
||||
ImGui_ImplVulkan_NewFrame();
|
||||
|
||||
@@ -876,10 +779,20 @@ void imgui_context::new_frame(XrTime display_time)
|
||||
|
||||
image_index = swapchain.acquire();
|
||||
swapchain.wait();
|
||||
|
||||
hovered_item_prev = hovered_item;
|
||||
hovered_item = 0;
|
||||
}
|
||||
|
||||
std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_context::end_frame()
|
||||
{
|
||||
if (hovered_item != hovered_item_prev && hovered_item != 0)
|
||||
{
|
||||
size_t controller = get_focused_controller();
|
||||
if (auto haptic_output = controllers[controller].first.haptic_output; haptic_output != XR_NULL_HANDLE)
|
||||
application::haptic_start(haptic_output, XR_NULL_PATH, 10'000'000, 1000, 1);
|
||||
}
|
||||
|
||||
vk::Image destination = swapchain.images()[image_index].image;
|
||||
|
||||
ImGui::SetCurrentContext(context);
|
||||
@@ -1070,6 +983,17 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_context::end_frame()
|
||||
return quads;
|
||||
}
|
||||
|
||||
void imgui_context::vibrate_on_hover()
|
||||
{
|
||||
if (ImGui::IsItemHovered())
|
||||
hovered_item = ImGui::GetItemID();
|
||||
}
|
||||
|
||||
void imgui_context::set_hovered_item()
|
||||
{
|
||||
hovered_item = ImGui::GetItemID();
|
||||
}
|
||||
|
||||
imgui_context::~imgui_context()
|
||||
{
|
||||
ImGui::SetCurrentContext(context);
|
||||
@@ -1119,7 +1043,7 @@ ImTextureID imgui_context::load_texture(const std::string & filename, vk::raii::
|
||||
|
||||
device.updateDescriptorSets(ds_write, nullptr);
|
||||
|
||||
ImTextureID id = *ds;
|
||||
ImTextureID id = reinterpret_cast<ImTextureID>(VkDescriptorSet(*ds));
|
||||
|
||||
textures.emplace(
|
||||
id,
|
||||
@@ -1159,6 +1083,11 @@ void imgui_context::set_current()
|
||||
ImPlot::SetCurrentContext(plot_context);
|
||||
}
|
||||
|
||||
void imgui_context::set_controllers_enabled(bool value)
|
||||
{
|
||||
controllers_enabled = value;
|
||||
}
|
||||
|
||||
bool imgui_context::is_modal_popup_shown() const
|
||||
{
|
||||
return ImGui::GetTopMostAndVisiblePopupModal() != nullptr;
|
||||
@@ -1174,3 +1103,50 @@ imgui_context::viewport & imgui_context::layer(ImVec2 position)
|
||||
|
||||
return layers_.front();
|
||||
}
|
||||
|
||||
void imgui_context::tooltip(std::string_view text)
|
||||
{
|
||||
// FIXME: this is incorrect if we use the docking branch of imgui
|
||||
ImGuiViewport * viewport = ImGui::GetMainViewport();
|
||||
auto & current_layer = layer(ImGui::GetMousePos());
|
||||
auto pos_backup = viewport->Pos;
|
||||
auto size_backup = viewport->Size;
|
||||
viewport->Pos = ImVec2(current_layer.vp_origin.x, current_layer.vp_origin.y);
|
||||
viewport->Size = ImVec2(current_layer.vp_size.x, current_layer.vp_size.y);
|
||||
|
||||
ImVec2 pos{
|
||||
(ImGui::GetItemRectMin().x + ImGui::GetItemRectMax().x) / 2,
|
||||
ImGui::GetItemRectMin().y - constants::style::tooltip_distance,
|
||||
};
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, constants::style::tooltip_padding);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, constants::style::tooltip_rounding);
|
||||
|
||||
// Clamp position to avoid overflowing on the left or the right
|
||||
auto & style = ImGui::GetStyle();
|
||||
const ImVec2 text_size = ImGui::CalcTextSize(text.data(), text.data() + text.size(), true);
|
||||
const ImVec2 size = {text_size.x + style.WindowPadding.x * 2.0f, text_size.y + style.WindowPadding.y * 2.0f};
|
||||
pos.x = std::clamp<float>(pos.x, viewport->Pos.x + size.x / 2, viewport->Pos.x + viewport->Size.x - size.x / 2);
|
||||
ImVec2 pivot = {0.5, 1};
|
||||
|
||||
// Move tooltip below the item if it overflows on the top
|
||||
if (pos.y - size.y <= viewport->Pos.y)
|
||||
{
|
||||
pos.y = ImGui::GetItemRectMax().y + constants::style::tooltip_distance;
|
||||
pivot.y = 0;
|
||||
}
|
||||
|
||||
ImGui::SetNextWindowPos(pos, ImGuiCond_Always, pivot);
|
||||
if (ImGui::BeginTooltip())
|
||||
{
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, 0xffffffff);
|
||||
ImGui::TextUnformatted(text.data(), text.data() + text.size());
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
ImGui::PopStyleVar(2);
|
||||
|
||||
viewport->Pos = pos_backup;
|
||||
viewport->Size = size_backup;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ public:
|
||||
XrAction scroll; // XR_ACTION_TYPE_VECTOR2F_INPUT
|
||||
// TODO: thresholds?
|
||||
|
||||
XrAction haptic_output;
|
||||
|
||||
xr::hand_tracker * hand = nullptr;
|
||||
};
|
||||
|
||||
@@ -153,13 +155,13 @@ private:
|
||||
XrSpace world;
|
||||
size_t focused_controller = (size_t)-1;
|
||||
XrTime last_display_time = 0;
|
||||
bool controllers_enabled = true;
|
||||
|
||||
bool button_pressed = false;
|
||||
bool fingertip_touching = false;
|
||||
|
||||
ImFontGlyphRangesBuilder glyph_range_builder;
|
||||
ImVector<ImWchar> glyph_ranges;
|
||||
bool glyph_range_dirty = true;
|
||||
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
|
||||
|
||||
#if WIVRN_SHOW_IMGUI_DEMO_WINDOW
|
||||
bool show_demo_window = true;
|
||||
@@ -192,7 +194,6 @@ public:
|
||||
void new_frame(XrTime display_time);
|
||||
std::vector<std::pair<int, XrCompositionLayerQuad>> end_frame();
|
||||
|
||||
ImFont * large_font;
|
||||
size_t get_focused_controller() const
|
||||
{
|
||||
return focused_controller;
|
||||
@@ -209,6 +210,10 @@ public:
|
||||
void free_texture(ImTextureID);
|
||||
void set_current();
|
||||
|
||||
void add_chars(std::string_view sv);
|
||||
bool is_modal_popup_shown() const;
|
||||
|
||||
void vibrate_on_hover();
|
||||
void set_hovered_item();
|
||||
void set_controllers_enabled(bool value);
|
||||
void tooltip(std::string_view text);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2024 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 "scene_components.h"
|
||||
#include <entt/entt.hpp>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
entt::entity find_node_by_name(entt::registry & scene, std::string_view name)
|
||||
{
|
||||
for (auto && [entity, node]: scene.view<components::node>().each())
|
||||
{
|
||||
if (node.name == name)
|
||||
return entity;
|
||||
}
|
||||
|
||||
// TODO custom exception
|
||||
throw std::runtime_error("Node \"" + (std::string)name + "\" not found");
|
||||
}
|
||||
|
||||
entt::entity find_node_by_name(entt::registry & scene, std::string_view name, entt::entity parent)
|
||||
{
|
||||
for (auto && [entity, node]: scene.view<components::node>().each())
|
||||
{
|
||||
if (node.name != name)
|
||||
continue;
|
||||
|
||||
auto current_parent = node.parent;
|
||||
|
||||
do
|
||||
{
|
||||
if (current_parent == parent)
|
||||
return entity;
|
||||
assert(current_parent != scene.get<components::node>(current_parent).parent);
|
||||
current_parent = scene.get<components::node>(current_parent).parent;
|
||||
|
||||
} while (current_parent != entt::null);
|
||||
}
|
||||
|
||||
// TODO custom exception
|
||||
throw std::runtime_error("Node \"" + (std::string)name + "\" not found");
|
||||
}
|
||||
|
||||
std::string get_node_name(const entt::registry & scene, entt::entity entity)
|
||||
{
|
||||
auto name_parent = [&](entt::entity entity) -> std::pair<std::string, entt::entity> {
|
||||
const auto & node = scene.get<components::node>(entity);
|
||||
if (node.name == "")
|
||||
return {std::to_string((int)entity), node.parent};
|
||||
else
|
||||
return {node.name, node.parent};
|
||||
};
|
||||
|
||||
std::string name;
|
||||
std::tie(name, entity) = name_parent(entity);
|
||||
|
||||
while (entity != entt::null)
|
||||
{
|
||||
std::string tmp;
|
||||
std::tie(tmp, entity) = name_parent(entity);
|
||||
name = tmp + "/" + name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
/*
|
||||
* 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 <array>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <entt/entity/entity.hpp>
|
||||
#include <glm/ext/quaternion_float.hpp>
|
||||
#include <glm/vec3.hpp>
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
|
||||
#include "utils/magic_hash.h"
|
||||
#include "vk/allocation.h"
|
||||
|
||||
namespace renderer
|
||||
{
|
||||
struct sampler_info
|
||||
{
|
||||
vk::Filter mag_filter = vk::Filter::eLinear;
|
||||
vk::Filter min_filter = vk::Filter::eLinear;
|
||||
vk::SamplerMipmapMode min_filter_mipmap = vk::SamplerMipmapMode::eLinear;
|
||||
vk::SamplerAddressMode wrapS = vk::SamplerAddressMode::eRepeat;
|
||||
vk::SamplerAddressMode wrapT = vk::SamplerAddressMode::eRepeat;
|
||||
|
||||
bool operator==(const sampler_info & other) const noexcept = default;
|
||||
};
|
||||
|
||||
struct texture
|
||||
{
|
||||
std::shared_ptr<vk::raii::ImageView> image_view;
|
||||
sampler_info sampler;
|
||||
};
|
||||
|
||||
struct material
|
||||
{
|
||||
struct gpu_data
|
||||
{
|
||||
glm::vec4 base_color_factor = glm::vec4(1, 1, 1, 1);
|
||||
glm::vec4 base_emissive_factor = glm::vec4(0, 0, 0, 0);
|
||||
float metallic_factor = 1;
|
||||
float roughness_factor = 1;
|
||||
float occlusion_strength = 0;
|
||||
float normal_scale = 0;
|
||||
|
||||
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?
|
||||
};
|
||||
|
||||
std::shared_ptr<texture> base_color_texture;
|
||||
std::shared_ptr<texture> metallic_roughness_texture;
|
||||
std::shared_ptr<texture> occlusion_texture;
|
||||
std::shared_ptr<texture> emissive_texture;
|
||||
std::shared_ptr<texture> normal_texture;
|
||||
|
||||
// Disable back face culling with this material
|
||||
bool double_sided = true;
|
||||
|
||||
// TODO transparency
|
||||
// fastgltf::AlphaMode alphaMode;
|
||||
// float alpha_cutoff;
|
||||
|
||||
gpu_data staging;
|
||||
|
||||
// Resources used by this material
|
||||
std::shared_ptr<buffer_allocation> buffer;
|
||||
size_t offset;
|
||||
|
||||
// The descriptor set is managed by the scene renderer, it is updated whenever ds_dirty is true
|
||||
// Bindings 0-4: textures
|
||||
// Binding 5: uniform buffer
|
||||
std::shared_ptr<vk::raii::DescriptorSet> ds;
|
||||
|
||||
// Set to true to update the descriptor set at the next frame
|
||||
bool ds_dirty;
|
||||
|
||||
std::string name;
|
||||
std::string shader_name = "lit";
|
||||
bool blend_enable = true;
|
||||
};
|
||||
|
||||
struct primitive
|
||||
{
|
||||
bool indexed;
|
||||
uint32_t index_count;
|
||||
uint32_t vertex_count;
|
||||
vk::IndexType index_type;
|
||||
vk::DeviceSize index_offset;
|
||||
vk::DeviceSize vertex_offset;
|
||||
|
||||
// See also material::double_sided
|
||||
vk::CullModeFlagBits cull_mode = vk::CullModeFlagBits::eNone;
|
||||
vk::FrontFace front_face = vk::FrontFace::eClockwise;
|
||||
vk::PrimitiveTopology topology = vk::PrimitiveTopology::eTriangleList;
|
||||
|
||||
std::shared_ptr<material> material_;
|
||||
};
|
||||
|
||||
struct mesh
|
||||
{
|
||||
std::vector<primitive> primitives;
|
||||
std::shared_ptr<buffer_allocation> buffer;
|
||||
};
|
||||
|
||||
// TODO move vertex class in .cpp, put vertex description in the primitive
|
||||
struct vertex
|
||||
{
|
||||
glm::vec3 position;
|
||||
glm::vec3 normal;
|
||||
glm::vec3 tangent;
|
||||
std::array<glm::vec2, 2> texcoord;
|
||||
glm::vec4 color;
|
||||
std::array<glm::vec4, 1> joints;
|
||||
std::array<glm::vec4, 1> weights;
|
||||
|
||||
struct description
|
||||
{
|
||||
vk::VertexInputBindingDescription binding;
|
||||
std::vector<vk::VertexInputAttributeDescription> attributes;
|
||||
std::vector<std::string> attribute_names;
|
||||
|
||||
vk::PipelineVertexInputStateCreateFlags flags{};
|
||||
};
|
||||
|
||||
static description describe();
|
||||
};
|
||||
} // namespace renderer
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<renderer::sampler_info> : utils::magic_hash<renderer::sampler_info>
|
||||
{};
|
||||
} // namespace std
|
||||
|
||||
namespace components
|
||||
{
|
||||
struct node
|
||||
{
|
||||
entt::entity parent = entt::null;
|
||||
std::string name;
|
||||
std::shared_ptr<renderer::mesh> mesh;
|
||||
|
||||
glm::vec3 position = {0, 0, 0};
|
||||
glm::quat orientation = {1, 0, 0, 0};
|
||||
glm::vec3 scale = {1, 1, 1};
|
||||
bool visible = true;
|
||||
uint32_t layer_mask = -1;
|
||||
|
||||
std::array<glm::vec4, 4> clipping_planes;
|
||||
|
||||
// TODO: separate component?
|
||||
std::vector<std::pair<entt::entity, glm::mat4>> joints; // Node index, inverse bind matrix of each joint
|
||||
|
||||
// For internal use by the renderer
|
||||
glm::mat4 transform_to_root;
|
||||
bool global_visible;
|
||||
bool reverse_side;
|
||||
uint32_t global_layer_mask;
|
||||
};
|
||||
} // namespace components
|
||||
|
||||
entt::entity find_node_by_name(entt::registry & scene, std::string_view name);
|
||||
entt::entity find_node_by_name(entt::registry & scene, std::string_view name, entt::entity parent);
|
||||
std::string get_node_name(const entt::registry & scene, entt::entity entity);
|
||||
@@ -1,992 +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/>.
|
||||
*/
|
||||
|
||||
#include "render/scene_data.h"
|
||||
|
||||
#include "image_loader.h"
|
||||
#include "render/gpu_buffer.h"
|
||||
#include "utils/fmt_glm.h"
|
||||
#include "utils/ranges.h"
|
||||
#include <boost/pfr/core.hpp>
|
||||
#include <fastgltf/base64.hpp>
|
||||
#include <fastgltf/core.hpp>
|
||||
#include <fastgltf/glm_element_traits.hpp>
|
||||
#include <fastgltf/tools.hpp>
|
||||
#include <fastgltf/types.hpp>
|
||||
#include <fastgltf/util.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
#include <ranges>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
#include <variant>
|
||||
#include <vk_mem_alloc.h>
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
|
||||
#include "asset.h"
|
||||
|
||||
template <class T>
|
||||
constexpr vk::Format vk_attribute_format = vk::Format::eUndefined;
|
||||
template <>
|
||||
constexpr vk::Format vk_attribute_format<float> = vk::Format::eR32Sfloat;
|
||||
template <>
|
||||
constexpr vk::Format vk_attribute_format<glm::vec2> = vk::Format::eR32G32Sfloat;
|
||||
template <>
|
||||
constexpr vk::Format vk_attribute_format<glm::vec3> = vk::Format::eR32G32B32Sfloat;
|
||||
template <>
|
||||
constexpr vk::Format vk_attribute_format<glm::vec4> = vk::Format::eR32G32B32A32Sfloat;
|
||||
template <typename T, size_t N>
|
||||
constexpr vk::Format vk_attribute_format<std::array<T, N>> = vk_attribute_format<T>;
|
||||
|
||||
template <class T>
|
||||
constexpr size_t nb_attributes = 1;
|
||||
template <typename T, size_t N>
|
||||
constexpr size_t nb_attributes<std::array<T, N>> = N;
|
||||
|
||||
template <class T>
|
||||
struct remove_array
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
template <class T, size_t N>
|
||||
struct remove_array<std::array<T, N>>
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
template <class T>
|
||||
using remove_array_t = remove_array<T>::type;
|
||||
|
||||
template <class T>
|
||||
struct is_array : std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <class T, size_t N>
|
||||
struct is_array<std::array<T, N>> : std::true_type
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
constexpr bool is_array_v = is_array<T>::value;
|
||||
|
||||
scene_data::vertex::description scene_data::vertex::describe()
|
||||
{
|
||||
scene_data::vertex::description desc;
|
||||
|
||||
desc.binding = vk::VertexInputBindingDescription{
|
||||
.binding = 0,
|
||||
.stride = sizeof(vertex),
|
||||
.inputRate = vk::VertexInputRate::eVertex,
|
||||
};
|
||||
|
||||
vk::VertexInputAttributeDescription attribute{
|
||||
.location = 0,
|
||||
.binding = 0,
|
||||
};
|
||||
|
||||
#define VERTEX_ATTR(member) \
|
||||
attribute.format = vk_attribute_format<decltype(vertex::member)>; \
|
||||
for (size_t i = 0; i < nb_attributes<decltype(vertex::member)>; i++) \
|
||||
{ \
|
||||
attribute.offset = offsetof(vertex, member) + i * sizeof(remove_array_t<decltype(vertex::member)>); \
|
||||
desc.attributes.push_back(attribute); \
|
||||
attribute.location++; \
|
||||
if (is_array_v<decltype(vertex::member)>) \
|
||||
{ \
|
||||
desc.attribute_names.push_back(#member "_" + std::to_string(i)); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
desc.attribute_names.push_back(#member); \
|
||||
} \
|
||||
}
|
||||
|
||||
VERTEX_ATTR(position);
|
||||
VERTEX_ATTR(normal);
|
||||
VERTEX_ATTR(tangent);
|
||||
VERTEX_ATTR(texcoord);
|
||||
VERTEX_ATTR(color);
|
||||
VERTEX_ATTR(joints);
|
||||
VERTEX_ATTR(weights);
|
||||
|
||||
static_assert(vertex{}.joints.size() == vertex{}.weights.size());
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
// Conversion functions gltf -> vulkan
|
||||
namespace
|
||||
{
|
||||
fastgltf::Asset load_gltf_asset(fastgltf::GltfDataBuffer & buffer, const std::filesystem::path & directory)
|
||||
{
|
||||
fastgltf::Parser parser(fastgltf::Extensions::KHR_texture_basisu);
|
||||
|
||||
auto gltf_options =
|
||||
fastgltf::Options::DontRequireValidAssetMember |
|
||||
fastgltf::Options::AllowDouble |
|
||||
fastgltf::Options::LoadGLBBuffers |
|
||||
fastgltf::Options::DecomposeNodeMatrices;
|
||||
|
||||
auto expected_asset = parser.loadGltf(&buffer, directory, gltf_options);
|
||||
|
||||
if (auto error = expected_asset.error(); error != fastgltf::Error::None)
|
||||
throw std::runtime_error(std::string(fastgltf::getErrorMessage(error)));
|
||||
|
||||
return std::move(expected_asset.get());
|
||||
}
|
||||
|
||||
std::pair<vk::Filter, vk::SamplerMipmapMode> convert(fastgltf::Filter filter)
|
||||
{
|
||||
switch (filter)
|
||||
{
|
||||
case fastgltf::Filter::Nearest:
|
||||
case fastgltf::Filter::NearestMipMapNearest:
|
||||
return {vk::Filter::eNearest, vk::SamplerMipmapMode::eNearest};
|
||||
|
||||
case fastgltf::Filter::Linear:
|
||||
case fastgltf::Filter::LinearMipMapNearest:
|
||||
return {vk::Filter::eLinear, vk::SamplerMipmapMode::eNearest};
|
||||
|
||||
case fastgltf::Filter::NearestMipMapLinear:
|
||||
return {vk::Filter::eNearest, vk::SamplerMipmapMode::eLinear};
|
||||
|
||||
case fastgltf::Filter::LinearMipMapLinear:
|
||||
return {vk::Filter::eLinear, vk::SamplerMipmapMode::eLinear};
|
||||
}
|
||||
|
||||
throw std::invalid_argument("filter");
|
||||
}
|
||||
|
||||
vk::SamplerAddressMode convert(fastgltf::Wrap wrap)
|
||||
{
|
||||
switch (wrap)
|
||||
{
|
||||
case fastgltf::Wrap::ClampToEdge:
|
||||
return vk::SamplerAddressMode::eClampToEdge;
|
||||
|
||||
case fastgltf::Wrap::MirroredRepeat:
|
||||
return vk::SamplerAddressMode::eMirroredRepeat;
|
||||
|
||||
case fastgltf::Wrap::Repeat:
|
||||
return vk::SamplerAddressMode::eRepeat;
|
||||
}
|
||||
|
||||
throw std::invalid_argument("wrap");
|
||||
}
|
||||
|
||||
sampler_info convert(fastgltf::Sampler & sampler)
|
||||
{
|
||||
sampler_info info;
|
||||
|
||||
info.mag_filter = convert(sampler.magFilter.value_or(fastgltf::Filter::Linear)).first;
|
||||
|
||||
std::tie(info.min_filter, info.min_filter_mipmap) = convert(sampler.minFilter.value_or(fastgltf::Filter::LinearMipMapLinear));
|
||||
|
||||
info.wrapS = convert(sampler.wrapS);
|
||||
info.wrapT = convert(sampler.wrapT);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
vk::PrimitiveTopology convert(fastgltf::PrimitiveType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case fastgltf::PrimitiveType::Points:
|
||||
return vk::PrimitiveTopology::ePointList;
|
||||
|
||||
case fastgltf::PrimitiveType::Lines:
|
||||
return vk::PrimitiveTopology::eLineList;
|
||||
|
||||
case fastgltf::PrimitiveType::LineLoop:
|
||||
throw std::runtime_error("Unimplemented");
|
||||
|
||||
case fastgltf::PrimitiveType::LineStrip:
|
||||
return vk::PrimitiveTopology::eLineStrip;
|
||||
|
||||
case fastgltf::PrimitiveType::Triangles:
|
||||
return vk::PrimitiveTopology::eTriangleList;
|
||||
|
||||
case fastgltf::PrimitiveType::TriangleStrip:
|
||||
return vk::PrimitiveTopology::eTriangleStrip;
|
||||
|
||||
case fastgltf::PrimitiveType::TriangleFan:
|
||||
return vk::PrimitiveTopology::eTriangleFan;
|
||||
}
|
||||
|
||||
throw std::invalid_argument("type");
|
||||
}
|
||||
|
||||
glm::vec4 convert(const std::array<float, 4> & v)
|
||||
{
|
||||
return {v[0], v[1], v[2], v[3]};
|
||||
}
|
||||
|
||||
glm::vec3 convert(const std::array<float, 3> & v)
|
||||
{
|
||||
return {v[0], v[1], v[2]};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
template <typename T>
|
||||
requires is_array_v<T>
|
||||
void copy_vertex_attributes(
|
||||
const fastgltf::Asset & asset,
|
||||
const fastgltf::Primitive & primitive,
|
||||
std::string attribute_name,
|
||||
std::vector<scene_data::vertex> & vertices,
|
||||
T scene_data::vertex::*attribute)
|
||||
{
|
||||
using U = T::value_type;
|
||||
constexpr size_t N = std::tuple_size_v<T>;
|
||||
|
||||
for (size_t i = 0; i < N; i++)
|
||||
{
|
||||
auto it = primitive.findAttribute(attribute_name + std::to_string(i));
|
||||
|
||||
if (it == primitive.attributes.end())
|
||||
continue;
|
||||
|
||||
const fastgltf::Accessor & accessor = asset.accessors.at(it->second);
|
||||
|
||||
if (vertices.size() < accessor.count)
|
||||
vertices.resize(accessor.count, {});
|
||||
|
||||
fastgltf::iterateAccessorWithIndex<U>(asset, accessor, [&](U value, std::size_t idx) {
|
||||
(vertices[idx].*attribute)[i] = value;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires(!is_array_v<T>)
|
||||
void copy_vertex_attributes(
|
||||
const fastgltf::Asset & asset,
|
||||
const fastgltf::Primitive & primitive,
|
||||
std::string attribute_name,
|
||||
std::vector<scene_data::vertex> & vertices,
|
||||
T scene_data::vertex::*attribute)
|
||||
{
|
||||
auto it = primitive.findAttribute(attribute_name);
|
||||
|
||||
if (it == primitive.attributes.end())
|
||||
return;
|
||||
|
||||
const fastgltf::Accessor & accessor = asset.accessors.at(it->second);
|
||||
|
||||
if (vertices.size() < accessor.count)
|
||||
vertices.resize(accessor.count, {});
|
||||
|
||||
fastgltf::iterateAccessorWithIndex<T>(asset, accessor, [&](T value, std::size_t idx) {
|
||||
vertices[idx].*attribute = value;
|
||||
});
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr bool starts_with(std::span<const std::byte> data, std::span<const uint8_t> prefix)
|
||||
{
|
||||
return data.size() >= prefix.size() && !memcmp(data.data(), prefix.data(), prefix.size());
|
||||
}
|
||||
|
||||
fastgltf::MimeType guess_mime_type(std::span<const std::byte> image_data)
|
||||
{
|
||||
const uint8_t jpeg_magic[] = {0xFF, 0xD8, 0xFF};
|
||||
const uint8_t png_magic[] = {0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A};
|
||||
const uint8_t ktx1_magic[] = {0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A};
|
||||
const uint8_t ktx2_magic[] = {0xAB, 0x4B, 0x54, 0x58, 0x20, 0x32, 0x30, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A};
|
||||
|
||||
if (starts_with(image_data, png_magic))
|
||||
return fastgltf::MimeType::PNG;
|
||||
else if (starts_with(image_data, jpeg_magic))
|
||||
return fastgltf::MimeType::JPEG;
|
||||
else if (starts_with(image_data, ktx1_magic))
|
||||
return fastgltf::MimeType::KTX2;
|
||||
else if (starts_with(image_data, ktx2_magic))
|
||||
return fastgltf::MimeType::KTX2;
|
||||
else
|
||||
return fastgltf::MimeType::None;
|
||||
}
|
||||
|
||||
std::shared_ptr<vk::raii::ImageView> do_load_image(
|
||||
vk::raii::PhysicalDevice & physical_device,
|
||||
vk::raii::Device & device,
|
||||
vk::raii::Queue & queue,
|
||||
vk::raii::CommandPool & cb_pool,
|
||||
std::span<const std::byte> image_data,
|
||||
bool srgb)
|
||||
{
|
||||
switch (guess_mime_type(image_data))
|
||||
{
|
||||
case fastgltf::MimeType::JPEG:
|
||||
case fastgltf::MimeType::PNG:
|
||||
case fastgltf::MimeType::KTX2: {
|
||||
try
|
||||
{
|
||||
image_loader loader(physical_device, device, queue, cb_pool);
|
||||
loader.load(image_data, srgb);
|
||||
|
||||
spdlog::debug("Loaded image {}x{}, format {}, {} mipmaps", loader.extent.width, loader.extent.height, vk::to_string(loader.format), loader.num_mipmaps);
|
||||
return loader.image_view;
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
spdlog::info("Cannot load image: {}", e.what());
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
spdlog::error("Unsupported image MIME type");
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
class loader_context
|
||||
{
|
||||
std::filesystem::path base_directory;
|
||||
fastgltf::Asset & gltf;
|
||||
vk::raii::PhysicalDevice physical_device;
|
||||
vk::raii::Device & device;
|
||||
vk::raii::Queue & queue;
|
||||
vk::raii::CommandPool & cb_pool;
|
||||
|
||||
std::vector<asset> loaded_assets;
|
||||
asset & load_from_asset(const std::filesystem::path & path)
|
||||
{
|
||||
return loaded_assets.emplace_back(path);
|
||||
}
|
||||
|
||||
public:
|
||||
loader_context(std::filesystem::path base_directory,
|
||||
fastgltf::Asset & gltf,
|
||||
vk::raii::PhysicalDevice physical_device,
|
||||
vk::raii::Device & device,
|
||||
vk::raii::Queue & queue,
|
||||
vk::raii::CommandPool & cb_pool) :
|
||||
base_directory(base_directory),
|
||||
gltf(gltf),
|
||||
physical_device(physical_device),
|
||||
device(device),
|
||||
queue(queue),
|
||||
cb_pool(cb_pool)
|
||||
{
|
||||
}
|
||||
|
||||
fastgltf::span<const std::byte> load(const fastgltf::URI & uri)
|
||||
{
|
||||
auto path = base_directory.empty() ? std::filesystem::path(uri.path()) : base_directory / std::filesystem::path(uri.path());
|
||||
std::span<const std::byte> bytes;
|
||||
|
||||
bytes = load_from_asset(path);
|
||||
|
||||
return fastgltf::span<const std::byte>(bytes.data(), bytes.size());
|
||||
}
|
||||
|
||||
fastgltf::span<const std::byte> load(const fastgltf::sources::URI & uri)
|
||||
{
|
||||
return load(uri.uri);
|
||||
}
|
||||
|
||||
template <typename T, std::size_t Extent>
|
||||
fastgltf::span<T, fastgltf::dynamic_extent> subspan(fastgltf::span<T, Extent> span, size_t offset, size_t count = fastgltf::dynamic_extent)
|
||||
{
|
||||
assert(offset < span.size());
|
||||
assert(count == fastgltf::dynamic_extent || count <= span.size() - offset);
|
||||
|
||||
if (count == fastgltf::dynamic_extent)
|
||||
count = span.size() - offset;
|
||||
|
||||
return fastgltf::span<T>{span.data() + offset, count};
|
||||
}
|
||||
|
||||
fastgltf::sources::ByteView visit_source(fastgltf::DataSource & source)
|
||||
{
|
||||
using return_type = fastgltf::sources::ByteView;
|
||||
|
||||
return std::visit(fastgltf::visitor{
|
||||
[&](std::monostate) -> return_type {
|
||||
throw std::runtime_error("Invalid source");
|
||||
},
|
||||
[&](fastgltf::sources::Fallback) -> return_type {
|
||||
throw std::runtime_error("Invalid source");
|
||||
},
|
||||
[&](const fastgltf::sources::BufferView & buffer_view) -> return_type {
|
||||
fastgltf::BufferView & view = gltf.bufferViews.at(buffer_view.bufferViewIndex);
|
||||
|
||||
fastgltf::Buffer & buffer = gltf.buffers.at(view.bufferIndex);
|
||||
|
||||
auto buffer2 = visit_source(buffer.data);
|
||||
|
||||
return {subspan(buffer2.bytes, view.byteOffset, view.byteLength), buffer_view.mimeType};
|
||||
},
|
||||
[&](const fastgltf::sources::URI & uri) -> return_type {
|
||||
if (!uri.uri.isLocalPath())
|
||||
throw std::runtime_error("Non local paths are not supported"); // TODO ?
|
||||
|
||||
fastgltf::span<const std::byte> data = load(uri);
|
||||
|
||||
// Don't use the MIME type from fastgltf, it's not initialized for URIs
|
||||
return {subspan(data, uri.fileByteOffset), fastgltf::MimeType::None};
|
||||
},
|
||||
[&](const fastgltf::sources::Vector & vector) -> return_type {
|
||||
fastgltf::span<const std::byte> data{reinterpret_cast<const std::byte *>(vector.bytes.data()), vector.bytes.size()};
|
||||
return {data, vector.mimeType};
|
||||
},
|
||||
[&](const fastgltf::sources::Array & array) -> return_type {
|
||||
fastgltf::span<const std::byte> data{reinterpret_cast<const std::byte *>(array.bytes.data()), array.bytes.size()};
|
||||
return {data, array.mimeType};
|
||||
},
|
||||
[&](const fastgltf::sources::CustomBuffer & custom_buffer) -> return_type {
|
||||
throw std::runtime_error("Unimplemented source CustomBuffer");
|
||||
// TODO ?
|
||||
},
|
||||
[&](fastgltf::sources::ByteView & byte_view) -> return_type {
|
||||
return {byte_view.bytes, byte_view.mimeType};
|
||||
}},
|
||||
source);
|
||||
}
|
||||
|
||||
std::unordered_map<int, std::shared_ptr<vk::raii::ImageView>> images;
|
||||
std::shared_ptr<vk::raii::ImageView> load_image(int index, bool srgb)
|
||||
{
|
||||
auto it = images.find(index);
|
||||
if (it != images.end())
|
||||
return it->second;
|
||||
|
||||
try
|
||||
{
|
||||
auto [image_data, mime_type] = visit_source(gltf.images[index].data);
|
||||
auto image = do_load_image(physical_device, device, queue, cb_pool, image_data, srgb);
|
||||
|
||||
images.emplace(index, image);
|
||||
return image;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<scene_data::texture>> load_all_textures()
|
||||
{
|
||||
// Determine which texture is sRGB
|
||||
std::vector<uint8_t> srgb_array;
|
||||
srgb_array.resize(gltf.textures.size(), false);
|
||||
for (const fastgltf::Material & gltf_material: gltf.materials)
|
||||
{
|
||||
if (gltf_material.pbrData.baseColorTexture)
|
||||
srgb_array.at(gltf_material.pbrData.baseColorTexture->textureIndex) = true;
|
||||
|
||||
if (gltf_material.emissiveTexture)
|
||||
srgb_array.at(gltf_material.emissiveTexture->textureIndex) = true;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<scene_data::texture>> textures;
|
||||
textures.reserve(gltf.textures.size());
|
||||
for (auto && [srgb, gltf_texture]: std::views::zip(srgb_array, gltf.textures))
|
||||
{
|
||||
auto & texture_ref = *textures.emplace_back(std::make_shared<scene_data::texture>());
|
||||
|
||||
if (gltf_texture.samplerIndex)
|
||||
{
|
||||
fastgltf::Sampler & sampler = gltf.samplers.at(*gltf_texture.samplerIndex);
|
||||
texture_ref.sampler = convert(sampler);
|
||||
}
|
||||
|
||||
if (gltf_texture.basisuImageIndex)
|
||||
{
|
||||
texture_ref.image_view = load_image(*gltf_texture.basisuImageIndex, srgb);
|
||||
if (texture_ref.image_view)
|
||||
continue;
|
||||
}
|
||||
|
||||
// if (gltf_texture.ddsImageIndex)
|
||||
// {
|
||||
// // TODO
|
||||
// }
|
||||
|
||||
// if (gltf_texture.webpImageIndex)
|
||||
// {
|
||||
// // TODO
|
||||
// }
|
||||
|
||||
if (gltf_texture.imageIndex)
|
||||
{
|
||||
texture_ref.image_view = load_image(*gltf_texture.imageIndex, srgb);
|
||||
if (texture_ref.image_view)
|
||||
continue;
|
||||
}
|
||||
|
||||
throw std::runtime_error("Unsupported image type");
|
||||
}
|
||||
|
||||
return textures;
|
||||
}
|
||||
|
||||
void load_all_buffers()
|
||||
{
|
||||
for (fastgltf::Buffer & buffer: gltf.buffers)
|
||||
{
|
||||
if (std::holds_alternative<fastgltf::sources::URI>(buffer.data))
|
||||
{
|
||||
fastgltf::sources::URI uri = std::get<fastgltf::sources::URI>(buffer.data);
|
||||
|
||||
// Don't use the MIME type from fastgltf, it's not initialized for URIs
|
||||
buffer.data = fastgltf::sources::ByteView(load(uri), fastgltf::MimeType::None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<scene_data::material>> load_all_materials(std::vector<std::shared_ptr<scene_data::texture>> & textures, gpu_buffer & staging_buffer, const scene_data::material & default_material)
|
||||
{
|
||||
std::vector<std::shared_ptr<scene_data::material>> materials;
|
||||
materials.reserve(gltf.materials.size());
|
||||
for (const fastgltf::Material & gltf_material: gltf.materials)
|
||||
{
|
||||
// Copy the default material, without references to its buffer or descriptor set
|
||||
auto & material_ref = *materials.emplace_back(std::make_shared<scene_data::material>(default_material));
|
||||
material_ref.name = gltf_material.name;
|
||||
spdlog::info("Loading material \"{}\"", material_ref.name);
|
||||
material_ref.buffer.reset();
|
||||
material_ref.ds.reset();
|
||||
|
||||
material_ref.double_sided = gltf_material.doubleSided;
|
||||
|
||||
scene_data::material::gpu_data & material_data = material_ref.staging;
|
||||
|
||||
material_data.base_color_factor = convert(gltf_material.pbrData.baseColorFactor);
|
||||
material_data.base_emissive_factor = glm::vec4(convert(gltf_material.emissiveFactor), 0);
|
||||
material_data.metallic_factor = gltf_material.pbrData.metallicFactor;
|
||||
material_data.roughness_factor = gltf_material.pbrData.roughnessFactor;
|
||||
|
||||
if (gltf_material.pbrData.baseColorTexture)
|
||||
{
|
||||
material_ref.base_color_texture = textures.at(gltf_material.pbrData.baseColorTexture->textureIndex);
|
||||
material_data.base_color_texcoord = gltf_material.pbrData.baseColorTexture->texCoordIndex;
|
||||
}
|
||||
|
||||
if (gltf_material.pbrData.metallicRoughnessTexture)
|
||||
{
|
||||
material_ref.metallic_roughness_texture = textures.at(gltf_material.pbrData.metallicRoughnessTexture->textureIndex);
|
||||
material_data.metallic_roughness_texcoord = gltf_material.pbrData.metallicRoughnessTexture->texCoordIndex;
|
||||
}
|
||||
|
||||
if (gltf_material.occlusionTexture)
|
||||
{
|
||||
material_ref.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_ref.emissive_texture = textures.at(gltf_material.emissiveTexture->textureIndex);
|
||||
material_data.emissive_texcoord = gltf_material.emissiveTexture->texCoordIndex;
|
||||
}
|
||||
|
||||
if (gltf_material.normalTexture)
|
||||
{
|
||||
material_ref.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_ref.offset = staging_buffer.add_uniform(material_data);
|
||||
}
|
||||
|
||||
return materials;
|
||||
}
|
||||
|
||||
std::vector<scene_data::mesh> load_all_meshes(std::vector<std::shared_ptr<scene_data::material>> & materials, gpu_buffer & staging_buffer)
|
||||
{
|
||||
std::vector<scene_data::mesh> meshes;
|
||||
meshes.reserve(gltf.meshes.size());
|
||||
for (const fastgltf::Mesh & gltf_mesh: gltf.meshes)
|
||||
{
|
||||
auto & mesh_ref = meshes.emplace_back();
|
||||
|
||||
mesh_ref.primitives.reserve(gltf_mesh.primitives.size());
|
||||
|
||||
for (const fastgltf::Primitive & gltf_primitive: gltf_mesh.primitives)
|
||||
{
|
||||
auto & primitive_ref = mesh_ref.primitives.emplace_back();
|
||||
|
||||
if (gltf_primitive.indicesAccessor)
|
||||
{
|
||||
fastgltf::Accessor & indices_accessor = gltf.accessors.at(*gltf_primitive.indicesAccessor);
|
||||
|
||||
primitive_ref.indexed = true;
|
||||
primitive_ref.index_offset = 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;
|
||||
}
|
||||
|
||||
std::vector<scene_data::vertex> vertices;
|
||||
|
||||
copy_vertex_attributes(gltf, gltf_primitive, "POSITION", vertices, &scene_data::vertex::position);
|
||||
copy_vertex_attributes(gltf, gltf_primitive, "NORMAL", vertices, &scene_data::vertex::normal);
|
||||
copy_vertex_attributes(gltf, gltf_primitive, "TANGENT", vertices, &scene_data::vertex::tangent);
|
||||
copy_vertex_attributes(gltf, gltf_primitive, "TEXCOORD_", vertices, &scene_data::vertex::texcoord);
|
||||
copy_vertex_attributes(gltf, gltf_primitive, "COLOR", vertices, &scene_data::vertex::color);
|
||||
copy_vertex_attributes(gltf, gltf_primitive, "JOINTS_", vertices, &scene_data::vertex::joints);
|
||||
copy_vertex_attributes(gltf, gltf_primitive, "WEIGHTS_", vertices, &scene_data::vertex::weights);
|
||||
|
||||
primitive_ref.vertex_offset = staging_buffer.add_vertices(vertices);
|
||||
primitive_ref.vertex_count = vertices.size();
|
||||
|
||||
primitive_ref.cull_mode = vk::CullModeFlagBits::eBack; // TBC
|
||||
primitive_ref.front_face = vk::FrontFace::eCounterClockwise; // TBC
|
||||
primitive_ref.topology = convert(gltf_primitive.type);
|
||||
|
||||
if (gltf_primitive.materialIndex)
|
||||
primitive_ref.material_ = materials.at(*gltf_primitive.materialIndex);
|
||||
}
|
||||
}
|
||||
|
||||
return meshes;
|
||||
}
|
||||
|
||||
std::vector<scene_data::node> load_all_nodes()
|
||||
{
|
||||
std::vector<scene_data::node> unsorted_objects;
|
||||
unsorted_objects.resize(gltf.nodes.size(), {.parent_id = scene_data::node::root_id});
|
||||
|
||||
for (const auto & [index, gltf_node]: utils::enumerate(gltf.nodes))
|
||||
{
|
||||
if (gltf_node.meshIndex)
|
||||
unsorted_objects[index].mesh_id = *gltf_node.meshIndex;
|
||||
|
||||
if (gltf_node.skinIndex)
|
||||
{
|
||||
auto & skin = gltf.skins.at(*gltf_node.skinIndex);
|
||||
|
||||
unsorted_objects[index].joints.resize(skin.joints.size());
|
||||
|
||||
for (auto [i, joint_index]: utils::enumerate(skin.joints))
|
||||
unsorted_objects[index].joints.at(i).first = joint_index;
|
||||
|
||||
if (skin.inverseBindMatrices)
|
||||
{
|
||||
const fastgltf::Accessor & accessor = gltf.accessors.at(*skin.inverseBindMatrices);
|
||||
|
||||
fastgltf::iterateAccessorWithIndex<glm::mat4>(gltf, accessor, [&](const glm::mat4 & value, std::size_t idx) {
|
||||
unsorted_objects[index].joints.at(idx).second = value;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t child: gltf_node.children)
|
||||
{
|
||||
unsorted_objects[child].parent_id = index;
|
||||
}
|
||||
|
||||
auto TRS = std::get<fastgltf::TRS>(gltf_node.transform);
|
||||
|
||||
unsorted_objects[index].position = glm::make_vec3(TRS.translation.data());
|
||||
unsorted_objects[index].orientation = glm::make_quat(TRS.rotation.data());
|
||||
unsorted_objects[index].scale = glm::make_vec3(TRS.scale.data());
|
||||
unsorted_objects[index].visible = true;
|
||||
unsorted_objects[index].name = gltf_node.name;
|
||||
std::ranges::fill(unsorted_objects[index].clipping_planes, glm::vec4{0, 0, 0, 1});
|
||||
}
|
||||
|
||||
return unsorted_objects;
|
||||
}
|
||||
|
||||
std::vector<scene_data::node> topological_sort(const std::vector<scene_data::node> & unsorted_nodes)
|
||||
{
|
||||
std::vector<scene_data::node> sorted_nodes;
|
||||
std::vector<size_t> new_index;
|
||||
std::vector<bool> already_sorted;
|
||||
|
||||
sorted_nodes.reserve(unsorted_nodes.size());
|
||||
already_sorted.resize(unsorted_nodes.size(), false);
|
||||
new_index.resize(unsorted_nodes.size(), scene_data::node::root_id);
|
||||
|
||||
[[maybe_unused]] bool loop_detected = true;
|
||||
|
||||
while (sorted_nodes.size() < unsorted_nodes.size())
|
||||
{
|
||||
for (size_t i = 0; i < unsorted_nodes.size(); i++)
|
||||
{
|
||||
if (already_sorted[i])
|
||||
continue;
|
||||
|
||||
if (unsorted_nodes[i].parent_id == scene_data::node::root_id)
|
||||
{
|
||||
sorted_nodes.push_back(unsorted_nodes[i]);
|
||||
already_sorted[i] = true;
|
||||
new_index[i] = sorted_nodes.size() - 1;
|
||||
loop_detected = false;
|
||||
}
|
||||
else if (already_sorted[unsorted_nodes[i].parent_id])
|
||||
{
|
||||
sorted_nodes.emplace_back(unsorted_nodes[i]).parent_id = new_index[unsorted_nodes[i].parent_id];
|
||||
already_sorted[i] = true;
|
||||
new_index[i] = sorted_nodes.size() - 1;
|
||||
loop_detected = false;
|
||||
}
|
||||
}
|
||||
|
||||
assert(!loop_detected);
|
||||
}
|
||||
|
||||
// renumber joint indices
|
||||
for (auto & node: sorted_nodes)
|
||||
{
|
||||
for (auto & joint: node.joints)
|
||||
{
|
||||
joint.first = new_index[joint.first];
|
||||
}
|
||||
}
|
||||
|
||||
assert(sorted_nodes.size() == unsorted_nodes.size());
|
||||
for (size_t i = 0; i < sorted_nodes.size(); i++)
|
||||
{
|
||||
assert(sorted_nodes[i].parent_id == scene_data::node::root_id || sorted_nodes[i].parent_id < i);
|
||||
}
|
||||
|
||||
return sorted_nodes;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
scene_data scene_loader::operator()(const std::filesystem::path & gltf_path)
|
||||
{
|
||||
vk::PhysicalDeviceProperties physical_device_properties = physical_device.getProperties();
|
||||
vk::raii::CommandPool cb_pool{device, vk::CommandPoolCreateInfo{
|
||||
.flags = vk::CommandPoolCreateFlagBits::eTransient | vk::CommandPoolCreateFlagBits::eResetCommandBuffer,
|
||||
.queueFamilyIndex = queue_family_index,
|
||||
}};
|
||||
|
||||
scene_data data;
|
||||
|
||||
asset asset_file(gltf_path);
|
||||
fastgltf::GltfDataBuffer data_buffer;
|
||||
data_buffer.copyBytes(reinterpret_cast<const uint8_t *>(asset_file.data()), asset_file.size());
|
||||
|
||||
fastgltf::Asset asset = load_gltf_asset(data_buffer, gltf_path.parent_path());
|
||||
loader_context ctx(gltf_path.parent_path(), asset, physical_device, device, queue, cb_pool);
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (auto error = fastgltf::validate(asset); error != fastgltf::Error::None)
|
||||
throw std::runtime_error(std::string(fastgltf::getErrorMessage(error)));
|
||||
#endif
|
||||
|
||||
// Load all buffers from URIs
|
||||
ctx.load_all_buffers();
|
||||
|
||||
gpu_buffer staging_buffer(physical_device_properties, asset);
|
||||
|
||||
// Load all textures
|
||||
auto textures = ctx.load_all_textures();
|
||||
|
||||
// Load all materials
|
||||
auto materials = ctx.load_all_materials(textures, staging_buffer, *default_material);
|
||||
|
||||
// Load all meshes
|
||||
data.meshes = ctx.load_all_meshes(materials, staging_buffer);
|
||||
|
||||
data.scene_nodes = ctx.topological_sort(ctx.load_all_nodes());
|
||||
|
||||
// Copy the staging buffer to the GPU
|
||||
spdlog::debug("Uploading scene data ({} bytes) to GPU memory", staging_buffer.size());
|
||||
auto buffer = std::make_shared<buffer_allocation>(staging_buffer.copy_to_gpu());
|
||||
|
||||
for (auto & i: materials)
|
||||
i->buffer = buffer;
|
||||
|
||||
for (auto & i: data.meshes)
|
||||
i.buffer = buffer;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
scene_data & scene_data::import(scene_data && other, node_handle parent)
|
||||
{
|
||||
assert(parent.scene == this || parent.id == node::root_id);
|
||||
|
||||
size_t mesh_offset = meshes.size();
|
||||
size_t nodes_offset = scene_nodes.size();
|
||||
|
||||
for (auto & mesh: other.meshes)
|
||||
meshes.push_back(std::move(mesh));
|
||||
|
||||
for (auto node: other.scene_nodes)
|
||||
{
|
||||
assert(!node.mesh_id || *node.mesh_id < other.meshes.size());
|
||||
|
||||
if (node.mesh_id)
|
||||
*node.mesh_id += mesh_offset;
|
||||
|
||||
for (auto & joint: node.joints)
|
||||
{
|
||||
joint.first += nodes_offset;
|
||||
}
|
||||
|
||||
if (node.parent_id == node::root_id)
|
||||
{
|
||||
node.parent_id = parent.id;
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(node.parent_id < other.scene_nodes.size());
|
||||
node.parent_id += nodes_offset;
|
||||
}
|
||||
|
||||
scene_nodes.push_back(node);
|
||||
}
|
||||
|
||||
other.meshes.clear();
|
||||
other.scene_nodes.clear();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
scene_data & scene_data::import(scene_data && other)
|
||||
{
|
||||
return import(std::move(other), {});
|
||||
}
|
||||
|
||||
node_handle scene_data::new_node()
|
||||
{
|
||||
size_t id = scene_nodes.size();
|
||||
|
||||
scene_nodes.push_back(node{
|
||||
.parent_id = node::root_id,
|
||||
.position = {0, 0, 0},
|
||||
.orientation = {1, 0, 0, 0},
|
||||
.scale = {1, 1, 1},
|
||||
.visible = true});
|
||||
|
||||
return {id, this};
|
||||
}
|
||||
|
||||
node_handle scene_data::find_node(std::string_view name)
|
||||
{
|
||||
for (auto && [index, node]: utils::enumerate(scene_nodes))
|
||||
{
|
||||
if (node.name == name)
|
||||
{
|
||||
return {index, this};
|
||||
}
|
||||
}
|
||||
|
||||
// TODO custom exception
|
||||
throw std::runtime_error("Node " + std::string(name) + " not found");
|
||||
}
|
||||
|
||||
node_handle scene_data::find_node(node_handle root, std::string_view name)
|
||||
{
|
||||
assert(root.id < scene_nodes.size());
|
||||
assert(root.scene == this);
|
||||
|
||||
std::vector<bool> flag(scene_nodes.size(), false);
|
||||
|
||||
flag[root.id] = true;
|
||||
|
||||
for (size_t index = root.id; index < scene_nodes.size(); index++)
|
||||
{
|
||||
size_t parent = scene_nodes[index].parent_id;
|
||||
|
||||
if (parent == node::root_id)
|
||||
continue;
|
||||
|
||||
if (!flag[parent])
|
||||
continue;
|
||||
|
||||
if (scene_nodes[index].name == name)
|
||||
return {index, this};
|
||||
|
||||
flag[index] = true;
|
||||
}
|
||||
|
||||
// TODO custom exception
|
||||
throw std::runtime_error("Node " + std::string(name) + " not found");
|
||||
}
|
||||
|
||||
std::vector<node_handle> scene_data::find_children(node_handle root)
|
||||
{
|
||||
assert(root.id < scene_nodes.size());
|
||||
assert(root.scene == this);
|
||||
|
||||
std::vector<bool> flag(scene_nodes.size(), false);
|
||||
|
||||
flag[root.id] = true;
|
||||
|
||||
std::vector<node_handle> nodes;
|
||||
|
||||
for (size_t index = root.id; index < scene_nodes.size(); index++)
|
||||
{
|
||||
size_t parent = scene_nodes[index].parent_id;
|
||||
|
||||
if (parent == node::root_id)
|
||||
continue;
|
||||
|
||||
if (!flag[parent])
|
||||
continue;
|
||||
|
||||
nodes.emplace_back(index, this);
|
||||
|
||||
flag[index] = true;
|
||||
}
|
||||
|
||||
return nodes;
|
||||
}
|
||||
|
||||
std::shared_ptr<scene_data::material> scene_data::find_material(std::string_view name)
|
||||
{
|
||||
for (auto & mesh: meshes)
|
||||
{
|
||||
for (auto & primitive: mesh.primitives)
|
||||
{
|
||||
if (primitive.material_ && primitive.material_->name == name)
|
||||
return primitive.material_;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -1,295 +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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "utils/magic_hash.h"
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <glm/ext/quaternion_float.hpp>
|
||||
#include <glm/mat4x4.hpp>
|
||||
#include <glm/vec2.hpp>
|
||||
#include <glm/vec3.hpp>
|
||||
#include <glm/vec4.hpp>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <vk/allocation.h>
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
|
||||
struct sampler_info
|
||||
{
|
||||
vk::Filter mag_filter = vk::Filter::eLinear;
|
||||
vk::Filter min_filter = vk::Filter::eLinear;
|
||||
vk::SamplerMipmapMode min_filter_mipmap = vk::SamplerMipmapMode::eLinear;
|
||||
vk::SamplerAddressMode wrapS = vk::SamplerAddressMode::eRepeat;
|
||||
vk::SamplerAddressMode wrapT = vk::SamplerAddressMode::eRepeat;
|
||||
|
||||
bool operator==(const sampler_info & other) const noexcept = default;
|
||||
};
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<sampler_info> : utils::magic_hash<sampler_info>
|
||||
{};
|
||||
} // namespace std
|
||||
|
||||
class node_handle;
|
||||
|
||||
struct scene_data
|
||||
{
|
||||
struct texture
|
||||
{
|
||||
std::shared_ptr<vk::raii::ImageView> image_view;
|
||||
sampler_info sampler;
|
||||
};
|
||||
|
||||
struct material
|
||||
{
|
||||
struct gpu_data
|
||||
{
|
||||
glm::vec4 base_color_factor = glm::vec4(1, 1, 1, 1);
|
||||
glm::vec4 base_emissive_factor = glm::vec4(0, 0, 0, 0);
|
||||
float metallic_factor = 1;
|
||||
float roughness_factor = 1;
|
||||
float occlusion_strength = 0;
|
||||
float normal_scale = 0;
|
||||
|
||||
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?
|
||||
};
|
||||
|
||||
std::shared_ptr<texture> base_color_texture;
|
||||
std::shared_ptr<texture> metallic_roughness_texture;
|
||||
std::shared_ptr<texture> occlusion_texture;
|
||||
std::shared_ptr<texture> emissive_texture;
|
||||
std::shared_ptr<texture> normal_texture;
|
||||
|
||||
// Disable back face culling with this material
|
||||
bool double_sided = true;
|
||||
|
||||
// TODO transparency
|
||||
// fastgltf::AlphaMode alphaMode;
|
||||
// float alpha_cutoff;
|
||||
|
||||
gpu_data staging;
|
||||
|
||||
// Resources used by this material
|
||||
std::shared_ptr<buffer_allocation> buffer;
|
||||
size_t offset;
|
||||
|
||||
// The descriptor set is managed by the scene renderer, it is updated whenever ds_dirty is true
|
||||
// Bindings 0-4: textures
|
||||
// Binding 5: uniform buffer
|
||||
std::shared_ptr<vk::raii::DescriptorSet> ds;
|
||||
|
||||
// Set to true to update the descriptor set at the next frame
|
||||
bool ds_dirty;
|
||||
|
||||
std::string name;
|
||||
std::string shader_name = "lit";
|
||||
bool blend_enable = true;
|
||||
};
|
||||
|
||||
struct vertex
|
||||
{
|
||||
glm::vec3 position;
|
||||
glm::vec3 normal;
|
||||
glm::vec3 tangent;
|
||||
std::array<glm::vec2, 2> texcoord;
|
||||
glm::vec4 color;
|
||||
std::array<glm::vec4, 1> joints;
|
||||
std::array<glm::vec4, 1> weights;
|
||||
|
||||
struct description
|
||||
{
|
||||
vk::VertexInputBindingDescription binding;
|
||||
std::vector<vk::VertexInputAttributeDescription> attributes;
|
||||
std::vector<std::string> attribute_names;
|
||||
|
||||
vk::PipelineVertexInputStateCreateFlags flags{};
|
||||
};
|
||||
|
||||
static description describe();
|
||||
};
|
||||
|
||||
struct primitive
|
||||
{
|
||||
bool indexed;
|
||||
uint32_t index_count;
|
||||
uint32_t vertex_count;
|
||||
vk::IndexType index_type;
|
||||
vk::DeviceSize index_offset;
|
||||
vk::DeviceSize vertex_offset;
|
||||
|
||||
// See also material::double_sided
|
||||
vk::CullModeFlagBits cull_mode = vk::CullModeFlagBits::eNone;
|
||||
vk::FrontFace front_face = vk::FrontFace::eClockwise;
|
||||
vk::PrimitiveTopology topology = vk::PrimitiveTopology::eTriangleList;
|
||||
|
||||
std::shared_ptr<material> material_;
|
||||
};
|
||||
|
||||
struct mesh
|
||||
{
|
||||
std::vector<primitive> primitives;
|
||||
std::shared_ptr<buffer_allocation> buffer;
|
||||
};
|
||||
|
||||
struct node
|
||||
{
|
||||
static constexpr size_t root_id = size_t(-1);
|
||||
|
||||
size_t parent_id;
|
||||
std::optional<size_t> mesh_id;
|
||||
|
||||
glm::vec3 position;
|
||||
glm::quat orientation;
|
||||
glm::vec3 scale;
|
||||
|
||||
std::string name;
|
||||
bool visible;
|
||||
|
||||
std::array<glm::vec4, 4> clipping_planes;
|
||||
|
||||
uint32_t layer_mask = 1;
|
||||
|
||||
std::vector<std::pair<size_t, glm::mat4>> joints; // Node index, inverse bind matrix of each joint
|
||||
};
|
||||
|
||||
// TODO: lights
|
||||
// TODO: skybox
|
||||
|
||||
std::vector<scene_data::mesh> meshes;
|
||||
std::vector<scene_data::node> scene_nodes;
|
||||
|
||||
scene_data() = default;
|
||||
scene_data(const scene_data &) = delete;
|
||||
scene_data(scene_data &&) = default;
|
||||
scene_data & operator=(const scene_data &) = delete;
|
||||
scene_data & operator=(scene_data &&) = default;
|
||||
|
||||
scene_data & import(scene_data && other, node_handle parent);
|
||||
scene_data & import(scene_data && other);
|
||||
|
||||
node_handle new_node();
|
||||
node_handle find_node(std::string_view name);
|
||||
node_handle find_node(node_handle parent, std::string_view name);
|
||||
std::vector<node_handle> find_children(node_handle parent);
|
||||
|
||||
std::shared_ptr<material> find_material(std::string_view name);
|
||||
};
|
||||
|
||||
class scene_loader
|
||||
{
|
||||
vk::raii::Device & device;
|
||||
vk::raii::PhysicalDevice physical_device;
|
||||
vk::raii::Queue & queue;
|
||||
uint32_t queue_family_index;
|
||||
std::shared_ptr<scene_data::material> default_material;
|
||||
|
||||
public:
|
||||
scene_loader(vk::raii::Device & device, vk::raii::PhysicalDevice physical_device, vk::raii::Queue & queue, uint32_t queue_family_index, std::shared_ptr<scene_data::material> default_material) :
|
||||
device(device),
|
||||
physical_device(physical_device),
|
||||
queue(queue),
|
||||
queue_family_index(queue_family_index),
|
||||
default_material(default_material)
|
||||
{}
|
||||
|
||||
scene_data operator()(const std::filesystem::path & gltf_path);
|
||||
};
|
||||
|
||||
class node_handle
|
||||
{
|
||||
friend struct scene_data;
|
||||
size_t id = scene_data::node::root_id;
|
||||
scene_data * scene = nullptr;
|
||||
|
||||
public:
|
||||
node_handle() = default;
|
||||
node_handle(size_t id, scene_data * scene) :
|
||||
id(id), scene(scene) {}
|
||||
node_handle(const node_handle &) = default;
|
||||
node_handle & operator=(const node_handle &) = default;
|
||||
|
||||
scene_data::node & operator*()
|
||||
{
|
||||
assert(scene != nullptr);
|
||||
assert(id < scene->scene_nodes.size());
|
||||
return scene->scene_nodes[id];
|
||||
}
|
||||
|
||||
const scene_data::node & operator*() const
|
||||
{
|
||||
assert(scene != nullptr);
|
||||
assert(id < scene->scene_nodes.size());
|
||||
return scene->scene_nodes[id];
|
||||
}
|
||||
|
||||
scene_data::node * operator->()
|
||||
{
|
||||
assert(scene != nullptr);
|
||||
assert(id < scene->scene_nodes.size());
|
||||
return &scene->scene_nodes[id];
|
||||
}
|
||||
|
||||
const scene_data::node * operator->() const
|
||||
{
|
||||
assert(scene != nullptr);
|
||||
assert(id < scene->scene_nodes.size());
|
||||
return &scene->scene_nodes[id];
|
||||
}
|
||||
|
||||
node_handle parent()
|
||||
{
|
||||
assert(scene != nullptr);
|
||||
assert(id < scene->scene_nodes.size());
|
||||
|
||||
return {scene->scene_nodes[id].parent_id, scene};
|
||||
}
|
||||
|
||||
const node_handle parent() const
|
||||
{
|
||||
assert(scene != nullptr);
|
||||
assert(id < scene->scene_nodes.size());
|
||||
|
||||
return {scene->scene_nodes[id].parent_id, scene};
|
||||
}
|
||||
|
||||
std::vector<node_handle> children()
|
||||
{
|
||||
assert(scene != nullptr);
|
||||
|
||||
return scene->find_children(*this);
|
||||
}
|
||||
|
||||
operator bool() const
|
||||
{
|
||||
return id != scene_data::node::root_id;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,840 @@
|
||||
/*
|
||||
* 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 "scene_loader.h"
|
||||
|
||||
#include "asset.h"
|
||||
#include "gpu_buffer.h"
|
||||
#include "image_loader.h"
|
||||
#include "render/scene_components.h"
|
||||
#include "utils/ranges.h"
|
||||
#include <entt/entt.hpp>
|
||||
#include <fastgltf/base64.hpp>
|
||||
#include <fastgltf/core.hpp>
|
||||
#include <fastgltf/glm_element_traits.hpp>
|
||||
#include <fastgltf/tools.hpp>
|
||||
#include <fastgltf/types.hpp>
|
||||
#include <fastgltf/util.hpp>
|
||||
#include <glm/ext.hpp>
|
||||
#include <ranges>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
// BEGIN Utility functions
|
||||
template <class T>
|
||||
constexpr vk::Format vk_attribute_format = vk::Format::eUndefined;
|
||||
template <>
|
||||
constexpr vk::Format vk_attribute_format<float> = vk::Format::eR32Sfloat;
|
||||
template <>
|
||||
constexpr vk::Format vk_attribute_format<glm::vec2> = vk::Format::eR32G32Sfloat;
|
||||
template <>
|
||||
constexpr vk::Format vk_attribute_format<glm::vec3> = vk::Format::eR32G32B32Sfloat;
|
||||
template <>
|
||||
constexpr vk::Format vk_attribute_format<glm::vec4> = vk::Format::eR32G32B32A32Sfloat;
|
||||
template <typename T, size_t N>
|
||||
constexpr vk::Format vk_attribute_format<std::array<T, N>> = vk_attribute_format<T>;
|
||||
|
||||
template <class T>
|
||||
constexpr size_t nb_attributes = 1;
|
||||
template <typename T, size_t N>
|
||||
constexpr size_t nb_attributes<std::array<T, N>> = N;
|
||||
|
||||
template <class T>
|
||||
struct remove_array
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
template <class T, size_t N>
|
||||
struct remove_array<std::array<T, N>>
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
template <class T>
|
||||
using remove_array_t = remove_array<T>::type;
|
||||
|
||||
template <class T>
|
||||
struct is_array : std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <class T, size_t N>
|
||||
struct is_array<std::array<T, N>> : std::true_type
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
constexpr bool is_array_v = is_array<T>::value;
|
||||
// END
|
||||
|
||||
// BEGIN GLTF -> Vulkan conversion functions
|
||||
std::pair<vk::Filter, vk::SamplerMipmapMode> convert(fastgltf::Filter filter)
|
||||
{
|
||||
switch (filter)
|
||||
{
|
||||
case fastgltf::Filter::Nearest:
|
||||
case fastgltf::Filter::NearestMipMapNearest:
|
||||
return {vk::Filter::eNearest, vk::SamplerMipmapMode::eNearest};
|
||||
|
||||
case fastgltf::Filter::Linear:
|
||||
case fastgltf::Filter::LinearMipMapNearest:
|
||||
return {vk::Filter::eLinear, vk::SamplerMipmapMode::eNearest};
|
||||
|
||||
case fastgltf::Filter::NearestMipMapLinear:
|
||||
return {vk::Filter::eNearest, vk::SamplerMipmapMode::eLinear};
|
||||
|
||||
case fastgltf::Filter::LinearMipMapLinear:
|
||||
return {vk::Filter::eLinear, vk::SamplerMipmapMode::eLinear};
|
||||
}
|
||||
|
||||
throw std::invalid_argument("filter");
|
||||
}
|
||||
|
||||
vk::SamplerAddressMode convert(fastgltf::Wrap wrap)
|
||||
{
|
||||
switch (wrap)
|
||||
{
|
||||
case fastgltf::Wrap::ClampToEdge:
|
||||
return vk::SamplerAddressMode::eClampToEdge;
|
||||
|
||||
case fastgltf::Wrap::MirroredRepeat:
|
||||
return vk::SamplerAddressMode::eMirroredRepeat;
|
||||
|
||||
case fastgltf::Wrap::Repeat:
|
||||
return vk::SamplerAddressMode::eRepeat;
|
||||
}
|
||||
|
||||
throw std::invalid_argument("wrap");
|
||||
}
|
||||
|
||||
renderer::sampler_info convert(fastgltf::Sampler & sampler)
|
||||
{
|
||||
renderer::sampler_info info;
|
||||
|
||||
info.mag_filter = convert(sampler.magFilter.value_or(fastgltf::Filter::Linear)).first;
|
||||
|
||||
std::tie(info.min_filter, info.min_filter_mipmap) = convert(sampler.minFilter.value_or(fastgltf::Filter::LinearMipMapLinear));
|
||||
|
||||
info.wrapS = convert(sampler.wrapS);
|
||||
info.wrapT = convert(sampler.wrapT);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
vk::PrimitiveTopology convert(fastgltf::PrimitiveType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case fastgltf::PrimitiveType::Points:
|
||||
return vk::PrimitiveTopology::ePointList;
|
||||
|
||||
case fastgltf::PrimitiveType::Lines:
|
||||
return vk::PrimitiveTopology::eLineList;
|
||||
|
||||
case fastgltf::PrimitiveType::LineLoop:
|
||||
throw std::runtime_error("Unimplemented");
|
||||
|
||||
case fastgltf::PrimitiveType::LineStrip:
|
||||
return vk::PrimitiveTopology::eLineStrip;
|
||||
|
||||
case fastgltf::PrimitiveType::Triangles:
|
||||
return vk::PrimitiveTopology::eTriangleList;
|
||||
|
||||
case fastgltf::PrimitiveType::TriangleStrip:
|
||||
return vk::PrimitiveTopology::eTriangleStrip;
|
||||
|
||||
case fastgltf::PrimitiveType::TriangleFan:
|
||||
return vk::PrimitiveTopology::eTriangleFan;
|
||||
}
|
||||
|
||||
throw std::invalid_argument("type");
|
||||
}
|
||||
|
||||
glm::vec4 convert(const std::array<float, 4> & v)
|
||||
{
|
||||
return {v[0], v[1], v[2], v[3]};
|
||||
}
|
||||
|
||||
glm::vec3 convert(const std::array<float, 3> & v)
|
||||
{
|
||||
return {v[0], v[1], v[2]};
|
||||
}
|
||||
// END
|
||||
|
||||
// BEGIN Vertex attributes loading
|
||||
template <typename T>
|
||||
requires is_array_v<T>
|
||||
void copy_vertex_attributes(
|
||||
const fastgltf::Asset & asset,
|
||||
const fastgltf::Primitive & primitive,
|
||||
std::string attribute_name,
|
||||
std::vector<renderer::vertex> & vertices,
|
||||
T renderer::vertex::*attribute)
|
||||
{
|
||||
using U = T::value_type;
|
||||
constexpr size_t N = std::tuple_size_v<T>;
|
||||
|
||||
for (size_t i = 0; i < N; i++)
|
||||
{
|
||||
auto it = primitive.findAttribute(attribute_name + std::to_string(i));
|
||||
|
||||
if (it == primitive.attributes.end())
|
||||
continue;
|
||||
|
||||
const fastgltf::Accessor & accessor = asset.accessors.at(it->second);
|
||||
|
||||
if (vertices.size() < accessor.count)
|
||||
vertices.resize(accessor.count, {});
|
||||
|
||||
fastgltf::iterateAccessorWithIndex<U>(asset, accessor, [&](U value, std::size_t idx) {
|
||||
(vertices[idx].*attribute)[i] = value;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires(!is_array_v<T>)
|
||||
void copy_vertex_attributes(
|
||||
const fastgltf::Asset & asset,
|
||||
const fastgltf::Primitive & primitive,
|
||||
std::string attribute_name,
|
||||
std::vector<renderer::vertex> & vertices,
|
||||
T renderer::vertex::*attribute)
|
||||
{
|
||||
auto it = primitive.findAttribute(attribute_name);
|
||||
|
||||
if (it == primitive.attributes.end())
|
||||
return;
|
||||
|
||||
const fastgltf::Accessor & accessor = asset.accessors.at(it->second);
|
||||
|
||||
if (vertices.size() < accessor.count)
|
||||
vertices.resize(accessor.count, {});
|
||||
|
||||
fastgltf::iterateAccessorWithIndex<T>(asset, accessor, [&](T value, std::size_t idx) {
|
||||
vertices[idx].*attribute = value;
|
||||
});
|
||||
}
|
||||
// END
|
||||
|
||||
// BEGIN Image loading
|
||||
constexpr bool starts_with(std::span<const std::byte> data, std::span<const uint8_t> prefix)
|
||||
{
|
||||
return data.size() >= prefix.size() && !memcmp(data.data(), prefix.data(), prefix.size());
|
||||
}
|
||||
|
||||
fastgltf::MimeType guess_mime_type(std::span<const std::byte> image_data)
|
||||
{
|
||||
const uint8_t jpeg_magic[] = {0xFF, 0xD8, 0xFF};
|
||||
const uint8_t png_magic[] = {0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A};
|
||||
const uint8_t ktx1_magic[] = {0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A};
|
||||
const uint8_t ktx2_magic[] = {0xAB, 0x4B, 0x54, 0x58, 0x20, 0x32, 0x30, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A};
|
||||
|
||||
if (starts_with(image_data, png_magic))
|
||||
return fastgltf::MimeType::PNG;
|
||||
else if (starts_with(image_data, jpeg_magic))
|
||||
return fastgltf::MimeType::JPEG;
|
||||
else if (starts_with(image_data, ktx1_magic))
|
||||
return fastgltf::MimeType::KTX2;
|
||||
else if (starts_with(image_data, ktx2_magic))
|
||||
return fastgltf::MimeType::KTX2;
|
||||
else
|
||||
return fastgltf::MimeType::None;
|
||||
}
|
||||
|
||||
std::shared_ptr<vk::raii::ImageView> do_load_image(
|
||||
vk::raii::PhysicalDevice & physical_device,
|
||||
vk::raii::Device & device,
|
||||
vk::raii::Queue & queue,
|
||||
vk::raii::CommandPool & cb_pool,
|
||||
std::span<const std::byte> image_data,
|
||||
bool srgb)
|
||||
{
|
||||
switch (guess_mime_type(image_data))
|
||||
{
|
||||
case fastgltf::MimeType::JPEG:
|
||||
case fastgltf::MimeType::PNG:
|
||||
case fastgltf::MimeType::KTX2: {
|
||||
try
|
||||
{
|
||||
image_loader loader(physical_device, device, queue, cb_pool);
|
||||
loader.load(image_data, srgb);
|
||||
|
||||
spdlog::debug("Loaded image {}x{}, format {}, {} mipmaps", loader.extent.width, loader.extent.height, vk::to_string(loader.format), loader.num_mipmaps);
|
||||
return loader.image_view;
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
spdlog::info("Cannot load image: {}", e.what());
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
spdlog::error("Unsupported image MIME type");
|
||||
return {};
|
||||
}
|
||||
}
|
||||
// END
|
||||
|
||||
fastgltf::Asset load_gltf_asset(fastgltf::GltfDataBuffer & buffer, const std::filesystem::path & directory)
|
||||
{
|
||||
fastgltf::Parser parser(fastgltf::Extensions::KHR_texture_basisu);
|
||||
|
||||
auto gltf_options =
|
||||
fastgltf::Options::DontRequireValidAssetMember |
|
||||
fastgltf::Options::AllowDouble |
|
||||
fastgltf::Options::LoadGLBBuffers |
|
||||
fastgltf::Options::DecomposeNodeMatrices;
|
||||
|
||||
auto expected_asset = parser.loadGltf(&buffer, directory, gltf_options);
|
||||
|
||||
if (auto error = expected_asset.error(); error != fastgltf::Error::None)
|
||||
throw std::runtime_error(std::string(fastgltf::getErrorMessage(error)));
|
||||
|
||||
return std::move(expected_asset.get());
|
||||
}
|
||||
|
||||
class loader_context
|
||||
{
|
||||
std::filesystem::path base_directory;
|
||||
fastgltf::Asset & gltf;
|
||||
vk::raii::PhysicalDevice physical_device;
|
||||
vk::raii::Device & device;
|
||||
vk::raii::Queue & queue;
|
||||
vk::raii::CommandPool & cb_pool;
|
||||
|
||||
std::vector<asset> loaded_assets;
|
||||
asset & load_from_asset(const std::filesystem::path & path)
|
||||
{
|
||||
return loaded_assets.emplace_back(path);
|
||||
}
|
||||
|
||||
public:
|
||||
loader_context(std::filesystem::path base_directory,
|
||||
fastgltf::Asset & gltf,
|
||||
vk::raii::PhysicalDevice physical_device,
|
||||
vk::raii::Device & device,
|
||||
vk::raii::Queue & queue,
|
||||
vk::raii::CommandPool & cb_pool) :
|
||||
base_directory(base_directory),
|
||||
gltf(gltf),
|
||||
physical_device(physical_device),
|
||||
device(device),
|
||||
queue(queue),
|
||||
cb_pool(cb_pool)
|
||||
{
|
||||
}
|
||||
|
||||
fastgltf::span<const std::byte> load(const fastgltf::URI & uri)
|
||||
{
|
||||
auto path = base_directory.empty() ? std::filesystem::path(uri.path()) : base_directory / std::filesystem::path(uri.path());
|
||||
std::span<const std::byte> bytes;
|
||||
|
||||
bytes = load_from_asset(path);
|
||||
|
||||
return fastgltf::span<const std::byte>(bytes.data(), bytes.size());
|
||||
}
|
||||
|
||||
fastgltf::span<const std::byte> load(const fastgltf::sources::URI & uri)
|
||||
{
|
||||
return load(uri.uri);
|
||||
}
|
||||
|
||||
template <typename T, std::size_t Extent>
|
||||
fastgltf::span<T, fastgltf::dynamic_extent> subspan(fastgltf::span<T, Extent> span, size_t offset, size_t count = fastgltf::dynamic_extent)
|
||||
{
|
||||
assert(offset < span.size());
|
||||
assert(count == fastgltf::dynamic_extent || count <= span.size() - offset);
|
||||
|
||||
if (count == fastgltf::dynamic_extent)
|
||||
count = span.size() - offset;
|
||||
|
||||
return fastgltf::span<T>{span.data() + offset, count};
|
||||
}
|
||||
|
||||
fastgltf::sources::ByteView visit_source(fastgltf::DataSource & source)
|
||||
{
|
||||
using return_type = fastgltf::sources::ByteView;
|
||||
|
||||
return std::visit(fastgltf::visitor{
|
||||
[&](std::monostate) -> return_type {
|
||||
throw std::runtime_error("Invalid source");
|
||||
},
|
||||
[&](fastgltf::sources::Fallback) -> return_type {
|
||||
throw std::runtime_error("Invalid source");
|
||||
},
|
||||
[&](const fastgltf::sources::BufferView & buffer_view) -> return_type {
|
||||
fastgltf::BufferView & view = gltf.bufferViews.at(buffer_view.bufferViewIndex);
|
||||
|
||||
fastgltf::Buffer & buffer = gltf.buffers.at(view.bufferIndex);
|
||||
|
||||
auto buffer2 = visit_source(buffer.data);
|
||||
|
||||
return {subspan(buffer2.bytes, view.byteOffset, view.byteLength), buffer_view.mimeType};
|
||||
},
|
||||
[&](const fastgltf::sources::URI & uri) -> return_type {
|
||||
if (!uri.uri.isLocalPath())
|
||||
throw std::runtime_error("Non local paths are not supported"); // TODO ?
|
||||
|
||||
fastgltf::span<const std::byte> data = load(uri);
|
||||
|
||||
// Don't use the MIME type from fastgltf, it's not initialized for URIs
|
||||
return {subspan(data, uri.fileByteOffset), fastgltf::MimeType::None};
|
||||
},
|
||||
[&](const fastgltf::sources::Vector & vector) -> return_type {
|
||||
fastgltf::span<const std::byte> data{reinterpret_cast<const std::byte *>(vector.bytes.data()), vector.bytes.size()};
|
||||
return {data, vector.mimeType};
|
||||
},
|
||||
[&](const fastgltf::sources::Array & array) -> return_type {
|
||||
fastgltf::span<const std::byte> data{reinterpret_cast<const std::byte *>(array.bytes.data()), array.bytes.size()};
|
||||
return {data, array.mimeType};
|
||||
},
|
||||
[&](const fastgltf::sources::CustomBuffer & custom_buffer) -> return_type {
|
||||
throw std::runtime_error("Unimplemented source CustomBuffer");
|
||||
// TODO ?
|
||||
},
|
||||
[&](fastgltf::sources::ByteView & byte_view) -> return_type {
|
||||
return {byte_view.bytes, byte_view.mimeType};
|
||||
}},
|
||||
source);
|
||||
}
|
||||
|
||||
std::unordered_map<int, std::shared_ptr<vk::raii::ImageView>> images;
|
||||
std::shared_ptr<vk::raii::ImageView> load_image(int index, bool srgb)
|
||||
{
|
||||
auto it = images.find(index);
|
||||
if (it != images.end())
|
||||
return it->second;
|
||||
|
||||
try
|
||||
{
|
||||
auto [image_data, mime_type] = visit_source(gltf.images[index].data);
|
||||
auto image = do_load_image(physical_device, device, queue, cb_pool, image_data, srgb);
|
||||
|
||||
images.emplace(index, image);
|
||||
return image;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<renderer::texture>> load_all_textures()
|
||||
{
|
||||
// Determine which texture is sRGB
|
||||
std::vector<uint8_t> srgb_array;
|
||||
srgb_array.resize(gltf.textures.size(), false);
|
||||
for (const fastgltf::Material & gltf_material: gltf.materials)
|
||||
{
|
||||
if (gltf_material.pbrData.baseColorTexture)
|
||||
srgb_array.at(gltf_material.pbrData.baseColorTexture->textureIndex) = true;
|
||||
|
||||
if (gltf_material.emissiveTexture)
|
||||
srgb_array.at(gltf_material.emissiveTexture->textureIndex) = true;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<renderer::texture>> textures;
|
||||
textures.reserve(gltf.textures.size());
|
||||
for (auto && [srgb, gltf_texture]: std::views::zip(srgb_array, gltf.textures))
|
||||
{
|
||||
auto & texture_ref = *textures.emplace_back(std::make_shared<renderer::texture>());
|
||||
|
||||
if (gltf_texture.samplerIndex)
|
||||
{
|
||||
fastgltf::Sampler & sampler = gltf.samplers.at(*gltf_texture.samplerIndex);
|
||||
texture_ref.sampler = convert(sampler);
|
||||
}
|
||||
|
||||
if (gltf_texture.basisuImageIndex)
|
||||
{
|
||||
texture_ref.image_view = load_image(*gltf_texture.basisuImageIndex, srgb);
|
||||
if (texture_ref.image_view)
|
||||
continue;
|
||||
}
|
||||
|
||||
// if (gltf_texture.ddsImageIndex)
|
||||
// {
|
||||
// // TODO
|
||||
// }
|
||||
|
||||
// if (gltf_texture.webpImageIndex)
|
||||
// {
|
||||
// // TODO
|
||||
// }
|
||||
|
||||
if (gltf_texture.imageIndex)
|
||||
{
|
||||
texture_ref.image_view = load_image(*gltf_texture.imageIndex, srgb);
|
||||
if (texture_ref.image_view)
|
||||
continue;
|
||||
}
|
||||
|
||||
throw std::runtime_error("Unsupported image type");
|
||||
}
|
||||
|
||||
return textures;
|
||||
}
|
||||
|
||||
void load_all_buffers()
|
||||
{
|
||||
for (fastgltf::Buffer & buffer: gltf.buffers)
|
||||
{
|
||||
if (std::holds_alternative<fastgltf::sources::URI>(buffer.data))
|
||||
{
|
||||
fastgltf::sources::URI uri = std::get<fastgltf::sources::URI>(buffer.data);
|
||||
|
||||
// Don't use the MIME type from fastgltf, it's not initialized for URIs
|
||||
buffer.data = fastgltf::sources::ByteView(load(uri), fastgltf::MimeType::None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<renderer::material>> load_all_materials(std::vector<std::shared_ptr<renderer::texture>> & textures, gpu_buffer & staging_buffer, const renderer::material & default_material)
|
||||
{
|
||||
std::vector<std::shared_ptr<renderer::material>> materials;
|
||||
materials.reserve(gltf.materials.size());
|
||||
for (const fastgltf::Material & gltf_material: gltf.materials)
|
||||
{
|
||||
// Copy the default material, without references to its buffer or descriptor set
|
||||
auto & material_ref = *materials.emplace_back(std::make_shared<renderer::material>(default_material));
|
||||
material_ref.name = gltf_material.name;
|
||||
spdlog::info("Loading material \"{}\"", material_ref.name);
|
||||
material_ref.buffer.reset();
|
||||
material_ref.ds.reset();
|
||||
|
||||
material_ref.double_sided = gltf_material.doubleSided;
|
||||
material_ref.blend_enable = gltf_material.alphaMode == fastgltf::AlphaMode::Blend; // TODO handle alpha cut off mode
|
||||
|
||||
renderer::material::gpu_data & material_data = material_ref.staging;
|
||||
|
||||
material_data.base_color_factor = convert(gltf_material.pbrData.baseColorFactor);
|
||||
material_data.base_emissive_factor = glm::vec4(convert(gltf_material.emissiveFactor), 0);
|
||||
material_data.metallic_factor = gltf_material.pbrData.metallicFactor;
|
||||
material_data.roughness_factor = gltf_material.pbrData.roughnessFactor;
|
||||
|
||||
if (gltf_material.pbrData.baseColorTexture)
|
||||
{
|
||||
material_ref.base_color_texture = textures.at(gltf_material.pbrData.baseColorTexture->textureIndex);
|
||||
material_data.base_color_texcoord = gltf_material.pbrData.baseColorTexture->texCoordIndex;
|
||||
}
|
||||
|
||||
if (gltf_material.pbrData.metallicRoughnessTexture)
|
||||
{
|
||||
material_ref.metallic_roughness_texture = textures.at(gltf_material.pbrData.metallicRoughnessTexture->textureIndex);
|
||||
material_data.metallic_roughness_texcoord = gltf_material.pbrData.metallicRoughnessTexture->texCoordIndex;
|
||||
}
|
||||
|
||||
if (gltf_material.occlusionTexture)
|
||||
{
|
||||
material_ref.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_ref.emissive_texture = textures.at(gltf_material.emissiveTexture->textureIndex);
|
||||
material_data.emissive_texcoord = gltf_material.emissiveTexture->texCoordIndex;
|
||||
}
|
||||
|
||||
if (gltf_material.normalTexture)
|
||||
{
|
||||
material_ref.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_ref.offset = staging_buffer.add_uniform(material_data);
|
||||
}
|
||||
|
||||
return materials;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<renderer::mesh>> load_all_meshes(std::vector<std::shared_ptr<renderer::material>> & materials, gpu_buffer & staging_buffer)
|
||||
{
|
||||
std::vector<std::shared_ptr<renderer::mesh>> meshes;
|
||||
meshes.reserve(gltf.meshes.size());
|
||||
for (const fastgltf::Mesh & gltf_mesh: gltf.meshes)
|
||||
{
|
||||
std::shared_ptr<renderer::mesh> & mesh_ref = meshes.emplace_back();
|
||||
mesh_ref = std::make_shared<renderer::mesh>();
|
||||
|
||||
mesh_ref->primitives.reserve(gltf_mesh.primitives.size());
|
||||
|
||||
for (const fastgltf::Primitive & gltf_primitive: gltf_mesh.primitives)
|
||||
{
|
||||
auto & primitive_ref = mesh_ref->primitives.emplace_back();
|
||||
|
||||
if (gltf_primitive.indicesAccessor)
|
||||
{
|
||||
fastgltf::Accessor & indices_accessor = gltf.accessors.at(*gltf_primitive.indicesAccessor);
|
||||
|
||||
primitive_ref.indexed = true;
|
||||
primitive_ref.index_offset = 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;
|
||||
}
|
||||
|
||||
std::vector<renderer::vertex> vertices;
|
||||
|
||||
copy_vertex_attributes(gltf, gltf_primitive, "POSITION", vertices, &renderer::vertex::position);
|
||||
copy_vertex_attributes(gltf, gltf_primitive, "NORMAL", vertices, &renderer::vertex::normal);
|
||||
copy_vertex_attributes(gltf, gltf_primitive, "TANGENT", vertices, &renderer::vertex::tangent);
|
||||
copy_vertex_attributes(gltf, gltf_primitive, "TEXCOORD_", vertices, &renderer::vertex::texcoord);
|
||||
copy_vertex_attributes(gltf, gltf_primitive, "COLOR", vertices, &renderer::vertex::color);
|
||||
copy_vertex_attributes(gltf, gltf_primitive, "JOINTS_", vertices, &renderer::vertex::joints);
|
||||
copy_vertex_attributes(gltf, gltf_primitive, "WEIGHTS_", vertices, &renderer::vertex::weights);
|
||||
|
||||
primitive_ref.vertex_offset = staging_buffer.add_vertices(vertices);
|
||||
primitive_ref.vertex_count = vertices.size();
|
||||
|
||||
primitive_ref.cull_mode = vk::CullModeFlagBits::eBack; // TBC
|
||||
primitive_ref.front_face = vk::FrontFace::eCounterClockwise; // TBC
|
||||
primitive_ref.topology = convert(gltf_primitive.type);
|
||||
|
||||
if (gltf_primitive.materialIndex)
|
||||
primitive_ref.material_ = materials.at(*gltf_primitive.materialIndex);
|
||||
}
|
||||
}
|
||||
|
||||
return meshes;
|
||||
}
|
||||
|
||||
entt::registry load_all_nodes(const std::vector<std::shared_ptr<renderer::mesh>> & meshes)
|
||||
{
|
||||
entt::registry registry;
|
||||
|
||||
std::vector<entt::entity> entities{gltf.nodes.size()};
|
||||
registry.create(entities.begin(), entities.end());
|
||||
|
||||
// Create all node components first
|
||||
registry.insert<components::node>(entities.begin(), entities.end());
|
||||
|
||||
for (const auto & [entity, gltf_node]: std::ranges::zip_view(entities, gltf.nodes))
|
||||
{
|
||||
components::node & node = registry.get<components::node>(entity);
|
||||
node.name = gltf_node.name;
|
||||
|
||||
if (gltf_node.meshIndex)
|
||||
node.mesh = meshes[*gltf_node.meshIndex];
|
||||
|
||||
if (gltf_node.skinIndex)
|
||||
{
|
||||
auto & skin = gltf.skins.at(*gltf_node.skinIndex);
|
||||
|
||||
node.joints.resize(skin.joints.size());
|
||||
|
||||
for (auto [i, joint_index]: utils::enumerate(skin.joints))
|
||||
node.joints.at(i).first = entities[joint_index];
|
||||
|
||||
if (skin.inverseBindMatrices)
|
||||
{
|
||||
const fastgltf::Accessor & accessor = gltf.accessors.at(*skin.inverseBindMatrices);
|
||||
|
||||
fastgltf::iterateAccessorWithIndex<glm::mat4>(gltf, accessor, [&](const glm::mat4 & value, std::size_t idx) {
|
||||
node.joints.at(idx).second = value;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t child: gltf_node.children)
|
||||
{
|
||||
registry.get<components::node>(entities[child]).parent = entity;
|
||||
}
|
||||
|
||||
auto TRS = std::get<fastgltf::TRS>(gltf_node.transform);
|
||||
|
||||
node.position = glm::make_vec3(TRS.translation.data());
|
||||
node.orientation = glm::make_quat(TRS.rotation.data());
|
||||
node.scale = glm::make_vec3(TRS.scale.data());
|
||||
node.visible = true;
|
||||
std::ranges::fill(node.clipping_planes, glm::vec4{0, 0, 0, 1});
|
||||
}
|
||||
|
||||
return registry;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
renderer::vertex::description renderer::vertex::describe()
|
||||
{
|
||||
renderer::vertex::description desc;
|
||||
|
||||
desc.binding = vk::VertexInputBindingDescription{
|
||||
.binding = 0,
|
||||
.stride = sizeof(vertex),
|
||||
.inputRate = vk::VertexInputRate::eVertex,
|
||||
};
|
||||
|
||||
vk::VertexInputAttributeDescription attribute{
|
||||
.location = 0,
|
||||
.binding = 0,
|
||||
};
|
||||
|
||||
#define VERTEX_ATTR(member) \
|
||||
attribute.format = vk_attribute_format<decltype(vertex::member)>; \
|
||||
for (size_t i = 0; i < nb_attributes<decltype(vertex::member)>; i++) \
|
||||
{ \
|
||||
attribute.offset = offsetof(vertex, member) + i * sizeof(remove_array_t<decltype(vertex::member)>); \
|
||||
desc.attributes.push_back(attribute); \
|
||||
attribute.location++; \
|
||||
if (is_array_v<decltype(vertex::member)>) \
|
||||
{ \
|
||||
desc.attribute_names.push_back(#member "_" + std::to_string(i)); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
desc.attribute_names.push_back(#member); \
|
||||
} \
|
||||
}
|
||||
|
||||
VERTEX_ATTR(position);
|
||||
VERTEX_ATTR(normal);
|
||||
VERTEX_ATTR(tangent);
|
||||
VERTEX_ATTR(texcoord);
|
||||
VERTEX_ATTR(color);
|
||||
VERTEX_ATTR(joints);
|
||||
VERTEX_ATTR(weights);
|
||||
|
||||
static_assert(vertex{}.joints.size() == vertex{}.weights.size());
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
entt::registry scene_loader::operator()(const std::filesystem::path & gltf_path)
|
||||
{
|
||||
vk::PhysicalDeviceProperties physical_device_properties = physical_device.getProperties();
|
||||
vk::raii::CommandPool cb_pool{device, vk::CommandPoolCreateInfo{
|
||||
.flags = vk::CommandPoolCreateFlagBits::eTransient | vk::CommandPoolCreateFlagBits::eResetCommandBuffer,
|
||||
.queueFamilyIndex = queue_family_index,
|
||||
}};
|
||||
|
||||
spdlog::debug("Loading {}", gltf_path.native());
|
||||
|
||||
asset asset_file(gltf_path);
|
||||
fastgltf::GltfDataBuffer data_buffer;
|
||||
data_buffer.copyBytes(reinterpret_cast<const uint8_t *>(asset_file.data()), asset_file.size());
|
||||
|
||||
fastgltf::Asset asset = load_gltf_asset(data_buffer, gltf_path.parent_path());
|
||||
loader_context ctx(gltf_path.parent_path(), asset, physical_device, device, queue, cb_pool);
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (auto error = fastgltf::validate(asset); error != fastgltf::Error::None)
|
||||
throw std::runtime_error(std::string(fastgltf::getErrorMessage(error)));
|
||||
#endif
|
||||
|
||||
// Load all buffers from URIs
|
||||
ctx.load_all_buffers();
|
||||
|
||||
gpu_buffer staging_buffer(physical_device_properties, asset);
|
||||
|
||||
// Load all textures
|
||||
auto textures = ctx.load_all_textures();
|
||||
|
||||
// Load all materials
|
||||
auto materials = ctx.load_all_materials(textures, staging_buffer, *default_material);
|
||||
|
||||
// Load all meshes
|
||||
auto meshes = ctx.load_all_meshes(materials, staging_buffer);
|
||||
|
||||
// Load all nodes
|
||||
entt::registry loaded_scene = ctx.load_all_nodes(meshes);
|
||||
|
||||
// Copy the staging buffer to the GPU
|
||||
spdlog::debug("Uploading scene data ({} bytes) to GPU memory", staging_buffer.size());
|
||||
auto buffer = std::make_shared<buffer_allocation>(staging_buffer.copy_to_gpu());
|
||||
|
||||
for (auto & i: materials)
|
||||
i->buffer = buffer;
|
||||
|
||||
for (auto & i: meshes)
|
||||
i->buffer = buffer;
|
||||
|
||||
return loaded_scene;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void copy_components(entt::registry & scene, const entt::registry & prefab, const std::unordered_map<entt::entity, entt::entity> & entity_map)
|
||||
{
|
||||
for (const auto & [entity, component]: prefab.view<T>().each())
|
||||
{
|
||||
scene.emplace<T>(entity_map.at(entity), component);
|
||||
}
|
||||
}
|
||||
|
||||
void scene_loader::add_prefab(entt::registry & scene, const entt::registry & prefab, entt::entity root)
|
||||
{
|
||||
assert(scene.valid(root) or root == entt::null);
|
||||
|
||||
auto prefab_entities = prefab.view<entt::entity>();
|
||||
|
||||
std::vector<entt::entity> scene_entities{prefab_entities.size()};
|
||||
scene.create(scene_entities.begin(), scene_entities.end());
|
||||
|
||||
std::unordered_map<entt::entity, entt::entity> entity_map; // key: prefab entity, value: scene entity
|
||||
|
||||
entity_map.emplace(entt::null, root);
|
||||
for (auto [prefab_entity, scene_entity]: std::ranges::zip_view(prefab_entities, scene_entities))
|
||||
entity_map.emplace(prefab_entity, scene_entity);
|
||||
|
||||
copy_components<components::node>(scene, prefab, entity_map);
|
||||
|
||||
// update links
|
||||
for (auto [prefab_entity, scene_entity]: entity_map)
|
||||
{
|
||||
if (prefab_entity == entt::null)
|
||||
continue;
|
||||
|
||||
auto & node = scene.get<components::node>(scene_entity);
|
||||
|
||||
node.parent = entity_map.at(node.parent);
|
||||
|
||||
for (auto & joint: node.joints)
|
||||
{
|
||||
joint.first = entity_map.at(joint.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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 <filesystem>
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
|
||||
#include "scene_components.h"
|
||||
|
||||
class scene_loader
|
||||
{
|
||||
vk::raii::Device & device;
|
||||
vk::raii::PhysicalDevice physical_device;
|
||||
vk::raii::Queue & queue;
|
||||
uint32_t queue_family_index;
|
||||
std::shared_ptr<renderer::material> default_material;
|
||||
|
||||
public:
|
||||
scene_loader(vk::raii::Device & device, vk::raii::PhysicalDevice physical_device, vk::raii::Queue & queue, uint32_t queue_family_index, std::shared_ptr<renderer::material> default_material) :
|
||||
device(device),
|
||||
physical_device(physical_device),
|
||||
queue(queue),
|
||||
queue_family_index(queue_family_index),
|
||||
default_material(default_material)
|
||||
{}
|
||||
|
||||
entt::registry operator()(const std::filesystem::path & gltf_path);
|
||||
|
||||
void add_prefab(entt::registry & scene, const entt::registry & prefab, entt::entity root = entt::null);
|
||||
};
|
||||
+354
-242
@@ -21,7 +21,7 @@
|
||||
#include "application.h"
|
||||
#include "render/growable_descriptor_pool.h"
|
||||
#include "render/image_loader.h"
|
||||
#include "render/scene_data.h"
|
||||
#include "render/scene_components.h"
|
||||
#include "utils/alignment.h"
|
||||
#include "utils/fmt_glm.h"
|
||||
#include "utils/ranges.h"
|
||||
@@ -29,6 +29,8 @@
|
||||
#include "vk/pipeline.h"
|
||||
#include "vk/shader.h"
|
||||
#include <boost/pfr/core.hpp>
|
||||
#include <entt/entity/entity.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
#include <glm/gtc/matrix_access.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
#include <glm/gtx/quaternion.hpp>
|
||||
@@ -37,6 +39,8 @@
|
||||
#include <ranges>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <vk_mem_alloc.h>
|
||||
#include <vulkan/vulkan_enums.hpp>
|
||||
#include <vulkan/vulkan_structs.hpp>
|
||||
|
||||
extern const std::map<std::string, std::vector<uint32_t>> shaders;
|
||||
|
||||
@@ -74,7 +78,7 @@ vk::Format scene_renderer::find_usable_image_format(
|
||||
return vk::Format::eUndefined;
|
||||
}
|
||||
|
||||
std::shared_ptr<scene_data::texture> scene_renderer::create_default_texture(vk::raii::CommandPool & cb_pool, std::vector<uint8_t> pixel)
|
||||
std::shared_ptr<renderer::texture> scene_renderer::create_default_texture(vk::raii::CommandPool & cb_pool, std::vector<uint8_t> pixel)
|
||||
{
|
||||
vk::Format format;
|
||||
|
||||
@@ -99,12 +103,12 @@ std::shared_ptr<scene_data::texture> scene_renderer::create_default_texture(vk::
|
||||
|
||||
std::shared_ptr<vk::raii::ImageView> image_view = loader.image_view;
|
||||
|
||||
return std::make_shared<scene_data::texture>(image_view, sampler_info{});
|
||||
return std::make_shared<renderer::texture>(image_view, renderer::sampler_info{});
|
||||
}
|
||||
|
||||
std::shared_ptr<scene_data::material> scene_renderer::create_default_material(vk::raii::CommandPool & cb_pool)
|
||||
std::shared_ptr<renderer::material> scene_renderer::create_default_material(vk::raii::CommandPool & cb_pool)
|
||||
{
|
||||
auto default_material = std::make_shared<scene_data::material>();
|
||||
auto default_material = std::make_shared<renderer::material>();
|
||||
default_material->name = "default";
|
||||
|
||||
default_material->base_color_texture = create_default_texture(cb_pool, {255, 255, 255, 255});
|
||||
@@ -200,23 +204,14 @@ scene_renderer::scene_renderer(
|
||||
vk::raii::PhysicalDevice physical_device,
|
||||
vk::raii::Queue & queue,
|
||||
vk::raii::CommandPool & cb_pool,
|
||||
vk::Extent2D output_size,
|
||||
vk::Format output_format,
|
||||
// std::span<vk::Format> depth_formats,
|
||||
vk::Format depth_format,
|
||||
int frames_in_flight,
|
||||
bool keep_depth_buffer) :
|
||||
int frames_in_flight) :
|
||||
physical_device(physical_device),
|
||||
device(device),
|
||||
physical_device_properties(physical_device.getProperties()),
|
||||
queue(queue),
|
||||
output_size(output_size),
|
||||
output_format(output_format),
|
||||
depth_format(depth_format),
|
||||
layout_0(create_descriptor_set_layout(layout_bindings_0, vk::DescriptorSetLayoutCreateFlagBits::ePushDescriptorKHR)),
|
||||
layout_1(create_descriptor_set_layout(layout_bindings_1)),
|
||||
ds_pool_material(device, layout_1, layout_bindings_1, 100), // TODO tunable
|
||||
keep_depth_buffer(keep_depth_buffer)
|
||||
ds_pool_material(device, layout_1, layout_bindings_1, 100) // TODO tunable
|
||||
{
|
||||
// Create the default material
|
||||
default_material = create_default_material(cb_pool);
|
||||
@@ -243,8 +238,6 @@ scene_renderer::scene_renderer(
|
||||
.queryCount = uint32_t(2 * frames_in_flight),
|
||||
});
|
||||
|
||||
renderpass = create_renderpass();
|
||||
|
||||
std::array layouts{*layout_0, *layout_1};
|
||||
pipeline_layout = create_pipeline_layout(layouts);
|
||||
}
|
||||
@@ -264,40 +257,40 @@ void scene_renderer::wait_idle()
|
||||
throw std::runtime_error("vkWaitForfences: " + vk::to_string(result));
|
||||
}
|
||||
|
||||
// #define MSAA_4x
|
||||
vk::raii::RenderPass & scene_renderer::get_renderpass(const renderpass_info & info)
|
||||
{
|
||||
auto it = renderpasses.find(info);
|
||||
if (it != renderpasses.end())
|
||||
return it->second;
|
||||
|
||||
#ifdef MSAA_4x
|
||||
#define MSAA_SAMPLES vk::SampleCountFlagBits::e4
|
||||
#else
|
||||
#define MSAA_SAMPLES vk::SampleCountFlagBits::e1
|
||||
#endif
|
||||
return renderpasses.emplace(info, create_renderpass(info)).first->second;
|
||||
}
|
||||
|
||||
vk::raii::RenderPass scene_renderer::create_renderpass()
|
||||
vk::raii::RenderPass scene_renderer::create_renderpass(const renderpass_info & info_)
|
||||
{
|
||||
vk::RenderPassCreateInfo info;
|
||||
|
||||
std::array attachments = {
|
||||
vk::AttachmentDescription{
|
||||
.format = output_format,
|
||||
.samples = MSAA_SAMPLES,
|
||||
.format = info_.color_format,
|
||||
.samples = info_.msaa_samples,
|
||||
.loadOp = vk::AttachmentLoadOp::eClear,
|
||||
.storeOp = vk::AttachmentStoreOp::eStore,
|
||||
.initialLayout = vk::ImageLayout::eUndefined,
|
||||
.finalLayout = vk::ImageLayout::eColorAttachmentOptimal,
|
||||
},
|
||||
vk::AttachmentDescription{
|
||||
.format = depth_format,
|
||||
.samples = MSAA_SAMPLES,
|
||||
.format = info_.depth_format,
|
||||
.samples = info_.msaa_samples,
|
||||
.loadOp = vk::AttachmentLoadOp::eClear,
|
||||
.storeOp = keep_depth_buffer ? vk::AttachmentStoreOp::eStore : vk::AttachmentStoreOp::eDontCare,
|
||||
.storeOp = info_.keep_depth_buffer ? vk::AttachmentStoreOp::eStore : vk::AttachmentStoreOp::eDontCare,
|
||||
.stencilLoadOp = vk::AttachmentLoadOp::eClear,
|
||||
.stencilStoreOp = vk::AttachmentStoreOp::eDontCare,
|
||||
.initialLayout = vk::ImageLayout::eUndefined,
|
||||
.finalLayout = vk::ImageLayout::eDepthStencilAttachmentOptimal,
|
||||
},
|
||||
#ifdef MSAA_4x
|
||||
vk::AttachmentDescription{
|
||||
.format = output_format,
|
||||
.format = info_.color_format,
|
||||
.samples = vk::SampleCountFlagBits::e1,
|
||||
.loadOp = vk::AttachmentLoadOp::eDontCare,
|
||||
.storeOp = vk::AttachmentStoreOp::eStore,
|
||||
@@ -306,10 +299,17 @@ vk::raii::RenderPass scene_renderer::create_renderpass()
|
||||
.initialLayout = vk::ImageLayout::eUndefined,
|
||||
.finalLayout = vk::ImageLayout::eColorAttachmentOptimal,
|
||||
|
||||
}
|
||||
#endif
|
||||
};
|
||||
info.setAttachments(attachments);
|
||||
}};
|
||||
|
||||
if (info_.msaa_samples != vk::SampleCountFlagBits::e1)
|
||||
{
|
||||
info.setAttachments(attachments);
|
||||
}
|
||||
else
|
||||
{
|
||||
info.setPAttachments(attachments.data());
|
||||
info.setAttachmentCount(2);
|
||||
}
|
||||
|
||||
vk::AttachmentReference color_attachment{
|
||||
.attachment = 0,
|
||||
@@ -321,22 +321,22 @@ vk::raii::RenderPass scene_renderer::create_renderpass()
|
||||
.layout = vk::ImageLayout::eDepthStencilAttachmentOptimal,
|
||||
};
|
||||
|
||||
#ifdef MSAA_4x
|
||||
// Only used if MSAA is enabled
|
||||
vk::AttachmentReference resolve_attachment{
|
||||
.attachment = 2,
|
||||
.layout = vk::ImageLayout::eColorAttachmentOptimal,
|
||||
};
|
||||
#endif
|
||||
|
||||
vk::SubpassDescription subpasses{
|
||||
.pipelineBindPoint = vk::PipelineBindPoint::eGraphics,
|
||||
.colorAttachmentCount = 1,
|
||||
.pColorAttachments = &color_attachment,
|
||||
#ifdef MSAA_4x
|
||||
.pResolveAttachments = &resolve_attachment,
|
||||
#endif
|
||||
.pDepthStencilAttachment = &depth_attachment,
|
||||
};
|
||||
|
||||
if (info_.msaa_samples != vk::SampleCountFlagBits::e1)
|
||||
subpasses.pResolveAttachments = &resolve_attachment;
|
||||
|
||||
info.setSubpasses(subpasses);
|
||||
|
||||
std::array dependencies{
|
||||
@@ -361,53 +361,53 @@ vk::raii::RenderPass scene_renderer::create_renderpass()
|
||||
return vk::raii::RenderPass(device, info);
|
||||
}
|
||||
|
||||
scene_renderer::output_image & scene_renderer::get_output_image_data(vk::Image output_color, vk::Image output_depth)
|
||||
scene_renderer::output_image & scene_renderer::get_output_image_data(const output_image_info & info)
|
||||
{
|
||||
std::pair images{output_color, output_depth};
|
||||
auto it = output_images.find(images);
|
||||
auto it = output_images.find(info);
|
||||
if (it != output_images.end())
|
||||
return it->second;
|
||||
|
||||
return output_images.emplace(images, create_output_image_data(output_color, output_depth)).first->second;
|
||||
return output_images.emplace(info, create_output_image_data(info)).first->second;
|
||||
}
|
||||
|
||||
scene_renderer::output_image scene_renderer::create_output_image_data(vk::Image output_color, vk::Image output_depth)
|
||||
scene_renderer::output_image scene_renderer::create_output_image_data(const output_image_info & info)
|
||||
{
|
||||
output_image out;
|
||||
|
||||
// TODO: use image view from xr::swapchain
|
||||
out.image_view = vk::raii::ImageView(
|
||||
device, vk::ImageViewCreateInfo{
|
||||
.image = output_color,
|
||||
.image = info.color,
|
||||
.viewType = vk::ImageViewType::e2D,
|
||||
.format = output_format,
|
||||
.format = info.renderpass.color_format,
|
||||
.components{},
|
||||
.subresourceRange = {
|
||||
.aspectMask = vk::ImageAspectFlagBits::eColor,
|
||||
.baseMipLevel = 0,
|
||||
.levelCount = 1,
|
||||
.baseArrayLayer = 0,
|
||||
.baseArrayLayer = info.base_array_layer,
|
||||
.layerCount = 1,
|
||||
},
|
||||
});
|
||||
|
||||
// TODO: check requiredFlags
|
||||
if (not output_depth)
|
||||
if (not info.depth)
|
||||
out.depth_buffer = image_allocation{
|
||||
device,
|
||||
vk::ImageCreateInfo{
|
||||
.imageType = vk::ImageType::e2D,
|
||||
.format = depth_format,
|
||||
.format = info.renderpass.depth_format,
|
||||
.extent = {
|
||||
.width = output_size.width,
|
||||
.height = output_size.height,
|
||||
.width = info.output_size.width,
|
||||
.height = info.output_size.height,
|
||||
.depth = 1,
|
||||
},
|
||||
.mipLevels = 1,
|
||||
.arrayLayers = 1,
|
||||
.samples = MSAA_SAMPLES,
|
||||
.samples = info.renderpass.msaa_samples,
|
||||
.tiling = vk::ImageTiling::eOptimal,
|
||||
.usage = vk::ImageUsageFlagBits::eDepthStencilAttachment | vk::ImageUsageFlagBits::eTransientAttachment},
|
||||
.usage = vk::ImageUsageFlagBits::eDepthStencilAttachment | vk::ImageUsageFlagBits::eTransientAttachment,
|
||||
},
|
||||
VmaAllocationCreateInfo{
|
||||
.flags = VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT,
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
@@ -417,77 +417,87 @@ scene_renderer::output_image scene_renderer::create_output_image_data(vk::Image
|
||||
out.depth_view = vk::raii::ImageView(
|
||||
device,
|
||||
vk::ImageViewCreateInfo{
|
||||
.image = output_depth ? output_depth : out.depth_buffer,
|
||||
.image = info.depth ? info.depth : out.depth_buffer,
|
||||
.viewType = vk::ImageViewType::e2D,
|
||||
.format = depth_format,
|
||||
.format = info.renderpass.depth_format,
|
||||
.components{},
|
||||
.subresourceRange = {
|
||||
.aspectMask = vk::ImageAspectFlagBits::eDepth,
|
||||
.baseMipLevel = 0,
|
||||
.levelCount = 1,
|
||||
.baseArrayLayer = 0,
|
||||
.baseArrayLayer = info.depth ? info.base_array_layer : 0,
|
||||
.layerCount = 1,
|
||||
},
|
||||
});
|
||||
|
||||
#ifdef MSAA_4x
|
||||
out.multisample_image = image_allocation{vk::ImageCreateInfo{
|
||||
.imageType = vk::ImageType::e2D,
|
||||
.format = output_format,
|
||||
.extent = {
|
||||
.width = output_size.width,
|
||||
.height = output_size.height,
|
||||
.depth = 1,
|
||||
},
|
||||
.mipLevels = 1,
|
||||
.arrayLayers = 1,
|
||||
.samples = MSAA_SAMPLES,
|
||||
.tiling = vk::ImageTiling::eOptimal,
|
||||
.usage = vk::ImageUsageFlagBits::eColorAttachment | vk::ImageUsageFlagBits::eTransientAttachment,
|
||||
},
|
||||
VmaAllocationCreateInfo{
|
||||
.flags = VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT,
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
.requiredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, // TODO: check
|
||||
.preferredFlags = VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT,
|
||||
}};
|
||||
if (info.renderpass.msaa_samples != vk::SampleCountFlagBits::e1)
|
||||
{
|
||||
out.multisample_image = image_allocation{
|
||||
device,
|
||||
vk::ImageCreateInfo{
|
||||
.imageType = vk::ImageType::e2D,
|
||||
.format = info.renderpass.color_format,
|
||||
.extent = {
|
||||
.width = info.output_size.width,
|
||||
.height = info.output_size.height,
|
||||
.depth = 1,
|
||||
},
|
||||
.mipLevels = 1,
|
||||
.arrayLayers = 1,
|
||||
.samples = info.renderpass.msaa_samples,
|
||||
.tiling = vk::ImageTiling::eOptimal,
|
||||
.usage = vk::ImageUsageFlagBits::eColorAttachment | vk::ImageUsageFlagBits::eTransientAttachment,
|
||||
},
|
||||
VmaAllocationCreateInfo{
|
||||
.flags = VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT,
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
.requiredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, // TODO: check
|
||||
.preferredFlags = VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT,
|
||||
}};
|
||||
|
||||
out.multisample_view = vk::raii::ImageView(device, vk::ImageViewCreateInfo{
|
||||
.image = out.multisample_image,
|
||||
.viewType = vk::ImageViewType::e2D,
|
||||
.format = output_format,
|
||||
.components{},
|
||||
.subresourceRange = {
|
||||
.aspectMask = vk::ImageAspectFlagBits::eColor,
|
||||
.baseMipLevel = 0,
|
||||
.levelCount = 1,
|
||||
.baseArrayLayer = 0,
|
||||
.layerCount = 1,
|
||||
},
|
||||
});
|
||||
#endif
|
||||
out.multisample_view = vk::raii::ImageView(
|
||||
device,
|
||||
vk::ImageViewCreateInfo{
|
||||
.image = out.multisample_image,
|
||||
.viewType = vk::ImageViewType::e2D,
|
||||
.format = info.renderpass.color_format,
|
||||
.components{},
|
||||
.subresourceRange = {
|
||||
.aspectMask = vk::ImageAspectFlagBits::eColor,
|
||||
.baseMipLevel = 0,
|
||||
.levelCount = 1,
|
||||
.baseArrayLayer = 0,
|
||||
.layerCount = 1,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
vk::FramebufferCreateInfo fb_info{
|
||||
.renderPass = *renderpass,
|
||||
.width = output_size.width,
|
||||
.height = output_size.height,
|
||||
.renderPass = *get_renderpass(info.renderpass),
|
||||
.width = info.output_size.width,
|
||||
.height = info.output_size.height,
|
||||
.layers = 1,
|
||||
};
|
||||
|
||||
#ifdef MSAA_4x
|
||||
std::array attachments{
|
||||
vk::ImageView{*out.multisample_view},
|
||||
vk::ImageView{*out.depth_view},
|
||||
vk::ImageView{*out.image_view},
|
||||
};
|
||||
#else
|
||||
std::array attachments{
|
||||
vk::ImageView{*out.image_view},
|
||||
vk::ImageView{*out.depth_view},
|
||||
};
|
||||
#endif
|
||||
fb_info.setAttachments(attachments);
|
||||
out.framebuffer = vk::raii::Framebuffer(device, fb_info);
|
||||
if (info.renderpass.msaa_samples != vk::SampleCountFlagBits::e1)
|
||||
{
|
||||
std::array attachments{
|
||||
vk::ImageView{*out.multisample_view},
|
||||
vk::ImageView{*out.depth_view},
|
||||
vk::ImageView{*out.image_view},
|
||||
};
|
||||
fb_info.setAttachments(attachments);
|
||||
out.framebuffer = vk::raii::Framebuffer(device, fb_info);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::array attachments{
|
||||
vk::ImageView{*out.image_view},
|
||||
vk::ImageView{*out.depth_view},
|
||||
};
|
||||
fb_info.setAttachments(attachments);
|
||||
out.framebuffer = vk::raii::Framebuffer(device, fb_info);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -518,7 +528,7 @@ vk::raii::PipelineLayout scene_renderer::create_pipeline_layout(std::span<vk::De
|
||||
|
||||
vk::raii::Pipeline scene_renderer::create_pipeline(const pipeline_info & info)
|
||||
{
|
||||
auto vertex_description = scene_data::vertex::describe();
|
||||
auto vertex_description = renderer::vertex::describe();
|
||||
|
||||
spdlog::debug("Creating pipeline");
|
||||
|
||||
@@ -580,18 +590,8 @@ vk::raii::Pipeline scene_renderer::create_pipeline(const pipeline_info & info)
|
||||
.topology = info.topology,
|
||||
.primitiveRestartEnable = false,
|
||||
}},
|
||||
.Viewports = {vk::Viewport{
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = (float)output_size.width,
|
||||
.height = (float)output_size.height,
|
||||
.minDepth = 0,
|
||||
.maxDepth = 1,
|
||||
}},
|
||||
.Scissors = {vk::Rect2D{
|
||||
.offset = {0, 0},
|
||||
.extent = output_size,
|
||||
}},
|
||||
.Viewports = {vk::Viewport{}}, // Dynamic scissor / viewport but the count must be set
|
||||
.Scissors = {vk::Rect2D{}},
|
||||
.RasterizationState = {vk::PipelineRasterizationStateCreateInfo{
|
||||
.polygonMode = vk::PolygonMode::eFill,
|
||||
.cullMode = info.cull_mode,
|
||||
@@ -599,7 +599,7 @@ vk::raii::Pipeline scene_renderer::create_pipeline(const pipeline_info & info)
|
||||
.lineWidth = 1.0,
|
||||
}},
|
||||
.MultisampleState = {vk::PipelineMultisampleStateCreateInfo{
|
||||
.rasterizationSamples = MSAA_SAMPLES,
|
||||
.rasterizationSamples = info.renderpass.msaa_samples,
|
||||
}},
|
||||
.DepthStencilState = {vk::PipelineDepthStencilStateCreateInfo{
|
||||
.depthTestEnable = info.depth_test_enable,
|
||||
@@ -619,13 +619,17 @@ vk::raii::Pipeline scene_renderer::create_pipeline(const pipeline_info & info)
|
||||
.dstAlphaBlendFactor = vk::BlendFactor::eOneMinusSrcAlpha,
|
||||
.alphaBlendOp = vk::BlendOp::eAdd,
|
||||
.colorWriteMask = vk::ColorComponentFlagBits::eR | vk::ColorComponentFlagBits::eG | vk::ColorComponentFlagBits::eB | vk::ColorComponentFlagBits::eA}},
|
||||
.DynamicStates = {
|
||||
vk::DynamicState::eViewport,
|
||||
vk::DynamicState::eScissor,
|
||||
},
|
||||
.layout = *pipeline_layout,
|
||||
.renderPass = *renderpass,
|
||||
.renderPass = *get_renderpass(info.renderpass),
|
||||
.subpass = 0,
|
||||
}};
|
||||
}
|
||||
|
||||
vk::Sampler scene_renderer::get_sampler(const sampler_info & info)
|
||||
vk::Sampler scene_renderer::get_sampler(const renderer::sampler_info & info)
|
||||
{
|
||||
auto it = samplers.find(info);
|
||||
if (it != samplers.end())
|
||||
@@ -715,14 +719,14 @@ scene_renderer::per_frame_resources & scene_renderer::current_frame()
|
||||
return frame_resources[current_frame_index];
|
||||
}
|
||||
|
||||
void scene_renderer::update_material_descriptor_set(scene_data::material & material)
|
||||
void scene_renderer::update_material_descriptor_set(renderer::material & material)
|
||||
{
|
||||
if (!material.ds || material.ds.use_count() != 1)
|
||||
material.ds = ds_pool_material.allocate();
|
||||
|
||||
vk::DescriptorSet ds = **material.ds;
|
||||
|
||||
auto f = [&](std::shared_ptr<scene_data::texture> & texture) {
|
||||
auto f = [&](std::shared_ptr<renderer::texture> & texture) {
|
||||
return vk::DescriptorImageInfo{
|
||||
.sampler = get_sampler(texture->sampler),
|
||||
.imageView = **texture->image_view,
|
||||
@@ -741,7 +745,7 @@ void scene_renderer::update_material_descriptor_set(scene_data::material & mater
|
||||
vk::DescriptorBufferInfo write_ds_buffer{
|
||||
.buffer = *material.buffer,
|
||||
.offset = material.offset,
|
||||
.range = sizeof(scene_data::material::gpu_data),
|
||||
.range = sizeof(renderer::material::gpu_data),
|
||||
};
|
||||
|
||||
// Write each descriptor separately because the HTC XR Elite needs it for some reason
|
||||
@@ -793,24 +797,74 @@ void scene_renderer::update_material_descriptor_set(scene_data::material & mater
|
||||
device.updateDescriptorSets(write_ds, {});
|
||||
}
|
||||
|
||||
// static void print_scene_hierarchy(const scene_data& scene, std::span<glm::mat4> model_matrices, size_t root = scene_data::node::root_id, int level = 0)
|
||||
static void print_scene_hierarchy(const entt::registry & scene, entt::entity root = entt::null, int level = 0)
|
||||
{
|
||||
if (level == 0)
|
||||
spdlog::info("Node hierarchy:");
|
||||
|
||||
for (auto && [entity, node]: scene.view<components::node>().each())
|
||||
{
|
||||
if (node.parent != root)
|
||||
continue;
|
||||
|
||||
// glm::mat4 M = model_matrices[index];
|
||||
// glm::vec4 pos = glm::column(M, 3);
|
||||
// spdlog::info("{:{}} {} pos={}, rot={}, pos to root={}", "", level * 2, node.name, node.translation, node.rotation, glm::vec3(pos));
|
||||
|
||||
spdlog::info("{:{}} {} ({}, visible: {}, {})", "", level * 2, node.name, (int)entity, node.visible, node.global_visible);
|
||||
|
||||
print_scene_hierarchy(scene, entity, level + 1);
|
||||
}
|
||||
if (level == 0)
|
||||
spdlog::info("---------------");
|
||||
}
|
||||
|
||||
// Topological sort of all nodes
|
||||
// static std::vector<entt::entity> sort_nodes(entt::registry & scene)
|
||||
// {
|
||||
// for(const auto&& [index, node]: utils::enumerate(scene.scene_nodes))
|
||||
// std::vector<std::pair<entt::entity, entt::entity>> unsorted; // first: child, second: parent
|
||||
// std::unordered_set<entt::entity> processed;
|
||||
// std::vector<entt::entity> sorted;
|
||||
//
|
||||
// for(auto && [entity, node]: scene.view<components::node>().each())
|
||||
// {
|
||||
// if (node.parent_id != root)
|
||||
// continue;
|
||||
//
|
||||
// // glm::mat4 M = model_matrices[index];
|
||||
// // glm::vec4 pos = glm::column(M, 3);
|
||||
// // spdlog::info("{:{}} {} pos={}, rot={}, pos to root={}", "", level * 2, node.name, node.translation, node.rotation, glm::vec3(pos));
|
||||
//
|
||||
// spdlog::info("{:{}} {}", "", level * 2, node.name);
|
||||
//
|
||||
// print_scene_hierarchy(scene, model_matrices, index, level + 1);
|
||||
// if (scene.valid(node.parent))
|
||||
// unsorted.push_back({entity, node.parent});
|
||||
// else
|
||||
// {
|
||||
// processed.emplace(entity);
|
||||
// sorted.push_back(entity);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// while(not unsorted.empty())
|
||||
// {
|
||||
// for(auto it = unsorted.begin(); it != unsorted.end(); )
|
||||
// {
|
||||
// if (processed.contains(it->second))
|
||||
// {
|
||||
// processed.emplace(it->first);
|
||||
// sorted.push_back(it->first);
|
||||
// it = unsorted.erase(it);
|
||||
// }
|
||||
// else
|
||||
// ++it;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return sorted;
|
||||
// }
|
||||
|
||||
void scene_renderer::render(scene_data & scene, const std::array<float, 4> & clear_color, std::span<frame_info> frames)
|
||||
void scene_renderer::render(
|
||||
entt::registry & scene,
|
||||
const std::array<float, 4> & clear_color,
|
||||
uint32_t layer_mask,
|
||||
vk::Extent2D output_size,
|
||||
vk::Format color_format,
|
||||
vk::Format depth_format,
|
||||
vk::Image color_buffer,
|
||||
vk::Image depth_buffer,
|
||||
std::span<frame_info> frames)
|
||||
{
|
||||
per_frame_resources & resources = current_frame();
|
||||
|
||||
@@ -826,41 +880,48 @@ void scene_renderer::render(scene_data & scene, const std::array<float, 4> & cle
|
||||
vk::ClearDepthStencilValue{0.0, 0},
|
||||
};
|
||||
|
||||
auto vertex_layout = scene_data::vertex::describe();
|
||||
|
||||
std::vector<glm::mat4> transform_to_root(scene.scene_nodes.size());
|
||||
std::vector<bool> reverse_side(scene.scene_nodes.size());
|
||||
std::vector<bool> visible(scene.scene_nodes.size());
|
||||
|
||||
for (const auto & [index, object]: utils::enumerate(scene.scene_nodes))
|
||||
// TODO once per frame, even if render is called several times
|
||||
for (auto && [entity, node]: scene.view<components::node>().each())
|
||||
{
|
||||
glm::mat4 transform_to_parent = glm::translate(glm::mat4(1), object.position) * (glm::mat4)object.orientation * glm::scale(glm::mat4(1), object.scale);
|
||||
float det = object.scale.x * object.scale.y * object.scale.z;
|
||||
glm::mat4 transform_to_root{1.0}; // Identity
|
||||
bool visible = true;
|
||||
bool reverse_side = false;
|
||||
uint32_t layers = -1;
|
||||
|
||||
if (object.parent_id == scene_data::node::root_id)
|
||||
for (auto i = &node; i != nullptr and visible; i = scene.try_get<components::node>(i->parent))
|
||||
{
|
||||
transform_to_root[index] = transform_to_parent;
|
||||
reverse_side[index] = det < 0;
|
||||
visible[index] = object.visible;
|
||||
float det = i->scale.x * i->scale.y * i->scale.z;
|
||||
glm::mat4 transform_to_parent = glm::translate(glm::mat4(1), i->position) * (glm::mat4)i->orientation * glm::scale(glm::mat4(1), i->scale);
|
||||
|
||||
transform_to_root = transform_to_parent * transform_to_root;
|
||||
reverse_side = reverse_side ^ (det < 0);
|
||||
visible = visible and i->visible;
|
||||
layers = layers bitand i->layer_mask;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t parent = object.parent_id;
|
||||
assert(parent < index);
|
||||
|
||||
transform_to_root[index] = transform_to_root.at(parent) * transform_to_parent;
|
||||
|
||||
reverse_side[index] = reverse_side[parent] ^ (det < 0);
|
||||
|
||||
visible[index] = visible[parent] && object.visible;
|
||||
}
|
||||
node.transform_to_root = transform_to_root;
|
||||
node.global_visible = visible;
|
||||
node.reverse_side = reverse_side;
|
||||
node.global_layer_mask = layers;
|
||||
}
|
||||
|
||||
// print_scene_hierarchy(scene, transform_to_root);
|
||||
// print_scene_hierarchy(scene);
|
||||
|
||||
for (const auto && [frame_index, frame]: utils::enumerate(frames))
|
||||
{
|
||||
scene_renderer::output_image & output = get_output_image_data(frame.destination, frame.depth_buffer);
|
||||
scene_renderer::output_image & output = get_output_image_data(output_image_info{
|
||||
.renderpass = {
|
||||
.color_format = color_format,
|
||||
.depth_format = depth_format,
|
||||
.keep_depth_buffer = depth_buffer != vk::Image{},
|
||||
.msaa_samples = vk::SampleCountFlagBits::e1,
|
||||
// .msaa_samples = vk::SampleCountFlagBits::e4, // FIXME: MSAA does not work
|
||||
},
|
||||
.output_size = output_size,
|
||||
.color = color_buffer,
|
||||
.depth = depth_buffer,
|
||||
.base_array_layer = (uint32_t)frame_index,
|
||||
});
|
||||
glm::mat4 viewproj = frame.projection * frame.view;
|
||||
|
||||
vk::DeviceSize frame_ubo_offset = resources.uniform_buffer_offset;
|
||||
@@ -873,13 +934,19 @@ void scene_renderer::render(scene_data & scene, const std::array<float, 4> & cle
|
||||
// frame_ubo.ambient_color = glm::vec4(0.2,0.2,0.2,0); // TODO
|
||||
// frame_ubo.light_color = glm::vec4(0.8,0.8,0.8,0); // TODO
|
||||
|
||||
frame_ubo.ambient_color = glm::vec4(0, 0, 0, 0); // TODO
|
||||
frame_ubo.light_color = glm::vec4(0.8, 0.8, 0.8, 0); // TODO
|
||||
frame_ubo.ambient_color = glm::vec4(0.1, 0.1, 0.1, 0); // TODO
|
||||
frame_ubo.light_color = glm::vec4(0.8, 0.8, 0.8, 0); // TODO
|
||||
|
||||
frame_ubo.light_position = glm::vec4(1, 1, 1, 0); // TODO
|
||||
frame_ubo.proj = frame.projection;
|
||||
frame_ubo.view = frame.view;
|
||||
|
||||
vk::raii::RenderPass & renderpass = get_renderpass(renderpass_info{
|
||||
.color_format = color_format,
|
||||
.depth_format = depth_format,
|
||||
.keep_depth_buffer = depth_buffer != vk::Image{},
|
||||
});
|
||||
|
||||
cb.beginRenderPass(
|
||||
vk::RenderPassBeginInfo{
|
||||
.renderPass = *renderpass,
|
||||
@@ -893,17 +960,46 @@ void scene_renderer::render(scene_data & scene, const std::array<float, 4> & cle
|
||||
},
|
||||
vk::SubpassContents::eInline);
|
||||
|
||||
for (const auto & [index, node]: utils::enumerate(scene.scene_nodes))
|
||||
// Accumulate all visible primitives
|
||||
std::vector<std::tuple<bool, float, components::node *, renderer::primitive *>> primitives; // TODO keep it between frames
|
||||
for (auto && [entity, node]: scene.view<components::node>().each())
|
||||
{
|
||||
if (!node.mesh_id)
|
||||
if (not node.global_visible or not node.mesh or (node.global_layer_mask & layer_mask) == 0)
|
||||
continue;
|
||||
|
||||
if (!visible[index])
|
||||
continue;
|
||||
// Position relative to the camera
|
||||
glm::vec4 position = frame.view * node.transform_to_root * glm::vec4(0, 0, 0, 1);
|
||||
|
||||
scene_data::mesh & mesh = scene.meshes.at(*node.mesh_id);
|
||||
glm::mat4 & transform = transform_to_root[index];
|
||||
for (renderer::primitive & primitive: node.mesh->primitives)
|
||||
{
|
||||
renderer::material & material = primitive.material_ ? *primitive.material_ : *default_material;
|
||||
primitives.emplace_back(material.blend_enable, position.z, &node, &primitive);
|
||||
}
|
||||
}
|
||||
|
||||
// Sort by blending / distance
|
||||
// TODO add frustum culling
|
||||
std::ranges::stable_sort(primitives, [](const auto & a, const auto & b) -> bool {
|
||||
// Put the opaque objects first
|
||||
if (std::get<0>(a) < std::get<0>(b))
|
||||
return true;
|
||||
if (std::get<0>(a) > std::get<0>(b))
|
||||
return false;
|
||||
|
||||
// If blending is disabled (std::get<0> == false), put the closest objects first
|
||||
// If blending is enabled (std::get<0> == true), put the farthest objeccts first
|
||||
return std::get<0>(a) ^ (std::get<1>(a) > std::get<1>(b));
|
||||
});
|
||||
|
||||
// TODO try to add a depth pre-pass
|
||||
for (auto & [blend_enable, distance, node_ptr, primitive_ptr]: primitives)
|
||||
{
|
||||
components::node & node = *node_ptr;
|
||||
renderer::primitive & primitive = *primitive_ptr;
|
||||
|
||||
glm::mat4 & transform = node.transform_to_root;
|
||||
|
||||
// TODO: reuse the UBO if another primitive of the same mesh has already been drawn
|
||||
vk::DeviceSize instance_ubo_offset = resources.uniform_buffer_offset;
|
||||
instance_gpu_data & object_ubo = *reinterpret_cast<instance_gpu_data *>(ubo + resources.uniform_buffer_offset);
|
||||
resources.uniform_buffer_offset += utils::align_up(buffer_alignment, sizeof(instance_gpu_data));
|
||||
@@ -918,7 +1014,8 @@ void scene_renderer::render(scene_data & scene, const std::array<float, 4> & cle
|
||||
|
||||
for (auto && [idx, joint]: utils::enumerate(node.joints))
|
||||
{
|
||||
joint_matrices[idx] = glm::inverse(transform) * transform_to_root[joint.first] * joint.second;
|
||||
glm::mat4 & joint_transform = scene.get<components::node>(joint.first).transform_to_root;
|
||||
joint_matrices[idx] = glm::inverse(transform) * joint_transform * joint.second;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -927,87 +1024,102 @@ void scene_renderer::render(scene_data & scene, const std::array<float, 4> & cle
|
||||
object_ubo.modelviewproj = viewproj * transform;
|
||||
object_ubo.clipping_planes = node.clipping_planes;
|
||||
|
||||
for (scene_data::primitive & primitive: mesh.primitives)
|
||||
{
|
||||
// Get the material
|
||||
std::shared_ptr<scene_data::material> material = primitive.material_ ? primitive.material_ : default_material;
|
||||
// Get the material
|
||||
std::shared_ptr<renderer::material> material = primitive.material_ ? primitive.material_ : default_material;
|
||||
|
||||
if (material->ds_dirty || !material->ds)
|
||||
update_material_descriptor_set(*material);
|
||||
if (material->ds_dirty || !material->ds)
|
||||
update_material_descriptor_set(*material);
|
||||
|
||||
// Get the pipeline
|
||||
pipeline_info info{
|
||||
.shader_name = material->shader_name,
|
||||
.cull_mode = primitive.cull_mode,
|
||||
.front_face = primitive.front_face,
|
||||
.topology = primitive.topology,
|
||||
.blend_enable = material->blend_enable,
|
||||
// Get the pipeline
|
||||
pipeline_info info{
|
||||
.renderpass = {
|
||||
.color_format = color_format,
|
||||
.depth_format = depth_format,
|
||||
.keep_depth_buffer = depth_buffer != vk::Image{}},
|
||||
.shader_name = material->shader_name,
|
||||
.cull_mode = primitive.cull_mode,
|
||||
.front_face = primitive.front_face,
|
||||
.topology = primitive.topology,
|
||||
.blend_enable = material->blend_enable,
|
||||
|
||||
.nb_texcoords = 2, // TODO
|
||||
.skinning = !node.joints.empty(),
|
||||
};
|
||||
.nb_texcoords = 2, // TODO
|
||||
.skinning = !node.joints.empty(),
|
||||
};
|
||||
|
||||
if (material->double_sided)
|
||||
info.cull_mode = vk::CullModeFlagBits::eNone;
|
||||
if (material->double_sided)
|
||||
info.cull_mode = vk::CullModeFlagBits::eNone;
|
||||
|
||||
if (reverse_side[index])
|
||||
info.front_face = reverse(info.front_face);
|
||||
if (node.reverse_side)
|
||||
info.front_face = reverse(info.front_face);
|
||||
|
||||
cb.bindPipeline(vk::PipelineBindPoint::eGraphics, *get_pipeline(info));
|
||||
cb.bindPipeline(vk::PipelineBindPoint::eGraphics, *get_pipeline(info));
|
||||
|
||||
if (primitive.indexed)
|
||||
cb.bindIndexBuffer(*mesh.buffer, primitive.index_offset, primitive.index_type);
|
||||
cb.setViewport(0, vk::Viewport{
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = (float)output_size.width,
|
||||
.height = (float)output_size.height,
|
||||
.minDepth = 0,
|
||||
.maxDepth = 1,
|
||||
});
|
||||
|
||||
cb.bindVertexBuffers(0, (vk::Buffer)*mesh.buffer, primitive.vertex_offset);
|
||||
cb.setScissor(0, vk::Rect2D{
|
||||
.offset = {0, 0},
|
||||
.extent = output_size,
|
||||
});
|
||||
|
||||
vk::DescriptorBufferInfo buffer_info_1{
|
||||
.buffer = resources.uniform_buffer,
|
||||
.offset = frame_ubo_offset,
|
||||
.range = sizeof(frame_gpu_data)
|
||||
if (primitive.indexed)
|
||||
cb.bindIndexBuffer(*node.mesh->buffer, primitive.index_offset, primitive.index_type);
|
||||
|
||||
};
|
||||
vk::DescriptorBufferInfo buffer_info_2{
|
||||
.buffer = resources.uniform_buffer,
|
||||
.offset = instance_ubo_offset,
|
||||
.range = sizeof(instance_gpu_data)};
|
||||
vk::DescriptorBufferInfo buffer_info_3{
|
||||
.buffer = resources.uniform_buffer,
|
||||
.offset = joints_ubo_offset,
|
||||
.range = sizeof(glm::mat4) * 32};
|
||||
cb.bindVertexBuffers(0, (vk::Buffer)*node.mesh->buffer, primitive.vertex_offset);
|
||||
|
||||
std::array descriptors{
|
||||
vk::WriteDescriptorSet{
|
||||
.dstBinding = 0,
|
||||
.descriptorCount = 1,
|
||||
.descriptorType = vk::DescriptorType::eUniformBuffer,
|
||||
.pBufferInfo = &buffer_info_1,
|
||||
},
|
||||
vk::WriteDescriptorSet{
|
||||
.dstBinding = 1,
|
||||
.descriptorCount = 1,
|
||||
.descriptorType = vk::DescriptorType::eUniformBuffer,
|
||||
.pBufferInfo = &buffer_info_2,
|
||||
},
|
||||
vk::WriteDescriptorSet{
|
||||
.dstBinding = 2,
|
||||
.descriptorCount = 1,
|
||||
.descriptorType = vk::DescriptorType::eUniformBuffer,
|
||||
.pBufferInfo = &buffer_info_3,
|
||||
},
|
||||
};
|
||||
vk::DescriptorBufferInfo buffer_info_1{
|
||||
.buffer = resources.uniform_buffer,
|
||||
.offset = frame_ubo_offset,
|
||||
.range = sizeof(frame_gpu_data)
|
||||
|
||||
cb.pushDescriptorSetKHR(vk::PipelineBindPoint::eGraphics, *pipeline_layout, 0, descriptors);
|
||||
};
|
||||
vk::DescriptorBufferInfo buffer_info_2{
|
||||
.buffer = resources.uniform_buffer,
|
||||
.offset = instance_ubo_offset,
|
||||
.range = sizeof(instance_gpu_data)};
|
||||
vk::DescriptorBufferInfo buffer_info_3{
|
||||
.buffer = resources.uniform_buffer,
|
||||
.offset = joints_ubo_offset,
|
||||
.range = sizeof(glm::mat4) * 32};
|
||||
|
||||
// Set 1: material
|
||||
cb.bindDescriptorSets(vk::PipelineBindPoint::eGraphics, *pipeline_layout, 1, **material->ds, {});
|
||||
std::array descriptors{
|
||||
vk::WriteDescriptorSet{
|
||||
.dstBinding = 0,
|
||||
.descriptorCount = 1,
|
||||
.descriptorType = vk::DescriptorType::eUniformBuffer,
|
||||
.pBufferInfo = &buffer_info_1,
|
||||
},
|
||||
vk::WriteDescriptorSet{
|
||||
.dstBinding = 1,
|
||||
.descriptorCount = 1,
|
||||
.descriptorType = vk::DescriptorType::eUniformBuffer,
|
||||
.pBufferInfo = &buffer_info_2,
|
||||
},
|
||||
vk::WriteDescriptorSet{
|
||||
.dstBinding = 2,
|
||||
.descriptorCount = 1,
|
||||
.descriptorType = vk::DescriptorType::eUniformBuffer,
|
||||
.pBufferInfo = &buffer_info_3,
|
||||
},
|
||||
};
|
||||
|
||||
if (primitive.indexed)
|
||||
cb.drawIndexed(primitive.index_count, 1, 0, 0, 0);
|
||||
else
|
||||
cb.draw(primitive.vertex_count, 1, 0, 0);
|
||||
cb.pushDescriptorSetKHR(vk::PipelineBindPoint::eGraphics, *pipeline_layout, 0, descriptors);
|
||||
|
||||
resources.resources.push_back(material->ds);
|
||||
}
|
||||
// Set 1: material
|
||||
cb.bindDescriptorSets(vk::PipelineBindPoint::eGraphics, *pipeline_layout, 1, **material->ds, {});
|
||||
|
||||
if (primitive.indexed)
|
||||
cb.drawIndexed(primitive.index_count, 1, 0, 0, 0);
|
||||
else
|
||||
cb.draw(primitive.vertex_count, 1, 0, 0);
|
||||
|
||||
resources.resources.push_back(material->ds);
|
||||
}
|
||||
cb.endRenderPass();
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <glm/vec2.hpp>
|
||||
#include <glm/vec3.hpp>
|
||||
#include <glm/vec4.hpp>
|
||||
#include <map>
|
||||
#include <span>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
@@ -34,10 +33,22 @@
|
||||
#include "vk/allocation.h"
|
||||
|
||||
#include "render/growable_descriptor_pool.h"
|
||||
#include "render/scene_data.h"
|
||||
#include "render/scene_components.h"
|
||||
|
||||
struct renderpass_info
|
||||
{
|
||||
vk::Format color_format;
|
||||
vk::Format depth_format;
|
||||
bool keep_depth_buffer;
|
||||
vk::SampleCountFlagBits msaa_samples = vk::SampleCountFlagBits::e1;
|
||||
|
||||
bool operator==(const renderpass_info & other) const noexcept = default;
|
||||
};
|
||||
|
||||
struct pipeline_info
|
||||
{
|
||||
renderpass_info renderpass;
|
||||
|
||||
std::string shader_name;
|
||||
|
||||
vk::CullModeFlags cull_mode = vk::CullModeFlagBits::eNone;
|
||||
@@ -56,11 +67,35 @@ struct pipeline_info
|
||||
bool operator==(const pipeline_info & other) const noexcept = default;
|
||||
};
|
||||
|
||||
struct output_image_info
|
||||
{
|
||||
renderpass_info renderpass;
|
||||
|
||||
vk::Extent2D output_size;
|
||||
VkImage color;
|
||||
VkImage depth;
|
||||
uint32_t base_array_layer;
|
||||
|
||||
bool operator==(const output_image_info & other) const noexcept = default;
|
||||
};
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<renderpass_info> : utils::magic_hash<renderpass_info>
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct hash<pipeline_info> : utils::magic_hash<pipeline_info>
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct hash<vk::Extent2D> : utils::magic_hash<vk::Extent2D>
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct hash<output_image_info> : utils::magic_hash<output_image_info>
|
||||
{};
|
||||
} // namespace std
|
||||
|
||||
class scene_renderer
|
||||
@@ -70,11 +105,6 @@ class scene_renderer
|
||||
vk::PhysicalDeviceProperties physical_device_properties;
|
||||
vk::raii::Queue & queue;
|
||||
|
||||
// Scene format
|
||||
const vk::Extent2D output_size;
|
||||
const vk::Format output_format;
|
||||
const vk::Format depth_format;
|
||||
|
||||
// Destination images
|
||||
struct output_image
|
||||
{
|
||||
@@ -84,26 +114,28 @@ class scene_renderer
|
||||
image_allocation depth_buffer;
|
||||
vk::raii::ImageView depth_view = nullptr;
|
||||
|
||||
// image_allocation multisample_image;
|
||||
// vk::raii::ImageView multisample_view = nullptr;
|
||||
image_allocation multisample_image;
|
||||
vk::raii::ImageView multisample_view = nullptr;
|
||||
};
|
||||
|
||||
// Initialization functions
|
||||
output_image create_output_image_data(vk::Image output_color, vk::Image output_depth);
|
||||
vk::raii::RenderPass create_renderpass();
|
||||
output_image create_output_image_data(const output_image_info & info);
|
||||
vk::raii::RenderPass create_renderpass(const renderpass_info & info);
|
||||
vk::raii::PipelineLayout create_pipeline_layout(std::span<vk::DescriptorSetLayout> layouts);
|
||||
vk::raii::Pipeline create_pipeline(const pipeline_info & info);
|
||||
|
||||
std::shared_ptr<scene_data::texture> create_default_texture(vk::raii::CommandPool & cb_pool, std::vector<uint8_t> pixel);
|
||||
std::shared_ptr<scene_data::material> create_default_material(vk::raii::CommandPool & cb_pool);
|
||||
std::shared_ptr<renderer::texture> create_default_texture(vk::raii::CommandPool & cb_pool, std::vector<uint8_t> pixel);
|
||||
std::shared_ptr<renderer::material> create_default_material(vk::raii::CommandPool & cb_pool);
|
||||
vk::raii::DescriptorSetLayout create_descriptor_set_layout(std::span<vk::DescriptorSetLayoutBinding> bindings, vk::DescriptorSetLayoutCreateFlags flags = {});
|
||||
|
||||
// Caches
|
||||
std::/*unordered_*/ map<std::pair<VkImage, VkImage>, output_image> output_images; // TODO: use an unordered_map, create a hash for std::pair
|
||||
std::unordered_map<renderpass_info, vk::raii::RenderPass> renderpasses;
|
||||
std::unordered_map<output_image_info, output_image> output_images;
|
||||
std::unordered_map<pipeline_info, vk::raii::Pipeline> pipelines;
|
||||
|
||||
output_image & get_output_image_data(vk::Image output_color, vk::Image output_depth);
|
||||
output_image & get_output_image_data(const output_image_info & info);
|
||||
vk::raii::Pipeline & get_pipeline(const pipeline_info & info);
|
||||
vk::raii::RenderPass & get_renderpass(const renderpass_info & info);
|
||||
|
||||
vk::raii::DescriptorSetLayout layout_0; // Descriptor set 0: per-frame/view data (UBO) and per-instance data (UBO + SSBO)
|
||||
vk::raii::DescriptorSetLayout layout_1; // Descriptor set 1: per-material data (5 combined image samplers and 1 uniform buffer)
|
||||
@@ -114,11 +146,8 @@ class scene_renderer
|
||||
vk::raii::PipelineLayout pipeline_layout = nullptr;
|
||||
|
||||
// Texture samplers
|
||||
std::unordered_map<sampler_info, std::shared_ptr<vk::raii::Sampler>> samplers;
|
||||
vk::Sampler get_sampler(const sampler_info & info);
|
||||
|
||||
// Render pass
|
||||
vk::raii::RenderPass renderpass = nullptr;
|
||||
std::unordered_map<renderer::sampler_info, std::shared_ptr<vk::raii::Sampler>> samplers;
|
||||
vk::Sampler get_sampler(const renderer::sampler_info & info);
|
||||
|
||||
// Default material and textures
|
||||
// This material has 1x1 textures with the following values:
|
||||
@@ -134,7 +163,7 @@ class scene_renderer
|
||||
// roughness_factor 1.0
|
||||
// occlusion_strength 0.0
|
||||
// normal_scale 0.0
|
||||
std::shared_ptr<scene_data::material> default_material;
|
||||
std::shared_ptr<renderer::material> default_material;
|
||||
|
||||
struct frame_gpu_data
|
||||
{
|
||||
@@ -170,11 +199,10 @@ class scene_renderer
|
||||
int current_frame_index;
|
||||
vk::raii::QueryPool query_pool = nullptr;
|
||||
double gpu_time_s = 0;
|
||||
bool keep_depth_buffer = false;
|
||||
|
||||
per_frame_resources & current_frame();
|
||||
|
||||
void update_material_descriptor_set(scene_data::material & material);
|
||||
void update_material_descriptor_set(renderer::material & material);
|
||||
|
||||
public:
|
||||
static vk::Format find_usable_image_format(
|
||||
@@ -191,24 +219,27 @@ public:
|
||||
vk::raii::PhysicalDevice physical_device,
|
||||
vk::raii::Queue & queue,
|
||||
vk::raii::CommandPool & cb_pool,
|
||||
vk::Extent2D output_size,
|
||||
vk::Format output_format,
|
||||
vk::Format depth_format,
|
||||
int frames_in_flight = 2,
|
||||
bool keep_depth_buffer = false);
|
||||
int frames_in_flight = 2);
|
||||
|
||||
~scene_renderer();
|
||||
|
||||
struct frame_info
|
||||
{
|
||||
vk::Image destination;
|
||||
vk::Image depth_buffer;
|
||||
glm::mat4 projection;
|
||||
glm::mat4 view;
|
||||
};
|
||||
|
||||
void start_frame();
|
||||
void render(scene_data & scene, const std::array<float, 4> & clear_color, std::span<frame_info> info);
|
||||
void render(
|
||||
entt::registry & scene,
|
||||
const std::array<float, 4> & clear_color,
|
||||
uint32_t layer_mask,
|
||||
vk::Extent2D output_size,
|
||||
vk::Format output_format,
|
||||
vk::Format depth_format,
|
||||
vk::Image color_buffer,
|
||||
vk::Image depth_buffer,
|
||||
std::span<frame_info> info);
|
||||
void end_frame();
|
||||
|
||||
double get_gpu_time() const
|
||||
@@ -216,7 +247,7 @@ public:
|
||||
return gpu_time_s;
|
||||
}
|
||||
|
||||
std::shared_ptr<scene_data::material> get_default_material()
|
||||
std::shared_ptr<renderer::material> get_default_material()
|
||||
{
|
||||
return default_material;
|
||||
}
|
||||
|
||||
+398
-1
@@ -19,14 +19,25 @@
|
||||
|
||||
#include "scene.h"
|
||||
#include "application.h"
|
||||
#include "render/scene_loader.h"
|
||||
#include "utils/contains.h"
|
||||
#include "utils/i18n.h"
|
||||
#include "utils/overloaded.h"
|
||||
#include "utils/ranges.h"
|
||||
#include <magic_enum.hpp>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
#include <vulkan/vulkan_structs.hpp>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
// TODO remove constants
|
||||
#include "constants.h"
|
||||
|
||||
std::vector<scene::meta *> scene::scene_registry;
|
||||
|
||||
scene::~scene() {}
|
||||
|
||||
scene::scene(key, const meta & current_meta) :
|
||||
scene::scene(key, const meta & current_meta, std::span<const vk::Format> supported_color_formats, std::span<const vk::Format> supported_depth_formats) :
|
||||
instance(application::instance().xr_instance),
|
||||
system(application::instance().xr_system_id),
|
||||
session(application::instance().xr_session),
|
||||
@@ -40,7 +51,46 @@ scene::scene(key, const meta & current_meta) :
|
||||
queue_family_index(application::instance().vk_queue_family_index),
|
||||
current_meta(current_meta)
|
||||
{
|
||||
passthrough_supported = system.passthrough_supported();
|
||||
|
||||
swapchain_format = vk::Format::eUndefined;
|
||||
spdlog::info("Supported swapchain formats:");
|
||||
|
||||
for (auto format: session.get_swapchain_formats())
|
||||
{
|
||||
spdlog::info(" {}", vk::to_string(format));
|
||||
}
|
||||
|
||||
for (auto format: session.get_swapchain_formats())
|
||||
{
|
||||
if (utils::contains(supported_color_formats, format))
|
||||
{
|
||||
swapchain_format = format;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (swapchain_format == vk::Format::eUndefined)
|
||||
throw std::runtime_error(_("No supported swapchain format"));
|
||||
|
||||
auto views = system.view_configuration_views(viewconfig);
|
||||
depth_format = scene_renderer::find_usable_image_format(
|
||||
physical_device,
|
||||
supported_depth_formats,
|
||||
{
|
||||
views[0].recommendedImageRectWidth,
|
||||
views[0].recommendedImageRectHeight,
|
||||
1,
|
||||
},
|
||||
vk::ImageUsageFlagBits::eDepthStencilAttachment);
|
||||
|
||||
composition_layer_depth_test_supported =
|
||||
instance.has_extension(XR_KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME) and
|
||||
instance.has_extension(XR_FB_COMPOSITION_LAYER_DEPTH_TEST_EXTENSION_NAME);
|
||||
|
||||
composition_layer_color_scale_bias_supported = instance.has_extension(XR_KHR_COMPOSITION_LAYER_COLOR_SCALE_BIAS_EXTENSION_NAME);
|
||||
}
|
||||
|
||||
void scene::set_focused(bool status)
|
||||
{
|
||||
if (status != focused)
|
||||
@@ -53,6 +103,353 @@ void scene::set_focused(bool status)
|
||||
}
|
||||
}
|
||||
|
||||
glm::mat4 scene::projection_matrix(XrFovf fov, float zn)
|
||||
{
|
||||
float r = tan(fov.angleRight);
|
||||
float l = tan(fov.angleLeft);
|
||||
float t = tan(fov.angleUp);
|
||||
float b = tan(fov.angleDown);
|
||||
|
||||
// reversed Z projection, infinite far plane
|
||||
|
||||
// clang-format off
|
||||
return glm::mat4{
|
||||
{ 2/(r-l), 0, 0, 0 },
|
||||
{ 0, 2/(b-t), 0, 0 },
|
||||
{ (l+r)/(r-l), (t+b)/(b-t), 0, -1 },
|
||||
{ 0, 0, zn, 0 }
|
||||
};
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
glm::mat4 scene::view_matrix(XrPosef pose)
|
||||
{
|
||||
XrQuaternionf q = pose.orientation;
|
||||
XrVector3f pos = pose.position;
|
||||
|
||||
glm::mat4 inv_view_matrix = glm::mat4_cast(glm::quat(q.w, q.x, q.y, q.z));
|
||||
|
||||
inv_view_matrix = glm::translate(glm::mat4(1), glm::vec3(pos.x, pos.y, pos.z)) * inv_view_matrix;
|
||||
|
||||
return glm::inverse(inv_view_matrix);
|
||||
}
|
||||
|
||||
void scene::render_world(
|
||||
XrCompositionLayerFlags flags,
|
||||
XrSpace space,
|
||||
std::span<XrView> views,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
bool keep_depth_buffer,
|
||||
uint32_t layer_mask,
|
||||
XrColor4f clear_color)
|
||||
{
|
||||
std::vector<scene_renderer::frame_info> frames;
|
||||
frames.reserve(views.size());
|
||||
|
||||
// TODO inplace vector
|
||||
std::vector<XrCompositionLayerProjectionView> composition_layer_color;
|
||||
std::vector<XrCompositionLayerDepthInfoKHR> composition_layer_depth;
|
||||
|
||||
composition_layer_color.reserve(views.size());
|
||||
if (keep_depth_buffer)
|
||||
composition_layer_depth.reserve(views.size());
|
||||
|
||||
auto [color_swapchain, color_image] = [&]() -> std::pair<XrSwapchain, vk::Image> {
|
||||
xr::swapchain & color_swapchain = get_swapchain(swapchain_format, width, height, 1, views.size());
|
||||
|
||||
int color_image_index = color_swapchain.acquire();
|
||||
vk::Image color_image = color_swapchain.images()[color_image_index].image;
|
||||
color_swapchain.wait();
|
||||
return {color_swapchain, color_image};
|
||||
}();
|
||||
|
||||
auto [depth_swapchain, depth_image] = [&]() -> std::pair<XrSwapchain, vk::Image> {
|
||||
if (keep_depth_buffer)
|
||||
{
|
||||
xr::swapchain & depth_swapchain = get_swapchain(depth_format, width, height, 1, views.size());
|
||||
|
||||
int depth_image_index = depth_swapchain.acquire();
|
||||
vk::Image depth_image = depth_swapchain.images()[depth_image_index].image;
|
||||
depth_swapchain.wait();
|
||||
return {depth_swapchain, depth_image};
|
||||
}
|
||||
else
|
||||
return {};
|
||||
}();
|
||||
|
||||
for (auto && [index, view]: utils::enumerate(views))
|
||||
{
|
||||
frames.push_back({
|
||||
.projection = projection_matrix(view.fov, constants::lobby::near_plane),
|
||||
.view = view_matrix(view.pose),
|
||||
});
|
||||
|
||||
composition_layer_color.push_back({
|
||||
.type = XR_TYPE_COMPOSITION_LAYER_PROJECTION_VIEW,
|
||||
.pose = view.pose,
|
||||
.fov = view.fov,
|
||||
.subImage = {
|
||||
.swapchain = color_swapchain,
|
||||
.imageRect = {
|
||||
.offset = {0, 0},
|
||||
.extent = {(int)width, (int)height},
|
||||
},
|
||||
.imageArrayIndex = (uint32_t)index,
|
||||
},
|
||||
});
|
||||
|
||||
if (keep_depth_buffer)
|
||||
{
|
||||
composition_layer_depth.push_back({
|
||||
.type = XR_TYPE_COMPOSITION_LAYER_DEPTH_INFO_KHR,
|
||||
.subImage = {
|
||||
.swapchain = depth_swapchain,
|
||||
.imageRect = {
|
||||
.offset = {0, 0},
|
||||
.extent = {(int)width, (int)height},
|
||||
},
|
||||
.imageArrayIndex = (uint32_t)index,
|
||||
},
|
||||
.minDepth = 0,
|
||||
.maxDepth = 1,
|
||||
.nearZ = std::numeric_limits<float>::infinity(),
|
||||
.farZ = constants::lobby::near_plane,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: compute transforms only once
|
||||
|
||||
renderer->render(
|
||||
world,
|
||||
{clear_color.r, clear_color.g, clear_color.b, clear_color.a},
|
||||
layer_mask,
|
||||
vk::Extent2D{width, height},
|
||||
swapchain_format,
|
||||
depth_format,
|
||||
color_image,
|
||||
depth_image,
|
||||
frames);
|
||||
|
||||
add_projection_layer(
|
||||
XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT,
|
||||
space,
|
||||
std::move(composition_layer_color),
|
||||
std::move(composition_layer_depth));
|
||||
}
|
||||
|
||||
xr::swapchain & scene::get_swapchain(vk::Format format, int32_t width, int32_t height, int sample_count, uint32_t array_size)
|
||||
{
|
||||
for (swapchain_entry & entry: swapchains)
|
||||
{
|
||||
if (not entry.used and
|
||||
entry.format == format and
|
||||
entry.width == width and
|
||||
entry.height == height and
|
||||
entry.sample_count == sample_count and
|
||||
entry.array_size == array_size)
|
||||
{
|
||||
entry.used = true;
|
||||
return entry.swapchain;
|
||||
}
|
||||
}
|
||||
|
||||
spdlog::info("Creating new swapchain: {}, {}x{}, {} sample(s), {} level(s)", magic_enum::enum_name(format), width, height, sample_count, array_size);
|
||||
|
||||
return swapchains.emplace_back(swapchain_entry{
|
||||
.format = format,
|
||||
.width = width,
|
||||
.height = height,
|
||||
.sample_count = sample_count,
|
||||
.array_size = array_size,
|
||||
.used = true,
|
||||
.swapchain = xr::swapchain(session, device, format, width, height, sample_count, array_size),
|
||||
})
|
||||
.swapchain;
|
||||
}
|
||||
|
||||
void scene::clear_swapchains()
|
||||
{
|
||||
swapchains.clear();
|
||||
}
|
||||
|
||||
void scene::render_start(bool passthrough, XrTime predicted_display_time_)
|
||||
{
|
||||
blend_mode = XR_ENVIRONMENT_BLEND_MODE_OPAQUE;
|
||||
predicted_display_time = predicted_display_time_;
|
||||
layers.clear();
|
||||
openxr_layers.clear();
|
||||
|
||||
for (swapchain_entry & swapchain: swapchains)
|
||||
swapchain.used = false;
|
||||
|
||||
if (renderer)
|
||||
renderer->start_frame();
|
||||
|
||||
if (passthrough)
|
||||
{
|
||||
std::visit(
|
||||
utils::overloaded{
|
||||
[&](std::monostate &) {
|
||||
assert(false);
|
||||
},
|
||||
[&](xr::passthrough_alpha_blend & p) {
|
||||
blend_mode = XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND;
|
||||
},
|
||||
[&](auto & p) {
|
||||
layers.push_back(layer{
|
||||
.composition_layer = p.layer(),
|
||||
});
|
||||
}},
|
||||
session.get_passthrough());
|
||||
}
|
||||
}
|
||||
|
||||
void scene::add_projection_layer(
|
||||
XrCompositionLayerFlags flags,
|
||||
XrSpace space,
|
||||
std::vector<XrCompositionLayerProjectionView> && color_views,
|
||||
std::vector<XrCompositionLayerDepthInfoKHR> && depth_views)
|
||||
{
|
||||
layers.push_back(layer{
|
||||
.composition_layer = XrCompositionLayerProjection{
|
||||
.type = XR_TYPE_COMPOSITION_LAYER_PROJECTION,
|
||||
.next = nullptr,
|
||||
.layerFlags = flags,
|
||||
.space = space,
|
||||
.viewCount = (uint32_t)color_views.size(),
|
||||
.views = nullptr,
|
||||
},
|
||||
.color_views = std::move(color_views),
|
||||
.depth_views = std::move(depth_views),
|
||||
});
|
||||
}
|
||||
|
||||
void scene::add_quad_layer(
|
||||
XrCompositionLayerFlags flags,
|
||||
XrSpace space,
|
||||
XrEyeVisibility eyeVisibility,
|
||||
XrSwapchainSubImage subImage,
|
||||
XrPosef pose,
|
||||
XrExtent2Df size)
|
||||
{
|
||||
layers.push_back(layer{
|
||||
.composition_layer = XrCompositionLayerQuad{
|
||||
.type = XR_TYPE_COMPOSITION_LAYER_QUAD,
|
||||
.next = nullptr,
|
||||
.layerFlags = flags,
|
||||
.space = space,
|
||||
.eyeVisibility = eyeVisibility,
|
||||
.subImage = subImage,
|
||||
.pose = pose,
|
||||
.size = size,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
void scene::set_color_scale_bias(XrColor4f scale, XrColor4f bias)
|
||||
{
|
||||
assert(not layers.empty());
|
||||
layers.back().color_scale_bias = XrCompositionLayerColorScaleBiasKHR{
|
||||
.type = XR_TYPE_COMPOSITION_LAYER_COLOR_SCALE_BIAS_KHR,
|
||||
.colorScale = scale,
|
||||
.colorBias = bias,
|
||||
};
|
||||
}
|
||||
|
||||
void scene::set_depth_test(bool write, XrCompareOpFB op)
|
||||
{
|
||||
assert(not layers.empty());
|
||||
layers.back().depth_test = XrCompositionLayerDepthTestFB{
|
||||
.type = XR_TYPE_COMPOSITION_LAYER_DEPTH_TEST_FB,
|
||||
.depthMask = write,
|
||||
.compareOp = op,
|
||||
};
|
||||
}
|
||||
|
||||
void scene::set_layer_settings(XrCompositionLayerSettingsFlagsFB flags)
|
||||
{
|
||||
assert(not layers.empty());
|
||||
layers.back().settings = XrCompositionLayerSettingsFB{
|
||||
.type = XR_TYPE_COMPOSITION_LAYER_SETTINGS_FB,
|
||||
.layerFlags = flags,
|
||||
};
|
||||
}
|
||||
|
||||
void scene::render_end()
|
||||
{
|
||||
// Fixup all pointers
|
||||
for (auto & i: layers)
|
||||
{
|
||||
XrCompositionLayerBaseHeader * base = std::visit(
|
||||
utils::overloaded{
|
||||
[&](XrCompositionLayerProjection & layer) {
|
||||
layer.views = i.color_views.data();
|
||||
|
||||
for (auto [color, depth]: std::views::zip(i.color_views, i.depth_views))
|
||||
color.next = &depth;
|
||||
|
||||
return reinterpret_cast<XrCompositionLayerBaseHeader *>(&layer);
|
||||
},
|
||||
[&](XrCompositionLayerQuad & layer) {
|
||||
return reinterpret_cast<XrCompositionLayerBaseHeader *>(&layer);
|
||||
},
|
||||
[&](XrCompositionLayerBaseHeader * layer) {
|
||||
return layer;
|
||||
},
|
||||
},
|
||||
i.composition_layer);
|
||||
|
||||
if (i.color_scale_bias)
|
||||
{
|
||||
i.color_scale_bias->next = base->next;
|
||||
base->next = &*i.color_scale_bias;
|
||||
}
|
||||
|
||||
if (i.depth_test)
|
||||
{
|
||||
i.depth_test->next = base->next;
|
||||
base->next = &*i.depth_test;
|
||||
}
|
||||
|
||||
if (i.settings)
|
||||
{
|
||||
i.settings->type = XR_TYPE_COMPOSITION_LAYER_SETTINGS_FB;
|
||||
i.settings->next = base->next;
|
||||
base->next = &*i.settings;
|
||||
}
|
||||
|
||||
openxr_layers.push_back(base);
|
||||
}
|
||||
|
||||
if (renderer)
|
||||
renderer->end_frame();
|
||||
|
||||
// Release all swapchains after the renderer has submitted the command buffers
|
||||
for (auto & swapchain: swapchains)
|
||||
{
|
||||
if (swapchain.used)
|
||||
swapchain.swapchain.release();
|
||||
}
|
||||
|
||||
session.end_frame(predicted_display_time, openxr_layers, blend_mode);
|
||||
}
|
||||
|
||||
std::pair<entt::entity, components::node &> scene::load_gltf(const std::filesystem::path & path, uint32_t layer_mask)
|
||||
{
|
||||
auto entity = world.create();
|
||||
auto & node = world.emplace<components::node>(entity);
|
||||
node.layer_mask = layer_mask;
|
||||
|
||||
assert(renderer);
|
||||
scene_loader loader(device, physical_device, queue, application::queue_family_index(), renderer->get_default_material());
|
||||
|
||||
loader.add_prefab(world, loader(path), entity);
|
||||
|
||||
return {entity, node};
|
||||
}
|
||||
|
||||
void scene::on_unfocused() {}
|
||||
void scene::on_focused() {}
|
||||
void scene::on_xr_event(const xr::event &) {}
|
||||
|
||||
+101
-3
@@ -19,16 +19,25 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "render/scene_loader.h"
|
||||
#include "xr/actionset.h"
|
||||
#include "xr/instance.h"
|
||||
#include "xr/session.h"
|
||||
#include "xr/swapchain.h"
|
||||
#include "xr/system.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "render/imgui_impl.h"
|
||||
#include "render/scene_renderer.h"
|
||||
#include <entt/entity/registry.hpp>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
// See http://www.nirfriedman.com/2018/04/29/unforgettable-factory/
|
||||
// for automatic registration of scenes
|
||||
|
||||
@@ -86,6 +95,18 @@ protected:
|
||||
|
||||
const meta & current_meta;
|
||||
|
||||
std::optional<scene_renderer> renderer;
|
||||
|
||||
public:
|
||||
std::optional<scene_loader> loader;
|
||||
|
||||
protected:
|
||||
vk::Format swapchain_format;
|
||||
vk::Format depth_format;
|
||||
xr::system::passthrough_type passthrough_supported;
|
||||
bool composition_layer_depth_test_supported;
|
||||
bool composition_layer_color_scale_bias_supported;
|
||||
|
||||
std::pair<XrAction, XrActionType> get_action(const std::string & name)
|
||||
{
|
||||
return current_meta.actions_by_name.at(name);
|
||||
@@ -96,17 +117,94 @@ protected:
|
||||
return current_meta.spaces_by_name.at(name);
|
||||
}
|
||||
|
||||
// Helper functions
|
||||
static glm::mat4 projection_matrix(XrFovf fov, float zn = 0.02);
|
||||
static glm::mat4 view_matrix(XrPosef pose);
|
||||
|
||||
// Layer rendering
|
||||
XrEnvironmentBlendMode blend_mode;
|
||||
XrTime predicted_display_time;
|
||||
|
||||
struct layer
|
||||
{
|
||||
std::variant<XrCompositionLayerProjection, XrCompositionLayerQuad, XrCompositionLayerBaseHeader *> composition_layer;
|
||||
|
||||
// TODO in place vectors
|
||||
std::vector<XrCompositionLayerProjectionView> color_views; // Used by XrCompositionLayerProjection
|
||||
std::vector<XrCompositionLayerDepthInfoKHR> depth_views; // Used by XrCompositionLayerProjection
|
||||
|
||||
std::optional<XrCompositionLayerColorScaleBiasKHR> color_scale_bias;
|
||||
std::optional<XrCompositionLayerDepthTestFB> depth_test;
|
||||
std::optional<XrCompositionLayerSettingsFB> settings;
|
||||
};
|
||||
|
||||
std::vector<layer> layers;
|
||||
std::vector<XrCompositionLayerBaseHeader *> openxr_layers;
|
||||
|
||||
struct swapchain_entry
|
||||
{
|
||||
vk::Format format;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
int sample_count;
|
||||
uint32_t array_size;
|
||||
|
||||
bool used;
|
||||
xr::swapchain swapchain;
|
||||
};
|
||||
std::vector<swapchain_entry> swapchains;
|
||||
|
||||
// The returned reference is valid until the next call to get_swapchain
|
||||
xr::swapchain & get_swapchain(vk::Format format, int32_t width, int32_t height, int sample_count, uint32_t array_size);
|
||||
void clear_swapchains();
|
||||
|
||||
void render_start(bool passthrough, XrTime predicted_display_time);
|
||||
|
||||
void add_projection_layer(
|
||||
XrCompositionLayerFlags flags,
|
||||
XrSpace space,
|
||||
std::vector<XrCompositionLayerProjectionView> && color_views,
|
||||
std::vector<XrCompositionLayerDepthInfoKHR> && depth_views = {});
|
||||
|
||||
void add_quad_layer(
|
||||
XrCompositionLayerFlags flags,
|
||||
XrSpace space,
|
||||
XrEyeVisibility eyeVisibility,
|
||||
XrSwapchainSubImage subImage,
|
||||
XrPosef pose,
|
||||
XrExtent2Df size);
|
||||
|
||||
void render_world(
|
||||
XrCompositionLayerFlags flags,
|
||||
XrSpace space,
|
||||
std::span<XrView> views,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
bool keep_depth_buffer,
|
||||
uint32_t layer_mask,
|
||||
XrColor4f clear_color);
|
||||
|
||||
void set_color_scale_bias(XrColor4f scale, XrColor4f bias);
|
||||
void set_depth_test(bool write, XrCompareOpFB op);
|
||||
void set_layer_settings(XrCompositionLayerSettingsFlagsFB flags);
|
||||
|
||||
void render_end();
|
||||
|
||||
virtual void on_unfocused();
|
||||
virtual void on_focused();
|
||||
|
||||
public:
|
||||
scene(key, const meta &);
|
||||
scene(key, const meta &, std::span<const vk::Format> supported_color_formats, std::span<const vk::Format> supported_depth_formats);
|
||||
|
||||
virtual ~scene();
|
||||
|
||||
void set_focused(bool status);
|
||||
virtual void render(const XrFrameState &) = 0;
|
||||
virtual void on_xr_event(const xr::event &);
|
||||
|
||||
entt::registry world;
|
||||
std::pair<entt::entity, components::node &> load_gltf(const std::filesystem::path & path, uint32_t layer_mask = -1);
|
||||
void remove(entt::entity entity); // TODO
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
@@ -124,8 +222,8 @@ class scene_impl : public scene
|
||||
|
||||
static inline bool registered = scene_impl<T>::register_scene();
|
||||
|
||||
scene_impl() :
|
||||
scene(key{}, T::get_meta_scene())
|
||||
scene_impl(std::span<const vk::Format> supported_color_formats, std::span<const vk::Format> supported_depth_formats = {}) :
|
||||
scene(key{}, T::get_meta_scene(), supported_color_formats, supported_depth_formats)
|
||||
{
|
||||
(void)registered;
|
||||
}
|
||||
|
||||
@@ -18,72 +18,113 @@
|
||||
|
||||
#include "hand_model.h"
|
||||
#include "openxr/openxr.h"
|
||||
#include <ranges>
|
||||
#include "render/scene_components.h"
|
||||
#include <entt/entt.hpp>
|
||||
#include <magic_enum.hpp>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
hand_model::hand_model(const std::filesystem::path & gltf_path, scene_loader & loader, scene_data & scene)
|
||||
namespace components
|
||||
{
|
||||
root_node = scene.new_node();
|
||||
root_node->name = gltf_path.stem();
|
||||
struct hand_joint
|
||||
{
|
||||
XrHandEXT hand;
|
||||
XrHandJointEXT joint;
|
||||
};
|
||||
} // namespace components
|
||||
|
||||
scene.import(loader(gltf_path), root_node);
|
||||
static const std::array<std::pair<XrHandJointEXT, std::string_view>, XR_HAND_JOINT_COUNT_EXT - 1 /* No palm in gltf */> joints{{
|
||||
// clang-format off
|
||||
{XR_HAND_JOINT_WRIST_EXT, "wrist"},
|
||||
{XR_HAND_JOINT_THUMB_METACARPAL_EXT, "thumb-metacarpal"},
|
||||
{XR_HAND_JOINT_THUMB_PROXIMAL_EXT, "thumb-phalanx-proximal"},
|
||||
{XR_HAND_JOINT_THUMB_DISTAL_EXT, "thumb-phalanx-distal"},
|
||||
{XR_HAND_JOINT_THUMB_TIP_EXT, "thumb-tip"},
|
||||
{XR_HAND_JOINT_INDEX_METACARPAL_EXT, "index-finger-metacarpal"},
|
||||
{XR_HAND_JOINT_INDEX_PROXIMAL_EXT, "index-finger-phalanx-proximal"},
|
||||
{XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT, "index-finger-phalanx-intermediate"},
|
||||
{XR_HAND_JOINT_INDEX_DISTAL_EXT, "index-finger-phalanx-distal"},
|
||||
{XR_HAND_JOINT_INDEX_TIP_EXT, "index-finger-tip"},
|
||||
{XR_HAND_JOINT_MIDDLE_METACARPAL_EXT, "middle-finger-metacarpal"},
|
||||
{XR_HAND_JOINT_MIDDLE_PROXIMAL_EXT, "middle-finger-phalanx-proximal"},
|
||||
{XR_HAND_JOINT_MIDDLE_INTERMEDIATE_EXT, "middle-finger-phalanx-intermediate"},
|
||||
{XR_HAND_JOINT_MIDDLE_DISTAL_EXT, "middle-finger-phalanx-distal"},
|
||||
{XR_HAND_JOINT_MIDDLE_TIP_EXT, "middle-finger-tip"},
|
||||
{XR_HAND_JOINT_RING_METACARPAL_EXT, "ring-finger-metacarpal"},
|
||||
{XR_HAND_JOINT_RING_PROXIMAL_EXT, "ring-finger-phalanx-proximal"},
|
||||
{XR_HAND_JOINT_RING_INTERMEDIATE_EXT, "ring-finger-phalanx-intermediate"},
|
||||
{XR_HAND_JOINT_RING_DISTAL_EXT, "ring-finger-phalanx-distal"},
|
||||
{XR_HAND_JOINT_RING_TIP_EXT, "ring-finger-tip"},
|
||||
{XR_HAND_JOINT_LITTLE_METACARPAL_EXT, "pinky-finger-metacarpal"},
|
||||
{XR_HAND_JOINT_LITTLE_PROXIMAL_EXT, "pinky-finger-phalanx-proximal"},
|
||||
{XR_HAND_JOINT_LITTLE_INTERMEDIATE_EXT, "pinky-finger-phalanx-intermediate"},
|
||||
{XR_HAND_JOINT_LITTLE_DISTAL_EXT, "pinky-finger-phalanx-distal"},
|
||||
{XR_HAND_JOINT_LITTLE_TIP_EXT, "pinky-finger-tip"},
|
||||
// clang-format on
|
||||
}};
|
||||
|
||||
joints.resize(XR_HAND_JOINT_COUNT_EXT);
|
||||
// clang-format off
|
||||
joints[XR_HAND_JOINT_PALM_EXT] = node_handle();
|
||||
joints[XR_HAND_JOINT_WRIST_EXT] = scene.find_node(root_node, "wrist");
|
||||
joints[XR_HAND_JOINT_THUMB_METACARPAL_EXT] = scene.find_node(root_node, "thumb-metacarpal");
|
||||
joints[XR_HAND_JOINT_THUMB_PROXIMAL_EXT] = scene.find_node(root_node, "thumb-phalanx-proximal");
|
||||
joints[XR_HAND_JOINT_THUMB_DISTAL_EXT] = scene.find_node(root_node, "thumb-phalanx-distal");
|
||||
joints[XR_HAND_JOINT_THUMB_TIP_EXT] = scene.find_node(root_node, "thumb-tip");
|
||||
joints[XR_HAND_JOINT_INDEX_METACARPAL_EXT] = scene.find_node(root_node, "index-finger-metacarpal");
|
||||
joints[XR_HAND_JOINT_INDEX_PROXIMAL_EXT] = scene.find_node(root_node, "index-finger-phalanx-proximal");
|
||||
joints[XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT] = scene.find_node(root_node, "index-finger-phalanx-intermediate");
|
||||
joints[XR_HAND_JOINT_INDEX_DISTAL_EXT] = scene.find_node(root_node, "index-finger-phalanx-distal");
|
||||
joints[XR_HAND_JOINT_INDEX_TIP_EXT] = scene.find_node(root_node, "index-finger-tip");
|
||||
joints[XR_HAND_JOINT_MIDDLE_METACARPAL_EXT] = scene.find_node(root_node, "middle-finger-metacarpal");
|
||||
joints[XR_HAND_JOINT_MIDDLE_PROXIMAL_EXT] = scene.find_node(root_node, "middle-finger-phalanx-proximal");
|
||||
joints[XR_HAND_JOINT_MIDDLE_INTERMEDIATE_EXT] = scene.find_node(root_node, "middle-finger-phalanx-intermediate");
|
||||
joints[XR_HAND_JOINT_MIDDLE_DISTAL_EXT] = scene.find_node(root_node, "middle-finger-phalanx-distal");
|
||||
joints[XR_HAND_JOINT_MIDDLE_TIP_EXT] = scene.find_node(root_node, "middle-finger-tip");
|
||||
joints[XR_HAND_JOINT_RING_METACARPAL_EXT] = scene.find_node(root_node, "ring-finger-metacarpal");
|
||||
joints[XR_HAND_JOINT_RING_PROXIMAL_EXT] = scene.find_node(root_node, "ring-finger-phalanx-proximal");
|
||||
joints[XR_HAND_JOINT_RING_INTERMEDIATE_EXT] = scene.find_node(root_node, "ring-finger-phalanx-intermediate");
|
||||
joints[XR_HAND_JOINT_RING_DISTAL_EXT] = scene.find_node(root_node, "ring-finger-phalanx-distal");
|
||||
joints[XR_HAND_JOINT_RING_TIP_EXT] = scene.find_node(root_node, "ring-finger-tip");
|
||||
joints[XR_HAND_JOINT_LITTLE_METACARPAL_EXT] = scene.find_node(root_node, "pinky-finger-metacarpal");
|
||||
joints[XR_HAND_JOINT_LITTLE_PROXIMAL_EXT] = scene.find_node(root_node, "pinky-finger-phalanx-proximal");
|
||||
joints[XR_HAND_JOINT_LITTLE_INTERMEDIATE_EXT] = scene.find_node(root_node, "pinky-finger-phalanx-intermediate");
|
||||
joints[XR_HAND_JOINT_LITTLE_DISTAL_EXT] = scene.find_node(root_node, "pinky-finger-phalanx-distal");
|
||||
joints[XR_HAND_JOINT_LITTLE_TIP_EXT] = scene.find_node(root_node, "pinky-finger-tip");
|
||||
// clang-format on
|
||||
void hand_model::add_hand(scene & scene,
|
||||
XrHandEXT hand,
|
||||
const std::filesystem::path & gltf_path,
|
||||
uint32_t layer_mask)
|
||||
{
|
||||
auto && [entity, node] = scene.load_gltf(gltf_path, layer_mask);
|
||||
|
||||
node.name = gltf_path.stem();
|
||||
|
||||
for (auto [joint, name]: joints)
|
||||
{
|
||||
entt::entity joint_entity = find_node_by_name(scene.world, name, entity);
|
||||
|
||||
scene.world.emplace<components::hand_joint>(joint_entity, hand, joint);
|
||||
}
|
||||
|
||||
// Fake joint to hide the hand when it should not be visible
|
||||
scene.world.emplace<components::hand_joint>(entity, hand, (XrHandJointEXT)-1);
|
||||
}
|
||||
|
||||
void hand_model::apply(const std::optional<std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT>> & joints_location)
|
||||
void hand_model::apply(entt::registry & scene,
|
||||
const std::optional<std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT>> & left_hand,
|
||||
const std::optional<std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT>> & right_hand)
|
||||
{
|
||||
if (joints_location and xr::hand_tracker::check_flags(*joints_location, XR_SPACE_LOCATION_POSITION_VALID_BIT | XR_SPACE_LOCATION_POSITION_TRACKED_BIT, 0))
|
||||
for (auto && [entity, hj, node]: scene.view<components::hand_joint, components::node>().each())
|
||||
{
|
||||
root_node->visible = true;
|
||||
auto f = [&](const std::optional<std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT>> & joints) {
|
||||
if (joints.has_value())
|
||||
{
|
||||
node.visible = true;
|
||||
|
||||
for (auto && [joint, loc]: std::views::zip(joints, *joints_location))
|
||||
if (hj.joint < 0 or hj.joint > XR_HAND_JOINT_COUNT_EXT)
|
||||
return;
|
||||
|
||||
const auto & pose = (*joints)[hj.joint].first.pose;
|
||||
|
||||
node.position = {
|
||||
pose.position.x,
|
||||
pose.position.y,
|
||||
pose.position.z};
|
||||
|
||||
node.orientation = {
|
||||
pose.orientation.w,
|
||||
pose.orientation.x,
|
||||
pose.orientation.y,
|
||||
pose.orientation.z};
|
||||
}
|
||||
else
|
||||
{
|
||||
node.visible = false;
|
||||
}
|
||||
};
|
||||
|
||||
switch (hj.hand)
|
||||
{
|
||||
if (!joint)
|
||||
continue;
|
||||
|
||||
joint->position = {
|
||||
loc.first.pose.position.x,
|
||||
loc.first.pose.position.y,
|
||||
loc.first.pose.position.z};
|
||||
|
||||
joint->orientation = {
|
||||
loc.first.pose.orientation.w,
|
||||
loc.first.pose.orientation.x,
|
||||
loc.first.pose.orientation.y,
|
||||
loc.first.pose.orientation.z};
|
||||
case XR_HAND_LEFT_EXT:
|
||||
f(left_hand);
|
||||
break;
|
||||
case XR_HAND_RIGHT_EXT:
|
||||
f(right_hand);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
root_node->visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,16 +18,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "scene.h"
|
||||
#include "xr/hand_tracker.h"
|
||||
#include <render/scene_data.h>
|
||||
#include <entt/fwd.hpp>
|
||||
#include <filesystem>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
struct hand_model
|
||||
namespace hand_model
|
||||
{
|
||||
node_handle root_node;
|
||||
std::vector<node_handle> joints;
|
||||
void add_hand(scene & scene,
|
||||
XrHandEXT hand,
|
||||
const std::filesystem::path & gltf_path,
|
||||
uint32_t layer_mask);
|
||||
|
||||
hand_model(const std::filesystem::path & gltf_path, scene_loader & loader, scene_data & scene);
|
||||
|
||||
void apply(const std::optional<std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT>> & joints);
|
||||
};
|
||||
void apply(entt::registry & scene,
|
||||
const std::optional<std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT>> & left_hand,
|
||||
const std::optional<std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT>> & right_hand);
|
||||
}; // namespace hand_model
|
||||
|
||||
+130
-85
@@ -21,6 +21,9 @@
|
||||
#include "application.h"
|
||||
#include "asset.h"
|
||||
#include "hardware.h"
|
||||
#include "render/scene_components.h"
|
||||
#include "xr/space.h"
|
||||
#include <entt/entt.hpp>
|
||||
#include <glm/gtc/matrix_access.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <magic_enum.hpp>
|
||||
@@ -29,9 +32,47 @@
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <variant>
|
||||
|
||||
namespace components
|
||||
{
|
||||
namespace details
|
||||
{
|
||||
struct node_state_transform
|
||||
{
|
||||
glm::vec3 position;
|
||||
glm::quat orientation;
|
||||
};
|
||||
|
||||
struct node_state_visibility
|
||||
{
|
||||
};
|
||||
|
||||
using node_state = std::variant<std::pair<node_state_transform, node_state_transform>, node_state_visibility>;
|
||||
} // namespace details
|
||||
|
||||
// Component added to nodes affected by actions
|
||||
struct visual_response
|
||||
{
|
||||
XrAction action;
|
||||
XrActionType type;
|
||||
int axis; // Only if type is XR_ACTION_TYPE_VECTOR2F_INPUT
|
||||
float bias;
|
||||
float scale;
|
||||
|
||||
details::node_state state;
|
||||
};
|
||||
} // namespace components
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
// Component added to nodes bound to an action space
|
||||
struct bound_space
|
||||
{
|
||||
xr::spaces space;
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
const std::unordered_map<std::string, std::string> input_mappings = {
|
||||
{"xr-standard-squeeze" , "/input/squeeze/value" },
|
||||
@@ -125,14 +166,14 @@ struct json_visual_response
|
||||
component_type type;
|
||||
component_property property;
|
||||
std::string target_node;
|
||||
input_profile::node_state state;
|
||||
components::details::node_state state;
|
||||
|
||||
// OpenXR component path
|
||||
std::string component_subpath;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
input_profile::input_profile(const std::filesystem::path & json_profile, scene_loader & loader, scene_data & scene_controllers, scene_data & scene_rays)
|
||||
input_profile::input_profile(scene & scene, const std::filesystem::path & json_profile, uint32_t layer_mask_controller, uint32_t layer_mask_ray)
|
||||
{
|
||||
std::string json = asset(json_profile);
|
||||
|
||||
@@ -141,17 +182,20 @@ input_profile::input_profile(const std::filesystem::path & json_profile, scene_l
|
||||
|
||||
id = std::string(root["profileId"]);
|
||||
|
||||
// Don't load them into the scene right now in case there is an exception
|
||||
std::vector<std::pair<std::string, scene_data>> models;
|
||||
std::vector<std::tuple<std::string, entt::entity, entt::registry>> models;
|
||||
std::vector<json_visual_response> json_responses;
|
||||
|
||||
// Fill models with the different models to be loaded and their name ("left" or "right")
|
||||
// Don't load them into the scene right now in case there is an exception
|
||||
for (simdjson::dom::key_value_pair layout: simdjson::dom::object(root["layouts"]))
|
||||
{
|
||||
// TODO handle case where i.key is none and there is no left or right
|
||||
// std::string user_path = "/user/hand/" + std::string(layout.key);
|
||||
std::filesystem::path asset_path = json_profile.parent_path() / std::string(layout.value["assetPath"]);
|
||||
|
||||
scene_data & data = models.emplace_back(layout.key, loader(asset_path)).second;
|
||||
// scene.load_gltf(asset_path);
|
||||
|
||||
entt::registry & data = std::get<2>(models.emplace_back(layout.key, entt::null, (*scene.loader)(asset_path)));
|
||||
|
||||
for (simdjson::dom::key_value_pair component: simdjson::dom::object(layout.value["components"]))
|
||||
{
|
||||
@@ -177,40 +221,38 @@ input_profile::input_profile(const std::filesystem::path & json_profile, scene_l
|
||||
vr.component_subpath = component_subpath;
|
||||
|
||||
// Check if the node exists
|
||||
data.find_node(vr.target_node);
|
||||
find_node_by_name(data, vr.target_node);
|
||||
|
||||
auto node_property = parse_value_node_property(response.value["valueNodeProperty"]);
|
||||
switch (node_property)
|
||||
{
|
||||
case value_node_property::transform: {
|
||||
auto min_node = data.find_node(response.value["minNodeName"]);
|
||||
auto max_node = data.find_node(response.value["maxNodeName"]);
|
||||
auto min_node = data.get<components::node>(find_node_by_name(data, std::string(response.value["minNodeName"])));
|
||||
auto max_node = data.get<components::node>(find_node_by_name(data, std::string(response.value["maxNodeName"])));
|
||||
|
||||
node_state_transform min{
|
||||
min_node->position,
|
||||
min_node->orientation};
|
||||
components::details::node_state_transform min{
|
||||
min_node.position,
|
||||
min_node.orientation};
|
||||
|
||||
node_state_transform max{
|
||||
max_node->position,
|
||||
max_node->orientation};
|
||||
components::details::node_state_transform max{
|
||||
max_node.position,
|
||||
max_node.orientation};
|
||||
|
||||
vr.state = std::make_pair(min, max);
|
||||
}
|
||||
break;
|
||||
|
||||
case value_node_property::visibility:
|
||||
vr.state = node_state_visibility{};
|
||||
vr.state = components::details::node_state_visibility{};
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto && [layout, model]: models)
|
||||
// Add all models in the scene
|
||||
for (auto & [layout, entity, model]: models)
|
||||
{
|
||||
node_handle root_node = scene_controllers.new_node();
|
||||
root_node->name = layout;
|
||||
|
||||
xr::spaces space;
|
||||
if (layout == "left")
|
||||
space = xr::spaces::grip_left;
|
||||
@@ -223,9 +265,16 @@ input_profile::input_profile(const std::filesystem::path & json_profile, scene_l
|
||||
else
|
||||
continue;
|
||||
|
||||
model_handles.emplace_back(space, root_node);
|
||||
entity = scene.world.create();
|
||||
scene.world.emplace<bound_space>(entity, space);
|
||||
scene.world.emplace<components::node>(entity, components::node{
|
||||
.name = layout,
|
||||
.layer_mask = layer_mask_controller,
|
||||
});
|
||||
|
||||
scene_controllers.import(std::move(model), root_node);
|
||||
scene.loader->add_prefab(scene.world, std::move(model), entity);
|
||||
|
||||
spdlog::debug("Created entity {}", layout);
|
||||
}
|
||||
|
||||
for (simdjson::dom::key_value_pair layout: simdjson::dom::object(root["layouts"]))
|
||||
@@ -238,16 +287,16 @@ input_profile::input_profile(const std::filesystem::path & json_profile, scene_l
|
||||
else
|
||||
continue;
|
||||
|
||||
node_handle root_node = scene_rays.new_node();
|
||||
root_node->name = (std::string)layout.key + "_ray";
|
||||
model_handles.emplace_back(space, root_node);
|
||||
auto && [entity, node] = scene.load_gltf(controller_ray_model_name(), layer_mask_ray);
|
||||
node.name = (std::string)layout.key + "_ray";
|
||||
spdlog::debug("Created entity {}", node.name);
|
||||
|
||||
scene_rays.import(loader(controller_ray_model_name()), root_node);
|
||||
scene.world.emplace<bound_space>(entity, space);
|
||||
|
||||
if (layout.key == "left")
|
||||
left_ray = root_node;
|
||||
left_ray = entity;
|
||||
else if (layout.key == "right")
|
||||
right_ray = root_node;
|
||||
right_ray = entity;
|
||||
}
|
||||
|
||||
for (auto & json_response: json_responses)
|
||||
@@ -264,7 +313,7 @@ input_profile::input_profile(const std::filesystem::path & json_profile, scene_l
|
||||
continue;
|
||||
}
|
||||
|
||||
auto & response = responses.emplace_back();
|
||||
components::visual_response response;
|
||||
response.action = action.first;
|
||||
response.type = action.second;
|
||||
|
||||
@@ -289,101 +338,101 @@ input_profile::input_profile(const std::filesystem::path & json_profile, scene_l
|
||||
break;
|
||||
}
|
||||
|
||||
node_handle controller_root_node;
|
||||
for (auto && [i, j]: model_handles)
|
||||
entt::entity controller_entity = entt::null;
|
||||
for (const auto & [layout, entity, model]: models)
|
||||
{
|
||||
if (j->name == json_response.layout)
|
||||
if (layout == json_response.layout)
|
||||
{
|
||||
controller_root_node = j;
|
||||
assert(controller_root_node->name == json_response.layout);
|
||||
controller_entity = entity;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
response.target.node = scene_controllers.find_node(controller_root_node, json_response.target_node);
|
||||
response.target.state = json_response.state;
|
||||
response.state = json_response.state;
|
||||
|
||||
auto target = find_node_by_name(scene.world, json_response.target_node, controller_entity);
|
||||
scene.world.emplace<components::visual_response>(target, response);
|
||||
}
|
||||
|
||||
offset.fill({{0, 0, 0}, {1, 0, 0, 0}});
|
||||
}
|
||||
|
||||
static void apply_visual_response(node_handle node, std::pair<input_profile::node_state_transform, input_profile::node_state_transform> transforms, float value)
|
||||
static void apply_visual_response(components::node & node, std::pair<components::details::node_state_transform, components::details::node_state_transform> transforms, float value)
|
||||
{
|
||||
node->position = glm::mix(transforms.first.position, transforms.second.position, value);
|
||||
node->orientation = glm::slerp(transforms.first.orientation, transforms.second.orientation, value);
|
||||
node.position = glm::mix(transforms.first.position, transforms.second.position, value);
|
||||
node.orientation = glm::slerp(transforms.first.orientation, transforms.second.orientation, value);
|
||||
}
|
||||
|
||||
static void apply_visual_response(node_handle node, input_profile::node_state_visibility, float value)
|
||||
static void apply_visual_response(components::node & node, components::details::node_state_visibility, float value)
|
||||
{
|
||||
node->visible = value > 0.5;
|
||||
node.visible = value > 0.5;
|
||||
}
|
||||
|
||||
static void set_clipping_planes(node_handle node, std::span<glm::vec4> clipping_planes)
|
||||
static void set_clipping_planes(entt::registry & scene, entt::entity entity, std::span<glm::vec4> clipping_planes)
|
||||
{
|
||||
if (not node)
|
||||
return;
|
||||
|
||||
// If the ray starts on the wrong side of the GUI, hide it entirely
|
||||
// This assumes the node is a child of the root node
|
||||
components::node & node = scene.get<components::node>(entity);
|
||||
for (glm::vec4 & plane: clipping_planes)
|
||||
{
|
||||
if (glm::dot(plane, glm::vec4(node->position, 1)) < 0)
|
||||
if (glm::dot(plane, glm::vec4(node.position, 1)) < 0)
|
||||
{
|
||||
node->visible = false;
|
||||
scene.get<components::node>(entity).visible = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto child_node: node.children())
|
||||
// Apply the clipping planes on direct children of the target entity
|
||||
for (auto && [child_entity, child_node]: scene.view<components::node>().each())
|
||||
{
|
||||
size_t nb_clipping_planes = std::min(child_node->clipping_planes.size(), clipping_planes.size());
|
||||
if (child_node.parent == entity)
|
||||
{
|
||||
size_t nb_clipping_planes = std::min(child_node.clipping_planes.size(), clipping_planes.size());
|
||||
|
||||
auto copy_results = std::ranges::copy_n(
|
||||
clipping_planes.begin(),
|
||||
nb_clipping_planes,
|
||||
child_node->clipping_planes.begin());
|
||||
auto copy_results = std::ranges::copy_n(
|
||||
clipping_planes.begin(),
|
||||
nb_clipping_planes,
|
||||
child_node.clipping_planes.begin());
|
||||
|
||||
// Disable the remaining clipping planes
|
||||
std::ranges::fill_n(
|
||||
copy_results.out,
|
||||
child_node->clipping_planes.size() - nb_clipping_planes,
|
||||
glm::vec4(0, 0, 0, 1));
|
||||
// Disable the remaining clipping planes
|
||||
std::ranges::fill_n(
|
||||
copy_results.out,
|
||||
child_node.clipping_planes.size() - nb_clipping_planes,
|
||||
glm::vec4(0, 0, 0, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void input_profile::apply(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, bool hide_right, std::span<glm::vec4> pointer_limits)
|
||||
{
|
||||
for (auto && [space, node]: model_handles)
|
||||
for (auto && [entity, node, space]: scene.view<components::node, bound_space>().each())
|
||||
{
|
||||
if ((space == xr::spaces::grip_left or space == xr::spaces::aim_left) and hide_left)
|
||||
if ((space.space == xr::spaces::grip_left or space.space == xr::spaces::aim_left) and hide_left)
|
||||
{
|
||||
node->visible = false;
|
||||
node.visible = false;
|
||||
}
|
||||
else if ((space == xr::spaces::grip_right or space == xr::spaces::aim_right) and hide_right)
|
||||
else if ((space.space == xr::spaces::grip_right or space.space == xr::spaces::aim_right) and hide_right)
|
||||
{
|
||||
node->visible = false;
|
||||
node.visible = false;
|
||||
}
|
||||
else if (auto location = application::locate_controller(application::space(space), world_space, predicted_display_time); location)
|
||||
else if (auto location = application::locate_controller(application::space(space.space), world_space, predicted_display_time); location)
|
||||
{
|
||||
node->visible = true;
|
||||
node.visible = true;
|
||||
|
||||
assert((int)space >= 0);
|
||||
assert((int)space < offset.size());
|
||||
auto & [p, q] = offset[space];
|
||||
assert((int)space.space >= 0);
|
||||
assert((int)space.space < offset.size());
|
||||
auto & [p, q] = offset[space.space];
|
||||
|
||||
node->position = location->first + glm::mat3_cast(location->second * q) * p;
|
||||
node->orientation = location->second * q;
|
||||
node.position = location->first + glm::mat3_cast(location->second * q) * p;
|
||||
node.orientation = location->second * q;
|
||||
}
|
||||
else
|
||||
{
|
||||
node->visible = false;
|
||||
node.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
set_clipping_planes(left_ray, pointer_limits);
|
||||
set_clipping_planes(right_ray, pointer_limits);
|
||||
|
||||
for (auto & response: responses)
|
||||
for (auto && [entity, node, response]: scene.view<components::node, components::visual_response>().each())
|
||||
{
|
||||
assert(response.action);
|
||||
|
||||
@@ -435,20 +484,16 @@ void input_profile::apply(XrSpace world_space, XrTime predicted_display_time, bo
|
||||
|
||||
if ((scaled_value < 0) || (scaled_value > 1))
|
||||
{
|
||||
std::string full_name = response.target.node->name;
|
||||
|
||||
for (auto i = response.target.node; i; i = i.parent())
|
||||
{
|
||||
full_name = i->name + "/" + full_name;
|
||||
}
|
||||
|
||||
spdlog::warn("Out of range value {} (scaled to {}) for node {}", *value, scaled_value, full_name);
|
||||
spdlog::warn("Out of range value {} (scaled to {}) for node {}", *value, scaled_value, get_node_name(scene, entity));
|
||||
}
|
||||
|
||||
std::visit([&](auto & transform) {
|
||||
apply_visual_response(response.target.node, transform, scaled_value);
|
||||
apply_visual_response(node, transform, scaled_value);
|
||||
},
|
||||
response.target.state);
|
||||
response.state);
|
||||
}
|
||||
}
|
||||
|
||||
set_clipping_planes(scene, left_ray, pointer_limits);
|
||||
set_clipping_planes(scene, right_ray, pointer_limits);
|
||||
}
|
||||
|
||||
@@ -18,58 +18,27 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "scene.h"
|
||||
#include <cstdint>
|
||||
#include <entt/fwd.hpp>
|
||||
#include <filesystem>
|
||||
#include <glm/glm.hpp>
|
||||
#include <magic_enum_containers.hpp>
|
||||
#include <render/scene_data.h>
|
||||
#include <span>
|
||||
#include <variant>
|
||||
#include <xr/space.h>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
struct input_profile
|
||||
{
|
||||
struct node_state_transform
|
||||
{
|
||||
glm::vec3 position;
|
||||
glm::quat orientation;
|
||||
};
|
||||
|
||||
struct node_state_visibility
|
||||
{
|
||||
};
|
||||
|
||||
using node_state = std::variant<std::pair<node_state_transform, node_state_transform>, node_state_visibility>;
|
||||
|
||||
struct node_target
|
||||
{
|
||||
node_handle node;
|
||||
node_state state;
|
||||
};
|
||||
|
||||
struct visual_response
|
||||
{
|
||||
XrAction action;
|
||||
XrActionType type;
|
||||
int axis; // Only if type is XR_ACTION_TYPE_VECTOR2F_INPUT
|
||||
float bias;
|
||||
float scale;
|
||||
|
||||
node_target target;
|
||||
};
|
||||
|
||||
std::string id;
|
||||
|
||||
std::vector<visual_response> responses;
|
||||
std::vector<std::pair<xr::spaces, node_handle>> model_handles;
|
||||
|
||||
node_handle left_ray;
|
||||
node_handle right_ray;
|
||||
entt::entity left_ray;
|
||||
entt::entity right_ray;
|
||||
|
||||
magic_enum::containers::array<xr::spaces, std::pair<glm::vec3, glm::quat>> offset;
|
||||
|
||||
input_profile(const std::filesystem::path & json_profile, scene_loader & loader, scene_data & scene_controllers, scene_data & scene_rays);
|
||||
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(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, bool hide_right, std::span<glm::vec4> pointer_limits);
|
||||
};
|
||||
|
||||
+160
-444
@@ -21,16 +21,14 @@
|
||||
#include "application.h"
|
||||
#include "constants.h"
|
||||
#include "glm/geometric.hpp"
|
||||
#include "hand_model.h"
|
||||
#include "hardware.h"
|
||||
#include "imgui.h"
|
||||
#include "input_profile.h"
|
||||
#include "openxr/openxr.h"
|
||||
#include "protocol_version.h"
|
||||
#include "render/scene_data.h"
|
||||
#include "render/scene_renderer.h"
|
||||
#include "stream.h"
|
||||
#include "utils/i18n.h"
|
||||
#include "utils/overloaded.h"
|
||||
#include "wivrn_client.h"
|
||||
#include "wivrn_discover.h"
|
||||
#include "wivrn_sockets.h"
|
||||
@@ -38,9 +36,7 @@
|
||||
#include "xr/space.h"
|
||||
#include <glm/gtc/matrix_access.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono> // IWYU pragma: keep
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <glm/matrix.hpp>
|
||||
@@ -110,76 +106,37 @@ void scenes::lobby::move_gui(glm::vec3 head_position, glm::vec3 new_gui_position
|
||||
imgui_ctx->layers()[2].orientation = q * glm::quat(cos(keyboard_pitch / 2), sin(keyboard_pitch / 2), 0, 0);
|
||||
}
|
||||
|
||||
scenes::lobby::lobby()
|
||||
scenes::lobby::lobby() :
|
||||
scene_impl<lobby>(supported_color_formats, supported_depth_formats)
|
||||
{
|
||||
spdlog::info("Using formats {} and {}", vk::to_string(swapchain_format), vk::to_string(depth_format));
|
||||
// composition_layer_depth_test_supported = false;
|
||||
if (composition_layer_depth_test_supported)
|
||||
spdlog::info("Composition layer depth test supported");
|
||||
else
|
||||
spdlog::info("Composition layer depth test NOT supported");
|
||||
|
||||
if (composition_layer_color_scale_bias_supported)
|
||||
spdlog::info("Composition layer color scale/bias supported");
|
||||
else
|
||||
spdlog::info("Composition layer color scale/bias NOT supported");
|
||||
|
||||
if (std::getenv("WIVRN_AUTOCONNECT"))
|
||||
force_autoconnect = true;
|
||||
|
||||
passthrough_supported = system.passthrough_supported();
|
||||
auto & config = application::get_config();
|
||||
|
||||
auto & servers = application::get_config().servers;
|
||||
auto & servers = config.servers;
|
||||
spdlog::info("{} known server(s):", servers.size());
|
||||
for (auto & i: servers)
|
||||
{
|
||||
spdlog::info(" {}", i.second.service.name);
|
||||
}
|
||||
|
||||
haptic_output[0] = get_action("left_haptic").first;
|
||||
haptic_output[1] = get_action("right_haptic").first;
|
||||
keyboard.set_layout(config.virtual_keyboard_layout);
|
||||
|
||||
swapchain_format = vk::Format::eUndefined;
|
||||
spdlog::info("Supported swapchain formats:");
|
||||
|
||||
for (auto format: session.get_swapchain_formats())
|
||||
{
|
||||
spdlog::info(" {}", vk::to_string(format));
|
||||
}
|
||||
|
||||
for (auto format: session.get_swapchain_formats())
|
||||
{
|
||||
if (std::find(supported_color_formats.begin(), supported_color_formats.end(), format) != supported_color_formats.end())
|
||||
{
|
||||
swapchain_format = format;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (swapchain_format == vk::Format::eUndefined)
|
||||
throw std::runtime_error(_("No supported swapchain format"));
|
||||
|
||||
auto views = system.view_configuration_views(viewconfig);
|
||||
stream_view = override_view(views[0], guess_model());
|
||||
uint32_t width = views[0].recommendedImageRectWidth;
|
||||
uint32_t height = views[0].recommendedImageRectHeight;
|
||||
|
||||
depth_format = scene_renderer::find_usable_image_format(
|
||||
physical_device,
|
||||
supported_depth_formats,
|
||||
{
|
||||
width,
|
||||
height,
|
||||
1,
|
||||
},
|
||||
vk::ImageUsageFlagBits::eDepthStencilAttachment);
|
||||
|
||||
spdlog::info("Using formats {} and {}", vk::to_string(swapchain_format), vk::to_string(depth_format));
|
||||
|
||||
composition_layer_depth_test_supported =
|
||||
instance.has_extension(XR_KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME) and
|
||||
instance.has_extension(XR_FB_COMPOSITION_LAYER_DEPTH_TEST_EXTENSION_NAME);
|
||||
|
||||
if (composition_layer_depth_test_supported)
|
||||
spdlog::info("Composition layer depth test supported");
|
||||
else
|
||||
spdlog::info("Composition layer depth test NOT supported");
|
||||
|
||||
composition_layer_color_scale_bias_supported = instance.has_extension(XR_KHR_COMPOSITION_LAYER_COLOR_SCALE_BIAS_EXTENSION_NAME);
|
||||
if (composition_layer_color_scale_bias_supported)
|
||||
spdlog::info("Composition layer color scale/bias supported");
|
||||
else
|
||||
spdlog::info("Composition layer color scale/bias NOT supported");
|
||||
|
||||
keyboard.set_layout(application::get_config().virtual_keyboard_layout);
|
||||
if (config.first_run)
|
||||
current_tab = tab::first_run;
|
||||
|
||||
const auto keypair_path = application::get_config_path() / "private_key.pem";
|
||||
try
|
||||
@@ -346,37 +303,6 @@ std::unique_ptr<wivrn_session> scenes::lobby::connect_to_session(wivrn_discover:
|
||||
throw std::runtime_error(error);
|
||||
}
|
||||
|
||||
static glm::mat4 projection_matrix(XrFovf fov, float zn = 0.02)
|
||||
{
|
||||
float r = tan(fov.angleRight);
|
||||
float l = tan(fov.angleLeft);
|
||||
float t = tan(fov.angleUp);
|
||||
float b = tan(fov.angleDown);
|
||||
|
||||
// reversed Z projection, infinite far plane
|
||||
|
||||
// clang-format off
|
||||
return glm::mat4{
|
||||
{ 2/(r-l), 0, 0, 0 },
|
||||
{ 0, 2/(b-t), 0, 0 },
|
||||
{ (l+r)/(r-l), (t+b)/(b-t), 0, -1 },
|
||||
{ 0, 0, zn, 0 }
|
||||
};
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
static glm::mat4 view_matrix(XrPosef pose)
|
||||
{
|
||||
XrQuaternionf q = pose.orientation;
|
||||
XrVector3f pos = pose.position;
|
||||
|
||||
glm::mat4 inv_view_matrix = glm::mat4_cast(glm::quat(q.w, q.x, q.y, q.z));
|
||||
|
||||
inv_view_matrix = glm::translate(glm::mat4(1), glm::vec3(pos.x, pos.y, pos.z)) * inv_view_matrix;
|
||||
|
||||
return glm::inverse(inv_view_matrix);
|
||||
}
|
||||
|
||||
void scenes::lobby::update_server_list()
|
||||
{
|
||||
if (application::is_focused() && !discover)
|
||||
@@ -476,19 +402,27 @@ std::optional<glm::vec3> scenes::lobby::check_recenter_gesture(const std::array<
|
||||
std::optional<glm::vec3> scenes::lobby::check_recenter_action(XrTime predicted_display_time, glm::vec3 head_position)
|
||||
{
|
||||
std::optional<std::pair<glm::vec3, glm::quat>> aim;
|
||||
glm::vec3 offset_position;
|
||||
glm::quat offset_orientation;
|
||||
|
||||
if (application::read_action_bool(recenter_left_action).value_or(std::pair{0, false}).second)
|
||||
{
|
||||
aim = application::locate_controller(application::space(xr::spaces::aim_left), application::space(xr::spaces::world), predicted_display_time);
|
||||
std::tie(offset_position, offset_orientation) = input->offset[xr::spaces::aim_left];
|
||||
}
|
||||
|
||||
if (application::read_action_bool(recenter_right_action).value_or(std::pair{0, false}).second)
|
||||
{
|
||||
aim = application::locate_controller(application::space(xr::spaces::aim_right), application::space(xr::spaces::world), predicted_display_time);
|
||||
std::tie(offset_position, offset_orientation) = input->offset[xr::spaces::aim_right];
|
||||
}
|
||||
|
||||
if (aim)
|
||||
{
|
||||
// Handle controller offset
|
||||
aim->first = aim->first + glm::mat3_cast(aim->second * offset_orientation) * offset_position;
|
||||
aim->second = aim->second * offset_orientation;
|
||||
|
||||
if (not gui_recenter_position or not gui_recenter_distance)
|
||||
{
|
||||
// First frame where the recenter action is active
|
||||
@@ -500,7 +434,7 @@ std::optional<glm::vec3> scenes::lobby::check_recenter_action(XrTime predicted_d
|
||||
|
||||
imgui_ctx->compute_pointer_position(state);
|
||||
|
||||
if (state.pointer_position)
|
||||
if (state.pointer_position) // TODO: check that the pointer is inside an imgui window
|
||||
{
|
||||
auto M = glm::mat3_cast(imgui_ctx->layers()[0].orientation);
|
||||
|
||||
@@ -572,80 +506,6 @@ std::optional<glm::vec3> scenes::lobby::check_recenter_gui(glm::vec3 head_positi
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static std::pair<std::vector<XrCompositionLayerProjectionView>, std::vector<XrCompositionLayerDepthInfoKHR>> render_layer(
|
||||
std::vector<XrView> & views,
|
||||
std::vector<xr::swapchain> & color_swapchains,
|
||||
std::vector<xr::swapchain> & depth_swapchains,
|
||||
scene_renderer & renderer,
|
||||
scene_data & data,
|
||||
const std::array<float, 4> & clear_color)
|
||||
{
|
||||
std::vector<scene_renderer::frame_info> frames;
|
||||
frames.reserve(views.size());
|
||||
|
||||
std::vector<XrCompositionLayerProjectionView> proj_layer_views;
|
||||
std::vector<XrCompositionLayerDepthInfoKHR> depth_layer_views;
|
||||
proj_layer_views.reserve(views.size());
|
||||
depth_layer_views.reserve(views.size());
|
||||
|
||||
for (auto && [view, color_swapchain, depth_swapchain]: std::views::zip(views, color_swapchains, depth_swapchains))
|
||||
{
|
||||
int color_image_index = color_swapchain.acquire();
|
||||
color_swapchain.wait();
|
||||
|
||||
int depth_image_index = depth_swapchain ? depth_swapchain.acquire() : 0;
|
||||
if (depth_swapchain)
|
||||
depth_swapchain.wait();
|
||||
|
||||
frames.push_back({
|
||||
.destination = color_swapchain.images()[color_image_index].image,
|
||||
.depth_buffer = depth_swapchain ? depth_swapchain.images()[depth_image_index].image : vk::Image{},
|
||||
.projection = projection_matrix(view.fov, constants::lobby::near_plane),
|
||||
.view = view_matrix(view.pose),
|
||||
});
|
||||
|
||||
proj_layer_views.push_back({
|
||||
.type = XR_TYPE_COMPOSITION_LAYER_PROJECTION_VIEW,
|
||||
.pose = view.pose,
|
||||
.fov = view.fov,
|
||||
.subImage = {
|
||||
.swapchain = color_swapchain,
|
||||
.imageRect = {
|
||||
.offset = {0, 0},
|
||||
.extent = color_swapchain.extent(),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
depth_layer_views.push_back({
|
||||
.type = XR_TYPE_COMPOSITION_LAYER_DEPTH_INFO_KHR,
|
||||
.subImage = {
|
||||
.swapchain = depth_swapchain,
|
||||
.imageRect = {
|
||||
.offset = {0, 0},
|
||||
.extent = depth_swapchain.extent(),
|
||||
},
|
||||
},
|
||||
.minDepth = 0,
|
||||
.maxDepth = 1,
|
||||
.nearZ = std::numeric_limits<float>::infinity(),
|
||||
.farZ = constants::lobby::near_plane,
|
||||
});
|
||||
}
|
||||
|
||||
renderer.render(data, clear_color, frames);
|
||||
|
||||
return {proj_layer_views, depth_layer_views};
|
||||
}
|
||||
|
||||
static std::vector<XrCompositionLayerProjectionView> render_layer(std::vector<XrView> & views, std::vector<xr::swapchain> & color_swapchains, scene_renderer & renderer, scene_data & data, const std::array<float, 4> & clear_color)
|
||||
{
|
||||
std::vector<xr::swapchain> depth_swapchains;
|
||||
depth_swapchains.resize(color_swapchains.size());
|
||||
|
||||
return std::get<0>(render_layer(views, color_swapchains, depth_swapchains, renderer, data, clear_color));
|
||||
}
|
||||
|
||||
// Return the vector v such that dot(v, x) > 0 iff x is on the side where the composition layer is visible
|
||||
static glm::vec4 compute_ray_limits(const XrPosef & pose, float margin = 0)
|
||||
{
|
||||
@@ -737,7 +597,8 @@ void scenes::lobby::render(const XrFrameState & frame_state)
|
||||
|
||||
XrSpace world_space = application::space(xr::spaces::world);
|
||||
auto [flags, views] = session.locate_views(viewconfig, frame_state.predictedDisplayTime, world_space);
|
||||
assert(views.size() == swapchains_lobby.size());
|
||||
// assert(views.size() == swapchains_lobby.size());
|
||||
assert(views.size() == 2); // FIXME
|
||||
|
||||
bool hide_left_controller = false;
|
||||
bool hide_right_controller = false;
|
||||
@@ -753,75 +614,70 @@ void scenes::lobby::render(const XrFrameState & frame_state)
|
||||
|
||||
if (application::get_hand_tracking_supported())
|
||||
{
|
||||
if (left_hand)
|
||||
{
|
||||
auto & hand = application::get_left_hand();
|
||||
auto joints = hand.locate(world_space, frame_state.predictedDisplayTime);
|
||||
left_hand->apply(joints);
|
||||
auto left = application::get_left_hand().locate(world_space, frame_state.predictedDisplayTime);
|
||||
auto right = application::get_right_hand().locate(world_space, frame_state.predictedDisplayTime);
|
||||
|
||||
if (joints and xr::hand_tracker::check_flags(*joints, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
{
|
||||
hide_left_controller = true;
|
||||
if (!new_gui_position)
|
||||
new_gui_position = check_recenter_gesture(*joints);
|
||||
}
|
||||
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 (!new_gui_position)
|
||||
new_gui_position = check_recenter_gesture(*left);
|
||||
}
|
||||
|
||||
if (right_hand)
|
||||
if (right and xr::hand_tracker::check_flags(*right, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
{
|
||||
auto & hand = application::get_right_hand();
|
||||
auto joints = hand.locate(world_space, frame_state.predictedDisplayTime);
|
||||
right_hand->apply(joints);
|
||||
|
||||
if (joints and xr::hand_tracker::check_flags(*joints, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
{
|
||||
hide_right_controller = true;
|
||||
if (!new_gui_position)
|
||||
new_gui_position = check_recenter_gesture(*joints);
|
||||
}
|
||||
hide_right_controller = true;
|
||||
if (!new_gui_position)
|
||||
new_gui_position = check_recenter_gesture(*right);
|
||||
}
|
||||
}
|
||||
|
||||
#if WIVRN_CLIENT_DEBUG_MENU
|
||||
if (display_debug_axes)
|
||||
{
|
||||
const xr::spaces left = display_grip_instead_of_aim ? xr::spaces::grip_left : xr::spaces::aim_left;
|
||||
const xr::spaces right = display_grip_instead_of_aim ? xr::spaces::grip_right : xr::spaces::aim_right;
|
||||
|
||||
if (hide_left_controller)
|
||||
xyz_axes_left_controller->visible = false;
|
||||
else if (auto location = application::locate_controller(application::space(left), world_space, frame_state.predictedDisplayTime))
|
||||
{
|
||||
xyz_axes_left_controller->visible = true;
|
||||
xyz_axes_left_controller->position = location->first;
|
||||
xyz_axes_left_controller->orientation = location->second;
|
||||
}
|
||||
else
|
||||
xyz_axes_left_controller->visible = false;
|
||||
|
||||
if (hide_right_controller)
|
||||
xyz_axes_right_controller->visible = false;
|
||||
else if (auto location = application::locate_controller(application::space(right), world_space, frame_state.predictedDisplayTime))
|
||||
{
|
||||
xyz_axes_right_controller->visible = true;
|
||||
xyz_axes_right_controller->position = location->first;
|
||||
xyz_axes_right_controller->orientation = location->second;
|
||||
}
|
||||
else
|
||||
xyz_axes_right_controller->visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
xyz_axes_left_controller->visible = false;
|
||||
xyz_axes_right_controller->visible = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (head_position && new_gui_position)
|
||||
{
|
||||
move_gui(head_position->first, *new_gui_position);
|
||||
}
|
||||
|
||||
#if WIVRN_CLIENT_DEBUG_MENU
|
||||
{
|
||||
auto & left_node = world.get<components::node>(xyz_axes_left_controller);
|
||||
auto & right_node = world.get<components::node>(xyz_axes_right_controller);
|
||||
if (display_debug_axes)
|
||||
{
|
||||
const xr::spaces left = display_grip_instead_of_aim ? xr::spaces::grip_left : xr::spaces::aim_left;
|
||||
|
||||
if (hide_left_controller)
|
||||
left_node.visible = false;
|
||||
else if (auto location = application::locate_controller(application::space(left), world_space, frame_state.predictedDisplayTime))
|
||||
{
|
||||
left_node.visible = true;
|
||||
left_node.position = location->first;
|
||||
left_node.orientation = location->second;
|
||||
}
|
||||
else
|
||||
left_node.visible = false;
|
||||
|
||||
const xr::spaces right = display_grip_instead_of_aim ? xr::spaces::grip_right : xr::spaces::aim_right;
|
||||
if (hide_right_controller)
|
||||
right_node.visible = false;
|
||||
else if (auto location = application::locate_controller(application::space(right), world_space, frame_state.predictedDisplayTime))
|
||||
{
|
||||
right_node.visible = true;
|
||||
right_node.position = location->first;
|
||||
right_node.orientation = location->second;
|
||||
}
|
||||
else
|
||||
right_node.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
left_node.visible = false;
|
||||
right_node.visible = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_layers = draw_gui(frame_state.predictedDisplayTime);
|
||||
|
||||
// Get the planes that limit the ray size from the composition layers
|
||||
@@ -832,182 +688,65 @@ void scenes::lobby::render(const XrFrameState & frame_state)
|
||||
ray_limits.push_back(compute_ray_limits(layer.pose));
|
||||
}
|
||||
|
||||
input->apply(world_space, frame_state.predictedDisplayTime, hide_left_controller, hide_right_controller, ray_limits);
|
||||
input->apply(world, world_space, frame_state.predictedDisplayTime, hide_left_controller, hide_right_controller, ray_limits);
|
||||
|
||||
assert(renderer);
|
||||
renderer->start_frame();
|
||||
|
||||
std::vector<XrCompositionLayerProjectionView> lobby_layer_views;
|
||||
std::vector<XrCompositionLayerDepthInfoKHR> lobby_depth_layer_views;
|
||||
std::vector<XrCompositionLayerProjectionView> controllers_layer_views;
|
||||
std::vector<XrCompositionLayerDepthInfoKHR> controllers_depth_layer_views;
|
||||
world.get<components::node>(lobby_entity).visible = not application::get_config().passthrough_enabled;
|
||||
|
||||
std::array<float, 4> clear_color;
|
||||
render_start(application::get_config().passthrough_enabled, frame_state.predictedDisplayTime);
|
||||
|
||||
lobby_handle->visible = not application::get_config().passthrough_enabled;
|
||||
|
||||
if (application::get_config().passthrough_enabled)
|
||||
clear_color = {0, 0, 0, 0};
|
||||
else
|
||||
clear_color = constants::lobby::sky_color;
|
||||
const XrColor4f clear_color = application::get_config().passthrough_enabled ? XrColor4f{0, 0, 0, 0} : constants::lobby::sky_color;
|
||||
render_world(
|
||||
XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT,
|
||||
world_space,
|
||||
views,
|
||||
width,
|
||||
height,
|
||||
composition_layer_depth_test_supported,
|
||||
composition_layer_depth_test_supported ? layer_lobby | layer_controllers : layer_lobby,
|
||||
clear_color);
|
||||
|
||||
if (composition_layer_depth_test_supported)
|
||||
set_depth_test(true, XR_COMPARE_OP_ALWAYS_FB);
|
||||
|
||||
bool dim_gui = imgui_ctx->is_modal_popup_shown() and composition_layer_color_scale_bias_supported;
|
||||
for (auto & [z_index, layer]: imgui_layers)
|
||||
{
|
||||
std::tie(lobby_layer_views, lobby_depth_layer_views) = render_layer(
|
||||
views,
|
||||
swapchains_lobby,
|
||||
swapchains_lobby_depth,
|
||||
*renderer,
|
||||
*lobby_scene,
|
||||
clear_color);
|
||||
for (auto [color, depth]: std::views::zip(lobby_layer_views, lobby_depth_layer_views))
|
||||
color.next = &depth;
|
||||
if (z_index < constants::lobby::zindex_recenter_tip)
|
||||
{
|
||||
add_quad_layer(layer.layerFlags, layer.space, layer.eyeVisibility, layer.subImage, layer.pose, layer.size);
|
||||
|
||||
std::tie(controllers_layer_views, controllers_depth_layer_views) = render_layer(
|
||||
views,
|
||||
swapchains_controllers,
|
||||
swapchains_controllers_depth,
|
||||
*renderer,
|
||||
*controllers_scene,
|
||||
{0, 0, 0, 0});
|
||||
for (auto [color, depth]: std::views::zip(controllers_layer_views, controllers_depth_layer_views))
|
||||
color.next = &depth;
|
||||
if (dim_gui)
|
||||
set_color_scale_bias(constants::lobby::dimming_scale, constants::lobby::dimming_bias);
|
||||
|
||||
renderer->end_frame();
|
||||
if (composition_layer_depth_test_supported)
|
||||
set_depth_test(true, XR_COMPARE_OP_LESS_OR_EQUAL_FB);
|
||||
|
||||
// After end_frame because the command buffers are submitted in end_frame
|
||||
for (auto & swapchain: swapchains_lobby)
|
||||
swapchain.release();
|
||||
|
||||
for (auto & swapchain: swapchains_lobby_depth)
|
||||
swapchain.release();
|
||||
|
||||
for (auto & swapchain: swapchains_controllers)
|
||||
swapchain.release();
|
||||
|
||||
for (auto & swapchain: swapchains_controllers_depth)
|
||||
swapchain.release();
|
||||
}
|
||||
else
|
||||
{
|
||||
lobby_layer_views = render_layer(
|
||||
views,
|
||||
swapchains_lobby,
|
||||
*renderer,
|
||||
*lobby_scene,
|
||||
clear_color);
|
||||
|
||||
controllers_layer_views = render_layer(
|
||||
views,
|
||||
swapchains_controllers,
|
||||
*renderer,
|
||||
*controllers_scene,
|
||||
{0, 0, 0, 0});
|
||||
|
||||
renderer->end_frame();
|
||||
|
||||
// After end_frame because the command buffers are submitted in end_frame
|
||||
for (auto & swapchain: swapchains_lobby)
|
||||
swapchain.release();
|
||||
|
||||
for (auto & swapchain: swapchains_controllers)
|
||||
swapchain.release();
|
||||
dim_gui = false; // Only dim the main window
|
||||
}
|
||||
}
|
||||
|
||||
XrCompositionLayerProjection lobby_layer{
|
||||
.type = XR_TYPE_COMPOSITION_LAYER_PROJECTION,
|
||||
.layerFlags = XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT,
|
||||
.space = world_space,
|
||||
.viewCount = (uint32_t)lobby_layer_views.size(),
|
||||
.views = lobby_layer_views.data(),
|
||||
};
|
||||
render_world(
|
||||
XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT,
|
||||
world_space,
|
||||
views,
|
||||
width,
|
||||
height,
|
||||
composition_layer_depth_test_supported,
|
||||
composition_layer_depth_test_supported ? layer_rays : layer_rays | layer_controllers,
|
||||
{0, 0, 0, 0});
|
||||
|
||||
XrCompositionLayerProjection controllers_layer{
|
||||
.type = XR_TYPE_COMPOSITION_LAYER_PROJECTION,
|
||||
.layerFlags = XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT,
|
||||
.space = world_space,
|
||||
.viewCount = (uint32_t)controllers_layer_views.size(),
|
||||
.views = controllers_layer_views.data(),
|
||||
};
|
||||
|
||||
XrEnvironmentBlendMode blend_mode = XR_ENVIRONMENT_BLEND_MODE_OPAQUE;
|
||||
std::vector<std::pair<int, XrCompositionLayerBaseHeader *>> layers_with_z_index;
|
||||
|
||||
if (application::get_config().passthrough_enabled)
|
||||
{
|
||||
std::visit(
|
||||
utils::overloaded{
|
||||
[&](std::monostate &) {
|
||||
assert(false);
|
||||
},
|
||||
[&](xr::passthrough_alpha_blend & p) {
|
||||
blend_mode = XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND;
|
||||
},
|
||||
[&](auto & p) {
|
||||
layers_with_z_index.emplace_back(constants::lobby::zindex_passthrough, p.layer());
|
||||
}},
|
||||
session.get_passthrough());
|
||||
}
|
||||
|
||||
// Dimming settings if a popup window is displayed
|
||||
XrCompositionLayerColorScaleBiasKHR color_scale_bias{
|
||||
.type = XR_TYPE_COMPOSITION_LAYER_COLOR_SCALE_BIAS_KHR,
|
||||
.colorScale = constants::lobby::dimming_scale,
|
||||
.colorBias = constants::lobby::dimming_bias,
|
||||
};
|
||||
|
||||
// Add XrCompositionLayerDepthTestFB to lobby_layer and imgui_layer
|
||||
// The sky in the lobby layer and the passthrough layer have the same depth, so the operation must be:
|
||||
// - LESS when passthrough is enabled (to avoid overwriting the passthrough)
|
||||
// - LESS_OR_EQUAL when passthrough is disabled (so that the sky is visible)
|
||||
XrCompositionLayerDepthTestFB layer_depth_test{
|
||||
.type = XR_TYPE_COMPOSITION_LAYER_DEPTH_TEST_FB,
|
||||
.next = nullptr,
|
||||
.depthMask = true,
|
||||
.compareOp = application::get_config().passthrough_enabled ? XR_COMPARE_OP_LESS_FB : XR_COMPARE_OP_LESS_OR_EQUAL_FB,
|
||||
};
|
||||
XrCompositionLayerDepthTestFB layer_depth_test_bg{
|
||||
.type = XR_TYPE_COMPOSITION_LAYER_DEPTH_TEST_FB,
|
||||
.next = nullptr,
|
||||
.depthMask = true,
|
||||
.compareOp = XR_COMPARE_OP_ALWAYS_FB,
|
||||
};
|
||||
|
||||
// if (composition_layer_depth_test_supported or not application::get_config().passthrough_enabled)
|
||||
layers_with_z_index.emplace_back(constants::lobby::zindex_lobby, reinterpret_cast<XrCompositionLayerBaseHeader *>(&lobby_layer));
|
||||
if (composition_layer_depth_test_supported)
|
||||
set_depth_test(true, XR_COMPARE_OP_LESS_OR_EQUAL_FB);
|
||||
|
||||
for (auto & [z_index, layer]: imgui_layers)
|
||||
layers_with_z_index.emplace_back(z_index, reinterpret_cast<XrCompositionLayerBaseHeader *>(&layer));
|
||||
|
||||
layers_with_z_index.emplace_back(constants::lobby::zindex_controllers, reinterpret_cast<XrCompositionLayerBaseHeader *>(&controllers_layer));
|
||||
|
||||
if (composition_layer_depth_test_supported)
|
||||
{
|
||||
lobby_layer.next = &layer_depth_test_bg;
|
||||
|
||||
for (auto & [z_index, layer]: imgui_layers)
|
||||
{
|
||||
if (z_index != constants::lobby::zindex_recenter_tip)
|
||||
layer.next = &layer_depth_test;
|
||||
}
|
||||
|
||||
controllers_layer.next = &layer_depth_test;
|
||||
if (z_index == constants::lobby::zindex_recenter_tip)
|
||||
add_quad_layer(layer.layerFlags, layer.space, layer.eyeVisibility, layer.subImage, layer.pose, layer.size);
|
||||
}
|
||||
|
||||
if (imgui_ctx->is_modal_popup_shown() and composition_layer_color_scale_bias_supported)
|
||||
{
|
||||
color_scale_bias.next = imgui_layers.front().second.next;
|
||||
imgui_layers.front().second.next = &color_scale_bias;
|
||||
}
|
||||
|
||||
std::ranges::stable_sort(layers_with_z_index);
|
||||
|
||||
std::vector<XrCompositionLayerBaseHeader *> layers;
|
||||
layers.reserve(layers_with_z_index.size());
|
||||
for (auto & [z_index, layer]: layers_with_z_index)
|
||||
layers.push_back(layer);
|
||||
|
||||
session.end_frame(frame_state.predictedDisplayTime, layers, blend_mode);
|
||||
render_end();
|
||||
}
|
||||
|
||||
void scenes::lobby::on_focused()
|
||||
@@ -1015,53 +754,25 @@ void scenes::lobby::on_focused()
|
||||
recenter_gui = true;
|
||||
|
||||
auto views = system.view_configuration_views(viewconfig);
|
||||
assert(views.size() == 2); // FIXME
|
||||
stream_view = override_view(views[0], guess_model());
|
||||
uint32_t width = views[0].recommendedImageRectWidth;
|
||||
uint32_t height = views[0].recommendedImageRectHeight;
|
||||
width = views[0].recommendedImageRectWidth;
|
||||
height = views[0].recommendedImageRectHeight;
|
||||
|
||||
swapchains_lobby.reserve(views.size());
|
||||
swapchains_controllers.reserve(views.size());
|
||||
// assert(std::ranges::all_of(views, [width](const XrViewConfigurationView & view) { return view.recommendedImageRectWidth == width; }));
|
||||
// assert(std::ranges::all_of(views, [height](const XrViewConfigurationView & view) { return view.recommendedImageRectHeight == height; }));
|
||||
|
||||
if (composition_layer_depth_test_supported)
|
||||
swapchains_lobby_depth.reserve(views.size());
|
||||
renderer.emplace(device, physical_device, queue, commandpool);
|
||||
loader.emplace(device, physical_device, queue, application::queue_family_index(), renderer->get_default_material());
|
||||
|
||||
for ([[maybe_unused]] auto view: views)
|
||||
{
|
||||
assert(view.recommendedImageRectWidth == width);
|
||||
assert(view.recommendedImageRectHeight == height);
|
||||
lobby_entity = load_gltf("ground.gltf", layer_lobby).first;
|
||||
|
||||
swapchains_lobby.emplace_back(session, device, swapchain_format, width, height);
|
||||
swapchains_controllers.emplace_back(session, device, swapchain_format, width, height);
|
||||
|
||||
if (composition_layer_depth_test_supported)
|
||||
{
|
||||
swapchains_lobby_depth.emplace_back(session, device, depth_format, width, height);
|
||||
swapchains_controllers_depth.emplace_back(session, device, depth_format, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
spdlog::info("Created lobby swapchains: {}x{}", width, height);
|
||||
|
||||
vk::Extent2D output_size{width, height};
|
||||
|
||||
renderer.emplace(device, physical_device, queue, commandpool, output_size, swapchain_format, depth_format, 2, composition_layer_depth_test_supported);
|
||||
|
||||
scene_loader loader(device, physical_device, queue, application::queue_family_index(), renderer->get_default_material());
|
||||
|
||||
lobby_scene.emplace();
|
||||
lobby_handle = lobby_scene->new_node();
|
||||
lobby_scene->import(loader("ground.gltf"), lobby_handle);
|
||||
|
||||
controllers_scene.emplace();
|
||||
|
||||
scene_data & controllers_scene_data = composition_layer_depth_test_supported ? *lobby_scene : *controllers_scene;
|
||||
|
||||
auto profile = controller_name();
|
||||
input = input_profile(
|
||||
std::string profile = controller_name();
|
||||
input.emplace(
|
||||
*this,
|
||||
"controllers/" + profile + "/profile.json",
|
||||
loader,
|
||||
controllers_scene_data,
|
||||
*controllers_scene);
|
||||
layer_controllers,
|
||||
layer_rays);
|
||||
|
||||
spdlog::info("Loaded input profile {}", input->id);
|
||||
|
||||
@@ -1085,17 +796,14 @@ void scenes::lobby::on_focused()
|
||||
offset_orientation = glm::degrees(glm::eulerAngles(input->offset[xr::spaces::grip_left].second));
|
||||
ray_offset = input->offset[xr::spaces::aim_left].first.z;
|
||||
|
||||
xyz_axes_left_controller = controllers_scene_data.new_node();
|
||||
controllers_scene_data.import(loader("xyz-arrows.glb"), xyz_axes_left_controller);
|
||||
|
||||
xyz_axes_right_controller = controllers_scene_data.new_node();
|
||||
controllers_scene_data.import(loader("xyz-arrows.glb"), xyz_axes_right_controller);
|
||||
xyz_axes_left_controller = load_gltf("xyz-arrows.glb", layer_controllers).first;
|
||||
xyz_axes_right_controller = load_gltf("xyz-arrows.glb", layer_controllers).first;
|
||||
#endif
|
||||
|
||||
if (application::get_hand_tracking_supported())
|
||||
{
|
||||
left_hand.emplace("left-hand.glb", loader, controllers_scene_data);
|
||||
right_hand.emplace("right-hand.glb", loader, controllers_scene_data);
|
||||
hand_model::add_hand(*this, XR_HAND_LEFT_EXT, "left-hand.glb", layer_controllers);
|
||||
hand_model::add_hand(*this, XR_HAND_RIGHT_EXT, "right-hand.glb", layer_controllers);
|
||||
}
|
||||
|
||||
recenter_left_action = get_action("recenter_left").first;
|
||||
@@ -1108,6 +816,7 @@ void scenes::lobby::on_focused()
|
||||
.trigger = get_action("left_trigger").first,
|
||||
.squeeze = get_action("left_squeeze").first,
|
||||
.scroll = get_action("left_scroll").first,
|
||||
.haptic_output = get_action("left_haptic").first,
|
||||
},
|
||||
imgui_context::controller{
|
||||
.aim = get_action_space("right_aim"),
|
||||
@@ -1115,6 +824,7 @@ void scenes::lobby::on_focused()
|
||||
.trigger = get_action("right_trigger").first,
|
||||
.squeeze = get_action("right_squeeze").first,
|
||||
.scroll = get_action("right_scroll").first,
|
||||
.haptic_output = get_action("right_haptic").first,
|
||||
},
|
||||
};
|
||||
if (auto & hand = application::get_left_hand())
|
||||
@@ -1174,9 +884,20 @@ void scenes::lobby::on_focused()
|
||||
|
||||
imgui_ctx.emplace(physical_device, device, queue_family_index, queue, imgui_inputs, swapchain_imgui, vps);
|
||||
|
||||
std::string image;
|
||||
/* Could be used for more patriotics logos
|
||||
|
||||
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";
|
||||
|
||||
switch (tm->tm_mon)
|
||||
{
|
||||
default:
|
||||
image = "wivrn";
|
||||
break;
|
||||
}
|
||||
*/
|
||||
image = "wivrn";
|
||||
try
|
||||
{
|
||||
about_picture = imgui_ctx->load_texture(image + ".ktx2");
|
||||
@@ -1204,20 +925,15 @@ void scenes::lobby::on_unfocused()
|
||||
|
||||
renderer->wait_idle(); // Must be before the scene data because the renderer uses its descriptor sets
|
||||
|
||||
about_picture = nullptr;
|
||||
about_picture = 0;
|
||||
imgui_ctx.reset();
|
||||
lobby_scene.reset(); // Must be reset before the renderer so that the descriptor sets are freed before their pools
|
||||
controllers_scene.reset();
|
||||
world.clear(); // Must be cleared before the renderer so that the descriptor sets are freed before their pools
|
||||
|
||||
input.reset();
|
||||
left_hand.reset();
|
||||
right_hand.reset();
|
||||
|
||||
loader.reset();
|
||||
renderer.reset();
|
||||
swapchains_lobby.clear();
|
||||
swapchains_controllers.clear();
|
||||
swapchains_lobby_depth.clear();
|
||||
swapchains_controllers_depth.clear();
|
||||
clear_swapchains();
|
||||
swapchain_imgui = xr::swapchain();
|
||||
multicast.reset();
|
||||
}
|
||||
@@ -1285,8 +1001,8 @@ scene::meta & scenes::lobby::get_meta_scene()
|
||||
{"right_scroll", "/user/hand/right/input/thumbstick"},
|
||||
{"right_haptic", "/user/hand/right/output/haptic"},
|
||||
|
||||
{"recenter_left", "/user/hand/left/input/x/click"},
|
||||
{"recenter_right", "/user/hand/right/input/a/click"},
|
||||
{"recenter_left", "/user/hand/left/input/squeeze/value"},
|
||||
{"recenter_right", "/user/hand/right/input/squeeze/value"},
|
||||
},
|
||||
},
|
||||
suggested_binding{
|
||||
|
||||
+16
-28
@@ -22,23 +22,19 @@
|
||||
#include "asset.h"
|
||||
#include "configuration.h"
|
||||
#include "crypto.h"
|
||||
#include "render/scene_data.h"
|
||||
#include "scene.h"
|
||||
#include "scenes/hand_model.h"
|
||||
#include "scenes/lobby_keyboard.h"
|
||||
#include "utils/thread_safe.h"
|
||||
#include "wifi_lock.h"
|
||||
#include "wivrn_config.h"
|
||||
#include "wivrn_discover.h"
|
||||
#include "wivrn_packets.h"
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
|
||||
#include "xr/system.h"
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
#include "input_profile.h"
|
||||
#include "render/imgui_impl.h"
|
||||
#include "render/scene_renderer.h"
|
||||
#include "utils/async.h"
|
||||
|
||||
class wivrn_session;
|
||||
@@ -64,37 +60,27 @@ class lobby : public scene_impl<lobby>
|
||||
std::string server_name;
|
||||
bool autoconnect_enabled = true;
|
||||
|
||||
std::optional<scene_renderer> renderer;
|
||||
std::optional<scene_data> lobby_scene;
|
||||
std::optional<scene_data> controllers_scene;
|
||||
std::optional<input_profile> input;
|
||||
std::optional<hand_model> left_hand;
|
||||
std::optional<hand_model> right_hand;
|
||||
node_handle lobby_handle;
|
||||
bool composition_layer_depth_test_supported;
|
||||
bool composition_layer_color_scale_bias_supported;
|
||||
entt::entity lobby_entity;
|
||||
|
||||
std::optional<imgui_context> imgui_ctx;
|
||||
std::array<XrAction, 2> haptic_output;
|
||||
|
||||
std::string selected_item;
|
||||
std::unique_ptr<asset> license;
|
||||
ImGuiID hovered_item;
|
||||
|
||||
std::vector<xr::swapchain> swapchains_lobby;
|
||||
std::vector<xr::swapchain> swapchains_lobby_depth;
|
||||
std::vector<xr::swapchain> swapchains_controllers;
|
||||
std::vector<xr::swapchain> swapchains_controllers_depth;
|
||||
static inline const uint32_t layer_lobby = 1 << 0;
|
||||
static inline const uint32_t layer_controllers = 1 << 1;
|
||||
static inline const uint32_t layer_rays = 1 << 2;
|
||||
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
xr::swapchain swapchain_imgui;
|
||||
vk::Format swapchain_format;
|
||||
vk::Format depth_format;
|
||||
xr::system::passthrough_type passthrough_supported;
|
||||
XrViewConfigurationView stream_view;
|
||||
|
||||
#if WIVRN_CLIENT_DEBUG_MENU
|
||||
// GUI debug
|
||||
node_handle xyz_axes_left_controller;
|
||||
node_handle xyz_axes_right_controller;
|
||||
entt::entity xyz_axes_left_controller;
|
||||
entt::entity xyz_axes_right_controller;
|
||||
bool display_debug_axes = false;
|
||||
bool display_grip_instead_of_aim = false;
|
||||
glm::vec3 offset_position{};
|
||||
@@ -112,10 +98,10 @@ class lobby : public scene_impl<lobby>
|
||||
std::optional<float> gui_recenter_distance;
|
||||
bool recenter_gui = true;
|
||||
void move_gui(glm::vec3 head_position, glm::vec3 new_gui_position);
|
||||
void tooltip(std::string_view text);
|
||||
|
||||
enum class tab
|
||||
{
|
||||
first_run,
|
||||
server_list,
|
||||
settings,
|
||||
post_processing,
|
||||
@@ -124,11 +110,13 @@ class lobby : public scene_impl<lobby>
|
||||
#endif
|
||||
about,
|
||||
licenses,
|
||||
exit
|
||||
exit,
|
||||
connected,
|
||||
};
|
||||
|
||||
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
|
||||
ImTextureID about_picture;
|
||||
|
||||
virtual_keyboard keyboard;
|
||||
@@ -146,6 +134,7 @@ class lobby : public scene_impl<lobby>
|
||||
void draw_features_status(XrTime predicted_display_time);
|
||||
void gui_connecting(locked_notifiable<pin_request_data> & request);
|
||||
void gui_enter_pin(locked_notifiable<pin_request_data> & request);
|
||||
void gui_connected();
|
||||
void gui_server_list();
|
||||
void gui_new_server();
|
||||
void gui_settings();
|
||||
@@ -154,11 +143,10 @@ class lobby : public scene_impl<lobby>
|
||||
void gui_about();
|
||||
void gui_licenses();
|
||||
void gui_keyboard();
|
||||
void gui_first_run();
|
||||
|
||||
void setup_passthrough();
|
||||
|
||||
void vibrate_on_hover();
|
||||
|
||||
void connect(const configuration::server_data & data);
|
||||
std::unique_ptr<wivrn_session> connect_to_session(wivrn_discover::service service, bool manual_connection);
|
||||
|
||||
|
||||
+376
-282
File diff suppressed because it is too large
Load Diff
@@ -319,14 +319,14 @@ virtual_keyboard::key_status virtual_keyboard::button_behavior(const ImRect & bb
|
||||
|
||||
float prev_held_duration = held_duration;
|
||||
held_duration += g.IO.DeltaTime;
|
||||
if ((flags & ImGuiButtonFlags_Repeat) and held_duration > g.IO.KeyRepeatDelay)
|
||||
{
|
||||
int n1 = (prev_held_duration - g.IO.KeyRepeatDelay) / g.IO.KeyRepeatRate;
|
||||
int n2 = (held_duration - g.IO.KeyRepeatDelay) / g.IO.KeyRepeatRate;
|
||||
|
||||
if (n2 != n1)
|
||||
pressed = true;
|
||||
}
|
||||
// if ((flags & ImGuiButtonFlags_Repeat) and held_duration > g.IO.KeyRepeatDelay)
|
||||
// {
|
||||
// int n1 = (prev_held_duration - g.IO.KeyRepeatDelay) / g.IO.KeyRepeatRate;
|
||||
// int n2 = (held_duration - g.IO.KeyRepeatDelay) / g.IO.KeyRepeatRate;
|
||||
//
|
||||
// if (n2 != n1)
|
||||
// pressed = true;
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -381,8 +381,8 @@ virtual_keyboard::key_status virtual_keyboard::draw_single_key(const key & k, in
|
||||
|
||||
ImGuiButtonFlags flags = ImGuiButtonFlags_None;
|
||||
|
||||
if (k.flag & key_flag_repeat)
|
||||
flags |= ImGuiButtonFlags_Repeat;
|
||||
// if (k.flag & key_flag_repeat)
|
||||
// flags |= ImGuiButtonFlags_Repeat;
|
||||
|
||||
auto status = button_behavior(bb, id, window_hovered, flags);
|
||||
|
||||
@@ -462,7 +462,7 @@ void virtual_keyboard::press_single_key(const key & k)
|
||||
}
|
||||
}
|
||||
|
||||
void virtual_keyboard::display(ImGuiID & hovered_id)
|
||||
void virtual_keyboard::display(imgui_context & ctx)
|
||||
{
|
||||
ImGuiStyle & style = ImGui::GetStyle();
|
||||
|
||||
@@ -534,7 +534,7 @@ void virtual_keyboard::display(ImGuiID & hovered_id)
|
||||
|
||||
auto status = draw_single_key(key, id++, ImVec2{base_key_width * key.width - style.ItemSpacing.x, key_height}, window_hovered);
|
||||
if (status.hovered)
|
||||
hovered_id = ImGui::GetItemID();
|
||||
ctx.set_hovered_item();
|
||||
}
|
||||
|
||||
key_position.x += base_key_width * key.width;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "imgui.h"
|
||||
#include "render/imgui_impl.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -80,7 +81,7 @@ private:
|
||||
bool symbols_shown = false;
|
||||
|
||||
public:
|
||||
void display(ImGuiID & hovered);
|
||||
void display(imgui_context & ctx);
|
||||
const std::string_view get_layout() const;
|
||||
void set_layout(std::string_view layout_name);
|
||||
};
|
||||
|
||||
+298
-97
@@ -16,11 +16,16 @@
|
||||
* 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 "constants.h"
|
||||
#include "utils/overloaded.h"
|
||||
#include "xr/fb_body_tracker.h"
|
||||
#include "xr/fb_face_tracker2.h"
|
||||
#include "xr/htc_body_tracker.h"
|
||||
#include "xr/pico_body_tracker.h"
|
||||
#include "xr/space.h"
|
||||
#include <glm/gtc/matrix_access.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <magic_enum.hpp>
|
||||
#include <openxr/openxr.h>
|
||||
#define GLM_FORCE_RADIANS
|
||||
|
||||
@@ -135,11 +140,21 @@ static const std::unordered_map<std::string, device_id> device_ids = {
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static const std::array supported_formats = {
|
||||
static const std::array supported_color_formats = {
|
||||
vk::Format::eR8G8B8A8Srgb,
|
||||
vk::Format::eB8G8R8A8Srgb,
|
||||
};
|
||||
|
||||
static const std::array supported_depth_formats{
|
||||
vk::Format::eD32Sfloat,
|
||||
vk::Format::eX8D24UnormPack32,
|
||||
};
|
||||
|
||||
scenes::stream::stream() :
|
||||
scene_impl<stream>(supported_color_formats, supported_depth_formats)
|
||||
{
|
||||
}
|
||||
|
||||
static from_headset::visibility_mask_changed::masks get_visibility_mask(xr::instance & inst, xr::session & session, int view)
|
||||
{
|
||||
assert(inst.has_extension(XR_KHR_VISIBILITY_MASK_EXTENSION_NAME));
|
||||
@@ -296,6 +311,29 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const auto & info = application::get_messages_info();
|
||||
self->network_session->send_control(from_headset::get_application_list{
|
||||
.language = info.language,
|
||||
.country = info.country,
|
||||
.variant = info.variant,
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
const auto & config = application::get_config();
|
||||
self->override_foveation_enable = config.override_foveation_enable;
|
||||
self->override_foveation_pitch = config.override_foveation_pitch;
|
||||
self->override_foveation_distance = config.override_foveation_distance;
|
||||
|
||||
if (self->override_foveation_enable)
|
||||
self->network_session->send_control(from_headset::override_foveation_center{
|
||||
.enabled = self->override_foveation_enable,
|
||||
.pitch = self->override_foveation_pitch,
|
||||
.distance = self->override_foveation_distance,
|
||||
});
|
||||
}
|
||||
|
||||
self->network_thread = utils::named_thread("network_thread", &stream::process_packets, self.get());
|
||||
|
||||
self->command_buffer = std::move(self->device.allocateCommandBuffers({
|
||||
@@ -341,25 +379,6 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
||||
self->input_actions.emplace_back(it->second, action, action_type);
|
||||
}
|
||||
|
||||
self->swapchain_format = vk::Format::eUndefined;
|
||||
spdlog::info("Supported swapchain formats:");
|
||||
|
||||
for (auto format: self->session.get_swapchain_formats())
|
||||
{
|
||||
spdlog::info(" {}", vk::to_string(format));
|
||||
}
|
||||
for (auto format: self->session.get_swapchain_formats())
|
||||
{
|
||||
if (std::find(supported_formats.begin(), supported_formats.end(), format) != supported_formats.end())
|
||||
{
|
||||
self->swapchain_format = format;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (self->swapchain_format == vk::Format::eUndefined)
|
||||
throw std::runtime_error("No supported swapchain format");
|
||||
|
||||
spdlog::info("Using format {}", vk::to_string(self->swapchain_format));
|
||||
|
||||
self->query_pool = vk::raii::QueryPool(
|
||||
@@ -375,36 +394,91 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
||||
|
||||
void scenes::stream::on_focused()
|
||||
{
|
||||
if (application::get_config().show_performance_metrics)
|
||||
gui_status_last_change = application::now();
|
||||
|
||||
auto views = system.view_configuration_views(viewconfig);
|
||||
// stream_view = override_view(views[0], guess_model());
|
||||
width = views[0].recommendedImageRectWidth;
|
||||
height = views[0].recommendedImageRectHeight;
|
||||
|
||||
renderer.emplace(device, physical_device, queue, commandpool);
|
||||
loader.emplace(device, physical_device, queue, application::queue_family_index(), renderer->get_default_material());
|
||||
|
||||
std::string profile = controller_name();
|
||||
input.emplace(
|
||||
*this,
|
||||
"controllers/" + profile + "/profile.json",
|
||||
layer_controllers,
|
||||
layer_rays);
|
||||
|
||||
spdlog::info("Loaded input profile {}", input->id);
|
||||
|
||||
for (auto i: {xr::spaces::aim_left, xr::spaces::aim_right, xr::spaces::grip_left, xr::spaces::grip_right})
|
||||
{
|
||||
swapchain_imgui = xr::swapchain(
|
||||
session,
|
||||
device,
|
||||
swapchain_format,
|
||||
1500,
|
||||
1000);
|
||||
auto [p, q] = input->offset[i] = controller_offset(controller_name(), i);
|
||||
|
||||
imgui_context::viewport vp{
|
||||
.space = xr::spaces::view,
|
||||
.position = {0, 0, -1},
|
||||
.orientation = {1, 0, 0, 0},
|
||||
.size = {1.0, 0.6666},
|
||||
.vp_origin = {0, 0},
|
||||
.vp_size = {1500, 1000},
|
||||
};
|
||||
|
||||
imgui_ctx.emplace(physical_device,
|
||||
device,
|
||||
queue_family_index,
|
||||
queue,
|
||||
std::span<imgui_context::controller>{},
|
||||
swapchain_imgui,
|
||||
std::vector{vp});
|
||||
|
||||
plots_toggle_1 = get_action("plots_toggle_1").first;
|
||||
plots_toggle_2 = get_action("plots_toggle_2").first;
|
||||
auto rot = glm::degrees(glm::eulerAngles(q));
|
||||
spdlog::info("Initializing offset of space {} to ({}, {}, {}) mm, ({}, {}, {})°",
|
||||
magic_enum::enum_name(i),
|
||||
1000 * p.x,
|
||||
1000 * p.y,
|
||||
1000 * p.z,
|
||||
rot.x,
|
||||
rot.y,
|
||||
rot.z);
|
||||
}
|
||||
|
||||
std::array imgui_inputs{
|
||||
imgui_context::controller{
|
||||
.aim = get_action_space("left_aim"),
|
||||
.offset = input->offset[xr::spaces::aim_left],
|
||||
.trigger = get_action("left_trigger").first,
|
||||
.squeeze = get_action("left_squeeze").first,
|
||||
.scroll = get_action("left_scroll").first,
|
||||
.haptic_output = get_action("left_haptic").first,
|
||||
},
|
||||
imgui_context::controller{
|
||||
.aim = get_action_space("right_aim"),
|
||||
.offset = input->offset[xr::spaces::aim_right],
|
||||
.trigger = get_action("right_trigger").first,
|
||||
.squeeze = get_action("right_squeeze").first,
|
||||
.scroll = get_action("right_scroll").first,
|
||||
.haptic_output = get_action("right_haptic").first,
|
||||
},
|
||||
};
|
||||
|
||||
swapchain_imgui = xr::swapchain(
|
||||
session,
|
||||
device,
|
||||
swapchain_format,
|
||||
1800,
|
||||
1000);
|
||||
|
||||
imgui_context::viewport vp{
|
||||
.space = xr::spaces::world,
|
||||
// Position and orientation are set at each frame
|
||||
.size = {1.2, 0.6666},
|
||||
.vp_origin = {0, 0},
|
||||
.vp_size = {1800, 1000},
|
||||
};
|
||||
|
||||
imgui_ctx.emplace(physical_device,
|
||||
device,
|
||||
queue_family_index,
|
||||
queue,
|
||||
imgui_inputs,
|
||||
swapchain_imgui,
|
||||
std::vector{vp});
|
||||
|
||||
plots_toggle_1 = get_action("plots_toggle_1").first;
|
||||
plots_toggle_2 = get_action("plots_toggle_2").first;
|
||||
recenter_left = get_action("recenter_left").first;
|
||||
recenter_right = get_action("recenter_right").first;
|
||||
foveation_pitch = get_action("foveation_pitch").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(
|
||||
@@ -414,6 +488,13 @@ void scenes::stream::on_focused()
|
||||
|
||||
void scenes::stream::on_unfocused()
|
||||
{
|
||||
renderer->wait_idle(); // Must be before the scene data because the renderer uses its descriptor sets
|
||||
world.clear(); // Must be cleared before the renderer so that the descriptor sets are freed before their pools
|
||||
input.reset();
|
||||
loader.reset();
|
||||
renderer.reset();
|
||||
clear_swapchains();
|
||||
|
||||
imgui_ctx.reset();
|
||||
swapchain_imgui = xr::swapchain();
|
||||
}
|
||||
@@ -585,6 +666,78 @@ std::shared_ptr<shard_accumulator::blit_handle> scenes::stream::accumulator_imag
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void scenes::stream::update_gui_position(xr::spaces controller)
|
||||
{
|
||||
auto aim = application::locate_controller(
|
||||
application::space(controller),
|
||||
application::space(xr::spaces::view),
|
||||
predicted_display_time);
|
||||
|
||||
if (not aim)
|
||||
return;
|
||||
|
||||
auto [offset_position, offset_orientation] = input->offset[controller];
|
||||
|
||||
auto head_controller_position = aim->first + glm::mat3_cast(aim->second * offset_orientation) * offset_position;
|
||||
auto head_controller_orientation = aim->second * offset_orientation;
|
||||
auto head_controller_direction = -glm::column(glm::mat3_cast(head_controller_orientation), 2);
|
||||
|
||||
if (not recentering_context)
|
||||
{
|
||||
// First frame of recentering: get the GUI position relative to the controller
|
||||
|
||||
// Compute the intersection of the ray with the GUI
|
||||
auto gui_controller_direction = glm::conjugate(head_gui_orientation) * head_controller_direction;
|
||||
auto gui_controller_position = glm::conjugate(head_gui_orientation) * (head_controller_position - head_gui_position);
|
||||
|
||||
float lambda = -gui_controller_position.z / gui_controller_direction.z;
|
||||
auto gui_intersection = gui_controller_position + lambda * gui_controller_direction;
|
||||
|
||||
auto viewport_size = imgui_ctx->layers()[0].size;
|
||||
if (std::isnan(lambda) or lambda < 0 or
|
||||
std::abs(gui_intersection.x) > viewport_size.x / 2 or
|
||||
std::abs(gui_intersection.y) > viewport_size.y / 2)
|
||||
{
|
||||
// Reset the relative GUI position if the ray does not intersect
|
||||
recentering_context.emplace(controller, glm::vec3{0, 0, -1}, glm::quat{1, 0, 0, 0});
|
||||
}
|
||||
else
|
||||
{
|
||||
glm::vec3 controller_gui_position = glm::conjugate(head_controller_orientation) * (head_gui_position - head_controller_position);
|
||||
glm::quat controller_gui_orientation = glm::conjugate(head_controller_orientation) * head_gui_orientation;
|
||||
|
||||
recentering_context.emplace(controller, controller_gui_position, controller_gui_orientation);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Subsequent frames of recentering: keep the GUI locked to the controller
|
||||
auto [_, controller_gui_position, controller_gui_orientation] = *recentering_context;
|
||||
|
||||
head_gui_position = head_controller_position + head_controller_orientation * controller_gui_position;
|
||||
head_gui_orientation = head_controller_orientation * controller_gui_orientation;
|
||||
}
|
||||
}
|
||||
|
||||
bool scenes::stream::is_gui_interactable() const
|
||||
{
|
||||
switch (gui_status)
|
||||
{
|
||||
case gui_status::stats:
|
||||
case gui_status::settings:
|
||||
case gui_status::foveation_settings:
|
||||
return true;
|
||||
|
||||
case gui_status::hidden:
|
||||
case gui_status::overlay_only:
|
||||
case gui_status::compact:
|
||||
return false;
|
||||
}
|
||||
|
||||
assert(false);
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void scenes::stream::render(const XrFrameState & frame_state)
|
||||
{
|
||||
if (exiting)
|
||||
@@ -956,31 +1109,18 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
vk::SubmitInfo submit_info;
|
||||
submit_info.setCommandBuffers(*command_buffer);
|
||||
queue.submit(submit_info, *fence);
|
||||
swapchain.release();
|
||||
|
||||
XrEnvironmentBlendMode blend_mode = XR_ENVIRONMENT_BLEND_MODE_OPAQUE;
|
||||
std::vector<XrCompositionLayerBaseHeader *> layers_base;
|
||||
std::vector<XrCompositionLayerProjectionView> layer_view(view_count);
|
||||
|
||||
if (use_alpha)
|
||||
{
|
||||
session.enable_passthrough(system);
|
||||
std::visit(
|
||||
utils::overloaded{
|
||||
[&](std::monostate &) {
|
||||
assert(false);
|
||||
},
|
||||
[&](xr::passthrough_alpha_blend & p) {
|
||||
blend_mode = XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND;
|
||||
},
|
||||
[&](auto & p) {
|
||||
layers_base.push_back(p.layer());
|
||||
}},
|
||||
session.get_passthrough());
|
||||
}
|
||||
else
|
||||
session.disable_passthrough();
|
||||
|
||||
swapchain.release();
|
||||
render_start(use_alpha, frame_state.predictedDisplayTime);
|
||||
|
||||
// Add the layer with the streamed content
|
||||
for (uint32_t view = 0; view < view_count; view++)
|
||||
{
|
||||
layer_view[view] =
|
||||
@@ -999,45 +1139,47 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
},
|
||||
};
|
||||
}
|
||||
add_projection_layer(
|
||||
XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT,
|
||||
application::space(xr::spaces::world),
|
||||
std::move(layer_view));
|
||||
|
||||
XrCompositionLayerProjection layer{
|
||||
.type = XR_TYPE_COMPOSITION_LAYER_PROJECTION,
|
||||
.layerFlags = XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT,
|
||||
.space = application::space(xr::spaces::world),
|
||||
.viewCount = (uint32_t)layer_view.size(),
|
||||
.views = layer_view.data(),
|
||||
};
|
||||
|
||||
XrCompositionLayerSettingsFB settings;
|
||||
const configuration::openxr_post_processing_settings openxr_post_processing = application::get_config().openxr_post_processing;
|
||||
if ((openxr_post_processing.sharpening | openxr_post_processing.super_sampling) > 0)
|
||||
if (composition_layer_color_scale_bias_supported)
|
||||
{
|
||||
settings = {
|
||||
.type = XR_TYPE_COMPOSITION_LAYER_SETTINGS_FB,
|
||||
.layerFlags = openxr_post_processing.sharpening | openxr_post_processing.super_sampling,
|
||||
};
|
||||
layer.next = &settings;
|
||||
switch (gui_status)
|
||||
{
|
||||
case gui_status::hidden:
|
||||
case gui_status::foveation_settings:
|
||||
case gui_status::compact:
|
||||
case gui_status::overlay_only:
|
||||
dimming = dimming - frame_state.predictedDisplayPeriod / (1e9 * constants::stream::fade_duration);
|
||||
break;
|
||||
case gui_status::stats:
|
||||
case gui_status::settings:
|
||||
dimming = dimming + frame_state.predictedDisplayPeriod / (1e9 * constants::stream::fade_duration);
|
||||
break;
|
||||
}
|
||||
|
||||
dimming = std::clamp<float>(dimming, 0, 1);
|
||||
float x = dimming * dimming * (3 - 2 * dimming); // Easing function
|
||||
|
||||
float scale = std::lerp(1, constants::stream::dimming_scale, x);
|
||||
float bias = std::lerp(0, constants::stream::dimming_bias, x);
|
||||
|
||||
set_color_scale_bias({scale, scale, scale, 1}, {bias, bias, bias, 0});
|
||||
}
|
||||
|
||||
std::vector<XrCompositionLayerQuad> imgui_layers;
|
||||
if (imgui_ctx)
|
||||
{
|
||||
accumulate_metrics(frame_state.predictedDisplayTime, current_blit_handles, timestamps);
|
||||
if (plots_visible)
|
||||
imgui_layers = plot_performance_metrics(frame_state.predictedDisplayTime);
|
||||
}
|
||||
if (const configuration::openxr_post_processing_settings openxr_post_processing = application::get_config().openxr_post_processing;
|
||||
(openxr_post_processing.sharpening | openxr_post_processing.super_sampling) > 0)
|
||||
set_layer_settings(openxr_post_processing.sharpening | openxr_post_processing.super_sampling);
|
||||
|
||||
layers_base.push_back(reinterpret_cast<XrCompositionLayerBaseHeader *>(&layer));
|
||||
accumulate_metrics(frame_state.predictedDisplayTime, current_blit_handles, timestamps);
|
||||
|
||||
if (imgui_ctx and plots_visible)
|
||||
{
|
||||
for (auto & layer: imgui_layers)
|
||||
layers_base.push_back(reinterpret_cast<XrCompositionLayerBaseHeader *>(&layer));
|
||||
}
|
||||
draw_gui(frame_state.predictedDisplayTime, frame_state.predictedDisplayPeriod);
|
||||
|
||||
try
|
||||
{
|
||||
session.end_frame(frame_state.predictedDisplayTime, layers_base, blend_mode);
|
||||
render_end();
|
||||
}
|
||||
catch (std::system_error & e)
|
||||
{
|
||||
@@ -1093,7 +1235,22 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
CHECK_XR(xrGetActionStateBoolean(session, &get_info, &state_2));
|
||||
|
||||
if (state_1.currentState and state_2.currentState and (state_1.changedSinceLastSync or state_2.changedSinceLastSync))
|
||||
plots_visible = not plots_visible;
|
||||
{
|
||||
switch (gui_status)
|
||||
{
|
||||
case gui_status::hidden:
|
||||
case gui_status::compact:
|
||||
case gui_status::overlay_only:
|
||||
gui_status = gui_status::stats;
|
||||
break;
|
||||
|
||||
case gui_status::stats:
|
||||
case gui_status::settings:
|
||||
case gui_status::foveation_settings:
|
||||
gui_status = gui_status::hidden;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query_pool_filled = true;
|
||||
@@ -1284,8 +1441,27 @@ scene::meta & scenes::stream::get_meta_scene()
|
||||
static meta m{
|
||||
.name = "Stream",
|
||||
.actions = {
|
||||
{"left_aim", XR_ACTION_TYPE_POSE_INPUT},
|
||||
{"left_trigger", XR_ACTION_TYPE_FLOAT_INPUT},
|
||||
{"left_squeeze", XR_ACTION_TYPE_FLOAT_INPUT},
|
||||
{"left_scroll", XR_ACTION_TYPE_VECTOR2F_INPUT},
|
||||
{"left_haptic", XR_ACTION_TYPE_VIBRATION_OUTPUT},
|
||||
{"right_aim", XR_ACTION_TYPE_POSE_INPUT},
|
||||
{"right_trigger", XR_ACTION_TYPE_FLOAT_INPUT},
|
||||
{"right_squeeze", XR_ACTION_TYPE_FLOAT_INPUT},
|
||||
{"right_scroll", XR_ACTION_TYPE_VECTOR2F_INPUT},
|
||||
{"right_haptic", XR_ACTION_TYPE_VIBRATION_OUTPUT},
|
||||
|
||||
{"plots_toggle_1", XR_ACTION_TYPE_BOOLEAN_INPUT},
|
||||
{"plots_toggle_2", XR_ACTION_TYPE_BOOLEAN_INPUT},
|
||||
|
||||
{"recenter_left", XR_ACTION_TYPE_BOOLEAN_INPUT},
|
||||
{"recenter_right", XR_ACTION_TYPE_BOOLEAN_INPUT},
|
||||
|
||||
{"foveation_pitch", 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},
|
||||
},
|
||||
.bindings = {
|
||||
suggested_binding{
|
||||
@@ -1297,9 +1473,28 @@ scene::meta & scenes::stream::get_meta_scene()
|
||||
"/interaction_profiles/meta/touch_plus_controller",
|
||||
"/interaction_profiles/bytedance/pico_neo3_controller",
|
||||
"/interaction_profiles/bytedance/pico4_controller",
|
||||
"/interaction_profiles/bytedance/pico4s_controller",
|
||||
"/interaction_profiles/htc/vive_focus3_controller",
|
||||
},
|
||||
{
|
||||
{"left_aim", "/user/hand/left/input/aim/pose"},
|
||||
{"left_trigger", "/user/hand/left/input/trigger/value"},
|
||||
{"left_squeeze", "/user/hand/left/input/squeeze/value"},
|
||||
{"left_scroll", "/user/hand/left/input/thumbstick"},
|
||||
{"left_haptic", "/user/hand/left/output/haptic"},
|
||||
{"right_aim", "/user/hand/right/input/aim/pose"},
|
||||
{"right_trigger", "/user/hand/right/input/trigger/value"},
|
||||
{"right_squeeze", "/user/hand/right/input/squeeze/value"},
|
||||
{"right_scroll", "/user/hand/right/input/thumbstick"},
|
||||
{"right_haptic", "/user/hand/right/output/haptic"},
|
||||
|
||||
{"recenter_left", "/user/hand/left/input/squeeze/value"},
|
||||
{"recenter_right", "/user/hand/right/input/squeeze/value"},
|
||||
{"foveation_pitch", "/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"},
|
||||
|
||||
{"plots_toggle_1", "/user/hand/left/input/thumbstick/click"},
|
||||
{"plots_toggle_2", "/user/hand/right/input/thumbstick/click"},
|
||||
},
|
||||
@@ -1337,9 +1532,15 @@ void scenes::stream::on_xr_event(const xr::event & event)
|
||||
});
|
||||
break;
|
||||
case XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED:
|
||||
network_session->send_control(from_headset::session_state_changed{
|
||||
.state = event.state_changed.state,
|
||||
});
|
||||
// Override session state if the GUI is interactable
|
||||
if (event.state_changed.state == XR_SESSION_STATE_FOCUSED and is_gui_interactable())
|
||||
network_session->send_control(from_headset::session_state_changed{
|
||||
.state = XR_SESSION_STATE_VISIBLE,
|
||||
});
|
||||
else
|
||||
network_session->send_control(from_headset::session_state_changed{
|
||||
.state = event.state_changed.state,
|
||||
});
|
||||
break;
|
||||
case XR_TYPE_EVENT_DATA_USER_PRESENCE_CHANGED_EXT:
|
||||
network_session->send_control(from_headset::user_presence_changed{
|
||||
|
||||
+71
-5
@@ -23,10 +23,13 @@
|
||||
#include "decoder/shard_accumulator.h"
|
||||
#include "render/imgui_impl.h"
|
||||
#include "scene.h"
|
||||
#include "scenes/input_profile.h"
|
||||
#include "stream_reprojection.h"
|
||||
#include "utils/thread_safe.h"
|
||||
#include "wifi_lock.h"
|
||||
#include "wivrn_client.h"
|
||||
#include "wivrn_packets.h"
|
||||
#include "xr/space.h"
|
||||
#include <mutex>
|
||||
#include <shared_mutex>
|
||||
#include <thread>
|
||||
@@ -119,19 +122,63 @@ private:
|
||||
|
||||
xr::swapchain swapchain;
|
||||
xr::swapchain swapchain_imgui;
|
||||
vk::Format swapchain_format;
|
||||
|
||||
std::optional<audio> audio_handle;
|
||||
|
||||
std::optional<input_profile> input;
|
||||
static inline const uint32_t layer_controllers = 1 << 0;
|
||||
static inline const uint32_t layer_rays = 1 << 1;
|
||||
|
||||
// Size of the composition layer used for the controllers
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
|
||||
std::optional<imgui_context> imgui_ctx;
|
||||
bool plots_visible = true;
|
||||
enum class gui_status
|
||||
{
|
||||
hidden,
|
||||
overlay_only,
|
||||
compact,
|
||||
stats,
|
||||
settings,
|
||||
foveation_settings
|
||||
};
|
||||
|
||||
bool is_gui_interactable() const;
|
||||
|
||||
std::atomic<gui_status> gui_status = gui_status::hidden;
|
||||
enum gui_status last_gui_status = gui_status::hidden;
|
||||
XrTime gui_status_last_change;
|
||||
float dimming = 0;
|
||||
|
||||
XrAction plots_toggle_1 = XR_NULL_HANDLE;
|
||||
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 foveation_distance = XR_NULL_HANDLE;
|
||||
XrAction foveation_ok = XR_NULL_HANDLE;
|
||||
XrAction foveation_cancel = XR_NULL_HANDLE;
|
||||
|
||||
// Position of the GUI relative to the view space, in view space axes
|
||||
glm::vec3 head_gui_position{-0.1, -0.3, -1.2}; // Shift 10cm left by default so that the stats are centered accounting for the tab list
|
||||
glm::quat head_gui_orientation{1, 0, 0, 0};
|
||||
|
||||
bool override_foveation_enable;
|
||||
float override_foveation_pitch; // The pitch is the opposite as the height displayed in the GUI
|
||||
float override_foveation_distance;
|
||||
|
||||
// Which controller is used for recentering and position of the GUI relative to the controller, in controller axes, during recentering
|
||||
std::optional<std::tuple<xr::spaces, glm::vec3, glm::quat>> recentering_context;
|
||||
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;
|
||||
|
||||
stream() = default;
|
||||
// Last application list received from server
|
||||
thread_safe<to_headset::application_list> applications;
|
||||
|
||||
stream();
|
||||
|
||||
public:
|
||||
~stream();
|
||||
@@ -154,6 +201,7 @@ public:
|
||||
void operator()(to_headset::audio_stream_description &&);
|
||||
void operator()(to_headset::video_stream_description &&);
|
||||
void operator()(to_headset::refresh_rate_change &&);
|
||||
void operator()(to_headset::application_list &&);
|
||||
void operator()(audio_data &&);
|
||||
|
||||
void push_blit_handle(wivrn::shard_accumulator * decoder, std::shared_ptr<wivrn::shard_accumulator::blit_handle> handle);
|
||||
@@ -170,6 +218,13 @@ public:
|
||||
return !exiting;
|
||||
}
|
||||
|
||||
auto get_applications()
|
||||
{
|
||||
return applications.lock();
|
||||
}
|
||||
|
||||
void start_application(std::string appid);
|
||||
|
||||
static meta & get_meta_scene();
|
||||
|
||||
private:
|
||||
@@ -186,8 +241,9 @@ private:
|
||||
vk::raii::QueryPool query_pool = nullptr;
|
||||
bool query_pool_filled = false;
|
||||
|
||||
uint64_t bytes_sent = 0;
|
||||
// Used for plots
|
||||
uint64_t bytes_received = 0;
|
||||
uint64_t bytes_sent = 0;
|
||||
float bandwidth_rx = 0;
|
||||
float bandwidth_tx = 0;
|
||||
|
||||
@@ -242,7 +298,17 @@ private:
|
||||
XrTime last_metric_time = 0;
|
||||
int metrics_offset = 0;
|
||||
|
||||
// Used for compact view
|
||||
float compact_bandwidth_rx = 0;
|
||||
float compact_bandwidth_tx = 0;
|
||||
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);
|
||||
std::vector<XrCompositionLayerQuad> plot_performance_metrics(XrTime predicted_display_time);
|
||||
void gui_performance_metrics();
|
||||
void gui_compact_view();
|
||||
void gui_settings();
|
||||
void gui_foveation_settings(float predicted_display_period);
|
||||
void draw_gui(XrTime predicted_display_time, XrDuration predicted_display_period);
|
||||
};
|
||||
} // namespace scenes
|
||||
|
||||
@@ -25,39 +25,43 @@ void scenes::stream::read_actions()
|
||||
{
|
||||
from_headset::inputs inputs;
|
||||
|
||||
for (const auto & [id, action, action_type]: input_actions)
|
||||
if (not is_gui_interactable())
|
||||
{
|
||||
switch (action_type)
|
||||
for (const auto & [id, action, action_type]: input_actions)
|
||||
{
|
||||
case XR_ACTION_TYPE_BOOLEAN_INPUT: {
|
||||
auto value = application::read_action_bool(action);
|
||||
if (value)
|
||||
inputs.values.push_back({id, (float)value->second, value->first});
|
||||
}
|
||||
break;
|
||||
|
||||
case XR_ACTION_TYPE_FLOAT_INPUT: {
|
||||
auto value = application::read_action_float(action);
|
||||
if (value)
|
||||
inputs.values.push_back({id, value->second, value->first});
|
||||
}
|
||||
break;
|
||||
|
||||
case XR_ACTION_TYPE_VECTOR2F_INPUT: {
|
||||
auto value = application::read_action_vec2(action);
|
||||
if (value)
|
||||
{
|
||||
inputs.values.push_back({id, value->second.x, value->first});
|
||||
inputs.values.push_back({(device_id)((int)id + 1), value->second.y, value->first});
|
||||
switch (action_type)
|
||||
{
|
||||
case XR_ACTION_TYPE_BOOLEAN_INPUT: {
|
||||
auto value = application::read_action_bool(action);
|
||||
if (value)
|
||||
inputs.values.push_back({id, (float)value->second, value->first});
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case XR_ACTION_TYPE_POSE_INPUT:
|
||||
default:
|
||||
break;
|
||||
|
||||
case XR_ACTION_TYPE_FLOAT_INPUT: {
|
||||
auto value = application::read_action_float(action);
|
||||
if (value)
|
||||
inputs.values.push_back({id, value->second, value->first});
|
||||
}
|
||||
break;
|
||||
|
||||
case XR_ACTION_TYPE_VECTOR2F_INPUT: {
|
||||
auto value = application::read_action_vec2(action);
|
||||
if (value)
|
||||
{
|
||||
inputs.values.push_back({id, value->second.x, value->first});
|
||||
inputs.values.push_back({(device_id)((int)id + 1), value->second.y, value->first});
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case XR_ACTION_TYPE_POSE_INPUT:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
network_session->send_stream(std::move(inputs));
|
||||
|
||||
@@ -0,0 +1,919 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
|
||||
#include "stream.h"
|
||||
|
||||
#include "application.h"
|
||||
#include "constants.h"
|
||||
#include "imgui.h"
|
||||
#include "imgui_internal.h"
|
||||
#include "implot.h"
|
||||
#include "utils/i18n.h"
|
||||
#include "utils/ranges.h"
|
||||
#include <IconsFontAwesome6.h>
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
#include <glm/gtc/matrix_access.hpp>
|
||||
#include <limits>
|
||||
#include <ranges>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
float compute_plot_max_value(float * data, int count, ptrdiff_t stride)
|
||||
{
|
||||
float max = 0;
|
||||
uintptr_t ptr = (uintptr_t)data;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
max = std::max(max, *(float *)(ptr + i * stride));
|
||||
}
|
||||
|
||||
// First power of 10 less than the max
|
||||
float x = pow(10, floor(log10(max)));
|
||||
return ceil(max / x) * x;
|
||||
}
|
||||
|
||||
std::pair<float, std::string> compute_plot_unit(float max_value)
|
||||
{
|
||||
if (max_value > 1e9)
|
||||
return {1e-9, "G"};
|
||||
if (max_value > 1e6)
|
||||
return {1e-6, "M"};
|
||||
if (max_value > 1e3)
|
||||
return {1e-3, "k"};
|
||||
if (max_value > 1)
|
||||
return {1, ""};
|
||||
if (max_value > 1e-3)
|
||||
return {1e3, "m"};
|
||||
if (max_value > 1e-6)
|
||||
return {1e6, "u"};
|
||||
return {1e9, "n"};
|
||||
}
|
||||
|
||||
struct getter_data
|
||||
{
|
||||
uintptr_t data;
|
||||
int stride;
|
||||
float multiplier;
|
||||
};
|
||||
|
||||
ImPlotPoint getter(int index, void * data_)
|
||||
{
|
||||
getter_data & data = *(getter_data *)data_;
|
||||
|
||||
return ImPlotPoint(index, *(float *)(data.data + index * data.stride) * data.multiplier);
|
||||
}
|
||||
} // 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)
|
||||
{
|
||||
uint64_t rx = network_session->bytes_received();
|
||||
uint64_t tx = network_session->bytes_sent();
|
||||
|
||||
float dt = (predicted_display_time - last_metric_time) * 1e-9f;
|
||||
|
||||
// Sometimes the render function can be called with almost the same predicted_display_time,
|
||||
// which can cause issues with the bandwidth estimation.
|
||||
if (dt < 0.001f)
|
||||
return;
|
||||
|
||||
bandwidth_rx = 0.8 * bandwidth_rx + 0.2 * float(rx - bytes_received) / dt;
|
||||
bandwidth_tx = 0.8 * bandwidth_tx + 0.2 * float(tx - bytes_sent) / dt;
|
||||
|
||||
// Filter more aggressively for the compact view
|
||||
compact_bandwidth_rx = 0.99 * compact_bandwidth_rx + 0.01 * float(rx - bytes_received) / dt;
|
||||
compact_bandwidth_tx = 0.99 * compact_bandwidth_tx + 0.01 * float(tx - bytes_sent) / dt;
|
||||
compact_cpu_time = 0.99 * compact_cpu_time + 0.01 * application::get_cpu_time().count() * 1e-9f;
|
||||
compact_gpu_time = 0.99 * compact_gpu_time + 0.01 * timestamps.gpu_time;
|
||||
|
||||
last_metric_time = predicted_display_time;
|
||||
bytes_received = rx;
|
||||
bytes_sent = tx;
|
||||
|
||||
*(gpu_timestamps *)&global_metrics[metrics_offset] = timestamps;
|
||||
global_metrics[metrics_offset].cpu_time = application::get_cpu_time().count() * 1e-9f;
|
||||
global_metrics[metrics_offset].bandwidth_rx = bandwidth_rx * 8;
|
||||
global_metrics[metrics_offset].bandwidth_tx = bandwidth_tx * 8;
|
||||
|
||||
std::vector<shard_accumulator::blit_handle *> active_handles;
|
||||
active_handles.reserve(blit_handles.size());
|
||||
for (const auto & h: blit_handles)
|
||||
{
|
||||
if (h)
|
||||
active_handles.push_back(h.get());
|
||||
}
|
||||
|
||||
if (decoder_metrics.size() != active_handles.size())
|
||||
decoder_metrics.resize(active_handles.size());
|
||||
|
||||
auto min_encode_begin = std::numeric_limits<decltype(active_handles[0]->feedback.encode_begin)>::max();
|
||||
for (const auto & bh: active_handles)
|
||||
{
|
||||
if (bh)
|
||||
min_encode_begin = std::min(min_encode_begin, bh->feedback.encode_begin);
|
||||
}
|
||||
|
||||
for (auto && [metrics, bh]: std::views::zip(decoder_metrics, active_handles))
|
||||
{
|
||||
if (metrics.size() != global_metrics.size())
|
||||
metrics.resize(global_metrics.size());
|
||||
if (not bh)
|
||||
continue;
|
||||
|
||||
// clang-format off
|
||||
metrics[metrics_offset] = bh ? decoder_metric{
|
||||
.encode_begin = (bh->feedback.encode_begin - min_encode_begin) * 1e-9f,
|
||||
.encode_end = (bh->feedback.encode_end - min_encode_begin) * 1e-9f,
|
||||
.send_begin = (bh->feedback.send_begin - min_encode_begin) * 1e-9f,
|
||||
.send_end = (bh->feedback.send_end - min_encode_begin) * 1e-9f,
|
||||
.received_first_packet = (bh->feedback.received_first_packet - min_encode_begin) * 1e-9f,
|
||||
.received_last_packet = (bh->feedback.received_last_packet - min_encode_begin) * 1e-9f,
|
||||
.sent_to_decoder = (bh->feedback.sent_to_decoder - min_encode_begin) * 1e-9f,
|
||||
.received_from_decoder = (bh->feedback.received_from_decoder - min_encode_begin) * 1e-9f,
|
||||
.blitted = (bh->feedback.blitted - min_encode_begin) * 1e-9f,
|
||||
.displayed = (bh->feedback.displayed - min_encode_begin) * 1e-9f,
|
||||
.predicted_display = (bh->view_info.display_time - min_encode_begin) * 1e-9f,
|
||||
}: decoder_metric{};
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
metrics_offset = (metrics_offset + 1) % global_metrics.size();
|
||||
}
|
||||
|
||||
// TODO move in separate file, factorize with lobby_gui.cpp
|
||||
static bool RadioButtonWithoutCheckBox(const std::string & label, bool active, ImVec2 size_arg)
|
||||
{
|
||||
ImGuiWindow * window = ImGui::GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
|
||||
ImGuiContext & g = *GImGui;
|
||||
const ImGuiStyle & style = g.Style;
|
||||
const ImGuiID id = window->GetID(label.c_str());
|
||||
const ImVec2 label_size = ImGui::CalcTextSize(label.c_str(), NULL, true);
|
||||
|
||||
const ImVec2 pos = window->DC.CursorPos;
|
||||
|
||||
ImVec2 size = ImGui::CalcItemSize(size_arg, label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f);
|
||||
|
||||
const ImRect bb(pos, pos + size);
|
||||
ImGui::ItemSize(bb, style.FramePadding.y);
|
||||
if (!ImGui::ItemAdd(bb, id))
|
||||
return false;
|
||||
|
||||
bool hovered, held;
|
||||
bool pressed = ImGui::ButtonBehavior(bb, id, &hovered, &held);
|
||||
|
||||
ImGuiCol_ col;
|
||||
if ((held && hovered) || active)
|
||||
col = ImGuiCol_ButtonActive;
|
||||
else if (hovered)
|
||||
col = ImGuiCol_ButtonHovered;
|
||||
else
|
||||
col = ImGuiCol_Button;
|
||||
|
||||
ImGui::RenderNavHighlight(bb, id);
|
||||
ImGui::RenderFrame(bb.Min, bb.Max, ImGui::GetColorU32(col), true, style.FrameRounding);
|
||||
|
||||
ImVec2 TextAlign{0, 0.5f};
|
||||
ImGui::RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label.c_str(), NULL, &label_size, TextAlign, &bb);
|
||||
|
||||
IMGUI_TEST_ENGINE_ITEM_INFO(id, label.c_str(), g.LastItemData.StatusFlags);
|
||||
return pressed;
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
static bool RadioButtonWithoutCheckBox(const std::string & label, T & v, U v_button, ImVec2 size_arg)
|
||||
{
|
||||
const bool pressed = RadioButtonWithoutCheckBox(label, v == v_button, size_arg);
|
||||
if (pressed)
|
||||
v = v_button;
|
||||
return pressed;
|
||||
}
|
||||
|
||||
void scenes::stream::gui_performance_metrics()
|
||||
{
|
||||
const ImGuiStyle & style = ImGui::GetStyle();
|
||||
|
||||
ImVec2 window_size = ImGui::GetWindowSize() - ImVec2(2, 2) * style.WindowPadding;
|
||||
|
||||
static 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(_("Network"), {{_("Download"), &global_metric::bandwidth_rx},
|
||||
{_("Upload"), &global_metric::bandwidth_tx}}, "bit/s"),
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
int n_plots = plots.size() + decoder_metrics.size();
|
||||
axis_scale.resize(n_plots);
|
||||
|
||||
int n_cols = 2;
|
||||
int n_rows = ceil((float)n_plots / n_cols);
|
||||
|
||||
ImVec2 plot_size = ImVec2(
|
||||
window_size.x / n_cols - style.ItemSpacing.x * (n_cols - 1) / n_cols,
|
||||
(window_size.y - 2 * ImGui::GetCurrentContext()->FontSize - 2 * style.ItemSpacing.y) / n_rows - style.ItemSpacing.y * (n_rows - 1) / n_rows);
|
||||
|
||||
ImPlot::PushStyleColor(ImPlotCol_PlotBg, IM_COL32(32, 32, 32, 64));
|
||||
ImPlot::PushStyleColor(ImPlotCol_FrameBg, IM_COL32(0, 0, 0, 0));
|
||||
ImPlot::PushStyleColor(ImPlotCol_AxisBg, IM_COL32(0, 0, 0, 0));
|
||||
ImPlot::PushStyleColor(ImPlotCol_AxisBgActive, IM_COL32(0, 0, 0, 0));
|
||||
ImPlot::PushStyleColor(ImPlotCol_AxisBgHovered, IM_COL32(0, 0, 0, 0));
|
||||
|
||||
int n = 0;
|
||||
for (const auto & [title, subplots, unit]: plots)
|
||||
{
|
||||
if (ImPlot::BeginPlot(title.c_str(), plot_size, ImPlotFlags_NoTitle | ImPlotFlags_NoMenus | ImPlotFlags_NoBoxSelect | ImPlotFlags_NoMouseText))
|
||||
{
|
||||
float min_v = 0;
|
||||
float max_v = 0;
|
||||
for (const auto & [subtitle, data]: subplots)
|
||||
{
|
||||
max_v = std::max(max_v, compute_plot_max_value(&(global_metrics.data()->*data), global_metrics.size(), sizeof(global_metric)));
|
||||
}
|
||||
auto [multiplier, prefix] = compute_plot_unit(max_v);
|
||||
|
||||
if (axis_scale[n] == 0 || std::isnan(axis_scale[n]))
|
||||
axis_scale[n] = max_v;
|
||||
else
|
||||
axis_scale[n] = 0.99 * axis_scale[n] + 0.01 * max_v;
|
||||
|
||||
auto color = ImPlot::GetColormapColor(n);
|
||||
|
||||
std::string title_with_units = std::string(title) + " [" + prefix + unit + "]";
|
||||
ImPlot::SetupAxes(nullptr, title_with_units.c_str(), ImPlotAxisFlags_NoDecorations, 0);
|
||||
ImPlot::SetupAxesLimits(0, global_metrics.size() - 1, min_v * multiplier, axis_scale[n] * multiplier, ImGuiCond_Always);
|
||||
ImPlot::SetNextLineStyle(color);
|
||||
ImPlot::SetNextFillStyle(color, 0.25);
|
||||
|
||||
for (const auto & [subtitle, data]: subplots)
|
||||
{
|
||||
getter_data gdata{
|
||||
.data = (uintptr_t) & (global_metrics.data()->*data),
|
||||
.stride = sizeof(global_metric),
|
||||
.multiplier = multiplier,
|
||||
};
|
||||
ImPlot::PlotLineG(subtitle.c_str(), getter, &gdata, global_metrics.size(), ImPlotLineFlags_Shaded);
|
||||
|
||||
double x[] = {double(metrics_offset), double(metrics_offset)};
|
||||
double y[] = {0, axis_scale[n] * multiplier};
|
||||
ImPlot::SetNextLineStyle(ImVec4(1, 1, 1, 1));
|
||||
ImPlot::PlotLine("", x, y, 2);
|
||||
}
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
|
||||
if (++n % n_cols != 0)
|
||||
ImGui::SameLine();
|
||||
}
|
||||
|
||||
for (auto && [index, metrics]: utils::enumerate(decoder_metrics))
|
||||
{
|
||||
std::string title = fmt::format(_F("Decoder {}"), std::to_string(index));
|
||||
if (ImPlot::BeginPlot(title.c_str(), plot_size, ImPlotFlags_NoTitle | ImPlotFlags_NoMenus | ImPlotFlags_NoBoxSelect | ImPlotFlags_NoMouseText))
|
||||
{
|
||||
float min_v = 0;
|
||||
float max_v = compute_plot_max_value(&(metrics.data()->displayed), metrics.size(), sizeof(decoder_metric));
|
||||
// auto [ multiplier, prefix ] = compute_plot_unit(max_v);
|
||||
|
||||
if (axis_scale[n] == 0)
|
||||
axis_scale[n] = max_v;
|
||||
else
|
||||
axis_scale[n] = 0.99 * axis_scale[n] + 0.01 * max_v;
|
||||
|
||||
std::string title_with_units = _("Timings [ms]");
|
||||
ImPlot::SetupAxes(nullptr, title_with_units.c_str(), ImPlotAxisFlags_NoDecorations, 0);
|
||||
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),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_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),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_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),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_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),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_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),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_displayed{
|
||||
.data = (uintptr_t) & (metrics.data()->displayed),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_predicted{
|
||||
.data = (uintptr_t) & (metrics.data()->predicted_display),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
// clang-format off
|
||||
ImPlot::PlotShadedG(_S("Encode"), getter, &getter_encode_begin, getter, &getter_encode_end, metrics.size());
|
||||
ImPlot::PlotShadedG(_S("Send"), getter, &getter_send_begin, getter, &getter_send_end, metrics.size());
|
||||
ImPlot::PlotShadedG(_S("Receive"), getter, &getter_received_first_packet, getter, &getter_received_last_packet, metrics.size());
|
||||
ImPlot::PlotShadedG(_S("Decode"), getter, &getter_sent_to_decoder, getter, &getter_received_from_decoder, metrics.size());
|
||||
ImPlot::PlotLineG(_S("Blitted"), getter, &getter_blitted, metrics.size());
|
||||
ImPlot::PlotLineG(_S("Displayed"), getter, &getter_displayed, metrics.size());
|
||||
ImPlot::PlotLineG(_S("Predicted"), getter, &getter_predicted, metrics.size());
|
||||
// clang-format on
|
||||
|
||||
double x[] = {double(metrics_offset), double(metrics_offset)};
|
||||
double y[] = {0, 1e9};
|
||||
ImPlot::SetNextLineStyle(ImVec4(1, 1, 1, 1));
|
||||
ImPlot::PlotLine("", x, y, 2);
|
||||
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
|
||||
if (++n % n_cols != 0)
|
||||
ImGui::SameLine();
|
||||
}
|
||||
|
||||
ImPlot::PopStyleColor(5);
|
||||
{
|
||||
std::lock_guard lock(tracking_control_mutex);
|
||||
ImGui::Text("%s", fmt::format(_F("Estimated motion to photons latency: {}ms"), std::chrono::duration_cast<std::chrono::milliseconds>(tracking_control.max_offset).count()).c_str());
|
||||
|
||||
if (is_gui_interactable())
|
||||
ImGui::Text("%s", _S("Press the grip button to move the window"));
|
||||
else
|
||||
ImGui::Text("%s", _S("Press both thumbsticks to display the WiVRn window"));
|
||||
}
|
||||
}
|
||||
|
||||
void scenes::stream::gui_compact_view()
|
||||
{
|
||||
const auto & metrics = global_metrics[(metrics_offset + global_metrics.size() - 1) % global_metrics.size()];
|
||||
|
||||
if (ImGui::BeginTable("metrics", 2))
|
||||
{
|
||||
auto f = [&](const char * label, float value, const char * unit) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%s", label);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%.1f %s", value, unit);
|
||||
};
|
||||
|
||||
f(_S("Download"), 8 * compact_bandwidth_rx * 1e-6, "Mbit/s");
|
||||
f(_S("Upload"), 8 * compact_bandwidth_tx * 1e-6, "Mbit/s");
|
||||
f(_S("CPU time"), compact_cpu_time * 1000, "ms");
|
||||
f(_S("GPU time"), compact_gpu_time * 1000, "ms");
|
||||
f(_S("Motion to photon latency"), std::chrono::duration_cast<std::chrono::microseconds>(tracking_control.max_offset).count() * 1e-3f, "ms");
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
|
||||
std::string openxr_post_processing_flag_name(XrCompositionLayerSettingsFlagsFB flag); // TODO declaration in a .h file
|
||||
void scenes::stream::gui_settings()
|
||||
{
|
||||
auto & config = application::get_config();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(20, 20));
|
||||
|
||||
if (application::get_openxr_post_processing_supported())
|
||||
{
|
||||
ImGui::Text("%s", _S("OpenXR post-processing"));
|
||||
ImGui::Indent();
|
||||
{
|
||||
XrCompositionLayerSettingsFlagsFB current = config.openxr_post_processing.super_sampling;
|
||||
if (ImGui::BeginCombo(_S("Supersampling"), openxr_post_processing_flag_name(current).c_str()))
|
||||
{
|
||||
const XrCompositionLayerSettingsFlagsFB selectable_options[]{
|
||||
0,
|
||||
XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SUPER_SAMPLING_BIT_FB,
|
||||
XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SUPER_SAMPLING_BIT_FB};
|
||||
for (XrCompositionLayerSettingsFlagsFB option: selectable_options)
|
||||
{
|
||||
if (ImGui::Selectable(openxr_post_processing_flag_name(option).c_str(), current == option, ImGuiSelectableFlags_SelectOnRelease))
|
||||
{
|
||||
spdlog::info("Setting OpenXR super sampling to {}", openxr_post_processing_flag_name(option));
|
||||
config.openxr_post_processing.super_sampling = option;
|
||||
config.save();
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
imgui_ctx->tooltip(_("Reduce flicker for high contrast edges.\nUseful when the input resolution is high compared to the headset display"));
|
||||
}
|
||||
}
|
||||
{
|
||||
XrCompositionLayerSettingsFlagsFB current = config.openxr_post_processing.sharpening;
|
||||
if (ImGui::BeginCombo(_S("Sharpening"), openxr_post_processing_flag_name(current).c_str()))
|
||||
{
|
||||
const XrCompositionLayerSettingsFlagsFB selectable_options[]{
|
||||
0,
|
||||
XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SHARPENING_BIT_FB,
|
||||
XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SHARPENING_BIT_FB};
|
||||
for (XrCompositionLayerSettingsFlagsFB option: selectable_options)
|
||||
{
|
||||
if (ImGui::Selectable(openxr_post_processing_flag_name(option).c_str(), current == option, ImGuiSelectableFlags_SelectOnRelease))
|
||||
{
|
||||
spdlog::info("Setting OpenXR sharpening to {}", openxr_post_processing_flag_name(option));
|
||||
config.openxr_post_processing.sharpening = option;
|
||||
config.save();
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
imgui_ctx->tooltip(_("Improve clarity of high contrast edges and counteract blur.\nUseful when the input resolution is low compared to the headset display"));
|
||||
}
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
bool send_packet = false;
|
||||
bool save_config = false;
|
||||
ImGui::Text("%s", _S("Foveation center override"));
|
||||
ImGui::Indent();
|
||||
{
|
||||
if (ImGui::Checkbox(_S("Enable"), &override_foveation_enable))
|
||||
{
|
||||
send_packet = true;
|
||||
save_config = true;
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
|
||||
ImGui::BeginDisabled(!override_foveation_enable);
|
||||
ImGui::Text("%s", fmt::format(_F("Height {:.1f} deg"), -override_foveation_pitch * 180 / M_PI).c_str());
|
||||
ImGui::Text("%s", fmt::format(_F("Distance {:.2f} m"), override_foveation_distance).c_str());
|
||||
if (ImGui::Button(_S("Default")))
|
||||
{
|
||||
override_foveation_distance = configuration{}.override_foveation_distance;
|
||||
override_foveation_pitch = configuration{}.override_foveation_pitch;
|
||||
send_packet = true;
|
||||
save_config = true;
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button(_S("Change")))
|
||||
gui_status = gui_status::foveation_settings;
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
if (send_packet)
|
||||
{
|
||||
network_session->send_control(from_headset::override_foveation_center{
|
||||
.enabled = override_foveation_enable,
|
||||
.pitch = override_foveation_pitch,
|
||||
.distance = override_foveation_distance,
|
||||
});
|
||||
}
|
||||
|
||||
if (save_config)
|
||||
{
|
||||
auto & config = application::get_config();
|
||||
config.override_foveation_enable = override_foveation_enable;
|
||||
config.override_foveation_pitch = override_foveation_pitch;
|
||||
config.override_foveation_distance = override_foveation_distance;
|
||||
config.save();
|
||||
}
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
void scenes::stream::gui_foveation_settings(float predicted_display_period)
|
||||
{
|
||||
ImGui::PushFont(nullptr, constants::gui::font_size_large);
|
||||
ImGui::Text("%s", _S("Use the thumbsticks to move the foveation center"));
|
||||
ImGui::Text("%s", _S("Press A to save or B to cancel"));
|
||||
ImGui::Text("%s", fmt::format(_F("Height {:.1f} deg"), -override_foveation_pitch * 180 / M_PI).c_str());
|
||||
ImGui::Text("%s", fmt::format(_F("Distance {:.2f} m"), override_foveation_distance).c_str());
|
||||
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;
|
||||
|
||||
// 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);
|
||||
|
||||
override_foveation_pitch = std::clamp<float>(override_foveation_pitch + delta_pitch, -M_PI / 3, M_PI / 3);
|
||||
override_foveation_distance = std::clamp<float>(override_foveation_distance * delta_distance, 0.5, 100);
|
||||
|
||||
bool ok = application::read_action_bool(foveation_ok).value_or(std::pair{0, false}).second;
|
||||
bool cancel = application::read_action_bool(foveation_cancel).value_or(std::pair{0, false}).second;
|
||||
|
||||
if (ok)
|
||||
{
|
||||
gui_status = gui_status::settings;
|
||||
|
||||
// Save settings
|
||||
auto & config = application::get_config();
|
||||
config.override_foveation_enable = true;
|
||||
config.override_foveation_pitch = override_foveation_pitch;
|
||||
config.override_foveation_distance = override_foveation_distance;
|
||||
config.save();
|
||||
}
|
||||
else if (cancel)
|
||||
{
|
||||
gui_status = gui_status::settings;
|
||||
|
||||
// Restore settings
|
||||
const auto & config = application::get_config();
|
||||
override_foveation_enable = config.override_foveation_enable;
|
||||
override_foveation_pitch = config.override_foveation_pitch;
|
||||
override_foveation_distance = config.override_foveation_distance;
|
||||
}
|
||||
|
||||
network_session->send_control(from_headset::override_foveation_center{
|
||||
.enabled = override_foveation_enable,
|
||||
.pitch = override_foveation_pitch,
|
||||
.distance = override_foveation_distance,
|
||||
});
|
||||
}
|
||||
|
||||
// Return the vector v such that dot(v, x) > 0 iff x is on the side where the composition layer is visible
|
||||
static glm::vec4 compute_ray_limits(const XrPosef & pose, float margin = 0)
|
||||
{
|
||||
glm::quat q{
|
||||
pose.orientation.w,
|
||||
pose.orientation.x,
|
||||
pose.orientation.y,
|
||||
pose.orientation.z,
|
||||
};
|
||||
|
||||
glm::vec3 p{
|
||||
pose.position.x,
|
||||
pose.position.y,
|
||||
pose.position.z,
|
||||
};
|
||||
|
||||
glm::vec3 normal = glm::column(glm::mat3_cast(q), 2);
|
||||
|
||||
return glm::vec4(normal, -glm::dot(p, normal) - margin);
|
||||
}
|
||||
|
||||
void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicted_display_period)
|
||||
{
|
||||
bool interactable = true;
|
||||
XrSpace world_space = application::space(xr::spaces::world);
|
||||
auto views = session.locate_views(viewconfig, predicted_display_time, world_space).second;
|
||||
|
||||
switch (gui_status)
|
||||
{
|
||||
case gui_status::hidden:
|
||||
case gui_status::foveation_settings:
|
||||
case gui_status::overlay_only:
|
||||
case gui_status::compact:
|
||||
interactable = false;
|
||||
break;
|
||||
case gui_status::stats:
|
||||
case gui_status::settings:
|
||||
break;
|
||||
}
|
||||
imgui_ctx->set_controllers_enabled(interactable);
|
||||
|
||||
if (gui_status != last_gui_status)
|
||||
{
|
||||
last_gui_status = gui_status;
|
||||
gui_status_last_change = predicted_display_time;
|
||||
|
||||
// Override session state if the GUI is interactable
|
||||
if (not is_gui_interactable())
|
||||
network_session->send_control(from_headset::session_state_changed{
|
||||
.state = application::get_session_state(),
|
||||
});
|
||||
else if (application::get_session_state() == XR_SESSION_STATE_FOCUSED)
|
||||
network_session->send_control(from_headset::session_state_changed{
|
||||
.state = XR_SESSION_STATE_VISIBLE,
|
||||
});
|
||||
}
|
||||
|
||||
float alpha = 1;
|
||||
if (gui_status == gui_status::hidden)
|
||||
{
|
||||
float t = (predicted_display_time - gui_status_last_change) * 1.e-9f;
|
||||
|
||||
alpha = std::clamp<float>(1 - (t - constants::stream::fade_delay) / constants::stream::fade_duration, 0, 1);
|
||||
|
||||
if (alpha == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
// Lock the GUI position to the head, do it before displaying the GUI to avoid being off by one frame when gui_status changes
|
||||
std::optional<std::pair<glm::vec3, glm::quat>> head_position = application::locate_controller(application::space(xr::spaces::view), world_space, predicted_display_time);
|
||||
if (head_position)
|
||||
{
|
||||
glm::mat3 M = glm::mat3_cast(head_position->second);
|
||||
switch (gui_status)
|
||||
{
|
||||
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};
|
||||
break;
|
||||
|
||||
case gui_status::hidden:
|
||||
// Always use the same position for the GUI shortcut tip
|
||||
imgui_ctx->layers()[0].orientation = head_position->second;
|
||||
imgui_ctx->layers()[0].position = head_position->first + M * glm::vec3{0.0, -0.4, -1.0};
|
||||
break;
|
||||
|
||||
case gui_status::overlay_only:
|
||||
case gui_status::compact:
|
||||
case gui_status::stats:
|
||||
case gui_status::settings:
|
||||
imgui_ctx->layers()[0].orientation = head_position->second * head_gui_orientation;
|
||||
imgui_ctx->layers()[0].position = head_position->first + M * head_gui_position;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const float tab_width = 300;
|
||||
const ImVec2 margin_around_window{50, 50};
|
||||
|
||||
const ImGuiStyle & style = ImGui::GetStyle();
|
||||
imgui_ctx->new_frame(predicted_display_time);
|
||||
|
||||
ImVec2 content_size{ImGui::GetMainViewport()->Size - ImVec2{tab_width, 0} - margin_around_window * 2};
|
||||
ImVec2 content_center = margin_around_window + content_size / 2 + ImVec2{tab_width, 0};
|
||||
|
||||
bool display_tabs, always_auto_resize;
|
||||
switch (gui_status)
|
||||
{
|
||||
case gui_status::overlay_only:
|
||||
ImGui::SetNextWindowPos(content_center, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
ImGui::SetNextWindowSize(content_size);
|
||||
always_auto_resize = false;
|
||||
display_tabs = false;
|
||||
break;
|
||||
|
||||
case gui_status::hidden:
|
||||
case gui_status::foveation_settings:
|
||||
ImGui::SetNextWindowPos(ImGui::GetMainViewport()->Size / 2, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
always_auto_resize = true;
|
||||
display_tabs = false;
|
||||
break;
|
||||
|
||||
case gui_status::compact:
|
||||
ImGui::SetNextWindowPos(content_center, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
always_auto_resize = true;
|
||||
display_tabs = false;
|
||||
break;
|
||||
|
||||
case gui_status::stats:
|
||||
case gui_status::settings:
|
||||
ImGui::SetNextWindowPos(margin_around_window);
|
||||
ImGui::SetNextWindowSize(ImGui::GetMainViewport()->Size - margin_around_window * 2);
|
||||
always_auto_resize = false;
|
||||
display_tabs = true;
|
||||
break;
|
||||
}
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 0);
|
||||
if (always_auto_resize)
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, {8, 8});
|
||||
ImGui::Begin("Compact view", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize);
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, {0, 0});
|
||||
ImGui::Begin("Stream settings", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove);
|
||||
}
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, {8, 8});
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 10);
|
||||
|
||||
switch (gui_status)
|
||||
{
|
||||
case gui_status::hidden:
|
||||
ImGui::Text("%s", _S("Press both thumbsticks to display the WiVRn window"));
|
||||
break;
|
||||
|
||||
case gui_status::overlay_only:
|
||||
ImGui::SetCursorPos({20, 20});
|
||||
ImGui::BeginChild("Main", ImVec2(ImGui::GetWindowSize().x - ImGui::GetCursorPosX(), 0));
|
||||
gui_performance_metrics();
|
||||
ImGui::EndChild();
|
||||
break;
|
||||
|
||||
case gui_status::compact:
|
||||
gui_compact_view();
|
||||
break;
|
||||
|
||||
case gui_status::stats:
|
||||
ImGui::SetCursorPos({tab_width + 20, 20});
|
||||
ImGui::BeginChild("Main", ImVec2(ImGui::GetWindowSize().x - ImGui::GetCursorPosX(), 0));
|
||||
gui_performance_metrics();
|
||||
ImGui::EndChild();
|
||||
break;
|
||||
|
||||
case gui_status::settings:
|
||||
ImGui::SetCursorPos({tab_width + 20, 20});
|
||||
ImGui::BeginChild("Main", ImVec2(ImGui::GetWindowSize().x - ImGui::GetCursorPosX(), 0));
|
||||
gui_settings();
|
||||
ImGui::EndChild();
|
||||
break;
|
||||
|
||||
case gui_status::foveation_settings:
|
||||
gui_foveation_settings(predicted_display_period * 1.e-9f);
|
||||
break;
|
||||
}
|
||||
|
||||
ImGui::PopStyleVar(2); // ImGuiStyleVar_WindowPadding, ImGuiStyleVar_FrameRounding
|
||||
|
||||
if (display_tabs)
|
||||
{
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, IM_COL32(0, 0, 0, 255));
|
||||
ImGui::SetCursorPos(style.WindowPadding);
|
||||
{
|
||||
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});
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
|
||||
RadioButtonWithoutCheckBox(ICON_FA_GEARS " " + _("Settings"), gui_status, gui_status::settings, {tab_width, 0});
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
|
||||
int n_items_at_end = 4;
|
||||
ImGui::SetCursorPosY(ImGui::GetContentRegionMax().y - n_items_at_end * ImGui::GetCurrentContext()->FontSize - (n_items_at_end * 2) * style.FramePadding.y - (n_items_at_end - 1) * style.ItemSpacing.y - style.WindowPadding.y);
|
||||
|
||||
RadioButtonWithoutCheckBox(ICON_FA_CHART_LINE " " + _("Statistics overlay"), gui_status, gui_status::overlay_only, {tab_width, 0});
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
|
||||
RadioButtonWithoutCheckBox(ICON_FA_MINIMIZE " " + _("Compact view"), gui_status, gui_status::compact, {tab_width, 0});
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
|
||||
RadioButtonWithoutCheckBox(ICON_FA_XMARK " " + _("Close"), gui_status, gui_status::hidden, {tab_width, 0});
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
|
||||
bool dummy = false;
|
||||
if (RadioButtonWithoutCheckBox(ICON_FA_DOOR_OPEN " " + _("Disconnect"), dummy, true, {tab_width, 0}))
|
||||
exit();
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
|
||||
ImGui::PopStyleVar(); // ImGuiStyleVar_FramePadding
|
||||
ImGui::EndChild();
|
||||
}
|
||||
ImGui::PopStyleColor(); // ImGuiCol_ChildBg
|
||||
}
|
||||
ImGui::End();
|
||||
ImGui::PopStyleVar(2); // ImGuiStyleVar_ChildBorderSize, ImGuiStyleVar_WindowPadding
|
||||
|
||||
auto layers = imgui_ctx->end_frame();
|
||||
|
||||
// Display controllers and handle recentering
|
||||
if (interactable)
|
||||
{
|
||||
if (recentering_context)
|
||||
{
|
||||
xr::spaces controller = std::get<0>(*recentering_context);
|
||||
bool state;
|
||||
switch (controller)
|
||||
{
|
||||
case xr::spaces::aim_left:
|
||||
state = application::read_action_bool(recenter_left).value_or(std::pair{0, false}).second;
|
||||
break;
|
||||
case xr::spaces::aim_right:
|
||||
state = application::read_action_bool(recenter_right).value_or(std::pair{0, false}).second;
|
||||
break;
|
||||
default:
|
||||
state = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (state)
|
||||
update_gui_position(controller);
|
||||
else
|
||||
recentering_context.reset();
|
||||
}
|
||||
else if (auto state = application::read_action_bool(recenter_left); state and state->second)
|
||||
update_gui_position(xr::spaces::aim_left);
|
||||
else if (auto state = application::read_action_bool(recenter_right); state and state->second)
|
||||
update_gui_position(xr::spaces::aim_right);
|
||||
else
|
||||
recentering_context.reset();
|
||||
|
||||
std::vector<glm::vec4> ray_limits;
|
||||
|
||||
for (auto [_, layer]: layers)
|
||||
ray_limits.push_back(compute_ray_limits(layer.pose));
|
||||
|
||||
bool hide_left_controller = false;
|
||||
bool hide_right_controller = false;
|
||||
|
||||
if (application::get_hand_tracking_supported())
|
||||
{
|
||||
auto left = application::get_left_hand().locate(world_space, predicted_display_time);
|
||||
auto right = application::get_right_hand().locate(world_space, predicted_display_time);
|
||||
|
||||
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 (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;
|
||||
}
|
||||
|
||||
input->apply(world, world_space, predicted_display_time, hide_left_controller, hide_right_controller, ray_limits);
|
||||
|
||||
// Add the layer with the controllers
|
||||
if (composition_layer_depth_test_supported)
|
||||
{
|
||||
render_world(XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT,
|
||||
world_space,
|
||||
views,
|
||||
width,
|
||||
height,
|
||||
true,
|
||||
layer_controllers,
|
||||
{});
|
||||
set_depth_test(true, XR_COMPARE_OP_ALWAYS_FB);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the layer with the GUI
|
||||
for (auto [_, layer]: layers)
|
||||
{
|
||||
add_quad_layer(layer.layerFlags, layer.space, layer.eyeVisibility, layer.subImage, layer.pose, layer.size);
|
||||
if (composition_layer_depth_test_supported)
|
||||
set_depth_test(true, XR_COMPARE_OP_LESS_FB);
|
||||
if (alpha < 1 and composition_layer_color_scale_bias_supported)
|
||||
set_color_scale_bias({alpha, alpha, alpha, alpha}, {});
|
||||
}
|
||||
|
||||
// Display the controller rays
|
||||
if (interactable)
|
||||
{
|
||||
render_world(XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT,
|
||||
world_space,
|
||||
views,
|
||||
width,
|
||||
height,
|
||||
composition_layer_depth_test_supported,
|
||||
composition_layer_depth_test_supported ? layer_rays : layer_controllers | layer_rays,
|
||||
{});
|
||||
if (composition_layer_depth_test_supported)
|
||||
set_depth_test(true, XR_COMPARE_OP_LESS_FB);
|
||||
}
|
||||
}
|
||||
@@ -19,9 +19,15 @@
|
||||
|
||||
#include "stream.h"
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "application.h"
|
||||
#endif
|
||||
|
||||
#include "utils/named_thread.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <uni_algo/case.h>
|
||||
|
||||
void scenes::stream::process_packets()
|
||||
{
|
||||
@@ -99,3 +105,19 @@ void scenes::stream::send_feedback(const wivrn::from_headset::feedback & feedbac
|
||||
spdlog::warn("Exception while sending feedback packet: {}", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
void scenes::stream::operator()(to_headset::application_list && apps)
|
||||
{
|
||||
std::ranges::sort(apps.applications, [](auto & l, auto & r) {
|
||||
return una::casesens::collate_utf8(l.name, r.name) < 0;
|
||||
});
|
||||
auto locked = applications.lock();
|
||||
*locked = std::move(apps);
|
||||
}
|
||||
|
||||
void scenes::stream::start_application(std::string appid)
|
||||
{
|
||||
network_session->send_control(wivrn::from_headset::start_app{
|
||||
.app_id = std::move(appid),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,339 +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/>.
|
||||
*/
|
||||
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
|
||||
#include "stream.h"
|
||||
|
||||
#include "application.h"
|
||||
#include "imgui_internal.h"
|
||||
#include "implot.h"
|
||||
#include "utils/i18n.h"
|
||||
#include "utils/ranges.h"
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
#include <ranges>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
float compute_plot_max_value(float * data, int count, ptrdiff_t stride)
|
||||
{
|
||||
float max = 0;
|
||||
uintptr_t ptr = (uintptr_t)data;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
max = std::max(max, *(float *)(ptr + i * stride));
|
||||
}
|
||||
|
||||
// First power of 10 less than the max
|
||||
float x = pow(10, floor(log10(max)));
|
||||
return ceil(max / x) * x;
|
||||
}
|
||||
|
||||
std::pair<float, std::string> compute_plot_unit(float max_value)
|
||||
{
|
||||
if (max_value > 1e9)
|
||||
return {1e-9, "G"};
|
||||
if (max_value > 1e6)
|
||||
return {1e-6, "M"};
|
||||
if (max_value > 1e3)
|
||||
return {1e-3, "k"};
|
||||
if (max_value > 1)
|
||||
return {1, ""};
|
||||
if (max_value > 1e-3)
|
||||
return {1e3, "m"};
|
||||
if (max_value > 1e-6)
|
||||
return {1e6, "u"};
|
||||
return {1e9, "n"};
|
||||
}
|
||||
|
||||
struct getter_data
|
||||
{
|
||||
uintptr_t data;
|
||||
int stride;
|
||||
float multiplier;
|
||||
};
|
||||
|
||||
ImPlotPoint getter(int index, void * data_)
|
||||
{
|
||||
getter_data & data = *(getter_data *)data_;
|
||||
|
||||
return ImPlotPoint(index, *(float *)(data.data + index * data.stride) * data.multiplier);
|
||||
}
|
||||
} // 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)
|
||||
{
|
||||
uint64_t rx = network_session->bytes_received();
|
||||
uint64_t tx = network_session->bytes_sent();
|
||||
|
||||
float dt = (predicted_display_time - last_metric_time) * 1e-9f;
|
||||
|
||||
bandwidth_rx = 0.8 * bandwidth_rx + 0.2 * float(rx - bytes_received) / dt;
|
||||
bandwidth_tx = 0.8 * bandwidth_tx + 0.2 * float(tx - bytes_sent) / dt;
|
||||
|
||||
last_metric_time = predicted_display_time;
|
||||
bytes_received = rx;
|
||||
bytes_sent = tx;
|
||||
|
||||
*(gpu_timestamps *)&global_metrics[metrics_offset] = timestamps;
|
||||
global_metrics[metrics_offset].cpu_time = application::get_cpu_time().count() * 1e-9f;
|
||||
global_metrics[metrics_offset].bandwidth_rx = bandwidth_rx * 8;
|
||||
global_metrics[metrics_offset].bandwidth_tx = bandwidth_tx * 8;
|
||||
|
||||
std::vector<shard_accumulator::blit_handle *> active_handles;
|
||||
active_handles.reserve(blit_handles.size());
|
||||
for (const auto & h: blit_handles)
|
||||
{
|
||||
if (h)
|
||||
active_handles.push_back(h.get());
|
||||
}
|
||||
|
||||
if (decoder_metrics.size() != active_handles.size())
|
||||
decoder_metrics.resize(active_handles.size());
|
||||
|
||||
auto min_encode_begin = std::numeric_limits<decltype(active_handles[0]->feedback.encode_begin)>::max();
|
||||
for (const auto & bh: active_handles)
|
||||
{
|
||||
if (bh)
|
||||
min_encode_begin = std::min(min_encode_begin, bh->feedback.encode_begin);
|
||||
}
|
||||
|
||||
for (auto && [metrics, bh]: std::views::zip(decoder_metrics, active_handles))
|
||||
{
|
||||
if (metrics.size() != global_metrics.size())
|
||||
metrics.resize(global_metrics.size());
|
||||
if (not bh)
|
||||
continue;
|
||||
|
||||
// clang-format off
|
||||
metrics[metrics_offset] = bh ? decoder_metric{
|
||||
.encode_begin = (bh->feedback.encode_begin - min_encode_begin) * 1e-9f,
|
||||
.encode_end = (bh->feedback.encode_end - min_encode_begin) * 1e-9f,
|
||||
.send_begin = (bh->feedback.send_begin - min_encode_begin) * 1e-9f,
|
||||
.send_end = (bh->feedback.send_end - min_encode_begin) * 1e-9f,
|
||||
.received_first_packet = (bh->feedback.received_first_packet - min_encode_begin) * 1e-9f,
|
||||
.received_last_packet = (bh->feedback.received_last_packet - min_encode_begin) * 1e-9f,
|
||||
.sent_to_decoder = (bh->feedback.sent_to_decoder - min_encode_begin) * 1e-9f,
|
||||
.received_from_decoder = (bh->feedback.received_from_decoder - min_encode_begin) * 1e-9f,
|
||||
.blitted = (bh->feedback.blitted - min_encode_begin) * 1e-9f,
|
||||
.displayed = (bh->feedback.displayed - min_encode_begin) * 1e-9f,
|
||||
.predicted_display = (bh->view_info.display_time - min_encode_begin) * 1e-9f,
|
||||
}: decoder_metric{};
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
metrics_offset = (metrics_offset + 1) % global_metrics.size();
|
||||
}
|
||||
|
||||
std::vector<XrCompositionLayerQuad> scenes::stream::plot_performance_metrics(XrTime predicted_display_time)
|
||||
{
|
||||
imgui_ctx->new_frame(predicted_display_time);
|
||||
const ImGuiStyle & style = ImGui::GetStyle();
|
||||
|
||||
ImGui::SetNextWindowPos({0, 0});
|
||||
ImGui::SetNextWindowSize(ImGui::GetMainViewport()->Size);
|
||||
ImGui::Begin("Performance metrics", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove);
|
||||
|
||||
ImVec2 window_size = ImGui::GetWindowSize() - ImVec2(2, 2) * style.WindowPadding;
|
||||
|
||||
static 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(_("Network"), {{_("Download"), &global_metric::bandwidth_rx},
|
||||
{_("Upload"), &global_metric::bandwidth_tx}}, "bit/s"),
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
int n_plots = plots.size() + decoder_metrics.size();
|
||||
axis_scale.resize(n_plots);
|
||||
|
||||
int n_cols = 2;
|
||||
int n_rows = ceil((float)n_plots / n_cols);
|
||||
|
||||
ImVec2 plot_size = ImVec2(
|
||||
window_size.x / n_cols - style.ItemSpacing.x * (n_cols - 1) / n_cols,
|
||||
(window_size.y - ImGui::GetCurrentContext()->FontSize - style.ItemSpacing.y) / n_rows - style.ItemSpacing.y * (n_rows - 1) / n_rows);
|
||||
|
||||
ImPlot::PushStyleColor(ImPlotCol_PlotBg, IM_COL32(32, 32, 32, 64));
|
||||
ImPlot::PushStyleColor(ImPlotCol_FrameBg, IM_COL32(0, 0, 0, 0));
|
||||
ImPlot::PushStyleColor(ImPlotCol_AxisBg, IM_COL32(0, 0, 0, 0));
|
||||
ImPlot::PushStyleColor(ImPlotCol_AxisBgActive, IM_COL32(0, 0, 0, 0));
|
||||
ImPlot::PushStyleColor(ImPlotCol_AxisBgHovered, IM_COL32(0, 0, 0, 0));
|
||||
|
||||
int n = 0;
|
||||
for (const auto & [title, subplots, unit]: plots)
|
||||
{
|
||||
if (ImPlot::BeginPlot(title.c_str(), plot_size, ImPlotFlags_NoTitle | ImPlotFlags_NoMenus | ImPlotFlags_NoBoxSelect | ImPlotFlags_NoMouseText | ImPlotFlags_NoChild))
|
||||
{
|
||||
float min_v = 0;
|
||||
float max_v = 0;
|
||||
for (const auto & [subtitle, data]: subplots)
|
||||
{
|
||||
max_v = std::max(max_v, compute_plot_max_value(&(global_metrics.data()->*data), global_metrics.size(), sizeof(global_metric)));
|
||||
}
|
||||
auto [multiplier, prefix] = compute_plot_unit(max_v);
|
||||
|
||||
if (axis_scale[n] == 0 || std::isnan(axis_scale[n]))
|
||||
axis_scale[n] = max_v;
|
||||
else
|
||||
axis_scale[n] = 0.99 * axis_scale[n] + 0.01 * max_v;
|
||||
|
||||
auto color = ImPlot::GetColormapColor(n);
|
||||
|
||||
std::string title_with_units = std::string(title) + " [" + prefix + unit + "]";
|
||||
ImPlot::SetupAxes(nullptr, title_with_units.c_str(), ImPlotAxisFlags_NoDecorations, 0);
|
||||
ImPlot::SetupAxesLimits(0, global_metrics.size() - 1, min_v * multiplier, axis_scale[n] * multiplier, ImGuiCond_Always);
|
||||
ImPlot::SetNextLineStyle(color);
|
||||
ImPlot::SetNextFillStyle(color, 0.25);
|
||||
|
||||
for (const auto & [subtitle, data]: subplots)
|
||||
{
|
||||
getter_data gdata{
|
||||
.data = (uintptr_t) & (global_metrics.data()->*data),
|
||||
.stride = sizeof(global_metric),
|
||||
.multiplier = multiplier,
|
||||
};
|
||||
ImPlot::PlotLineG(subtitle.c_str(), getter, &gdata, global_metrics.size(), ImPlotLineFlags_Shaded);
|
||||
|
||||
double x[] = {double(metrics_offset), double(metrics_offset)};
|
||||
double y[] = {0, axis_scale[n] * multiplier};
|
||||
ImPlot::SetNextLineStyle(ImVec4(1, 1, 1, 1));
|
||||
ImPlot::PlotLine("", x, y, 2);
|
||||
}
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
|
||||
if (++n % n_cols != 0)
|
||||
ImGui::SameLine();
|
||||
}
|
||||
|
||||
for (auto && [index, metrics]: utils::enumerate(decoder_metrics))
|
||||
{
|
||||
std::string title = fmt::format(_F("Decoder {}"), std::to_string(index));
|
||||
if (ImPlot::BeginPlot(title.c_str(), plot_size, ImPlotFlags_NoTitle | ImPlotFlags_NoMenus | ImPlotFlags_NoBoxSelect | ImPlotFlags_NoMouseText | ImPlotFlags_NoChild))
|
||||
{
|
||||
float min_v = 0;
|
||||
float max_v = compute_plot_max_value(&(metrics.data()->displayed), metrics.size(), sizeof(decoder_metric));
|
||||
// auto [ multiplier, prefix ] = compute_plot_unit(max_v);
|
||||
|
||||
if (axis_scale[n] == 0)
|
||||
axis_scale[n] = max_v;
|
||||
else
|
||||
axis_scale[n] = 0.99 * axis_scale[n] + 0.01 * max_v;
|
||||
|
||||
std::string title_with_units = _("Timings [ms]");
|
||||
ImPlot::SetupAxes(nullptr, title_with_units.c_str(), ImPlotAxisFlags_NoDecorations, 0);
|
||||
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),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_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),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_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),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_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),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_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),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_displayed{
|
||||
.data = (uintptr_t) & (metrics.data()->displayed),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_predicted{
|
||||
.data = (uintptr_t) & (metrics.data()->predicted_display),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
// clang-format off
|
||||
ImPlot::PlotShadedG(_S("Encode"), getter, &getter_encode_begin, getter, &getter_encode_end, metrics.size());
|
||||
ImPlot::PlotShadedG(_S("Send"), getter, &getter_send_begin, getter, &getter_send_end, metrics.size());
|
||||
ImPlot::PlotShadedG(_S("Receive"), getter, &getter_received_first_packet, getter, &getter_received_last_packet, metrics.size());
|
||||
ImPlot::PlotShadedG(_S("Decode"), getter, &getter_sent_to_decoder, getter, &getter_received_from_decoder, metrics.size());
|
||||
ImPlot::PlotLineG(_S("Blitted"), getter, &getter_blitted, metrics.size());
|
||||
ImPlot::PlotLineG(_S("Displayed"), getter, &getter_displayed, metrics.size());
|
||||
ImPlot::PlotLineG(_S("Predicted"), getter, &getter_predicted, metrics.size());
|
||||
// clang-format on
|
||||
|
||||
double x[] = {double(metrics_offset), double(metrics_offset)};
|
||||
double y[] = {0, 1e9};
|
||||
ImPlot::SetNextLineStyle(ImVec4(1, 1, 1, 1));
|
||||
ImPlot::PlotLine("", x, y, 2);
|
||||
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
|
||||
if (++n % n_cols != 0)
|
||||
ImGui::SameLine();
|
||||
}
|
||||
|
||||
ImPlot::PopStyleColor(5);
|
||||
{
|
||||
std::lock_guard lock(tracking_control_mutex);
|
||||
ImGui::Text("%s", fmt::format(_F("Estimated motion to photons latency: {}ms"), std::chrono::duration_cast<std::chrono::milliseconds>(tracking_control.max_offset).count()).c_str());
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
std::vector<XrCompositionLayerQuad> layers;
|
||||
for (auto & layer: imgui_ctx->end_frame())
|
||||
layers.push_back(layer.second);
|
||||
|
||||
return layers;
|
||||
}
|
||||
@@ -315,7 +315,19 @@ void scenes::stream::tracking()
|
||||
}
|
||||
}
|
||||
|
||||
auto enabled = [](const to_headset::tracking_control & control, device_id id) -> bool {
|
||||
auto enabled = [&](const to_headset::tracking_control & control, device_id id) -> bool {
|
||||
if (is_gui_interactable())
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case device_id::HEAD:
|
||||
case device_id::EYE_GAZE:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case device_id::HEAD:
|
||||
@@ -328,10 +340,9 @@ void scenes::stream::tracking()
|
||||
case device_id::LEFT_PALM:
|
||||
return control.enabled[size_t(tid::left_palm)];
|
||||
case device_id::LEFT_PINCH_POSE:
|
||||
case device_id::LEFT_POKE: {
|
||||
const auto tracking_id = id == device_id::LEFT_PINCH_POSE ? tid::left_pinch : tid::left_poke;
|
||||
return control.enabled[size_t(tracking_id)];
|
||||
}
|
||||
return control.enabled[size_t(tid::left_pinch)];
|
||||
case device_id::LEFT_POKE:
|
||||
return control.enabled[size_t(tid::left_poke)];
|
||||
case device_id::RIGHT_AIM:
|
||||
return control.enabled[size_t(tid::right_aim)];
|
||||
case device_id::RIGHT_GRIP:
|
||||
@@ -339,10 +350,9 @@ void scenes::stream::tracking()
|
||||
case device_id::RIGHT_PALM:
|
||||
return control.enabled[size_t(tid::right_palm)];
|
||||
case device_id::RIGHT_PINCH_POSE:
|
||||
case device_id::RIGHT_POKE: {
|
||||
const auto tracking_id = id == device_id::RIGHT_PINCH_POSE ? tid::right_pinch : tid::right_poke;
|
||||
return control.enabled[size_t(tracking_id)];
|
||||
}
|
||||
return control.enabled[size_t(tid::right_pinch)];
|
||||
case device_id::RIGHT_POKE:
|
||||
return control.enabled[size_t(tid::right_poke)];
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@ out gl_PerVertex
|
||||
|
||||
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];
|
||||
|
||||
@@ -149,7 +150,7 @@ void main()
|
||||
|
||||
const float dither_pattern[4][4] = {
|
||||
{ 0.0f, 0.5f, 0.125f, 0.625f},
|
||||
{ 0.75f, 0.22f, 0.875f, 0.375f},
|
||||
{ 0.75f, 0.25f, 0.875f, 0.375f},
|
||||
{ 0.1875f, 0.6875f, 0.0625f, 0.5625},
|
||||
{ 0.9375f, 0.4375f, 0.8125f, 0.3125}
|
||||
};
|
||||
@@ -206,9 +207,6 @@ void main()
|
||||
|
||||
bc = mix(bc + ec, fog_color, fog);
|
||||
|
||||
// if (alpha_cutout && c.a <= 0.5)
|
||||
// discard;
|
||||
|
||||
if (dithering)
|
||||
{
|
||||
ivec2 tmp = ivec2(gl_FragCoord.xy) % 4;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "fb_face_tracker2.h"
|
||||
#include "wivrn_packets.h"
|
||||
#include "xr/instance.h"
|
||||
#include "xr/session.h"
|
||||
#include <cstdint>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
@@ -29,11 +30,25 @@ XrResult xr::destroy_fb_face_tracker2(XrFaceTracker2FB id)
|
||||
return xrDestroyFaceTracker2FB(id);
|
||||
}
|
||||
|
||||
xr::fb_face_tracker2::fb_face_tracker2(instance & inst, XrFaceTracker2FB h)
|
||||
xr::fb_face_tracker2::fb_face_tracker2(instance & inst, session & s)
|
||||
{
|
||||
id = h;
|
||||
auto xrCreateFaceTracker2FB = inst.get_proc<PFN_xrCreateFaceTracker2FB>("xrCreateFaceTracker2FB");
|
||||
xrGetFaceExpressionWeights2FB = inst.get_proc<PFN_xrGetFaceExpressionWeights2FB>("xrGetFaceExpressionWeights2FB");
|
||||
xrDestroyFaceTracker2FB = inst.get_proc<PFN_xrDestroyFaceTracker2FB>("xrDestroyFaceTracker2FB");
|
||||
assert(xrCreateFaceTracker2FB);
|
||||
|
||||
XrFaceTrackingDataSource2FB data_sources[1];
|
||||
data_sources[0] = XR_FACE_TRACKING_DATA_SOURCE2_VISUAL_FB;
|
||||
|
||||
XrFaceTrackerCreateInfo2FB create_info{
|
||||
.type = XR_TYPE_FACE_TRACKER_CREATE_INFO2_FB,
|
||||
.next = nullptr,
|
||||
.faceExpressionSet = XR_FACE_EXPRESSION_SET2_DEFAULT_FB,
|
||||
.requestedDataSourceCount = 1,
|
||||
.requestedDataSources = data_sources,
|
||||
};
|
||||
|
||||
CHECK_XR(xrCreateFaceTracker2FB(s, &create_info, &id));
|
||||
}
|
||||
|
||||
void xr::fb_face_tracker2::get_weights(XrTime time, wivrn::from_headset::tracking::fb_face2 & out_expressions)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
namespace xr
|
||||
{
|
||||
class instance;
|
||||
class session;
|
||||
|
||||
XrResult destroy_fb_face_tracker2(XrFaceTracker2FB);
|
||||
|
||||
@@ -36,7 +37,7 @@ class fb_face_tracker2 : public utils::handle<XrFaceTracker2FB, destroy_fb_face_
|
||||
public:
|
||||
using packet_type = wivrn::from_headset::tracking::fb_face2;
|
||||
fb_face_tracker2() = default;
|
||||
fb_face_tracker2(instance & inst, XrFaceTracker2FB h);
|
||||
fb_face_tracker2(instance & inst, session & s);
|
||||
|
||||
void get_weights(XrTime time, packet_type & out_expressions);
|
||||
};
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "xr.h"
|
||||
#include "xr/details/enumerate.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <spdlog/spdlog.h>
|
||||
@@ -114,6 +115,7 @@ xr::instance::instance(std::string_view application_name, std::vector<const char
|
||||
spdlog::info("Available OpenXR extensions:");
|
||||
bool debug_utils_found = false;
|
||||
auto all_extensions = xr::instance::extensions();
|
||||
std::ranges::sort(all_extensions, [](const char * a, const char * b) { return strcmp(a, b) < 0; }, &XrExtensionProperties::extensionName);
|
||||
for (XrExtensionProperties & i: all_extensions)
|
||||
{
|
||||
spdlog::info(" {} (version {})", i.extensionName, i.extensionVersion);
|
||||
|
||||
@@ -30,10 +30,19 @@ XrResult xr::destroy_pico_body_tracker(XrBodyTrackerBD id)
|
||||
return xrDestroyBodyTrackerBD(id);
|
||||
}
|
||||
|
||||
xr::pico_body_tracker::pico_body_tracker(instance & inst, XrBodyTrackerBD h)
|
||||
xr::pico_body_tracker::pico_body_tracker(instance & inst, session & s)
|
||||
{
|
||||
id = h;
|
||||
auto xrCreateBodyTrackerBD = inst.get_proc<PFN_xrCreateBodyTrackerBD>("xrCreateBodyTrackerBD");
|
||||
xrLocateBodyJointsBD = inst.get_proc<PFN_xrLocateBodyJointsBD>("xrLocateBodyJointsBD");
|
||||
assert(xrCreateBodyTrackerBD);
|
||||
|
||||
XrBodyTrackerCreateInfoBD create_info{
|
||||
.type = XR_TYPE_BODY_TRACKER_CREATE_INFO_BD,
|
||||
.next = nullptr,
|
||||
.jointSet = XR_BODY_JOINT_SET_FULL_BODY_JOINTS_BD,
|
||||
};
|
||||
|
||||
CHECK_XR(xrCreateBodyTrackerBD(s, &create_info, &id));
|
||||
}
|
||||
|
||||
size_t xr::pico_body_tracker::count() const
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
namespace xr
|
||||
{
|
||||
class instance;
|
||||
class session;
|
||||
|
||||
XrResult destroy_pico_body_tracker(XrBodyTrackerBD);
|
||||
|
||||
@@ -48,7 +49,7 @@ public:
|
||||
};
|
||||
|
||||
pico_body_tracker() = default;
|
||||
pico_body_tracker(instance & inst, XrBodyTrackerBD h);
|
||||
pico_body_tracker(instance & inst, session & s);
|
||||
|
||||
size_t count() const;
|
||||
std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> locate_spaces(XrTime time, XrSpace reference);
|
||||
|
||||
@@ -23,10 +23,7 @@
|
||||
#include "details/enumerate.h"
|
||||
#include "openxr/openxr.h"
|
||||
#include "utils/contains.h"
|
||||
#include "xr/fb_body_tracker.h"
|
||||
#include "xr/htc_body_tracker.h"
|
||||
#include "xr/instance.h"
|
||||
#include "xr/pico_body_tracker.h"
|
||||
#include "xr/system.h"
|
||||
#include <ranges>
|
||||
#include <vulkan/vulkan.h>
|
||||
@@ -101,65 +98,6 @@ xr::hand_tracker xr::session::create_hand_tracker(XrHandEXT hand, XrHandJointSet
|
||||
}};
|
||||
}
|
||||
|
||||
xr::fb_face_tracker2 xr::session::create_fb_face_tracker2()
|
||||
{
|
||||
XrFaceTrackingDataSource2FB data_sources[1];
|
||||
data_sources[0] = XR_FACE_TRACKING_DATA_SOURCE2_VISUAL_FB;
|
||||
|
||||
XrFaceTrackerCreateInfo2FB create_info{
|
||||
.type = XR_TYPE_FACE_TRACKER_CREATE_INFO2_FB,
|
||||
.next = nullptr,
|
||||
.faceExpressionSet = XR_FACE_EXPRESSION_SET2_DEFAULT_FB,
|
||||
.requestedDataSourceCount = 1,
|
||||
.requestedDataSources = data_sources,
|
||||
};
|
||||
|
||||
XrFaceTracker2FB ft;
|
||||
|
||||
auto xrCreateFaceTracker2FB = inst->get_proc<PFN_xrCreateFaceTracker2FB>("xrCreateFaceTracker2FB");
|
||||
assert(xrCreateFaceTracker2FB);
|
||||
|
||||
CHECK_XR(xrCreateFaceTracker2FB(id, &create_info, &ft));
|
||||
return {*inst, ft};
|
||||
}
|
||||
|
||||
xr::htc_face_tracker xr::session::create_htc_face_tracker(bool eye, bool lip)
|
||||
{
|
||||
return {*inst, *this, eye, lip};
|
||||
}
|
||||
|
||||
xr::pico_face_tracker xr::session::create_pico_face_tracker()
|
||||
{
|
||||
return {*inst, *this};
|
||||
}
|
||||
|
||||
xr::fb_body_tracker xr::session::create_fb_body_tracker()
|
||||
{
|
||||
return {*inst, *this};
|
||||
}
|
||||
|
||||
xr::htc_body_tracker xr::session::create_htc_body_tracker()
|
||||
{
|
||||
return {*inst, *this};
|
||||
}
|
||||
|
||||
xr::pico_body_tracker xr::session::create_pico_body_tracker()
|
||||
{
|
||||
XrBodyTrackerCreateInfoBD create_info{
|
||||
.type = XR_TYPE_BODY_TRACKER_CREATE_INFO_BD,
|
||||
.next = nullptr,
|
||||
.jointSet = XR_BODY_JOINT_SET_FULL_BODY_JOINTS_BD,
|
||||
};
|
||||
|
||||
XrBodyTrackerBD bt;
|
||||
|
||||
auto xrCreateBodyTrackerBD = inst->get_proc<PFN_xrCreateBodyTrackerBD>("xrCreateBodyTrackerBD");
|
||||
assert(xrCreateBodyTrackerBD);
|
||||
|
||||
CHECK_XR(xrCreateBodyTrackerBD(id, &create_info, &bt));
|
||||
return {*inst, bt};
|
||||
}
|
||||
|
||||
std::vector<vk::Format> xr::session::get_swapchain_formats() const
|
||||
{
|
||||
std::vector<vk::Format> formats;
|
||||
|
||||
@@ -26,14 +26,8 @@
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
#include "fb_body_tracker.h"
|
||||
#include "fb_face_tracker2.h"
|
||||
#include "hand_tracker.h"
|
||||
#include "htc_body_tracker.h"
|
||||
#include "htc_face_tracker.h"
|
||||
#include "passthrough.h"
|
||||
#include "pico_body_tracker.h"
|
||||
#include "pico_face_tracker.h"
|
||||
#include "space.h"
|
||||
|
||||
namespace xr
|
||||
@@ -54,12 +48,6 @@ public:
|
||||
space create_reference_space(XrReferenceSpaceType ref, const XrPosef & pose = {{0, 0, 0, 1}, {0, 0, 0}});
|
||||
space create_action_space(XrAction action, const XrPosef & pose = {{0, 0, 0, 1}, {0, 0, 0}});
|
||||
hand_tracker create_hand_tracker(XrHandEXT hand, XrHandJointSetEXT hand_joint_set = XR_HAND_JOINT_SET_DEFAULT_EXT);
|
||||
fb_face_tracker2 create_fb_face_tracker2();
|
||||
htc_face_tracker create_htc_face_tracker(bool eye, bool lip);
|
||||
pico_face_tracker create_pico_face_tracker();
|
||||
fb_body_tracker create_fb_body_tracker();
|
||||
htc_body_tracker create_htc_body_tracker();
|
||||
pico_body_tracker create_pico_body_tracker();
|
||||
|
||||
std::vector<vk::Format> get_swapchain_formats() const;
|
||||
|
||||
|
||||
+19
-6
@@ -23,19 +23,17 @@ endif()
|
||||
|
||||
configure_file(wivrn_config.h.in wivrn_config.h)
|
||||
|
||||
add_library(wivrn-common-base STATIC
|
||||
utils/xdg_base_directory.cpp
|
||||
utils/flatpak.cpp
|
||||
add_library(wivrn-common-base STATIC EXCLUDE_FROM_ALL
|
||||
utils/strings.cpp
|
||||
utils/xdg_base_directory.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.cpp
|
||||
)
|
||||
|
||||
add_library(wivrn-common STATIC
|
||||
add_library(wivrn-common STATIC EXCLUDE_FROM_ALL
|
||||
crypto.cpp
|
||||
smp.cpp
|
||||
secrets.cpp
|
||||
wivrn_sockets.cpp
|
||||
utils/xdg_base_directory.cpp
|
||||
utils/strings.cpp
|
||||
vk/allocation.cpp
|
||||
vk/error_category.cpp
|
||||
@@ -43,6 +41,22 @@ add_library(wivrn-common STATIC
|
||||
vk/vk_mem_alloc.cpp
|
||||
)
|
||||
|
||||
if (WIVRN_BUILD_DASHBOARD OR WIVRN_BUILD_SERVER)
|
||||
add_library(wivrn-common-server STATIC EXCLUDE_FROM_ALL
|
||||
utils/flatpak.cpp
|
||||
application.cpp
|
||||
)
|
||||
target_link_libraries(wivrn-common-server PRIVATE nlohmann_json::nlohmann_json PUBLIC wivrn-common-base)
|
||||
|
||||
if (WIVRN_BUILD_TEST)
|
||||
add_executable(list-apps
|
||||
test_application.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(list-apps wivrn-common-server)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
# The Vulkan headers in Android do not include the C++ headers, download them
|
||||
# Minimum version is 1.3.256
|
||||
@@ -113,5 +127,4 @@ endif()
|
||||
|
||||
target_include_directories(wivrn-common-base PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_link_libraries(wivrn-common PUBLIC Boost::pfr OpenSSL::Crypto wivrn-external wivrn-common-base)
|
||||
target_compile_features(wivrn-common PRIVATE cxx_std_20)
|
||||
target_compile_definitions(wivrn-common PUBLIC VULKAN_HPP_NO_STRUCT_CONSTRUCTORS)
|
||||
|
||||
@@ -0,0 +1,313 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2024 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 "application.h"
|
||||
|
||||
#include "utils/flatpak.h"
|
||||
#include "utils/xdg_base_directory.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace wivrn
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
std::string read_file(const std::filesystem::path & path)
|
||||
{
|
||||
std::ifstream f(path);
|
||||
std::istreambuf_iterator<char> begin{f}, end;
|
||||
|
||||
return {begin, end};
|
||||
}
|
||||
|
||||
std::filesystem::path home()
|
||||
{
|
||||
auto home = std::getenv("HOME");
|
||||
return home ? home : "";
|
||||
}
|
||||
|
||||
std::pair<std::string, std::string> read_vr_manifest()
|
||||
{
|
||||
// system Steam
|
||||
auto manifest = read_file(xdg_data_home() / "Steam/config/steamapps.vrmanifest");
|
||||
if (not manifest.empty())
|
||||
return {"steam", manifest};
|
||||
|
||||
auto h = home();
|
||||
|
||||
// system Steam (accessed from flatpak)
|
||||
manifest = read_file(h / ".local/share/Steam/config/steamapps.vrmanifest");
|
||||
if (not manifest.empty())
|
||||
return {"steam", manifest};
|
||||
|
||||
// Flatpak Steam
|
||||
manifest = read_file(h / ".var/app/com.valvesoftware.Steam/.steam/steam/config/steamapps.vrmanifest");
|
||||
if (not manifest.empty())
|
||||
return {"flatpak run com.valvesoftware.Steam", manifest};
|
||||
return {};
|
||||
}
|
||||
|
||||
void read_steam_vr_apps(std::unordered_map<std::string, application> & res)
|
||||
{
|
||||
auto [command, manifest] = read_vr_manifest();
|
||||
if (manifest.empty())
|
||||
return;
|
||||
nlohmann::json json = nlohmann::json::parse(manifest);
|
||||
|
||||
for (auto & i: json["applications"])
|
||||
{
|
||||
try
|
||||
{
|
||||
application app;
|
||||
|
||||
std::string app_key = i["app_key"];
|
||||
for (auto [locale, items]: i["strings"].items())
|
||||
{
|
||||
if (auto it = items.find("name"); it != items.end())
|
||||
app.name[locale] = *it;
|
||||
}
|
||||
|
||||
if (not app.name.contains(""))
|
||||
{
|
||||
auto it = app.name.find("en_us");
|
||||
if (it == app.name.end())
|
||||
it = app.name.begin();
|
||||
if (it != app.name.end())
|
||||
app.name[""] = it->second;
|
||||
}
|
||||
|
||||
if (i["launch_type"] == "url")
|
||||
{
|
||||
app.exec = command + " " + (std::string)i["url"];
|
||||
}
|
||||
else if (i["launch_type"] == "binary")
|
||||
{
|
||||
const char prefix[] = "steam.app.";
|
||||
if (app_key.starts_with(prefix))
|
||||
{
|
||||
// ¯\_(ツ)_/¯
|
||||
uint64_t appkey = stoll(app_key.substr(strlen(prefix)));
|
||||
app.exec = command + " steam://rungameid/" + std::to_string((appkey << 32) + 0x2000000);
|
||||
}
|
||||
}
|
||||
|
||||
if (not app.exec.empty())
|
||||
res[app_key] = std::move(app);
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
std::cerr << "Failed to parse Steam VR manifest: " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string unescape(std::string_view in)
|
||||
{
|
||||
std::string out;
|
||||
out.reserve(in.size());
|
||||
for (auto c = in.begin(); c != in.end(); ++c)
|
||||
{
|
||||
if (*c == '\\')
|
||||
{
|
||||
++c;
|
||||
if (c == in.end())
|
||||
break;
|
||||
switch (*c)
|
||||
{
|
||||
case 's':
|
||||
out += ' ';
|
||||
break;
|
||||
case 'n':
|
||||
out += '\n';
|
||||
break;
|
||||
case 't':
|
||||
out += '\t';
|
||||
break;
|
||||
case 'r':
|
||||
out += '\r';
|
||||
break;
|
||||
default:
|
||||
out += *c;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
out += *c;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
struct key_value
|
||||
{
|
||||
std::string_view key;
|
||||
std::string_view locale;
|
||||
std::string_view value;
|
||||
key_value(std::string_view l)
|
||||
{
|
||||
auto pos = l.find_first_of("[ =");
|
||||
if (pos == std::string_view::npos)
|
||||
return;
|
||||
key = l.substr(0, pos);
|
||||
l = l.substr(pos);
|
||||
if (l[0] == '[')
|
||||
{
|
||||
pos = l.find(']');
|
||||
if (pos == std::string_view::npos)
|
||||
{
|
||||
key = std::string_view();
|
||||
return;
|
||||
}
|
||||
locale = l.substr(1, pos - 1);
|
||||
l = l.substr(pos + 1);
|
||||
}
|
||||
pos = l.find('=');
|
||||
if (pos == std::string_view::npos)
|
||||
{
|
||||
key = std::string_view();
|
||||
locale = std::string_view();
|
||||
return;
|
||||
}
|
||||
l = l.substr(pos + 1);
|
||||
pos = l.find_first_not_of(" ");
|
||||
if (pos == std::string_view::npos)
|
||||
{
|
||||
key = std::string_view();
|
||||
locale = std::string_view();
|
||||
return;
|
||||
}
|
||||
value = l.substr(pos);
|
||||
}
|
||||
};
|
||||
|
||||
bool contains(std::string_view entries, std::string_view val, char sep = ';')
|
||||
{
|
||||
for (auto bounds: entries | std::views::split(sep))
|
||||
{
|
||||
if (std::string_view(bounds.begin(), bounds.end()) == val)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<application> do_desktop_entry(const std::filesystem::path & filename)
|
||||
{
|
||||
auto data = read_file(filename);
|
||||
std::optional<application> res;
|
||||
|
||||
// Most apps are not VR, don't bother parsing the rest
|
||||
bool vr = false;
|
||||
for (auto bounds: data | std::views::split('\n'))
|
||||
{
|
||||
std::string_view line(bounds.begin(), bounds.end());
|
||||
key_value item(line);
|
||||
if (item.key == "Categories")
|
||||
vr = contains(item.value, "X-WiVRn-VR");
|
||||
}
|
||||
if (not vr)
|
||||
return res;
|
||||
|
||||
res.emplace();
|
||||
for (auto bounds: data | std::views::split('\n'))
|
||||
{
|
||||
std::string_view line(bounds.begin(), bounds.end());
|
||||
if (line.empty())
|
||||
continue;
|
||||
if (line.starts_with("#"))
|
||||
continue;
|
||||
|
||||
// Only process the main section
|
||||
if (line.starts_with("[") and line != "[Desktop Entry]")
|
||||
break;
|
||||
|
||||
key_value item(line);
|
||||
if (item.key == "Type" and item.value != "Application")
|
||||
{
|
||||
res.reset();
|
||||
return res;
|
||||
}
|
||||
if (item.key == "Name")
|
||||
res->name.emplace(item.locale, unescape(item.value));
|
||||
if (item.key == "Exec")
|
||||
res->exec = unescape(item.value);
|
||||
if (item.key == "Path")
|
||||
res->path = unescape(item.value);
|
||||
}
|
||||
|
||||
if (res->exec.empty() or not res->name.contains(""))
|
||||
res.reset();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void do_data_dir(std::filesystem::path dir, std::unordered_map<std::string, application> & res)
|
||||
{
|
||||
dir = dir / "applications";
|
||||
if (not std::filesystem::is_directory(dir))
|
||||
return;
|
||||
for (const auto & entry: std::filesystem::recursive_directory_iterator(dir))
|
||||
{
|
||||
if (entry.is_directory())
|
||||
continue;
|
||||
|
||||
if (entry.path().extension() != ".desktop")
|
||||
continue;
|
||||
|
||||
// https://specifications.freedesktop.org/desktop-entry-spec/latest/file-naming.html#desktop-file-id
|
||||
auto file_id = entry.path()
|
||||
.lexically_relative(dir)
|
||||
.replace_extension("")
|
||||
.string();
|
||||
std::ranges::replace(file_id, '/', '-');
|
||||
|
||||
if (res.contains(file_id))
|
||||
continue;
|
||||
|
||||
auto app = do_desktop_entry(entry.path());
|
||||
if (app)
|
||||
res.emplace(std::move(file_id), std::move(*app));
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
std::unordered_map<std::string, application> list_applications(bool include_steam)
|
||||
{
|
||||
std::unordered_map<std::string, application> res;
|
||||
|
||||
if (include_steam)
|
||||
read_steam_vr_apps(res);
|
||||
|
||||
do_data_dir(xdg_data_home(), res);
|
||||
for (auto && dir: xdg_data_dirs())
|
||||
do_data_dir(std::move(dir), res);
|
||||
if (wivrn::is_flatpak())
|
||||
{
|
||||
// Try to guess host data dirs
|
||||
do_data_dir("/run/host/usr/share", res);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
} // namespace wivrn
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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 <optional>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace wivrn
|
||||
{
|
||||
|
||||
struct application
|
||||
{
|
||||
// localised names, with empty locale for default
|
||||
std::unordered_map<std::string, std::string> name;
|
||||
std::string exec;
|
||||
std::optional<std::string> path;
|
||||
};
|
||||
|
||||
std::unordered_map<std::string, application> list_applications(bool include_steam = true);
|
||||
} // namespace wivrn
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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 "application.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
auto apps = wivrn::list_applications();
|
||||
|
||||
std::cout << "Parsed " << apps.size() << " applications" << std::endl;
|
||||
for (const auto & [k, app]: apps)
|
||||
{
|
||||
std::cout << "======================" << std::endl;
|
||||
std::cout << k << std::endl;
|
||||
for (const auto & [locale, name]: app.name)
|
||||
{
|
||||
std::cout << "Name";
|
||||
if (not locale.empty())
|
||||
std::cout << "[" << locale << "]";
|
||||
std::cout << "=" << name << std::endl;
|
||||
}
|
||||
std::cout << "Exec=" << app.exec << std::endl;
|
||||
if (app.path)
|
||||
std::cout << "Path=" << *app.path << std::endl;
|
||||
}
|
||||
}
|
||||
@@ -23,10 +23,11 @@
|
||||
#include <fstream>
|
||||
|
||||
static const std::filesystem::path info_path = "/.flatpak-info";
|
||||
static const bool is_flatpak_v = std::filesystem::exists(info_path);
|
||||
|
||||
bool wivrn::is_flatpak()
|
||||
{
|
||||
return std::filesystem::exists(info_path);
|
||||
return is_flatpak_v;
|
||||
}
|
||||
|
||||
std::optional<std::string> wivrn::flatpak_key(std::string section, std::string key)
|
||||
|
||||
@@ -19,13 +19,6 @@
|
||||
|
||||
#include "strings.h"
|
||||
|
||||
std::string utils::trim(std::string input)
|
||||
{
|
||||
input.resize(input.find_last_not_of("\n ") + 1);
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
std::vector<std::string> utils::split(const std::string & s, const std::string & sep)
|
||||
{
|
||||
std::string::size_type i = 0;
|
||||
|
||||
@@ -19,32 +19,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace utils
|
||||
{
|
||||
std::string trim(std::string input);
|
||||
|
||||
template <typename T>
|
||||
std::string join(const std::vector<T> & vec, const std::string & sep = ", ")
|
||||
{
|
||||
std::stringstream s;
|
||||
|
||||
if (!vec.empty())
|
||||
{
|
||||
s << vec[0];
|
||||
|
||||
for (size_t i = 1, n = vec.size(); i < n; i++)
|
||||
{
|
||||
s << sep << vec[i];
|
||||
}
|
||||
}
|
||||
|
||||
return s.str();
|
||||
}
|
||||
|
||||
std::vector<std::string> split(const std::string & s, const std::string & sep = "\n");
|
||||
|
||||
} // namespace utils
|
||||
|
||||
+39
-2
@@ -430,11 +430,31 @@ struct session_state_changed
|
||||
{
|
||||
XrSessionState state;
|
||||
};
|
||||
|
||||
struct user_presence_changed
|
||||
{
|
||||
bool present;
|
||||
};
|
||||
|
||||
struct override_foveation_center
|
||||
{
|
||||
bool enabled;
|
||||
float pitch;
|
||||
float distance;
|
||||
};
|
||||
|
||||
struct get_application_list
|
||||
{
|
||||
std::string language;
|
||||
std::string country;
|
||||
std::string variant;
|
||||
};
|
||||
|
||||
struct start_app
|
||||
{
|
||||
std::string app_id;
|
||||
};
|
||||
|
||||
using packets = std::variant<
|
||||
crypto_handshake,
|
||||
pin_check_1,
|
||||
@@ -454,7 +474,10 @@ using packets = std::variant<
|
||||
visibility_mask_changed,
|
||||
refresh_rate_changed,
|
||||
session_state_changed,
|
||||
user_presence_changed>;
|
||||
user_presence_changed,
|
||||
override_foveation_center,
|
||||
get_application_list,
|
||||
start_app>;
|
||||
} // namespace from_headset
|
||||
|
||||
namespace to_headset
|
||||
@@ -643,6 +666,19 @@ struct refresh_rate_change
|
||||
float fps;
|
||||
};
|
||||
|
||||
struct application_list
|
||||
{
|
||||
std::string language;
|
||||
std::string country;
|
||||
std::string variant;
|
||||
struct application
|
||||
{
|
||||
std::string id;
|
||||
std::string name;
|
||||
};
|
||||
std::vector<application> applications;
|
||||
};
|
||||
|
||||
using packets = std::variant<
|
||||
crypto_handshake,
|
||||
pin_check_2,
|
||||
@@ -655,6 +691,7 @@ using packets = std::variant<
|
||||
haptics,
|
||||
timesync_query,
|
||||
tracking_control,
|
||||
refresh_rate_change>;
|
||||
refresh_rate_change,
|
||||
application_list>;
|
||||
} // namespace to_headset
|
||||
} // namespace wivrn
|
||||
|
||||
@@ -10,7 +10,7 @@ add_executable(wivrn-dashboard
|
||||
main.cpp
|
||||
wivrn_server.cpp
|
||||
wivrn_qdbus_types.cpp
|
||||
steam_apps.cpp
|
||||
apps.cpp
|
||||
escape_string.cpp
|
||||
settings.cpp
|
||||
rectangle_partitionner.cpp
|
||||
@@ -68,6 +68,7 @@ target_link_libraries(wivrn-dashboard
|
||||
QCoro::Network
|
||||
QCoro::Qml
|
||||
wivrn-common-base
|
||||
wivrn-common-server
|
||||
wivrn-external
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2024 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 "apps.h"
|
||||
|
||||
#include "application.h"
|
||||
|
||||
#include <ranges>
|
||||
|
||||
Apps::Apps(QObject * parent)
|
||||
{
|
||||
auto apps = wivrn::list_applications();
|
||||
|
||||
for (const auto & [id, app]: apps)
|
||||
{
|
||||
m_apps.push_back(
|
||||
vrApp(
|
||||
QString::fromStdString(app.name.at("")),
|
||||
QString::fromStdString(app.exec)));
|
||||
}
|
||||
|
||||
std::ranges::sort(m_apps, [](const vrApp & a, const vrApp & b) {
|
||||
return a.name() < b.name();
|
||||
});
|
||||
}
|
||||
|
||||
#include "moc_apps.cpp"
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2024 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
|
||||
@@ -21,37 +22,30 @@
|
||||
#include <QAbstractListModel>
|
||||
#include <qqmlintegration.h>
|
||||
|
||||
class steamApp
|
||||
class vrApp
|
||||
{
|
||||
Q_GADGET
|
||||
QML_VALUE_TYPE(steamApp)
|
||||
QML_VALUE_TYPE(vrApp)
|
||||
Q_PROPERTY(QString name READ name WRITE setName)
|
||||
Q_PROPERTY(QString imagePath READ imagePath WRITE setImagePath)
|
||||
Q_PROPERTY(QString command READ command WRITE setCommand)
|
||||
|
||||
QString m_name;
|
||||
QString m_imagePath;
|
||||
QString m_command;
|
||||
|
||||
public:
|
||||
steamApp() = default;
|
||||
steamApp(const steamApp &) = default;
|
||||
steamApp(steamApp &&) = default;
|
||||
steamApp & operator=(const steamApp &) = default;
|
||||
steamApp & operator=(steamApp &&) = default;
|
||||
steamApp(QString name, QString imagePath, QString command) :
|
||||
m_name(name), m_imagePath(imagePath), m_command(command) {}
|
||||
vrApp() = default;
|
||||
vrApp(const vrApp &) = default;
|
||||
vrApp(vrApp &&) = default;
|
||||
vrApp & operator=(const vrApp &) = default;
|
||||
vrApp & operator=(vrApp &&) = default;
|
||||
vrApp(QString name, QString command) :
|
||||
m_name(name), m_command(command) {}
|
||||
|
||||
QString name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
QString imagePath() const
|
||||
{
|
||||
return m_imagePath;
|
||||
}
|
||||
|
||||
QString command() const
|
||||
{
|
||||
return m_command;
|
||||
@@ -62,11 +56,6 @@ public:
|
||||
m_name = value;
|
||||
}
|
||||
|
||||
void setImagePath(QString value)
|
||||
{
|
||||
m_imagePath = value;
|
||||
}
|
||||
|
||||
void setCommand(QString value)
|
||||
{
|
||||
m_command = value;
|
||||
@@ -77,30 +66,25 @@ public:
|
||||
m_name = QString::fromStdString(value);
|
||||
}
|
||||
|
||||
void setImagePath(const std::string & value)
|
||||
{
|
||||
m_imagePath = QString::fromStdString(value);
|
||||
}
|
||||
|
||||
void setCommand(const std::string & value)
|
||||
{
|
||||
m_command = QString::fromStdString(value);
|
||||
}
|
||||
};
|
||||
|
||||
class SteamApps : public QObject
|
||||
class Apps : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_SINGLETON
|
||||
|
||||
Q_PROPERTY(QList<steamApp> apps READ apps)
|
||||
QList<steamApp> m_apps;
|
||||
Q_PROPERTY(QList<vrApp> apps READ apps)
|
||||
QList<vrApp> m_apps;
|
||||
|
||||
public:
|
||||
SteamApps(QObject * parent = nullptr);
|
||||
Apps(QObject * parent = nullptr);
|
||||
|
||||
const QList<steamApp> & apps() const
|
||||
const QList<vrApp> & apps() const
|
||||
{
|
||||
return m_apps;
|
||||
}
|
||||
@@ -12,24 +12,21 @@ ColumnLayout {
|
||||
Component.onCompleted: {
|
||||
apps.append({
|
||||
"name": i18nc("don't start an application automatically", "None"),
|
||||
"image_path": "",
|
||||
"command": "",
|
||||
"is_custom": false
|
||||
});
|
||||
|
||||
apps.append({
|
||||
"name": i18nc("choose a custom application to start", "Custom"),
|
||||
"image_path": "",
|
||||
"command": "",
|
||||
"is_custom": true
|
||||
});
|
||||
|
||||
var steam_apps = SteamApps.apps;
|
||||
for (var i = 0; i < steam_apps.length; i++) {
|
||||
var vr_apps = Apps.apps;
|
||||
for (var i = 0; i < vr_apps.length; i++) {
|
||||
apps.append({
|
||||
"name": steam_apps[i].name,
|
||||
"image_path": steam_apps[i].imagePath,
|
||||
"command": steam_apps[i].command,
|
||||
"name": vr_apps[i].name,
|
||||
"command": vr_apps[i].command,
|
||||
"is_custom": false
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2024 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 "steam_apps.h"
|
||||
#include "escape_string.h"
|
||||
#include "utils/flatpak.h"
|
||||
#include <QProcess>
|
||||
#include <QtLogging>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
std::string read_vr_manifest()
|
||||
{
|
||||
const char * home = getenv("HOME");
|
||||
|
||||
std::filesystem::path vrmanifest = std::string{home ? home : ""} + "/.steam/steam/config/steamapps.vrmanifest";
|
||||
|
||||
if (wivrn::flatpak_key(wivrn::flatpak::section::session_bus_policy, "org.freedesktop.Flatpak") == "talk")
|
||||
{
|
||||
QProcess flatpak_spawn;
|
||||
flatpak_spawn.start("flatpak-spawn", {"--host", "cat", QString::fromStdString(vrmanifest)});
|
||||
flatpak_spawn.waitForFinished();
|
||||
return flatpak_spawn.readAllStandardOutput().toStdString();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ifstream f(vrmanifest);
|
||||
std::istreambuf_iterator<char> begin{f}, end;
|
||||
|
||||
return {begin, end};
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
SteamApps::SteamApps(QObject * parent)
|
||||
{
|
||||
auto manifest = read_vr_manifest();
|
||||
if (manifest.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
nlohmann::json json;
|
||||
try
|
||||
{
|
||||
json = nlohmann::json::parse(manifest);
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
qWarning() << "Error parsing VR manifest: " << e.what();
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto & i: json["applications"])
|
||||
{
|
||||
try
|
||||
{
|
||||
steamApp app;
|
||||
|
||||
app.setImagePath(i.value("image_path", ""));
|
||||
app.setName(i["strings"]["en_us"]["name"]);
|
||||
|
||||
if (i["launch_type"] == "url")
|
||||
{
|
||||
app.setCommand("steam " + (std::string)i["url"]);
|
||||
}
|
||||
else if (i["launch_type"] == "binary")
|
||||
{
|
||||
std::string app_key = i["app_key"];
|
||||
|
||||
const char prefix[] = "steam.app.";
|
||||
if (app_key.starts_with(prefix))
|
||||
{
|
||||
// ¯\_(ツ)_/¯
|
||||
uint64_t appkey = stoll(app_key.substr(strlen(prefix)));
|
||||
app.setCommand("steam steam://rungameid/" + std::to_string((appkey << 32) + 0x2000000));
|
||||
}
|
||||
}
|
||||
|
||||
if (app.command() != "")
|
||||
m_apps.push_back(app);
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
qWarning() << "Error adding app from VR manifest: " << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
std::ranges::sort(m_apps, [](const steamApp & a, const steamApp & b) {
|
||||
return a.name() < b.name();
|
||||
});
|
||||
}
|
||||
|
||||
#include "moc_steam_apps.cpp"
|
||||
@@ -0,0 +1,848 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"https://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<interface name="org.freedesktop.DBus.Peer">
|
||||
<method name="Ping"/>
|
||||
<method name="GetMachineId">
|
||||
<arg type="s" name="machine_uuid" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.DBus.Introspectable">
|
||||
<method name="Introspect">
|
||||
<arg name="xml_data" type="s" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.DBus.Properties">
|
||||
<method name="Get">
|
||||
<arg name="interface_name" direction="in" type="s"/>
|
||||
<arg name="property_name" direction="in" type="s"/>
|
||||
<arg name="value" direction="out" type="v"/>
|
||||
</method>
|
||||
<method name="GetAll">
|
||||
<arg name="interface_name" direction="in" type="s"/>
|
||||
<arg name="props" direction="out" type="a{sv}"/>
|
||||
</method>
|
||||
<method name="Set">
|
||||
<arg name="interface_name" direction="in" type="s"/>
|
||||
<arg name="property_name" direction="in" type="s"/>
|
||||
<arg name="value" direction="in" type="v"/>
|
||||
</method>
|
||||
<signal name="PropertiesChanged">
|
||||
<arg type="s" name="interface_name"/>
|
||||
<arg type="a{sv}" name="changed_properties"/>
|
||||
<arg type="as" name="invalidated_properties"/>
|
||||
</signal>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.systemd1.Manager">
|
||||
<property name="Version" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Features" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Virtualization" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="ConfidentialVirtualization" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Architecture" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Tainted" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="FirmwareTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="FirmwareTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="LoaderTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="LoaderTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="KernelTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="KernelTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="InitRDTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="InitRDTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="UserspaceTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="UserspaceTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="FinishTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="FinishTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="ShutdownStartTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="ShutdownStartTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="SecurityStartTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="SecurityStartTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="SecurityFinishTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="SecurityFinishTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="GeneratorsStartTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="GeneratorsStartTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="GeneratorsFinishTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="GeneratorsFinishTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="UnitsLoadStartTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="UnitsLoadStartTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="UnitsLoadFinishTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="UnitsLoadFinishTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="UnitsLoadTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="UnitsLoadTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="InitRDSecurityStartTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="InitRDSecurityStartTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="InitRDSecurityFinishTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="InitRDSecurityFinishTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="InitRDGeneratorsStartTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="InitRDGeneratorsStartTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="InitRDGeneratorsFinishTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="InitRDGeneratorsFinishTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="InitRDUnitsLoadStartTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="InitRDUnitsLoadStartTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="InitRDUnitsLoadFinishTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="InitRDUnitsLoadFinishTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="LogLevel" type="s" access="readwrite">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
<annotation name="org.freedesktop.systemd1.Privileged" value="true"/>
|
||||
</property>
|
||||
<property name="LogTarget" type="s" access="readwrite">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
<annotation name="org.freedesktop.systemd1.Privileged" value="true"/>
|
||||
</property>
|
||||
<property name="NNames" type="u" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="NFailedUnits" type="u" access="read">
|
||||
</property>
|
||||
<property name="NJobs" type="u" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="NInstalledJobs" type="u" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="NFailedJobs" type="u" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="Progress" type="d" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="Environment" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="ConfirmSpawn" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="ShowStatus" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="UnitPath" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultStandardOutput" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultStandardError" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="WatchdogDevice" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="WatchdogLastPingTimestamp" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="WatchdogLastPingTimestampMonotonic" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="RuntimeWatchdogUSec" type="t" access="readwrite">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
<annotation name="org.freedesktop.systemd1.Privileged" value="true"/>
|
||||
</property>
|
||||
<property name="RuntimeWatchdogPreUSec" type="t" access="readwrite">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
<annotation name="org.freedesktop.systemd1.Privileged" value="true"/>
|
||||
</property>
|
||||
<property name="RuntimeWatchdogPreGovernor" type="s" access="readwrite">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
<annotation name="org.freedesktop.systemd1.Privileged" value="true"/>
|
||||
</property>
|
||||
<property name="RebootWatchdogUSec" type="t" access="readwrite">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
<annotation name="org.freedesktop.systemd1.Privileged" value="true"/>
|
||||
</property>
|
||||
<property name="KExecWatchdogUSec" type="t" access="readwrite">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
<annotation name="org.freedesktop.systemd1.Privileged" value="true"/>
|
||||
</property>
|
||||
<property name="ServiceWatchdogs" type="b" access="readwrite">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
<annotation name="org.freedesktop.systemd1.Privileged" value="true"/>
|
||||
</property>
|
||||
<property name="ControlGroup" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="SystemState" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="ExitCode" type="y" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="DefaultTimerAccuracyUSec" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultTimeoutStartUSec" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultTimeoutStopUSec" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultTimeoutAbortUSec" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="DefaultDeviceTimeoutUSec" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultRestartUSec" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultStartLimitIntervalUSec" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultStartLimitBurst" type="u" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultCPUAccounting" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultBlockIOAccounting" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultIOAccounting" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultIPAccounting" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultMemoryAccounting" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultTasksAccounting" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitCPU" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitCPUSoft" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitFSIZE" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitFSIZESoft" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitDATA" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitDATASoft" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitSTACK" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitSTACKSoft" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitCORE" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitCORESoft" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitRSS" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitRSSSoft" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitNOFILE" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitNOFILESoft" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitAS" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitASSoft" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitNPROC" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitNPROCSoft" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitMEMLOCK" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitMEMLOCKSoft" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitLOCKS" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitLOCKSSoft" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitSIGPENDING" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitSIGPENDINGSoft" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitMSGQUEUE" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitMSGQUEUESoft" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitNICE" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitNICESoft" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitRTPRIO" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitRTPRIOSoft" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitRTTIME" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultLimitRTTIMESoft" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultTasksMax" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="DefaultMemoryPressureThresholdUSec" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="DefaultMemoryPressureWatch" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="TimerSlackNSec" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultOOMPolicy" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultOOMScoreAdjust" type="i" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="CtrlAltDelBurstAction" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="SoftRebootsCount" type="u" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<method name="GetUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="o" name="unit" direction="out"/>
|
||||
</method>
|
||||
<method name="GetUnitByPID">
|
||||
<arg type="u" name="pid" direction="in"/>
|
||||
<arg type="o" name="unit" direction="out"/>
|
||||
</method>
|
||||
<method name="GetUnitByInvocationID">
|
||||
<arg type="ay" name="invocation_id" direction="in"/>
|
||||
<arg type="o" name="unit" direction="out"/>
|
||||
</method>
|
||||
<method name="GetUnitByControlGroup">
|
||||
<arg type="s" name="cgroup" direction="in"/>
|
||||
<arg type="o" name="unit" direction="out"/>
|
||||
</method>
|
||||
<method name="GetUnitByPIDFD">
|
||||
<arg type="h" name="pidfd" direction="in"/>
|
||||
<arg type="o" name="unit" direction="out"/>
|
||||
<arg type="s" name="unit_id" direction="out"/>
|
||||
<arg type="ay" name="invocation_id" direction="out"/>
|
||||
</method>
|
||||
<method name="LoadUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="o" name="unit" direction="out"/>
|
||||
</method>
|
||||
<method name="StartUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="StartUnitWithFlags">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="t" name="flags" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="StartUnitReplace">
|
||||
<arg type="s" name="old_unit" direction="in"/>
|
||||
<arg type="s" name="new_unit" direction="in"/>
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="StopUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="ReloadUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="RestartUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="TryRestartUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="ReloadOrRestartUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="ReloadOrTryRestartUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="EnqueueUnitJob">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="s" name="job_type" direction="in"/>
|
||||
<arg type="s" name="job_mode" direction="in"/>
|
||||
<arg type="u" name="job_id" direction="out"/>
|
||||
<arg type="o" name="job_path" direction="out"/>
|
||||
<arg type="s" name="unit_id" direction="out"/>
|
||||
<arg type="o" name="unit_path" direction="out"/>
|
||||
<arg type="s" name="job_type" direction="out"/>
|
||||
<arg type="a(uosos)" name="affected_jobs" direction="out"/>
|
||||
</method>
|
||||
<method name="KillUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="s" name="whom" direction="in"/>
|
||||
<arg type="i" name="signal" direction="in"/>
|
||||
</method>
|
||||
<method name="QueueSignalUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="s" name="whom" direction="in"/>
|
||||
<arg type="i" name="signal" direction="in"/>
|
||||
<arg type="i" name="value" direction="in"/>
|
||||
</method>
|
||||
<method name="CleanUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="as" name="mask" direction="in"/>
|
||||
</method>
|
||||
<method name="FreezeUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
</method>
|
||||
<method name="ThawUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
</method>
|
||||
<method name="ResetFailedUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
</method>
|
||||
<method name="SetUnitProperties">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="b" name="runtime" direction="in"/>
|
||||
<arg type="a(sv)" name="properties" direction="in"/>
|
||||
</method>
|
||||
<method name="BindMountUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="s" name="source" direction="in"/>
|
||||
<arg type="s" name="destination" direction="in"/>
|
||||
<arg type="b" name="read_only" direction="in"/>
|
||||
<arg type="b" name="mkdir" direction="in"/>
|
||||
</method>
|
||||
<method name="MountImageUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="s" name="source" direction="in"/>
|
||||
<arg type="s" name="destination" direction="in"/>
|
||||
<arg type="b" name="read_only" direction="in"/>
|
||||
<arg type="b" name="mkdir" direction="in"/>
|
||||
<arg type="a(ss)" name="options" direction="in"/>
|
||||
</method>
|
||||
<method name="RefUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
</method>
|
||||
<method name="UnrefUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
</method>
|
||||
<method name="StartTransientUnit">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="a(sv)" name="properties" direction="in"/>
|
||||
<arg type="a(sa(sv))" name="aux" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="GetUnitProcesses">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="a(sus)" name="processes" direction="out"/>
|
||||
</method>
|
||||
<method name="AttachProcessesToUnit">
|
||||
<arg type="s" name="unit_name" direction="in"/>
|
||||
<arg type="s" name="subcgroup" direction="in"/>
|
||||
<arg type="au" name="pids" direction="in"/>
|
||||
</method>
|
||||
<method name="AbandonScope">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
</method>
|
||||
<method name="GetJob">
|
||||
<arg type="u" name="id" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="GetJobAfter">
|
||||
<arg type="u" name="id" direction="in"/>
|
||||
<arg type="a(usssoo)" name="jobs" direction="out"/>
|
||||
</method>
|
||||
<method name="GetJobBefore">
|
||||
<arg type="u" name="id" direction="in"/>
|
||||
<arg type="a(usssoo)" name="jobs" direction="out"/>
|
||||
</method>
|
||||
<method name="CancelJob">
|
||||
<arg type="u" name="id" direction="in"/>
|
||||
</method>
|
||||
<method name="ClearJobs">
|
||||
</method>
|
||||
<method name="ResetFailed">
|
||||
</method>
|
||||
<method name="SetShowStatus">
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
</method>
|
||||
<method name="ListUnits">
|
||||
<arg type="a(ssssssouso)" name="units" direction="out"/>
|
||||
</method>
|
||||
<method name="ListUnitsFiltered">
|
||||
<arg type="as" name="states" direction="in"/>
|
||||
<arg type="a(ssssssouso)" name="units" direction="out"/>
|
||||
</method>
|
||||
<method name="ListUnitsByPatterns">
|
||||
<arg type="as" name="states" direction="in"/>
|
||||
<arg type="as" name="patterns" direction="in"/>
|
||||
<arg type="a(ssssssouso)" name="units" direction="out"/>
|
||||
</method>
|
||||
<method name="ListUnitsByNames">
|
||||
<arg type="as" name="names" direction="in"/>
|
||||
<arg type="a(ssssssouso)" name="units" direction="out"/>
|
||||
</method>
|
||||
<method name="ListJobs">
|
||||
<arg type="a(usssoo)" name="jobs" direction="out"/>
|
||||
</method>
|
||||
<method name="Subscribe">
|
||||
</method>
|
||||
<method name="Unsubscribe">
|
||||
</method>
|
||||
<method name="Dump">
|
||||
<arg type="s" name="output" direction="out"/>
|
||||
</method>
|
||||
<method name="DumpUnitsMatchingPatterns">
|
||||
<arg type="as" name="patterns" direction="in"/>
|
||||
<arg type="s" name="output" direction="out"/>
|
||||
</method>
|
||||
<method name="DumpByFileDescriptor">
|
||||
<arg type="h" name="fd" direction="out"/>
|
||||
</method>
|
||||
<method name="DumpUnitsMatchingPatternsByFileDescriptor">
|
||||
<arg type="as" name="patterns" direction="in"/>
|
||||
<arg type="h" name="fd" direction="out"/>
|
||||
</method>
|
||||
<method name="Reload">
|
||||
</method>
|
||||
<method name="Reexecute">
|
||||
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
|
||||
</method>
|
||||
<method name="Exit">
|
||||
<annotation name="org.freedesktop.systemd1.Privileged" value="true"/>
|
||||
</method>
|
||||
<method name="Reboot">
|
||||
<annotation name="org.freedesktop.systemd1.Privileged" value="true"/>
|
||||
</method>
|
||||
<method name="SoftReboot">
|
||||
<arg type="s" name="new_root" direction="in"/>
|
||||
<annotation name="org.freedesktop.systemd1.Privileged" value="true"/>
|
||||
</method>
|
||||
<method name="PowerOff">
|
||||
<annotation name="org.freedesktop.systemd1.Privileged" value="true"/>
|
||||
</method>
|
||||
<method name="Halt">
|
||||
<annotation name="org.freedesktop.systemd1.Privileged" value="true"/>
|
||||
</method>
|
||||
<method name="KExec">
|
||||
<annotation name="org.freedesktop.systemd1.Privileged" value="true"/>
|
||||
</method>
|
||||
<method name="SwitchRoot">
|
||||
<arg type="s" name="new_root" direction="in"/>
|
||||
<arg type="s" name="init" direction="in"/>
|
||||
<annotation name="org.freedesktop.systemd1.Privileged" value="true"/>
|
||||
</method>
|
||||
<method name="SetEnvironment">
|
||||
<arg type="as" name="assignments" direction="in"/>
|
||||
</method>
|
||||
<method name="UnsetEnvironment">
|
||||
<arg type="as" name="names" direction="in"/>
|
||||
</method>
|
||||
<method name="UnsetAndSetEnvironment">
|
||||
<arg type="as" name="names" direction="in"/>
|
||||
<arg type="as" name="assignments" direction="in"/>
|
||||
</method>
|
||||
<method name="EnqueueMarkedJobs">
|
||||
<arg type="ao" name="jobs" direction="out"/>
|
||||
</method>
|
||||
<method name="ListUnitFiles">
|
||||
<arg type="a(ss)" name="unit_files" direction="out"/>
|
||||
</method>
|
||||
<method name="ListUnitFilesByPatterns">
|
||||
<arg type="as" name="states" direction="in"/>
|
||||
<arg type="as" name="patterns" direction="in"/>
|
||||
<arg type="a(ss)" name="unit_files" direction="out"/>
|
||||
</method>
|
||||
<method name="GetUnitFileState">
|
||||
<arg type="s" name="file" direction="in"/>
|
||||
<arg type="s" name="state" direction="out"/>
|
||||
</method>
|
||||
<method name="EnableUnitFiles">
|
||||
<arg type="as" name="files" direction="in"/>
|
||||
<arg type="b" name="runtime" direction="in"/>
|
||||
<arg type="b" name="force" direction="in"/>
|
||||
<arg type="b" name="carries_install_info" direction="out"/>
|
||||
<arg type="a(sss)" name="changes" direction="out"/>
|
||||
</method>
|
||||
<method name="DisableUnitFiles">
|
||||
<arg type="as" name="files" direction="in"/>
|
||||
<arg type="b" name="runtime" direction="in"/>
|
||||
<arg type="a(sss)" name="changes" direction="out"/>
|
||||
</method>
|
||||
<method name="EnableUnitFilesWithFlags">
|
||||
<arg type="as" name="files" direction="in"/>
|
||||
<arg type="t" name="flags" direction="in"/>
|
||||
<arg type="b" name="carries_install_info" direction="out"/>
|
||||
<arg type="a(sss)" name="changes" direction="out"/>
|
||||
</method>
|
||||
<method name="DisableUnitFilesWithFlags">
|
||||
<arg type="as" name="files" direction="in"/>
|
||||
<arg type="t" name="flags" direction="in"/>
|
||||
<arg type="a(sss)" name="changes" direction="out"/>
|
||||
</method>
|
||||
<method name="DisableUnitFilesWithFlagsAndInstallInfo">
|
||||
<arg type="as" name="files" direction="in"/>
|
||||
<arg type="t" name="flags" direction="in"/>
|
||||
<arg type="b" name="carries_install_info" direction="out"/>
|
||||
<arg type="a(sss)" name="changes" direction="out"/>
|
||||
</method>
|
||||
<method name="ReenableUnitFiles">
|
||||
<arg type="as" name="files" direction="in"/>
|
||||
<arg type="b" name="runtime" direction="in"/>
|
||||
<arg type="b" name="force" direction="in"/>
|
||||
<arg type="b" name="carries_install_info" direction="out"/>
|
||||
<arg type="a(sss)" name="changes" direction="out"/>
|
||||
</method>
|
||||
<method name="LinkUnitFiles">
|
||||
<arg type="as" name="files" direction="in"/>
|
||||
<arg type="b" name="runtime" direction="in"/>
|
||||
<arg type="b" name="force" direction="in"/>
|
||||
<arg type="a(sss)" name="changes" direction="out"/>
|
||||
</method>
|
||||
<method name="PresetUnitFiles">
|
||||
<arg type="as" name="files" direction="in"/>
|
||||
<arg type="b" name="runtime" direction="in"/>
|
||||
<arg type="b" name="force" direction="in"/>
|
||||
<arg type="b" name="carries_install_info" direction="out"/>
|
||||
<arg type="a(sss)" name="changes" direction="out"/>
|
||||
</method>
|
||||
<method name="PresetUnitFilesWithMode">
|
||||
<arg type="as" name="files" direction="in"/>
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="b" name="runtime" direction="in"/>
|
||||
<arg type="b" name="force" direction="in"/>
|
||||
<arg type="b" name="carries_install_info" direction="out"/>
|
||||
<arg type="a(sss)" name="changes" direction="out"/>
|
||||
</method>
|
||||
<method name="MaskUnitFiles">
|
||||
<arg type="as" name="files" direction="in"/>
|
||||
<arg type="b" name="runtime" direction="in"/>
|
||||
<arg type="b" name="force" direction="in"/>
|
||||
<arg type="a(sss)" name="changes" direction="out"/>
|
||||
</method>
|
||||
<method name="UnmaskUnitFiles">
|
||||
<arg type="as" name="files" direction="in"/>
|
||||
<arg type="b" name="runtime" direction="in"/>
|
||||
<arg type="a(sss)" name="changes" direction="out"/>
|
||||
</method>
|
||||
<method name="RevertUnitFiles">
|
||||
<arg type="as" name="files" direction="in"/>
|
||||
<arg type="a(sss)" name="changes" direction="out"/>
|
||||
</method>
|
||||
<method name="SetDefaultTarget">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="b" name="force" direction="in"/>
|
||||
<arg type="a(sss)" name="changes" direction="out"/>
|
||||
</method>
|
||||
<method name="GetDefaultTarget">
|
||||
<arg type="s" name="name" direction="out"/>
|
||||
</method>
|
||||
<method name="PresetAllUnitFiles">
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="b" name="runtime" direction="in"/>
|
||||
<arg type="b" name="force" direction="in"/>
|
||||
<arg type="a(sss)" name="changes" direction="out"/>
|
||||
</method>
|
||||
<method name="AddDependencyUnitFiles">
|
||||
<arg type="as" name="files" direction="in"/>
|
||||
<arg type="s" name="target" direction="in"/>
|
||||
<arg type="s" name="type" direction="in"/>
|
||||
<arg type="b" name="runtime" direction="in"/>
|
||||
<arg type="b" name="force" direction="in"/>
|
||||
<arg type="a(sss)" name="changes" direction="out"/>
|
||||
</method>
|
||||
<method name="GetUnitFileLinks">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="b" name="runtime" direction="in"/>
|
||||
<arg type="as" name="links" direction="out"/>
|
||||
</method>
|
||||
<method name="SetExitCode">
|
||||
<arg type="y" name="number" direction="in"/>
|
||||
</method>
|
||||
<method name="LookupDynamicUserByName">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="u" name="uid" direction="out"/>
|
||||
</method>
|
||||
<method name="LookupDynamicUserByUID">
|
||||
<arg type="u" name="uid" direction="in"/>
|
||||
<arg type="s" name="name" direction="out"/>
|
||||
</method>
|
||||
<method name="GetDynamicUsers">
|
||||
<arg type="a(us)" name="users" direction="out"/>
|
||||
</method>
|
||||
<method name="DumpUnitFileDescriptorStore">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="a(suuutuusu)" name="entries" direction="out"/>
|
||||
</method>
|
||||
<method name="StartAuxiliaryScope">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="ah" name="pidfds" direction="in"/>
|
||||
<arg type="t" name="flags" direction="in"/>
|
||||
<arg type="a(sv)" name="properties" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
<annotation name="org.freedesktop.DBus.Deprecated" value="true"/>
|
||||
</method>
|
||||
<signal name="UnitNew">
|
||||
<arg type="s" name="id"/>
|
||||
<arg type="o" name="unit"/>
|
||||
</signal>
|
||||
<signal name="UnitRemoved">
|
||||
<arg type="s" name="id"/>
|
||||
<arg type="o" name="unit"/>
|
||||
</signal>
|
||||
<signal name="JobNew">
|
||||
<arg type="u" name="id"/>
|
||||
<arg type="o" name="job"/>
|
||||
<arg type="s" name="unit"/>
|
||||
</signal>
|
||||
<signal name="JobRemoved">
|
||||
<arg type="u" name="id"/>
|
||||
<arg type="o" name="job"/>
|
||||
<arg type="s" name="unit"/>
|
||||
<arg type="s" name="result"/>
|
||||
</signal>
|
||||
<signal name="StartupFinished">
|
||||
<arg type="t" name="firmware"/>
|
||||
<arg type="t" name="loader"/>
|
||||
<arg type="t" name="kernel"/>
|
||||
<arg type="t" name="initrd"/>
|
||||
<arg type="t" name="userspace"/>
|
||||
<arg type="t" name="total"/>
|
||||
</signal>
|
||||
<signal name="UnitFilesChanged">
|
||||
</signal>
|
||||
<signal name="Reloading">
|
||||
<arg type="b" name="active"/>
|
||||
</signal>
|
||||
</interface>
|
||||
<node name="job"/>
|
||||
<node name="unit"/>
|
||||
</node>
|
||||
@@ -0,0 +1,386 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"https://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<interface name="org.freedesktop.DBus.Peer">
|
||||
<method name="Ping"/>
|
||||
<method name="GetMachineId">
|
||||
<arg type="s" name="machine_uuid" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.DBus.Introspectable">
|
||||
<method name="Introspect">
|
||||
<arg name="xml_data" type="s" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.DBus.Properties">
|
||||
<method name="Get">
|
||||
<arg name="interface_name" direction="in" type="s"/>
|
||||
<arg name="property_name" direction="in" type="s"/>
|
||||
<arg name="value" direction="out" type="v"/>
|
||||
</method>
|
||||
<method name="GetAll">
|
||||
<arg name="interface_name" direction="in" type="s"/>
|
||||
<arg name="props" direction="out" type="a{sv}"/>
|
||||
</method>
|
||||
<method name="Set">
|
||||
<arg name="interface_name" direction="in" type="s"/>
|
||||
<arg name="property_name" direction="in" type="s"/>
|
||||
<arg name="value" direction="in" type="v"/>
|
||||
</method>
|
||||
<signal name="PropertiesChanged">
|
||||
<arg type="s" name="interface_name"/>
|
||||
<arg type="a{sv}" name="changed_properties"/>
|
||||
<arg type="as" name="invalidated_properties"/>
|
||||
</signal>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.systemd1.Unit">
|
||||
<property name="Id" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Names" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Following" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="Requires" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Requisite" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Wants" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="BindsTo" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="PartOf" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Upholds" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="RequiredBy" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="RequisiteOf" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="WantedBy" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="BoundBy" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="UpheldBy" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="ConsistsOf" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Conflicts" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="ConflictedBy" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Before" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="After" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="OnSuccess" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="OnSuccessOf" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="OnFailure" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="OnFailureOf" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Triggers" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="TriggeredBy" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="PropagatesReloadTo" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="ReloadPropagatedFrom" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="PropagatesStopTo" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="StopPropagatedFrom" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="JoinsNamespaceOf" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="SliceOf" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="RequiresMountsFor" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="WantsMountsFor" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Documentation" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Description" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="AccessSELinuxContext" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="LoadState" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="ActiveState" type="s" access="read">
|
||||
</property>
|
||||
<property name="FreezerState" type="s" access="read">
|
||||
</property>
|
||||
<property name="SubState" type="s" access="read">
|
||||
</property>
|
||||
<property name="FragmentPath" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="SourcePath" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DropInPaths" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="UnitFileState" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="UnitFilePreset" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="StateChangeTimestamp" type="t" access="read">
|
||||
</property>
|
||||
<property name="StateChangeTimestampMonotonic" type="t" access="read">
|
||||
</property>
|
||||
<property name="InactiveExitTimestamp" type="t" access="read">
|
||||
</property>
|
||||
<property name="InactiveExitTimestampMonotonic" type="t" access="read">
|
||||
</property>
|
||||
<property name="ActiveEnterTimestamp" type="t" access="read">
|
||||
</property>
|
||||
<property name="ActiveEnterTimestampMonotonic" type="t" access="read">
|
||||
</property>
|
||||
<property name="ActiveExitTimestamp" type="t" access="read">
|
||||
</property>
|
||||
<property name="ActiveExitTimestampMonotonic" type="t" access="read">
|
||||
</property>
|
||||
<property name="InactiveEnterTimestamp" type="t" access="read">
|
||||
</property>
|
||||
<property name="InactiveEnterTimestampMonotonic" type="t" access="read">
|
||||
</property>
|
||||
<property name="CanStart" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="CanStop" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="CanReload" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="CanIsolate" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="CanClean" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="CanFreeze" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="CanLiveMount" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Job" type="(uo)" access="read">
|
||||
</property>
|
||||
<property name="StopWhenUnneeded" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="RefuseManualStart" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="RefuseManualStop" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="AllowIsolate" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="DefaultDependencies" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="SurviveFinalKillSignal" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="OnSuccessJobMode" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="OnFailureJobMode" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="IgnoreOnIsolate" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="NeedDaemonReload" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="Markers" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="JobTimeoutUSec" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="JobRunningTimeoutUSec" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="JobTimeoutAction" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="JobTimeoutRebootArgument" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="ConditionResult" type="b" access="read">
|
||||
</property>
|
||||
<property name="AssertResult" type="b" access="read">
|
||||
</property>
|
||||
<property name="ConditionTimestamp" type="t" access="read">
|
||||
</property>
|
||||
<property name="ConditionTimestampMonotonic" type="t" access="read">
|
||||
</property>
|
||||
<property name="AssertTimestamp" type="t" access="read">
|
||||
</property>
|
||||
<property name="AssertTimestampMonotonic" type="t" access="read">
|
||||
</property>
|
||||
<property name="Conditions" type="a(sbbsi)" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="invalidates"/>
|
||||
</property>
|
||||
<property name="Asserts" type="a(sbbsi)" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="invalidates"/>
|
||||
</property>
|
||||
<property name="LoadError" type="(ss)" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Transient" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Perpetual" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="StartLimitIntervalUSec" type="t" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="StartLimitBurst" type="u" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="StartLimitAction" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="FailureAction" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="FailureActionExitStatus" type="i" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="SuccessAction" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="SuccessActionExitStatus" type="i" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="RebootArgument" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="InvocationID" type="ay" access="read">
|
||||
</property>
|
||||
<property name="CollectMode" type="s" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
|
||||
</property>
|
||||
<property name="Refs" type="as" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<property name="ActivationDetails" type="a(ss)" access="read">
|
||||
</property>
|
||||
<property name="DebugInvocation" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="false"/>
|
||||
</property>
|
||||
<method name="Start">
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="Stop">
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="Reload">
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="Restart">
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="TryRestart">
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="ReloadOrRestart">
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="ReloadOrTryRestart">
|
||||
<arg type="s" name="mode" direction="in"/>
|
||||
<arg type="o" name="job" direction="out"/>
|
||||
</method>
|
||||
<method name="EnqueueJob">
|
||||
<arg type="s" name="job_type" direction="in"/>
|
||||
<arg type="s" name="job_mode" direction="in"/>
|
||||
<arg type="u" name="job_id" direction="out"/>
|
||||
<arg type="o" name="job_path" direction="out"/>
|
||||
<arg type="s" name="unit_id" direction="out"/>
|
||||
<arg type="o" name="unit_path" direction="out"/>
|
||||
<arg type="s" name="job_type" direction="out"/>
|
||||
<arg type="a(uosos)" name="affected_jobs" direction="out"/>
|
||||
</method>
|
||||
<method name="Kill">
|
||||
<arg type="s" name="whom" direction="in"/>
|
||||
<arg type="i" name="signal" direction="in"/>
|
||||
</method>
|
||||
<method name="QueueSignal">
|
||||
<arg type="s" name="whom" direction="in"/>
|
||||
<arg type="i" name="signal" direction="in"/>
|
||||
<arg type="i" name="value" direction="in"/>
|
||||
</method>
|
||||
<method name="ResetFailed">
|
||||
</method>
|
||||
<method name="SetProperties">
|
||||
<arg type="b" name="runtime" direction="in"/>
|
||||
<arg type="a(sv)" name="properties" direction="in"/>
|
||||
</method>
|
||||
<method name="Ref">
|
||||
</method>
|
||||
<method name="Unref">
|
||||
</method>
|
||||
<method name="Clean">
|
||||
<arg type="as" name="mask" direction="in"/>
|
||||
</method>
|
||||
<method name="Freeze">
|
||||
</method>
|
||||
<method name="Thaw">
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
||||
+2
-3
@@ -7,10 +7,9 @@ You only need `gettext` and a text editor, you can optionally use a graphical ed
|
||||
|
||||
# Adding a new language
|
||||
|
||||
* Edit the `tools/update_messages.sh`, adding the 2 letter [ISO 639](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) language code to the `LANGS` variable.
|
||||
* Run `tools/update_messages.sh LANG` where LANG is the 2 letter [ISO 639](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) language code, this will create files in the `locale` directory for the new language. Fill in the fields, `git add` the files, commit and file a pull request.
|
||||
* (optional) Edit the `tools/check_po.py`, add to the `countries` mapping a value with the language code on the left and the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) code of a flag on the right. The flag will only be used for continuous integration messages.
|
||||
* Run the `tools/update_messages.sh` script, this will create files in the `locale` directory for the new language. Fill in the fields, `git add` the files, commit and file a pull request.
|
||||
|
||||
# Editing existing translations
|
||||
|
||||
Run the `tools/update_messages.sh` script, this will add the lines for the missing translations, edit your language, then `git add` the files for the language you just edited, commit and file a pull request.
|
||||
Run the `tools/update_messages.sh [lang...]` script with the list of languages you wish to edit, this will add the lines for the missing translations, edit them, then `git add` the files for the language you just edited, commit and file a pull request.
|
||||
|
||||
@@ -23,11 +23,19 @@ finish-args:
|
||||
- --system-talk-name=org.freedesktop.Avahi
|
||||
# Allow getting the pretty hostname
|
||||
- --system-talk-name=org.freedesktop.hostname1
|
||||
# List applications from $XDG_DATA_DIRS
|
||||
- --filesystem=host-os:ro
|
||||
- --filesystem=xdg-data:ro
|
||||
# List flatpak Steam games
|
||||
- --filesystem=~/.var/app/com.valvesoftware.Steam:ro
|
||||
# Pipewire
|
||||
- --filesystem=xdg-run/pipewire-0
|
||||
# Set the active OpenXR / OpenVR runtime
|
||||
- --filesystem=xdg-config/openxr:create
|
||||
- --filesystem=xdg-config/openvr:create
|
||||
# SlimeVR
|
||||
- --filesystem=xdg-run/SlimeVRInput
|
||||
- --filesystem=xdg-run/SlimeVRRpc
|
||||
# Let outside application access the WiVRn socket
|
||||
- --filesystem=xdg-run/wivrn:create
|
||||
- --own-name=io.github.wivrn.Server
|
||||
@@ -90,7 +98,8 @@ modules:
|
||||
url: https://www.mpfr.org/mpfr-4.2.1/mpfr-4.2.1.tar.xz
|
||||
sha256: 277807353a6726978996945af13e52829e3abd7a9a5b7fb2793894e18f1fcbb2
|
||||
- type: file
|
||||
url: https://libisl.sourceforge.io/isl-0.26.tar.xz
|
||||
dest-filename: isl-0.26.tar.xz
|
||||
url: https://sourceforge.net/projects/libisl/files/isl-0.26.tar.xz/download
|
||||
sha256: a0b5cb06d24f9fa9e77b55fabbe9a3c94a336190345c2555f9915bb38e976504
|
||||
- type: file
|
||||
url: https://www.multiprecision.org/downloads/mpc-1.3.1.tar.gz
|
||||
@@ -304,7 +313,7 @@ modules:
|
||||
sources:
|
||||
- type: git
|
||||
url: https://github.com/Supreeeme/xrizer.git
|
||||
tag: fcc6793ffeadf0d7676c4cfd5a6c57da481a520c
|
||||
tag: 366be00cdeb3156cf958fa48b49c39ce819cab86
|
||||
- xrizer-gen-src.json
|
||||
|
||||
- name: wivrn-library
|
||||
@@ -371,6 +380,7 @@ modules:
|
||||
- -DWIVRN_USE_NVENC=ON
|
||||
- -DWIVRN_USE_VULKAN_ENCODE=ON
|
||||
- -DWIVRN_USE_PULSEAUDIO=OFF
|
||||
- -DWIVRN_FEATURE_SOLARXR=ON
|
||||
- -DWIVRN_WERROR=ON
|
||||
- -DWIVRN_CHECK_CAPSYSNICE=OFF # Capabilities don't work inside flatpak
|
||||
- -DFETCHCONTENT_FULLY_DISCONNECTED=ON
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 158 KiB |
+276
-153
@@ -5,8 +5,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WiVRn 0.15\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-06-18 21:11+0200\n"
|
||||
"PO-Revision-Date: 2025-06-18 21:25+0200\n"
|
||||
"POT-Creation-Date: 2025-07-30 09:41+0200\n"
|
||||
"PO-Revision-Date: 2025-07-30 14:47+0200\n"
|
||||
"Last-Translator: Guillaume Meunier <guillaume.meunier@centraliens.net>\n"
|
||||
"Language-Team: French <>\n"
|
||||
"Language: French\n"
|
||||
@@ -15,120 +15,127 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Gtranslator 47.1\n"
|
||||
|
||||
#: client/scenes/lobby.cpp:148
|
||||
#: client/scene.cpp:74
|
||||
msgid "No supported swapchain format"
|
||||
msgstr "Aucun format de swapchain supporté"
|
||||
|
||||
#: client/scenes/lobby.cpp:228
|
||||
#: client/scenes/lobby.cpp:185
|
||||
msgid "Incompatible WiVRn server: no protocol field in TXT"
|
||||
msgstr "Serveur WiVRn incompatible : pas de champ protocol dans le TXT"
|
||||
|
||||
#: client/scenes/lobby.cpp:231
|
||||
#: client/scenes/lobby.cpp:188
|
||||
#, c++-format
|
||||
msgid "Incompatible WiVRn server protocol (client: {}, server: {})"
|
||||
msgstr ""
|
||||
"Version du protocole WiVRn du serveur incompatible (client: {}, serveur: {})"
|
||||
|
||||
#: client/scenes/lobby.cpp:246
|
||||
#: client/scenes/lobby.cpp:203
|
||||
#, c++-format
|
||||
msgid "Cannot resolve hostname: {}"
|
||||
msgstr "Impossible de résoudre le nom: {}"
|
||||
|
||||
#: client/scenes/lobby.cpp:333 client/scenes/lobby.cpp:339
|
||||
#: client/scenes/lobby.cpp:290 client/scenes/lobby.cpp:296
|
||||
#, c++-format
|
||||
msgid "Cannot connect to {} ({}): {}"
|
||||
msgstr "Impossible de se connecter à {} ({}): {}"
|
||||
|
||||
#: client/scenes/lobby.cpp:453
|
||||
#: client/scenes/lobby.cpp:379
|
||||
msgid "Waiting for connection"
|
||||
msgstr "Attente de connexion"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:132
|
||||
#: client/scenes/lobby_gui.cpp:156
|
||||
msgctxt "openxr_post_processing"
|
||||
msgid "Normal"
|
||||
msgstr "Normal"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:135
|
||||
#: client/scenes/lobby_gui.cpp:159
|
||||
msgctxt "openxr_post_processing"
|
||||
msgid "Quality"
|
||||
msgstr "Qualité"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:137
|
||||
#: client/scenes/lobby_gui.cpp:161
|
||||
msgctxt "openxr_post_processing"
|
||||
msgid "Disabled"
|
||||
msgstr "Désactivé"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:198
|
||||
#: client/scenes/lobby_gui.cpp:169 client/scenes/lobby_gui.cpp:320
|
||||
#: client/scenes/stream_gui.cpp:812
|
||||
msgid "Disconnect"
|
||||
msgstr "Déconnecter"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:204
|
||||
msgid "Video stream interrupted"
|
||||
msgstr "Flux vidéo interrompu"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:206
|
||||
msgid ""
|
||||
"Connection ready\n"
|
||||
"Start a VR application on your computer"
|
||||
msgstr ""
|
||||
"Connexion prête\n"
|
||||
"Démarrez une application VR sur l'ordinateur"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:208
|
||||
#, c++-format
|
||||
msgid ""
|
||||
"Connection ready\n"
|
||||
"Start a VR application on {}"
|
||||
msgstr ""
|
||||
"Connexion prête\n"
|
||||
"Démarrez une application VR sur {}"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:221
|
||||
#: client/scenes/lobby_gui.cpp:189 client/scenes/stream_gui.cpp:808
|
||||
msgid "Close"
|
||||
msgstr "Fermer"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:227
|
||||
#: client/scenes/lobby_gui.cpp:195
|
||||
msgid "Connection"
|
||||
msgstr "Connexion en cours"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:229
|
||||
#: client/scenes/lobby_gui.cpp:197
|
||||
#, c++-format
|
||||
msgid "Connection to {}"
|
||||
msgstr "Connexion à {}"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:259
|
||||
#: client/scenes/lobby_gui.cpp:227
|
||||
msgid "PIN"
|
||||
msgstr "Code PIN"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:281
|
||||
#: client/scenes/lobby_gui.cpp:249
|
||||
msgid "Input the PIN displayed on the dashboard"
|
||||
msgstr "Entrez le code PIN affiché sur le tableau de bord"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:356
|
||||
#: client/scenes/lobby_gui.cpp:315
|
||||
msgid "Connected to WiVRn server"
|
||||
msgstr "Connecté au serveur WiVRn"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:317
|
||||
#, c++-format
|
||||
msgid "Connected to {}"
|
||||
msgstr "Connecté à {}"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:327
|
||||
msgid "Start an application on the server to start streaming."
|
||||
msgstr ""
|
||||
"Démarrez une application sur le serveur pour commencer la transmission."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:333
|
||||
msgid "Start an application on your computer or select one to start streaming."
|
||||
msgstr ""
|
||||
"Démarrez une application sur le serveur ou depuis la liste pour commencer la "
|
||||
"transmission."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:335
|
||||
#, c++-format
|
||||
msgid "Start an application on {} or select one to start streaming."
|
||||
msgstr ""
|
||||
"Démarrez une application sur {} ou depuis la liste pour commencer la "
|
||||
"transmission."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:383
|
||||
msgid "Name"
|
||||
msgstr "Nom"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:367
|
||||
#: client/scenes/lobby_gui.cpp:394
|
||||
msgid "Address"
|
||||
msgstr "Adresse"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:376
|
||||
#: client/scenes/lobby_gui.cpp:403
|
||||
msgid "Port"
|
||||
msgstr "Port"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:384
|
||||
#: client/scenes/lobby_gui.cpp:411
|
||||
msgid "TCP only"
|
||||
msgstr "TCP seulement"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:391
|
||||
#: client/scenes/lobby_gui.cpp:418
|
||||
msgid "Cancel"
|
||||
msgstr "Annuler"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:405
|
||||
#: client/scenes/lobby_gui.cpp:432
|
||||
msgid "Save"
|
||||
msgstr "Enregistrer"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:458
|
||||
#: client/scenes/lobby_gui.cpp:485
|
||||
msgid ""
|
||||
"Start a WiVRn server on your\n"
|
||||
"local network"
|
||||
@@ -136,32 +143,32 @@ msgstr ""
|
||||
"Démarrez un serveur WiVRn sur\n"
|
||||
"le réseau local"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:490
|
||||
#: client/scenes/lobby_gui.cpp:517
|
||||
msgid "Autoconnect"
|
||||
msgstr "Autoconnexion"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:516
|
||||
#: client/scenes/lobby_gui.cpp:543
|
||||
msgid "Connect"
|
||||
msgstr "Connexion"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:526 client/wivrn_client.cpp:186
|
||||
#: client/scenes/lobby_gui.cpp:553 client/wivrn_client.cpp:186
|
||||
msgid "Incompatible server version"
|
||||
msgstr "Version du serveur incompatible"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:528
|
||||
#: client/scenes/lobby_gui.cpp:555
|
||||
msgid "Server not available"
|
||||
msgstr "Serveur non disponible"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:614
|
||||
#: client/scenes/lobby_gui.cpp:641
|
||||
msgid "Refresh rate"
|
||||
msgstr "Taux de rafraichissement"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:614 client/scenes/lobby_gui.cpp:616
|
||||
#: client/scenes/lobby_gui.cpp:641 client/scenes/lobby_gui.cpp:643
|
||||
msgctxt "automatic refresh rate"
|
||||
msgid "Automatic"
|
||||
msgstr "Automatique"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:623
|
||||
#: client/scenes/lobby_gui.cpp:650
|
||||
msgid ""
|
||||
"Select refresh rate based on measured application performance.\n"
|
||||
"May cause flicker when a change happens."
|
||||
@@ -170,59 +177,59 @@ msgstr ""
|
||||
"des performances mesurées.\n"
|
||||
"Peut causer des clignotements lors du changement de fréquence."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:640
|
||||
#: client/scenes/lobby_gui.cpp:667
|
||||
msgid "Minimum refresh rate"
|
||||
msgstr "Taux minimal"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:663
|
||||
#: client/scenes/lobby_gui.cpp:690
|
||||
msgid "Resolution scale"
|
||||
msgstr "Échelle"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:667 client/scenes/lobby_gui.cpp:971
|
||||
#: client/scenes/lobby_gui.cpp:694 client/scenes/lobby_gui.cpp:933
|
||||
#, c-format, c++-format
|
||||
msgid "%d%% - {}x{} per eye"
|
||||
msgstr "%d%% - {}x{} par œil"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:678 client/scenes/lobby_gui.cpp:982
|
||||
#: client/scenes/lobby_gui.cpp:705 client/scenes/lobby_gui.cpp:944
|
||||
#, c++-format
|
||||
msgid "Resolution larger than {}x{} may not be supported by the headset"
|
||||
msgstr "Les résolutions plus grandes que {}x{} pourraient ne pas fonctionner"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:684
|
||||
#: client/scenes/lobby_gui.cpp:711
|
||||
msgid "Enable microphone"
|
||||
msgstr "Activer le micro"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:694
|
||||
#: client/scenes/lobby_gui.cpp:720
|
||||
msgid "Unprocessed Microphone Audio"
|
||||
msgstr "Utiliser les données brutes du micro"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:700
|
||||
#: client/scenes/lobby_gui.cpp:726
|
||||
msgid "Force disable audio filters, such as noise cancellation"
|
||||
msgstr "Désactive les traitements tels que la suppression du bruit"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:707
|
||||
#: client/scenes/lobby_gui.cpp:733
|
||||
msgid "Enable hand tracking"
|
||||
msgstr "Activer le suivi des mains"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:714 client/scenes/lobby_gui.cpp:727
|
||||
#: client/scenes/lobby_gui.cpp:740 client/scenes/lobby_gui.cpp:757
|
||||
#: client/scenes/lobby_gui.cpp:807
|
||||
#: client/scenes/lobby_gui.cpp:739 client/scenes/lobby_gui.cpp:751
|
||||
#: client/scenes/lobby_gui.cpp:763 client/scenes/lobby_gui.cpp:779
|
||||
#: client/scenes/lobby_gui.cpp:829
|
||||
msgid "This feature is not supported by your headset"
|
||||
msgstr "Cette fonctionnalité n'est pas supportée par le casque"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:720
|
||||
#: client/scenes/lobby_gui.cpp:745
|
||||
msgid "Enable eye tracking"
|
||||
msgstr "Activer le suivi des yeux"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:733
|
||||
#: client/scenes/lobby_gui.cpp:757
|
||||
msgid "Enable face tracking"
|
||||
msgstr "Activer le suivi du visage"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:747
|
||||
#: client/scenes/lobby_gui.cpp:770
|
||||
msgid "Enable body tracking"
|
||||
msgstr "Activer le suivi du corps"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:764
|
||||
#: client/scenes/lobby_gui.cpp:786
|
||||
msgid ""
|
||||
"Requires 'Hand and body tracking' to be enabled in the Quest movement "
|
||||
"tracking settings,\n"
|
||||
@@ -233,11 +240,11 @@ msgstr ""
|
||||
"suivi des mouvements du casque.\n"
|
||||
"Sinon les positions seront déduites de celles des manettes et casque."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:777
|
||||
#: client/scenes/lobby_gui.cpp:799
|
||||
msgid "Enable lower body tracking"
|
||||
msgstr "Activer le suivi du bas du corps"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:783
|
||||
#: client/scenes/lobby_gui.cpp:805
|
||||
msgid ""
|
||||
"Estimate lower body joint positions using Generative Legs\n"
|
||||
"Requires 'Hand and body tracking' to be enabled in the Quest movement "
|
||||
@@ -248,11 +255,11 @@ msgstr ""
|
||||
"paramètres\n"
|
||||
"de suivi de mouvements du casque."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:786
|
||||
#: client/scenes/lobby_gui.cpp:808
|
||||
msgid "Enable hip tracking"
|
||||
msgstr "Activer le suivi des hanches"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:792
|
||||
#: client/scenes/lobby_gui.cpp:814
|
||||
msgid ""
|
||||
"Only takes affect with lower body tracking enabled\n"
|
||||
"May be desired when using another source of hip tracking"
|
||||
@@ -260,45 +267,19 @@ msgstr ""
|
||||
"N'a d'effet que si le suivi du bas du corps est activé.\n"
|
||||
"Peut être utile si les hanches sont suivies via un autre moyen."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:800
|
||||
#: client/scenes/lobby_gui.cpp:822
|
||||
msgid "Enable video passthrough in lobby"
|
||||
msgstr "Activer la vue réelle dans l'accueil"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:810
|
||||
msgid "Show performance metrics"
|
||||
msgstr "Afficher les métriques de performances"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:814
|
||||
msgid "Overlay can be toggled by pressing both thumbsticks"
|
||||
msgstr "L'affichage peut être basculé en appuyant sur les deux joysticks"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:844 client/scenes/lobby_gui.cpp:852
|
||||
#: client/scenes/stream_stats.cpp:159
|
||||
msgid "CPU time"
|
||||
msgstr "Temps CPU"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:848
|
||||
msgid "CPU time [ms]"
|
||||
msgstr "Temps CPU [ms]"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:858 client/scenes/lobby_gui.cpp:866
|
||||
#: client/scenes/stream_stats.cpp:161
|
||||
msgid "GPU time"
|
||||
msgstr "Temps GPU"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:862
|
||||
msgid "GPU time [ms]"
|
||||
msgstr "Temps GPU [ms]"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:881
|
||||
#: client/scenes/lobby_gui.cpp:843 client/scenes/stream_gui.cpp:434
|
||||
msgid "OpenXR post-processing"
|
||||
msgstr "Post-traitement OpenXR"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:885
|
||||
#: client/scenes/lobby_gui.cpp:847 client/scenes/stream_gui.cpp:438
|
||||
msgid "Supersampling"
|
||||
msgstr "Suréchantillonnage"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:905
|
||||
#: client/scenes/lobby_gui.cpp:867 client/scenes/stream_gui.cpp:459
|
||||
msgid ""
|
||||
"Reduce flicker for high contrast edges.\n"
|
||||
"Useful when the input resolution is high compared to the headset display"
|
||||
@@ -306,11 +287,11 @@ msgstr ""
|
||||
"Réduit le scintillement des contours à haut contraste.\n"
|
||||
"Utile quand la résolution d’entrée est haute comparée à l’écran du casque"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:910
|
||||
#: client/scenes/lobby_gui.cpp:872 client/scenes/stream_gui.cpp:464
|
||||
msgid "Sharpening"
|
||||
msgstr "Affinage de netteté"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:930
|
||||
#: client/scenes/lobby_gui.cpp:892 client/scenes/stream_gui.cpp:485
|
||||
msgid ""
|
||||
"Improve clarity of high contrast edges and counteract blur.\n"
|
||||
"Useful when the input resolution is low compared to the headset display"
|
||||
@@ -318,11 +299,11 @@ msgstr ""
|
||||
"Améliore la clarté des contours à haut contraste et réduit le flou.\n"
|
||||
"Utile quand la résolution d’entrée est basse comparée à l’écran du casque"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:939
|
||||
#: client/scenes/lobby_gui.cpp:901
|
||||
msgid "Enable Snapdragon Game Super Resolution"
|
||||
msgstr "Activer Snapdragon Game Super Resolution"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:947
|
||||
#: client/scenes/lobby_gui.cpp:909
|
||||
msgid ""
|
||||
"On this headset, this setting has been fully superseded by the native "
|
||||
"Sharpening setting above.\n"
|
||||
@@ -332,186 +313,292 @@ msgstr ""
|
||||
"de netteté ci-dessus.\n"
|
||||
"N’activer que si vous savez ce que vous faites."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:949
|
||||
#: client/scenes/lobby_gui.cpp:911
|
||||
msgid ""
|
||||
"Client-side upscaling and sharpening, adds a performance cost on the headset"
|
||||
msgstr ""
|
||||
"Mise à l’échelle et affinage de netteté, ajoute un coût en performances pour "
|
||||
"le casque"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:967
|
||||
#: client/scenes/lobby_gui.cpp:929
|
||||
msgid "Upscaling factor"
|
||||
msgstr "Échelle"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:986
|
||||
#: client/scenes/lobby_gui.cpp:948
|
||||
msgid "Use edge direction"
|
||||
msgstr "Utiliser la direction de contours"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:992
|
||||
#: client/scenes/lobby_gui.cpp:954
|
||||
msgid "Adds an additional performance cost"
|
||||
msgstr "Ajoute un coût additionnel en performances"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:997
|
||||
#: client/scenes/lobby_gui.cpp:959
|
||||
msgid "Edge threshold"
|
||||
msgstr "Seuil de contour"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1004 client/scenes/lobby_gui.cpp:1013
|
||||
#: client/scenes/lobby_gui.cpp:966 client/scenes/lobby_gui.cpp:975
|
||||
#, c++-format
|
||||
msgid "Recommended: {:.1f}"
|
||||
msgstr "Recommandé : {:.1f}"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1007
|
||||
#: client/scenes/lobby_gui.cpp:969
|
||||
msgid "Edge sharpness"
|
||||
msgstr "Netteté de contour"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1101 client/scenes/lobby_gui.cpp:1757
|
||||
#: client/scenes/lobby_gui.cpp:1071 client/scenes/lobby_gui.cpp:1079
|
||||
#: client/scenes/stream_gui.cpp:222 client/scenes/stream_gui.cpp:418
|
||||
msgid "CPU time"
|
||||
msgstr "Temps CPU"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1075
|
||||
msgid "CPU time [ms]"
|
||||
msgstr "Temps CPU [ms]"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1085 client/scenes/lobby_gui.cpp:1093
|
||||
#: client/scenes/stream_gui.cpp:224 client/scenes/stream_gui.cpp:419
|
||||
msgid "GPU time"
|
||||
msgstr "Temps GPU"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1089
|
||||
msgid "GPU time [ms]"
|
||||
msgstr "Temps GPU [ms]"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1132
|
||||
msgid "Enable the microphone?"
|
||||
msgstr "Activer le micro ?"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1137
|
||||
msgid "Enable eye tracking?"
|
||||
msgstr "Activer le suivi des yeux ?"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1142
|
||||
msgid "Enable face tracking?"
|
||||
msgstr "Activer le suivi du visage ?"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1147
|
||||
msgid "Enable body tracking?"
|
||||
msgstr "Activer le suivi du corps ?"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1155
|
||||
msgid "Welcome to WiVRn"
|
||||
msgstr "Bienvenue sur WiVRn"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1179
|
||||
msgid "Yes"
|
||||
msgstr "Oui"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1186
|
||||
msgid "No"
|
||||
msgstr "Non"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1205 client/scenes/lobby_gui.cpp:1844
|
||||
msgid "Licenses"
|
||||
msgstr "Licences"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1440
|
||||
#: client/scenes/lobby_gui.cpp:1519
|
||||
msgid "Microphone is enabled"
|
||||
msgstr "Le micro est activé"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1441
|
||||
#: client/scenes/lobby_gui.cpp:1520
|
||||
msgid "Microphone is disabled"
|
||||
msgstr "Le micro est désactivé"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1450
|
||||
#: client/scenes/lobby_gui.cpp:1529
|
||||
msgid "Hand tracking is enabled"
|
||||
msgstr "Le suivi des mains est activé"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1451
|
||||
#: client/scenes/lobby_gui.cpp:1530
|
||||
msgid "Hand tracking is disabled"
|
||||
msgstr "Le suivi des mains est désactivé"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1460
|
||||
#: client/scenes/lobby_gui.cpp:1539
|
||||
msgid "Eye tracking is enabled"
|
||||
msgstr "Le suivi des yeux est activé"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1461
|
||||
#: client/scenes/lobby_gui.cpp:1540
|
||||
msgid "Eye tracking is disabled"
|
||||
msgstr "Le suivi des yeux est désactivé"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1471 client/scenes/lobby_gui.cpp:1482
|
||||
#: client/scenes/lobby_gui.cpp:1553
|
||||
msgid "Face tracking is enabled"
|
||||
msgstr "Le suivi du visage est activé"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1472 client/scenes/lobby_gui.cpp:1483
|
||||
#: client/scenes/lobby_gui.cpp:1554
|
||||
msgid "Face tracking is disabled"
|
||||
msgstr "Le suivi du visage est désactivé"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1493
|
||||
#: client/scenes/lobby_gui.cpp:1564
|
||||
msgid "Body tracking is enabled"
|
||||
msgstr "Le suivi du corps est activé"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1494
|
||||
#: client/scenes/lobby_gui.cpp:1565
|
||||
msgid "Body tracking is disabled"
|
||||
msgstr "Le suivi du corps est désactivé"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1510
|
||||
#: client/scenes/lobby_gui.cpp:1581
|
||||
msgid "Add server"
|
||||
msgstr "Ajouter un serveur"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1739
|
||||
#: client/scenes/lobby_gui.cpp:1826
|
||||
msgid "Server list"
|
||||
msgstr "Serveurs"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1742
|
||||
#: client/scenes/lobby_gui.cpp:1829 client/scenes/stream_gui.cpp:796
|
||||
msgid "Settings"
|
||||
msgstr "Paramètres"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1745
|
||||
#: client/scenes/lobby_gui.cpp:1832
|
||||
msgid "Post-processing"
|
||||
msgstr "Post-traitement"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1749
|
||||
#: client/scenes/lobby_gui.cpp:1836
|
||||
msgid "Debug"
|
||||
msgstr "Debug"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1754
|
||||
#: client/scenes/lobby_gui.cpp:1841
|
||||
msgid "About"
|
||||
msgstr "À propos"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1760
|
||||
#: client/scenes/lobby_gui.cpp:1847
|
||||
msgid "Exit"
|
||||
msgstr "Quitter"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1774
|
||||
#: client/scenes/lobby_gui.cpp:1864
|
||||
msgid ""
|
||||
"Press A or X or put your palm up\n"
|
||||
"Press the grip button or put your palm up\n"
|
||||
"to move the main window"
|
||||
msgstr ""
|
||||
"Appuyez sur A ou X ou placez votre paume\n"
|
||||
"vers le haut pour déplacer la fenêtre principale"
|
||||
"Serrez la gâchette latérale ou pointez la paume\n"
|
||||
"vers le haut pour bouger la fenêtre principale"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1776
|
||||
msgid "Press A or X to move the main window"
|
||||
#: client/scenes/lobby_gui.cpp:1866
|
||||
msgid "Press the grip button to move the main window"
|
||||
msgstr ""
|
||||
"Appuyez sur A ou X pour\n"
|
||||
"déplacer la fenêtre principale"
|
||||
"Serrez la gâchette latérale pour bouger la\n"
|
||||
"fenêtre principale"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:161
|
||||
#: client/scenes/stream_gui.cpp:224
|
||||
msgid "Reproject"
|
||||
msgstr "Reprojection"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:162
|
||||
#: client/scenes/stream_gui.cpp:225
|
||||
msgid "Blit"
|
||||
msgstr "Copie"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:164
|
||||
#: client/scenes/stream_gui.cpp:227
|
||||
msgid "Network"
|
||||
msgstr "Réseau"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:164
|
||||
#: client/scenes/stream_gui.cpp:227 client/scenes/stream_gui.cpp:416
|
||||
msgid "Download"
|
||||
msgstr "Téléchargement"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:165
|
||||
#: client/scenes/stream_gui.cpp:228 client/scenes/stream_gui.cpp:417
|
||||
msgid "Upload"
|
||||
msgstr "Téléversement"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:234
|
||||
#: client/scenes/stream_gui.cpp:297
|
||||
#, c++-format
|
||||
msgid "Decoder {}"
|
||||
msgstr "Décodeur {}"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:246
|
||||
#: client/scenes/stream_gui.cpp:309
|
||||
msgid "Timings [ms]"
|
||||
msgstr "Durées [ms]"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:306
|
||||
#: client/scenes/stream_gui.cpp:369
|
||||
msgid "Encode"
|
||||
msgstr "Encodage"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:307
|
||||
#: client/scenes/stream_gui.cpp:370
|
||||
msgid "Send"
|
||||
msgstr "Envoi"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:308
|
||||
#: client/scenes/stream_gui.cpp:371
|
||||
msgid "Receive"
|
||||
msgstr "Réception"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:309
|
||||
#: client/scenes/stream_gui.cpp:372
|
||||
msgid "Decode"
|
||||
msgstr "Décodage"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:310
|
||||
#: client/scenes/stream_gui.cpp:373
|
||||
msgid "Blitted"
|
||||
msgstr "Copie"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:311
|
||||
#: client/scenes/stream_gui.cpp:374
|
||||
msgid "Displayed"
|
||||
msgstr "Affichage"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:312
|
||||
#: client/scenes/stream_gui.cpp:375
|
||||
msgid "Predicted"
|
||||
msgstr "Prédiction"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:330
|
||||
#: client/scenes/stream_gui.cpp:393
|
||||
#, c++-format
|
||||
msgid "Estimated motion to photons latency: {}ms"
|
||||
msgstr "Latence mouvement à photons estimée: {}ms"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:396
|
||||
msgid "Press the grip button to move the window"
|
||||
msgstr ""
|
||||
"Serrez la gâchette latérale pour bouger\n"
|
||||
"la fenêtre"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:398 client/scenes/stream_gui.cpp:750
|
||||
msgid "Press both thumbsticks to display the WiVRn window"
|
||||
msgstr "Appuyez sur les deux sticks pour afficher la fenêtre de WiVRn"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:420
|
||||
msgid "Motion to photon latency"
|
||||
msgstr "Latence mouvements à photons"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:492
|
||||
msgid "Foveation center override"
|
||||
msgstr "Zone de fovéation manuelle"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:495
|
||||
msgid "Enable"
|
||||
msgstr "Activer"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:503 client/scenes/stream_gui.cpp:550
|
||||
#, c++-format
|
||||
msgid "Height {:.1f} deg"
|
||||
msgstr "Hauteur: {:.1f} deg"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:504 client/scenes/stream_gui.cpp:551
|
||||
#, c++-format
|
||||
msgid "Distance {:.2f} m"
|
||||
msgstr "Distance {:.2f} m"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:505
|
||||
msgid "Default"
|
||||
msgstr "Réinitialiser"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:516
|
||||
msgid "Change"
|
||||
msgstr "Ajuster"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:548
|
||||
msgid "Use the thumbsticks to move the foveation center"
|
||||
msgstr "Utiliser le stick pour bouger le centre de fovéation"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:549
|
||||
msgid "Press A to save or B to cancel"
|
||||
msgstr "A pour sauvegarder, B pour annuler"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:793
|
||||
msgid "Stats"
|
||||
msgstr "Statistiques"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:802
|
||||
msgid "Statistics overlay"
|
||||
msgstr "Statistiques seules"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:805
|
||||
msgid "Compact view"
|
||||
msgstr "Vue compacte"
|
||||
|
||||
#: client/wivrn_client.cpp:98 client/wivrn_client.cpp:202
|
||||
msgid "Timeout"
|
||||
msgstr "Temps d'attente dépassé"
|
||||
@@ -527,3 +614,39 @@ msgstr "Impossible de vérifier le code PIN"
|
||||
#: client/wivrn_client.cpp:182
|
||||
msgid "Pairing is disabled on server"
|
||||
msgstr "L'appairage est désactivé sur le serveur"
|
||||
|
||||
#~ msgid "Video stream interrupted"
|
||||
#~ msgstr "Flux vidéo interrompu"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Connection ready\n"
|
||||
#~ "Start a VR application on your computer"
|
||||
#~ msgstr ""
|
||||
#~ "Connexion prête\n"
|
||||
#~ "Démarrez une application VR sur l'ordinateur"
|
||||
|
||||
#, c++-format
|
||||
#~ msgid ""
|
||||
#~ "Connection ready\n"
|
||||
#~ "Start a VR application on {}"
|
||||
#~ msgstr ""
|
||||
#~ "Connexion prête\n"
|
||||
#~ "Démarrez une application VR sur {}"
|
||||
|
||||
#~ msgid "Show performance metrics"
|
||||
#~ msgstr "Afficher les métriques de performances"
|
||||
|
||||
#~ msgid "Overlay can be toggled by pressing both thumbsticks"
|
||||
#~ msgstr "L'affichage peut être basculé en appuyant sur les deux joysticks"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Press A or X or put your palm up\n"
|
||||
#~ "to move the main window"
|
||||
#~ msgstr ""
|
||||
#~ "Appuyez sur A ou X ou placez votre paume\n"
|
||||
#~ "vers le haut pour déplacer la fenêtre principale"
|
||||
|
||||
#~ msgid "Press A or X to move the main window"
|
||||
#~ msgstr ""
|
||||
#~ "Appuyez sur A ou X pour\n"
|
||||
#~ "déplacer la fenêtre principale"
|
||||
|
||||
+273
-152
@@ -5,8 +5,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WiVRn 0.15\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-06-18 21:11+0200\n"
|
||||
"PO-Revision-Date: 2025-06-18 21:32+0200\n"
|
||||
"POT-Creation-Date: 2025-07-30 09:41+0200\n"
|
||||
"PO-Revision-Date: 2025-07-30 09:59+0200\n"
|
||||
"Last-Translator: Albano Battistella <albanobattistella@gmail.com>\n"
|
||||
"Language-Team: Italian <>\n"
|
||||
"Language: Italian\n"
|
||||
@@ -15,119 +15,125 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Gtranslator 47.1\n"
|
||||
|
||||
#: client/scenes/lobby.cpp:148
|
||||
#: client/scene.cpp:74
|
||||
msgid "No supported swapchain format"
|
||||
msgstr "Nessun formato swapchain supportato"
|
||||
|
||||
#: client/scenes/lobby.cpp:228
|
||||
#: client/scenes/lobby.cpp:185
|
||||
msgid "Incompatible WiVRn server: no protocol field in TXT"
|
||||
msgstr "Server WiVRn incompatibile: nessun campo protocollo in TXT"
|
||||
|
||||
#: client/scenes/lobby.cpp:231
|
||||
#: client/scenes/lobby.cpp:188
|
||||
#, c++-format
|
||||
msgid "Incompatible WiVRn server protocol (client: {}, server: {})"
|
||||
msgstr "Protocollo server WiVRn incompatibile (client: {}, server: {})"
|
||||
|
||||
#: client/scenes/lobby.cpp:246
|
||||
#: client/scenes/lobby.cpp:203
|
||||
#, c++-format
|
||||
msgid "Cannot resolve hostname: {}"
|
||||
msgstr "Impossibile risolvere il nome host: {}"
|
||||
|
||||
#: client/scenes/lobby.cpp:333 client/scenes/lobby.cpp:339
|
||||
#: client/scenes/lobby.cpp:290 client/scenes/lobby.cpp:296
|
||||
#, c++-format
|
||||
msgid "Cannot connect to {} ({}): {}"
|
||||
msgstr "Impossibile connettersi a {} ({}): {}"
|
||||
|
||||
#: client/scenes/lobby.cpp:453
|
||||
#: client/scenes/lobby.cpp:379
|
||||
msgid "Waiting for connection"
|
||||
msgstr "In attesa di connessione"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:132
|
||||
#: client/scenes/lobby_gui.cpp:156
|
||||
msgctxt "openxr_post_processing"
|
||||
msgid "Normal"
|
||||
msgstr "Normale"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:135
|
||||
#: client/scenes/lobby_gui.cpp:159
|
||||
msgctxt "openxr_post_processing"
|
||||
msgid "Quality"
|
||||
msgstr "Alta qualità"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:137
|
||||
#: client/scenes/lobby_gui.cpp:161
|
||||
msgctxt "openxr_post_processing"
|
||||
msgid "Disabled"
|
||||
msgstr "Disattivato"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:198
|
||||
#: client/scenes/lobby_gui.cpp:169 client/scenes/lobby_gui.cpp:320
|
||||
#: client/scenes/stream_gui.cpp:812
|
||||
msgid "Disconnect"
|
||||
msgstr "Sconnetti"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:204
|
||||
msgid "Video stream interrupted"
|
||||
msgstr "Flusso video interrotto"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:206
|
||||
msgid ""
|
||||
"Connection ready\n"
|
||||
"Start a VR application on your computer"
|
||||
msgstr ""
|
||||
"Connessione pronta\n"
|
||||
"Avvia un'applicazione VR sul computer"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:208
|
||||
#, c++-format
|
||||
msgid ""
|
||||
"Connection ready\n"
|
||||
"Start a VR application on {}"
|
||||
msgstr ""
|
||||
"Connessione pronta\n"
|
||||
"Avvia un'applicazione VR su {}"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:221
|
||||
#: client/scenes/lobby_gui.cpp:189 client/scenes/stream_gui.cpp:808
|
||||
msgid "Close"
|
||||
msgstr "Chiudi"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:227
|
||||
#: client/scenes/lobby_gui.cpp:195
|
||||
msgid "Connection"
|
||||
msgstr "Connessione"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:229
|
||||
#: client/scenes/lobby_gui.cpp:197
|
||||
#, c++-format
|
||||
msgid "Connection to {}"
|
||||
msgstr "Connessione a {}"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:259
|
||||
#: client/scenes/lobby_gui.cpp:227
|
||||
msgid "PIN"
|
||||
msgstr "PIN"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:281
|
||||
#: client/scenes/lobby_gui.cpp:249
|
||||
msgid "Input the PIN displayed on the dashboard"
|
||||
msgstr "Digitare il PIN visibile sul server"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:356
|
||||
#: client/scenes/lobby_gui.cpp:315
|
||||
msgid "Connected to WiVRn server"
|
||||
msgstr "Connesso al server WiVRn"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:317
|
||||
#, c++-format
|
||||
msgid "Connected to {}"
|
||||
msgstr "Connesso a {}"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:327
|
||||
msgid "Start an application on the server to start streaming."
|
||||
msgstr "Avvia un applicazione sul server per incominciare a trasmettere."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:333
|
||||
msgid "Start an application on your computer or select one to start streaming."
|
||||
msgstr ""
|
||||
"Avvia un applicazione sul computer o scegli dalla lista per incominciare a "
|
||||
"trasmettere."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:335
|
||||
#, c++-format
|
||||
msgid "Start an application on {} or select one to start streaming."
|
||||
msgstr ""
|
||||
"Avvia un applicazione su {} o scegli dalla lista per incominciare a "
|
||||
"trasmettere."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:383
|
||||
msgid "Name"
|
||||
msgstr "Nome"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:367
|
||||
#: client/scenes/lobby_gui.cpp:394
|
||||
msgid "Address"
|
||||
msgstr "Indirizzo"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:376
|
||||
#: client/scenes/lobby_gui.cpp:403
|
||||
msgid "Port"
|
||||
msgstr "Porta"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:384
|
||||
#: client/scenes/lobby_gui.cpp:411
|
||||
msgid "TCP only"
|
||||
msgstr "Solo TCP"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:391
|
||||
#: client/scenes/lobby_gui.cpp:418
|
||||
msgid "Cancel"
|
||||
msgstr "Annulla"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:405
|
||||
#: client/scenes/lobby_gui.cpp:432
|
||||
msgid "Save"
|
||||
msgstr "Salva"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:458
|
||||
#: client/scenes/lobby_gui.cpp:485
|
||||
msgid ""
|
||||
"Start a WiVRn server on your\n"
|
||||
"local network"
|
||||
@@ -135,32 +141,32 @@ msgstr ""
|
||||
"Avvia un server WiVRn sulla\n"
|
||||
"rete locale"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:490
|
||||
#: client/scenes/lobby_gui.cpp:517
|
||||
msgid "Autoconnect"
|
||||
msgstr "Connessione automatica"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:516
|
||||
#: client/scenes/lobby_gui.cpp:543
|
||||
msgid "Connect"
|
||||
msgstr "Connetti"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:526 client/wivrn_client.cpp:186
|
||||
#: client/scenes/lobby_gui.cpp:553 client/wivrn_client.cpp:186
|
||||
msgid "Incompatible server version"
|
||||
msgstr "Versione del server incompatibile"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:528
|
||||
#: client/scenes/lobby_gui.cpp:555
|
||||
msgid "Server not available"
|
||||
msgstr "Server non disponibile"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:614
|
||||
#: client/scenes/lobby_gui.cpp:641
|
||||
msgid "Refresh rate"
|
||||
msgstr "Frequenza di aggiornamento"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:614 client/scenes/lobby_gui.cpp:616
|
||||
#: client/scenes/lobby_gui.cpp:641 client/scenes/lobby_gui.cpp:643
|
||||
msgctxt "automatic refresh rate"
|
||||
msgid "Automatic"
|
||||
msgstr "Automatica"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:623
|
||||
#: client/scenes/lobby_gui.cpp:650
|
||||
msgid ""
|
||||
"Select refresh rate based on measured application performance.\n"
|
||||
"May cause flicker when a change happens."
|
||||
@@ -169,60 +175,60 @@ msgstr ""
|
||||
"misurate dell'applicazione.\n"
|
||||
"Può causare un flash quando avviene il cambiamento."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:640
|
||||
#: client/scenes/lobby_gui.cpp:667
|
||||
msgid "Minimum refresh rate"
|
||||
msgstr "Frequenza minima"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:663
|
||||
#: client/scenes/lobby_gui.cpp:690
|
||||
msgid "Resolution scale"
|
||||
msgstr "Scala di risoluzione"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:667 client/scenes/lobby_gui.cpp:971
|
||||
#: client/scenes/lobby_gui.cpp:694 client/scenes/lobby_gui.cpp:933
|
||||
#, c-format, c++-format
|
||||
msgid "%d%% - {}x{} per eye"
|
||||
msgstr "%d%% - {}x{} per occhio"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:678 client/scenes/lobby_gui.cpp:982
|
||||
#: client/scenes/lobby_gui.cpp:705 client/scenes/lobby_gui.cpp:944
|
||||
#, c++-format
|
||||
msgid "Resolution larger than {}x{} may not be supported by the headset"
|
||||
msgstr ""
|
||||
"Le risoluzioni superiori a {}x{} potrebbero non essere supportate dal visore"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:684
|
||||
#: client/scenes/lobby_gui.cpp:711
|
||||
msgid "Enable microphone"
|
||||
msgstr "Attiva il microfono"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:694
|
||||
#: client/scenes/lobby_gui.cpp:720
|
||||
msgid "Unprocessed Microphone Audio"
|
||||
msgstr "Usare dati grezzi del microfono"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:700
|
||||
#: client/scenes/lobby_gui.cpp:726
|
||||
msgid "Force disable audio filters, such as noise cancellation"
|
||||
msgstr "Disattiva gli effetti come la cancellazione del rumore"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:707
|
||||
#: client/scenes/lobby_gui.cpp:733
|
||||
msgid "Enable hand tracking"
|
||||
msgstr "Abilita il tracciamento delle mani"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:714 client/scenes/lobby_gui.cpp:727
|
||||
#: client/scenes/lobby_gui.cpp:740 client/scenes/lobby_gui.cpp:757
|
||||
#: client/scenes/lobby_gui.cpp:807
|
||||
#: client/scenes/lobby_gui.cpp:739 client/scenes/lobby_gui.cpp:751
|
||||
#: client/scenes/lobby_gui.cpp:763 client/scenes/lobby_gui.cpp:779
|
||||
#: client/scenes/lobby_gui.cpp:829
|
||||
msgid "This feature is not supported by your headset"
|
||||
msgstr "Questa funzionalità non è supportata dal visore"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:720
|
||||
#: client/scenes/lobby_gui.cpp:745
|
||||
msgid "Enable eye tracking"
|
||||
msgstr "Abilita il tracciamento oculare"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:733
|
||||
#: client/scenes/lobby_gui.cpp:757
|
||||
msgid "Enable face tracking"
|
||||
msgstr "Abilita il tracciamento facciale"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:747
|
||||
#: client/scenes/lobby_gui.cpp:770
|
||||
msgid "Enable body tracking"
|
||||
msgstr "Abilita il tracciamento del corpo"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:764
|
||||
#: client/scenes/lobby_gui.cpp:786
|
||||
msgid ""
|
||||
"Requires 'Hand and body tracking' to be enabled in the Quest movement "
|
||||
"tracking settings,\n"
|
||||
@@ -235,11 +241,11 @@ msgstr ""
|
||||
"controller e\n"
|
||||
"del visore."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:777
|
||||
#: client/scenes/lobby_gui.cpp:799
|
||||
msgid "Enable lower body tracking"
|
||||
msgstr "Abilita il tracciamento del basso del corpo"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:783
|
||||
#: client/scenes/lobby_gui.cpp:805
|
||||
msgid ""
|
||||
"Estimate lower body joint positions using Generative Legs\n"
|
||||
"Requires 'Hand and body tracking' to be enabled in the Quest movement "
|
||||
@@ -250,11 +256,11 @@ msgstr ""
|
||||
"impostazioni,\n"
|
||||
"sezione \"Tracking dei movimenti\"."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:786
|
||||
#: client/scenes/lobby_gui.cpp:808
|
||||
msgid "Enable hip tracking"
|
||||
msgstr "Abilitia il tracciamento delle anche"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:792
|
||||
#: client/scenes/lobby_gui.cpp:814
|
||||
msgid ""
|
||||
"Only takes affect with lower body tracking enabled\n"
|
||||
"May be desired when using another source of hip tracking"
|
||||
@@ -263,45 +269,19 @@ msgstr ""
|
||||
"Può essere utile se un altro metodo viene usato per il tracciamento\n"
|
||||
"delle anche."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:800
|
||||
#: client/scenes/lobby_gui.cpp:822
|
||||
msgid "Enable video passthrough in lobby"
|
||||
msgstr "Abilita la visualizzazione reale in ingresso"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:810
|
||||
msgid "Show performance metrics"
|
||||
msgstr "Mostra metriche delle prestazioni"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:814
|
||||
msgid "Overlay can be toggled by pressing both thumbsticks"
|
||||
msgstr "È possibile alternare la visualizzazione premendo entrambi i joystick"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:844 client/scenes/lobby_gui.cpp:852
|
||||
#: client/scenes/stream_stats.cpp:159
|
||||
msgid "CPU time"
|
||||
msgstr "Tempo CPU"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:848
|
||||
msgid "CPU time [ms]"
|
||||
msgstr "Tempo CPU [ms]"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:858 client/scenes/lobby_gui.cpp:866
|
||||
#: client/scenes/stream_stats.cpp:161
|
||||
msgid "GPU time"
|
||||
msgstr "Tempo GPU"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:862
|
||||
msgid "GPU time [ms]"
|
||||
msgstr "Tempo GPU [ms]"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:881
|
||||
#: client/scenes/lobby_gui.cpp:843 client/scenes/stream_gui.cpp:434
|
||||
msgid "OpenXR post-processing"
|
||||
msgstr "Post-trattamento OpenXR"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:885
|
||||
#: client/scenes/lobby_gui.cpp:847 client/scenes/stream_gui.cpp:438
|
||||
msgid "Supersampling"
|
||||
msgstr "Supersamping"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:905
|
||||
#: client/scenes/lobby_gui.cpp:867 client/scenes/stream_gui.cpp:459
|
||||
msgid ""
|
||||
"Reduce flicker for high contrast edges.\n"
|
||||
"Useful when the input resolution is high compared to the headset display"
|
||||
@@ -309,11 +289,11 @@ msgstr ""
|
||||
"Riduce i lampeggiamenti sui bordi ad alto contrasto.\n"
|
||||
"Utile quando la risoluzine d'entrata è alta in confronto a quella del visore"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:910
|
||||
#: client/scenes/lobby_gui.cpp:872 client/scenes/stream_gui.cpp:464
|
||||
msgid "Sharpening"
|
||||
msgstr "Miglioramento della nitidezza"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:930
|
||||
#: client/scenes/lobby_gui.cpp:892 client/scenes/stream_gui.cpp:485
|
||||
msgid ""
|
||||
"Improve clarity of high contrast edges and counteract blur.\n"
|
||||
"Useful when the input resolution is low compared to the headset display"
|
||||
@@ -322,195 +302,301 @@ msgstr ""
|
||||
"Utile quando la risoluzione d'entrate è bassa in contronto a quella del "
|
||||
"visore"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:939
|
||||
#: client/scenes/lobby_gui.cpp:901
|
||||
msgid "Enable Snapdragon Game Super Resolution"
|
||||
msgstr "Attivare Snapdragon Game Super Resolution"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:947
|
||||
#: client/scenes/lobby_gui.cpp:909
|
||||
msgid ""
|
||||
"On this headset, this setting has been fully superseded by the native "
|
||||
"Sharpening setting above.\n"
|
||||
"Only enable if you know what you're doing."
|
||||
msgstr "Su questo visore è consigliato usare il post-trattamento OpenXR."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:949
|
||||
#: client/scenes/lobby_gui.cpp:911
|
||||
msgid ""
|
||||
"Client-side upscaling and sharpening, adds a performance cost on the headset"
|
||||
msgstr ""
|
||||
"Aumento della risoluzione e nitidezza sul visore, diminuisce le prestazioni "
|
||||
"sul visore"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:967
|
||||
#: client/scenes/lobby_gui.cpp:929
|
||||
msgid "Upscaling factor"
|
||||
msgstr "Aumento di risoluzione"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:986
|
||||
#: client/scenes/lobby_gui.cpp:948
|
||||
msgid "Use edge direction"
|
||||
msgstr "Usare la direzione dei bordi"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:992
|
||||
#: client/scenes/lobby_gui.cpp:954
|
||||
msgid "Adds an additional performance cost"
|
||||
msgstr "Riduce le prestazioni"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:997
|
||||
#: client/scenes/lobby_gui.cpp:959
|
||||
msgid "Edge threshold"
|
||||
msgstr "Soglia dei bordi"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1004 client/scenes/lobby_gui.cpp:1013
|
||||
#: client/scenes/lobby_gui.cpp:966 client/scenes/lobby_gui.cpp:975
|
||||
#, c++-format
|
||||
msgid "Recommended: {:.1f}"
|
||||
msgstr "Valore consigliato: {:.1f}"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1007
|
||||
#: client/scenes/lobby_gui.cpp:969
|
||||
msgid "Edge sharpness"
|
||||
msgstr "Nitidezza dei bordi"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1101 client/scenes/lobby_gui.cpp:1757
|
||||
#: client/scenes/lobby_gui.cpp:1071 client/scenes/lobby_gui.cpp:1079
|
||||
#: client/scenes/stream_gui.cpp:222 client/scenes/stream_gui.cpp:418
|
||||
msgid "CPU time"
|
||||
msgstr "Tempo CPU"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1075
|
||||
msgid "CPU time [ms]"
|
||||
msgstr "Tempo CPU [ms]"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1085 client/scenes/lobby_gui.cpp:1093
|
||||
#: client/scenes/stream_gui.cpp:224 client/scenes/stream_gui.cpp:419
|
||||
msgid "GPU time"
|
||||
msgstr "Tempo GPU"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1089
|
||||
msgid "GPU time [ms]"
|
||||
msgstr "Tempo GPU [ms]"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1132
|
||||
msgid "Enable the microphone?"
|
||||
msgstr "Attivare il microfono?"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1137
|
||||
msgid "Enable eye tracking?"
|
||||
msgstr "Attivare il tracciamento oculare?"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1142
|
||||
msgid "Enable face tracking?"
|
||||
msgstr "Attivare il tracciamento facciale?"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1147
|
||||
msgid "Enable body tracking?"
|
||||
msgstr "Attivare il tracciamento del corpo?"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1155
|
||||
msgid "Welcome to WiVRn"
|
||||
msgstr "Benvenuto su WiVRn"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1179
|
||||
msgid "Yes"
|
||||
msgstr "Sì"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1186
|
||||
msgid "No"
|
||||
msgstr "No"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1205 client/scenes/lobby_gui.cpp:1844
|
||||
msgid "Licenses"
|
||||
msgstr "Licenze"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1440
|
||||
#: client/scenes/lobby_gui.cpp:1519
|
||||
msgid "Microphone is enabled"
|
||||
msgstr "Microfono attivo"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1441
|
||||
#: client/scenes/lobby_gui.cpp:1520
|
||||
msgid "Microphone is disabled"
|
||||
msgstr "Microfono disattivato"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1450
|
||||
#: client/scenes/lobby_gui.cpp:1529
|
||||
msgid "Hand tracking is enabled"
|
||||
msgstr "Tracciamento delle mani attivo"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1451
|
||||
#: client/scenes/lobby_gui.cpp:1530
|
||||
msgid "Hand tracking is disabled"
|
||||
msgstr "Tracciamento delle mani disattivato"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1460
|
||||
#: client/scenes/lobby_gui.cpp:1539
|
||||
msgid "Eye tracking is enabled"
|
||||
msgstr "Tracciamento oculare attivo"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1461
|
||||
#: client/scenes/lobby_gui.cpp:1540
|
||||
msgid "Eye tracking is disabled"
|
||||
msgstr "Tracciamento oculare disattivato"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1471 client/scenes/lobby_gui.cpp:1482
|
||||
#: client/scenes/lobby_gui.cpp:1553
|
||||
msgid "Face tracking is enabled"
|
||||
msgstr "Tracciamento facciale attivato"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1472 client/scenes/lobby_gui.cpp:1483
|
||||
#: client/scenes/lobby_gui.cpp:1554
|
||||
msgid "Face tracking is disabled"
|
||||
msgstr "Tracciamento facciale disattivato"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1493
|
||||
#: client/scenes/lobby_gui.cpp:1564
|
||||
msgid "Body tracking is enabled"
|
||||
msgstr "Tracciamento del corpo attivato"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1494
|
||||
#: client/scenes/lobby_gui.cpp:1565
|
||||
msgid "Body tracking is disabled"
|
||||
msgstr "Tracciamento del corpo disattivato"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1510
|
||||
#: client/scenes/lobby_gui.cpp:1581
|
||||
msgid "Add server"
|
||||
msgstr "Aggiungi server"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1739
|
||||
#: client/scenes/lobby_gui.cpp:1826
|
||||
msgid "Server list"
|
||||
msgstr "Elenco dei server"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1742
|
||||
#: client/scenes/lobby_gui.cpp:1829 client/scenes/stream_gui.cpp:796
|
||||
msgid "Settings"
|
||||
msgstr "Impostazioni"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1745
|
||||
#: client/scenes/lobby_gui.cpp:1832
|
||||
msgid "Post-processing"
|
||||
msgstr "Post-trattamento"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1749
|
||||
#: client/scenes/lobby_gui.cpp:1836
|
||||
msgid "Debug"
|
||||
msgstr "Debug"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1754
|
||||
#: client/scenes/lobby_gui.cpp:1841
|
||||
msgid "About"
|
||||
msgstr "Informazioni"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1760
|
||||
#: client/scenes/lobby_gui.cpp:1847
|
||||
msgid "Exit"
|
||||
msgstr "Esci"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1774
|
||||
#: client/scenes/lobby_gui.cpp:1864
|
||||
msgid ""
|
||||
"Press A or X or put your palm up\n"
|
||||
"Press the grip button or put your palm up\n"
|
||||
"to move the main window"
|
||||
msgstr ""
|
||||
"Premi A, X o punta il palmo della mano verso l'alto\n"
|
||||
"per spostare la finestra principale"
|
||||
"Premi il pulsante laterale o punta il palmo della\n"
|
||||
"mano verso l'alto per spostare la finestra principale"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1776
|
||||
msgid "Press A or X to move the main window"
|
||||
msgstr "Premi A o X per spostare la finestra principale"
|
||||
#: client/scenes/lobby_gui.cpp:1866
|
||||
msgid "Press the grip button to move the main window"
|
||||
msgstr ""
|
||||
"Premi il pulsante laterale per\n"
|
||||
"spostare la finestra principale"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:161
|
||||
#: client/scenes/stream_gui.cpp:224
|
||||
msgid "Reproject"
|
||||
msgstr "Riproiezione"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:162
|
||||
#: client/scenes/stream_gui.cpp:225
|
||||
msgid "Blit"
|
||||
msgstr "Copia"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:164
|
||||
#: client/scenes/stream_gui.cpp:227
|
||||
msgid "Network"
|
||||
msgstr "Rete"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:164
|
||||
#: client/scenes/stream_gui.cpp:227 client/scenes/stream_gui.cpp:416
|
||||
msgid "Download"
|
||||
msgstr "Download"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:165
|
||||
#: client/scenes/stream_gui.cpp:228 client/scenes/stream_gui.cpp:417
|
||||
msgid "Upload"
|
||||
msgstr "Upload"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:234
|
||||
#: client/scenes/stream_gui.cpp:297
|
||||
#, c++-format
|
||||
msgid "Decoder {}"
|
||||
msgstr "Decoder {}"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:246
|
||||
#: client/scenes/stream_gui.cpp:309
|
||||
msgid "Timings [ms]"
|
||||
msgstr "Durata [ms]"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:306
|
||||
#: client/scenes/stream_gui.cpp:369
|
||||
msgid "Encode"
|
||||
msgstr "Compressione"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:307
|
||||
#: client/scenes/stream_gui.cpp:370
|
||||
msgid "Send"
|
||||
msgstr "Invio"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:308
|
||||
#: client/scenes/stream_gui.cpp:371
|
||||
msgid "Receive"
|
||||
msgstr "Ricezione"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:309
|
||||
#: client/scenes/stream_gui.cpp:372
|
||||
msgid "Decode"
|
||||
msgstr "Decodifica"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:310
|
||||
#: client/scenes/stream_gui.cpp:373
|
||||
msgid "Blitted"
|
||||
msgstr "Copiato"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:311
|
||||
#: client/scenes/stream_gui.cpp:374
|
||||
msgid "Displayed"
|
||||
msgstr "Visualizzato"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:312
|
||||
#: client/scenes/stream_gui.cpp:375
|
||||
msgid "Predicted"
|
||||
msgstr "Previsto"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:330
|
||||
#: client/scenes/stream_gui.cpp:393
|
||||
#, c++-format
|
||||
msgid "Estimated motion to photons latency: {}ms"
|
||||
msgstr "Latenza stimata da movimento a fotoni: {}ms"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:396
|
||||
msgid "Press the grip button to move the window"
|
||||
msgstr "Premi il pulsante laterale per spostare la finestra"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:398 client/scenes/stream_gui.cpp:750
|
||||
msgid "Press both thumbsticks to display the WiVRn window"
|
||||
msgstr "Premi entrabli gli stick per mostrare la finestra di WiVRn"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:420
|
||||
msgid "Motion to photon latency"
|
||||
msgstr "Latenza da movimento a fotoni"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:492
|
||||
msgid "Foveation center override"
|
||||
msgstr "Centro di foveazione manuale"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:495
|
||||
msgid "Enable"
|
||||
msgstr "Attiva"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:503 client/scenes/stream_gui.cpp:550
|
||||
#, c++-format
|
||||
msgid "Height {:.1f} deg"
|
||||
msgstr "Altezza {:.1f} deg"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:504 client/scenes/stream_gui.cpp:551
|
||||
#, c++-format
|
||||
msgid "Distance {:.2f} m"
|
||||
msgstr "Distanza {:.2f} m"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:505
|
||||
msgid "Default"
|
||||
msgstr "Reimposta"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:516
|
||||
msgid "Change"
|
||||
msgstr "Cambia"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:548
|
||||
msgid "Use the thumbsticks to move the foveation center"
|
||||
msgstr "Usa gli stick per spostare il centro di foveazione"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:549
|
||||
msgid "Press A to save or B to cancel"
|
||||
msgstr "A per salvare, B per annullare"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:793
|
||||
msgid "Stats"
|
||||
msgstr "Statistiche"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:802
|
||||
msgid "Statistics overlay"
|
||||
msgstr "Solo statistiche"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:805
|
||||
msgid "Compact view"
|
||||
msgstr "Modalità compatta"
|
||||
|
||||
#: client/wivrn_client.cpp:98 client/wivrn_client.cpp:202
|
||||
msgid "Timeout"
|
||||
msgstr "Timeout"
|
||||
@@ -526,3 +612,38 @@ msgstr "Impossibile verificare il PIN"
|
||||
#: client/wivrn_client.cpp:182
|
||||
msgid "Pairing is disabled on server"
|
||||
msgstr "L'associazione è disattivata sul server"
|
||||
|
||||
#~ msgid "Video stream interrupted"
|
||||
#~ msgstr "Flusso video interrotto"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Connection ready\n"
|
||||
#~ "Start a VR application on your computer"
|
||||
#~ msgstr ""
|
||||
#~ "Connessione pronta\n"
|
||||
#~ "Avvia un'applicazione VR sul computer"
|
||||
|
||||
#, c++-format
|
||||
#~ msgid ""
|
||||
#~ "Connection ready\n"
|
||||
#~ "Start a VR application on {}"
|
||||
#~ msgstr ""
|
||||
#~ "Connessione pronta\n"
|
||||
#~ "Avvia un'applicazione VR su {}"
|
||||
|
||||
#~ msgid "Show performance metrics"
|
||||
#~ msgstr "Mostra metriche delle prestazioni"
|
||||
|
||||
#~ msgid "Overlay can be toggled by pressing both thumbsticks"
|
||||
#~ msgstr ""
|
||||
#~ "È possibile alternare la visualizzazione premendo entrambi i joystick"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Press A or X or put your palm up\n"
|
||||
#~ "to move the main window"
|
||||
#~ msgstr ""
|
||||
#~ "Premi A, X o punta il palmo della mano verso l'alto\n"
|
||||
#~ "per spostare la finestra principale"
|
||||
|
||||
#~ msgid "Press A or X to move the main window"
|
||||
#~ msgstr "Premi A o X per spostare la finestra principale"
|
||||
|
||||
@@ -2,7 +2,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WiVRn-dashboard\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-06-20 01:44+0900\n"
|
||||
"POT-Creation-Date: 2025-07-30 22:35+0900\n"
|
||||
"PO-Revision-Date: 2025-04-10 07:14+0900\n"
|
||||
"Last-Translator: Mitsuami Megane <hello@mitsua.me>\n"
|
||||
"Language-Team: Japanese <>\n"
|
||||
@@ -339,13 +339,13 @@ msgctxt "don't start an application automatically"
|
||||
msgid "None"
|
||||
msgstr "なし"
|
||||
|
||||
#: dashboard/qml/SelectGame.qml:21
|
||||
#: dashboard/qml/SelectGame.qml:20
|
||||
#, kde-format
|
||||
msgctxt "choose a custom application to start"
|
||||
msgid "Custom"
|
||||
msgstr "カスタム"
|
||||
|
||||
#: dashboard/qml/SelectGame.qml:79
|
||||
#: dashboard/qml/SelectGame.qml:76
|
||||
#, kde-format
|
||||
msgctxt "browse a file to choose the application to start"
|
||||
msgid "Browse"
|
||||
@@ -835,7 +835,9 @@ msgstr "警告"
|
||||
msgid ""
|
||||
"WiVRn entirely replaces SteamVR, you should not start SteamVR while WiVRn is "
|
||||
"running."
|
||||
msgstr "WiVRnはSteamVRの変わりに使うものです。両方を同時に走らせないように気をつけましょう。"
|
||||
msgstr ""
|
||||
"WiVRnはSteamVRの変わりに使うものです。両方を同時に走らせないように気をつけま"
|
||||
"しょう。"
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:358
|
||||
#, kde-format
|
||||
|
||||
+233
-153
@@ -2,7 +2,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WiVRn 0.16\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-06-20 01:44+0900\n"
|
||||
"POT-Creation-Date: 2025-07-30 22:35+0900\n"
|
||||
"PO-Revision-Date: 2024-06-20 10:33+0900\n"
|
||||
"Last-Translator: Mitsuami Megane <hello@mitsua.me>\n"
|
||||
"Language: Japanese\n"
|
||||
@@ -10,119 +10,121 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: client/scenes/lobby.cpp:148
|
||||
#: client/scene.cpp:74
|
||||
msgid "No supported swapchain format"
|
||||
msgstr "互換性のあるスワップチェーンは見つからなかった"
|
||||
|
||||
#: client/scenes/lobby.cpp:228
|
||||
#: client/scenes/lobby.cpp:185
|
||||
msgid "Incompatible WiVRn server: no protocol field in TXT"
|
||||
msgstr "互換性のないサーバー(プロトコルのフィールドは欠落)"
|
||||
|
||||
#: client/scenes/lobby.cpp:231
|
||||
#: client/scenes/lobby.cpp:188
|
||||
#, c++-format
|
||||
msgid "Incompatible WiVRn server protocol (client: {}, server: {})"
|
||||
msgstr "互換性のないサーバー(クライエント{}、サーバー{})"
|
||||
|
||||
#: client/scenes/lobby.cpp:246
|
||||
#: client/scenes/lobby.cpp:203
|
||||
#, c++-format
|
||||
msgid "Cannot resolve hostname: {}"
|
||||
msgstr "ホスト名解決に失敗:{}"
|
||||
|
||||
#: client/scenes/lobby.cpp:333 client/scenes/lobby.cpp:339
|
||||
#: client/scenes/lobby.cpp:290 client/scenes/lobby.cpp:296
|
||||
#, c++-format
|
||||
msgid "Cannot connect to {} ({}): {}"
|
||||
msgstr "{}に接続できませんでした:({}) {}"
|
||||
|
||||
#: client/scenes/lobby.cpp:453
|
||||
#: client/scenes/lobby.cpp:379
|
||||
msgid "Waiting for connection"
|
||||
msgstr "接続を待っています"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:132
|
||||
#: client/scenes/lobby_gui.cpp:156
|
||||
msgctxt "openxr_post_processing"
|
||||
msgid "Normal"
|
||||
msgstr "ノーマル"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:135
|
||||
#: client/scenes/lobby_gui.cpp:159
|
||||
msgctxt "openxr_post_processing"
|
||||
msgid "Quality"
|
||||
msgstr "クオリティ"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:137
|
||||
#: client/scenes/lobby_gui.cpp:161
|
||||
msgctxt "openxr_post_processing"
|
||||
msgid "Disabled"
|
||||
msgstr "無効"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:198
|
||||
#: client/scenes/lobby_gui.cpp:169 client/scenes/lobby_gui.cpp:320
|
||||
#: client/scenes/stream_gui.cpp:812
|
||||
msgid "Disconnect"
|
||||
msgstr "切断する"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:204
|
||||
msgid "Video stream interrupted"
|
||||
msgstr "動画ストリームは中断しました"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:206
|
||||
msgid ""
|
||||
"Connection ready\n"
|
||||
"Start a VR application on your computer"
|
||||
msgstr ""
|
||||
"接続に成功しました\n"
|
||||
"パソコンでVRアプリを起動して下さい"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:208
|
||||
#, c++-format
|
||||
msgid ""
|
||||
"Connection ready\n"
|
||||
"Start a VR application on {}"
|
||||
msgstr ""
|
||||
"接続に成功しました\n"
|
||||
"{}でVRアプリを起動して下さい"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:221
|
||||
#: client/scenes/lobby_gui.cpp:189 client/scenes/stream_gui.cpp:808
|
||||
msgid "Close"
|
||||
msgstr "やめる"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:227
|
||||
#: client/scenes/lobby_gui.cpp:195
|
||||
msgid "Connection"
|
||||
msgstr "接続"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:229
|
||||
#: client/scenes/lobby_gui.cpp:197
|
||||
#, c++-format
|
||||
msgid "Connection to {}"
|
||||
msgstr "{}に接続中"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:259
|
||||
#: client/scenes/lobby_gui.cpp:227
|
||||
msgid "PIN"
|
||||
msgstr "暗証番号"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:281
|
||||
#: client/scenes/lobby_gui.cpp:249
|
||||
msgid "Input the PIN displayed on the dashboard"
|
||||
msgstr "パソコンで表示された暗証番号を入力してください"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:356
|
||||
#: client/scenes/lobby_gui.cpp:315
|
||||
msgid "Connected to WiVRn server"
|
||||
msgstr "WiVRnサーバーに接続しました。"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:317
|
||||
#, c++-format
|
||||
msgid "Connected to {}"
|
||||
msgstr "{}に接続しました。"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:327
|
||||
msgid "Start an application on the server to start streaming."
|
||||
msgstr "VRアプリを起動してVRに入りましょう!"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:333
|
||||
msgid "Start an application on your computer or select one to start streaming."
|
||||
msgstr "パソコンでVRアプリを起動するか、ここからアプリを選択しましょう。"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:335
|
||||
#, c++-format
|
||||
msgid "Start an application on {} or select one to start streaming."
|
||||
msgstr "{}でVRアプリを起動するか、ここからアプリを選択しましょう。"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:383
|
||||
msgid "Name"
|
||||
msgstr "表示名"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:367
|
||||
#: client/scenes/lobby_gui.cpp:394
|
||||
msgid "Address"
|
||||
msgstr "アドレス"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:376
|
||||
#: client/scenes/lobby_gui.cpp:403
|
||||
msgid "Port"
|
||||
msgstr "ポート番号"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:384
|
||||
#: client/scenes/lobby_gui.cpp:411
|
||||
msgid "TCP only"
|
||||
msgstr "TCPのみを使用"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:391
|
||||
#: client/scenes/lobby_gui.cpp:418
|
||||
msgid "Cancel"
|
||||
msgstr "やめる"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:405
|
||||
#: client/scenes/lobby_gui.cpp:432
|
||||
msgid "Save"
|
||||
msgstr "保存する"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:458
|
||||
#: client/scenes/lobby_gui.cpp:485
|
||||
msgid ""
|
||||
"Start a WiVRn server on your\n"
|
||||
"local network"
|
||||
@@ -130,32 +132,32 @@ msgstr ""
|
||||
"ローカルネットワークでWiVRnサーバーを\n"
|
||||
"起動してみて下さい"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:490
|
||||
#: client/scenes/lobby_gui.cpp:517
|
||||
msgid "Autoconnect"
|
||||
msgstr "自動接続"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:516
|
||||
#: client/scenes/lobby_gui.cpp:543
|
||||
msgid "Connect"
|
||||
msgstr "接続する"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:526 client/wivrn_client.cpp:186
|
||||
#: client/scenes/lobby_gui.cpp:553 client/wivrn_client.cpp:186
|
||||
msgid "Incompatible server version"
|
||||
msgstr "互換性のないサーバーです"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:528
|
||||
#: client/scenes/lobby_gui.cpp:555
|
||||
msgid "Server not available"
|
||||
msgstr "サーバーは利用不可です"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:614
|
||||
#: client/scenes/lobby_gui.cpp:641
|
||||
msgid "Refresh rate"
|
||||
msgstr "リフレッシュレート"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:614 client/scenes/lobby_gui.cpp:616
|
||||
#: client/scenes/lobby_gui.cpp:641 client/scenes/lobby_gui.cpp:643
|
||||
msgctxt "automatic refresh rate"
|
||||
msgid "Automatic"
|
||||
msgstr "自動"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:623
|
||||
#: client/scenes/lobby_gui.cpp:650
|
||||
msgid ""
|
||||
"Select refresh rate based on measured application performance.\n"
|
||||
"May cause flicker when a change happens."
|
||||
@@ -163,60 +165,60 @@ msgstr ""
|
||||
"アプリケーションのパフォーマンスを基づいて自動的に設定します。\n"
|
||||
"変更時にチラツキが発生する可能性があります。"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:640
|
||||
#: client/scenes/lobby_gui.cpp:667
|
||||
msgid "Minimum refresh rate"
|
||||
msgstr "最低リフレッシュレート"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:663
|
||||
#: client/scenes/lobby_gui.cpp:690
|
||||
msgid "Resolution scale"
|
||||
msgstr "解像度"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:667 client/scenes/lobby_gui.cpp:971
|
||||
#: client/scenes/lobby_gui.cpp:694 client/scenes/lobby_gui.cpp:933
|
||||
#, c-format, c++-format
|
||||
msgid "%d%% - {}x{} per eye"
|
||||
msgstr "%d%% - 目あたり{}x{}"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:678 client/scenes/lobby_gui.cpp:982
|
||||
#: client/scenes/lobby_gui.cpp:705 client/scenes/lobby_gui.cpp:944
|
||||
#, c++-format
|
||||
msgid "Resolution larger than {}x{} may not be supported by the headset"
|
||||
msgstr ""
|
||||
"{}x{}以上の解像度は、お使いのヘッドセットではサポートされない場合があります。"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:684
|
||||
#: client/scenes/lobby_gui.cpp:711
|
||||
msgid "Enable microphone"
|
||||
msgstr "マイクを有効する"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:694
|
||||
#: client/scenes/lobby_gui.cpp:720
|
||||
msgid "Unprocessed Microphone Audio"
|
||||
msgstr "未処理のマイク音声"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:700
|
||||
#: client/scenes/lobby_gui.cpp:726
|
||||
msgid "Force disable audio filters, such as noise cancellation"
|
||||
msgstr "ノイズ除去などのフィルターを無効化する"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:707
|
||||
#: client/scenes/lobby_gui.cpp:733
|
||||
msgid "Enable hand tracking"
|
||||
msgstr "ハンドトラッキングを有効する"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:714 client/scenes/lobby_gui.cpp:727
|
||||
#: client/scenes/lobby_gui.cpp:740 client/scenes/lobby_gui.cpp:757
|
||||
#: client/scenes/lobby_gui.cpp:807
|
||||
#: client/scenes/lobby_gui.cpp:739 client/scenes/lobby_gui.cpp:751
|
||||
#: client/scenes/lobby_gui.cpp:763 client/scenes/lobby_gui.cpp:779
|
||||
#: client/scenes/lobby_gui.cpp:829
|
||||
msgid "This feature is not supported by your headset"
|
||||
msgstr "デバイスはこの機能をサポートしていません"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:720
|
||||
#: client/scenes/lobby_gui.cpp:745
|
||||
msgid "Enable eye tracking"
|
||||
msgstr "アイトラッキングを有効する"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:733
|
||||
#: client/scenes/lobby_gui.cpp:757
|
||||
msgid "Enable face tracking"
|
||||
msgstr "顔トラッキングを有効する"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:747
|
||||
#: client/scenes/lobby_gui.cpp:770
|
||||
msgid "Enable body tracking"
|
||||
msgstr "ボディラッキングを有効する"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:764
|
||||
#: client/scenes/lobby_gui.cpp:786
|
||||
msgid ""
|
||||
"Requires 'Hand and body tracking' to be enabled in the Quest movement "
|
||||
"tracking settings,\n"
|
||||
@@ -227,11 +229,11 @@ msgstr ""
|
||||
"そうでなければ、トラッキングデータはHMDとコントローラーの情報から推測されるこ"
|
||||
"とになる。"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:777
|
||||
#: client/scenes/lobby_gui.cpp:799
|
||||
msgid "Enable lower body tracking"
|
||||
msgstr "下半身トラッキングを有効する"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:783
|
||||
#: client/scenes/lobby_gui.cpp:805
|
||||
msgid ""
|
||||
"Estimate lower body joint positions using Generative Legs\n"
|
||||
"Requires 'Hand and body tracking' to be enabled in the Quest movement "
|
||||
@@ -241,11 +243,11 @@ msgstr ""
|
||||
"Quest設定・動きのトラッキング・ジェスチャーコントロールとボディトラッキングを"
|
||||
"有効する必要がある。"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:786
|
||||
#: client/scenes/lobby_gui.cpp:808
|
||||
msgid "Enable hip tracking"
|
||||
msgstr "腰のトラッキングを有効する"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:792
|
||||
#: client/scenes/lobby_gui.cpp:814
|
||||
msgid ""
|
||||
"Only takes affect with lower body tracking enabled\n"
|
||||
"May be desired when using another source of hip tracking"
|
||||
@@ -253,45 +255,19 @@ msgstr ""
|
||||
"下半身トラッキングが有効な場合に使用可能。腰トラッカーを持ってる方は無効にし"
|
||||
"ましょう。"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:800
|
||||
#: client/scenes/lobby_gui.cpp:822
|
||||
msgid "Enable video passthrough in lobby"
|
||||
msgstr "ロビーでパススルーを有効する"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:810
|
||||
msgid "Show performance metrics"
|
||||
msgstr "パフォーマンスグラフを表示する"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:814
|
||||
msgid "Overlay can be toggled by pressing both thumbsticks"
|
||||
msgstr "両方のサムスティックを同時に押すことで切り替え可能"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:844 client/scenes/lobby_gui.cpp:852
|
||||
#: client/scenes/stream_stats.cpp:159
|
||||
msgid "CPU time"
|
||||
msgstr "CPU使用時間"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:848
|
||||
msgid "CPU time [ms]"
|
||||
msgstr "CPU使用時間、ミリ秒"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:858 client/scenes/lobby_gui.cpp:866
|
||||
#: client/scenes/stream_stats.cpp:161
|
||||
msgid "GPU time"
|
||||
msgstr "GPU使用時間"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:862
|
||||
msgid "GPU time [ms]"
|
||||
msgstr "GPU使用時間、ミリ秒"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:881
|
||||
#: client/scenes/lobby_gui.cpp:843 client/scenes/stream_gui.cpp:434
|
||||
msgid "OpenXR post-processing"
|
||||
msgstr "OpenXRポストエフェクト"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:885
|
||||
#: client/scenes/lobby_gui.cpp:847 client/scenes/stream_gui.cpp:438
|
||||
msgid "Supersampling"
|
||||
msgstr "スーパーサンプリング"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:905
|
||||
#: client/scenes/lobby_gui.cpp:867 client/scenes/stream_gui.cpp:459
|
||||
msgid ""
|
||||
"Reduce flicker for high contrast edges.\n"
|
||||
"Useful when the input resolution is high compared to the headset display"
|
||||
@@ -299,11 +275,11 @@ msgstr ""
|
||||
"コントラストが高い部分のギザギザを低減する。\n"
|
||||
"ストリームの解像度は、HMDの解像度より高い場合は有用です。"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:910
|
||||
#: client/scenes/lobby_gui.cpp:872 client/scenes/stream_gui.cpp:464
|
||||
msgid "Sharpening"
|
||||
msgstr "シャープ"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:930
|
||||
#: client/scenes/lobby_gui.cpp:892 client/scenes/stream_gui.cpp:485
|
||||
msgid ""
|
||||
"Improve clarity of high contrast edges and counteract blur.\n"
|
||||
"Useful when the input resolution is low compared to the headset display"
|
||||
@@ -311,11 +287,11 @@ msgstr ""
|
||||
"ぼかしを低減し、コントラストが高い部分の鮮明度を向上する。\n"
|
||||
"ストリームの解像度は、HMDの解像度より低い場合に有用です。"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:939
|
||||
#: client/scenes/lobby_gui.cpp:901
|
||||
msgid "Enable Snapdragon Game Super Resolution"
|
||||
msgstr "Snapdragon Game Super Resolutionを有効する"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:947
|
||||
#: client/scenes/lobby_gui.cpp:909
|
||||
msgid ""
|
||||
"On this headset, this setting has been fully superseded by the native "
|
||||
"Sharpening setting above.\n"
|
||||
@@ -323,184 +299,288 @@ msgid ""
|
||||
msgstr ""
|
||||
"この設定は、使用中のHMDでは非推奨です。OpenXRの方法を使用してください。"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:949
|
||||
#: client/scenes/lobby_gui.cpp:911
|
||||
msgid ""
|
||||
"Client-side upscaling and sharpening, adds a performance cost on the headset"
|
||||
msgstr ""
|
||||
"HMD側のアップスケーリングやシャープニングを使用する場合、要求性能が上がりま"
|
||||
"す。"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:967
|
||||
#: client/scenes/lobby_gui.cpp:929
|
||||
msgid "Upscaling factor"
|
||||
msgstr "アップスケーリング係数"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:986
|
||||
#: client/scenes/lobby_gui.cpp:948
|
||||
msgid "Use edge direction"
|
||||
msgstr "エッジ方向を使用する"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:992
|
||||
#: client/scenes/lobby_gui.cpp:954
|
||||
msgid "Adds an additional performance cost"
|
||||
msgstr "HMDに対する要求性能が上がります。"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:997
|
||||
#: client/scenes/lobby_gui.cpp:959
|
||||
msgid "Edge threshold"
|
||||
msgstr "エッジのしきい値"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1004 client/scenes/lobby_gui.cpp:1013
|
||||
#: client/scenes/lobby_gui.cpp:966 client/scenes/lobby_gui.cpp:975
|
||||
#, c++-format
|
||||
msgid "Recommended: {:.1f}"
|
||||
msgstr "推奨値:{:.1f}"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1007
|
||||
#: client/scenes/lobby_gui.cpp:969
|
||||
msgid "Edge sharpness"
|
||||
msgstr "エッジのシャープ"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1101 client/scenes/lobby_gui.cpp:1757
|
||||
#: client/scenes/lobby_gui.cpp:1071 client/scenes/lobby_gui.cpp:1079
|
||||
#: client/scenes/stream_gui.cpp:222 client/scenes/stream_gui.cpp:418
|
||||
msgid "CPU time"
|
||||
msgstr "CPU使用時間"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1075
|
||||
msgid "CPU time [ms]"
|
||||
msgstr "CPU使用時間、ミリ秒"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1085 client/scenes/lobby_gui.cpp:1093
|
||||
#: client/scenes/stream_gui.cpp:224 client/scenes/stream_gui.cpp:419
|
||||
msgid "GPU time"
|
||||
msgstr "GPU使用時間"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1089
|
||||
msgid "GPU time [ms]"
|
||||
msgstr "GPU使用時間、ミリ秒"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1132
|
||||
msgid "Enable the microphone?"
|
||||
msgstr "マイクを有効にしますか?"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1137
|
||||
msgid "Enable eye tracking?"
|
||||
msgstr "アイトラッキングを有効にしますか?"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1142
|
||||
msgid "Enable face tracking?"
|
||||
msgstr "フェースラッキングを有効にしますか?"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1147
|
||||
msgid "Enable body tracking?"
|
||||
msgstr "ボディトラッキングを有効にしますか?"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1155
|
||||
msgid "Welcome to WiVRn"
|
||||
msgstr "WiVRnへようこそ!"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1179
|
||||
msgid "Yes"
|
||||
msgstr "はい"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1186
|
||||
msgid "No"
|
||||
msgstr "いいえ"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1205 client/scenes/lobby_gui.cpp:1844
|
||||
msgid "Licenses"
|
||||
msgstr "ライセンス"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1440
|
||||
#: client/scenes/lobby_gui.cpp:1519
|
||||
msgid "Microphone is enabled"
|
||||
msgstr "マイクは有効です"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1441
|
||||
#: client/scenes/lobby_gui.cpp:1520
|
||||
msgid "Microphone is disabled"
|
||||
msgstr "マイクは無効です"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1450
|
||||
#: client/scenes/lobby_gui.cpp:1529
|
||||
msgid "Hand tracking is enabled"
|
||||
msgstr "ハンドトラッキングは有効です"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1451
|
||||
#: client/scenes/lobby_gui.cpp:1530
|
||||
msgid "Hand tracking is disabled"
|
||||
msgstr "ハンドラッキングは無効です"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1460
|
||||
#: client/scenes/lobby_gui.cpp:1539
|
||||
msgid "Eye tracking is enabled"
|
||||
msgstr "アイトラッキングは有効です"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1461
|
||||
#: client/scenes/lobby_gui.cpp:1540
|
||||
msgid "Eye tracking is disabled"
|
||||
msgstr "アイトラッキングは無効です"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1471 client/scenes/lobby_gui.cpp:1482
|
||||
#: client/scenes/lobby_gui.cpp:1553
|
||||
msgid "Face tracking is enabled"
|
||||
msgstr "顔トラッキングは有効です"
|
||||
msgstr "フェーストラッキングは有効です"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1472 client/scenes/lobby_gui.cpp:1483
|
||||
#: client/scenes/lobby_gui.cpp:1554
|
||||
msgid "Face tracking is disabled"
|
||||
msgstr "フェーストラッキングは無効です"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1493
|
||||
#: client/scenes/lobby_gui.cpp:1564
|
||||
msgid "Body tracking is enabled"
|
||||
msgstr "ボディトラッキングは有効です"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1494
|
||||
#: client/scenes/lobby_gui.cpp:1565
|
||||
msgid "Body tracking is disabled"
|
||||
msgstr "ボディトラッキングは無効です"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1510
|
||||
#: client/scenes/lobby_gui.cpp:1581
|
||||
msgid "Add server"
|
||||
msgstr "サーバーを追加する"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1739
|
||||
#: client/scenes/lobby_gui.cpp:1826
|
||||
msgid "Server list"
|
||||
msgstr "サーバー"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1742
|
||||
#: client/scenes/lobby_gui.cpp:1829 client/scenes/stream_gui.cpp:796
|
||||
msgid "Settings"
|
||||
msgstr "設定"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1745
|
||||
#: client/scenes/lobby_gui.cpp:1832
|
||||
msgid "Post-processing"
|
||||
msgstr "ポストエフェクト"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1749
|
||||
#: client/scenes/lobby_gui.cpp:1836
|
||||
msgid "Debug"
|
||||
msgstr "デバッグ"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1754
|
||||
#: client/scenes/lobby_gui.cpp:1841
|
||||
msgid "About"
|
||||
msgstr "WiVRnについて"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1760
|
||||
#: client/scenes/lobby_gui.cpp:1847
|
||||
msgid "Exit"
|
||||
msgstr "完了"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1774
|
||||
#: client/scenes/lobby_gui.cpp:1864
|
||||
msgid ""
|
||||
"Press A or X or put your palm up\n"
|
||||
"Press the grip button or put your palm up\n"
|
||||
"to move the main window"
|
||||
msgstr ""
|
||||
"ウィンドウを移動するには、手のひらを上に向けるか、\n"
|
||||
"AまたはBボタンを押しましょう"
|
||||
"メイン・パネルを動かすには、グリップを握るか、"
|
||||
"手のひらを上向きにしましょう。"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1776
|
||||
msgid "Press A or X to move the main window"
|
||||
msgstr "AまたはXボタンを押してウィンドウを移動"
|
||||
#: client/scenes/lobby_gui.cpp:1866
|
||||
msgid "Press the grip button to move the main window"
|
||||
msgstr "グリップを握ってパネルを動かしましょう。"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:161
|
||||
#: client/scenes/stream_gui.cpp:224
|
||||
msgid "Reproject"
|
||||
msgstr "リプロジェクション"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:162
|
||||
#: client/scenes/stream_gui.cpp:225
|
||||
msgid "Blit"
|
||||
msgstr "レンダー"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:164
|
||||
#: client/scenes/stream_gui.cpp:227
|
||||
msgid "Network"
|
||||
msgstr "ネットワーク"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:164
|
||||
#: client/scenes/stream_gui.cpp:227 client/scenes/stream_gui.cpp:416
|
||||
msgid "Download"
|
||||
msgstr "ダウンロード"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:165
|
||||
#: client/scenes/stream_gui.cpp:228 client/scenes/stream_gui.cpp:417
|
||||
msgid "Upload"
|
||||
msgstr "アップロード"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:234
|
||||
#: client/scenes/stream_gui.cpp:297
|
||||
#, c++-format
|
||||
msgid "Decoder {}"
|
||||
msgstr "デコーダー {}"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:246
|
||||
#: client/scenes/stream_gui.cpp:309
|
||||
msgid "Timings [ms]"
|
||||
msgstr "タイミング、ミリ秒"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:306
|
||||
#: client/scenes/stream_gui.cpp:369
|
||||
msgid "Encode"
|
||||
msgstr "動画エンコード"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:307
|
||||
#: client/scenes/stream_gui.cpp:370
|
||||
msgid "Send"
|
||||
msgstr "送信"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:308
|
||||
#: client/scenes/stream_gui.cpp:371
|
||||
msgid "Receive"
|
||||
msgstr "受信"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:309
|
||||
#: client/scenes/stream_gui.cpp:372
|
||||
msgid "Decode"
|
||||
msgstr "デコード"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:310
|
||||
#: client/scenes/stream_gui.cpp:373
|
||||
msgid "Blitted"
|
||||
msgstr "レンダー"
|
||||
msgstr "描画"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:311
|
||||
#: client/scenes/stream_gui.cpp:374
|
||||
msgid "Displayed"
|
||||
msgstr "表示"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:312
|
||||
#: client/scenes/stream_gui.cpp:375
|
||||
msgid "Predicted"
|
||||
msgstr "予測時間"
|
||||
|
||||
#: client/scenes/stream_stats.cpp:330
|
||||
#: client/scenes/stream_gui.cpp:393
|
||||
#, c++-format
|
||||
msgid "Estimated motion to photons latency: {}ms"
|
||||
msgstr "「Motion-to-photon」推定遅延 {}ミリ秒"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:396
|
||||
msgid "Press the grip button to move the window"
|
||||
msgstr "グリップを握ってパネルを動かしましょう。"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:398 client/scenes/stream_gui.cpp:750
|
||||
msgid "Press both thumbsticks to display the WiVRn window"
|
||||
msgstr "両方のサムスティックを同時に押すことでWiVRn"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:420
|
||||
msgid "Motion to photon latency"
|
||||
msgstr "「Motion-to-photon」遅延"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:492
|
||||
msgid "Foveation center override"
|
||||
msgstr "光学中心の調整"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:495
|
||||
msgid "Enable"
|
||||
msgstr "有効"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:503 client/scenes/stream_gui.cpp:550
|
||||
#, c++-format
|
||||
msgid "Height {:.1f} deg"
|
||||
msgstr "仰角 {:.1f}°"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:504 client/scenes/stream_gui.cpp:551
|
||||
#, c++-format
|
||||
msgid "Distance {:.2f} m"
|
||||
msgstr "距離 {:.2f}m"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:505
|
||||
msgid "Default"
|
||||
msgstr "デフォルト"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:516
|
||||
msgid "Change"
|
||||
msgstr "編集"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:548
|
||||
msgid "Use the thumbsticks to move the foveation center"
|
||||
msgstr "ジョイスティックを使って中心点を調整しましょう。"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:549
|
||||
msgid "Press A to save or B to cancel"
|
||||
msgstr "AかBを押してキャンセル。"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:793
|
||||
msgid "Stats"
|
||||
msgstr "統計情報"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:802
|
||||
msgid "Statistics overlay"
|
||||
msgstr "統計オーバーレイ"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:805
|
||||
msgid "Compact view"
|
||||
msgstr "コンパクト・モード"
|
||||
|
||||
#: client/wivrn_client.cpp:98 client/wivrn_client.cpp:202
|
||||
msgid "Timeout"
|
||||
msgstr "タイムアウト"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 748060ccb60bdc3df47dc44f1b1dcb57dfd5b488 Mon Sep 17 00:00:00 2001
|
||||
From bf64125b461a33d9e67e9b6f3da2f0e0726cfb03 Mon Sep 17 00:00:00 2001
|
||||
From: Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
Date: Wed, 16 Oct 2024 20:51:52 +0200
|
||||
Subject: [PATCH 1/2] Change ImGui::ButtonBehavior default flags when using
|
||||
@@ -12,10 +12,10 @@ Subject: [PATCH 1/2] Change ImGui::ButtonBehavior default flags when using
|
||||
4 files changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/imgui.cpp b/imgui.cpp
|
||||
index 3bbaf018f..44eed7900 100644
|
||||
index 99819ffe..c1a16c42 100644
|
||||
--- a/imgui.cpp
|
||||
+++ b/imgui.cpp
|
||||
@@ -9969,7 +9969,7 @@ static const char* GetInputSourceName(ImGuiInputSource source)
|
||||
@@ -10140,7 +10140,7 @@ static const char* GetInputSourceName(ImGuiInputSource source)
|
||||
}
|
||||
static const char* GetMouseSourceName(ImGuiMouseSource source)
|
||||
{
|
||||
@@ -25,10 +25,10 @@ index 3bbaf018f..44eed7900 100644
|
||||
return mouse_source_names[source];
|
||||
}
|
||||
diff --git a/imgui.h b/imgui.h
|
||||
index 77ca8e04f..647090b9e 100644
|
||||
index a2b2a1fa..64d5f758 100644
|
||||
--- a/imgui.h
|
||||
+++ b/imgui.h
|
||||
@@ -1838,6 +1838,8 @@ enum ImGuiMouseSource : int
|
||||
@@ -1935,6 +1935,8 @@ enum ImGuiMouseSource : int
|
||||
ImGuiMouseSource_Mouse = 0, // Input is coming from an actual mouse.
|
||||
ImGuiMouseSource_TouchScreen, // Input is coming from a touch screen (no hovering prior to initial press, less precise initial press aiming, dual-axis wheeling possible).
|
||||
ImGuiMouseSource_Pen, // Input is coming from a pressure/magnetic pen (often used in conjunction with high-sampling rates).
|
||||
@@ -38,12 +38,12 @@ index 77ca8e04f..647090b9e 100644
|
||||
};
|
||||
|
||||
diff --git a/imgui_demo.cpp b/imgui_demo.cpp
|
||||
index 8df1755fb..69f200218 100644
|
||||
index 991676f7..b360e69e 100644
|
||||
--- a/imgui_demo.cpp
|
||||
+++ b/imgui_demo.cpp
|
||||
@@ -7350,6 +7350,11 @@ static void ShowDemoWindowInputs()
|
||||
for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseDown(i)) { ImGui::SameLine(); ImGui::Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); }
|
||||
ImGui::Text("Mouse wheel: %.1f", io.MouseWheel);
|
||||
@@ -7768,6 +7768,11 @@ static void DemoWindowInputs()
|
||||
ImGui::Text("Mouse clicked count:");
|
||||
for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (io.MouseClickedCount[i] > 0) { ImGui::SameLine(); ImGui::Text("b%d: %d", i, io.MouseClickedCount[i]); }
|
||||
|
||||
+ const char* mouse_source_names[] = { "Mouse", "TouchScreen", "Pen", "VRHandTracking", "VRController" };
|
||||
+ IM_ASSERT(IM_ARRAYSIZE(mouse_source_names) == ImGuiMouseSource_COUNT && io.MouseSource >= 0 && io.MouseSource < ImGuiMouseSource_COUNT);
|
||||
@@ -54,14 +54,14 @@ index 8df1755fb..69f200218 100644
|
||||
// displaying the data for old/new backends.
|
||||
// User code should never have to go through such hoops!
|
||||
diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp
|
||||
index 322c0846c..26a8ffdcd 100644
|
||||
index a0c4f14f..11709bd1 100644
|
||||
--- a/imgui_widgets.cpp
|
||||
+++ b/imgui_widgets.cpp
|
||||
@@ -501,7 +501,12 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
||||
@@ -557,7 +557,12 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
||||
|
||||
// Default behavior requires click + release inside bounding box
|
||||
if ((flags & ImGuiButtonFlags_PressedOnMask_) == 0)
|
||||
- flags |= ImGuiButtonFlags_PressedOnDefault_;
|
||||
- flags |= (item_flags & ImGuiItemFlags_ButtonRepeat) ? ImGuiButtonFlags_PressedOnClick : ImGuiButtonFlags_PressedOnDefault_;
|
||||
+ {
|
||||
+ if (g.IO.MouseSource == ImGuiMouseSource_VRHandTracking)
|
||||
+ flags |= ImGuiButtonFlags_PressedOnClick;
|
||||
@@ -69,8 +69,8 @@ index 322c0846c..26a8ffdcd 100644
|
||||
+ flags |= ImGuiButtonFlags_PressedOnDefault_;
|
||||
+ }
|
||||
|
||||
// Default behavior inherited from item flags
|
||||
// Note that _both_ ButtonFlags and ItemFlags are valid sources, so copy one into the item_flags and only check that.
|
||||
ImGuiWindow* backup_hovered_window = g.HoveredWindow;
|
||||
const bool flatten_hovered_children = (flags & ImGuiButtonFlags_FlattenChildren) && g.HoveredWindow && g.HoveredWindow->RootWindow == window->RootWindow;
|
||||
--
|
||||
2.47.0
|
||||
2.50.0
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 265d4ef46317d87b8d22926e7ee99fda6e2b940d Mon Sep 17 00:00:00 2001
|
||||
From cdb8a40a9363019e33ecf9428cc2e1c6319aea1f Mon Sep 17 00:00:00 2001
|
||||
From: Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
Date: Tue, 22 Oct 2024 15:09:14 +0200
|
||||
Subject: [PATCH 2/2] Add ImGuiWindowFlags_NoFocusOnClick flag
|
||||
@@ -9,10 +9,10 @@ Subject: [PATCH 2/2] Add ImGuiWindowFlags_NoFocusOnClick flag
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/imgui.cpp b/imgui.cpp
|
||||
index 44eed7900..46f3ea877 100644
|
||||
index c1a16c42..115371b2 100644
|
||||
--- a/imgui.cpp
|
||||
+++ b/imgui.cpp
|
||||
@@ -4879,6 +4879,9 @@ void ImGui::UpdateMouseMovingWindowEndFrame()
|
||||
@@ -5134,6 +5134,9 @@ void ImGui::UpdateMouseMovingWindowEndFrame()
|
||||
// Handle the edge case of a popup being closed while clicking in its empty space.
|
||||
// If we try to focus it, FocusWindow() > ClosePopupsOverWindow() will accidentally close any parent popups because they are not linked together any more.
|
||||
ImGuiWindow* root_window = g.HoveredWindow ? g.HoveredWindow->RootWindow : NULL;
|
||||
@@ -23,17 +23,17 @@ index 44eed7900..46f3ea877 100644
|
||||
|
||||
if (root_window != NULL && !is_closed_popup)
|
||||
diff --git a/imgui.h b/imgui.h
|
||||
index 647090b9e..e9e453195 100644
|
||||
index 64d5f758..cff44a55 100644
|
||||
--- a/imgui.h
|
||||
+++ b/imgui.h
|
||||
@@ -1079,6 +1079,7 @@ enum ImGuiWindowFlags_
|
||||
ImGuiWindowFlags_NoNavInputs = 1 << 16, // No gamepad/keyboard navigation within the window
|
||||
ImGuiWindowFlags_NoNavFocus = 1 << 17, // No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB)
|
||||
@@ -1161,6 +1161,7 @@ enum ImGuiWindowFlags_
|
||||
ImGuiWindowFlags_NoNavInputs = 1 << 16, // No keyboard/gamepad navigation within the window
|
||||
ImGuiWindowFlags_NoNavFocus = 1 << 17, // No focusing toward this window with keyboard/gamepad navigation (e.g. skipped by CTRL+TAB)
|
||||
ImGuiWindowFlags_UnsavedDocument = 1 << 18, // Display a dot next to the title. When used in a tab/docking context, tab is selected when clicking the X + closure is not assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar.
|
||||
+ ImGuiWindowFlags_NoFocusOnClick = 1 << 19, // Disable taking focus when clicked
|
||||
ImGuiWindowFlags_NoNav = ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,
|
||||
ImGuiWindowFlags_NoDecoration = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoCollapse,
|
||||
ImGuiWindowFlags_NoInputs = ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,
|
||||
--
|
||||
2.47.0
|
||||
2.50.0
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,292 @@
|
||||
From 999c18895dc60680b0c4e167b4b89de031020445 Mon Sep 17 00:00:00 2001
|
||||
From: rcelyte <rcelyte@battletrains.org>
|
||||
Date: Fri, 23 Aug 2024 20:54:53 +0000
|
||||
Subject: [PATCH] t/common: Load SolarXR driver
|
||||
|
||||
---
|
||||
src/xrt/drivers/qwerty/qwerty_device.c | 4 +++
|
||||
.../common/target_builder_lighthouse.c | 25 +++++++++++++++++
|
||||
.../targets/common/target_builder_qwerty.c | 25 +++++++++++++++++
|
||||
.../targets/common/target_builder_rift_s.c | 26 ++++++++++++++++++
|
||||
.../targets/common/target_builder_steamvr.c | 27 +++++++++++++++++++
|
||||
src/xrt/targets/common/target_builder_wmr.c | 25 +++++++++++++++++
|
||||
6 files changed, 132 insertions(+)
|
||||
|
||||
diff --git a/src/xrt/drivers/qwerty/qwerty_device.c b/src/xrt/drivers/qwerty/qwerty_device.c
|
||||
index 53949d3b90..e1194bc061 100644
|
||||
--- a/src/xrt/drivers/qwerty/qwerty_device.c
|
||||
+++ b/src/xrt/drivers/qwerty/qwerty_device.c
|
||||
@@ -315,6 +315,8 @@ qwerty_hmd_create(void)
|
||||
|
||||
xd->inputs[0].name = XRT_INPUT_GENERIC_HEAD_POSE;
|
||||
|
||||
+ xd->supported.orientation_tracking = true;
|
||||
+ xd->supported.position_tracking = true;
|
||||
xd->update_inputs = u_device_noop_update_inputs;
|
||||
xd->get_tracked_pose = qwerty_get_tracked_pose;
|
||||
xd->get_view_poses = u_device_get_view_poses;
|
||||
@@ -367,6 +369,8 @@ qwerty_controller_create(bool is_left, struct qwerty_hmd *qhmd)
|
||||
xd->binding_profiles = binding_profiles;
|
||||
xd->binding_profile_count = ARRAY_SIZE(binding_profiles);
|
||||
|
||||
+ xd->supported.orientation_tracking = true;
|
||||
+ xd->supported.position_tracking = true;
|
||||
xd->update_inputs = qwerty_update_inputs;
|
||||
xd->get_tracked_pose = qwerty_get_tracked_pose;
|
||||
xd->set_output = qwerty_set_output;
|
||||
diff --git a/src/xrt/targets/common/target_builder_lighthouse.c b/src/xrt/targets/common/target_builder_lighthouse.c
|
||||
index 2386586be3..b8cbafdbed 100644
|
||||
--- a/src/xrt/targets/common/target_builder_lighthouse.c
|
||||
+++ b/src/xrt/targets/common/target_builder_lighthouse.c
|
||||
@@ -58,6 +58,10 @@
|
||||
#include "opengloves/opengloves_interface.h"
|
||||
#endif
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+#include "solarxr/solarxr_interface.h"
|
||||
+#endif
|
||||
+
|
||||
#if defined(XRT_BUILD_DRIVER_SURVIVE)
|
||||
#define DEFAULT_DRIVER "survive"
|
||||
#else
|
||||
@@ -509,6 +513,16 @@ try_add_opengloves(struct xrt_device *left,
|
||||
#endif
|
||||
}
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+static void
|
||||
+destroy_system_devices_solarxr(struct xrt_system_devices *xsysd)
|
||||
+{
|
||||
+ solarxr_device_set_feeder_devices(xsysd->static_roles.body, NULL, 0);
|
||||
+ u_system_devices_close(xsysd);
|
||||
+ free(xsysd);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
static xrt_result_t
|
||||
lighthouse_open_system_impl(struct xrt_builder *xb,
|
||||
cJSON *config,
|
||||
@@ -736,6 +750,17 @@ end_valve_index:
|
||||
try_add_opengloves(left, right, &left_ht, &right_ht);
|
||||
}
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+ const uint32_t count = solarxr_device_create_xdevs(head->tracking_origin, &xsysd->xdevs[xsysd->xdev_count],
|
||||
+ ARRAY_SIZE(xsysd->xdevs) - xsysd->xdev_count);
|
||||
+ if (count != 0) {
|
||||
+ xsysd->static_roles.body = xsysd->xdevs[xsysd->xdev_count];
|
||||
+ solarxr_device_set_feeder_devices(xsysd->static_roles.body, xsysd->xdevs, xsysd->xdev_count);
|
||||
+ xsysd->destroy = destroy_system_devices_solarxr;
|
||||
+ }
|
||||
+ xsysd->xdev_count += count;
|
||||
+#endif
|
||||
+
|
||||
// Assign to role(s).
|
||||
ubrh->head = head;
|
||||
ubrh->left = left;
|
||||
diff --git a/src/xrt/targets/common/target_builder_qwerty.c b/src/xrt/targets/common/target_builder_qwerty.c
|
||||
index 2c66ad3038..5a5059ee18 100644
|
||||
--- a/src/xrt/targets/common/target_builder_qwerty.c
|
||||
+++ b/src/xrt/targets/common/target_builder_qwerty.c
|
||||
@@ -18,6 +18,10 @@
|
||||
|
||||
#include "qwerty/qwerty_interface.h"
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+#include "solarxr/solarxr_interface.h"
|
||||
+#endif
|
||||
+
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
@@ -67,6 +71,16 @@ qwerty_estimate_system(struct xrt_builder *xb,
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+static void
|
||||
+destroy_system_devices_solarxr(struct xrt_system_devices *xsysd)
|
||||
+{
|
||||
+ solarxr_device_set_feeder_devices(xsysd->static_roles.body, NULL, 0);
|
||||
+ u_system_devices_close(xsysd);
|
||||
+ free(xsysd);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
static xrt_result_t
|
||||
qwerty_open_system_impl(struct xrt_builder *xb,
|
||||
cJSON *config,
|
||||
@@ -100,6 +114,17 @@ qwerty_open_system_impl(struct xrt_builder *xb,
|
||||
ubrh->left = left;
|
||||
ubrh->right = right;
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+ const uint32_t count = solarxr_device_create_xdevs(head->tracking_origin, &xsysd->xdevs[xsysd->xdev_count],
|
||||
+ ARRAY_SIZE(xsysd->xdevs) - xsysd->xdev_count);
|
||||
+ if (count != 0) {
|
||||
+ xsysd->static_roles.body = xsysd->xdevs[xsysd->xdev_count];
|
||||
+ solarxr_device_set_feeder_devices(xsysd->static_roles.body, xsysd->xdevs, xsysd->xdev_count);
|
||||
+ xsysd->destroy = destroy_system_devices_solarxr;
|
||||
+ }
|
||||
+ xsysd->xdev_count += count;
|
||||
+#endif
|
||||
+
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
diff --git a/src/xrt/targets/common/target_builder_rift_s.c b/src/xrt/targets/common/target_builder_rift_s.c
|
||||
index 675b303228..bf5581688d 100644
|
||||
--- a/src/xrt/targets/common/target_builder_rift_s.c
|
||||
+++ b/src/xrt/targets/common/target_builder_rift_s.c
|
||||
@@ -28,6 +28,10 @@
|
||||
#include "ht_ctrl_emu/ht_ctrl_emu_interface.h"
|
||||
#endif
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+#include "solarxr/solarxr_interface.h"
|
||||
+#endif
|
||||
+
|
||||
#include "rift_s/rift_s_interface.h"
|
||||
#include "rift_s/rift_s.h"
|
||||
|
||||
@@ -92,6 +96,16 @@ rift_s_estimate_system(struct xrt_builder *xb,
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+static void
|
||||
+destroy_system_devices_solarxr(struct xrt_system_devices *xsysd)
|
||||
+{
|
||||
+ solarxr_device_set_feeder_devices(xsysd->static_roles.body, NULL, 0);
|
||||
+ u_system_devices_close(xsysd);
|
||||
+ free(xsysd);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
static xrt_result_t
|
||||
rift_s_open_system_impl(struct xrt_builder *xb,
|
||||
cJSON *config,
|
||||
@@ -200,6 +214,18 @@ rift_s_open_system_impl(struct xrt_builder *xb,
|
||||
}
|
||||
#endif
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+ const uint32_t count =
|
||||
+ solarxr_device_create_xdevs((hmd_xdev != NULL) ? hmd_xdev->tracking_origin : NULL,
|
||||
+ &xsysd->xdevs[xsysd->xdev_count], ARRAY_SIZE(xsysd->xdevs) - xsysd->xdev_count);
|
||||
+ if (count != 0) {
|
||||
+ xsysd->static_roles.body = xsysd->xdevs[xsysd->xdev_count];
|
||||
+ solarxr_device_set_feeder_devices(xsysd->static_roles.body, xsysd->xdevs, xsysd->xdev_count);
|
||||
+ xsysd->destroy = destroy_system_devices_solarxr;
|
||||
+ }
|
||||
+ xsysd->xdev_count += count;
|
||||
+#endif
|
||||
+
|
||||
// Assign to role(s).
|
||||
ubrh->head = hmd_xdev;
|
||||
ubrh->left = left_xdev;
|
||||
diff --git a/src/xrt/targets/common/target_builder_steamvr.c b/src/xrt/targets/common/target_builder_steamvr.c
|
||||
index 7b70e6b7c7..0267bb900d 100644
|
||||
--- a/src/xrt/targets/common/target_builder_steamvr.c
|
||||
+++ b/src/xrt/targets/common/target_builder_steamvr.c
|
||||
@@ -34,6 +34,10 @@
|
||||
#include "xrt/xrt_space.h"
|
||||
#include "util/u_space_overseer.h"
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+#include "solarxr/solarxr_interface.h"
|
||||
+#endif
|
||||
+
|
||||
#ifndef XRT_BUILD_DRIVER_STEAMVR_LIGHTHOUSE
|
||||
#error "This builder requires the SteamVR Lighthouse driver"
|
||||
#endif
|
||||
@@ -115,6 +119,17 @@ steamvr_destroy(struct xrt_builder *xb)
|
||||
free(svrb);
|
||||
}
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+static void
|
||||
+destroy_system_devices_solarxr(struct xrt_system_devices *xsysd)
|
||||
+{
|
||||
+ void _Z7destroyP18xrt_system_devices(struct xrt_system_devices * xsysd);
|
||||
+
|
||||
+ solarxr_device_set_feeder_devices(xsysd->static_roles.body, NULL, 0);
|
||||
+ _Z7destroyP18xrt_system_devices(xsysd);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
static xrt_result_t
|
||||
steamvr_open_system(struct xrt_builder *xb,
|
||||
cJSON *config,
|
||||
@@ -151,6 +166,18 @@ steamvr_open_system(struct xrt_builder *xb,
|
||||
svrb->right_ht = u_system_devices_get_ht_device_right(xsysd);
|
||||
xsysd->static_roles.hand_tracking.right = svrb->right_ht;
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+ const uint32_t count =
|
||||
+ solarxr_device_create_xdevs(xsysd->static_roles.head->tracking_origin, &xsysd->xdevs[xsysd->xdev_count],
|
||||
+ ARRAY_SIZE(xsysd->xdevs) - xsysd->xdev_count);
|
||||
+ if (count != 0) {
|
||||
+ xsysd->static_roles.body = xsysd->xdevs[xsysd->xdev_count];
|
||||
+ solarxr_device_set_feeder_devices(xsysd->static_roles.body, xsysd->xdevs, xsysd->xdev_count);
|
||||
+ xsysd->destroy = destroy_system_devices_solarxr;
|
||||
+ }
|
||||
+ xsysd->xdev_count += count;
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* Space overseer.
|
||||
*/
|
||||
diff --git a/src/xrt/targets/common/target_builder_wmr.c b/src/xrt/targets/common/target_builder_wmr.c
|
||||
index 40df6b6535..d543c441c2 100644
|
||||
--- a/src/xrt/targets/common/target_builder_wmr.c
|
||||
+++ b/src/xrt/targets/common/target_builder_wmr.c
|
||||
@@ -26,6 +26,10 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+#include "solarxr/solarxr_interface.h"
|
||||
+#endif
|
||||
+
|
||||
#ifndef XRT_BUILD_DRIVER_WMR
|
||||
#error "Must only be built with XRT_BUILD_DRIVER_WMR set"
|
||||
#endif
|
||||
@@ -175,6 +179,16 @@ wmr_estimate_system(struct xrt_builder *xb,
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+static void
|
||||
+destroy_system_devices_solarxr(struct xrt_system_devices *xsysd)
|
||||
+{
|
||||
+ solarxr_device_set_feeder_devices(xsysd->static_roles.body, NULL, 0);
|
||||
+ u_system_devices_close(xsysd);
|
||||
+ free(xsysd);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
static xrt_result_t
|
||||
wmr_open_system_impl(struct xrt_builder *xb,
|
||||
cJSON *config,
|
||||
@@ -295,6 +309,17 @@ wmr_open_system_impl(struct xrt_builder *xb,
|
||||
right = ht_right;
|
||||
}
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+ const uint32_t count = solarxr_device_create_xdevs(head->tracking_origin, &xsysd->xdevs[xsysd->xdev_count],
|
||||
+ ARRAY_SIZE(xsysd->xdevs) - xsysd->xdev_count);
|
||||
+ if (count != 0) {
|
||||
+ xsysd->static_roles.body = xsysd->xdevs[xsysd->xdev_count];
|
||||
+ solarxr_device_set_feeder_devices(xsysd->static_roles.body, xsysd->xdevs, xsysd->xdev_count);
|
||||
+ xsysd->destroy = destroy_system_devices_solarxr;
|
||||
+ }
|
||||
+ xsysd->xdev_count += count;
|
||||
+#endif
|
||||
+
|
||||
|
||||
// Assign to role(s).
|
||||
ubrh->head = head;
|
||||
--
|
||||
GitLab
|
||||
|
||||
+24
-5
@@ -16,6 +16,7 @@ set(XRT_BUILD_DRIVER_RIFT_S OFF)
|
||||
set(XRT_BUILD_DRIVER_ROKID OFF)
|
||||
set(XRT_BUILD_DRIVER_SIMULATED OFF)
|
||||
set(XRT_BUILD_DRIVER_STEAMVR_LIGHTHOUSE ${WIVRN_FEATURE_STEAMVR_LIGHTHOUSE})
|
||||
set(XRT_BUILD_DRIVER_SOLARXR ${WIVRN_FEATURE_SOLARXR})
|
||||
set(XRT_BUILD_DRIVER_TWRAP OFF)
|
||||
set(XRT_BUILD_DRIVER_VF OFF)
|
||||
set(XRT_BUILD_DRIVER_VIVE OFF)
|
||||
@@ -33,6 +34,7 @@ set(XRT_FEATURE_WINDOW_PEEK OFF)
|
||||
set(XRT_FEATURE_OPENXR_ACTIVE_ACTION_SET_PRIORITY ON)
|
||||
set(XRT_FEATURE_RENDERDOC ${WIVRN_FEATURE_RENDERDOC})
|
||||
|
||||
set(XRT_FEATURE_OPENXR_BODY_TRACKING_FB ON)
|
||||
set(XRT_FEATURE_OPENXR_FACE_TRACKING2_FB ON)
|
||||
set(XRT_FEATURE_OPENXR_FACIAL_TRACKING_HTC ON)
|
||||
set(XRT_FEATURE_OPENXR_HAND_TRACKING_EXT ON)
|
||||
@@ -127,7 +129,11 @@ if (WIVRN_BUILD_SERVER)
|
||||
endif()
|
||||
|
||||
if(WIVRN_USE_NVENC)
|
||||
target_sources(wivrn-server PRIVATE encoder/video_encoder_nvenc.cpp)
|
||||
target_sources(
|
||||
wivrn-server
|
||||
PRIVATE encoder/video_encoder_nvenc.cpp
|
||||
encoder/video_encoder_nvenc_shared_state.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WIVRN_USE_VAAPI)
|
||||
@@ -188,6 +194,22 @@ if (WIVRN_BUILD_SERVER)
|
||||
target_link_libraries(wivrn-server PUBLIC wivrn-server-dbus)
|
||||
target_link_libraries(wivrn-server PUBLIC PkgConfig::libnotify)
|
||||
|
||||
if(WIVRN_USE_SYSTEMD)
|
||||
add_custom_command(OUTPUT systemd_manager.c systemd_manager.h
|
||||
COMMAND ${GDBUS_CODEGEN} ${CMAKE_CURRENT_SOURCE_DIR}/../dbus/org.freedesktop.systemd1.Manager.xml --interface-prefix org.freedesktop.systemd1 --generate-c-code systemd_manager --c-namespace systemd
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../dbus/org.freedesktop.systemd1.Manager.xml )
|
||||
add_custom_command(OUTPUT systemd_unit.c systemd_unit.h
|
||||
COMMAND ${GDBUS_CODEGEN} ${CMAKE_CURRENT_SOURCE_DIR}/../dbus/org.freedesktop.systemd1.Unit.xml --interface-prefix org.freedesktop.systemd1 --generate-c-code systemd_unit --c-namespace unit
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../dbus/org.freedesktop.systemd1.Manager.xml )
|
||||
target_sources(wivrn-server-dbus PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR}/systemd_manager.c ${CMAKE_CURRENT_BINARY_DIR}/systemd_manager.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/systemd_unit.c ${CMAKE_CURRENT_BINARY_DIR}/systemd_unit.h)
|
||||
target_sources(
|
||||
wivrn-server
|
||||
PRIVATE start_systemd_unit.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
wivrn-server
|
||||
PRIVATE
|
||||
@@ -202,6 +224,7 @@ if (WIVRN_BUILD_SERVER)
|
||||
PkgConfig::AVAHI
|
||||
Eigen3::Eigen
|
||||
wivrn-common
|
||||
wivrn-common-server
|
||||
wivrn-external
|
||||
nlohmann_json::nlohmann_json
|
||||
)
|
||||
@@ -212,10 +235,6 @@ if (WIVRN_BUILD_SERVER)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/wivrn.service
|
||||
DESTINATION lib/systemd/user/)
|
||||
|
||||
configure_file(dist/wivrn-application.service.in wivrn-application.service)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/wivrn-application.service
|
||||
DESTINATION lib/systemd/user/)
|
||||
|
||||
install(FILES dist/firewalld-wivrn.xml
|
||||
RENAME wivrn.xml
|
||||
DESTINATION lib/firewalld/services)
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
[Unit]
|
||||
Description=OpenXR streaming server
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=@CMAKE_INSTALL_PREFIX@/bin/wivrn-server --application
|
||||
Restart=on-failure
|
||||
RestartSec=0
|
||||
@@ -173,9 +173,9 @@ static float angles_to_center(float e, float l, float r)
|
||||
e = tan(e);
|
||||
l = tan(l);
|
||||
r = tan(r);
|
||||
float res = (e - l) / (r - l) * 2 - 1;
|
||||
float res = std::clamp((e - l) / (r - l) * 2 - 1, -1.f, 1.f);
|
||||
// If the center isn't in the FoV, fallback to middle of image
|
||||
if (res < -1 or res > 1 or std::isnan(res))
|
||||
if (std::isnan(res))
|
||||
return 0;
|
||||
return res;
|
||||
}
|
||||
@@ -274,6 +274,10 @@ void wivrn_foveation::compute_params(
|
||||
const xrt_fov fovs[2])
|
||||
{
|
||||
auto e = yaw_pitch(gaze);
|
||||
|
||||
if (manual_foveation.enabled)
|
||||
e.y = manual_foveation.pitch;
|
||||
|
||||
for (size_t i = 0; i < 2; ++i)
|
||||
{
|
||||
const auto & fov = fovs[i];
|
||||
@@ -281,7 +285,8 @@ void wivrn_foveation::compute_params(
|
||||
size_t extent_w = std::abs(src[i].extent.w);
|
||||
if (foveated_width < extent_w)
|
||||
{
|
||||
auto angle_x = convergence_angle(convergence_distance, eye_x[i], e.x);
|
||||
auto distance = manual_foveation.enabled ? manual_foveation.distance : convergence_distance;
|
||||
auto angle_x = convergence_angle(distance, eye_x[i], e.x);
|
||||
auto center = angles_to_center(angle_x, fov.angle_left, fov.angle_right);
|
||||
fill_param_2d(center, foveated_width, extent_w, params[i].x);
|
||||
}
|
||||
@@ -292,7 +297,7 @@ void wivrn_foveation::compute_params(
|
||||
if (foveated_height < extent_h)
|
||||
{
|
||||
auto angle_y = e.y;
|
||||
if (is_zero_quat(gaze))
|
||||
if (is_zero_quat(gaze) and not manual_foveation.enabled)
|
||||
{
|
||||
// Natural gaze is not straight forward, adjust the angle
|
||||
angle_y += angle_offset;
|
||||
@@ -371,6 +376,12 @@ void wivrn_foveation::update_tracking(const from_headset::tracking & tracking, c
|
||||
}
|
||||
}
|
||||
|
||||
void wivrn_foveation::update_foveation_center_override(const from_headset::override_foveation_center & center)
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
manual_foveation = center;
|
||||
}
|
||||
|
||||
std::array<to_headset::foveation_parameter, 2> wivrn_foveation::get_parameters()
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
@@ -395,6 +406,7 @@ static void fill_ubo(
|
||||
const int n_source = std::abs(n_ratio - int(i)) + 1;
|
||||
for (size_t j = 0; j < n; ++j)
|
||||
{
|
||||
assert(count > 0);
|
||||
if (flip)
|
||||
ubo[1] = ubo[0] - n_source;
|
||||
else
|
||||
@@ -441,14 +453,17 @@ vk::CommandBuffer wivrn_foveation::update_foveation_buffer(
|
||||
|
||||
// Check if the last value is still valid
|
||||
std::lock_guard lock(mutex);
|
||||
if (last.flip_y == flip_y //
|
||||
and last.src[0] == source[0] //
|
||||
and last.src[1] == source[1] //
|
||||
and last.fovs[0] == fovs[0] //
|
||||
and last.fovs[1] == fovs[1] //
|
||||
and last.gaze == gaze //
|
||||
and std::abs(last.eye_x[0] - eye_x[0]) < 0.0005 //
|
||||
and std::abs(last.eye_x[1] - eye_x[1]) < 0.0005 //
|
||||
if (last.flip_y == flip_y //
|
||||
and last.src[0] == source[0] //
|
||||
and last.src[1] == source[1] //
|
||||
and last.fovs[0] == fovs[0] //
|
||||
and last.fovs[1] == fovs[1] //
|
||||
and (last.gaze == gaze or manual_foveation.enabled) // Ignore the gaze if foveation center is overridden
|
||||
and std::abs(last.eye_x[0] - eye_x[0]) < 0.0005 //
|
||||
and std::abs(last.eye_x[1] - eye_x[1]) < 0.0005 //
|
||||
and last.manual_foveation.enabled == manual_foveation.enabled //
|
||||
and std::abs(last.manual_foveation.pitch - manual_foveation.pitch) < 0.0005 //
|
||||
and std::abs(last.manual_foveation.distance - manual_foveation.distance) < 0.0005 //
|
||||
)
|
||||
return nullptr;
|
||||
|
||||
@@ -458,6 +473,7 @@ vk::CommandBuffer wivrn_foveation::update_foveation_buffer(
|
||||
.src = {source[0], source[1]},
|
||||
.fovs = {fovs[0], fovs[1]},
|
||||
.eye_x = {eye_x[0], eye_x[1]},
|
||||
.manual_foveation = manual_foveation,
|
||||
};
|
||||
|
||||
compute_params(source, fovs);
|
||||
|
||||
@@ -48,6 +48,7 @@ class wivrn_foveation
|
||||
|
||||
float eye_x[2] = {}; // eye x position
|
||||
xrt_quat gaze = {};
|
||||
from_headset::override_foveation_center manual_foveation = {};
|
||||
std::array<to_headset::foveation_parameter, 2> params;
|
||||
|
||||
vk::raii::CommandPool command_pool;
|
||||
@@ -63,6 +64,8 @@ class wivrn_foveation
|
||||
xrt_rect src[2] = {};
|
||||
xrt_fov fovs[2] = {};
|
||||
float eye_x[2] = {};
|
||||
|
||||
from_headset::override_foveation_center manual_foveation = {};
|
||||
};
|
||||
P last;
|
||||
|
||||
@@ -75,6 +78,7 @@ public:
|
||||
wivrn_foveation(wivrn_vk_bundle &, const xrt_hmd_parts &);
|
||||
|
||||
void update_tracking(const from_headset::tracking &, const clock_offset &);
|
||||
void update_foveation_center_override(const from_headset::override_foveation_center &);
|
||||
std::array<to_headset::foveation_parameter, 2> get_parameters();
|
||||
|
||||
vk::CommandBuffer update_foveation_buffer(
|
||||
|
||||
@@ -42,13 +42,6 @@ class wivrn_hmd : public xrt_device
|
||||
.name = XRT_INPUT_GENERIC_HEAD_POSE,
|
||||
};
|
||||
xrt_hmd_parts hmd_parts{};
|
||||
xrt_tracking_origin tracking_origin{
|
||||
.name = "WiVRn origin",
|
||||
.type = XRT_TRACKING_TYPE_OTHER,
|
||||
.initial_offset = {
|
||||
.orientation = {0, 0, 0, 1},
|
||||
},
|
||||
};
|
||||
|
||||
view_list views;
|
||||
from_headset::battery battery{};
|
||||
@@ -66,6 +59,15 @@ class wivrn_hmd : public xrt_device
|
||||
|
||||
public:
|
||||
using base = xrt_device;
|
||||
|
||||
xrt_tracking_origin tracking_origin{
|
||||
.name = "WiVRn origin",
|
||||
.type = XRT_TRACKING_TYPE_OTHER,
|
||||
.initial_offset = {
|
||||
.orientation = {0, 0, 0, 1},
|
||||
},
|
||||
};
|
||||
|
||||
wivrn_hmd(wivrn::wivrn_session * cnx,
|
||||
const from_headset::headset_info_packet & info);
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "wivrn_session.h"
|
||||
|
||||
#include "accept_connection.h"
|
||||
#include "application.h"
|
||||
#include "driver/app_pacer.h"
|
||||
#include "main/comp_compositor.h"
|
||||
#include "main/comp_main_interface.h"
|
||||
@@ -34,6 +35,7 @@
|
||||
#include "wivrn_config.h"
|
||||
#include "wivrn_eye_tracker.h"
|
||||
#include "wivrn_fb_face2_tracker.h"
|
||||
#include "wivrn_foveation.h"
|
||||
#include "wivrn_generic_tracker.h"
|
||||
#include "wivrn_htc_face_tracker.h"
|
||||
#include "wivrn_ipc.h"
|
||||
@@ -55,7 +57,7 @@
|
||||
#endif
|
||||
|
||||
#if WIVRN_FEATURE_SOLARXR
|
||||
#include "solarxr_device.h"
|
||||
#include "solarxr_interface.h"
|
||||
#endif
|
||||
|
||||
namespace wivrn
|
||||
@@ -251,15 +253,13 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> connection
|
||||
}
|
||||
|
||||
#if WIVRN_FEATURE_SOLARXR
|
||||
xrt_device * solar_devs[XRT_SYSTEM_MAX_DEVICES];
|
||||
uint32_t solar_devs_cap = XRT_SYSTEM_MAX_DEVICES - xdev_count;
|
||||
uint32_t num_devs = solarxr_device_create_xdevs(&hmd, solar_devs, XRT_SYSTEM_MAX_DEVICES - xdev_count);
|
||||
for (int i = 0; i < num_devs; i++)
|
||||
uint32_t num_devs = solarxr_device_create_xdevs(&hmd.tracking_origin, &xdevs[xdev_count], ARRAY_SIZE(xdevs) - xdev_count);
|
||||
if (num_devs != 0)
|
||||
{
|
||||
xdevs[xdev_count++] = solar_devs[i];
|
||||
if (i == 0)
|
||||
static_roles.body = solar_devs[i];
|
||||
static_roles.body = xdevs[xdev_count];
|
||||
solarxr_device_set_feeder_devices(static_roles.body, xdevs, xdev_count);
|
||||
}
|
||||
xdev_count += num_devs;
|
||||
#endif
|
||||
|
||||
if (roles.left >= 0)
|
||||
@@ -278,6 +278,10 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> connection
|
||||
|
||||
wivrn_session::~wivrn_session()
|
||||
{
|
||||
#if WIVRN_FEATURE_SOLARXR
|
||||
solarxr_device_set_feeder_devices(static_roles.body, nullptr, 0);
|
||||
#endif
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(xdevs); i++)
|
||||
{
|
||||
xrt_device_destroy(&xdevs[i]);
|
||||
@@ -502,6 +506,13 @@ void wivrn_session::operator()(const from_headset::tracking & tracking)
|
||||
htc_face_tracker->update_tracking(tracking, offset);
|
||||
}
|
||||
|
||||
void wivrn_session::operator()(from_headset::override_foveation_center && foveation_center)
|
||||
{
|
||||
std::shared_lock lock(comp_target_mutex);
|
||||
if (comp_target)
|
||||
comp_target->foveation->update_foveation_center_override(foveation_center);
|
||||
}
|
||||
|
||||
void wivrn_session::operator()(from_headset::derived_pose && derived)
|
||||
{
|
||||
left_controller.set_derived_pose(derived);
|
||||
@@ -716,6 +727,28 @@ void wivrn_session::operator()(from_headset::refresh_rate_changed && event)
|
||||
});
|
||||
}
|
||||
|
||||
void wivrn_session::operator()(from_headset::get_application_list && request)
|
||||
{
|
||||
to_headset::application_list response{
|
||||
.language = std::move(request.language),
|
||||
.country = std::move(request.country),
|
||||
.variant = std::move(request.variant),
|
||||
};
|
||||
for (auto && [id, app]: list_applications())
|
||||
{
|
||||
response.applications.emplace_back(
|
||||
std::move(id),
|
||||
// FIXME: use locale
|
||||
app.name.at(""));
|
||||
}
|
||||
send_control(std::move(response));
|
||||
}
|
||||
|
||||
void wivrn_session::operator()(const from_headset::start_app & request)
|
||||
{
|
||||
send_to_main(request);
|
||||
}
|
||||
|
||||
void wivrn_session::operator()(audio_data && data)
|
||||
{
|
||||
if (audio_handle)
|
||||
|
||||
@@ -189,6 +189,9 @@ public:
|
||||
void operator()(from_headset::session_state_changed &&);
|
||||
void operator()(from_headset::user_presence_changed &&);
|
||||
void operator()(from_headset::refresh_rate_changed &&);
|
||||
void operator()(from_headset::override_foveation_center &&);
|
||||
void operator()(from_headset::get_application_list &&);
|
||||
void operator()(const from_headset::start_app &);
|
||||
void operator()(audio_data &&);
|
||||
|
||||
void operator()(to_monado::disconnect &&);
|
||||
|
||||
@@ -305,7 +305,7 @@ static std::vector<configuration::encoder> get_encoder_default_settings(wivrn_vk
|
||||
fill_defaults(bundle, headset_codecs, base, bit_depth);
|
||||
|
||||
#ifdef WIVRN_SPLIT_ENCODERS
|
||||
if (base.name != encoder_x264 and base.name != encoder_nvenc)
|
||||
if (base.name != encoder_x264)
|
||||
{
|
||||
/* Split in 3 parts:
|
||||
* +--------+--------+
|
||||
|
||||
@@ -336,7 +336,7 @@ void video_encoder::SendData(std::span<uint8_t> data, bool end_of_frame, bool co
|
||||
auto end = data.end();
|
||||
while (begin != end)
|
||||
{
|
||||
const size_t max_payload_size = to_headset::video_stream_data_shard::max_payload_size - serialized_size(shard.view_info);
|
||||
const size_t max_payload_size = std::max(0z, ssize_t(to_headset::video_stream_data_shard::max_payload_size) - ssize_t(serialized_size(shard.view_info)));
|
||||
auto next = std::min(end, begin + max_payload_size);
|
||||
if (next == end)
|
||||
{
|
||||
|
||||
@@ -37,15 +37,15 @@
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define NVENC_CHECK(x) \
|
||||
do \
|
||||
{ \
|
||||
NVENCSTATUS status = x; \
|
||||
if (status != NV_ENC_SUCCESS) \
|
||||
{ \
|
||||
U_LOG_E("%s:%d: %d, %s", __FILE__, __LINE__, status, fn.nvEncGetLastErrorString(session_handle)); \
|
||||
throw std::runtime_error("nvenc error"); \
|
||||
} \
|
||||
#define NVENC_CHECK(x) \
|
||||
do \
|
||||
{ \
|
||||
NVENCSTATUS status = x; \
|
||||
if (status != NV_ENC_SUCCESS) \
|
||||
{ \
|
||||
U_LOG_E("%s:%d: %d, %s", __FILE__, __LINE__, status, shared_state->fn.nvEncGetLastErrorString(session_handle)); \
|
||||
throw std::runtime_error("nvenc error"); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define CU_CHECK(x) \
|
||||
@@ -55,7 +55,7 @@
|
||||
if (status != CUDA_SUCCESS) \
|
||||
{ \
|
||||
const char * error_string; \
|
||||
cuda_fn->cuGetErrorString(status, &error_string); \
|
||||
shared_state->cuda_fn->cuGetErrorString(status, &error_string); \
|
||||
U_LOG_E("%s:%d: %s (%d)", __FILE__, __LINE__, error_string, (int)status); \
|
||||
throw std::runtime_error(std::string("CUDA error: ") + error_string); \
|
||||
} \
|
||||
@@ -64,62 +64,6 @@
|
||||
namespace wivrn
|
||||
{
|
||||
|
||||
void video_encoder_nvenc::deleter::operator()(CudaFunctions * fn)
|
||||
{
|
||||
cuda_free_functions(&fn);
|
||||
}
|
||||
void video_encoder_nvenc::deleter::operator()(NvencFunctions * fn)
|
||||
{
|
||||
nvenc_free_functions(&fn);
|
||||
}
|
||||
|
||||
static auto init()
|
||||
{
|
||||
std::unique_ptr<CudaFunctions, video_encoder_nvenc::deleter> cuda_fn;
|
||||
std::unique_ptr<NvencFunctions, video_encoder_nvenc::deleter> nvenc_fn;
|
||||
void * session_handle;
|
||||
|
||||
{
|
||||
CudaFunctions * tmp = nullptr;
|
||||
if (cuda_load_functions(&tmp, nullptr))
|
||||
throw std::runtime_error("Failed to load CUDA");
|
||||
cuda_fn.reset(tmp);
|
||||
}
|
||||
|
||||
{
|
||||
NvencFunctions * tmp = nullptr;
|
||||
if (nvenc_load_functions(&tmp, nullptr))
|
||||
throw std::runtime_error("Failed to load nvenc");
|
||||
nvenc_fn.reset(tmp);
|
||||
}
|
||||
|
||||
CU_CHECK(cuda_fn->cuInit(0));
|
||||
|
||||
CUcontext cuda;
|
||||
CU_CHECK(cuda_fn->cuCtxCreate(&cuda, 0, 0));
|
||||
|
||||
NV_ENCODE_API_FUNCTION_LIST fn{
|
||||
.version = NV_ENCODE_API_FUNCTION_LIST_VER,
|
||||
};
|
||||
NVENC_CHECK_NOENCODER(nvenc_fn->NvEncodeAPICreateInstance(&fn));
|
||||
|
||||
{
|
||||
NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS params{
|
||||
.version = NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER,
|
||||
.deviceType = NV_ENC_DEVICE_TYPE_CUDA,
|
||||
.device = cuda,
|
||||
.reserved = {},
|
||||
.apiVersion = NVENCAPI_VERSION,
|
||||
.reserved1 = {},
|
||||
.reserved2 = {},
|
||||
};
|
||||
|
||||
NVENC_CHECK_NOENCODER(fn.nvEncOpenEncodeSessionEx(¶ms, &session_handle));
|
||||
}
|
||||
|
||||
return std::make_tuple(std::move(cuda_fn), std::move(nvenc_fn), fn, cuda, session_handle);
|
||||
}
|
||||
|
||||
static auto encode_guid(video_codec codec)
|
||||
{
|
||||
switch (codec)
|
||||
@@ -141,13 +85,13 @@ video_encoder_nvenc::video_encoder_nvenc(
|
||||
uint8_t stream_idx) :
|
||||
video_encoder(stream_idx, settings.channels, settings.bitrate_multiplier, true),
|
||||
vk(vk),
|
||||
shared_state(video_encoder_nvenc_shared_state::get()),
|
||||
fps(fps),
|
||||
bitrate(settings.bitrate)
|
||||
{
|
||||
if (settings.bit_depth != 8)
|
||||
throw std::runtime_error("nvenc encoder only supports 8-bit encoding");
|
||||
|
||||
std::tie(cuda_fn, nvenc_fn, fn, cuda, session_handle) = init();
|
||||
assert(settings.width % 32 == 0);
|
||||
assert(settings.height % 32 == 0);
|
||||
rect = vk::Rect2D{
|
||||
@@ -161,12 +105,20 @@ video_encoder_nvenc::video_encoder_nvenc(
|
||||
},
|
||||
};
|
||||
|
||||
auto encodeGUID = encode_guid(settings.codec);
|
||||
NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS params_ex = {
|
||||
.version = NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER,
|
||||
.deviceType = NV_ENC_DEVICE_TYPE_CUDA,
|
||||
.device = shared_state->cuda,
|
||||
.apiVersion = NVENCAPI_VERSION,
|
||||
};
|
||||
NVENC_CHECK_NOENCODER(shared_state->fn.nvEncOpenEncodeSessionEx(¶ms_ex, &session_handle));
|
||||
|
||||
uint32_t count;
|
||||
std::vector<GUID> presets;
|
||||
auto encodeGUID = encode_guid(settings.codec);
|
||||
NVENC_CHECK(fn.nvEncGetEncodePresetCount(session_handle, encodeGUID, &count));
|
||||
NVENC_CHECK(shared_state->fn.nvEncGetEncodePresetCount(session_handle, encodeGUID, &count));
|
||||
presets.resize(count);
|
||||
NVENC_CHECK(fn.nvEncGetEncodePresetGUIDs(session_handle, encodeGUID, presets.data(), count, &count));
|
||||
NVENC_CHECK(shared_state->fn.nvEncGetEncodePresetGUIDs(session_handle, encodeGUID, presets.data(), count, &count));
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
@@ -178,7 +130,7 @@ video_encoder_nvenc::video_encoder_nvenc(
|
||||
.presetCfg = {
|
||||
.version = NV_ENC_CONFIG_VER,
|
||||
}};
|
||||
NVENC_CHECK(fn.nvEncGetEncodePresetConfigEx(session_handle, encodeGUID, presetGUID, tuningInfo, &preset_config));
|
||||
NVENC_CHECK(shared_state->fn.nvEncGetEncodePresetConfigEx(session_handle, encodeGUID, presetGUID, tuningInfo, &preset_config));
|
||||
|
||||
NV_ENC_CONFIG params = preset_config.presetCfg;
|
||||
|
||||
@@ -228,12 +180,12 @@ video_encoder_nvenc::video_encoder_nvenc(
|
||||
.enablePTD = 1,
|
||||
.encodeConfig = ¶ms,
|
||||
.tuningInfo = tuningInfo};
|
||||
NVENC_CHECK(fn.nvEncInitializeEncoder(session_handle, ¶ms2));
|
||||
NVENC_CHECK(shared_state->fn.nvEncInitializeEncoder(session_handle, ¶ms2));
|
||||
|
||||
NV_ENC_CREATE_BITSTREAM_BUFFER params3{
|
||||
.version = NV_ENC_CREATE_BITSTREAM_BUFFER_VER,
|
||||
};
|
||||
NVENC_CHECK(fn.nvEncCreateBitstreamBuffer(session_handle, ¶ms3));
|
||||
NVENC_CHECK(shared_state->fn.nvEncCreateBitstreamBuffer(session_handle, ¶ms3));
|
||||
bitstreamBuffer = params3.bitstreamBuffer;
|
||||
|
||||
vk::DeviceSize buffer_size = rect.extent.width * settings.video_height * 3 / 2;
|
||||
@@ -276,7 +228,7 @@ video_encoder_nvenc::video_encoder_nvenc(
|
||||
});
|
||||
|
||||
CUdeviceptr frame;
|
||||
CU_CHECK(cuda_fn->cuCtxPushCurrent(cuda));
|
||||
CU_CHECK(shared_state->cuda_fn->cuCtxPushCurrent(shared_state->cuda));
|
||||
{
|
||||
CUexternalMemory extmem;
|
||||
CUDA_EXTERNAL_MEMORY_HANDLE_DESC param{
|
||||
@@ -285,14 +237,14 @@ video_encoder_nvenc::video_encoder_nvenc(
|
||||
.size = memory_req.size,
|
||||
.flags = 0,
|
||||
};
|
||||
CU_CHECK(cuda_fn->cuImportExternalMemory(&extmem, ¶m));
|
||||
CU_CHECK(shared_state->cuda_fn->cuImportExternalMemory(&extmem, ¶m));
|
||||
|
||||
CUDA_EXTERNAL_MEMORY_BUFFER_DESC map_param{
|
||||
.offset = 0,
|
||||
.size = buffer_size,
|
||||
.flags = 0,
|
||||
};
|
||||
CU_CHECK(cuda_fn->cuExternalMemoryGetMappedBuffer(&frame, extmem, &map_param));
|
||||
CU_CHECK(shared_state->cuda_fn->cuExternalMemoryGetMappedBuffer(&frame, extmem, &map_param));
|
||||
}
|
||||
|
||||
NV_ENC_REGISTER_RESOURCE param3{
|
||||
@@ -305,18 +257,16 @@ video_encoder_nvenc::video_encoder_nvenc(
|
||||
.bufferFormat = NV_ENC_BUFFER_FORMAT_NV12,
|
||||
.bufferUsage = NV_ENC_INPUT_IMAGE,
|
||||
};
|
||||
NVENC_CHECK(fn.nvEncRegisterResource(session_handle, ¶m3));
|
||||
NVENC_CHECK(shared_state->fn.nvEncRegisterResource(session_handle, ¶m3));
|
||||
i.nvenc_resource = param3.registeredResource;
|
||||
}
|
||||
CU_CHECK(cuda_fn->cuCtxPopCurrent(NULL));
|
||||
CU_CHECK(shared_state->cuda_fn->cuCtxPopCurrent(NULL));
|
||||
}
|
||||
|
||||
video_encoder_nvenc::~video_encoder_nvenc()
|
||||
{
|
||||
if (session_handle)
|
||||
fn.nvEncDestroyEncoder(session_handle);
|
||||
if (cuda)
|
||||
cuda_fn->cuCtxDestroy(cuda);
|
||||
shared_state->fn.nvEncDestroyEncoder(session_handle);
|
||||
}
|
||||
|
||||
std::pair<bool, vk::Semaphore> video_encoder_nvenc::present_image(vk::Image y_cbcr, vk::raii::CommandBuffer & cmd_buf, uint8_t slot, uint64_t)
|
||||
@@ -367,12 +317,12 @@ std::pair<bool, vk::Semaphore> video_encoder_nvenc::present_image(vk::Image y_cb
|
||||
|
||||
std::optional<video_encoder::data> video_encoder_nvenc::encode(bool idr, std::chrono::steady_clock::time_point pts, uint8_t slot)
|
||||
{
|
||||
CU_CHECK(cuda_fn->cuCtxPushCurrent(cuda));
|
||||
CU_CHECK(shared_state->cuda_fn->cuCtxPushCurrent(shared_state->cuda));
|
||||
|
||||
NV_ENC_MAP_INPUT_RESOURCE param4{};
|
||||
param4.version = NV_ENC_MAP_INPUT_RESOURCE_VER;
|
||||
param4.registeredResource = in[slot].nvenc_resource;
|
||||
NVENC_CHECK(fn.nvEncMapInputResource(session_handle, ¶m4));
|
||||
NVENC_CHECK(shared_state->fn.nvEncMapInputResource(session_handle, ¶m4));
|
||||
|
||||
NV_ENC_PIC_PARAMS param{
|
||||
.version = NV_ENC_PIC_PARAMS_VER,
|
||||
@@ -387,30 +337,41 @@ std::optional<video_encoder::data> video_encoder_nvenc::encode(bool idr, std::ch
|
||||
.bufferFmt = param4.mappedBufferFmt,
|
||||
.pictureStruct = NV_ENC_PIC_STRUCT_FRAME,
|
||||
};
|
||||
NVENC_CHECK(fn.nvEncEncodePicture(session_handle, ¶m));
|
||||
NVENC_CHECK(shared_state->fn.nvEncEncodePicture(session_handle, ¶m));
|
||||
|
||||
NV_ENC_LOCK_BITSTREAM param2{
|
||||
.version = NV_ENC_LOCK_BITSTREAM_VER,
|
||||
.doNotWait = 0,
|
||||
.outputBitstream = bitstreamBuffer,
|
||||
};
|
||||
NVENC_CHECK(fn.nvEncLockBitstream(session_handle, ¶m2));
|
||||
NVENC_CHECK(shared_state->fn.nvEncLockBitstream(session_handle, ¶m2));
|
||||
|
||||
CU_CHECK(cuda_fn->cuCtxPopCurrent(NULL));
|
||||
CU_CHECK(shared_state->cuda_fn->cuCtxPopCurrent(NULL));
|
||||
return data{
|
||||
.encoder = this,
|
||||
.span = std::span((uint8_t *)param2.bitstreamBufferPtr, param2.bitstreamSizeInBytes),
|
||||
.mem = std::shared_ptr<void>(param2.bitstreamBufferPtr, [this](void *) {
|
||||
NVENCSTATUS status = fn.nvEncUnlockBitstream(session_handle, bitstreamBuffer);
|
||||
NVENCSTATUS status = shared_state->fn.nvEncUnlockBitstream(session_handle, bitstreamBuffer);
|
||||
if (status != NV_ENC_SUCCESS)
|
||||
U_LOG_E("%s:%d: %d, %s", __FILE__, __LINE__, status, fn.nvEncGetLastErrorString(session_handle));
|
||||
U_LOG_E("%s:%d: %d, %s", __FILE__, __LINE__, status, shared_state->fn.nvEncGetLastErrorString(session_handle));
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
std::array<int, 2> video_encoder_nvenc::get_max_size(video_codec codec)
|
||||
{
|
||||
auto [cuda_fn, nvenc_fn, fn, cuda, session_handle] = init();
|
||||
video_encoder_nvenc_shared_state state;
|
||||
void * session_handle = nullptr;
|
||||
NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS params_ex = {
|
||||
.version = NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER,
|
||||
.deviceType = NV_ENC_DEVICE_TYPE_CUDA,
|
||||
.device = state.cuda,
|
||||
.apiVersion = NVENCAPI_VERSION,
|
||||
};
|
||||
if (state.fn.nvEncOpenEncodeSessionEx(¶ms_ex, &session_handle) != NV_ENC_SUCCESS)
|
||||
{
|
||||
throw std::runtime_error("nvenc get_max_size: Failed to open session");
|
||||
}
|
||||
std::array<int, 2> result;
|
||||
std::exception_ptr ex;
|
||||
try
|
||||
@@ -425,15 +386,21 @@ std::array<int, 2> video_encoder_nvenc::get_max_size(video_codec codec)
|
||||
.version = NV_ENC_CAPS_PARAM_VER,
|
||||
.capsToQuery = NV_ENC_CAPS_WIDTH_MAX,
|
||||
};
|
||||
NVENC_CHECK(fn.nvEncGetEncodeCaps(session_handle, encodeGUID, &cap_param, res));
|
||||
NVENCSTATUS status = state.fn.nvEncGetEncodeCaps(session_handle, encodeGUID, &cap_param, res);
|
||||
if (status != NV_ENC_SUCCESS)
|
||||
{
|
||||
throw std::runtime_error("nvenc get_max_size: failed to get caps");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
ex = std::current_exception();
|
||||
}
|
||||
cuda_fn->cuCtxPopCurrent(NULL);
|
||||
fn.nvEncDestroyEncoder(session_handle);
|
||||
if (session_handle)
|
||||
{
|
||||
state.fn.nvEncDestroyEncoder(session_handle);
|
||||
}
|
||||
if (ex)
|
||||
std::rethrow_exception(ex);
|
||||
U_LOG_D("nvenc maximum encoded size: %dx%d", result[0], result[1]);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "video_encoder.h"
|
||||
#include "video_encoder_nvenc_shared_state.h"
|
||||
#include <array>
|
||||
#include <ffnvcodec/dynlink_cuda.h>
|
||||
#include <ffnvcodec/dynlink_loader.h>
|
||||
@@ -31,22 +32,13 @@ namespace wivrn
|
||||
|
||||
class video_encoder_nvenc : public video_encoder
|
||||
{
|
||||
public:
|
||||
struct deleter
|
||||
{
|
||||
void operator()(CudaFunctions * fn);
|
||||
void operator()(NvencFunctions * fn);
|
||||
};
|
||||
|
||||
private:
|
||||
wivrn_vk_bundle & vk;
|
||||
// relevant part of the input image to encode
|
||||
vk::Rect2D rect;
|
||||
|
||||
std::unique_ptr<CudaFunctions, deleter> cuda_fn;
|
||||
std::unique_ptr<NvencFunctions, deleter> nvenc_fn;
|
||||
NV_ENCODE_API_FUNCTION_LIST fn;
|
||||
CUcontext cuda;
|
||||
std::shared_ptr<video_encoder_nvenc_shared_state> shared_state;
|
||||
|
||||
void * session_handle = nullptr;
|
||||
NV_ENC_OUTPUT_PTR bitstreamBuffer;
|
||||
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2022-2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
* Copyright (C) 2022-2024 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 "video_encoder_nvenc_shared_state.h"
|
||||
#include "util/u_logging.h"
|
||||
|
||||
#include <bits/unique_lock.h>
|
||||
|
||||
void video_encoder_nvenc_shared_state::deleter::operator()(CudaFunctions * fn)
|
||||
{
|
||||
cuda_free_functions(&fn);
|
||||
}
|
||||
void video_encoder_nvenc_shared_state::deleter::operator()(NvencFunctions * fn)
|
||||
{
|
||||
nvenc_free_functions(&fn);
|
||||
}
|
||||
|
||||
#define NVENC_CHECK_NOENCODER(x) \
|
||||
do \
|
||||
{ \
|
||||
NVENCSTATUS status = x; \
|
||||
if (status != NV_ENC_SUCCESS) \
|
||||
{ \
|
||||
U_LOG_E("NVENC Init Error: %s:%d: %d", __FILE__, __LINE__, status); \
|
||||
throw std::runtime_error("nvenc init error"); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define CU_CHECK(x) \
|
||||
do \
|
||||
{ \
|
||||
CUresult status = x; \
|
||||
if (status != CUDA_SUCCESS) \
|
||||
{ \
|
||||
const char * error_string; \
|
||||
cuda_fn->cuGetErrorString(status, &error_string); \
|
||||
U_LOG_E("CUDA Init Error: %s:%d: %s (%d)", __FILE__, __LINE__, error_string, (int)status); \
|
||||
throw std::runtime_error(std::string("CUDA init error: ") + error_string); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
std::shared_ptr<video_encoder_nvenc_shared_state> video_encoder_nvenc_shared_state::get()
|
||||
{
|
||||
static std::weak_ptr<video_encoder_nvenc_shared_state> instance;
|
||||
static std::mutex m;
|
||||
std::unique_lock lock(m);
|
||||
auto s = instance.lock();
|
||||
if (s)
|
||||
return s;
|
||||
s.reset(new video_encoder_nvenc_shared_state());
|
||||
instance = s;
|
||||
return s;
|
||||
}
|
||||
|
||||
video_encoder_nvenc_shared_state::video_encoder_nvenc_shared_state()
|
||||
{
|
||||
CudaFunctions * tmp_cuda_fn = nullptr;
|
||||
if (cuda_load_functions(&tmp_cuda_fn, nullptr))
|
||||
{
|
||||
throw std::runtime_error("Failed to load CUDA functions");
|
||||
}
|
||||
cuda_fn.reset(tmp_cuda_fn);
|
||||
|
||||
NvencFunctions * tmp_nvenc_fn = nullptr;
|
||||
if (nvenc_load_functions(&tmp_nvenc_fn, nullptr))
|
||||
{
|
||||
throw std::runtime_error("Failed to load nvenc functions");
|
||||
}
|
||||
nvenc_fn.reset(tmp_nvenc_fn);
|
||||
|
||||
CU_CHECK(cuda_fn->cuInit(0));
|
||||
CU_CHECK(cuda_fn->cuCtxCreate(&cuda, 0, 0));
|
||||
|
||||
fn.version = NV_ENCODE_API_FUNCTION_LIST_VER;
|
||||
NVENC_CHECK_NOENCODER(nvenc_fn->NvEncodeAPICreateInstance(&fn));
|
||||
}
|
||||
|
||||
video_encoder_nvenc_shared_state::~video_encoder_nvenc_shared_state()
|
||||
{
|
||||
if (cuda)
|
||||
{
|
||||
cuda_fn->cuCtxDestroy(cuda);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2022-2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
* Copyright (C) 2022-2024 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 <memory>
|
||||
|
||||
#include <ffnvcodec/dynlink_cuda.h>
|
||||
#include <ffnvcodec/dynlink_loader.h>
|
||||
#include <ffnvcodec/nvEncodeAPI.h>
|
||||
|
||||
class video_encoder_nvenc_shared_state
|
||||
{
|
||||
public:
|
||||
struct deleter
|
||||
{
|
||||
void operator()(CudaFunctions * fn);
|
||||
void operator()(NvencFunctions * fn);
|
||||
};
|
||||
|
||||
static std::shared_ptr<video_encoder_nvenc_shared_state> get();
|
||||
std::unique_ptr<CudaFunctions, deleter> cuda_fn;
|
||||
std::unique_ptr<NvencFunctions, deleter> nvenc_fn;
|
||||
NV_ENCODE_API_FUNCTION_LIST fn = {};
|
||||
CUcontext cuda = nullptr;
|
||||
|
||||
video_encoder_nvenc_shared_state();
|
||||
~video_encoder_nvenc_shared_state();
|
||||
|
||||
video_encoder_nvenc_shared_state(const video_encoder_nvenc_shared_state &) = delete;
|
||||
video_encoder_nvenc_shared_state & operator=(const video_encoder_nvenc_shared_state &) = delete;
|
||||
video_encoder_nvenc_shared_state(video_encoder_nvenc_shared_state &&) = delete;
|
||||
video_encoder_nvenc_shared_state & operator=(video_encoder_nvenc_shared_state &&) = delete;
|
||||
};
|
||||
+32
-73
@@ -5,6 +5,7 @@
|
||||
* @brief Main file for WiVRn Monado service.
|
||||
*/
|
||||
|
||||
#include "application.h"
|
||||
#include "openxr/openxr.h"
|
||||
#include "sleep_inhibitor.h"
|
||||
#include "util/u_trace_marker.h"
|
||||
@@ -33,7 +34,6 @@
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <libnotify/notification.h>
|
||||
#include <memory>
|
||||
#include <poll.h>
|
||||
@@ -53,6 +53,10 @@
|
||||
#include <shared/ipc_protocol.h>
|
||||
#include <util/u_file.h>
|
||||
|
||||
#if WIVRN_USE_SYSTEMD
|
||||
#include "start_systemd_unit.h"
|
||||
#endif
|
||||
|
||||
// Insert the on load constructor to init trace marker.
|
||||
U_TRACE_TARGET_SETUP(U_TRACE_WHICH_SERVICE)
|
||||
|
||||
@@ -124,21 +128,6 @@ int create_listen_socket()
|
||||
return fd;
|
||||
}
|
||||
|
||||
void display_child_status(int wstatus, const std::string & name)
|
||||
{
|
||||
std::cerr << name << " exited, exit status " << WEXITSTATUS(wstatus);
|
||||
if (WIFSIGNALED(wstatus))
|
||||
{
|
||||
std::cerr << ", received signal " << sigabbrev_np(WTERMSIG(wstatus)) << " ("
|
||||
<< strsignal(WTERMSIG(wstatus)) << ")"
|
||||
<< (WCOREDUMP(wstatus) ? ", core dumped" : "") << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
static std::filesystem::path flatpak_app_path()
|
||||
{
|
||||
if (auto value = flatpak_key(flatpak::section::instance, "app-path"))
|
||||
@@ -197,9 +186,7 @@ guint server_kill_watch;
|
||||
pid_t server_pid;
|
||||
std::optional<std::jthread> connection_thread;
|
||||
|
||||
guint app_watch;
|
||||
guint app_kill_watch;
|
||||
pid_t app_pid;
|
||||
std::unique_ptr<children_manager> children;
|
||||
|
||||
bool quitting_main_loop;
|
||||
bool do_fork;
|
||||
@@ -236,37 +223,6 @@ void stop_publishing();
|
||||
|
||||
void update_fsm();
|
||||
|
||||
void start_app()
|
||||
{
|
||||
#if WIVRN_USE_SYSTEMD
|
||||
app_pid = use_systemd ? start_unit_file() : fork_application();
|
||||
#else
|
||||
app_pid = fork_application();
|
||||
#endif
|
||||
|
||||
assert(app_watch == 0);
|
||||
assert(app_kill_watch == 0);
|
||||
if (app_pid > 0)
|
||||
{
|
||||
app_watch = g_child_watch_add(app_pid, [](pid_t, int status, void *) {
|
||||
display_child_status(status, "Application");
|
||||
g_source_remove(app_watch);
|
||||
if (app_kill_watch)
|
||||
g_source_remove(app_kill_watch);
|
||||
|
||||
app_watch = 0;
|
||||
app_kill_watch = 0;
|
||||
|
||||
update_fsm(); }, nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
app_watch = 0;
|
||||
if (app_pid < 0)
|
||||
throw std::system_error(-app_pid, std::system_category());
|
||||
}
|
||||
}
|
||||
|
||||
void start_server(configuration config)
|
||||
{
|
||||
server_pid = do_fork ? fork() : 0;
|
||||
@@ -339,17 +295,6 @@ void start_server(configuration config)
|
||||
runtime_setter.emplace();
|
||||
}
|
||||
|
||||
void kill_app()
|
||||
{
|
||||
kill(-app_pid, SIGTERM);
|
||||
|
||||
// Send SIGKILL after 1s if it is still running
|
||||
app_kill_watch = g_timeout_add(1000, [](void *) {
|
||||
assert(app_pid > 0);
|
||||
kill(-app_pid, SIGKILL);
|
||||
return G_SOURCE_REMOVE; }, 0);
|
||||
}
|
||||
|
||||
void kill_server()
|
||||
{
|
||||
// Write to the server's stdin to make it quit
|
||||
@@ -421,7 +366,7 @@ void stop_publishing()
|
||||
void update_fsm()
|
||||
{
|
||||
bool server_running = server_watch != 0 or connection_thread;
|
||||
bool app_running = app_watch != 0;
|
||||
bool app_running = children->running();
|
||||
|
||||
if (quitting_main_loop)
|
||||
{
|
||||
@@ -431,15 +376,18 @@ void update_fsm()
|
||||
kill_server();
|
||||
|
||||
if (app_running)
|
||||
kill_app();
|
||||
children->stop();
|
||||
|
||||
if (not server_running and not app_running)
|
||||
{
|
||||
children.reset(nullptr);
|
||||
g_main_loop_quit(main_loop);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (not server_running and app_running)
|
||||
kill_app();
|
||||
children->stop();
|
||||
|
||||
if (not server_running)
|
||||
{
|
||||
@@ -479,10 +427,11 @@ gboolean headset_connected_success(void *)
|
||||
|
||||
expose_known_keys_on_dbus();
|
||||
|
||||
start_server(configuration());
|
||||
configuration c;
|
||||
start_server(c);
|
||||
try
|
||||
{
|
||||
start_app();
|
||||
children->start_application(c.application);
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
@@ -519,7 +468,7 @@ gboolean headset_connected_incorrect_pin(void *)
|
||||
gboolean headset_connected(gint fd, GIOCondition condition, gpointer user_data)
|
||||
{
|
||||
assert(server_watch == 0);
|
||||
assert(app_watch == 0);
|
||||
assert(not children->running());
|
||||
assert(not connection_thread);
|
||||
assert(listener);
|
||||
|
||||
@@ -562,6 +511,11 @@ gboolean control_received(gint fd, GIOCondition condition, gpointer user_data)
|
||||
inhibitor.emplace();
|
||||
wivrn_server_set_headset_connected(dbus_server, true);
|
||||
},
|
||||
[&](const wivrn::from_headset::start_app & request) {
|
||||
const auto & apps = list_applications();
|
||||
if (auto it = apps.find(request.app_id); it != apps.end())
|
||||
children->start_application(it->second.exec);
|
||||
},
|
||||
[&](const from_monado::headset_connected &) {
|
||||
stop_publishing();
|
||||
inhibitor.emplace();
|
||||
@@ -816,6 +770,17 @@ void on_headset_info_packet(const wivrn::from_headset::headset_info_packet & inf
|
||||
|
||||
void on_name_acquired(GDBusConnection * connection, const gchar * name, gpointer user_data)
|
||||
{
|
||||
#if WIVRN_USE_SYSTEMD
|
||||
if (use_systemd)
|
||||
{
|
||||
children = std::make_unique<systemd_units_manager>(connection, update_fsm);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
children = std::make_unique<forked_children>(update_fsm);
|
||||
}
|
||||
|
||||
dbus_server = wivrn_server_skeleton_new();
|
||||
|
||||
g_signal_connect(dbus_server,
|
||||
@@ -1016,8 +981,6 @@ int main(int argc, char * argv[])
|
||||
auto no_publish = app.add_flag("--no-publish-service")->description("disable publishing the service through avahi");
|
||||
auto no_encrypt = app.add_flag("--no-encrypt")->description("disable encryption")->group("Debug");
|
||||
#if WIVRN_USE_SYSTEMD
|
||||
// --application should only be used from wivrn-application unit file
|
||||
auto app_flag = app.add_flag("--application")->group("");
|
||||
app.add_flag("--systemd", use_systemd, "use systemd to launch user-configured application");
|
||||
#endif
|
||||
|
||||
@@ -1043,10 +1006,6 @@ int main(int argc, char * argv[])
|
||||
else
|
||||
publication = configuration().publication;
|
||||
|
||||
#if WIVRN_USE_SYSTEMD
|
||||
if (*app_flag)
|
||||
return exec_application(configuration());
|
||||
#endif
|
||||
try
|
||||
{
|
||||
return inner_main(argc, argv, not *no_instructions);
|
||||
|
||||
+175
-234
@@ -1,276 +1,165 @@
|
||||
// Copyright 2024, Gavin John et al.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief Main file for WiVRn Monado service.
|
||||
* @author Gavin John
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2024 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 "start_application.h"
|
||||
|
||||
#include "driver/configuration.h"
|
||||
#include "utils/flatpak.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
#if WIVRN_USE_SYSTEMD
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
#include <systemd/sd-bus.h>
|
||||
#include <thread>
|
||||
|
||||
namespace
|
||||
namespace wivrn
|
||||
{
|
||||
|
||||
struct deleter
|
||||
children_manager::~children_manager() {}
|
||||
|
||||
static std::vector<std::string> unescape_string(const std::string & app_string)
|
||||
{
|
||||
void operator()(sd_bus * p)
|
||||
std::vector<std::string> app;
|
||||
app.emplace_back();
|
||||
|
||||
bool seen_backslash = false;
|
||||
bool seen_single_quote = false;
|
||||
bool seen_double_quote = false;
|
||||
for (auto c: app_string)
|
||||
{
|
||||
sd_bus_unref(p);
|
||||
}
|
||||
void operator()(sd_bus_message * p)
|
||||
{
|
||||
sd_bus_message_unref(p);
|
||||
}
|
||||
};
|
||||
|
||||
using sd_bus_ptr = std::unique_ptr<sd_bus, deleter>;
|
||||
|
||||
sd_bus_ptr get_user_bus()
|
||||
{
|
||||
sd_bus * bus = nullptr;
|
||||
int ret;
|
||||
// reimplement sd_bus_open_user to honor the env variable
|
||||
if (const char * bus_address = getenv("DBUS_SESSION_BUS_ADDRESS"))
|
||||
{
|
||||
if (ret = sd_bus_new(&bus); ret < 0)
|
||||
throw std::system_error(-ret, std::system_category(), "failed to create dbus object");
|
||||
sd_bus_ptr res(bus);
|
||||
|
||||
if (ret = sd_bus_set_address(bus, bus_address); ret < 0)
|
||||
throw std::system_error(-ret, std::system_category(), std::string("failed to connect to dbus at address ") + bus_address);
|
||||
|
||||
if (ret = sd_bus_set_bus_client(bus, 1); ret < 0)
|
||||
throw std::system_error(-ret, std::system_category(), std::string("failed to configure dbus at address ") + bus_address);
|
||||
if (ret = sd_bus_set_trusted(bus, 1); ret < 0)
|
||||
throw std::system_error(-ret, std::system_category(), std::string("failed to trust dbus at address ") + bus_address);
|
||||
|
||||
if (ret = sd_bus_start(bus); ret < 0)
|
||||
throw std::system_error(-ret, std::system_category(), std::string("failed to start dbus connection ") + bus_address);
|
||||
|
||||
return res;
|
||||
}
|
||||
if (ret = sd_bus_open_user(&bus); ret < 0)
|
||||
throw std::system_error(-ret, std::system_category(), "failed to connect to dbus");
|
||||
|
||||
return sd_bus_ptr(bus);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
static int get_service_pid(sd_bus * bus, const std::string & service_name, pid_t & pid)
|
||||
{
|
||||
sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
sd_bus_message * msg = nullptr;
|
||||
const char * destination = "org.freedesktop.systemd1";
|
||||
const char * path = "/org/freedesktop/systemd1";
|
||||
const char * interface = "org.freedesktop.systemd1.Manager";
|
||||
const char * member = "GetUnit";
|
||||
|
||||
int ret = 0;
|
||||
|
||||
// Call the method
|
||||
ret = sd_bus_call_method(bus, destination, path, interface, member, &error, &msg, "s", service_name.c_str());
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cerr << "Failed to issue method call: " << error.message << std::endl;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
// Parse the response message
|
||||
const char * object_path;
|
||||
ret = sd_bus_message_read(msg, "o", &object_path);
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cerr << "Failed to parse response message: " << strerror(-ret) << std::endl;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
// Get the service's main PID
|
||||
ret = sd_bus_get_property_trivial(bus, destination, object_path, "org.freedesktop.systemd1.Service", "MainPID", &error, 'u', &pid);
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cerr << "Failed to get PID: " << error.message << std::endl;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
finish:
|
||||
sd_bus_error_free(&error);
|
||||
sd_bus_message_unref(msg);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int start_service(sd_bus * bus, const std::string & service_name)
|
||||
{
|
||||
sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
sd_bus_message * msg = nullptr;
|
||||
const char * destination = "org.freedesktop.systemd1";
|
||||
const char * path = "/org/freedesktop/systemd1";
|
||||
const char * interface = "org.freedesktop.systemd1.Manager";
|
||||
const char * member = "StartUnit";
|
||||
const char * mode = "replace";
|
||||
|
||||
// Call the method to start the service
|
||||
int ret = sd_bus_call_method(bus, destination, path, interface, member, &error, &msg, "ss", service_name.c_str(), mode);
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cerr << "Failed to start service: " << error.message << std::endl;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
finish:
|
||||
sd_bus_error_free(&error);
|
||||
sd_bus_message_unref(msg);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool is_service_active(sd_bus * bus, const std::string & service_name)
|
||||
{
|
||||
sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
sd_bus_message * msg = nullptr;
|
||||
const char * destination = "org.freedesktop.systemd1";
|
||||
const char * path = "/org/freedesktop/systemd1";
|
||||
const char * interface = "org.freedesktop.systemd1.Manager";
|
||||
const char * member = "GetUnit";
|
||||
|
||||
bool is_active = false;
|
||||
const char * object_path;
|
||||
// Call the method
|
||||
int ret = sd_bus_call_method(bus, destination, path, interface, member, &error, &msg, "s", service_name.c_str());
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cerr << "Failed to issue method call: " << error.message << std::endl;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
// Parse the response message
|
||||
ret = sd_bus_message_read(msg, "o", &object_path);
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cerr << "Failed to parse response message: " << strerror(-ret) << std::endl;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
// Check the service's ActiveState property
|
||||
char * active_state;
|
||||
ret = sd_bus_get_property_string(bus, destination, object_path, "org.freedesktop.systemd1.Unit", "ActiveState", &error, &active_state);
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cerr << "Failed to get ActiveState: " << error.message << std::endl;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
is_active = (std::string_view(active_state) == "active");
|
||||
|
||||
finish:
|
||||
sd_bus_error_free(&error);
|
||||
sd_bus_message_unref(msg);
|
||||
return is_active;
|
||||
}
|
||||
|
||||
pid_t wivrn::start_unit_file()
|
||||
{
|
||||
std::string service_name = "wivrn-application.service";
|
||||
pid_t pid;
|
||||
auto bus = get_user_bus();
|
||||
int ret = get_service_pid(bus.get(), service_name, pid);
|
||||
|
||||
if (ret < 0 || pid == 0)
|
||||
{
|
||||
ret = start_service(bus.get(), service_name);
|
||||
if (ret < 0)
|
||||
if (seen_backslash)
|
||||
{
|
||||
std::cerr << "Failed to start service " << service_name << std::endl;
|
||||
return ret;
|
||||
app.back() += c;
|
||||
seen_backslash = false;
|
||||
}
|
||||
|
||||
// Wait until the service is active
|
||||
while (!is_service_active(bus.get(), service_name))
|
||||
else if (seen_single_quote)
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
if (c == '\'')
|
||||
seen_single_quote = false;
|
||||
else if (c == '\\')
|
||||
seen_backslash = true;
|
||||
else
|
||||
app.back() += c;
|
||||
}
|
||||
|
||||
// Try to get the PID again
|
||||
ret = get_service_pid(bus.get(), service_name, pid);
|
||||
if (ret < 0)
|
||||
else if (seen_double_quote)
|
||||
{
|
||||
std::cerr << "Failed to get PID for service " << service_name << std::endl;
|
||||
return ret;
|
||||
if (c == '"')
|
||||
seen_double_quote = false;
|
||||
else if (c == '\\')
|
||||
seen_backslash = true;
|
||||
else
|
||||
app.back() += c;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case '\\':
|
||||
seen_backslash = true;
|
||||
break;
|
||||
case '\'':
|
||||
seen_single_quote = true;
|
||||
break;
|
||||
case '"':
|
||||
seen_double_quote = true;
|
||||
break;
|
||||
case ' ':
|
||||
if (app.back() != "")
|
||||
app.emplace_back();
|
||||
break;
|
||||
default:
|
||||
app.back() += c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pid;
|
||||
if (app.back() == "")
|
||||
app.pop_back();
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
pid_t wivrn::fork_application()
|
||||
void children_manager::start_application(const std::string & exec)
|
||||
{
|
||||
configuration config;
|
||||
start_application(unescape_string(exec));
|
||||
}
|
||||
|
||||
if (config.application.empty())
|
||||
return 0;
|
||||
forked_children::forked_children(std::function<void()> state_changed_cb) :
|
||||
state_changed_cb(state_changed_cb) {}
|
||||
|
||||
void forked_children::start_application(const std::vector<std::string> & args)
|
||||
{
|
||||
if (args.empty())
|
||||
return;
|
||||
|
||||
pid_t application_pid = fork();
|
||||
|
||||
if (application_pid < 0)
|
||||
{
|
||||
throw std::system_error(errno, std::system_category(), "fork");
|
||||
}
|
||||
|
||||
if (application_pid == 0)
|
||||
if (application_pid > 0)
|
||||
{
|
||||
// Start a new process group so that all processes started by the
|
||||
// application can be signaled
|
||||
setpgrp();
|
||||
guint app_watch = g_child_watch_add(
|
||||
application_pid,
|
||||
[](pid_t pid, int status, void * self_) {
|
||||
auto self = (forked_children *)self_;
|
||||
bool empty = self->children.empty();
|
||||
auto node = self->children.extract(pid);
|
||||
if (not node)
|
||||
{
|
||||
std::cerr << "Failed to update child application information" << std::endl;
|
||||
}
|
||||
display_child_status(status, "Application");
|
||||
const auto & watches = node.mapped();
|
||||
g_source_remove(watches.child);
|
||||
if (watches.kill)
|
||||
g_source_remove(watches.kill);
|
||||
|
||||
return exec_application(config);
|
||||
if (self->state_changed_cb and self->children.empty() and not empty)
|
||||
self->state_changed_cb();
|
||||
},
|
||||
this);
|
||||
children.emplace(application_pid, watches{.child = app_watch});
|
||||
return;
|
||||
}
|
||||
|
||||
return application_pid;
|
||||
}
|
||||
|
||||
int wivrn::exec_application(configuration config)
|
||||
{
|
||||
if (config.application.empty())
|
||||
return 0;
|
||||
|
||||
std::string executable;
|
||||
std::vector<std::string> args;
|
||||
|
||||
if (flatpak_key(flatpak::section::session_bus_policy, "org.freedesktop.Flatpak") == "talk")
|
||||
{
|
||||
executable = "flatpak-spawn";
|
||||
args.push_back("flatpak-spawn");
|
||||
args.push_back("--host");
|
||||
}
|
||||
else
|
||||
{
|
||||
executable = config.application.front();
|
||||
}
|
||||
|
||||
for (auto & arg: config.application)
|
||||
args.push_back(arg.data());
|
||||
// Start a new process group so that all processes started by the
|
||||
// application can be signaled
|
||||
setpgrp();
|
||||
|
||||
std::vector<std::string> tmp;
|
||||
std::vector<char *> argv;
|
||||
argv.reserve(args.size());
|
||||
argv.reserve(args.size() + 3);
|
||||
|
||||
for (auto & i: args)
|
||||
argv.push_back(i.data());
|
||||
if (wivrn::flatpak_key(wivrn::flatpak::section::session_bus_policy, "org.freedesktop.Flatpak") == "talk")
|
||||
{
|
||||
tmp.push_back("flatpak-spawn");
|
||||
tmp.push_back("--host");
|
||||
}
|
||||
|
||||
tmp.insert(tmp.end(), args.begin(), args.end());
|
||||
for (auto & arg: tmp)
|
||||
argv.push_back(arg.data());
|
||||
argv.push_back(nullptr);
|
||||
|
||||
std::string executable = argv.front();
|
||||
|
||||
std::cerr << "Launching " << executable << std::endl;
|
||||
std::cerr << "With args:" << std::endl;
|
||||
for (auto & i: argv)
|
||||
@@ -280,7 +169,59 @@ int wivrn::exec_application(configuration config)
|
||||
}
|
||||
|
||||
execvp(executable.c_str(), argv.data());
|
||||
|
||||
perror("Cannot start application");
|
||||
perror("Failed to start application");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
forked_children::~forked_children()
|
||||
{
|
||||
for (auto & [pid, watches]: children)
|
||||
{
|
||||
g_source_remove(watches.child);
|
||||
if (watches.kill)
|
||||
g_source_remove(watches.kill);
|
||||
}
|
||||
}
|
||||
|
||||
bool forked_children::running() const
|
||||
{
|
||||
return not children.empty();
|
||||
}
|
||||
|
||||
void forked_children::stop()
|
||||
{
|
||||
for (auto & [pid, watches]: children)
|
||||
{
|
||||
kill(-pid, SIGTERM);
|
||||
intptr_t pid_ptr = pid;
|
||||
|
||||
// Send SIGKILL after 1s if it is still running
|
||||
static_assert(sizeof(pid_t) < sizeof(intptr_t));
|
||||
watches.kill = g_timeout_add(
|
||||
1000,
|
||||
[](void * pid_) {
|
||||
auto pid = (intptr_t)pid_;
|
||||
assert(pid > 0);
|
||||
kill(-pid, SIGKILL);
|
||||
return G_SOURCE_REMOVE;
|
||||
},
|
||||
(void *)pid_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void display_child_status(int wstatus, const std::string & name)
|
||||
{
|
||||
std::cerr << name << " exited, exit status " << WEXITSTATUS(wstatus);
|
||||
if (WIFSIGNALED(wstatus))
|
||||
{
|
||||
std::cerr << ", received signal " << sigabbrev_np(WTERMSIG(wstatus)) << " ("
|
||||
<< strsignal(WTERMSIG(wstatus)) << ")"
|
||||
<< (WCOREDUMP(wstatus) ? ", core dumped" : "") << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace wivrn
|
||||
|
||||
@@ -1,18 +1,67 @@
|
||||
/*
|
||||
* 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 "wivrn_config.h"
|
||||
|
||||
#include <functional>
|
||||
#include <glib.h>
|
||||
#include <string>
|
||||
#include <sys/types.h>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace wivrn
|
||||
{
|
||||
struct configuration;
|
||||
|
||||
pid_t fork_application();
|
||||
class children_manager
|
||||
{
|
||||
public:
|
||||
virtual ~children_manager();
|
||||
|
||||
#if WIVRN_USE_SYSTEMD
|
||||
pid_t start_unit_file();
|
||||
#endif
|
||||
virtual void start_application(const std::vector<std::string> &) = 0;
|
||||
void start_application(const std::string &);
|
||||
|
||||
int exec_application(configuration);
|
||||
virtual bool running() const = 0;
|
||||
|
||||
virtual void stop() = 0;
|
||||
};
|
||||
|
||||
// Start applications using fork+exec
|
||||
class forked_children : public children_manager
|
||||
{
|
||||
struct watches
|
||||
{
|
||||
guint child = 0;
|
||||
guint kill = 0;
|
||||
};
|
||||
std::unordered_map<pid_t, watches> children;
|
||||
std::function<void()> state_changed_cb;
|
||||
|
||||
public:
|
||||
forked_children(std::function<void()> state_changed_cb);
|
||||
virtual ~forked_children();
|
||||
|
||||
void start_application(const std::vector<std::string> &) override;
|
||||
|
||||
// true if any unit started by this object is still running
|
||||
bool running() const override;
|
||||
|
||||
void stop() override;
|
||||
};
|
||||
|
||||
void display_child_status(int wstatus, const std::string & name);
|
||||
} // namespace wivrn
|
||||
|
||||
@@ -0,0 +1,248 @@
|
||||
/*
|
||||
* 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 "start_systemd_unit.h"
|
||||
#include "systemd_manager.h"
|
||||
#include "systemd_unit.h"
|
||||
#include <gio/gio.h>
|
||||
#include <glib-object.h>
|
||||
#include <iostream>
|
||||
|
||||
#include <chrono>
|
||||
#include <format>
|
||||
|
||||
namespace wivrn
|
||||
{
|
||||
|
||||
void systemd_units_manager::deleter::operator()(systemdManager * obj)
|
||||
{
|
||||
g_object_unref(obj);
|
||||
}
|
||||
void systemd_units_manager::deleter::operator()(unitUnit * obj)
|
||||
{
|
||||
g_object_unref(obj);
|
||||
}
|
||||
|
||||
systemd_units_manager::systemd_units_manager(GDBusConnection * connection, std::function<void()> state_changed_cb) :
|
||||
connection(connection), state_changed_cb(state_changed_cb)
|
||||
{
|
||||
GError * error = nullptr;
|
||||
proxy.reset(systemd_manager_proxy_new_sync(
|
||||
connection,
|
||||
G_DBUS_PROXY_FLAGS_NONE,
|
||||
"org.freedesktop.systemd1",
|
||||
"/org/freedesktop/systemd1",
|
||||
nullptr,
|
||||
&error));
|
||||
|
||||
if (error)
|
||||
{
|
||||
std::runtime_error e(std::string("Failed to connect to systemd user session: ") + error->message);
|
||||
g_error_free(error);
|
||||
throw e;
|
||||
}
|
||||
|
||||
systemd_manager_call_subscribe_sync(
|
||||
proxy.get(),
|
||||
nullptr,
|
||||
&error);
|
||||
|
||||
if (error)
|
||||
{
|
||||
std::runtime_error e(std::string("Failed to subscribe to systemd messages: ") + error->message);
|
||||
g_error_free(error);
|
||||
throw e;
|
||||
}
|
||||
|
||||
g_signal_connect(proxy.get(),
|
||||
"job-removed",
|
||||
G_CALLBACK(&on_job_removed),
|
||||
this);
|
||||
}
|
||||
|
||||
bool systemd_units_manager::running() const
|
||||
{
|
||||
return not(jobs.empty() and units.empty());
|
||||
}
|
||||
|
||||
void systemd_units_manager::stop()
|
||||
{
|
||||
for (auto & unit: units)
|
||||
{
|
||||
unit_unit_call_stop(unit.get(),
|
||||
"replace",
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void systemd_units_manager::on_job_removed(
|
||||
systemdManagerProxy * connection,
|
||||
guint32 id,
|
||||
gchar * job,
|
||||
gchar * unit,
|
||||
gchar * result,
|
||||
void * self_)
|
||||
{
|
||||
auto self = (systemd_units_manager *)(self_);
|
||||
|
||||
auto node = self->jobs.extract(job);
|
||||
if (node.empty())
|
||||
return;
|
||||
|
||||
if (strcmp(result, "done"))
|
||||
{
|
||||
std::cerr << "Failed to start application " << node.mapped() << ": " << result << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::string object = "/org/freedesktop/systemd1/unit/";
|
||||
for (char * c = unit; *c != '\0'; ++c)
|
||||
{
|
||||
if (std::isalnum(*c))
|
||||
object += *c;
|
||||
else
|
||||
object += std::format("_{:02x}", *c);
|
||||
}
|
||||
|
||||
unit_unit_proxy_new(
|
||||
self->connection,
|
||||
G_DBUS_PROXY_FLAGS_NONE,
|
||||
"org.freedesktop.systemd1",
|
||||
object.c_str(),
|
||||
nullptr,
|
||||
[](GObject * source_object, GAsyncResult * res, void * self_) {
|
||||
auto self = (systemd_units_manager *)(self_);
|
||||
|
||||
GError * error = nullptr;
|
||||
|
||||
std::unique_ptr<unitUnit, deleter> unit(unit_unit_proxy_new_finish(res, &error));
|
||||
if (error)
|
||||
{
|
||||
std::cerr << "failed to create unit proxy: " << error->message << std::endl;
|
||||
g_error_free(error);
|
||||
return;
|
||||
}
|
||||
|
||||
g_signal_connect(unit.get(),
|
||||
"notify::active-state",
|
||||
G_CALLBACK(on_unit_result),
|
||||
self);
|
||||
|
||||
bool changed = self->units.empty();
|
||||
|
||||
self->units.emplace(std::move(unit));
|
||||
if (changed and self->state_changed_cb)
|
||||
self->state_changed_cb();
|
||||
},
|
||||
self);
|
||||
}
|
||||
|
||||
void systemd_units_manager::on_unit_result(
|
||||
unitUnit * unit,
|
||||
const GParamSpec * pspec,
|
||||
void * self_)
|
||||
{
|
||||
auto self = (systemd_units_manager *)(self_);
|
||||
std::string_view state = unit_unit_get_active_state(unit);
|
||||
bool empty = self->units.empty();
|
||||
if (state == "inactive" or state == "failed")
|
||||
std::erase_if(self->units, [&](auto & o) { return o.get() == unit; });
|
||||
if (self->state_changed_cb and self->units.empty() and not empty)
|
||||
self->state_changed_cb();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct variant_builder
|
||||
{
|
||||
GVariantBuilder builder;
|
||||
|
||||
variant_builder(const GVariantType * type)
|
||||
{
|
||||
g_variant_builder_init(&builder, type);
|
||||
}
|
||||
~variant_builder()
|
||||
{
|
||||
g_variant_builder_clear(&builder);
|
||||
}
|
||||
auto operator&()
|
||||
{
|
||||
return &builder;
|
||||
}
|
||||
|
||||
GVariant * end()
|
||||
{
|
||||
return g_variant_builder_end(&builder);
|
||||
}
|
||||
};
|
||||
|
||||
}; // namespace
|
||||
|
||||
void systemd_units_manager::start_application(const std::vector<std::string> & args)
|
||||
{
|
||||
if (args.empty())
|
||||
return;
|
||||
|
||||
std::string service_name = std::format("wivrn-application-{}.service", std::chrono::steady_clock::now().time_since_epoch().count());
|
||||
|
||||
variant_builder b(G_VARIANT_TYPE("a(sv)"));
|
||||
g_variant_builder_add(&b,
|
||||
"(sv)",
|
||||
"Description",
|
||||
g_variant_new("s", "Application spawned by WiVRn"));
|
||||
|
||||
variant_builder argv(G_VARIANT_TYPE("as"));
|
||||
for (const auto & arg: args)
|
||||
g_variant_builder_add(&argv, "s", arg.c_str());
|
||||
auto exec_start =
|
||||
g_variant_new("(s@asb)",
|
||||
args.front().c_str(),
|
||||
g_variant_new("as", &argv),
|
||||
false);
|
||||
g_variant_builder_add(&b,
|
||||
"(sv)",
|
||||
"ExecStart",
|
||||
g_variant_new_array(
|
||||
nullptr,
|
||||
&exec_start,
|
||||
1));
|
||||
|
||||
auto properties = b.end();
|
||||
auto aux = g_variant_new_array(G_VARIANT_TYPE("(sa(sv))"), nullptr, 0);
|
||||
|
||||
gchar * job = nullptr;
|
||||
GError * error = nullptr;
|
||||
systemd_manager_call_start_transient_unit_sync(
|
||||
proxy.get(), service_name.c_str(), "replace", properties, aux, &job, nullptr, &error);
|
||||
|
||||
if (job)
|
||||
{
|
||||
jobs.emplace(job, std::move(service_name));
|
||||
g_free(job);
|
||||
}
|
||||
|
||||
if (error)
|
||||
{
|
||||
std::runtime_error e(std::format("start transient unit failed: {}", error->message));
|
||||
g_error_free(error);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
} // namespace wivrn
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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 "start_application.h"
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "systemd_manager.h"
|
||||
#include "systemd_unit.h"
|
||||
|
||||
namespace wivrn
|
||||
{
|
||||
|
||||
// Start applications in transient units
|
||||
class systemd_units_manager : public children_manager
|
||||
{
|
||||
struct deleter
|
||||
{
|
||||
void operator()(systemdManager *);
|
||||
void operator()(unitUnit *);
|
||||
};
|
||||
GDBusConnection * connection;
|
||||
std::unique_ptr<systemdManager, deleter> proxy;
|
||||
std::unordered_map<std::string, std::string> jobs;
|
||||
std::unordered_set<std::unique_ptr<unitUnit, deleter>> units;
|
||||
|
||||
std::function<void()> state_changed_cb;
|
||||
|
||||
public:
|
||||
systemd_units_manager(GDBusConnection * connection, std::function<void()> state_changed_cb);
|
||||
|
||||
// create and start the transient unit
|
||||
void start_application(const std::vector<std::string> &) override;
|
||||
|
||||
// true if any unit started by this object is still running
|
||||
bool running() const override;
|
||||
|
||||
void stop() override;
|
||||
|
||||
private:
|
||||
static void on_job_removed(
|
||||
systemdManagerProxy * proxy,
|
||||
guint32 id,
|
||||
gchar * job,
|
||||
gchar * unit,
|
||||
gchar * result,
|
||||
void * self);
|
||||
|
||||
static void on_unit_result(
|
||||
unitUnit * proxy,
|
||||
const GParamSpec * pspec,
|
||||
void * self);
|
||||
};
|
||||
} // namespace wivrn
|
||||
+6
-1
@@ -47,7 +47,12 @@ struct bitrate_changed
|
||||
uint32_t bitrate_bps;
|
||||
};
|
||||
|
||||
using packets = std::variant<wivrn::from_headset::headset_info_packet, headset_connected, headset_disconnected, bitrate_changed>;
|
||||
using packets = std::variant<
|
||||
wivrn::from_headset::headset_info_packet,
|
||||
wivrn::from_headset::start_app,
|
||||
headset_connected,
|
||||
headset_disconnected,
|
||||
bitrate_changed>;
|
||||
} // namespace from_monado
|
||||
|
||||
namespace to_monado
|
||||
|
||||
@@ -27,7 +27,11 @@ xgettext \
|
||||
|
||||
sed -i 's/charset=CHARSET/charset=UTF-8/g' $WIVRN_CLIENT_POT $WIVRN_DASHBOARD_POT
|
||||
|
||||
LANGS="es fr it ja zh_TW pt_BR"
|
||||
if [ "$#" -ge 1 ] ; then
|
||||
LANGS="$@"
|
||||
else
|
||||
LANGS="$(ls -1 locale)"
|
||||
fi
|
||||
|
||||
for i in $LANGS
|
||||
do
|
||||
|
||||
Reference in New Issue
Block a user