From 19ad856e597cc8b369f1b2333ba222765c9135c1 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Tue, 5 Aug 2025 16:20:23 +0200 Subject: [PATCH 01/85] Use VK_KHR_video_maintenance1 --- ...a-vk-Track-VK_KHR_video_maintenance1.patch | 64 +++++++++ ...e-video_maintenance_1-device-feature.patch | 134 ++++++++++++++++++ ...-Request-video_maintenance_1-feature.patch | 26 ++++ server/driver/wivrn_comp_target.cpp | 79 +++++------ server/encoder/video_encoder.cpp | 26 ---- server/encoder/video_encoder.h | 5 - server/encoder/video_encoder_vulkan.cpp | 6 +- 7 files changed, 266 insertions(+), 74 deletions(-) create mode 100644 patches/monado/0011-a-vk-Track-VK_KHR_video_maintenance1.patch create mode 100644 patches/monado/0012-a-vk-Expose-video_maintenance_1-device-feature.patch create mode 100644 patches/monado/0013-c-util-Request-video_maintenance_1-feature.patch diff --git a/patches/monado/0011-a-vk-Track-VK_KHR_video_maintenance1.patch b/patches/monado/0011-a-vk-Track-VK_KHR_video_maintenance1.patch new file mode 100644 index 00000000..82cc60f8 --- /dev/null +++ b/patches/monado/0011-a-vk-Track-VK_KHR_video_maintenance1.patch @@ -0,0 +1,64 @@ +From 4905a1bd2a32d0cef4ade575021b17cf453632f0 Mon Sep 17 00:00:00 2001 +From: Patrick Nicolas +Date: Tue, 5 Aug 2025 15:51:48 +0200 +Subject: [PATCH 1/3] a/vk: Track VK_KHR_video_maintenance1 + +--- + scripts/generate_vk_helpers.py | 1 + + src/xrt/auxiliary/vk/vk_bundle_init.c | 8 ++++++++ + src/xrt/auxiliary/vk/vk_helpers.h | 1 + + 3 files changed, 10 insertions(+) + +diff --git a/scripts/generate_vk_helpers.py b/scripts/generate_vk_helpers.py +index 330b1b05e..80902193a 100755 +--- a/scripts/generate_vk_helpers.py ++++ b/scripts/generate_vk_helpers.py +@@ -307,6 +307,7 @@ DEVICE_EXTENSIONS_TO_CHECK = [ + "VK_KHR_present_wait", + "VK_KHR_synchronization2", + "VK_KHR_timeline_semaphore", ++ "VK_KHR_video_maintenance1", + "VK_EXT_calibrated_timestamps", + "VK_EXT_display_control", + "VK_EXT_external_memory_dma_buf", +diff --git a/src/xrt/auxiliary/vk/vk_bundle_init.c b/src/xrt/auxiliary/vk/vk_bundle_init.c +index f28f7591f..b435d73dd 100644 +--- a/src/xrt/auxiliary/vk/vk_bundle_init.c ++++ b/src/xrt/auxiliary/vk/vk_bundle_init.c +@@ -754,6 +754,7 @@ fill_in_has_device_extensions(struct vk_bundle *vk, struct u_string_list *ext_li + vk->has_KHR_present_wait = false; + vk->has_KHR_synchronization2 = false; + vk->has_KHR_timeline_semaphore = false; ++ vk->has_KHR_video_maintenance1 = false; + vk->has_EXT_calibrated_timestamps = false; + vk->has_EXT_display_control = false; + vk->has_EXT_external_memory_dma_buf = false; +@@ -868,6 +869,13 @@ fill_in_has_device_extensions(struct vk_bundle *vk, struct u_string_list *ext_li + } + #endif // defined(VK_KHR_timeline_semaphore) + ++#if defined(VK_KHR_video_maintenance1) ++ if (strcmp(ext, VK_KHR_VIDEO_MAINTENANCE_1_EXTENSION_NAME) == 0) { ++ vk->has_KHR_video_maintenance1 = true; ++ continue; ++ } ++#endif // defined(VK_KHR_video_maintenance1) ++ + #if defined(VK_EXT_calibrated_timestamps) + if (strcmp(ext, VK_EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME) == 0) { + vk->has_EXT_calibrated_timestamps = true; +diff --git a/src/xrt/auxiliary/vk/vk_helpers.h b/src/xrt/auxiliary/vk/vk_helpers.h +index 896b597d4..3b5cbb9c8 100644 +--- a/src/xrt/auxiliary/vk/vk_helpers.h ++++ b/src/xrt/auxiliary/vk/vk_helpers.h +@@ -142,6 +142,7 @@ struct vk_bundle + bool has_KHR_present_wait; + bool has_KHR_synchronization2; + bool has_KHR_timeline_semaphore; ++ bool has_KHR_video_maintenance1; + bool has_EXT_calibrated_timestamps; + bool has_EXT_display_control; + bool has_EXT_external_memory_dma_buf; +-- +2.50.1 + diff --git a/patches/monado/0012-a-vk-Expose-video_maintenance_1-device-feature.patch b/patches/monado/0012-a-vk-Expose-video_maintenance_1-device-feature.patch new file mode 100644 index 00000000..6e696995 --- /dev/null +++ b/patches/monado/0012-a-vk-Expose-video_maintenance_1-device-feature.patch @@ -0,0 +1,134 @@ +From 26d9345724a868304b9d3ca5b58fecef02493df3 Mon Sep 17 00:00:00 2001 +From: Patrick Nicolas +Date: Tue, 5 Aug 2025 16:00:59 +0200 +Subject: [PATCH 2/3] a/vk: Expose video_maintenance_1 device feature + +--- + src/xrt/auxiliary/vk/vk_bundle_init.c | 40 +++++++++++++++++++++++++-- + src/xrt/auxiliary/vk/vk_helpers.h | 4 +++ + 2 files changed, 42 insertions(+), 2 deletions(-) + +diff --git a/src/xrt/auxiliary/vk/vk_bundle_init.c b/src/xrt/auxiliary/vk/vk_bundle_init.c +index b435d73dd..501cd6f3c 100644 +--- a/src/xrt/auxiliary/vk/vk_bundle_init.c ++++ b/src/xrt/auxiliary/vk/vk_bundle_init.c +@@ -1098,6 +1098,13 @@ filter_device_features(struct vk_bundle *vk, + }; + #endif + ++#ifdef VK_KHR_video_maintenance1 ++ VkPhysicalDeviceVideoMaintenance1FeaturesKHR video_maintenance_1_info = { ++ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_MAINTENANCE_1_FEATURES_KHR, ++ .pNext = NULL, ++ }; ++#endif ++ + #ifdef VK_ANDROID_external_format_resolve + VkPhysicalDeviceExternalFormatResolveFeaturesANDROID ext_fmt_resolve_info = { + .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FORMAT_RESOLVE_FEATURES_ANDROID, +@@ -1148,6 +1155,13 @@ filter_device_features(struct vk_bundle *vk, + } + #endif + ++#ifdef VK_KHR_video_maintenance1 ++ if (vk->has_KHR_video_maintenance1) { ++ vk_append_to_pnext_chain((VkBaseInStructure *)&physical_device_features, ++ (VkBaseInStructure *)&video_maintenance_1_info); ++ } ++#endif ++ + #ifdef VK_ANDROID_external_format_resolve + if (vk->has_ANDROID_external_format_resolve) { + vk_append_to_pnext_chain((VkBaseInStructure *)&physical_device_features, +@@ -1187,6 +1201,10 @@ filter_device_features(struct vk_bundle *vk, + CHECK(synchronization_2, synchronization_2_info.synchronization2); + #endif + ++#ifdef VK_KHR_video_maintenance1 ++ CHECK(video_maintenance_1, video_maintenance_1_info.videoMaintenance1); ++#endif ++ + #ifdef VK_ANDROID_external_format_resolve + CHECK(ext_fmt_resolve, ext_fmt_resolve_info.externalFormatResolve); + #endif +@@ -1207,14 +1225,16 @@ filter_device_features(struct vk_bundle *vk, + "\n\tshader_storage_image_write_without_format: %i" + "\n\tstorage_buffer_8bit_access: %i" + "\n\tsynchronization_2: %i" +- "\n\ttimeline_semaphore: %i", // ++ "\n\ttimeline_semaphore: %i" ++ "\n\tvideo_maintenance_1: %i", // + device_features->ext_fmt_resolve, // + device_features->null_descriptor, // + device_features->shader_image_gather_extended, // + device_features->shader_storage_image_write_without_format, // + device_features->storage_buffer_8bit_access, // + device_features->synchronization_2, // +- device_features->timeline_semaphore); // ++ device_features->timeline_semaphore, // ++ device_features->video_maintenance_1); // + } + + +@@ -1262,6 +1282,7 @@ vk_create_device(struct vk_bundle *vk, + vk->features.timeline_semaphore = device_features.timeline_semaphore; + vk->features.synchronization_2 = device_features.synchronization_2; + vk->features.present_wait = device_features.present_wait; ++ vk->features.video_maintenance_1 = device_features.video_maintenance_1; + + + /* +@@ -1384,6 +1405,14 @@ vk_create_device(struct vk_bundle *vk, + }; + #endif + ++#ifdef VK_KHR_video_maintenance1 ++ VkPhysicalDeviceVideoMaintenance1FeaturesKHR video_maintenance_1_info = { ++ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_MAINTENANCE_1_FEATURES_KHR, ++ .pNext = NULL, ++ .videoMaintenance1 = device_features.video_maintenance_1, ++ }; ++#endif ++ + #ifdef VK_ANDROID_external_format_resolve + VkPhysicalDeviceExternalFormatResolveFeaturesANDROID ext_fmt_resolve_info = { + .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FORMAT_RESOLVE_FEATURES_ANDROID, +@@ -1444,6 +1473,13 @@ vk_create_device(struct vk_bundle *vk, + } + #endif + ++#ifdef VK_KHR_video_maintenance1 ++ if (vk->has_KHR_video_maintenance1) { ++ vk_append_to_pnext_chain((VkBaseInStructure *)&device_create_info, ++ (VkBaseInStructure *)&video_maintenance_1_info); ++ } ++#endif ++ + #ifdef VK_ANDROID_external_format_resolve + if (vk->has_ANDROID_external_format_resolve) { + vk_append_to_pnext_chain((VkBaseInStructure *)&device_create_info, +diff --git a/src/xrt/auxiliary/vk/vk_helpers.h b/src/xrt/auxiliary/vk/vk_helpers.h +index 3b5cbb9c8..748c06dac 100644 +--- a/src/xrt/auxiliary/vk/vk_helpers.h ++++ b/src/xrt/auxiliary/vk/vk_helpers.h +@@ -179,6 +179,9 @@ struct vk_bundle + + //! Was KHR_present_wait requested, available, and enabled? + bool present_wait; ++ ++ //! Was KHR_video_maintenance1 requested, available, and enabled? ++ bool video_maintenance_1; + } features; + + //! Is the GPU a tegra device. +@@ -1030,6 +1033,7 @@ struct vk_device_features + bool ext_fmt_resolve; + bool storage_buffer_8bit_access; + bool present_wait; ++ bool video_maintenance_1; + }; + + /*! +-- +2.50.1 + diff --git a/patches/monado/0013-c-util-Request-video_maintenance_1-feature.patch b/patches/monado/0013-c-util-Request-video_maintenance_1-feature.patch new file mode 100644 index 00000000..8e5cfeeb --- /dev/null +++ b/patches/monado/0013-c-util-Request-video_maintenance_1-feature.patch @@ -0,0 +1,26 @@ +From b8e23426ec5ac97efdceaf2a319b9d5921e7b412 Mon Sep 17 00:00:00 2001 +From: Patrick Nicolas +Date: Tue, 5 Aug 2025 16:01:59 +0200 +Subject: [PATCH 3/3] c/util: Request video_maintenance_1 feature + +This will only be enabled if the VK_KHR_maintenance1 extension was +requested. +--- + src/xrt/compositor/util/comp_vulkan.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/xrt/compositor/util/comp_vulkan.c b/src/xrt/compositor/util/comp_vulkan.c +index 5618f4f78..9c719275c 100644 +--- a/src/xrt/compositor/util/comp_vulkan.c ++++ b/src/xrt/compositor/util/comp_vulkan.c +@@ -282,6 +282,7 @@ create_device(struct vk_bundle *vk, const struct comp_vulkan_arguments *vk_args) + .timeline_semaphore = vk_args->timeline_semaphore, + .synchronization_2 = true, + .present_wait = true, ++ .video_maintenance_1 = true, + }; + + ret = vk_init_mutex(vk); +-- +2.50.1 + diff --git a/server/driver/wivrn_comp_target.cpp b/server/driver/wivrn_comp_target.cpp index a849c413..2c0aa5ed 100644 --- a/server/driver/wivrn_comp_target.cpp +++ b/server/driver/wivrn_comp_target.cpp @@ -23,12 +23,14 @@ #include "encoder/video_encoder.h" #include "util/u_logging.h" #include "utils/scoped_lock.h" +#include "wivrn_config.h" #include "wivrn_foveation.h" #include "main/comp_compositor.h" #include "math/m_space.h" #include "xrt_cast.h" +#include #include #include #include @@ -58,6 +60,9 @@ std::vector wivrn_comp_target::wanted_device_extensions = { #ifdef VK_KHR_video_encode_queue VK_KHR_VIDEO_ENCODE_QUEUE_EXTENSION_NAME, #endif +#ifdef VK_KHR_video_maintenance1 + VK_KHR_VIDEO_MAINTENANCE_1_EXTENSION_NAME, +#endif #ifdef VK_KHR_video_encode_h264 VK_KHR_VIDEO_ENCODE_H264_EXTENSION_NAME, #endif @@ -188,54 +193,46 @@ static VkResult create_images(struct wivrn_comp_target * cn, vk::ImageUsageFlags cn->images = U_TYPED_ARRAY_CALLOC(struct comp_target_image, cn->image_count); -#if WIVRN_USE_VULKAN_ENCODE - auto [video_profiles, encoder_flags] = video_encoder::get_create_image_info(cn->settings); - - vk::VideoProfileListInfoKHR video_profile_list{ - .profileCount = uint32_t(video_profiles.size()), - .pProfiles = video_profiles.data(), + vk::StructureChain image_info{ + vk::ImageCreateInfo{ + .flags = vk::ImageCreateFlagBits::eExtendedUsage | vk::ImageCreateFlagBits::eMutableFormat, + .imageType = vk::ImageType::e2D, + .format = format, + .extent = { + .width = cn->width, + .height = cn->height, + .depth = 1, + }, + .mipLevels = 1, + .arrayLayers = 2, // colour then alpha + .samples = vk::SampleCountFlagBits::e1, + .tiling = vk::ImageTiling::eOptimal, + .usage = flags | vk::ImageUsageFlagBits::eStorage | vk::ImageUsageFlagBits::eTransferSrc, + .sharingMode = vk::SharingMode::eExclusive, + }, + vk::ImageFormatListCreateInfo{ + .viewFormatCount = formats.size(), + .pViewFormats = formats.data(), + }, }; +#if WIVRN_USE_VULKAN_ENCODE + if ( + vk->features.video_maintenance_1 and + std::ranges::any_of( + cn->settings, + [](const auto & item) { return item.encoder_name == encoder_vulkan // + and item.offset_x == 0 and item.offset_y == 0; })) + { + image_info.get().flags |= vk::ImageCreateFlagBits::eVideoProfileIndependentKHR; + image_info.get().usage |= vk::ImageUsageFlagBits::eVideoEncodeSrcKHR; + } #endif cn->psc.images.resize(cn->image_count); for (uint32_t i = 0; i < cn->image_count; i++) { - vk::ImageFormatListCreateInfo formats_info{ - .viewFormatCount = formats.size(), - .pViewFormats = formats.data(), - }; - -#if WIVRN_USE_VULKAN_ENCODE - if (video_profile_list.profileCount) - formats_info.pNext = &video_profile_list; -#endif - auto & image = cn->psc.images[i].image; - image = image_allocation( - device, { - .pNext = &formats_info, - .flags = vk::ImageCreateFlagBits::eExtendedUsage | vk::ImageCreateFlagBits::eMutableFormat, - .imageType = vk::ImageType::e2D, - .format = format, - .extent = { - .width = cn->width, - .height = cn->height, - .depth = 1, - }, - .mipLevels = 1, - .arrayLayers = 2, // colour then alpha - .samples = vk::SampleCountFlagBits::e1, - .tiling = vk::ImageTiling::eOptimal, - .usage = flags -#if WIVRN_USE_VULKAN_ENCODE - | encoder_flags -#endif - | vk::ImageUsageFlagBits::eStorage | vk::ImageUsageFlagBits::eTransferSrc, - .sharingMode = vk::SharingMode::eExclusive, - }, - { - .usage = VMA_MEMORY_USAGE_AUTO, - }); + image = image_allocation(device, image_info.get(), {.usage = VMA_MEMORY_USAGE_AUTO}); cn->images[i].handle = image; cn->wivrn_bundle->name(vk::Image(image), "comp target image"); } diff --git a/server/encoder/video_encoder.cpp b/server/encoder/video_encoder.cpp index f352b637..8bbaaffe 100644 --- a/server/encoder/video_encoder.cpp +++ b/server/encoder/video_encoder.cpp @@ -180,32 +180,6 @@ std::unique_ptr video_encoder::create( return res; } -#if WIVRN_USE_VULKAN_ENCODE -std::pair, vk::ImageUsageFlags> video_encoder::get_create_image_info(const std::vector & settings) -{ - std::pair, vk::ImageUsageFlags> result; - for (const auto & item: settings) - { - if (item.encoder_name == encoder_vulkan) - { - result.second |= vk::ImageUsageFlagBits::eVideoEncodeSrcKHR; - switch (item.codec) - { - case h264: - result.first.push_back(video_encoder_vulkan_h264::video_profile_info.get()); - break; - case h265: - // result.first.push_back(video_encoder_vulkan_h265::video_profile_info.get()); - break; - case av1: - throw std::runtime_error("av1 not supported for vulkan video encode"); - } - } - } - return result; -} -#endif - static const uint64_t idr_throttle = 100; video_encoder::video_encoder(uint8_t stream_idx, to_headset::video_stream_description::channels_t channels, double bitrate_multiplier, bool async_send) : diff --git a/server/encoder/video_encoder.h b/server/encoder/video_encoder.h index 104a97c7..639f56b6 100644 --- a/server/encoder/video_encoder.h +++ b/server/encoder/video_encoder.h @@ -20,7 +20,6 @@ #pragma once #include "driver/clock_offset.h" -#include "wivrn_config.h" #include "wivrn_packets.h" #include @@ -114,10 +113,6 @@ public: int input_height, float fps); -#if WIVRN_USE_VULKAN_ENCODE - static std::pair, vk::ImageUsageFlags> get_create_image_info(const std::vector &); -#endif - video_encoder(uint8_t stream_idx, to_headset::video_stream_description::channels_t channels, double bitrate_multiplier, bool async_send); virtual ~video_encoder(); diff --git a/server/encoder/video_encoder_vulkan.cpp b/server/encoder/video_encoder_vulkan.cpp index ea151952..c18e21a9 100644 --- a/server/encoder/video_encoder_vulkan.cpp +++ b/server/encoder/video_encoder_vulkan.cpp @@ -15,6 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include "vk/vk_helpers.h" + #include "video_encoder_vulkan.h" #include "encoder/encoder_settings.h" @@ -266,7 +268,7 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca .layerCount = 1}, }; - if (rect.offset != vk::Offset2D{0, 0}) + if (rect.offset != vk::Offset2D{0, 0} or not vk.vk.features.video_maintenance_1) { image_view_template.subresourceRange.baseArrayLayer = 0; for (size_t i = 0; i < num_slots; ++i) @@ -478,7 +480,7 @@ std::pair wivrn::video_encoder_vulkan::present_image(vk::Im video_cmd_buf.begin({.flags = vk::CommandBufferUsageFlagBits::eOneTimeSubmit}); // If we encode from top left corner, encode from the source image directly - bool encode_direct = rect.offset == vk::Offset2D{0, 0}; + bool encode_direct = not slot_item.tmp_image; vk::ImageView image_view; From 34036c6b9ebeea3ed2340351bceb4d0738b998b7 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Fri, 8 Aug 2025 14:16:46 +0200 Subject: [PATCH 02/85] Fail if path command does not exist --- patches/apply.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/patches/apply.sh b/patches/apply.sh index 272a2e54..11bb2fb5 100755 --- a/patches/apply.sh +++ b/patches/apply.sh @@ -9,6 +9,11 @@ if [ -d ".git" ] ; then exec git am --committer-date-is-author-date "$@" fi +if ! type patch 2> /dev/null ; then + echo "patch command not found" >&1 + exit 1 +fi + # There is no reliable way to apply a patch and succeed if it was # already applied. Just ignore errors... for f in "$@" ; do From e0608f0c68e8a75ecc161c1cd0a6db08cf59f6b4 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Fri, 8 Aug 2025 14:34:42 +0200 Subject: [PATCH 03/85] Don't crash if server failed to start --- dashboard/wivrn_server.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/dashboard/wivrn_server.cpp b/dashboard/wivrn_server.cpp index 816387a7..19f3219d 100644 --- a/dashboard/wivrn_server.cpp +++ b/dashboard/wivrn_server.cpp @@ -506,29 +506,37 @@ void wivrn_server::on_server_properties_changed(const QString & interface_name, void wivrn_server::setJsonConfiguration(QString new_configuration) { - server_interface->setJsonConfiguration(m_jsonConfiguration = new_configuration); - jsonConfigurationChanged(new_configuration); + if (server_interface) + { + server_interface->setJsonConfiguration(m_jsonConfiguration = new_configuration); + jsonConfigurationChanged(new_configuration); + } } void wivrn_server::revoke_key(QString public_key) { - server_interface->RevokeKey(public_key); + if (server_interface) + server_interface->RevokeKey(public_key); } void wivrn_server::rename_key(QString public_key, QString name) { - server_interface->RenameKey(public_key, name); + if (server_interface) + server_interface->RenameKey(public_key, name); } QString wivrn_server::enable_pairing(int timeout_secs) { qDebug() << "Enabling pairing for" << timeout_secs << "seconds"; - return server_interface->EnablePairing(timeout_secs).value(); + if (server_interface) + return server_interface->EnablePairing(timeout_secs).value(); + return ""; } void wivrn_server::disable_pairing() { - server_interface->DisablePairing(); + if (server_interface) + server_interface->DisablePairing(); } QString wivrn_server::hostname() From 4f0daa0a635c7352bd830b366a44c3b11e7dfd13 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Fri, 8 Aug 2025 14:38:49 +0200 Subject: [PATCH 04/85] Don't show wizard on first run if server failed --- dashboard/qml/Main.qml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dashboard/qml/Main.qml b/dashboard/qml/Main.qml index ed2b3dc5..e3e14a0b 100644 --- a/dashboard/qml/Main.qml +++ b/dashboard/qml/Main.qml @@ -59,6 +59,12 @@ Kirigami.ApplicationWindow { // Set the visible property here because dismissing the message removes the binding if (value == WivrnServer.FailedToStart) message_failed_to_start.visible = true; + + if (root.first_run && started) { + console.log("First run"); + root.pageStack.push(Qt.resolvedUrl("WizardPage.qml")); + root.first_run = false; + } } function onPairingEnabledChanged(value) { @@ -84,12 +90,6 @@ Kirigami.ApplicationWindow { if (WivrnServer.serverStatus == WivrnServer.Stopped) WivrnServer.start_server(); - if (root.first_run) { - console.log("First run"); - root.pageStack.push(Qt.resolvedUrl("WizardPage.qml")); - root.first_run = false; - } - if (root.last_run_version != ApkInstaller.currentVersion) { root.last_run_version = ApkInstaller.currentVersion; } From f91c7222dbfd6432e33fb9095d9d1e88c363c039 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Fri, 8 Aug 2025 16:15:49 +0200 Subject: [PATCH 05/85] Fix NVIDIA crash in vulkan video encoder creation --- server/encoder/video_encoder_vulkan_h264.cpp | 66 +++++++++++++------- server/encoder/video_encoder_vulkan_h264.h | 2 - 2 files changed, 43 insertions(+), 25 deletions(-) diff --git a/server/encoder/video_encoder_vulkan_h264.cpp b/server/encoder/video_encoder_vulkan_h264.cpp index 76405794..fb0d5994 100644 --- a/server/encoder/video_encoder_vulkan_h264.cpp +++ b/server/encoder/video_encoder_vulkan_h264.cpp @@ -169,6 +169,47 @@ std::vector wivrn::video_encoder_vulkan_h264::setup_slot_info(size_t dpb return res; } +auto get_video_caps(vk::raii::PhysicalDevice & phys_dev) +{ + vk::StructureChain video_profile_info{ + vk::VideoProfileInfoKHR{ + .videoCodecOperation = + vk::VideoCodecOperationFlagBitsKHR::eEncodeH264, + .chromaSubsampling = vk::VideoChromaSubsamplingFlagBitsKHR::e420, + .lumaBitDepth = vk::VideoComponentBitDepthFlagBitsKHR::e8, + .chromaBitDepth = vk::VideoComponentBitDepthFlagBitsKHR::e8, + }, + vk::VideoEncodeH264ProfileInfoKHR{ + .stdProfileIdc = STD_VIDEO_H264_PROFILE_IDC_BASELINE, + }, + vk::VideoEncodeUsageInfoKHR{ + .videoUsageHints = vk::VideoEncodeUsageFlagBitsKHR::eStreaming, + .videoContentHints = vk::VideoEncodeContentFlagBitsKHR::eRendered, + .tuningMode = vk::VideoEncodeTuningModeKHR::eUltraLowLatency, + }}; + + try + { + auto [video_caps, encode_caps, encode_h264_caps] = + phys_dev.getVideoCapabilitiesKHR< + vk::VideoCapabilitiesKHR, + vk::VideoEncodeCapabilitiesKHR, + vk::VideoEncodeH264CapabilitiesKHR>(video_profile_info.get()); + + return std::make_tuple(video_caps, encode_caps, encode_h264_caps, video_profile_info); + } + catch (...) + {} + // NVIDIA fails if the structure is there + video_profile_info.unlink(); + auto [video_caps, encode_caps, encode_h264_caps] = + phys_dev.getVideoCapabilitiesKHR< + vk::VideoCapabilitiesKHR, + vk::VideoEncodeCapabilitiesKHR, + vk::VideoEncodeH264CapabilitiesKHR>(video_profile_info.get()); + return std::make_tuple(video_caps, encode_caps, encode_h264_caps, video_profile_info); +} + std::unique_ptr wivrn::video_encoder_vulkan_h264::create( wivrn_vk_bundle & vk, encoder_settings & settings, @@ -186,15 +227,11 @@ std::unique_ptr wivrn::video_encoder_vulkan_h2 }, }; - auto [video_caps, encode_caps, encode_h264_caps] = - vk.physical_device.getVideoCapabilitiesKHR< - vk::VideoCapabilitiesKHR, - vk::VideoEncodeCapabilitiesKHR, - vk::VideoEncodeH264CapabilitiesKHR>(video_profile_info.get()); - if (settings.bit_depth != 8) throw std::runtime_error("h264 codec only supports 8-bit encoding"); + auto [video_caps, encode_caps, encode_h264_caps, video_profile_info] = get_video_caps(vk.physical_device); + std::unique_ptr self(new video_encoder_vulkan_h264(vk, rect, video_caps, encode_caps, fps, stream_idx, settings)); vk::VideoEncodeH264SessionParametersAddInfoKHR h264_add_info{}; @@ -359,20 +396,3 @@ vk::ExtensionProperties wivrn::video_encoder_vulkan_h264::std_header_version() VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_EXTENSION_NAME); return std_header_version; } - -decltype(wivrn::video_encoder_vulkan_h264::video_profile_info) wivrn::video_encoder_vulkan_h264::video_profile_info = vk::StructureChain{ - vk::VideoProfileInfoKHR{ - .videoCodecOperation = - vk::VideoCodecOperationFlagBitsKHR::eEncodeH264, - .chromaSubsampling = vk::VideoChromaSubsamplingFlagBitsKHR::e420, - .lumaBitDepth = vk::VideoComponentBitDepthFlagBitsKHR::e8, - .chromaBitDepth = vk::VideoComponentBitDepthFlagBitsKHR::e8, - }, - vk::VideoEncodeH264ProfileInfoKHR{ - .stdProfileIdc = STD_VIDEO_H264_PROFILE_IDC_BASELINE, - }, - vk::VideoEncodeUsageInfoKHR{ - .videoUsageHints = vk::VideoEncodeUsageFlagBitsKHR::eStreaming, - .videoContentHints = vk::VideoEncodeContentFlagBitsKHR::eRendered, - .tuningMode = vk::VideoEncodeTuningModeKHR::eUltraLowLatency, - }}; diff --git a/server/encoder/video_encoder_vulkan_h264.h b/server/encoder/video_encoder_vulkan_h264.h index df43c11c..0abc6fbe 100644 --- a/server/encoder/video_encoder_vulkan_h264.h +++ b/server/encoder/video_encoder_vulkan_h264.h @@ -70,7 +70,5 @@ public: uint8_t stream_idx); std::vector get_sps_pps(); - - static const vk::StructureChain video_profile_info; }; } // namespace wivrn From 9c599206d6dd8a8925a8bb7437bae49d749579ed Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Fri, 8 Aug 2025 16:15:58 +0200 Subject: [PATCH 06/85] Working NVIDIA h264 vulkan video encode! NVIDIA fails with initalization failed error if no VkVideoEncodeH264RateControlLayerInfoKHR structure is provided --- server/encoder/video_encoder_vulkan.h | 3 +-- server/encoder/video_encoder_vulkan_h264.cpp | 2 ++ server/encoder/video_encoder_vulkan_h264.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/server/encoder/video_encoder_vulkan.h b/server/encoder/video_encoder_vulkan.h index 354e075d..64778d1f 100644 --- a/server/encoder/video_encoder_vulkan.h +++ b/server/encoder/video_encoder_vulkan.h @@ -80,10 +80,9 @@ class video_encoder_vulkan : public video_encoder bool session_initialized = false; const vk::Rect2D rect; - vk::VideoEncodeRateControlLayerInfoKHR rate_control_layer; - protected: const uint8_t num_dpb_slots; + vk::VideoEncodeRateControlLayerInfoKHR rate_control_layer; std::optional rate_control; video_encoder_vulkan(wivrn_vk_bundle & vk, diff --git a/server/encoder/video_encoder_vulkan_h264.cpp b/server/encoder/video_encoder_vulkan_h264.cpp index fb0d5994..03e7f585 100644 --- a/server/encoder/video_encoder_vulkan_h264.cpp +++ b/server/encoder/video_encoder_vulkan_h264.cpp @@ -264,6 +264,8 @@ std::unique_ptr wivrn::video_encoder_vulkan_h2 self->rate_control->pNext = &self->rate_control_h264; } + self->rate_control_layer.pNext = &self->rate_control_layer_h264; + self->init(video_caps, video_profile_info.get(), &session_create_info, &h264_session_params); return self; diff --git a/server/encoder/video_encoder_vulkan_h264.h b/server/encoder/video_encoder_vulkan_h264.h index 0abc6fbe..a98b7b05 100644 --- a/server/encoder/video_encoder_vulkan_h264.h +++ b/server/encoder/video_encoder_vulkan_h264.h @@ -46,6 +46,7 @@ class video_encoder_vulkan_h264 : public video_encoder_vulkan vk::VideoEncodeH264GopRemainingFrameInfoKHR gop_info; vk::VideoEncodeH264RateControlInfoKHR rate_control_h264; + vk::VideoEncodeH264RateControlLayerInfoKHR rate_control_layer_h264; video_encoder_vulkan_h264(wivrn_vk_bundle & vk, vk::Rect2D rect, From 73390c20357c0adcc40dbbbdd34afc9b98015241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=83=BC?= Date: Fri, 8 Aug 2025 16:53:42 +0200 Subject: [PATCH 07/85] Small fixes in sk translation (#432) --- locale/sk/wivrn-dashboard.po | 23 ++++++++++++++++------- locale/sk/wivrn.po | 2 +- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/locale/sk/wivrn-dashboard.po b/locale/sk/wivrn-dashboard.po index 2498685a..52da766d 100644 --- a/locale/sk/wivrn-dashboard.po +++ b/locale/sk/wivrn-dashboard.po @@ -20,12 +20,12 @@ msgstr "" #: dashboard/apk_installer.cpp:167 #, kde-format msgid "Downloading APK: %1 MB / %2 MB" -msgstr "Sťahujem APK: %1 MB / %2 MB" +msgstr "Sťahuje sa APK: %1 MB / %2 MB" #: dashboard/apk_installer.cpp:169 #, kde-format msgid "Downloading APK: %1 MB" -msgstr "Sťahujem APK: %1 MB" +msgstr "Sťahuje sa APK: %1 MB" #: dashboard/apk_installer.cpp:178 #, kde-format @@ -35,12 +35,12 @@ msgstr "Sťahovanie zrušené" #: dashboard/apk_installer.cpp:194 #, kde-format msgid "Cannot download APK: %1" -msgstr "APK sa nedá stiahnuť: %1" +msgstr "APK sa nedá stiahnúť: %1" #: dashboard/apk_installer.cpp:217 #, kde-format msgid "Installing APK" -msgstr "Inštalujem APK" +msgstr "Inštaluje sa APK" #: dashboard/apk_installer.cpp:221 #, kde-format @@ -76,7 +76,7 @@ msgstr "Nainštaluj si aplikáciu WiVRn do headsetu" #: dashboard/qml/WizardPage.qml:192 #, kde-format msgid "Checking latest release..." -msgstr "Kontrolujem najnovšiu verziu…" +msgstr "Kontroluje sa najnovšia verzia…" #: dashboard/qml/ApkInstallPage.qml:43 dashboard/qml/WizardPage.qml:198 #, kde-format @@ -369,12 +369,12 @@ msgstr "Prehľadať" #, kde-format msgctxt "automatic foveation setup" msgid "Manual foveation" -msgstr "Manuálna foveation" +msgstr "Manuálne foveovanie" #: dashboard/qml/SettingsPage.qml:46 #, kde-format msgid "Foveation strength:" -msgstr "Foveation sila" +msgstr "Sila foveovania" #: dashboard/qml/SettingsPage.qml:62 #, kde-format @@ -927,3 +927,12 @@ msgstr "xrizer" #, kde-format msgid "Open Composite" msgstr "Open Composite" + +#: dashboard/qml/Main.qml:162 +#, kde-format +msgid "" +"No OpenVR compatibility detected, Steam games won't be able to load VR.\n" +"Install xrizer or OpenComposite." +msgstr "" +"Žiadna OpenVR kompatibilita nebola nájdená, Hry na steame nebude možné načítať do VRka.\n" +"Nainštalujte xrizer alebo OpenComposite." diff --git a/locale/sk/wivrn.po b/locale/sk/wivrn.po index 56e98c6a..d93597fc 100644 --- a/locale/sk/wivrn.po +++ b/locale/sk/wivrn.po @@ -108,7 +108,7 @@ msgstr "" #: client/scenes/lobby_gui.cpp:335 #, c++-format msgid "Start an application on {} or select one to start streaming." -msgstr "Spustite aplikáciu na {} alebo vyberte jednu na začatie streamovania." +msgstr "Spustite aplikáciu na {} alebo jednu vyberte pre začatie streamovania." #: client/scenes/lobby_gui.cpp:383 msgid "Name" From a1bf1de910858ca9219c336cbfdd00bf079af3df Mon Sep 17 00:00:00 2001 From: myghi63 <110261785+myghi63@users.noreply.github.com> Date: Fri, 8 Aug 2025 12:31:10 -0300 Subject: [PATCH 08/85] Update pt_BR locale (#433) --- locale/pt_BR/wivrn-dashboard.po | 72 +++--- locale/pt_BR/wivrn.po | 426 ++++++++++++++++++++------------ 2 files changed, 313 insertions(+), 185 deletions(-) diff --git a/locale/pt_BR/wivrn-dashboard.po b/locale/pt_BR/wivrn-dashboard.po index 6b7701e4..14c01d9b 100644 --- a/locale/pt_BR/wivrn-dashboard.po +++ b/locale/pt_BR/wivrn-dashboard.po @@ -4,20 +4,20 @@ # SPDX-FileCopyrightText: 2025 Claudio Sampaio (Patola) # LuckShiba , 2025. # +# SPDX-FileCopyrightText: 2025 myghi 63 msgid "" msgstr "" "Project-Id-Version: WiVRn-dashboard\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-06-20 19:23-0300\n" -"PO-Revision-Date: 2025-06-21 21:55-0300\n" -"Last-Translator: LuckShiba \n" -"Language-Team: Brazilian Portuguese\n" +"POT-Creation-Date: 2025-08-04 04:40-0300\n" +"PO-Revision-Date: 2025-08-08 11:56-0300\n" +"Last-Translator: myghi63 \n" "Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Gtranslator 48.0\n" +"X-Generator: Lokalize 25.04.3\n" #: dashboard/apk_installer.cpp:167 #, kde-format @@ -85,8 +85,8 @@ msgstr "Verificando a última versão..." msgid "No precompiled APK is available for this version." msgstr "Nenhum APK pré-compilado está disponível para esta versão." -#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:247 -#: dashboard/qml/Main.qml:329 +#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:259 +#: dashboard/qml/Main.qml:341 #, kde-format msgid "ADB is not installed." msgstr "ADB não está instalado." @@ -135,7 +135,7 @@ msgstr "Reinstalar WiVRn" msgid "Install WiVRn" msgstr "Instalar WiVRn" -#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:342 +#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:354 #, kde-format msgid "Headsets" msgstr "Headsets" @@ -231,40 +231,40 @@ msgstr "Parear um novo headset" msgid "Headset statistics" msgstr "Estatísticas do headset" -#: dashboard/qml/Main.qml:103 +#: dashboard/qml/Main.qml:107 #, kde-format msgid "The server does not have CAP_SYS_NICE capabilities." msgstr "O servidor não tem capabilities CAP_SYS_NICE." -#: dashboard/qml/Main.qml:110 +#: dashboard/qml/Main.qml:114 #, kde-format msgid "Fix it" msgstr "Conserte" -#: dashboard/qml/Main.qml:119 +#: dashboard/qml/Main.qml:123 #, kde-format msgid "The CAP_SYS_NICE capability will be used when the server is restarted." msgstr "A capability CAP_SYS_NICE será usada quando o servidor for reiniciado." -#: dashboard/qml/Main.qml:125 +#: dashboard/qml/Main.qml:129 #, kde-format msgctxt "restart the server" msgid "Restart now" msgstr "Reiniciar agora" -#: dashboard/qml/Main.qml:136 +#: dashboard/qml/Main.qml:140 #, kde-format msgid "" "NVIDIA GPUs require at least driver version 565.77, current version is %1" msgstr "" "GPUs NVIDIA requerem pelo menos o driver versão 565.77, a versão atual é %1" -#: dashboard/qml/Main.qml:142 +#: dashboard/qml/Main.qml:146 #, kde-format msgid "More info" msgstr "Mais informações" -#: dashboard/qml/Main.qml:150 +#: dashboard/qml/Main.qml:154 #, kde-format msgid "" "Use the Mesa (radv) driver for AMD GPUs\n" @@ -273,76 +273,86 @@ msgstr "" "Use o driver Mesa (radv) para GPUs AMD\n" "Codificação de hardware com a vaapi não funciona com AMDVLK e AMDGPU-PRO" -#: dashboard/qml/Main.qml:159 +#: dashboard/qml/Main.qml:162 +#, kde-format +msgid "" +"No OpenVR compatibility detected, Steam games won't be able to load VR.\n" +"Install xrizer or OpenComposite." +msgstr "" +"Nenhuma compatibilidade com OpenVR foi detectada. Os jogos do Steam não conseg" +"uirão carregar em VR.\n" +"Instale o xrizer ou o OpenComposite." + +#: dashboard/qml/Main.qml:171 #, kde-format msgid "Server failed to start" msgstr "Servidor falhou em iniciar" -#: dashboard/qml/Main.qml:165 dashboard/qml/TroubleshootPage.qml:77 +#: dashboard/qml/Main.qml:177 dashboard/qml/TroubleshootPage.qml:77 #, kde-format msgid "Open server logs" msgstr "Abrir logs do servidor" -#: dashboard/qml/Main.qml:202 +#: dashboard/qml/Main.qml:214 #, kde-format msgctxt "whether the server is running, displayed in front of a checkbox" msgid "Running" msgstr "Rodando" -#: dashboard/qml/Main.qml:217 +#: dashboard/qml/Main.qml:229 #, kde-format msgctxt "whether pairing is enabled, displayed in front of a checkbox" msgid "Pairing" msgstr "Pareando" -#: dashboard/qml/Main.qml:230 +#: dashboard/qml/Main.qml:242 #, kde-format msgid "PIN: %1" msgstr "PIN: %1" -#: dashboard/qml/Main.qml:238 dashboard/qml/WizardPage.qml:373 +#: dashboard/qml/Main.qml:250 dashboard/qml/WizardPage.qml:373 #, kde-format msgid "Connect by USB" msgstr "Conectar pela USB" -#: dashboard/qml/Main.qml:249 +#: dashboard/qml/Main.qml:261 #, kde-format msgid "No headset is connected or your headset is not in developer mode." msgstr "" "Nenhum headset está conectado ou seu headset não está em modo desenvolvedor." -#: dashboard/qml/Main.qml:257 +#: dashboard/qml/Main.qml:269 #, kde-format msgid "Disconnect" msgstr "Desconectar" -#: dashboard/qml/Main.qml:274 +#: dashboard/qml/Main.qml:286 #, kde-format msgctxt "automatically started application" msgid "Application" msgstr "Aplicativo" -#: dashboard/qml/Main.qml:295 +#: dashboard/qml/Main.qml:307 #, kde-format msgid "Steam information" msgstr "Informações da Steam" -#: dashboard/qml/Main.qml:313 +#: dashboard/qml/Main.qml:325 #, kde-format msgid "Wizard" msgstr "Assistente" -#: dashboard/qml/Main.qml:320 +#: dashboard/qml/Main.qml:332 #, kde-format msgid "Install the app" msgstr "Instalar o aplicativo" -#: dashboard/qml/Main.qml:349 dashboard/qml/SettingsPage.qml:14 +#: dashboard/qml/Main.qml:361 dashboard/qml/SettingsPage.qml:14 #, kde-format msgid "Settings" msgstr "Ajustes" -#: dashboard/qml/Main.qml:356 dashboard/qml/TroubleshootPage.qml:10 +#: dashboard/qml/Main.qml:368 dashboard/qml/TroubleshootPage.qml:10 #, kde-format msgid "Troubleshoot" msgstr "Resolver problemas" @@ -353,13 +363,13 @@ msgctxt "don't start an application automatically" msgid "None" msgstr "Nenhum" -#: dashboard/qml/SelectGame.qml:21 +#: dashboard/qml/SelectGame.qml:20 #, kde-format msgctxt "choose a custom application to start" msgid "Custom" msgstr "Personalizado" -#: dashboard/qml/SelectGame.qml:79 +#: dashboard/qml/SelectGame.qml:76 #, kde-format msgctxt "browse a file to choose the application to start" msgid "Browse" diff --git a/locale/pt_BR/wivrn.po b/locale/pt_BR/wivrn.po index a7960230..0dec7723 100644 --- a/locale/pt_BR/wivrn.po +++ b/locale/pt_BR/wivrn.po @@ -4,134 +4,140 @@ # SPDX-FileCopyrightText: 2025 Claudio Sampaio (Patola) # LuckShiba , 2025. # +# SPDX-FileCopyrightText: 2025 myghi 63 +# SPDX-FileCopyrightText: 2025 myghi 63 +# SPDX-FileCopyrightText: 2025 myghi 63 +# SPDX-FileCopyrightText: 2025 myghi63 msgid "" msgstr "" "Project-Id-Version: WiVRn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-06-20 19:23-0300\n" -"PO-Revision-Date: 2025-06-23 05:42-0300\n" -"Last-Translator: LuckShiba \n" -"Language-Team: Brazilian Portuguese\n" +"POT-Creation-Date: 2025-08-04 10:49-0300\n" +"PO-Revision-Date: 2025-08-08 11:55-0300\n" +"Last-Translator: myghi63 \n" "Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Gtranslator 48.0\n" +"X-Generator: Lokalize 25.04.3\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: client/scenes/lobby.cpp:148 +#: client/scene.cpp:74 msgid "No supported swapchain format" msgstr "Sem formato de cadeia de troca suportado" -#: client/scenes/lobby.cpp:228 +#: client/scenes/lobby.cpp:185 msgid "Incompatible WiVRn server: no protocol field in TXT" msgstr "Servidor WiVRn incompatível: sem campo protocolo no TXT" -#: client/scenes/lobby.cpp:231 +#: client/scenes/lobby.cpp:188 #, c++-format msgid "Incompatible WiVRn server protocol (client: {}, server: {})" msgstr "Protocolo incompatível de servidor WiVRn (cliente: {}, servidor: {})" -#: client/scenes/lobby.cpp:246 +#: client/scenes/lobby.cpp:203 #, c++-format msgid "Cannot resolve hostname: {}" msgstr "Incapaz de resolver hostname: {}" -#: 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 "Incapaz de conectar a {} ({}): {}" -#: client/scenes/lobby.cpp:453 +#: client/scenes/lobby.cpp:379 msgid "Waiting for connection" msgstr "Aguardando conexão" -#: client/scenes/lobby_gui.cpp:132 +#: client/scenes/lobby_gui.cpp:229 msgctxt "openxr_post_processing" msgid "Normal" msgstr "Normal" -#: client/scenes/lobby_gui.cpp:135 +#: client/scenes/lobby_gui.cpp:232 msgctxt "openxr_post_processing" msgid "Quality" msgstr "Qualidade" -#: client/scenes/lobby_gui.cpp:137 +#: client/scenes/lobby_gui.cpp:234 msgctxt "openxr_post_processing" msgid "Disabled" msgstr "Desabilitado" -#: client/scenes/lobby_gui.cpp:198 +#: client/scenes/lobby_gui.cpp:242 client/scenes/lobby_gui.cpp:398 +#: client/scenes/stream_gui.cpp:812 msgid "Disconnect" msgstr "Desconectar" -#: client/scenes/lobby_gui.cpp:204 -msgid "Video stream interrupted" -msgstr "Fluxo de vídeo interrompido" - -#: client/scenes/lobby_gui.cpp:206 -msgid "" -"Connection ready\n" -"Start a VR application on your computer" -msgstr "" -"Conexão pronta\n" -"Inicie um aplicativo VR no seu computador" - -#: client/scenes/lobby_gui.cpp:208 -#, c++-format -msgid "" -"Connection ready\n" -"Start a VR application on {}" -msgstr "" -"Conexão pronta\n" -"Inicie um aplicativo VR em {}" - -#: client/scenes/lobby_gui.cpp:221 +#: client/scenes/lobby_gui.cpp:262 client/scenes/stream_gui.cpp:808 msgid "Close" msgstr "Fechar" -#: client/scenes/lobby_gui.cpp:227 +#: client/scenes/lobby_gui.cpp:268 msgid "Connection" msgstr "Conexão" -#: client/scenes/lobby_gui.cpp:229 +#: client/scenes/lobby_gui.cpp:270 #, c++-format msgid "Connection to {}" msgstr "Conexão a {}" -#: client/scenes/lobby_gui.cpp:259 +#: client/scenes/lobby_gui.cpp:300 msgid "PIN" msgstr "PIN" -#: client/scenes/lobby_gui.cpp:281 +#: client/scenes/lobby_gui.cpp:322 msgid "Input the PIN displayed on the dashboard" msgstr "Entre o PIN mostrado no painel" -#: client/scenes/lobby_gui.cpp:356 +#: client/scenes/lobby_gui.cpp:393 +msgid "Connected to WiVRn server" +msgstr "Conectado ao servidor WiVRn" + +#: client/scenes/lobby_gui.cpp:395 +#, c++-format +msgid "Connected to {}" +msgstr "Conectado a {}" + +#: client/scenes/lobby_gui.cpp:405 +msgid "Start an application on the server to start streaming." +msgstr "Abra um aplicativo no servidor para iniciar o streaming." + +#: client/scenes/lobby_gui.cpp:414 +msgid "Start an application on your computer or select one to start streaming." +msgstr "" +"Abra um aplicativo no seu computador ou selecione um para iniciar o streaming." + +#: client/scenes/lobby_gui.cpp:416 +#, c++-format +msgid "Start an application on {} or select one to start streaming." +msgstr "Abra um aplicativo em {} ou selecione um para iniciar o streaming." + +#: client/scenes/lobby_gui.cpp:522 msgid "Name" msgstr "Nome" -#: client/scenes/lobby_gui.cpp:367 +#: client/scenes/lobby_gui.cpp:533 msgid "Address" msgstr "Endereço" -#: client/scenes/lobby_gui.cpp:376 +#: client/scenes/lobby_gui.cpp:542 msgid "Port" msgstr "Porta" -#: client/scenes/lobby_gui.cpp:384 +#: client/scenes/lobby_gui.cpp:550 msgid "TCP only" msgstr "TCP somente" -#: client/scenes/lobby_gui.cpp:391 +#: client/scenes/lobby_gui.cpp:557 msgid "Cancel" msgstr "Cancelar" -#: client/scenes/lobby_gui.cpp:405 +#: client/scenes/lobby_gui.cpp:571 msgid "Save" msgstr "Salvar" -#: client/scenes/lobby_gui.cpp:458 +#: client/scenes/lobby_gui.cpp:624 msgid "" "Start a WiVRn server on your\n" "local network" @@ -139,32 +145,32 @@ msgstr "" "Inicie um servidor WiVRn em sua\n" "rede local" -#: client/scenes/lobby_gui.cpp:490 +#: client/scenes/lobby_gui.cpp:656 msgid "Autoconnect" msgstr "Autoconectar" -#: client/scenes/lobby_gui.cpp:516 +#: client/scenes/lobby_gui.cpp:682 msgid "Connect" msgstr "Conectar" -#: client/scenes/lobby_gui.cpp:526 client/wivrn_client.cpp:186 +#: client/scenes/lobby_gui.cpp:692 client/wivrn_client.cpp:186 msgid "Incompatible server version" msgstr "Versão de servidor incompatível" -#: client/scenes/lobby_gui.cpp:528 +#: client/scenes/lobby_gui.cpp:694 msgid "Server not available" msgstr "Servidor não disponível" -#: client/scenes/lobby_gui.cpp:614 +#: client/scenes/lobby_gui.cpp:780 msgid "Refresh rate" msgstr "Taxa de atualização" -#: client/scenes/lobby_gui.cpp:614 client/scenes/lobby_gui.cpp:616 +#: client/scenes/lobby_gui.cpp:780 client/scenes/lobby_gui.cpp:782 msgctxt "automatic refresh rate" msgid "Automatic" msgstr "Automático" -#: client/scenes/lobby_gui.cpp:623 +#: client/scenes/lobby_gui.cpp:789 msgid "" "Select refresh rate based on measured application performance.\n" "May cause flicker when a change happens." @@ -172,60 +178,60 @@ msgstr "" "Seleciona a taxa de atualização baseada no desempenho medido do aplicativo.\n" "Pode causar oscilações quando uma alteração ocorrer." -#: client/scenes/lobby_gui.cpp:640 +#: client/scenes/lobby_gui.cpp:806 msgid "Minimum refresh rate" msgstr "Taxa de atualização mínima" -#: client/scenes/lobby_gui.cpp:663 +#: client/scenes/lobby_gui.cpp:829 msgid "Resolution scale" msgstr "Escala de resolução" -#: client/scenes/lobby_gui.cpp:667 client/scenes/lobby_gui.cpp:971 +#: client/scenes/lobby_gui.cpp:833 client/scenes/lobby_gui.cpp:1072 #, c-format, c++-format msgid "%d%% - {}x{} per eye" msgstr "%d%% - {}x{} por olho" -#: client/scenes/lobby_gui.cpp:678 client/scenes/lobby_gui.cpp:982 +#: client/scenes/lobby_gui.cpp:844 client/scenes/lobby_gui.cpp:1083 #, c++-format msgid "Resolution larger than {}x{} may not be supported by the headset" msgstr "Resolução maior que {}x{} pode não ser suportada pelo headset" -#: client/scenes/lobby_gui.cpp:684 +#: client/scenes/lobby_gui.cpp:850 msgid "Enable microphone" msgstr "Ativar microfone" -#: client/scenes/lobby_gui.cpp:694 +#: client/scenes/lobby_gui.cpp:859 msgid "Unprocessed Microphone Audio" msgstr "Áudio Não-processado de Microfone" -#: client/scenes/lobby_gui.cpp:700 +#: client/scenes/lobby_gui.cpp:865 msgid "Force disable audio filters, such as noise cancellation" msgstr "" "Força a desativação de filtros de áudio tais como cancelamento de ruído" -#: client/scenes/lobby_gui.cpp:707 +#: client/scenes/lobby_gui.cpp:872 msgid "Enable hand tracking" msgstr "Ativar rastreamento de mãos" -#: 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:878 client/scenes/lobby_gui.cpp:890 +#: client/scenes/lobby_gui.cpp:902 client/scenes/lobby_gui.cpp:918 +#: client/scenes/lobby_gui.cpp:968 msgid "This feature is not supported by your headset" msgstr "Este recurso não é suportado pelo seu headset" -#: client/scenes/lobby_gui.cpp:720 +#: client/scenes/lobby_gui.cpp:884 msgid "Enable eye tracking" msgstr "Ativar rastreamento ocular" -#: client/scenes/lobby_gui.cpp:733 +#: client/scenes/lobby_gui.cpp:896 msgid "Enable face tracking" msgstr "Ativar rastreamento facial" -#: client/scenes/lobby_gui.cpp:747 +#: client/scenes/lobby_gui.cpp:909 msgid "Enable body tracking" msgstr "Ativar rastreamento corporal" -#: client/scenes/lobby_gui.cpp:764 +#: client/scenes/lobby_gui.cpp:925 msgid "" "Requires 'Hand and body tracking' to be enabled in the Quest movement " "tracking settings,\n" @@ -237,11 +243,11 @@ msgstr "" "estimados\n" "com base nas posições do controle e do headset." -#: client/scenes/lobby_gui.cpp:777 +#: client/scenes/lobby_gui.cpp:938 msgid "Enable lower body tracking" msgstr "Ativar rastreamento corporal inferior" -#: client/scenes/lobby_gui.cpp:783 +#: client/scenes/lobby_gui.cpp:944 msgid "" "Estimate lower body joint positions using Generative Legs\n" "Requires 'Hand and body tracking' to be enabled in the Quest movement " @@ -252,11 +258,11 @@ msgstr "" "Requer que 'Rastreamento corporal e das mãos' esteja ativado nas\n" "configurações de Rastreamento de Movimento do Quest" -#: client/scenes/lobby_gui.cpp:786 +#: client/scenes/lobby_gui.cpp:947 msgid "Enable hip tracking" msgstr "Ativar rastreamento de quadril" -#: client/scenes/lobby_gui.cpp:792 +#: client/scenes/lobby_gui.cpp:953 msgid "" "Only takes affect with lower body tracking enabled\n" "May be desired when using another source of hip tracking" @@ -264,45 +270,19 @@ msgstr "" "Só tem efeito com o rastreamento corporal inferior ativado\n" "Pode ser desejado ao usar outra fonte de rastreamento de quadril" -#: client/scenes/lobby_gui.cpp:800 +#: client/scenes/lobby_gui.cpp:961 msgid "Enable video passthrough in lobby" msgstr "Habilitar repassagem de vídeo no lobby" -#: client/scenes/lobby_gui.cpp:810 -msgid "Show performance metrics" -msgstr "Mostrar métricas de desempenho" - -#: client/scenes/lobby_gui.cpp:814 -msgid "Overlay can be toggled by pressing both thumbsticks" -msgstr "A sobreposição pode ser alternada pressionando ambos os joysticks" - -#: client/scenes/lobby_gui.cpp:844 client/scenes/lobby_gui.cpp:852 -#: client/scenes/stream_stats.cpp:159 -msgid "CPU time" -msgstr "Tempo de CPU" - -#: client/scenes/lobby_gui.cpp:848 -msgid "CPU time [ms]" -msgstr "Tempo de 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 de GPU" - -#: client/scenes/lobby_gui.cpp:862 -msgid "GPU time [ms]" -msgstr "Tempo de GPU [ms]" - -#: client/scenes/lobby_gui.cpp:881 +#: client/scenes/lobby_gui.cpp:982 client/scenes/stream_gui.cpp:434 msgid "OpenXR post-processing" msgstr "Pós-processamento OpenXR" -#: client/scenes/lobby_gui.cpp:885 +#: client/scenes/lobby_gui.cpp:986 client/scenes/stream_gui.cpp:438 msgid "Supersampling" msgstr "Supersampling" -#: client/scenes/lobby_gui.cpp:905 +#: client/scenes/lobby_gui.cpp:1006 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" @@ -310,11 +290,11 @@ msgstr "" "Reduz flicker para arestas de alto contraste.\n" "Útil quando a resolução de entrada é alta comparada ao display do headset" -#: client/scenes/lobby_gui.cpp:910 +#: client/scenes/lobby_gui.cpp:1011 client/scenes/stream_gui.cpp:464 msgid "Sharpening" msgstr "Aumento de nitidez" -#: client/scenes/lobby_gui.cpp:930 +#: client/scenes/lobby_gui.cpp:1031 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,11 +302,11 @@ msgstr "" "Melhora a clareza de arestas de alto contraste e minimiza o desfoque.\n" "Útil quando a resolução de entrada é baixa comparada ao display do headset" -#: client/scenes/lobby_gui.cpp:939 +#: client/scenes/lobby_gui.cpp:1040 msgid "Enable Snapdragon Game Super Resolution" msgstr "Habilitar Snapdragon Game Super Resolution" -#: client/scenes/lobby_gui.cpp:947 +#: client/scenes/lobby_gui.cpp:1048 msgid "" "On this headset, this setting has been fully superseded by the native " "Sharpening setting above.\n" @@ -336,184 +316,288 @@ msgstr "" "aumento de nitidez acima.\n" "Somente habilite se souber o que está fazendo." -#: client/scenes/lobby_gui.cpp:949 +#: client/scenes/lobby_gui.cpp:1050 msgid "" "Client-side upscaling and sharpening, adds a performance cost on the headset" msgstr "" "Upscaling e aumento de nitidez do lado do cliente, acrescenta um custo de " "desempenho no headset" -#: client/scenes/lobby_gui.cpp:967 +#: client/scenes/lobby_gui.cpp:1068 msgid "Upscaling factor" msgstr "Fator de upscaling" -#: client/scenes/lobby_gui.cpp:986 +#: client/scenes/lobby_gui.cpp:1087 msgid "Use edge direction" msgstr "Usar direção da aresta" -#: client/scenes/lobby_gui.cpp:992 +#: client/scenes/lobby_gui.cpp:1093 msgid "Adds an additional performance cost" msgstr "Acrescenta um custo de desempenho" -#: client/scenes/lobby_gui.cpp:997 +#: client/scenes/lobby_gui.cpp:1098 msgid "Edge threshold" msgstr "Limite da aresta" -#: client/scenes/lobby_gui.cpp:1004 client/scenes/lobby_gui.cpp:1013 +#: client/scenes/lobby_gui.cpp:1105 client/scenes/lobby_gui.cpp:1114 #, c++-format msgid "Recommended: {:.1f}" msgstr "Recomenadado: {:.1f}" -#: client/scenes/lobby_gui.cpp:1007 +#: client/scenes/lobby_gui.cpp:1108 msgid "Edge sharpness" msgstr "Nitidez da aresta" -#: client/scenes/lobby_gui.cpp:1101 client/scenes/lobby_gui.cpp:1757 +#: client/scenes/lobby_gui.cpp:1210 client/scenes/lobby_gui.cpp:1218 +#: client/scenes/stream_gui.cpp:222 client/scenes/stream_gui.cpp:418 +msgid "CPU time" +msgstr "Tempo de CPU" + +#: client/scenes/lobby_gui.cpp:1214 +msgid "CPU time [ms]" +msgstr "Tempo de CPU [ms]" + +#: client/scenes/lobby_gui.cpp:1224 client/scenes/lobby_gui.cpp:1232 +#: client/scenes/stream_gui.cpp:224 client/scenes/stream_gui.cpp:419 +msgid "GPU time" +msgstr "Tempo de GPU" + +#: client/scenes/lobby_gui.cpp:1228 +msgid "GPU time [ms]" +msgstr "Tempo de GPU [ms]" + +#: client/scenes/lobby_gui.cpp:1271 +msgid "Enable the microphone?" +msgstr "Habilitar o microfone?" + +#: client/scenes/lobby_gui.cpp:1276 +msgid "Enable eye tracking?" +msgstr "Habilitar o rastreamento ocular?" + +#: client/scenes/lobby_gui.cpp:1281 +msgid "Enable face tracking?" +msgstr "Habilitar o rastreamento facial?" + +#: client/scenes/lobby_gui.cpp:1286 +msgid "Enable body tracking?" +msgstr "Habilitar o rastreamento corporal?" + +#: client/scenes/lobby_gui.cpp:1294 +msgid "Welcome to WiVRn" +msgstr "Bem vindo ao WiVRn" + +#: client/scenes/lobby_gui.cpp:1318 +msgid "Yes" +msgstr "Sim" + +#: client/scenes/lobby_gui.cpp:1325 +msgid "No" +msgstr "Não" + +#: client/scenes/lobby_gui.cpp:1344 client/scenes/lobby_gui.cpp:1983 msgid "Licenses" msgstr "Licenças" -#: client/scenes/lobby_gui.cpp:1440 +#: client/scenes/lobby_gui.cpp:1658 msgid "Microphone is enabled" msgstr "O microfone está ativado" -#: client/scenes/lobby_gui.cpp:1441 +#: client/scenes/lobby_gui.cpp:1659 msgid "Microphone is disabled" msgstr "O microfone está desativado" -#: client/scenes/lobby_gui.cpp:1450 +#: client/scenes/lobby_gui.cpp:1668 msgid "Hand tracking is enabled" msgstr "O rastreamento de mãos está ativado" -#: client/scenes/lobby_gui.cpp:1451 +#: client/scenes/lobby_gui.cpp:1669 msgid "Hand tracking is disabled" msgstr "O rastreamento de mãos está desativado" -#: client/scenes/lobby_gui.cpp:1460 +#: client/scenes/lobby_gui.cpp:1678 msgid "Eye tracking is enabled" msgstr "O rastreamento ocular está ativado" -#: client/scenes/lobby_gui.cpp:1461 +#: client/scenes/lobby_gui.cpp:1679 msgid "Eye tracking is disabled" msgstr "O rastreamento ocular está desativado" -#: client/scenes/lobby_gui.cpp:1471 client/scenes/lobby_gui.cpp:1482 +#: client/scenes/lobby_gui.cpp:1692 msgid "Face tracking is enabled" msgstr "O rastreamento facial está ativado" -#: client/scenes/lobby_gui.cpp:1472 client/scenes/lobby_gui.cpp:1483 +#: client/scenes/lobby_gui.cpp:1693 msgid "Face tracking is disabled" msgstr "O rastreamento facial está desativado" -#: client/scenes/lobby_gui.cpp:1493 +#: client/scenes/lobby_gui.cpp:1703 msgid "Body tracking is enabled" msgstr "O rastreamento corporal está ativado" -#: client/scenes/lobby_gui.cpp:1494 +#: client/scenes/lobby_gui.cpp:1704 msgid "Body tracking is disabled" msgstr "O rastreamento corporal está desativado" -#: client/scenes/lobby_gui.cpp:1510 +#: client/scenes/lobby_gui.cpp:1720 msgid "Add server" msgstr "Adicionar servidor" -#: client/scenes/lobby_gui.cpp:1739 +#: client/scenes/lobby_gui.cpp:1965 msgid "Server list" msgstr "Lista de servidores" -#: client/scenes/lobby_gui.cpp:1742 +#: client/scenes/lobby_gui.cpp:1968 client/scenes/stream_gui.cpp:796 msgid "Settings" msgstr "Ajustes" -#: client/scenes/lobby_gui.cpp:1745 +#: client/scenes/lobby_gui.cpp:1971 msgid "Post-processing" msgstr "Pós-processamento" -#: client/scenes/lobby_gui.cpp:1749 +#: client/scenes/lobby_gui.cpp:1975 msgid "Debug" msgstr "Depurar" -#: client/scenes/lobby_gui.cpp:1754 +#: client/scenes/lobby_gui.cpp:1980 msgid "About" msgstr "Sobre" -#: client/scenes/lobby_gui.cpp:1760 +#: client/scenes/lobby_gui.cpp:1986 msgid "Exit" msgstr "Sair" -#: client/scenes/lobby_gui.cpp:1774 +#: client/scenes/lobby_gui.cpp:2003 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 "" -"Pressione A ou X ou coloque a palma da mão pra cima\n" +"Pressione o botão de aderência ou coloque a palma da mão para cima\n" "para mover a janela principal" -#: client/scenes/lobby_gui.cpp:1776 -msgid "Press A or X to move the main window" -msgstr "Pressione A ou X para mover a janela principal" +#: client/scenes/lobby_gui.cpp:2005 +msgid "Press the grip button to move the main window" +msgstr "Pressione o botão de aderência para mover a janela principal" -#: client/scenes/stream_stats.cpp:161 +#: client/scenes/stream_gui.cpp:224 msgid "Reproject" msgstr "Reprojetar" -#: client/scenes/stream_stats.cpp:162 +#: client/scenes/stream_gui.cpp:225 msgid "Blit" msgstr "Blit" -#: client/scenes/stream_stats.cpp:164 +#: client/scenes/stream_gui.cpp:227 msgid "Network" msgstr "Rede" -#: client/scenes/stream_stats.cpp:164 +#: client/scenes/stream_gui.cpp:227 client/scenes/stream_gui.cpp:416 msgid "Download" msgstr "Baixar" -#: client/scenes/stream_stats.cpp:165 +#: client/scenes/stream_gui.cpp:228 client/scenes/stream_gui.cpp:417 msgid "Upload" msgstr "Enviar" -#: client/scenes/stream_stats.cpp:234 +#: client/scenes/stream_gui.cpp:297 #, c++-format msgid "Decoder {}" msgstr "Decodificador {}" -#: client/scenes/stream_stats.cpp:246 +#: client/scenes/stream_gui.cpp:309 msgid "Timings [ms]" msgstr "Tempos [ms]" -#: client/scenes/stream_stats.cpp:306 +#: client/scenes/stream_gui.cpp:369 msgid "Encode" msgstr "Codificar" -#: client/scenes/stream_stats.cpp:307 +#: client/scenes/stream_gui.cpp:370 msgid "Send" msgstr "Enviar" -#: client/scenes/stream_stats.cpp:308 +#: client/scenes/stream_gui.cpp:371 msgid "Receive" msgstr "Receber" -#: client/scenes/stream_stats.cpp:309 +#: client/scenes/stream_gui.cpp:372 msgid "Decode" msgstr "Decodificar" -#: client/scenes/stream_stats.cpp:310 +#: client/scenes/stream_gui.cpp:373 msgid "Blitted" msgstr "Blitado" -#: client/scenes/stream_stats.cpp:311 +#: client/scenes/stream_gui.cpp:374 msgid "Displayed" msgstr "Mostrado" -#: 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 "Movimento estimado para a latência de fótons: {}ms" +#: client/scenes/stream_gui.cpp:396 +msgid "Press the grip button to move the window" +msgstr "Pressione o botão de aderência para mover a janela" + +#: client/scenes/stream_gui.cpp:398 client/scenes/stream_gui.cpp:750 +msgid "Press both thumbsticks to display the WiVRn window" +msgstr "Pressione ambos os thumbsticks para mostrar a janela do WiVRn" + +#: client/scenes/stream_gui.cpp:420 +msgid "Motion to photon latency" +msgstr "Latência (de movimento para fótons)" + +#: client/scenes/stream_gui.cpp:492 +msgid "Foveation center override" +msgstr "Ajuste do centro de foveação" + +#: client/scenes/stream_gui.cpp:495 +msgid "Enable" +msgstr "Habilitar" + +#: client/scenes/stream_gui.cpp:503 client/scenes/stream_gui.cpp:550 +#, c++-format +msgid "Height {:.1f} deg" +msgstr "Altura {:.1f} graus" + +#: client/scenes/stream_gui.cpp:504 client/scenes/stream_gui.cpp:551 +#, c++-format +msgid "Distance {:.2f} m" +msgstr "Distância {:.2f} m" + +#: client/scenes/stream_gui.cpp:505 +msgid "Default" +msgstr "Padrão" + +#: client/scenes/stream_gui.cpp:516 +msgid "Change" +msgstr "Modificar" + +#: client/scenes/stream_gui.cpp:548 +msgid "Use the thumbsticks to move the foveation center" +msgstr "Use os thumbsticks para mover o centro da foveação" + +#: client/scenes/stream_gui.cpp:549 +msgid "Press A to save or B to cancel" +msgstr "Pressione A para salvar ou B para cancelar" + +#: client/scenes/stream_gui.cpp:793 +msgid "Stats" +msgstr "Estatísticas" + +#: client/scenes/stream_gui.cpp:802 +msgid "Statistics overlay" +msgstr "Overlay de estatísticas" + +#: client/scenes/stream_gui.cpp:805 +msgid "Compact view" +msgstr "Visualização compacta" + #: client/wivrn_client.cpp:98 client/wivrn_client.cpp:202 msgid "Timeout" msgstr "Tempo esgotado" @@ -529,3 +613,37 @@ msgstr "Incapaz de verificar PIN" #: client/wivrn_client.cpp:182 msgid "Pairing is disabled on server" msgstr "Pareamento está desabilitado no servidor" + +#~ msgid "Video stream interrupted" +#~ msgstr "Fluxo de vídeo interrompido" + +#~ msgid "" +#~ "Connection ready\n" +#~ "Start a VR application on your computer" +#~ msgstr "" +#~ "Conexão pronta\n" +#~ "Inicie um aplicativo VR no seu computador" + +#, c++-format +#~ msgid "" +#~ "Connection ready\n" +#~ "Start a VR application on {}" +#~ msgstr "" +#~ "Conexão pronta\n" +#~ "Inicie um aplicativo VR em {}" + +#~ msgid "Show performance metrics" +#~ msgstr "Mostrar métricas de desempenho" + +#~ msgid "Overlay can be toggled by pressing both thumbsticks" +#~ msgstr "A sobreposição pode ser alternada pressionando ambos os joysticks" + +#~ msgid "" +#~ "Press A or X or put your palm up\n" +#~ "to move the main window" +#~ msgstr "" +#~ "Pressione A ou X ou coloque a palma da mão pra cima\n" +#~ "para mover a janela principal" + +#~ msgid "Press A or X to move the main window" +#~ msgstr "Pressione A ou X para mover a janela principal" From 5d58af95e4c419a1d17a824c6babee9701cdfe90 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Fri, 8 Aug 2025 18:03:40 +0200 Subject: [PATCH 09/85] Add note about Lokalize mailing list setting --- docs/translating.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/translating.md b/docs/translating.md index 0aee035d..2d6781a7 100644 --- a/docs/translating.md +++ b/docs/translating.md @@ -5,6 +5,8 @@ The headset application and the server dashboard are translated, contributions a # Required software You only need `gettext` and a text editor, you can optionally use a graphical editor such as [GNOME Translation Editor](https://wiki.gnome.org/Apps/Gtranslator/) or [Lokalize](https://apps.kde.org/lokalize/). +If using Lokalize, make sure to erase the "Default mailing list" in the settings, or it will write a KDE mailing list in the translation file and you will to manually remove it. + # Adding a new language * 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. From 3c82c2db8466f18327ec6d6c10d2b52a110964a6 Mon Sep 17 00:00:00 2001 From: myghi63 Date: Fri, 8 Aug 2025 13:44:31 -0300 Subject: [PATCH 10/85] Fix welcome translation and file comments --- locale/pt_BR/wivrn-dashboard.po | 3 ++- locale/pt_BR/wivrn.po | 8 +++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/locale/pt_BR/wivrn-dashboard.po b/locale/pt_BR/wivrn-dashboard.po index 14c01d9b..60969ea8 100644 --- a/locale/pt_BR/wivrn-dashboard.po +++ b/locale/pt_BR/wivrn-dashboard.po @@ -4,7 +4,8 @@ # SPDX-FileCopyrightText: 2025 Claudio Sampaio (Patola) # LuckShiba , 2025. # -# SPDX-FileCopyrightText: 2025 myghi 63 +# SPDX-FileCopyrightText: 2025 myghi63 +# msgid "" msgstr "" "Project-Id-Version: WiVRn-dashboard\n" diff --git a/locale/pt_BR/wivrn.po b/locale/pt_BR/wivrn.po index 0dec7723..045e3fb5 100644 --- a/locale/pt_BR/wivrn.po +++ b/locale/pt_BR/wivrn.po @@ -4,16 +4,14 @@ # SPDX-FileCopyrightText: 2025 Claudio Sampaio (Patola) # LuckShiba , 2025. # -# SPDX-FileCopyrightText: 2025 myghi 63 -# SPDX-FileCopyrightText: 2025 myghi 63 -# SPDX-FileCopyrightText: 2025 myghi 63 # SPDX-FileCopyrightText: 2025 myghi63 +# msgid "" msgstr "" "Project-Id-Version: WiVRn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-08-04 10:49-0300\n" -"PO-Revision-Date: 2025-08-08 11:55-0300\n" +"PO-Revision-Date: 2025-08-08 13:27-0300\n" "Last-Translator: myghi63 \n" "Language: pt_BR\n" "MIME-Version: 1.0\n" @@ -384,7 +382,7 @@ msgstr "Habilitar o rastreamento corporal?" #: client/scenes/lobby_gui.cpp:1294 msgid "Welcome to WiVRn" -msgstr "Bem vindo ao WiVRn" +msgstr "Bem vindo(a) ao WiVRn" #: client/scenes/lobby_gui.cpp:1318 msgid "Yes" From 669b06e982a43f79dd320f05cc4b20bed5578d5f Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Fri, 8 Aug 2025 20:10:18 +0200 Subject: [PATCH 11/85] typo in translating.md --- docs/translating.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/translating.md b/docs/translating.md index 2d6781a7..35757836 100644 --- a/docs/translating.md +++ b/docs/translating.md @@ -5,7 +5,7 @@ The headset application and the server dashboard are translated, contributions a # Required software You only need `gettext` and a text editor, you can optionally use a graphical editor such as [GNOME Translation Editor](https://wiki.gnome.org/Apps/Gtranslator/) or [Lokalize](https://apps.kde.org/lokalize/). -If using Lokalize, make sure to erase the "Default mailing list" in the settings, or it will write a KDE mailing list in the translation file and you will to manually remove it. +If using Lokalize, make sure to erase the "Default mailing list" in the settings, or it will write a KDE mailing list in the translation file and you will have to manually remove it. # Adding a new language From 1b78180d734d5eb52276c0cea2e48d991f6befd6 Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Tue, 5 Aug 2025 21:33:19 +0200 Subject: [PATCH 12/85] Send app icons one by one --- client/scenes/lobby_gui.cpp | 6 ++-- client/scenes/stream.h | 11 +++++- client/scenes/stream_network.cpp | 20 ++++++++++- common/application.cpp | 59 +++++++++++++++----------------- common/application.h | 6 ++-- common/wivrn_packets.h | 12 +++++-- dashboard/apps.cpp | 2 +- server/driver/wivrn_session.cpp | 22 ++++++++++-- 8 files changed, 91 insertions(+), 47 deletions(-) diff --git a/client/scenes/lobby_gui.cpp b/client/scenes/lobby_gui.cpp index 0036cbe1..eb4853c1 100644 --- a/client/scenes/lobby_gui.cpp +++ b/client/scenes/lobby_gui.cpp @@ -400,7 +400,7 @@ void scenes::lobby::gui_connected() auto apps = next_scene->get_applications(); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, {20, 20}); - if (apps->applications.empty()) + if (apps->empty()) { CenterTextHV(_("Start an application on the server to start streaming.")); } @@ -426,7 +426,7 @@ void scenes::lobby::gui_connected() ImGui::Indent((usable_window_width - icon_line_width) / 2); auto t0 = std::chrono::steady_clock::now(); - for (const auto [index, app]: utils::enumerate(apps->applications)) + for (const auto [index, app]: utils::enumerate(*apps)) { ImTextureID texture = [&]() -> ImTextureID { if (app.image.empty()) @@ -470,7 +470,7 @@ void scenes::lobby::gui_connected() std::vector> to_be_removed; for (const auto & [app_id, app_icon]: app_icons) { - if (not std::ranges::contains(apps->applications, app_id, &to_headset::application_list::application::id)) + if (not std::ranges::contains(*apps, app_id, &scenes::stream::app::id)) to_be_removed.emplace_back(app_id, app_icon); } for (const auto & [app_id, app_icon]: to_be_removed) diff --git a/client/scenes/stream.h b/client/scenes/stream.h index 6f506ab7..aa28435a 100644 --- a/client/scenes/stream.h +++ b/client/scenes/stream.h @@ -21,6 +21,7 @@ #include "audio/audio.h" #include "decoder/shard_accumulator.h" +#include "imgui.h" #include "render/imgui_impl.h" #include "scene.h" #include "scenes/input_profile.h" @@ -48,6 +49,13 @@ public: }; static const size_t image_buffer_size = 3; + struct app + { + std::string id; + std::string name; + std::vector image; + }; + private: static const size_t view_count = 2; @@ -176,7 +184,7 @@ private: std::vector> current_blit_handles; // Last application list received from server - thread_safe applications; + thread_safe> applications; stream(); @@ -202,6 +210,7 @@ public: void operator()(to_headset::video_stream_description &&); void operator()(to_headset::refresh_rate_change &&); void operator()(to_headset::application_list &&); + void operator()(to_headset::application_icon &&); void operator()(audio_data &&); void push_blit_handle(wivrn::shard_accumulator * decoder, std::shared_ptr handle); diff --git a/client/scenes/stream_network.cpp b/client/scenes/stream_network.cpp index cc8201d5..d93601d6 100644 --- a/client/scenes/stream_network.cpp +++ b/client/scenes/stream_network.cpp @@ -111,8 +111,26 @@ 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); + + locked->clear(); + locked->reserve(apps.applications.size()); + for (const auto & i: apps.applications) + { + locked->push_back(app{ + .id = std::move(i.id), + .name = std::move(i.name), + }); + } +} + +void scenes::stream::operator()(to_headset::application_icon && icon) +{ + auto locked = applications.lock(); + + if (auto it = std::ranges::find(*locked, icon.id, &app::id); it != locked->end()) + it->image = std::move(icon.image); } void scenes::stream::start_application(std::string appid) diff --git a/common/application.cpp b/common/application.cpp index c4b2bc6a..0e8f6e8c 100644 --- a/common/application.cpp +++ b/common/application.cpp @@ -20,7 +20,6 @@ #include "application.h" #include "utils/flatpak.h" -#include "utils/load_icon.h" #include "utils/steam_app_info.h" #include "utils/xdg_base_directory.h" #include "utils/xdg_icon_lookup.h" @@ -85,17 +84,17 @@ steam_app_info read_steam_app_info(const std::filesystem::path & root) return {}; } -std::vector load_steam_icon(const std::filesystem::path & root, int app_id, const steam_app_info & info) +std::filesystem::path find_steam_icon(const std::filesystem::path & root, int app_id, const steam_app_info & info) { const auto & app_info = info.get(app_id); try { std::string icon{std::get(app_info.at("common.clienticon"))}; + auto icon_path = root / "steam/games" / (icon + ".ico"); - auto image = load_icon(root / "steam/games" / (icon + ".ico"), 128); - if (not image.empty()) - return image; + if (std::filesystem::exists(icon_path)) + return icon_path; } catch (...) { @@ -105,9 +104,10 @@ std::vector load_steam_icon(const std::filesystem::path & root, int a { std::string icon{std::get(app_info.at("common.LinuxClientIcon"))}; - auto image = load_icon(root / "steam/games" / (icon + ".zip"), 128); - if (not image.empty()) - return image; + auto icon_path = root / "steam/games" / (icon + ".zip"); + + if (std::filesystem::exists(icon_path)) + return icon_path; } catch (...) { @@ -116,7 +116,7 @@ std::vector load_steam_icon(const std::filesystem::path & root, int a return {}; } -void read_steam_vr_apps(std::unordered_map & res, bool load_icons) +void read_steam_vr_apps(std::unordered_map & res) { auto [command, root] = find_steam(); if (not root) @@ -166,21 +166,18 @@ void read_steam_vr_apps(std::unordered_map & res, bool } } - if (load_icons) + try { - try - { - const char prefix[] = "steam.app."; - if (app_key.starts_with(prefix)) - { - uint32_t app_id = stoll(app_key.substr(strlen(prefix))); - app.image = load_steam_icon(*root, app_id, info); - } - } - catch (...) + const char prefix[] = "steam.app."; + if (app_key.starts_with(prefix)) { + uint32_t app_id = stoll(app_key.substr(strlen(prefix))); + app.icon_path = find_steam_icon(*root, app_id, info); } } + catch (...) + { + } if (not app.exec.empty()) res[app_key] = std::move(app); @@ -281,7 +278,7 @@ bool contains(std::string_view entries, std::string_view val, char sep = ';') return false; } -std::optional do_desktop_entry(const std::filesystem::path & filename, bool load_icons) +std::optional do_desktop_entry(const std::filesystem::path & filename) { auto data = read_file(filename); std::optional res; @@ -323,12 +320,11 @@ std::optional do_desktop_entry(const std::filesystem::path & filena res->exec = unescape(item.value); if (item.key == "Path") res->path = unescape(item.value); - if (item.key == "Icon" and load_icons) + if (item.key == "Icon") { try { - if (auto filename = xdg_icon_lookup(std::string{item.value}, 256)) - res->image = load_icon(*filename, 256); + res->icon_path = xdg_icon_lookup(std::string{item.value}, 256); } catch (...) {} @@ -341,7 +337,7 @@ std::optional do_desktop_entry(const std::filesystem::path & filena return res; } -void do_data_dir(std::filesystem::path dir, std::unordered_map & res, bool load_icons) +void do_data_dir(std::filesystem::path dir, std::unordered_map & res) { dir = dir / "applications"; if (not std::filesystem::is_directory(dir)) @@ -364,29 +360,28 @@ void do_data_dir(std::filesystem::path dir, std::unordered_map list_applications(bool include_steam, bool load_icons) +std::unordered_map list_applications() { std::unordered_map res; - if (include_steam) - read_steam_vr_apps(res, load_icons); + read_steam_vr_apps(res); - do_data_dir(xdg_data_home(), res, load_icons); + do_data_dir(xdg_data_home(), res); for (auto && dir: xdg_data_dirs()) - do_data_dir(std::move(dir), res, load_icons); + 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, load_icons); + do_data_dir("/run/host/usr/share", res); } return res; diff --git a/common/application.h b/common/application.h index 38961247..91c051fd 100644 --- a/common/application.h +++ b/common/application.h @@ -18,10 +18,10 @@ #pragma once +#include #include #include #include -#include namespace wivrn { @@ -31,9 +31,9 @@ struct application // localised names, with empty locale for default std::unordered_map name; std::string exec; - std::vector image; // In PNG + std::optional icon_path; std::optional path; }; -std::unordered_map list_applications(bool include_steam = true, bool load_icons = true); +std::unordered_map list_applications(); } // namespace wivrn diff --git a/common/wivrn_packets.h b/common/wivrn_packets.h index 1c40219c..919d3b41 100644 --- a/common/wivrn_packets.h +++ b/common/wivrn_packets.h @@ -41,7 +41,7 @@ namespace wivrn // Default port for server to listen, both TCP and UDP static const int default_port = 9757; -static constexpr int protocol_revision = 2; +static constexpr int protocol_revision = 1; enum class device_id : uint8_t { @@ -675,11 +675,16 @@ struct application_list { std::string id; std::string name; - std::vector image; // In PNG }; std::vector applications; }; +struct application_icon +{ + std::string id; + std::vector image; // In PNG +}; + using packets = std::variant< crypto_handshake, pin_check_2, @@ -693,6 +698,7 @@ using packets = std::variant< timesync_query, tracking_control, refresh_rate_change, - application_list>; + application_list, + application_icon>; } // namespace to_headset } // namespace wivrn diff --git a/dashboard/apps.cpp b/dashboard/apps.cpp index fe24bfa9..2ab62820 100644 --- a/dashboard/apps.cpp +++ b/dashboard/apps.cpp @@ -25,7 +25,7 @@ Apps::Apps(QObject * parent) { - auto apps = wivrn::list_applications(true /* Include steam apps */, false /* Don't load icons */); + auto apps = wivrn::list_applications(); for (const auto & [id, app]: apps) { diff --git a/server/driver/wivrn_session.cpp b/server/driver/wivrn_session.cpp index 6954eb45..45d21178 100644 --- a/server/driver/wivrn_session.cpp +++ b/server/driver/wivrn_session.cpp @@ -28,6 +28,7 @@ #include "util/u_builders.h" #include "util/u_logging.h" #include "util/u_system.h" +#include "utils/load_icon.h" #include "utils/scoped_lock.h" #include "audio/audio_setup.h" @@ -734,15 +735,30 @@ void wivrn_session::operator()(from_headset::get_application_list && request) .country = std::move(request.country), .variant = std::move(request.variant), }; - for (auto && [id, app]: list_applications()) + + auto apps = list_applications(); + + for (const auto & [id, app]: apps) { response.applications.emplace_back( std::move(id), // FIXME: use locale - app.name.at(""), - app.image); + app.name.at("")); } send_control(std::move(response)); + + for (const auto & [id, app]: apps) + { + if (app.icon_path) + { + auto icon = load_icon(*app.icon_path, 256); + + send_control(to_headset::application_icon{ + .id = id, + .image = std::move(icon), + }); + } + } } void wivrn_session::operator()(const from_headset::start_app & request) From 1b11594c3eb008966a160f1886de26f018b2d023 Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Wed, 6 Aug 2025 21:24:29 +0200 Subject: [PATCH 13/85] Send app list ASAP --- client/scenes/stream.cpp | 6 +++++- common/wivrn_packets.h | 5 +++++ server/driver/wivrn_session.cpp | 6 ++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index dc20f14e..aff2938d 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -189,7 +189,11 @@ std::shared_ptr scenes::stream::create(std::unique_ptrnetwork_session = std::move(network_session); self->network_session->send_control([&]() { - from_headset::headset_info_packet info{}; + from_headset::headset_info_packet info{ + .language = application::get_messages_info().language, + .country = application::get_messages_info().country, + .variant = application::get_messages_info().variant, + }; auto view = self->system.view_configuration_views(self->viewconfig)[0]; view = override_view(view, guess_model()); diff --git a/common/wivrn_packets.h b/common/wivrn_packets.h index 919d3b41..ce852ddd 100644 --- a/common/wivrn_packets.h +++ b/common/wivrn_packets.h @@ -239,6 +239,11 @@ struct headset_info_packet uint32_t num_generic_trackers; std::vector supported_codecs; // from preferred to least preferred std::string system_name; + + // Used for the application list + std::string language; + std::string country; + std::string variant; }; struct handshake diff --git a/server/driver/wivrn_session.cpp b/server/driver/wivrn_session.cpp index 45d21178..b42e63d1 100644 --- a/server/driver/wivrn_session.cpp +++ b/server/driver/wivrn_session.cpp @@ -172,6 +172,12 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr connection throw; } + (*this)(from_headset::get_application_list{ + .language = get_info().language, + .country = get_info().country, + .variant = get_info().variant, + }); + static_roles.head = xdevs[xdev_count++] = &hmd; if (hmd.supported.face_tracking) From 963205908f038e9199cb7b2dc168183ec35d0d6c Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Thu, 7 Aug 2025 23:29:01 +0200 Subject: [PATCH 14/85] Add spinner when an app is starting --- client/CMakeLists.txt | 25 +- client/scenes/lobby.h | 4 +- client/scenes/lobby_gui.cpp | 32 +- external/CMakeLists.txt | 4 + external/imspinner/cimspinner.cpp | 1628 ++++++++ external/imspinner/cimspinner.h | 415 ++ external/imspinner/cimspinner_config.h | 11 + external/imspinner/imspinner.h | 4950 ++++++++++++++++++++++++ 8 files changed, 7054 insertions(+), 15 deletions(-) create mode 100644 external/imspinner/cimspinner.cpp create mode 100644 external/imspinner/cimspinner.h create mode 100644 external/imspinner/cimspinner_config.h create mode 100644 external/imspinner/imspinner.h diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 20a01c98..ec7d9d58 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -91,7 +91,22 @@ file(GLOB_RECURSE VULKAN_SHADERS CONFIGURE_DEPENDS "*.glsl") target_sources(wivrn PRIVATE ${LOCAL_SOURCE} ${VULKAN_SHADERS}) wivrn_compile_glsl(wivrn ${VULKAN_SHADERS}) -target_link_libraries(wivrn Vulkan::Vulkan spdlog::spdlog glm::glm fastgltf FreetypeHarfbuzz stb Boost::url Boost::locale) +target_link_libraries(wivrn + Boost::locale + Boost::url + EnTT::EnTT + fastgltf + FreetypeHarfbuzz + glm::glm + imspinner + simdjson + spdlog::spdlog + stb + uni-algo + Vulkan::Vulkan + wivrn-common + wivrn-external +) if (WIVRN_USE_LIBKTX) target_link_libraries(wivrn ktx_read) @@ -107,10 +122,6 @@ if(NOT ANDROID) install(TARGETS wivrn) endif() -target_link_libraries(wivrn simdjson uni-algo wivrn-common wivrn-external) - - - ############################################################################## # Dear ImGui # @@ -140,10 +151,6 @@ target_link_libraries(wivrn-imgui FreetypeHarfbuzz) target_link_libraries(wivrn wivrn-imgui) -############################################################################## -# EnTT -# -target_link_libraries(wivrn EnTT::EnTT) ############################################################################## # Vulkan Validation Layer diff --git a/client/scenes/lobby.h b/client/scenes/lobby.h index 1ef69eae..ca4755b1 100644 --- a/client/scenes/lobby.h +++ b/client/scenes/lobby.h @@ -30,6 +30,7 @@ #include "wivrn_discover.h" #include "wivrn_packets.h" #include +#include #include #include @@ -120,6 +121,7 @@ class lobby : public scene_impl ImTextureID about_picture; ImTextureID default_icon; std::unordered_map app_icons; + XrTime timestamp_start_application{}; virtual_keyboard keyboard; @@ -136,7 +138,7 @@ class lobby : public scene_impl void draw_features_status(XrTime predicted_display_time); void gui_connecting(locked_notifiable & request); void gui_enter_pin(locked_notifiable & request); - void gui_connected(); + void gui_connected(XrTime predicted_display_time); void gui_server_list(); void gui_new_server(); void gui_settings(); diff --git a/client/scenes/lobby_gui.cpp b/client/scenes/lobby_gui.cpp index eb4853c1..ee800ae6 100644 --- a/client/scenes/lobby_gui.cpp +++ b/client/scenes/lobby_gui.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -245,6 +246,7 @@ void scenes::lobby::gui_connecting(locked_notifiable & pin_req if (next_scene) { current_tab = tab::connected; + timestamp_start_application = 0; ImGui::CloseCurrentPopup(); return; } @@ -375,7 +377,7 @@ void scenes::lobby::gui_enter_pin(locked_notifiable & pin_requ imgui_ctx->vibrate_on_hover(); } -void scenes::lobby::gui_connected() +void scenes::lobby::gui_connected(XrTime predicted_display_time) { if (not next_scene) { @@ -406,8 +408,11 @@ void scenes::lobby::gui_connected() } else { + bool app_starting = predicted_display_time - timestamp_start_application < 10'000'000'000; + ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, {20, 0}); - ImGui::BeginChild("Main", ImGui::GetWindowSize() - ImGui::GetCursorPos() - ImVec2(0, disconnect_size.y + 80), 0); + ImGui::BeginDisabled(app_starting); + ImGui::BeginChild("Main", ImGui::GetWindowSize() - ImGui::GetCursorPos() - ImVec2(0, disconnect_size.y + 80), 0, app_starting ? ImGuiWindowFlags_NoScrollWithMouse : 0); ImGui::Indent(20); if (server_name.empty()) @@ -458,7 +463,10 @@ void scenes::lobby::gui_connected() ImGui::PushStyleColor(ImGuiCol_Button, 0); if (icon(app.name + "##" + app.id, texture, {256, 256}, 0, {icon_width, 0})) + { + timestamp_start_application = predicted_display_time; next_scene->start_application(app.id); + } imgui_ctx->vibrate_on_hover(); ImGui::PopStyleColor(); // ImGuiCol_Button @@ -481,12 +489,26 @@ void scenes::lobby::gui_connected() ScrollWhenDragging(); ImGui::EndChild(); + ImGui::EndDisabled(); + + if (app_starting) + { + ImGui::SetCursorPos(ImGui::GetWindowSize() / 2 - ImVec2{200, 200} - ImGui::GetStyle().FramePadding); + ImSpinner::SpinnerAng("App starting spinner", + 200, // Radius + 40, // Thickness + ImColor{1.f, 1.f, 1.f, 1.f}, // Colour + ImColor{1.f, 1.f, 1.f, 0.f}, // Background + 6, // Velocity + 0.75f * 2 * M_PI // Angle + ); + } + ImGui::PopStyleVar(); // ImGuiStyleVar_WindowPadding } ImGui::PopStyleVar(); - ImGui::SetCursorPosX(ImGui::GetWindowSize().x - disconnect_size.x - 50); - ImGui::SetCursorPosY(ImGui::GetWindowSize().y - disconnect_size.y - 50); + ImGui::SetCursorPos(ImGui::GetWindowSize() - disconnect_size - ImVec2{50, 50}); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.8f, 0.2f, 0.2f, 0.40f)); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.8f, 0.2f, 0.2f, 1.00f)); @@ -1887,7 +1909,7 @@ std::vector> scenes::lobby::draw_gui(XrTi ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 10); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, {10, 10}); ImGui::Begin("WiVRn", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove); - gui_connected(); + gui_connected(predicted_display_time); ImGui::End(); ImGui::PopStyleVar(3); // ImGuiStyleVar_WindowPadding, ImGuiStyleVar_FrameRounding, ImGuiStyleVar_FramePadding } diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 3d6233a4..8a4515ec 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -1,2 +1,6 @@ add_library(wivrn-external INTERFACE) target_include_directories(wivrn-external SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) + +add_library(imspinner OBJECT EXCLUDE_FROM_ALL imspinner/cimspinner.cpp) +target_include_directories(imspinner SYSTEM PUBLIC imspinner) +target_link_libraries(imspinner wivrn-imgui) diff --git a/external/imspinner/cimspinner.cpp b/external/imspinner/cimspinner.cpp new file mode 100644 index 00000000..54f36a7e --- /dev/null +++ b/external/imspinner/cimspinner.cpp @@ -0,0 +1,1628 @@ +/* + * This file has been auto generated by srcript, see genCimSpinner.rb + */ +#include "cimspinner_config.h" + +#include "imspinner.h" +#include "cimspinner.h" + +/* + * The MIT License (MIT) + + * Copyright (c) 2025 dinau + + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +/* C++ definition + void Spinner::SpinnerRainbow(const char *label, float radius, float thickness, const ImColor &color, float speed, float ang_min = 0.f, float ang_max = PI_2, int arcs = 1, int mode = 0) +*/ +#ifdef SPINNER_RAINBOW +CIMSPINNER_API void SpinnerRainbow(const char *label, float radius, float thickness, const ImColor color, float speed) { + ImSpinner::SpinnerRainbow(label, radius, thickness, color, speed); +} +CIMSPINNER_API void SpinnerRainbowEx(const char *label, float radius, float thickness, const ImColor color, float speed,float ang_min, float ang_max, int arcs, int mode) { + ImSpinner::SpinnerRainbow(label, radius, thickness, color, speed, ang_min, ang_max, arcs, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerRainbowMix(const char *label, float radius, float thickness, const ImColor &color, float speed, float ang_min = 0.f, float ang_max = PI_2, int arcs = 1, int mode = 0) +*/ +#ifdef SPINNER_RAINBOWMIX +CIMSPINNER_API void SpinnerRainbowMix(const char *label, float radius, float thickness, const ImColor color, float speed) { + ImSpinner::SpinnerRainbowMix(label, radius, thickness, color, speed); +} +CIMSPINNER_API void SpinnerRainbowMixEx(const char *label, float radius, float thickness, const ImColor color, float speed,float ang_min, float ang_max, int arcs, int mode) { + ImSpinner::SpinnerRainbowMix(label, radius, thickness, color, speed, ang_min, ang_max, arcs, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerRotatingHeart(const char *label, float radius, float thickness, const ImColor &color, float speed, float ang_min = 0.f) +*/ +#ifdef SPINNER_ROTATINGHEART +CIMSPINNER_API void SpinnerRotatingHeart(const char *label, float radius, float thickness, const ImColor color, float speed) { + ImSpinner::SpinnerRotatingHeart(label, radius, thickness, color, speed); +} +CIMSPINNER_API void SpinnerRotatingHeartEx(const char *label, float radius, float thickness, const ImColor color, float speed,float ang_min) { + ImSpinner::SpinnerRotatingHeart(label, radius, thickness, color, speed, ang_min); +} +#endif + +/* C++ definition + void Spinner::SpinnerAng(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = white, float speed = 2.8f, float angle = IM_PI, int mode = 0) +*/ +#ifdef SPINNER_ANG +CIMSPINNER_API void SpinnerAng(const char *label, float radius, float thickness) { + ImSpinner::SpinnerAng(label, radius, thickness); +} +CIMSPINNER_API void SpinnerAngEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float angle, int mode) { + ImSpinner::SpinnerAng(label, radius, thickness, color, bg, speed, angle, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerAng8(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = white, float speed = 2.8f, float angle = IM_PI, int mode = 0, float rkoef = 0.5f) +*/ +#ifdef SPINNER_ANG8 +CIMSPINNER_API void SpinnerAng8(const char *label, float radius, float thickness) { + ImSpinner::SpinnerAng8(label, radius, thickness); +} +CIMSPINNER_API void SpinnerAng8Ex(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float angle, int mode, float rkoef) { + ImSpinner::SpinnerAng8(label, radius, thickness, color, bg, speed, angle, mode, rkoef); +} +#endif + +/* C++ definition + void Spinner::SpinnerAngMix(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, float angle = IM_PI, int arcs = 4, int mode = 0) +*/ +#ifdef SPINNER_ANGMIX +CIMSPINNER_API void SpinnerAngMix(const char *label, float radius, float thickness) { + ImSpinner::SpinnerAngMix(label, radius, thickness); +} +CIMSPINNER_API void SpinnerAngMixEx(const char *label, float radius, float thickness,const ImColor color, float speed, float angle, int arcs, int mode) { + ImSpinner::SpinnerAngMix(label, radius, thickness, color, speed, angle, arcs, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerLoadingRing(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = half_white, float speed = 2.8f, int segments = 5) +*/ +#ifdef SPINNER_LOADINGRING +CIMSPINNER_API void SpinnerLoadingRing(const char *label, float radius, float thickness) { + ImSpinner::SpinnerLoadingRing(label, radius, thickness); +} +CIMSPINNER_API void SpinnerLoadingRingEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, int segments) { + ImSpinner::SpinnerLoadingRing(label, radius, thickness, color, bg, speed, segments); +} +#endif + +/* C++ definition + void Spinner::SpinnerClock(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = half_white, float speed = 2.8f) +*/ +#ifdef SPINNER_CLOCK +CIMSPINNER_API void SpinnerClock(const char *label, float radius, float thickness) { + ImSpinner::SpinnerClock(label, radius, thickness); +} +CIMSPINNER_API void SpinnerClockEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed) { + ImSpinner::SpinnerClock(label, radius, thickness, color, bg, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerPulsar(const char *label, float radius, float thickness, const ImColor &bg = half_white, float speed = 2.8f, bool sequence = true, float angle = 0.f, int mode = 0) +*/ +#ifdef SPINNER_PULSAR +CIMSPINNER_API void SpinnerPulsar(const char *label, float radius, float thickness) { + ImSpinner::SpinnerPulsar(label, radius, thickness); +} +CIMSPINNER_API void SpinnerPulsarEx(const char *label, float radius, float thickness,const ImColor bg, float speed, bool sequence, float angle, int mode) { + ImSpinner::SpinnerPulsar(label, radius, thickness, bg, speed, sequence, angle, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerDoubleFadePulsar(const char *label, float radius, float thickness, const ImColor &bg = half_white, float speed = 2.8f) +*/ +#ifdef SPINNER_DOUBLEFADEPULSAR +CIMSPINNER_API void SpinnerDoubleFadePulsar(const char *label, float radius, float thickness) { + ImSpinner::SpinnerDoubleFadePulsar(label, radius, thickness); +} +CIMSPINNER_API void SpinnerDoubleFadePulsarEx(const char *label, float radius, float thickness,const ImColor bg, float speed) { + ImSpinner::SpinnerDoubleFadePulsar(label, radius, thickness, bg, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerTwinPulsar(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int rings = 2, int mode = 0) +*/ +#ifdef SPINNER_TWINPULSAR +CIMSPINNER_API void SpinnerTwinPulsar(const char *label, float radius, float thickness) { + ImSpinner::SpinnerTwinPulsar(label, radius, thickness); +} +CIMSPINNER_API void SpinnerTwinPulsarEx(const char *label, float radius, float thickness,const ImColor color, float speed, int rings, int mode) { + ImSpinner::SpinnerTwinPulsar(label, radius, thickness, color, speed, rings, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerFadePulsar(const char *label, float radius, const ImColor &color = white, float speed = 2.8f, int rings = 2, int mode = 0) +*/ +#ifdef SPINNER_FADEPULSAR +CIMSPINNER_API void SpinnerFadePulsar(const char *label, float radius) { + ImSpinner::SpinnerFadePulsar(label, radius); +} +CIMSPINNER_API void SpinnerFadePulsarEx(const char *label, float radius,const ImColor color, float speed, int rings, int mode) { + ImSpinner::SpinnerFadePulsar(label, radius, color, speed, rings, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerFadePulsarSquare(const char *label, float radius, const ImColor &color = white, float speed = 2.8f, int rings = 2, int mode = 0) +*/ +#ifdef SPINNER_FADEPULSARSQUARE +CIMSPINNER_API void SpinnerFadePulsarSquare(const char *label, float radius) { + ImSpinner::SpinnerFadePulsarSquare(label, radius); +} +CIMSPINNER_API void SpinnerFadePulsarSquareEx(const char *label, float radius,const ImColor color, float speed, int rings, int mode) { + ImSpinner::SpinnerFadePulsarSquare(label, radius, color, speed, rings, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerCircularLines(const char *label, float radius, const ImColor &color = white, float speed = 1.8f, int lines = 8, int mode = 0) +*/ +#ifdef SPINNER_CIRCULARLINES +CIMSPINNER_API void SpinnerCircularLines(const char *label, float radius) { + ImSpinner::SpinnerCircularLines(label, radius); +} +CIMSPINNER_API void SpinnerCircularLinesEx(const char *label, float radius,const ImColor color, float speed, int lines, int mode) { + ImSpinner::SpinnerCircularLines(label, radius, color, speed, lines, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerDots(const char *label, float *nextdot, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t dots = 12, float minth = -1.f, int mode = 0) +*/ +#ifdef SPINNER_DOTS +CIMSPINNER_API void SpinnerDots(const char *label, float *nextdot, float radius, float thickness) { + ImSpinner::SpinnerDots(label, nextdot, radius, thickness); +} +CIMSPINNER_API void SpinnerDotsEx(const char *label, float *nextdot, float radius, float thickness,const ImColor color, float speed, size_t dots, float minth, int mode) { + ImSpinner::SpinnerDots(label, nextdot, radius, thickness, color, speed, dots, minth, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerVDots(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bgcolor = white, float speed = 2.8f, size_t dots = 12, size_t mdots = 6, int mode = 0) +*/ +#ifdef SPINNER_VDOTS +CIMSPINNER_API void SpinnerVDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerVDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerVDotsEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bgcolor, float speed, size_t dots, size_t mdots, int mode) { + ImSpinner::SpinnerVDots(label, radius, thickness, color, bgcolor, speed, dots, mdots, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerBounceDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t dots = 3, int mode = 0) +*/ +#ifdef SPINNER_BOUNCEDOTS +CIMSPINNER_API void SpinnerBounceDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerBounceDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerBounceDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots, int mode) { + ImSpinner::SpinnerBounceDots(label, radius, thickness, color, speed, dots, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerZipDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t dots = 5) +*/ +#ifdef SPINNER_ZIPDOTS +CIMSPINNER_API void SpinnerZipDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerZipDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerZipDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots) { + ImSpinner::SpinnerZipDots(label, radius, thickness, color, speed, dots); +} +#endif + +/* C++ definition + void Spinner::SpinnerDotsToPoints(const char *label, float radius, float thickness, float offset_k, const ImColor &color = white, float speed = 1.8f, size_t dots = 5) +*/ +#ifdef SPINNER_DOTSTOPOINTS +CIMSPINNER_API void SpinnerDotsToPoints(const char *label, float radius, float thickness, float offset_k) { + ImSpinner::SpinnerDotsToPoints(label, radius, thickness, offset_k); +} +CIMSPINNER_API void SpinnerDotsToPointsEx(const char *label, float radius, float thickness, float offset_k,const ImColor color, float speed, size_t dots) { + ImSpinner::SpinnerDotsToPoints(label, radius, thickness, offset_k, color, speed, dots); +} +#endif + +/* C++ definition + void Spinner::SpinnerDotsToBar(const char *label, float radius, float thickness, float offset_k, const ImColor &color = white, float speed = 2.8f, size_t dots = 5) +*/ +#ifdef SPINNER_DOTSTOBAR +CIMSPINNER_API void SpinnerDotsToBar(const char *label, float radius, float thickness, float offset_k) { + ImSpinner::SpinnerDotsToBar(label, radius, thickness, offset_k); +} +CIMSPINNER_API void SpinnerDotsToBarEx(const char *label, float radius, float thickness, float offset_k,const ImColor color, float speed, size_t dots) { + ImSpinner::SpinnerDotsToBar(label, radius, thickness, offset_k, color, speed, dots); +} +#endif + +/* C++ definition + void Spinner::SpinnerWaveDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int lt = 8) +*/ +#ifdef SPINNER_WAVEDOTS +CIMSPINNER_API void SpinnerWaveDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerWaveDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerWaveDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt) { + ImSpinner::SpinnerWaveDots(label, radius, thickness, color, speed, lt); +} +#endif + +/* C++ definition + void Spinner::SpinnerFadeDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int lt = 8, int mode = 0) +*/ +#ifdef SPINNER_FADEDOTS +CIMSPINNER_API void SpinnerFadeDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerFadeDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerFadeDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt, int mode) { + ImSpinner::SpinnerFadeDots(label, radius, thickness, color, speed, lt, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerThreeDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int lt = 8) +*/ +#ifdef SPINNER_THREEDOTS +CIMSPINNER_API void SpinnerThreeDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerThreeDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerThreeDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt) { + ImSpinner::SpinnerThreeDots(label, radius, thickness, color, speed, lt); +} +#endif + +/* C++ definition + void Spinner::SpinnerFiveDots(const char *label, float radius, float thickness, const ImColor &color = 0xffffffff, float speed = 2.8f, int lt = 8) +*/ +#ifdef SPINNER_FIVEDOTS +CIMSPINNER_API void SpinnerFiveDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerFiveDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerFiveDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt) { + ImSpinner::SpinnerFiveDots(label, radius, thickness, color, speed, lt); +} +#endif + +/* C++ definition + void Spinner::Spinner4Caleidospcope(const char *label, float radius, float thickness, const ImColor &color = 0xffffffff, float speed = 2.8f, int lt = 8) +*/ +#ifdef SPINNER_4CALEIDOSPCOPE +CIMSPINNER_API void Spinner4Caleidospcope(const char *label, float radius, float thickness) { + ImSpinner::Spinner4Caleidospcope(label, radius, thickness); +} +CIMSPINNER_API void Spinner4CaleidospcopeEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt) { + ImSpinner::Spinner4Caleidospcope(label, radius, thickness, color, speed, lt); +} +#endif + +/* C++ definition + void Spinner::SpinnerMultiFadeDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int lt = 8) +*/ +#ifdef SPINNER_MULTIFADEDOTS +CIMSPINNER_API void SpinnerMultiFadeDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerMultiFadeDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerMultiFadeDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt) { + ImSpinner::SpinnerMultiFadeDots(label, radius, thickness, color, speed, lt); +} +#endif + +/* C++ definition + void Spinner::SpinnerThickToSin(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int nt = 1, int lt = 8, int mode = 0) +*/ +#ifdef SPINNER_THICKTOSIN +CIMSPINNER_API void SpinnerThickToSin(const char *label, float radius, float thickness) { + ImSpinner::SpinnerThickToSin(label, radius, thickness); +} +CIMSPINNER_API void SpinnerThickToSinEx(const char *label, float radius, float thickness,const ImColor color, float speed, int nt, int lt, int mode) { + ImSpinner::SpinnerThickToSin(label, radius, thickness, color, speed, nt, lt, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerScaleDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int lt = 8) +*/ +#ifdef SPINNER_SCALEDOTS +CIMSPINNER_API void SpinnerScaleDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerScaleDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerScaleDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt) { + ImSpinner::SpinnerScaleDots(label, radius, thickness, color, speed, lt); +} +#endif + +/* C++ definition + void Spinner::SpinnerSquareSpins(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) +*/ +#ifdef SPINNER_SQUARESPINS +CIMSPINNER_API void SpinnerSquareSpins(const char *label, float radius, float thickness) { + ImSpinner::SpinnerSquareSpins(label, radius, thickness); +} +CIMSPINNER_API void SpinnerSquareSpinsEx(const char *label, float radius, float thickness,const ImColor color, float speed) { + ImSpinner::SpinnerSquareSpins(label, radius, thickness, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerMovingDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t dots = 3) +*/ +#ifdef SPINNER_MOVINGDOTS +CIMSPINNER_API void SpinnerMovingDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerMovingDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerMovingDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots) { + ImSpinner::SpinnerMovingDots(label, radius, thickness, color, speed, dots); +} +#endif + +/* C++ definition + void Spinner::SpinnerRotateDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int dots = 2, int mode = 0) +*/ +#ifdef SPINNER_ROTATEDOTS +CIMSPINNER_API void SpinnerRotateDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerRotateDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerRotateDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int dots, int mode) { + ImSpinner::SpinnerRotateDots(label, radius, thickness, color, speed, dots, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerOrionDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int arcs = 4) +*/ +#ifdef SPINNER_ORIONDOTS +CIMSPINNER_API void SpinnerOrionDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerOrionDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerOrionDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int arcs) { + ImSpinner::SpinnerOrionDots(label, radius, thickness, color, speed, arcs); +} +#endif + +/* C++ definition + void Spinner::SpinnerGalaxyDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int arcs = 4) +*/ +#ifdef SPINNER_GALAXYDOTS +CIMSPINNER_API void SpinnerGalaxyDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerGalaxyDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerGalaxyDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int arcs) { + ImSpinner::SpinnerGalaxyDots(label, radius, thickness, color, speed, arcs); +} +#endif + +/* C++ definition + void Spinner::SpinnerTwinAng(const char *label, float radius1, float radius2, float thickness, const ImColor &color1 = white, const ImColor &color2 = red, float speed = 2.8f, float angle = IM_PI, int mode = 0) +*/ +#ifdef SPINNER_TWINANG +CIMSPINNER_API void SpinnerTwinAng(const char *label, float radius1, float radius2, float thickness) { + ImSpinner::SpinnerTwinAng(label, radius1, radius2, thickness); +} +CIMSPINNER_API void SpinnerTwinAngEx(const char *label, float radius1, float radius2, float thickness,const ImColor color1, const ImColor color2, float speed, float angle, int mode) { + ImSpinner::SpinnerTwinAng(label, radius1, radius2, thickness, color1, color2, speed, angle, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerFilling(const char *label, float radius, float thickness, const ImColor &color1 = white, const ImColor &color2 = red, float speed = 2.8f) +*/ +#ifdef SPINNER_FILLING +CIMSPINNER_API void SpinnerFilling(const char *label, float radius, float thickness) { + ImSpinner::SpinnerFilling(label, radius, thickness); +} +CIMSPINNER_API void SpinnerFillingEx(const char *label, float radius, float thickness,const ImColor color1, const ImColor color2, float speed) { + ImSpinner::SpinnerFilling(label, radius, thickness, color1, color2, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerFillingMem(const char *label, float radius, float thickness, const ImColor &color, ImColor &colorbg, float speed) +*/ +#ifdef SPINNER_FILLINGMEM +CIMSPINNER_API void SpinnerFillingMem(const char *label, float radius, float thickness, const ImColor color, ImColor colorbg, float speed) { + ImSpinner::SpinnerFillingMem(label, radius, thickness, color, colorbg, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerTopup(const char *label, float radius1, float radius2, const ImColor &color = red, const ImColor &fg = white, const ImColor &bg = white, float speed = 2.8f) +*/ +#ifdef SPINNER_TOPUP +CIMSPINNER_API void SpinnerTopup(const char *label, float radius1, float radius2) { + ImSpinner::SpinnerTopup(label, radius1, radius2); +} +CIMSPINNER_API void SpinnerTopupEx(const char *label, float radius1, float radius2,const ImColor color, const ImColor fg, const ImColor bg, float speed) { + ImSpinner::SpinnerTopup(label, radius1, radius2, color, fg, bg, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerTwinAng180(const char *label, float radius1, float radius2, float thickness, const ImColor &color1 = white, const ImColor &color2 = red, float speed = 2.8f, float angle = PI_DIV_4, int mode = 0) +*/ +#ifdef SPINNER_TWINANG180 +CIMSPINNER_API void SpinnerTwinAng180(const char *label, float radius1, float radius2, float thickness) { + ImSpinner::SpinnerTwinAng180(label, radius1, radius2, thickness); +} +CIMSPINNER_API void SpinnerTwinAng180Ex(const char *label, float radius1, float radius2, float thickness,const ImColor color1, const ImColor color2, float speed, float angle, int mode) { + ImSpinner::SpinnerTwinAng180(label, radius1, radius2, thickness, color1, color2, speed, angle, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerTwinAng360(const char *label, float radius1, float radius2, float thickness, const ImColor &color1 = white, const ImColor &color2 = red, float speed1 = 2.8f, float speed2 = 2.5f, int mode = 0) +*/ +#ifdef SPINNER_TWINANG360 +CIMSPINNER_API void SpinnerTwinAng360(const char *label, float radius1, float radius2, float thickness) { + ImSpinner::SpinnerTwinAng360(label, radius1, radius2, thickness); +} +CIMSPINNER_API void SpinnerTwinAng360Ex(const char *label, float radius1, float radius2, float thickness,const ImColor color1, const ImColor color2, float speed1, float speed2, int mode) { + ImSpinner::SpinnerTwinAng360(label, radius1, radius2, thickness, color1, color2, speed1, speed2, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerIncDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t dots = 6) +*/ +#ifdef SPINNER_INCDOTS +CIMSPINNER_API void SpinnerIncDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerIncDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerIncDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots) { + ImSpinner::SpinnerIncDots(label, radius, thickness, color, speed, dots); +} +#endif + +/* C++ definition + void Spinner::SpinnerIncFullDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t dots = 4) +*/ +#ifdef SPINNER_INCFULLDOTS +CIMSPINNER_API void SpinnerIncFullDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerIncFullDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerIncFullDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots) { + ImSpinner::SpinnerIncFullDots(label, radius, thickness, color, speed, dots); +} +#endif + +/* C++ definition + void Spinner::SpinnerFadeBars(const char *label, float w, const ImColor &color = white, float speed = 2.8f, size_t bars = 3, bool scale = false) +*/ +#ifdef SPINNER_FADEBARS +CIMSPINNER_API void SpinnerFadeBars(const char *label, float w) { + ImSpinner::SpinnerFadeBars(label, w); +} +CIMSPINNER_API void SpinnerFadeBarsEx(const char *label, float w,const ImColor color, float speed, size_t bars, bool scale) { + ImSpinner::SpinnerFadeBars(label, w, color, speed, bars, scale); +} +#endif + +/* C++ definition + void Spinner::SpinnerFadeTris(const char *label, float radius, const ImColor &color = white, float speed = 2.8f, size_t dim = 2, bool scale = false, int mode = 0) +*/ +#ifdef SPINNER_FADETRIS +CIMSPINNER_API void SpinnerFadeTris(const char *label, float radius) { + ImSpinner::SpinnerFadeTris(label, radius); +} +CIMSPINNER_API void SpinnerFadeTrisEx(const char *label, float radius,const ImColor color, float speed, size_t dim, bool scale, int mode) { + ImSpinner::SpinnerFadeTris(label, radius, color, speed, dim, scale, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerBarsRotateFade(const char *label, float rmin, float rmax , float thickness, const ImColor &color = white, float speed = 2.8f, size_t bars = 6) +*/ +#ifdef SPINNER_BARSROTATEFADE +CIMSPINNER_API void SpinnerBarsRotateFade(const char *label, float rmin, float rmax , float thickness) { + ImSpinner::SpinnerBarsRotateFade(label, rmin, rmax, thickness); +} +CIMSPINNER_API void SpinnerBarsRotateFadeEx(const char *label, float rmin, float rmax , float thickness,const ImColor color, float speed, size_t bars) { + ImSpinner::SpinnerBarsRotateFade(label, rmin, rmax, thickness, color, speed, bars); +} +#endif + +/* C++ definition + void Spinner::SpinnerBarsScaleMiddle(const char *label, float w, const ImColor &color = white, float speed = 2.8f, size_t bars = 3) +*/ +#ifdef SPINNER_BARSSCALEMIDDLE +CIMSPINNER_API void SpinnerBarsScaleMiddle(const char *label, float w) { + ImSpinner::SpinnerBarsScaleMiddle(label, w); +} +CIMSPINNER_API void SpinnerBarsScaleMiddleEx(const char *label, float w,const ImColor color, float speed, size_t bars) { + ImSpinner::SpinnerBarsScaleMiddle(label, w, color, speed, bars); +} +#endif + +/* C++ definition + void Spinner::SpinnerAngTwin(const char *label, float radius1, float radius2, float thickness, const ImColor &color = white, const ImColor &bg = half_white, float speed = 2.8f, float angle = IM_PI, size_t arcs = 1, int mode = 0) +*/ +#ifdef SPINNER_ANGTWIN +CIMSPINNER_API void SpinnerAngTwin(const char *label, float radius1, float radius2, float thickness) { + ImSpinner::SpinnerAngTwin(label, radius1, radius2, thickness); +} +CIMSPINNER_API void SpinnerAngTwinEx(const char *label, float radius1, float radius2, float thickness,const ImColor color, const ImColor bg, float speed, float angle, size_t arcs, int mode) { + ImSpinner::SpinnerAngTwin(label, radius1, radius2, thickness, color, bg, speed, angle, arcs, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerArcRotation(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4, int mode = 0) +*/ +#ifdef SPINNER_ARCROTATION +CIMSPINNER_API void SpinnerArcRotation(const char *label, float radius, float thickness) { + ImSpinner::SpinnerArcRotation(label, radius, thickness); +} +CIMSPINNER_API void SpinnerArcRotationEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, int mode) { + ImSpinner::SpinnerArcRotation(label, radius, thickness, color, speed, arcs, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerArcFade(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4, int mode = 0) +*/ +#ifdef SPINNER_ARCFADE +CIMSPINNER_API void SpinnerArcFade(const char *label, float radius, float thickness) { + ImSpinner::SpinnerArcFade(label, radius, thickness); +} +CIMSPINNER_API void SpinnerArcFadeEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, int mode) { + ImSpinner::SpinnerArcFade(label, radius, thickness, color, speed, arcs, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerSimpleArcFade(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) +*/ +#ifdef SPINNER_SIMPLEARCFADE +CIMSPINNER_API void SpinnerSimpleArcFade(const char *label, float radius, float thickness) { + ImSpinner::SpinnerSimpleArcFade(label, radius, thickness); +} +CIMSPINNER_API void SpinnerSimpleArcFadeEx(const char *label, float radius, float thickness,const ImColor color, float speed) { + ImSpinner::SpinnerSimpleArcFade(label, radius, thickness, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerSquareStrokeFade(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) +*/ +#ifdef SPINNER_SQUARESTROKEFADE +CIMSPINNER_API void SpinnerSquareStrokeFade(const char *label, float radius, float thickness) { + ImSpinner::SpinnerSquareStrokeFade(label, radius, thickness); +} +CIMSPINNER_API void SpinnerSquareStrokeFadeEx(const char *label, float radius, float thickness,const ImColor color, float speed) { + ImSpinner::SpinnerSquareStrokeFade(label, radius, thickness, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerAsciiSymbolPoints(const char *label, const char* text, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) +*/ +#ifdef SPINNER_ASCIISYMBOLPOINTS +CIMSPINNER_API void SpinnerAsciiSymbolPoints(const char *label, const char* text, float radius, float thickness) { + ImSpinner::SpinnerAsciiSymbolPoints(label, text, radius, thickness); +} +CIMSPINNER_API void SpinnerAsciiSymbolPointsEx(const char *label, const char* text, float radius, float thickness,const ImColor color, float speed) { + ImSpinner::SpinnerAsciiSymbolPoints(label, text, radius, thickness, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerTextFading(const char *label, const char* text, float radius, float fsize, const ImColor &color = white, float speed = 2.8f) +*/ +#ifdef SPINNER_TEXTFADING +CIMSPINNER_API void SpinnerTextFading(const char *label, const char* text, float radius, float fsize) { + ImSpinner::SpinnerTextFading(label, text, radius, fsize); +} +CIMSPINNER_API void SpinnerTextFadingEx(const char *label, const char* text, float radius, float fsize,const ImColor color, float speed) { + ImSpinner::SpinnerTextFading(label, text, radius, fsize, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerSevenSegments(const char *label, const char* text, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) +*/ +#ifdef SPINNER_SEVENSEGMENTS +CIMSPINNER_API void SpinnerSevenSegments(const char *label, const char* text, float radius, float thickness) { + ImSpinner::SpinnerSevenSegments(label, text, radius, thickness); +} +CIMSPINNER_API void SpinnerSevenSegmentsEx(const char *label, const char* text, float radius, float thickness,const ImColor color, float speed) { + ImSpinner::SpinnerSevenSegments(label, text, radius, thickness, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerSquareStrokeFill(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) +*/ +#ifdef SPINNER_SQUARESTROKEFILL +CIMSPINNER_API void SpinnerSquareStrokeFill(const char *label, float radius, float thickness) { + ImSpinner::SpinnerSquareStrokeFill(label, radius, thickness); +} +CIMSPINNER_API void SpinnerSquareStrokeFillEx(const char *label, float radius, float thickness,const ImColor color, float speed) { + ImSpinner::SpinnerSquareStrokeFill(label, radius, thickness, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerSquareStrokeLoading(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) +*/ +#ifdef SPINNER_SQUARESTROKELOADING +CIMSPINNER_API void SpinnerSquareStrokeLoading(const char *label, float radius, float thickness) { + ImSpinner::SpinnerSquareStrokeLoading(label, radius, thickness); +} +CIMSPINNER_API void SpinnerSquareStrokeLoadingEx(const char *label, float radius, float thickness,const ImColor color, float speed) { + ImSpinner::SpinnerSquareStrokeLoading(label, radius, thickness, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerSquareLoading(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) +*/ +#ifdef SPINNER_SQUARELOADING +CIMSPINNER_API void SpinnerSquareLoading(const char *label, float radius, float thickness) { + ImSpinner::SpinnerSquareLoading(label, radius, thickness); +} +CIMSPINNER_API void SpinnerSquareLoadingEx(const char *label, float radius, float thickness,const ImColor color, float speed) { + ImSpinner::SpinnerSquareLoading(label, radius, thickness, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerFilledArcFade(const char *label, float radius, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4, int mode = 0) +*/ +#ifdef SPINNER_FILLEDARCFADE +CIMSPINNER_API void SpinnerFilledArcFade(const char *label, float radius) { + ImSpinner::SpinnerFilledArcFade(label, radius); +} +CIMSPINNER_API void SpinnerFilledArcFadeEx(const char *label, float radius,const ImColor color, float speed, size_t arcs, int mode) { + ImSpinner::SpinnerFilledArcFade(label, radius, color, speed, arcs, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerPointsRoller(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t points = 8, int circles = 2, float rspeed = 1.f) +*/ +#ifdef SPINNER_POINTSROLLER +CIMSPINNER_API void SpinnerPointsRoller(const char *label, float radius, float thickness) { + ImSpinner::SpinnerPointsRoller(label, radius, thickness); +} +CIMSPINNER_API void SpinnerPointsRollerEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t points, int circles, float rspeed) { + ImSpinner::SpinnerPointsRoller(label, radius, thickness, color, speed, points, circles, rspeed); +} +#endif + +/* C++ definition + void Spinner::SpinnerPointsArcBounce(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t points = 4, int circles = 2, float rspeed = 0.f) +*/ +#ifdef SPINNER_POINTSARCBOUNCE +CIMSPINNER_API void SpinnerPointsArcBounce(const char *label, float radius, float thickness) { + ImSpinner::SpinnerPointsArcBounce(label, radius, thickness); +} +CIMSPINNER_API void SpinnerPointsArcBounceEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t points, int circles, float rspeed) { + ImSpinner::SpinnerPointsArcBounce(label, radius, thickness, color, speed, points, circles, rspeed); +} +#endif + +/* C++ definition + void Spinner::SpinnerFilledArcColor(const char *label, float radius, const ImColor &color = red, const ImColor &bg = white, float speed = 2.8f, size_t arcs = 4) +*/ +#ifdef SPINNER_FILLEDARCCOLOR +CIMSPINNER_API void SpinnerFilledArcColor(const char *label, float radius) { + ImSpinner::SpinnerFilledArcColor(label, radius); +} +CIMSPINNER_API void SpinnerFilledArcColorEx(const char *label, float radius,const ImColor color, const ImColor bg, float speed, size_t arcs) { + ImSpinner::SpinnerFilledArcColor(label, radius, color, bg, speed, arcs); +} +#endif + +/* C++ definition + void Spinner::SpinnerFilledArcRing(const char *label, float radius, float thickness, const ImColor &color = red, const ImColor &bg = white, float speed = 2.8f, size_t arcs = 4) +*/ +#ifdef SPINNER_FILLEDARCRING +CIMSPINNER_API void SpinnerFilledArcRing(const char *label, float radius, float thickness) { + ImSpinner::SpinnerFilledArcRing(label, radius, thickness); +} +CIMSPINNER_API void SpinnerFilledArcRingEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, size_t arcs) { + ImSpinner::SpinnerFilledArcRing(label, radius, thickness, color, bg, speed, arcs); +} +#endif + +/* C++ definition + void Spinner::SpinnerArcWedges(const char *label, float radius, const ImColor &color = red, float speed = 2.8f, size_t arcs = 4, int mode = 0) +*/ +#ifdef SPINNER_ARCWEDGES +CIMSPINNER_API void SpinnerArcWedges(const char *label, float radius) { + ImSpinner::SpinnerArcWedges(label, radius); +} +CIMSPINNER_API void SpinnerArcWedgesEx(const char *label, float radius,const ImColor color, float speed, size_t arcs, int mode) { + ImSpinner::SpinnerArcWedges(label, radius, color, speed, arcs, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerTwinBall(const char *label, float radius1, float radius2, float thickness, float b_thickness, const ImColor &ball = white, const ImColor &bg = half_white, float speed = 2.8f, size_t balls = 2, int mode = 0) +*/ +#ifdef SPINNER_TWINBALL +CIMSPINNER_API void SpinnerTwinBall(const char *label, float radius1, float radius2, float thickness, float b_thickness) { + ImSpinner::SpinnerTwinBall(label, radius1, radius2, thickness, b_thickness); +} +CIMSPINNER_API void SpinnerTwinBallEx(const char *label, float radius1, float radius2, float thickness, float b_thickness,const ImColor ball, const ImColor bg, float speed, size_t balls, int mode) { + ImSpinner::SpinnerTwinBall(label, radius1, radius2, thickness, b_thickness, ball, bg, speed, balls, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerSolarBalls(const char *label, float radius, float thickness, const ImColor &ball = white, const ImColor &bg = half_white, float speed = 2.8f, size_t balls = 4) +*/ +#ifdef SPINNER_SOLARBALLS +CIMSPINNER_API void SpinnerSolarBalls(const char *label, float radius, float thickness) { + ImSpinner::SpinnerSolarBalls(label, radius, thickness); +} +CIMSPINNER_API void SpinnerSolarBallsEx(const char *label, float radius, float thickness,const ImColor ball, const ImColor bg, float speed, size_t balls) { + ImSpinner::SpinnerSolarBalls(label, radius, thickness, ball, bg, speed, balls); +} +#endif + +/* C++ definition + void Spinner::SpinnerSolarScaleBalls(const char *label, float radius, float thickness, const ImColor &ball = white, float speed = 2.8f, size_t balls = 4) +*/ +#ifdef SPINNER_SOLARSCALEBALLS +CIMSPINNER_API void SpinnerSolarScaleBalls(const char *label, float radius, float thickness) { + ImSpinner::SpinnerSolarScaleBalls(label, radius, thickness); +} +CIMSPINNER_API void SpinnerSolarScaleBallsEx(const char *label, float radius, float thickness,const ImColor ball, float speed, size_t balls) { + ImSpinner::SpinnerSolarScaleBalls(label, radius, thickness, ball, speed, balls); +} +#endif + +/* C++ definition + void Spinner::SpinnerSolarArcs(const char *label, float radius, float thickness, const ImColor &ball = white, const ImColor &bg = half_white, float speed = 2.8f, size_t balls = 4) +*/ +#ifdef SPINNER_SOLARARCS +CIMSPINNER_API void SpinnerSolarArcs(const char *label, float radius, float thickness) { + ImSpinner::SpinnerSolarArcs(label, radius, thickness); +} +CIMSPINNER_API void SpinnerSolarArcsEx(const char *label, float radius, float thickness,const ImColor ball, const ImColor bg, float speed, size_t balls) { + ImSpinner::SpinnerSolarArcs(label, radius, thickness, ball, bg, speed, balls); +} +#endif + +/* C++ definition + void Spinner::SpinnerMovingArcs(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4) +*/ +#ifdef SPINNER_MOVINGARCS +CIMSPINNER_API void SpinnerMovingArcs(const char *label, float radius, float thickness) { + ImSpinner::SpinnerMovingArcs(label, radius, thickness); +} +CIMSPINNER_API void SpinnerMovingArcsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs) { + ImSpinner::SpinnerMovingArcs(label, radius, thickness, color, speed, arcs); +} +#endif + +/* C++ definition + void Spinner::SpinnerRainbowCircle(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4, float mode = 1) +*/ +#ifdef SPINNER_RAINBOWCIRCLE +CIMSPINNER_API void SpinnerRainbowCircle(const char *label, float radius, float thickness) { + ImSpinner::SpinnerRainbowCircle(label, radius, thickness); +} +CIMSPINNER_API void SpinnerRainbowCircleEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, float mode) { + ImSpinner::SpinnerRainbowCircle(label, radius, thickness, color, speed, arcs, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerBounceBall(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int dots = 1, bool shadow = false) +*/ +#ifdef SPINNER_BOUNCEBALL +CIMSPINNER_API void SpinnerBounceBall(const char *label, float radius, float thickness) { + ImSpinner::SpinnerBounceBall(label, radius, thickness); +} +CIMSPINNER_API void SpinnerBounceBallEx(const char *label, float radius, float thickness,const ImColor color, float speed, int dots, bool shadow) { + ImSpinner::SpinnerBounceBall(label, radius, thickness, color, speed, dots, shadow); +} +#endif + +/* C++ definition + void Spinner::SpinnerPulsarBall(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, bool shadow = false, int mode = 0) +*/ +#ifdef SPINNER_PULSARBALL +CIMSPINNER_API void SpinnerPulsarBall(const char *label, float radius, float thickness) { + ImSpinner::SpinnerPulsarBall(label, radius, thickness); +} +CIMSPINNER_API void SpinnerPulsarBallEx(const char *label, float radius, float thickness,const ImColor color, float speed, bool shadow, int mode) { + ImSpinner::SpinnerPulsarBall(label, radius, thickness, color, speed, shadow, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerIncScaleDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t dots = 6, float angle = 0.f, int mode = 0) +*/ +#ifdef SPINNER_INCSCALEDOTS +CIMSPINNER_API void SpinnerIncScaleDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerIncScaleDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerIncScaleDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots, float angle, int mode) { + ImSpinner::SpinnerIncScaleDots(label, radius, thickness, color, speed, dots, angle, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerSomeScaleDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t dots = 6, int mode = 0) +*/ +#ifdef SPINNER_SOMESCALEDOTS +CIMSPINNER_API void SpinnerSomeScaleDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerSomeScaleDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerSomeScaleDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots, int mode) { + ImSpinner::SpinnerSomeScaleDots(label, radius, thickness, color, speed, dots, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerAngTriple(const char *label, float radius1, float radius2, float radius3, float thickness, const ImColor &c1 = white, const ImColor &c2 = half_white, const ImColor &c3 = white, float speed = 2.8f, float angle = IM_PI) +*/ +#ifdef SPINNER_ANGTRIPLE +CIMSPINNER_API void SpinnerAngTriple(const char *label, float radius1, float radius2, float radius3, float thickness) { + ImSpinner::SpinnerAngTriple(label, radius1, radius2, radius3, thickness); +} +CIMSPINNER_API void SpinnerAngTripleEx(const char *label, float radius1, float radius2, float radius3, float thickness,const ImColor c1, const ImColor c2, const ImColor c3, float speed, float angle) { + ImSpinner::SpinnerAngTriple(label, radius1, radius2, radius3, thickness, c1, c2, c3, speed, angle); +} +#endif + +/* C++ definition + void Spinner::SpinnerAngEclipse(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, float angle = IM_PI) +*/ +#ifdef SPINNER_ANGECLIPSE +CIMSPINNER_API void SpinnerAngEclipse(const char *label, float radius, float thickness) { + ImSpinner::SpinnerAngEclipse(label, radius, thickness); +} +CIMSPINNER_API void SpinnerAngEclipseEx(const char *label, float radius, float thickness,const ImColor color, float speed, float angle) { + ImSpinner::SpinnerAngEclipse(label, radius, thickness, color, speed, angle); +} +#endif + +/* C++ definition + void Spinner::SpinnerIngYang(const char *label, float radius, float thickness, bool reverse, float yang_detlta_r, const ImColor &colorI = white, const ImColor &colorY = white, float speed = 2.8f, float angle = IM_PI * 0.7f, int mode = 0) +*/ +#ifdef SPINNER_INGYANG +CIMSPINNER_API void SpinnerIngYang(const char *label, float radius, float thickness, bool reverse, float yang_detlta_r) { + ImSpinner::SpinnerIngYang(label, radius, thickness, reverse, yang_detlta_r); +} +CIMSPINNER_API void SpinnerIngYangEx(const char *label, float radius, float thickness, bool reverse, float yang_detlta_r,const ImColor colorI, const ImColor colorY, float speed, float angle, int mode) { + ImSpinner::SpinnerIngYang(label, radius, thickness, reverse, yang_detlta_r, colorI, colorY, speed, angle, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerGooeyBalls(const char *label, float radius, const ImColor &color, float speed, int mode = 0) +*/ +#ifdef SPINNER_GOOEYBALLS +CIMSPINNER_API void SpinnerGooeyBalls(const char *label, float radius, const ImColor color, float speed) { + ImSpinner::SpinnerGooeyBalls(label, radius, color, speed); +} +CIMSPINNER_API void SpinnerGooeyBallsEx(const char *label, float radius, const ImColor color, float speed,int mode) { + ImSpinner::SpinnerGooeyBalls(label, radius, color, speed, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerDotsLoading(const char *label, float radius, float thickness, const ImColor &color, const ImColor &bg, float speed) +*/ +#ifdef SPINNER_DOTSLOADING +CIMSPINNER_API void SpinnerDotsLoading(const char *label, float radius, float thickness, const ImColor color, const ImColor bg, float speed) { + ImSpinner::SpinnerDotsLoading(label, radius, thickness, color, bg, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerRotateGooeyBalls(const char *label, float radius, float thickness, const ImColor &color, float speed, int balls, int mode = 0) +*/ +#ifdef SPINNER_ROTATEGOOEYBALLS +CIMSPINNER_API void SpinnerRotateGooeyBalls(const char *label, float radius, float thickness, const ImColor color, float speed, int balls) { + ImSpinner::SpinnerRotateGooeyBalls(label, radius, thickness, color, speed, balls); +} +CIMSPINNER_API void SpinnerRotateGooeyBallsEx(const char *label, float radius, float thickness, const ImColor color, float speed, int balls,int mode) { + ImSpinner::SpinnerRotateGooeyBalls(label, radius, thickness, color, speed, balls, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerHerbertBalls(const char *label, float radius, float thickness, const ImColor &color, float speed, int balls) +*/ +#ifdef SPINNER_HERBERTBALLS +CIMSPINNER_API void SpinnerHerbertBalls(const char *label, float radius, float thickness, const ImColor color, float speed, int balls) { + ImSpinner::SpinnerHerbertBalls(label, radius, thickness, color, speed, balls); +} +#endif + +/* C++ definition + void Spinner::SpinnerHerbertBalls3D(const char *label, float radius, float thickness, const ImColor &color, float speed) +*/ +#ifdef SPINNER_HERBERTBALLS3D +CIMSPINNER_API void SpinnerHerbertBalls3D(const char *label, float radius, float thickness, const ImColor color, float speed) { + ImSpinner::SpinnerHerbertBalls3D(label, radius, thickness, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerRotateTriangles(const char *label, float radius, float thickness, const ImColor &color, float speed, int tris, int mode = 0) +*/ +#ifdef SPINNER_ROTATETRIANGLES +CIMSPINNER_API void SpinnerRotateTriangles(const char *label, float radius, float thickness, const ImColor color, float speed, int tris) { + ImSpinner::SpinnerRotateTriangles(label, radius, thickness, color, speed, tris); +} +CIMSPINNER_API void SpinnerRotateTrianglesEx(const char *label, float radius, float thickness, const ImColor color, float speed, int tris,int mode) { + ImSpinner::SpinnerRotateTriangles(label, radius, thickness, color, speed, tris, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerRotateShapes(const char *label, float radius, float thickness, const ImColor &color, float speed, int shapes, int pnt) +*/ +#ifdef SPINNER_ROTATESHAPES +CIMSPINNER_API void SpinnerRotateShapes(const char *label, float radius, float thickness, const ImColor color, float speed, int shapes, int pnt) { + ImSpinner::SpinnerRotateShapes(label, radius, thickness, color, speed, shapes, pnt); +} +#endif + +/* C++ definition + void Spinner::SpinnerSinSquares(const char *label, float radius, float thickness, const ImColor &color, float speed, int mode = 0) +*/ +#ifdef SPINNER_SINSQUARES +CIMSPINNER_API void SpinnerSinSquares(const char *label, float radius, float thickness, const ImColor color, float speed) { + ImSpinner::SpinnerSinSquares(label, radius, thickness, color, speed); +} +CIMSPINNER_API void SpinnerSinSquaresEx(const char *label, float radius, float thickness, const ImColor color, float speed,int mode) { + ImSpinner::SpinnerSinSquares(label, radius, thickness, color, speed, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerMoonLine(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = red, float speed = 2.8f, float angle = IM_PI) +*/ +#ifdef SPINNER_MOONLINE +CIMSPINNER_API void SpinnerMoonLine(const char *label, float radius, float thickness) { + ImSpinner::SpinnerMoonLine(label, radius, thickness); +} +CIMSPINNER_API void SpinnerMoonLineEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float angle) { + ImSpinner::SpinnerMoonLine(label, radius, thickness, color, bg, speed, angle); +} +#endif + +/* C++ definition + void Spinner::SpinnerCircleDrop(const char *label, float radius, float thickness, float thickness_drop, const ImColor &color = white, const ImColor &bg = half_white, float speed = 2.8f, float angle = IM_PI) +*/ +#ifdef SPINNER_CIRCLEDROP +CIMSPINNER_API void SpinnerCircleDrop(const char *label, float radius, float thickness, float thickness_drop) { + ImSpinner::SpinnerCircleDrop(label, radius, thickness, thickness_drop); +} +CIMSPINNER_API void SpinnerCircleDropEx(const char *label, float radius, float thickness, float thickness_drop,const ImColor color, const ImColor bg, float speed, float angle) { + ImSpinner::SpinnerCircleDrop(label, radius, thickness, thickness_drop, color, bg, speed, angle); +} +#endif + +/* C++ definition + void Spinner::SpinnerSurroundedIndicator(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = half_white, float speed = 2.8f) +*/ +#ifdef SPINNER_SURROUNDEDINDICATOR +CIMSPINNER_API void SpinnerSurroundedIndicator(const char *label, float radius, float thickness) { + ImSpinner::SpinnerSurroundedIndicator(label, radius, thickness); +} +CIMSPINNER_API void SpinnerSurroundedIndicatorEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed) { + ImSpinner::SpinnerSurroundedIndicator(label, radius, thickness, color, bg, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerWifiIndicator(const char *label, float radius, float thickness, const ImColor &color = red, const ImColor &bg = half_white, float speed = 2.8f, float cangle = 0.f, int dots = 3) +*/ +#ifdef SPINNER_WIFIINDICATOR +CIMSPINNER_API void SpinnerWifiIndicator(const char *label, float radius, float thickness) { + ImSpinner::SpinnerWifiIndicator(label, radius, thickness); +} +CIMSPINNER_API void SpinnerWifiIndicatorEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float cangle, int dots) { + ImSpinner::SpinnerWifiIndicator(label, radius, thickness, color, bg, speed, cangle, dots); +} +#endif + +/* C++ definition + void Spinner::SpinnerTrianglesSelector(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = half_white, float speed = 2.8f, size_t bars = 8) +*/ +#ifdef SPINNER_TRIANGLESSELECTOR +CIMSPINNER_API void SpinnerTrianglesSelector(const char *label, float radius, float thickness) { + ImSpinner::SpinnerTrianglesSelector(label, radius, thickness); +} +CIMSPINNER_API void SpinnerTrianglesSelectorEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, size_t bars) { + ImSpinner::SpinnerTrianglesSelector(label, radius, thickness, color, bg, speed, bars); +} +#endif + +/* C++ definition + void Spinner::SpinnerCamera(const char *label, float radius, float thickness, LeafColor *leaf_color, float speed = 2.8f, size_t bars = 8, int mode = 0) +*/ +#ifdef SPINNER_CAMERA +CIMSPINNER_API void SpinnerCamera(const char *label, float radius, float thickness, LeafColor *leaf_color) { + ImSpinner::SpinnerCamera(label, radius, thickness, leaf_color); +} +CIMSPINNER_API void SpinnerCameraEx(const char *label, float radius, float thickness, LeafColor *leaf_color,float speed, size_t bars, int mode) { + ImSpinner::SpinnerCamera(label, radius, thickness, leaf_color, speed, bars, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerFlowingGradient(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = red, float speed = 2.8f, float angle = IM_PI) +*/ +#ifdef SPINNER_FLOWINGGRADIENT +CIMSPINNER_API void SpinnerFlowingGradient(const char *label, float radius, float thickness) { + ImSpinner::SpinnerFlowingGradient(label, radius, thickness); +} +CIMSPINNER_API void SpinnerFlowingGradientEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float angle) { + ImSpinner::SpinnerFlowingGradient(label, radius, thickness, color, bg, speed, angle); +} +#endif + +/* C++ definition + void Spinner::SpinnerRotateSegments(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4, size_t layers = 1, int mode = 0) +*/ +#ifdef SPINNER_ROTATESEGMENTS +CIMSPINNER_API void SpinnerRotateSegments(const char *label, float radius, float thickness) { + ImSpinner::SpinnerRotateSegments(label, radius, thickness); +} +CIMSPINNER_API void SpinnerRotateSegmentsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, size_t layers, int mode) { + ImSpinner::SpinnerRotateSegments(label, radius, thickness, color, speed, arcs, layers, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerLemniscate(const char* label, float radius, float thickness, const ImColor& color = white, float speed = 2.8f, float angle = IM_PI / 2.0f) +*/ +#ifdef SPINNER_LEMNISCATE +CIMSPINNER_API void SpinnerLemniscate(const char* label, float radius, float thickness) { + ImSpinner::SpinnerLemniscate(label, radius, thickness); +} +CIMSPINNER_API void SpinnerLemniscateEx(const char* label, float radius, float thickness,const ImColor color, float speed, float angle) { + ImSpinner::SpinnerLemniscate(label, radius, thickness, color, speed, angle); +} +#endif + +/* C++ definition + void Spinner::SpinnerRotateGear(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t pins = 12) +*/ +#ifdef SPINNER_ROTATEGEAR +CIMSPINNER_API void SpinnerRotateGear(const char *label, float radius, float thickness) { + ImSpinner::SpinnerRotateGear(label, radius, thickness); +} +CIMSPINNER_API void SpinnerRotateGearEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t pins) { + ImSpinner::SpinnerRotateGear(label, radius, thickness, color, speed, pins); +} +#endif + +/* C++ definition + void Spinner::SpinnerRotateWheel(const char *label, float radius, float thickness, const ImColor &bg_color = white, const ImColor &color = white, float speed = 2.8f, size_t pins = 12) +*/ +#ifdef SPINNER_ROTATEWHEEL +CIMSPINNER_API void SpinnerRotateWheel(const char *label, float radius, float thickness) { + ImSpinner::SpinnerRotateWheel(label, radius, thickness); +} +CIMSPINNER_API void SpinnerRotateWheelEx(const char *label, float radius, float thickness,const ImColor bg_color, const ImColor color, float speed, size_t pins) { + ImSpinner::SpinnerRotateWheel(label, radius, thickness, bg_color, color, speed, pins); +} +#endif + +/* C++ definition + void Spinner::SpinnerAtom(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int elipses = 3) +*/ +#ifdef SPINNER_ATOM +CIMSPINNER_API void SpinnerAtom(const char *label, float radius, float thickness) { + ImSpinner::SpinnerAtom(label, radius, thickness); +} +CIMSPINNER_API void SpinnerAtomEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses) { + ImSpinner::SpinnerAtom(label, radius, thickness, color, speed, elipses); +} +#endif + +/* C++ definition + void Spinner::SpinnerPatternRings(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int elipses = 3) +*/ +#ifdef SPINNER_PATTERNRINGS +CIMSPINNER_API void SpinnerPatternRings(const char *label, float radius, float thickness) { + ImSpinner::SpinnerPatternRings(label, radius, thickness); +} +CIMSPINNER_API void SpinnerPatternRingsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses) { + ImSpinner::SpinnerPatternRings(label, radius, thickness, color, speed, elipses); +} +#endif + +/* C++ definition + void Spinner::SpinnerPatternEclipse(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int elipses = 3, float delta_a = 2.f, float delta_y = 0.f) +*/ +#ifdef SPINNER_PATTERNECLIPSE +CIMSPINNER_API void SpinnerPatternEclipse(const char *label, float radius, float thickness) { + ImSpinner::SpinnerPatternEclipse(label, radius, thickness); +} +CIMSPINNER_API void SpinnerPatternEclipseEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses, float delta_a, float delta_y) { + ImSpinner::SpinnerPatternEclipse(label, radius, thickness, color, speed, elipses, delta_a, delta_y); +} +#endif + +/* C++ definition + void Spinner::SpinnerPatternSphere(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int elipses = 3) +*/ +#ifdef SPINNER_PATTERNSPHERE +CIMSPINNER_API void SpinnerPatternSphere(const char *label, float radius, float thickness) { + ImSpinner::SpinnerPatternSphere(label, radius, thickness); +} +CIMSPINNER_API void SpinnerPatternSphereEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses) { + ImSpinner::SpinnerPatternSphere(label, radius, thickness, color, speed, elipses); +} +#endif + +/* C++ definition + void Spinner::SpinnerRingSynchronous(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int elipses = 3) +*/ +#ifdef SPINNER_RINGSYNCHRONOUS +CIMSPINNER_API void SpinnerRingSynchronous(const char *label, float radius, float thickness) { + ImSpinner::SpinnerRingSynchronous(label, radius, thickness); +} +CIMSPINNER_API void SpinnerRingSynchronousEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses) { + ImSpinner::SpinnerRingSynchronous(label, radius, thickness, color, speed, elipses); +} +#endif + +/* C++ definition + void Spinner::SpinnerRingWatermarks(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int elipses = 3) +*/ +#ifdef SPINNER_RINGWATERMARKS +CIMSPINNER_API void SpinnerRingWatermarks(const char *label, float radius, float thickness) { + ImSpinner::SpinnerRingWatermarks(label, radius, thickness); +} +CIMSPINNER_API void SpinnerRingWatermarksEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses) { + ImSpinner::SpinnerRingWatermarks(label, radius, thickness, color, speed, elipses); +} +#endif + +/* C++ definition + void Spinner::SpinnerRotatedAtom(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int elipses = 3, int mode = 0) +*/ +#ifdef SPINNER_ROTATEDATOM +CIMSPINNER_API void SpinnerRotatedAtom(const char *label, float radius, float thickness) { + ImSpinner::SpinnerRotatedAtom(label, radius, thickness); +} +CIMSPINNER_API void SpinnerRotatedAtomEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses, int mode) { + ImSpinner::SpinnerRotatedAtom(label, radius, thickness, color, speed, elipses, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerRainbowBalls(const char *label, float radius, float thickness, const ImColor &color, float speed, int balls = 5, int mode = 0, int rings = 1, int mx = 1) +*/ +#ifdef SPINNER_RAINBOWBALLS +CIMSPINNER_API void SpinnerRainbowBalls(const char *label, float radius, float thickness, const ImColor color, float speed) { + ImSpinner::SpinnerRainbowBalls(label, radius, thickness, color, speed); +} +CIMSPINNER_API void SpinnerRainbowBallsEx(const char *label, float radius, float thickness, const ImColor color, float speed,int balls, int mode, int rings, int mx) { + ImSpinner::SpinnerRainbowBalls(label, radius, thickness, color, speed, balls, mode, rings, mx); +} +#endif + +/* C++ definition + void Spinner::SpinnerRainbowShot(const char *label, float radius, float thickness, const ImColor &color, float speed, int balls = 5, int mode = 0) +*/ +#ifdef SPINNER_RAINBOWSHOT +CIMSPINNER_API void SpinnerRainbowShot(const char *label, float radius, float thickness, const ImColor color, float speed) { + ImSpinner::SpinnerRainbowShot(label, radius, thickness, color, speed); +} +CIMSPINNER_API void SpinnerRainbowShotEx(const char *label, float radius, float thickness, const ImColor color, float speed,int balls, int mode) { + ImSpinner::SpinnerRainbowShot(label, radius, thickness, color, speed, balls, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerSpiral(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4) +*/ +#ifdef SPINNER_SPIRAL +CIMSPINNER_API void SpinnerSpiral(const char *label, float radius, float thickness) { + ImSpinner::SpinnerSpiral(label, radius, thickness); +} +CIMSPINNER_API void SpinnerSpiralEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs) { + ImSpinner::SpinnerSpiral(label, radius, thickness, color, speed, arcs); +} +#endif + +/* C++ definition + void Spinner::SpinnerSpiralEye(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) +*/ +#ifdef SPINNER_SPIRALEYE +CIMSPINNER_API void SpinnerSpiralEye(const char *label, float radius, float thickness) { + ImSpinner::SpinnerSpiralEye(label, radius, thickness); +} +CIMSPINNER_API void SpinnerSpiralEyeEx(const char *label, float radius, float thickness,const ImColor color, float speed) { + ImSpinner::SpinnerSpiralEye(label, radius, thickness, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerBarChartSine(const char *label, float radius, float thickness, const ImColor &color, float speed, int bars = 5, int mode = 0) +*/ +#ifdef SPINNER_BARCHARTSINE +CIMSPINNER_API void SpinnerBarChartSine(const char *label, float radius, float thickness, const ImColor color, float speed) { + ImSpinner::SpinnerBarChartSine(label, radius, thickness, color, speed); +} +CIMSPINNER_API void SpinnerBarChartSineEx(const char *label, float radius, float thickness, const ImColor color, float speed,int bars, int mode) { + ImSpinner::SpinnerBarChartSine(label, radius, thickness, color, speed, bars, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerBarChartAdvSine(const char *label, float radius, float thickness, const ImColor &color, float speed, int mode = 0) +*/ +#ifdef SPINNER_BARCHARTADVSINE +CIMSPINNER_API void SpinnerBarChartAdvSine(const char *label, float radius, float thickness, const ImColor color, float speed) { + ImSpinner::SpinnerBarChartAdvSine(label, radius, thickness, color, speed); +} +CIMSPINNER_API void SpinnerBarChartAdvSineEx(const char *label, float radius, float thickness, const ImColor color, float speed,int mode) { + ImSpinner::SpinnerBarChartAdvSine(label, radius, thickness, color, speed, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerBarChartAdvSineFade(const char *label, float radius, float thickness, const ImColor &color, float speed, int mode = 0) +*/ +#ifdef SPINNER_BARCHARTADVSINEFADE +CIMSPINNER_API void SpinnerBarChartAdvSineFade(const char *label, float radius, float thickness, const ImColor color, float speed) { + ImSpinner::SpinnerBarChartAdvSineFade(label, radius, thickness, color, speed); +} +CIMSPINNER_API void SpinnerBarChartAdvSineFadeEx(const char *label, float radius, float thickness, const ImColor color, float speed,int mode) { + ImSpinner::SpinnerBarChartAdvSineFade(label, radius, thickness, color, speed, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerBarChartRainbow(const char *label, float radius, float thickness, const ImColor &color, float speed, int bars = 5, int mode = 0) +*/ +#ifdef SPINNER_BARCHARTRAINBOW +CIMSPINNER_API void SpinnerBarChartRainbow(const char *label, float radius, float thickness, const ImColor color, float speed) { + ImSpinner::SpinnerBarChartRainbow(label, radius, thickness, color, speed); +} +CIMSPINNER_API void SpinnerBarChartRainbowEx(const char *label, float radius, float thickness, const ImColor color, float speed,int bars, int mode) { + ImSpinner::SpinnerBarChartRainbow(label, radius, thickness, color, speed, bars, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerBlocks(const char *label, float radius, float thickness, const ImColor &bg, const ImColor &color, float speed) +*/ +#ifdef SPINNER_BLOCKS +CIMSPINNER_API void SpinnerBlocks(const char *label, float radius, float thickness, const ImColor bg, const ImColor color, float speed) { + ImSpinner::SpinnerBlocks(label, radius, thickness, bg, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerTwinBlocks(const char *label, float radius, float thickness, const ImColor &bg, const ImColor &color, float speed) +*/ +#ifdef SPINNER_TWINBLOCKS +CIMSPINNER_API void SpinnerTwinBlocks(const char *label, float radius, float thickness, const ImColor bg, const ImColor color, float speed) { + ImSpinner::SpinnerTwinBlocks(label, radius, thickness, bg, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerSquareRandomDots(const char *label, float radius, float thickness, const ImColor &bg, const ImColor &color, float speed) +*/ +#ifdef SPINNER_SQUARERANDOMDOTS +CIMSPINNER_API void SpinnerSquareRandomDots(const char *label, float radius, float thickness, const ImColor bg, const ImColor color, float speed) { + ImSpinner::SpinnerSquareRandomDots(label, radius, thickness, bg, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerScaleBlocks(const char *label, float radius, float thickness, const ImColor &color, float speed, int mode = 0) +*/ +#ifdef SPINNER_SCALEBLOCKS +CIMSPINNER_API void SpinnerScaleBlocks(const char *label, float radius, float thickness, const ImColor color, float speed) { + ImSpinner::SpinnerScaleBlocks(label, radius, thickness, color, speed); +} +CIMSPINNER_API void SpinnerScaleBlocksEx(const char *label, float radius, float thickness, const ImColor color, float speed,int mode) { + ImSpinner::SpinnerScaleBlocks(label, radius, thickness, color, speed, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerScaleSquares(const char *label, float radius, float thikness, const ImColor &color, float speed) +*/ +#ifdef SPINNER_SCALESQUARES +CIMSPINNER_API void SpinnerScaleSquares(const char *label, float radius, float thikness, const ImColor color, float speed) { + ImSpinner::SpinnerScaleSquares(label, radius, thikness, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerSquishSquare(const char *label, float radius, const ImColor &color, float speed) +*/ +#ifdef SPINNER_SQUISHSQUARE +CIMSPINNER_API void SpinnerSquishSquare(const char *label, float radius, const ImColor color, float speed) { + ImSpinner::SpinnerSquishSquare(label, radius, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerFluid(const char *label, float radius, const ImColor &color, float speed, int bars = 3) +*/ +#ifdef SPINNER_FLUID +CIMSPINNER_API void SpinnerFluid(const char *label, float radius, const ImColor color, float speed) { + ImSpinner::SpinnerFluid(label, radius, color, speed); +} +CIMSPINNER_API void SpinnerFluidEx(const char *label, float radius, const ImColor color, float speed,int bars) { + ImSpinner::SpinnerFluid(label, radius, color, speed, bars); +} +#endif + +/* C++ definition + void Spinner::SpinnerFluidPoints(const char *label, float radius, float thickness, const ImColor &color, float speed, size_t dots = 6, float delta = 0.35f) +*/ +#ifdef SPINNER_FLUIDPOINTS +CIMSPINNER_API void SpinnerFluidPoints(const char *label, float radius, float thickness, const ImColor color, float speed) { + ImSpinner::SpinnerFluidPoints(label, radius, thickness, color, speed); +} +CIMSPINNER_API void SpinnerFluidPointsEx(const char *label, float radius, float thickness, const ImColor color, float speed,size_t dots, float delta) { + ImSpinner::SpinnerFluidPoints(label, radius, thickness, color, speed, dots, delta); +} +#endif + +/* C++ definition + void Spinner::SpinnerArcPolarFade(const char *label, float radius, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4, int mode = 0) +*/ +#ifdef SPINNER_ARCPOLARFADE +CIMSPINNER_API void SpinnerArcPolarFade(const char *label, float radius) { + ImSpinner::SpinnerArcPolarFade(label, radius); +} +CIMSPINNER_API void SpinnerArcPolarFadeEx(const char *label, float radius,const ImColor color, float speed, size_t arcs, int mode) { + ImSpinner::SpinnerArcPolarFade(label, radius, color, speed, arcs, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerArcPolarRadius(const char *label, float radius, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4, int mode = 0) +*/ +#ifdef SPINNER_ARCPOLARRADIUS +CIMSPINNER_API void SpinnerArcPolarRadius(const char *label, float radius) { + ImSpinner::SpinnerArcPolarRadius(label, radius); +} +CIMSPINNER_API void SpinnerArcPolarRadiusEx(const char *label, float radius,const ImColor color, float speed, size_t arcs, int mode) { + ImSpinner::SpinnerArcPolarRadius(label, radius, color, speed, arcs, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerCaleidoscope(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t arcs = 6, int mode = 0) +*/ +#ifdef SPINNER_CALEIDOSCOPE +CIMSPINNER_API void SpinnerCaleidoscope(const char *label, float radius, float thickness) { + ImSpinner::SpinnerCaleidoscope(label, radius, thickness); +} +CIMSPINNER_API void SpinnerCaleidoscopeEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, int mode) { + ImSpinner::SpinnerCaleidoscope(label, radius, thickness, color, speed, arcs, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerHboDots(const char *label, float radius, float thickness, const ImColor &color = white, float minfade = 0.0f, float ryk = 0.f, float speed = 1.1f, size_t dots = 6, int mode = 0) +*/ +#ifdef SPINNER_HBODOTS +CIMSPINNER_API void SpinnerHboDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerHboDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerHboDotsEx(const char *label, float radius, float thickness,const ImColor color, float minfade, float ryk, float speed, size_t dots, int mode) { + ImSpinner::SpinnerHboDots(label, radius, thickness, color, minfade, ryk, speed, dots, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerMoonDots(const char *label, float radius, float thickness, const ImColor &first, const ImColor &second, float speed = 1.1f) +*/ +#ifdef SPINNER_MOONDOTS +CIMSPINNER_API void SpinnerMoonDots(const char *label, float radius, float thickness, const ImColor first, const ImColor second) { + ImSpinner::SpinnerMoonDots(label, radius, thickness, first, second); +} +CIMSPINNER_API void SpinnerMoonDotsEx(const char *label, float radius, float thickness, const ImColor first, const ImColor second,float speed) { + ImSpinner::SpinnerMoonDots(label, radius, thickness, first, second, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerTwinHboDots(const char *label, float radius, float thickness, const ImColor &color = white, float minfade = 0.0f, float ryk = 0.f, float speed = 1.1f, size_t dots = 6, float delta = 0.f) +*/ +#ifdef SPINNER_TWINHBODOTS +CIMSPINNER_API void SpinnerTwinHboDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerTwinHboDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerTwinHboDotsEx(const char *label, float radius, float thickness,const ImColor color, float minfade, float ryk, float speed, size_t dots, float delta) { + ImSpinner::SpinnerTwinHboDots(label, radius, thickness, color, minfade, ryk, speed, dots, delta); +} +#endif + +/* C++ definition + void Spinner::SpinnerThreeDotsStar(const char *label, float radius, float thickness, const ImColor &color = white, float minfade = 0.0f, float ryk = 0.f, float speed = 1.1f, float delta = 0.f) +*/ +#ifdef SPINNER_THREEDOTSSTAR +CIMSPINNER_API void SpinnerThreeDotsStar(const char *label, float radius, float thickness) { + ImSpinner::SpinnerThreeDotsStar(label, radius, thickness); +} +CIMSPINNER_API void SpinnerThreeDotsStarEx(const char *label, float radius, float thickness,const ImColor color, float minfade, float ryk, float speed, float delta) { + ImSpinner::SpinnerThreeDotsStar(label, radius, thickness, color, minfade, ryk, speed, delta); +} +#endif + +/* C++ definition + void Spinner::SpinnerSineArcs(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) +*/ +#ifdef SPINNER_SINEARCS +CIMSPINNER_API void SpinnerSineArcs(const char *label, float radius, float thickness) { + ImSpinner::SpinnerSineArcs(label, radius, thickness); +} +CIMSPINNER_API void SpinnerSineArcsEx(const char *label, float radius, float thickness,const ImColor color, float speed) { + ImSpinner::SpinnerSineArcs(label, radius, thickness, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerTrianglesShift(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = half_white, float speed = 2.8f, size_t bars = 8) +*/ +#ifdef SPINNER_TRIANGLESSHIFT +CIMSPINNER_API void SpinnerTrianglesShift(const char *label, float radius, float thickness) { + ImSpinner::SpinnerTrianglesShift(label, radius, thickness); +} +CIMSPINNER_API void SpinnerTrianglesShiftEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, size_t bars) { + ImSpinner::SpinnerTrianglesShift(label, radius, thickness, color, bg, speed, bars); +} +#endif + +/* C++ definition + void Spinner::SpinnerPointsShift(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = half_white, float speed = 2.8f, size_t bars = 8) +*/ +#ifdef SPINNER_POINTSSHIFT +CIMSPINNER_API void SpinnerPointsShift(const char *label, float radius, float thickness) { + ImSpinner::SpinnerPointsShift(label, radius, thickness); +} +CIMSPINNER_API void SpinnerPointsShiftEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, size_t bars) { + ImSpinner::SpinnerPointsShift(label, radius, thickness, color, bg, speed, bars); +} +#endif + +/* C++ definition + void Spinner::SpinnerSwingDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) +*/ +#ifdef SPINNER_SWINGDOTS +CIMSPINNER_API void SpinnerSwingDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerSwingDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerSwingDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed) { + ImSpinner::SpinnerSwingDots(label, radius, thickness, color, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerCircularPoints(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 1.8f, int lines = 8) +*/ +#ifdef SPINNER_CIRCULARPOINTS +CIMSPINNER_API void SpinnerCircularPoints(const char *label, float radius, float thickness) { + ImSpinner::SpinnerCircularPoints(label, radius, thickness); +} +CIMSPINNER_API void SpinnerCircularPointsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lines) { + ImSpinner::SpinnerCircularPoints(label, radius, thickness, color, speed, lines); +} +#endif + +/* C++ definition + void Spinner::SpinnerCurvedCircle(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t circles = 1) +*/ +#ifdef SPINNER_CURVEDCIRCLE +CIMSPINNER_API void SpinnerCurvedCircle(const char *label, float radius, float thickness) { + ImSpinner::SpinnerCurvedCircle(label, radius, thickness); +} +CIMSPINNER_API void SpinnerCurvedCircleEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t circles) { + ImSpinner::SpinnerCurvedCircle(label, radius, thickness, color, speed, circles); +} +#endif + +/* C++ definition + void Spinner::SpinnerModCircle(const char *label, float radius, float thickness, const ImColor &color = white, float ang_min = 1.f, float ang_max = 1.f, float speed = 2.8f) +*/ +#ifdef SPINNER_MODCIRCLE +CIMSPINNER_API void SpinnerModCircle(const char *label, float radius, float thickness) { + ImSpinner::SpinnerModCircle(label, radius, thickness); +} +CIMSPINNER_API void SpinnerModCircleEx(const char *label, float radius, float thickness,const ImColor color, float ang_min, float ang_max, float speed) { + ImSpinner::SpinnerModCircle(label, radius, thickness, color, ang_min, ang_max, speed); +} +#endif + +/* C++ definition + void Spinner::SpinnerDnaDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int lt = 8, float delta = 0.5f, bool mode = 0) +*/ +#ifdef SPINNER_DNADOTS +CIMSPINNER_API void SpinnerDnaDots(const char *label, float radius, float thickness) { + ImSpinner::SpinnerDnaDots(label, radius, thickness); +} +CIMSPINNER_API void SpinnerDnaDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt, float delta, bool mode) { + ImSpinner::SpinnerDnaDots(label, radius, thickness, color, speed, lt, delta, mode); +} +#endif + +/* C++ definition + void Spinner::Spinner3SmuggleDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 4.8f, int lt = 8, float delta = 0.5f, bool mode = 0) +*/ +#ifdef SPINNER_3SMUGGLEDOTS +CIMSPINNER_API void Spinner3SmuggleDots(const char *label, float radius, float thickness) { + ImSpinner::Spinner3SmuggleDots(label, radius, thickness); +} +CIMSPINNER_API void Spinner3SmuggleDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt, float delta, bool mode) { + ImSpinner::Spinner3SmuggleDots(label, radius, thickness, color, speed, lt, delta, mode); +} +#endif + +/* C++ definition + void Spinner::SpinnerRotateSegmentsPulsar(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4, size_t layers = 1) +*/ +#ifdef SPINNER_ROTATESEGMENTSPULSAR +CIMSPINNER_API void SpinnerRotateSegmentsPulsar(const char *label, float radius, float thickness) { + ImSpinner::SpinnerRotateSegmentsPulsar(label, radius, thickness); +} +CIMSPINNER_API void SpinnerRotateSegmentsPulsarEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, size_t layers) { + ImSpinner::SpinnerRotateSegmentsPulsar(label, radius, thickness, color, speed, arcs, layers); +} +#endif + +/* C++ definition + void Spinner::SpinnerSplineAng(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = white, float speed = 2.8f, float angle = IM_PI, int mode = 0) +*/ +#ifdef SPINNER_SPLINEANG +CIMSPINNER_API void SpinnerSplineAng(const char *label, float radius, float thickness) { + ImSpinner::SpinnerSplineAng(label, radius, thickness); +} +CIMSPINNER_API void SpinnerSplineAngEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float angle, int mode) { + ImSpinner::SpinnerSplineAng(label, radius, thickness, color, bg, speed, angle, mode); +} +#endif + +#ifdef IMSPINNER_DEMO +CIMSPINNER_API void demoSpinners() { + ImSpinner::demoSpinners(); +} +#endif diff --git a/external/imspinner/cimspinner.h b/external/imspinner/cimspinner.h new file mode 100644 index 00000000..8c49483c --- /dev/null +++ b/external/imspinner/cimspinner.h @@ -0,0 +1,415 @@ +/* + * This file has been auto generated by srcript, see genCimSpinner.rb + */ +#include "cimspinner_config.h" +//#define SPINNER_RAINBOW +//#define SPINNER_RAINBOWMIX +//#define SPINNER_ROTATINGHEART +//#define SPINNER_ANG +//#define SPINNER_ANG8 +//#define SPINNER_ANGMIX +//#define SPINNER_LOADINGRING +//#define SPINNER_CLOCK +//#define SPINNER_PULSAR +//#define SPINNER_DOUBLEFADEPULSAR +//#define SPINNER_TWINPULSAR +//#define SPINNER_FADEPULSAR +//#define SPINNER_FADEPULSARSQUARE +//#define SPINNER_CIRCULARLINES +//#define SPINNER_DOTS +//#define SPINNER_VDOTS +//#define SPINNER_BOUNCEDOTS +//#define SPINNER_ZIPDOTS +//#define SPINNER_DOTSTOPOINTS +//#define SPINNER_DOTSTOBAR +//#define SPINNER_WAVEDOTS +//#define SPINNER_FADEDOTS +//#define SPINNER_THREEDOTS +//#define SPINNER_FIVEDOTS +//#define SPINNER_4CALEIDOSPCOPE +//#define SPINNER_MULTIFADEDOTS +//#define SPINNER_THICKTOSIN +//#define SPINNER_SCALEDOTS +//#define SPINNER_SQUARESPINS +//#define SPINNER_MOVINGDOTS +//#define SPINNER_ROTATEDOTS +//#define SPINNER_ORIONDOTS +//#define SPINNER_GALAXYDOTS +//#define SPINNER_TWINANG +//#define SPINNER_FILLING +//#define SPINNER_FILLINGMEM +//#define SPINNER_TOPUP +//#define SPINNER_TWINANG180 +//#define SPINNER_TWINANG360 +//#define SPINNER_INCDOTS +//#define SPINNER_INCFULLDOTS +//#define SPINNER_FADEBARS +//#define SPINNER_FADETRIS +//#define SPINNER_BARSROTATEFADE +//#define SPINNER_BARSSCALEMIDDLE +//#define SPINNER_ANGTWIN +//#define SPINNER_ARCROTATION +//#define SPINNER_ARCFADE +//#define SPINNER_SIMPLEARCFADE +//#define SPINNER_SQUARESTROKEFADE +//#define SPINNER_ASCIISYMBOLPOINTS +//#define SPINNER_TEXTFADING +//#define SPINNER_SEVENSEGMENTS +//#define SPINNER_SQUARESTROKEFILL +//#define SPINNER_SQUARESTROKELOADING +//#define SPINNER_SQUARELOADING +//#define SPINNER_FILLEDARCFADE +//#define SPINNER_POINTSROLLER +//#define SPINNER_POINTSARCBOUNCE +//#define SPINNER_FILLEDARCCOLOR +//#define SPINNER_FILLEDARCRING +//#define SPINNER_ARCWEDGES +//#define SPINNER_TWINBALL +//#define SPINNER_SOLARBALLS +//#define SPINNER_SOLARSCALEBALLS +//#define SPINNER_SOLARARCS +//#define SPINNER_MOVINGARCS +//#define SPINNER_RAINBOWCIRCLE +//#define SPINNER_BOUNCEBALL +//#define SPINNER_PULSARBALL +//#define SPINNER_INCSCALEDOTS +//#define SPINNER_SOMESCALEDOTS +//#define SPINNER_ANGTRIPLE +//#define SPINNER_ANGECLIPSE +//#define SPINNER_INGYANG +//#define SPINNER_GOOEYBALLS +//#define SPINNER_DOTSLOADING +//#define SPINNER_ROTATEGOOEYBALLS +//#define SPINNER_HERBERTBALLS +//#define SPINNER_HERBERTBALLS3D +//#define SPINNER_ROTATETRIANGLES +//#define SPINNER_ROTATESHAPES +//#define SPINNER_SINSQUARES +//#define SPINNER_MOONLINE +//#define SPINNER_CIRCLEDROP +//#define SPINNER_SURROUNDEDINDICATOR +//#define SPINNER_WIFIINDICATOR +//#define SPINNER_TRIANGLESSELECTOR +//#define SPINNER_CAMERA +//#define SPINNER_FLOWINGGRADIENT +//#define SPINNER_ROTATESEGMENTS +//#define SPINNER_LEMNISCATE +//#define SPINNER_ROTATEGEAR +//#define SPINNER_ROTATEWHEEL +//#define SPINNER_ATOM +//#define SPINNER_PATTERNRINGS +//#define SPINNER_PATTERNECLIPSE +//#define SPINNER_PATTERNSPHERE +//#define SPINNER_RINGSYNCHRONOUS +//#define SPINNER_RINGWATERMARKS +//#define SPINNER_ROTATEDATOM +//#define SPINNER_RAINBOWBALLS +//#define SPINNER_RAINBOWSHOT +//#define SPINNER_SPIRAL +//#define SPINNER_SPIRALEYE +//#define SPINNER_BARCHARTSINE +//#define SPINNER_BARCHARTADVSINE +//#define SPINNER_BARCHARTADVSINEFADE +//#define SPINNER_BARCHARTRAINBOW +//#define SPINNER_BLOCKS +//#define SPINNER_TWINBLOCKS +//#define SPINNER_SQUARERANDOMDOTS +//#define SPINNER_SCALEBLOCKS +//#define SPINNER_SCALESQUARES +//#define SPINNER_SQUISHSQUARE +//#define SPINNER_FLUID +//#define SPINNER_FLUIDPOINTS +//#define SPINNER_ARCPOLARFADE +//#define SPINNER_ARCPOLARRADIUS +//#define SPINNER_CALEIDOSCOPE +//#define SPINNER_HBODOTS +//#define SPINNER_MOONDOTS +//#define SPINNER_TWINHBODOTS +//#define SPINNER_THREEDOTSSTAR +//#define SPINNER_SINEARCS +//#define SPINNER_TRIANGLESSHIFT +//#define SPINNER_POINTSSHIFT +//#define SPINNER_SWINGDOTS +//#define SPINNER_CIRCULARPOINTS +//#define SPINNER_CURVEDCIRCLE +//#define SPINNER_MODCIRCLE +//#define SPINNER_DNADOTS +//#define SPINNER_3SMUGGLEDOTS +//#define SPINNER_ROTATESEGMENTSPULSAR +//#define SPINNER_SPLINEANG + +#pragma once +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CIMSPINNER_API + #define CIMSPINNER_API +#endif + +CIMSPINNER_API void SpinnerRainbow(const char *label, float radius, float thickness, const ImColor color, float speed); +CIMSPINNER_API void SpinnerRainbowEx(const char *label, float radius, float thickness, const ImColor color, float speed,float ang_min, float ang_max, int arcs, int mode); +CIMSPINNER_API void SpinnerRainbowMix(const char *label, float radius, float thickness, const ImColor color, float speed); +CIMSPINNER_API void SpinnerRainbowMixEx(const char *label, float radius, float thickness, const ImColor color, float speed,float ang_min, float ang_max, int arcs, int mode); +CIMSPINNER_API void SpinnerRotatingHeart(const char *label, float radius, float thickness, const ImColor color, float speed); +CIMSPINNER_API void SpinnerRotatingHeartEx(const char *label, float radius, float thickness, const ImColor color, float speed,float ang_min); +CIMSPINNER_API void SpinnerAng(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerAngEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float angle, int mode); +CIMSPINNER_API void SpinnerAng8(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerAng8Ex(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float angle, int mode, float rkoef); +CIMSPINNER_API void SpinnerAngMix(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerAngMixEx(const char *label, float radius, float thickness,const ImColor color, float speed, float angle, int arcs, int mode); +CIMSPINNER_API void SpinnerLoadingRing(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerLoadingRingEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, int segments); +CIMSPINNER_API void SpinnerClock(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerClockEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed); +CIMSPINNER_API void SpinnerPulsar(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerPulsarEx(const char *label, float radius, float thickness,const ImColor bg, float speed, bool sequence, float angle, int mode); +CIMSPINNER_API void SpinnerDoubleFadePulsar(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerDoubleFadePulsarEx(const char *label, float radius, float thickness,const ImColor bg, float speed); +CIMSPINNER_API void SpinnerTwinPulsar(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerTwinPulsarEx(const char *label, float radius, float thickness,const ImColor color, float speed, int rings, int mode); +CIMSPINNER_API void SpinnerFadePulsar(const char *label, float radius); +CIMSPINNER_API void SpinnerFadePulsarEx(const char *label, float radius,const ImColor color, float speed, int rings, int mode); +CIMSPINNER_API void SpinnerFadePulsarSquare(const char *label, float radius); +CIMSPINNER_API void SpinnerFadePulsarSquareEx(const char *label, float radius,const ImColor color, float speed, int rings, int mode); +CIMSPINNER_API void SpinnerCircularLines(const char *label, float radius); +CIMSPINNER_API void SpinnerCircularLinesEx(const char *label, float radius,const ImColor color, float speed, int lines, int mode); +CIMSPINNER_API void SpinnerDots(const char *label, float *nextdot, float radius, float thickness); +CIMSPINNER_API void SpinnerDotsEx(const char *label, float *nextdot, float radius, float thickness,const ImColor color, float speed, size_t dots, float minth, int mode); +CIMSPINNER_API void SpinnerVDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerVDotsEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bgcolor, float speed, size_t dots, size_t mdots, int mode); +CIMSPINNER_API void SpinnerBounceDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerBounceDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots, int mode); +CIMSPINNER_API void SpinnerZipDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerZipDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots); +CIMSPINNER_API void SpinnerDotsToPoints(const char *label, float radius, float thickness, float offset_k); +CIMSPINNER_API void SpinnerDotsToPointsEx(const char *label, float radius, float thickness, float offset_k,const ImColor color, float speed, size_t dots); +CIMSPINNER_API void SpinnerDotsToBar(const char *label, float radius, float thickness, float offset_k); +CIMSPINNER_API void SpinnerDotsToBarEx(const char *label, float radius, float thickness, float offset_k,const ImColor color, float speed, size_t dots); +CIMSPINNER_API void SpinnerWaveDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerWaveDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt); +CIMSPINNER_API void SpinnerFadeDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerFadeDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt, int mode); +CIMSPINNER_API void SpinnerThreeDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerThreeDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt); +CIMSPINNER_API void SpinnerFiveDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerFiveDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt); +CIMSPINNER_API void Spinner4Caleidospcope(const char *label, float radius, float thickness); +CIMSPINNER_API void Spinner4CaleidospcopeEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt); +CIMSPINNER_API void SpinnerMultiFadeDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerMultiFadeDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt); +CIMSPINNER_API void SpinnerThickToSin(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerThickToSinEx(const char *label, float radius, float thickness,const ImColor color, float speed, int nt, int lt, int mode); +CIMSPINNER_API void SpinnerScaleDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerScaleDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt); +CIMSPINNER_API void SpinnerSquareSpins(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerSquareSpinsEx(const char *label, float radius, float thickness,const ImColor color, float speed); +CIMSPINNER_API void SpinnerMovingDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerMovingDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots); +CIMSPINNER_API void SpinnerRotateDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerRotateDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int dots, int mode); +CIMSPINNER_API void SpinnerOrionDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerOrionDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int arcs); +CIMSPINNER_API void SpinnerGalaxyDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerGalaxyDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int arcs); +CIMSPINNER_API void SpinnerTwinAng(const char *label, float radius1, float radius2, float thickness); +CIMSPINNER_API void SpinnerTwinAngEx(const char *label, float radius1, float radius2, float thickness,const ImColor color1, const ImColor color2, float speed, float angle, int mode); +CIMSPINNER_API void SpinnerFilling(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerFillingEx(const char *label, float radius, float thickness,const ImColor color1, const ImColor color2, float speed); +CIMSPINNER_API void SpinnerFillingMem(const char *label, float radius, float thickness, const ImColor color, ImColor colorbg, float speed); +CIMSPINNER_API void SpinnerTopup(const char *label, float radius1, float radius2); +CIMSPINNER_API void SpinnerTopupEx(const char *label, float radius1, float radius2,const ImColor color, const ImColor fg, const ImColor bg, float speed); +CIMSPINNER_API void SpinnerTwinAng180(const char *label, float radius1, float radius2, float thickness); +CIMSPINNER_API void SpinnerTwinAng180Ex(const char *label, float radius1, float radius2, float thickness,const ImColor color1, const ImColor color2, float speed, float angle, int mode); +CIMSPINNER_API void SpinnerTwinAng360(const char *label, float radius1, float radius2, float thickness); +CIMSPINNER_API void SpinnerTwinAng360Ex(const char *label, float radius1, float radius2, float thickness,const ImColor color1, const ImColor color2, float speed1, float speed2, int mode); +CIMSPINNER_API void SpinnerIncDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerIncDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots); +CIMSPINNER_API void SpinnerIncFullDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerIncFullDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots); +CIMSPINNER_API void SpinnerFadeBars(const char *label, float w); +CIMSPINNER_API void SpinnerFadeBarsEx(const char *label, float w,const ImColor color, float speed, size_t bars, bool scale); +CIMSPINNER_API void SpinnerFadeTris(const char *label, float radius); +CIMSPINNER_API void SpinnerFadeTrisEx(const char *label, float radius,const ImColor color, float speed, size_t dim, bool scale, int mode); +CIMSPINNER_API void SpinnerBarsRotateFade(const char *label, float rmin, float rmax , float thickness); +CIMSPINNER_API void SpinnerBarsRotateFadeEx(const char *label, float rmin, float rmax , float thickness,const ImColor color, float speed, size_t bars); +CIMSPINNER_API void SpinnerBarsScaleMiddle(const char *label, float w); +CIMSPINNER_API void SpinnerBarsScaleMiddleEx(const char *label, float w,const ImColor color, float speed, size_t bars); +CIMSPINNER_API void SpinnerAngTwin(const char *label, float radius1, float radius2, float thickness); +CIMSPINNER_API void SpinnerAngTwinEx(const char *label, float radius1, float radius2, float thickness,const ImColor color, const ImColor bg, float speed, float angle, size_t arcs, int mode); +CIMSPINNER_API void SpinnerArcRotation(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerArcRotationEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, int mode); +CIMSPINNER_API void SpinnerArcFade(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerArcFadeEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, int mode); +CIMSPINNER_API void SpinnerSimpleArcFade(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerSimpleArcFadeEx(const char *label, float radius, float thickness,const ImColor color, float speed); +CIMSPINNER_API void SpinnerSquareStrokeFade(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerSquareStrokeFadeEx(const char *label, float radius, float thickness,const ImColor color, float speed); +CIMSPINNER_API void SpinnerAsciiSymbolPoints(const char *label, const char* text, float radius, float thickness); +CIMSPINNER_API void SpinnerAsciiSymbolPointsEx(const char *label, const char* text, float radius, float thickness,const ImColor color, float speed); +CIMSPINNER_API void SpinnerTextFading(const char *label, const char* text, float radius, float fsize); +CIMSPINNER_API void SpinnerTextFadingEx(const char *label, const char* text, float radius, float fsize,const ImColor color, float speed); +CIMSPINNER_API void SpinnerSevenSegments(const char *label, const char* text, float radius, float thickness); +CIMSPINNER_API void SpinnerSevenSegmentsEx(const char *label, const char* text, float radius, float thickness,const ImColor color, float speed); +CIMSPINNER_API void SpinnerSquareStrokeFill(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerSquareStrokeFillEx(const char *label, float radius, float thickness,const ImColor color, float speed); +CIMSPINNER_API void SpinnerSquareStrokeLoading(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerSquareStrokeLoadingEx(const char *label, float radius, float thickness,const ImColor color, float speed); +CIMSPINNER_API void SpinnerSquareLoading(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerSquareLoadingEx(const char *label, float radius, float thickness,const ImColor color, float speed); +CIMSPINNER_API void SpinnerFilledArcFade(const char *label, float radius); +CIMSPINNER_API void SpinnerFilledArcFadeEx(const char *label, float radius,const ImColor color, float speed, size_t arcs, int mode); +CIMSPINNER_API void SpinnerPointsRoller(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerPointsRollerEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t points, int circles, float rspeed); +CIMSPINNER_API void SpinnerPointsArcBounce(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerPointsArcBounceEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t points, int circles, float rspeed); +CIMSPINNER_API void SpinnerFilledArcColor(const char *label, float radius); +CIMSPINNER_API void SpinnerFilledArcColorEx(const char *label, float radius,const ImColor color, const ImColor bg, float speed, size_t arcs); +CIMSPINNER_API void SpinnerFilledArcRing(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerFilledArcRingEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, size_t arcs); +CIMSPINNER_API void SpinnerArcWedges(const char *label, float radius); +CIMSPINNER_API void SpinnerArcWedgesEx(const char *label, float radius,const ImColor color, float speed, size_t arcs, int mode); +CIMSPINNER_API void SpinnerTwinBall(const char *label, float radius1, float radius2, float thickness, float b_thickness); +CIMSPINNER_API void SpinnerTwinBallEx(const char *label, float radius1, float radius2, float thickness, float b_thickness,const ImColor ball, const ImColor bg, float speed, size_t balls, int mode); +CIMSPINNER_API void SpinnerSolarBalls(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerSolarBallsEx(const char *label, float radius, float thickness,const ImColor ball, const ImColor bg, float speed, size_t balls); +CIMSPINNER_API void SpinnerSolarScaleBalls(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerSolarScaleBallsEx(const char *label, float radius, float thickness,const ImColor ball, float speed, size_t balls); +CIMSPINNER_API void SpinnerSolarArcs(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerSolarArcsEx(const char *label, float radius, float thickness,const ImColor ball, const ImColor bg, float speed, size_t balls); +CIMSPINNER_API void SpinnerMovingArcs(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerMovingArcsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs); +CIMSPINNER_API void SpinnerRainbowCircle(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerRainbowCircleEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, float mode); +CIMSPINNER_API void SpinnerBounceBall(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerBounceBallEx(const char *label, float radius, float thickness,const ImColor color, float speed, int dots, bool shadow); +CIMSPINNER_API void SpinnerPulsarBall(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerPulsarBallEx(const char *label, float radius, float thickness,const ImColor color, float speed, bool shadow, int mode); +CIMSPINNER_API void SpinnerIncScaleDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerIncScaleDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots, float angle, int mode); +CIMSPINNER_API void SpinnerSomeScaleDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerSomeScaleDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots, int mode); +CIMSPINNER_API void SpinnerAngTriple(const char *label, float radius1, float radius2, float radius3, float thickness); +CIMSPINNER_API void SpinnerAngTripleEx(const char *label, float radius1, float radius2, float radius3, float thickness,const ImColor c1, const ImColor c2, const ImColor c3, float speed, float angle); +CIMSPINNER_API void SpinnerAngEclipse(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerAngEclipseEx(const char *label, float radius, float thickness,const ImColor color, float speed, float angle); +CIMSPINNER_API void SpinnerIngYang(const char *label, float radius, float thickness, bool reverse, float yang_detlta_r); +CIMSPINNER_API void SpinnerIngYangEx(const char *label, float radius, float thickness, bool reverse, float yang_detlta_r,const ImColor colorI, const ImColor colorY, float speed, float angle, int mode); +CIMSPINNER_API void SpinnerGooeyBalls(const char *label, float radius, const ImColor color, float speed); +CIMSPINNER_API void SpinnerGooeyBallsEx(const char *label, float radius, const ImColor color, float speed,int mode); +CIMSPINNER_API void SpinnerDotsLoading(const char *label, float radius, float thickness, const ImColor color, const ImColor bg, float speed); +CIMSPINNER_API void SpinnerRotateGooeyBalls(const char *label, float radius, float thickness, const ImColor color, float speed, int balls); +CIMSPINNER_API void SpinnerRotateGooeyBallsEx(const char *label, float radius, float thickness, const ImColor color, float speed, int balls,int mode); +CIMSPINNER_API void SpinnerHerbertBalls(const char *label, float radius, float thickness, const ImColor color, float speed, int balls); +CIMSPINNER_API void SpinnerHerbertBalls3D(const char *label, float radius, float thickness, const ImColor color, float speed); +CIMSPINNER_API void SpinnerRotateTriangles(const char *label, float radius, float thickness, const ImColor color, float speed, int tris); +CIMSPINNER_API void SpinnerRotateTrianglesEx(const char *label, float radius, float thickness, const ImColor color, float speed, int tris,int mode); +CIMSPINNER_API void SpinnerRotateShapes(const char *label, float radius, float thickness, const ImColor color, float speed, int shapes, int pnt); +CIMSPINNER_API void SpinnerSinSquares(const char *label, float radius, float thickness, const ImColor color, float speed); +CIMSPINNER_API void SpinnerSinSquaresEx(const char *label, float radius, float thickness, const ImColor color, float speed,int mode); +CIMSPINNER_API void SpinnerMoonLine(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerMoonLineEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float angle); +CIMSPINNER_API void SpinnerCircleDrop(const char *label, float radius, float thickness, float thickness_drop); +CIMSPINNER_API void SpinnerCircleDropEx(const char *label, float radius, float thickness, float thickness_drop,const ImColor color, const ImColor bg, float speed, float angle); +CIMSPINNER_API void SpinnerSurroundedIndicator(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerSurroundedIndicatorEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed); +CIMSPINNER_API void SpinnerWifiIndicator(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerWifiIndicatorEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float cangle, int dots); +CIMSPINNER_API void SpinnerTrianglesSelector(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerTrianglesSelectorEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, size_t bars); +typedef ImColor LeafColor(int); +CIMSPINNER_API void SpinnerCamera(const char *label, float radius, float thickness, LeafColor *leaf_color); +CIMSPINNER_API void SpinnerCameraEx(const char *label, float radius, float thickness, LeafColor *leaf_color,float speed, size_t bars, int mode); +CIMSPINNER_API void SpinnerFlowingGradient(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerFlowingGradientEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float angle); +CIMSPINNER_API void SpinnerRotateSegments(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerRotateSegmentsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, size_t layers, int mode); +CIMSPINNER_API void SpinnerLemniscate(const char* label, float radius, float thickness); +CIMSPINNER_API void SpinnerLemniscateEx(const char* label, float radius, float thickness,const ImColor color, float speed, float angle); +CIMSPINNER_API void SpinnerRotateGear(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerRotateGearEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t pins); +CIMSPINNER_API void SpinnerRotateWheel(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerRotateWheelEx(const char *label, float radius, float thickness,const ImColor bg_color, const ImColor color, float speed, size_t pins); +CIMSPINNER_API void SpinnerAtom(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerAtomEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses); +CIMSPINNER_API void SpinnerPatternRings(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerPatternRingsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses); +CIMSPINNER_API void SpinnerPatternEclipse(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerPatternEclipseEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses, float delta_a, float delta_y); +CIMSPINNER_API void SpinnerPatternSphere(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerPatternSphereEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses); +CIMSPINNER_API void SpinnerRingSynchronous(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerRingSynchronousEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses); +CIMSPINNER_API void SpinnerRingWatermarks(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerRingWatermarksEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses); +CIMSPINNER_API void SpinnerRotatedAtom(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerRotatedAtomEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses, int mode); +CIMSPINNER_API void SpinnerRainbowBalls(const char *label, float radius, float thickness, const ImColor color, float speed); +CIMSPINNER_API void SpinnerRainbowBallsEx(const char *label, float radius, float thickness, const ImColor color, float speed,int balls, int mode, int rings, int mx); +CIMSPINNER_API void SpinnerRainbowShot(const char *label, float radius, float thickness, const ImColor color, float speed); +CIMSPINNER_API void SpinnerRainbowShotEx(const char *label, float radius, float thickness, const ImColor color, float speed,int balls, int mode); +CIMSPINNER_API void SpinnerSpiral(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerSpiralEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs); +CIMSPINNER_API void SpinnerSpiralEye(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerSpiralEyeEx(const char *label, float radius, float thickness,const ImColor color, float speed); +CIMSPINNER_API void SpinnerBarChartSine(const char *label, float radius, float thickness, const ImColor color, float speed); +CIMSPINNER_API void SpinnerBarChartSineEx(const char *label, float radius, float thickness, const ImColor color, float speed,int bars, int mode); +CIMSPINNER_API void SpinnerBarChartAdvSine(const char *label, float radius, float thickness, const ImColor color, float speed); +CIMSPINNER_API void SpinnerBarChartAdvSineEx(const char *label, float radius, float thickness, const ImColor color, float speed,int mode); +CIMSPINNER_API void SpinnerBarChartAdvSineFade(const char *label, float radius, float thickness, const ImColor color, float speed); +CIMSPINNER_API void SpinnerBarChartAdvSineFadeEx(const char *label, float radius, float thickness, const ImColor color, float speed,int mode); +CIMSPINNER_API void SpinnerBarChartRainbow(const char *label, float radius, float thickness, const ImColor color, float speed); +CIMSPINNER_API void SpinnerBarChartRainbowEx(const char *label, float radius, float thickness, const ImColor color, float speed,int bars, int mode); +CIMSPINNER_API void SpinnerBlocks(const char *label, float radius, float thickness, const ImColor bg, const ImColor color, float speed); +CIMSPINNER_API void SpinnerTwinBlocks(const char *label, float radius, float thickness, const ImColor bg, const ImColor color, float speed); +CIMSPINNER_API void SpinnerSquareRandomDots(const char *label, float radius, float thickness, const ImColor bg, const ImColor color, float speed); +CIMSPINNER_API void SpinnerScaleBlocks(const char *label, float radius, float thickness, const ImColor color, float speed); +CIMSPINNER_API void SpinnerScaleBlocksEx(const char *label, float radius, float thickness, const ImColor color, float speed,int mode); +CIMSPINNER_API void SpinnerScaleSquares(const char *label, float radius, float thikness, const ImColor color, float speed); +CIMSPINNER_API void SpinnerSquishSquare(const char *label, float radius, const ImColor color, float speed); +CIMSPINNER_API void SpinnerFluid(const char *label, float radius, const ImColor color, float speed); +CIMSPINNER_API void SpinnerFluidEx(const char *label, float radius, const ImColor color, float speed,int bars); +CIMSPINNER_API void SpinnerFluidPoints(const char *label, float radius, float thickness, const ImColor color, float speed); +CIMSPINNER_API void SpinnerFluidPointsEx(const char *label, float radius, float thickness, const ImColor color, float speed,size_t dots, float delta); +CIMSPINNER_API void SpinnerArcPolarFade(const char *label, float radius); +CIMSPINNER_API void SpinnerArcPolarFadeEx(const char *label, float radius,const ImColor color, float speed, size_t arcs, int mode); +CIMSPINNER_API void SpinnerArcPolarRadius(const char *label, float radius); +CIMSPINNER_API void SpinnerArcPolarRadiusEx(const char *label, float radius,const ImColor color, float speed, size_t arcs, int mode); +CIMSPINNER_API void SpinnerCaleidoscope(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerCaleidoscopeEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, int mode); +CIMSPINNER_API void SpinnerHboDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerHboDotsEx(const char *label, float radius, float thickness,const ImColor color, float minfade, float ryk, float speed, size_t dots, int mode); +CIMSPINNER_API void SpinnerMoonDots(const char *label, float radius, float thickness, const ImColor first, const ImColor second); +CIMSPINNER_API void SpinnerMoonDotsEx(const char *label, float radius, float thickness, const ImColor first, const ImColor second,float speed); +CIMSPINNER_API void SpinnerTwinHboDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerTwinHboDotsEx(const char *label, float radius, float thickness,const ImColor color, float minfade, float ryk, float speed, size_t dots, float delta); +CIMSPINNER_API void SpinnerThreeDotsStar(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerThreeDotsStarEx(const char *label, float radius, float thickness,const ImColor color, float minfade, float ryk, float speed, float delta); +CIMSPINNER_API void SpinnerSineArcs(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerSineArcsEx(const char *label, float radius, float thickness,const ImColor color, float speed); +CIMSPINNER_API void SpinnerTrianglesShift(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerTrianglesShiftEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, size_t bars); +CIMSPINNER_API void SpinnerPointsShift(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerPointsShiftEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, size_t bars); +CIMSPINNER_API void SpinnerSwingDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerSwingDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed); +CIMSPINNER_API void SpinnerCircularPoints(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerCircularPointsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lines); +CIMSPINNER_API void SpinnerCurvedCircle(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerCurvedCircleEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t circles); +CIMSPINNER_API void SpinnerModCircle(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerModCircleEx(const char *label, float radius, float thickness,const ImColor color, float ang_min, float ang_max, float speed); +CIMSPINNER_API void SpinnerDnaDots(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerDnaDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt, float delta, bool mode); +CIMSPINNER_API void Spinner3SmuggleDots(const char *label, float radius, float thickness); +CIMSPINNER_API void Spinner3SmuggleDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt, float delta, bool mode); +CIMSPINNER_API void SpinnerRotateSegmentsPulsar(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerRotateSegmentsPulsarEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, size_t layers); +CIMSPINNER_API void SpinnerSplineAng(const char *label, float radius, float thickness); +CIMSPINNER_API void SpinnerSplineAngEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float angle, int mode); + +CIMSPINNER_API void demoSpinners(); +#ifdef __cplusplus +} +#endif diff --git a/external/imspinner/cimspinner_config.h b/external/imspinner/cimspinner_config.h new file mode 100644 index 00000000..5dc21a63 --- /dev/null +++ b/external/imspinner/cimspinner_config.h @@ -0,0 +1,11 @@ +#pragma once + +#define SPINNER_RAINBOWMIX +#define SPINNER_DNADOTS +#define SPINNER_ANG8 +#define SPINNER_CLOCK +#define SPINNER_PULSAR +#define SPINNER_DOTSTOBAR +#define SPINNER_ATOM +#define SPINNER_BARCHARTRAINBOW +#define SPINNER_SWINGDOTS diff --git a/external/imspinner/imspinner.h b/external/imspinner/imspinner.h new file mode 100644 index 00000000..57032060 --- /dev/null +++ b/external/imspinner/imspinner.h @@ -0,0 +1,4950 @@ +#ifndef _IMSPINNER_H_ +#define _IMSPINNER_H_ + +/* + * The MIT License (MIT) + * + * Copyright (c) 2021-2022 Dalerank + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __has_include + #if !__has_include() + #error "Couldn't find imgui.h in the header include path, please add it to the path!" + #endif // ! +#endif // __has_include + +// imgui headers +#include "imgui.h" +#include "imgui_internal.h" + +namespace ImSpinner +{ + static const ImColor white{1.f, 1.f, 1.f, 1.f}; + static const ImColor half_white{1.f, 1.f, 1.f, 0.5f}; + static const ImColor red{1.f,0.f,0.f,1.f}; + +#define DECLPROP(name, type, def) \ + struct name { \ + type value = def; \ + operator type() { return value; } \ + name(const type& v) : value(v) {} \ + }; + + enum SpinnerTypeT { + e_st_rainbow = 0, + e_st_angle, + e_st_dots, + e_st_ang, + e_st_vdots, + e_st_bounce_ball, + e_st_eclipse, + e_st_ingyang, + e_st_barchartsine, + + e_st_count + }; + + using float_ptr = float *; + constexpr float PI_DIV_4 = IM_PI / 4.f; + constexpr float PI_DIV_2 = IM_PI / 2.f; + constexpr float PI_2 = IM_PI * 2.f; + template constexpr float PI_DIV(T d) { return IM_PI / (float)d; } + template constexpr float PI_2_DIV(T d) { return PI_2 / (float)d; } + + DECLPROP (SpinnerType, SpinnerTypeT, e_st_rainbow) + DECLPROP (Radius, float, 16.f) + DECLPROP (Speed, float, 1.f) + DECLPROP (Thickness, float, 1.f) + DECLPROP (Color, ImColor, white) + DECLPROP (BgColor, ImColor, white) + DECLPROP (AltColor, ImColor, white) + DECLPROP (Angle, float, IM_PI) + DECLPROP (AngleMin, float, IM_PI) + DECLPROP (AngleMax, float, IM_PI) + DECLPROP (FloatPtr, float_ptr, nullptr) + DECLPROP (Dots, int, 0) + DECLPROP (MiddleDots, int, 0) + DECLPROP (MinThickness, float, 0.f) + DECLPROP (Reverse, bool, false) + DECLPROP (Delta, float, 0.f) + DECLPROP (Mode, int, 0) +#undef DECLPROP + + namespace detail { + // SpinnerBegin is a function that starts a spinner widget, used to display an animation indicating that + // a task is in progress. It returns true if the widget is visible and can be used, or false if it should be skipped. + inline bool SpinnerBegin(const char *label, float radius, ImVec2 &pos, ImVec2 &size, ImVec2 ¢re, int &num_segments) { + ImGuiWindow *window = ImGui::GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext &g = *GImGui; + const ImGuiStyle &style = g.Style; + const ImGuiID id = window->GetID(label); + + pos = window->DC.CursorPos; + // The size of the spinner is set to twice the radius, plus some padding based on the style + size = ImVec2((radius) * 2, (radius + style.FramePadding.y) * 2); + + const ImRect bb(pos, ImVec2(pos.x + size.x, pos.y + size.y)); + ImGui::ItemSize(bb, style.FramePadding.y); + + num_segments = window->DrawList->_CalcCircleAutoSegmentCount(radius); + + centre = bb.GetCenter(); + // If the item cannot be added to the window, return false + if (!ImGui::ItemAdd(bb, id)) + return false; + + return true; + } + +#define IMPLRPOP(basetype,type) basetype m_##type; \ + void set##type(const basetype& v) { m_##type = v;} \ + void set(type h) { m_##type = h.value;} \ + template \ + void set(const type& h, const Args&... args) { set##type(h.value); this->template set(args...); } + struct SpinnerConfig { + SpinnerConfig() {} + template void set() {} + + template + SpinnerConfig(const Args&... args) { this->template set(args...); } + + IMPLRPOP(SpinnerTypeT, SpinnerType) + IMPLRPOP(float, Radius) + IMPLRPOP(float, Speed) + IMPLRPOP(float, Thickness) + IMPLRPOP(ImColor, Color) + IMPLRPOP(ImColor, BgColor) + IMPLRPOP(ImColor, AltColor) + IMPLRPOP(float, Angle) + IMPLRPOP(float, AngleMin) + IMPLRPOP(float, AngleMax) + IMPLRPOP(float_ptr, FloatPtr) + IMPLRPOP(int, Dots) + IMPLRPOP(int, MiddleDots) + IMPLRPOP(float, MinThickness) + IMPLRPOP(bool, Reverse) + IMPLRPOP(float, Delta) + IMPLRPOP(int, Mode) + }; +#undef IMPLRPOP + } + +#define SPINNER_HEADER(pos, size, centre, num_segments) \ + ImVec2 pos, size, centre; int num_segments; \ + if (!detail::SpinnerBegin(label, radius, pos, size, centre, num_segments)) { return; }; \ + ImGuiWindow *window = ImGui::GetCurrentWindow(); \ + auto circle = [&] (const std::function& point_func, ImU32 dbc, float dth) { \ + window->DrawList->PathClear(); \ + for (int i = 0; i < num_segments; i++) { \ + ImVec2 p = point_func(i); \ + window->DrawList->PathLineTo(ImVec2(centre.x + p.x, centre.y + p.y)); \ + } \ + window->DrawList->PathStroke(dbc, 0, dth); \ + } + + inline ImColor color_alpha(ImColor c, float alpha) { c.Value.w *= alpha * ImGui::GetStyle().Alpha; return c; } + + inline float damped_spring(float mass, float stiffness, float damping, float time, float a = PI_DIV_2, float b = PI_DIV_2) { + float omega = ImSqrt(stiffness / mass); + float alpha = damping / (2 * mass); + float exponent = std::exp(-alpha * time); + float cosTerm = ImCos(omega * ImSqrt(1 - alpha * alpha) * time); + float result = exponent * cosTerm; + return ((result *= a) + b); + }; + + inline float damped_gravity(float limtime) { + float time = 0.0f, initialHeight = 10.f, height = initialHeight, velocity = 0.f, prtime = 0.0f; + + while (height >= 0.0) { + if (prtime >= limtime) { return height / 10.f; } + time += 0.01f; prtime += 0.01f; + height = initialHeight - 0.5 * 9.81f * time * time; + if (height < 0.0) { initialHeight = 0.0; time = 0.0; } + } + return 0.f; + } + + inline float damped_trifolium(float limtime, float a = 0.f, float b = 1.f) { + return a * ImSin(limtime) - b * ImSin(3 * limtime); + } + + inline float damped_inoutelastic(float t, float amplitude, float period) { + if( t == 0 ) return 0; + t *= 2; + if( t == 2 ) return 1; + + float s; + if( amplitude < 1 ) { + amplitude = 1; + s = period / 4; + } else { + s = period / (2 * IM_PI) * std::asin( 1 / amplitude ); + } + + if( t < 1 ) return -0.5f * ( amplitude * ImPow(2.0f, 10.f*(t-1.f) ) * ImSin( (t-1.f-s)*(2.f*IM_PI)/period )); + return amplitude * ImPow( 2.0f, -10*(t-1) ) * ImSin( (t-1.f-s)*(2.f*IM_PI)/period ) * 0.5f + 1.f; + } + + inline std::pair damped_infinity(float t, float a) { + return std::make_pair((a * ImCos(t)) / (1 + (powf(ImSin(t), 2.0f))), + (a * ImSin(t) * ImCos(t)) / (1 + (powf(ImSin(t), 2.0f)))); + }; + + inline float ease_inquad(float time) { return time * time; } + inline float ease_outquad(float time) { return time * (2.f - time); } + inline float ease_inoutquad(float t) { if (t < 0.5f) { return 2 * t * t; } else { return -1 + (4 - 2 * t) * t; }} + inline float ease_inoutquad(float *p) { float tr = ImMax(ImSin(p[0]) - 0.5f, 0.f) * (p[1] * 0.5f); return ease_inoutquad(tr); } + inline float ease_outcubic(float t) { float ft = t - 1; return ft * ft * ft + 1; } + inline float ease_inexpo(float t) { return t == 0 ? 0 : pow(2, 10 * (t - 1)); } + inline float ease_inoutexpo(float t) { if (t == 0) return 0; if (t == 1) return 1; if (t < 0.5f) return 0.5f * pow(2, (20 * t) - 10); return 0.5f * (2 - pow(2, -20 * t + 10)); } + inline float ease_inoutexpo(float *p) { float tr = ImMax(ImSin(p[0]) - 0.5f, 0.f) * (p[1] * 0.4f); return ease_inoutexpo(tr) * (p[1] * 0.3f); } + inline float ease_spring(float *p) { return damped_spring(1, 10.f, 1.0f, ImSin(ImFmod(p[0], p[1])), p[2], p[3]);} + inline float ease_gravity(float *p) { return damped_gravity(p[0]); } + inline float ease_infinity(float *p) { return damped_infinity(p[0], p[1]).second; } + inline float ease_inoutelastic(float *p) { return damped_inoutelastic(p[1], p[2], p[3]); } + inline float ease_sine(float *p) { return 0.5f * (1.0f - cosf(p[0] * IM_PI)); } + inline float ease_damping(float *p) { + const float A = 3.14 * 2; + const float ma = 5.0; + const float k = 2.1; + const float b = 0.09; + const float theta = 0.0; + const float w = std::sqrt(k / ma); + const float t = ImFmod(*p, 25); + double x = A * std::exp(-b * t) * std::cos(w * t - theta); + return x; + } + + enum ease_mode { + e_ease_none = 0, + e_ease_inoutquad = 1, + e_ease_inoutexpo = 2, + e_ease_spring = 3, + e_ease_gravity = 4, + e_ease_infinity = 5, + e_ease_elastic = 6, + e_ease_sine = 7, + e_ease_damping = 8, + }; + + template + inline float ease(ease_mode mode, Args ... args) { + static_assert((std::is_same_v && ...), "All arguments should be of type float"); + float params[] = {args...}; + switch (mode) { + case e_ease_inoutquad: return ease_inoutquad(params); + case e_ease_inoutexpo: return ease_inoutexpo(params); + case e_ease_spring: return ease_spring(params); + case e_ease_gravity: return ease_gravity(params); + case e_ease_infinity: return ease_infinity(params); + case e_ease_elastic: return ease_inoutelastic(params); + case e_ease_sine: return ease_sine(params); + case e_ease_damping: return ease_damping(params); + case e_ease_none: return (0.f); + } + return 0.f; + } + + /* + const char *label: A string label for the spinner, used to identify it in ImGui. + float radius: The radius of the spinner. + float thickness: The thickness of the spinner's border. + const ImColor &color: The color of the spinner. + float speed: The speed of the spinning animation. + float ang_min: Minimum angle of spinning. + float ang_max: Maximum angle of spinning. + int arcs: Number of arcs of the spinner. + */ + inline void SpinnerRainbow(const char *label, float radius, float thickness, const ImColor &color, float speed, float ang_min = 0.f, float ang_max = PI_2, int arcs = 1, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImAbs(ImSin((float)ImGui::GetTime()) * (num_segments - 5)); + for (int i = 0; i < arcs; ++i) + { + const float rb = (radius / arcs) * (i + 1); + const float ab = ease((ease_mode)mode, (float)ImGui::GetTime() * speed + i * PI_DIV(2) / arcs, IM_PI, 1.0f, 0.0f); + const float a_min = ImMax(ang_min, PI_2 * ((float)start) / (float)num_segments + (IM_PI / arcs) * i) + ab; + const float a_max = ImMin(ang_max, PI_2 * ((float)num_segments + 3 * (i + 1)) / (float)num_segments) - ab; + + circle([&] (int i) { + const float a = a_min + ((float)i / (float)num_segments) * (a_max - a_min); + const float rspeed = a + (float)ImGui::GetTime() * speed; + return ImVec2(ImCos(rspeed) * rb, ImSin(rspeed) * rb); + }, color_alpha(color, 1.f), thickness); + } + } + + inline void SpinnerRainbowMix(const char *label, float radius, float thickness, const ImColor &color, float speed, float ang_min = 0.f, float ang_max = PI_2, int arcs = 1, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + for (int i = 0; i < arcs; ++i) + { + const float rb = (radius / arcs) * (i + 1); + + const float start = ImAbs(ImSin((float)ImGui::GetTime()) * (num_segments - 5)); + const float a_min = ImMax(ang_min, PI_2 * ((float)start) / (float)num_segments + (IM_PI / arcs) * i); + const float a_max = ImMin(ang_max, PI_2 * ((float)num_segments + 3 * (i + 1)) / (float)num_segments); + const float koeff = mode ? (1.1f - 1.f / (i+1)) : 1.f; + ImColor c = ImColor::HSV(out_h + i * (1.f / arcs), out_s, out_v); + + circle([&] (int i) { + const float a = a_min + ((float)i / (float)num_segments) * (a_max - a_min); + const float rspeed = a + (float)ImGui::GetTime() * speed * koeff; + return ImVec2(ImCos(rspeed) * rb, ImSin(rspeed) * rb); + }, color_alpha(c, 1.f), thickness); + } + } + + // This function draws a rotating heart spinner. + inline void SpinnerRotatingHeart(const char *label, float radius, float thickness, const ImColor &color, float speed, float ang_min = 0.f) + { + // Calculate the position and size of the spinner, as well as the number of segments it will be divided into. + SPINNER_HEADER(pos, size, centre, num_segments); + + // Calculate the start angle of the spinner based on the current time and speed. + const float start = (float)ImGui::GetTime() * speed; + + // Modify the number of segments to ensure the heart shape is complete. + num_segments = (num_segments * 3) / 2; + + // Create a lambda function to rotate points. + auto rotate = [] (const ImVec2 &point, float angle) { + const float s = ImSin(angle), c = ImCos(angle); + return ImVec2(point.x * c - point.y * s, point.x * s + point.y * c); + }; + + // Calculate the radius of the bottom of the heart. + const float rb = radius * ImMax(0.8f, ImSin(start * 2)); + auto scale = [rb] (float v) { return v / 16.f * rb; }; + + // Draw the heart spinner by calling the circle function, passing in a lambda function that defines the shape of the heart. + circle([&] (int i) { + const float a = PI_2 * i / num_segments; + const float x = (scale(16) * ImPow(ImSin(a), 3)); + const float y = -1.f * (scale(13) * ImCos(a) - scale(5) * ImCos(2 * a) - scale(2) * ImCos(3 * a) - ImCos(4 * a)); + return rotate(ImVec2(x, y), ang_min); + }, color_alpha(color, 1.f), thickness); + } + + // SpinnerAng is a function that draws a spinner widget with a given angle. + inline void SpinnerAng(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = white, float speed = 2.8f, float angle = IM_PI, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); // Get the position, size, centre, and number of segments of the spinner using the SPINNER_HEADER macro. + float start = (float)ImGui::GetTime() * speed; // The start angle of the spinner is calculated based on the current time and the specified speed. + float b = 0.f; + switch (mode) { + case 1: b = damped_gravity(ImSin(start * 1.1f)) * angle; break; + case 2: radius = (0.8f + ImCos(start) * 0.2f) * radius; break; + case 3: b = damped_infinity(start * 1.1f, 1.f).second; break; + } + + auto radiusmode = [radius, mode] (float a) { switch (mode) { case 4: return damped_trifolium(a) * radius; } return radius; }; + circle([&] (int i) { // Draw the background of the spinner using the `circle` function, with the specified background color and thickness. + const float a = start + (i * (PI_2 / (num_segments - 1))); // Calculate the angle for each segment based on the start angle and the number of segments. + return ImVec2(ImCos(a) * radiusmode(a), ImSin(a) * radiusmode(a)); + }, color_alpha(bg, 1.f), thickness); + + circle([&] (int i) { // Draw the spinner itself using the `circle` function, with the specified color and thickness. + const float a = start - b + (i * angle / num_segments); + return ImVec2(ImCos(a) * radiusmode(a), ImSin(a) * radiusmode(a)); + }, color_alpha(color, 1.f), thickness); + } + + inline void SpinnerAng8(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = white, float speed = 2.8f, float angle = IM_PI, int mode = 0, float rkoef = 0.5f) + { + SPINNER_HEADER(pos, size, centre, num_segments); // Get the position, size, centre, and number of segments of the spinner using the SPINNER_HEADER macro. + float start = (float)ImGui::GetTime() * speed; // The start angle of the spinner is calculated based on the current time and the specified speed. + float b = 0.f, kb = 1.f; + switch (mode) { + case 1: b = damped_gravity(ImSin(start * 1.1f)) * angle; break; + case 2: radius = (0.8f + ImCos(start) * 0.2f) * radius; break; + case 3: b = damped_infinity(start * 1.1f, 1.f).second; break; + case 4: b = ease_outquad(ImSin(start * 1.1f)) * angle; break; + case 5: kb = 2.f; break; + } + + auto radiusmode = [radius, mode, kb] (float a, float k) { switch (mode) { case 4: return damped_trifolium(a) * radius; } return radius * k * kb; }; + float centerx_save = centre.x; + centre.x = centerx_save + radius * (1.f - rkoef); + circle([&] (int i) { // Draw the spinner itself using the `circle` function, with the specified color and thickness. + const float a = start - b + (i * angle / num_segments); + return ImVec2(ImCos(a) * radiusmode(a, rkoef), ImSin(a) * radiusmode(a, rkoef)); + }, color_alpha(color, 1.f), thickness); + + centre.x = centerx_save - radius * rkoef; + circle([&] (int i) { // Draw the spinner itself using the `circle` function, with the specified color and thickness. + const float a = start - b + (i * angle / num_segments); + return ImVec2(ImCos(-a) * radiusmode(a, 1.f - rkoef), ImSin(-a) * radiusmode(a, 1.f - rkoef)); + }, color_alpha(color, 1.f), thickness); + } + + inline void SpinnerAngMix(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, float angle = IM_PI, int arcs = 4, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); // Get the position, size, centre, and number of segments of the spinner using the SPINNER_HEADER macro. + + for (int i = 0; i < arcs; ++i) + { + const float koeff = (1.1f - 1.f / (i+1)); + float start = (float)ImGui::GetTime() * speed * koeff; // The start angle of the spinner is calculated based on the current time and the specified speed. + radius = (mode == 2) ? (0.8f + ImCos(start) * 0.2f) * radius : radius; + const float rb = (radius / arcs) * (i + 1); + const float b = (mode == 1) ? damped_gravity(ImSin(start * 1.1f)) * angle : 0.f; + circle([&] (int i) { // Draw the spinner itself using the `circle` function, with the specified color and thickness. + const float a = start - b + (i * angle / num_segments); + return ImVec2(ImCos(a) * rb, ImSin(a) * rb); + }, color_alpha(color, 1.f), thickness); + } + } + + inline void SpinnerLoadingRing(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = half_white, float speed = 2.8f, int segments = 5) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, IM_PI); // Calculate the starting angle based on the current time and speed + const float bg_angle_offset = PI_2 / num_segments - 1; + + num_segments *= 2; // Double the number of segments for the background ringxxxxxxx + circle([&] (int i) { + return ImVec2(ImCos(i * bg_angle_offset) * radius, ImSin(i * bg_angle_offset) * radius); // Draw the background ring + }, color_alpha(bg, 1.f), thickness); + + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); // Convert the color to HSV for variation in segment colors + + const float start_ang = (start < PI_DIV_2) ? 0.f : (start - PI_DIV_2) * 4.f; // Calculate the angles and delta angle for each segment + const float angle_offset = ((start < PI_DIV_2) ? PI_2 : (PI_2 - start_ang)) / segments; + const float delta_angle = (start < PI_DIV_2) ? ImSin(start) * angle_offset : angle_offset; + for (int i = 0; i < segments; ++i) // Draw each segment of the loading ring + { + window->DrawList->PathClear(); + const float begin_ang = start_ang - PI_DIV_2 + delta_angle * i; + ImColor c = ImColor::HSV(out_h + i * (1.f / segments * 2.f), out_s, out_v); + window->DrawList->PathArcTo(centre, radius, begin_ang, begin_ang + delta_angle, num_segments); + window->DrawList->PathStroke(color_alpha(c, 1.f), false, thickness); + } + } + + inline void SpinnerClock(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = half_white, float speed = 2.8f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime() * speed; + const float bg_angle_offset = PI_2 / (num_segments - 1); + + circle([&] (int i) { return ImVec2(ImCos(i * bg_angle_offset) * radius, ImSin(i * bg_angle_offset) * radius); }, color_alpha(bg, 1.f), thickness); + + window->DrawList->AddLine(centre, ImVec2(centre.x + ImCos(start) * radius, centre.y + ImSin(start) * radius), color_alpha(color, 1.f), thickness * 2); + window->DrawList->AddLine(centre, ImVec2(centre.x + ImCos(start * 0.5f) * radius / 2.f, centre.y + ImSin(start * 0.5f) * radius / 2.f), color_alpha(color, 1.f), thickness * 2); + } + + inline void SpinnerPulsar(const char *label, float radius, float thickness, const ImColor &bg = half_white, float speed = 2.8f, bool sequence = true, float angle = 0.f, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + ImGuiStorage* storage = window->DC.StateStorage; + const ImGuiID radiusbId = window->GetID("##radiusb"); + float radius_b = storage->GetFloat(radiusbId, 0.8f); + + const float start = (float)ImGui::GetTime() * speed; + const float bg_angle_offset = PI_2 / (num_segments - 1); + + float start_r = ImFmod(start, PI_DIV_2); + switch (mode) { + case 1: start_r = damped_infinity(start_r, angle).second; break; + } + float radius_k = ImSin(start_r); + float radius1 = radius_k * radius; + + circle([&] (int i) { + return ImVec2(ImCos(i * bg_angle_offset) * radius1, ImSin(i * bg_angle_offset) * radius1); + }, color_alpha(bg, 1.f), thickness); + + if (sequence) { radius_b -= (0.005f * speed); radius_b = ImMax(radius_k, ImMax(0.8f, radius_b)); } + else { radius_b = (1.f - radius_k); } + storage->SetFloat(radiusbId, radius_b); + + float radius_tb = sequence ? ImMax(radius_k, radius_b) * radius : (radius_b * radius); + circle([&] (int i) { + return ImVec2(ImCos(i * bg_angle_offset) * radius_tb, ImSin(i * bg_angle_offset) * radius_tb); + }, color_alpha(bg, 1.f), thickness); + } + + inline void SpinnerDoubleFadePulsar(const char *label, float radius, float /*thickness*/, const ImColor &bg = half_white, float speed = 2.8f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + ImGuiStorage* storage = window->DC.StateStorage; + const ImGuiID radiusbId = window->GetID("##radiusb"); + float radius_b = storage->GetFloat(radiusbId, 0.8f); + + const float start = (float)ImGui::GetTime() * speed; + const float bg_angle_offset = PI_2_DIV(num_segments); + + float start_r = ImFmod(start, PI_DIV_2); + float radius_k = ImSin(start_r); + window->DrawList->AddCircleFilled(centre, radius_k * radius, color_alpha(bg, ImMin(0.1f, radius_k)), num_segments); + + radius_b = (1.f - radius_k); + storage->SetFloat(radiusbId, radius_b); + + window->DrawList->AddCircleFilled(centre, radius_b * radius, color_alpha(bg, ImMin(0.3f, radius_b)), num_segments); + } + + inline void SpinnerTwinPulsar(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int rings = 2, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float bg_angle_offset = PI_2 / (num_segments - 1); + const float koeff = PI_DIV(2 * rings); + float start = (float)ImGui::GetTime() * speed; + + for (int num_ring = 0; num_ring < rings; ++num_ring) { + float radius_k = ImSin(ImFmod(start + (num_ring * koeff), PI_DIV_2)); + float radius1 = radius_k * radius; + radius1 += ease((ease_mode)mode, start, radius); + + circle([&] (int i) { + const float a = start + (i * bg_angle_offset); + return ImVec2(ImCos(a) * radius1, ImSin(a) * radius1); + }, color_alpha(color, radius_k > 0.5f ? 2.f - (radius_k * 2.f) : color.Value.w), thickness); + } + } + + inline void SpinnerFadePulsar(const char *label, float radius, const ImColor &color = white, float speed = 2.8f, int rings = 2, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float bg_angle_offset = PI_2_DIV(num_segments); + const float koeff = PI_DIV(2 * rings); + float start = (float)ImGui::GetTime() * speed; + + for (int num_ring = 0; num_ring < rings; ++num_ring) { + float radius_k = ImSin(ImFmod(start + (num_ring * koeff), PI_DIV_2)); + ImColor c = color_alpha(color, (radius_k > 0.5f) ? (2.f - (radius_k * 2.f)) : color.Value.w); + c.Value.w -= ease((ease_mode)mode, start, c.Value.w); + window->DrawList->AddCircleFilled(centre, radius_k * radius, c, num_segments); + } + } + + inline void SpinnerFadePulsarSquare(const char *label, float radius, const ImColor &color = white, float speed = 2.8f, int rings = 2, int mode = 0) { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float bg_angle_offset = PI_2_DIV(num_segments); + const float koeff = PI_DIV(2 * rings); + float start = (float)ImGui::GetTime() * speed; + + for (int num_ring = 0; num_ring < rings; ++num_ring) { + float start_r = ImFmod(start, PI_DIV_2); + float radius_k = ImSin(start_r * (1.f - (1.f / rings) * num_ring)); + radius_k += ease((ease_mode)mode, bg_angle_offset, speed); + radius_k = std::clamp(radius_k, 0.f, 1.f); + + ImColor c = color_alpha(color, (radius_k > 0.5f) ? (2.f - (radius_k * 2.f)) : color.Value.w); + c.Value.w = 0.8f / (1 + rings);//ease((ease_mode)mode, start, c.Value.w); + float px = radius_k * radius; + window->DrawList->AddRectFilled(ImVec2(centre.x - px, centre.y - px), ImVec2(centre.x + px, centre.y + px), c, 2.f); + + px = radius * (1.f - radius_k); + window->DrawList->AddRectFilled(ImVec2(centre.x - px, centre.y - px), ImVec2(centre.x + px, centre.y + px), c, 2.f); + } + } + + inline void SpinnerCircularLines(const char *label, float radius, const ImColor &color = white, float speed = 1.8f, int lines = 8, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + auto ghalf_pi = [] (float f) -> float { return ImMin(f, PI_DIV_2); }; + const float start = ImFmod((float)ImGui::GetTime() * speed, IM_PI); + const float bg_angle_offset = PI_2_DIV(lines); + for (size_t j = 0; j < 3; ++j) + { + const float start_offset = j * PI_DIV(7.f); + const float rmax = ImMax(ImSin(ghalf_pi(start - start_offset)), 0.3f) * radius; + const float rmin = ImMax(ImSin(ghalf_pi(start - PI_DIV_4 - start_offset)), 0.3f) * radius; + + ImColor c = color_alpha(color, 1.f - j * 0.3f); + for (size_t i = 0; i <= lines; i++) + { + float a = (i * bg_angle_offset); + a += ease((ease_mode)mode, start_offset, radius); + window->DrawList->AddLine(ImVec2(centre.x + ImCos(a) * rmin, centre.y + ImSin(a) * rmin), + ImVec2(centre.x + ImCos(a) * rmax, centre.y + ImSin(a) * rmax), + color_alpha(c, 1.f), 1.f); + } + } + } + + inline void SpinnerDots(const char *label, float *nextdot, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t dots = 12, float minth = -1.f, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float start = (float)ImGui::GetTime() * speed; + const float bg_angle_offset = PI_2 / dots; + dots = ImMin(dots, (size_t)32); + const size_t mdots = dots / 2; + + float def_nextdot = 0; + float &ref_nextdot = nextdot ? *nextdot : def_nextdot; + if (ref_nextdot < 0.f) + ref_nextdot = (float)dots; + + auto radiusmode = [radius, mode, dots] (float a, int i) { + switch (mode) { + case 2: return damped_trifolium(a) * radius; + case 3: return (radius / dots) * i; + } return radius; + }; + auto thcorrect = [&thickness, &ref_nextdot, &mdots, &minth] (size_t i) { + const float nth = minth < 0.f ? thickness / 2.f : minth; + return ImMax(nth, ImSin(((i - ref_nextdot) / mdots) * IM_PI) * thickness); + }; + + switch (mode) { + case 1: start = damped_infinity(start * 1.1f, 1.f).second; break; + case 4: start = ease_outquad(ImSin(ImFmod(start, IM_PI))); break; + case 5: start = ease_inoutexpo(ImSin(ImFmod(start, IM_PI))); break; + } + for (size_t i = 0; i <= dots; i++) + { + float a = start + (i * bg_angle_offset); + a = ImFmod(a, PI_2); + float th = minth < 0 ? thickness / 2.f : minth; + + if (ref_nextdot + mdots < dots) { + if (i > ref_nextdot && i < ref_nextdot + mdots) + th = thcorrect(i); + } else { + if ((i > ref_nextdot && i < dots) || (i < ((int)(ref_nextdot + mdots)) % dots)) + th = thcorrect(i); + } + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(-a) * radiusmode(a, i), centre.y + ImSin(-a) * radiusmode(a, i)), th, color_alpha(color, 1.f), 8); + } + } + + inline void SpinnerVDots(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bgcolor = white, float speed = 2.8f, size_t dots = 12, size_t mdots = 6, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float start = (float)ImGui::GetTime() * speed; + switch (mode) { + case 1: start += ease_inoutquad(ImSin(ImFmod(start, IM_PI))); break; + } + + const float bg_angle_offset = PI_2_DIV(dots); + dots = ImMin(dots, (size_t)32); + + for (size_t i = 0; i <= dots; i++) + { + float a = ImFmod(start + (i * bg_angle_offset), PI_2); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(-a) * radius, centre.y + ImSin(-a) * radius), thickness / 2, color_alpha(bgcolor, 1.f), 8); + } + + window->DrawList->PathClear(); + const float d_ang = (mdots / (float)dots) * PI_2; + const float angle_offset = (d_ang) / dots; + for (size_t i = 0; i < dots; i++) + { + const float a = start + (i * angle_offset); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * radius, centre.y + ImSin(a) * radius)); + } + window->DrawList->PathStroke(color_alpha(color, 1.f), false, thickness); + } + + inline void SpinnerBounceDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t dots = 3, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float nextItemKoeff = 2.5f; + const float heightKoeff = 2.f; + const float heightSpeed = 0.8f; + const float hsize = dots * (thickness * nextItemKoeff) / 2.f - (thickness * nextItemKoeff) * 0.5f; + + float start = (float)ImGui::GetTime() * speed; + const float offset = PI_DIV(dots); + for (size_t i = 0; i < dots; i++) { + float a = start + (IM_PI - i * offset); + switch (mode) { + case 1: a = damped_spring(1, 10.f, 1.0f, ImSin(ImFmod(start + i * PI_DIV(dots * 2), PI_2))); break; + case 2: a = damped_infinity((float)(start + i * PI_DIV(dots * 2)), radius).second; break; + } + float y = centre.y + ImSin(a * heightSpeed) * thickness * heightKoeff; + window->DrawList->AddCircleFilled(ImVec2(centre.x - hsize + i * (thickness * nextItemKoeff), ImMin(y, centre.y)), thickness, color_alpha(color, 1.f), 8); + } + } + + inline void SpinnerZipDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t dots = 5) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float nextItemKoeff = 3.5f; + const float heightKoeff = 2.f; + const float heightSpeed = 0.8f; + const float hsize = dots * (thickness * nextItemKoeff) / 2.f - (thickness * nextItemKoeff) * 0.5f; + const float start = (float)ImGui::GetTime() * speed; + const float offset = PI_DIV(dots); + + for (size_t i = 0; i < dots; i++) + { + const float sina = ImSin((start + (IM_PI - i * offset)) * heightSpeed); + const float y = ImMin(centre.y + sina * thickness * heightKoeff, centre.y); + const float deltay = ImAbs(y - centre.y); + window->DrawList->AddCircleFilled(ImVec2(centre.x - hsize + i * (thickness * nextItemKoeff), y), thickness, color_alpha(color, 1.f), 8); + window->DrawList->AddCircleFilled(ImVec2(centre.x - hsize + i * (thickness * nextItemKoeff), y + 2 * deltay), thickness, color_alpha(color, 1.f), 8); + } + } + + inline void SpinnerDotsToPoints(const char *label, float radius, float thickness, float offset_k, const ImColor &color = white, float speed = 1.8f, size_t dots = 5) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float nextItemKoeff = 3.5f; + const float hsize = dots * (thickness * nextItemKoeff) / 2.f - (thickness * nextItemKoeff) * 0.5f; + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + const float offset = PI_DIV(dots); + + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + if (start < PI_DIV_2) { + const float sina = ImSin(start); + for (size_t i = 0; i < dots; i++) { + const float xx = ImMax(sina * (i * (thickness * nextItemKoeff)), 0.f); + ImColor c = color_alpha(ImColor::HSV(out_h + i * ((1.f / dots) * 2.f), out_s, out_v), 1.f); + window->DrawList->AddCircleFilled(ImVec2(centre.x - hsize + xx, centre.y), thickness, c, 8); + } + } else { + for (size_t i = 0; i < dots; i++) { + const float sina = ImSin(ImMax(start - (IM_PI / dots) * i, PI_DIV_2)); + const float xx = ImMax(1.f * (i * (thickness * nextItemKoeff)), 0.f); + const float th = sina * thickness; + ImColor c = color_alpha(ImColor::HSV(out_h + i * ((1.f / dots) * 2.f), out_s, out_v), 1.f); + window->DrawList->AddCircleFilled(ImVec2(centre.x - hsize + xx, centre.y), th, c, 8); + } + } + } + //const float sina = ImSin( ImFmod((start + (IM_PI - i * offset)), PI_DIV_2)); + + inline void SpinnerDotsToBar(const char *label, float radius, float thickness, float offset_k, const ImColor &color = white, float speed = 2.8f, size_t dots = 5) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float nextItemKoeff = 3.5f; + const float heightSpeed = 0.8f; + const float hsize = dots * (thickness * nextItemKoeff) / 2.f - (thickness * nextItemKoeff) * 0.5f; + const float start = (float)ImGui::GetTime() * speed; + const float offset = PI_DIV(dots); + const float hradius = (radius); + + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + for (size_t i = 0; i < dots; i++) + { + const float sina = ImSin((start + (IM_PI - i * offset)) * heightSpeed); + const float sinb = ImSin((start + (IM_PI + IM_PI * offset_k - i * offset)) * heightSpeed); + const float y = ImMin(centre.y + sina * hradius, centre.y); + const float y2 = ImMin(sinb, 0.f) * (hradius * offset_k); + const float y3 = (y + y2); + const float deltay = ImAbs(y - centre.y); + ImColor c = color_alpha(ImColor::HSV(out_h + i * ((1.f / dots) * 2.f), out_s, out_v), 1.f); + ImVec2 p1(centre.x - hsize + i * (thickness * nextItemKoeff), y3); + ImVec2 p2(centre.x - hsize + i * (thickness * nextItemKoeff), y3 + 2 * deltay); + window->DrawList->AddCircleFilled(p1, thickness, c, 8); + window->DrawList->AddCircleFilled(p2, thickness, c, 8); + window->DrawList->AddLine(p1, p2, c, thickness * 2.f); + } + } + + inline void SpinnerWaveDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int lt = 8) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float nextItemKoeff = 2.5f; + const float dots = (size.x / (thickness * nextItemKoeff)); + const float offset = PI_DIV(dots); + const float start = (float)ImGui::GetTime() * speed; + + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + for (size_t i = 0; i < dots; i++) + { + float a = start + (IM_PI - i * offset); + float y = centre.y + ImSin(a) * (size.y / 2.f); + ImColor c = ImColor::HSV(out_h + i * (1.f / dots * 2.f), out_s, out_v); + window->DrawList->AddCircleFilled(ImVec2(centre.x - (size.x / 2.f) + i * thickness * nextItemKoeff, y), thickness, color_alpha(c, 1.f), lt); + } + } + + inline void SpinnerFadeDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int lt = 8, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime() * speed; + const float nextItemKoeff = 2.5f; + const float dots = (size.x / (thickness * nextItemKoeff)); + const float heightSpeed = 0.8f; + + for (size_t i = 0; i < dots; i++) + { + float a = mode + ? damped_spring(1, 10.f, 1.0f, ImSin(ImFmod(start + (IM_PI - i * (IM_PI / dots)), PI_2))) + : ImSin(start + (IM_PI - i * (IM_PI / dots)) * heightSpeed); + window->DrawList->AddCircleFilled(ImVec2(centre.x - (size.x / 2.f) + i * thickness * nextItemKoeff, centre.y), thickness, color_alpha(color, ImMax(0.1f, a)), lt); + } + } + + inline void SpinnerThreeDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int lt = 8) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + const float nextItemKoeff = 2.5f; + const float offset = size.x / 4.f; + + float ab = start; + int msize = 2; + if (start < IM_PI) { ab = 0; msize = 1; } + for (size_t i = 0; i < msize; i++) + { + float a = ab + i * IM_PI - PI_DIV_2; + window->DrawList->AddCircleFilled(ImVec2(centre.x - offset + ImSin(a) * offset, centre.y + ImCos(a) * offset), thickness, color_alpha(color, 1.f), lt); + } + + float ba = start; msize = 2; + if (start > IM_PI && start < PI_2) { ba = 0; msize = 1; } + for (size_t i = 0; i < msize; i++) + { + float a = -ba + i * IM_PI + PI_DIV_2; + window->DrawList->AddCircleFilled(ImVec2(centre.x + offset + ImSin(a) * offset, centre.y + ImCos(a) * offset), thickness, color_alpha(color, 1.f), lt); + } + } + + inline void SpinnerFiveDots(const char *label, float radius, float thickness, const ImColor &color = 0xffffffff, float speed = 2.8f, int lt = 8) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2 * 2); + const float nextItemKoeff = 2.5f; + const float offset = size.x / 4.f; + + float ab = 0; + int msize = 1; + if (start < IM_PI) { ab = start; msize = 2; } + for (size_t i = 0; i < msize; i++) + { + float a = -ab + i * IM_PI - PI_DIV_2; + window->DrawList->AddCircleFilled(ImVec2(centre.x - offset + ImSin(a) * offset, centre.y + ImCos(a) * offset), thickness, color_alpha(color, 1.f), lt); + } + + float ba = 0; msize = 1; + if (start > IM_PI && start < PI_2) { ba = start; msize = 2; } + for (size_t i = 0; i < msize; i++) + { + float a = -ba + i * IM_PI; + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImSin(a) * offset, centre.y + offset + ImCos(a) * offset), thickness, color_alpha(color, 1.f), lt); + } + + float bc = 0; msize = 1; + if (start > PI_2 && start < IM_PI * 3) { bc = start; msize = 2; } + for (size_t i = 0; i < msize; i++) + { + float a = -bc + i * IM_PI - IM_PI; + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImSin(a) * offset, centre.y - offset + ImCos(a) * offset), thickness, color_alpha(color, 1.f), lt); + } + + float bd = 0; msize = 1; + if (start > IM_PI * 3 && start < IM_PI * 4) { bd = start; msize = 2; } + for (size_t i = 0; i < msize; i++) + { + float a = -bd + i * IM_PI + PI_DIV_2; + window->DrawList->AddCircleFilled(ImVec2(centre.x + offset + ImSin(a) * offset, centre.y + ImCos(a) * offset), thickness, color_alpha(color, 1.f), lt); + } + } + + inline void Spinner4Caleidospcope(const char *label, float radius, float thickness, const ImColor &color = 0xffffffff, float speed = 2.8f, int lt = 8) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + const float nextItemKoeff = 2.5f; + const float offset = size.x / 4.f; + + float ab = start; + int msize = 2; + + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + for (size_t i = 0; i < msize; i++) + { + float a = ab - i * IM_PI; + ImColor c = color_alpha(ImColor::HSV(out_h + (0.1f * i), out_s, out_v, 0.7f), 1.f); + window->DrawList->AddCircleFilled(ImVec2(centre.x - offset + ImSin(a) * offset, centre.y + ImCos(a) * offset), thickness, c, lt); + } + + for (size_t i = 0; i < msize; i++) + { + float a = ab + i * IM_PI + PI_DIV_2; + ImColor c = color_alpha(ImColor::HSV(out_h + 0.2f + (0.1f * i), out_s, out_v, 0.7f), 1.f); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImSin(a) * offset, centre.y - offset + ImCos(a) * offset), thickness, c, lt); + } + + float ba = start; msize = 2; + for (size_t i = 0; i < msize; i++) + { + float a = -ba + i * IM_PI + PI_DIV_2; + ImColor c = color_alpha(ImColor::HSV(out_h + 0.4f + (0.1f * i), out_s, out_v, 0.7f), 1.f); + window->DrawList->AddCircleFilled(ImVec2(centre.x + offset + ImSin(a) * offset, centre.y + ImCos(a) * offset), thickness, c, lt); + } + + for (size_t i = 0; i < msize; i++) + { + float a = ab - i * IM_PI + PI_DIV_4; + ImColor c = color_alpha(ImColor::HSV(out_h + 0.6f + (0.1f * i), out_s, out_v, 0.7f), 1.f); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImSin(a) * offset, centre.y + offset + ImCos(a) * offset), thickness, c, lt); + } + } + + inline void SpinnerMultiFadeDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int lt = 8) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime() * speed; + const float nextItemKoeff = 2.5f; + const float dots = (size.x / (thickness * nextItemKoeff)); + const float heightSpeed = 0.8f; + + for (size_t j = 0; j < dots; j++) + { + for (size_t i = 0; i < dots; i++) + { + float a = start - (IM_PI - i * j * PI_DIV(dots)); + window->DrawList->AddCircleFilled(ImVec2(centre.x - (size.x / 2.f) + i * thickness * nextItemKoeff, centre.y - (size.y / 2.f) + j * thickness * nextItemKoeff), thickness, color_alpha(color, ImMax(0.1f, ImSin(a * heightSpeed))), lt); + } + } + } + + inline void SpinnerThickToSin(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int nt = 1, int lt = 8, int mode = 0) { + SPINNER_HEADER(pos, size, centre, num_segments); + + float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + float length = ImFmod(start, IM_PI); + const float dangle = ImSin(length) * IM_PI * 0.5f; + const float angle_offset = IM_PI / (lt * 2); + + auto draw_spring = [&] (float k, float r) { + float arc = 0.f; + size_t i = 0; + for (; i < (lt * 2); i++) { + float a = start + (i * angle_offset); + a += ease((ease_mode)mode, a, dangle); + if (ImSin(a) < 0.f) + a *= -1; + arc += angle_offset; + if (arc > dangle) + break; + float th = thickness * (2 * fabs(ImCos(start))); + th = ImMax(th, 1.f); + + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(a) * r, centre.y + k * ImSin(a) * r), th, color_alpha(color, 1.f), 8); + } + }; + + for (int num_ring = 0; num_ring < nt; ++num_ring) { + draw_spring(-1 - num_ring * 0.1, radius * (1 - 0.1 * num_ring)); + } + } + + + inline void SpinnerScaleDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int lt = 8) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float nextItemKoeff = 2.5f; + const float heightSpeed = 0.8f; + const float dots = (size.x / (thickness * nextItemKoeff)); + const float start = (float)ImGui::GetTime() * speed; + + for (size_t i = 0; i < dots; i++) + { + const float a = start + (IM_PI - i * PI_DIV(dots)); + const float th = thickness * ImSin(a * heightSpeed); + window->DrawList->AddCircleFilled(ImVec2(centre.x - (size.x / 2.f) + i * thickness * nextItemKoeff, centre.y), thickness, color_alpha(color, 0.1f), lt); + window->DrawList->AddCircleFilled(ImVec2(centre.x - (size.x / 2.f) + i * thickness * nextItemKoeff, centre.y), th, color_alpha(color, 1.f), lt); + } + } + + inline void SpinnerSquareSpins(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float nextItemKoeff = 2.5f; + const float heightSpeed = 0.8f; + const float dots = (size.x / (thickness * nextItemKoeff)); + const float start = (float)ImGui::GetTime() * speed; + + for (size_t i = 0; i < dots; i++) + { + const float a = ImFmod(start + i * ((PI_DIV_2 * 0.7f) / dots), PI_DIV_2); + const float th = thickness * (ImCos(a * heightSpeed) * 2.f); + ImVec2 pmin = ImVec2(centre.x - (size.x / 2.f) + i * thickness * nextItemKoeff - thickness, centre.y - thickness); + ImVec2 pmax = ImVec2(centre.x - (size.x / 2.f) + i * thickness * nextItemKoeff + thickness, centre.y + thickness); + window->DrawList->AddRect(pmin, pmax, color_alpha(color, 1.f), 0.f); + ImVec2 lmin = ImVec2(centre.x - (size.x / 2.f) + i * thickness * nextItemKoeff - thickness, centre.y - th + thickness); + ImVec2 lmax = ImVec2(centre.x - (size.x / 2.f) + i * thickness * nextItemKoeff + thickness - 1, centre.y - th + thickness); + window->DrawList->AddLine(lmin, lmax, color_alpha(color, 1.f), 1.f); + } + } + + inline void SpinnerMovingDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t dots = 3) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float nextItemKoeff = 2.5f; + const float heightKoeff = 2.f; + const float heightSpeed = 0.8f; + const float start = ImFmod((float)ImGui::GetTime() * speed, size.x); + + float offset = 0; + for (size_t i = 0; i < dots; i++) + { + float th = thickness; + offset = ImFmod(start + i * (size.x / dots), size.x); + + if (offset < thickness) { th = offset; } + if (offset > size.x - thickness) { th = size.x - offset; } + + window->DrawList->AddCircleFilled(ImVec2(pos.x + offset - thickness, centre.y), th, color_alpha(color, 1.f), 8); + } + } + + inline void SpinnerRotateDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int dots = 2, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + ImGuiStorage* storage = window->DC.StateStorage; + const ImGuiID velocityId = window->GetID("##velocity"); + const ImGuiID vtimeId = window->GetID("##velocitytime"); + + float velocity = storage->GetFloat(velocityId, 0.f); + float vtime = storage->GetFloat(vtimeId, 0.f); + + float dtime = ImFmod((float)vtime, IM_PI); + float start = (vtime += velocity); + if (dtime > 0.f && dtime < PI_DIV_2) { velocity += 0.001f * speed; } + else if (dtime > IM_PI * 0.9f && dtime < IM_PI) { velocity -= 0.01f * speed; } + if (velocity > 0.1f) velocity = 0.1f; + if (velocity < 0.01f) velocity = 0.01f; + + storage->SetFloat(velocityId, velocity); + storage->SetFloat(vtimeId, vtime); + + window->DrawList->AddCircleFilled(centre, thickness, color_alpha(color, 1.f), 8); + + for (int i = 0; i < dots; i++) + { + float a = 0.f; + switch (mode) { + case 1: a = start + i * PI_2_DIV(dots) + damped_spring(1, 10.f, 1.0f, ImSin(start + i * PI_2_DIV(dots)), PI_2_DIV(dots), 0); break; + case 2: a = start + i * PI_2_DIV(dots) + damped_infinity(start + i * PI_DIV(dots * 2), 1.f).second; break; + default: + a = start + (i * PI_2_DIV(dots)); + } + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(a) * radius, centre.y + ImSin(a) * radius), thickness, color_alpha(color, 1.f), 8); + } + + if (mode == 3) { + float sm_thickness = thickness * 0.5f; + const float bstart = (float)ImGui::GetTime() * speed; + for (size_t i = 0; i < dots; i++) + { + const float b = bstart + (IM_PI - i * PI_DIV(dots) * 2.f); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(b) * radius, centre.y + ImSin(b) * radius), sm_thickness, color_alpha(color, 1.f), 8); + } + } + } + + inline void SpinnerOrionDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int arcs = 4) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + ImGuiStorage* storage = window->DC.StateStorage; + const ImGuiID velocityId = window->GetID("##velocity"); + const ImGuiID vtimeId = window->GetID("##velocitytime"); + + float velocity = storage->GetFloat(velocityId, 0.f); + float vtime = storage->GetFloat(vtimeId, 0.f); + + float dtime = ImFmod((float)vtime, IM_PI); + float start = (vtime += velocity); + if (dtime > 0.f && dtime < PI_DIV_2) { velocity += 0.001f * speed; } + else if (dtime > IM_PI * 0.9f && dtime < IM_PI) { velocity -= 0.01f * speed; } + + if (velocity > 0.1f) velocity = 0.1f; + if (velocity < 0.01f) velocity = 0.01f; + + storage->SetFloat(velocityId, velocity); + storage->SetFloat(vtimeId, vtime); + + window->DrawList->AddCircleFilled(centre, thickness, color_alpha(color, 1.f), 8); + + for (int j = 1; j < arcs; ++j) { + const float r = (radius / (arcs + 1)) * j; + for (int i = 0; i < j + 1; i++) + { + const float a = start + (i * PI_2_DIV(j+1)); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(a) * r, centre.y + ImSin(a) * r), thickness, color_alpha(color, 1.f), 8); + } + } + } + + inline void SpinnerGalaxyDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int arcs = 4) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + ImGuiStorage* storage = window->DC.StateStorage; + const ImGuiID velocityId = window->GetID("##velocity"); + const ImGuiID vtimeId = window->GetID("##velocitytime"); + + float velocity = storage->GetFloat(velocityId, 0.f); + float vtime = storage->GetFloat(vtimeId, 0.f); + + float dtime = ImFmod((float)vtime, IM_PI); + float start = (vtime += (velocity * speed)); + if (dtime > 0.f && dtime < PI_DIV_2) { velocity += 0.001f; } + else if (dtime > IM_PI * 0.9f && dtime < IM_PI) { velocity -= 0.01f; } + + if (velocity > 0.1f) velocity = 0.1f; + if (velocity < 0.01f) velocity = 0.01f; + + storage->SetFloat(velocityId, velocity); + storage->SetFloat(vtimeId, vtime); + + window->DrawList->AddCircleFilled(centre, thickness, color_alpha(color, 1.f), 8); + + for (int j = 1; j < arcs; ++j) { + const float r = ((j / (float)arcs) * radius); + for (int i = 0; i < arcs; i++) + { + const float a = start * (1.f + j * 0.1f) + (i * PI_2_DIV(arcs)); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(a) * r, centre.y + ImSin(a) * r), thickness, color_alpha(color, 1.f), 8); + } + } + } + + inline void SpinnerTwinAng(const char *label, float radius1, float radius2, float thickness, const ImColor &color1 = white, const ImColor &color2 = red, float speed = 2.8f, float angle = IM_PI, int mode = 0) + { + const float radius = ImMax(radius1, radius2); + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + const float aoffset = ImFmod((float)ImGui::GetTime(), 1.5f * IM_PI); + const float bofsset = (aoffset > angle) ? angle : aoffset; + const float angle_offset = angle * 2.f / num_segments; + + window->DrawList->PathClear(); + for (size_t i = 0; i <= 2 * num_segments; i++) + { + float b = ease((ease_mode)mode, start + i * PI_DIV(2) / num_segments, IM_PI, 1.0f, 0.0f); + const float a = start + b + (i * angle_offset); + if (i * angle_offset > 2 * bofsset) + break; + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * radius1, centre.y + ImSin(a) * radius1)); + } + window->DrawList->PathStroke(color_alpha(color1, 1.f), false, thickness); + + window->DrawList->PathClear(); + for (size_t i = 0; i < num_segments / 2; i++) + { + float b = ease((ease_mode)mode, start + i * PI_DIV(2) / num_segments, IM_PI, 1.0f, 0.0f); + const float a = start - b + (i * angle_offset); + if (i * angle_offset > bofsset) + break; + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * radius2, centre.y + ImSin(a) * radius2)); + } + window->DrawList->PathStroke(color_alpha(color2, 1.f), false, thickness); + } + + inline void SpinnerFilling(const char *label, float radius, float thickness, const ImColor &color1 = white, const ImColor &color2 = red, float speed = 2.8f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + const float angle_offset = PI_2_DIV(num_segments - 1); + + circle([&] (int i) { + const float a = (i * angle_offset); + return ImVec2(ImCos(a) * radius, ImSin(a) * radius); + }, color_alpha(color1, 1.f), thickness); + + window->DrawList->PathClear(); + for (size_t i = 0; i < 2 * num_segments / 2; i++) + { + const float a = (i * angle_offset); + if (a > start) + break; + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * radius, centre.y + ImSin(a) * radius)); + } + window->DrawList->PathStroke(color_alpha(color2, 1.f), false, thickness); + } + + inline void SpinnerFillingMem(const char *label, float radius, float thickness, const ImColor &color, ImColor &colorbg, float speed) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + const float angle_offset = PI_2_DIV(num_segments - 1); + num_segments *= 4; + + circle([&] (int i) { + const float a = (i * angle_offset); + return ImVec2(ImCos(a) * radius, ImSin(a) * radius); + }, color_alpha(colorbg, 1.f), thickness); + + if (start < 0.02f) { + colorbg = color; + } + + window->DrawList->PathClear(); + for (size_t i = 0; i < 2 * num_segments / 2; i++) { + const float a = (i * angle_offset); + if (a > start) + break; + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * radius, centre.y + ImSin(a) * radius)); + } + window->DrawList->PathStroke(color_alpha(color, 1.f), false, thickness); + } + + inline void SpinnerTopup(const char *label, float radius1, float radius2, const ImColor &color = red, const ImColor &fg = white, const ImColor &bg = white, float speed = 2.8f) + { + const float radius = ImMax(radius1, radius2); + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, IM_PI); + window->DrawList->AddCircleFilled(centre, radius1, color_alpha(bg, 1.f), num_segments); + + const float abegin = (PI_DIV_2) - start; + const float aend = (PI_DIV_2) + start; + const float angle_offset = (aend - abegin) / num_segments; + + window->DrawList->PathClear(); + window->DrawList->PathArcTo(centre, radius1, abegin, aend, num_segments * 2); + + ImDrawListFlags save = window->DrawList->Flags; + window->DrawList->Flags &= ~ImDrawListFlags_AntiAliasedFill; + + window->DrawList->PathFillConvex(color_alpha(color, 1.f)); + + window->DrawList->AddCircleFilled(centre, radius2, color_alpha(fg, 1.f), num_segments); + + window->DrawList->Flags = save; + } + + inline void SpinnerTwinAng180(const char *label, float radius1, float radius2, float thickness, const ImColor &color1 = white, const ImColor &color2 = red, float speed = 2.8f, float angle = PI_DIV_4, int mode = 0) + { + const float radius = ImMax(radius1, radius2); + SPINNER_HEADER(pos, size, centre, num_segments); + + num_segments *= 8; + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + const float aoffset = ImFmod((float)ImGui::GetTime(), PI_2); + const float bofsset = (aoffset > IM_PI) ? IM_PI : aoffset; + const float angle_offset = PI_2_DIV(num_segments); + float ared_min = 0, ared = 0; + if (aoffset > IM_PI) + ared_min = aoffset - IM_PI; + + window->DrawList->PathClear(); + auto radiusmode = [mode] (float a, float r, float f) { switch (mode) { case 2: return damped_trifolium(a, 0.f, f) * r; } return r; }; + for (size_t i = 0; i <= num_segments / 2 + 1; i++) + { + ared = start + (i * angle_offset); + switch (mode) { + case 1: ared += damped_infinity(start, angle).second; break; + } + + if (i * angle_offset < ared_min) + continue; + + if (i * angle_offset > bofsset) + break; + + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(ared) * radiusmode(ared, radius2, -1.1f), centre.y + ImSin(ared) * radiusmode(ared, radius2, -1.1f))); + } + window->DrawList->PathStroke(color_alpha(color2, 1.f), false, thickness); + + window->DrawList->PathClear(); + for (size_t i = 0; i <= 2 * num_segments + 1; i++) + { + const float a = ared + ared_min + (i * angle_offset); + if (i * angle_offset < ared_min) + continue; + + if (i * angle_offset > bofsset) + break; + + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * radiusmode(a, radius1, 1.f), centre.y + ImSin(a) * radiusmode(a, radius1, 1.f))); + } + window->DrawList->PathStroke(color_alpha(color1, 1.f), false, thickness); + } + + inline void SpinnerTwinAng360(const char *label, float radius1, float radius2, float thickness, const ImColor &color1 = white, const ImColor &color2 = red, float speed1 = 2.8f, float speed2 = 2.5f, int mode = 0) + { + const float radius = ImMax(radius1, radius2); + SPINNER_HEADER(pos, size, centre, num_segments); + + num_segments *= 4; + float start1 = ImFmod((float)ImGui::GetTime() * speed1, PI_2); + float start2 = ImFmod((float)ImGui::GetTime() * speed2, PI_2); + const float aoffset = ImFmod((float)ImGui::GetTime(), 2.f * IM_PI); + const float bofsset = (aoffset > IM_PI) ? IM_PI : aoffset; + const float angle_offset = PI_2 / num_segments; + float ared_min = 0, ared = 0; + if (aoffset > IM_PI) + ared_min = aoffset - IM_PI; + + window->DrawList->PathClear(); + for (size_t i = 0; i <= num_segments + 1; i++) { + ared = ( mode ? damped_spring(1, 10.f, 1.0f, ImSin(ImFmod(start1 + 0 * PI_DIV(2), PI_2))) : start1) + (i * angle_offset); + if (i * angle_offset < ared_min * 2) continue; + if (i * angle_offset > bofsset * 2.f) break; + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(ared) * radius2, centre.y + ImSin(ared) * radius2)); + } + window->DrawList->PathStroke(color_alpha(color2, 1.f), false, thickness); + + window->DrawList->PathClear(); + for (size_t i = 0; i <= num_segments + 1; i++) { + ared = (mode ? damped_spring(1, 10.f, 1.0f, ImSin(ImFmod(start2 + 1 * PI_DIV(2), PI_2))) : start2) + (i * angle_offset); + if (i * angle_offset < ared_min * 2) continue; + if (i * angle_offset > bofsset * 2.f) break; + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(-ared) * radius1, centre.y + ImSin(-ared) * radius1)); + } + window->DrawList->PathStroke(color_alpha(color1, 1.f), false, thickness); + } + + inline void SpinnerIncDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t dots = 6) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float start = (float)ImGui::GetTime() * speed; + float astart = ImFmod(start, PI_DIV(dots)); + start -= astart; + dots = ImMin(dots, 32); + + for (size_t i = 0; i <= dots; i++) + { + float a = start + (i * PI_DIV(dots - 1)); + ImColor c = color_alpha(color, ImMax(0.1f, i / (float)dots)); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(a) * radius, centre.y + ImSin(a) * radius), thickness, c, 8); + } + } + + inline void SpinnerIncFullDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t dots = 4) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + dots = ImMin(dots, 32); + float start = (float)ImGui::GetTime() * speed; + float astart = ImFmod(start, IM_PI / dots); + start -= astart; + const float bg_angle_offset = IM_PI / dots; + + for (size_t i = 0; i < dots * 2; i++) + { + float a = start + (i * bg_angle_offset); + ImColor c = color_alpha(color, 0.1f); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(a) * radius, centre.y + ImSin(a) * radius), thickness, c, 8); + } + + for (size_t i = 0; i < dots; i++) + { + float a = start + (i * bg_angle_offset); + ImColor c = color_alpha(color, ImMax(0.1f, i / (float)dots)); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(a) * radius, centre.y + ImSin(a) * radius), thickness, c, 8); + } + } + + inline void SpinnerFadeBars(const char *label, float w, const ImColor &color = white, float speed = 2.8f, size_t bars = 3, bool scale = false) + { + float radius = (w * 0.5f) * bars; + SPINNER_HEADER(pos, size, centre, num_segments); + + ImGuiContext &g = *GImGui; + const ImGuiStyle &style = g.Style; + const float nextItemKoeff = 1.5f; + const float yOffsetKoeftt = 0.8f; + const float heightSpeed = 0.8f; + const float start = (float)ImGui::GetTime() * speed; + + const float offset = IM_PI / bars; + for (size_t i = 0; i < bars; i++) + { + float a = start + (IM_PI - i * offset); + ImColor c = color_alpha(color, ImMax(0.1f, ImSin(a * heightSpeed))); + float h = (scale ? (0.6f + 0.4f * c.Value.w) : 1.f) * size.y / 2; + window->DrawList->AddRectFilled(ImVec2(pos.x + style.FramePadding.x + i * (w * nextItemKoeff) - w / 2, centre.y - h * yOffsetKoeftt), + ImVec2(pos.x + style.FramePadding.x + i * (w * nextItemKoeff) + w / 2, centre.y + h * yOffsetKoeftt), c); + } + } + + inline void SpinnerFadeTris(const char *label, float radius, const ImColor &color = white, float speed = 2.8f, size_t dim = 2, bool scale = false, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + ImGuiContext &g = *GImGui; + const ImGuiStyle &style = g.Style; + const float nextItemKoeff = 1.5f; + const float yOffsetKoeftt = 0.8f; + const float heightSpeed = 0.8f; + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + + std::vector points; + auto pushPoints = [] (std::vector &pp, const ImVec2 &p1, const ImVec2 &p2, const ImVec2 &p3) { pp.push_back(p1); pp.push_back(p2); pp.push_back(p3); }; + auto hsumPoints = [] (const ImVec2 &p1, const ImVec2 &p2) { return ImVec2((p1.x + p2.x) / 2.f, (p1.y + p2.y) / 2.f); }; + + auto splitTriangle = [&] (const ImVec2 &p1, const ImVec2 &p2, const ImVec2 &p3, int numDivisions) { + pushPoints(points, p1, p2, p3); + + for (int i = 0; i < numDivisions; i++) { + std::vector newPoints; + for (int j = 0; j < points.size() - 2; j += 3) { + ImVec2 p1 = points[j]; + ImVec2 p2 = points[j + 1]; + ImVec2 p3 = points[j + 2]; + + ImVec2 p4((p1.x + p2.x) / 2, (p1.y + p2.y) / 2); + ImVec2 p5((p2.x + p3.x) / 2, (p2.y + p3.y) / 2); + ImVec2 p6((p3.x + p1.x) / 2, (p3.y + p1.y) / 2); + + pushPoints(newPoints, p1, p4, p6); + pushPoints(newPoints, p4, p5, p6); + pushPoints(newPoints, p4, p2, p5); + pushPoints(newPoints, p6, p5, p3); + } + points = newPoints; + } + + return points; + }; + + auto calculateAngle = [] (ImVec2 v1, ImVec2 v2, const ImVec2 c) { + v1.x -= c.x; v1.y -= c.y; v2.x -= c.x; v2.y -= c.y; + float dotProduct = v1.x * v2.x + v1.y * v2.y; + float magnitudeV1 = ImSqrt(v1.x * v1.x + v1.y * v1.y); + float magnitudeV2 = ImSqrt(v2.x * v2.x + v2.y * v2.y); + float angleInRadians = ImAcos(dotProduct / (magnitudeV1 * magnitudeV2)); + float crossProduct = v1.x * v2.y - v2.x * v1.y; + float signedAngle = std::copysign(angleInRadians, crossProduct); + return fmod(signedAngle + PI_2, PI_2); + }; + + const float offset = IM_PI / dim; + ImVec2 p1 = ImVec2(centre.x + ImSin(0) * radius, centre.y + ImCos(0) * radius); + ImVec2 p2 = ImVec2(centre.x + ImSin(PI_DIV(3) * 2) * radius, centre.y + ImCos(PI_DIV(3) * 2) * radius); + ImVec2 p3 = ImVec2(centre.x + ImSin(PI_DIV(3) * 4) * radius, centre.y + ImCos(PI_DIV(3) * 4) * radius); + std::vector subdividedPoints = splitTriangle(p1, p2, p3, dim); + for (size_t i = 0; i < subdividedPoints.size(); i+=3) { + ImVec2 trisCenter = hsumPoints(hsumPoints(subdividedPoints[i], subdividedPoints[i + 1]), subdividedPoints[i + 2]); + const float angle = calculateAngle(p1, trisCenter, centre); + ImColor c = color_alpha(color, 1.f - ImMax(0.1f, ImFmod(start + angle, PI_2) / PI_2)); + window->DrawList->AddTriangleFilled(subdividedPoints[i], subdividedPoints[i+1], subdividedPoints[i+2], c); + } + } + + inline void SpinnerBarsRotateFade(const char *label, float rmin, float rmax , float thickness, const ImColor &color = white, float speed = 2.8f, size_t bars = 6) + { + float radius = rmax; + SPINNER_HEADER(pos, size, centre, num_segments); + + float start = (float)ImGui::GetTime() * speed; + float astart = ImFmod(start, IM_PI / bars); + start -= astart; + const float bg_angle_offset = IM_PI / bars; + bars = ImMin(bars, 32); + + for (size_t i = 0; i <= bars; i++) + { + float a = start + (i * bg_angle_offset); + ImColor c = color_alpha(color, ImMax(0.1f, i / (float)bars)); + window->DrawList->AddLine(ImVec2(centre.x + ImCos(a) * rmin, centre.y + ImSin(a) * rmin), ImVec2(centre.x + ImCos(a) * rmax, centre.y + ImSin(a) * rmax), c, thickness); + } + } + + inline void SpinnerBarsScaleMiddle(const char *label, float w, const ImColor &color = white, float speed = 2.8f, size_t bars = 3) + { + float radius = (w) * bars; + SPINNER_HEADER(pos, size, centre, num_segments); + + ImGuiContext &g = *GImGui; + const ImGuiStyle &style = g.Style; + const float nextItemKoeff = 1.5f; + const float yOffsetKoeftt = 0.8f; + const float heightSpeed = 0.8f; + float start = (float)ImGui::GetTime() * speed; + const float offset = IM_PI / bars; + + for (size_t i = 0; i < bars; i++) + { + float a = start + (IM_PI - i * offset); + float h = (0.4f + 0.6f * ImMax(0.1f, ImSin(a * heightSpeed))) * (size.y / 2); + window->DrawList->AddRectFilled(ImVec2(centre.x + style.FramePadding.x + i * (w * nextItemKoeff) - w / 2, centre.y - h * yOffsetKoeftt), + ImVec2(centre.x + style.FramePadding.x + i * (w * nextItemKoeff) + w / 2, centre.y + h * yOffsetKoeftt), color_alpha(color, 1.f)); + if (i == 0) + continue; + + window->DrawList->AddRectFilled(ImVec2(centre.x + style.FramePadding.x - i * (w * nextItemKoeff) - w / 2, centre.y - h * yOffsetKoeftt), + ImVec2(centre.x + style.FramePadding.x - i * (w * nextItemKoeff) + w / 2, centre.y + h * yOffsetKoeftt), color_alpha(color, 1.f)); + } + } + + inline void SpinnerAngTwin(const char *label, float radius1, float radius2, float thickness, const ImColor &color = white, const ImColor &bg = half_white, float speed = 2.8f, float angle = IM_PI, size_t arcs = 1, int mode = 0) + { + float radius = ImMax(radius1, radius2); + SPINNER_HEADER(pos, size, centre, num_segments); + + float start = (float)ImGui::GetTime()* speed; + const float bg_angle_offset = PI_2 / num_segments; + + window->DrawList->PathClear(); + for (size_t i = 0; i <= num_segments; i++) { + const float a = start + (i * bg_angle_offset); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * radius1, centre.y + ImSin(a) * radius1)); + } + window->DrawList->PathStroke(color_alpha(bg, 1.f), false, thickness); + + const float angle_offset = angle / num_segments; + for (size_t arc_num = 0; arc_num < arcs; ++arc_num) { + window->DrawList->PathClear(); + float arc_start = 2 * IM_PI / arcs; + float b = ease((ease_mode)mode, start + arc_num * PI_DIV(2) / arcs, IM_PI, 1.0f, 0.0f); + //switch (mode) { + //case 1: b = start + damped_spring(1, 10.f, 1.0f, , )), 1, 0); break; + //case 2: b = start + damped_infinity(PI_2 - angle, start).second; break; + //default: b = start; + //} + + for (size_t i = 0; i < num_segments; i++) { + const float a = start + b + arc_start * arc_num + (i * angle_offset); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * radius2, centre.y + ImSin(a) * radius2)); + } + window->DrawList->PathStroke(color_alpha(color, 1.f), false, thickness); + } + } + + inline void SpinnerArcRotation(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime()* speed; + const float arc_angle = PI_2 / (float)arcs; + const float angle_offset = arc_angle / num_segments; + + for (size_t arc_num = 0; arc_num < arcs; ++arc_num) { + window->DrawList->PathClear(); + ImColor c = color_alpha(color, ImMax(0.1f, arc_num / (float)arcs)); + float b = ease((ease_mode)mode, start + arc_num * PI_DIV(2) / arcs, IM_PI, 1.0f, 0.0f); + for (size_t i = 0; i <= num_segments; i++) { + const float a = start + b + arc_angle * arc_num + (i * angle_offset); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * radius, centre.y + ImSin(a) * radius)); + } + window->DrawList->PathStroke(c, false, thickness); + } + } + + inline void SpinnerArcFade(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime()* speed, IM_PI * 4.f); + const float arc_angle = PI_2 / (float)arcs; + const float angle_offset = arc_angle / num_segments; + + for (size_t arc_num = 0; arc_num < arcs; ++arc_num) + { + window->DrawList->PathClear(); + for (size_t i = 0; i <= num_segments + 1; i++) + { + const float a = arc_angle * arc_num + (i * angle_offset) - PI_DIV_2 - PI_DIV_4; + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * radius, centre.y + ImSin(a) * radius)); + } + const float a = arc_angle * arc_num; + ImColor c = color; + if (start < PI_2) { + c.Value.w = 0.f; + if (start > a && start < (a + arc_angle)) { c.Value.w = 1.f - (start - a) / (float)arc_angle; } + else if (start < a) { c.Value.w = 1.f; } + float woff = ease((ease_mode)mode, start - a, 4.f); + c.Value.w = ImMax(0.05f, 1.f - c.Value.w - woff); + } else { + const float startk = start - PI_2; + c.Value.w = 0.f; + if (startk > a && startk < (a + arc_angle)) { c.Value.w = 1.f - (startk - a) / (float)arc_angle; } + else if (startk < a) { c.Value.w = 1.f; } + float woff = ease((ease_mode)mode, start - a, 4.f); + c.Value.w = ImMax(0.05f, c.Value.w + woff); + } + + window->DrawList->PathStroke(color_alpha(c, 1.f), false, thickness); + } + } + + inline void SpinnerSimpleArcFade(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, IM_PI * 4.f); + const float arc_angle = PI_2 / (float)4; + const float angle_offset = arc_angle / num_segments; + + auto draw_segment = [&] (int arc_num, float delta, auto c, float k, float t) { + window->DrawList->PathClear(); + for (size_t i = 0; i <= num_segments + 1; i++) { + const float a = t * start + arc_angle * arc_num + (i * angle_offset) - PI_DIV_2 - PI_DIV_4 + delta; + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * radius * k, centre.y + ImSin(a) * radius * k)); + } + window->DrawList->PathStroke(color_alpha(c, 1.f), false, thickness); + }; + + for (size_t arc_num = 0; arc_num < 2; ++arc_num) { + const float a = arc_angle * arc_num; + ImColor c = color; + if (start < PI_2) { + c.Value.w = 0.f; + if (start > a && start < (a + arc_angle)) { c.Value.w = 1.f - (start - a) / (float)arc_angle; } + else if (start < a) { c.Value.w = 1.f; } + c.Value.w = ImMax(0.05f, 1.f - c.Value.w); + } else { + const float startk = start - PI_2; + c.Value.w = 0.f; + if (startk > a && startk < (a + arc_angle)) { c.Value.w = 1.f - (startk - a) / (float)arc_angle; } + else if (startk < a) { c.Value.w = 1.f; } + c.Value.w = ImMax(0.05f, c.Value.w); + } + + draw_segment(arc_num, 0.f, c, 1.f + arc_num * 0.3f, arc_num > 0 ? -1 : 1); + draw_segment(arc_num, IM_PI, c, 1.f + arc_num * 0.3f, arc_num > 0 ? -1 : 1); + } + } + + inline void SpinnerSquareStrokeFade(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, IM_PI * 4.f); + const float arc_angle = PI_DIV_2; + const float ht = thickness / 2.f; + + for (size_t arc_num = 0; arc_num < 4; ++arc_num) + { + float a = arc_angle * arc_num; + ImColor c = color_alpha(color, 1.f); + if (start < PI_2) { + c.Value.w = (start > a && start < (a + arc_angle)) + ? 1.f - (start - a) / (float)arc_angle + : (start < a ? 1.f : 0.f); + c.Value.w = ImMax(0.05f, 1.f - c.Value.w); + } else { + const float startk = start - PI_2; + c.Value.w = (startk > a && startk < (a + arc_angle)) + ? 1.f - (startk - a) / (float)arc_angle + : (startk < a ? 1.f : 0.f); + c.Value.w = ImMax(0.05f, c.Value.w); + } + a -= PI_DIV_4; + const float r = radius * 1.4f; + const bool right = ImSin(a) > 0; + const bool top = ImCos(a) < 0; + ImVec2 p1(centre.x + ImCos(a) * r, centre.y + ImSin(a) * r); + ImVec2 p2(centre.x + ImCos(a - PI_DIV_2) * r, centre.y + ImSin(a - PI_DIV_2) * r); + switch (arc_num) { + case 0: p1.x -= ht; p2.x -= ht; break; + case 1: p1.y -= ht; p2.y -= ht; break; + case 2: p1.x += ht; p2.x += ht; break; + case 3: p1.y += ht; p2.y += ht; break; + } + window->DrawList->AddLine(p1, p2, color_alpha(c, 1.f), thickness); + } + } + +#if IMGUI_VERSION_NUM < 19197 + #define IMSPINNER_FIND_GLYPH(x) Font->FindGlyph(x) +#else + #define IMSPINNER_FIND_GLYPH(x) FontBaked->FindGlyph(x) +#endif + + + inline void SpinnerAsciiSymbolPoints(const char *label, const char* text, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + if (!text || !*text) + return; + + const float start = ImFmod((float)ImGui::GetTime() * speed, (float)strlen(text)); + const ImFontGlyph* glyph = ImGui::GetCurrentContext()->IMSPINNER_FIND_GLYPH(text[(int)start]); + + ImVec2 pp(centre.x - radius, centre.y - radius); + ImFontAtlas* atlas = ImGui::GetIO().Fonts; + unsigned char* bitmap; + int out_width, out_height; + +#if IMGUI_VERSION_NUM < 19197 + atlas->GetTexDataAsAlpha8(&bitmap, &out_width, &out_height); +#else + const auto* atlas_tex_data = atlas->TexData; + out_width = atlas_tex_data->Width; + out_height = atlas_tex_data->Height; + bitmap = atlas_tex_data->Pixels; +#endif + + const int U1 = (int)(glyph->U1 * out_width); + const int U0 = (int)(glyph->U0 * out_width); + const int V1 = (int)(glyph->V1 * out_height); + const int V0 = (int)(glyph->V0 * out_height); + const float px = size.x / (U1 - U0); + const float py = size.y / (V1 - V0); + + for (int x = U0, ppx = 0; x < U1; x++, ppx++) { + for (int y = V0, ppy = 0; y < V1; y++, ppy++) { + ImVec2 point(pp.x + (ppx * px), pp.y + (ppy * py)); + // * 4 + 3 because dear imgui now defaults to RGBA32 + const unsigned char alpha = bitmap[(out_width * y + x) +#if IMGUI_VERSION_NUM > 19197 + * 4 + 3]; +#else + ]; +#endif + window->DrawList->AddCircleFilled(point, thickness * 1.5f, color_alpha({.5f,.5f,.5f,.5f}, alpha / 255.f)); + window->DrawList->AddCircleFilled(point, thickness, color_alpha(color, alpha / 255.f)); + } + } + } + + inline void SpinnerTextFading(const char *label, const char* text, float radius, float fsize, const ImColor &color = white, float speed = 2.8f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + if (!text || !*text) + return; + + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + const char *last_symbol = ImGui::FindRenderedTextEnd(text); + const ImVec2 text_size = ImGui::CalcTextSize(text, last_symbol); +#if IMGUI_VERSION_NUM < 19150 + const // Newer imgui versions require make the current context's font non-const +#endif + ImFont* font = ImGui::GetCurrentContext()->Font; + + ImVec2 pp(centre.x - text_size.x / 2.f, centre.y - text_size.y / 2.f); + + const int text_len = last_symbol - text; + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + for (int i = 0; text != last_symbol; ++text, ++i) { + const ImFontGlyph* glyph = ImGui::GetCurrentContext()->IMSPINNER_FIND_GLYPH(*text); + + const float alpha = ImClamp(ImSin(-start + (i / (float)text_len * PI_DIV_2)), 0.f, 1.f); + ImColor c = ImColor::HSV(out_h + i * (1.f / text_len), out_s, out_v); + font->RenderChar(window->DrawList, fsize, pp, color_alpha(c, alpha), (ImWchar)*text); + pp.x += glyph->AdvanceX; + } + } + + inline void SpinnerSevenSegments(const char *label, const char* text, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + if (!text || !*text) + return; + + const float start = ImFmod((float)ImGui::GetTime() * speed, (float)strlen(text)); + + struct Segment { ImVec2 b, e; }; + const float q = 1.f, hq = q * 0.5f, xq = thickness / radius; + const Segment segments[] = {{ ImVec2{-hq, 0.0f}, ImVec2{hq, 0.0f} }, /*central*/ + { ImVec2{-hq - xq, 0.0f}, ImVec2{-hq - xq, -q} }, /*left up*/ + { ImVec2{-hq - xq, q}, ImVec2{-hq - xq, xq} }, /*left down*/ + { ImVec2{-hq, q}, ImVec2{hq, q} }, /*center up*/ + { ImVec2{hq + xq, q}, ImVec2{hq + xq, xq} }, /*right down*/ + { ImVec2{hq + xq, 0.0f}, ImVec2{hq + xq, -q} }, /*right up*/ + { ImVec2{-hq, -q}, ImVec2{hq, -q} } /*center down*/}; + + const int symbols[][8]{ + //segments + //g,f,e,d,c,b,a,sym + // NUMBERS + {0,1,1,1,1,1,1,0}, //ZERO + {0,0,0,0,1,1,0,1}, //ONE + {1,0,1,1,0,1,1,2}, //TWO + {1,0,0,1,1,1,1,3}, //THREE + {1,1,0,0,1,1,0,4}, //FOUR + {1,1,0,1,1,0,1,5}, //FIVE + {1,1,1,1,1,0,1,6}, //SIX + {0,0,0,0,1,1,1,7}, //SEVEN + {1,1,1,1,1,1,1,8}, //EIGHT + {1,1,0,1,1,1,1,9}, //NINE + // LETTERS + {1,1,1,0,1,1,1,'A'}, //LETTER A + {1,1,1,1,1,0,0,'B'}, //LETTER B + {0,1,1,1,0,0,1,'C'}, //LETTER C + {1,0,1,1,1,1,0,'D'}, //LETTER D + {1,1,1,1,0,0,1,'E'}, //LETTER E + {1,1,1,0,0,0,1,'F'}, //LETTER F + {0,1,1,1,1,0,1,'G'}, //LETTER G + {1,1,1,0,1,0,0,'H'}, //LETTER H + {0,1,1,0,0,0,0,'I'}, //LETTER I + {0,0,1,1,1,1,0,'J'}, //LETTER J + {1,1,1,0,1,0,1,'K'}, //LETTER K + {0,1,1,1,0,0,0,'L'}, //LETTER L + {0,0,1,0,1,0,1,'M'}, //LETTER M + {0,1,1,0,1,1,1,'N'}, //LETTER N + {0,1,1,1,1,1,1,'O'}, //LETTER O + {1,1,1,0,0,1,1,'P'}, //LETTER P + {1,1,0,0,1,1,1,'Q'}, //LETTER Q + {0,1,1,0,0,1,1,'R'}, //LETTER R + {1,1,0,1,1,0,1,'S'}, //LETTER S + {1,1,1,1,0,0,0,'T'}, //LETTER T + {0,1,1,1,1,1,0,'U'}, //LETTER U + {0,1,0,1,1,1,0,'V'}, //LETTER V + {0,1,0,1,0,1,0,'W'}, //LETTER W + {1,1,1,0,1,1,0,'X'}, //LETTER X + {1,1,0,1,1,1,0,'Y'}, //LETTER Y + {1,0,0,1,0,1,1,'Z'}, //LETTER Z + }; + + auto draw_segment = [&] (const Segment &s) { + ImVec2 p1(centre.x + radius * s.b.x, centre.y + radius * s.b.y); + ImVec2 p2(centre.x + radius * s.e.x, centre.y + radius * s.e.y); + + window->DrawList->AddLine(p1, p2, color_alpha(color, 1.f), thickness); + }; + + auto draw_symbol = [&] (const int* sq) { + for (int i = 0; i < 7; ++i) + sq[i] ? draw_segment(segments[i]) : void(); + }; + char current_char = text[(int)start]; + if (isalpha(current_char)) { + draw_symbol(symbols[tolower(current_char) - 'a' + 10]); + } else if (isdigit(current_char)) { + draw_symbol(symbols[current_char - '0']); + } + } + + inline void SpinnerSquareStrokeFill(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float overt = 3.f; + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2 + overt); + const float arc_angle = 2.f * PI_DIV_4; + const float ht = thickness / 2.f; + + const float r = radius * 1.4f; + ImVec2 pp(centre.x + ImCos(-IM_PI * 0.75f) * r, centre.y + ImSin(-IM_PI * 0.75f) * r); + if (start > PI_2) { + ImColor c = color; + const float delta = (start - PI_2) / overt; + if (delta < 0.5f) { + c.Value.w = 1.f - delta * 2.f; + window->DrawList->AddLine(ImVec2(pp.x - ht, pp.y), ImVec2(pp.x + ht, pp.y), color_alpha(c, 1.f), thickness); + } else { + c.Value.w = (delta - 0.5f) * 2.f; + window->DrawList->AddLine(ImVec2(pp.x - ht, pp.y), ImVec2(pp.x + ht, pp.y), color_alpha(color, 1.f), thickness); + } + } else { + window->DrawList->AddLine(ImVec2(pp.x - ht, pp.y), ImVec2(pp.x + ht, pp.y), color_alpha(color, 1.f), thickness); + } + + if (start < PI_2) { + for (size_t arc_num = 0; arc_num < 4; ++arc_num) { + float a = arc_angle * arc_num; + float segment_progress = (start > a && start < (a + arc_angle)) + ? 1.f - (start - a) / (float)arc_angle + : (start < a ? 1.f : 0.f); + a -= PI_DIV_4; + segment_progress = 1.f - segment_progress; + ImVec2 p1(centre.x + ImCos(a - PI_DIV_2) * r, centre.y + ImSin(a - PI_DIV_2) * r); + ImVec2 p2(centre.x + ImCos(a) * r, centre.y + ImSin(a) * r); + switch (arc_num) { + case 0: p1.x += ht; p2.x -= ht; p2.x = p1.x + (p2.x - p1.x) * segment_progress; break; + case 1: p1.y -= ht; p2.y -= ht; p2.y = p1.y + (p2.y - p1.y) * segment_progress; break; + case 2: p1.x += ht; p2.x += ht; p2.x = p1.x + (p2.x - p1.x) * segment_progress; break; + case 3: p1.y += ht; p2.y -= ht; p2.y = p1.y + (p2.y - p1.y) * segment_progress; break; + } + window->DrawList->AddLine(p1, p2, color_alpha(color, 1.f), thickness); + } + } + } + + inline void SpinnerSquareStrokeLoading(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2 ); + const float arc_angle = 2.f * PI_DIV_4; + const float ht = thickness / 2.f; + + const float best_radius = radius * 1.4f; + const float delta = (start - PI_2) / 2.f; + for (size_t arc_num = 0; arc_num < 4; ++arc_num) { + float a = arc_angle * arc_num; + a -= PI_DIV_4; + ImVec2 pp(centre.x + ImCos(a) * best_radius, centre.y + ImSin(a) * best_radius); + window->DrawList->AddLine(ImVec2(pp.x - ht, pp.y), ImVec2(pp.x + ht, pp.y), color_alpha(color, 1.f), thickness); + } + + const bool grow = start < IM_PI; + const float segment_progress = grow ? (start / IM_PI) : (1.f - (start - IM_PI) / IM_PI); + for (size_t arc_num = 0; arc_num < 4; ++arc_num) { + float a = arc_angle * arc_num; + a -= PI_DIV_4; + const bool right = ImSin(a) > 0; + const bool top = ImCos(a) < 0; + ImVec2 p1(centre.x + ImCos(a - PI_DIV_2) * best_radius, centre.y + ImSin(a - PI_DIV_2) * best_radius); + ImVec2 p2(centre.x + ImCos(a) * best_radius, centre.y + ImSin(a) * best_radius); + switch (arc_num) { + case 0: p1.x -= ht; p2.x += ht; + p1.x = grow ? p1.x : p1.x + (p2.x - p1.x) * (1.f - segment_progress); p2.x = grow ? p1.x + (p2.x - p1.x) * segment_progress : p2.x; break; + case 1: p1.y -= ht; p2.y += ht; + p1.y = grow ? p1.y : p1.y + (p2.y - p1.y) * (1.f - segment_progress); p2.y = grow ? p1.y + (p2.y - p1.y) * segment_progress : p2.y; break; + case 2: p1.x += ht; p2.x -= ht; + p1.x = grow ? p1.x : grow ? p1.x : p1.x + (p2.x - p1.x) * (1.f - segment_progress); p2.x = grow ? p1.x + (p2.x - p1.x) * segment_progress : p2.x; break; + case 3: p1.y += ht; p2.y -= ht; + p1.y = grow ? p1.y : p1.y + (p2.y - p1.y) * (1.f - segment_progress); p2.y = grow ? p1.y + (p2.y - p1.y) * segment_progress : p2.y; break; + } + window->DrawList->AddLine(p1, p2, color_alpha(color, 1.f), thickness); + } + } + + inline void SpinnerSquareLoading(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2 + PI_DIV_2 ); + const float arc_angle = PI_DIV_2; + const float ht = thickness / 2.f; + + const float best_radius = radius * 1.4f; + float a = arc_angle * 3 - PI_DIV_4 + (start > PI_2 ? start * 2.f : 0); + ImVec2 last_pos(centre.x + ImCos(a) * best_radius, centre.y + ImSin(a) * best_radius); + ImVec2 ppMin, ppMax; + for (size_t arc_num = 0; arc_num < 4; ++arc_num) { + a = arc_angle * arc_num - PI_DIV_4 + (start > PI_2 ? start * 2.f : 0); + ImVec2 pp(centre.x + ImCos(a) * best_radius, centre.y + ImSin(a) * best_radius); + window->DrawList->AddLine(last_pos, pp, color_alpha(color, 1.f), thickness); + last_pos = pp; + + if (start < PI_2) { + if (arc_num == 2) ppMin = ImVec2(centre.x + ImCos(a) * best_radius * 0.8f, centre.y + ImSin(a) * best_radius * 0.8f); + else if (arc_num == 0) ppMax = ImVec2(centre.x + ImCos(a) * best_radius * 0.8f, centre.y + ImSin(a) * best_radius * 0.8f); + } + } + + if (start < PI_2) { + ppMax.y = ppMin.y + (start / PI_2) * (ppMax.y - ppMin.y); + window->DrawList->AddRectFilled(ppMin, ppMax, color_alpha(color, 1.f), 0.f); + } + } + + inline void SpinnerFilledArcFade(const char *label, float radius, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime()* speed, IM_PI * 4.f); + const float arc_angle = PI_2 / (float)arcs; + const float angle_offset = arc_angle / num_segments; + for (size_t arc_num = 0; arc_num < arcs; ++arc_num) + { + const float b = arc_angle * arc_num - PI_DIV_2 - PI_DIV_4; + const float e = arc_angle * arc_num + arc_angle - PI_DIV_2 - PI_DIV_4; + const float a = arc_angle * arc_num; + ImColor c = color; + float vradius = radius; + if (start < PI_2) { + c.Value.w = 0.f; + if (start > a && start < (a + arc_angle)) { c.Value.w = 1.f - (start - a) / (float)arc_angle; } + else if (start < a) { c.Value.w = 1.f; } + c.Value.w = ImMax(0.f, 1.f - c.Value.w); + if (mode == 1) + vradius = radius * c.Value.w; + } + else + { + const float startk = start - PI_2; + c.Value.w = 0.f; + if (startk > a && startk < (a + arc_angle)) { c.Value.w = 1.f - (startk - a) / (float)arc_angle; } + else if (startk < a) { c.Value.w = 1.f; } + if (mode == 1) + vradius = radius * c.Value.w; + } + + window->DrawList->PathClear(); + window->DrawList->PathLineTo(centre); + for (size_t i = 0; i <= num_segments + 1; i++) + { + const float ar = arc_angle * arc_num + (i * angle_offset) - PI_DIV_2 - PI_DIV_4; + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(ar) * vradius, centre.y + ImSin(ar) * vradius)); + } + window->DrawList->PathFillConvex(color_alpha(c, 1.f)); + } + } + + inline void SpinnerPointsRoller(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t points = 8, int circles = 2, float rspeed = 1.f) { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, IM_PI / (points / 2)); + const float arc_angle = PI_2 / (float)points; + const float angle_offset = arc_angle / num_segments; + + float dspeed = rspeed; + float angleStep = IM_PI * 2.0f / points; // Step between dots + + for (int c_num = 0; c_num < circles; c_num++) { + float vradius = radius * (1.f - (1.f / (circles + 2.f) * c_num)); + float adv_angle = ((IM_PI * 2) / circles) * c_num;// *(1.f + (0.1f * circles) * c_num); + for (size_t arc_num = 0; arc_num < points; ++arc_num) { + const float b = arc_angle * arc_num - PI_DIV_2 - PI_DIV_4; + const float e = arc_angle * arc_num + arc_angle - PI_DIV_2 - PI_DIV_4; + const float a = arc_angle * arc_num; + + float angle = angleStep * arc_num + start * speed; // Calculate angle for each dot + float alpha = 1.0f - (angle / (IM_PI * 2.0f)); // Fade effect + + ImU32 dotColor = ImGui::GetColorU32(ImVec4( + (color >> IM_COL32_R_SHIFT) / 255.0f, + (color >> IM_COL32_G_SHIFT) / 255.0f, + (color >> IM_COL32_B_SHIFT) / 255.0f, + alpha + )); + + const float ar = start + adv_angle + arc_angle * arc_num - PI_DIV_2 - PI_DIV_4; + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(ar) * vradius, centre.y + ImSin(ar) * vradius), thickness, color_alpha(dotColor, 1.f), 8); + } + dspeed += rspeed; + } + } + + inline void SpinnerPointsArcBounce(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t points = 4, int circles = 2, float rspeed = 0.f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime()* speed, IM_PI * 4.f); + const float arc_angle = PI_2 / (float)points; + const float angle_offset = arc_angle / num_segments; + float dspeed = rspeed; + for (int c_num = 0; c_num < circles; c_num++) + { + float mr = radius * (1.f - (1.f / (circles + 2.f) * c_num)); + float adv_angle = IM_PI * c_num;// *(1.f + (0.1f * circles) * c_num); + for (size_t arc_num = 0; arc_num < points; ++arc_num) + { + const float b = arc_angle * arc_num - PI_DIV_2 - PI_DIV_4; + const float e = arc_angle * arc_num + arc_angle - PI_DIV_2 - PI_DIV_4; + const float a = arc_angle * arc_num; + ImColor c = color; + float vradius = mr; + if (start < PI_2) { + c.Value.w = 0.f; + if (start > a && start < (a + arc_angle)) { c.Value.w = 1.f - (start - a) / (float)arc_angle; } + else if (start < a) { c.Value.w = 1.f; } + c.Value.w = ImMax(0.f, 1.f - c.Value.w); + vradius = mr * c.Value.w; + } + else + { + const float startk = start - PI_2; + c.Value.w = 0.f; + if (startk > a && startk < (a + arc_angle)) { c.Value.w = 1.f - (startk - a) / (float)arc_angle; } + else if (startk < a) { c.Value.w = 1.f; } + vradius = mr * c.Value.w; + } + + const float ar = start * dspeed + adv_angle + arc_angle * arc_num - PI_DIV_2 - PI_DIV_4; + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(ar) * vradius, centre.y + ImSin(ar) * vradius), thickness, color_alpha(c, 1.f), 8); + } + dspeed += rspeed; + } + } + + inline void SpinnerFilledArcColor(const char *label, float radius, const ImColor &color = red, const ImColor &bg = white, float speed = 2.8f, size_t arcs = 4) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime()* speed, PI_2); + const float arc_angle = PI_2 / (float)arcs; + const float angle_offset = arc_angle / num_segments; + + window->DrawList->AddCircleFilled(centre, radius, color_alpha(bg, 1.f), num_segments * 2); + for (size_t arc_num = 0; arc_num < arcs; ++arc_num) + { + const float b = arc_angle * arc_num - PI_DIV_2; + const float e = arc_angle * arc_num + arc_angle - PI_DIV_2; + const float a = arc_angle * arc_num; + + ImColor c = color; + c.Value.w = 0.f; + if (start > a && start < (a + arc_angle)) { c.Value.w = 1.f - (start - a) / (float)arc_angle; } + else if (start < a) { c.Value.w = 1.f; } + c.Value.w = ImMax(0.f, 1.f - c.Value.w); + + window->DrawList->PathClear(); + window->DrawList->PathLineTo(centre); + for (size_t i = 0; i < num_segments + 1; i++) + { + const float ar = arc_angle * arc_num + (i * angle_offset) - PI_DIV_2; + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(ar) * radius, centre.y + ImSin(ar) * radius)); + } + window->DrawList->PathFillConvex(color_alpha(c, 1.f)); + } + } + + inline void SpinnerFilledArcRing(const char *label, float radius, float thickness, const ImColor &color = red, const ImColor &bg = white, float speed = 2.8f, size_t arcs = 4) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float pi_div_2 = PI_DIV_2; + const float pi_div_4 = PI_DIV_4; + const float pi_mul_2 = PI_2; + const float start = ImFmod((float)ImGui::GetTime() * speed, pi_mul_2 + pi_div_4); + const float arc_angle = pi_mul_2 / (float)arcs; + const float angle_offset = arc_angle / num_segments; + + window->DrawList->PathClear(); + for (size_t i = 0; i < num_segments + 1; i++) + { + const float ar_b = (i * (pi_mul_2 / num_segments)); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(ar_b) * radius, centre.y + ImSin(ar_b) * radius)); + } + window->DrawList->PathStroke(color_alpha(bg, 1.f), false, thickness); + + for (size_t arc_num = 0; arc_num < arcs; ++arc_num) + { + const float b = arc_angle * arc_num - pi_div_2; + const float e = arc_angle * arc_num + arc_angle - pi_div_2; + const float a = arc_angle * arc_num; + + float alpha = 0.f; + if (start > pi_mul_2) { alpha = (start - pi_mul_2) / pi_div_4; } + else if (start > a && start < (a + arc_angle)) { alpha = 1.f - (start - a) / (float)arc_angle; } + else if (start < a) { alpha = 1.f; } + + window->DrawList->PathClear(); + for (size_t i = 0; i < num_segments + 1; i++) + { + const float ar_b = arc_angle * arc_num + (i * angle_offset) - pi_div_2; + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(ar_b) * radius, centre.y + ImSin(ar_b) * radius)); + } + window->DrawList->PathStroke(color_alpha(color, ImMax(0.f, 1.f - alpha)), false, thickness); + } + } + + inline void SpinnerArcWedges(const char *label, float radius, const ImColor &color = red, float speed = 2.8f, size_t arcs = 4, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime() * speed; + const float arc_angle = PI_2 / (float)arcs; + const float angle_offset = arc_angle / num_segments; + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + + for (size_t arc_num = 0; arc_num < arcs; ++arc_num) + { + const float b = arc_angle * arc_num - PI_DIV_2; + const float e = arc_angle * arc_num + arc_angle - PI_DIV_2; + const float a = arc_angle * arc_num; + + window->DrawList->PathClear(); + window->DrawList->PathLineTo(centre); + const float ab = ease((ease_mode)mode, start + arc_num * PI_DIV(2) / arcs, IM_PI, 1.0f, 0.0f); + for (size_t i = 0; i < num_segments + 1; i++) + { + const float start_a = ImFmod(start * (1.05f * (arc_num + 1)), PI_2); + const float ar = start_a + ab + arc_angle * arc_num + (i * angle_offset) - PI_DIV_2; + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(ar) * radius, centre.y + ImSin(ar) * radius)); + } + window->DrawList->PathFillConvex(color_alpha(ImColor::HSV(out_h + (1.f / arcs) * arc_num, out_s, out_v, 0.7f), 1.f)); + } + } + + inline void SpinnerTwinBall(const char *label, float radius1, float radius2, float thickness, float b_thickness, const ImColor &ball = white, const ImColor &bg = half_white, float speed = 2.8f, size_t balls = 2, int mode = 0) + { + float radius = ImMax(radius1, radius2); + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime()* speed; + const float bg_angle_offset = PI_2 / num_segments; + + window->DrawList->PathClear(); + for (size_t i = 0; i <= num_segments; i++) + { + const float a = start + (i * bg_angle_offset); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * radius1, centre.y + ImSin(a) * radius1)); + } + window->DrawList->PathStroke(color_alpha(bg, 1.f), false, thickness); + + for (size_t b_num = 0; b_num < balls; ++b_num) + { + float b_start = PI_2 / balls; + const float ab = ease((ease_mode)mode, start + b_num * PI_DIV(2) / balls, IM_PI, 1.0f, 0.0f); + const float a = b_start * b_num + start + ab; + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(a) * radius2, centre.y + ImSin(a) * radius2), b_thickness, color_alpha(ball, 1.f)); + } + } + + inline void SpinnerSolarBalls(const char *label, float radius, float thickness, const ImColor &ball = white, const ImColor &bg = half_white, float speed = 2.8f, size_t balls = 4) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime() * speed; + const float bg_angle_offset = PI_2 / num_segments; + + for (int i = 0; i < balls; ++i) { + const float rb = (radius / balls) * 1.3f * (i + 1); + window->DrawList->AddCircle(centre, rb, color_alpha(bg, 1.f), num_segments, thickness * 0.3f); + } + + for (int i = 0; i < balls; ++i) { + const float rb = (radius / balls) * 1.3f * (i + 1); + const float a = start * (1.0f + 0.1f * i); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(a) * rb, centre.y + ImSin(a) * rb), thickness, color_alpha(ball, 1.f)); + } + } + + inline void SpinnerSolarScaleBalls(const char *label, float radius, float thickness, const ImColor &ball = white, float speed = 2.8f, size_t balls = 4) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, IM_PI * 16.f); + const float bg_angle_offset = PI_2 / num_segments; + + for (int i = 0; i < balls; ++i) { + const float rb = (radius / balls) * 1.3f * (i + 1); + const float a = start * (1.0f + 0.1f * i); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(a) * rb, centre.y + ImSin(a) * rb), ((thickness * 2.f) / balls) * i, color_alpha(ball, 1.f)); + } + } + + inline void SpinnerSolarArcs(const char *label, float radius, float thickness, const ImColor &ball = white, const ImColor &bg = half_white, float speed = 2.8f, size_t balls = 4) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime()* speed; + const int half_segments = num_segments / 2; + + for (int i = 0; i < balls; ++i) + { + const float rb = (radius / balls) * 1.3f * (i + 1); + const float bg_angle_offset = IM_PI / half_segments; + const int mul = i % 2 ? -1 : 1; + window->DrawList->PathClear(); + for (size_t ii = 0; ii <= half_segments; ii++) + { + const float a = (ii * bg_angle_offset); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * rb, centre.y + ImSin(a) * rb * mul)); + } + window->DrawList->PathStroke(color_alpha(bg, 1.f), false, thickness * 0.8f); + } + + for (int i = 0; i < balls; ++i) + { + const float rb = (radius / balls) * 1.3f * (i + 1); + const float a = ImFmod(start * (1.0f + 0.1f * i), PI_2); + const int mul = i % 2 ? -1 : 1; + float y = ImSin(a) * rb; + if ((y > 0 && mul < 0) || (y < 0 && mul > 0)) y = -y; + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(a) * rb, centre.y + y), thickness, color_alpha(ball, 1.f)); + } + } + + inline void SpinnerMovingArcs(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImFmod(ImGui::GetTime() * speed, IM_PI * 2); + const int half_segments = num_segments / 2; + + for (int i = 0; i < arcs; ++i) { + const float rb = (radius / arcs) * 1.3f * (i + 1); + float a = damped_spring(1, 10.f, 1.0f, ImSin(ImFmod(start + i * PI_DIV(arcs), PI_2))); + const float angle = ImMax(PI_DIV_2, (1.f - i/(float)arcs) * IM_PI); + circle([&] (int i) { + const float b = a + (i * angle / num_segments); + return ImVec2(ImCos(b) * rb, ImSin(b) * rb); + }, color_alpha(color, 1.f), thickness); + } + } + + inline void SpinnerRainbowCircle(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4, float mode = 1) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime() * speed; + num_segments *= 2; + const float bg_angle_offset = IM_PI / num_segments; + + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + + for (int i = 0; i < arcs; ++i) + { + float max_angle = IM_PI - ImFmod(start /* * (1.0 + 0.1f * i) */, IM_PI + PI_DIV_2 + PI_DIV(8)); + max_angle = ImMin(IM_PI, max_angle + (PI_DIV_2 / arcs) * i); + const float rb = (radius / arcs) * 1.1f * (i + 1); + + ImColor c = ImColor::HSV(out_h + i * (0.8f / arcs), out_s, out_v); + const int draw_segments = ImMax(0, (int)(max_angle / bg_angle_offset)); + + for (int j = 0; j < 2; j++) + { + const int mul = j % 2 ? -1 : 1; + const float py = (j % 2 ? -0.5f : 0.5f) * thickness; + const float alpha_start = (j % 2 ? 0 : IM_PI) * mode; + window->DrawList->PathClear(); + for (size_t ii = 0; ii <= draw_segments + 1; ii++) + { + const float a = (ii * bg_angle_offset); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(IM_PI - alpha_start - a) * rb, centre.y + ImSin(a) * rb * mul + py)); + } + window->DrawList->PathStroke(color_alpha(c, 1.f), false, thickness * 0.8f); + } + } + } + + inline void SpinnerBounceBall(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int dots = 1, bool shadow = false) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + ImGuiStorage* storage = window->DC.StateStorage; + const ImGuiID vtimeId = window->GetID("##vtime"); + const ImGuiID hmaxId = window->GetID("##hmax"); + + float vtime = storage->GetFloat(vtimeId, 0.f); + float hmax = storage->GetFloat(hmaxId, 1.f); + + vtime += 0.05f; + hmax += 0.01f; + + storage->SetFloat(vtimeId, vtime); + storage->SetFloat(hmaxId, hmax); + + constexpr float rkoeff[9] = {0.1f, 0.15f, 0.17f, 0.25f, 0.31f, 0.19f, 0.08f, 0.24f, 0.9f}; + const int iterations = shadow ? 4 : 1; + for (int j = 0; j < iterations; j++) { + ImColor c = color_alpha(color, 1.f - 0.15f * j); + for (int i = 0; i < dots; i++) { + float start = ImFmod((float)ImGui::GetTime() * speed * (1 + rkoeff[i % 9]) - (IM_PI / 12.f) * j, IM_PI); + float sign = ((i % 2 == 0) ? 1.f : -1.f); + float offset = (i == 0) ? 0.f : (floorf((i+1) / 2.f + 0.1f) * sign * 2.f * thickness); + float maxht = damped_gravity(ImSin(ImFmod(hmax, IM_PI))) * radius; + window->DrawList->AddCircleFilled(ImVec2(centre.x + offset, centre.y + radius - ImSin(start) * 2.f * maxht), thickness, c, 8); + } + } + } + + inline void SpinnerPulsarBall(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, bool shadow = false, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + ImGuiStorage* storage = window->DC.StateStorage; + + const int iterations = shadow ? 4 : 1; + for (int j = 0; j < iterations; j++) { + ImColor c = color_alpha(color, 1.f - 0.15f * j); + float start = ImFmod((float)ImGui::GetTime() * speed - (IM_PI / 12.f) * j, IM_PI); + float maxht = damped_gravity(ImSin(ImFmod(start, IM_PI))) * (radius * 0.6f); + window->DrawList->AddCircleFilled(ImVec2(centre.x, centre.y), maxht, c, num_segments); + } + + const float angle_offset = PI_DIV_2 / num_segments; + const int arcs = 2; + for (size_t arc_num = 0; arc_num < arcs; ++arc_num) { + window->DrawList->PathClear(); + float arc_start = 2 * IM_PI / arcs; + float start = ImFmod((float)ImGui::GetTime() * speed - (IM_PI * arc_num), IM_PI); + float b = mode ? start + damped_spring(1, 10.f, 1.0f, ImSin(ImFmod(start + arc_num * PI_DIV(2) / arcs, IM_PI)), 1, 0) : start; + float maxht = (damped_gravity(ImSin(ImFmod(start, IM_PI))) * 0.3f + 0.7f) * radius; + for (size_t i = 0; i < num_segments; i++) { + const float a = b + arc_start * arc_num + (i * angle_offset); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * maxht, centre.y + ImSin(a) * maxht)); + } + window->DrawList->PathStroke(color_alpha(color, 1.f), false, thickness); + } + } + + inline void SpinnerIncScaleDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t dots = 6, float angle = 0.f, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float start = (float)ImGui::GetTime() * speed; + float astart = ImFmod(start, IM_PI / dots); + start -= astart; + const float bg_angle_offset = IM_PI / dots; + dots = ImMin(dots, (size_t)32); + + for (size_t i = 0; i <= dots; i++) + { + float a = start + (i * bg_angle_offset); + a += ease((ease_mode)mode, a, angle); + float th = thickness * ImMax(0.1f, i / (float)dots); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(a) * radius, centre.y + ImSin(a) * radius), th, color_alpha(color, 1.f), 8); + } + } + + inline void SpinnerSomeScaleDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t dots = 6, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float start = (float)ImGui::GetTime() * speed; + float astart = ImFmod(start, IM_PI / dots); + start -= astart; + const float bg_angle_offset = IM_PI / dots; + dots = ImMin(dots, (size_t)32); + + for (size_t j = 0; j < 4; j++) + { + float r = radius * (1.f - (0.15f * j)); + for (size_t i = 0; i <= dots; i++) + { + float a = start * (mode ? (1.f + j * 0.05f) : 1.f) + (i * bg_angle_offset); + float th = thickness * ImMax(0.1f, i / (float)dots); + float thh = th * (1.f - (0.2f * j)); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(a) * r, centre.y + ImSin(a) * r), thh, color_alpha(color, 1.f), 8); + } + } + } + + inline void SpinnerAngTriple(const char *label, float radius1, float radius2, float radius3, float thickness, const ImColor &c1 = white, const ImColor &c2 = half_white, const ImColor &c3 = white, float speed = 2.8f, float angle = IM_PI) + { + float radius = ImMax(ImMax(radius1, radius2), radius3); + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start1 = (float)ImGui::GetTime() * speed; + const float angle_offset = angle / num_segments; + + window->DrawList->PathClear(); + for (size_t i = 0; i < num_segments; i++) + { + const float a = start1 + (i * angle_offset); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * radius1, centre.y + ImSin(a) * radius1)); + } + window->DrawList->PathStroke(color_alpha(c1, 1.f), false, thickness); + + float start2 = (float)ImGui::GetTime() * 1.2f * speed; + window->DrawList->PathClear(); + for (size_t i = 0; i < num_segments; i++) + { + const float a = start2 + (i * angle_offset); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(-a) * radius2, centre.y + ImSin(-a) * radius2)); + } + window->DrawList->PathStroke(color_alpha(c2, 1.f), false, thickness); + + float start3 = (float)ImGui::GetTime() * 0.9f * speed; + window->DrawList->PathClear(); + for (size_t i = 0; i < num_segments; i++) + { + const float a = start3 + (i * angle_offset); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * radius3, centre.y + ImSin(a) * radius3)); + } + window->DrawList->PathStroke(color_alpha(c3, 1.f), false, thickness); + } + + inline void SpinnerAngEclipse(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, float angle = IM_PI) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime()* speed; + const float angle_offset = angle / num_segments; + const float th = thickness / num_segments; + + for (size_t i = 0; i < num_segments; i++) + { + const float a = start + (i * angle_offset); + const float a1 = start + ((i+1) * angle_offset); + window->DrawList->AddLine(ImVec2(centre.x + ImCos(a) * radius, centre.y + ImSin(a) * radius), + ImVec2(centre.x + ImCos(a1) * radius, centre.y + ImSin(a1) * radius), + color_alpha(color, 1.f), + th * i); + } + } + + inline void SpinnerIngYang(const char *label, float radius, float thickness, bool reverse, float yang_detlta_r, const ImColor &colorI = white, const ImColor &colorY = white, float speed = 2.8f, float angle = IM_PI * 0.7f, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float startI = (float)ImGui::GetTime() * speed; + const float startY = (float)ImGui::GetTime() * (speed + (yang_detlta_r > 0.f ? ImClamp(yang_detlta_r * 0.5f, 0.5f, 2.f) : 0.f)); + const float angle_offset = angle / num_segments; + const float th = thickness / num_segments; + + for (int i = 0; i < num_segments; i++) + { + const float ab = ease((ease_mode)mode, startI + i * PI_DIV(2) / num_segments, IM_PI, 1.0f, 0.0f); + const float a = startI + ab + (i * angle_offset); + const float a1 = startI + ab + ((i + 1) * angle_offset); + window->DrawList->AddLine(ImVec2(centre.x + ImCos(a) * radius, centre.y + ImSin(a) * radius), + ImVec2(centre.x + ImCos(a1) * radius, centre.y + ImSin(a1) * radius), + color_alpha(colorI, 1.f), + th * i); + } + const float ab = ease((ease_mode)mode, startI + PI_DIV(2), IM_PI, 1.0f, 0.0f); + const float ai_end = startI + ab + (num_segments * angle_offset); + ImVec2 circle_i_center{centre.x + ImCos(ai_end) * radius, centre.y + ImSin(ai_end) * radius}; + window->DrawList->AddCircleFilled(circle_i_center, thickness / 2.f, color_alpha(colorI, 1.f), num_segments); + + const float rv = reverse ? -1.f : 1.f; + const float yang_radius = (radius - yang_detlta_r); + for (int i = 0; i < num_segments; i++) + { + const float ae = ease((ease_mode)mode, startI + i * PI_DIV(2) / num_segments, IM_PI, 1.0f, 0.0f); + const float a = startY - ae + IM_PI + (i * angle_offset); + const float a1 = startY - ae + IM_PI + ((i+1) * angle_offset); + window->DrawList->AddLine(ImVec2(centre.x + ImCos(a * rv) * yang_radius, centre.y + ImSin(a * rv) * yang_radius), + ImVec2(centre.x + ImCos(a1 * rv) * yang_radius, centre.y + ImSin(a1 * rv) * yang_radius), + color_alpha(colorY, 1.f), + th * i); + } + const float ae = ease((ease_mode)mode, startI + PI_DIV(2), IM_PI, 1.0f, 0.0f); + const float ay_end = startY - ae + IM_PI + (num_segments * angle_offset); + ImVec2 circle_y_center{centre.x + ImCos(ay_end * rv) * yang_radius, centre.y + ImSin(ay_end * rv) * yang_radius}; + window->DrawList->AddCircleFilled(circle_y_center, thickness / 2.f, color_alpha(colorY, 1.f), num_segments); + } + + + inline void SpinnerGooeyBalls(const char *label, float radius, const ImColor &color, float speed, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float start = ImFmod((float)ImGui::GetTime() * speed, IM_PI); + start = mode ? damped_spring(1, 10.f, 1.0f, ImSin(start), 1, 0) : start; + const float radius1 = (0.4f + 0.3f * ImSin(start)) * radius; + const float radius2 = radius - radius1; + + window->DrawList->AddCircleFilled(ImVec2(centre.x - radius + radius1, centre.y), radius1, color_alpha(color, 1.f), num_segments); + window->DrawList->AddCircleFilled(ImVec2(centre.x - radius + radius1 * 1.2f + radius2, centre.y), radius2, color_alpha(color, 1.f), num_segments); + } + + inline void SpinnerDotsLoading(const char *label, float radius, float thickness, const ImColor &color, const ImColor &bg, float speed) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, IM_PI); + const float radius1 = (2.f * ImSin(start)) * radius; + + float startb = ImFmod(start, PI_DIV_2); + float lenb = startb < PI_DIV_2 ? ImAbs((0.5f * ImSin(start * 2)) * radius) : radius * 0.5f; + float radius2 = radius * 0.25f; + + float deltae = thickness - ImMin(thickness, ImMax(0, (2.f * radius - radius1 + thickness + lenb) * 0.25f)); + float deltag = ImMin(thickness, ImAbs(centre.x - radius + radius1 + thickness + lenb - centre.x - radius) * 0.25f); + window->DrawList->AddCircleFilled(ImVec2(centre.x - radius, centre.y), radius2 + deltag, color_alpha(bg, 1.f), num_segments); + window->DrawList->AddCircleFilled(ImVec2(centre.x + radius + thickness, centre.y), radius2 + deltae, color_alpha(bg, 1.f), num_segments); + + window->DrawList->AddRectFilled(ImVec2(centre.x - radius + radius1 - thickness - lenb, centre.y - thickness), ImVec2(centre.x - radius + radius1 + thickness + lenb, centre.y + thickness), color_alpha(color, 1.f), thickness); + } + + inline void SpinnerRotateGooeyBalls(const char *label, float radius, float thickness, const ImColor &color, float speed, int balls, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime(), IM_PI); + const float rstart = ImFmod((float)ImGui::GetTime() * speed, PI_2); + float radius1 = (0.2f + 0.3f * ImSin(start)) * radius; + const float angle_offset = PI_2 / balls; + + float roff = ease((ease_mode)mode, start, radius); + for (int i = 0; i <= balls; i++) + { + const float a = rstart + (i * angle_offset); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(a) * (radius1 + roff), centre.y + ImSin(a) * (radius1 + roff)), thickness, color_alpha(color, 1.f), num_segments); + } + } + + inline void SpinnerHerbertBalls(const char *label, float radius, float thickness, const ImColor &color, float speed, int balls) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime(), IM_PI); + const float rstart = ImFmod((float)ImGui::GetTime() * speed, PI_2); + const float radius1 = 0.3f * radius; + const float radius2 = 0.8f * radius; + const float angle_offset = PI_2 / balls; + + for (int i = 0; i < balls; i++) + { + const float a = rstart + (i * angle_offset); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(a) * radius1, centre.y + ImSin(a) * radius1), thickness, color_alpha(color, 1.f), num_segments); + } + + for (int i = 0; i < balls * 2; i++) + { + const float a = -rstart + (i * angle_offset / 2.f); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(a) * radius2, centre.y + ImSin(a) * radius2), thickness, color_alpha(color, 1.f), num_segments); + } + } + + inline void SpinnerHerbertBalls3D(const char *label, float radius, float thickness, const ImColor &color, float speed) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime(), IM_PI); + const float rstart = ImFmod((float)ImGui::GetTime() * speed, PI_2); + const float radius1 = 0.3f * radius; + const float radius2 = 0.8f * radius; + const int balls = 2; + const float angle_offset = PI_2 / balls; + + ImVec2 frontpos, backpos; + for (int i = 0; i < balls; i++) + { + const float a = rstart + (i * angle_offset); + const float t = (i == 1 ? 0.7f : 1.f) * thickness; + const ImVec2 pos = ImVec2(centre.x + ImCos(a) * radius1, centre.y + ImSin(a) * radius1); + window->DrawList->AddCircleFilled(pos, t, color_alpha(color, 1.f), num_segments); + if (i == 0) frontpos = pos; else backpos = pos; + } + + ImVec2 lastpos; + for (int i = 0; i <= balls * 2; i++) + { + const float a = -rstart + (i * angle_offset / 2.f); + const ImVec2 pos = ImVec2(centre.x + ImCos(a) * radius2, centre.y + ImSin(a) * radius2); + float t = sqrt(pow(pos.x - frontpos.x, 2) + pow(pos.y - frontpos.y, 2)) / (radius * 1.f) * thickness; + window->DrawList->AddCircleFilled(pos, t, color_alpha(color, 1.f), num_segments); + window->DrawList->AddLine(pos, backpos, color_alpha(color, 0.5f), ImMax(thickness / 2.f, 1.f)); + if (i > 0) { + window->DrawList->AddLine(pos, lastpos, color_alpha(color, 1.f), ImMax(thickness / 2.f, 1.f)); + } + window->DrawList->AddLine(pos, frontpos, color_alpha(color, 1.f), ImMax(thickness / 2.f, 1.f)); + lastpos = pos; + } + } + + inline void SpinnerRotateTriangles(const char *label, float radius, float thickness, const ImColor &color, float speed, int tris, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime(), IM_PI); + const float rstart = ImFmod((float)ImGui::GetTime() * speed, PI_2); + const float radius1 = radius / 2.5f + thickness; + const float angle_offset = PI_2 / tris; + + for (int i = 0; i <= tris; i++) + { + const float ab = ease((ease_mode)mode, start + i * PI_DIV(2) / tris, IM_PI, 1.0f, 0.0f); + const float a = rstart + ab + (i * angle_offset); + ImVec2 tri_centre(centre.x + ImCos(a) * radius1, centre.y + ImSin(a) * radius1); + ImVec2 p1(tri_centre.x + ImCos(-a) * radius1, tri_centre.y + ImSin(-a) * radius1); + ImVec2 p2(tri_centre.x + ImCos(-a + PI_2 / 3.f) * radius1, tri_centre.y + ImSin(-a + PI_2 / 3.f) * radius1); + ImVec2 p3(tri_centre.x + ImCos(-a - PI_2 / 3.f) * radius1, tri_centre.y + ImSin(-a - PI_2 / 3.f) * radius1); + ImVec2 points[] = {p1, p2, p3}; + window->DrawList->AddConvexPolyFilled(points, 3, color_alpha(color, 1.f)); + } + } + + inline void SpinnerRotateShapes(const char *label, float radius, float thickness, const ImColor &color, float speed, int shapes, int pnt) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime(), IM_PI); + const float rstart = ImFmod((float)ImGui::GetTime() * speed, PI_2); + const float radius1 = radius / 2.5f + thickness; + const float angle_offset = PI_2 / shapes; + + std::vector points(pnt); + const float begin_a = -IM_PI / ((pnt % 2 == 0) ? pnt : (pnt - 1)); + for (int i = 0; i <= shapes; i++) + { + const float a = rstart + (i * angle_offset); + ImVec2 tri_centre(centre.x + ImCos(a) * radius1, centre.y + ImSin(a) * radius1); + for (int pi = 0; pi < pnt; ++pi) { + points[pi] = {tri_centre.x + ImCos(begin_a + pi * PI_2 / pnt) * radius1, tri_centre.y + ImSin(begin_a + pi * PI_2 / pnt) * radius1}; + } + window->DrawList->AddConvexPolyFilled(points.data(), pnt, color_alpha(color, 1.f)); + } + } + + inline void SpinnerSinSquares(const char *label, float radius, float thickness, const ImColor &color, float speed, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime(), IM_PI); + const float rstart = ImFmod((float)ImGui::GetTime() * speed, PI_2); + const float radius1 = radius / 2.5f + thickness; + const float angle_offset = PI_DIV_2; + + std::vector points(4); + for (int i = 0; i <= 4; i++) + { + const float a = rstart + (i * angle_offset); + const float begin_a = a - PI_DIV_2; + float roff = ImMax(ImSin(start) - 0.5f, 0.f) * (radius * 0.4f); + switch (mode) { + case 1: roff = ease_inoutquad(roff); break; + case 2: roff = ease_inoutexpo(roff) * (radius * 0.3f); break; + } + ImVec2 tri_centre(centre.x + ImCos(a) * (radius1 + roff), centre.y + ImSin(a) * (radius1 + roff)); + for (int pi = 0; pi < 4; ++pi) { + points[pi] = {tri_centre.x + ImCos(begin_a+ pi * PI_DIV_2) * radius1, tri_centre.y + ImSin(begin_a + pi * PI_DIV_2) * radius1}; + } + window->DrawList->AddConvexPolyFilled(points.data(), 4, color_alpha(color, 1.f)); + } + } + + inline void SpinnerMoonLine(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = red, float speed = 2.8f, float angle = IM_PI) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime()* speed; + const float angle_offset = (angle * 0.5f) / num_segments; + const float th = thickness / num_segments; + + window->DrawList->AddCircleFilled(centre, radius, bg, num_segments); + + auto draw_gradient = [&] (const std::function& b, const std::function& e, const std::function& th) { + for (int i = 0; i < num_segments; i++) + { + window->DrawList->AddLine(ImVec2(centre.x + ImCos(start + b(i)) * radius, centre.y + ImSin(start + b(i)) * radius), + ImVec2(centre.x + ImCos(start + e(i)) * radius, centre.y + ImSin(start + e(i)) * radius), + color_alpha(color, 1.f), + th(i)); + } + + }; + + draw_gradient([&] (int i) { return (num_segments + i) * angle_offset; }, + [&] (int i) { return (num_segments + i + 1) * angle_offset; }, + [&] (int i) { return thickness - th * i; }); + + draw_gradient([&] (int i) { return (i) * angle_offset; }, + [&] (int i) { return (i + 1) * angle_offset; }, + [&] (int i) { return th * i; }); + + draw_gradient([&] (int i) { return (num_segments + i) * angle_offset; }, + [&] (int i) { return (num_segments + i + 1) * angle_offset; }, + [&] (int i) { return thickness - th * i; }); + + const float b_angle_offset = (PI_2 - angle) / num_segments; + draw_gradient([&] (int i) { return num_segments * angle_offset * 2.f + (i * b_angle_offset); }, + [&] (int i) { return num_segments * angle_offset * 2.f + ((i + 1) * b_angle_offset); }, + [] (int) { return 1.f; }); + } + + inline void SpinnerCircleDrop(const char *label, float radius, float thickness, float thickness_drop, const ImColor &color = white, const ImColor &bg = half_white, float speed = 2.8f, float angle = IM_PI) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime() * speed; + const float bg_angle_offset = PI_2 / num_segments; + const float angle_offset = angle / num_segments; + const float th = thickness_drop / num_segments; + const float drop_radius_th = thickness_drop / num_segments; + + for (int i = 0; i < num_segments; i++) + { + const float a = start + (i * angle_offset); + const float a1 = start + ((i + 1) * angle_offset); + const float s_drop_radius = radius - thickness / 2.f - (drop_radius_th * i); + window->DrawList->AddLine(ImVec2(centre.x + ImCos(a) * s_drop_radius, centre.y + ImSin(a) * s_drop_radius), + ImVec2(centre.x + ImCos(a1) * s_drop_radius, centre.y + ImSin(a1) * s_drop_radius), + color_alpha(color, 1.f), + th * 2.f * i); + } + const float ai_end = start + (num_segments * angle_offset); + const float f_drop_radius = radius - thickness / 2.f - thickness_drop; + ImVec2 circle_i_center{centre.x + ImCos(ai_end) * f_drop_radius, centre.y + ImSin(ai_end) * f_drop_radius}; + window->DrawList->AddCircleFilled(circle_i_center, thickness_drop, color_alpha(color, 1.f), num_segments); + + window->DrawList->PathClear(); + for (int i = 0; i <= num_segments; i++) + { + const float a = (i * bg_angle_offset); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * radius, centre.y + ImSin(a) * radius)); + } + window->DrawList->PathStroke(color_alpha(bg, 1.f), false, thickness); + } + + inline void SpinnerSurroundedIndicator(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = half_white, float speed = 2.8f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float lerp_koeff = (ImSin((float)ImGui::GetTime() * speed) + 1.f) * 0.5f; + window->DrawList->AddCircleFilled(centre, thickness, color_alpha(bg, 1.f), num_segments); + window->DrawList->AddCircleFilled(centre, thickness, color_alpha(color, ImMax(0.1f, ImMin(lerp_koeff, 1.f))), num_segments); + + auto PathArc = [&] (const ImColor& c, float th) { + window->DrawList->PathClear(); + const float bg_angle_offset = PI_2 / num_segments; + for (int i = 0; i <= num_segments; i++) + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(i * bg_angle_offset) * radius, centre.y + ImSin(i * bg_angle_offset) * radius)); + window->DrawList->PathStroke(color_alpha(c, 1.f), false, th); + }; + + lerp_koeff = (ImSin((float)ImGui::GetTime() * speed * 1.6f) + 1.f) * 0.5f; + PathArc(bg, thickness); + PathArc(color_alpha(color, 1.f - ImMax(0.1f, ImMin(lerp_koeff, 1.f))), thickness); + } + + inline void SpinnerWifiIndicator(const char *label, float radius, float thickness, const ImColor &color = red, const ImColor &bg = half_white, float speed = 2.8f, float cangle = 0.f, int dots = 3) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float lerp_koeff = (ImSin((float)ImGui::GetTime() * speed) + 1.f) * 0.5f; + float start_ang = -cangle - PI_DIV_4 - PI_DIV_2; + ImVec2 pc(centre.x + ImSin(cangle) * radius, centre.y + ImCos(cangle) * radius); + window->DrawList->AddCircleFilled(pc, thickness, bg, num_segments); + window->DrawList->AddCircleFilled(pc, thickness, color_alpha(color, ImMax(0.1f, ImMin(lerp_koeff, 1.f))), num_segments); + + auto PathArc = [&] (float as, const ImColor& c, float th, float r) { + window->DrawList->PathClear(); + const float bg_angle_offset = PI_DIV(2) / num_segments; + for (int i = 0; i <= num_segments; i++) + window->DrawList->PathLineTo(ImVec2(pc.x + ImCos(as + i * bg_angle_offset) * r, pc.y + ImSin(as + i * bg_angle_offset) * r)); + window->DrawList->PathStroke(color_alpha(c, 1.f), false, th); + }; + + const float interval = (size.x * 0.7f) / dots; + for (int i = 0; i < dots; ++i) { + float r = 1.5f * (i + 1) * interval; + lerp_koeff = (ImSin((float)ImGui::GetTime() * speed - (i+1) * (IM_PI / dots)) + 1.f) * 0.5f; + PathArc(start_ang, bg, thickness, r); + PathArc(start_ang, color_alpha(color, ImMax(0.1f, ImMin(lerp_koeff, 1.f))), thickness, r); + } + } + + inline void SpinnerTrianglesSelector(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = half_white, float speed = 2.8f, size_t bars = 8) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float lerp_koeff = (ImSin((float)ImGui::GetTime() * speed) + 1.f) * 0.5f; + ImColor c = color_alpha(color, ImMax(0.1f, ImMin(lerp_koeff, 1.f))); + float dr = radius - thickness - 3; + window->DrawList->AddCircleFilled(centre, dr, bg, num_segments); + window->DrawList->AddCircleFilled(centre, dr, c, num_segments); + + // Render + float start = (float)ImGui::GetTime() * speed; + float astart = ImFmod(start, PI_2 / bars); + start -= astart; + const float angle_offset = PI_2 / bars; + const float angle_offset_t = angle_offset * 0.3f; + bars = ImMin(bars, 32); + + const float rmin = radius - thickness; + auto get_points = [&] (float left, float right) -> std::array { + return { + ImVec2(centre.x + ImCos(left) * rmin, centre.y + ImSin(left) * rmin), + ImVec2(centre.x + ImCos(left) * radius, centre.y + ImSin(left) * radius), + ImVec2(centre.x + ImCos(right) * radius, centre.y + ImSin(right) * radius), + ImVec2(centre.x + ImCos(right) * rmin, centre.y + ImSin(right) * rmin) + }; + }; + + auto draw_sectors = [&] (float s, const std::function& color_func) { + for (size_t i = 0; i <= bars; i++) { + float left = s + (i * angle_offset) - angle_offset_t; + float right = s + (i * angle_offset) + angle_offset_t; + auto points = get_points(left, right); + window->DrawList->AddConvexPolyFilled(points.data(), 4, color_func(i)); + } + }; + + draw_sectors(0, [&] (size_t) { return color_alpha(bg, 0.1f); }); + draw_sectors(start, [&] (size_t i) { return color_alpha(bg, (i / (float)bars) - 0.5f); }); + } + + using LeafColor = ImColor (int); + inline void SpinnerCamera(const char *label, float radius, float thickness, LeafColor *leaf_color, float speed = 2.8f, size_t bars = 8, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float start = (float)ImGui::GetTime() * speed; + switch (mode) { + case 1: + start += ease_inoutquad(ImSin(ImFmod(start, IM_PI))); + thickness += ease_inoutquad(ImSin(ImFmod(start, IM_PI))) * (thickness * 0.5f); + break; + } + const float angle_offset = PI_2 / bars; + const float angle_offset_t = angle_offset * 0.3f; + bars = ImMin(bars, 32); + + const float rmin = radius - thickness - 1; + auto get_points = [&] (float left, float right) -> std::array { + return { + ImVec2(centre.x + ImCos(left - 0.1f) * radius, centre.y + ImSin(left - 0.1f) * radius), + ImVec2(centre.x + ImCos(right + 0.15f) * radius, centre.y + ImSin(right + 0.15f) * radius), + ImVec2(centre.x + ImCos(right - 0.91f) * rmin, centre.y + ImSin(right - 0.91f) * rmin) + }; + }; + + auto draw_sectors = [&] (float s, const std::function& color_func) { + for (size_t i = 0; i <= bars; i++) { + float left = s + (i * angle_offset) - angle_offset_t; + float right = s + (i * angle_offset) + angle_offset_t; + auto points = get_points(left, right); + window->DrawList->AddConvexPolyFilled(points.data(), 3, color_alpha(color_func((int)i), 1.f)); + } + }; + + draw_sectors(start, leaf_color); + } + + inline void SpinnerFlowingGradient(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = red, float speed = 2.8f, float angle = IM_PI) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime()* speed; + const float angle_offset = (angle * 0.5f) / num_segments; + const float bg_angle_offset = (PI_2) / num_segments; + const float th = thickness / num_segments; + + for (size_t i = 0; i <= num_segments; i++) + { + const float a = (i * bg_angle_offset); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * radius, centre.y + ImSin(a) * radius)); + } + window->DrawList->PathStroke(bg, false, thickness); + + auto draw_gradient = [&] (const std::function& b, const std::function& e, const std::function& c) { + for (size_t i = 0; i < num_segments; i++) + { + window->DrawList->AddLine(ImVec2(centre.x + ImCos(start + b(i)) * radius, centre.y + ImSin(start + b(i)) * radius), + ImVec2(centre.x + ImCos(start + e(i)) * radius, centre.y + ImSin(start + e(i)) * radius), + c(i), + thickness); + } + }; + + draw_gradient([&] (size_t i) { return (i) * angle_offset; }, + [&] (size_t i) { return (i + 1) * angle_offset; }, + [&] (size_t i) { return color_alpha(color, (i / (float)num_segments)); }); + + draw_gradient([&] (size_t i) { return (num_segments + i) * angle_offset; }, + [&] (size_t i) { return (num_segments + i + 1) * angle_offset; }, + [&] (size_t i) { return color_alpha(color, 1.f - (i / (float)num_segments)); }); + } + + inline void SpinnerRotateSegments(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4, size_t layers = 1, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float start = (float)ImGui::GetTime()* speed; + switch (mode) { + case 1: start += ease_inoutquad(ImSin(ImFmod(start, IM_PI))); break; + } + const float arc_angle = PI_2 / (float)arcs; + const float angle_offset = arc_angle / num_segments; + float r = radius; + float reverse = 1.f; + for (size_t layer = 0; layer < layers; layer++) + { + for (size_t arc_num = 0; arc_num < arcs; ++arc_num) + { + window->DrawList->PathClear(); + for (size_t i = 2; i <= num_segments - 2; i++) + { + const float a = start * (1 + 0.1f * layer) + arc_angle * arc_num + (i * angle_offset); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a * reverse) * r, centre.y + ImSin(a * reverse) * r)); + } + window->DrawList->PathStroke(color_alpha(color, 1.f), false, thickness); + } + + r -= (thickness + 1); + reverse *= -1.f; + } + } + + inline void SpinnerLemniscate(const char* label, float radius, float thickness, const ImColor& color = white, float speed = 2.8f, float angle = IM_PI / 2.0f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime() * speed; + const float a = radius; + const float t = start; + const float step = angle / num_segments; + const float th = thickness / num_segments; + + for (size_t i = 0; i < num_segments; i++) + { + const auto xy0 = damped_infinity(start + (i * step), a); + const auto xy1 = damped_infinity(start + ((i + 1) * step), a); + + window->DrawList->AddLine(ImVec2(centre.x + xy0.first, centre.y + xy0.second), + ImVec2(centre.x + xy1.first, centre.y + xy1.second), + color_alpha(color, 1.f), + th * i); + } + } + + inline void SpinnerRotateGear(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t pins = 12) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime()* speed; + const float bg_angle_offset = PI_2 / num_segments; + const float bg_radius = radius - thickness; + + window->DrawList->PathClear(); + for (size_t i = 0; i <= num_segments; i++) + { + const float a = (i * bg_angle_offset); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * bg_radius, centre.y + ImSin(a) * bg_radius)); + } + window->DrawList->PathStroke(color_alpha(color, 1.f), false, bg_radius / 2); + + const float rmin = bg_radius; + const float rmax = radius; + const float pin_angle_offset = PI_2 / pins; + for (size_t i = 0; i <= pins; i++) + { + float a = start + (i * pin_angle_offset); + window->DrawList->AddLine(ImVec2(centre.x + ImCos(a) * rmin, centre.y + ImSin(a) * rmin), + ImVec2(centre.x + ImCos(a) * rmax, centre.y + ImSin(a) * rmax), + color_alpha(color, 1.f), thickness); + } + } + + inline void SpinnerRotateWheel(const char *label, float radius, float thickness, const ImColor &bg_color = white, const ImColor &color = white, float speed = 2.8f, size_t pins = 12) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime() * speed; + const float bg_radius = radius - thickness; + const float line_th = ImMax(radius / 8.f, 3.f); + + auto draw_circle = [window, num_segments, centre] (float r, const ImColor &c, float th) { + const float bg_angle_offset = PI_2 / num_segments; + window->DrawList->PathClear(); + for (size_t i = 0; i <= num_segments; i++) + { + const float a = (i * bg_angle_offset); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * r, centre.y + ImSin(a) * r)); + } + window->DrawList->PathStroke(color_alpha(c, 1.f), false, th); + }; + + auto draw_pins = [window, centre, pins, start] (float rmin, float rmax, const ImColor &c, float th) { + const float pin_angle_offset = PI_2 / pins; + for (size_t i = 0; i <= pins; i++) { + float a = start + (i * pin_angle_offset); + window->DrawList->AddLine(ImVec2(centre.x + ImCos(a) * rmin, centre.y + ImSin(a) * rmin), + ImVec2(centre.x + ImCos(a) * rmax, centre.y + ImSin(a) * rmax), + color_alpha(c, 1.f), th); + } + }; + + draw_circle(bg_radius, bg_color, line_th); + draw_pins(bg_radius, radius, bg_color, line_th); + draw_circle(radius, color, line_th); + } + + inline void SpinnerAtom(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int elipses = 3) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime()* speed; + elipses = std::min(elipses, 3); + + auto draw_rotated_ellipse = [&] (float alpha, float start) { + alpha = ImFmod(alpha, IM_PI); + float a = radius; + float b = radius / 2.f; + + window->DrawList->PathClear(); + for (int i = 0; i < num_segments; ++i) { + float anga = (i * (PI_2 / (num_segments - 1))); + + float xx = a * ImCos(anga) * ImCos(alpha) + b * ImSin(anga) * ImSin(alpha) + centre.x; + float yy = b * ImSin(anga) * ImCos(alpha) - a * ImCos(anga) * ImSin(alpha) + centre.y; + window->DrawList->PathLineTo({xx, yy}); + } + window->DrawList->PathStroke(color_alpha(color, 1.f), false, thickness); + + float anga = ImFmod(start, PI_2); + float x = a * ImCos(anga) * ImCos(alpha) + b * ImSin(anga) * ImSin(alpha) + centre.x; + float y = b * ImSin(anga) * ImCos(alpha) - a * ImCos(anga) * ImSin(alpha) + centre.y; + return ImVec2{x, y}; + }; + + ImVec2 ppos[3]; + for (int i = 0; i < elipses; ++i) { + ppos[i % 3] = draw_rotated_ellipse((IM_PI * (float)i/ elipses), start * (1.f + 0.1f * i)); + } + + ImColor pcolors[3] = {ImColor(255, 0, 0), ImColor(0, 255, 0), ImColor(0, 0, 255)}; + for (int i = 0; i < elipses; ++i) { + window->DrawList->AddCircleFilled(ppos[i], thickness * 2, color_alpha(pcolors[i], 1.f), int(num_segments / 3.f)); + } + } + + inline void SpinnerPatternRings(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int elipses = 3) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime()* speed; + elipses = std::max(elipses, 1); + + auto draw_rotated_ellipse = [&] (float alpha, float tr, float y) { + alpha = ImFmod(alpha, IM_PI); + float a = radius; + float b = radius / 2.f; + + const float bg_angle_offset = PI_2 / (num_segments - 1); + ImColor c = color_alpha(color, tr); + window->DrawList->PathClear(); + for (int i = 0; i < num_segments; ++i) { + float anga = (i * bg_angle_offset); + float xx = a * ImCos(anga) * ImCos(alpha) + b * ImSin(anga) * ImSin(alpha) + centre.x; + float yy = b * ImSin(anga) * ImCos(alpha) - a * ImCos(anga) * ImSin(alpha) + centre.y + y; + window->DrawList->PathLineTo({xx, yy}); + } + window->DrawList->PathStroke(c, false, thickness); + }; + + for (int i = 0; i < elipses; ++i) + { + const float h = (0.5f * ImSin(start + (IM_PI / elipses) * i)); + draw_rotated_ellipse(0.f, 0.1f + (0.9f / elipses) * i, radius * h); + } + } + + inline void SpinnerPatternEclipse(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int elipses = 3, float delta_a = 2.f, float delta_y = 0.f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime()* speed; + elipses = std::max(elipses, 1); + + auto draw_rotated_ellipse = [&] (const ImVec2 &pp, float alpha, float tr, float r, float x, float y) { + alpha = ImFmod(alpha, IM_PI); + float a = r; + float b = r / delta_a; + + ImColor c = color_alpha(color, tr); + window->DrawList->PathClear(); + for (int i = 0; i < num_segments; ++i) { + float anga = (i * PI_2 / (num_segments - 1)); + float xx = a * ImCos(anga) * ImCos(alpha) + b * ImSin(anga) * ImSin(alpha) + pp.x + x; + float yy = b * ImSin(anga) * ImCos(alpha) - a * ImCos(anga) * ImSin(alpha) + pp.y + y; + window->DrawList->PathLineTo({xx, yy}); + } + window->DrawList->PathStroke(c, false, thickness); + }; + + for (int i = 0; i < elipses; ++i) + { + const float rkoeff = (0.5f + 0.5f * ImSin(start + (IM_PI / elipses) * i)); + const float h = ((1.f / elipses) * (i+1)); + const float anga = start + (i * PI_DIV_2 / elipses); + const float yoff = ((1.f / elipses) * i) * delta_y; + float a = (radius * (1.f - h)); + float b = (radius * (1.f - h)) / delta_a; + float xx = a * ImCos(anga) * ImCos(0) + b * ImSin(anga) * ImSin(0) + centre.x; + float yy = b * ImSin(anga) * ImCos(0) - a * ImCos(anga) * ImSin(0) + centre.y; + draw_rotated_ellipse(ImVec2(xx, yy), 0.f, 0.3f + (0.7f / elipses) * i, radius * h, 0.f, yoff * radius); + } + } + + inline void SpinnerPatternSphere(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int elipses = 3) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed * 3.f, size.y); + elipses = std::max(elipses, 1); + + auto draw_rotated_ellipse = [&] (float alpha, float tr, float y, float r) { + alpha = ImFmod(alpha, IM_PI); + float a = r; + float b = r / 4.f; + + ImColor c = color_alpha(color, tr); + window->DrawList->PathClear(); + for (int i = 0; i < num_segments; ++i) { + float anga = (i * PI_2 / (num_segments - 1)); + float xx = a * ImCos(anga) * ImCos(alpha) + b * ImSin(anga) * ImSin(alpha) + centre.x; + float yy = b * ImSin(anga) * ImCos(alpha) - a * ImCos(anga) * ImSin(alpha) + pos.y + y; + window->DrawList->PathLineTo({xx, yy}); + } + window->DrawList->PathStroke(c, false, thickness); + }; + + float offset = 0; + float half_size = size.y * 0.5f; + for (size_t i = 0; i < elipses; i++) + { + offset = ImFmod(start + i * (size.y / elipses), size.y); + const float th = (offset > half_size) + ? 1.f - (offset - half_size) / half_size + : offset / half_size; + draw_rotated_ellipse(0.f, th, offset, ImSin(offset / size.y * IM_PI) * radius); + } + } + + inline void SpinnerRingSynchronous(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int elipses = 3) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + + num_segments *= 4; + const float aoffset = ImFmod((float)ImGui::GetTime(), PI_2); + const float bofsset = (aoffset > IM_PI) ? IM_PI : aoffset; + const float angle_offset = PI_2 / num_segments; + float ared_min = 0, ared = 0; + if (aoffset > IM_PI) + ared_min = aoffset - IM_PI; + + auto draw_ellipse = [&] (float alpha, float y, float r) { + window->DrawList->PathClear(); + for (size_t i = 0; i <= num_segments + 1; i++) + { + ared = start + (i * angle_offset); + + if (i * angle_offset < ared_min * 2) + continue; + + if (i * angle_offset > bofsset * 2.f) + break; + + float a = r; + float b = r * 0.25f; + + const float xx = a * ImCos(ared) * ImCos(alpha) + b * ImSin(ared) * ImSin(alpha) + centre.x; + const float yy = b * ImSin(ared) * ImCos(alpha) - a * ImCos(ared) * ImSin(alpha) + pos.y + y; + window->DrawList->PathLineTo(ImVec2(xx, yy)); + } + window->DrawList->PathStroke(color_alpha(color, 1.f), false, thickness); + }; + + for (int i = 0; i < elipses; ++i) + { + float y = i * ((float)(size.y * 0.7f) / (float)elipses) + (size.y * 0.15f); + draw_ellipse(0, y, radius * ImSin((i + 1) * (IM_PI / (elipses + 1)))); + } + } + + inline void SpinnerRingWatermarks(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int elipses = 3) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime() * speed; + num_segments *= 4; + + const float angle_offset = PI_2 / num_segments; + auto draw_ellipse = [&] (float s, float alpha, float x, float y, float r) { + const float aoffset = ImFmod((float)s, PI_2); + const float bofsset = (aoffset > IM_PI) ? IM_PI : aoffset; + float ared_min = 0, ared = 0; + if (aoffset > IM_PI) + ared_min = aoffset - IM_PI; + + window->DrawList->PathClear(); + for (size_t i = 0; i <= num_segments + 1; i++) + { + ared = s + (i * angle_offset); + + if (i * angle_offset < ared_min * 2) + continue; + + if (i * angle_offset > bofsset * 2.f) + break; + + float a = r; + float b = r * 0.25f; + + const float xx = a * ImCos(ared) * ImCos(alpha) + b * ImSin(ared) * ImSin(alpha) + centre.x + x; + const float yy = b * ImSin(ared) * ImCos(alpha) - a * ImCos(ared) * ImSin(alpha) + pos.y + y; + window->DrawList->PathLineTo(ImVec2(xx, yy)); + } + window->DrawList->PathStroke(color_alpha(color, 1.f), false, thickness); + }; + + for (int i = 0; i < elipses; ++i) + { + float y = i * ((float)(size.y * 0.7f) / (float)elipses) + (size.y * 0.15f); + float x = -i * (radius / elipses); + draw_ellipse(start + (i * IM_PI / (elipses * 2)), -PI_DIV_4, x, y, radius); + } + } + + inline void SpinnerRotatedAtom(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int elipses = 3, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime()* speed; + auto draw_rotated_ellipse = [&] (float alpha) { + std::array pts; + + alpha = ImFmod(alpha, IM_PI); + float a = radius; + float b = radius / 2.f; + + const float bg_angle_offset = PI_2 / num_segments; + for (size_t i = 0; i < num_segments; ++i) { + float anga = (i * bg_angle_offset); + float h = ease((ease_mode)mode, start, radius); + + pts[i].x = (a + h) * ImCos(anga) * ImCos(alpha) + b * ImSin(anga) * ImSin(alpha) + centre.x; + pts[i].y = (b + h) * ImSin(anga) * ImCos(alpha) - a * ImCos(anga) * ImSin(alpha) + centre.y; + } + for (size_t i = 1; i < num_segments; ++i) { + window->DrawList->AddLine(pts[i-1], pts[i], color_alpha(color, 1.f), thickness); + } + window->DrawList->AddLine(pts[num_segments-1], pts[0], color_alpha(color, 1.f), thickness); + }; + + for (int i = 0; i < elipses; ++i) { + draw_rotated_ellipse(start + (IM_PI * (float)i/ elipses)); + } + } + + inline void SpinnerRainbowBalls(const char *label, float radius, float thickness, const ImColor &color, float speed, int balls = 5, int mode = 0, int rings = 1, int mx = 1) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed * 3.f, IM_PI); + const float colorback = 0.3f + 0.2f * ImSin((float)ImGui::GetTime() * speed); + const float rstart = ImFmod((float)ImGui::GetTime() * speed, PI_2); + const float radius1 = (0.7f + 0.2f * ImSin(start)) * radius; + const float angle_offset = PI_2 / balls; + const bool rainbow = ((ImU32)color.Value.w) == 0; + + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + for (int j = 0; j < rings; j++) { + const float ring_r = radius1 * (rings > 1 ? ((j+1) / (float)rings) : 1); + float ring_angle = (j * (PI_2 / rings)); + for (int i = 0; i < balls; i++) { + const float a = rstart + (i * angle_offset) + ring_angle; + ImColor c = rainbow ? ImColor::HSV(out_h + i * (1.f / balls) + colorback, out_s, out_v) : color; + float rb = ring_r + ease((ease_mode)mode, start, ring_r); + float ax, ay; + switch (mx) { + default: ax = ImCos(a) * rb; ay = ImSin(a) * rb; break; + case 1: ax = ImCos(a) * rb; ay = ImSin(a) * rb + ImSin(a * 8) * rb * 0.15f; break; + case 2: { float pulse = 0.8f + 0.2f * ImSin(start * 2); ax = ImCos(a) * rb * pulse; ay = ImSin(a) * rb * pulse; } break; + case 3: { float R = rb, r = rb * 0.3f, d = rb * 0.1f; float t = a; ax = (R - r) * ImCos(t) + d * ImCos((R - r) / r * t); ay = (R - r) * ImSin(t) - d * ImSin((R - r) / r * t); } break; + case 4: { float t = a; ax = rb * ImCos(t) / (1 + ImSin(t) * ImSin(t)); ay = rb * ImSin(t) * ImCos(t) / (1 + ImSin(t) * ImSin(t)); } break; + case 5: { float zigzag = (ImSin(a * 8) > 0) ? rb * 0.3f : -rb * 0.3f; ax = ImCos(a) * rb + zigzag * ImCos(a + IM_PI / 2); ay = ImSin(a) * rb + zigzag * ImSin(a + IM_PI / 2); } break; + case 6: ax = ImCos(a) * (rb + ImSin(a * 3) * rb * 0.3f); ay = ImSin(a) * (rb + ImSin(a * 3) * rb * 0.3f); break; + case 7: + { + float t = ImFmod(a, PI_2) / PI_2; + if (t < 0.25f) { ax = rb; ay = (t * 4 - 0.5f) * 2 * rb; } + else if (t < 0.5f) { ax = (0.75f - t * 4) * 2 * rb; ay = rb; } + else if (t < 0.75f) { ax = -rb; ay = (1.25f - t * 4) * 2 * rb; } + else { ax = (t * 4 - 1.75f) * 2 * rb; ay = -rb; } + } + break; + case 8: ax = ImCos(a) * rb; ay = ImSin(a) * rb + ImSin(a * 4) * rb * 0.2f; break; + } + window->DrawList->AddCircleFilled(ImVec2(centre.x + ax, centre.y + ay), thickness, color_alpha(c, 1.f), num_segments); + } + } + } + + inline void SpinnerRainbowShot(const char *label, float radius, float thickness, const ImColor &color, float speed, int balls = 5, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed * 3.f, PI_2); + const float colorback = 0.3f + 0.2f * ImSin((float)ImGui::GetTime() * speed); + const float rstart = ImFmod((float)ImGui::GetTime() * speed, PI_2); + const float angle_offset = PI_2 / balls; + const bool rainbow = ((ImU32)color.Value.w) == 0; + + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + for (int i = 0; i <= balls; i++) + { + float centera = start - PI_DIV_2 + (i * angle_offset); + float rmul = ImMax(0.2f, 1.f - ImSin(centera)); + const float radius1 = ImMin(radius * rmul, radius); + const float a = (i * angle_offset); + ImColor c = rainbow ? ImColor::HSV(out_h + i * (1.f / balls) + colorback, out_s, out_v) : color; + float ax, ay; + switch(mode) { + default: ax = ImCos(a) * radius1; ay = ImSin(a) * radius1; break; + case 1: ax = ImCos(a) * radius1; ay = ImSin(a) * radius1 + ImSin(a * 4) * radius1 * 0.2f; break; + case 2: { float pulse = 0.8f + 0.2f * ImSin(start * 2); ax = ImCos(a) * radius1 * pulse; ay = ImSin(a) * radius1 * pulse; } break; + case 3: { float R = radius1, r = radius1 * 0.3f, d = radius1 * 0.1f; float t = a; ax = (R - r) * ImCos(t) + d * ImCos((R - r) / r * t); ay = (R - r) * ImSin(t) - d * ImSin((R - r) / r * t); } break; + case 4: { float t = a; ax = radius1 * ImCos(t) / (1 + ImSin(t) * ImSin(t)); ay = radius1 * ImSin(t) * ImCos(t) / (1 + ImSin(t) * ImSin(t)); } break; + case 5: { float zigzag = (ImSin(a * 8) > 0) ? radius1 * 0.3f : -radius1 * 0.3f; ax = ImCos(a) * radius1 + zigzag * ImCos(a + IM_PI / 2); ay = ImSin(a) * radius1 + zigzag * ImSin(a + IM_PI / 2); } break; + case 6: ax = ImCos(a) * (radius1 + ImSin(a * 3) * radius1 * 0.3f); ay = ImSin(a) * (radius1 + ImSin(a * 3) * radius1 * 0.3f); break; + } + window->DrawList->AddLine(centre, ImVec2(centre.x + ax, centre.y + ay), color_alpha(c, 1.f), thickness); + } + } + + inline void SpinnerSpiral(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + float a = radius / num_segments; + float b = a; + + ImVec2 last = centre; + for (size_t arc_num = 0; arc_num < (num_segments * arcs); ++arc_num) + { + float angle = (PI_2 / num_segments) * arc_num; + float x = centre.x + (a + b * angle) * ImCos(start + angle); + float y = centre.y + (a + b * angle) * ImSin(start + angle); + + window->DrawList->AddLine(last, ImVec2(x, y), color_alpha(color, 1.f), thickness); + last = ImVec2(x, y); + } + } + + inline void SpinnerSpiralEye(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + float a = (radius * 3.f) / num_segments; + float b = a; + num_segments *= 4; + + auto half_eye = [&] (float side) { + for (size_t arc_num = 0; arc_num < num_segments; ++arc_num) { + float angle = (PI_2 / num_segments) * arc_num; + float x = centre.x + (a + b * angle) * ImCos((start + angle) * side); + float y = centre.y + (a + b * angle) * ImSin((start + angle) * side); + + window->DrawList->AddCircleFilled(ImVec2(x, y), thickness, color_alpha(color, 1.f)); + } + }; + + half_eye(1.f); + half_eye(-1.f); + } + + inline void SpinnerBarChartSine(const char *label, float radius, float thickness, const ImColor &color, float speed, int bars = 5, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const ImGuiStyle &style = GImGui->Style; + const float nextItemKoeff = 1.5f; + const float yOffsetKoeftt = 0.8f; + const float heightSpeed = 0.8f; + + const float start = (float)ImGui::GetTime() * speed; + const float offset = IM_PI / bars; + for (int i = 0; i < bars; i++) + { + const float ab = ease((ease_mode)mode, start + i * PI_DIV(2) / num_segments, IM_PI, 1.0f, 0.0f); + const float angle = ImMax(PI_DIV_2, (1.f - i/(float)bars) * IM_PI); + float a = start + ab + (IM_PI - i * offset); + ImColor c = color_alpha(color, ImMax(0.1f, ImSin(a * heightSpeed))); + float h = mode ? ImSin(a) * size.y / 2.f + : (0.6f + 0.4f * c.Value.w) * size.y; + float halfs = mode ? 0 : size.y / 2.f; + window->DrawList->AddRectFilled(ImVec2(pos.x + style.FramePadding.x + i * (thickness * nextItemKoeff) - thickness / 2, centre.y + halfs), + ImVec2(pos.x + style.FramePadding.x + i * (thickness * nextItemKoeff) + thickness / 2, centre.y + halfs - h * yOffsetKoeftt), + c); + } + } + + inline void SpinnerBarChartAdvSine(const char *label, float radius, float thickness, const ImColor &color, float speed, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float nextItemKoeff = 1.5f; + const float start = (float)ImGui::GetTime() * speed; + const int bars = radius * 2 / thickness; + const float offset = PI_DIV_2 / bars; + for (int i = 0; i < bars; i++) + { + float a = start + (PI_DIV_2 - i * offset); + float halfsx = thickness * ImSin(a); + float halfsy = (ImMax(0.1f, ImSin(a) + 1.f)) * radius * 0.5f; + window->DrawList->AddRectFilled(ImVec2(pos.x + i * (thickness * nextItemKoeff) - thickness / 2 + halfsx, centre.y + halfsy), + ImVec2(pos.x + i * (thickness * nextItemKoeff) + thickness / 2 + halfsx, centre.y - halfsy), + color); + } + } + + inline void SpinnerBarChartAdvSineFade(const char *label, float radius, float thickness, const ImColor &color, float speed, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime() * speed; + const int bars = radius * 2 / thickness; + const float offset = PI_DIV_2 / bars; + for (int i = 0; i < bars; i++) + { + float a = start - i * offset; + float halfsy = ImMax(0.1f, ImCos(a) + 1.f) * radius * 0.5f; + window->DrawList->AddRectFilled(ImVec2(pos.x + i * thickness - thickness / 2, centre.y + halfsy), + ImVec2(pos.x + i * thickness + thickness / 2, centre.y - halfsy), + color_alpha(color, ImMax(0.1f, halfsy / radius))); + } + } + + inline void SpinnerBarChartRainbow(const char *label, float radius, float thickness, const ImColor &color, float speed, int bars = 5, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const ImGuiStyle &style = GImGui->Style; + const float nextItemKoeff = 1.5f; + const float yOffsetKoeftt = 0.8f; + + const float start = (float)ImGui::GetTime() * speed; + const float hspeed = 0.1f + ImSin((float)ImGui::GetTime() * 0.1f) * 0.05f; + constexpr float rkoeff[6] = {4.f, 13.f, 3.4f, 8.7f, 25.f, 11.f}; + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + for (int i = 0; i < bars; i++) + { + ImColor c = ImColor::HSV(out_h + i * 0.1f, out_s, out_v); + float h = (0.6f + 0.4f * ImSin(start + (1.f + rkoeff[i % 6] * i * hspeed)) ) * size.y; + h += ease((ease_mode)mode, start, radius); + window->DrawList->AddRectFilled(ImVec2(pos.x + style.FramePadding.x + i * (thickness * nextItemKoeff) - thickness / 2, centre.y + size.y / 2.f), + ImVec2(pos.x + style.FramePadding.x + i * (thickness * nextItemKoeff) + thickness / 2, centre.y + size.y / 2.f - h * yOffsetKoeftt), + color_alpha(c, 1.f)); + } + } + + inline void SpinnerBlocks(const char *label, float radius, float thickness, const ImColor &bg, const ImColor &color, float speed) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + ImVec2 lt{centre.x - radius, centre.y - radius}; + const float offset_block = radius * 2.f / 3.f; + + int start = (int)ImFmod((float)ImGui::GetTime() * speed, 8.f); + + const ImVec2ih poses[] = {{0, 0}, {1, 0}, {2, 0}, {2, 1}, {2, 2}, {1, 2}, {0, 2}, {0, 1}}; + + int ti = 0; + for (const auto &rpos: poses) + { + const ImColor &c = (ti == start) ? color : bg; + window->DrawList->AddRectFilled(ImVec2(lt.x + rpos.x * (offset_block), lt.y + rpos.y * offset_block), + ImVec2(lt.x + rpos.x * (offset_block) + thickness, lt.y + rpos.y * offset_block + thickness), + color_alpha(c, 1.f)); + ti++; + } + } + + inline void SpinnerTwinBlocks(const char *label, float radius, float thickness, const ImColor &bg, const ImColor &color, float speed) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float offset_block = radius * 2.f / 3.f; + ImVec2 lt{centre.x - radius - offset_block / 2.f, centre.y - radius - offset_block / 2.f}; + + int start = (int)ImFmod((float)ImGui::GetTime() * speed, 8.f); + const ImVec2ih poses[] = {{0, 0}, {1, 0}, {2, 0}, {2, 1}, {2, 2}, {1, 2}, {0, 2}, {0, 1}}; + + int ti = 0; + for (const auto &rpos: poses) + { + const ImColor &c = (ti == start) ? color : bg; + window->DrawList->AddRectFilled(ImVec2(lt.x + rpos.x * (offset_block), lt.y + rpos.y * offset_block), + ImVec2(lt.x + rpos.x * (offset_block) + thickness, lt.y + rpos.y * offset_block + thickness), + color_alpha(c, 1.f)); + ti++; + } + + lt = ImVec2{centre.x - radius + offset_block / 2.f, centre.y - radius + offset_block / 2.f}; + ti = std::size(poses) - 1; + start = (int)ImFmod((float)ImGui::GetTime() * speed * 1.1f, 8.f); + for (const auto &rpos: poses) + { + const ImColor &c = (ti == start) ? color : bg; + window->DrawList->AddRectFilled(ImVec2(lt.x + rpos.x * (offset_block), lt.y + rpos.y * offset_block), + ImVec2(lt.x + rpos.x * (offset_block) + thickness, lt.y + rpos.y * offset_block + thickness), + color_alpha(c, 1.f)); + ti--; + } + } + + inline void SpinnerSquareRandomDots(const char *label, float radius, float thickness, const ImColor &bg, const ImColor &color, float speed) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float offset_block = radius * 2.f / 3.f; + ImVec2 lt{centre.x - offset_block, centre.y - offset_block}; + + int start = (int)ImFmod((float)ImGui::GetTime() * speed, 9.f); + + ImGuiStorage* storage = window->DC.StateStorage; + const ImGuiID vtimeId = window->GetID("##vtime"); + const ImGuiID vvald = window->GetID("##vval"); + int vtime = storage->GetInt(vtimeId, 0); + int vval = storage->GetInt(vvald, 0); + + if (vtime != start) { + vval = rand() % 9; + storage->SetInt(vvald, vval); + storage->SetInt(vtimeId, start); + } + + const ImVec2ih poses[] = {{0, 0}, {1, 0}, {2, 0}, {2, 1}, {2, 2}, {1, 2}, {0, 2}, {0, 1}, {1, 1}}; + int ti = 0; + for (const auto &rpos: poses) + { + const ImColor &c = (ti == vval) ? color : bg; + window->DrawList->AddCircleFilled(ImVec2(lt.x + rpos.x * (offset_block), lt.y + rpos.y * offset_block), thickness, + color_alpha(c, 1.f)); + ti++; + } + } + + inline void SpinnerScaleBlocks(const char *label, float radius, float thickness, const ImColor &color, float speed, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + ImVec2 lt{centre.x - radius, centre.y - radius}; + const float offset_block = radius * 2.f / 3.f; + + const ImVec2ih poses[] = {{0, 0}, {1, 0}, {2, 0}, {0, 1}, {1, 1}, {2, 1}, {0, 2}, {1, 2}, {2, 2}}; + constexpr float rkoeff[9] = {0.1f, 0.15f, 0.17f, 0.25f, 0.6f, 0.15f, 0.1f, 0.12f, 0.22f}; + + int ti = 0; + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + for (const auto &rpos: poses) + { + ImColor c = ImColor::HSV(out_h + ti * 0.1f, out_s, out_v); + if (mode) { + float h = (0.1f + 0.4f * ImSin((float)ImGui::GetTime() * (speed * rkoeff[ti % 9]))); + window->DrawList->AddCircleFilled(ImVec2(lt.x + rpos.x * (offset_block), lt.y + rpos.y * offset_block), std::max(1.f, h * thickness), + color_alpha(c, 1.f)); + } else { + float h = (0.8f + 0.4f * ImSin((float)ImGui::GetTime() * (speed * rkoeff[ti % 9]))); + window->DrawList->AddRectFilled(ImVec2(lt.x + rpos.x * (offset_block), lt.y + rpos.y * offset_block), + ImVec2(lt.x + rpos.x * (offset_block) + h * thickness, lt.y + rpos.y * offset_block + h * thickness), + color_alpha(c, 1.f)); + } + ti++; + } + } + + inline void SpinnerScaleSquares(const char *label, float radius, float thikness, const ImColor &color, float speed) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + ImVec2 lt{centre.x - radius, centre.y - radius}; + const float offset_block = radius * 2.f / 3.f; + const float hside = (thikness / 2.f); + + const ImVec2ih poses[] = {{0, 0}, {1, 0}, {0, 1}, {2, 0}, {1, 1}, {0, 2}, {2, 1}, {1, 2}, {2, 2}}; + const float offsets[] = {0.f, 0.8f, 0.8f, 1.6f, 1.6f, 1.6f, 2.4f, 2.4f, 3.2f}; + + int ti = 0; + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + for (const auto &rpos: poses) + { + const ImColor c = ImColor::HSV(out_h + offsets[ti], out_s, out_v); + const float strict = (0.5f + 0.5f * ImSin((float)-ImGui::GetTime() * speed + offsets[ti % 9])); + const float side = ImClamp(strict + 0.1f, 0.1f, 1.f) * hside; + window->DrawList->AddRectFilled(ImVec2(lt.x + hside + (rpos.x * offset_block) - side, lt.y + hside + (rpos.y * offset_block) - side), + ImVec2(lt.x + hside + (rpos.x * offset_block) + side, lt.y + hside + (rpos.y * offset_block) + side), + color_alpha(c, 1.f)); + ti++; + } + } + + inline void SpinnerSquishSquare(const char *label, float radius, const ImColor &color, float speed) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + const float side = ImSin((float)-start) * radius; + bool type = (start > IM_PI) ? 1 : 0; + if (type) { + if (start > IM_PI && start < IM_PI + PI_DIV_2) { + window->DrawList->AddRectFilled(ImVec2(centre.x - side, centre.y - radius), ImVec2(centre.x + side, centre.y + radius), color_alpha(color, 1.f)); + } else { + window->DrawList->AddRectFilled(ImVec2(centre.x - radius, centre.y - side), ImVec2(centre.x + radius, centre.y + side), color_alpha(color, 1.f)); + } + } else { + if (start < PI_DIV_2) { + window->DrawList->AddRectFilled(ImVec2(centre.x - radius, centre.y - side), ImVec2(centre.x + radius, centre.y + side), color_alpha(color, 1.f)); + } else { + window->DrawList->AddRectFilled(ImVec2(centre.x - side, centre.y - radius), ImVec2(centre.x + side, centre.y + radius), color_alpha(color, 1.f)); + } + } + } + + inline void SpinnerFluid(const char *label, float radius, const ImColor &color, float speed, int bars = 3) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const ImGuiStyle &style = GImGui->Style; + const float hspeed = 0.1f + ImSin((float)ImGui::GetTime() * 0.1f) * 0.05f; + constexpr float rkoeff[6][3] = {{0.15f, 0.1f, 0.1f}, {0.033f, 0.15f, 0.8f}, {0.017f, 0.25f, 0.6f}, {0.037f, 0.1f, 0.4f}, {0.25f, 0.1f, 0.3f}, {0.11f, 0.1f, 0.2f}}; + const float j_k = radius * 2.f / num_segments; + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + for (int i = 0; i < bars; i++) + { + ImColor c = color_alpha(ImColor::HSV(out_h - i * 0.1f, out_s, out_v), rkoeff[i % 6][1]); + for (int j = 0; j < num_segments; ++j) { + float h = (0.6f + 0.3f * ImSin((float)ImGui::GetTime() * (speed * rkoeff[i % 6][2] * 2.f) + (2.f * rkoeff[i % 6][0] * j * j_k))) * (radius * 2.f * rkoeff[i % 6][2]); + window->DrawList->AddRectFilled(ImVec2(pos.x + style.FramePadding.x + j * j_k, centre.y + size.y / 2.f), + ImVec2(pos.x + style.FramePadding.x + (j + 1) * (j_k), centre.y + size.y / 2.f - h), + c); + } + } + } + + inline void SpinnerFluidPoints(const char *label, float radius, float thickness, const ImColor &color, float speed, size_t dots = 6, float delta = 0.35f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const ImGuiStyle &style = GImGui->Style; + const float rkoeff[3] = {0.033f, 0.3f, 0.8f}; + const float hspeed = 0.1f + ImSin((float)ImGui::GetTime() * 0.1f) * 0.05f; + const float j_k = radius * 2.f / num_segments; + + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + for (int j = 0; j < num_segments; ++j) { + float h = (0.6f + delta * ImSin((float)ImGui::GetTime() * (speed * rkoeff[2] * 2.f) + (2.f * rkoeff[0] * j * j_k))) * (radius * 2.f * rkoeff[2]); + for (int i = 0; i < dots; i++) { + ImColor c = color_alpha(ImColor::HSV(out_h - i * 0.1f, out_s, out_v), 1.f); + window->DrawList->AddCircleFilled(ImVec2(pos.x + style.FramePadding.x + j * j_k, centre.y + size.y / 2.f - (h / dots) * i), thickness, c); + } + } + } + + inline void SpinnerArcPolarFade(const char *label, float radius, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float arc_angle = PI_2 / (float)arcs; + const float angle_offset = arc_angle / num_segments; + constexpr float rkoeff[6][3] = {{0.15f, 0.1f, 0.1f}, {0.033f, 0.15f, 0.8f}, {0.017f, 0.25f, 0.6f}, {0.037f, 0.1f, 0.4f}, {0.25f, 0.1f, 0.3f}, {0.11f, 0.1f, 0.2f}}; + for (size_t arc_num = 0; arc_num < arcs; ++arc_num) + { + const float b = arc_angle * arc_num - PI_DIV_2 - PI_DIV_4; + const float e = arc_angle * arc_num + arc_angle - PI_DIV_2 - PI_DIV_4; + const float a = arc_angle * arc_num; + float h = (0.6f + 0.3f * ImSin((float)ImGui::GetTime() * (speed * rkoeff[arc_num % 6][2] * 2.f) + (2 * rkoeff[arc_num % 6][0]))); + ImColor c = color_alpha(color, h); + c.Value.w += ease((ease_mode)mode, h, arc_angle); + + window->DrawList->PathClear(); + window->DrawList->PathLineTo(centre); + for (size_t i = 0; i <= num_segments + 1; i++) + { + const float ar = arc_angle * arc_num + (i * angle_offset) - PI_DIV_2 - PI_DIV_4; + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(ar) * radius, centre.y + ImSin(ar) * radius)); + } + window->DrawList->PathFillConvex(c); + } + } + + inline void SpinnerArcPolarRadius(const char *label, float radius, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float arc_angle = PI_2 / (float)arcs; + const float angle_offset = arc_angle / num_segments; + constexpr float rkoeff[6][3] = {{0.15f, 0.1f, 0.41f}, {0.033f, 0.15f, 0.8f}, {0.017f, 0.25f, 0.6f}, {0.037f, 0.1f, 0.4f}, {0.25f, 0.1f, 0.3f}, {0.11f, 0.1f, 0.2f}}; + float out_h, out_s, out_v; + const float start = (float)ImGui::GetTime(); + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + for (size_t arc_num = 0; arc_num < arcs; ++arc_num) + { + const float b = arc_angle * arc_num - PI_DIV_2 - PI_DIV_4; + const float e = arc_angle * arc_num + arc_angle - PI_DIV_2 - PI_DIV_4; + const float a = arc_angle * arc_num; + float r = (0.6f + 0.3f * ImSin(start * (speed * rkoeff[arc_num % 6][2] * 2.f) + (2.f * rkoeff[arc_num % 6][0]))); + + window->DrawList->PathClear(); + window->DrawList->PathLineTo(centre); + ImColor c = ImColor::HSV(out_h + arc_num * 0.31f, out_s, out_v); + for (size_t i = 0; i <= num_segments + 1; i++) + { + const float ar = arc_angle * arc_num + (i * angle_offset) - PI_DIV_2 - PI_DIV_4; + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(ar) * (radius * r), centre.y + ImSin(ar) * (radius * r))); + } + window->DrawList->PathFillConvex(color_alpha(c, 1.f)); + } + } + + inline void SpinnerCaleidoscope(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t arcs = 6, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float start = (float)ImGui::GetTime() * speed; + float astart = ImFmod(start, PI_2 / arcs); + start -= astart; + const float angle_offset = PI_2 / arcs; + const float angle_offset_t = angle_offset * 0.3f; + arcs = ImMin(arcs, 32); + + auto get_points = [&] (float left, float right, float r) -> std::array { + const float rmin = r - thickness; + return { + ImVec2(centre.x + ImCos(left) * rmin, centre.y + ImSin(left) * rmin), + ImVec2(centre.x + ImCos(left) * r, centre.y + ImSin(left) * r), + ImVec2(centre.x + ImCos(right) * r, centre.y + ImSin(right) * r), + ImVec2(centre.x + ImCos(right) * rmin, centre.y + ImSin(right) * rmin) + }; + }; + + auto draw_sectors = [&] (float s, const std::function& color_func, float r) { + for (size_t i = 0; i <= arcs; i++) { + float left = s + (i * angle_offset) - angle_offset_t; + float right = s + (i * angle_offset) + angle_offset_t; + auto points = get_points(left, right, r); + window->DrawList->AddConvexPolyFilled(points.data(), 4, color_alpha(color_func(i), 1.f)); + } + }; + + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + draw_sectors(start, [&] (size_t i) { return ImColor::HSV(out_h + i * 0.31f, out_s, out_v); }, radius); + switch (mode) { + case 0: draw_sectors(-start * 0.78f, [&] (size_t i) { return ImColor::HSV(out_h + i * 0.31f, out_s, out_v); }, radius - thickness - 2); break; + case 1: + { + ImColor c = color; + float lerp_koeff = (ImSin((float)ImGui::GetTime() * speed) + 1.f) * 0.5f; + c.Value.w = ImMax(0.1f, ImMin(lerp_koeff, 1.f)); + float dr = radius - thickness - 3; + window->DrawList->AddCircleFilled(centre, dr, c, num_segments); + } + break; + } + } + + // spinner idea by nitz 'Chris Dailey' + inline void SpinnerHboDots(const char *label, float radius, float thickness, const ImColor &color = white, float minfade = 0.0f, float ryk = 0.f, float speed = 1.1f, size_t dots = 6, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime() * speed; + + for (size_t i = 0; i < dots; i++) + { + const float ab = ease((ease_mode)mode, start + i * PI_DIV(2) / dots, IM_PI, 1.0f, 0.0f); + const float astart = start + ab + PI_2_DIV(dots) * i; + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImSin(astart) * radius, centre.y + ryk * ImCos(astart) * radius), thickness, + color_alpha(color, ImMax(minfade, ImSin(astart + PI_DIV_2))), + 8); + } + } + + inline void SpinnerMoonDots(const char *label, float radius, float thickness, const ImColor &first, const ImColor &second, float speed = 1.1f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime() * speed; + + const float astart = ImFmod(start, IM_PI * 2.f); + const float bstart = astart + IM_PI; + + const float sina = ImSin(astart); + const float sinb = ImSin(bstart); + + if (astart < PI_DIV_2 || astart > IM_PI + PI_DIV_2) { + window->DrawList->AddCircleFilled(ImVec2(centre.x + sina * thickness, centre.y), thickness, color_alpha(first, 1.f), 16); + window->DrawList->AddCircleFilled(ImVec2(centre.x + sinb * thickness, centre.y), thickness, color_alpha(second, 1.f), 16); + window->DrawList->AddCircle(ImVec2(centre.x + sinb * thickness, centre.y), thickness, color_alpha(first, 1.f), 16); + } else { + window->DrawList->AddCircleFilled(ImVec2(centre.x + sinb * thickness, centre.y), thickness, color_alpha(second, 1.f), 16); + window->DrawList->AddCircle(ImVec2(centre.x + sinb * thickness, centre.y), thickness, color_alpha(first, 1.f), 16); + window->DrawList->AddCircleFilled(ImVec2(centre.x + sina * thickness, centre.y), thickness, color_alpha(first, 1.f), 16); + } + } + + inline void SpinnerTwinHboDots(const char *label, float radius, float thickness, const ImColor &color = white, float minfade = 0.0f, float ryk = 0.f, float speed = 1.1f, size_t dots = 6, float delta = 0.f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime() * speed; + + for (size_t i = 0; i < dots; i++) + { + const float astart = start + PI_2_DIV(dots) * i; + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImSin(astart) * radius, centre.y + ryk * ImCos(astart) * radius + radius * delta), thickness, + color_alpha(color, ImMax(minfade, ImSin(astart + PI_DIV_2))), + 8); + } + + for (size_t i = 0; i < dots; i++) + { + const float astart = start + PI_2_DIV(dots) * i; + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImSin(astart) * radius, centre.y - ryk * ImCos(astart) * radius - radius * delta), thickness, + color_alpha(color, ImMax(minfade, ImSin(astart + PI_DIV_2))), + 8); + } + } + + inline void SpinnerThreeDotsStar(const char *label, float radius, float thickness, const ImColor &color = white, float minfade = 0.0f, float ryk = 0.f, float speed = 1.1f, float delta = 0.f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime() * speed; + + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImSin(-start) * radius, centre.y - ryk * ImCos(-start) * radius + radius * delta), thickness, color_alpha(color, ImMax(minfade, ImSin(-start + PI_DIV_2))), 8); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImSin(start) * radius, centre.y - ryk * ImCos(start) * radius - radius * delta), thickness, color_alpha(color, ImMax(minfade, ImSin(start + PI_DIV_2))), 8); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImSin(start + PI_DIV_4) * radius, centre.y - ryk * ImCos(start + PI_DIV_4) * radius - radius * delta), thickness, color_alpha(color, ImMax(minfade, ImSin(start + PI_DIV_4 + PI_DIV_2))), 8); + } + + inline void SpinnerSineArcs(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + float length = ImFmod(start, IM_PI); + const float dangle = ImSin(length) * IM_PI * 0.35f; + const float angle_offset = IM_PI / num_segments; + + auto draw_spring = [&] (float k) { + float arc = 0.f; + window->DrawList->PathClear(); + for (size_t i = 0; i < num_segments; i++) { + float a = start + (i * angle_offset); + if (ImSin(a) < 0.f) + a *= -1; + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * radius, centre.y + k * ImSin(a) * radius)); + arc += angle_offset; + if (arc > dangle) + break; + } + window->DrawList->PathStroke(color_alpha(color, 1.f), false, thickness); + }; + + draw_spring(1); + draw_spring(-1); + } + + inline void SpinnerTrianglesShift(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = half_white, float speed = 2.8f, size_t bars = 8) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + ImColor c = color; + float lerp_koeff = (ImSin((float)ImGui::GetTime() * speed) + 1.f) * 0.5f; + c.Value.w = ImMax(0.1f, ImMin(lerp_koeff, 1.f)); + + const float angle_offset = PI_2 / bars; + float start = (float)ImGui::GetTime() * speed; + const float astart = ImFmod(start, angle_offset); + const float save_start = start; + start -= astart; + const float angle_offset_t = angle_offset * 0.3f; + bars = ImMin(bars, 32); + + const float rmin = radius - thickness; + auto get_points = [&] (float left, float right, float r1, float r2) -> std::array { + return { + ImVec2(centre.x + ImCos(left) * r1, centre.y + ImSin(left) * r1), + ImVec2(centre.x + ImCos(left) * r2, centre.y + ImSin(left) * r2), + ImVec2(centre.x + ImCos(right) * r2, centre.y + ImSin(right) * r2), + ImVec2(centre.x + ImCos(right) * r1, centre.y + ImSin(right) * r1) + }; + }; + + ImColor rc = bg; + for (size_t i = 0; i < bars; i++) { + float left = start + (i * angle_offset) - angle_offset_t; + float right = start + (i * angle_offset) + angle_offset_t; + float centera = start - PI_DIV_2 + (i * angle_offset); + float rmul = 1.f - ImClamp(ImAbs(centera - save_start), 0.f, PI_DIV_2) / PI_DIV_2; + rc.Value.w = ImMax(rmul, 0.1f); + rmul *= 1.5f; + rmul = ImMax(0.5f, rmul); + const float r1 = ImMax(rmin * rmul, rmin); + const float r2 = ImMax(radius * rmul, radius); + auto points = get_points(left, right, r1, r2); + window->DrawList->AddConvexPolyFilled(points.data(), 4, color_alpha(rc, 1.f)); + } + } + + inline void SpinnerPointsShift(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = half_white, float speed = 2.8f, size_t bars = 8) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + ImColor c = color; + float lerp_koeff = (ImSin((float)ImGui::GetTime() * speed) + 1.f) * 0.5f; + c.Value.w = ImMax(0.1f, ImMin(lerp_koeff, 1.f)); + + const float angle_offset = PI_2 / bars; + float start = (float)ImGui::GetTime() * speed; + const float astart = ImFmod(start, angle_offset); + const float save_start = start; + start -= astart; + const float angle_offset_t = angle_offset * 0.3f; + bars = ImMin(bars, 32); + + const float rmin = radius - thickness; + + ImColor rc = bg; + for (size_t i = 0; i < bars; i++) { + float left = start + (i * angle_offset) - angle_offset_t; + float centera = start - PI_DIV_2 + (i * angle_offset); + float rmul = 1.f - ImClamp(ImAbs(centera - save_start), 0.f, PI_DIV_2) / PI_DIV_2; + rc.Value.w = ImMax(rmul, 0.1f); + rmul *= 1.f + ImSin(rmul * IM_PI); + const float r = ImMax(radius * rmul, radius); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(left) * r, centre.y + ImSin(left) * r), thickness, color_alpha(rc, 1.f), num_segments); + } + } + + inline void SpinnerSwingDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = (float)ImGui::GetTime() * speed; + constexpr int elipses = 2; + + auto get_rotated_ellipse_pos = [&] (float alpha, float start) { + std::array pts; + + alpha = ImFmod(alpha, IM_PI); + float a = radius; + float b = radius / 10.f; + + float anga = ImFmod(start, PI_2); + float x = a * ImCos(anga) * ImCos(alpha) + b * ImSin(anga) * ImSin(alpha) + centre.x; + float y = b * ImSin(anga) * ImCos(alpha) - a * ImCos(anga) * ImSin(alpha) + centre.y; + return ImVec2{x, y}; + }; + + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + for (int i = 0; i < elipses; ++i) { + ImVec2 ppos = get_rotated_ellipse_pos((IM_PI * (float)i/ elipses) + PI_DIV_4, start + PI_DIV_2 * i); + const float y_delta = ImAbs(centre.y - ppos.y); + float th_koeff = ImMax((y_delta / size.y) * 4.f, 0.5f); + window->DrawList->AddCircleFilled(ppos, th_koeff * thickness, color_alpha(ImColor::HSV(out_h + i * 0.5f, out_s, out_v), 1.f), num_segments); + } + } + + inline void SpinnerCircularPoints(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 1.8f, int lines = 8) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, radius); + const float bg_angle_offset = (PI_2) / lines; + for (size_t j = 0; j < 3; ++j) + { + const float start_offset = j * radius / 3.f; + const float rmax = ImFmod((start + start_offset), radius); + + ImColor c = color_alpha(color, ImSin((radius - rmax) / radius * IM_PI)); + for (size_t i = 0; i < lines; i++) + { + float a = (i * bg_angle_offset); + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(a) * rmax, centre.y + ImSin(a) * rmax), thickness, c, num_segments); + } + } + } + + inline void SpinnerCurvedCircle(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t circles = 1) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + const float bg_angle_offset = PI_2 / num_segments; + + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + for (int j = 0; j < circles; j++) + { + window->DrawList->PathClear(); + const float rr = radius - ((radius * 0.5f) / circles) * j; + const float start_a = start * (1.1f * (j+1)); + for (size_t i = 0; i <= num_segments; i++) + { + const float a = start_a + (i * bg_angle_offset); + const float r = rr - (0.2f * (i % 2)) * rr; + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a) * r, centre.y + ImSin(a) * r)); + } + window->DrawList->PathStroke(color_alpha(ImColor::HSV(out_h + (j * 1.f / circles), out_s, out_v), 1.f), false, thickness); + } + } + + inline void SpinnerModCircle(const char *label, float radius, float thickness, const ImColor &color = white, float ang_min = 1.f, float ang_max = 1.f, float speed = 2.8f) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + + window->DrawList->PathClear(); + for (size_t i = 0; i <= 90; i++) + { + const float ax = ((i / 90.f) * PI_2 * ang_min); + const float ay = ((i / 90.f) * PI_2 * ang_max); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(ax) * radius, centre.y + ImSin(ay) * radius)); + } + window->DrawList->PathStroke(color_alpha(color, 1.f), false, thickness); + + start = (start < IM_PI) ? (start * 2.f) : (PI_2 - start) * 2.f; + window->DrawList->AddCircleFilled(ImVec2(centre.x + ImCos(start * ang_min) * radius, centre.y + ImSin(start * ang_max) * radius), thickness * 4.f, color_alpha(color, 1.f), num_segments); + } + + inline void SpinnerDnaDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, int lt = 8, float delta = 0.5f, bool mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float nextItemKoeff = 2.5f; + const float dots = (size.x / (thickness * nextItemKoeff)); + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + + float out_h, out_s, out_v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, out_h, out_s, out_v); + auto draw_point = [&] (float angle, int i) { + float a = angle + start + (IM_PI - i * PI_DIV(dots)); + float th_koeff = 1.f + ImSin(a + PI_DIV_2) * 0.5f; + + float pp = mode ? centre.x + ImSin(a) * size.x * delta + : centre.y + ImSin(a) * size.y * delta; + ImColor c = ImColor::HSV(out_h + i * (1.f / dots * 2.f), out_s, out_v); + ImVec2 p = mode ? ImVec2(pp, centre.y - (size.y * 0.5f) + i * thickness * nextItemKoeff) + : ImVec2(centre.x - (size.x * 0.5f) + i * thickness * nextItemKoeff, pp); + window->DrawList->AddCircleFilled(p, thickness * th_koeff, color_alpha(c, 1.f), lt); + return p; + }; + + + for (int i = 0; i < dots; i++) { + ImVec2 p1 = draw_point(0, i); + ImVec2 p2 = draw_point(IM_PI, i); + window->DrawList->AddLine(p1, p2, color_alpha(color, 1.f), thickness * 0.5f); + } + } + + inline void Spinner3SmuggleDots(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 4.8f, int lt = 8, float delta = 0.5f, bool mode = 0) { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float nextItemKoeff = 2.5f; + const float dots = 2;// (size.x / (thickness * nextItemKoeff)); + const float start = ImFmod((float)ImGui::GetTime() * speed, PI_2); + + auto draw_point = [&] (float angle, int i, float k) { + float a = angle + k * start + k * (IM_PI - i * PI_DIV(dots)); + float th_koeff = 1.f + ImSin(a + PI_DIV_2) * 0.3f; + + float pp = mode ? centre.x + ImSin(a) * size.x * delta + : centre.y + ImSin(a) * size.y * delta; + ImVec2 p = mode ? ImVec2(pp, centre.y - (size.y * 0.5f) + i * thickness * nextItemKoeff) + : ImVec2(centre.x - (size.x * 0.5f) + i * thickness * nextItemKoeff, pp); + window->DrawList->AddCircleFilled(p, thickness * th_koeff, color_alpha(color, 1.f), lt); + return p; + }; + + { + ImVec2 p1 = draw_point(0, 1, -1); + ImVec2 p2 = draw_point(IM_PI, 2, 1); + //window->DrawList->AddLine(p1, p2, color_alpha(color, 1.f), thickness * 0.5f); + ImVec2 p3 = draw_point(PI_DIV_2, 3, -1); + //window->DrawList->AddLine(p2, p3, color_alpha(color, 1.f), thickness * 0.5f); + } + } + + inline void SpinnerRotateSegmentsPulsar(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 2.8f, size_t arcs = 4, size_t layers = 1) + { + SPINNER_HEADER(pos, size, centre, num_segments); + + const float arc_angle = PI_2 / (float)arcs; + const float angle_offset = arc_angle / num_segments; + float r = radius; + float reverse = 1.f; + + const float bg_angle_offset = PI_2_DIV(num_segments); + const float koeff = PI_DIV(2 * layers); + float start = (float)ImGui::GetTime() * speed; + + for (int num_ring = 0; num_ring < layers; ++num_ring) { + float radius_k = ImSin(ImFmod(start + (num_ring * koeff), PI_DIV_2)); + ImColor c = color_alpha(color, (radius_k > 0.5f) ? (2.f - (radius_k * 2.f)) : color.Value.w); + + for (size_t arc_num = 0; arc_num < arcs; ++arc_num) + { + window->DrawList->PathClear(); + for (size_t i = 2; i <= num_segments - 2; i++) + { + const float a = start * (1.f + 0.1f * num_ring) + arc_angle * arc_num + (i * angle_offset); + window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a * reverse) * (r * radius_k), centre.y + ImSin(a * reverse) * (r * radius_k))); + } + window->DrawList->PathStroke(c, false, thickness); + } + } + } + + inline void SpinnerSplineAng(const char *label, float radius, float thickness, const ImColor &color = white, const ImColor &bg = white, float speed = 2.8f, float angle = IM_PI, int mode = 0) + { + SPINNER_HEADER(pos, size, centre, num_segments); // Get the position, size, centre, and number of segments of the spinner using the SPINNER_HEADER macro. + float start = (float)ImGui::GetTime() * speed; // The start angle of the spinner is calculated based on the current time and the specified speed. + radius = (mode == 1) ? (0.8f + ImCos(start) * 0.2f) * radius : radius; + + //circle([&] (int i) { // Draw the background of the spinner using the `circle` function, with the specified background color and thickness. + // const float a = start + (i * (PI_2 / (num_segments - 1))); // Calculate the angle for each segment based on the start angle and the number of segments. + // return ImVec2(ImCos(a) * (radius + thickness), damped_infinity(1.3f, (float)a).second * radius); + //}, color_alpha(bg, 1.f), thickness); + + const float b = damped_gravity(ImSin(start * 1.1f)) * angle; + circle([&] (int i) { // Draw the spinner itself using the `circle` function, with the specified color and thickness. + const float a = start - b + (i * angle / num_segments); + return ImVec2(ImSin(a) * radius, ImCos(a) * radius); + }, color_alpha(color, 1.f), thickness); + } + + namespace detail { + static struct SpinnerDraw { SpinnerTypeT type; void (*func)(const char *, const detail::SpinnerConfig &); } spinner_draw_funcs[e_st_count] = { + { e_st_rainbow, [] (const char *label, const detail::SpinnerConfig &c) { SpinnerRainbow(label, c.m_Radius, c.m_Thickness, c.m_Color, c.m_Speed, c.m_AngleMin, c.m_AngleMax, c.m_Dots, c.m_Mode); } }, + { e_st_angle, [] (const char *label, const detail::SpinnerConfig &c) { SpinnerAng(label, c.m_Radius, c.m_Thickness, c.m_Color, c.m_BgColor, c.m_Speed, c.m_Angle, c.m_Mode); } }, + { e_st_dots, [] (const char *label, const detail::SpinnerConfig &c) { SpinnerDots(label, c.m_FloatPtr, c.m_Radius, c.m_Thickness, c.m_Color, c.m_Speed, c.m_Dots, c.m_MinThickness, c.m_Mode); } }, + { e_st_ang, [] (const char *label, const detail::SpinnerConfig &c) { SpinnerAng(label, c.m_Radius, c.m_Thickness, c.m_Color, c.m_BgColor, c.m_Speed, c.m_Angle, c.m_Mode); } }, + { e_st_vdots, [] (const char *label, const detail::SpinnerConfig &c) { SpinnerVDots(label, c.m_Radius, c.m_Thickness, c.m_Color, c.m_BgColor, c.m_Speed, c.m_Dots, c.m_MiddleDots, c.m_Mode); } }, + { e_st_bounce_ball, [] (const char *label,const detail::SpinnerConfig &c) { SpinnerBounceBall(label, c.m_Radius, c.m_Thickness, c.m_Color, c.m_Speed, c.m_Dots); } }, + { e_st_eclipse, [] (const char *label, const detail::SpinnerConfig &c) { SpinnerAngEclipse(label , c.m_Radius, c.m_Thickness, c.m_Color, c.m_Speed); } }, + { e_st_ingyang, [] (const char *label, const detail::SpinnerConfig &c) { SpinnerIngYang(label, c.m_Radius, c.m_Thickness, c.m_Reverse, c.m_Delta, c.m_AltColor, c.m_Color, c.m_Speed, c.m_Angle); } }, + { e_st_barchartsine, [] (const char *label, const detail::SpinnerConfig &c) { SpinnerBarChartSine(label, c.m_Radius, c.m_Thickness, c.m_Color, c.m_Speed, c.m_Dots, c.m_Mode); } } + }; + } + + inline void Spinner(const char *label, const detail::SpinnerConfig& config) + { + if (config.m_SpinnerType < sizeof(detail::spinner_draw_funcs) / sizeof(detail::spinner_draw_funcs[0])) + detail::spinner_draw_funcs[config.m_SpinnerType].func(label, config); + } + + template + inline void Spinner(const char *label, const Args&... args) + { + detail::SpinnerConfig config(SpinnerType{Type}, args...); + Spinner(label, config); + } + +#ifdef IMSPINNER_DEMO + inline void demoSpinners() { + static int hue = 0; + static float nextdot = 0, nextdot2; + static bool show_number = false; + + nextdot -= 0.07f; + + static float velocity = 1.f; + static float widget_size = 50.f; + + static int selected_idx = 0; + static ImColor spinner_filling_meb_bg; + + constexpr int num_spinners = 260; + + static int cci = 0, last_cci = 0; + static std::map __nn; auto Name = [] (const char* v) { if (!__nn.count(cci)) { __nn[cci] = v; }; return __nn[cci]; }; + static std::map __rr; auto R = [] (float v) { if (!__rr.count(cci)) { __rr[cci] = v; }; return __rr[cci]; }; + static std::map __tt; auto T = [] (float v) { if (!__tt.count(cci)) { __tt[cci] = v; }; return __tt[cci]; }; + static std::map __cc; auto C = [] (ImColor v) { if (!__cc.count(cci)) { __cc[cci] = v; }; return __cc[cci]; }; + static std::map __cb; auto CB = [] (ImColor v) { if (!__cb.count(cci)) { __cb[cci] = v; }; return __cb[cci]; }; + static std::map __hc; auto HC = [] (bool v) { if (!__hc.count(cci)) { __hc[cci] = v; }; return __hc[cci]; }; + static std::map __hcb; auto HCB = [] (bool v) { if (!__hcb.count(cci)) { __hcb[cci] = v; }; return __hcb[cci]; }; + static std::map __ss; auto S = [] (float v) { if (!__ss.count(cci)) { __ss[cci] = v; }; return __ss[cci]; }; + static std::map __aa; auto A = [] (float v) { if (!__aa.count(cci)) { __aa[cci] = v; }; return __aa[cci]; }; + static std::map __amn; auto AMN = [] (float v) { if (!__amn.count(cci)) { __amn[cci] = v; }; return __amn[cci]; }; + static std::map __amx; auto AMX = [] (float v) { if (!__amx.count(cci)) { __amx[cci] = v; }; return __amx[cci]; }; + static std::map __dt; auto DT = [] (int v) { if (!__dt.count(cci)) { __dt[cci] = v; }; return __dt[cci]; }; + static std::map __mdt; auto MDT = [] (int v) { if (!__mdt.count(cci)) { __mdt[cci] = v; }; return __mdt[cci]; }; + static std::map __dd; auto D = [] (float v) { if (!__dd.count(cci)) { __dd[cci] = v; }; return __dd[cci]; }; + static std::map __mm; auto M = [] (float v) { if (!__mm.count(cci)) { __mm[cci] = v; }; return __mm[cci]; }; + static std::map __mx; auto MX = [] (float v) { if (!__mx.count(cci)) { __mx[cci] = v; }; return __mx[cci]; }; + + const auto draw_spinner = [&](int spinner_idx, float widget_size) + { + const ImVec2 curpos_begin = ImGui::GetCursorPos(); + + ImGui::PushID(spinner_idx); + { + if (show_number) { + ImGui::Text("%04u", spinner_idx); + } + + const bool is_selected = (selected_idx == spinner_idx); + if (ImGui::Selectable("", is_selected, 0, ImVec2(widget_size, widget_size))) { + selected_idx = spinner_idx; + last_cci = spinner_idx; + } + + // Set the initial focus when opening the combo (scrolling + keyboard navigation focus) + if (is_selected) { + ImGui::SetItemDefaultFocus(); + } + + const float sp_radius = __rr.count(spinner_idx) ? __rr[spinner_idx] : 16.f; + const float sp_offset = (widget_size - sp_radius * 2.f ) / 2.f; + ImGui::SetCursorPos({curpos_begin.x + sp_offset, curpos_begin.y + sp_offset}); + +#define $(i) i: cci = i; + switch (spinner_idx) { + case $( 0) ImSpinner::Spinner (Name("Spinner"), + Radius{R(16)}, Thickness{T(2)}, Color{ImColor::HSV(++hue * 0.005f, 0.8f, 0.8f)}, Speed{S(8) * velocity}, AngleMin{AMN(0.f)}, AngleMax{AMX(PI_2)}, Dots{DT(1)}, Mode{M(0)}); break; + case $( 1) ImSpinner::Spinner (Name("Spinner"), + Radius{R(16)}, Thickness{T(2)}, Color{ImColor::HSV(++hue * 0.005f, 0.8f, 0.8f)}, Speed{S(8) * velocity}, AngleMin{AMN(0.f)}, AngleMax{AMX(PI_2)}, Dots{DT(4)}, Mode{M(1)}); break; + case $( 2) ImSpinner::Spinner (Name("SpinnerDots"), + Radius{R(16)}, Thickness{T(4)}, Color{C(white)}, FloatPtr{&nextdot}, Speed{S(1) * velocity}, Dots{DT(12)}, MinThickness{-1.f}, Mode{M(0)}); break; + case $( 3) ImSpinner::Spinner (Name("SpinnerDots"), + Radius{R(16)}, Thickness{T(4)}, Color{C(white)}, FloatPtr{&nextdot}, Speed{S(1) * velocity}, Dots{DT(12)}, MinThickness{-1.f}, Mode{M(1)}); break; + case $( 4) ImSpinner::Spinner (Name("SpinnerAng270"), + Radius{R(16)}, Thickness{T(2)}, Color{C(white)}, BgColor{CB(ImColor(255, 255, 255, 128))}, Speed{S(6) * velocity}, Angle{A(0.75f * PI_2)}, Mode{M(0)}); break; + case $( 5) ImSpinner::Spinner (Name("SpinnerAng270NoBg"), + Radius{R(16)}, Thickness{T(2)}, Color{C(white)}, BgColor{CB(ImColor(255, 255, 255, 0))}, Speed{S(6) * velocity}, Angle{A(0.75f * PI_2)}); break; + case $( 6) ImSpinner::Spinner (Name("SpinnerVDots"), + Radius{R(16)}, Thickness{T(4)}, Color{C(white)}, BgColor{CB(ImColor::HSV(hue * 0.0011f, 0.8f, 0.8f))}, Speed{S(2.7f) * velocity}, Dots{DT(12)}, MiddleDots{MDT(6)}, Mode{M(0)}); break; + case $( 7) ImSpinner::Spinner(Name("SpinnerBounceBall"), + Radius{R(16)}, Thickness{T(6)}, Color{C(white)}, Speed{S(4) * velocity}, Dots{DT(1)}, Mode{M(0)}); break; + case $( 8) ImSpinner::Spinner (Name("SpinnerAngEclipse"), + Radius{R(16)}, Thickness{T(5)}, Color{C(white)}, Speed{S(6) * velocity}); break; + case $( 9) ImSpinner::Spinner (Name("SpinnerIngYang"), + Radius{R(16)}, Thickness{T(5)}, Reverse{false}, Delta{D(0.f)}, Color{C(white)}, AltColor{ImColor(255, 0, 0)}, Speed{S(4) * velocity}, Angle{A(IM_PI * 0.8f)}); break; + case $(10) ImSpinner::Spinner(Name("SpinnerBarChartSine"), + Radius{R(16)}, Thickness{T(4)}, Color{C(white)}, Speed{S(6.8f) * velocity}, Dots{DT(4)}, Mode{M(0)}); break; + case $(11) ImSpinner::SpinnerBounceDots (Name("SpinnerBounceDots"), R(16), + T(6), C(white), S(6) * velocity, DT(3), M(0)); break; + case $(12) ImSpinner::SpinnerFadeDots (Name("SpinnerFadeDots"), R(16), + T(6), C(white), S(8) * velocity, DT(8)); break; + case $(13) ImSpinner::SpinnerScaleDots (Name("SpinnerScaleDots"), R(16), + T(6), C(white), S(7) * velocity, DT(8)); break; + case $(14) ImSpinner::SpinnerMovingDots (Name("SpinnerMovingDots"), R(16), + T(6), C(white), S(30) * velocity, DT(3)); break; + case $(15) ImSpinner::SpinnerRotateDots (Name("SpinnerRotateDots"), + R(16), T(6), C(white), S(4) * velocity, DT(2), M(0)); break; + case $(16) ImSpinner::SpinnerTwinAng (Name("SpinnerTwinAng"), + R(16), 16, T(6), C(white), CB(ImColor(255, 0, 0)), S(4) * velocity, A(IM_PI), M(0)); break; + case $(17) ImSpinner::SpinnerClock (Name("SpinnerClock"), + R(16), T(2), C(ImColor(255, 0, 0)), CB(white), S(4) * velocity); break; + case $(18) ImSpinner::SpinnerIngYang (Name("SpinnerIngYangR"), + R(16), T(5), true, 0.1f, C(white), CB(ImColor(255, 0, 0)), S(4) * velocity, A(IM_PI * 0.8f), M(0)); break; + case $(19) ImSpinner::SpinnerBarChartSine (Name("SpinnerBarChartSine2"), + R(16), T(4), ImColor::HSV(hue * 0.005f, 0.8f, 0.8f), S(4.8f) * velocity, DT(4), M(4)); break; + case $(20) ImSpinner::SpinnerTwinAng180 (Name("SpinnerTwinAng"), + R(16), 12, T(4), C(white), CB(ImColor(255, 0, 0)), S(4) * velocity, A(PI_DIV_4), M(0)); break; + case $(21) ImSpinner::SpinnerTwinAng180 (Name("SpinnerTwinAng2"), + R(16), 12, T(4), C(white), CB(ImColor(255, 0, 0)), S(4) * velocity, A(IM_PI), M(1)); break; + case $(22) ImSpinner::SpinnerIncDots (Name("SpinnerIncDots"), + R(16), T(4), C(white), S(5.6f) * velocity, 6); break; + case $(23) nextdot2 -= 0.2f * velocity; + ImSpinner::SpinnerDots (Name("SpinnerDotsWoBg"), + &nextdot2, R(16), T(4), C(white), S(0.3f) * velocity, DT(12), A(0.f), M(0)); break; + case $(24) ImSpinner::SpinnerIncScaleDots (Name("SpinnerIncScaleDots"), + R(16), T(4), C(white), S(6.6f) * velocity, DT(6), A(0), M(0)); break; + case $(25) ImSpinner::SpinnerAng (Name("SpinnerAng90"), + R(16), T(6), C(white), CB(ImColor(255, 255, 255, 128)), S(8.f) * velocity, A(PI_DIV_2), M(0)); break; + case $(26) ImSpinner::SpinnerAng (Name("SpinnerAng90"), + R(16), 6, C(white), CB(ImColor(255, 255, 255, 0)), S(8.5f) * velocity, A(PI_DIV_2), M(0)); break; + case $(27) ImSpinner::SpinnerFadeBars (Name("SpinnerFadeBars"), + 10, C(white), S(4.8f) * velocity, 3); break; + case $(28) ImSpinner::SpinnerPulsar (Name("SpinnerPulsar"), + R(16), T(2), C(white), S(1) * velocity, true, A(0), M(0)); break; + case $(29) ImSpinner::SpinnerIngYang (Name("SpinnerIngYangR2"), + R(16), T(5), true, 3.f, C(white), CB(ImColor(255, 0, 0)), S(4) * velocity, A(IM_PI * 0.8f)); break; + case $(30) ImSpinner::SpinnerBarChartRainbow (Name("SpinnerBarChartRainbow"), + R(16), T(4), ImColor::HSV(hue * 0.005f, 0.8f, 0.8f), S(6.8f) * velocity, DT(4), M(0)); break; + case $(31) ImSpinner::SpinnerBarsRotateFade (Name("SpinnerBarsRotateFade"), + 8, 18, T(4), C(white), S(7.6f) * velocity, DT(6)); break; + case $(32) ImSpinner::SpinnerFadeBars (Name("SpinnerFadeScaleBars"), + 10, C(white), S(6.8f) * velocity, 3, true); break; + case $(33) ImSpinner::SpinnerBarsScaleMiddle (Name("SpinnerBarsScaleMiddle"), + 6, C(white), S(8.8f) * velocity, 3); break; + case $(34) ImSpinner::SpinnerAngTwin (Name("SpinnerAngTwin1"), + R(16), 13, T(2), C(ImColor(255, 0, 0)), CB(white), S(6) * velocity, A(PI_DIV_2), DT(1), M(0)); break; + case $(35) ImSpinner::SpinnerAngTwin (Name("SpinnerAngTwin2"), + 13, 16, T(2), C(ImColor(255, 0, 0)), CB(white), S(6) * velocity, A(PI_DIV_2), DT(1), M(0)); break; + case $(36) ImSpinner::SpinnerAngTwin (Name("SpinnerAngTwin3"), + 13, 16, T(2), C(ImColor(255, 0, 0)), CB(white), S(6) * velocity, A(PI_DIV_2), DT(2), M(0)); break; + case $(37) ImSpinner::SpinnerAngTwin (Name("SpinnerAngTwin4"), + R(16), 13, T(2), C(ImColor(255, 0, 0)), CB(white), S(6) * velocity, A(PI_DIV_2), DT(2), M(0)); break; + case $(38) ImSpinner::SpinnerTwinPulsar (Name("SpinnerTwinPulsar"), + R(16), T(2), C(white), S(0.5f) * velocity, DT(2), M(0)); break; + case $(39) ImSpinner::SpinnerAngTwin (Name("SpinnerAngTwin4"), + R(14), 13, T(3), C(ImColor(255, 0, 0)), CB(ImColor(0, 0, 0, 0)), S(5) * velocity, A(IM_PI / 1.5f), 2); break; + case $(40) ImSpinner::SpinnerBlocks (Name("SpinnerBlocks"), + R(16), T(7), C(ImColor(255, 255, 255, 30)), CB(ImColor::HSV(hue * 0.005f, 0.8f, 0.8f)), S(5) * velocity); break; + case $(41) ImSpinner::SpinnerTwinBall (Name("SpinnerTwinBall"), + R(16), 11, T(2), 2.5f, C(ImColor(255, 0, 0)), CB(white), S(6) * velocity, DT(2), M(0)); break; + case $(42) ImSpinner::SpinnerTwinBall (Name("SpinnerTwinBall2"), + R(15), 19, T(2), 2.f, C(ImColor(255, 0, 0)), CB(white), S(6) * velocity, DT(3), M(0)); break; + case $(43) ImSpinner::SpinnerTwinBall (Name("SpinnerTwinBall2"), + 16, 16, T(2), 5.f, C(ImColor(255, 0, 0)), CB(white), S(5) * velocity, DT(1), M(0)); break; + case $(44) ImSpinner::SpinnerAngTriple (Name("SpinnerAngTriple"), + 16, 13, 10, T(1.3f), C(white), ImColor(255, 0, 0), white, S(5) * velocity, A(1.5f * IM_PI)); break; + case $(45) ImSpinner::SpinnerIncFullDots (Name("SpinnerIncFullDots"), + R(16), T(4), C(white), S(5.6f) * velocity, 4); break; + case $(46) ImSpinner::SpinnerGooeyBalls (Name("SpinnerGooeyBalls"), + R(16), C(white), S(2.f) * velocity); break; + case $(47) ImSpinner::SpinnerRotateGooeyBalls (Name("SpinnerRotateGooeyBalls2"), + R(16), T(5), C(white), S(6.f) * velocity, DT(2), M(0)); break; + case $(48) ImSpinner::SpinnerRotateGooeyBalls (Name("SpinnerRotateGooeyBalls3"), + R(16), T(5), C(white), S(6.f) * velocity, DT(3), M(0)); break; + case $(49) ImSpinner::SpinnerMoonLine (Name("SpinnerMoonLine"), + R(16), T(3), C(ImColor(200, 80, 0)), ImColor(80, 80, 80), S(5) * velocity); break; + case $(50) ImSpinner::SpinnerArcRotation (Name("SpinnerArcRotation"), + R(13), T(5), C(white), S(3) * velocity, DT(4), M(0)); break; + case $(51) ImSpinner::SpinnerFluid (Name("SpinnerFluid"), + R(16), C(ImColor(0, 0, 255)), S(3.8f) * velocity, 4); break; + case $(52) ImSpinner::SpinnerArcFade (Name("SpinnerArcFade"), + R(13), T(5), C(white), S(3) * velocity, DT(4), M(0)); break; + case $(53) ImSpinner::SpinnerFilling (Name("SpinnerFilling"), + R(16), T(6), C(white), CB(ImColor(255, 0, 0)), S(4) * velocity); break; + case $(54) ImSpinner::SpinnerTopup (Name("SpinnerTopup"), + R(16), 12, C(ImColor(255, 0, 0)), ImColor(80, 80, 80), CB(white), S(1) * velocity); break; + case $(55) ImSpinner::SpinnerFadePulsar (Name("SpinnerFadePulsar"), + R(16), C(white), S(1.5f) * velocity, DT(1), M(0)); break; + case $(56) ImSpinner::SpinnerFadePulsar (Name("SpinnerFadePulsar2"), + R(16), C(white), S(0.9f) * velocity, DT(2), M(0)); break; + case $(57) ImSpinner::SpinnerPulsar (Name("SpinnerPulsar"), + R(16), T(2), C(white), S(1) * velocity, false); break; + case $(58) ImSpinner::SpinnerDoubleFadePulsar (Name("SpinnerDoubleFadePulsar"), + R(16), T(2), C(white), S(2) * velocity); break; + case $(59) ImSpinner::SpinnerFilledArcFade (Name("SpinnerFilledArcFade"), + R(16), C(white), S(4) * velocity, 4); break; + case $(60) ImSpinner::SpinnerFilledArcFade (Name("SpinnerFilledArcFade6"), + R(16), C(white), S(6) * velocity, 6); break; + case $(61) ImSpinner::SpinnerFilledArcFade (Name("SpinnerFilledArcFade6"), + R(16), C(white), S(8) * velocity, 12); break; + case $(62) ImSpinner::SpinnerFilledArcColor (Name("SpinnerFilledArcColor"), + R(16), C(ImColor(255, 0, 0)), CB(white), S(2.8f) * velocity, 4); break; + case $(63) ImSpinner::SpinnerCircleDrop (Name("SpinnerCircleDrop"), + R(16), T(1.5f), 4.f, C(ImColor(255, 0, 0)), CB(white), S(2.8f) * velocity, A(IM_PI)); break; + case $(64) ImSpinner::SpinnerSurroundedIndicator(Name("SpinnerSurroundedIndicator"), + R(16), T(5), C(ImColor(0, 0, 0)), CB(white), S(7.8f) * velocity); break; + case $(65) ImSpinner::SpinnerTrianglesSelector (Name("SpinnerTrianglesSelector"), + R(16), T(8), C(ImColor(0, 0, 0)), CB(white), S(4.8f) * velocity, 8); break; + case $(66) ImSpinner::SpinnerFlowingGradient (Name("SpinnerFlowingFradient"), + R(16), T(6), C(ImColor(200, 80, 0)), CB(ImColor(80, 80, 80)), S(5) * velocity, A(PI_2)); break; + case $(67) ImSpinner::SpinnerRotateSegments (Name("SpinnerRotateSegments"), + R(16), T(4), C(white), S(3) * velocity, DT(4), MDT(1), M(0)); break; + case $(68) ImSpinner::SpinnerRotateSegments (Name("SpinnerRotateSegments2"), + R(16), T(3), C(white), S(2.4f) * velocity, DT(4), MDT(2), M(0)); break; + case $(69) ImSpinner::SpinnerRotateSegments (Name("SpinnerRotateSegments3"), + R(16), T(2), C(white), S(2.1f) * velocity, DT(4), MDT(3), M(0)); break; + case $(70) ImSpinner::SpinnerLemniscate (Name("SpinnerLemniscate"), + R(20), T(3), C(white), S(2.1f) * velocity, 3); break; + case $(71) ImSpinner::SpinnerRotateGear (Name("SpinnerRotateGear"), + R(16), T(6), C(white), S(2.1f) * velocity, 8); break; + case $(72) ImSpinner::SpinnerRotatedAtom (Name("SpinnerRotatedAtom"), + R(16), T(2), C(white), S(2.1f) * velocity, DT(3), M(0)); break; + case $(73) ImSpinner::SpinnerAtom (Name("SpinnerAtom"), + R(16), T(2), C(white), S(4.1f) * velocity, 3); break; + case $(74) ImSpinner::SpinnerRainbowBalls (Name("SpinnerRainbowBalls"), + R(16), T(4), ImColor::HSV(0.25f, 0.8f, 0.8f, 0.f), S(1.5f) * velocity, DT(5), M(0), MDT(1), MX(0)); break; + case $(75) ImSpinner::SpinnerCamera (Name("SpinnerCamera"), + R(16), T(8), [] (int i) { return ImColor::HSV(i * 0.25f, 0.8f, 0.8f); }, S(4.8f) * velocity, DT(8), M(0)); break; + case $(76) ImSpinner::SpinnerArcPolarFade (Name("SpinnerArcPolarFade"), + R(16), C(white), S(6) * velocity, DT(6), M(0)); break; + case $(77) ImSpinner::SpinnerArcPolarRadius (Name("SpinnerArcPolarRadius"), + R(16), C(ImColor::HSV(0.25f, 0.8f, 0.8f)), S(6.f) * velocity, DT(6), M(0)); break; + case $(78) ImSpinner::SpinnerCaleidoscope (Name("SpinnerArcPolarPies"), + R(16), T(4), C(ImColor::HSV(0.25f, 0.8f, 0.8f)), S(2.6f) * velocity, DT(10), M(0)); break; + case $(79) ImSpinner::SpinnerCaleidoscope (Name("SpinnerArcPolarPies2"), + R(16), T(4), C(ImColor::HSV(0.35f, 0.8f, 0.8f)), S(3.2f) * velocity, 10, 1); break; + case $(80) ImSpinner::SpinnerScaleBlocks (Name("SpinnerScaleBlocks"), + R(16), T(8), ImColor::HSV(hue * 0.005f, 0.8f, 0.8f), S(5) * velocity); break; + case $(81) ImSpinner::SpinnerRotateTriangles (Name("SpinnerRotateTriangles"), + R(16), T(2), C(white), S(6.f) * velocity, DT(3), M(0)); break; + case $(82) ImSpinner::SpinnerArcWedges (Name("SpinnerArcWedges"), + R(16), C(ImColor::HSV(0.3f, 0.8f, 0.8f)), S(2.8f) * velocity, DT(4), M(0)); break; + case $(83) ImSpinner::SpinnerScaleSquares (Name("SpinnerScaleSquares"), + R(16), T(8), ImColor::HSV(hue * 0.005f, 0.8f, 0.8f), S(5) * velocity); break; + case $(84) ImSpinner::SpinnerHboDots (Name("SpinnerHboDots"), R(16), + T(4), C(white), 0.f, 0.f, S(1.1f) * velocity, DT(6), M(0)); break; + case $(85) ImSpinner::SpinnerHboDots (Name("SpinnerHboDots2"), R(16), + T(4), C(white), 0.1f, 0.5f, S(1.1f) * velocity, DT(6), M(0)); break; + case $(86) ImSpinner::Spinner(Name("SpinnerBounceBall3"), + Radius{R(16)}, Thickness{T(4)}, Color{C(white)}, Speed{S(3.2f) * velocity}, Dots{DT(5)}); break; + case $(87) ImSpinner::SpinnerBounceBall (Name("SpinnerBounceBallShadow"), + R(16), T(4), C(white), S(2.2f) * velocity, DT(1), true); break; + case $(88) ImSpinner::SpinnerBounceBall (Name("SpinnerBounceBall5Shadow"), + R(16), T(4), C(white), S(3.6f) * velocity, DT(5), true); break; + case $(89) ImSpinner::SpinnerSquareStrokeFade (Name("SpinnerSquareStrokeFade"), + R(13), T(5), C(white), S(3) * velocity); break; + case $(90) ImSpinner::SpinnerSquareStrokeFill (Name("SpinnerSquareStrokeFill"), + R(13), T(5), C(white), S(3) * velocity); break; + case $(91) ImSpinner::SpinnerSwingDots (Name("SpinnerSwingDots"), + R(16), T(6), C(ImColor(255, 0, 0)), S(4.1f) * velocity); break; + case $(92) ImSpinner::SpinnerRotateWheel (Name("SpinnerRotateWheel"), + R(16), T(10), C(ImColor(255, 255, 0)), CB(white), S(2.1f) * velocity, 8); break; + case $(93) ImSpinner::SpinnerWaveDots (Name("SpinnerWaveDots"), R(16), + T(3), C(white), S(6) * velocity, DT(8)); break; + case $(94) ImSpinner::SpinnerRotateShapes (Name("SpinnerRotateShapes"), + R(16), T(2), C(white), S(6.f) * velocity, DT(4), MDT(4)); break; + case $(95) ImSpinner::SpinnerSquareStrokeLoading(Name("SpinnerSquareStrokeLoanding"), + R(13), T(5), C(white), S(3) * velocity); break; + case $(96) ImSpinner::SpinnerSinSquares (Name("SpinnerSinSquares"), + R(16), T(2), C(white), S(1.f) * velocity, M(0)); break; + case $(97) ImSpinner::SpinnerZipDots (Name("SpinnerZipDots"), R(16), + T(3), C(white), S(6) * velocity, DT(5)); break; + case $(98) ImSpinner::SpinnerDotsToBar (Name("SpinnerDotsToBar"), R(16), + T(3), D(0.5f), C(ImColor::HSV(0.31f, 0.8f, 0.8f)), S(5) * velocity, DT(5)); break; + case $(99) ImSpinner::SpinnerSineArcs (Name("SpinnerSineArcs"), R(16), + T(1), C(white), S(3) * velocity); + case $(100) ImSpinner::SpinnerTrianglesShift (Name("SpinnerTrianglesShift"), + R(16), T(8), C(ImColor(0, 0, 0)), CB(white), S(1.8f) * velocity, DT(8)); break; + case $(101) ImSpinner::SpinnerCircularLines (Name("SpinnerCircularLines"), + R(16), C(white), S(1.5f) * velocity, DT(8), M(0)); break; + case $(102) ImSpinner::SpinnerLoadingRing (Name("SpinnerLoadingRing"), + R(16), T(6), C(red), CB(ImColor(255, 255, 255, 128)), S(1.f) * velocity, DT(5)); break; + case $(103) ImSpinner::SpinnerPatternRings (Name("SpinnerPatternRings"), + R(16), T(2), C(white), S(4.1f) * velocity, DT(3)); break; + case $(104) ImSpinner::SpinnerPatternSphere (Name("SpinnerPatternSphere"), + R(16), T(2), C(white), S(2.1f) * velocity, DT(6)); break; + case $(105) ImSpinner::SpinnerRingSynchronous (Name("SpinnerRingSnchronous"), + R(16), T(2), C(white), S(2.1f) * velocity, DT(3)); break; + case $(106) ImSpinner::SpinnerRingWatermarks (Name("SpinnerRingWatermarks"), + R(16), T(2), C(white), S(2.1f) * velocity, DT(3)); break; + case $(107) ImSpinner::SpinnerFilledArcRing (Name("SpinnerFilledArcRing"), + R(16), T(6), C(red), CB(white), S(2.8f) * velocity, DT(8)); break; + case $(108) ImSpinner::SpinnerPointsShift (Name("SpinnerPointsShift"), + R(16), T(3), C(ImColor(0, 0, 0)), CB(white), S(1.8f) * velocity, DT(10)); break; + case $(109) ImSpinner::SpinnerCircularPoints (Name("SpinnerCircularPoints"), + R(16), T(1.2f), C(white), S(10.f) * velocity, DT(7)); break; + case $(110) ImSpinner::SpinnerCurvedCircle (Name("SpinnerCurvedCircle"), + R(16), T(1.2f), C(white), S(1.f) * velocity, DT(3)); break; + case $(111) ImSpinner::SpinnerModCircle (Name("SpinnerModCirclre"), + R(16), T(1.2f), C(white), AMN(1.f), AMX(2.f), S(3.f) * velocity); break; + case $(112) ImSpinner::SpinnerModCircle (Name("SpinnerModCirclre2"), + R(16), T(1.2f), C(white), AMN(1.11f), AMX(3.33f), S(3.f) * velocity); break; + case $(113) ImSpinner::SpinnerPatternEclipse (Name("SpinnerPatternEclipse"), + R(16), T(2), C(white), S(4.1f) * velocity, DT(5), AMN(2.f), AMX(0.f)); break; + case $(114) ImSpinner::SpinnerPatternEclipse (Name("SpinnerPatternEclipse2"), + R(16), T(2), C(white), S(4.1f) * velocity, DT(9), AMN(4.f), AMX(1.f)); break; + case $(115) ImSpinner::SpinnerMultiFadeDots (Name("SpinnerMultiFadeDots"), R(16), + T(2), C(white), S(8) * velocity, DT(8)); break; + case $(116) ImSpinner::SpinnerRainbowShot (Name("SpinnerRainbowShot"), + R(16), T(4), ImColor::HSV(0.25f, 0.8f, 0.8f, 0.f), S(1.5f) * velocity, DT(5), M(0)); break; + case $(117) ImSpinner::SpinnerSpiral (Name("SpinnerSpiral"), + R(16), T(2), C(white), S(6) * velocity, DT(5)); break; + case $(118) ImSpinner::SpinnerSpiralEye (Name("SpinnerSpiralEye"), + R(16), T(1), C(white), S(3) * velocity); break; + case $(119) ImSpinner::SpinnerWifiIndicator (Name("SpinnerWifiIndicator"), + R(16), T(1.5f), C(ImColor(0, 0, 0)), CB(white), S(7.8f) * velocity, AMN(5.52f), DT(3)); break; + case $(120) ImSpinner::SpinnerHboDots (Name("SpinnerHboDots"), R(16), + T(2), C(white), 0.f, 0.f, S(1.1f) * velocity, DT(10)); break; + case $(121) ImSpinner::SpinnerHboDots (Name("SpinnerHboDots2"), R(16), + T(4), C(white), 0.1f, 0.5f, S(1.1f) * velocity, DT(2)); break; + case $(122) ImSpinner::SpinnerHboDots (Name("SpinnerHboDots4"), R(16), + T(4), C(white), 0.1f, 0.5f, S(1.1f) * velocity, DT(3)); break; + case $(123) ImSpinner::SpinnerDnaDots (Name("SpinnerDnaDotsH"), R(16), + T(3), C(white), S(2) * velocity, DT(8), D(0.25f)); break; + case $(124) ImSpinner::SpinnerDnaDots (Name("SpinnerDnaDotsV"), R(16), + T(3), C(white), S(2) * velocity, DT(8), D(0.25f), true); break; + case $(125) ImSpinner::SpinnerRotateDots (Name("SpinnerRotateDots2"), + R(16), T(6), C(white), S(4) * velocity, ImMax(int(ImSin((float)ImGui::GetTime() * 0.5f) * 8), 3)); break; + case $(126) ImSpinner::SpinnerSevenSegments (Name("SpinnerSevenSegments"), "012345679ABCDEF", + R(16), T(2), C(white), S(4) * velocity); break; + case $(127) ImSpinner::SpinnerSolarBalls (Name("SpinnerSolarBalls"), + R(16), T(4), C(red), CB(white), S(5) * velocity, DT(4)); break; + case $(128) ImSpinner::SpinnerSolarArcs (Name("SpinnerSolarArcs"), + R(16), T(4), C(red), CB(white), S(5) * velocity, DT(4)); break; + case $(129) ImSpinner::SpinnerRainbow (Name("Spinner"), + R(16), T(2), ImColor::HSV(++hue * 0.005f, 0.8f, 0.8f), S(8) * velocity, AMN(0.f), AMX(PI_2), DT(3)); break; + case $(130) ImSpinner::SpinnerRotatingHeart (Name("SpinnerRotatedHeart"), + R(16), T(2), C(red), S(8) * velocity, AMN(0.f)); break; + case $(131) ImSpinner::SpinnerSolarScaleBalls (Name("SpinnerSolarScaleBalls"), + R(16), T(1.3f), C(red), S(1) * velocity, DT(36)); break; + case $(132) ImSpinner::SpinnerOrionDots (Name("SpinnerOrionDots"), + R(16), T(1.3f), C(white), S(4) * velocity, DT(12)); break; + case $(133) ImSpinner::SpinnerGalaxyDots (Name("SpinnerGalaxyDots"), + R(16), T(1.3f), C(white), S(0.2f) * velocity, DT(6)); break; + case $(134) ImSpinner::SpinnerAsciiSymbolPoints(Name("SpinnerAsciiSymbolPoints"), "012345679ABCDEF", + R(16), T(2), C(white), S(4) * velocity); break; + case $(135) ImSpinner::SpinnerRainbowCircle (Name("SpinnerRainbowCircle"), + R(16), T(4), C(ImColor::HSV(0.25f, 0.8f, 0.8f)), S(1) * velocity, DT(4)); break; + case $(136) ImSpinner::SpinnerRainbowCircle (Name("SpinnerRainbowCircle2"), + R(16), T(2), ImColor::HSV(hue * 0.001f, 0.8f, 0.8f), S(2) * velocity, DT(8), D(0)); break; + case $(137) ImSpinner::Spinner (Name("SpinnerVDots2"), + Radius{R(16)}, Thickness{T(4)}, Color{C(white)}, BgColor{CB(ImColor::HSV(hue * 0.0011f, 0.8f, 0.8f))}, Speed{S(2.1f) * velocity}, Dots{DT(2)}, MiddleDots{6}); break; + case $(138) ImSpinner::Spinner (Name("SpinnerVDots3"), + Radius{R(16)}, Thickness{T(4)}, Color{C(white)}, BgColor{CB(ImColor::HSV(hue * 0.0011f, 0.8f, 0.8f))}, Speed{S(2.9f) * velocity}, Dots{DT(3)}, MiddleDots{6}); break; + case $(139) ImSpinner::SpinnerSquareRandomDots(Name("SpinnerSquareRandomDots"), + R(16), T(2.8f), C(ImColor(255, 255, 255, 30)), CB(ImColor::HSV(hue * 0.005f, 0.8f, 0.8f)), S(5) * velocity); break; + case $(140) ImSpinner::SpinnerFluidPoints (Name("SpinnerFluidPoints"), + R(16), T(2.8f), C(ImColor(0, 0, 255)), S(3.8f) * velocity, Dots{DT(4)}, D(0.45f)); break; + case $(141) ImSpinner::SpinnerDotsLoading (Name("SpinnerDotsLoading"), + R(16), T(4.f), C(white), CB(white), S(2.f) * velocity); break; + case $(142) ImSpinner::SpinnerDotsToPoints (Name("SpinnerDotsToPoints"), R(16), + T(3), D(0.5f), C(ImColor::HSV(0.31f, 0.8f, 0.8f)), S(1.8) * velocity, DT(5)); break; + case $(143) ImSpinner::SpinnerThreeDots (Name("SpinnerThreeDots"), R(16), + T(6), C(white), S(4) * velocity, DT(8)); break; + case $(144) ImSpinner::Spinner4Caleidospcope (Name("Spinner4Caleidospcope"), R(16), + T(6), ImColor::HSV(hue * 0.0031f, 0.8f, 0.8f), S(4) * velocity, DT(8)); break; + case $(145) ImSpinner::SpinnerFiveDots (Name("SpinnerSixDots"), R(16), + T(6), C(white), S(4) * velocity, DT(8)); break; + case $(146) ImSpinner::SpinnerFillingMem (Name("SpinnerFillingMem"), + R(16), T(6), ImColor::HSV(hue * 0.001f, 0.8f, 0.8f), spinner_filling_meb_bg, S(4) * velocity); break; + case $(147) ImSpinner::SpinnerHerbertBalls (Name("SpinnerHerbertBalls"), + R(16), T(2.3f), C(white), S(2.f) * velocity, DT(4)); break; + case $(148) ImSpinner::SpinnerHerbertBalls3D (Name("SpinnerHerbertBalls3D"), + R(16), T(3.f), C(white), S(1.4f) * velocity); break; + case $(149) ImSpinner::SpinnerSquareLoading (Name("SpinnerSquareLoanding"), + R(16), T(2), C(white), S(3) * velocity); break; + case $(150) ImSpinner::SpinnerTextFading (Name("SpinnerTextFading"), "Loading", + R(16), T(15), C(ImColor::HSV(hue * 0.0011f, 0.8f, 0.8f)), S(4) * velocity); break; + case $(151) ImSpinner::SpinnerBarChartAdvSine (Name("SpinnerBarChartAdvSine"), + R(16), T(5), C(white), S(4.8f) * velocity, 0); break; + case $(152) ImSpinner::SpinnerBarChartAdvSineFade(Name("SpinnerBarChartAdvSineFade"), + R(16), T(5), C(white), S(4.8f) * velocity, 0); break; + case $(153) ImSpinner::SpinnerMovingArcs (Name("SpinnerMovingArcs"), + R(16), T(4), C(white), S(2) * velocity, DT(4)); break; + case $(154) ImSpinner::SpinnerFadeTris (Name("SpinnerFadeTris"), + R(20), C(white), S(5.f) * velocity, DT(2), false, M(0)); break; + case $(155) ImSpinner::SpinnerBounceDots (Name("SpinnerBounceDots1"), R(16), + T(2.5), C(white), S(3) * velocity, DT(6), M(1)); break; + case $(156) ImSpinner::SpinnerRotateDots (Name("SpinnerRotateDots"), + R(16), T(2), C(white), S(4) * velocity, DT(16), 1); break; + case $(157) ImSpinner::SpinnerTwinAng360 (Name("SpinnerTwinAng360"), + R(16), 11, T(2), C(white), CB(ImColor(255, 0, 0)), 2.4f, 2.1f, 1); break; + case $(158) ImSpinner::SpinnerAngTwin (Name("SpinnerAngTwin1"), + R(18), 13, T(2), C(ImColor(255, 0, 0)), CB(white), S(3) * velocity, A(1.3), DT(3), 1); break; + case $(159) ImSpinner::SpinnerGooeyBalls (Name("SpinnerGooeyBalls"), + R(16), C(white), S(2.f) * velocity, 1); break; + case $(160) ImSpinner::SpinnerArcRotation (Name("SpinnerArcRotation"), + R(13), T(2.5), C(white), S(3) * velocity, DT(15), 1); break; + case $(161) ImSpinner::SpinnerAng (Name("SpinnerAng90Gravity"), + R(16), T(1), C(white), CB(ImColor(255, 255, 255, 128)), S(8.f) * velocity, A(PI_DIV_2), M(1)); break; + case $(162) ImSpinner::SpinnerAng (Name("SpinnerAng90SinRad"), + R(16), T(1), C(white), CB(ImColor(255, 255, 255, 0)), S(8.f) * velocity, A(0.75f * PI_2), M(2)); break; + case $(163) ImSpinner::SpinnerSquishSquare (Name("SpinnerSquishSquare"), + R(16), C(white), S(8.f) * velocity); break; + case $(164) ImSpinner::SpinnerPulsarBall (Name("SpinnerBounceBall"), + R(16), T(2), C(white), S(4) * velocity, DT(1)); break; + case $(165) ImSpinner::SpinnerRainbowMix (Name("Spinner"), + R(16), T(2), ImColor::HSV(0.005f, 0.8f, 0.8f), S(8) * velocity, AMN(0.f), AMX(PI_2), DT(5), 1); break; + case $(166) ImSpinner::SpinnerAngMix (Name("SpinnerAngMix"), + R(16), T(1), C(white), S(8.f) * velocity, A(IM_PI), DT(4), 0); break; + case $(167) ImSpinner::SpinnerAngMix (Name("SpinnerAngMixGravity"), + R(16), T(1), C(white), S(8.f) * velocity, A(PI_DIV_2), DT(6), 1); break; + case $(168) ImSpinner::SpinnerScaleBlocks (Name("SpinnerScaleBlocks"), + R(16), T(8), ImColor::HSV(hue * 0.005f, 0.8f, 0.8f), S(5) * velocity, 1); break; + case $(169) ImSpinner::SpinnerFadeDots (Name("SpinnerFadeDots3"), R(16), + T(6), C(white), S(8) * velocity, DT(4), 1); break; + case $(170) ImSpinner::SpinnerFadeDots (Name("SpinnerFadeDots6"), R(16), + T(3), C(white), S(8) * velocity, DT(4), 1); break; + case $(171) ImSpinner::SpinnerFadeDots (Name("SpinnerFadeDots2"), R(16), + T(2), C(white), S(5) * velocity, DT(8)); break; + case $(172) ImSpinner::SpinnerScaleDots (Name("SpinnerScaleDots2"), R(16), + T(2), C(white), S(4) * velocity, DT(8)); break; + case $(173) ImSpinner::Spinner3SmuggleDots (Name("Spinner3SmuggleDots"), R(16), + T(3), C(white), S(4) * velocity, DT(8), D(0.25f), true); break; + case $(174) ImSpinner::SpinnerSimpleArcFade (Name("SpinnerSimpleArcFade"), + R(13), T(2), C(white), S(4) * velocity); break; + case $(175) ImSpinner::SpinnerTwinHboDots (Name("SpinnerTwinHboDots"), R(16), + T(4), C(white), 0.1f, 0.5f, S(1.1f) * velocity, DT(6), D(0.f)); break; + case $(176) ImSpinner::SpinnerTwinHboDots (Name("SpinnerTwinHboDots2"), R(16), + T(4), C(white), 0.1f, 0.5f, S(3.1f) * velocity, DT(3), D(-0.5f)); break; + case $(177) ImSpinner::SpinnerThreeDotsStar (Name("SpinnerThreeDotsStar"), R(16), + T(4), C(white), 0.1f, 0.5f, S(5.1f) * velocity, D(-0.2f)); break; + case $(178) ImSpinner::SpinnerSquareSpins (Name("SpinnerSquareSpins"), R(16), + T(6), C(white), S(2) * velocity); break; + case $(179) ImSpinner::SpinnerMoonDots (Name("SpinnerMoonDots"), R(16), + T(8), C(white), CB(ImColor(0, 0, 0)), S(1.1f) * velocity); break; + case $(180) ImSpinner::SpinnerFilledArcFade (Name("SpinnerFilledArcFade7"), + R(16), C(white), S(6) * velocity, DT(6), 1); break; + case $(181) ImSpinner::SpinnerRotateSegmentsPulsar(Name("SpinnerRotateSegmentsPulsar"), + R(16), T(2), C(white), S(1.1f) * velocity, DT(4), MDT(2)); break; + case $(182) ImSpinner::SpinnerRotateSegmentsPulsar(Name("SpinnerRotateSegmentsPulsar2"), + R(16), T(2), C(white), S(1.1f) * velocity, DT(1), MDT(3)); break; + case $(183) ImSpinner::SpinnerRotateSegmentsPulsar(Name("SpinnerRotateSegmentsPulsar3"), + R(16), T(2), C(white), S(1.1f) * velocity, DT(3), MDT(3)); break; + case $(184) ImSpinner::SpinnerPointsArcBounce (Name("SpinnerPointsArcBounce"), + R(16), T(2), C(white), S(3) * velocity, DT(12), 1, 0.f); break; + case $(185) ImSpinner::SpinnerSomeScaleDots (Name("SpinnerSomeScaleDots0"), + R(16), T(4), C(white), S(5.6f) * velocity, 6, 0); break; + case $(186) ImSpinner::SpinnerSomeScaleDots (Name("SpinnerSomeScaleDots1"), + R(16), T(4), C(white), S(6.6f) * velocity, 6, 1); break; + case $(187) ImSpinner::SpinnerPointsArcBounce (Name("SpinnerPointsArcBounce2"), + R(16), T(2), C(white), S(3) * velocity, DT(12), 1, 0.5f); break; + case $(188) ImSpinner::SpinnerPointsArcBounce (Name("SpinnerPointsArcBounce3"), + R(16), T(2), C(white), S(3) * velocity, DT(12), 2, 0.3f); break; + case $(189) ImSpinner::SpinnerPointsArcBounce (Name("SpinnerPointsArcBounce4"), + R(16), T(2), C(white), S(3) * velocity, DT(12), 3, 0.3f); break; + case $(190) ImSpinner::SpinnerTwinBlocks (Name("SpinnerTwinBlocks"), + R(16), T(7), C(ImColor(255, 255, 255, 30)), CB(ImColor::HSV(hue * 0.005f, 0.8f, 0.8f)), S(5) * velocity); break; + case $(191) ImSpinner::SpinnerAng (Name("SpinnerAng90"), + R(16), T(4), C(white), CB(ImColor(255, 255, 255, 128)), S(8.f) * velocity, A(PI_DIV_2), M(3)); break; + case $(192) ImSpinner::SpinnerSplineAng (Name("SpinnerSplineAng90"), + R(16), T(2), C(white), CB(ImColor(255, 255, 255, 128)), S(8.f) * velocity, A(PI_DIV_2), M(0)); break; + case $(193) ImSpinner::Spinner (Name("SpinnerAngNoBg"), + Radius{R(16)}, Thickness{T(2)}, Color{C(white)}, BgColor{CB(ImColor(255, 255, 255, 0))}, Speed{S(6) * velocity}, Angle{A(IM_PI)}, Mode{M(0)}); break; + case $(194) ImSpinner::SpinnerBounceDots (Name("SpinnerBounceDots2"), R(16), + T(2.5), C(white), S(1) * velocity, DT(6), M(2)); break; + case $(195) ImSpinner::SpinnerRotateDots (Name("SpinnerRotateDots"), + R(16), T(1.3), C(white), S(4) * velocity, DT(6), M(0)); break; + case $(196) ImSpinner::SpinnerRotateDots (Name("SpinnerRotateDots"), + R(16), T(2.3), C(white), S(4) * velocity, DT(5), M(2)); break; + case $(197) ImSpinner::SpinnerTwinAng360 (Name("SpinnerTwinAng360"), + R(16), 11, T(4), C(white), CB(ImColor(255, 0, 0)), S(4) * velocity); break; + case $(198) ImSpinner::SpinnerDots (Name("SpinnerDotsWoBg2"), + &nextdot2, R(16), T(4), C(white), S(0.3f) * velocity, DT(6), A(1.49f), M(0)); break; + case $(199) ImSpinner::SpinnerDots (Name("SpinnerDotsWoBg3"), + &nextdot2, R(16), T(4), C(white), S(0.3f) * velocity, DT(4), A(1.49f), M(1)); break; + case $(200) ImSpinner::SpinnerIncScaleDots (Name("SpinnerIncScaleDots2"), + R(16), T(4), C(white), S(6.6f) * velocity, DT(8), A(1.22), M(1)); break; + case $(201) ImSpinner::SpinnerPulsar (Name("SpinnerPulsar2"), + R(16), T(2), C(white), S(1) * velocity, true, A(PI_2), M(1)); break; + case $(202) ImSpinner::SpinnerAngTwin (Name("SpinnerAngTwin4"), + R(16), 13, T(2), C(ImColor(255, 0, 0)), CB(white), S(1.6f) * velocity, A(3.14), DT(1), M(2)); break; + case $(203) ImSpinner::SpinnerAngTwin (Name("SpinnerAngTwin5"), + R(14), 16, T(2), C(ImColor(255, 0, 0)), CB(white), S(0.8f) * velocity, A(1.57), DT(3), M(2)); break; + case $(204) ImSpinner::Spinner (Name("SpinnerDotsX3"), + Radius{R(16)}, Thickness{T(2.3)}, Color{C(white)}, FloatPtr{&nextdot}, Speed{S(1) * velocity}, Dots{DT(3)}, MinThickness{-1.f}, Mode{M(2)}); break; + case $(205) ImSpinner::Spinner (Name("SpinnerDotsX13"), + Radius{R(16)}, Thickness{T(2.3)}, Color{C(white)}, FloatPtr{&nextdot}, Speed{S(1) * velocity}, Dots{DT(13)}, MinThickness{-1.f}, Mode{M(2)}); break; + case $(206) ImSpinner::Spinner (Name("SpinnerAng"), + Radius{R(16)}, Thickness{T(2)}, Color{C(white)}, BgColor{CB(ImColor(255, 255, 255, 128))}, Speed{S(2.8) * velocity}, Angle{A(PI_DIV_2)}, Mode{M(4)}); break; + case $(207) ImSpinner::SpinnerTwinAng180 (Name("SpinnerTwinAngX"), + R(16), 12, T(2), C(white), CB(ImColor(255, 0, 0)), S(0.5f) * velocity, A(PI_DIV_4), M(2)); break; + case $(208) ImSpinner::SpinnerAng8 (Name("SpinnerAng8"), + R(21), T(2), C(white), CB(0), S(8.f) * velocity, A(PI_DIV_4 * 6), M(3), D(0.5f)); break; + case $(209) ImSpinner::SpinnerAng8 (Name("SpinnerAng8.1"), + R(14.5), T(2.5), C(white), CB(0), S(4) * velocity, A(PI_DIV_4), M(4), D(0.5f)); break; + case $(210) ImSpinner::SpinnerAng8 (Name("SpinnerAng8.2"), + R(12), T(2.5), C(white), CB(0), S(5) * velocity, A(5.0f), M(5), D(0.75f)); break; + case $(211) ImSpinner::SpinnerAng8 (Name("SpinnerAng8.3"), + R(19), T(2.5), C(white), CB(0), S(5) * velocity, A(5.0f), M(0), D(0.70f)); break; + case $(212) ImSpinner::SpinnerRotateDots (Name("SpinnerRotateDots"), + R(16), T(3), C(white), S(4) * velocity, DT(4), M(3)); break; + case $(213) ImSpinner::Spinner (Name("SpinnerDots/3"), + Radius{R(16)}, Thickness{T(4)}, Color{C(white)}, FloatPtr{&nextdot}, Speed{S(1) * velocity}, Dots{DT(12)}, MinThickness{-1.f}, Mode{M(3)}); break; + case $(214) ImSpinner::Spinner (Name("SpinnerDots/4"), + Radius{R(16)}, Thickness{T(4)}, Color{C(white)}, FloatPtr{&nextdot}, Speed{S(1) * velocity}, Dots{DT(12)}, MinThickness{-1.f}, Mode{M(4)}); break; + case $(215) ImSpinner::Spinner (Name("SpinnerVDots/1"), + Radius{R(16)}, Thickness{T(4)}, Color{C(white)}, BgColor{CB(ImColor::HSV(hue * 0.0011f, 0.8f, 0.8f))}, Speed{S(2.7f) * velocity}, Dots{DT(12)}, MiddleDots{MDT(7)}, Mode{M(1)}); break; + case $(216) ImSpinner::SpinnerSinSquares (Name("SpinnerSinSquares/1"), + R(16), T(2), C(white), S(1.f) * velocity, M(1)); break; + case $(217) ImSpinner::SpinnerSinSquares (Name("SpinnerSinSquares/2"), + R(16), T(2), C(white), S(1.f) * velocity, M(2)); break; + case $(218) ImSpinner::SpinnerCamera (Name("SpinnerCamera/1"), + R(16), T(8), [] (int i) { return ImColor::HSV(i * 0.25f, 0.8f, 0.8f); }, S(2.8f) * velocity, DT(4), M(1)); break; + case $(219) ImSpinner::SpinnerCamera (Name("SpinnerCamera/1"), + R(16), T(8), [] (int i) { return ImColor::HSV(i * 0.25f, 0.8f, 0.8f); }, S(1.8f) * velocity, DT(3), M(1)); break; + case $(220) ImSpinner::SpinnerRotateSegments (Name("SpinnerRotateSegments/1"), + R(16), T(1.4), C(white), S(3) * velocity, DT(1), MDT(4), M(1)); break; + case $(221) ImSpinner::SpinnerRotateSegments (Name("SpinnerRotateSegments/1"), + R(16), T(4), C(white), S(3) * velocity, DT(4), MDT(1), M(1)); break; + case $(222) ImSpinner::Spinner (Name("SpinnerAng"), + Radius{R(16)}, Thickness{T(2)}, Color{C(white)}, BgColor{CB(ImColor(255, 255, 255, 128))}, Speed{S(8) * velocity}, Angle{A(IM_PI)}, Mode{M(1)}); break; + case $(223) ImSpinner::SpinnerArcRotation (Name("SpinnerArcRotation/3"), + R(13), T(5), C(white), S(3) * velocity, DT(4), M(3)); break; + case $(224) ImSpinner::SpinnerArcFade (Name("SpinnerArcFade/2"), + R(13), T(5), C(white), S(3) * velocity, DT(4), M(1)); break; + case $(225) ImSpinner::SpinnerIncScaleDots (Name("SpinnerIncScaleDots"), + R(16), T(4), C(white), S(4.6f) * velocity, DT(16), A(1), M(5)); break; + case $(226) ImSpinner::SpinnerTwinPulsar (Name("SpinnerTwinPulsar/5"), + R(16), T(2), C(white), S(0.5f) * velocity, DT(5), M(5)); break; + case $(227) ImSpinner::SpinnerTwinPulsar (Name("SpinnerTwinPulsar/0"), + R(16), T(2), C(white), S(0.5f) * velocity, DT(5), M(0)); break; + case $(228) ImSpinner::SpinnerCircularLines (Name("SpinnerCircularLines/4"), + R(16), C(white), S(1.5f) * velocity, DT(16), M(4)); break; + case $(229) ImSpinner::SpinnerRotatedAtom (Name("SpinnerRotatedAtom/5"), + R(16), T(2), C(white), S(2.1f) * velocity, DT(2), M(5)); break; + case $(230) ImSpinner::SpinnerRotatedAtom (Name("SpinnerRotatedAtom/2"), + R(16), T(2), C(white), S(2.1f) * velocity, DT(2), M(1)); break; + case $(231) ImSpinner::SpinnerRotatedAtom (Name("SpinnerRotatedAtom/2"), + R(16), T(2), C(white), S(2.1f) * velocity, DT(3), M(5)); break; + case $(232) ImSpinner::SpinnerRainbowBalls (Name("SpinnerRainbowBalls/1"), + R(16), T(4), ImColor::HSV(0.25f, 0.8f, 0.8f, 0.f), S(1.5f) * velocity, DT(3), M(1), MDT(1)); break; + case $(233) ImSpinner::SpinnerRainbowBalls (Name("SpinnerRainbowBalls/5"), + R(16), T(4), ImColor::HSV(0.25f, 0.8f, 0.8f, 0.f), S(1.5f) * velocity, DT(4), M(5), MDT(1)); break; + case $(234) ImSpinner::SpinnerPointsRoller (Name("SpinnerPointsRoller"), + R(16), T(3.5), C(white), S(1.4) * velocity, DT(8), MDT(1), 1.f); break; + case $(235) ImSpinner::SpinnerPointsRoller (Name("SpinnerPointsRoller2"), + R(16), T(1), C(white), S(1.0) * velocity, DT(18), MDT(3), 1.f); break; + case $(236) ImSpinner::SpinnerPointsRoller (Name("SpinnerPointsRoller2"), + R(16), T(3), C(white), S(1.0) * velocity, DT(2), MDT(12), 1.f); break; + case $(237) ImSpinner::SpinnerThickToSin (Name("SpinnerThickToSin"), + R(16), T(2), C(white), S(3) * velocity, MDT(1), DT(8) , M(0)); break; + case $(238) ImSpinner::SpinnerThickToSin (Name("SpinnerThickToSin2"), + R(16), T(1), C(white), S(3) * velocity, MDT(1), DT(20), M(5)); break; + case $(239) ImSpinner::SpinnerThickToSin (Name("SpinnerThickToSin2"), + R(16), T(1), C(white), S(3) * velocity, MDT(1), DT(20), M(6)); break; + case $(240) ImSpinner::SpinnerFadePulsarSquare (Name("SpinnerFadePulsarSquare"), + R(16), C(white), S(1.5f) * velocity, DT(5), M(0)); break; + case $(241) ImSpinner::SpinnerRainbowBalls (Name("SpinnerRainbowBalls1"), + R(16), T(1), ImColor::HSV(0.25f, 0.8f, 0.8f, 0.f), S(0.4f) * velocity, DT(9), M(1), MDT(10), MX(1)); break; + case $(242) ImSpinner::SpinnerRainbowBalls (Name("SpinnerRainbowBalls2"), + R(16), T(1), ImColor::HSV(0.25f, 0.8f, 0.8f, 0.f), S(0.9f) * velocity, DT(9), M(2), MDT(16), MX(1)); break; + case $(243) ImSpinner::SpinnerRainbowBalls (Name("SpinnerRainbowBalls3"), + R(16), T(1), ImColor::HSV(0.25f, 0.8f, 0.8f, 0.f), S(0.9f) * velocity, DT(9), M(6), MDT(16), MX(1)); break; + case $(244) ImSpinner::SpinnerRainbowBalls (Name("SpinnerRainbowBalls4"), + R(16), T(1), ImColor::HSV(0.25f, 0.8f, 0.8f, 0.f), S(0.9f) * velocity, DT(7), M(0), MDT(24), MX(3)); break; + case $(245) ImSpinner::SpinnerRainbowBalls (Name("SpinnerRainbowBalls5"), + R(16), T(1), ImColor::HSV(0.25f, 0.8f, 0.8f, 0.f), S(0.9f) * velocity, DT(17), M(4), MDT(30), MX(4)); break; + case $(246) ImSpinner::SpinnerRainbowBalls (Name("SpinnerRainbowBalls6"), + R(16), T(1), ImColor::HSV(0.25f, 0.8f, 0.8f, 0.f), S(0.9f) * velocity, DT(17), M(4), MDT(30), MX(5)); break; + case $(247) ImSpinner::SpinnerRainbowBalls (Name("SpinnerRainbowBalls7"), + R(16), T(1), ImColor::HSV(0.25f, 0.8f, 0.8f, 0.f), S(0.9f) * velocity, DT(17), M(4), MDT(30), MX(6)); break; + case $(248) ImSpinner::SpinnerRainbowBalls (Name("SpinnerRainbowBalls7"), + R(16), T(1), ImColor::HSV(0.25f, 0.8f, 0.8f, 0.f), S(0.9f) * velocity, DT(4), M(0), MDT(30), MX(8)); break; + case $(249) ImSpinner::SpinnerRainbowShot (Name("SpinnerRainbowShot2"), + R(16), T(2), ImColor::HSV(0.25f, 0.8f, 0.8f, 0.f), S(1.5f) * velocity, DT(30), M(1)); break; + case $(250) ImSpinner::SpinnerRainbowShot (Name("SpinnerRainbowShot3"), + R(16), T(2), ImColor::HSV(0.25f, 0.8f, 0.8f, 0.f), S(1.5f) * velocity, DT(30), M(3)); break; + case $(251) ImSpinner::SpinnerRainbowShot (Name("SpinnerRainbowShot2"), + R(16), T(2), ImColor::HSV(0.25f, 0.8f, 0.8f, 0.f), S(1.5f) * velocity, DT(30), M(5)); break; + case $(252) ImSpinner::SpinnerRainbowShot (Name("SpinnerRainbowShot2"), + R(16), T(2), ImColor::HSV(0.25f, 0.8f, 0.8f, 0.f), S(1.5f) * velocity, DT(30), M(6)); break; + } +#undef $ + } + ImGui::PopID(); + }; + + if( ImGui::BeginTable("Demo table", 2, ImGuiTableFlags_Resizable | ImGuiTableFlags_BordersInnerV) ) + { + ImGui::TableNextColumn(); // Grid + { + // Extra 'Child region' needed here, to make scrollable-area + if(ImGui::BeginChild("Grid")) + { + ImGuiStyle& style = ImGui::GetStyle(); + + // Store previous Item spacing & Window padding (to restore it later) + const ImVec2 prevSpacing = style.ItemSpacing; + const ImVec2 prevPadding = style.WindowPadding; + + // Set Item spacing & Window padding as zero + style.ItemSpacing = style.WindowPadding = {0.f, 0.f}; + + // ----------------------------------------------------------------- + // For drawing spinners used 'Row-wrap' layout, same as in + // Dear ImGui Demo > Layout > Basic Horizontal Layout > Manual wrapping: + // https://github.com/ocornut/imgui/blob/1029f57b8aa9118d08413d1d8a6dd9d32cf0d5f1/imgui_demo.cpp#L2866-L2878 + + const float region_visible_x2 = ImGui::GetWindowPos().x + ImGui::GetColumnWidth(); + + const ImVec2 item_size = ImVec2(widget_size, widget_size); + for(int current_spi = 0; current_spi < num_spinners; current_spi++) + { + // BeginChild here needed to restrict item width&height by specific size + if( ImGui::BeginChild(100 + current_spi, item_size, false, ImGuiWindowFlags_NoScrollbar) ) + { + draw_spinner(current_spi, widget_size); + } + ImGui::EndChild(); + + // Show tooltip over spinner + if( ImGui::IsItemHovered() ) + { + //if( ) + ImGui::BeginTooltip(); + { + // Number + ImGui::TextDisabled("%04u", current_spi); + + // Spinner name + if(__nn.count(current_spi)) { + ImGui::SameLine(); + ImGui::Text(" - %s", __nn[current_spi] ); + } + + ImGui::EndTooltip(); + } + } + + // ------------------------------------------------------------- + + const float last_item_x2 = ImGui::GetItemRectMax().x; + const float next_item_x2 = last_item_x2 + style.ItemSpacing.x + item_size.x; // Expected position if next item was on same line + if ((current_spi + 1 < num_spinners) && (next_item_x2 < region_visible_x2)) { + ImGui::SameLine(); + } + } + + // ----------------------------------------------------------------- + + // Restore previous Item spacing & Window padding + style.ItemSpacing = prevSpacing; + style.WindowPadding = prevPadding; + } + ImGui::EndChild(); + } + + // --------------------------------------------------------------------- + + ImGui::TableNextColumn(); // Options + { + ImGui::SliderFloat("Velocity", &velocity, 0.0f, 10.0f, "velocity = %.2f"); + ImGui::Checkbox("Show Numbers", &show_number); + ImGui::SliderFloat("Grid size", &widget_size, 0.0f, 100.0f, "size = %.2f"); + + // ----------------------------------------------------------------- + // Spinner-related parameters + + constexpr ImGuiColorEditFlags COLOR_EDIT_FLAGS = + ImGuiColorEditFlags_PickerHueWheel | + ImGuiColorEditFlags_NoSidePreview | + ImGuiColorEditFlags_NoInputs | + ImGuiColorEditFlags_NoAlpha; + + if(__nn.count(last_cci)) ImGui::Separator(); + + if (__rr.count(last_cci)) ImGui::SliderFloat("Radius", &__rr[last_cci], 0.0f, 100.0f, "radius = %.2f"); + if (__tt.count(last_cci)) ImGui::SliderFloat("Thickness", &__tt[last_cci], 0.0f, 100.0f, "thickness = %.2f"); + if (__cc.count(last_cci)) { + ImGui::Checkbox("Change Color", &__hc[last_cci]); + if (__hc[last_cci]) { __cc[last_cci] = ImColor::HSV(hue * 0.005f, 0.8f, 0.8f); } + else { + ImGui::SameLine(); ImGui::SetNextItemWidth(120); + ImGui::ColorPicker3("##MyColor", (float *)&__cc[last_cci], COLOR_EDIT_FLAGS); + } + } + if (__cb.count(last_cci)) { + ImGui::Checkbox("Change Bg Color", &__hcb[last_cci]); + if (__hcb[last_cci]) { __cb[last_cci] = ImColor::HSV(hue * 0.008f, 0.8f, 0.8f); } + else { + ImGui::SameLine(); ImGui::SetNextItemWidth(120); + ImGui::ColorPicker3("##MyBgColor", (float *)&__cb[last_cci], COLOR_EDIT_FLAGS); + } + } + if (__ss.count(last_cci)) ImGui::SliderFloat("Speed", &__ss[last_cci], 0.0f, 100.0f, "speed = %.2f"); + if (__aa.count(last_cci)) ImGui::SliderFloat("Angle", &__aa[last_cci], 0.0f, PI_2, "angle = %.2f"); + if (__amn.count(last_cci)) ImGui::SliderFloat("Angle Min", &__amn[last_cci], 0.0f, PI_2, "angle min = %.2f"); + if (__amx.count(last_cci)) ImGui::SliderFloat("Angle Max", &__amx[last_cci], 0.0f, PI_2, "angle max = %.2f"); + if (__dt.count(last_cci)) ImGui::SliderInt("Dots", &__dt[last_cci], 1, 100, "dots = %u"); + if (__mdt.count(last_cci)) ImGui::SliderInt("MidDots", &__mdt[last_cci], 1, 100, "mid dots = %u"); + if (__dd.count(last_cci)) ImGui::SliderFloat("Delta", &__dd[last_cci], -1.f, 1.f, "delta = %f"); + if (__mm.count(last_cci)) ImGui::SliderInt("Mode", &__mm[last_cci], 0, 8, "mode = %d"); + if (__mx.count(last_cci)) ImGui::SliderInt("Ext", &__mx[last_cci], 0, 8, "ext = %d"); + } + + ImGui::EndTable(); + } + } +#endif // IMSPINNER_DEMO +} + +#endif // _IMSPINNER_H_ From 230e102f36a7739bb6186e3b9c383c2d0e5a5ed8 Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Fri, 8 Aug 2025 19:55:17 +0200 Subject: [PATCH 15/85] Only request the app list when the stream is stalled --- client/scenes/stream.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index aff2938d..aa33ba7b 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -315,15 +315,6 @@ std::shared_ptr scenes::stream::create(std::unique_ptrnetwork_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; @@ -770,7 +761,15 @@ void scenes::stream::render(const XrFrameState & frame_state) } if (state_ == state::stalled) + { + network_session->send_control(from_headset::get_application_list{ + .language = application::get_messages_info().language, + .country = application::get_messages_info().country, + .variant = application::get_messages_info().variant, + }); + application::pop_scene(); + } assert(swapchain); for (auto & i: decoders) From 58b6b9d19f476c56eb957695a3ad1322a4ed0b49 Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Fri, 8 Aug 2025 20:38:57 +0200 Subject: [PATCH 16/85] Remove useless newline in fr and it locales --- locale/fr/wivrn.po | 6 ++---- locale/it/wivrn.po | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/locale/fr/wivrn.po b/locale/fr/wivrn.po index 4467af9c..4745f723 100644 --- a/locale/fr/wivrn.po +++ b/locale/fr/wivrn.po @@ -474,8 +474,7 @@ msgstr "" #: client/scenes/lobby_gui.cpp:1866 msgid "Press the grip button to move the main window" msgstr "" -"Serrez la gâchette latérale pour bouger la\n" -"fenêtre principale" +"Serrez la gâchette latérale pour bouger la fenêtre principale" #: client/scenes/stream_gui.cpp:224 msgid "Reproject" @@ -542,8 +541,7 @@ 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" +"Serrez la gâchette latérale pour bouger la fenêtre" #: client/scenes/stream_gui.cpp:398 client/scenes/stream_gui.cpp:750 msgid "Press both thumbsticks to display the WiVRn window" diff --git a/locale/it/wivrn.po b/locale/it/wivrn.po index 32a70a1c..e13a49e6 100644 --- a/locale/it/wivrn.po +++ b/locale/it/wivrn.po @@ -474,8 +474,7 @@ msgstr "" #: 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" +"Premi il pulsante laterale per spostare la finestra principale" #: client/scenes/stream_gui.cpp:224 msgid "Reproject" From c7b7bc6fbd312148da32121eea6ff86e688fba1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Fahri=20Uzun?= Date: Fri, 8 Aug 2025 17:11:08 +0300 Subject: [PATCH 17/85] added TR translation --- locale/tr/wivrn-dashboard.po | 943 +++++++++++++++++++++++++++++++++++ locale/tr/wivrn.po | 612 +++++++++++++++++++++++ 2 files changed, 1555 insertions(+) create mode 100644 locale/tr/wivrn-dashboard.po create mode 100644 locale/tr/wivrn.po diff --git a/locale/tr/wivrn-dashboard.po b/locale/tr/wivrn-dashboard.po new file mode 100644 index 00000000..6385fcf3 --- /dev/null +++ b/locale/tr/wivrn-dashboard.po @@ -0,0 +1,943 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the WiVRn-dashboard package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: WiVRn-dashboard\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-04 10:40+0300\n" +"PO-Revision-Date: 2025-08-08 17:09+0300\n" +"Last-Translator: Hüseyin Fahri Uzun \n" +"Language-Team: \n" +"Language: tr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.6\n" + +#: dashboard/apk_installer.cpp:167 +#, kde-format +msgid "Downloading APK: %1 MB / %2 MB" +msgstr "APK indiriliyor: %1 MB / %2 MB" + +#: dashboard/apk_installer.cpp:169 +#, kde-format +msgid "Downloading APK: %1 MB" +msgstr "APK indiriliyor: %1 MB" + +#: dashboard/apk_installer.cpp:178 +#, kde-format +msgid "Download cancelled" +msgstr "İndirme iptal edildi" + +#: dashboard/apk_installer.cpp:194 +#, kde-format +msgid "Cannot download APK: %1" +msgstr "APK indirilemiyor: %1" + +#: dashboard/apk_installer.cpp:217 +#, kde-format +msgid "Installing APK" +msgstr "APK yükleniyor" + +#: dashboard/apk_installer.cpp:221 +#, kde-format +msgid "adb failed to start: %1" +msgstr "adb başlatılamadı: %1" + +#: dashboard/apk_installer.cpp:231 +#, kde-format +msgid "adb exited abnormally: %1" +msgstr "adb anormal şekilde çıktı: %1" + +#: dashboard/apk_installer.cpp:239 +#, kde-format +msgid "The 'adb install' command failed: exit code %1" +msgstr "'adb install' komutu başarısız oldu: çıkış kodu %1" + +#: dashboard/apk_installer.cpp:244 +#, kde-format +msgid "Installation successful" +msgstr "Yükleme başarılı" + +#: dashboard/main.cpp:27 dashboard/qml/Main.qml:12 +#, kde-format +msgid "WiVRn dashboard" +msgstr "WiVRn kontrol paneli" + +#: dashboard/qml/ApkInstallPage.qml:12 dashboard/qml/WizardPage.qml:137 +#, kde-format +msgid "Install the WiVRn app on your headset" +msgstr "WiVRn uygulamasını gözlüğe yükle" + +#: dashboard/qml/ApkInstallPage.qml:41 dashboard/qml/WizardPage.qml:157 +#: dashboard/qml/WizardPage.qml:192 +#, kde-format +msgid "Checking latest release..." +msgstr "En son sürüm kontrol ediliyor..." + +#: dashboard/qml/ApkInstallPage.qml:43 dashboard/qml/WizardPage.qml:198 +#, kde-format +msgid "No precompiled APK is available for this version." +msgstr "Bu sürüm için önceden derlenmiş APK yok." + +#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:259 +#: dashboard/qml/Main.qml:341 +#, kde-format +msgid "ADB is not installed." +msgstr "ADB yüklü değil." + +#: dashboard/qml/ApkInstallPage.qml:47 +#, kde-format +msgid "Connect a headset and make sure developer mode is enabled." +msgstr "" +"Bir gözlük bağlayın ve geliştirici modunun etkinleştirildiğinden emin olun." + +#: dashboard/qml/ApkInstallPage.qml:51 dashboard/qml/WizardPage.qml:204 +#, kde-format +msgid "" +"Follow the instructions in the documentation to build your own " +"client." +msgstr "" +"Kendi istemcinizi oluşturmak için belgelerdeki talimatları " +"izleyin." + +#: dashboard/qml/ApkInstallPage.qml:65 dashboard/qml/HeadsetsPage.qml:183 +#: dashboard/qml/HeadsetStatsPage.qml:36 dashboard/qml/TroubleshootPage.qml:59 +#, kde-format +msgctxt "go back to the home page" +msgid "Back" +msgstr "Geri" + +#: dashboard/qml/ConnectUsbDialog.qml:11 +#, kde-format +msgid "Select your headset" +msgstr "Gözlüğünüzü seçin" + +#: dashboard/qml/DeviceCard.qml:46 +#, kde-format +msgid "WiVRn is already installed on this device" +msgstr "WiVRn bu aygıta zaten yüklü" + +#: dashboard/qml/DeviceCard.qml:54 +#, kde-format +msgid "Reinstall WiVRn" +msgstr "WiVRn'i yeniden yükle" + +#: dashboard/qml/DeviceCard.qml:54 +#, kde-format +msgid "Install WiVRn" +msgstr "WiVRn'i yükle" + +#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:354 +#, kde-format +msgid "Headsets" +msgstr "Gözlükler" + +#: dashboard/qml/HeadsetsPage.qml:29 +#, kde-format +msgid "Last connection: %1 second ago" +msgid_plural "Last connection: %1 seconds ago" +msgstr[0] "Son bağlantı: %1 saniye önce" +msgstr[1] "Son bağlantı: %1 saniye önce" + +#: dashboard/qml/HeadsetsPage.qml:31 +#, kde-format +msgid "Last connection: %1 minute ago" +msgid_plural "Last connection: %1 minutes ago" +msgstr[0] "Son bağlantı: %1 dakika önce" +msgstr[1] "Son bağlantı: %1 dakika önce" + +#: dashboard/qml/HeadsetsPage.qml:33 +#, kde-format +msgid "Last connection: %1 hour ago" +msgid_plural "Last connection: %1 hours ago" +msgstr[0] "Son bağlantı: %1 saat önce" +msgstr[1] "Son bağlantı: %1 saat önce" + +#: dashboard/qml/HeadsetsPage.qml:35 +#, kde-format +msgid "Last connection: %1 day ago" +msgid_plural "Last connection: %1 days ago" +msgstr[0] "Son bağlantı: %1 gün önce" +msgstr[1] "Son bağlantı: %1 gün önce" + +#: dashboard/qml/HeadsetsPage.qml:40 +#, kde-format +msgid "Rename headset" +msgstr "Gözlüğü yeniden adlandır" + +#: dashboard/qml/HeadsetsPage.qml:48 dashboard/qml/HeadsetsPage.qml:116 +#, kde-format +msgid "Rename" +msgstr "Yeniden Adlandır" + +#: dashboard/qml/HeadsetsPage.qml:55 dashboard/qml/WizardPage.qml:38 +#: dashboard/qml/WizardPage.qml:88 dashboard/qml/WizardPage.qml:263 +#: dashboard/qml/WizardPage.qml:326 dashboard/qml/WizardPage.qml:410 +#, kde-format +msgid "Cancel" +msgstr "İptal" + +#: dashboard/qml/HeadsetsPage.qml:64 +#, kde-format +msgid "Headset name…" +msgstr "Gözlük adı…" + +#: dashboard/qml/HeadsetsPage.qml:128 +#, kde-format +msgid "Remove" +msgstr "Kaldır" + +#: dashboard/qml/HeadsetsPage.qml:143 +#, kde-format +msgid "Pairing enabled, PIN: %1" +msgstr "Eşleştirme etkin, PIN: %1" + +#: dashboard/qml/HeadsetsPage.qml:148 dashboard/qml/TroubleshootPage.qml:42 +#, kde-format +msgid "Disable pairing" +msgstr "Eşleştirmeyi devre dışı bırak" + +#: dashboard/qml/HeadsetsPage.qml:166 +#, kde-format +msgid "Start the WiVRn app on your headset and use the PIN: %1" +msgstr "Gözlüğünüzde WiVRn uygulamasını başlatın ve PIN: %1'i kullanın" + +#: dashboard/qml/HeadsetsPage.qml:166 +#, kde-format +msgid "Enable pairing to allow your headset to connect to this computer" +msgstr "" +"Gözlüğünüzün bu bilgisayara bağlanmasına izin vermek için eşleştirmeyi " +"etkinleştirin" + +#: dashboard/qml/HeadsetsPage.qml:171 dashboard/qml/TroubleshootPage.qml:37 +#, kde-format +msgid "Enable pairing" +msgstr "Eşleştirmeyi etkinleştir" + +#: dashboard/qml/HeadsetsPage.qml:191 +#, kde-format +msgid "Pair a new headset" +msgstr "Yeni bir gözlük eşleştir" + +#: dashboard/qml/HeadsetStatsPage.qml:12 +#, kde-format +msgid "Headset statistics" +msgstr "Gözlük istatistikleri" + +#: dashboard/qml/Main.qml:107 +#, kde-format +msgid "The server does not have CAP_SYS_NICE capabilities." +msgstr "Sunucunun CAP_SYS_NICE yetenekleri yok." + +#: dashboard/qml/Main.qml:114 +#, kde-format +msgid "Fix it" +msgstr "Onar" + +#: dashboard/qml/Main.qml:123 +#, kde-format +msgid "The CAP_SYS_NICE capability will be used when the server is restarted." +msgstr "Sunucu yeniden başlatıldığında CAP_SYS_NICE yeteneği kullanılacak." + +#: dashboard/qml/Main.qml:129 +#, kde-format +msgctxt "restart the server" +msgid "Restart now" +msgstr "Şimdi yeniden başlat" + +#: dashboard/qml/Main.qml:140 +#, kde-format +msgid "" +"NVIDIA GPUs require at least driver version 565.77, current version is %1" +msgstr "" +"NVIDIA GPU'lar en az 565.77 sürücü sürümünü gerektirir, geçerli sürüm %1" + +#: dashboard/qml/Main.qml:146 +#, kde-format +msgid "More info" +msgstr "Daha fazla bilgi" + +#: dashboard/qml/Main.qml:154 +#, kde-format +msgid "" +"Use the Mesa (radv) driver for AMD GPUs\n" +"Hardware encoding with vaapi does not work with AMDVLK and AMDGPU-PRO" +msgstr "" +"AMD GPU'lar için Mesa (radv) sürücüsünü kullanın\n" +"vaapi ile donanım kodlaması AMDVLK ve AMDGPU-PRO ile çalışmaz" + +#: dashboard/qml/Main.qml:162 +#, kde-format +msgid "" +"No OpenVR compatibility detected, Steam games won't be able to load VR.\n" +"Install xrizer or OpenComposite." +msgstr "" +"OpenVR uyumluluğu algılanmadı, Steam oyunları VR'ı yükleyemeyecek.\n" +"xrizer veya OpenComposite kurun." + +#: dashboard/qml/Main.qml:171 +#, kde-format +msgid "Server failed to start" +msgstr "Sunucu başlatılamadı" + +#: dashboard/qml/Main.qml:177 dashboard/qml/TroubleshootPage.qml:77 +#, kde-format +msgid "Open server logs" +msgstr "Sunucu günlüklerini aç" + +#: dashboard/qml/Main.qml:214 +#, kde-format +msgctxt "whether the server is running, displayed in front of a checkbox" +msgid "Running" +msgstr "Çalışıyor" + +#: dashboard/qml/Main.qml:229 +#, kde-format +msgctxt "whether pairing is enabled, displayed in front of a checkbox" +msgid "Pairing" +msgstr "Eşleştirme" + +#: dashboard/qml/Main.qml:242 +#, kde-format +msgid "PIN: %1" +msgstr "PIN: %1" + +#: dashboard/qml/Main.qml:250 dashboard/qml/WizardPage.qml:373 +#, kde-format +msgid "Connect by USB" +msgstr "USB ile bağlan" + +#: dashboard/qml/Main.qml:261 +#, kde-format +msgid "No headset is connected or your headset is not in developer mode." +msgstr "Gözlük bağlı değil veya gözlüğünüz geliştirici modunda değil." + +#: dashboard/qml/Main.qml:269 +#, kde-format +msgid "Disconnect" +msgstr "Bağlantıyı kes" + +#: dashboard/qml/Main.qml:286 +#, kde-format +msgctxt "automatically started application" +msgid "Application" +msgstr "Uygulama" + +#: dashboard/qml/Main.qml:307 +#, kde-format +msgid "Steam information" +msgstr "Steam bilgisi" + +#: dashboard/qml/Main.qml:325 +#, kde-format +msgid "Wizard" +msgstr "Sihirbaz" + +#: dashboard/qml/Main.qml:332 +#, kde-format +msgid "Install the app" +msgstr "Uygulamayı yükle" + +#: dashboard/qml/Main.qml:361 dashboard/qml/SettingsPage.qml:14 +#, kde-format +msgid "Settings" +msgstr "Ayarlar" + +#: dashboard/qml/Main.qml:368 dashboard/qml/TroubleshootPage.qml:10 +#, kde-format +msgid "Troubleshoot" +msgstr "Sorun giderme" + +#: dashboard/qml/SelectGame.qml:14 +#, kde-format +msgctxt "don't start an application automatically" +msgid "None" +msgstr "Yok" + +#: dashboard/qml/SelectGame.qml:20 +#, kde-format +msgctxt "choose a custom application to start" +msgid "Custom" +msgstr "Özel" + +#: dashboard/qml/SelectGame.qml:76 +#, kde-format +msgctxt "browse a file to choose the application to start" +msgid "Browse" +msgstr "Gözat" + +#: dashboard/qml/SettingsPage.qml:40 +#, kde-format +msgctxt "automatic foveation setup" +msgid "Manual foveation" +msgstr "El ile foveasyon" + +#: dashboard/qml/SettingsPage.qml:46 +#, kde-format +msgid "Foveation strength:" +msgstr "Foveasyon gücü:" + +#: dashboard/qml/SettingsPage.qml:62 +#, kde-format +msgid "%1 %" +msgstr "%%%1" + +#: dashboard/qml/SettingsPage.qml:68 +#, kde-format +msgid "" +"A stronger foveation makes the image sharper in the center than in the " +"periphery and makes the decoding faster. This is better for fast paced " +"games.\n" +"\n" +"A weaker foveation gives a uniform sharpness in the whole image.\n" +"\n" +"The recommended values are between 20% and 50% for headsets without eye " +"tracking and between 50% and 70% for headsets with eye tracking." +msgstr "" +"Daha güçlü bir foveasyon, görüntüyü merkezde çevreye göre daha keskin hale " +"getirir ve kod çözmeyi hızlandırır. Bu, hızlı tempolu oyunlar için daha " +"iyidir.\n" +"\n" +"Daha zayıf bir foveasyon, tüm görüntüde tek tip bir keskinlik sağlar.\n" +"\n" +"Önerilen değerler, göz izleme olmayan başlıklar için 20% ile 50% arasında, " +"göz izleme olan başlıklar için ise 50% ile 70% arasındadır." + +#: dashboard/qml/SettingsPage.qml:74 +#, kde-format +msgctxt "weaker foveation" +msgid "Weaker" +msgstr "Daha zayıf" + +#: dashboard/qml/SettingsPage.qml:85 +#, kde-format +msgctxt "stronger foveation" +msgid "Stronger" +msgstr "Daha güçlü" + +#: dashboard/qml/SettingsPage.qml:95 +#, kde-format +msgid "Bitrate:" +msgstr "Bit hızı:" + +#: dashboard/qml/SettingsPage.qml:99 dashboard/qml/SettingsPage.qml:101 +#, kde-format +msgctxt "bitrate" +msgid "%1 Mbit/s" +msgstr "Mbit/s %1" + +#: dashboard/qml/SettingsPage.qml:111 +#, kde-format +msgid "Encoder layout:" +msgstr "Kodlayıcı düzeni:" + +#: dashboard/qml/SettingsPage.qml:114 +#, kde-format +msgctxt "encoder preset" +msgid "Automatic" +msgstr "Otomatik" + +#: dashboard/qml/SettingsPage.qml:118 +#, kde-format +msgctxt "encoder preset" +msgid "Manual" +msgstr "El ile" + +#: dashboard/qml/SettingsPage.qml:122 +#, kde-format +msgctxt "encoder preset" +msgid "Default preset" +msgstr "Varsayılan ön ayar" + +#: dashboard/qml/SettingsPage.qml:145 +#, kde-format +msgctxt "encoder preset" +msgid "Low latency preset" +msgstr "Düşük gecikmeli ön ayar" + +#: dashboard/qml/SettingsPage.qml:170 +#, kde-format +msgctxt "encoder preset" +msgid "Safe preset" +msgstr "Güvenli ön ayar" + +#: dashboard/qml/SettingsPage.qml:193 +#, kde-format +msgid "" +"To add a new encoder, split an existing encoder by clicking near an edge.\n" +"Drag an edge to resize or remove encoders." +msgstr "" +"Yeni bir kodlayıcı eklemek için, mevcut bir kodlayıcıyı bir kenarın yakınına " +"tıklayarak bölün.\n" +"Kodlayıcıları yeniden boyutlandırmak veya kaldırmak için bir kenarı " +"sürükleyin." + +#: dashboard/qml/SettingsPage.qml:220 +#, kde-format +msgid "Encoder:" +msgstr "Kodlayıcı:" + +#: dashboard/qml/SettingsPage.qml:229 +#, kde-format +msgctxt "automatic encoder setup" +msgid "Auto" +msgstr "Otomatik" + +#: dashboard/qml/SettingsPage.qml:234 +#, kde-format +msgid "nvenc (NVIDIA GPUs)" +msgstr "nvenc (NVIDIA GPU'ları)" + +#: dashboard/qml/SettingsPage.qml:239 +#, kde-format +msgid "vaapi (AMD and Intel GPUs)" +msgstr "vaapi (AMD ve Intel GPU'ları)" + +#: dashboard/qml/SettingsPage.qml:244 +#, kde-format +msgid "x264 (software encoding)" +msgstr "x264 (yazılım kodlaması)" + +#: dashboard/qml/SettingsPage.qml:249 +#, kde-format +msgid "Vulkan (Vulkan Video)" +msgstr "Vulkan (Vulkan Video)" + +#: dashboard/qml/SettingsPage.qml:272 +#, kde-format +msgid "\"Auto\" will use hardware acceleration if it is available" +msgstr "\"Otomatik\", mevcutsa donanım hızlandırmayı kullanacaktır" + +#: dashboard/qml/SettingsPage.qml:278 +#, kde-format +msgid "Codec:" +msgstr "Codec:" + +#: dashboard/qml/SettingsPage.qml:285 +#, kde-format +msgctxt "automatic codec setup" +msgid "Auto" +msgstr "Otomatik" + +#: dashboard/qml/SettingsPage.qml:289 +#, kde-format +msgid "H.264" +msgstr "H.264" + +#: dashboard/qml/SettingsPage.qml:293 +#, kde-format +msgid "H.265" +msgstr "H.265" + +#: dashboard/qml/SettingsPage.qml:297 +#, kde-format +msgid "AV1" +msgstr "AV1" + +#: dashboard/qml/SettingsPage.qml:319 +#, kde-format +msgid "Advanced options" +msgstr "Gelişmiş seçenekler" + +#: dashboard/qml/SettingsPage.qml:325 +#, kde-format +msgid "Enable debug window" +msgstr "Hata ayıklama penceresini etkinleştir" + +#: dashboard/qml/SettingsPage.qml:332 +#, kde-format +msgid "Enable SteamVR tracked devices support" +msgstr "SteamVR izlenen aygıt desteğini etkinleştir" + +#: dashboard/qml/SettingsPage.qml:335 +#, kde-format +msgid "" +"Allows the use of lighthouse-based controllers and trackers.\n" +"Requires SteamVR to be installed.\n" +"Devices must be be powered on before connecting to WiVRn.\n" +"An external tool such as motoc is needed for calibration." +msgstr "" +"Deniz lighthouse tabanlı denetleyicilerin ve izleyicilerin kullanılmasına " +"izin verir.\n" +"SteamVR'nin kurulu olmasını gerektirir.\n" +"Aygıtlar WiVRn'e bağlanmadan önce açık olmalıdır.\n" +"Kalibrasyon için motoc gibi harici bir araç gereklidir." + +#: dashboard/qml/SettingsPage.qml:343 +#, kde-format +msgid "Custom adb location" +msgstr "Özel adb konumu" + +#: dashboard/qml/SettingsPage.qml:354 +#, kde-format +msgid "Adb location:" +msgstr "Adb konumu:" + +#: dashboard/qml/SettingsPage.qml:363 +#, kde-format +msgctxt "browse a file to choose the adb binary" +msgid "Browse" +msgstr "Gözat" + +#: dashboard/qml/SettingsPage.qml:373 +#, kde-format +msgid "Default" +msgstr "Varsayılan" + +#: dashboard/qml/SettingsPage.qml:387 +#, kde-format +msgctxt "set a custom OpenVR compatibility library" +msgid "Custom" +msgstr "Özel" + +#: dashboard/qml/SettingsPage.qml:392 +#, kde-format +msgid "Disabled" +msgstr "Devre dışı" + +#: dashboard/qml/SettingsPage.qml:400 +#, kde-format +msgid "OpenVR compatibility library:" +msgstr "OpenVR uyumluluk kitaplığı:" + +#: dashboard/qml/SettingsPage.qml:426 +#, kde-format +msgid "Library path, excluding bin/linux64/vrclient.so" +msgstr "Yol: bin/linux64/vrclient.so hariç, kitaplık yolu" + +#: dashboard/qml/SteamLaunchOptions.qml:8 +#, kde-format +msgid "" +"For Steam games, right click on the game in Steam, go in Properties > " +"General and paste this in \"Launch options\":" +msgstr "" +"Steam oyunları için, Steam'de oyuna sağ tıklayın, Özellikler > Genel'e gidin " +"ve bunu \"Başlatma seçenekleri\" bölümüne yapıştırın:" + +#: dashboard/qml/SteamLaunchOptions.qml:20 +#, kde-format +msgid "Paste this in the Steam launch options for the app you want to start" +msgstr "" +"Başlatmak istediğiniz uygulama için bunu Steam başlatma seçeneklerine " +"yapıştırın" + +#: dashboard/qml/SteamLaunchOptions.qml:26 +#, kde-format +msgctxt "copy text to the clipboard" +msgid "Copy" +msgstr "Kopyala" + +#: dashboard/qml/SteamLaunchOptions.qml:30 +#, kde-format +msgid "Copied Steam launch command" +msgstr "Steam başlatma komutu kopyalandı" + +#: dashboard/qml/TroubleshootPage.qml:20 +#, kde-format +msgid "I cannot find the WiVRn app on my headset" +msgstr "Gözlüğümde WiVRn uygulamasını bulamıyorum" + +#: dashboard/qml/TroubleshootPage.qml:21 dashboard/qml/WizardPage.qml:387 +#, kde-format +msgid "" +"If you installed WiVRn over USB on a Meta headset, the app is in the " +"\"unknown sources\" section." +msgstr "" +"Meta gözlüğüne USB üzerinden WiVRn'i kurduysanız, uygulama \"bilinmeyen " +"kaynaklar\" bölümündedir." + +#: dashboard/qml/TroubleshootPage.qml:24 +#, kde-format +msgid "I cannot see my computer in the WiVRn app" +msgstr "WiVRn uygulamasında bilgisayarımı göremiyorum" + +#: dashboard/qml/TroubleshootPage.qml:25 dashboard/qml/WizardPage.qml:392 +#, kde-format +msgid "" +"If the server is not visible or the connection fails, check that port 5353 " +"(UDP) and 9757 (TCP and UDP) are open in your firewall." +msgstr "" +"Sunucu görünür değilse veya bağlantı başarısız oluyorsa, güvenlik " +"duvarınızda 5353 (UDP) ve 9757 (TCP ve UDP) bağlantı noktalarının açık " +"olduğundan emin olun." + +#: dashboard/qml/TroubleshootPage.qml:28 +#, kde-format +msgid "I have an \"Incompatible WiVRn server\" error on my headset" +msgstr "Gözlüğümde \"Uyumsuz WiVRn sunucusu\" hatası alıyorum" + +#: dashboard/qml/TroubleshootPage.qml:29 +#, kde-format +msgid "" +"

The version of the headset app and the server on your computer must match." +"

  • The headset app version is in the \"About\" page
  • The " +"server version is %1
" +msgstr "" +"

Gözlük uygulamasının ve bilgisayarınızdaki sunucunun sürümü eşleşmelidir." +"

  • Gözlük uygulaması sürümü \"Hakkında\" sayfasındadır
  • Sunucu sürümü %1'dir
" + +#: dashboard/qml/TroubleshootPage.qml:32 +#, kde-format +msgid "I have a \"Pairing is disabled\" error" +msgstr "Eşleştirme devre dışı\" hatası alıyorum" + +#: dashboard/qml/TroubleshootPage.qml:33 +#, kde-format +msgid "" +"If you have reinstalled the server or the client or if you want to connect " +"another headset, you must enable pairing before connecting." +msgstr "" +"Sunucuyu veya istemciyi yeniden yüklediyseniz veya başka bir gözlük bağlamak " +"istiyorsanız, bağlanmadan önce eşleştirmeyi etkinleştirmeniz gerekir." + +#: dashboard/qml/TroubleshootPage.qml:33 +#, kde-format +msgid "Pairing is currently enabled with PIN %1." +msgstr "Eşleştirme şu anda PIN %1 ile etkin." + +#: dashboard/qml/TroubleshootPage.qml:33 +#, kde-format +msgid "Pairing is currently disabled." +msgstr "Eşleştirme şu anda devre dışı." + +#: dashboard/qml/TroubleshootPage.qml:49 +#, kde-format +msgid "I have no sound on my headset" +msgstr "Gözlüğümde ses yok" + +#: dashboard/qml/TroubleshootPage.qml:50 dashboard/qml/WizardPage.qml:440 +#, kde-format +msgid "" +"When the headset is connected, select \"WiVRn\" as the default audio output " +"device for applications to use it." +msgstr "" +"Gözlük bağlıyken, uygulamaların kullanması için varsayılan ses çıkış aygıtı " +"olarak \"WiVRn\" seçin." + +#: dashboard/qml/TroubleshootPage.qml:67 +#, kde-format +msgid "Report an issue" +msgstr "Bir sorun bildir" + +#: dashboard/qml/TroubleshootPage.qml:72 +#, kde-format +msgid "Ask on Discord" +msgstr "Discord'da sor" + +#: dashboard/qml/WizardPage.qml:14 +#, kde-format +msgid "Getting started" +msgstr "Başlangıç" + +#: dashboard/qml/WizardPage.qml:29 dashboard/qml/WizardPage.qml:78 +#: dashboard/qml/WizardPage.qml:253 dashboard/qml/WizardPage.qml:316 +#: dashboard/qml/WizardPage.qml:400 dashboard/qml/WizardPage.qml:447 +#: dashboard/qml/WizardPage.qml:484 +#, kde-format +msgid "Back" +msgstr "Geri" + +#: dashboard/qml/WizardPage.qml:64 +#, kde-format +msgid "Welcome to WiVRn" +msgstr "WiVRn'e hoş geldiniz" + +#: dashboard/qml/WizardPage.qml:69 +#, kde-format +msgid "" +"This wizard will help you set up WiVRn on your headset and connect it to " +"your computer." +msgstr "" +"Bu sihirbaz, WiVRn'i gözlüğünüze kurmanıza ve bilgisayarınıza bağlamanıza " +"yardımcı olacaktır." + +#: dashboard/qml/WizardPage.qml:83 dashboard/qml/WizardPage.qml:258 +#: dashboard/qml/WizardPage.qml:321 dashboard/qml/WizardPage.qml:452 +#: dashboard/qml/WizardPage.qml:489 +#, kde-format +msgid "Next" +msgstr "İleri" + +#: dashboard/qml/WizardPage.qml:112 +#, kde-format +msgid "How to enable developer mode" +msgstr "Geliştirici modu nasıl etkinleştirilir" + +#: dashboard/qml/WizardPage.qml:119 +#, kde-format +msgid "Follow the manufacturer's instructions below:" +msgstr "Aşağıdaki üreticinin talimatlarını izleyin:" + +#: dashboard/qml/WizardPage.qml:142 +#, kde-format +msgid "" +"In order to use WiVRn, you will have to install the client app on your " +"headset.\n" +"You can either install it from the Meta store or directly over USB." +msgstr "" +"WiVRn'i kullanmak için, istemci uygulamasını gözlüğünüze kurmanız gerekir.\n" +"Uygulamayı Meta mağazasından veya doğrudan USB üzerinden kurabilirsiniz." + +#: dashboard/qml/WizardPage.qml:148 +#, kde-format +msgid "Install from the Meta store" +msgstr "Meta mağazasından yükle" + +#: dashboard/qml/WizardPage.qml:152 +#, kde-format +msgid "" +"For the Quest 2, 3, 3S, and Pro, you can get the app from the Meta store." +msgstr "" +"Quest 2, 3, 3S ve Pro için uygulamayı Meta mağazasından edinebilirsiniz." + +#: dashboard/qml/WizardPage.qml:164 +#, kde-format +msgid "" +"A newer release is available: %1 → %2, the client app on the Meta store may " +"not be compatible." +msgstr "" +"Daha yeni bir sürüm mevcut: %1 → %2, Meta mağazasındaki istemci uygulaması " +"uyumlu olmayabilir." + +#: dashboard/qml/WizardPage.qml:171 +#, kde-format +msgid "" +"This is a nightly build, the client app on the Meta store may not be " +"compatible." +msgstr "" +"Bu, gece derlemesidir, Meta mağazasındaki istemci uygulaması uyumlu " +"olmayabilir." + +#: dashboard/qml/WizardPage.qml:181 +#, kde-format +msgctxt "displayed between 'meta store' and 'install over USB' in the wizard" +msgid "Or" +msgstr "Veya" + +#: dashboard/qml/WizardPage.qml:187 +#, kde-format +msgid "Install over USB" +msgstr "USB üzerinden yükle" + +#: dashboard/qml/WizardPage.qml:211 +#, kde-format +msgid "ADB is not installed" +msgstr "ADB yüklü değil" + +#: dashboard/qml/WizardPage.qml:219 +#, kde-format +msgid "" +"

No headset detected. Make sure that:\n" +"

" +msgstr "" +"

Gözlük algılanmadı. Şunlardan emin olun:\n" +"

" + +#: dashboard/qml/WizardPage.qml:280 +#, kde-format +msgid "Select the application you want to start" +msgstr "Başlatmak istediğiniz uygulamayı seçin" + +#: dashboard/qml/WizardPage.qml:286 +#, kde-format +msgid "" +"The application you choose will be started automatically when you connect " +"your headset." +msgstr "" +"Seçtiğiniz uygulama, gözlüğünüzü bağladığınızda otomatik olarak " +"başlayacaktır." + +#: dashboard/qml/WizardPage.qml:300 +#, kde-format +msgid "Important information" +msgstr "Önemli bilgi" + +#: dashboard/qml/WizardPage.qml:307 +#, kde-format +msgid "" +"WiVRn entirely replaces SteamVR, you should not start SteamVR while WiVRn is " +"running." +msgstr "" +"WiVRn, SteamVR'nin yerini tamamen alır, WiVRn çalışırken SteamVR'yi " +"başlatmamalısınız." + +#: dashboard/qml/WizardPage.qml:358 +#, kde-format +msgid "Start the WiVRn app on your headset" +msgstr "Gözlüğünüzde WiVRn uygulamasını başlatın" + +#: dashboard/qml/WizardPage.qml:363 +#, kde-format +msgid "" +"To connect over WiFi, start the WiVRn app on your headset, connect to \"%1\" " +"and enter PIN \"%2\"." +msgstr "" +"WiFi üzerinden bağlanmak için, gözlüğünüzde WiVRn uygulamasını başlatın, " +"\"%1\"e bağlanın ve \"%2\" PIN'ini girin." + +#: dashboard/qml/WizardPage.qml:370 +#, kde-format +msgid "To connect over USB, click on \"Connect by USB\"." +msgstr "USB üzerinden bağlanmak için \"USB ile bağlan\"a tıklayın." + +#: dashboard/qml/WizardPage.qml:383 +#, kde-format +msgid "Troubleshooting" +msgstr "Sorun giderme" + +#: dashboard/qml/WizardPage.qml:405 +#, kde-format +msgid "Skip" +msgstr "Atla" + +#: dashboard/qml/WizardPage.qml:425 +#, kde-format +msgid "Connection established" +msgstr "Bağlantı kuruldu" + +#: dashboard/qml/WizardPage.qml:430 +#, kde-format +msgid "Your headset is now connected." +msgstr "Gözlüğünüz şimdi bağlı." + +#: dashboard/qml/WizardPage.qml:435 dashboard/qml/WizardPage.qml:477 +#, kde-format +msgid "" +"To connect another headset, make sure pairing is enabled in the dashboard " +"before connecting." +msgstr "" +"Başka bir gözlük bağlamak için, bağlanmadan önce kontrol panelinde " +"eşleştirmenin etkinleştirildiğinden emin olun." + +#: dashboard/qml/WizardPage.qml:457 dashboard/qml/WizardPage.qml:494 +#, kde-format +msgid "Finish" +msgstr "Bitir" + +#: dashboard/qml/WizardPage.qml:472 +#, kde-format +msgid "Finished" +msgstr "Bitti" + +#: dashboard/wivrn_server.cpp:584 +#, kde-format +msgid "xrizer" +msgstr "xrizer" + +#: dashboard/wivrn_server.cpp:585 +#, kde-format +msgid "Open Composite" +msgstr "Open Composite" diff --git a/locale/tr/wivrn.po b/locale/tr/wivrn.po new file mode 100644 index 00000000..5f659de9 --- /dev/null +++ b/locale/tr/wivrn.po @@ -0,0 +1,612 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the WiVRn package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: WiVRn\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-04 16:49+0300\n" +"PO-Revision-Date: 2025-08-08 16:56+0300\n" +"Last-Translator: Hüseyin Fahri Uzun \n" +"Language-Team: \n" +"Language: tr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.6\n" + +#: client/scene.cpp:74 +msgid "No supported swapchain format" +msgstr "Desteklenen swapchain formatı yok" + +#: client/scenes/lobby.cpp:185 +msgid "Incompatible WiVRn server: no protocol field in TXT" +msgstr "Uyumsuz WiVRn sunucusu: TXT dosyasında protokol alanı yok" + +#: client/scenes/lobby.cpp:188 +#, c++-format +msgid "Incompatible WiVRn server protocol (client: {}, server: {})" +msgstr "Uyumsuz WiVRn sunucu protokolü (uçbirim: {}, sunucu: {})" + +#: client/scenes/lobby.cpp:203 +#, c++-format +msgid "Cannot resolve hostname: {}" +msgstr "Ana bilgisayar adı çözümlenemiyor: {}" + +#: client/scenes/lobby.cpp:290 client/scenes/lobby.cpp:296 +#, c++-format +msgid "Cannot connect to {} ({}): {}" +msgstr "Bağlanılamıyor {} ({}): {}" + +#: client/scenes/lobby.cpp:379 +msgid "Waiting for connection" +msgstr "Bağlantı için bekleniyor" + +#: client/scenes/lobby_gui.cpp:229 +msgctxt "openxr_post_processing" +msgid "Normal" +msgstr "Normal" + +#: client/scenes/lobby_gui.cpp:232 +msgctxt "openxr_post_processing" +msgid "Quality" +msgstr "Kalite" + +#: client/scenes/lobby_gui.cpp:234 +msgctxt "openxr_post_processing" +msgid "Disabled" +msgstr "Devre dışı" + +#: client/scenes/lobby_gui.cpp:242 client/scenes/lobby_gui.cpp:398 +#: client/scenes/stream_gui.cpp:812 +msgid "Disconnect" +msgstr "Bağlantıyı Kes" + +#: client/scenes/lobby_gui.cpp:262 client/scenes/stream_gui.cpp:808 +msgid "Close" +msgstr "Kapat" + +#: client/scenes/lobby_gui.cpp:268 +msgid "Connection" +msgstr "Bağlantı" + +#: client/scenes/lobby_gui.cpp:270 +#, c++-format +msgid "Connection to {}" +msgstr "{} Bağlan" + +#: client/scenes/lobby_gui.cpp:300 +msgid "PIN" +msgstr "PIN" + +#: client/scenes/lobby_gui.cpp:322 +msgid "Input the PIN displayed on the dashboard" +msgstr "Gösterilen PIN'i gösterge paneline giriniz" + +#: client/scenes/lobby_gui.cpp:393 +msgid "Connected to WiVRn server" +msgstr "WiVRn sunucusuna bağlanıldı" + +#: client/scenes/lobby_gui.cpp:395 +#, c++-format +msgid "Connected to {}" +msgstr "{} bağlanıldı" + +#: client/scenes/lobby_gui.cpp:405 +msgid "Start an application on the server to start streaming." +msgstr "Sunucuda bir uygulama başlatarak akışa başlayın." + +#: client/scenes/lobby_gui.cpp:414 +msgid "Start an application on your computer or select one to start streaming." +msgstr "" +"Bilgisayarınızda bir uygulama başlatın veya akış başlatmak için bir uygulama " +"seçin." + +#: client/scenes/lobby_gui.cpp:416 +#, c++-format +msgid "Start an application on {} or select one to start streaming." +msgstr "" +"{} üzerinde bir uygulama başlatın veya akış başlatmak için bir tane seçin." + +#: client/scenes/lobby_gui.cpp:522 +msgid "Name" +msgstr "Ad" + +#: client/scenes/lobby_gui.cpp:533 +msgid "Address" +msgstr "Adres" + +#: client/scenes/lobby_gui.cpp:542 +msgid "Port" +msgstr "Port" + +#: client/scenes/lobby_gui.cpp:550 +msgid "TCP only" +msgstr "Sadece TCP" + +#: client/scenes/lobby_gui.cpp:557 +msgid "Cancel" +msgstr "İptal" + +#: client/scenes/lobby_gui.cpp:571 +msgid "Save" +msgstr "Kaydet" + +#: client/scenes/lobby_gui.cpp:624 +msgid "" +"Start a WiVRn server on your\n" +"local network" +msgstr "" +"Yerel ağınızda\n" +"bir WiVRn sunucusu başlatın." + +#: client/scenes/lobby_gui.cpp:656 +msgid "Autoconnect" +msgstr "Oto Bağlan" + +#: client/scenes/lobby_gui.cpp:682 +msgid "Connect" +msgstr "Bağlan" + +#: client/scenes/lobby_gui.cpp:692 client/wivrn_client.cpp:186 +msgid "Incompatible server version" +msgstr "Uyumsuz sunucu versiyonu" + +#: client/scenes/lobby_gui.cpp:694 +msgid "Server not available" +msgstr "Sunucu mevcut değil" + +#: client/scenes/lobby_gui.cpp:780 +msgid "Refresh rate" +msgstr "Tazeleme oranı" + +#: client/scenes/lobby_gui.cpp:780 client/scenes/lobby_gui.cpp:782 +msgctxt "automatic refresh rate" +msgid "Automatic" +msgstr "Otomatik" + +#: client/scenes/lobby_gui.cpp:789 +msgid "" +"Select refresh rate based on measured application performance.\n" +"May cause flicker when a change happens." +msgstr "" +"Ölçülen uygulama performansına göre yenileme hızını seçin.\n" +"Değişiklik olduğunda titremeye neden olabilir." + +#: client/scenes/lobby_gui.cpp:806 +msgid "Minimum refresh rate" +msgstr "Minimum tazeleme oranı" + +#: client/scenes/lobby_gui.cpp:829 +msgid "Resolution scale" +msgstr "Çözünürlük ölçeği" + +#: client/scenes/lobby_gui.cpp:833 client/scenes/lobby_gui.cpp:1072 +#, c-format, c++-format +msgid "%d%% - {}x{} per eye" +msgstr "göz başına %d%% - {}x{}" + +#: client/scenes/lobby_gui.cpp:844 client/scenes/lobby_gui.cpp:1083 +#, c++-format +msgid "Resolution larger than {}x{} may not be supported by the headset" +msgstr "" +"{}x{} 'den daha büyük çözünürlükler gözlük tarafından desteklenmeyebilir." + +#: client/scenes/lobby_gui.cpp:850 +msgid "Enable microphone" +msgstr "Mikrofonu aktif et" + +#: client/scenes/lobby_gui.cpp:859 +msgid "Unprocessed Microphone Audio" +msgstr "İşlenmemiş Mikrofon Sesi" + +#: client/scenes/lobby_gui.cpp:865 +msgid "Force disable audio filters, such as noise cancellation" +msgstr "Gürültü engelleme gibi ses filtrelerini zorla devre dışı bırak" + +#: client/scenes/lobby_gui.cpp:872 +msgid "Enable hand tracking" +msgstr "El izlemeyi etkinleştir" + +#: client/scenes/lobby_gui.cpp:878 client/scenes/lobby_gui.cpp:890 +#: client/scenes/lobby_gui.cpp:902 client/scenes/lobby_gui.cpp:918 +#: client/scenes/lobby_gui.cpp:968 +msgid "This feature is not supported by your headset" +msgstr "Bu özellik gözlüğünüz tarafından desteklenmemektedir." + +#: client/scenes/lobby_gui.cpp:884 +msgid "Enable eye tracking" +msgstr "Göz takibi aktif et" + +#: client/scenes/lobby_gui.cpp:896 +msgid "Enable face tracking" +msgstr "Yüz takibi aktif et" + +#: client/scenes/lobby_gui.cpp:909 +msgid "Enable body tracking" +msgstr "Vücut takibi aktif et" + +#: client/scenes/lobby_gui.cpp:925 +msgid "" +"Requires 'Hand and body tracking' to be enabled in the Quest movement " +"tracking settings,\n" +"otherwise body data will be guessed from controller and headset positions" +msgstr "" +"Quest hareket izleme ayarlarında 'El ve vücut izleme' özelliğinin " +"etkinleştirilmesi gerekir,\n" +"aksi takdirde vücut verileri kontrol cihazı ve başlık konumlarından tahmin " +"edilecektir." + +#: client/scenes/lobby_gui.cpp:938 +msgid "Enable lower body tracking" +msgstr "Alt vücut izlemeyi etkinleştir" + +#: client/scenes/lobby_gui.cpp:944 +msgid "" +"Estimate lower body joint positions using Generative Legs\n" +"Requires 'Hand and body tracking' to be enabled in the Quest movement " +"tracking settings" +msgstr "" +"Generative Legs kullanarak alt vücut eklem pozisyonlarını tahmin edin\n" +"Quest hareket izleme ayarlarında 'El ve vücut izleme' özelliğinin " +"etkinleştirilmesi gerekir" + +#: client/scenes/lobby_gui.cpp:947 +msgid "Enable hip tracking" +msgstr "Kalça izlemeyi etkinleştir" + +#: client/scenes/lobby_gui.cpp:953 +msgid "" +"Only takes affect with lower body tracking enabled\n" +"May be desired when using another source of hip tracking" +msgstr "" +"Sadece alt vücut izleme etkinleştirildiğinde geçerlidir\n" +"Başka bir kalça izleme kaynağı kullanıldığında tercih edilebilir" + +#: client/scenes/lobby_gui.cpp:961 +msgid "Enable video passthrough in lobby" +msgstr "Lobide video geçişini etkinleştir" + +#: client/scenes/lobby_gui.cpp:982 client/scenes/stream_gui.cpp:434 +msgid "OpenXR post-processing" +msgstr "OpenXR işlem sonrası" + +#: client/scenes/lobby_gui.cpp:986 client/scenes/stream_gui.cpp:438 +msgid "Supersampling" +msgstr "Süper örnekleme" + +#: client/scenes/lobby_gui.cpp:1006 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" +msgstr "" +"Yüksek kontrastlı kenarlarda titremeyi azaltın.\n" +"Giriş çözünürlüğü kulaklık ekranına kıyasla yüksek olduğunda kullanışlıdır." + +#: client/scenes/lobby_gui.cpp:1011 client/scenes/stream_gui.cpp:464 +msgid "Sharpening" +msgstr "Keskinleştirme" + +#: client/scenes/lobby_gui.cpp:1031 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" +msgstr "" +"Yüksek kontrastlı kenarların netliğini artırın ve bulanıklığı giderin.\n" +"Giriş çözünürlüğü kulaklık ekranına kıyasla düşük olduğunda kullanışlıdır." + +#: client/scenes/lobby_gui.cpp:1040 +msgid "Enable Snapdragon Game Super Resolution" +msgstr "Snapdragon Oyun Süper Çözünürlüğü'nü etkinleştirin" + +#: client/scenes/lobby_gui.cpp:1048 +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 "" +"Bu kulaklıkta, bu ayar yukarıdaki yerel Keskinleştirme ayarı ile tamamen " +"değiştirilmiştir.\n" +"Ne yaptığınızı biliyorsanız etkinleştirin." + +#: client/scenes/lobby_gui.cpp:1050 +msgid "" +"Client-side upscaling and sharpening, adds a performance cost on the headset" +msgstr "" +"İstemci tarafında yükseltme ve keskinleştirme, kulaklıkta performans " +"düşüşüne neden olur." + +#: client/scenes/lobby_gui.cpp:1068 +msgid "Upscaling factor" +msgstr "Yükseltme faktörü" + +#: client/scenes/lobby_gui.cpp:1087 +msgid "Use edge direction" +msgstr "Kenar yönünü kullan" + +#: client/scenes/lobby_gui.cpp:1093 +msgid "Adds an additional performance cost" +msgstr "Ek bir performans düşüşü ekler" + +#: client/scenes/lobby_gui.cpp:1098 +msgid "Edge threshold" +msgstr "Kenar eşiği" + +#: client/scenes/lobby_gui.cpp:1105 client/scenes/lobby_gui.cpp:1114 +#, c++-format +msgid "Recommended: {:.1f}" +msgstr "Önerilen: {:.1f}" + +#: client/scenes/lobby_gui.cpp:1108 +msgid "Edge sharpness" +msgstr "Kenar keskinliği" + +#: client/scenes/lobby_gui.cpp:1210 client/scenes/lobby_gui.cpp:1218 +#: client/scenes/stream_gui.cpp:222 client/scenes/stream_gui.cpp:418 +msgid "CPU time" +msgstr "CPU zamanı" + +#: client/scenes/lobby_gui.cpp:1214 +msgid "CPU time [ms]" +msgstr "CPU zamanı [ms]" + +#: client/scenes/lobby_gui.cpp:1224 client/scenes/lobby_gui.cpp:1232 +#: client/scenes/stream_gui.cpp:224 client/scenes/stream_gui.cpp:419 +msgid "GPU time" +msgstr "GPU zamanı" + +#: client/scenes/lobby_gui.cpp:1228 +msgid "GPU time [ms]" +msgstr "GPU zamanı [ms]" + +#: client/scenes/lobby_gui.cpp:1271 +msgid "Enable the microphone?" +msgstr "Mikrofonu aktif et?" + +#: client/scenes/lobby_gui.cpp:1276 +msgid "Enable eye tracking?" +msgstr "Göz takibi aktif et?" + +#: client/scenes/lobby_gui.cpp:1281 +msgid "Enable face tracking?" +msgstr "Yüz takibi aktif et?" + +#: client/scenes/lobby_gui.cpp:1286 +msgid "Enable body tracking?" +msgstr "Vücut takibi aktif et?" + +#: client/scenes/lobby_gui.cpp:1294 +msgid "Welcome to WiVRn" +msgstr "WiVRn'e hoş geldiniz" + +#: client/scenes/lobby_gui.cpp:1318 +msgid "Yes" +msgstr "Evet" + +#: client/scenes/lobby_gui.cpp:1325 +msgid "No" +msgstr "Hayır" + +#: client/scenes/lobby_gui.cpp:1344 client/scenes/lobby_gui.cpp:1983 +msgid "Licenses" +msgstr "Lisanslar" + +#: client/scenes/lobby_gui.cpp:1658 +msgid "Microphone is enabled" +msgstr "Mikrofon aktif" + +#: client/scenes/lobby_gui.cpp:1659 +msgid "Microphone is disabled" +msgstr "Mikrofon devre dışı" + +#: client/scenes/lobby_gui.cpp:1668 +msgid "Hand tracking is enabled" +msgstr "El takibi aktif" + +#: client/scenes/lobby_gui.cpp:1669 +msgid "Hand tracking is disabled" +msgstr "El takibi devre dışı" + +#: client/scenes/lobby_gui.cpp:1678 +msgid "Eye tracking is enabled" +msgstr "Göz takibi aktif" + +#: client/scenes/lobby_gui.cpp:1679 +msgid "Eye tracking is disabled" +msgstr "Göz takibi devre dışı" + +#: client/scenes/lobby_gui.cpp:1692 +msgid "Face tracking is enabled" +msgstr "Yüz takibi aktif" + +#: client/scenes/lobby_gui.cpp:1693 +msgid "Face tracking is disabled" +msgstr "Yüz takibi devre dışı" + +#: client/scenes/lobby_gui.cpp:1703 +msgid "Body tracking is enabled" +msgstr "Vücut takibi aktif" + +#: client/scenes/lobby_gui.cpp:1704 +msgid "Body tracking is disabled" +msgstr "Vücut takibi devre dışı" + +#: client/scenes/lobby_gui.cpp:1720 +msgid "Add server" +msgstr "Sunucu ekle" + +#: client/scenes/lobby_gui.cpp:1965 +msgid "Server list" +msgstr "Sunucu listesi" + +#: client/scenes/lobby_gui.cpp:1968 client/scenes/stream_gui.cpp:796 +msgid "Settings" +msgstr "Ayarlar" + +#: client/scenes/lobby_gui.cpp:1971 +msgid "Post-processing" +msgstr "İşlem sonrası" + +#: client/scenes/lobby_gui.cpp:1975 +msgid "Debug" +msgstr "Hata ayıklama" + +#: client/scenes/lobby_gui.cpp:1980 +msgid "About" +msgstr "Hakkında" + +#: client/scenes/lobby_gui.cpp:1986 +msgid "Exit" +msgstr "Çıkış" + +#: client/scenes/lobby_gui.cpp:2003 +msgid "" +"Press the grip button or put your palm up\n" +"to move the main window" +msgstr "" +"Ana pencereyi hareket ettirmek için tutma düğmesine basın\n" +"veya avucunuzu yukarı kaldırın" + +#: client/scenes/lobby_gui.cpp:2005 +msgid "Press the grip button to move the main window" +msgstr "Ana pencereyi hareket ettirmek için tutma düğmesine basın" + +#: client/scenes/stream_gui.cpp:224 +msgid "Reproject" +msgstr "Yeniden yansıt" + +#: client/scenes/stream_gui.cpp:225 +msgid "Blit" +msgstr "Blit" + +#: client/scenes/stream_gui.cpp:227 +msgid "Network" +msgstr "Ağ" + +#: client/scenes/stream_gui.cpp:227 client/scenes/stream_gui.cpp:416 +msgid "Download" +msgstr "İndir" + +#: client/scenes/stream_gui.cpp:228 client/scenes/stream_gui.cpp:417 +msgid "Upload" +msgstr "Gönder" + +#: client/scenes/stream_gui.cpp:297 +#, c++-format +msgid "Decoder {}" +msgstr "Decoder {}" + +#: client/scenes/stream_gui.cpp:309 +msgid "Timings [ms]" +msgstr "Zaman [ms]" + +#: client/scenes/stream_gui.cpp:369 +msgid "Encode" +msgstr "Encode" + +#: client/scenes/stream_gui.cpp:370 +msgid "Send" +msgstr "Gönder" + +#: client/scenes/stream_gui.cpp:371 +msgid "Receive" +msgstr "Al" + +#: client/scenes/stream_gui.cpp:372 +msgid "Decode" +msgstr "Decode" + +#: client/scenes/stream_gui.cpp:373 +msgid "Blitted" +msgstr "Blitted" + +#: client/scenes/stream_gui.cpp:374 +msgid "Displayed" +msgstr "Görüntülenen" + +#: client/scenes/stream_gui.cpp:375 +msgid "Predicted" +msgstr "Tahmin edilen" + +#: client/scenes/stream_gui.cpp:393 +#, c++-format +msgid "Estimated motion to photons latency: {}ms" +msgstr "Fotonlara tahmini hareket gecikmesi: {}ms" + +#: client/scenes/stream_gui.cpp:396 +msgid "Press the grip button to move the window" +msgstr "Pencereyi hareket ettirmek için tutma düğmesine basın" + +#: client/scenes/stream_gui.cpp:398 client/scenes/stream_gui.cpp:750 +msgid "Press both thumbsticks to display the WiVRn window" +msgstr "" +"WiVRn penceresini görüntülemek için her iki başparmak çubuklarınıda basın" + +#: client/scenes/stream_gui.cpp:420 +msgid "Motion to photon latency" +msgstr "Hareketin fotona ulaşma gecikmesi" + +#: client/scenes/stream_gui.cpp:492 +msgid "Foveation center override" +msgstr "Foveasyon merkezi geçersiz kılma" + +#: client/scenes/stream_gui.cpp:495 +msgid "Enable" +msgstr "Aktif et" + +#: client/scenes/stream_gui.cpp:503 client/scenes/stream_gui.cpp:550 +#, c++-format +msgid "Height {:.1f} deg" +msgstr "Boy {:.1f} deg" + +#: client/scenes/stream_gui.cpp:504 client/scenes/stream_gui.cpp:551 +#, c++-format +msgid "Distance {:.2f} m" +msgstr "Uzaklık {:.2f} m" + +#: client/scenes/stream_gui.cpp:505 +msgid "Default" +msgstr "Varsayılan" + +#: client/scenes/stream_gui.cpp:516 +msgid "Change" +msgstr "Değiştir" + +#: client/scenes/stream_gui.cpp:548 +msgid "Use the thumbsticks to move the foveation center" +msgstr "Başparmak çubuklarını kullanarak odak merkezini hareket ettirin" + +#: client/scenes/stream_gui.cpp:549 +msgid "Press A to save or B to cancel" +msgstr "Kaydetmek için A tuşuna, iptal etmek için B tuşuna basın" + +#: client/scenes/stream_gui.cpp:793 +msgid "Stats" +msgstr "İstatistikler" + +#: client/scenes/stream_gui.cpp:802 +msgid "Statistics overlay" +msgstr "İstatistik katmanı" + +#: client/scenes/stream_gui.cpp:805 +msgid "Compact view" +msgstr "Kompakt görünüm" + +#: client/wivrn_client.cpp:98 client/wivrn_client.cpp:202 +msgid "Timeout" +msgstr "Zaman aşımı" + +#: client/wivrn_client.cpp:149 +msgid "Incorrect PIN" +msgstr "Geçersiz PIN" + +#: client/wivrn_client.cpp:153 +msgid "Unable to check PIN" +msgstr "PIN kontrol edilemiyor" + +#: client/wivrn_client.cpp:182 +msgid "Pairing is disabled on server" +msgstr "Bu sunucuda eşleşme devre dışı" From 00e979065bf0e4f390e4f205e12b4743127dfc37 Mon Sep 17 00:00:00 2001 From: epsypolym <30553210+epsypolym@users.noreply.github.com> Date: Fri, 8 Aug 2025 23:03:55 +0200 Subject: [PATCH 18/85] Update slovak translation (#436) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update slovak translation - Replaced multiple instances of informal form with formal form, also by extension replaced some cases of gendered form with gender neutral version. - Fixed a few typos * additional adjustments to sk locale - re-added a space i accidentally removed (oops) - fixed other miscellaneous typos found during 2nd review - removed instance of word "fičura" - informal slang translation of word "feature" - replaced with "funkcia" - ie: function as direct translation of "feature" doesn't exist --- locale/sk/wivrn-dashboard.po | 207 ++++++++++++++++--------------- locale/sk/wivrn.po | 233 ++++++++++++++++++----------------- 2 files changed, 225 insertions(+), 215 deletions(-) diff --git a/locale/sk/wivrn-dashboard.po b/locale/sk/wivrn-dashboard.po index 52da766d..42b41b87 100644 --- a/locale/sk/wivrn-dashboard.po +++ b/locale/sk/wivrn-dashboard.po @@ -2,13 +2,14 @@ # This file is distributed under the same license as the WiVRn-dashboard package. # # SPDX-FileCopyrightText: 2025 not +# SPDX-FileCopyrightText: 2025 eps msgid "" msgstr "" "Project-Id-Version: WiVRn-dashboard\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-25 22:10+0200\n" -"PO-Revision-Date: 2025-08-02 18:48+0200\n" -"Last-Translator: not \n" +"POT-Creation-Date: 2025-08-08 20:41+0200\n" +"PO-Revision-Date: 2025-08-08 22:35+0200\n" +"Last-Translator: eps \n" "Language-Team: Slovak <>\n" "Language: sk\n" "MIME-Version: 1.0\n" @@ -50,7 +51,7 @@ msgstr "Nepodarilo sa spustiť adb: %1" #: dashboard/apk_installer.cpp:231 #, kde-format msgid "adb exited abnormally: %1" -msgstr "adb sa neočakávane ukončil: %1" +msgstr "adb sa neočakávane ukončilo: %1" #: dashboard/apk_installer.cpp:239 #, kde-format @@ -83,8 +84,8 @@ msgstr "Kontroluje sa najnovšia verzia…" msgid "No precompiled APK is available for this version." msgstr "Pre túto verziu nie je dostupné predkompilované APK." -#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:247 -#: dashboard/qml/Main.qml:329 +#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:259 +#: dashboard/qml/Main.qml:341 #, kde-format msgid "ADB is not installed." msgstr "ADB nie je nainštalované." @@ -92,7 +93,7 @@ msgstr "ADB nie je nainštalované." #: dashboard/qml/ApkInstallPage.qml:47 #, kde-format msgid "Connect a headset and make sure developer mode is enabled." -msgstr "Pripoj headset a uisti sa, že je zapnutý vývojársky režim." +msgstr "Pripojte headset a uistite sa, že je zapnutý vývojársky režim." #: dashboard/qml/ApkInstallPage.qml:51 dashboard/qml/WizardPage.qml:204 #, kde-format @@ -102,12 +103,11 @@ msgid "" "client." msgstr "" "Postupuj podľa pokynov v dokumentácii na vytvorenie vlastn" -"ého " -"klienta." +"master/docs/building.md#client-headset\">dokumentácii na vytvorenie " +"vlastného klienta." -#: dashboard/qml/ApkInstallPage.qml:65 dashboard/qml/HeadsetsPage.qml:183 -#: dashboard/qml/HeadsetStatsPage.qml:36 dashboard/qml/TroubleshootPage.qml:59 +#: dashboard/qml/ApkInstallPage.qml:65 dashboard/qml/HeadsetStatsPage.qml:36 +#: dashboard/qml/HeadsetsPage.qml:183 dashboard/qml/TroubleshootPage.qml:59 #, kde-format msgctxt "go back to the home page" msgid "Back" @@ -116,7 +116,7 @@ msgstr "Späť" #: dashboard/qml/ConnectUsbDialog.qml:11 #, kde-format msgid "Select your headset" -msgstr "Vyber svoj headset" +msgstr "Vyberte svoj headset" #: dashboard/qml/DeviceCard.qml:46 #, kde-format @@ -133,7 +133,12 @@ msgstr "Preinštalovať WiVRn" msgid "Install WiVRn" msgstr "Nainštalovať WiVRn" -#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:342 +#: dashboard/qml/HeadsetStatsPage.qml:12 +#, kde-format +msgid "Headset statistics" +msgstr "Štatistiky headsetu" + +#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:354 #, kde-format msgid "Headsets" msgstr "Headsety" @@ -210,12 +215,12 @@ msgstr "Vypnúť párovanie" #: dashboard/qml/HeadsetsPage.qml:166 #, kde-format msgid "Start the WiVRn app on your headset and use the PIN: %1" -msgstr "Spusť aplikáciu WiVRn v headsete a zadaj PIN: %1" +msgstr "Spustite aplikáciu WiVRn v headsete a zadajte PIN: %1" #: dashboard/qml/HeadsetsPage.qml:166 #, kde-format msgid "Enable pairing to allow your headset to connect to this computer" -msgstr "Zapni párovanie, aby sa mohol headset pripojiť k tomuto počítaču" +msgstr "Zapnite párovanie, aby sa mohol headset pripojiť k tomuto počítaču" #: dashboard/qml/HeadsetsPage.qml:171 dashboard/qml/TroubleshootPage.qml:37 #, kde-format @@ -227,122 +232,128 @@ msgstr "Zapnúť párovanie" msgid "Pair a new headset" msgstr "Spárovať nový headset" -#: dashboard/qml/HeadsetStatsPage.qml:12 -#, kde-format -msgid "Headset statistics" -msgstr "Štatistiky headsetu" - -#: dashboard/qml/Main.qml:103 +#: dashboard/qml/Main.qml:107 #, kde-format msgid "The server does not have CAP_SYS_NICE capabilities." msgstr "Server nemá oprávnenia CAP_SYS_NICE." -#: dashboard/qml/Main.qml:110 +#: dashboard/qml/Main.qml:114 #, kde-format msgid "Fix it" msgstr "Opraviť" -#: dashboard/qml/Main.qml:119 +#: dashboard/qml/Main.qml:123 #, kde-format msgid "The CAP_SYS_NICE capability will be used when the server is restarted." msgstr "CAP_SYS_NICE bude použité po reštarte servera." -#: dashboard/qml/Main.qml:125 +#: dashboard/qml/Main.qml:129 #, kde-format msgctxt "restart the server" msgid "Restart now" msgstr "Reštartovať teraz" -#: dashboard/qml/Main.qml:136 +#: dashboard/qml/Main.qml:140 #, kde-format msgid "" "NVIDIA GPUs require at least driver version 565.77, current version is %1" msgstr "" -"GPU od NVIDIA vyžadujú minimálne verziu ovládača 565.77, aktuálna verzia je %1" +"GPU od NVIDIA vyžadujú minimálne verziu ovládača 565.77, aktuálna verzia je " +"%1" -#: dashboard/qml/Main.qml:142 +#: dashboard/qml/Main.qml:146 #, kde-format msgid "More info" msgstr "Viac info" -#: dashboard/qml/Main.qml:150 +#: dashboard/qml/Main.qml:154 #, kde-format msgid "" "Use the Mesa (radv) driver for AMD GPUs\n" "Hardware encoding with vaapi does not work with AMDVLK and AMDGPU-PRO" msgstr "" -"Pre GPU od AMD používaj ovládač Mesa (radv)\n" +"Pre GPU od AMD používajte ovládač Mesa (radv)\n" "Hardvérové kódovanie cez vaapi nefunguje s AMDVLK ani AMDGPU-PRO" -#: dashboard/qml/Main.qml:159 +#: dashboard/qml/Main.qml:162 +#, kde-format +msgid "" +"No OpenVR compatibility detected, Steam games won't be able to load VR.\n" +"Install xrizer or OpenComposite." +msgstr "" +"Žiadna OpenVR kompatibilita nebola nájdená, Hry na steame nebude možné " +"načítať do VRka.\n" +"Nainštalujte xrizer alebo OpenComposite." + +#: dashboard/qml/Main.qml:171 #, kde-format msgid "Server failed to start" msgstr "Nepodarilo sa spustiť server" -#: dashboard/qml/Main.qml:165 dashboard/qml/TroubleshootPage.qml:77 +#: dashboard/qml/Main.qml:177 dashboard/qml/TroubleshootPage.qml:77 #, kde-format msgid "Open server logs" msgstr "Zobraziť logy servera" -#: dashboard/qml/Main.qml:202 +#: dashboard/qml/Main.qml:214 #, kde-format msgctxt "whether the server is running, displayed in front of a checkbox" msgid "Running" msgstr "Beží" -#: dashboard/qml/Main.qml:217 +#: dashboard/qml/Main.qml:229 #, kde-format msgctxt "whether pairing is enabled, displayed in front of a checkbox" msgid "Pairing" msgstr "Párovanie" -#: dashboard/qml/Main.qml:230 +#: dashboard/qml/Main.qml:242 #, kde-format msgid "PIN: %1" msgstr "PIN: %1" -#: dashboard/qml/Main.qml:238 dashboard/qml/WizardPage.qml:373 +#: dashboard/qml/Main.qml:250 dashboard/qml/WizardPage.qml:373 #, kde-format msgid "Connect by USB" msgstr "Pripojiť cez USB" -#: dashboard/qml/Main.qml:249 +#: dashboard/qml/Main.qml:261 #, kde-format msgid "No headset is connected or your headset is not in developer mode." msgstr "Žiadny headset nie je pripojený alebo nemá zapnutý vývojársky režim." -#: dashboard/qml/Main.qml:257 +#: dashboard/qml/Main.qml:269 #, kde-format msgid "Disconnect" msgstr "Odpojiť" -#: dashboard/qml/Main.qml:274 +#: dashboard/qml/Main.qml:286 #, kde-format msgctxt "automatically started application" msgid "Application" msgstr "Aplikácia" -#: dashboard/qml/Main.qml:295 +#: dashboard/qml/Main.qml:307 #, kde-format msgid "Steam information" msgstr "Informácie o Steame" -#: dashboard/qml/Main.qml:313 +#: dashboard/qml/Main.qml:325 #, kde-format msgid "Wizard" msgstr "Sprievodca" -#: dashboard/qml/Main.qml:320 +#: dashboard/qml/Main.qml:332 #, kde-format msgid "Install the app" msgstr "Nainštalovať aplikáciu" -#: dashboard/qml/Main.qml:349 dashboard/qml/SettingsPage.qml:14 +#: dashboard/qml/Main.qml:361 dashboard/qml/SettingsPage.qml:14 #, kde-format msgid "Settings" msgstr "Nastavenia" -#: dashboard/qml/Main.qml:356 dashboard/qml/TroubleshootPage.qml:10 +#: dashboard/qml/Main.qml:368 dashboard/qml/TroubleshootPage.qml:10 #, kde-format msgid "Troubleshoot" msgstr "Riešiť problémy" @@ -393,13 +404,13 @@ msgid "" "The recommended values are between 20% and 50% for headsets without eye " "tracking and between 50% and 70% for headsets with eye tracking." msgstr "" -"Silnejšia foveácia zvyšuje ostrosť v strede obrazu a znižuje ju na okrajoch, č" -"ím zrýchľuje dekódovanie. Je vhodnejšia pre rýchle hry.\n" +"Silnejšia foveácia zvyšuje ostrosť v strede obrazu a znižuje ju na okrajoch, " +"čím zrýchľuje dekódovanie. Je vhodnejšia pre rýchle hry.\n" "\n" "Slabšia foveácia zachováva rovnomernú ostrosť v celom obraze.\n" "\n" -"Odporúčané hodnoty sú medzi 20 % a 50 % pre headsety bez sledovania očí a medz" -"i 50 % a 70 % pre headsety so sledovaním očí." +"Odporúčané hodnoty sú medzi 20 % a 50 % pre headsety bez sledovania očí a " +"medzi 50 % a 70 % pre headsety so sledovaním očí." #: dashboard/qml/SettingsPage.qml:74 #, kde-format @@ -465,8 +476,9 @@ msgid "" "To add a new encoder, split an existing encoder by clicking near an edge.\n" "Drag an edge to resize or remove encoders." msgstr "" -"Ak chceš pridať nový enkodér, rozdeľ existujúci kliknutím pri jeho okraji.\n" -"Potiahnutím okraja môžeš meniť veľkosť alebo enkodér odstrániť." +"Ak chcete pridať nový enkodér, rozdeľte existujúci kliknutím pri jeho " +"okraji.\n" +"Potiahnutím okraja môžete meniť veľkosť alebo enkodér odstrániť." #: dashboard/qml/SettingsPage.qml:220 #, kde-format @@ -606,14 +618,14 @@ msgid "" "For Steam games, right click on the game in Steam, go in Properties > " "General and paste this in \"Launch options\":" msgstr "" -"Pre Steam hry klikni pravým tlačidlom na hru v Steame, otvor Vlastnosti > " -"Všeo becné a vlož toto do \"Spúšťacích parametrov“:" +"Pre Steam hry kliknite pravým tlačidlom na hru v Steame, otvorte Vlastnosti > " +"Všeobecné a vložte toto do \"Spúšťacích parametrov“:" #: dashboard/qml/SteamLaunchOptions.qml:20 #, kde-format msgid "Paste this in the Steam launch options for the app you want to start" msgstr "" -"Vlož toto do spúšťacích možností Steamu pre aplikáciu, ktorú chceš spustiť" +"Vložte toto do spúšťacích možností Steamu pre aplikáciu, ktorú chcete spustiť" #: dashboard/qml/SteamLaunchOptions.qml:26 #, kde-format @@ -637,8 +649,8 @@ msgid "" "If you installed WiVRn over USB on a Meta headset, the app is in the " "\"unknown sources\" section." msgstr "" -"Ak si nainštaloval WiVRn cez USB na Meta headset, aplikácia sa nachádza v sekc" -"ii „neznáme zdroje“." +"Ak ste nainštalovali WiVRn cez USB na Meta headset, aplikácia sa nachádza v " +"sekcii „neznáme zdroje“." #: dashboard/qml/TroubleshootPage.qml:24 #, kde-format @@ -651,8 +663,9 @@ msgid "" "If the server is not visible or the connection fails, check that port 5353 " "(UDP) and 9757 (TCP and UDP) are open in your firewall." msgstr "" -"Ak server nie je viditeľný alebo sa nepodarilo pripojenie, skontroluj, či sú v" -" tvojom firewalle otvorené porty 5353 (UDP) a 9757 (TCP aj UDP)." +"Ak server nie je viditeľný alebo sa nepodarilo pripojenie, skontrolujte, či sú" +" " +"vo vašom firewalle otvorené porty 5353 (UDP) a 9757 (TCP aj UDP)." #: dashboard/qml/TroubleshootPage.qml:28 #, kde-format @@ -666,10 +679,9 @@ msgid "" "

  • The headset app version is in the \"About\" page
  • The " "server version is %1
" msgstr "" -"

Verzia aplikácie v headsete a verzia servera na tvojom počítači sa musia zh" -"odovať." -"

  • Verziu aplikácie nájdeš v časti „O aplikácii“
  • Verzia " -"servera je %1
" +"

Verzia aplikácie v headsete a verzia servera na vašom počítači sa musia " +"zhodovať.

  • Verziu aplikácie nájdete v časti „O aplikácii“
  • Verzia servera je %1
" #: dashboard/qml/TroubleshootPage.qml:32 #, kde-format @@ -682,8 +694,8 @@ msgid "" "If you have reinstalled the server or the client or if you want to connect " "another headset, you must enable pairing before connecting." msgstr "" -"Ak si preinštaloval server alebo klienta, alebo ak chceš pripojiť iný headset," -" musíš pred pripojením povoliť párovanie." +"Ak ste preinštalovali server alebo klienta, alebo ak chcete pripojiť iný " +"headset, musíte pred pripojením povoliť párovanie." #: dashboard/qml/TroubleshootPage.qml:33 #, kde-format @@ -706,8 +718,9 @@ msgid "" "When the headset is connected, select \"WiVRn\" as the default audio output " "device for applications to use it." msgstr "" -"Keď je headset pripojený, vyber WiVRn ako predvolené zvukové zariadenie, aby h" -"o aplikácie používali." +"Keď je headset pripojený, vyberte WiVRn ako predvolené zvukové zariadenie, aby" +" " +"ho aplikácie používali." #: dashboard/qml/TroubleshootPage.qml:67 #, kde-format @@ -743,8 +756,8 @@ msgid "" "This wizard will help you set up WiVRn on your headset and connect it to " "your computer." msgstr "" -"Tento sprievodca ti pomôže nastaviť WiVRn na tvojom headsete a pripojiť ho k p" -"očítaču." +"Tento sprievodca vám pomôže nastaviť WiVRn na vašom headsete a pripojiť ho k " +"počítaču." #: dashboard/qml/WizardPage.qml:83 dashboard/qml/WizardPage.qml:258 #: dashboard/qml/WizardPage.qml:321 dashboard/qml/WizardPage.qml:452 @@ -756,12 +769,12 @@ msgstr "Ďalej" #: dashboard/qml/WizardPage.qml:112 #, kde-format msgid "How to enable developer mode" -msgstr "Ako zapnúť vývojársky reži" +msgstr "Ako zapnúť vývojársky režim" #: dashboard/qml/WizardPage.qml:119 #, kde-format msgid "Follow the manufacturer's instructions below:" -msgstr "Postupuj podľa inštrukcií od výrobcu:" +msgstr "Postupujte podľa inštrukcií od výrobcu:" #: dashboard/qml/WizardPage.qml:142 #, kde-format @@ -770,9 +783,9 @@ msgid "" "headset.\n" "You can either install it from the Meta store or directly over USB." msgstr "" -"Na používanie WiVRn je potrebné nainštalovať klientsku aplikáciu do headsetu." -"\n" -"Môžeš ju nainštalovať buď z Meta obchodu alebo priamo cez USB." +"Na používanie WiVRn je potrebné nainštalovať klientsku aplikáciu do " +"headsetu.\n" +"Môžete ju nainštalovať buď z Meta obchodu alebo priamo cez USB." #: dashboard/qml/WizardPage.qml:148 #, kde-format @@ -785,8 +798,8 @@ msgid "" "For the Quest 2, 3, 3S, and Pro, you can get the app from the Meta store." msgstr "" -"Pre Quest 2, 3, 3S a Pro si môžeš aplikáciu stiahnuť z Meta obchodu." +"Pre Quest 2, 3, 3S a Pro si môžete aplikáciu stiahnuť z obchodu Meta." #: dashboard/qml/WizardPage.qml:164 #, kde-format @@ -794,8 +807,8 @@ msgid "" "A newer release is available: %1 → %2, the client app on the Meta store may " "not be compatible." msgstr "" -"K dispozícii je novšia verzia: %1 → %2, Aplikácia z obchodu Meta nemusí byť ko" -"mpatibilná." +"K dispozícii je novšia verzia: %1 → %2, Aplikácia z obchodu Meta nemusí byť " +"kompatibilná." #: dashboard/qml/WizardPage.qml:171 #, kde-format @@ -803,8 +816,8 @@ msgid "" "This is a nightly build, the client app on the Meta store may not be " "compatible." msgstr "" -"Toto je nightly verzia, aplikácia z Meta obchodu s ňou nemusí byť kompatibilná" -"." +"Toto je nightly verzia, aplikácia z Meta obchodu s ňou nemusí byť " +"kompatibilná." #: dashboard/qml/WizardPage.qml:181 #, kde-format @@ -829,14 +842,14 @@ msgid "" "

" msgstr "" -"

Headset nebol rozpoznaný. Uisti sa, že:\n" -"

  • Máš nainštalované ADB udev rules
  • Headset je v Headset nebol rozpoznaný. Uistite sa, že:\n" +"

    " #: dashboard/qml/WizardPage.qml:280 #, kde-format msgid "Select the application you want to start" -msgstr "Vyber aplikáciu, ktorú chceš spustiť" +msgstr "Vyberte aplikáciu, ktorú chcete spustiť" #: dashboard/qml/WizardPage.qml:286 #, kde-format @@ -856,13 +869,13 @@ msgid "" "WiVRn entirely replaces SteamVR, you should not start SteamVR while WiVRn is " "running." msgstr "" -"WiVRn úplne nahrádza SteamVR, preto by si SteamVR nemal spúšťať, keď beží WiVR" -"n" +"WiVRn úplne nahrádza SteamVR, preto by ste SteamVR nemali spúšťať, keď beží " +"WiVRn" #: dashboard/qml/WizardPage.qml:358 #, kde-format msgid "Start the WiVRn app on your headset" -msgstr "Spusť aplikáciu WiVRn v headsete" +msgstr "Spustite aplikáciu WiVRn v headsete" #: dashboard/qml/WizardPage.qml:363 #, kde-format @@ -870,14 +883,14 @@ msgid "" "To connect over WiFi, start the WiVRn app on your headset, connect to \"%1\" " "and enter PIN \"%2\"." msgstr "" -"Na pripojenie cez Wi-Fi spusti aplikáciu WiVRn v headsete, pripoj sa k \"%1“ a" -" " -"zadaj PIN \"%2“." +"Na pripojenie cez Wi-Fi spustite aplikáciu WiVRn v headsete, pripojte sa k \"%" +"1“ " +"a zadajte PIN \"%2“." #: dashboard/qml/WizardPage.qml:370 #, kde-format msgid "To connect over USB, click on \"Connect by USB\"." -msgstr "Pre pripojenie cez USB klikni na \"Pripojiť cez USB“." +msgstr "Pre pripojenie cez USB kliknite na \"Pripojiť cez USB“." #: dashboard/qml/WizardPage.qml:383 #, kde-format @@ -905,8 +918,9 @@ msgid "" "To connect another headset, make sure pairing is enabled in the dashboard " "before connecting." msgstr "" -"Ak chceš pripojiť ďalší headset, uisti sa, že je v ovládacom paneli povolené p" -"árovanie." +"Ak chcete pripojiť ďalší headset, uistite sa, že je v ovládacom paneli povolen" +"é " +"párovanie." #: dashboard/qml/WizardPage.qml:457 dashboard/qml/WizardPage.qml:494 #, kde-format @@ -918,21 +932,12 @@ msgstr "Dokončiť" msgid "Finished" msgstr "Hotovo" -#: dashboard/wivrn_server.cpp:584 +#: dashboard/wivrn_server.cpp:592 #, kde-format msgid "xrizer" msgstr "xrizer" -#: dashboard/wivrn_server.cpp:585 +#: dashboard/wivrn_server.cpp:593 #, kde-format msgid "Open Composite" msgstr "Open Composite" - -#: dashboard/qml/Main.qml:162 -#, kde-format -msgid "" -"No OpenVR compatibility detected, Steam games won't be able to load VR.\n" -"Install xrizer or OpenComposite." -msgstr "" -"Žiadna OpenVR kompatibilita nebola nájdená, Hry na steame nebude možné načítať do VRka.\n" -"Nainštalujte xrizer alebo OpenComposite." diff --git a/locale/sk/wivrn.po b/locale/sk/wivrn.po index d93597fc..86a67a11 100644 --- a/locale/sk/wivrn.po +++ b/locale/sk/wivrn.po @@ -2,13 +2,14 @@ # This file is distributed under the same license as the WiVRn package. # # SPDX-FileCopyrightText: 2025 not +# SPDX-FileCopyrightText: 2025 eps msgid "" msgstr "" "Project-Id-Version: WiVRn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-30 09:32+0200\n" -"PO-Revision-Date: 2025-08-02 18:41+0200\n" -"Last-Translator: not \n" +"POT-Creation-Date: 2025-08-08 20:41+0200\n" +"PO-Revision-Date: 2025-08-08 22:08+0200\n" +"Last-Translator: eps \n" "Language-Team: Slovak <>\n" "Language: sk\n" "MIME-Version: 1.0\n" @@ -45,129 +46,129 @@ msgstr "Nie je možné sa pripojiť k {} ({}): {}" msgid "Waiting for connection" msgstr "Čaká sa na pripojenie" -#: client/scenes/lobby_gui.cpp:156 +#: client/scenes/lobby_gui.cpp:230 msgctxt "openxr_post_processing" msgid "Normal" msgstr "Normálna" -#: client/scenes/lobby_gui.cpp:159 +#: client/scenes/lobby_gui.cpp:233 msgctxt "openxr_post_processing" msgid "Quality" msgstr "Vyššia kvalita" -#: client/scenes/lobby_gui.cpp:161 +#: client/scenes/lobby_gui.cpp:235 msgctxt "openxr_post_processing" msgid "Disabled" msgstr "Vypnuté" -#: client/scenes/lobby_gui.cpp:169 client/scenes/lobby_gui.cpp:320 +#: client/scenes/lobby_gui.cpp:243 client/scenes/lobby_gui.cpp:400 #: client/scenes/stream_gui.cpp:812 msgid "Disconnect" msgstr "Odpojiť" -#: client/scenes/lobby_gui.cpp:189 client/scenes/stream_gui.cpp:808 +#: client/scenes/lobby_gui.cpp:264 client/scenes/stream_gui.cpp:808 msgid "Close" msgstr "Zatvoriť" -#: client/scenes/lobby_gui.cpp:195 +#: client/scenes/lobby_gui.cpp:270 msgid "Connection" msgstr "Pripojenie" -#: client/scenes/lobby_gui.cpp:197 +#: client/scenes/lobby_gui.cpp:272 #, c++-format msgid "Connection to {}" msgstr "Pripojenie k {}" -#: client/scenes/lobby_gui.cpp:227 +#: client/scenes/lobby_gui.cpp:302 msgid "PIN" msgstr "PIN" -#: client/scenes/lobby_gui.cpp:249 +#: client/scenes/lobby_gui.cpp:324 msgid "Input the PIN displayed on the dashboard" msgstr "Zadajte PIN zobrazený v okne aplikácie" -#: client/scenes/lobby_gui.cpp:315 +#: client/scenes/lobby_gui.cpp:395 msgid "Connected to WiVRn server" msgstr "Pripojené k WiVRn serveru" -#: client/scenes/lobby_gui.cpp:317 +#: client/scenes/lobby_gui.cpp:397 #, c++-format msgid "Connected to {}" msgstr "Pripojené k {}" -#: client/scenes/lobby_gui.cpp:327 +#: client/scenes/lobby_gui.cpp:407 msgid "Start an application on the server to start streaming." msgstr "Na serveri spustite aplikáciu, aby sa začalo streamovanie." -#: client/scenes/lobby_gui.cpp:333 +#: client/scenes/lobby_gui.cpp:419 msgid "Start an application on your computer or select one to start streaming." msgstr "" -"Na svojom počítači spustite aplikáciu alebo vyberte jednu na začatie streamova" -"nia." +"Na svojom počítači spustite aplikáciu alebo vyberte jednu na začatie " +"streamovania." -#: client/scenes/lobby_gui.cpp:335 +#: client/scenes/lobby_gui.cpp:421 #, c++-format msgid "Start an application on {} or select one to start streaming." msgstr "Spustite aplikáciu na {} alebo jednu vyberte pre začatie streamovania." -#: client/scenes/lobby_gui.cpp:383 +#: client/scenes/lobby_gui.cpp:544 msgid "Name" msgstr "Názov" -#: client/scenes/lobby_gui.cpp:394 +#: client/scenes/lobby_gui.cpp:555 msgid "Address" msgstr "Adresa" -#: client/scenes/lobby_gui.cpp:403 +#: client/scenes/lobby_gui.cpp:564 msgid "Port" msgstr "Port" -#: client/scenes/lobby_gui.cpp:411 +#: client/scenes/lobby_gui.cpp:572 msgid "TCP only" msgstr "Iba TCP" -#: client/scenes/lobby_gui.cpp:418 +#: client/scenes/lobby_gui.cpp:579 msgid "Cancel" msgstr "Zrušiť" -#: client/scenes/lobby_gui.cpp:432 +#: client/scenes/lobby_gui.cpp:593 msgid "Save" msgstr "Uložiť" -#: client/scenes/lobby_gui.cpp:485 +#: client/scenes/lobby_gui.cpp:646 msgid "" "Start a WiVRn server on your\n" "local network" msgstr "" -"Spustite WiVRn server vo svojej\n" +"Spustite WiVRn server na svojej\n" "lokálnej sieti" -#: client/scenes/lobby_gui.cpp:517 +#: client/scenes/lobby_gui.cpp:678 msgid "Autoconnect" msgstr "Automatické pripojenie" -#: client/scenes/lobby_gui.cpp:543 +#: client/scenes/lobby_gui.cpp:704 msgid "Connect" msgstr "Pripojiť" -#: client/scenes/lobby_gui.cpp:553 client/wivrn_client.cpp:186 +#: client/scenes/lobby_gui.cpp:714 client/wivrn_client.cpp:186 msgid "Incompatible server version" msgstr "Verzia servera nie je kompatibilná" -#: client/scenes/lobby_gui.cpp:555 +#: client/scenes/lobby_gui.cpp:716 msgid "Server not available" msgstr "Server nie je dostupný" -#: client/scenes/lobby_gui.cpp:641 +#: client/scenes/lobby_gui.cpp:802 msgid "Refresh rate" msgstr "Obnovovacia frekvencia" -#: client/scenes/lobby_gui.cpp:641 client/scenes/lobby_gui.cpp:643 +#: client/scenes/lobby_gui.cpp:802 client/scenes/lobby_gui.cpp:804 msgctxt "automatic refresh rate" msgid "Automatic" msgstr "Automaticky" -#: client/scenes/lobby_gui.cpp:650 +#: client/scenes/lobby_gui.cpp:811 msgid "" "Select refresh rate based on measured application performance.\n" "May cause flicker when a change happens." @@ -175,60 +176,60 @@ msgstr "" "Vyber obnovovaciu frekvenciu podľa výkonu aplikácie.\n" "Pri zmene sa môže obraz trochu trhať." -#: client/scenes/lobby_gui.cpp:667 +#: client/scenes/lobby_gui.cpp:828 msgid "Minimum refresh rate" msgstr "Minimálna obnovovacia frekvencia" -#: client/scenes/lobby_gui.cpp:690 +#: client/scenes/lobby_gui.cpp:851 msgid "Resolution scale" msgstr "Rozlíšenie" -#: client/scenes/lobby_gui.cpp:694 client/scenes/lobby_gui.cpp:933 +#: client/scenes/lobby_gui.cpp:855 client/scenes/lobby_gui.cpp:1094 #, c-format, c++-format msgid "%d%% - {}x{} per eye" msgstr "%d%% - {}x{} na oko" -#: client/scenes/lobby_gui.cpp:705 client/scenes/lobby_gui.cpp:944 +#: client/scenes/lobby_gui.cpp:866 client/scenes/lobby_gui.cpp:1105 #, c++-format msgid "Resolution larger than {}x{} may not be supported by the headset" -msgstr "Rozlíšenie vyžšie ako {}x{} nemusí byť podporované vašim hedsetom" +msgstr "Rozlíšenie vyžšie ako {}x{} nemusí byť podporované vašim headsetom" -#: client/scenes/lobby_gui.cpp:711 +#: client/scenes/lobby_gui.cpp:872 msgid "Enable microphone" msgstr "Zapnúť mikrofón" -#: client/scenes/lobby_gui.cpp:720 +#: client/scenes/lobby_gui.cpp:881 msgid "Unprocessed Microphone Audio" -msgstr "Mikrofónu bez postrocesovaného zvuku" +msgstr "Mikrofónu bez procesovaného zvuku" -#: client/scenes/lobby_gui.cpp:726 +#: client/scenes/lobby_gui.cpp:887 msgid "Force disable audio filters, such as noise cancellation" msgstr "" "Vynúťené vypnutie zvukových filtrov, ako napríklad potlačenie okolného hluku" -#: client/scenes/lobby_gui.cpp:733 +#: client/scenes/lobby_gui.cpp:894 msgid "Enable hand tracking" msgstr "Zapnúť sledovanie rúk" -#: 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 +#: client/scenes/lobby_gui.cpp:900 client/scenes/lobby_gui.cpp:912 +#: client/scenes/lobby_gui.cpp:924 client/scenes/lobby_gui.cpp:940 +#: client/scenes/lobby_gui.cpp:990 msgid "This feature is not supported by your headset" -msgstr "Táto fíčura nieje podporovaná vašim hedsetom" +msgstr "Táto funkcia nieje podporovaná vašim headsetom" -#: client/scenes/lobby_gui.cpp:745 +#: client/scenes/lobby_gui.cpp:906 msgid "Enable eye tracking" msgstr "Zapnúť sledovanie očí" -#: client/scenes/lobby_gui.cpp:757 +#: client/scenes/lobby_gui.cpp:918 msgid "Enable face tracking" msgstr "Zapnúť sledovanie tváre" -#: client/scenes/lobby_gui.cpp:770 +#: client/scenes/lobby_gui.cpp:931 msgid "Enable body tracking" msgstr "Zapnúť sledovanie tela" -#: client/scenes/lobby_gui.cpp:786 +#: client/scenes/lobby_gui.cpp:947 msgid "" "Requires 'Hand and body tracking' to be enabled in the Quest movement " "tracking settings,\n" @@ -236,27 +237,27 @@ msgid "" msgstr "" "Je potrebné 'Hand and body tracking' aby bolo zapnuté v Quest movement " "tracking settings,\n" -"inak dáta o pozícii tela budú odhadované podla pozície hedsetu a ovládačov" +"inak dáta o pozícii tela budú odhadované podla pozície headsetu a ovládačov" -#: client/scenes/lobby_gui.cpp:799 +#: client/scenes/lobby_gui.cpp:960 msgid "Enable lower body tracking" msgstr "Zapnúť sledovanie spodnej části tela" -#: client/scenes/lobby_gui.cpp:805 +#: client/scenes/lobby_gui.cpp:966 msgid "" "Estimate lower body joint positions using Generative Legs\n" "Requires 'Hand and body tracking' to be enabled in the Quest movement " "tracking settings" msgstr "" "Odhad polohy kĺbov dolnej časti tela pomocou Generative Legs\n" -"Vyžaduje, aby bolo v nastaveniach Quest movement " -"tracking povolené „Hand and body tracking“" +"Vyžaduje, aby bolo v nastaveniach Quest movement tracking povolené „Hand and " +"body tracking“" -#: client/scenes/lobby_gui.cpp:808 +#: client/scenes/lobby_gui.cpp:969 msgid "Enable hip tracking" msgstr "Povoliť sledovanie pása" -#: client/scenes/lobby_gui.cpp:814 +#: client/scenes/lobby_gui.cpp:975 msgid "" "Only takes affect with lower body tracking enabled\n" "May be desired when using another source of hip tracking" @@ -264,207 +265,211 @@ msgstr "" "Platí len pri zapnutom sledovaní dolnej časti tela\n" "Môže byť vhodné, ak sa používa iný zdroj sledovania pása" -#: client/scenes/lobby_gui.cpp:822 +#: client/scenes/lobby_gui.cpp:983 msgid "Enable video passthrough in lobby" msgstr "Povoliť passthrough video v hlavnom menu" -#: client/scenes/lobby_gui.cpp:843 client/scenes/stream_gui.cpp:434 +#: client/scenes/lobby_gui.cpp:1004 client/scenes/stream_gui.cpp:434 msgid "OpenXR post-processing" msgstr "OpenXRPostprocesing" -#: client/scenes/lobby_gui.cpp:847 client/scenes/stream_gui.cpp:438 +#: client/scenes/lobby_gui.cpp:1008 client/scenes/stream_gui.cpp:438 msgid "Supersampling" msgstr "Supersampling" -#: client/scenes/lobby_gui.cpp:867 client/scenes/stream_gui.cpp:459 +#: client/scenes/lobby_gui.cpp:1028 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" msgstr "" "Zníženie blikania pri okrajoch z vysokým kontrastom.\n" -"Užitočné, keď je vstupné rozlíšenie vysoké v porovnaní s displejom hedsetu" +"Užitočné, keď je vstupné rozlíšenie vysoké v porovnaní s displejom headsetu" -#: client/scenes/lobby_gui.cpp:872 client/scenes/stream_gui.cpp:464 +#: client/scenes/lobby_gui.cpp:1033 client/scenes/stream_gui.cpp:464 msgid "Sharpening" msgstr "Ostrosť" -#: client/scenes/lobby_gui.cpp:892 client/scenes/stream_gui.cpp:485 +#: client/scenes/lobby_gui.cpp:1053 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" msgstr "" "Zlepšuje jasnosť pri okrajoch z vysokým kontrastom a potlačuje rozmazanie.\n" -"Užitočné, keď je vstupné rozlíšenie nízke v porovnaní s displejom hedsetu" +"Užitočné, keď je vstupné rozlíšenie nízke v porovnaní s displejom headsetu" -#: client/scenes/lobby_gui.cpp:901 +#: client/scenes/lobby_gui.cpp:1062 msgid "Enable Snapdragon Game Super Resolution" msgstr "Zapnúť Snapdragon Game Super Resolution" -#: client/scenes/lobby_gui.cpp:909 +#: client/scenes/lobby_gui.cpp:1070 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 "" -"V tomto headsete bolo toto nastavenie plne nahradené vyššie uvedeným natívnym" -"nastavením doostrenia.\n" +"V tomto headsete bolo toto nastavenie plne nahradené vyššie uvedeným " +"natívnym nastavením doostrenia.\n" "Zapnite ho, len ak viete, čo robíte." -#: client/scenes/lobby_gui.cpp:911 +#: client/scenes/lobby_gui.cpp:1072 msgid "" "Client-side upscaling and sharpening, adds a performance cost on the headset" msgstr "" -"Zvýšenie rozlíšenia a doostrenie na strane klienta zvyšuje náklady na výkon he" -"dsetu" +"Zvýšenie rozlíšenia a doostrenie na strane klienta zvyšuje náklady na výkon " +"headsetu" -#: client/scenes/lobby_gui.cpp:929 +#: client/scenes/lobby_gui.cpp:1090 msgid "Upscaling factor" msgstr "Faktor upscalovania" -#: client/scenes/lobby_gui.cpp:948 +#: client/scenes/lobby_gui.cpp:1109 msgid "Use edge direction" msgstr "Použitie smeru okrajov" -#: client/scenes/lobby_gui.cpp:954 +#: client/scenes/lobby_gui.cpp:1115 msgid "Adds an additional performance cost" msgstr "Pridáva dodatočné náklady na výkon" -#: client/scenes/lobby_gui.cpp:959 +#: client/scenes/lobby_gui.cpp:1120 msgid "Edge threshold" msgstr "Hraničná hodnota okrajov" -#: client/scenes/lobby_gui.cpp:966 client/scenes/lobby_gui.cpp:975 +#: client/scenes/lobby_gui.cpp:1127 client/scenes/lobby_gui.cpp:1136 #, c++-format msgid "Recommended: {:.1f}" msgstr "Odporúčané: {:.1f}" -#: client/scenes/lobby_gui.cpp:969 +#: client/scenes/lobby_gui.cpp:1130 msgid "Edge sharpness" msgstr "Ostrosť okrajov" -#: client/scenes/lobby_gui.cpp:1071 client/scenes/lobby_gui.cpp:1079 +#: client/scenes/lobby_gui.cpp:1232 client/scenes/lobby_gui.cpp:1240 #: client/scenes/stream_gui.cpp:222 client/scenes/stream_gui.cpp:418 msgid "CPU time" msgstr "CPU odozva" -#: client/scenes/lobby_gui.cpp:1075 +#: client/scenes/lobby_gui.cpp:1236 msgid "CPU time [ms]" msgstr "CPU odozva [ms]" -#: client/scenes/lobby_gui.cpp:1085 client/scenes/lobby_gui.cpp:1093 +#: client/scenes/lobby_gui.cpp:1246 client/scenes/lobby_gui.cpp:1254 #: client/scenes/stream_gui.cpp:224 client/scenes/stream_gui.cpp:419 msgid "GPU time" msgstr "GPU odozva" -#: client/scenes/lobby_gui.cpp:1089 +#: client/scenes/lobby_gui.cpp:1250 msgid "GPU time [ms]" msgstr "GPU odozva [ms]" -#: client/scenes/lobby_gui.cpp:1132 +#: client/scenes/lobby_gui.cpp:1293 msgid "Enable the microphone?" msgstr "Zapnúť mikrofón?" -#: client/scenes/lobby_gui.cpp:1137 +#: client/scenes/lobby_gui.cpp:1298 msgid "Enable eye tracking?" msgstr "Povolenie sledovania očí?" -#: client/scenes/lobby_gui.cpp:1142 +#: client/scenes/lobby_gui.cpp:1303 msgid "Enable face tracking?" msgstr "Povolenie sledovania tváre?" -#: client/scenes/lobby_gui.cpp:1147 +#: client/scenes/lobby_gui.cpp:1308 msgid "Enable body tracking?" msgstr "Povoliť sledovanie tela?" -#: client/scenes/lobby_gui.cpp:1155 +#: client/scenes/lobby_gui.cpp:1316 msgid "Welcome to WiVRn" msgstr "Vitajte v WiVRn" -#: client/scenes/lobby_gui.cpp:1179 +#: client/scenes/lobby_gui.cpp:1340 msgid "Yes" msgstr "Áno" -#: client/scenes/lobby_gui.cpp:1186 +#: client/scenes/lobby_gui.cpp:1347 msgid "No" msgstr "Nie" -#: client/scenes/lobby_gui.cpp:1205 client/scenes/lobby_gui.cpp:1844 +#: client/scenes/lobby_gui.cpp:1366 client/scenes/lobby_gui.cpp:2005 msgid "Licenses" msgstr "Licencie" -#: client/scenes/lobby_gui.cpp:1519 +#: client/scenes/lobby_gui.cpp:1680 msgid "Microphone is enabled" msgstr "Mikrofón je zapnutý" -#: client/scenes/lobby_gui.cpp:1520 +#: client/scenes/lobby_gui.cpp:1681 msgid "Microphone is disabled" msgstr "Mikrofón je vypnutý" -#: client/scenes/lobby_gui.cpp:1529 +#: client/scenes/lobby_gui.cpp:1690 msgid "Hand tracking is enabled" msgstr "Sledovanie rúk je zapnuté" -#: client/scenes/lobby_gui.cpp:1530 +#: client/scenes/lobby_gui.cpp:1691 msgid "Hand tracking is disabled" msgstr "Sledovanie rúk je vypnuté" -#: client/scenes/lobby_gui.cpp:1539 +#: client/scenes/lobby_gui.cpp:1700 msgid "Eye tracking is enabled" msgstr "Sledovanie očí je zapnuté" -#: client/scenes/lobby_gui.cpp:1540 +#: client/scenes/lobby_gui.cpp:1701 msgid "Eye tracking is disabled" msgstr "Sledovanie očí je vypnuté" -#: client/scenes/lobby_gui.cpp:1553 +#: client/scenes/lobby_gui.cpp:1714 msgid "Face tracking is enabled" msgstr "Sledovanie tváre je zapnuté" -#: client/scenes/lobby_gui.cpp:1554 +#: client/scenes/lobby_gui.cpp:1715 msgid "Face tracking is disabled" msgstr "Sledovanie tváre je vypnuté" -#: client/scenes/lobby_gui.cpp:1564 +#: client/scenes/lobby_gui.cpp:1725 msgid "Body tracking is enabled" msgstr "Sledovanie tela je zapnuté" -#: client/scenes/lobby_gui.cpp:1565 +#: client/scenes/lobby_gui.cpp:1726 msgid "Body tracking is disabled" msgstr "Sledovanie tela je vypnuté" -#: client/scenes/lobby_gui.cpp:1581 +#: client/scenes/lobby_gui.cpp:1742 msgid "Add server" msgstr "Pridať server" -#: client/scenes/lobby_gui.cpp:1826 +#: client/scenes/lobby_gui.cpp:1987 msgid "Server list" msgstr "Zoznam serverov" -#: client/scenes/lobby_gui.cpp:1829 client/scenes/stream_gui.cpp:796 +#: client/scenes/lobby_gui.cpp:1990 client/scenes/stream_gui.cpp:796 msgid "Settings" msgstr "Nastavenia" -#: client/scenes/lobby_gui.cpp:1832 +#: client/scenes/lobby_gui.cpp:1993 msgid "Post-processing" msgstr "Postprocesing" -#: client/scenes/lobby_gui.cpp:1836 +#: client/scenes/lobby_gui.cpp:1997 msgid "Debug" msgstr "Ladenie" -#: client/scenes/lobby_gui.cpp:1841 +#: client/scenes/lobby_gui.cpp:2002 msgid "About" msgstr "O aplikácii" -#: client/scenes/lobby_gui.cpp:1847 +#: client/scenes/lobby_gui.cpp:2008 msgid "Exit" msgstr "Ukončiť" -#: client/scenes/lobby_gui.cpp:1864 -msgid "Press the grip button or put your palm up\nto move the main window" -msgstr "Stlačte tlačidlo grip alebo zdvihnite dlaň\npre presunutie hlavného okna" +#: client/scenes/lobby_gui.cpp:2025 +msgid "" +"Press the grip button or put your palm up\n" +"to move the main window" +msgstr "" +"Stlačte tlačidlo grip alebo zdvihnite dlaň\n" +"pre presunutie hlavného okna" -#: client/scenes/lobby_gui.cpp:1866 +#: client/scenes/lobby_gui.cpp:2027 msgid "Press the grip button to move the main window" msgstr "Pre presunutie hlavného okna stlačte grip" @@ -574,7 +579,7 @@ msgstr "Pomocou joysticku nastavte foveation centrum" #: client/scenes/stream_gui.cpp:549 msgid "Press A to save or B to cancel" -msgstr "Stlač A pre uloženie alebo B pre zrušenie" +msgstr "Stlačte A pre uloženie alebo B pre zrušenie" #: client/scenes/stream_gui.cpp:793 msgid "Stats" From e02d115a4e49b177921878b14d33c09c8f39ba8c Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Fri, 8 Aug 2025 23:15:18 +0200 Subject: [PATCH 19/85] Use PRESSURE_VESSEL_IMPORT_OPENXR_1_RUNTIMES --- server/main.cpp | 49 ++++++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/server/main.cpp b/server/main.cpp index 020e6136..ae4914fe 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -18,7 +18,6 @@ #include "hostname.h" #include "protocol_version.h" #include "start_application.h" -#include "utils/flatpak.h" #include "utils/overloaded.h" #include "version.h" #include "wivrn_config.h" @@ -128,46 +127,37 @@ int create_listen_socket() return fd; } -static std::filesystem::path flatpak_app_path() +static bool pressure_vessel_openxr_support() { - if (auto value = flatpak_key(flatpak::section::instance, "app-path")) - { - std::filesystem::path path = *value; - while (path != "" and path != path.parent_path() and path.filename() != "io.github.wivrn.wivrn") - path = path.parent_path(); + auto pv_var = std::getenv("PRESSURE_VESSEL_IMPORT_OPENXR_1_RUNTIMES"); + return pv_var and pv_var == std::string_view("1"); +} - return path; - } - - return "/"; +static void append_delim(std::string & to, std::string_view what, char delim) +{ + if (not to.empty()) + to += delim; + to += what; } static std::string steam_command() { - std::string pressure_vessel_filesystems_rw = "$XDG_RUNTIME_DIR/" XRT_IPC_MSG_SOCK_FILENAME; - std::string vr_override; + std::string command; - // Check if in a flatpak - if (is_flatpak()) - { - std::string app_path = flatpak_app_path().string(); - // /usr and /var are remapped by steam - if (app_path.starts_with("/var")) - pressure_vessel_filesystems_rw += ":" + app_path; - } - else if (auto p = active_runtime::openvr_compat_path().string(); not p.empty()) + if (not pressure_vessel_openxr_support()) + command = "PRESSURE_VESSEL_IMPORT_OPENXR_1_RUNTIMES=1"; + + if (auto p = active_runtime::openvr_compat_path().string(); not p.empty()) { // /usr cannot be shared in pressure vessel container if (p.starts_with("/usr")) - vr_override = " VR_OVERRIDE=/run/host" + p; + append_delim(command, " VR_OVERRIDE=/run/host" + p, ' '); else if (p.starts_with("/var")) - pressure_vessel_filesystems_rw += ":" + p; + append_delim(command, "PRESSURE_VESSEL_FILESYSTEMS_RW=" + p, ' '); } - std::string command = "PRESSURE_VESSEL_FILESYSTEMS_RW=" + pressure_vessel_filesystems_rw + vr_override + " %command%"; - - if (auto p = active_runtime::manifest_path().string(); p.starts_with("/usr")) - command = "XR_RUNTIME_JSON=/run/host" + p + " " + command; + if (not command.empty()) + command += " %command%"; return command; } @@ -884,7 +874,8 @@ int inner_main(int argc, char * argv[], bool show_instructions) std::cerr << "WiVRn " << wivrn::git_version << " starting" << std::endl; if (show_instructions) { - std::cerr << "For Steam games, set command to " << steam_command() << std::endl; + if (auto command = steam_command(); not command.empty()) + std::cerr << "For Steam games, set command to " << command << std::endl; } std::filesystem::create_directories(socket_path().parent_path()); From b036731b517903070e4e6fe7ab7688405cb638ed Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Fri, 8 Aug 2025 23:43:26 +0200 Subject: [PATCH 20/85] Hide Steam info when not needed --- dashboard/qml/Main.qml | 5 +++-- server/main.cpp | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dashboard/qml/Main.qml b/dashboard/qml/Main.qml index e3e14a0b..4854befe 100644 --- a/dashboard/qml/Main.qml +++ b/dashboard/qml/Main.qml @@ -305,11 +305,12 @@ Kirigami.ApplicationWindow { level: 1 wrapMode: Text.WordWrap text: i18n("Steam information") - opacity: root.server_started + opacity: steam_info.opacity Layout.maximumHeight: root.server_started ? -1 : 0 } SteamLaunchOptions { - opacity: root.server_started + id: steam_info + opacity: root.server_started && WivrnServer.steamCommand != "" Layout.maximumHeight: root.server_started ? -1 : 0 } diff --git a/server/main.cpp b/server/main.cpp index ae4914fe..610ddfba 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -678,14 +678,18 @@ void on_json_configuration(WivrnServer * server, const GParamSpec * pspec, gpoin std::filesystem::path config_new = config; config_new += ".new"; - std::ofstream file(config_new); - file.write(json, strlen(json)); + { + std::ofstream file(config_new); + file.write(json, strlen(json)); + } std::error_code ec; std::filesystem::rename(config_new, config, ec); if (ec) std::cerr << "Failed to save configuration: " << ec.message() << std::endl; + + wivrn_server_set_steam_command(dbus_server, steam_command().c_str()); } void expose_known_keys_on_dbus() From d5ef8c1a856f9bebb9cd958e030e0e51b6b9c847 Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Sat, 9 Aug 2025 09:58:38 +0200 Subject: [PATCH 21/85] Added checks and try-catch when attempting to load icons Fixes #437 --- common/utils/load_icon.cpp | 586 ++++++++++++++++---------------- server/driver/wivrn_session.cpp | 17 +- 2 files changed, 299 insertions(+), 304 deletions(-) diff --git a/common/utils/load_icon.cpp b/common/utils/load_icon.cpp index f4bde8d5..d973855e 100644 --- a/common/utils/load_icon.cpp +++ b/common/utils/load_icon.cpp @@ -126,10 +126,7 @@ std::vector load_svg(const std::filesystem::path & filename, int size }; if (!rsvg_handle_render_document(handle.get(), cr.get(), &viewport, &error)) - { - g_printerr("could not render: %s", error->message); - return {}; - } + throw std::runtime_error{std::string{"Could not render: "} + error->message}; // Write a PNG file std::vector png; @@ -143,11 +140,8 @@ std::vector load_svg(const std::filesystem::path & filename, int size return CAIRO_STATUS_SUCCESS; }; - if (cairo_surface_write_to_png_stream(surface.get(), cb, &png) != CAIRO_STATUS_SUCCESS) - { - g_printerr("could not write output file"); - return {}; - } + if (auto status = cairo_surface_write_to_png_stream(surface.get(), cb, &png); status != CAIRO_STATUS_SUCCESS) + throw std::runtime_error{std::string{"Could not write output: "} + cairo_status_to_string(status)}; return png; } @@ -201,352 +195,346 @@ std::vector load_ico(const std::filesystem::path & filename, int size { const uint32_t ICO_PNG_MAGIC = 0x474e5089; - try + auto ico = load_file(filename); + + std::span header{ico}; + + auto reserved = read(header); + auto resource_type = read(header); + auto icon_count = read(header); + + if (reserved != 0 or resource_type != 1) + throw std::runtime_error{"Cannot read icon: " + filename.native()}; + + std::vector entries; + int max_bpp = 0; + + for (int i = 0; i < icon_count; i++) { - auto ico = load_file(filename); + ico_file_entry entry; + entry.width = read(header); + entry.height = read(header); + auto num_colors = read(header); + auto reserved = read(header); // reserved + auto planes = read(header); + entry.bpp = read(header); + auto size = read(header); + auto offset = read(header); - std::span header{ico}; + if (offset + size > ico.size()) + throw std::runtime_error{"Cannot read icon: " + filename.native()}; - auto reserved = read(header); - auto resource_type = read(header); - auto icon_count = read(header); + entry.data = std::span{ico}.subspan(offset, size); + if (entry.width == 0) + entry.width = 256; + if (entry.height == 0) + entry.height = 256; + if (reserved != 0) + throw std::runtime_error{"Cannot read icon: " + filename.native()}; + if (planes != 0 and planes != 1) + throw std::runtime_error{"Cannot read icon: " + filename.native()}; - if (reserved != 0 or resource_type != 1) - return {}; + entries.push_back(entry); - std::vector entries; - int max_bpp = 0; + max_bpp = std::max(max_bpp, entry.bpp); + } - for (int i = 0; i < icon_count; i++) + const ico_file_entry * best_entry = index >= 0 ? &entries.at(index) : [&]() { + const ico_file_entry * best_entry = nullptr; + + // Look for the smallest multiple of the requested size + int criterion = std::numeric_limits::max(); + + for (const auto & entry: entries) { - ico_file_entry entry; - entry.width = read(header); - entry.height = read(header); - auto num_colors = read(header); - auto reserved = read(header); // reserved - auto planes = read(header); - entry.bpp = read(header); - auto size = read(header); - auto offset = read(header); + if (entry.bpp != max_bpp) + continue; - if (offset + size > ico.size()) - return {}; + if (entry.width % size != 0 or entry.height % size != 0) + continue; - entry.data = std::span{ico}.subspan(offset, size); - if (entry.width == 0) - entry.width = 256; - if (entry.height == 0) - entry.height = 256; - if (reserved != 0) - return {}; - if (planes != 0 and planes != 1) - return {}; - - entries.push_back(entry); - - max_bpp = std::max(max_bpp, entry.bpp); + if (std::min(entry.width, entry.height) / size < criterion) + { + criterion = std::min(entry.width, entry.height); + best_entry = &entry; + } } - - const ico_file_entry * best_entry = index >= 0 ? &entries.at(index) : [&]() { - const ico_file_entry * best_entry = nullptr; - - // Look for the smallest multiple of the requested size - int criterion = std::numeric_limits::max(); - - for (const auto & entry: entries) - { - if (entry.bpp != max_bpp) - continue; - - if (entry.width % size != 0 or entry.height % size != 0) - continue; - - if (std::min(entry.width, entry.height) / size < criterion) - { - criterion = std::min(entry.width, entry.height); - best_entry = &entry; - } - } - if (best_entry) - return best_entry; - - // No multiple found: pick the largest icon - criterion = 0; - - for (const auto & entry: entries) - { - if (entry.bpp != max_bpp) - continue; - - if (entry.width * entry.height > criterion) - { - criterion = entry.width * entry.height; - best_entry = &entry; - } - } + if (best_entry) return best_entry; - }(); - if (not best_entry) + // No multiple found: pick the largest icon + criterion = 0; + + for (const auto & entry: entries) + { + if (entry.bpp != max_bpp) + continue; + + if (entry.width * entry.height > criterion) + { + criterion = entry.width * entry.height; + best_entry = &entry; + } + } + return best_entry; + }(); + + if (not best_entry) + return {}; + + auto data = best_entry->data; + auto magic = read(data); + + if (magic == ICO_PNG_MAGIC) + { + // PNG file + std::vector png_data; + + // The PNG magic has already been consumed, put it back + png_data.insert(png_data.end(), data.begin() - 4, data.end()); + + // Check if the PNG is valid + std::vector pixels; + png_image png_ref{ + .version = PNG_IMAGE_VERSION, + .format = PNG_FORMAT_BGRA, + }; + if (not png_image_begin_read_from_memory(&png_ref, png_data.data(), png_data.size())) + throw std::runtime_error{"Cannot read icon: " + filename.native()}; + + pixels.resize(PNG_IMAGE_SIZE(png_ref)); + + if (!png_image_finish_read(&png_ref, nullptr, pixels.data(), 0, nullptr)) + { + png_image_free(&png_ref); + throw std::runtime_error{"Cannot read icon: " + filename.native()}; + } + png_image_free(&png_ref); + + return png_data; + } + else if (magic == 40) + { + auto width = read(data); // Width of image in pixels + auto height = read(data); // Height of image in pixels + auto planes = read(data); // Must be 1 + auto bpp = read(data); // 1, 4, 8, 16, 24, 32 + auto compression = read(data); // Must be 0 for icons + auto image_size = read(data); // Size of image (without this header) + auto x_res = read(data); + auto y_res = read(data); + auto used_colors = read(data); + auto important_colors = read(data); + + if (planes != 1 or compression != 0) return {}; - auto data = best_entry->data; - auto magic = read(data); + if (bpp != 1 and + bpp != 4 and + bpp != 8 and + bpp != 16 and + bpp != 24 and + bpp != 32) + return {}; - if (magic == ICO_PNG_MAGIC) + auto w = width; + auto h = height / 2; + + std::span palette; // BGRX + + if (bpp <= 16) { - // PNG file - std::vector png_data; + // Load the palette + if (used_colors == 0) + used_colors = 1 << bpp; - // The PNG magic has already been consumed, put it back - png_data.insert(png_data.end(), data.begin() - 4, data.end()); - - // Check if the PNG is valid - std::vector pixels; - png_image png_ref{ - .version = PNG_IMAGE_VERSION, - .format = PNG_FORMAT_BGRA, - }; - if (not png_image_begin_read_from_memory(&png_ref, png_data.data(), png_data.size())) - return {}; - - pixels.resize(PNG_IMAGE_SIZE(png_ref)); - - if (!png_image_finish_read(&png_ref, nullptr, pixels.data(), 0, nullptr)) - { - png_image_free(&png_ref); - return {}; - } - png_image_free(&png_ref); - - return png_data; + palette = read(data, used_colors * 4); } - else if (magic == 40) + + size_t xor_stride = rowstride(w, bpp); + size_t and_stride = rowstride(w, 1); + size_t dst_stride = 4 * w; + + std::span xor_map = read(data, xor_stride * h); + std::span and_map = read(data, and_stride * h); + + std::vector dest_buffer; + dest_buffer.resize(h * dst_stride); + + switch (bpp) { - auto width = read(data); // Width of image in pixels - auto height = read(data); // Height of image in pixels - auto planes = read(data); // Must be 1 - auto bpp = read(data); // 1, 4, 8, 16, 24, 32 - auto compression = read(data); // Must be 0 for icons - auto image_size = read(data); // Size of image (without this header) - auto x_res = read(data); - auto y_res = read(data); - auto used_colors = read(data); - auto important_colors = read(data); + case 1: + for (int y = 0; y < h; y++) + { + uint8_t * src_xor_row = xor_map.data() + xor_stride * y; + uint8_t * src_and_row = and_map.data() + and_stride * y; + uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); - if (planes != 1 or compression != 0) - return {}; - - if (bpp != 1 and - bpp != 4 and - bpp != 8 and - bpp != 16 and - bpp != 24 and - bpp != 32) - return {}; - - auto w = width; - auto h = height / 2; - - std::span palette; // BGRX - - if (bpp <= 16) - { - // Load the palette - if (used_colors == 0) - used_colors = 1 << bpp; - - palette = read(data, used_colors * 4); - } - - size_t xor_stride = rowstride(w, bpp); - size_t and_stride = rowstride(w, 1); - size_t dst_stride = 4 * w; - - std::span xor_map = read(data, xor_stride * h); - std::span and_map = read(data, and_stride * h); - - std::vector dest_buffer; - dest_buffer.resize(h * dst_stride); - - switch (bpp) - { - case 1: - for (int y = 0; y < h; y++) + for (int x = 0, i = 0; x < w; x++) { - uint8_t * src_xor_row = xor_map.data() + xor_stride * y; - uint8_t * src_and_row = and_map.data() + and_stride * y; - uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); + int colour = (src_xor_row[x / 8] >> (7 - (x % 8))) & 0x1; + if (colour >= used_colors) + return {}; - for (int x = 0, i = 0; x < w; x++) - { - int colour = (src_xor_row[x / 8] >> (7 - (x % 8))) & 0x1; - if (colour >= used_colors) - return {}; + uint8_t b = palette[4 * colour + 0]; // Blue + uint8_t g = palette[4 * colour + 1]; // Green + uint8_t r = palette[4 * colour + 2]; // Red - uint8_t b = palette[4 * colour + 0]; // Blue - uint8_t g = palette[4 * colour + 1]; // Green - uint8_t r = palette[4 * colour + 2]; // Red + // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) + uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; - // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) - uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; - - *dst_row++ = b; - *dst_row++ = g; - *dst_row++ = r; - *dst_row++ = a; - } + *dst_row++ = b; + *dst_row++ = g; + *dst_row++ = r; + *dst_row++ = a; } - break; + } + break; - case 4: - for (int y = 0; y < h; y++) + case 4: + for (int y = 0; y < h; y++) + { + uint8_t * src_xor_row = xor_map.data() + xor_stride * y; + uint8_t * src_and_row = and_map.data() + and_stride * y; + uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); + + for (int x = 0, i = 0; x < w; x++) { - uint8_t * src_xor_row = xor_map.data() + xor_stride * y; - uint8_t * src_and_row = and_map.data() + and_stride * y; - uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); + int colour = (src_xor_row[x / 2] >> (4 - 4 * (x % 2))) & 0xf; + if (colour >= used_colors) + return {}; - for (int x = 0, i = 0; x < w; x++) - { - int colour = (src_xor_row[x / 2] >> (4 - 4 * (x % 2))) & 0xf; - if (colour >= used_colors) - return {}; + uint8_t b = palette[4 * colour + 0]; // Blue + uint8_t g = palette[4 * colour + 1]; // Green + uint8_t r = palette[4 * colour + 2]; // Red - uint8_t b = palette[4 * colour + 0]; // Blue - uint8_t g = palette[4 * colour + 1]; // Green - uint8_t r = palette[4 * colour + 2]; // Red + // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) + uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; - // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) - uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; - - *dst_row++ = b; - *dst_row++ = g; - *dst_row++ = r; - *dst_row++ = a; - } + *dst_row++ = b; + *dst_row++ = g; + *dst_row++ = r; + *dst_row++ = a; } - break; + } + break; - case 8: - for (int y = 0; y < h; y++) + case 8: + for (int y = 0; y < h; y++) + { + uint8_t * src_xor_row = xor_map.data() + xor_stride * y; + uint8_t * src_and_row = and_map.data() + and_stride * y; + uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); + + for (int x = 0, i = 0; x < w; x++) { - uint8_t * src_xor_row = xor_map.data() + xor_stride * y; - uint8_t * src_and_row = and_map.data() + and_stride * y; - uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); + int colour = *src_xor_row++; + if (colour >= used_colors) + return {}; - for (int x = 0, i = 0; x < w; x++) - { - int colour = *src_xor_row++; - if (colour >= used_colors) - return {}; + uint8_t b = palette[4 * colour + 0]; // Blue + uint8_t g = palette[4 * colour + 1]; // Green + uint8_t r = palette[4 * colour + 2]; // Red - uint8_t b = palette[4 * colour + 0]; // Blue - uint8_t g = palette[4 * colour + 1]; // Green - uint8_t r = palette[4 * colour + 2]; // Red + // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) + uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; - // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) - uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; - - *dst_row++ = b; - *dst_row++ = g; - *dst_row++ = r; - *dst_row++ = a; - } + *dst_row++ = b; + *dst_row++ = g; + *dst_row++ = r; + *dst_row++ = a; } - break; + } + break; - case 16: - for (int y = 0; y < h; y++) + case 16: + for (int y = 0; y < h; y++) + { + uint8_t * src_xor_row = xor_map.data() + xor_stride * y; + uint8_t * src_and_row = and_map.data() + and_stride * y; + uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); + + for (int x = 0, i = 0; x < w; x++) { - uint8_t * src_xor_row = xor_map.data() + xor_stride * y; - uint8_t * src_and_row = and_map.data() + and_stride * y; - uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); + int colour = (src_xor_row[1] << 8) | src_xor_row[0]; + src_xor_row += 2; - for (int x = 0, i = 0; x < w; x++) - { - int colour = (src_xor_row[1] << 8) | src_xor_row[0]; - src_xor_row += 2; + if (colour >= used_colors) + return {}; - if (colour >= used_colors) - return {}; + uint8_t b = palette[4 * colour + 0]; // Blue + uint8_t g = palette[4 * colour + 1]; // Green + uint8_t r = palette[4 * colour + 2]; // Red - uint8_t b = palette[4 * colour + 0]; // Blue - uint8_t g = palette[4 * colour + 1]; // Green - uint8_t r = palette[4 * colour + 2]; // Red + // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) + uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; - // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) - uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; - - *dst_row++ = b; - *dst_row++ = g; - *dst_row++ = r; - *dst_row++ = a; - } + *dst_row++ = b; + *dst_row++ = g; + *dst_row++ = r; + *dst_row++ = a; } - break; + } + break; - case 24: - for (int y = 0; y < h; y++) + case 24: + for (int y = 0; y < h; y++) + { + uint8_t * src_xor_row = xor_map.data() + xor_stride * y; + uint8_t * src_and_row = and_map.data() + and_stride * y; + uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); + + for (int x = 0, i = 0; x < w; x++) { - uint8_t * src_xor_row = xor_map.data() + xor_stride * y; - uint8_t * src_and_row = and_map.data() + and_stride * y; - uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); + uint8_t b = *src_xor_row++; // Blue + uint8_t g = *src_xor_row++; // Green + uint8_t r = *src_xor_row++; // Red - for (int x = 0, i = 0; x < w; x++) - { - uint8_t b = *src_xor_row++; // Blue - uint8_t g = *src_xor_row++; // Green - uint8_t r = *src_xor_row++; // Red + // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) + uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; - // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) - uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; - - *dst_row++ = b; - *dst_row++ = g; - *dst_row++ = r; - *dst_row++ = a; - } + *dst_row++ = b; + *dst_row++ = g; + *dst_row++ = r; + *dst_row++ = a; } - break; + } + break; - case 32: - for (int y = 0; y < h; y++) - { - uint8_t * src_xor_row = (uint8_t *)xor_map.data() + xor_stride * y; - uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); + case 32: + for (int y = 0; y < h; y++) + { + uint8_t * src_xor_row = (uint8_t *)xor_map.data() + xor_stride * y; + uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); - memcpy(dst_row, src_xor_row, dst_stride); - } - break; - } + memcpy(dst_row, src_xor_row, dst_stride); + } + break; + } - png_image png{ - .version = PNG_IMAGE_VERSION, - .width = w, - .height = h, - .format = PNG_FORMAT_BGRA, - }; + png_image png{ + .version = PNG_IMAGE_VERSION, + .width = w, + .height = h, + .format = PNG_FORMAT_BGRA, + }; - std::vector png_data{65536}; - png_alloc_size_t png_size = png_data.size(); + std::vector png_data{65536}; + png_alloc_size_t png_size = png_data.size(); + png_image_write_to_memory(&png, png_data.data(), &png_size, false /* convert_to_8_bit*/, dest_buffer.data(), w * 4, nullptr); + + if (png_size > png_data.size()) + { + png_data.resize(png_size); png_image_write_to_memory(&png, png_data.data(), &png_size, false /* convert_to_8_bit*/, dest_buffer.data(), w * 4, nullptr); - - if (png_size > png_data.size()) - { - png_data.resize(png_size); - png_image_write_to_memory(&png, png_data.data(), &png_size, false /* convert_to_8_bit*/, dest_buffer.data(), w * 4, nullptr); - } - else - png_data.resize(png_size); - - return png_data; } - } - catch (std::exception & e) - { + else + png_data.resize(png_size); + + return png_data; } - return {}; + throw std::runtime_error{"Wrong magic number in " + filename.native()}; } std::unordered_map> icon_cache; @@ -556,7 +544,7 @@ std::unordered_map> icon_cache; const std::vector & wivrn::load_icon(const std::filesystem::path & filename, int size) { auto it = icon_cache.find(filename); - if (it != icon_cache.end()) + if (it != icon_cache.end() and not it->second.empty()) return it->second; std::vector icon; diff --git a/server/driver/wivrn_session.cpp b/server/driver/wivrn_session.cpp index b42e63d1..dc61dbd4 100644 --- a/server/driver/wivrn_session.cpp +++ b/server/driver/wivrn_session.cpp @@ -757,12 +757,19 @@ void wivrn_session::operator()(from_headset::get_application_list && request) { if (app.icon_path) { - auto icon = load_icon(*app.icon_path, 256); + try + { + auto icon = load_icon(*app.icon_path, 256); - send_control(to_headset::application_icon{ - .id = id, - .image = std::move(icon), - }); + send_control(to_headset::application_icon{ + .id = id, + .image = std::move(icon), + }); + } + catch (std::exception & e) + { + U_LOG_W("Error loading icon %s: %s", app.icon_path->c_str(), e.what()); + } } } } From 45d5d6dd7aabf9d95be4ae2af9399eb9c51c4d79 Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Sat, 9 Aug 2025 13:34:21 +0200 Subject: [PATCH 22/85] Read Linux steam icons --- CMakeLists.txt | 1 + common/CMakeLists.txt | 2 +- common/application.cpp | 6 +-- common/utils/load_icon.cpp | 65 ++++++++++++++++++++++++++++++++- common/utils/steam_app_info.cpp | 3 ++ 5 files changed, 72 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3be38d8..540fefd3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,6 +185,7 @@ endif() if (WIVRN_BUILD_DASHBOARD OR WIVRN_BUILD_SERVER) pkg_check_modules(librsvg-2.0 REQUIRED IMPORTED_TARGET librsvg-2.0) + find_package(LibArchive) find_package(PNG) endif() diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index c580a4fd..be306e28 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -50,7 +50,7 @@ if (WIVRN_BUILD_DASHBOARD OR WIVRN_BUILD_SERVER) utils/ini.cpp application.cpp ) - target_link_libraries(wivrn-common-server PRIVATE nlohmann_json::nlohmann_json PNG::PNG PkgConfig::librsvg-2.0 PUBLIC wivrn-common-base) + target_link_libraries(wivrn-common-server PRIVATE nlohmann_json::nlohmann_json PNG::PNG PkgConfig::librsvg-2.0 LibArchive::LibArchive PUBLIC wivrn-common-base) if (WIVRN_BUILD_TEST) add_executable(list-apps diff --git a/common/application.cpp b/common/application.cpp index 0e8f6e8c..4992fced 100644 --- a/common/application.cpp +++ b/common/application.cpp @@ -84,7 +84,7 @@ steam_app_info read_steam_app_info(const std::filesystem::path & root) return {}; } -std::filesystem::path find_steam_icon(const std::filesystem::path & root, int app_id, const steam_app_info & info) +std::optional find_steam_icon(const std::filesystem::path & root, int app_id, const steam_app_info & info) { const auto & app_info = info.get(app_id); @@ -102,7 +102,7 @@ std::filesystem::path find_steam_icon(const std::filesystem::path & root, int ap try { - std::string icon{std::get(app_info.at("common.LinuxClientIcon"))}; + std::string icon{std::get(app_info.at("common.linuxclienticon"))}; auto icon_path = root / "steam/games" / (icon + ".zip"); @@ -113,7 +113,7 @@ std::filesystem::path find_steam_icon(const std::filesystem::path & root, int ap { } - return {}; + return std::nullopt; } void read_steam_vr_apps(std::unordered_map & res) diff --git a/common/utils/load_icon.cpp b/common/utils/load_icon.cpp index d973855e..5a3aaffa 100644 --- a/common/utils/load_icon.cpp +++ b/common/utils/load_icon.cpp @@ -18,6 +18,8 @@ #include "load_icon.h" +#include +#include #include #include #include @@ -537,6 +539,67 @@ std::vector load_ico(const std::filesystem::path & filename, int size throw std::runtime_error{"Wrong magic number in " + filename.native()}; } +std::vector load_zip(const std::filesystem::path & filename, int size) +{ + std::unique_ptr zip{archive_read_new(), &archive_read_free}; + + archive_read_support_filter_all(zip.get()); + archive_read_support_format_all(zip.get()); + + if (auto rc = archive_read_open_filename(zip.get(), filename.c_str(), 1'000'000); rc != ARCHIVE_OK) + throw std::runtime_error{"Cannot open " + filename.native() + ": " + archive_error_string(zip.get())}; + + archive_entry * entry; + int width = 0; + int height = 0; + std::vector png; + + while (archive_read_next_header(zip.get(), &entry) == ARCHIVE_OK) + { + printf("%s\n", archive_entry_pathname(entry)); + + std::vector buffer; + buffer.resize(archive_entry_size(entry)); + + if (auto status = archive_read_data(zip.get(), buffer.data(), buffer.size()); status < 0) + continue; + + // Try reading the PNG + std::vector pixels; + png_image png_ref{ + .version = PNG_IMAGE_VERSION, + .format = PNG_FORMAT_BGRA, + }; + + if (not png_image_begin_read_from_memory(&png_ref, buffer.data(), buffer.size())) + { + png_image_free(&png_ref); + continue; + } + + // Keep the largest icon only + if (png_ref.width * png_ref.height < width * height) + continue; + + pixels.resize(PNG_IMAGE_SIZE(png_ref)); + + if (!png_image_finish_read(&png_ref, nullptr, pixels.data(), 0, nullptr)) + { + png_image_free(&png_ref); + continue; + } + + // PNG read successfully: keep it until we find a better one + width = png_ref.width; + height = png_ref.height; + png = std::move(buffer); + + png_image_free(&png_ref); + } + + return png; +} + std::unordered_map> icon_cache; } // namespace @@ -561,7 +624,7 @@ const std::vector & wivrn::load_icon(const std::filesystem::path & fi else if (filename.extension() == ".zip") { // Steam icon (Linux) - // TODO + icon = load_zip(filename, size); } else { diff --git a/common/utils/steam_app_info.cpp b/common/utils/steam_app_info.cpp index 9e8e69dd..168240a1 100644 --- a/common/utils/steam_app_info.cpp +++ b/common/utils/steam_app_info.cpp @@ -18,6 +18,7 @@ #include "steam_app_info.h" #include +#include #include #include #include @@ -89,6 +90,8 @@ void read_vdf(wivrn::steam_app_info::info & info, const std::string & prefix, st while (type != 8) { std::string name{string_table.at(read(bindata))}; + for (char & c: name) + c = std::tolower(c); // https://github.com/ValveResourceFormat/ValveKeyValue/blob/master/ValveKeyValue/ValveKeyValue/KeyValues1/KV1BinaryNodeType.cs switch (type) From 8dcd14b168df76e0c5e3625f36ac1a3b294534f7 Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Sat, 9 Aug 2025 15:09:18 +0200 Subject: [PATCH 23/85] Unbreak CI --- .github/workflows/Build.yml | 8 ++++---- flake.nix | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index cbc1e2af..8e1cf148 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -33,7 +33,7 @@ jobs: - name: Install dependencies run: > - sudo apt-get update && sudo apt-get install libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev libboost-all-dev librsvg2-bin libssl-dev libnotify-dev librsvg2-dev + sudo apt-get update && sudo apt-get install libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev libboost-all-dev librsvg2-bin libssl-dev libnotify-dev librsvg2-dev libarchive-dev - name: Prepare Vulkan SDK uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944 with: @@ -87,7 +87,7 @@ jobs: - name: Install dependencies run: > - apt-get update && apt-get install --yes libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev qt6-base-dev qt6-tools-dev libcap-dev pkexec libboost-all-dev librsvg2-bin libssl-dev libnotify-dev qt6-declarative-dev extra-cmake-modules libkirigami-dev libkf6i18n-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev jq sudo cmake gcc g++ git qcoro-qt6-dev librsvg2-dev + apt-get update && apt-get install --yes libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev qt6-base-dev qt6-tools-dev libcap-dev pkexec libboost-all-dev librsvg2-bin libssl-dev libnotify-dev qt6-declarative-dev extra-cmake-modules libkirigami-dev libkf6i18n-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev jq sudo cmake gcc g++ git qcoro-qt6-dev librsvg2-dev libarchive-dev # runtime: qml6-module-qtqml-workerscript qml6-module-qtquick-dialogs - name: Prepare Vulkan SDK uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944 @@ -192,7 +192,7 @@ jobs: - name: install server dependencies run: > - sudo apt-get update && sudo apt-get install libavahi-glib-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev qt6-base-dev qt6-tools-dev libcap-dev pkexec libnotify-dev librsvg2-dev + sudo apt-get update && sudo apt-get install libavahi-glib-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev qt6-base-dev qt6-tools-dev libcap-dev pkexec libnotify-dev librsvg2-dev libarchive-dev - name: Configure CMake run: > @@ -467,7 +467,7 @@ jobs: - name: Install dependencies run: | apt update - apt install --yes libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev qt6-base-dev qt6-tools-dev libcap-dev pkexec libboost-all-dev librsvg2-bin dpkg-dev pkg-config debhelper-compat build-essential lintian cmake libnotify-dev qt6-declarative-dev extra-cmake-modules libkirigami-dev libkf6i18n-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev jq sudo cmake gcc g++ git wget libssl-dev qcoro-qt6-dev librsvg2-dev + apt install --yes libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev qt6-base-dev qt6-tools-dev libcap-dev pkexec libboost-all-dev librsvg2-bin dpkg-dev pkg-config debhelper-compat build-essential lintian cmake libnotify-dev qt6-declarative-dev extra-cmake-modules libkirigami-dev libkf6i18n-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev jq sudo cmake gcc g++ git wget libssl-dev qcoro-qt6-dev librsvg2-dev libarchive-dev - uses: actions/checkout@v4 with: diff --git a/flake.nix b/flake.nix index ed7ac917..6ab65aa9 100644 --- a/flake.nix +++ b/flake.nix @@ -19,6 +19,7 @@ pkgs.librsvg pkgs.libpng + pkgs.libarchive ]; package = pkgs.enableDebugging (pkgs.wivrn.overrideAttrs (finalAttrs: oldAttrs: { From acea81c13f67bf70c9f247eba920e7eb3ec9e289 Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Sat, 9 Aug 2025 15:44:47 +0200 Subject: [PATCH 24/85] Allow dragging with hand tracking in the app list --- client/scenes/lobby_gui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/scenes/lobby_gui.cpp b/client/scenes/lobby_gui.cpp index ee800ae6..bbc61c63 100644 --- a/client/scenes/lobby_gui.cpp +++ b/client/scenes/lobby_gui.cpp @@ -462,7 +462,7 @@ void scenes::lobby::gui_connected(XrTime predicted_display_time) }(); ImGui::PushStyleColor(ImGuiCol_Button, 0); - if (icon(app.name + "##" + app.id, texture, {256, 256}, 0, {icon_width, 0})) + if (icon(app.name + "##" + app.id, texture, {256, 256}, ImGuiButtonFlags_PressedOnClickRelease, {icon_width, 0})) { timestamp_start_application = predicted_display_time; next_scene->start_application(app.id); From 03cfe1c12d4f04cb0dc552d07191be2ddb80979d Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Fri, 8 Aug 2025 23:47:27 +0200 Subject: [PATCH 25/85] Keep the GUI locked to the controller that started repositionning in the lobby --- client/scenes/lobby.cpp | 201 +++++++++++++++++++++++----------------- client/scenes/lobby.h | 8 +- 2 files changed, 123 insertions(+), 86 deletions(-) diff --git a/client/scenes/lobby.cpp b/client/scenes/lobby.cpp index ec3f7b74..98aaa0a7 100644 --- a/client/scenes/lobby.cpp +++ b/client/scenes/lobby.cpp @@ -383,9 +383,18 @@ void scenes::lobby::connect(const configuration::server_data & data) data.manual); } -std::optional scenes::lobby::check_recenter_gesture(const std::array & joints) +std::optional scenes::lobby::check_recenter_gesture(xr::spaces space, const std::optional> & joints) { - const auto & palm = joints[XR_HAND_JOINT_PALM_EXT].first; + if (recentering_context and std::get<0>(*recentering_context) != space) + return std::nullopt; + + if (not joints) + { + recentering_context.reset(); + return std::nullopt; + } + + const auto & palm = (*joints)[XR_HAND_JOINT_PALM_EXT].first; const auto & o = palm.pose.orientation; const auto & p = palm.pose.position; glm::quat q{o.w, o.x, o.y, o.z}; @@ -393,102 +402,130 @@ std::optional scenes::lobby::check_recenter_gesture(const std::array< if (glm::dot(q * glm::vec3(0, 1, 0), glm::vec3(0, -1, 0)) > constants::lobby::recenter_cosangle_min) { + recentering_context.emplace(space, glm::vec3{}, 0); return v + glm::vec3(0, constants::lobby::recenter_distance_up, 0) + q * glm::vec3(0, 0, -constants::lobby::recenter_distance_front); } + recentering_context.reset(); return std::nullopt; } std::optional scenes::lobby::check_recenter_action(XrTime predicted_display_time, glm::vec3 head_position) { - std::optional> aim; - glm::vec3 offset_position; - glm::quat offset_orientation; + xr::spaces controller; + glm::vec3 recenter_position; + float recenter_distance; - if (application::read_action_bool(recenter_left_action).value_or(std::pair{0, false}).second) + if (recentering_context) { - 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) + controller = std::get<0>(*recentering_context); + bool state; + switch (controller) { - // First frame where the recenter action is active - imgui_context::controller_state state{ - .active = true, - .aim_position = aim->first, - .aim_orientation = aim->second, - }; + case xr::spaces::aim_left: + state = application::read_action_bool(recenter_left_action).value_or(std::pair{0, false}).second; + break; - imgui_ctx->compute_pointer_position(state); + case xr::spaces::aim_right: + state = application::read_action_bool(recenter_right_action).value_or(std::pair{0, false}).second; + break; - if (state.pointer_position) // TODO: check that the pointer is inside an imgui window - { - auto M = glm::mat3_cast(imgui_ctx->layers()[0].orientation); + default: + return std::nullopt; + } - // Pointer position in world - glm::vec3 world_pointer_position = imgui_ctx->rw_from_vp(*state.pointer_position); + if (not state) + { + recentering_context.reset(); + return std::nullopt; + } + } + else if (auto state = application::read_action_bool(recenter_left_action); state and state->second) + controller = xr::spaces::aim_left; + else if (auto state = application::read_action_bool(recenter_right_action); state and state->second) + controller = xr::spaces::aim_right; + else + return std::nullopt; - // Pointer position in GUI - gui_recenter_position = glm::transpose(M) * (world_pointer_position - imgui_ctx->layers()[0].position); - gui_recenter_distance = glm::length(state.aim_position - world_pointer_position); - } - else - { - gui_recenter_position = glm::vec3(0, 0, 0); - gui_recenter_distance = constants::lobby::recenter_action_distance; - } + auto aim = application::locate_controller(application::space(controller), application::space(xr::spaces::world), predicted_display_time); + + if (not aim) + { + // The controller cannot be located + recentering_context.reset(); + return std::nullopt; + } + + // Handle controller offset + auto [offset_position, offset_orientation] = input->offset[controller]; + aim->first = aim->first + glm::mat3_cast(aim->second * offset_orientation) * offset_position; + aim->second = aim->second * offset_orientation; + + if (not recentering_context) + { + // First frame of recentering + imgui_context::controller_state state{ + .active = true, + .aim_position = aim->first, + .aim_orientation = aim->second, + }; + + imgui_ctx->compute_pointer_position(state); + + if (state.pointer_position) // TODO: check that the pointer is inside an imgui window + { + auto M = glm::mat3_cast(imgui_ctx->layers()[0].orientation); + + // Pointer position in world + glm::vec3 world_pointer_position = imgui_ctx->rw_from_vp(*state.pointer_position); + + // Pointer position in GUI + recenter_position = glm::transpose(M) * (world_pointer_position - imgui_ctx->layers()[0].position); + recenter_distance = glm::length(state.aim_position - world_pointer_position); } else { - // Subsequent frames: find the GUI position that gives the correct world pointer position - glm::vec3 controller_direction = -glm::column(glm::mat3_cast(aim->second), 2); - glm::vec3 wanted_world_pointer_position = aim->first + controller_direction * *gui_recenter_distance; - - // I'm sure there's an analytical solution but I can't be bothered to write it so - // let's use a gradient descent instead - auto f = [&](glm::vec3 new_gui_position) { - auto q = compute_gui_orientation(head_position, new_gui_position); - auto M = glm::mat3_cast(q); // plane-to-world transform - - glm::vec3 world_pointer_position = new_gui_position + M * *gui_recenter_position; - - return world_pointer_position - wanted_world_pointer_position; - }; - - // One step is usually enough, the solution will continuously improve in the next frames - glm::vec3 gui_position = imgui_ctx->layers()[0].position; - float eps = 0.01; - glm::vec3 obj = f(gui_position); - glm::vec3 obj_dx = (f(gui_position + glm::vec3(eps, 0, 0)) - obj) / eps; - glm::vec3 obj_dy = (f(gui_position + glm::vec3(0, eps, 0)) - obj) / eps; - glm::vec3 obj_dz = (f(gui_position + glm::vec3(0, 0, eps)) - obj) / eps; - - glm::mat3 jacobian{obj_dx, obj_dy, obj_dz}; - - gui_position -= glm::inverse(jacobian) * obj; - - return gui_position; + // Use the center of the GUI if the controller points outside of the GUI + recenter_position = glm::vec3(0, 0, 0); + recenter_distance = constants::lobby::recenter_action_distance; } + + recentering_context.emplace(controller, recenter_position, recenter_distance); + return std::nullopt; } else { - gui_recenter_position.reset(); - } + // Subsequent frames: find the GUI position that gives the correct world pointer position + std::tie(controller, recenter_position, recenter_distance) = *recentering_context; - return std::nullopt; + glm::vec3 controller_direction = -glm::column(glm::mat3_cast(aim->second), 2); + glm::vec3 wanted_world_pointer_position = aim->first + controller_direction * recenter_distance; + + // I'm sure there's an analytical solution but I can't be bothered to write it so + // let's use a gradient descent instead + auto f = [&](glm::vec3 new_gui_position) { + auto q = compute_gui_orientation(head_position, new_gui_position); + auto M = glm::mat3_cast(q); // plane-to-world transform + + glm::vec3 world_pointer_position = new_gui_position + M * recenter_position; + + return world_pointer_position - wanted_world_pointer_position; + }; + + // One step is usually enough, the solution will continuously improve in the next frames + glm::vec3 gui_position = imgui_ctx->layers()[0].position; + float eps = 0.01; + glm::vec3 obj = f(gui_position); + glm::vec3 obj_dx = (f(gui_position + glm::vec3(eps, 0, 0)) - obj) / eps; + glm::vec3 obj_dy = (f(gui_position + glm::vec3(0, eps, 0)) - obj) / eps; + glm::vec3 obj_dz = (f(gui_position + glm::vec3(0, 0, eps)) - obj) / eps; + + glm::mat3 jacobian{obj_dx, obj_dy, obj_dz}; + + gui_position -= glm::inverse(jacobian) * obj; + + return gui_position; + } } std::optional scenes::lobby::check_recenter_gui(glm::vec3 head_position, glm::quat head_orientation) @@ -620,18 +657,16 @@ void scenes::lobby::render(const XrFrameState & frame_state) 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 and xr::hand_tracker::check_flags(*right, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0)) - { hide_right_controller = true; - if (!new_gui_position) - new_gui_position = check_recenter_gesture(*right); - } + + if (not new_gui_position) + new_gui_position = check_recenter_gesture(xr::spaces::palm_left, left); + + if (not new_gui_position) + new_gui_position = check_recenter_gesture(xr::spaces::palm_right, right); } if (head_position && new_gui_position) diff --git a/client/scenes/lobby.h b/client/scenes/lobby.h index ca4755b1..54d092d3 100644 --- a/client/scenes/lobby.h +++ b/client/scenes/lobby.h @@ -95,8 +95,10 @@ class lobby : public scene_impl XrAction recenter_left_action = XR_NULL_HANDLE; XrAction recenter_right_action = XR_NULL_HANDLE; - std::optional gui_recenter_position; - std::optional gui_recenter_distance; + // std::optional gui_recenter_position; + // std::optional gui_recenter_distance; + // Which controller is used for recentering, position of the pointed point in the GUI, in GUI axes, and distance between the controller and the pointed point during recentering + std::optional> recentering_context; bool recenter_gui = true; void move_gui(glm::vec3 head_position, glm::vec3 new_gui_position); @@ -154,7 +156,7 @@ class lobby : public scene_impl void connect(const configuration::server_data & data); std::unique_ptr connect_to_session(wivrn_discover::service service, bool manual_connection); - std::optional check_recenter_gesture(const std::array & joints); + std::optional check_recenter_gesture(xr::spaces space, const std::optional> & joints); std::optional check_recenter_action(XrTime predicted_display_time, glm::vec3 head_position); std::optional check_recenter_gui(glm::vec3 head_position, glm::quat head_orientation); From 5ccc725ef73aa6b2bda6093a3d0b51f5b574c13d Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sat, 9 Aug 2025 22:47:00 +0200 Subject: [PATCH 26/85] Hide Steam launch options in wizard if empty --- dashboard/qml/WizardPage.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/dashboard/qml/WizardPage.qml b/dashboard/qml/WizardPage.qml index 76a31289..5fb9abfb 100644 --- a/dashboard/qml/WizardPage.qml +++ b/dashboard/qml/WizardPage.qml @@ -290,6 +290,7 @@ Kirigami.ScrollablePage { SelectGame {} SteamLaunchOptions { + visible: WivrnServer.steamCommand != "" Layout.topMargin: 2 * Kirigami.Units.largeSpacing } From e603e3022926bd7e6cea42a6ad796faa8935b59e Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sun, 10 Aug 2025 10:21:48 +0200 Subject: [PATCH 27/85] Reduce flatpak permissions --- flatpak/io.github.wivrn.wivrn.yml.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flatpak/io.github.wivrn.wivrn.yml.in b/flatpak/io.github.wivrn.wivrn.yml.in index 5eb682b4..4743a197 100644 --- a/flatpak/io.github.wivrn.wivrn.yml.in +++ b/flatpak/io.github.wivrn.wivrn.yml.in @@ -25,7 +25,8 @@ finish-args: - --system-talk-name=org.freedesktop.hostname1 # List applications from $XDG_DATA_DIRS - --filesystem=host-os:ro - - --filesystem=xdg-data:ro + - --filesystem=xdg-data/applications:ro + - --filesystem=xdg-data/Steam:ro # List flatpak Steam games - --filesystem=~/.var/app/com.valvesoftware.Steam:ro # Pipewire From e744a91488c978053339e34d918909d9d293c22a Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sat, 9 Aug 2025 16:46:14 +0200 Subject: [PATCH 28/85] prepare 25.8 release --- dashboard/io.github.wivrn.wivrn.metainfo.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dashboard/io.github.wivrn.wivrn.metainfo.xml b/dashboard/io.github.wivrn.wivrn.metainfo.xml index f7691a9f..8ea3e1be 100644 --- a/dashboard/io.github.wivrn.wivrn.metainfo.xml +++ b/dashboard/io.github.wivrn.wivrn.metainfo.xml @@ -69,6 +69,20 @@ + + https://github.com/WiVRn/WiVRn/releases/tag/v25.8 + +
      +
    • Add a screen to launch applications when the headset connects
    • +
    • Add a screen with many options during stream, which can be summoned by pressing both thumbsticks
    • +
    • Add XR_EXT_user_presence and XR_EXT_hand_interaction OpenXR extensions
    • +
    • Fix vulkan video encode and performances issues with multiple nvenc encoders on NVIDIA GPUs
    • +
    • Support 10-bit encoding on VAAPI for H.265 and AV1 codecs
    • +
    • Xrizer is now the default OpenVR compatibility layer (may be overriden by distribution packages)
    • +
    • Added Slovak and Turkish translations
    • +
    +
    +
    https://github.com/WiVRn/WiVRn/releases/tag/v25.6.1 From 869911fcd50c91f28cf781c5d982b718623ff52f Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sun, 10 Aug 2025 14:19:01 +0200 Subject: [PATCH 29/85] pythonize check_messages (merged into check_po) --- .github/workflows/Locales.yml | 2 +- tools/check_messages.sh | 56 --------------- tools/check_po.py | 124 ++++++++++++++++++++++++---------- 3 files changed, 90 insertions(+), 92 deletions(-) delete mode 100755 tools/check_messages.sh diff --git a/.github/workflows/Locales.yml b/.github/workflows/Locales.yml index 1cefef9b..42fa903b 100644 --- a/.github/workflows/Locales.yml +++ b/.github/workflows/Locales.yml @@ -15,4 +15,4 @@ jobs: run: | qtchooser -install qt6 $(which qmake6) export QT_SELECT=qt6 - tools/check_messages.sh + tools/check_po.py diff --git a/tools/check_messages.sh b/tools/check_messages.sh deleted file mode 100755 index 73917740..00000000 --- a/tools/check_messages.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -cd $(dirname $0)/.. - -WIVRN_CLIENT_POT=$(mktemp) -WIVRN_DASHBOARD_POT=$(mktemp) - -xgettext \ - --c++ --from-code=UTF-8 \ - --keyword=_:1,1t \ - --keyword=_S:1,1t \ - --keyword=_cS:1c,2,2t \ - --keyword=_F:1,1t \ - --output=$WIVRN_CLIENT_POT \ - --package-name=WiVRn \ - $(find client/ -name "*.cpp" | sort) - -xgettext \ - --c++ --kde --from-code=UTF-8 \ - --keyword=i18n:1 \ - --keyword=i18nc:1c,2 \ - --keyword=i18np:1,2 \ - --keyword=i18ncp:1c,2,3 \ - --output=$WIVRN_DASHBOARD_POT \ - --package-name=WiVRn-dashboard \ - $(find dashboard/ -name "*.qml" -o -name "*.cpp" | sort) - -sed -i 's/charset=CHARSET/charset=UTF-8/g' $WIVRN_CLIENT_POT $WIVRN_DASHBOARD_POT - -RC=0 - -for i in locale/* -do - if [ -f $i/wivrn.po ] - then - tools/check_po.py $WIVRN_CLIENT_POT $i/wivrn.po $(basename $i) - if [ $? != 0 ] - then - RC=1 - fi - fi - - if [ -f $i/wivrn-dashboard.po ] - then - tools/check_po.py $WIVRN_DASHBOARD_POT $i/wivrn-dashboard.po $(basename $i) - - if [ $? != 0 ] - then - RC=1 - fi - fi -done - -rm $WIVRN_CLIENT_POT $WIVRN_DASHBOARD_POT - -exit $RC diff --git a/tools/check_po.py b/tools/check_po.py index 91f6f2e4..118243d9 100755 --- a/tools/check_po.py +++ b/tools/check_po.py @@ -3,49 +3,103 @@ import sys import polib import argparse +import os import pathlib +import subprocess +import tempfile -parser = argparse.ArgumentParser( - prog='check_po.py', - description='Check that all strings are translated in a .po file') +def list_files(base: str, exts: str|list[str]): + if type(exts) == str: + exts = [exts] + for root, dirs, files in os.walk(base): + for f in files: + for ext in exts: + if f.endswith(ext): + yield os.path.join(root, f) -parser.add_argument('ref', type=pathlib.Path) -parser.add_argument('file', type=pathlib.Path) -parser.add_argument('lang', type=str) +def flag(lang: str): + # Map language code to a country flag + countries = { + 'es': 'es', + 'fr': 'fr', + 'it': 'it', + 'ja': 'jp', + 'zh_TW': 'tw', + 'pt_BR': 'br' + } -args = parser.parse_args() + country = countries.get(lang, lang) -po_ref = polib.pofile(args.ref) + res = '' + for i in country.upper(): + res += chr(ord(i) + ord('🇦') - ord('A')) + return res -po_file = polib.pofile(args.file) -entries = [i.msgid for i in po_file.translated_entries()] +if __name__ == "__main__": + root = os.path.dirname(os.path.dirname(__file__)) + locale_dir = os.path.join(root, "locale") + cwd = os.getcwd() -# Map language code to a country flag -countries = { - 'es': 'es', - 'fr': 'fr', - 'it': 'it', - 'ja': 'jp', - 'zh_TW': 'tw', - 'pt_BR': 'br' -} + parser = argparse.ArgumentParser( + prog='check_po.py', + description='Check that all strings are translated in a .po file') -if args.lang in countries: - country = countries[args.lang] -else: - country = args.lang + parser.add_argument('lang', type=str, nargs="*") -flag = '' -for i in country.upper(): - flag += chr(ord(i) + ord('🇦') - ord('A')) + args = parser.parse_args() -missing = 0 -for i in po_ref: - if not i.obsolete: - if not i.msgid in entries: - missing = missing + 1 - print(f"::notice file={args.file}::{flag} Translation for {repr(i.msgid)} is missing") + if len(args.lang) == 0: + for d in sorted(os.listdir(locale_dir)): + if os.path.isdir(os.path.join(locale_dir, d)): + args.lang.append(d) -if missing > 0: - print(f"::warning file={args.file}::{flag} {missing} translations missing") - sys.exit(1) + with tempfile.TemporaryDirectory() as tmpdir: + client_pot = os.path.join(tmpdir, "client.pot") + dashboard_pot = os.path.join(tmpdir, "dashboard.pot") + + subprocess.check_call( + ["xgettext", + "--c++", "--from-code=UTF-8", + "--keyword=_:1,1t", + "--keyword=_S:1,1t", + "--keyword=_cS:1c,2,2t", + "--keyword=_F:1,1t", + "--output", client_pot, + "--package-name=WiVRn", + ] + sorted(list_files(os.path.join(root, "client"), ".cpp")) + ) + + subprocess.check_call( + ["xgettext", + "--c++", "--kde", "--from-code=UTF-8", + "--keyword=i18n:1", + "--keyword=i18nc:1c,2", + "--keyword=i18np:1,2", + "--keyword=i18ncp:1c,2,3", + "--output", dashboard_pot, + "--package-name=WiVRn-dashboard", + ] + sorted(list_files(os.path.join(root, "dashboard"), [".cpp", ".qml"])) + ) + + client_ref = polib.pofile(client_pot) + dashboard_ref = polib.pofile(dashboard_pot) + + for lang in args.lang: + + for po_ref, po in ((client_ref, os.path.join(locale_dir, lang, "wivrn.po")), + (dashboard_ref, os.path.join(locale_dir, lang, "wivrn-dashboard.po"))): + if not os.path.exists(po): + continue + po_file = polib.pofile(po) + po = os.path.relpath(po, cwd) + entries = [i.msgid for i in po_file.translated_entries()] + + missing = 0 + for i in po_ref: + if not i.obsolete: + if not i.msgid in entries: + missing = missing + 1 + print(f"::notice file={po}::{flag(lang)} Translation for {repr(i.msgid)} is missing") + + if missing > 0: + print(f"::warning file={po}::{flag(lang)} {missing} translations missing") From 810c9bd2fa8393b139246a3635b01840e13b0688 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sun, 10 Aug 2025 14:59:50 +0200 Subject: [PATCH 30/85] Manage localisation issues from CI --- .github/workflows/Locales.yml | 12 ++++++++---- tools/check_po.py | 29 ++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/.github/workflows/Locales.yml b/.github/workflows/Locales.yml index 42fa903b..722586f6 100644 --- a/.github/workflows/Locales.yml +++ b/.github/workflows/Locales.yml @@ -9,10 +9,14 @@ jobs: - uses: actions/checkout@v4 - name: Install dependencies - run: sudo apt-get update && sudo apt-get install gettext qt6-base-dev qt6-tools-dev qt6-l10n-tools qtchooser python3-polib + run: | + sudo apt-get update && sudo apt-get install gettext + pip install polib PyGithub - name: Check that .po files are up to date run: | - qtchooser -install qt6 $(which qmake6) - export QT_SELECT=qt6 - tools/check_po.py + if [[ "${{github.ref}}" == 'refs/heads/master' ]] ; then + tools/check_po.py --manage-issues --github-repository "${{ github.repository }}" --github-token "${{ github.token }}" + else + tools/check_po.py + fi diff --git a/tools/check_po.py b/tools/check_po.py index 118243d9..c311b751 100755 --- a/tools/check_po.py +++ b/tools/check_po.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import sys import polib import argparse import os @@ -35,6 +34,9 @@ def flag(lang: str): res += chr(ord(i) + ord('🇦') - ord('A')) return res +ISSUE_LABEL="localisation" +ISSUE_TITLE="[{lang}] Missing translations" + if __name__ == "__main__": root = os.path.dirname(os.path.dirname(__file__)) locale_dir = os.path.join(root, "locale") @@ -45,6 +47,9 @@ if __name__ == "__main__": description='Check that all strings are translated in a .po file') parser.add_argument('lang', type=str, nargs="*") + parser.add_argument('--github-repository') + parser.add_argument('--github-token') + parser.add_argument('--manage-issues', action="store_true") args = parser.parse_args() @@ -53,6 +58,11 @@ if __name__ == "__main__": if os.path.isdir(os.path.join(locale_dir, d)): args.lang.append(d) + if args.manage_issues: + from github import Github, Auth + gh = Github(auth=Auth.Token(args.github_token)) + repo = gh.get_repo(args.github_repository) + with tempfile.TemporaryDirectory() as tmpdir: client_pot = os.path.join(tmpdir, "client.pot") dashboard_pot = os.path.join(tmpdir, "dashboard.pot") @@ -103,3 +113,20 @@ if __name__ == "__main__": if missing > 0: print(f"::warning file={po}::{flag(lang)} {missing} translations missing") + + if args.manage_issues: + issues = [i for i in repo.get_issues(state="all", labels = [ISSUE_LABEL]) if i.title == ISSUE_TITLE.format(lang=lang)] + if not issues: + issue = repo.create_issue( + title=ISSUE_TITLE.format(lang=lang), + labels = [ISSUE_LABEL] + ) + else: + for issue in issues: + if issue.state != "open": + issue.edit(state = "open") + else: + if args.manage_issues: + issues = [i for i in repo.get_issues(state="open", labels = [ISSUE_LABEL]) if i.title == ISSUE_TITLE.format(lang=lang)] + for issue in issues: + issue.edit(state = "closed") From 30ceab5b3082cbc545acf8bc8ca4a24279e6f738 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sun, 10 Aug 2025 22:06:59 +0200 Subject: [PATCH 31/85] Forward PATH when starting application in systemd mode --- server/main.cpp | 2 +- server/start_systemd_unit.cpp | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/server/main.cpp b/server/main.cpp index 610ddfba..792bbb8a 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -425,7 +425,7 @@ gboolean headset_connected_success(void *) } catch (std::exception & e) { - std::cerr << "Failed to start application: " << e.what(); + std::cerr << "Failed to start application: " << e.what() << std::endl; } delay_next_try = default_delay_next_try; diff --git a/server/start_systemd_unit.cpp b/server/start_systemd_unit.cpp index 5009f000..258fca49 100644 --- a/server/start_systemd_unit.cpp +++ b/server/start_systemd_unit.cpp @@ -19,6 +19,7 @@ #include "start_systemd_unit.h" #include "systemd_manager.h" #include "systemd_unit.h" +#include "utils/strings.h" #include #include #include @@ -211,11 +212,10 @@ void systemd_units_manager::start_application(const std::vector & a 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); + 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", @@ -224,6 +224,17 @@ void systemd_units_manager::start_application(const std::vector & a &exec_start, 1)); + if (auto path = std::getenv("PATH")) + { + variant_builder pathv(G_VARIANT_TYPE("as")); + for (auto item: utils::split(path, ":")) + g_variant_builder_add(&pathv, "s", item.c_str()); + g_variant_builder_add(&b, + "(sv)", + "ExecSearchPath", + g_variant_new("as", &pathv)); + } + auto properties = b.end(); auto aux = g_variant_new_array(G_VARIANT_TYPE("(sa(sv))"), nullptr, 0); From 93ba9b836753accf3ad0b6ad931be505b14324ce Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sun, 10 Aug 2025 23:01:46 +0200 Subject: [PATCH 32/85] Add required to libarchive and png dependencies --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 540fefd3..a1c2874c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,8 +185,8 @@ endif() if (WIVRN_BUILD_DASHBOARD OR WIVRN_BUILD_SERVER) pkg_check_modules(librsvg-2.0 REQUIRED IMPORTED_TARGET librsvg-2.0) - find_package(LibArchive) - find_package(PNG) + find_package(LibArchive REQUIRED) + find_package(PNG REQUIRED) endif() if (WIVRN_BUILD_DASHBOARD) From e7b218bfb6afb5638adbc7ef1c2d784d0492bcf7 Mon Sep 17 00:00:00 2001 From: BlackCherryCat Date: Mon, 11 Aug 2025 03:52:17 +0200 Subject: [PATCH 33/85] Simplify es locale --- locale/es/wivrn.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/es/wivrn.po b/locale/es/wivrn.po index e5532cce..39f4673a 100644 --- a/locale/es/wivrn.po +++ b/locale/es/wivrn.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: WiVRn 0.15\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-08-04 15:49+0200\n" -"PO-Revision-Date: 2025-08-02 00:41+0200\n" +"PO-Revision-Date: 2025-08-10 17:11+0200\n" "Last-Translator: Álvaro De Quinta \n" "Language-Team: Spanish\n" "Language: es\n" @@ -470,7 +470,7 @@ msgid "" "Press the grip button or put your palm up\n" "to move the main window" msgstr "" -"Pulsa el botón de agarre o pon tu palma apuntando hacia arriba\n" +"Pulsa el botón de agarre o pon tu palma hacia arriba\n" "para mover la ventana principal" #: client/scenes/lobby_gui.cpp:2005 @@ -591,7 +591,7 @@ msgstr "Estadísticas" #: client/scenes/stream_gui.cpp:802 msgid "Statistics overlay" -msgstr "Superposición de las estadísticas" +msgstr "Superponer estadísticas" #: client/scenes/stream_gui.cpp:805 msgid "Compact view" From 9725ae7fc055ebd08a9bebfa98c61f4cb67dd23e Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 11 Aug 2025 10:02:02 +0200 Subject: [PATCH 34/85] Add an option to disable in-stream GUI --- client/configuration.cpp | 4 ++++ client/configuration.h | 2 ++ client/scenes/lobby_gui.cpp | 7 +++++++ client/scenes/stream.cpp | 7 +++++-- client/scenes/stream_gui.cpp | 2 ++ 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/client/configuration.cpp b/client/configuration.cpp index abe7f15e..ea0ec8d8 100644 --- a/client/configuration.cpp +++ b/client/configuration.cpp @@ -214,6 +214,9 @@ configuration::configuration(xr::system & system) if (auto val = root["resolution_scale"]; val.is_double()) resolution_scale = val.get_double(); + if (auto val = root["enable_stream_gui"]; val.is_bool()) + enable_stream_gui = val.get_bool(); + if (auto val = root["sgsr"]; val.is_object()) parse_sgsr_options(val.get_object()); @@ -365,6 +368,7 @@ void configuration::save() json << ",\"mic_unprocessed_audio\":" << std::boolalpha << mic_unprocessed_audio; json << ",\"fb_lower_body\":" << std::boolalpha << fb_lower_body; json << ",\"fb_hip\":" << std::boolalpha << fb_hip; + json << ",\"enable_stream_gui\":" << std::boolalpha << enable_stream_gui; for (auto & [key, value]: features) json << "," << key << ":" << std::boolalpha << value; json << ",\"virtual_keyboard_layout\":" << json_string(virtual_keyboard_layout); diff --git a/client/configuration.h b/client/configuration.h index 8d34faae..a0f6ecad 100644 --- a/client/configuration.h +++ b/client/configuration.h @@ -56,6 +56,8 @@ public: bool fb_lower_body = false; bool fb_hip = true; + bool enable_stream_gui = true; + // Snapdragon Game Super Resolution struct sgsr_settings { diff --git a/client/scenes/lobby_gui.cpp b/client/scenes/lobby_gui.cpp index bbc61c63..b5a61928 100644 --- a/client/scenes/lobby_gui.cpp +++ b/client/scenes/lobby_gui.cpp @@ -990,6 +990,13 @@ void scenes::lobby::gui_settings() imgui_ctx->tooltip(_("This feature is not supported by your headset")); ImGui::EndDisabled(); + { + ImGui::Checkbox(_S("Enable in-stream window"), &config.enable_stream_gui); + imgui_ctx->vibrate_on_hover(); + if (ImGui::IsItemHovered()) + imgui_ctx->tooltip(_("Enables the configuration window to be shown while the game is streaming.\nIf enabled, the window is activated by pressing both thumbsticks.")); + } + ImGui::PopStyleVar(); // ImGuiStyleVar_ItemSpacing } diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index aa33ba7b..7dd945a3 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -465,8 +465,11 @@ void scenes::stream::on_focused() swapchain_imgui, std::vector{vp}); - plots_toggle_1 = get_action("plots_toggle_1").first; - plots_toggle_2 = get_action("plots_toggle_2").first; + if (application::get_config().enable_stream_gui) + { + 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; diff --git a/client/scenes/stream_gui.cpp b/client/scenes/stream_gui.cpp index 975445a1..1164543f 100644 --- a/client/scenes/stream_gui.cpp +++ b/client/scenes/stream_gui.cpp @@ -615,6 +615,8 @@ static glm::vec4 compute_ray_limits(const XrPosef & pose, float margin = 0) void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicted_display_period) { + if (not(plots_toggle_1 and plots_toggle_2)) + return; bool interactable = true; XrSpace world_space = application::space(xr::spaces::world); auto views = session.locate_views(viewconfig, predicted_display_time, world_space).second; From d2191a354eff5c27d5820f7f442ef73752d8b375 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 11 Aug 2025 14:23:31 +0200 Subject: [PATCH 35/85] Improve issue template Add an installation method entry Recommend file attachments for long entries --- .github/ISSUE_TEMPLATE/bug_report.yml | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index b9417e68..098f36d2 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -36,17 +36,33 @@ body: validations: required: true + - type: input + attributes: + label: Installation method + description: Describe how WiVRn and OpenComposite/xrizer were installed + placeholder: flatpak --user, flatpak, AUR, Gentoo/Guru, built from sources... + - type: textarea attributes: label: Server Config - description: Provide the content of `config.json` for the server. - placeholder: Add the content of config.json here... + description: | + Provide the content of `config.json` for the server. + Located in `${XDG_CONFIG_HOME-${HOME}/.config}/wivrn/config.json` + or `~/.var/app/io.github.wivrn.wivrn/config/wivrn/config.json` for the flatpak version + placeholder: | + { + "encoders": [ + {"codec": "h264"} + ] + } - type: textarea attributes: label: Server Logs description: Provide the `wivrn-server` output. - placeholder: Add the output of the wivrn-server here... + placeholder: | + Add the output of the wivrn-server here. + If more than a few lines, prefer file attachment. - type: dropdown id: gpu @@ -64,7 +80,7 @@ body: attributes: label: Vulkan Info description: Provide the output of `vulkaninfo --summary` command. - placeholder: Add the output of vulkaninfo command here... + placeholder: Attach the output as a file here. - type: dropdown id: hmd @@ -90,4 +106,4 @@ body: attributes: label: ADB Logs description: Provide the output of `adb logcat` command. - placeholder: Add the output of adb logcat command here... + placeholder: Attach the output of adb logcat as a file. From a2e470799e8e9fc45567a84016590692052b93bf Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 11 Aug 2025 14:53:32 +0200 Subject: [PATCH 36/85] Add --version option --- server/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/main.cpp b/server/main.cpp index 792bbb8a..970e8260 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -969,6 +969,7 @@ int main(int argc, char * argv[]) std::string config_file; app.add_option("-f", config_file, "configuration file")->option_text("FILE")->check(CLI::ExistingFile); + auto version_flag = app.add_flag("--version")->description("print version and exit"); auto no_active_runtime = app.add_flag("--no-manage-active-runtime")->description("don't set the active runtime on connection"); auto early_active_runtime = app.add_flag("--early-active-runtime")->description("forcibly manages the active runtime even if no headset present"); auto no_instructions = app.add_flag("--no-instructions")->group(""); @@ -981,6 +982,12 @@ int main(int argc, char * argv[]) CLI11_PARSE(app, argc, argv); + if (*version_flag) + { + std::cout << "WiVRn version " << wivrn::git_version << std::endl; + return 0; + } + if (not config_file.empty()) configuration::set_config_file(config_file); From 461de7c540a94741d7c42ff6619d47c33ff5b990 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 11 Aug 2025 14:58:05 +0200 Subject: [PATCH 37/85] Remove "v" at the beginning of the version --- cmake/GitVersion.cmake | 1 + common/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/cmake/GitVersion.cmake b/cmake/GitVersion.cmake index 431a7520..5732ce39 100644 --- a/cmake/GitVersion.cmake +++ b/cmake/GitVersion.cmake @@ -13,6 +13,7 @@ execute_process( if (GIT_DESC) string(STRIP ${GIT_DESC} GIT_DESC) + string(REGEX REPLACE "^v([0-9])" "\\1" GIT_DESC ${GIT_DESC}) message(STATUS "Setting version to ${GIT_DESC} from git") else() set(GIT_DESC v${CMAKE_PROJECT_VERSION}) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index be306e28..f6b2d36e 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -7,6 +7,7 @@ else() endif() if (GIT_DESC) + string(REGEX REPLACE "^v([0-9])" "\\1" GIT_DESC ${GIT_DESC}) configure_file(version.cpp.in version.cpp) else () add_custom_target(wivrn-version ALL From 5e4edc9857df103a39b9f54cc5edc36d90d49644 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 11 Aug 2025 15:56:18 +0200 Subject: [PATCH 38/85] Fix lang issue closing for no reason --- tools/check_po.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tools/check_po.py b/tools/check_po.py index c311b751..27612948 100755 --- a/tools/check_po.py +++ b/tools/check_po.py @@ -95,7 +95,7 @@ if __name__ == "__main__": dashboard_ref = polib.pofile(dashboard_pot) for lang in args.lang: - + lang_issues = 0 for po_ref, po in ((client_ref, os.path.join(locale_dir, lang, "wivrn.po")), (dashboard_ref, os.path.join(locale_dir, lang, "wivrn-dashboard.po"))): if not os.path.exists(po): @@ -110,23 +110,23 @@ if __name__ == "__main__": if not i.msgid in entries: missing = missing + 1 print(f"::notice file={po}::{flag(lang)} Translation for {repr(i.msgid)} is missing") + lang_issues += missing if missing > 0: print(f"::warning file={po}::{flag(lang)} {missing} translations missing") - if args.manage_issues: - issues = [i for i in repo.get_issues(state="all", labels = [ISSUE_LABEL]) if i.title == ISSUE_TITLE.format(lang=lang)] - if not issues: - issue = repo.create_issue( - title=ISSUE_TITLE.format(lang=lang), - labels = [ISSUE_LABEL] - ) - else: - for issue in issues: - if issue.state != "open": - issue.edit(state = "open") - else: - if args.manage_issues: - issues = [i for i in repo.get_issues(state="open", labels = [ISSUE_LABEL]) if i.title == ISSUE_TITLE.format(lang=lang)] + if args.manage_issues: + issues = [i for i in repo.get_issues(state="all", labels = [ISSUE_LABEL]) if i.title == ISSUE_TITLE.format(lang=lang)] + if lang_issues > 0: + if issues: for issue in issues: - issue.edit(state = "closed") + if issue.state != "open": + issue.edit(state="open") + else: + issue = repo.create_issue( + title=ISSUE_TITLE.format(lang=lang), + labels=[ISSUE_LABEL] + ) + else: + for issue in issues: + issue.edit(state="closed") From c8b8d798d1ae20be2f945246bfb90968fc2b2950 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Tue, 12 Aug 2025 13:42:49 +0200 Subject: [PATCH 39/85] Update fr, it locale --- locale/fr/wivrn.po | 222 ++++++++++++++++++++++++--------------------- locale/it/wivrn.po | 217 +++++++++++++++++++++++--------------------- 2 files changed, 231 insertions(+), 208 deletions(-) diff --git a/locale/fr/wivrn.po b/locale/fr/wivrn.po index 4745f723..c6eaa9d7 100644 --- a/locale/fr/wivrn.po +++ b/locale/fr/wivrn.po @@ -5,15 +5,15 @@ msgid "" msgstr "" "Project-Id-Version: WiVRn 0.15\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-30 09:41+0200\n" -"PO-Revision-Date: 2025-07-30 14:47+0200\n" +"POT-Creation-Date: 2025-08-12 13:35+0200\n" +"PO-Revision-Date: 2025-08-12 13:37+0200\n" "Last-Translator: Guillaume Meunier \n" "Language-Team: French <>\n" "Language: French\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Gtranslator 47.1\n" +"X-Generator: Gtranslator 48.0\n" #: client/scene.cpp:74 msgid "No supported swapchain format" @@ -43,99 +43,99 @@ msgstr "Impossible de se connecter à {} ({}): {}" msgid "Waiting for connection" msgstr "Attente de connexion" -#: client/scenes/lobby_gui.cpp:156 +#: client/scenes/lobby_gui.cpp:230 msgctxt "openxr_post_processing" msgid "Normal" msgstr "Normal" -#: client/scenes/lobby_gui.cpp:159 +#: client/scenes/lobby_gui.cpp:233 msgctxt "openxr_post_processing" msgid "Quality" msgstr "Qualité" -#: client/scenes/lobby_gui.cpp:161 +#: client/scenes/lobby_gui.cpp:235 msgctxt "openxr_post_processing" msgid "Disabled" msgstr "Désactivé" -#: client/scenes/lobby_gui.cpp:169 client/scenes/lobby_gui.cpp:320 -#: client/scenes/stream_gui.cpp:812 +#: client/scenes/lobby_gui.cpp:243 client/scenes/lobby_gui.cpp:400 +#: client/scenes/stream_gui.cpp:814 msgid "Disconnect" msgstr "Déconnecter" -#: client/scenes/lobby_gui.cpp:189 client/scenes/stream_gui.cpp:808 +#: client/scenes/lobby_gui.cpp:264 client/scenes/stream_gui.cpp:810 msgid "Close" msgstr "Fermer" -#: client/scenes/lobby_gui.cpp:195 +#: client/scenes/lobby_gui.cpp:270 msgid "Connection" msgstr "Connexion en cours" -#: client/scenes/lobby_gui.cpp:197 +#: client/scenes/lobby_gui.cpp:272 #, c++-format msgid "Connection to {}" msgstr "Connexion à {}" -#: client/scenes/lobby_gui.cpp:227 +#: client/scenes/lobby_gui.cpp:302 msgid "PIN" msgstr "Code PIN" -#: client/scenes/lobby_gui.cpp:249 +#: client/scenes/lobby_gui.cpp:324 msgid "Input the PIN displayed on the dashboard" msgstr "Entrez le code PIN affiché sur le tableau de bord" -#: client/scenes/lobby_gui.cpp:315 +#: client/scenes/lobby_gui.cpp:395 msgid "Connected to WiVRn server" msgstr "Connecté au serveur WiVRn" -#: client/scenes/lobby_gui.cpp:317 +#: client/scenes/lobby_gui.cpp:397 #, c++-format msgid "Connected to {}" msgstr "Connecté à {}" -#: client/scenes/lobby_gui.cpp:327 +#: client/scenes/lobby_gui.cpp:407 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 +#: client/scenes/lobby_gui.cpp:419 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 +#: client/scenes/lobby_gui.cpp:421 #, 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 +#: client/scenes/lobby_gui.cpp:544 msgid "Name" msgstr "Nom" -#: client/scenes/lobby_gui.cpp:394 +#: client/scenes/lobby_gui.cpp:555 msgid "Address" msgstr "Adresse" -#: client/scenes/lobby_gui.cpp:403 +#: client/scenes/lobby_gui.cpp:564 msgid "Port" msgstr "Port" -#: client/scenes/lobby_gui.cpp:411 +#: client/scenes/lobby_gui.cpp:572 msgid "TCP only" msgstr "TCP seulement" -#: client/scenes/lobby_gui.cpp:418 +#: client/scenes/lobby_gui.cpp:579 msgid "Cancel" msgstr "Annuler" -#: client/scenes/lobby_gui.cpp:432 +#: client/scenes/lobby_gui.cpp:593 msgid "Save" msgstr "Enregistrer" -#: client/scenes/lobby_gui.cpp:485 +#: client/scenes/lobby_gui.cpp:646 msgid "" "Start a WiVRn server on your\n" "local network" @@ -143,32 +143,32 @@ msgstr "" "Démarrez un serveur WiVRn sur\n" "le réseau local" -#: client/scenes/lobby_gui.cpp:517 +#: client/scenes/lobby_gui.cpp:678 msgid "Autoconnect" msgstr "Autoconnexion" -#: client/scenes/lobby_gui.cpp:543 +#: client/scenes/lobby_gui.cpp:704 msgid "Connect" msgstr "Connexion" -#: client/scenes/lobby_gui.cpp:553 client/wivrn_client.cpp:186 +#: client/scenes/lobby_gui.cpp:714 client/wivrn_client.cpp:186 msgid "Incompatible server version" msgstr "Version du serveur incompatible" -#: client/scenes/lobby_gui.cpp:555 +#: client/scenes/lobby_gui.cpp:716 msgid "Server not available" msgstr "Serveur non disponible" -#: client/scenes/lobby_gui.cpp:641 +#: client/scenes/lobby_gui.cpp:802 msgid "Refresh rate" msgstr "Taux de rafraichissement" -#: client/scenes/lobby_gui.cpp:641 client/scenes/lobby_gui.cpp:643 +#: client/scenes/lobby_gui.cpp:802 client/scenes/lobby_gui.cpp:804 msgctxt "automatic refresh rate" msgid "Automatic" msgstr "Automatique" -#: client/scenes/lobby_gui.cpp:650 +#: client/scenes/lobby_gui.cpp:811 msgid "" "Select refresh rate based on measured application performance.\n" "May cause flicker when a change happens." @@ -177,59 +177,59 @@ msgstr "" "des performances mesurées.\n" "Peut causer des clignotements lors du changement de fréquence." -#: client/scenes/lobby_gui.cpp:667 +#: client/scenes/lobby_gui.cpp:828 msgid "Minimum refresh rate" msgstr "Taux minimal" -#: client/scenes/lobby_gui.cpp:690 +#: client/scenes/lobby_gui.cpp:851 msgid "Resolution scale" msgstr "Échelle" -#: client/scenes/lobby_gui.cpp:694 client/scenes/lobby_gui.cpp:933 +#: client/scenes/lobby_gui.cpp:855 client/scenes/lobby_gui.cpp:1101 #, c-format, c++-format msgid "%d%% - {}x{} per eye" msgstr "%d%% - {}x{} par œil" -#: client/scenes/lobby_gui.cpp:705 client/scenes/lobby_gui.cpp:944 +#: client/scenes/lobby_gui.cpp:866 client/scenes/lobby_gui.cpp:1112 #, 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:711 +#: client/scenes/lobby_gui.cpp:872 msgid "Enable microphone" msgstr "Activer le micro" -#: client/scenes/lobby_gui.cpp:720 +#: client/scenes/lobby_gui.cpp:881 msgid "Unprocessed Microphone Audio" msgstr "Utiliser les données brutes du micro" -#: client/scenes/lobby_gui.cpp:726 +#: client/scenes/lobby_gui.cpp:887 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:733 +#: client/scenes/lobby_gui.cpp:894 msgid "Enable hand tracking" msgstr "Activer le suivi des mains" -#: 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 +#: client/scenes/lobby_gui.cpp:900 client/scenes/lobby_gui.cpp:912 +#: client/scenes/lobby_gui.cpp:924 client/scenes/lobby_gui.cpp:940 +#: client/scenes/lobby_gui.cpp:990 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:745 +#: client/scenes/lobby_gui.cpp:906 msgid "Enable eye tracking" msgstr "Activer le suivi des yeux" -#: client/scenes/lobby_gui.cpp:757 +#: client/scenes/lobby_gui.cpp:918 msgid "Enable face tracking" msgstr "Activer le suivi du visage" -#: client/scenes/lobby_gui.cpp:770 +#: client/scenes/lobby_gui.cpp:931 msgid "Enable body tracking" msgstr "Activer le suivi du corps" -#: client/scenes/lobby_gui.cpp:786 +#: client/scenes/lobby_gui.cpp:947 msgid "" "Requires 'Hand and body tracking' to be enabled in the Quest movement " "tracking settings,\n" @@ -240,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:799 +#: client/scenes/lobby_gui.cpp:960 msgid "Enable lower body tracking" msgstr "Activer le suivi du bas du corps" -#: client/scenes/lobby_gui.cpp:805 +#: client/scenes/lobby_gui.cpp:966 msgid "" "Estimate lower body joint positions using Generative Legs\n" "Requires 'Hand and body tracking' to be enabled in the Quest movement " @@ -255,11 +255,11 @@ msgstr "" "paramètres\n" "de suivi de mouvements du casque." -#: client/scenes/lobby_gui.cpp:808 +#: client/scenes/lobby_gui.cpp:969 msgid "Enable hip tracking" msgstr "Activer le suivi des hanches" -#: client/scenes/lobby_gui.cpp:814 +#: client/scenes/lobby_gui.cpp:975 msgid "" "Only takes affect with lower body tracking enabled\n" "May be desired when using another source of hip tracking" @@ -267,19 +267,33 @@ 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:822 +#: client/scenes/lobby_gui.cpp:983 msgid "Enable video passthrough in lobby" msgstr "Activer la vue réelle dans l'accueil" -#: client/scenes/lobby_gui.cpp:843 client/scenes/stream_gui.cpp:434 +#: client/scenes/lobby_gui.cpp:994 +msgid "Enable in-stream window" +msgstr "Activer la fenêtre WiVRn lors de la transmission" + +#: client/scenes/lobby_gui.cpp:997 +msgid "" +"Enables the configuration window to be shown while the game is streaming.\n" +"If enabled, the window is activated by pressing both thumbsticks." +msgstr "" +"Permet à la fenêtre de configuration d'être affichée pendant la transmission " +"du jeu.\n" +"Lorsque activé, la fenêtre peut être affichée en appuyant sur les deux " +"sticks." + +#: client/scenes/lobby_gui.cpp:1011 client/scenes/stream_gui.cpp:434 msgid "OpenXR post-processing" msgstr "Post-traitement OpenXR" -#: client/scenes/lobby_gui.cpp:847 client/scenes/stream_gui.cpp:438 +#: client/scenes/lobby_gui.cpp:1015 client/scenes/stream_gui.cpp:438 msgid "Supersampling" msgstr "Suréchantillonnage" -#: client/scenes/lobby_gui.cpp:867 client/scenes/stream_gui.cpp:459 +#: client/scenes/lobby_gui.cpp:1035 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" @@ -287,11 +301,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:872 client/scenes/stream_gui.cpp:464 +#: client/scenes/lobby_gui.cpp:1040 client/scenes/stream_gui.cpp:464 msgid "Sharpening" msgstr "Affinage de netteté" -#: client/scenes/lobby_gui.cpp:892 client/scenes/stream_gui.cpp:485 +#: client/scenes/lobby_gui.cpp:1060 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" @@ -299,11 +313,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:901 +#: client/scenes/lobby_gui.cpp:1069 msgid "Enable Snapdragon Game Super Resolution" msgstr "Activer Snapdragon Game Super Resolution" -#: client/scenes/lobby_gui.cpp:909 +#: client/scenes/lobby_gui.cpp:1077 msgid "" "On this headset, this setting has been fully superseded by the native " "Sharpening setting above.\n" @@ -313,157 +327,157 @@ msgstr "" "de netteté ci-dessus.\n" "N’activer que si vous savez ce que vous faites." -#: client/scenes/lobby_gui.cpp:911 +#: client/scenes/lobby_gui.cpp:1079 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:929 +#: client/scenes/lobby_gui.cpp:1097 msgid "Upscaling factor" msgstr "Échelle" -#: client/scenes/lobby_gui.cpp:948 +#: client/scenes/lobby_gui.cpp:1116 msgid "Use edge direction" msgstr "Utiliser la direction de contours" -#: client/scenes/lobby_gui.cpp:954 +#: client/scenes/lobby_gui.cpp:1122 msgid "Adds an additional performance cost" msgstr "Ajoute un coût additionnel en performances" -#: client/scenes/lobby_gui.cpp:959 +#: client/scenes/lobby_gui.cpp:1127 msgid "Edge threshold" msgstr "Seuil de contour" -#: client/scenes/lobby_gui.cpp:966 client/scenes/lobby_gui.cpp:975 +#: client/scenes/lobby_gui.cpp:1134 client/scenes/lobby_gui.cpp:1143 #, c++-format msgid "Recommended: {:.1f}" msgstr "Recommandé : {:.1f}" -#: client/scenes/lobby_gui.cpp:969 +#: client/scenes/lobby_gui.cpp:1137 msgid "Edge sharpness" msgstr "Netteté de contour" -#: client/scenes/lobby_gui.cpp:1071 client/scenes/lobby_gui.cpp:1079 +#: client/scenes/lobby_gui.cpp:1239 client/scenes/lobby_gui.cpp:1247 #: client/scenes/stream_gui.cpp:222 client/scenes/stream_gui.cpp:418 msgid "CPU time" msgstr "Temps CPU" -#: client/scenes/lobby_gui.cpp:1075 +#: client/scenes/lobby_gui.cpp:1243 msgid "CPU time [ms]" msgstr "Temps CPU [ms]" -#: client/scenes/lobby_gui.cpp:1085 client/scenes/lobby_gui.cpp:1093 +#: client/scenes/lobby_gui.cpp:1253 client/scenes/lobby_gui.cpp:1261 #: client/scenes/stream_gui.cpp:224 client/scenes/stream_gui.cpp:419 msgid "GPU time" msgstr "Temps GPU" -#: client/scenes/lobby_gui.cpp:1089 +#: client/scenes/lobby_gui.cpp:1257 msgid "GPU time [ms]" msgstr "Temps GPU [ms]" -#: client/scenes/lobby_gui.cpp:1132 +#: client/scenes/lobby_gui.cpp:1300 msgid "Enable the microphone?" msgstr "Activer le micro ?" -#: client/scenes/lobby_gui.cpp:1137 +#: client/scenes/lobby_gui.cpp:1305 msgid "Enable eye tracking?" msgstr "Activer le suivi des yeux ?" -#: client/scenes/lobby_gui.cpp:1142 +#: client/scenes/lobby_gui.cpp:1310 msgid "Enable face tracking?" msgstr "Activer le suivi du visage ?" -#: client/scenes/lobby_gui.cpp:1147 +#: client/scenes/lobby_gui.cpp:1315 msgid "Enable body tracking?" msgstr "Activer le suivi du corps ?" -#: client/scenes/lobby_gui.cpp:1155 +#: client/scenes/lobby_gui.cpp:1323 msgid "Welcome to WiVRn" msgstr "Bienvenue sur WiVRn" -#: client/scenes/lobby_gui.cpp:1179 +#: client/scenes/lobby_gui.cpp:1347 msgid "Yes" msgstr "Oui" -#: client/scenes/lobby_gui.cpp:1186 +#: client/scenes/lobby_gui.cpp:1354 msgid "No" msgstr "Non" -#: client/scenes/lobby_gui.cpp:1205 client/scenes/lobby_gui.cpp:1844 +#: client/scenes/lobby_gui.cpp:1373 client/scenes/lobby_gui.cpp:2012 msgid "Licenses" msgstr "Licences" -#: client/scenes/lobby_gui.cpp:1519 +#: client/scenes/lobby_gui.cpp:1687 msgid "Microphone is enabled" msgstr "Le micro est activé" -#: client/scenes/lobby_gui.cpp:1520 +#: client/scenes/lobby_gui.cpp:1688 msgid "Microphone is disabled" msgstr "Le micro est désactivé" -#: client/scenes/lobby_gui.cpp:1529 +#: client/scenes/lobby_gui.cpp:1697 msgid "Hand tracking is enabled" msgstr "Le suivi des mains est activé" -#: client/scenes/lobby_gui.cpp:1530 +#: client/scenes/lobby_gui.cpp:1698 msgid "Hand tracking is disabled" msgstr "Le suivi des mains est désactivé" -#: client/scenes/lobby_gui.cpp:1539 +#: client/scenes/lobby_gui.cpp:1707 msgid "Eye tracking is enabled" msgstr "Le suivi des yeux est activé" -#: client/scenes/lobby_gui.cpp:1540 +#: client/scenes/lobby_gui.cpp:1708 msgid "Eye tracking is disabled" msgstr "Le suivi des yeux est désactivé" -#: client/scenes/lobby_gui.cpp:1553 +#: client/scenes/lobby_gui.cpp:1721 msgid "Face tracking is enabled" msgstr "Le suivi du visage est activé" -#: client/scenes/lobby_gui.cpp:1554 +#: client/scenes/lobby_gui.cpp:1722 msgid "Face tracking is disabled" msgstr "Le suivi du visage est désactivé" -#: client/scenes/lobby_gui.cpp:1564 +#: client/scenes/lobby_gui.cpp:1732 msgid "Body tracking is enabled" msgstr "Le suivi du corps est activé" -#: client/scenes/lobby_gui.cpp:1565 +#: client/scenes/lobby_gui.cpp:1733 msgid "Body tracking is disabled" msgstr "Le suivi du corps est désactivé" -#: client/scenes/lobby_gui.cpp:1581 +#: client/scenes/lobby_gui.cpp:1749 msgid "Add server" msgstr "Ajouter un serveur" -#: client/scenes/lobby_gui.cpp:1826 +#: client/scenes/lobby_gui.cpp:1994 msgid "Server list" msgstr "Serveurs" -#: client/scenes/lobby_gui.cpp:1829 client/scenes/stream_gui.cpp:796 +#: client/scenes/lobby_gui.cpp:1997 client/scenes/stream_gui.cpp:798 msgid "Settings" msgstr "Paramètres" -#: client/scenes/lobby_gui.cpp:1832 +#: client/scenes/lobby_gui.cpp:2000 msgid "Post-processing" msgstr "Post-traitement" -#: client/scenes/lobby_gui.cpp:1836 +#: client/scenes/lobby_gui.cpp:2004 msgid "Debug" msgstr "Debug" -#: client/scenes/lobby_gui.cpp:1841 +#: client/scenes/lobby_gui.cpp:2009 msgid "About" msgstr "À propos" -#: client/scenes/lobby_gui.cpp:1847 +#: client/scenes/lobby_gui.cpp:2015 msgid "Exit" msgstr "Quitter" -#: client/scenes/lobby_gui.cpp:1864 +#: client/scenes/lobby_gui.cpp:2032 msgid "" "Press the grip button or put your palm up\n" "to move the main window" @@ -471,10 +485,9 @@ msgstr "" "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:1866 +#: client/scenes/lobby_gui.cpp:2034 msgid "Press the grip button to move the main window" -msgstr "" -"Serrez la gâchette latérale pour bouger la fenêtre principale" +msgstr "Serrez la gâchette latérale pour bouger la fenêtre principale" #: client/scenes/stream_gui.cpp:224 msgid "Reproject" @@ -540,10 +553,9 @@ 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 la fenêtre" +msgstr "Serrez la gâchette latérale pour bouger la fenêtre" -#: client/scenes/stream_gui.cpp:398 client/scenes/stream_gui.cpp:750 +#: client/scenes/stream_gui.cpp:398 client/scenes/stream_gui.cpp:752 msgid "Press both thumbsticks to display the WiVRn window" msgstr "Appuyez sur les deux sticks pour afficher la fenêtre de WiVRn" @@ -585,15 +597,15 @@ msgstr "Utiliser le stick pour bouger le centre de fovéation" msgid "Press A to save or B to cancel" msgstr "A pour sauvegarder, B pour annuler" -#: client/scenes/stream_gui.cpp:793 +#: client/scenes/stream_gui.cpp:795 msgid "Stats" msgstr "Statistiques" -#: client/scenes/stream_gui.cpp:802 +#: client/scenes/stream_gui.cpp:804 msgid "Statistics overlay" msgstr "Statistiques seules" -#: client/scenes/stream_gui.cpp:805 +#: client/scenes/stream_gui.cpp:807 msgid "Compact view" msgstr "Vue compacte" diff --git a/locale/it/wivrn.po b/locale/it/wivrn.po index e13a49e6..cbf66960 100644 --- a/locale/it/wivrn.po +++ b/locale/it/wivrn.po @@ -5,15 +5,15 @@ msgid "" msgstr "" "Project-Id-Version: WiVRn 0.15\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-30 09:41+0200\n" -"PO-Revision-Date: 2025-07-30 09:59+0200\n" +"POT-Creation-Date: 2025-08-12 13:35+0200\n" +"PO-Revision-Date: 2025-08-12 13:41+0200\n" "Last-Translator: Albano Battistella \n" "Language-Team: Italian <>\n" "Language: Italian\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Gtranslator 47.1\n" +"X-Generator: Gtranslator 48.0\n" #: client/scene.cpp:74 msgid "No supported swapchain format" @@ -42,98 +42,98 @@ msgstr "Impossibile connettersi a {} ({}): {}" msgid "Waiting for connection" msgstr "In attesa di connessione" -#: client/scenes/lobby_gui.cpp:156 +#: client/scenes/lobby_gui.cpp:230 msgctxt "openxr_post_processing" msgid "Normal" msgstr "Normale" -#: client/scenes/lobby_gui.cpp:159 +#: client/scenes/lobby_gui.cpp:233 msgctxt "openxr_post_processing" msgid "Quality" msgstr "Alta qualità" -#: client/scenes/lobby_gui.cpp:161 +#: client/scenes/lobby_gui.cpp:235 msgctxt "openxr_post_processing" msgid "Disabled" msgstr "Disattivato" -#: client/scenes/lobby_gui.cpp:169 client/scenes/lobby_gui.cpp:320 -#: client/scenes/stream_gui.cpp:812 +#: client/scenes/lobby_gui.cpp:243 client/scenes/lobby_gui.cpp:400 +#: client/scenes/stream_gui.cpp:814 msgid "Disconnect" msgstr "Sconnetti" -#: client/scenes/lobby_gui.cpp:189 client/scenes/stream_gui.cpp:808 +#: client/scenes/lobby_gui.cpp:264 client/scenes/stream_gui.cpp:810 msgid "Close" msgstr "Chiudi" -#: client/scenes/lobby_gui.cpp:195 +#: client/scenes/lobby_gui.cpp:270 msgid "Connection" msgstr "Connessione" -#: client/scenes/lobby_gui.cpp:197 +#: client/scenes/lobby_gui.cpp:272 #, c++-format msgid "Connection to {}" msgstr "Connessione a {}" -#: client/scenes/lobby_gui.cpp:227 +#: client/scenes/lobby_gui.cpp:302 msgid "PIN" msgstr "PIN" -#: client/scenes/lobby_gui.cpp:249 +#: client/scenes/lobby_gui.cpp:324 msgid "Input the PIN displayed on the dashboard" msgstr "Digitare il PIN visibile sul server" -#: client/scenes/lobby_gui.cpp:315 +#: client/scenes/lobby_gui.cpp:395 msgid "Connected to WiVRn server" msgstr "Connesso al server WiVRn" -#: client/scenes/lobby_gui.cpp:317 +#: client/scenes/lobby_gui.cpp:397 #, c++-format msgid "Connected to {}" msgstr "Connesso a {}" -#: client/scenes/lobby_gui.cpp:327 +#: client/scenes/lobby_gui.cpp:407 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 +#: client/scenes/lobby_gui.cpp:419 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 +#: client/scenes/lobby_gui.cpp:421 #, 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 +#: client/scenes/lobby_gui.cpp:544 msgid "Name" msgstr "Nome" -#: client/scenes/lobby_gui.cpp:394 +#: client/scenes/lobby_gui.cpp:555 msgid "Address" msgstr "Indirizzo" -#: client/scenes/lobby_gui.cpp:403 +#: client/scenes/lobby_gui.cpp:564 msgid "Port" msgstr "Porta" -#: client/scenes/lobby_gui.cpp:411 +#: client/scenes/lobby_gui.cpp:572 msgid "TCP only" msgstr "Solo TCP" -#: client/scenes/lobby_gui.cpp:418 +#: client/scenes/lobby_gui.cpp:579 msgid "Cancel" msgstr "Annulla" -#: client/scenes/lobby_gui.cpp:432 +#: client/scenes/lobby_gui.cpp:593 msgid "Save" msgstr "Salva" -#: client/scenes/lobby_gui.cpp:485 +#: client/scenes/lobby_gui.cpp:646 msgid "" "Start a WiVRn server on your\n" "local network" @@ -141,32 +141,32 @@ msgstr "" "Avvia un server WiVRn sulla\n" "rete locale" -#: client/scenes/lobby_gui.cpp:517 +#: client/scenes/lobby_gui.cpp:678 msgid "Autoconnect" msgstr "Connessione automatica" -#: client/scenes/lobby_gui.cpp:543 +#: client/scenes/lobby_gui.cpp:704 msgid "Connect" msgstr "Connetti" -#: client/scenes/lobby_gui.cpp:553 client/wivrn_client.cpp:186 +#: client/scenes/lobby_gui.cpp:714 client/wivrn_client.cpp:186 msgid "Incompatible server version" msgstr "Versione del server incompatibile" -#: client/scenes/lobby_gui.cpp:555 +#: client/scenes/lobby_gui.cpp:716 msgid "Server not available" msgstr "Server non disponibile" -#: client/scenes/lobby_gui.cpp:641 +#: client/scenes/lobby_gui.cpp:802 msgid "Refresh rate" msgstr "Frequenza di aggiornamento" -#: client/scenes/lobby_gui.cpp:641 client/scenes/lobby_gui.cpp:643 +#: client/scenes/lobby_gui.cpp:802 client/scenes/lobby_gui.cpp:804 msgctxt "automatic refresh rate" msgid "Automatic" msgstr "Automatica" -#: client/scenes/lobby_gui.cpp:650 +#: client/scenes/lobby_gui.cpp:811 msgid "" "Select refresh rate based on measured application performance.\n" "May cause flicker when a change happens." @@ -175,60 +175,60 @@ msgstr "" "misurate dell'applicazione.\n" "Può causare un flash quando avviene il cambiamento." -#: client/scenes/lobby_gui.cpp:667 +#: client/scenes/lobby_gui.cpp:828 msgid "Minimum refresh rate" msgstr "Frequenza minima" -#: client/scenes/lobby_gui.cpp:690 +#: client/scenes/lobby_gui.cpp:851 msgid "Resolution scale" msgstr "Scala di risoluzione" -#: client/scenes/lobby_gui.cpp:694 client/scenes/lobby_gui.cpp:933 +#: client/scenes/lobby_gui.cpp:855 client/scenes/lobby_gui.cpp:1101 #, c-format, c++-format msgid "%d%% - {}x{} per eye" msgstr "%d%% - {}x{} per occhio" -#: client/scenes/lobby_gui.cpp:705 client/scenes/lobby_gui.cpp:944 +#: client/scenes/lobby_gui.cpp:866 client/scenes/lobby_gui.cpp:1112 #, 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:711 +#: client/scenes/lobby_gui.cpp:872 msgid "Enable microphone" msgstr "Attiva il microfono" -#: client/scenes/lobby_gui.cpp:720 +#: client/scenes/lobby_gui.cpp:881 msgid "Unprocessed Microphone Audio" msgstr "Usare dati grezzi del microfono" -#: client/scenes/lobby_gui.cpp:726 +#: client/scenes/lobby_gui.cpp:887 msgid "Force disable audio filters, such as noise cancellation" msgstr "Disattiva gli effetti come la cancellazione del rumore" -#: client/scenes/lobby_gui.cpp:733 +#: client/scenes/lobby_gui.cpp:894 msgid "Enable hand tracking" msgstr "Abilita il tracciamento delle mani" -#: 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 +#: client/scenes/lobby_gui.cpp:900 client/scenes/lobby_gui.cpp:912 +#: client/scenes/lobby_gui.cpp:924 client/scenes/lobby_gui.cpp:940 +#: client/scenes/lobby_gui.cpp:990 msgid "This feature is not supported by your headset" msgstr "Questa funzionalità non è supportata dal visore" -#: client/scenes/lobby_gui.cpp:745 +#: client/scenes/lobby_gui.cpp:906 msgid "Enable eye tracking" msgstr "Abilita il tracciamento oculare" -#: client/scenes/lobby_gui.cpp:757 +#: client/scenes/lobby_gui.cpp:918 msgid "Enable face tracking" msgstr "Abilita il tracciamento facciale" -#: client/scenes/lobby_gui.cpp:770 +#: client/scenes/lobby_gui.cpp:931 msgid "Enable body tracking" msgstr "Abilita il tracciamento del corpo" -#: client/scenes/lobby_gui.cpp:786 +#: client/scenes/lobby_gui.cpp:947 msgid "" "Requires 'Hand and body tracking' to be enabled in the Quest movement " "tracking settings,\n" @@ -241,11 +241,11 @@ msgstr "" "controller e\n" "del visore." -#: client/scenes/lobby_gui.cpp:799 +#: client/scenes/lobby_gui.cpp:960 msgid "Enable lower body tracking" msgstr "Abilita il tracciamento del basso del corpo" -#: client/scenes/lobby_gui.cpp:805 +#: client/scenes/lobby_gui.cpp:966 msgid "" "Estimate lower body joint positions using Generative Legs\n" "Requires 'Hand and body tracking' to be enabled in the Quest movement " @@ -256,11 +256,11 @@ msgstr "" "impostazioni,\n" "sezione \"Tracking dei movimenti\"." -#: client/scenes/lobby_gui.cpp:808 +#: client/scenes/lobby_gui.cpp:969 msgid "Enable hip tracking" msgstr "Abilitia il tracciamento delle anche" -#: client/scenes/lobby_gui.cpp:814 +#: client/scenes/lobby_gui.cpp:975 msgid "" "Only takes affect with lower body tracking enabled\n" "May be desired when using another source of hip tracking" @@ -269,19 +269,31 @@ msgstr "" "Può essere utile se un altro metodo viene usato per il tracciamento\n" "delle anche." -#: client/scenes/lobby_gui.cpp:822 +#: client/scenes/lobby_gui.cpp:983 msgid "Enable video passthrough in lobby" msgstr "Abilita la visualizzazione reale in ingresso" -#: client/scenes/lobby_gui.cpp:843 client/scenes/stream_gui.cpp:434 +#: client/scenes/lobby_gui.cpp:994 +msgid "Enable in-stream window" +msgstr "Attiva la finestra di WiVRn durante la trasmissione" + +#: client/scenes/lobby_gui.cpp:997 +msgid "" +"Enables the configuration window to be shown while the game is streaming.\n" +"If enabled, the window is activated by pressing both thumbsticks." +msgstr "" +"Abilita la finestra di configurazione quando il gioco viene trasmesso.\n" +"Se selezionato, la finestra può essere attivata premendo entrambi gli stick." + +#: client/scenes/lobby_gui.cpp:1011 client/scenes/stream_gui.cpp:434 msgid "OpenXR post-processing" msgstr "Post-trattamento OpenXR" -#: client/scenes/lobby_gui.cpp:847 client/scenes/stream_gui.cpp:438 +#: client/scenes/lobby_gui.cpp:1015 client/scenes/stream_gui.cpp:438 msgid "Supersampling" msgstr "Supersamping" -#: client/scenes/lobby_gui.cpp:867 client/scenes/stream_gui.cpp:459 +#: client/scenes/lobby_gui.cpp:1035 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" @@ -289,11 +301,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:872 client/scenes/stream_gui.cpp:464 +#: client/scenes/lobby_gui.cpp:1040 client/scenes/stream_gui.cpp:464 msgid "Sharpening" msgstr "Miglioramento della nitidezza" -#: client/scenes/lobby_gui.cpp:892 client/scenes/stream_gui.cpp:485 +#: client/scenes/lobby_gui.cpp:1060 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" @@ -302,168 +314,168 @@ msgstr "" "Utile quando la risoluzione d'entrate è bassa in contronto a quella del " "visore" -#: client/scenes/lobby_gui.cpp:901 +#: client/scenes/lobby_gui.cpp:1069 msgid "Enable Snapdragon Game Super Resolution" msgstr "Attivare Snapdragon Game Super Resolution" -#: client/scenes/lobby_gui.cpp:909 +#: client/scenes/lobby_gui.cpp:1077 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:911 +#: client/scenes/lobby_gui.cpp:1079 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:929 +#: client/scenes/lobby_gui.cpp:1097 msgid "Upscaling factor" msgstr "Aumento di risoluzione" -#: client/scenes/lobby_gui.cpp:948 +#: client/scenes/lobby_gui.cpp:1116 msgid "Use edge direction" msgstr "Usare la direzione dei bordi" -#: client/scenes/lobby_gui.cpp:954 +#: client/scenes/lobby_gui.cpp:1122 msgid "Adds an additional performance cost" msgstr "Riduce le prestazioni" -#: client/scenes/lobby_gui.cpp:959 +#: client/scenes/lobby_gui.cpp:1127 msgid "Edge threshold" msgstr "Soglia dei bordi" -#: client/scenes/lobby_gui.cpp:966 client/scenes/lobby_gui.cpp:975 +#: client/scenes/lobby_gui.cpp:1134 client/scenes/lobby_gui.cpp:1143 #, c++-format msgid "Recommended: {:.1f}" msgstr "Valore consigliato: {:.1f}" -#: client/scenes/lobby_gui.cpp:969 +#: client/scenes/lobby_gui.cpp:1137 msgid "Edge sharpness" msgstr "Nitidezza dei bordi" -#: client/scenes/lobby_gui.cpp:1071 client/scenes/lobby_gui.cpp:1079 +#: client/scenes/lobby_gui.cpp:1239 client/scenes/lobby_gui.cpp:1247 #: client/scenes/stream_gui.cpp:222 client/scenes/stream_gui.cpp:418 msgid "CPU time" msgstr "Tempo CPU" -#: client/scenes/lobby_gui.cpp:1075 +#: client/scenes/lobby_gui.cpp:1243 msgid "CPU time [ms]" msgstr "Tempo CPU [ms]" -#: client/scenes/lobby_gui.cpp:1085 client/scenes/lobby_gui.cpp:1093 +#: client/scenes/lobby_gui.cpp:1253 client/scenes/lobby_gui.cpp:1261 #: client/scenes/stream_gui.cpp:224 client/scenes/stream_gui.cpp:419 msgid "GPU time" msgstr "Tempo GPU" -#: client/scenes/lobby_gui.cpp:1089 +#: client/scenes/lobby_gui.cpp:1257 msgid "GPU time [ms]" msgstr "Tempo GPU [ms]" -#: client/scenes/lobby_gui.cpp:1132 +#: client/scenes/lobby_gui.cpp:1300 msgid "Enable the microphone?" msgstr "Attivare il microfono?" -#: client/scenes/lobby_gui.cpp:1137 +#: client/scenes/lobby_gui.cpp:1305 msgid "Enable eye tracking?" msgstr "Attivare il tracciamento oculare?" -#: client/scenes/lobby_gui.cpp:1142 +#: client/scenes/lobby_gui.cpp:1310 msgid "Enable face tracking?" msgstr "Attivare il tracciamento facciale?" -#: client/scenes/lobby_gui.cpp:1147 +#: client/scenes/lobby_gui.cpp:1315 msgid "Enable body tracking?" msgstr "Attivare il tracciamento del corpo?" -#: client/scenes/lobby_gui.cpp:1155 +#: client/scenes/lobby_gui.cpp:1323 msgid "Welcome to WiVRn" msgstr "Benvenuto su WiVRn" -#: client/scenes/lobby_gui.cpp:1179 +#: client/scenes/lobby_gui.cpp:1347 msgid "Yes" msgstr "Sì" -#: client/scenes/lobby_gui.cpp:1186 +#: client/scenes/lobby_gui.cpp:1354 msgid "No" msgstr "No" -#: client/scenes/lobby_gui.cpp:1205 client/scenes/lobby_gui.cpp:1844 +#: client/scenes/lobby_gui.cpp:1373 client/scenes/lobby_gui.cpp:2012 msgid "Licenses" msgstr "Licenze" -#: client/scenes/lobby_gui.cpp:1519 +#: client/scenes/lobby_gui.cpp:1687 msgid "Microphone is enabled" msgstr "Microfono attivo" -#: client/scenes/lobby_gui.cpp:1520 +#: client/scenes/lobby_gui.cpp:1688 msgid "Microphone is disabled" msgstr "Microfono disattivato" -#: client/scenes/lobby_gui.cpp:1529 +#: client/scenes/lobby_gui.cpp:1697 msgid "Hand tracking is enabled" msgstr "Tracciamento delle mani attivo" -#: client/scenes/lobby_gui.cpp:1530 +#: client/scenes/lobby_gui.cpp:1698 msgid "Hand tracking is disabled" msgstr "Tracciamento delle mani disattivato" -#: client/scenes/lobby_gui.cpp:1539 +#: client/scenes/lobby_gui.cpp:1707 msgid "Eye tracking is enabled" msgstr "Tracciamento oculare attivo" -#: client/scenes/lobby_gui.cpp:1540 +#: client/scenes/lobby_gui.cpp:1708 msgid "Eye tracking is disabled" msgstr "Tracciamento oculare disattivato" -#: client/scenes/lobby_gui.cpp:1553 +#: client/scenes/lobby_gui.cpp:1721 msgid "Face tracking is enabled" msgstr "Tracciamento facciale attivato" -#: client/scenes/lobby_gui.cpp:1554 +#: client/scenes/lobby_gui.cpp:1722 msgid "Face tracking is disabled" msgstr "Tracciamento facciale disattivato" -#: client/scenes/lobby_gui.cpp:1564 +#: client/scenes/lobby_gui.cpp:1732 msgid "Body tracking is enabled" msgstr "Tracciamento del corpo attivato" -#: client/scenes/lobby_gui.cpp:1565 +#: client/scenes/lobby_gui.cpp:1733 msgid "Body tracking is disabled" msgstr "Tracciamento del corpo disattivato" -#: client/scenes/lobby_gui.cpp:1581 +#: client/scenes/lobby_gui.cpp:1749 msgid "Add server" msgstr "Aggiungi server" -#: client/scenes/lobby_gui.cpp:1826 +#: client/scenes/lobby_gui.cpp:1994 msgid "Server list" msgstr "Elenco dei server" -#: client/scenes/lobby_gui.cpp:1829 client/scenes/stream_gui.cpp:796 +#: client/scenes/lobby_gui.cpp:1997 client/scenes/stream_gui.cpp:798 msgid "Settings" msgstr "Impostazioni" -#: client/scenes/lobby_gui.cpp:1832 +#: client/scenes/lobby_gui.cpp:2000 msgid "Post-processing" msgstr "Post-trattamento" -#: client/scenes/lobby_gui.cpp:1836 +#: client/scenes/lobby_gui.cpp:2004 msgid "Debug" msgstr "Debug" -#: client/scenes/lobby_gui.cpp:1841 +#: client/scenes/lobby_gui.cpp:2009 msgid "About" msgstr "Informazioni" -#: client/scenes/lobby_gui.cpp:1847 +#: client/scenes/lobby_gui.cpp:2015 msgid "Exit" msgstr "Esci" -#: client/scenes/lobby_gui.cpp:1864 +#: client/scenes/lobby_gui.cpp:2032 msgid "" "Press the grip button or put your palm up\n" "to move the main window" @@ -471,10 +483,9 @@ msgstr "" "Premi il pulsante laterale o punta il palmo della\n" "mano verso l'alto per spostare la finestra principale" -#: client/scenes/lobby_gui.cpp:1866 +#: client/scenes/lobby_gui.cpp:2034 msgid "Press the grip button to move the main window" -msgstr "" -"Premi il pulsante laterale per spostare la finestra principale" +msgstr "Premi il pulsante laterale per spostare la finestra principale" #: client/scenes/stream_gui.cpp:224 msgid "Reproject" @@ -542,7 +553,7 @@ msgstr "Latenza stimata da movimento a fotoni: {}ms" 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 +#: client/scenes/stream_gui.cpp:398 client/scenes/stream_gui.cpp:752 msgid "Press both thumbsticks to display the WiVRn window" msgstr "Premi entrabli gli stick per mostrare la finestra di WiVRn" @@ -584,15 +595,15 @@ msgstr "Usa gli stick per spostare il centro di foveazione" msgid "Press A to save or B to cancel" msgstr "A per salvare, B per annullare" -#: client/scenes/stream_gui.cpp:793 +#: client/scenes/stream_gui.cpp:795 msgid "Stats" msgstr "Statistiche" -#: client/scenes/stream_gui.cpp:802 +#: client/scenes/stream_gui.cpp:804 msgid "Statistics overlay" msgstr "Solo statistiche" -#: client/scenes/stream_gui.cpp:805 +#: client/scenes/stream_gui.cpp:807 msgid "Compact view" msgstr "Modalità compatta" From c7fc144a667e0f75f680e1484eb8165c0d49d763 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Tue, 12 Aug 2025 17:36:17 +0200 Subject: [PATCH 40/85] Add simple controller binding for hand interaction --- server/driver/wivrn_hand_interaction.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server/driver/wivrn_hand_interaction.cpp b/server/driver/wivrn_hand_interaction.cpp index def312f9..ff68e484 100644 --- a/server/driver/wivrn_hand_interaction.cpp +++ b/server/driver/wivrn_hand_interaction.cpp @@ -147,6 +147,12 @@ static xrt_binding_input_pair hand_interaction_input_binding[] = { {XRT_INPUT_HAND_GRASP_READY, XRT_INPUT_HAND_GRASP_READY}, }; +static xrt_binding_input_pair simple_input_binding[] = { + {XRT_INPUT_SIMPLE_SELECT_CLICK, XRT_INPUT_HAND_PINCH_VALUE}, + {XRT_INPUT_SIMPLE_GRIP_POSE, XRT_INPUT_HAND_GRIP_POSE}, + {XRT_INPUT_SIMPLE_AIM_POSE, XRT_INPUT_HAND_AIM_POSE}, +}; + static xrt_binding_profile wivrn_binding_profiles[] = { { .name = XRT_DEVICE_EXT_HAND_INTERACTION, @@ -155,6 +161,13 @@ static xrt_binding_profile wivrn_binding_profiles[] = { .outputs = nullptr, .output_count = 0, }, + { + .name = XRT_DEVICE_SIMPLE_CONTROLLER, + .inputs = simple_input_binding, + .input_count = std::size(simple_input_binding), + .outputs = nullptr, + .output_count = 0, + }, }; namespace From 49ab1af5425a5e93d79c8e7494a409cd6316e8cc Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Sun, 10 Aug 2025 13:11:17 +0200 Subject: [PATCH 41/85] Avoid showing the spinner when the predicted display time is close to 0 --- client/scenes/lobby.h | 2 +- client/scenes/lobby_gui.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/scenes/lobby.h b/client/scenes/lobby.h index 54d092d3..e68040ce 100644 --- a/client/scenes/lobby.h +++ b/client/scenes/lobby.h @@ -123,7 +123,7 @@ class lobby : public scene_impl ImTextureID about_picture; ImTextureID default_icon; std::unordered_map app_icons; - XrTime timestamp_start_application{}; + std::optional timestamp_start_application; virtual_keyboard keyboard; diff --git a/client/scenes/lobby_gui.cpp b/client/scenes/lobby_gui.cpp index b5a61928..ad7e3533 100644 --- a/client/scenes/lobby_gui.cpp +++ b/client/scenes/lobby_gui.cpp @@ -246,7 +246,7 @@ void scenes::lobby::gui_connecting(locked_notifiable & pin_req if (next_scene) { current_tab = tab::connected; - timestamp_start_application = 0; + timestamp_start_application.reset(); ImGui::CloseCurrentPopup(); return; } @@ -408,7 +408,7 @@ void scenes::lobby::gui_connected(XrTime predicted_display_time) } else { - bool app_starting = predicted_display_time - timestamp_start_application < 10'000'000'000; + bool app_starting = timestamp_start_application and (predicted_display_time - *timestamp_start_application < 10'000'000'000); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, {20, 0}); ImGui::BeginDisabled(app_starting); From a5b3178f36def27e7a1eda394379d4dee3d93fc2 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Thu, 14 Aug 2025 14:37:00 +0200 Subject: [PATCH 42/85] Fix uninitialized data in foveation params --- server/driver/wivrn_foveation.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/server/driver/wivrn_foveation.cpp b/server/driver/wivrn_foveation.cpp index abe895dc..2ac73ae5 100644 --- a/server/driver/wivrn_foveation.cpp +++ b/server/driver/wivrn_foveation.cpp @@ -389,7 +389,7 @@ std::array wivrn_foveation::get_parameters() } static void fill_ubo( - uint32_t * ubo, + std::span ubo, const std::vector & params, bool flip, size_t offset, @@ -398,9 +398,9 @@ static void fill_ubo( { assert(params.size() % 2 == 1); const int n_ratio = (params.size() - 1) / 2; - *ubo = offset; + ubo[0] = offset; if (flip) - *ubo += size; + ubo[0] += size; for (auto [i, n]: std::ranges::enumerate_view(params)) { const int n_source = std::abs(n_ratio - int(i)) + 1; @@ -411,12 +411,12 @@ static void fill_ubo( ubo[1] = ubo[0] - n_source; else ubo[1] = ubo[0] + n_source; - ++ubo; + ubo = ubo.subspan(1); --count; } } - if (count > 0) - std::fill(ubo + 1, ubo + count + 1, *ubo); + if (not ubo.empty()) + std::ranges::fill(ubo, ubo[0]); } template @@ -495,7 +495,7 @@ vk::CommandBuffer wivrn_foveation::update_foveation_buffer( offset = source[view].offset.w; extent = source[view].extent.w; } - fill_ubo(ubo->x + view * RENDER_FOVEATION_BUFFER_DIMENSIONS, params[view].x, flip, offset, extent, foveated_width); + fill_ubo(std::span(ubo->x + view * RENDER_FOVEATION_BUFFER_DIMENSIONS, RENDER_FOVEATION_BUFFER_DIMENSIONS), params[view].x, flip, offset, extent, foveated_width); if (source[view].extent.h < 0) { @@ -509,7 +509,7 @@ vk::CommandBuffer wivrn_foveation::update_foveation_buffer( offset = source[view].offset.h; extent = source[view].extent.h; } - fill_ubo(ubo->y + view * RENDER_FOVEATION_BUFFER_DIMENSIONS, params[view].y, flip, offset, extent, foveated_height); + fill_ubo(std::span(ubo->y + view * RENDER_FOVEATION_BUFFER_DIMENSIONS, RENDER_FOVEATION_BUFFER_DIMENSIONS), params[view].y, flip, offset, extent, foveated_height); } return *cmd; } From 50c44c8422e5694e99cee3e50fb634fc497482e9 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Thu, 14 Aug 2025 15:01:07 +0200 Subject: [PATCH 43/85] Add iGPU no-copy for distortion UBO --- server/driver/wivrn_foveation.cpp | 67 ++++++++++++++++++------------- server/driver/wivrn_foveation.h | 7 +++- 2 files changed, 45 insertions(+), 29 deletions(-) diff --git a/server/driver/wivrn_foveation.cpp b/server/driver/wivrn_foveation.cpp index 2ac73ae5..500605d2 100644 --- a/server/driver/wivrn_foveation.cpp +++ b/server/driver/wivrn_foveation.cpp @@ -18,7 +18,6 @@ */ #include "render/render_interface.h" -#include "vk/vk_mini_helpers.h" #include "wivrn_foveation.h" @@ -44,22 +43,13 @@ bool render_distortion_images_ensure(struct render_resources * r, bool pre_rotate) { if (r->distortion.buffer == VK_NULL_HANDLE) - { - return vk_buffer_init(vk, - sizeof(render_compute_distortion_foveation_data), - VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, - VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, - &r->distortion.buffer, - &r->distortion.device_memory); - } + r->distortion.buffer = wivrn::wivrn_foveation::instance().get_gpu_buffer(); return true; } void render_distortion_images_fini(struct render_resources * r) { - auto * vk = r->vk; - D(Buffer, r->distortion.buffer); - DF(Memory, r->distortion.device_memory); + r->distortion.buffer = VK_NULL_HANDLE; } // a, b: parameters computed by solve_foveation @@ -320,20 +310,35 @@ wivrn_foveation::wivrn_foveation(wivrn_vk_bundle & bundle, const xrt_hmd_parts & .commandPool = *command_pool, .commandBufferCount = 1, })[0])), - host_buffer( + gpu_buffer( bundle.device, { .size = sizeof(render_compute_distortion_foveation_data), - .usage = vk::BufferUsageFlagBits::eTransferSrc, + .usage = vk::BufferUsageFlagBits::eTransferDst | vk::BufferUsageFlagBits::eStorageBuffer, }, VmaAllocationCreateInfo{ - .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT, + .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT | VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT, .usage = VMA_MEMORY_USAGE_AUTO, - }) + }, + "foveation storage buffer") { + if (not(gpu_buffer.properties() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)) + { + host_buffer = buffer_allocation( + bundle.device, + { + .size = gpu_buffer.info().size, + .usage = vk::BufferUsageFlagBits::eTransferSrc, + }, + { + .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT, + .usage = VMA_MEMORY_USAGE_AUTO_PREFER_HOST, + }, + "foveation staging buffer"); + bundle.name(vk::Buffer(host_buffer), "foveation staging buffer"); + } bundle.name(command_pool, "foveation command pool"); bundle.name(cmd, "foveation command buffer"); - bundle.name(vk::Buffer(host_buffer), "foveation staging buffer"); } void wivrn_foveation::update_tracking(const from_headset::tracking & tracking, const clock_offset & offset) @@ -434,6 +439,11 @@ static bool operator==(const xrt_fov & a, const xrt_fov & b) return a.angle_left == b.angle_left and a.angle_right == b.angle_right and a.angle_up == b.angle_up and a.angle_down == b.angle_down; } +vk::Buffer wivrn_foveation::get_gpu_buffer() +{ + return gpu_buffer; +} + vk::CommandBuffer wivrn_foveation::update_foveation_buffer( vk::Buffer target, bool flip_y, @@ -443,14 +453,6 @@ vk::CommandBuffer wivrn_foveation::update_foveation_buffer( if (not target) return nullptr; - if (target != gpu_buffer) - { - command_pool.reset(); - cmd.begin({}); - cmd.copyBuffer(host_buffer, target, vk::BufferCopy{.size = sizeof(render_compute_distortion_foveation_data)}); - cmd.end(); - } - // Check if the last value is still valid std::lock_guard lock(mutex); if (last.flip_y == flip_y // @@ -467,6 +469,15 @@ vk::CommandBuffer wivrn_foveation::update_foveation_buffer( ) return nullptr; + assert(target == gpu_buffer); + if (host_buffer) + { + command_pool.reset(); + cmd.begin({}); + cmd.copyBuffer(host_buffer, target, vk::BufferCopy{.size = sizeof(render_compute_distortion_foveation_data)}); + cmd.end(); + } + last = { .gaze = gaze, .flip_y = flip_y, @@ -478,7 +489,7 @@ vk::CommandBuffer wivrn_foveation::update_foveation_buffer( compute_params(source, fovs); - auto ubo = (render_compute_distortion_foveation_data *)host_buffer.map(); + auto ubo = host_buffer ? host_buffer.data() : gpu_buffer.data(); for (size_t view = 0; view < 2; ++view) { bool flip = false; @@ -511,6 +522,8 @@ vk::CommandBuffer wivrn_foveation::update_foveation_buffer( } fill_ubo(std::span(ubo->y + view * RENDER_FOVEATION_BUFFER_DIMENSIONS, RENDER_FOVEATION_BUFFER_DIMENSIONS), params[view].y, flip, offset, extent, foveated_height); } - return *cmd; + if (host_buffer) + return *cmd; + return nullptr; } } // namespace wivrn diff --git a/server/driver/wivrn_foveation.h b/server/driver/wivrn_foveation.h index e1eb50de..e4951fde 100644 --- a/server/driver/wivrn_foveation.h +++ b/server/driver/wivrn_foveation.h @@ -24,6 +24,7 @@ #include "xrt/xrt_defines.h" #include "xrt/xrt_device.h" +#include "utils/singleton.h" #include struct render_resources; @@ -34,7 +35,7 @@ namespace wivrn struct clock_offset; struct wivrn_vk_bundle; -class wivrn_foveation +class wivrn_foveation : public singleton { std::mutex mutex; @@ -53,8 +54,8 @@ class wivrn_foveation vk::raii::CommandPool command_pool; vk::raii::CommandBuffer cmd; + buffer_allocation gpu_buffer; buffer_allocation host_buffer; - vk::Buffer gpu_buffer = nullptr; // parameters used for last computation struct P @@ -81,6 +82,8 @@ public: void update_foveation_center_override(const from_headset::override_foveation_center &); std::array get_parameters(); + vk::Buffer get_gpu_buffer(); + vk::CommandBuffer update_foveation_buffer( vk::Buffer target, bool flip_y, From 6d0cc606265d22140f0b7ad3488b49544a533b4b Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Thu, 14 Aug 2025 16:55:49 +0200 Subject: [PATCH 44/85] Use subgroups in distortion shader --- ...001-c-multi-early-wake-of-compositor.patch | 8 +- ...02-ipc-server-Always-listen-to-stdin.patch | 4 +- .../monado/0003-Use-extern-socket-fd.patch | 4 +- ...Add-storage-usage-to-distortion-mesh.patch | 4 +- ...vironment-blend-mode-selection-logic.patch | 4 +- .../0006-Convert-to-YCbCr-in-Monado.patch | 10 +- .../0007-store-alpha-channel-in-layer-1.patch | 4 +- ...main-allow-custom-pacing-app-factory.patch | 4 +- .../0009-st-oxr-forward-0-refresh-rate.patch | 4 +- ...tortion-with-pixel-aligned-foveation.patch | 143 ++++++++++++------ ...a-vk-Track-VK_KHR_video_maintenance1.patch | 4 +- ...e-video_maintenance_1-device-feature.patch | 4 +- ...-Request-video_maintenance_1-feature.patch | 4 +- 13 files changed, 124 insertions(+), 77 deletions(-) diff --git a/patches/monado/0001-c-multi-early-wake-of-compositor.patch b/patches/monado/0001-c-multi-early-wake-of-compositor.patch index ee810261..90eddb98 100644 --- a/patches/monado/0001-c-multi-early-wake-of-compositor.patch +++ b/patches/monado/0001-c-multi-early-wake-of-compositor.patch @@ -1,7 +1,7 @@ -From 18e184e504d9f55dbba3f02c87f96410b2ce04ab Mon Sep 17 00:00:00 2001 +From 483ce192460569020fa57522ee2bea99198dac2e Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Tue, 22 Oct 2024 15:23:19 +0200 -Subject: [PATCH 01/10] c/multi: early wake of compositor +Subject: [PATCH 01/13] c/multi: early wake of compositor --- .../compositor/multi/comp_multi_compositor.c | 14 +++++++++ @@ -10,10 +10,10 @@ Subject: [PATCH 01/10] c/multi: early wake of compositor 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/src/xrt/compositor/multi/comp_multi_compositor.c b/src/xrt/compositor/multi/comp_multi_compositor.c -index 553565db4..789a2d042 100644 +index 94cea110e..88347a092 100644 --- a/src/xrt/compositor/multi/comp_multi_compositor.c +++ b/src/xrt/compositor/multi/comp_multi_compositor.c -@@ -232,7 +232,21 @@ wait_for_scheduled_free(struct multi_compositor *mc) +@@ -236,7 +236,21 @@ wait_for_scheduled_free(struct multi_compositor *mc) os_mutex_lock(&mc->slot_lock); slot_move_and_clear_locked(mc, &mc->scheduled, &mc->progress); os_mutex_unlock(&mc->slot_lock); diff --git a/patches/monado/0002-ipc-server-Always-listen-to-stdin.patch b/patches/monado/0002-ipc-server-Always-listen-to-stdin.patch index ef9c355d..aed5a5e2 100644 --- a/patches/monado/0002-ipc-server-Always-listen-to-stdin.patch +++ b/patches/monado/0002-ipc-server-Always-listen-to-stdin.patch @@ -1,7 +1,7 @@ -From b31b5aa4e7e890ae079ae2953a1ce3fc2e47b954 Mon Sep 17 00:00:00 2001 +From 642f328ff08872289082f591b393aa72cdfffe0a Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Tue, 2 Apr 2024 17:14:42 +0200 -Subject: [PATCH 02/10] ipc/server: Always listen to stdin +Subject: [PATCH 02/13] ipc/server: Always listen to stdin --- src/xrt/ipc/server/ipc_server_mainloop_linux.c | 2 +- diff --git a/patches/monado/0003-Use-extern-socket-fd.patch b/patches/monado/0003-Use-extern-socket-fd.patch index ca626a54..55734999 100644 --- a/patches/monado/0003-Use-extern-socket-fd.patch +++ b/patches/monado/0003-Use-extern-socket-fd.patch @@ -1,7 +1,7 @@ -From 46cacda03c5552ffb70601dd89e0abe38e97c1d3 Mon Sep 17 00:00:00 2001 +From a06da2ceeddf3f7760501114efa35bd168ba74bc Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Tue, 8 Oct 2024 22:13:15 +0200 -Subject: [PATCH 03/10] Use extern socket fd +Subject: [PATCH 03/13] Use extern socket fd --- src/xrt/ipc/server/ipc_server_mainloop_linux.c | 8 ++++++++ diff --git a/patches/monado/0004-c-render-Add-storage-usage-to-distortion-mesh.patch b/patches/monado/0004-c-render-Add-storage-usage-to-distortion-mesh.patch index ab8399ef..16a7e514 100644 --- a/patches/monado/0004-c-render-Add-storage-usage-to-distortion-mesh.patch +++ b/patches/monado/0004-c-render-Add-storage-usage-to-distortion-mesh.patch @@ -1,7 +1,7 @@ -From 90c3842f38985e0f8f06bb51d0e58cccf437526f Mon Sep 17 00:00:00 2001 +From 4efe5b0e12a92284e46fdeb225102dc63a7eda51 Mon Sep 17 00:00:00 2001 From: galister <3123227-galister@users.noreply.gitlab.com> Date: Mon, 19 Aug 2024 18:51:45 +0900 -Subject: [PATCH 04/10] c/render: Add storage usage to distortion mesh +Subject: [PATCH 04/13] c/render: Add storage usage to distortion mesh --- src/xrt/compositor/render/render_distortion.c | 2 +- diff --git a/patches/monado/0005-change-environment-blend-mode-selection-logic.patch b/patches/monado/0005-change-environment-blend-mode-selection-logic.patch index d06ff96f..26e642fb 100644 --- a/patches/monado/0005-change-environment-blend-mode-selection-logic.patch +++ b/patches/monado/0005-change-environment-blend-mode-selection-logic.patch @@ -1,7 +1,7 @@ -From 9e2288bc85a5be9bb0228a42dc5a9419c4357eb8 Mon Sep 17 00:00:00 2001 +From a28d3e6a3e85b7c04392137b30958e8b1d13c591 Mon Sep 17 00:00:00 2001 From: galister <85970-galister@users.noreply.gitlab.freedesktop.org> Date: Sat, 23 Nov 2024 02:42:12 +0900 -Subject: [PATCH 05/10] change environment blend mode selection logic +Subject: [PATCH 05/13] change environment blend mode selection logic --- src/xrt/compositor/multi/comp_multi_system.c | 26 +++++++++++++------- diff --git a/patches/monado/0006-Convert-to-YCbCr-in-Monado.patch b/patches/monado/0006-Convert-to-YCbCr-in-Monado.patch index 6de3da68..a907d7ac 100644 --- a/patches/monado/0006-Convert-to-YCbCr-in-Monado.patch +++ b/patches/monado/0006-Convert-to-YCbCr-in-Monado.patch @@ -1,7 +1,7 @@ -From 437469e6a4de72ab69719cce92b841e4de19156f Mon Sep 17 00:00:00 2001 +From ec28b5726922e300dc05085a30150223c6a2183a Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Wed, 11 Sep 2024 22:56:29 +0200 -Subject: [PATCH 06/10] Convert to YCbCr in Monado +Subject: [PATCH 06/13] Convert to YCbCr in Monado --- src/xrt/compositor/main/comp_renderer.c | 6 +- @@ -17,10 +17,10 @@ Subject: [PATCH 06/10] Convert to YCbCr in Monado 10 files changed, 184 insertions(+), 86 deletions(-) diff --git a/src/xrt/compositor/main/comp_renderer.c b/src/xrt/compositor/main/comp_renderer.c -index c6f589466..0895ff694 100644 +index e45d33e22..d2518585c 100644 --- a/src/xrt/compositor/main/comp_renderer.c +++ b/src/xrt/compositor/main/comp_renderer.c -@@ -933,7 +933,8 @@ dispatch_compute(struct comp_renderer *r, +@@ -936,7 +936,8 @@ dispatch_compute(struct comp_renderer *r, // Target Vulkan resources.. VkImage target_image = r->c->target->images[r->acquired_buffer].handle; @@ -30,7 +30,7 @@ index c6f589466..0895ff694 100644 // Target view information. struct render_viewport_data target_viewport_datas[XRT_MAX_VIEWS]; -@@ -949,7 +950,8 @@ dispatch_compute(struct comp_renderer *r, +@@ -952,7 +953,8 @@ dispatch_compute(struct comp_renderer *r, eye_poses, // fovs, // target_image, // diff --git a/patches/monado/0007-store-alpha-channel-in-layer-1.patch b/patches/monado/0007-store-alpha-channel-in-layer-1.patch index 0782d747..580a5500 100644 --- a/patches/monado/0007-store-alpha-channel-in-layer-1.patch +++ b/patches/monado/0007-store-alpha-channel-in-layer-1.patch @@ -1,7 +1,7 @@ -From 5a791919ce1e01f2cb0034e4055bf22767a41121 Mon Sep 17 00:00:00 2001 +From 022835847793c2b97df20a1dc823512a36533d53 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sun, 3 Nov 2024 13:40:00 +0100 -Subject: [PATCH 07/10] store alpha channel in layer 1 +Subject: [PATCH 07/13] store alpha channel in layer 1 --- src/xrt/compositor/shaders/clear.comp | 4 ++-- diff --git a/patches/monado/0008-c-main-allow-custom-pacing-app-factory.patch b/patches/monado/0008-c-main-allow-custom-pacing-app-factory.patch index 63607d0d..ce7e84a3 100644 --- a/patches/monado/0008-c-main-allow-custom-pacing-app-factory.patch +++ b/patches/monado/0008-c-main-allow-custom-pacing-app-factory.patch @@ -1,7 +1,7 @@ -From 877709160be24c4bd504b8d8cd04197cc2bf2b69 Mon Sep 17 00:00:00 2001 +From 0d2ae2efb84f1479151c096e26f3295eded3b170 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Thu, 27 Feb 2025 22:45:36 +0100 -Subject: [PATCH 08/10] c/main: allow custom pacing app factory +Subject: [PATCH 08/13] c/main: allow custom pacing app factory --- src/xrt/compositor/main/comp_compositor.c | 10 ++++++---- diff --git a/patches/monado/0009-st-oxr-forward-0-refresh-rate.patch b/patches/monado/0009-st-oxr-forward-0-refresh-rate.patch index d3c7b63a..fe282057 100644 --- a/patches/monado/0009-st-oxr-forward-0-refresh-rate.patch +++ b/patches/monado/0009-st-oxr-forward-0-refresh-rate.patch @@ -1,7 +1,7 @@ -From 53d8509dff69caccecdc38b443864b1a755486dd Mon Sep 17 00:00:00 2001 +From 1a9b288475830fc1caf9bbf340ea370677b239a5 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sat, 15 Mar 2025 22:19:48 +0100 -Subject: [PATCH 09/10] st/oxr: forward 0 refresh rate +Subject: [PATCH 09/13] st/oxr: forward 0 refresh rate --- src/xrt/state_trackers/oxr/oxr_api_session.c | 6 +----- diff --git a/patches/monado/0010-Replace-distortion-with-pixel-aligned-foveation.patch b/patches/monado/0010-Replace-distortion-with-pixel-aligned-foveation.patch index 4898d7a2..267eb76f 100644 --- a/patches/monado/0010-Replace-distortion-with-pixel-aligned-foveation.patch +++ b/patches/monado/0010-Replace-distortion-with-pixel-aligned-foveation.patch @@ -1,21 +1,30 @@ -From 1bc74f74b613cce9d32c0f4bf16de70ddb7fb482 Mon Sep 17 00:00:00 2001 +From 624849b80a893d073f2315eca909afa823c0a345 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 2 Jun 2025 14:51:11 +0200 -Subject: [PATCH 10/10] Replace distortion with pixel-aligned foveation +Subject: [PATCH 10/13] Replace distortion with pixel-aligned foveation --- - src/xrt/compositor/CMakeLists.txt | 2 +- - src/xrt/compositor/render/render_compute.c | 181 ++----------------- + src/xrt/compositor/CMakeLists.txt | 4 +- + src/xrt/compositor/render/render_compute.c | 185 ++----------------- src/xrt/compositor/render/render_interface.h | 33 ++-- - src/xrt/compositor/render/render_resources.c | 71 +------- - src/xrt/compositor/shaders/distortion.comp | 134 ++++---------- + src/xrt/compositor/render/render_resources.c | 71 +------ + src/xrt/compositor/shaders/distortion.comp | 167 ++++++----------- src/xrt/compositor/util/comp_render_cs.c | 33 +--- - 6 files changed, 76 insertions(+), 378 deletions(-) + 6 files changed, 101 insertions(+), 392 deletions(-) diff --git a/src/xrt/compositor/CMakeLists.txt b/src/xrt/compositor/CMakeLists.txt -index 1ba5ec438..f1defe77a 100644 +index 1ba5ec438..eb068f5fc 100644 --- a/src/xrt/compositor/CMakeLists.txt +++ b/src/xrt/compositor/CMakeLists.txt +@@ -105,7 +105,7 @@ if(XRT_HAVE_VULKAN) + spirv_shaders( + SHADER_HEADERS + SPIRV_VERSION +- 1.0 # Currently targeting Vulkan 1.0 ++ 1.3 # Currently targeting Vulkan 1.3 + SOURCES + ${SHADERS} + ) @@ -115,7 +115,7 @@ if(XRT_HAVE_VULKAN) ${SHADER_HEADERS} render/render_buffer.c @@ -26,9 +35,20 @@ index 1ba5ec438..f1defe77a 100644 render/render_interface.h render/render_resources.c diff --git a/src/xrt/compositor/render/render_compute.c b/src/xrt/compositor/render/render_compute.c -index fd04801d4..5cd5a1726 100644 +index fd04801d4..44c3f0aee 100644 --- a/src/xrt/compositor/render/render_compute.c +++ b/src/xrt/compositor/render/render_compute.c +@@ -66,8 +66,8 @@ calc_dispatch_dims_views(const struct render_viewport_data views[XRT_MAX_VIEWS], + #undef IMAX + + // Power of two divide and round up. +- w = uint_divide_and_round_up(w, 16); +- h = uint_divide_and_round_up(h, 16); ++ w = uint_divide_and_round_up(w, 8); ++ h = uint_divide_and_round_up(h, 8); + + *out_w = w; + *out_h = h; @@ -167,8 +167,8 @@ update_compute_shared_descriptor_set(struct vk_bundle *vk, VkSampler src_samplers[XRT_MAX_VIEWS], VkImageView src_image_views[XRT_MAX_VIEWS], @@ -478,10 +498,15 @@ index 5b9addd59..7d4d9cddb 100644 D(Pipeline, r->compute.clear.pipeline); diff --git a/src/xrt/compositor/shaders/distortion.comp b/src/xrt/compositor/shaders/distortion.comp -index 9ce46fe6f..f3be617bd 100644 +index 9ce46fe6f..cd1828ac9 100644 --- a/src/xrt/compositor/shaders/distortion.comp +++ b/src/xrt/compositor/shaders/distortion.comp -@@ -7,17 +7,17 @@ +@@ -4,20 +4,22 @@ + + #version 460 + #extension GL_GOOGLE_include_directive : require ++#extension GL_KHR_shader_subgroup_basic: require ++#extension GL_KHR_shader_subgroup_shuffle: require #include "srgb.inc.glsl" @@ -507,7 +532,7 @@ index 9ce46fe6f..f3be617bd 100644 layout(set = 0, binding = 2) uniform writeonly restrict image2DArray luma; layout(set = 0, binding = 3, std140) uniform restrict Config { -@@ -41,109 +41,40 @@ vec3 rgb_to_ycbcr(vec3 color) +@@ -41,122 +43,59 @@ vec3 rgb_to_ycbcr(vec3 color) return transpose(color_space) * color + vec3(0, 0.5, 0.5); } @@ -593,24 +618,13 @@ index 9ce46fe6f..f3be617bd 100644 ivec2 extent = ivec2(ubo.views[iz].zw); - vec2 cbcrs[4]; - vec4 alpha; -+ vec3 cbcra = vec3(0); - for (int k = 0; k < 2; k += 1) { - uint iy = gl_GlobalInvocationID.y * 2 + k; -+ uint ymin = foveation.y[MAX_DIM * iz + iy]; -+ uint ymax = foveation.y[MAX_DIM * iz + iy + 1]; -+ if (ymin > ymax) -+ { -+ uint tmp = ymin; -+ ymin = ymax; -+ ymax = tmp; -+ } - for (int j = 0; j < 2; j += 1) { - uint ix = gl_GlobalInvocationID.x * 2 + j; - +- for (int k = 0; k < 2; k += 1) { +- uint iy = gl_GlobalInvocationID.y * 2 + k; +- for (int j = 0; j < 2; j += 1) { +- uint ix = gl_GlobalInvocationID.x * 2 + j; +- - vec2 dist_uv = position_to_uv(extent, ix, iy); -+ uint xmin = foveation.x[MAX_DIM * iz + ix]; -+ uint xmax = foveation.x[MAX_DIM * iz + ix + 1]; - +- - vec2 uv = texture(distortion[iz + 0], dist_uv).xy; - vec2 lod = texture(distortion[iz + 2], dist_uv).xy; - @@ -621,35 +635,68 @@ index 9ce46fe6f..f3be617bd 100644 - vec4 colour = textureLod(source[iz], uv, mix(lod.x, lod.y, 0.5)); - - colour.rgb = rgb_to_ycbcr(from_linear_to_srgb(colour.rgb)); -+ vec4 colour = vec4(0); -+ for (uint y = ymin ; y < ymax; y += 1) { -+ for (uint x = xmin ; x < xmax; x += 1) { -+ colour += texelFetch(source[iz], ivec2(x, y), 0); -+ } -+ } -+ colour /= (xmax - xmin) * (ymax - ymin); -+ colour.xyz = rgb_to_ycbcr(from_linear_to_srgb(colour.rgb)); ++ uint iy = gl_GlobalInvocationID.y; ++ uint ymin = foveation.y[MAX_DIM * iz + iy]; ++ uint ymax = foveation.y[MAX_DIM * iz + iy + 1]; ++ if (ymin == ymax) ++ return; ++ if (ymin > ymax) ++ { ++ uint tmp = ymin; ++ ymin = ymax; ++ ymax = tmp; ++ } ++ uint ix = gl_GlobalInvocationID.x; - int i = k * 2 + j; - cbcrs[i] = colour.yz; - alpha[i] = colour.a; -+ cbcra.xy += colour.yz; -+ cbcra.z += colour.a; ++ uint xmin = foveation.x[MAX_DIM * iz + ix]; ++ uint xmax = foveation.x[MAX_DIM * iz + ix + 1]; ++ if (xmin == xmax) ++ return; - if (ix < extent.x && iy < extent.y) { - imageStore(luma, ivec3(offset.x + ix, offset.y + iy, 0), vec4(colour.x)); -@@ -153,10 +84,7 @@ void main() - if (gl_GlobalInvocationID.x >= extent.x || gl_GlobalInvocationID.y >= extent.y) { - return; +- if (ix < extent.x && iy < extent.y) { +- imageStore(luma, ivec3(offset.x + ix, offset.y + iy, 0), vec4(colour.x)); +- } ++ vec4 colour = vec4(0); ++ for (uint y = ymin ; y < ymax; y += 1) { ++ for (uint x = xmin ; x < xmax; x += 1) { ++ colour += texelFetch(source[iz], ivec2(x, y), 0); + } + } +- if (gl_GlobalInvocationID.x >= extent.x || gl_GlobalInvocationID.y >= extent.y) { +- return; ++ colour /= (xmax - xmin) * (ymax - ymin); ++ colour.xyz = rgb_to_ycbcr(from_linear_to_srgb(colour.rgb)); ++ ++ imageStore(luma, ivec3(offset.x + ix, offset.y + iy, 0), vec4(colour.x)); ++ ++ vec4 sum = colour; ++ for (uint i = 0 ; i < gl_SubgroupSize; ++i) ++ { ++ uvec3 other = subgroupShuffle(gl_GlobalInvocationID, i); ++ vec4 c = subgroupShuffle(colour, i); ++ if ( ++ other == gl_GlobalInvocationID + uvec3(1, 0, 0) ++ || other == gl_GlobalInvocationID + uvec3(0, 1, 0) ++ || other == gl_GlobalInvocationID + uvec3(1, 1, 0)) ++ { ++ sum += c; ++ } } - vec2 cbcr = mix(mix(cbcrs[0], cbcrs[1], 0.5), mix(cbcrs[2], cbcrs[3], 0.5), 0.5); - imageStore(chroma, ivec3(offset.xy/2 + gl_GlobalInvocationID.xy, 0), vec4(cbcr.x, cbcr.y, 0, 0)); -- -+ imageStore(chroma, ivec3(offset.xy/2 + gl_GlobalInvocationID.xy, 0), vec4(cbcra.x, cbcra.y, 0, 0) / 4); -+ imageStore(luma, ivec3(offset.xy/2 + gl_GlobalInvocationID.xy, 1), vec4(cbcra.z, 0, 0, 0) / 4); - imageStore(chroma, ivec3(offset.xy/2 + gl_GlobalInvocationID.xy, 1), vec4(0.5, 0.5, 0, 0)); + +- imageStore(chroma, ivec3(offset.xy/2 + gl_GlobalInvocationID.xy, 1), vec4(0.5, 0.5, 0, 0)); - alpha = vec4(mix(mix(alpha[0], alpha[1], 0.5), mix(alpha[2], alpha[3], 0.5), 0.5)); - imageStore(luma, ivec3(offset.xy/2 + gl_GlobalInvocationID.xy, 1), alpha); ++ if (ix %2 == 0 && iy %2 == 0) ++ { ++ imageStore(chroma, ivec3(offset.xy/2 + gl_GlobalInvocationID.xy/2, 0), vec4(sum.y, sum.z, 0, 0) / 4); ++ imageStore(luma, ivec3(offset.xy/2 + gl_GlobalInvocationID.xy/2, 1), vec4(sum.w, 0, 0, 0) / 4); ++ imageStore(chroma, ivec3(offset.xy/2 + gl_GlobalInvocationID.xy/2, 1), vec4(0.5, 0.5, 0, 0)); ++ } } diff --git a/src/xrt/compositor/util/comp_render_cs.c b/src/xrt/compositor/util/comp_render_cs.c index b2d3ce10d..69429dc97 100644 diff --git a/patches/monado/0011-a-vk-Track-VK_KHR_video_maintenance1.patch b/patches/monado/0011-a-vk-Track-VK_KHR_video_maintenance1.patch index 82cc60f8..d33beefb 100644 --- a/patches/monado/0011-a-vk-Track-VK_KHR_video_maintenance1.patch +++ b/patches/monado/0011-a-vk-Track-VK_KHR_video_maintenance1.patch @@ -1,7 +1,7 @@ -From 4905a1bd2a32d0cef4ade575021b17cf453632f0 Mon Sep 17 00:00:00 2001 +From 34699c38c4ebb5c968b4e1053ddbf48b31dbe72d Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Tue, 5 Aug 2025 15:51:48 +0200 -Subject: [PATCH 1/3] a/vk: Track VK_KHR_video_maintenance1 +Subject: [PATCH 11/13] a/vk: Track VK_KHR_video_maintenance1 --- scripts/generate_vk_helpers.py | 1 + diff --git a/patches/monado/0012-a-vk-Expose-video_maintenance_1-device-feature.patch b/patches/monado/0012-a-vk-Expose-video_maintenance_1-device-feature.patch index 6e696995..cb3c4b18 100644 --- a/patches/monado/0012-a-vk-Expose-video_maintenance_1-device-feature.patch +++ b/patches/monado/0012-a-vk-Expose-video_maintenance_1-device-feature.patch @@ -1,7 +1,7 @@ -From 26d9345724a868304b9d3ca5b58fecef02493df3 Mon Sep 17 00:00:00 2001 +From 2300c7509699db2a59e4bd0eee33890a2d906156 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Tue, 5 Aug 2025 16:00:59 +0200 -Subject: [PATCH 2/3] a/vk: Expose video_maintenance_1 device feature +Subject: [PATCH 12/13] a/vk: Expose video_maintenance_1 device feature --- src/xrt/auxiliary/vk/vk_bundle_init.c | 40 +++++++++++++++++++++++++-- diff --git a/patches/monado/0013-c-util-Request-video_maintenance_1-feature.patch b/patches/monado/0013-c-util-Request-video_maintenance_1-feature.patch index 8e5cfeeb..4b1b7618 100644 --- a/patches/monado/0013-c-util-Request-video_maintenance_1-feature.patch +++ b/patches/monado/0013-c-util-Request-video_maintenance_1-feature.patch @@ -1,7 +1,7 @@ -From b8e23426ec5ac97efdceaf2a319b9d5921e7b412 Mon Sep 17 00:00:00 2001 +From 8c874368dfaa363e088e91c05adf2a96f921671d Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Tue, 5 Aug 2025 16:01:59 +0200 -Subject: [PATCH 3/3] c/util: Request video_maintenance_1 feature +Subject: [PATCH 13/13] c/util: Request video_maintenance_1 feature This will only be enabled if the VK_KHR_maintenance1 extension was requested. From 31c347475e4c84f1c7e6ab14b1fe045bf252ddf9 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Fri, 15 Aug 2025 23:16:53 +0200 Subject: [PATCH 45/85] Cleanup some redundant variables --- client/scenes/stream.cpp | 15 +++++++-------- client/scenes/stream.h | 2 -- client/scenes/stream_reprojection.cpp | 14 +++++++------- client/scenes/stream_reprojection.h | 5 +---- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index 7dd945a3..9db56dbb 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -1008,6 +1008,10 @@ void scenes::stream::render(const XrFrameState & frame_state) uint16_t x_offset = 0; for (auto & out: decoder_output) { + vk::Extent2D decoder_out_size{ + .width = decoder_out_image.info().extent.width, + .height = decoder_out_image.info().extent.height, + }; command_buffer.beginRenderPass( { .renderPass = *blit_render_pass, @@ -1316,10 +1320,7 @@ void scenes::stream::setup(const to_headset::video_stream_description & descript } // Create outputs for the decoders - decoder_out_size = vk::Extent2D{video_width, video_height}; { - decoder_out_format = vk::Format::eA8B8G8R8SrgbPack32; - vk::ImageCreateInfo image_info{ .flags = vk::ImageCreateFlags{}, .imageType = vk::ImageType::e2D, @@ -1343,7 +1344,7 @@ void scenes::stream::setup(const to_headset::video_stream_description & descript vk::ImageViewCreateInfo image_view_info{ .image = vk::Image{decoder_out_image}, .viewType = vk::ImageViewType::e2D, - .format = vk::Format::eA8B8G8R8SrgbPack32, + .format = image_info.format, .components = {}, .subresourceRange = { .aspectMask = vk::ImageAspectFlagBits::eColor, @@ -1367,8 +1368,8 @@ void scenes::stream::setup(const to_headset::video_stream_description & descript .renderPass = *blit_render_pass, .attachmentCount = 1, .pAttachments = &*output.image_view, - .width = decoder_out_size.width, - .height = decoder_out_size.height, + .width = image_info.extent.width, + .height = image_info.extent.height, .layers = 1, }); } @@ -1435,8 +1436,6 @@ void scenes::stream::setup_reprojection_swapchain(uint32_t swapchain_width, uint device, physical_device, decoder_out_image, - vk::Extent2D{.width = video_width, .height = video_height}, - 2, swapchain_images, extent, swapchain.format()); diff --git a/client/scenes/stream.h b/client/scenes/stream.h index aa28435a..3c227e90 100644 --- a/client/scenes/stream.h +++ b/client/scenes/stream.h @@ -101,8 +101,6 @@ private: vk::raii::DescriptorPool blit_descriptor_pool = nullptr; vk::raii::RenderPass blit_render_pass = nullptr; - vk::Extent2D decoder_out_size; - vk::Format decoder_out_format; image_allocation decoder_out_image; struct renderpass_output diff --git a/client/scenes/stream_reprojection.cpp b/client/scenes/stream_reprojection.cpp index deddb0b2..91443138 100644 --- a/client/scenes/stream_reprojection.cpp +++ b/client/scenes/stream_reprojection.cpp @@ -74,16 +74,16 @@ stream_reprojection::vertex * stream_reprojection::get_vertices(size_t view) stream_reprojection::stream_reprojection( vk::raii::Device & device, vk::raii::PhysicalDevice & physical_device, - vk::Image input_image_, - vk::Extent2D input_extent, - uint32_t view_count, + image_allocation & input_image, std::vector output_images_, vk::Extent2D output_extent, vk::Format format) : - view_count(view_count), + view_count(input_image.info().arrayLayers), device(device), - input_image(input_image_), - input_extent(input_extent), + input_extent{ + .width = input_image.info().extent.width, + .height = input_image.info().extent.height, + }, output_images(std::move(output_images_)), output_extent(output_extent) { @@ -144,7 +144,7 @@ stream_reprojection::stream_reprojection( vk::ImageViewCreateInfo iv_info{ .image = input_image, .viewType = vk::ImageViewType::e2D, - .format = vk::Format::eA8B8G8R8SrgbPack32, + .format = input_image.info().format, .components = { .r = vk::ComponentSwizzle::eIdentity, .g = vk::ComponentSwizzle::eIdentity, diff --git a/client/scenes/stream_reprojection.h b/client/scenes/stream_reprojection.h index 6854d4d6..49143149 100644 --- a/client/scenes/stream_reprojection.h +++ b/client/scenes/stream_reprojection.h @@ -43,7 +43,6 @@ class stream_reprojection // Source image vk::raii::Sampler sampler = nullptr; - vk::Image input_image; std::vector input_image_views; std::vector descriptor_sets; vk::Extent2D input_extent; @@ -61,9 +60,7 @@ public: stream_reprojection( vk::raii::Device & device, vk::raii::PhysicalDevice & physical_device, - vk::Image input_image, - vk::Extent2D input_extent, - uint32_t view_count, + image_allocation & input_image, std::vector output_images, vk::Extent2D output_extent, vk::Format format); From 757e0fd97b9a2091fe15334cd9119939ea2d6118 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Fri, 15 Aug 2025 23:27:44 +0200 Subject: [PATCH 46/85] merge tracking control and its mutex --- client/scenes/stream.h | 3 +-- client/scenes/stream_gui.cpp | 17 ++++++++++++++--- client/scenes/stream_tracking.cpp | 12 ++++-------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/client/scenes/stream.h b/client/scenes/stream.h index 3c227e90..ac1bf2de 100644 --- a/client/scenes/stream.h +++ b/client/scenes/stream.h @@ -85,8 +85,7 @@ private: std::unique_ptr network_session; std::atomic exiting = false; std::thread network_thread; - std::mutex tracking_control_mutex; - to_headset::tracking_control tracking_control{}; + thread_safe tracking_control{}; std::array, 2> interaction_profiles; // left and right hand std::atomic recenter_requested = false; std::atomic display_time_phase = 0; diff --git a/client/scenes/stream_gui.cpp b/client/scenes/stream_gui.cpp index 1164543f..e02b8719 100644 --- a/client/scenes/stream_gui.cpp +++ b/client/scenes/stream_gui.cpp @@ -389,8 +389,14 @@ void scenes::stream::gui_performance_metrics() 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(tracking_control.max_offset).count()).c_str()); + ImGui::Text( + "%s", + fmt::format( + _F("Estimated motion to photons latency: {}ms"), + std::chrono::duration_cast( + tracking_control.lock()->max_offset) + .count()) + .c_str()); if (is_gui_interactable()) ImGui::Text("%s", _S("Press the grip button to move the window")); @@ -417,7 +423,12 @@ void scenes::stream::gui_compact_view() 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(tracking_control.max_offset).count() * 1e-3f, "ms"); + f(_S("Motion to photon latency"), + std::chrono::duration_cast( + tracking_control.lock()->max_offset) + .count() * + 1e-3f, + "ms"); ImGui::EndTable(); } } diff --git a/client/scenes/stream_tracking.cpp b/client/scenes/stream_tracking.cpp index afc3c958..9ce2322b 100644 --- a/client/scenes/stream_tracking.cpp +++ b/client/scenes/stream_tracking.cpp @@ -433,11 +433,7 @@ void scenes::stream::tracking() timer t(instance); int samples = 0; - to_headset::tracking_control control; - { - std::lock_guard lock(tracking_control_mutex); - control = tracking_control; - } + auto control = *tracking_control.lock(); XrDuration prediction = std::clamp(control.max_offset.count(), 0, 80'000'000); auto period = std::max(display_time_period.load(), 1'000'000); @@ -636,13 +632,13 @@ void scenes::stream::tracking() void scenes::stream::operator()(to_headset::tracking_control && packet) { - std::lock_guard lock(tracking_control_mutex); + auto locked = tracking_control.lock(); auto m = size_t(to_headset::tracking_control::id::microphone); if (audio_handle) audio_handle->set_mic_state(packet.enabled[m]); - tracking_control = packet; - tracking_control.min_offset = std::min(tracking_control.min_offset, tracking_control.max_offset); + *locked = packet; + locked->min_offset = std::min(locked->min_offset, locked->max_offset); } static device_id derived_from(device_id target) From 5784cbd4fa0b7970f70218dd5492ec37b9e84d87 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Fri, 15 Aug 2025 23:28:35 +0200 Subject: [PATCH 47/85] remove unused include --- client/scenes/stream.h | 1 - 1 file changed, 1 deletion(-) diff --git a/client/scenes/stream.h b/client/scenes/stream.h index ac1bf2de..1b61d4ed 100644 --- a/client/scenes/stream.h +++ b/client/scenes/stream.h @@ -21,7 +21,6 @@ #include "audio/audio.h" #include "decoder/shard_accumulator.h" -#include "imgui.h" #include "render/imgui_impl.h" #include "scene.h" #include "scenes/input_profile.h" From b1d6d50a4a30a7897fe06129e650cc5f252e8ecc Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Fri, 15 Aug 2025 23:40:40 +0200 Subject: [PATCH 48/85] Replace unused frames() method with empty() --- client/scenes/stream.cpp | 9 ++++----- client/scenes/stream.h | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index 9db56dbb..dccc3291 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -527,7 +527,7 @@ void scenes::stream::push_blit_handle(shard_accumulator * decoder, std::shared_p } if (state_ != state::streaming and std::ranges::all_of(decoders, [](accumulator_images & i) { - return i.alpha() or not i.frames().empty(); + return i.alpha() or not i.empty(); })) { state_ = state::streaming; @@ -546,15 +546,14 @@ bool scenes::stream::accumulator_images::alpha() const return decoder->desc().channels == wivrn::to_headset::video_stream_description::channels_t::alpha; } -std::vector scenes::stream::accumulator_images::frames() const +bool scenes::stream::accumulator_images::empty() const { - std::vector result; for (const auto & frame: latest_frames) { if (frame) - result.push_back(frame->feedback.frame_index); + return false; } - return result; + return true; } std::vector> scenes::stream::common_frame(XrTime display_time) diff --git a/client/scenes/stream.h b/client/scenes/stream.h index 1b61d4ed..391d2a9b 100644 --- a/client/scenes/stream.h +++ b/client/scenes/stream.h @@ -67,12 +67,12 @@ private: vk::DescriptorSet descriptor_set = nullptr; vk::raii::PipelineLayout blit_pipeline_layout = nullptr; vk::raii::Pipeline blit_pipeline = nullptr; - // latest frames from oldest to most recent + // latest frames, rolling buffer std::array, image_buffer_size> latest_frames; std::shared_ptr frame(uint64_t id) const; bool alpha() const; - std::vector frames() const; + bool empty() const; }; wifi_lock::wifi wifi; From dc04f7edccce4cce1dba5d0385154b3277c45172 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sat, 16 Aug 2025 10:28:45 +0200 Subject: [PATCH 49/85] Add utility to write specialization constants --- client/render/scene_renderer.cpp | 40 +++---------- client/scenes/stream.cpp | 49 +++------------- client/scenes/stream_reprojection.cpp | 54 +++-------------- common/vk/specialization_constants.h | 84 +++++++++++++++++++++++++++ 4 files changed, 110 insertions(+), 117 deletions(-) create mode 100644 common/vk/specialization_constants.h diff --git a/client/render/scene_renderer.cpp b/client/render/scene_renderer.cpp index d944c559..da28ec8f 100644 --- a/client/render/scene_renderer.cpp +++ b/client/render/scene_renderer.cpp @@ -28,6 +28,7 @@ #include "vk/allocation.h" #include "vk/pipeline.h" #include "vk/shader.h" +#include "vk/specialization_constants.h" #include #include #include @@ -535,34 +536,11 @@ vk::raii::Pipeline scene_renderer::create_pipeline(const pipeline_info & info) auto vertex_shader = load_shader(device, info.shader_name + ".vert"); auto fragment_shader = load_shader(device, info.shader_name + ".frag"); - std::array specialization_constants_desc{ - vk::SpecializationMapEntry{ - .constantID = 0, - .offset = offsetof(pipeline_info, nb_texcoords), - .size = sizeof(int32_t), - }, - vk::SpecializationMapEntry{ - .constantID = 1, - .offset = offsetof(pipeline_info, dithering), - .size = sizeof(VkBool32), - }, - vk::SpecializationMapEntry{ - .constantID = 2, - .offset = offsetof(pipeline_info, alpha_cutout), - .size = sizeof(VkBool32), - }, - vk::SpecializationMapEntry{ - .constantID = 3, - .offset = offsetof(pipeline_info, skinning), - .size = sizeof(VkBool32), - }}; - - vk::SpecializationInfo specialization{ - .mapEntryCount = specialization_constants_desc.size(), - .pMapEntries = specialization_constants_desc.data(), - .dataSize = sizeof(pipeline_info), - .pData = &info, - }; + auto specialization = make_specialization_constants( + int32_t(info.nb_texcoords), + VkBool32(info.dithering), + VkBool32(info.alpha_cutout), + VkBool32(info.skinning)); return vk::raii::Pipeline{ device, @@ -573,14 +551,14 @@ vk::raii::Pipeline scene_renderer::create_pipeline(const pipeline_info & info) .stage = vk::ShaderStageFlagBits::eVertex, .module = *vertex_shader, .pName = "main", - .pSpecializationInfo = &specialization, + .pSpecializationInfo = specialization, }, vk::PipelineShaderStageCreateInfo{ .stage = vk::ShaderStageFlagBits::eFragment, .module = *fragment_shader, .pName = "main", - .pSpecializationInfo = &specialization, + .pSpecializationInfo = specialization, }, }, @@ -797,7 +775,7 @@ void scene_renderer::update_material_descriptor_set(renderer::material & materia device.updateDescriptorSets(write_ds, {}); } -static void print_scene_hierarchy(const entt::registry & scene, entt::entity root = entt::null, int level = 0) +[[maybe_unused]] static void print_scene_hierarchy(const entt::registry & scene, entt::entity root = entt::null, int level = 0) { if (level == 0) spdlog::info("Node hierarchy:"); diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index dccc3291..50dca0a8 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -42,6 +42,7 @@ #include "utils/ranges.h" #include "vk/pipeline.h" #include "vk/shader.h" +#include "vk/specialization_constants.h" #include "wivrn_packets.h" #include #include @@ -804,51 +805,19 @@ void scenes::stream::render(const XrFrameState & frame_state) const auto & description = i.decoder->desc(); vk::Extent2D image_size = i.decoder->image_size(); - std::array useful_size{ - float(description.width) / image_size.width, - float(description.height) / image_size.height, - }; spdlog::info("useful size: {}x{} with buffer {}x{}", description.width, description.height, image_size.width, image_size.height); - std::array specialization_constants_desc{ - vk::SpecializationMapEntry{ - .constantID = 0, - .offset = 0, - .size = sizeof(float), - }, - vk::SpecializationMapEntry{ - .constantID = 1, - .offset = sizeof(float), - .size = sizeof(float), - }}; + auto vert_constants = make_specialization_constants( + float(description.width) / image_size.width, + float(description.height) / image_size.height); - vk::SpecializationInfo vert_specialization_info; - vert_specialization_info.setMapEntries(specialization_constants_desc); - vert_specialization_info.setData(useful_size); - - std::array constants = { - need_srgb_conversion(guess_model()), - i.alpha(), - }; - std::array frag_specialization_constant_desc = { - vk::SpecializationMapEntry{ - .constantID = 0, - .offset = 0, - .size = sizeof(constants[0]), - }, - vk::SpecializationMapEntry{ - .constantID = 1, - .offset = sizeof(constants[0]), - .size = sizeof(constants[1]), - }, - }; - vk::SpecializationInfo frag_specialization_info; - frag_specialization_info.setMapEntries(frag_specialization_constant_desc); - frag_specialization_info.setData(constants); + auto frag_constants = make_specialization_constants( + VkBool32(need_srgb_conversion(guess_model())), + VkBool32(i.alpha())); // Create graphics pipeline vk::raii::ShaderModule vertex_shader = load_shader(device, "stream.vert"); @@ -866,13 +835,13 @@ void scenes::stream::render(const XrFrameState & frame_state) .stage = vk::ShaderStageFlagBits::eVertex, .module = *vertex_shader, .pName = "main", - .pSpecializationInfo = &vert_specialization_info, + .pSpecializationInfo = vert_constants, }, { .stage = vk::ShaderStageFlagBits::eFragment, .module = *fragment_shader, .pName = "main", - .pSpecializationInfo = &frag_specialization_info, + .pSpecializationInfo = frag_constants, }}, .VertexBindingDescriptions = {}, .VertexAttributeDescriptions = {}, diff --git a/client/scenes/stream_reprojection.cpp b/client/scenes/stream_reprojection.cpp index 91443138..6528ea13 100644 --- a/client/scenes/stream_reprojection.cpp +++ b/client/scenes/stream_reprojection.cpp @@ -24,6 +24,7 @@ #include "vk/allocation.h" #include "vk/pipeline.h" #include "vk/shader.h" +#include "vk/specialization_constants.h" #include #include #include @@ -39,13 +40,6 @@ struct stream_reprojection::vertex alignas(8) glm::vec2 uv; }; -struct SgsrSpecializationConstants -{ - VkBool32 use_edge_direction; - float edge_threshold; - float edge_sharpness; -}; - void stream_reprojection::ensure_vertices(size_t num_vertices) { vk::BufferCreateInfo create_info{ @@ -223,46 +217,14 @@ stream_reprojection::stream_reprojection( vk::raii::ShaderModule vertex_shader = load_shader(device, "reprojection.vert"); // Fragment shader - std::string fragment_shader_name = "reprojection.frag"; - vk::SpecializationInfo fragment_specialization_info; - SgsrSpecializationConstants fragment_specialization_constants; - std::vector fragment_specialization_constants_desc; - const configuration::sgsr_settings sgsr = application::get_config().sgsr; - if (sgsr.enabled) - { - fragment_shader_name = "reprojection_sgsr.frag"; + const configuration::sgsr_settings & sgsr = application::get_config().sgsr; + auto sgsr_specialization = make_specialization_constants( + VkBool32(sgsr.use_edge_direction), + float(sgsr.edge_threshold / 255.f), + float(sgsr.edge_sharpness)); - fragment_specialization_constants = { - .use_edge_direction = sgsr.use_edge_direction, - .edge_threshold = float(sgsr.edge_threshold / 255.0), - .edge_sharpness = sgsr.edge_sharpness, - }; - - fragment_specialization_constants_desc = { - vk::SpecializationMapEntry{ - .constantID = 0, - .offset = offsetof(SgsrSpecializationConstants, use_edge_direction), - .size = sizeof(fragment_specialization_constants.use_edge_direction), - }, - vk::SpecializationMapEntry{ - .constantID = 1, - .offset = offsetof(SgsrSpecializationConstants, edge_threshold), - .size = sizeof(fragment_specialization_constants.edge_threshold), - }, - vk::SpecializationMapEntry{ - .constantID = 2, - .offset = offsetof(SgsrSpecializationConstants, edge_sharpness), - .size = sizeof(fragment_specialization_constants.edge_sharpness), - }, - }; - - fragment_specialization_info.setMapEntries(fragment_specialization_constants_desc); - fragment_specialization_info.setDataSize(sizeof(fragment_specialization_constants)); - fragment_specialization_info.setPData(&fragment_specialization_constants); - } - - vk::raii::ShaderModule fragment_shader = load_shader(device, fragment_shader_name); + vk::raii::ShaderModule fragment_shader = load_shader(device, sgsr.enabled ? "reprojection_sgsr.frag" : "reprojection.frag"); // Create graphics pipeline vk::PipelineLayoutCreateInfo pipeline_layout_info; @@ -282,7 +244,7 @@ stream_reprojection::stream_reprojection( .stage = vk::ShaderStageFlagBits::eFragment, .module = *fragment_shader, .pName = "main", - .pSpecializationInfo = &fragment_specialization_info, + .pSpecializationInfo = sgsr.enabled ? sgsr_specialization.info() : nullptr, }, }, .VertexBindingDescriptions = { diff --git a/common/vk/specialization_constants.h b/common/vk/specialization_constants.h new file mode 100644 index 00000000..a2d513ab --- /dev/null +++ b/common/vk/specialization_constants.h @@ -0,0 +1,84 @@ +/* + * WiVRn VR streaming + * Copyright (C) 2025 Patrick Nicolas + * + * 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 . + */ + +#pragma once + +#include +#include +#include +#include + +template +class specialization_constants +{ + std::tuple values; + std::array entries; + vk::SpecializationInfo info_; + + specialization_constants(specialization_constants &&) = delete; + specialization_constants(const specialization_constants &) = delete; + specialization_constants & operator=(const specialization_constants &) = delete; + specialization_constants & operator=(specialization_constants &&) = delete; + + template + void fill_entries() + { + entries[i] = vk::SpecializationMapEntry{ + .constantID = i, + .offset = uint32_t(uintptr_t(std::addressof(std::get(values))) - uintptr_t(std::addressof(values))), + .size = sizeof(std::get(values)), + }; + if constexpr (i > 0) + fill_entries(); + } + +public: + specialization_constants(Args &&... args) : + values(std::forward(args)...), + info_{ + .mapEntryCount = uint32_t(entries.size()), + .pMapEntries = entries.data(), + .dataSize = sizeof(values), + .pData = &values, + } + { + fill_entries(); + } + + operator vk::SpecializationInfo *() + { + return &info_; + } + + vk::SpecializationInfo * info() + { + return &info_; + } + + template + auto & data() + { + return std::get(values); + } +}; + +template +specialization_constants make_specialization_constants(Args &&... args) +{ + return specialization_constants(std::forward(args)...); +} From c15de9bf27113965561488ced8bff14fdcfe05ae Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sat, 16 Aug 2025 10:54:30 +0200 Subject: [PATCH 50/85] Automatically name image/buffer allocations --- client/application.cpp | 14 +++-- client/render/text_rasterizer.cpp | 68 ++++++++++++------------- common/vk/allocation.h | 6 +++ common/vk/vk_allocator.cpp | 3 +- common/vk/vk_allocator.h | 3 +- server/driver/wivrn_comp_target.cpp | 7 ++- server/driver/wivrn_foveation.cpp | 1 - server/encoder/video_encoder_vulkan.cpp | 16 +++--- server/encoder/video_encoder_x264.cpp | 8 +-- server/utils/wivrn_vk_bundle.cpp | 11 ++-- 10 files changed, 75 insertions(+), 62 deletions(-) diff --git a/client/application.cpp b/client/application.cpp index b0433274..384dee76 100644 --- a/client/application.cpp +++ b/client/application.cpp @@ -902,10 +902,16 @@ void application::initialize_vulkan() pipeline_cache = vk::raii::PipelineCache(vk_device, pipeline_cache_info); allocator.emplace(VmaAllocatorCreateInfo{ - .physicalDevice = *vk_physical_device, - .device = *vk_device, - .instance = *vk_instance, - }); + .physicalDevice = *vk_physical_device, + .device = *vk_device, + .instance = *vk_instance, + }, +#ifndef NDEBUG + debug_utils_found +#else + false +#endif + ); } void application::log_views() diff --git a/client/render/text_rasterizer.cpp b/client/render/text_rasterizer.cpp index d206aa15..ac0f7a83 100644 --- a/client/render/text_rasterizer.cpp +++ b/client/render/text_rasterizer.cpp @@ -139,46 +139,42 @@ text_rasterizer::text_rasterizer(vk::raii::Device & device, vk::raii::PhysicalDe image_allocation text_rasterizer::create_image(vk::Extent2D size) { - image_allocation alloc{device, - vk::ImageCreateInfo{ - .imageType = vk::ImageType::e2D, - .format = text::format, - .extent = { - .width = size.width, - .height = size.height, - .depth = 1, - }, - .mipLevels = 1, - .arrayLayers = 1, - .samples = vk::SampleCountFlagBits::e1, - .tiling = vk::ImageTiling::eOptimal, - .usage = vk::ImageUsageFlagBits::eSampled | vk::ImageUsageFlagBits::eTransferDst, - .sharingMode = vk::SharingMode::eExclusive, - .initialLayout = vk::ImageLayout::eUndefined, - }, - VmaAllocationCreateInfo{ - .flags = 0, - .usage = VMA_MEMORY_USAGE_AUTO, - }}; - - application::set_debug_reports_name(alloc, "text_rasterizer image"); - return alloc; + return {device, + vk::ImageCreateInfo{ + .imageType = vk::ImageType::e2D, + .format = text::format, + .extent = { + .width = size.width, + .height = size.height, + .depth = 1, + }, + .mipLevels = 1, + .arrayLayers = 1, + .samples = vk::SampleCountFlagBits::e1, + .tiling = vk::ImageTiling::eOptimal, + .usage = vk::ImageUsageFlagBits::eSampled | vk::ImageUsageFlagBits::eTransferDst, + .sharingMode = vk::SharingMode::eExclusive, + .initialLayout = vk::ImageLayout::eUndefined, + }, + VmaAllocationCreateInfo{ + .flags = 0, + .usage = VMA_MEMORY_USAGE_AUTO, + }, + "text_rasterizer image"}; } buffer_allocation text_rasterizer::create_buffer(size_t size) { - buffer_allocation alloc{device, - vk::BufferCreateInfo{ - .size = size, - .usage = vk::BufferUsageFlagBits::eTransferSrc, - }, - VmaAllocationCreateInfo{ - .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT, - .usage = VMA_MEMORY_USAGE_AUTO, - }}; - application::set_debug_reports_name(alloc, "text_rasterizer buffer"); - - return alloc; + return {device, + vk::BufferCreateInfo{ + .size = size, + .usage = vk::BufferUsageFlagBits::eTransferSrc, + }, + VmaAllocationCreateInfo{ + .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT, + .usage = VMA_MEMORY_USAGE_AUTO, + }, + "text_rasterizer buffer"}; } text_rasterizer::~text_rasterizer() diff --git a/common/vk/allocation.h b/common/vk/allocation.h index e47242be..91c36d20 100644 --- a/common/vk/allocation.h +++ b/common/vk/allocation.h @@ -131,6 +131,12 @@ public: std::tie(resource, allocation) = traits::create(device, create_info, alloc_info); vmaSetAllocationName(vk_allocator::instance(), allocation, name.c_str()); + if (vk_allocator::instance().has_debug_utils) + device.setDebugUtilsObjectNameEXT(vk::DebugUtilsObjectNameInfoEXT{ + .objectType = T::objectType, + .objectHandle = uint64_t(CType(*resource)), + .pObjectName = name.c_str(), + }); } basic_allocation(const basic_allocation &) = delete; diff --git a/common/vk/vk_allocator.cpp b/common/vk/vk_allocator.cpp index 9ea62e63..27371fcd 100644 --- a/common/vk/vk_allocator.cpp +++ b/common/vk/vk_allocator.cpp @@ -20,7 +20,8 @@ #include "vk_allocator.h" #include "vk/check.h" -vk_allocator::vk_allocator(const VmaAllocatorCreateInfo & info) +vk_allocator::vk_allocator(const VmaAllocatorCreateInfo & info, bool has_debug_utils) : + has_debug_utils(has_debug_utils) { CHECK_VK(vmaCreateAllocator(&info, &handle)); } diff --git a/common/vk/vk_allocator.h b/common/vk/vk_allocator.h index 182ca114..ecb156e3 100644 --- a/common/vk/vk_allocator.h +++ b/common/vk/vk_allocator.h @@ -27,7 +27,8 @@ class vk_allocator : public singleton VmaAllocator handle = nullptr; public: - vk_allocator(const VmaAllocatorCreateInfo &); + const bool has_debug_utils; + vk_allocator(const VmaAllocatorCreateInfo &, bool has_debug_utils); ~vk_allocator(); operator VmaAllocator() diff --git a/server/driver/wivrn_comp_target.cpp b/server/driver/wivrn_comp_target.cpp index 2c0aa5ed..b529e359 100644 --- a/server/driver/wivrn_comp_target.cpp +++ b/server/driver/wivrn_comp_target.cpp @@ -232,9 +232,12 @@ static VkResult create_images(struct wivrn_comp_target * cn, vk::ImageUsageFlags for (uint32_t i = 0; i < cn->image_count; i++) { auto & image = cn->psc.images[i].image; - image = image_allocation(device, image_info.get(), {.usage = VMA_MEMORY_USAGE_AUTO}); + image = image_allocation( + device, + image_info.get(), + {.usage = VMA_MEMORY_USAGE_AUTO}, + std::format("comp target image {}", i)); cn->images[i].handle = image; - cn->wivrn_bundle->name(vk::Image(image), "comp target image"); } for (uint32_t i = 0; i < cn->image_count; i++) diff --git a/server/driver/wivrn_foveation.cpp b/server/driver/wivrn_foveation.cpp index 500605d2..747ef6e5 100644 --- a/server/driver/wivrn_foveation.cpp +++ b/server/driver/wivrn_foveation.cpp @@ -335,7 +335,6 @@ wivrn_foveation::wivrn_foveation(wivrn_vk_bundle & bundle, const xrt_hmd_parts & .usage = VMA_MEMORY_USAGE_AUTO_PREFER_HOST, }, "foveation staging buffer"); - bundle.name(vk::Buffer(host_buffer), "foveation staging buffer"); } bundle.name(command_pool, "foveation command pool"); bundle.name(cmd, "foveation command buffer"); diff --git a/server/encoder/video_encoder_vulkan.cpp b/server/encoder/video_encoder_vulkan.cpp index c18e21a9..9da1bc06 100644 --- a/server/encoder/video_encoder_vulkan.cpp +++ b/server/encoder/video_encoder_vulkan.cpp @@ -176,8 +176,8 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca img_create_info, { .usage = VMA_MEMORY_USAGE_AUTO, - }); - vk.name(vk::Image(dpb_image), "vulkan encoder DPB image"); + }, + "vulkan encoder DPB image"); } // Output buffer @@ -195,8 +195,8 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca { .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT | VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT, .usage = VMA_MEMORY_USAGE_AUTO, - }); - vk.name(vk::Buffer(item.output_buffer), "vulkan encode output buffer"); + }, + "vulkan encode output buffer"); if (not(item.output_buffer.properties() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)) { @@ -208,8 +208,8 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca { .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT, .usage = VMA_MEMORY_USAGE_AUTO, - }); - vk.name(vk::Buffer(item.host_buffer), "vulkan encode host buffer"); + }, + "vulkan encode host buffer"); } } @@ -292,8 +292,8 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca }, { .usage = VMA_MEMORY_USAGE_AUTO, - }); - vk.name(vk::Image(slot_data[i].tmp_image), "vulkan encoder temporary image"); + }, + "vulkan encoder temporary image"); image_view_template.image = vk::Image(slot_data[i].tmp_image); slot_data[i].view = vk.device.createImageView(image_view_template); vk.name(slot_data[i].view, "vulkan encoder temporary image view"); diff --git a/server/encoder/video_encoder_x264.cpp b/server/encoder/video_encoder_x264.cpp index fcb28162..048282df 100644 --- a/server/encoder/video_encoder_x264.cpp +++ b/server/encoder/video_encoder_x264.cpp @@ -168,7 +168,8 @@ video_encoder_x264::video_encoder_x264( { .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT, .usage = VMA_MEMORY_USAGE_AUTO, - }); + }, + "x264 luma buffer"); i.chroma = buffer_allocation( vk.device, { .size = vk::DeviceSize(settings.video_width * settings.video_height / 2), @@ -177,9 +178,8 @@ video_encoder_x264::video_encoder_x264( { .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT, .usage = VMA_MEMORY_USAGE_AUTO, - }); - vk.name(vk::Buffer(i.luma), "x264 luma buffer"); - vk.name(vk::Buffer(i.chroma), "x264 chroma buffer"); + }, + "x264 chroma buffer"); auto & pic = i.pic; x264_picture_init(&pic); diff --git a/server/utils/wivrn_vk_bundle.cpp b/server/utils/wivrn_vk_bundle.cpp index 5a01c2a9..5d9b688a 100644 --- a/server/utils/wivrn_vk_bundle.cpp +++ b/server/utils/wivrn_vk_bundle.cpp @@ -83,11 +83,12 @@ wivrn::wivrn_vk_bundle::wivrn_vk_bundle(vk_bundle & vk, std::span physical_device(instance, vk.physical_device), device(physical_device, vk.device), allocator({ - .physicalDevice = vk.physical_device, - .device = vk.device, - .instance = vk.instance, - .vulkanApiVersion = VK_MAKE_VERSION(1, 3, 0), // FIXME: sync with wivrn_session.cpp - }), + .physicalDevice = vk.physical_device, + .device = vk.device, + .instance = vk.instance, + .vulkanApiVersion = VK_MAKE_VERSION(1, 3, 0), // FIXME: sync with wivrn_session.cpp + }, + vk.has_EXT_debug_utils), queue(device, vk.queue_family_index, vk.queue_index), queue_family_index(vk.queue_family_index), #ifdef VK_KHR_video_encode_queue From b9052c6ebb20466b0d01afdf5fe294bfa281cdd0 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sat, 16 Aug 2025 11:52:13 +0200 Subject: [PATCH 51/85] controller/hand_interaction: fix ODR, race condition --- server/driver/wivrn_controller.cpp | 149 ++++++++++++----------- server/driver/wivrn_controller.h | 7 ++ server/driver/wivrn_hand_interaction.cpp | 98 ++++----------- 3 files changed, 103 insertions(+), 151 deletions(-) diff --git a/server/driver/wivrn_controller.cpp b/server/driver/wivrn_controller.cpp index f5f6633f..796eb14c 100644 --- a/server/driver/wivrn_controller.cpp +++ b/server/driver/wivrn_controller.cpp @@ -37,6 +37,8 @@ namespace wivrn { +namespace +{ enum wivrn_controller_input_index { WIVRN_CONTROLLER_INPUT_INVALID = -1, @@ -98,7 +100,7 @@ struct input_data xrt_device_type device; }; -static input_data map_input(device_id id) +input_data map_input(device_id id) { switch (id) { @@ -247,18 +249,18 @@ static input_data map_input(device_id id) return {WIVRN_CONTROLLER_INPUT_INVALID, wivrn_input_type::BOOL, XRT_DEVICE_TYPE_UNKNOWN}; } -static xrt_binding_input_pair simple_input_binding[] = { +xrt_binding_input_pair simple_input_binding[] = { {XRT_INPUT_SIMPLE_SELECT_CLICK, XRT_INPUT_TOUCH_TRIGGER_VALUE}, {XRT_INPUT_SIMPLE_MENU_CLICK, XRT_INPUT_TOUCH_MENU_CLICK}, {XRT_INPUT_SIMPLE_GRIP_POSE, XRT_INPUT_TOUCH_GRIP_POSE}, {XRT_INPUT_SIMPLE_AIM_POSE, XRT_INPUT_TOUCH_AIM_POSE}, }; -static xrt_binding_output_pair simple_output_binding[] = { +xrt_binding_output_pair simple_output_binding[] = { {XRT_OUTPUT_NAME_SIMPLE_VIBRATION, XRT_OUTPUT_NAME_TOUCH_HAPTIC}, }; -static xrt_binding_input_pair index_input_binding[] = { +xrt_binding_input_pair index_input_binding[] = { {XRT_INPUT_INDEX_SYSTEM_CLICK, XRT_INPUT_TOUCH_SYSTEM_CLICK}, {XRT_INPUT_INDEX_SYSTEM_TOUCH, XRT_INPUT_INDEX_SYSTEM_TOUCH}, {XRT_INPUT_INDEX_A_CLICK, XRT_INPUT_TOUCH_A_CLICK}, @@ -280,11 +282,11 @@ static xrt_binding_input_pair index_input_binding[] = { {XRT_INPUT_INDEX_AIM_POSE, XRT_INPUT_TOUCH_AIM_POSE}, }; -static xrt_binding_output_pair index_output_binding[] = { +xrt_binding_output_pair index_output_binding[] = { {XRT_OUTPUT_NAME_INDEX_HAPTIC, XRT_OUTPUT_NAME_TOUCH_HAPTIC}, }; -static xrt_binding_input_pair focus3_input_binding[] = { +xrt_binding_input_pair focus3_input_binding[] = { {XRT_INPUT_VIVE_FOCUS3_X_CLICK, XRT_INPUT_TOUCH_X_CLICK}, {XRT_INPUT_VIVE_FOCUS3_Y_CLICK, XRT_INPUT_TOUCH_Y_CLICK}, {XRT_INPUT_VIVE_FOCUS3_MENU_CLICK, XRT_INPUT_TOUCH_MENU_CLICK}, @@ -305,11 +307,11 @@ static xrt_binding_input_pair focus3_input_binding[] = { {XRT_INPUT_VIVE_FOCUS3_AIM_POSE, XRT_INPUT_TOUCH_AIM_POSE}, }; -static xrt_binding_output_pair focus3_output_binding[] = { +xrt_binding_output_pair focus3_output_binding[] = { {XRT_OUTPUT_NAME_VIVE_FOCUS3_HAPTIC, XRT_OUTPUT_NAME_TOUCH_HAPTIC}, }; -static xrt_binding_input_pair touch_pro_input_binding[] = { +xrt_binding_input_pair touch_pro_input_binding[] = { {XRT_INPUT_TOUCH_PRO_X_CLICK, XRT_INPUT_TOUCH_X_CLICK}, {XRT_INPUT_TOUCH_PRO_X_TOUCH, XRT_INPUT_TOUCH_X_TOUCH}, {XRT_INPUT_TOUCH_PRO_Y_CLICK, XRT_INPUT_TOUCH_Y_CLICK}, @@ -337,13 +339,13 @@ static xrt_binding_input_pair touch_pro_input_binding[] = { {XRT_INPUT_TOUCH_PRO_STYLUS_FORCE, XRT_INPUT_TOUCH_PRO_STYLUS_FORCE}, }; -static xrt_binding_output_pair touch_pro_output_binding[] = { +xrt_binding_output_pair touch_pro_output_binding[] = { {XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC, XRT_OUTPUT_NAME_TOUCH_HAPTIC}, {XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_THUMB, XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_THUMB}, {XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_TRIGGER, XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_TRIGGER}, }; -static xrt_binding_input_pair touch_plus_input_binding[] = { +xrt_binding_input_pair touch_plus_input_binding[] = { {XRT_INPUT_TOUCH_PLUS_X_CLICK, XRT_INPUT_TOUCH_X_CLICK}, {XRT_INPUT_TOUCH_PLUS_X_TOUCH, XRT_INPUT_TOUCH_X_TOUCH}, {XRT_INPUT_TOUCH_PLUS_Y_CLICK, XRT_INPUT_TOUCH_Y_CLICK}, @@ -370,11 +372,11 @@ static xrt_binding_input_pair touch_plus_input_binding[] = { {XRT_INPUT_TOUCH_PLUS_TRIGGER_SLIDE, XRT_INPUT_TOUCH_PRO_TRIGGER_SLIDE}, }; -static xrt_binding_output_pair touch_plus_output_binding[] = { +xrt_binding_output_pair touch_plus_output_binding[] = { {XRT_OUTPUT_NAME_TOUCH_PLUS_HAPTIC, XRT_OUTPUT_NAME_TOUCH_HAPTIC}, }; -static xrt_binding_input_pair pico_neo3_input_binding[] = { +xrt_binding_input_pair pico_neo3_input_binding[] = { {XRT_INPUT_PICO_NEO3_X_CLICK, XRT_INPUT_TOUCH_X_CLICK}, {XRT_INPUT_PICO_NEO3_X_TOUCH, XRT_INPUT_TOUCH_X_TOUCH}, {XRT_INPUT_PICO_NEO3_Y_CLICK, XRT_INPUT_TOUCH_Y_CLICK}, @@ -397,11 +399,11 @@ static xrt_binding_input_pair pico_neo3_input_binding[] = { {XRT_INPUT_PICO_NEO3_B_TOUCH, XRT_INPUT_TOUCH_B_TOUCH}, }; -static xrt_binding_output_pair pico_neo3_output_binding[] = { +xrt_binding_output_pair pico_neo3_output_binding[] = { {XRT_OUTPUT_NAME_PICO_NEO3_HAPTIC, XRT_OUTPUT_NAME_TOUCH_HAPTIC}, }; -static xrt_binding_input_pair pico4_input_binding[] = { +xrt_binding_input_pair pico4_input_binding[] = { {XRT_INPUT_PICO4_X_CLICK, XRT_INPUT_TOUCH_X_CLICK}, {XRT_INPUT_PICO4_X_TOUCH, XRT_INPUT_TOUCH_X_TOUCH}, {XRT_INPUT_PICO4_Y_CLICK, XRT_INPUT_TOUCH_Y_CLICK}, @@ -424,11 +426,11 @@ static xrt_binding_input_pair pico4_input_binding[] = { {XRT_INPUT_PICO4_MENU_CLICK, XRT_INPUT_TOUCH_MENU_CLICK}, }; -static xrt_binding_output_pair pico4_output_binding[] = { +xrt_binding_output_pair pico4_output_binding[] = { {XRT_OUTPUT_NAME_PICO4_HAPTIC, XRT_OUTPUT_NAME_TOUCH_HAPTIC}, }; -static xrt_binding_profile wivrn_binding_profiles[] = { +xrt_binding_profile wivrn_binding_profiles[] = { { .name = XRT_DEVICE_SIMPLE_CONTROLLER, .inputs = simple_input_binding, @@ -480,13 +482,10 @@ static xrt_binding_profile wivrn_binding_profiles[] = { }, }; -namespace -{ struct xrt_space_relation_csv_header {}; -} // namespace -static std::ostream & operator<<(std::ostream & out, const xrt_space_relation_csv_header &) +std::ostream & operator<<(std::ostream & out, const xrt_space_relation_csv_header &) { for (auto [value, name]: magic_enum::enum_entries()) { @@ -503,44 +502,7 @@ static std::ostream & operator<<(std::ostream & out, const xrt_space_relation_cs out << "avx,avy,avz"; return out; } - -static std::ostream & operator<<(std::ostream & out, const xrt_space_relation & rel) -{ - const auto & pos = rel.pose.position; - const auto & o = rel.pose.orientation; - const auto & v = rel.linear_velocity; - const auto & av = rel.angular_velocity; - for (const auto & [value, name]: magic_enum::enum_entries()) - { - if (value and value != XRT_SPACE_RELATION_BITMASK_ALL) - out << bool(rel.relation_flags & value) << ','; - } - out << pos.x << ',' << pos.y << ',' << pos.z << ','; - out << o.w << ',' << o.x << ',' << o.y << ',' << o.z << ','; - out << v.x << ',' << v.y << ',' << v.z << ','; - out << av.x << ',' << av.y << ',' << av.z; - return out; -} - -static std::mutex tracking_dump_mutex; -static std::ofstream & tracking_dump() -{ - static auto res = [] { - std::ofstream res; - if (auto wivrn_dump = std::getenv("WIVRN_DUMP_TRACKING")) - { - res.open(wivrn_dump); - res << "device_id," - "now_ns," - "timestamp_ns," - "extrapolation_ns," - "receive/get," - << xrt_space_relation_csv_header{} << std::endl; - } - return res; - }(); - return res; -} +} // namespace wivrn_controller::wivrn_controller(int hand_id, xrt_device * hmd, @@ -760,9 +722,8 @@ xrt_result_t wivrn_controller::get_tracked_pose(xrt_input_name name, int64_t at_ return XRT_ERROR_INPUT_UNSUPPORTED; } cnx->add_predict_offset(extrapolation_time); - if (auto & out = tracking_dump()) + if (auto out = tracking_dump()) { - std::lock_guard lock{tracking_dump_mutex}; auto device = [&] { switch (name) { @@ -773,12 +734,12 @@ xrt_result_t wivrn_controller::get_tracked_pose(xrt_input_name name, int64_t at_ assert(false); __builtin_unreachable(); } }(); - out << magic_enum::enum_name(device) << ',' - << os_monotonic_get_ns() << ',' - << at_timestamp_ns << ',' - << extrapolation_time.count() << ',' - << "g," - << *res << std::endl; + *out->lock() << magic_enum::enum_name(device) << ',' + << os_monotonic_get_ns() << ',' + << at_timestamp_ns << ',' + << extrapolation_time.count() << ',' + << "g," + << *res << std::endl; ; } return XRT_SUCCESS; @@ -832,19 +793,19 @@ void wivrn_controller::update_tracking(const from_headset::tracking & tracking, cnx->set_enabled(grip.device, false); if (not palm.update_tracking(tracking, offset)) cnx->set_enabled(palm.device, false); - if (auto & out = tracking_dump(); out and offset) + if (auto out = tracking_dump(); out and offset) { - std::lock_guard lock{tracking_dump_mutex}; + auto locked = out->lock(); auto now = os_monotonic_get_ns(); for (const auto & pose: tracking.device_poses) { if (pose.device == aim.device or pose.device == grip.device or pose.device == palm.device) - out << magic_enum::enum_name(pose.device) << ',' - << now << ',' - << offset.from_headset(tracking.timestamp) << ',' - << tracking.timestamp - tracking.production_timestamp << ',' - << "r," - << pose_list::convert_pose(pose) << std::endl; + *locked << magic_enum::enum_name(pose.device) << ',' + << now << ',' + << offset.from_headset(tracking.timestamp) << ',' + << tracking.timestamp - tracking.production_timestamp << ',' + << "r," + << pose_list::convert_pose(pose) << std::endl; } } } @@ -895,4 +856,44 @@ void wivrn_controller::reset_history() aim.reset(); palm.reset(); } + +thread_safe * wivrn_controller::tracking_dump() +{ + static std::unique_ptr> res = [] { + if (auto wivrn_dump = std::getenv("WIVRN_DUMP_TRACKING")) + { + U_LOG_I("Controller tracking dump enabled: %s", wivrn_dump); + std::ofstream res; + res.open(wivrn_dump); + res << "device_id," + "now_ns," + "timestamp_ns," + "extrapolation_ns," + "receive/get," + << xrt_space_relation_csv_header{} << std::endl; + + return std::make_unique>(std::move(res)); + } + return std::unique_ptr>(); + }(); + return res.get(); +} } // namespace wivrn + +std::ostream & operator<<(std::ostream & out, const xrt_space_relation & rel) +{ + const auto & pos = rel.pose.position; + const auto & o = rel.pose.orientation; + const auto & v = rel.linear_velocity; + const auto & av = rel.angular_velocity; + for (const auto & [value, name]: magic_enum::enum_entries()) + { + if (value and value != XRT_SPACE_RELATION_BITMASK_ALL) + out << bool(rel.relation_flags & value) << ','; + } + out << pos.x << ',' << pos.y << ',' << pos.z << ','; + out << o.w << ',' << o.x << ',' << o.y << ',' << o.z << ','; + out << v.x << ',' << v.y << ',' << v.z << ','; + out << av.x << ',' << av.y << ',' << av.z; + return out; +} diff --git a/server/driver/wivrn_controller.h b/server/driver/wivrn_controller.h index 4a737e0b..c560e820 100644 --- a/server/driver/wivrn_controller.h +++ b/server/driver/wivrn_controller.h @@ -23,7 +23,9 @@ #include "hand_joints_list.h" #include "pose_list.h" +#include "utils/thread_safe.h" +#include #include #include @@ -64,5 +66,10 @@ public: void update_hand_tracking(const from_headset::hand_tracking &, const clock_offset &); void reset_history(); + + static thread_safe * tracking_dump(); }; + } // namespace wivrn + +std::ostream & operator<<(std::ostream & out, const xrt_space_relation & rel); diff --git a/server/driver/wivrn_hand_interaction.cpp b/server/driver/wivrn_hand_interaction.cpp index ff68e484..698d9ab4 100644 --- a/server/driver/wivrn_hand_interaction.cpp +++ b/server/driver/wivrn_hand_interaction.cpp @@ -31,13 +31,13 @@ #include #include -#include - #include "xrt/xrt_defines.h" namespace wivrn { +namespace +{ enum wivrn_hand_interaction_input_index { WIVRN_HAND_INTERACTION_INPUT_INVALID = -1, @@ -73,7 +73,7 @@ struct input_data xrt_device_type device; }; -static input_data map_input(device_id id) +input_data map_input(device_id id) { switch (id) { @@ -134,7 +134,7 @@ static input_data map_input(device_id id) return {WIVRN_HAND_INTERACTION_INPUT_INVALID, wivrn_input_type::BOOL, XRT_DEVICE_TYPE_UNKNOWN}; } -static xrt_binding_input_pair hand_interaction_input_binding[] = { +xrt_binding_input_pair hand_interaction_input_binding[] = { {XRT_INPUT_HAND_GRIP_POSE, XRT_INPUT_HAND_GRIP_POSE}, {XRT_INPUT_HAND_AIM_POSE, XRT_INPUT_HAND_AIM_POSE}, {XRT_INPUT_HAND_PINCH_POSE, XRT_INPUT_HAND_PINCH_POSE}, @@ -147,13 +147,13 @@ static xrt_binding_input_pair hand_interaction_input_binding[] = { {XRT_INPUT_HAND_GRASP_READY, XRT_INPUT_HAND_GRASP_READY}, }; -static xrt_binding_input_pair simple_input_binding[] = { +xrt_binding_input_pair simple_input_binding[] = { {XRT_INPUT_SIMPLE_SELECT_CLICK, XRT_INPUT_HAND_PINCH_VALUE}, {XRT_INPUT_SIMPLE_GRIP_POSE, XRT_INPUT_HAND_GRIP_POSE}, {XRT_INPUT_SIMPLE_AIM_POSE, XRT_INPUT_HAND_AIM_POSE}, }; -static xrt_binding_profile wivrn_binding_profiles[] = { +xrt_binding_profile wivrn_binding_profiles[] = { { .name = XRT_DEVICE_EXT_HAND_INTERACTION, .inputs = hand_interaction_input_binding, @@ -169,63 +169,8 @@ static xrt_binding_profile wivrn_binding_profiles[] = { .output_count = 0, }, }; - -namespace -{ -struct xrt_space_relation_csv_header -{}; } // namespace -static std::ostream & operator<<(std::ostream & out, const xrt_space_relation_csv_header &) -{ - for (auto [value, name]: magic_enum::enum_entries()) - { - if (value and value != XRT_SPACE_RELATION_BITMASK_ALL) - { - name = name.substr(strlen("XRT_SPACE_RELATION_")); - name = name.substr(0, name.size() - strlen("_BIT")); - out << name << ","; - } - } - out << "x,y,z,"; - out << "qw,qx,qy,qz"; - return out; -} - -static std::ostream & operator<<(std::ostream & out, const xrt_space_relation & rel) -{ - const auto & pos = rel.pose.position; - const auto & o = rel.pose.orientation; - for (const auto & [value, name]: magic_enum::enum_entries()) - { - if (value and value != XRT_SPACE_RELATION_BITMASK_ALL) - out << bool(rel.relation_flags & value) << ','; - } - out << pos.x << ',' << pos.y << ',' << pos.z << ','; - out << o.w << ',' << o.x << ',' << o.y << ',' << o.z; - return out; -} - -static std::mutex tracking_dump_mutex; -static std::ofstream & tracking_dump() -{ - static auto res = [] { - std::ofstream res; - if (auto wivrn_dump = std::getenv("WIVRN_DUMP_TRACKING")) - { - res.open(wivrn_dump); - res << "device_id," - "now_ns," - "timestamp_ns," - "extrapolation_ns," - "receive/get," - << xrt_space_relation_csv_header{} << std::endl; - } - return res; - }(); - return res; -} - wivrn_hand_interaction::wivrn_hand_interaction(int hand_id, xrt_device * hmd, wivrn::wivrn_session * cnx) : @@ -410,9 +355,8 @@ xrt_result_t wivrn_hand_interaction::get_tracked_pose(xrt_input_name name, int64 return XRT_ERROR_INPUT_UNSUPPORTED; } cnx->add_predict_offset(extrapolation_time); - if (auto & out = tracking_dump()) + if (auto out = wivrn_controller::tracking_dump()) { - std::lock_guard lock{tracking_dump_mutex}; auto device = [&] { switch (name) { @@ -425,12 +369,12 @@ xrt_result_t wivrn_hand_interaction::get_tracked_pose(xrt_input_name name, int64 assert(false); __builtin_unreachable(); } }(); - out << magic_enum::enum_name(device) << ',' - << os_monotonic_get_ns() << ',' - << at_timestamp_ns << ',' - << extrapolation_time.count() << ',' - << "g," - << *res << std::endl; + *out->lock() << magic_enum::enum_name(device) << ',' + << os_monotonic_get_ns() << ',' + << at_timestamp_ns << ',' + << extrapolation_time.count() << ',' + << "g," + << *res << std::endl; ; } return XRT_SUCCESS; @@ -468,19 +412,19 @@ void wivrn_hand_interaction::update_tracking(const from_headset::tracking & trac cnx->set_enabled(pinch_ext.device, false); if (not poke_ext.update_tracking(tracking, offset)) cnx->set_enabled(poke_ext.device, false); - if (auto & out = tracking_dump(); out and offset) + if (auto out = wivrn_controller::tracking_dump(); out and offset) { - std::lock_guard lock{tracking_dump_mutex}; auto now = os_monotonic_get_ns(); + auto locked = out->lock(); for (const auto & pose: tracking.device_poses) { if (pose.device == aim.device or pose.device == grip.device or pose.device == palm.device) - out << magic_enum::enum_name(pose.device) << ',' - << now << ',' - << offset.from_headset(tracking.timestamp) << ',' - << tracking.timestamp - tracking.production_timestamp << ',' - << "r," - << pose_list::convert_pose(pose) << std::endl; + *locked << magic_enum::enum_name(pose.device) << ',' + << now << ',' + << offset.from_headset(tracking.timestamp) << ',' + << tracking.timestamp - tracking.production_timestamp << ',' + << "r," + << pose_list::convert_pose(pose) << std::endl; } } } From bce3e498e8e5fee7f42c3b44ecdd7cecab75c0af Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sat, 16 Aug 2025 12:08:58 +0200 Subject: [PATCH 52/85] Fix destruction of textures still in use --- client/render/imgui_impl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/render/imgui_impl.cpp b/client/render/imgui_impl.cpp index 53d59862..1f762af9 100644 --- a/client/render/imgui_impl.cpp +++ b/client/render/imgui_impl.cpp @@ -1099,6 +1099,13 @@ ImTextureID imgui_context::load_texture(const std::string & filename) void imgui_context::free_texture(ImTextureID texture) { + // Make sure we are done using the texture + std::vector 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)); + textures.erase(texture); } From 94aceb3f0f80c75ce15b1c97820693cbb87b1107 Mon Sep 17 00:00:00 2001 From: Patola Date: Sun, 17 Aug 2025 21:18:47 +0200 Subject: [PATCH 53/85] Update pr_BR strings for small GUI activation option change (#460) --- locale/pt_BR/wivrn-dashboard.po | 66 ++++----- locale/pt_BR/wivrn.po | 254 +++++++++++++++++--------------- 2 files changed, 168 insertions(+), 152 deletions(-) diff --git a/locale/pt_BR/wivrn-dashboard.po b/locale/pt_BR/wivrn-dashboard.po index 60969ea8..2c7eb6ad 100644 --- a/locale/pt_BR/wivrn-dashboard.po +++ b/locale/pt_BR/wivrn-dashboard.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: WiVRn-dashboard\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-04 04:40-0300\n" +"POT-Creation-Date: 2025-08-09 22:47+0200\n" "PO-Revision-Date: 2025-08-08 11:56-0300\n" "Last-Translator: myghi63 \n" "Language: pt_BR\n" @@ -87,7 +87,7 @@ msgid "No precompiled APK is available for this version." msgstr "Nenhum APK pré-compilado está disponível para esta versão." #: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:259 -#: dashboard/qml/Main.qml:341 +#: dashboard/qml/Main.qml:342 #, kde-format msgid "ADB is not installed." msgstr "ADB não está instalado." @@ -136,7 +136,7 @@ msgstr "Reinstalar WiVRn" msgid "Install WiVRn" msgstr "Instalar WiVRn" -#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:354 +#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:355 #, kde-format msgid "Headsets" msgstr "Headsets" @@ -181,7 +181,7 @@ msgstr "Renomear" #: dashboard/qml/HeadsetsPage.qml:55 dashboard/qml/WizardPage.qml:38 #: dashboard/qml/WizardPage.qml:88 dashboard/qml/WizardPage.qml:263 -#: dashboard/qml/WizardPage.qml:326 dashboard/qml/WizardPage.qml:410 +#: dashboard/qml/WizardPage.qml:327 dashboard/qml/WizardPage.qml:411 #, kde-format msgid "Cancel" msgstr "Cancelar" @@ -280,8 +280,8 @@ msgid "" "No OpenVR compatibility detected, Steam games won't be able to load VR.\n" "Install xrizer or OpenComposite." msgstr "" -"Nenhuma compatibilidade com OpenVR foi detectada. Os jogos do Steam não conseg" -"uirão carregar em VR.\n" +"Nenhuma compatibilidade com OpenVR foi detectada. Os jogos do Steam não " +"conseguirão carregar em VR.\n" "Instale o xrizer ou o OpenComposite." #: dashboard/qml/Main.qml:171 @@ -311,7 +311,7 @@ msgstr "Pareando" msgid "PIN: %1" msgstr "PIN: %1" -#: dashboard/qml/Main.qml:250 dashboard/qml/WizardPage.qml:373 +#: dashboard/qml/Main.qml:250 dashboard/qml/WizardPage.qml:374 #, kde-format msgid "Connect by USB" msgstr "Conectar pela USB" @@ -338,22 +338,22 @@ msgstr "Aplicativo" msgid "Steam information" msgstr "Informações da Steam" -#: dashboard/qml/Main.qml:325 +#: dashboard/qml/Main.qml:326 #, kde-format msgid "Wizard" msgstr "Assistente" -#: dashboard/qml/Main.qml:332 +#: dashboard/qml/Main.qml:333 #, kde-format msgid "Install the app" msgstr "Instalar o aplicativo" -#: dashboard/qml/Main.qml:361 dashboard/qml/SettingsPage.qml:14 +#: dashboard/qml/Main.qml:362 dashboard/qml/SettingsPage.qml:14 #, kde-format msgid "Settings" msgstr "Ajustes" -#: dashboard/qml/Main.qml:368 dashboard/qml/TroubleshootPage.qml:10 +#: dashboard/qml/Main.qml:369 dashboard/qml/TroubleshootPage.qml:10 #, kde-format msgid "Troubleshoot" msgstr "Resolver problemas" @@ -645,7 +645,7 @@ msgstr "Comando de lançamento da Steam copiado" msgid "I cannot find the WiVRn app on my headset" msgstr "Não consigo encontrar o aplicativo do WiVRn no meu headset" -#: dashboard/qml/TroubleshootPage.qml:21 dashboard/qml/WizardPage.qml:387 +#: dashboard/qml/TroubleshootPage.qml:21 dashboard/qml/WizardPage.qml:388 #, kde-format msgid "" "If you installed WiVRn over USB on a Meta headset, the app is in the " @@ -659,7 +659,7 @@ msgstr "" msgid "I cannot see my computer in the WiVRn app" msgstr "Não consigo ver meu computador no aplicativo do WiVRn" -#: dashboard/qml/TroubleshootPage.qml:25 dashboard/qml/WizardPage.qml:392 +#: dashboard/qml/TroubleshootPage.qml:25 dashboard/qml/WizardPage.qml:393 #, kde-format msgid "" "If the server is not visible or the connection fails, check that port 5353 " @@ -713,7 +713,7 @@ msgstr "Pareamento está atualmente desativado." msgid "I have no sound on my headset" msgstr "Eu não tenho som no meu headset" -#: dashboard/qml/TroubleshootPage.qml:50 dashboard/qml/WizardPage.qml:440 +#: dashboard/qml/TroubleshootPage.qml:50 dashboard/qml/WizardPage.qml:441 #, kde-format msgid "" "When the headset is connected, select \"WiVRn\" as the default audio output " @@ -738,9 +738,9 @@ msgid "Getting started" msgstr "Começando" #: dashboard/qml/WizardPage.qml:29 dashboard/qml/WizardPage.qml:78 -#: dashboard/qml/WizardPage.qml:253 dashboard/qml/WizardPage.qml:316 -#: dashboard/qml/WizardPage.qml:400 dashboard/qml/WizardPage.qml:447 -#: dashboard/qml/WizardPage.qml:484 +#: dashboard/qml/WizardPage.qml:253 dashboard/qml/WizardPage.qml:317 +#: dashboard/qml/WizardPage.qml:401 dashboard/qml/WizardPage.qml:448 +#: dashboard/qml/WizardPage.qml:485 #, kde-format msgid "Back" msgstr "Voltar" @@ -760,8 +760,8 @@ msgstr "" "ao seu computador." #: dashboard/qml/WizardPage.qml:83 dashboard/qml/WizardPage.qml:258 -#: dashboard/qml/WizardPage.qml:321 dashboard/qml/WizardPage.qml:452 -#: dashboard/qml/WizardPage.qml:489 +#: dashboard/qml/WizardPage.qml:322 dashboard/qml/WizardPage.qml:453 +#: dashboard/qml/WizardPage.qml:490 #, kde-format msgid "Next" msgstr "Próximo" @@ -860,12 +860,12 @@ msgstr "" "O aplicativo que você escolher será iniciado automaticamente quando você " "conectar seu headset." -#: dashboard/qml/WizardPage.qml:300 +#: dashboard/qml/WizardPage.qml:301 #, kde-format msgid "Important information" msgstr "Informação importante" -#: dashboard/qml/WizardPage.qml:307 +#: dashboard/qml/WizardPage.qml:308 #, kde-format msgid "" "WiVRn entirely replaces SteamVR, you should not start SteamVR while WiVRn is " @@ -874,12 +874,12 @@ msgstr "" "O WiVRn substitui o SteamVR completamente, você não deve iniciar o SteamVR " "enquanto o WiVRn estiver rodando." -#: dashboard/qml/WizardPage.qml:358 +#: dashboard/qml/WizardPage.qml:359 #, kde-format msgid "Start the WiVRn app on your headset" msgstr "Iniciar o aplicativo do WiVRn no seu headset" -#: dashboard/qml/WizardPage.qml:363 +#: dashboard/qml/WizardPage.qml:364 #, kde-format msgid "" "To connect over WiFi, start the WiVRn app on your headset, connect to \"%1\" " @@ -888,32 +888,32 @@ msgstr "" "Para conectar pelo WiFi, inicie o aplicativo do WiVRn no seu headset, " "conecte a \"%1\" e entre o PIN \"%2\"." -#: dashboard/qml/WizardPage.qml:370 +#: dashboard/qml/WizardPage.qml:371 #, kde-format msgid "To connect over USB, click on \"Connect by USB\"." msgstr "Para conectar pela USB, clique em \"Conectar pela USB\"." -#: dashboard/qml/WizardPage.qml:383 +#: dashboard/qml/WizardPage.qml:384 #, kde-format msgid "Troubleshooting" msgstr "Resolver problemas" -#: dashboard/qml/WizardPage.qml:405 +#: dashboard/qml/WizardPage.qml:406 #, kde-format msgid "Skip" msgstr "Pular" -#: dashboard/qml/WizardPage.qml:425 +#: dashboard/qml/WizardPage.qml:426 #, kde-format msgid "Connection established" msgstr "Conexão estabelecida" -#: dashboard/qml/WizardPage.qml:430 +#: dashboard/qml/WizardPage.qml:431 #, kde-format msgid "Your headset is now connected." msgstr "Seu headset está conectado agora." -#: dashboard/qml/WizardPage.qml:435 dashboard/qml/WizardPage.qml:477 +#: dashboard/qml/WizardPage.qml:436 dashboard/qml/WizardPage.qml:478 #, kde-format msgid "" "To connect another headset, make sure pairing is enabled in the dashboard " @@ -922,22 +922,22 @@ msgstr "" "Para conectar outro headset, se assegure que o pareamento esteja habilitado " "no painel antes de conectar." -#: dashboard/qml/WizardPage.qml:457 dashboard/qml/WizardPage.qml:494 +#: dashboard/qml/WizardPage.qml:458 dashboard/qml/WizardPage.qml:495 #, kde-format msgid "Finish" msgstr "Terminar" -#: dashboard/qml/WizardPage.qml:472 +#: dashboard/qml/WizardPage.qml:473 #, kde-format msgid "Finished" msgstr "Terminado" -#: dashboard/wivrn_server.cpp:584 +#: dashboard/wivrn_server.cpp:592 #, kde-format msgid "xrizer" msgstr "xrizer" -#: dashboard/wivrn_server.cpp:585 +#: dashboard/wivrn_server.cpp:593 #, kde-format msgid "Open Composite" msgstr "Open Composite" diff --git a/locale/pt_BR/wivrn.po b/locale/pt_BR/wivrn.po index 045e3fb5..aa94b74a 100644 --- a/locale/pt_BR/wivrn.po +++ b/locale/pt_BR/wivrn.po @@ -5,20 +5,22 @@ # LuckShiba , 2025. # # SPDX-FileCopyrightText: 2025 myghi63 +# Claudio Sampaio , 2025. # msgid "" msgstr "" "Project-Id-Version: WiVRn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-04 10:49-0300\n" -"PO-Revision-Date: 2025-08-08 13:27-0300\n" -"Last-Translator: myghi63 \n" +"POT-Creation-Date: 2025-08-16 14:15+0200\n" +"PO-Revision-Date: 2025-08-17 20:58+0200\n" +"Last-Translator: Claudio Sampaio \n" "Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 25.04.3\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Gtranslator 48.0\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"Language-Team: Brazilian Portuguese\n" #: client/scene.cpp:74 msgid "No supported swapchain format" @@ -47,95 +49,96 @@ msgstr "Incapaz de conectar a {} ({}): {}" msgid "Waiting for connection" msgstr "Aguardando conexão" -#: client/scenes/lobby_gui.cpp:229 +#: client/scenes/lobby_gui.cpp:230 msgctxt "openxr_post_processing" msgid "Normal" msgstr "Normal" -#: client/scenes/lobby_gui.cpp:232 +#: client/scenes/lobby_gui.cpp:233 msgctxt "openxr_post_processing" msgid "Quality" msgstr "Qualidade" -#: client/scenes/lobby_gui.cpp:234 +#: client/scenes/lobby_gui.cpp:235 msgctxt "openxr_post_processing" msgid "Disabled" msgstr "Desabilitado" -#: client/scenes/lobby_gui.cpp:242 client/scenes/lobby_gui.cpp:398 -#: client/scenes/stream_gui.cpp:812 +#: client/scenes/lobby_gui.cpp:243 client/scenes/lobby_gui.cpp:400 +#: client/scenes/stream_gui.cpp:825 msgid "Disconnect" msgstr "Desconectar" -#: client/scenes/lobby_gui.cpp:262 client/scenes/stream_gui.cpp:808 +#: client/scenes/lobby_gui.cpp:264 client/scenes/stream_gui.cpp:821 msgid "Close" msgstr "Fechar" -#: client/scenes/lobby_gui.cpp:268 +#: client/scenes/lobby_gui.cpp:270 msgid "Connection" msgstr "Conexão" -#: client/scenes/lobby_gui.cpp:270 +#: client/scenes/lobby_gui.cpp:272 #, c++-format msgid "Connection to {}" msgstr "Conexão a {}" -#: client/scenes/lobby_gui.cpp:300 +#: client/scenes/lobby_gui.cpp:302 msgid "PIN" msgstr "PIN" -#: client/scenes/lobby_gui.cpp:322 +#: client/scenes/lobby_gui.cpp:324 msgid "Input the PIN displayed on the dashboard" msgstr "Entre o PIN mostrado no painel" -#: client/scenes/lobby_gui.cpp:393 +#: client/scenes/lobby_gui.cpp:395 msgid "Connected to WiVRn server" msgstr "Conectado ao servidor WiVRn" -#: client/scenes/lobby_gui.cpp:395 +#: client/scenes/lobby_gui.cpp:397 #, c++-format msgid "Connected to {}" msgstr "Conectado a {}" -#: client/scenes/lobby_gui.cpp:405 +#: client/scenes/lobby_gui.cpp:407 msgid "Start an application on the server to start streaming." msgstr "Abra um aplicativo no servidor para iniciar o streaming." -#: client/scenes/lobby_gui.cpp:414 +#: client/scenes/lobby_gui.cpp:419 msgid "Start an application on your computer or select one to start streaming." msgstr "" -"Abra um aplicativo no seu computador ou selecione um para iniciar o streaming." +"Abra um aplicativo no seu computador ou selecione um para iniciar o " +"streaming." -#: client/scenes/lobby_gui.cpp:416 +#: client/scenes/lobby_gui.cpp:421 #, c++-format msgid "Start an application on {} or select one to start streaming." msgstr "Abra um aplicativo em {} ou selecione um para iniciar o streaming." -#: client/scenes/lobby_gui.cpp:522 +#: client/scenes/lobby_gui.cpp:544 msgid "Name" msgstr "Nome" -#: client/scenes/lobby_gui.cpp:533 +#: client/scenes/lobby_gui.cpp:555 msgid "Address" msgstr "Endereço" -#: client/scenes/lobby_gui.cpp:542 +#: client/scenes/lobby_gui.cpp:564 msgid "Port" msgstr "Porta" -#: client/scenes/lobby_gui.cpp:550 +#: client/scenes/lobby_gui.cpp:572 msgid "TCP only" msgstr "TCP somente" -#: client/scenes/lobby_gui.cpp:557 +#: client/scenes/lobby_gui.cpp:579 msgid "Cancel" msgstr "Cancelar" -#: client/scenes/lobby_gui.cpp:571 +#: client/scenes/lobby_gui.cpp:593 msgid "Save" msgstr "Salvar" -#: client/scenes/lobby_gui.cpp:624 +#: client/scenes/lobby_gui.cpp:646 msgid "" "Start a WiVRn server on your\n" "local network" @@ -143,32 +146,32 @@ msgstr "" "Inicie um servidor WiVRn em sua\n" "rede local" -#: client/scenes/lobby_gui.cpp:656 +#: client/scenes/lobby_gui.cpp:678 msgid "Autoconnect" msgstr "Autoconectar" -#: client/scenes/lobby_gui.cpp:682 +#: client/scenes/lobby_gui.cpp:704 msgid "Connect" msgstr "Conectar" -#: client/scenes/lobby_gui.cpp:692 client/wivrn_client.cpp:186 +#: client/scenes/lobby_gui.cpp:714 client/wivrn_client.cpp:186 msgid "Incompatible server version" msgstr "Versão de servidor incompatível" -#: client/scenes/lobby_gui.cpp:694 +#: client/scenes/lobby_gui.cpp:716 msgid "Server not available" msgstr "Servidor não disponível" -#: client/scenes/lobby_gui.cpp:780 +#: client/scenes/lobby_gui.cpp:802 msgid "Refresh rate" msgstr "Taxa de atualização" -#: client/scenes/lobby_gui.cpp:780 client/scenes/lobby_gui.cpp:782 +#: client/scenes/lobby_gui.cpp:802 client/scenes/lobby_gui.cpp:804 msgctxt "automatic refresh rate" msgid "Automatic" msgstr "Automático" -#: client/scenes/lobby_gui.cpp:789 +#: client/scenes/lobby_gui.cpp:811 msgid "" "Select refresh rate based on measured application performance.\n" "May cause flicker when a change happens." @@ -176,60 +179,60 @@ msgstr "" "Seleciona a taxa de atualização baseada no desempenho medido do aplicativo.\n" "Pode causar oscilações quando uma alteração ocorrer." -#: client/scenes/lobby_gui.cpp:806 +#: client/scenes/lobby_gui.cpp:828 msgid "Minimum refresh rate" msgstr "Taxa de atualização mínima" -#: client/scenes/lobby_gui.cpp:829 +#: client/scenes/lobby_gui.cpp:851 msgid "Resolution scale" msgstr "Escala de resolução" -#: client/scenes/lobby_gui.cpp:833 client/scenes/lobby_gui.cpp:1072 +#: client/scenes/lobby_gui.cpp:855 client/scenes/lobby_gui.cpp:1101 #, c-format, c++-format msgid "%d%% - {}x{} per eye" msgstr "%d%% - {}x{} por olho" -#: client/scenes/lobby_gui.cpp:844 client/scenes/lobby_gui.cpp:1083 +#: client/scenes/lobby_gui.cpp:866 client/scenes/lobby_gui.cpp:1112 #, c++-format msgid "Resolution larger than {}x{} may not be supported by the headset" msgstr "Resolução maior que {}x{} pode não ser suportada pelo headset" -#: client/scenes/lobby_gui.cpp:850 +#: client/scenes/lobby_gui.cpp:872 msgid "Enable microphone" msgstr "Ativar microfone" -#: client/scenes/lobby_gui.cpp:859 +#: client/scenes/lobby_gui.cpp:881 msgid "Unprocessed Microphone Audio" msgstr "Áudio Não-processado de Microfone" -#: client/scenes/lobby_gui.cpp:865 +#: client/scenes/lobby_gui.cpp:887 msgid "Force disable audio filters, such as noise cancellation" msgstr "" "Força a desativação de filtros de áudio tais como cancelamento de ruído" -#: client/scenes/lobby_gui.cpp:872 +#: client/scenes/lobby_gui.cpp:894 msgid "Enable hand tracking" msgstr "Ativar rastreamento de mãos" -#: client/scenes/lobby_gui.cpp:878 client/scenes/lobby_gui.cpp:890 -#: client/scenes/lobby_gui.cpp:902 client/scenes/lobby_gui.cpp:918 -#: client/scenes/lobby_gui.cpp:968 +#: client/scenes/lobby_gui.cpp:900 client/scenes/lobby_gui.cpp:912 +#: client/scenes/lobby_gui.cpp:924 client/scenes/lobby_gui.cpp:940 +#: client/scenes/lobby_gui.cpp:990 msgid "This feature is not supported by your headset" msgstr "Este recurso não é suportado pelo seu headset" -#: client/scenes/lobby_gui.cpp:884 +#: client/scenes/lobby_gui.cpp:906 msgid "Enable eye tracking" msgstr "Ativar rastreamento ocular" -#: client/scenes/lobby_gui.cpp:896 +#: client/scenes/lobby_gui.cpp:918 msgid "Enable face tracking" msgstr "Ativar rastreamento facial" -#: client/scenes/lobby_gui.cpp:909 +#: client/scenes/lobby_gui.cpp:931 msgid "Enable body tracking" msgstr "Ativar rastreamento corporal" -#: client/scenes/lobby_gui.cpp:925 +#: client/scenes/lobby_gui.cpp:947 msgid "" "Requires 'Hand and body tracking' to be enabled in the Quest movement " "tracking settings,\n" @@ -241,11 +244,11 @@ msgstr "" "estimados\n" "com base nas posições do controle e do headset." -#: client/scenes/lobby_gui.cpp:938 +#: client/scenes/lobby_gui.cpp:960 msgid "Enable lower body tracking" msgstr "Ativar rastreamento corporal inferior" -#: client/scenes/lobby_gui.cpp:944 +#: client/scenes/lobby_gui.cpp:966 msgid "" "Estimate lower body joint positions using Generative Legs\n" "Requires 'Hand and body tracking' to be enabled in the Quest movement " @@ -256,11 +259,11 @@ msgstr "" "Requer que 'Rastreamento corporal e das mãos' esteja ativado nas\n" "configurações de Rastreamento de Movimento do Quest" -#: client/scenes/lobby_gui.cpp:947 +#: client/scenes/lobby_gui.cpp:969 msgid "Enable hip tracking" msgstr "Ativar rastreamento de quadril" -#: client/scenes/lobby_gui.cpp:953 +#: client/scenes/lobby_gui.cpp:975 msgid "" "Only takes affect with lower body tracking enabled\n" "May be desired when using another source of hip tracking" @@ -268,19 +271,32 @@ msgstr "" "Só tem efeito com o rastreamento corporal inferior ativado\n" "Pode ser desejado ao usar outra fonte de rastreamento de quadril" -#: client/scenes/lobby_gui.cpp:961 +#: client/scenes/lobby_gui.cpp:983 msgid "Enable video passthrough in lobby" msgstr "Habilitar repassagem de vídeo no lobby" -#: client/scenes/lobby_gui.cpp:982 client/scenes/stream_gui.cpp:434 +#: client/scenes/lobby_gui.cpp:994 +msgid "Enable in-stream window" +msgstr "Habilitar janela na stream" + +#: client/scenes/lobby_gui.cpp:997 +msgid "" +"Enables the configuration window to be shown while the game is streaming.\n" +"If enabled, the window is activated by pressing both thumbsticks." +msgstr "" +"Habilita que a janela de configuração seja vista enquanto o jogo está sendo " +"streamado.\n" +"Se habilitado, a janela é ativada clicando os dois joysticks simultaneamente." + +#: client/scenes/lobby_gui.cpp:1011 client/scenes/stream_gui.cpp:445 msgid "OpenXR post-processing" msgstr "Pós-processamento OpenXR" -#: client/scenes/lobby_gui.cpp:986 client/scenes/stream_gui.cpp:438 +#: client/scenes/lobby_gui.cpp:1015 client/scenes/stream_gui.cpp:449 msgid "Supersampling" msgstr "Supersampling" -#: client/scenes/lobby_gui.cpp:1006 client/scenes/stream_gui.cpp:459 +#: client/scenes/lobby_gui.cpp:1035 client/scenes/stream_gui.cpp:470 msgid "" "Reduce flicker for high contrast edges.\n" "Useful when the input resolution is high compared to the headset display" @@ -288,11 +304,11 @@ msgstr "" "Reduz flicker para arestas de alto contraste.\n" "Útil quando a resolução de entrada é alta comparada ao display do headset" -#: client/scenes/lobby_gui.cpp:1011 client/scenes/stream_gui.cpp:464 +#: client/scenes/lobby_gui.cpp:1040 client/scenes/stream_gui.cpp:475 msgid "Sharpening" msgstr "Aumento de nitidez" -#: client/scenes/lobby_gui.cpp:1031 client/scenes/stream_gui.cpp:485 +#: client/scenes/lobby_gui.cpp:1060 client/scenes/stream_gui.cpp:496 msgid "" "Improve clarity of high contrast edges and counteract blur.\n" "Useful when the input resolution is low compared to the headset display" @@ -300,11 +316,11 @@ msgstr "" "Melhora a clareza de arestas de alto contraste e minimiza o desfoque.\n" "Útil quando a resolução de entrada é baixa comparada ao display do headset" -#: client/scenes/lobby_gui.cpp:1040 +#: client/scenes/lobby_gui.cpp:1069 msgid "Enable Snapdragon Game Super Resolution" msgstr "Habilitar Snapdragon Game Super Resolution" -#: client/scenes/lobby_gui.cpp:1048 +#: client/scenes/lobby_gui.cpp:1077 msgid "" "On this headset, this setting has been fully superseded by the native " "Sharpening setting above.\n" @@ -314,157 +330,157 @@ msgstr "" "aumento de nitidez acima.\n" "Somente habilite se souber o que está fazendo." -#: client/scenes/lobby_gui.cpp:1050 +#: client/scenes/lobby_gui.cpp:1079 msgid "" "Client-side upscaling and sharpening, adds a performance cost on the headset" msgstr "" "Upscaling e aumento de nitidez do lado do cliente, acrescenta um custo de " "desempenho no headset" -#: client/scenes/lobby_gui.cpp:1068 +#: client/scenes/lobby_gui.cpp:1097 msgid "Upscaling factor" msgstr "Fator de upscaling" -#: client/scenes/lobby_gui.cpp:1087 +#: client/scenes/lobby_gui.cpp:1116 msgid "Use edge direction" msgstr "Usar direção da aresta" -#: client/scenes/lobby_gui.cpp:1093 +#: client/scenes/lobby_gui.cpp:1122 msgid "Adds an additional performance cost" msgstr "Acrescenta um custo de desempenho" -#: client/scenes/lobby_gui.cpp:1098 +#: client/scenes/lobby_gui.cpp:1127 msgid "Edge threshold" msgstr "Limite da aresta" -#: client/scenes/lobby_gui.cpp:1105 client/scenes/lobby_gui.cpp:1114 +#: client/scenes/lobby_gui.cpp:1134 client/scenes/lobby_gui.cpp:1143 #, c++-format msgid "Recommended: {:.1f}" msgstr "Recomenadado: {:.1f}" -#: client/scenes/lobby_gui.cpp:1108 +#: client/scenes/lobby_gui.cpp:1137 msgid "Edge sharpness" msgstr "Nitidez da aresta" -#: client/scenes/lobby_gui.cpp:1210 client/scenes/lobby_gui.cpp:1218 -#: client/scenes/stream_gui.cpp:222 client/scenes/stream_gui.cpp:418 +#: client/scenes/lobby_gui.cpp:1239 client/scenes/lobby_gui.cpp:1247 +#: client/scenes/stream_gui.cpp:222 client/scenes/stream_gui.cpp:424 msgid "CPU time" msgstr "Tempo de CPU" -#: client/scenes/lobby_gui.cpp:1214 +#: client/scenes/lobby_gui.cpp:1243 msgid "CPU time [ms]" msgstr "Tempo de CPU [ms]" -#: client/scenes/lobby_gui.cpp:1224 client/scenes/lobby_gui.cpp:1232 -#: client/scenes/stream_gui.cpp:224 client/scenes/stream_gui.cpp:419 +#: client/scenes/lobby_gui.cpp:1253 client/scenes/lobby_gui.cpp:1261 +#: client/scenes/stream_gui.cpp:224 client/scenes/stream_gui.cpp:425 msgid "GPU time" msgstr "Tempo de GPU" -#: client/scenes/lobby_gui.cpp:1228 +#: client/scenes/lobby_gui.cpp:1257 msgid "GPU time [ms]" msgstr "Tempo de GPU [ms]" -#: client/scenes/lobby_gui.cpp:1271 +#: client/scenes/lobby_gui.cpp:1300 msgid "Enable the microphone?" msgstr "Habilitar o microfone?" -#: client/scenes/lobby_gui.cpp:1276 +#: client/scenes/lobby_gui.cpp:1305 msgid "Enable eye tracking?" msgstr "Habilitar o rastreamento ocular?" -#: client/scenes/lobby_gui.cpp:1281 +#: client/scenes/lobby_gui.cpp:1310 msgid "Enable face tracking?" msgstr "Habilitar o rastreamento facial?" -#: client/scenes/lobby_gui.cpp:1286 +#: client/scenes/lobby_gui.cpp:1315 msgid "Enable body tracking?" msgstr "Habilitar o rastreamento corporal?" -#: client/scenes/lobby_gui.cpp:1294 +#: client/scenes/lobby_gui.cpp:1323 msgid "Welcome to WiVRn" msgstr "Bem vindo(a) ao WiVRn" -#: client/scenes/lobby_gui.cpp:1318 +#: client/scenes/lobby_gui.cpp:1347 msgid "Yes" msgstr "Sim" -#: client/scenes/lobby_gui.cpp:1325 +#: client/scenes/lobby_gui.cpp:1354 msgid "No" msgstr "Não" -#: client/scenes/lobby_gui.cpp:1344 client/scenes/lobby_gui.cpp:1983 +#: client/scenes/lobby_gui.cpp:1373 client/scenes/lobby_gui.cpp:2012 msgid "Licenses" msgstr "Licenças" -#: client/scenes/lobby_gui.cpp:1658 +#: client/scenes/lobby_gui.cpp:1687 msgid "Microphone is enabled" msgstr "O microfone está ativado" -#: client/scenes/lobby_gui.cpp:1659 +#: client/scenes/lobby_gui.cpp:1688 msgid "Microphone is disabled" msgstr "O microfone está desativado" -#: client/scenes/lobby_gui.cpp:1668 +#: client/scenes/lobby_gui.cpp:1697 msgid "Hand tracking is enabled" msgstr "O rastreamento de mãos está ativado" -#: client/scenes/lobby_gui.cpp:1669 +#: client/scenes/lobby_gui.cpp:1698 msgid "Hand tracking is disabled" msgstr "O rastreamento de mãos está desativado" -#: client/scenes/lobby_gui.cpp:1678 +#: client/scenes/lobby_gui.cpp:1707 msgid "Eye tracking is enabled" msgstr "O rastreamento ocular está ativado" -#: client/scenes/lobby_gui.cpp:1679 +#: client/scenes/lobby_gui.cpp:1708 msgid "Eye tracking is disabled" msgstr "O rastreamento ocular está desativado" -#: client/scenes/lobby_gui.cpp:1692 +#: client/scenes/lobby_gui.cpp:1721 msgid "Face tracking is enabled" msgstr "O rastreamento facial está ativado" -#: client/scenes/lobby_gui.cpp:1693 +#: client/scenes/lobby_gui.cpp:1722 msgid "Face tracking is disabled" msgstr "O rastreamento facial está desativado" -#: client/scenes/lobby_gui.cpp:1703 +#: client/scenes/lobby_gui.cpp:1732 msgid "Body tracking is enabled" msgstr "O rastreamento corporal está ativado" -#: client/scenes/lobby_gui.cpp:1704 +#: client/scenes/lobby_gui.cpp:1733 msgid "Body tracking is disabled" msgstr "O rastreamento corporal está desativado" -#: client/scenes/lobby_gui.cpp:1720 +#: client/scenes/lobby_gui.cpp:1749 msgid "Add server" msgstr "Adicionar servidor" -#: client/scenes/lobby_gui.cpp:1965 +#: client/scenes/lobby_gui.cpp:1994 msgid "Server list" msgstr "Lista de servidores" -#: client/scenes/lobby_gui.cpp:1968 client/scenes/stream_gui.cpp:796 +#: client/scenes/lobby_gui.cpp:1997 client/scenes/stream_gui.cpp:809 msgid "Settings" msgstr "Ajustes" -#: client/scenes/lobby_gui.cpp:1971 +#: client/scenes/lobby_gui.cpp:2000 msgid "Post-processing" msgstr "Pós-processamento" -#: client/scenes/lobby_gui.cpp:1975 +#: client/scenes/lobby_gui.cpp:2004 msgid "Debug" msgstr "Depurar" -#: client/scenes/lobby_gui.cpp:1980 +#: client/scenes/lobby_gui.cpp:2009 msgid "About" msgstr "Sobre" -#: client/scenes/lobby_gui.cpp:1986 +#: client/scenes/lobby_gui.cpp:2015 msgid "Exit" msgstr "Sair" -#: client/scenes/lobby_gui.cpp:2003 +#: client/scenes/lobby_gui.cpp:2032 msgid "" "Press the grip button or put your palm up\n" "to move the main window" @@ -472,7 +488,7 @@ msgstr "" "Pressione o botão de aderência ou coloque a palma da mão para cima\n" "para mover a janela principal" -#: client/scenes/lobby_gui.cpp:2005 +#: client/scenes/lobby_gui.cpp:2034 msgid "Press the grip button to move the main window" msgstr "Pressione o botão de aderência para mover a janela principal" @@ -488,11 +504,11 @@ msgstr "Blit" msgid "Network" msgstr "Rede" -#: client/scenes/stream_gui.cpp:227 client/scenes/stream_gui.cpp:416 +#: client/scenes/stream_gui.cpp:227 client/scenes/stream_gui.cpp:422 msgid "Download" msgstr "Baixar" -#: client/scenes/stream_gui.cpp:228 client/scenes/stream_gui.cpp:417 +#: client/scenes/stream_gui.cpp:228 client/scenes/stream_gui.cpp:423 msgid "Upload" msgstr "Enviar" @@ -533,66 +549,66 @@ msgstr "Mostrado" msgid "Predicted" msgstr "Previsto" -#: client/scenes/stream_gui.cpp:393 +#: client/scenes/stream_gui.cpp:395 #, c++-format msgid "Estimated motion to photons latency: {}ms" msgstr "Movimento estimado para a latência de fótons: {}ms" -#: client/scenes/stream_gui.cpp:396 +#: client/scenes/stream_gui.cpp:402 msgid "Press the grip button to move the window" msgstr "Pressione o botão de aderência para mover a janela" -#: client/scenes/stream_gui.cpp:398 client/scenes/stream_gui.cpp:750 +#: client/scenes/stream_gui.cpp:404 client/scenes/stream_gui.cpp:763 msgid "Press both thumbsticks to display the WiVRn window" msgstr "Pressione ambos os thumbsticks para mostrar a janela do WiVRn" -#: client/scenes/stream_gui.cpp:420 +#: client/scenes/stream_gui.cpp:426 msgid "Motion to photon latency" msgstr "Latência (de movimento para fótons)" -#: client/scenes/stream_gui.cpp:492 +#: client/scenes/stream_gui.cpp:503 msgid "Foveation center override" msgstr "Ajuste do centro de foveação" -#: client/scenes/stream_gui.cpp:495 +#: client/scenes/stream_gui.cpp:506 msgid "Enable" msgstr "Habilitar" -#: client/scenes/stream_gui.cpp:503 client/scenes/stream_gui.cpp:550 +#: client/scenes/stream_gui.cpp:514 client/scenes/stream_gui.cpp:561 #, c++-format msgid "Height {:.1f} deg" msgstr "Altura {:.1f} graus" -#: client/scenes/stream_gui.cpp:504 client/scenes/stream_gui.cpp:551 +#: client/scenes/stream_gui.cpp:515 client/scenes/stream_gui.cpp:562 #, c++-format msgid "Distance {:.2f} m" msgstr "Distância {:.2f} m" -#: client/scenes/stream_gui.cpp:505 +#: client/scenes/stream_gui.cpp:516 msgid "Default" msgstr "Padrão" -#: client/scenes/stream_gui.cpp:516 +#: client/scenes/stream_gui.cpp:527 msgid "Change" msgstr "Modificar" -#: client/scenes/stream_gui.cpp:548 +#: client/scenes/stream_gui.cpp:559 msgid "Use the thumbsticks to move the foveation center" msgstr "Use os thumbsticks para mover o centro da foveação" -#: client/scenes/stream_gui.cpp:549 +#: client/scenes/stream_gui.cpp:560 msgid "Press A to save or B to cancel" msgstr "Pressione A para salvar ou B para cancelar" -#: client/scenes/stream_gui.cpp:793 +#: client/scenes/stream_gui.cpp:806 msgid "Stats" msgstr "Estatísticas" -#: client/scenes/stream_gui.cpp:802 +#: client/scenes/stream_gui.cpp:815 msgid "Statistics overlay" msgstr "Overlay de estatísticas" -#: client/scenes/stream_gui.cpp:805 +#: client/scenes/stream_gui.cpp:818 msgid "Compact view" msgstr "Visualização compacta" From c2f23223a237ad2cfeb8dbaca35efe503e37aa92 Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Thu, 14 Aug 2025 21:03:25 +0200 Subject: [PATCH 54/85] Don't trust the file extension when loading icons Fixes #439 --- common/utils/load_icon.cpp | 656 +++++++++++++++----------------- common/utils/load_icon.h | 12 +- server/driver/wivrn_session.cpp | 15 +- 3 files changed, 337 insertions(+), 346 deletions(-) diff --git a/common/utils/load_icon.cpp b/common/utils/load_icon.cpp index 5a3aaffa..390e848f 100644 --- a/common/utils/load_icon.cpp +++ b/common/utils/load_icon.cpp @@ -75,7 +75,7 @@ std::span read(std::span & buffer, size_t count) return value; } -std::vector load_svg(const std::filesystem::path & filename, int size) +std::vector try_load_svg(const std::filesystem::path & filename, int size) { // TODO check if aspect ratio needs to be handled, dpi @@ -111,6 +111,8 @@ std::vector load_svg(const std::filesystem::path & filename, int size GFile_ptr file{g_file_new_for_path(filename.c_str())}; RsvgHandle_ptr handle{rsvg_handle_new_from_gfile_sync(file.get(), RSVG_HANDLE_FLAGS_NONE, nullptr, &error)}; + if (!handle) + throw std::runtime_error{std::string{"Could not open: "} + error->message}; // Create a Cairo image surface and a rendering context for it cairo_surface_t_ptr surface{cairo_image_surface_create(CAIRO_FORMAT_ARGB32, size, size)}; @@ -145,58 +147,49 @@ std::vector load_svg(const std::filesystem::path & filename, int size if (auto status = cairo_surface_write_to_png_stream(surface.get(), cb, &png); status != CAIRO_STATUS_SUCCESS) throw std::runtime_error{std::string{"Could not write output: "} + cairo_status_to_string(status)}; - return png; + return {{size, size, 32, std::move(png)}}; } -// See https://gitlab.gnome.org/GNOME/gimp/-/tree/master/plug-ins/file-ico?ref_type=heads - -struct ico_file_entry -{ - int width; // Width of icon in pixels - int height; // Height of icon in pixels - int bpp; // 1, 4, 8, 16, 24 or 32 bits per pixel - std::span data; -}; - -constexpr int rowstride(int width, int bpp) -{ - int words_per_line = (width * bpp + 31) / 32; - return words_per_line * 4; -} -static_assert(rowstride(1, 1) == 4); -static_assert(rowstride(8, 1) == 4); -static_assert(rowstride(16, 1) == 4); -static_assert(rowstride(32, 1) == 4); -static_assert(rowstride(33, 1) == 8); - -static_assert(rowstride(1, 4) == 4); -static_assert(rowstride(8, 4) == 4); -static_assert(rowstride(16, 4) == 8); -static_assert(rowstride(32, 4) == 16); -static_assert(rowstride(33, 4) == 20); - -static_assert(rowstride(1, 8) == 4); -static_assert(rowstride(8, 8) == 8); -static_assert(rowstride(16, 8) == 16); -static_assert(rowstride(32, 8) == 32); -static_assert(rowstride(33, 8) == 36); - -static_assert(rowstride(1, 24) == 4); -static_assert(rowstride(8, 24) == 24); -static_assert(rowstride(16, 24) == 48); -static_assert(rowstride(32, 24) == 96); -static_assert(rowstride(33, 24) == 100); - -static_assert(rowstride(1, 32) == 4); -static_assert(rowstride(8, 32) == 32); -static_assert(rowstride(16, 32) == 64); -static_assert(rowstride(32, 32) == 128); -static_assert(rowstride(33, 32) == 132); - -std::vector load_ico(const std::filesystem::path & filename, int size, int index = -1) +std::vector try_load_ico(const std::filesystem::path & filename) { const uint32_t ICO_PNG_MAGIC = 0x474e5089; + // See https://gitlab.gnome.org/GNOME/gimp/-/tree/master/plug-ins/file-ico?ref_type=heads + auto rowstride = [](int width, int bpp) { + int words_per_line = (width * bpp + 31) / 32; + return words_per_line * 4; + }; + + static_assert(rowstride(1, 1) == 4); + static_assert(rowstride(8, 1) == 4); + static_assert(rowstride(16, 1) == 4); + static_assert(rowstride(32, 1) == 4); + static_assert(rowstride(33, 1) == 8); + + static_assert(rowstride(1, 4) == 4); + static_assert(rowstride(8, 4) == 4); + static_assert(rowstride(16, 4) == 8); + static_assert(rowstride(32, 4) == 16); + static_assert(rowstride(33, 4) == 20); + + static_assert(rowstride(1, 8) == 4); + static_assert(rowstride(8, 8) == 8); + static_assert(rowstride(16, 8) == 16); + static_assert(rowstride(32, 8) == 32); + static_assert(rowstride(33, 8) == 36); + + static_assert(rowstride(1, 24) == 4); + static_assert(rowstride(8, 24) == 24); + static_assert(rowstride(16, 24) == 48); + static_assert(rowstride(32, 24) == 96); + static_assert(rowstride(33, 24) == 100); + + static_assert(rowstride(1, 32) == 4); + static_assert(rowstride(8, 32) == 32); + static_assert(rowstride(16, 32) == 64); + static_assert(rowstride(32, 32) == 128); + static_assert(rowstride(33, 32) == 132); + auto ico = load_file(filename); std::span header{ico}; @@ -208,338 +201,287 @@ std::vector load_ico(const std::filesystem::path & filename, int size if (reserved != 0 or resource_type != 1) throw std::runtime_error{"Cannot read icon: " + filename.native()}; - std::vector entries; - int max_bpp = 0; + std::vector icons; for (int i = 0; i < icon_count; i++) { - ico_file_entry entry; - entry.width = read(header); - entry.height = read(header); + auto width = read(header); + auto height = read(header); auto num_colors = read(header); auto reserved = read(header); // reserved auto planes = read(header); - entry.bpp = read(header); + auto bpp = read(header); auto size = read(header); auto offset = read(header); if (offset + size > ico.size()) throw std::runtime_error{"Cannot read icon: " + filename.native()}; - entry.data = std::span{ico}.subspan(offset, size); - if (entry.width == 0) - entry.width = 256; - if (entry.height == 0) - entry.height = 256; + auto data = std::span{ico}.subspan(offset, size); if (reserved != 0) throw std::runtime_error{"Cannot read icon: " + filename.native()}; if (planes != 0 and planes != 1) throw std::runtime_error{"Cannot read icon: " + filename.native()}; - entries.push_back(entry); + auto magic = read(data); - max_bpp = std::max(max_bpp, entry.bpp); - } - - const ico_file_entry * best_entry = index >= 0 ? &entries.at(index) : [&]() { - const ico_file_entry * best_entry = nullptr; - - // Look for the smallest multiple of the requested size - int criterion = std::numeric_limits::max(); - - for (const auto & entry: entries) + if (magic == ICO_PNG_MAGIC) { - if (entry.bpp != max_bpp) - continue; + // PNG file + std::vector png_data; - if (entry.width % size != 0 or entry.height % size != 0) - continue; + // The PNG magic has already been consumed, put it back + png_data.insert(png_data.end(), data.begin() - 4, data.end()); - if (std::min(entry.width, entry.height) / size < criterion) + // Check if the PNG is valid + std::vector pixels; + png_image png_ref{ + .version = PNG_IMAGE_VERSION, + .format = PNG_FORMAT_BGRA, + }; + if (not png_image_begin_read_from_memory(&png_ref, png_data.data(), png_data.size())) + continue; + // throw std::runtime_error{"Cannot read icon: " + filename.native()}; + + pixels.resize(PNG_IMAGE_SIZE(png_ref)); + + if (!png_image_finish_read(&png_ref, nullptr, pixels.data(), 0, nullptr)) { - criterion = std::min(entry.width, entry.height); - best_entry = &entry; - } - } - if (best_entry) - return best_entry; - - // No multiple found: pick the largest icon - criterion = 0; - - for (const auto & entry: entries) - { - if (entry.bpp != max_bpp) + png_image_free(&png_ref); continue; - - if (entry.width * entry.height > criterion) - { - criterion = entry.width * entry.height; - best_entry = &entry; + // throw std::runtime_error{"Cannot read icon: " + filename.native()}; } - } - return best_entry; - }(); - if (not best_entry) - return {}; - - auto data = best_entry->data; - auto magic = read(data); - - if (magic == ICO_PNG_MAGIC) - { - // PNG file - std::vector png_data; - - // The PNG magic has already been consumed, put it back - png_data.insert(png_data.end(), data.begin() - 4, data.end()); - - // Check if the PNG is valid - std::vector pixels; - png_image png_ref{ - .version = PNG_IMAGE_VERSION, - .format = PNG_FORMAT_BGRA, - }; - if (not png_image_begin_read_from_memory(&png_ref, png_data.data(), png_data.size())) - throw std::runtime_error{"Cannot read icon: " + filename.native()}; - - pixels.resize(PNG_IMAGE_SIZE(png_ref)); - - if (!png_image_finish_read(&png_ref, nullptr, pixels.data(), 0, nullptr)) - { + // TODO: get bit depth from PNG instead of trusting the ico header + icons.emplace_back(png_ref.width, png_ref.height, bpp, std::move(png_data)); png_image_free(&png_ref); - throw std::runtime_error{"Cannot read icon: " + filename.native()}; } - png_image_free(&png_ref); - - return png_data; - } - else if (magic == 40) - { - auto width = read(data); // Width of image in pixels - auto height = read(data); // Height of image in pixels - auto planes = read(data); // Must be 1 - auto bpp = read(data); // 1, 4, 8, 16, 24, 32 - auto compression = read(data); // Must be 0 for icons - auto image_size = read(data); // Size of image (without this header) - auto x_res = read(data); - auto y_res = read(data); - auto used_colors = read(data); - auto important_colors = read(data); - - if (planes != 1 or compression != 0) - return {}; - - if (bpp != 1 and - bpp != 4 and - bpp != 8 and - bpp != 16 and - bpp != 24 and - bpp != 32) - return {}; - - auto w = width; - auto h = height / 2; - - std::span palette; // BGRX - - if (bpp <= 16) + else if (magic == 40) { - // Load the palette - if (used_colors == 0) - used_colors = 1 << bpp; + auto width = read(data); // Width of image in pixels + auto height = read(data); // Height of image in pixels + auto planes = read(data); // Must be 1 + auto bpp = read(data); // 1, 4, 8, 16, 24, 32 + auto compression = read(data); // Must be 0 for icons + auto image_size = read(data); // Size of image (without this header) + auto x_res = read(data); + auto y_res = read(data); + auto used_colors = read(data); + auto important_colors = read(data); - palette = read(data, used_colors * 4); - } + if (planes != 1 or compression != 0) + return {}; - size_t xor_stride = rowstride(w, bpp); - size_t and_stride = rowstride(w, 1); - size_t dst_stride = 4 * w; + if (bpp != 1 and + bpp != 4 and + bpp != 8 and + bpp != 16 and + bpp != 24 and + bpp != 32) + return {}; - std::span xor_map = read(data, xor_stride * h); - std::span and_map = read(data, and_stride * h); + auto w = width; + auto h = height / 2; - std::vector dest_buffer; - dest_buffer.resize(h * dst_stride); + std::span palette; // BGRX - switch (bpp) - { - case 1: - for (int y = 0; y < h; y++) - { - uint8_t * src_xor_row = xor_map.data() + xor_stride * y; - uint8_t * src_and_row = and_map.data() + and_stride * y; - uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); + if (bpp <= 16) + { + // Load the palette + if (used_colors == 0) + used_colors = 1 << bpp; - for (int x = 0, i = 0; x < w; x++) + palette = read(data, used_colors * 4); + } + + size_t xor_stride = rowstride(w, bpp); + size_t and_stride = rowstride(w, 1); + size_t dst_stride = 4 * w; + + std::span xor_map = read(data, xor_stride * h); + std::span and_map = read(data, and_stride * h); + + std::vector dest_buffer; + dest_buffer.resize(h * dst_stride); + + switch (bpp) + { + case 1: + for (int y = 0; y < h; y++) { - int colour = (src_xor_row[x / 8] >> (7 - (x % 8))) & 0x1; - if (colour >= used_colors) - return {}; + uint8_t * src_xor_row = xor_map.data() + xor_stride * y; + uint8_t * src_and_row = and_map.data() + and_stride * y; + uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); - uint8_t b = palette[4 * colour + 0]; // Blue - uint8_t g = palette[4 * colour + 1]; // Green - uint8_t r = palette[4 * colour + 2]; // Red + for (int x = 0, i = 0; x < w; x++) + { + int colour = (src_xor_row[x / 8] >> (7 - (x % 8))) & 0x1; + if (colour >= used_colors) + return {}; - // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) - uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; + uint8_t b = palette[4 * colour + 0]; // Blue + uint8_t g = palette[4 * colour + 1]; // Green + uint8_t r = palette[4 * colour + 2]; // Red - *dst_row++ = b; - *dst_row++ = g; - *dst_row++ = r; - *dst_row++ = a; + // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) + uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; + + *dst_row++ = b; + *dst_row++ = g; + *dst_row++ = r; + *dst_row++ = a; + } } - } - break; + break; - case 4: - for (int y = 0; y < h; y++) - { - uint8_t * src_xor_row = xor_map.data() + xor_stride * y; - uint8_t * src_and_row = and_map.data() + and_stride * y; - uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); - - for (int x = 0, i = 0; x < w; x++) + case 4: + for (int y = 0; y < h; y++) { - int colour = (src_xor_row[x / 2] >> (4 - 4 * (x % 2))) & 0xf; - if (colour >= used_colors) - return {}; + uint8_t * src_xor_row = xor_map.data() + xor_stride * y; + uint8_t * src_and_row = and_map.data() + and_stride * y; + uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); - uint8_t b = palette[4 * colour + 0]; // Blue - uint8_t g = palette[4 * colour + 1]; // Green - uint8_t r = palette[4 * colour + 2]; // Red + for (int x = 0, i = 0; x < w; x++) + { + int colour = (src_xor_row[x / 2] >> (4 - 4 * (x % 2))) & 0xf; + if (colour >= used_colors) + return {}; - // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) - uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; + uint8_t b = palette[4 * colour + 0]; // Blue + uint8_t g = palette[4 * colour + 1]; // Green + uint8_t r = palette[4 * colour + 2]; // Red - *dst_row++ = b; - *dst_row++ = g; - *dst_row++ = r; - *dst_row++ = a; + // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) + uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; + + *dst_row++ = b; + *dst_row++ = g; + *dst_row++ = r; + *dst_row++ = a; + } } - } - break; + break; - case 8: - for (int y = 0; y < h; y++) - { - uint8_t * src_xor_row = xor_map.data() + xor_stride * y; - uint8_t * src_and_row = and_map.data() + and_stride * y; - uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); - - for (int x = 0, i = 0; x < w; x++) + case 8: + for (int y = 0; y < h; y++) { - int colour = *src_xor_row++; - if (colour >= used_colors) - return {}; + uint8_t * src_xor_row = xor_map.data() + xor_stride * y; + uint8_t * src_and_row = and_map.data() + and_stride * y; + uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); - uint8_t b = palette[4 * colour + 0]; // Blue - uint8_t g = palette[4 * colour + 1]; // Green - uint8_t r = palette[4 * colour + 2]; // Red + for (int x = 0, i = 0; x < w; x++) + { + int colour = *src_xor_row++; + if (colour >= used_colors) + return {}; - // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) - uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; + uint8_t b = palette[4 * colour + 0]; // Blue + uint8_t g = palette[4 * colour + 1]; // Green + uint8_t r = palette[4 * colour + 2]; // Red - *dst_row++ = b; - *dst_row++ = g; - *dst_row++ = r; - *dst_row++ = a; + // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) + uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; + + *dst_row++ = b; + *dst_row++ = g; + *dst_row++ = r; + *dst_row++ = a; + } } - } - break; + break; - case 16: - for (int y = 0; y < h; y++) - { - uint8_t * src_xor_row = xor_map.data() + xor_stride * y; - uint8_t * src_and_row = and_map.data() + and_stride * y; - uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); - - for (int x = 0, i = 0; x < w; x++) + case 16: + for (int y = 0; y < h; y++) { - int colour = (src_xor_row[1] << 8) | src_xor_row[0]; - src_xor_row += 2; + uint8_t * src_xor_row = xor_map.data() + xor_stride * y; + uint8_t * src_and_row = and_map.data() + and_stride * y; + uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); - if (colour >= used_colors) - return {}; + for (int x = 0, i = 0; x < w; x++) + { + int colour = (src_xor_row[1] << 8) | src_xor_row[0]; + src_xor_row += 2; - uint8_t b = palette[4 * colour + 0]; // Blue - uint8_t g = palette[4 * colour + 1]; // Green - uint8_t r = palette[4 * colour + 2]; // Red + if (colour >= used_colors) + return {}; - // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) - uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; + uint8_t b = palette[4 * colour + 0]; // Blue + uint8_t g = palette[4 * colour + 1]; // Green + uint8_t r = palette[4 * colour + 2]; // Red - *dst_row++ = b; - *dst_row++ = g; - *dst_row++ = r; - *dst_row++ = a; + // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) + uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; + + *dst_row++ = b; + *dst_row++ = g; + *dst_row++ = r; + *dst_row++ = a; + } } - } - break; + break; - case 24: - for (int y = 0; y < h; y++) - { - uint8_t * src_xor_row = xor_map.data() + xor_stride * y; - uint8_t * src_and_row = and_map.data() + and_stride * y; - uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); - - for (int x = 0, i = 0; x < w; x++) + case 24: + for (int y = 0; y < h; y++) { - uint8_t b = *src_xor_row++; // Blue - uint8_t g = *src_xor_row++; // Green - uint8_t r = *src_xor_row++; // Red + uint8_t * src_xor_row = xor_map.data() + xor_stride * y; + uint8_t * src_and_row = and_map.data() + and_stride * y; + uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); - // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) - uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; + for (int x = 0, i = 0; x < w; x++) + { + uint8_t b = *src_xor_row++; // Blue + uint8_t g = *src_xor_row++; // Green + uint8_t r = *src_xor_row++; // Red - *dst_row++ = b; - *dst_row++ = g; - *dst_row++ = r; - *dst_row++ = a; + // Get alpha from AND mask (0: opaque => 0xff, 1: transparent => 0) + uint8_t a = src_and_row[x / 8] & (1 << (7 - x % 8)) ? 0 : 0xff; + + *dst_row++ = b; + *dst_row++ = g; + *dst_row++ = r; + *dst_row++ = a; + } } - } - break; + break; - case 32: - for (int y = 0; y < h; y++) - { - uint8_t * src_xor_row = (uint8_t *)xor_map.data() + xor_stride * y; - uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); + case 32: + for (int y = 0; y < h; y++) + { + uint8_t * src_xor_row = (uint8_t *)xor_map.data() + xor_stride * y; + uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); - memcpy(dst_row, src_xor_row, dst_stride); - } - break; - } + memcpy(dst_row, src_xor_row, dst_stride); + } + break; + } - png_image png{ - .version = PNG_IMAGE_VERSION, - .width = w, - .height = h, - .format = PNG_FORMAT_BGRA, - }; + png_image png{ + .version = PNG_IMAGE_VERSION, + .width = w, + .height = h, + .format = PNG_FORMAT_BGRA, + }; - std::vector png_data{65536}; - png_alloc_size_t png_size = png_data.size(); - png_image_write_to_memory(&png, png_data.data(), &png_size, false /* convert_to_8_bit*/, dest_buffer.data(), w * 4, nullptr); - - if (png_size > png_data.size()) - { - png_data.resize(png_size); + std::vector png_data{65536}; + png_alloc_size_t png_size = png_data.size(); png_image_write_to_memory(&png, png_data.data(), &png_size, false /* convert_to_8_bit*/, dest_buffer.data(), w * 4, nullptr); - } - else - png_data.resize(png_size); - return png_data; + if (png_size > png_data.size()) + { + png_data.resize(png_size); + png_image_write_to_memory(&png, png_data.data(), &png_size, false /* convert_to_8_bit*/, dest_buffer.data(), w * 4, nullptr); + } + else + png_data.resize(png_size); + + icons.emplace_back(w, h, bpp, std::move(png_data)); + } } - throw std::runtime_error{"Wrong magic number in " + filename.native()}; + return icons; } -std::vector load_zip(const std::filesystem::path & filename, int size) +std::vector try_load_zip(const std::filesystem::path & filename) { std::unique_ptr zip{archive_read_new(), &archive_read_free}; @@ -550,14 +492,10 @@ std::vector load_zip(const std::filesystem::path & filename, int size throw std::runtime_error{"Cannot open " + filename.native() + ": " + archive_error_string(zip.get())}; archive_entry * entry; - int width = 0; - int height = 0; - std::vector png; + std::vector icons; while (archive_read_next_header(zip.get(), &entry) == ARCHIVE_OK) { - printf("%s\n", archive_entry_pathname(entry)); - std::vector buffer; buffer.resize(archive_entry_size(entry)); @@ -577,10 +515,6 @@ std::vector load_zip(const std::filesystem::path & filename, int size continue; } - // Keep the largest icon only - if (png_ref.width * png_ref.height < width * height) - continue; - pixels.resize(PNG_IMAGE_SIZE(png_ref)); if (!png_image_finish_read(&png_ref, nullptr, pixels.data(), 0, nullptr)) @@ -589,48 +523,86 @@ std::vector load_zip(const std::filesystem::path & filename, int size continue; } - // PNG read successfully: keep it until we find a better one - width = png_ref.width; - height = png_ref.height; - png = std::move(buffer); + // PNG read successfully + icons.emplace_back(png_ref.width, png_ref.height, 32, std::move(buffer)); // TODO: check how to get bit depth png_image_free(&png_ref); } - return png; + return icons; } -std::unordered_map> icon_cache; +std::vector try_load_png(const std::filesystem::path & filename) +{ + auto png_data = load_file(filename); + std::vector icons; + + // Try reading the PNG + std::vector pixels; + png_image png_ref{ + .version = PNG_IMAGE_VERSION, + .format = PNG_FORMAT_BGRA, + }; + + if (not png_image_begin_read_from_memory(&png_ref, png_data.data(), png_data.size())) + { + png_image_free(&png_ref); + throw std::runtime_error(""); + } + + pixels.resize(PNG_IMAGE_SIZE(png_ref)); + + if (!png_image_finish_read(&png_ref, nullptr, pixels.data(), 0, nullptr)) + { + png_image_free(&png_ref); + throw std::runtime_error(""); + } + + // PNG read successfully + icons.emplace_back(png_ref.width, png_ref.height, 32, std::move(png_data)); // TODO: check how to get bit depth + + png_image_free(&png_ref); + + return icons; +} + +std::unordered_map> icon_cache; } // namespace -const std::vector & wivrn::load_icon(const std::filesystem::path & filename, int size) +const std::vector & wivrn::load_icon(const std::filesystem::path & filename) { auto it = icon_cache.find(filename); if (it != icon_cache.end() and not it->second.empty()) return it->second; - std::vector icon; + try + { + return icon_cache.emplace(filename, try_load_svg(filename, 256)).first->second; + } + catch (...) + {} - if (filename.extension() == ".svg") + try { - icon = load_svg(filename, size); - } - else if (filename.extension() == ".ico") - { - // Steam icon (Windows) - icon = load_ico(filename, size); - } - else if (filename.extension() == ".zip") - { - // Steam icon (Linux) - icon = load_zip(filename, size); - } - else - { - // TODO read arbitrary format / rewrite as png - icon = load_file(filename); + return icon_cache.emplace(filename, try_load_ico(filename)).first->second; } + catch (...) + {} - return icon_cache.emplace(filename, std::move(icon)).first->second; + try + { + return icon_cache.emplace(filename, try_load_zip(filename)).first->second; + } + catch (...) + {} + + try + { + return icon_cache.emplace(filename, try_load_png(filename)).first->second; + } + catch (...) + {} + + throw std::runtime_error{"Cannot load icon: " + filename.native()}; } diff --git a/common/utils/load_icon.h b/common/utils/load_icon.h index d89d8fdc..fa93e576 100644 --- a/common/utils/load_icon.h +++ b/common/utils/load_icon.h @@ -23,5 +23,13 @@ namespace wivrn { -const std::vector & load_icon(const std::filesystem::path & filename, int size); -} +struct icon +{ + int width; + int height; + int bpp; + std::vector png_data; +}; + +const std::vector & load_icon(const std::filesystem::path & filename); +} // namespace wivrn diff --git a/server/driver/wivrn_session.cpp b/server/driver/wivrn_session.cpp index dc61dbd4..4652567b 100644 --- a/server/driver/wivrn_session.cpp +++ b/server/driver/wivrn_session.cpp @@ -759,11 +759,22 @@ void wivrn_session::operator()(from_headset::get_application_list && request) { try { - auto icon = load_icon(*app.icon_path, 256); + const auto & icons = load_icon(*app.icon_path); + + if (icons.empty()) + continue; + + const auto & largest_icon = std::ranges::max(icons, [](const wivrn::icon & a, const wivrn::icon & b) { + if (a.bpp < b.bpp) + return true; + if (a.bpp > b.bpp) + return false; + return a.width * a.height < b.width * b.height; + }); send_control(to_headset::application_icon{ .id = id, - .image = std::move(icon), + .image = largest_icon.png_data, }); } catch (std::exception & e) From 5f6641c38f0364541528bb641f8b7aabe2d2308d Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Tue, 19 Aug 2025 19:13:46 +0200 Subject: [PATCH 55/85] load_icons: read files only once --- common/utils/load_icon.cpp | 77 +++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 43 deletions(-) diff --git a/common/utils/load_icon.cpp b/common/utils/load_icon.cpp index 390e848f..a85fb9db 100644 --- a/common/utils/load_icon.cpp +++ b/common/utils/load_icon.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -46,7 +45,7 @@ std::vector load_file(const std::filesystem::path & filename) template requires std::is_integral_v -T read(std::span & buffer) +T read(std::span & buffer) { if (sizeof(T) > buffer.size()) throw std::runtime_error{"File truncated"}; @@ -65,27 +64,22 @@ T read(std::span & buffer) template requires std::is_integral_v -std::span read(std::span & buffer, size_t count) +std::span read(std::span & buffer, size_t count) { if (count * sizeof(T) > buffer.size()) throw std::runtime_error{"File truncated"}; - std::span value{reinterpret_cast(buffer.data()), count}; + std::span value{reinterpret_cast(buffer.data()), count}; buffer = buffer.subspan(count * sizeof(T)); return value; } -std::vector try_load_svg(const std::filesystem::path & filename, int size) +std::vector try_load_svg(const std::vector & data, int size) { // TODO check if aspect ratio needs to be handled, dpi struct deleter { - void operator()(GFile * ptr) - { - g_object_unref(ptr); - } - void operator()(RsvgHandle * ptr) { g_object_unref(ptr); @@ -102,15 +96,13 @@ std::vector try_load_svg(const std::filesystem::path & filename, in } }; - using GFile_ptr = std::unique_ptr; using RsvgHandle_ptr = std::unique_ptr; using cairo_surface_t_ptr = std::unique_ptr; using cairo_t_ptr = std::unique_ptr; GError * error{}; - GFile_ptr file{g_file_new_for_path(filename.c_str())}; - RsvgHandle_ptr handle{rsvg_handle_new_from_gfile_sync(file.get(), RSVG_HANDLE_FLAGS_NONE, nullptr, &error)}; + RsvgHandle_ptr handle{rsvg_handle_new_from_data((guint8 *)data.data(), data.size(), &error)}; if (!handle) throw std::runtime_error{std::string{"Could not open: "} + error->message}; @@ -150,7 +142,7 @@ std::vector try_load_svg(const std::filesystem::path & filename, in return {{size, size, 32, std::move(png)}}; } -std::vector try_load_ico(const std::filesystem::path & filename) +std::vector try_load_ico(const std::vector & ico) { const uint32_t ICO_PNG_MAGIC = 0x474e5089; @@ -190,8 +182,6 @@ std::vector try_load_ico(const std::filesystem::path & filename) static_assert(rowstride(32, 32) == 128); static_assert(rowstride(33, 32) == 132); - auto ico = load_file(filename); - std::span header{ico}; auto reserved = read(header); @@ -199,7 +189,7 @@ std::vector try_load_ico(const std::filesystem::path & filename) auto icon_count = read(header); if (reserved != 0 or resource_type != 1) - throw std::runtime_error{"Cannot read icon: " + filename.native()}; + throw std::runtime_error{"Cannot read icon"}; std::vector icons; @@ -215,13 +205,13 @@ std::vector try_load_ico(const std::filesystem::path & filename) auto offset = read(header); if (offset + size > ico.size()) - throw std::runtime_error{"Cannot read icon: " + filename.native()}; + throw std::runtime_error{"Cannot read icon"}; auto data = std::span{ico}.subspan(offset, size); if (reserved != 0) - throw std::runtime_error{"Cannot read icon: " + filename.native()}; + throw std::runtime_error{"Cannot read icon"}; if (planes != 0 and planes != 1) - throw std::runtime_error{"Cannot read icon: " + filename.native()}; + throw std::runtime_error{"Cannot read icon"}; auto magic = read(data); @@ -283,7 +273,7 @@ std::vector try_load_ico(const std::filesystem::path & filename) auto w = width; auto h = height / 2; - std::span palette; // BGRX + std::span palette; // BGRX if (bpp <= 16) { @@ -298,8 +288,8 @@ std::vector try_load_ico(const std::filesystem::path & filename) size_t and_stride = rowstride(w, 1); size_t dst_stride = 4 * w; - std::span xor_map = read(data, xor_stride * h); - std::span and_map = read(data, and_stride * h); + std::span xor_map = read(data, xor_stride * h); + std::span and_map = read(data, and_stride * h); std::vector dest_buffer; dest_buffer.resize(h * dst_stride); @@ -309,8 +299,8 @@ std::vector try_load_ico(const std::filesystem::path & filename) case 1: for (int y = 0; y < h; y++) { - uint8_t * src_xor_row = xor_map.data() + xor_stride * y; - uint8_t * src_and_row = and_map.data() + and_stride * y; + const uint8_t * src_xor_row = xor_map.data() + xor_stride * y; + const uint8_t * src_and_row = and_map.data() + and_stride * y; uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); for (int x = 0, i = 0; x < w; x++) @@ -337,8 +327,8 @@ std::vector try_load_ico(const std::filesystem::path & filename) case 4: for (int y = 0; y < h; y++) { - uint8_t * src_xor_row = xor_map.data() + xor_stride * y; - uint8_t * src_and_row = and_map.data() + and_stride * y; + const uint8_t * src_xor_row = xor_map.data() + xor_stride * y; + const uint8_t * src_and_row = and_map.data() + and_stride * y; uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); for (int x = 0, i = 0; x < w; x++) @@ -365,8 +355,8 @@ std::vector try_load_ico(const std::filesystem::path & filename) case 8: for (int y = 0; y < h; y++) { - uint8_t * src_xor_row = xor_map.data() + xor_stride * y; - uint8_t * src_and_row = and_map.data() + and_stride * y; + const uint8_t * src_xor_row = xor_map.data() + xor_stride * y; + const uint8_t * src_and_row = and_map.data() + and_stride * y; uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); for (int x = 0, i = 0; x < w; x++) @@ -393,8 +383,8 @@ std::vector try_load_ico(const std::filesystem::path & filename) case 16: for (int y = 0; y < h; y++) { - uint8_t * src_xor_row = xor_map.data() + xor_stride * y; - uint8_t * src_and_row = and_map.data() + and_stride * y; + const uint8_t * src_xor_row = xor_map.data() + xor_stride * y; + const uint8_t * src_and_row = and_map.data() + and_stride * y; uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); for (int x = 0, i = 0; x < w; x++) @@ -423,8 +413,8 @@ std::vector try_load_ico(const std::filesystem::path & filename) case 24: for (int y = 0; y < h; y++) { - uint8_t * src_xor_row = xor_map.data() + xor_stride * y; - uint8_t * src_and_row = and_map.data() + and_stride * y; + const uint8_t * src_xor_row = xor_map.data() + xor_stride * y; + const uint8_t * src_and_row = and_map.data() + and_stride * y; uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); for (int x = 0, i = 0; x < w; x++) @@ -447,7 +437,7 @@ std::vector try_load_ico(const std::filesystem::path & filename) case 32: for (int y = 0; y < h; y++) { - uint8_t * src_xor_row = (uint8_t *)xor_map.data() + xor_stride * y; + const uint8_t * src_xor_row = xor_map.data() + xor_stride * y; uint8_t * dst_row = dest_buffer.data() + dst_stride * (h - 1 - y); memcpy(dst_row, src_xor_row, dst_stride); @@ -481,15 +471,15 @@ std::vector try_load_ico(const std::filesystem::path & filename) return icons; } -std::vector try_load_zip(const std::filesystem::path & filename) +std::vector try_load_zip(const std::vector & data) { std::unique_ptr zip{archive_read_new(), &archive_read_free}; archive_read_support_filter_all(zip.get()); archive_read_support_format_all(zip.get()); - if (auto rc = archive_read_open_filename(zip.get(), filename.c_str(), 1'000'000); rc != ARCHIVE_OK) - throw std::runtime_error{"Cannot open " + filename.native() + ": " + archive_error_string(zip.get())}; + if (auto rc = archive_read_open_memory(zip.get(), data.data(), data.size()); rc != ARCHIVE_OK) + throw std::runtime_error{std::string("Cannot open ZIP: ") + archive_error_string(zip.get())}; archive_entry * entry; std::vector icons; @@ -532,9 +522,8 @@ std::vector try_load_zip(const std::filesystem::path & filename) return icons; } -std::vector try_load_png(const std::filesystem::path & filename) +std::vector try_load_png(const std::vector & png_data) { - auto png_data = load_file(filename); std::vector icons; // Try reading the PNG @@ -576,30 +565,32 @@ const std::vector & wivrn::load_icon(const std::filesystem::path & if (it != icon_cache.end() and not it->second.empty()) return it->second; + auto data = load_file(filename); + try { - return icon_cache.emplace(filename, try_load_svg(filename, 256)).first->second; + return icon_cache.emplace(filename, try_load_svg(data, 256)).first->second; } catch (...) {} try { - return icon_cache.emplace(filename, try_load_ico(filename)).first->second; + return icon_cache.emplace(filename, try_load_ico(data)).first->second; } catch (...) {} try { - return icon_cache.emplace(filename, try_load_zip(filename)).first->second; + return icon_cache.emplace(filename, try_load_zip(data)).first->second; } catch (...) {} try { - return icon_cache.emplace(filename, try_load_png(filename)).first->second; + return icon_cache.emplace(filename, try_load_png(data)).first->second; } catch (...) {} From 0acfe7cd24a1b6fd8a4799cd73828c09cdedf5e4 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sat, 16 Aug 2025 20:17:50 +0200 Subject: [PATCH 56/85] Remove hand tracker from application.h --- client/application.cpp | 13 +----------- client/application.h | 24 +++++----------------- client/configuration.cpp | 4 ++-- client/scenes/lobby.cpp | 34 ++++++++++++------------------- client/scenes/lobby.h | 3 +++ client/scenes/lobby_gui.cpp | 6 +++--- client/scenes/stream.cpp | 2 ++ client/scenes/stream.h | 2 ++ client/scenes/stream_gui.cpp | 19 ++++++++++++++--- client/scenes/stream_tracking.cpp | 26 +++++++++++++++++++---- client/xr/system.cpp | 8 ++++++++ client/xr/system.h | 2 ++ 12 files changed, 79 insertions(+), 64 deletions(-) diff --git a/client/application.cpp b/client/application.cpp index 384dee76..c7c976e8 100644 --- a/client/application.cpp +++ b/client/application.cpp @@ -1236,12 +1236,7 @@ void application::initialize() spdlog::info(" Orientation tracking: {}", (bool)properties.trackingProperties.orientationTracking); spdlog::info(" Position tracking: {}", (bool)properties.trackingProperties.positionTracking); - if (utils::contains(xr_extensions, XR_EXT_HAND_TRACKING_EXTENSION_NAME)) - { - XrSystemHandTrackingPropertiesEXT hand_tracking_properties = xr_system_id.hand_tracking_properties(); - spdlog::info(" Hand tracking support: {}", (bool)hand_tracking_properties.supportsHandTracking); - hand_tracking_supported = hand_tracking_properties.supportsHandTracking; - } + spdlog::info(" Hand tracking support: {}", xr_system_id.hand_tracking_supported()); if (utils::contains(xr_extensions, XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME)) { @@ -1288,12 +1283,6 @@ void application::initialize() config.emplace(xr_system_id); - if (hand_tracking_supported) - { - left_hand = xr_session.create_hand_tracker(XR_HAND_LEFT_EXT); - right_hand = xr_session.create_hand_tracker(XR_HAND_RIGHT_EXT); - } - if (utils::contains(xr_extensions, XR_FB_FACE_TRACKING2_EXTENSION_NAME)) { XrSystemFaceTrackingProperties2FB fb_face2_properties = xr_system_id.fb_face_tracking2_properties(); diff --git a/client/application.h b/client/application.h index cb17f87e..69120199 100644 --- a/client/application.h +++ b/client/application.h @@ -126,10 +126,6 @@ class application : public singleton xr::actionset xr_actionset; std::vector> actions; - bool hand_tracking_supported = false; - xr::hand_tracker left_hand; - xr::hand_tracker right_hand; - std::variant face_tracker; std::variant body_tracker; @@ -396,6 +392,11 @@ public: return instance().vk_instance; } + static xr::system & get_system() + { + return instance().xr_system_id; + } + static vk::raii::PipelineCache & get_pipeline_cache() { return instance().pipeline_cache; @@ -416,11 +417,6 @@ public: return instance().last_scene_cpu_time; } - static bool get_hand_tracking_supported() - { - return instance().hand_tracking_supported; - } - static bool get_face_tracking_supported() { return !std::holds_alternative(instance().face_tracker); @@ -441,16 +437,6 @@ public: return instance().openxr_post_processing_supported; } - static xr::hand_tracker & get_left_hand() - { - return instance().left_hand; - } - - static xr::hand_tracker & get_right_hand() - { - return instance().right_hand; - } - static auto & get_face_tracker() { return instance().face_tracker; diff --git a/client/configuration.cpp b/client/configuration.cpp index ea0ec8d8..ccb34b20 100644 --- a/client/configuration.cpp +++ b/client/configuration.cpp @@ -94,7 +94,7 @@ bool configuration::check_feature(feature f) const case feature::microphone: break; case feature::hand_tracking: - if (not application::get_hand_tracking_supported()) + if (not application::get_system().hand_tracking_supported()) return false; break; case feature::eye_gaze: @@ -182,7 +182,7 @@ void configuration::set_feature(feature f, bool state) configuration::configuration(xr::system & system) { passthrough_enabled = system.passthrough_supported() == xr::system::passthrough_type::color; - features[feature::hand_tracking] = application::get_hand_tracking_supported(); + features[feature::hand_tracking] = system.hand_tracking_supported(); try { simdjson::dom::parser parser; diff --git a/client/scenes/lobby.cpp b/client/scenes/lobby.cpp index 98aaa0a7..54345fcb 100644 --- a/client/scenes/lobby.cpp +++ b/client/scenes/lobby.cpp @@ -649,10 +649,10 @@ void scenes::lobby::render(const XrFrameState & frame_state) if (!new_gui_position and head_position) new_gui_position = check_recenter_action(frame_state.predictedDisplayTime, head_position->first); - if (application::get_hand_tracking_supported()) + if (left_hand and right_hand) { - auto left = application::get_left_hand().locate(world_space, frame_state.predictedDisplayTime); - auto right = application::get_right_hand().locate(world_space, frame_state.predictedDisplayTime); + auto left = left_hand->locate(world_space, frame_state.predictedDisplayTime); + auto right = right_hand->locate(world_space, frame_state.predictedDisplayTime); hand_model::apply(world, left, right); @@ -835,12 +835,6 @@ void scenes::lobby::on_focused() xyz_axes_right_controller = load_gltf("xyz-arrows.glb", layer_controllers).first; #endif - if (application::get_hand_tracking_supported()) - { - 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; recenter_right_action = get_action("recenter_right").first; @@ -862,19 +856,15 @@ void scenes::lobby::on_focused() .haptic_output = get_action("right_haptic").first, }, }; - if (auto & hand = application::get_left_hand()) + + if (system.hand_tracking_supported()) { - imgui_inputs.push_back( - { - .hand = &hand, - }); - } - if (auto & hand = application::get_right_hand()) - { - imgui_inputs.push_back( - { - .hand = &hand, - }); + left_hand = session.create_hand_tracker(XR_HAND_LEFT_EXT); + right_hand = session.create_hand_tracker(XR_HAND_RIGHT_EXT); + hand_model::add_hand(*this, XR_HAND_LEFT_EXT, "left-hand.glb", layer_controllers); + hand_model::add_hand(*this, XR_HAND_RIGHT_EXT, "right-hand.glb", layer_controllers); + imgui_inputs.push_back({.hand = &*left_hand}); + imgui_inputs.push_back({.hand = &*right_hand}); } // 0.4mm / pixel @@ -966,6 +956,8 @@ void scenes::lobby::on_unfocused() 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(); diff --git a/client/scenes/lobby.h b/client/scenes/lobby.h index e68040ce..81d6afd3 100644 --- a/client/scenes/lobby.h +++ b/client/scenes/lobby.h @@ -66,6 +66,9 @@ class lobby : public scene_impl std::optional imgui_ctx; + std::optional left_hand; + std::optional right_hand; + std::string selected_item; std::unique_ptr license; diff --git a/client/scenes/lobby_gui.cpp b/client/scenes/lobby_gui.cpp index ad7e3533..9c3029b9 100644 --- a/client/scenes/lobby_gui.cpp +++ b/client/scenes/lobby_gui.cpp @@ -889,7 +889,7 @@ void scenes::lobby::gui_settings() ImGui::EndDisabled(); } { - ImGui::BeginDisabled(not application::get_hand_tracking_supported()); + ImGui::BeginDisabled(not system.hand_tracking_supported()); bool enabled = config.check_feature(feature::hand_tracking); if (ImGui::Checkbox(_S("Enable hand tracking"), &enabled)) { @@ -1690,7 +1690,7 @@ void scenes::lobby::draw_features_status(XrTime predicted_display_time) .icon_disabled = ICON_FA_MICROPHONE_SLASH, }); - if (application::get_hand_tracking_supported()) + if (system.hand_tracking_supported()) { items.push_back({ .f = feature::hand_tracking, @@ -2028,7 +2028,7 @@ std::vector> scenes::lobby::draw_gui(XrTi if (not is_gui_visible(*imgui_ctx, predicted_display_time)) { - if (application::get_hand_tracking_supported()) + if (system.hand_tracking_supported()) display_recentering_tip(*imgui_ctx, _("Press the grip button or put your palm up\nto move the main window")); else display_recentering_tip(*imgui_ctx, _("Press the grip button to move the main window")); diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index 50dca0a8..68a6f9a7 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -493,6 +493,8 @@ void scenes::stream::on_unfocused() loader.reset(); renderer.reset(); clear_swapchains(); + left_hand.reset(); + right_hand.reset(); imgui_ctx.reset(); swapchain_imgui = xr::swapchain(); diff --git a/client/scenes/stream.h b/client/scenes/stream.h index 391d2a9b..a7cbd2ce 100644 --- a/client/scenes/stream.h +++ b/client/scenes/stream.h @@ -129,6 +129,8 @@ private: std::optional