Remove unused functions
This commit is contained in:
@@ -34,7 +34,6 @@
|
||||
#include "xr/system.h"
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui_internal.h"
|
||||
#include <IconsFontAwesome6.h>
|
||||
#include <cmath>
|
||||
|
||||
@@ -45,90 +44,6 @@ float toggle_width()
|
||||
return ImGui::GetFrameHeight() * ui::metrics::control_height * ui::metrics::toggle_aspect;
|
||||
}
|
||||
|
||||
std::string rate_label(float rate, uint32_t divider)
|
||||
{
|
||||
if (rate == 0)
|
||||
return _C("automatic refresh rate", "Automatic");
|
||||
if (divider == 1)
|
||||
return fmt::format("{}", rate);
|
||||
|
||||
return fmt::format(_cF("refresh rate selection, with reprojection", "{} ({} with space warp)"), rate / divider, rate);
|
||||
}
|
||||
|
||||
bool refresh_rate(
|
||||
xr::instance & instance,
|
||||
xr::session & session,
|
||||
imgui_context & imgui_ctx,
|
||||
configuration & config)
|
||||
{
|
||||
if (not instance.has_extension(XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME))
|
||||
return false;
|
||||
|
||||
const auto & refresh_rates = session.get_refresh_rates();
|
||||
if (refresh_rates.empty())
|
||||
return false;
|
||||
|
||||
bool changed = false;
|
||||
if (ImGui::BeginCombo(
|
||||
_S("Refresh rate"),
|
||||
rate_label(config.preferred_refresh_rate, config.fps_divider).c_str()))
|
||||
{
|
||||
if (ImGui::Selectable(
|
||||
_cS("automatic refresh rate", "Automatic"),
|
||||
config.preferred_refresh_rate == 0,
|
||||
ImGuiSelectableFlags_SelectOnRelease))
|
||||
{
|
||||
config.preferred_refresh_rate = 0;
|
||||
config.fps_divider = 1;
|
||||
config.save();
|
||||
changed = true;
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
imgui_ctx.tooltip(_("Select refresh rate based on measured application performance.\n"
|
||||
"May cause flicker when a change happens."));
|
||||
|
||||
for (uint32_t divider: {1, 2})
|
||||
{
|
||||
for (float rate: refresh_rates)
|
||||
{
|
||||
if (ImGui::Selectable(
|
||||
rate_label(rate, divider).c_str(),
|
||||
rate == config.preferred_refresh_rate and divider == config.fps_divider,
|
||||
ImGuiSelectableFlags_SelectOnRelease))
|
||||
{
|
||||
spdlog::info("configured refresh rate: {}", rate);
|
||||
session.set_refresh_rate(rate);
|
||||
config.preferred_refresh_rate = rate;
|
||||
config.fps_divider = divider;
|
||||
config.save();
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
imgui_ctx.vibrate_on_hover();
|
||||
|
||||
if (config.preferred_refresh_rate == 0 and refresh_rates.size() > 2)
|
||||
{
|
||||
float min_rate = config.minimum_refresh_rate.value_or(refresh_rates.front());
|
||||
if (ImGui::BeginCombo(_S("Minimum refresh rate"), fmt::format("{}", min_rate).c_str()))
|
||||
{
|
||||
for (float rate: refresh_rates | std::views::take(refresh_rates.size() - 1))
|
||||
{
|
||||
if (ImGui::Selectable(fmt::format("{}", rate).c_str(), rate == config.minimum_refresh_rate, ImGuiSelectableFlags_SelectOnRelease))
|
||||
{
|
||||
config.minimum_refresh_rate = rate;
|
||||
config.save();
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
imgui_ctx.vibrate_on_hover();
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
bool body_tracking_parts(
|
||||
xr::system & system,
|
||||
imgui_context & imgui_ctx,
|
||||
@@ -189,88 +104,6 @@ bool body_tracking_parts(
|
||||
return changed;
|
||||
}
|
||||
|
||||
static std::string openxr_post_processing_flag_name(XrCompositionLayerSettingsFlagsFB flag)
|
||||
{
|
||||
switch (flag)
|
||||
{
|
||||
case XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SUPER_SAMPLING_BIT_FB:
|
||||
case XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SHARPENING_BIT_FB:
|
||||
return _C("openxr_post_processing", "Normal");
|
||||
case XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SUPER_SAMPLING_BIT_FB:
|
||||
case XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SHARPENING_BIT_FB:
|
||||
return _C("openxr_post_processing", "Quality");
|
||||
default:
|
||||
return _C("openxr_post_processing", "Disabled");
|
||||
}
|
||||
}
|
||||
|
||||
bool post_processing(
|
||||
imgui_context & imgui_ctx,
|
||||
configuration & config)
|
||||
{
|
||||
bool changed = false;
|
||||
if (not application::get_openxr_post_processing_supported())
|
||||
return changed;
|
||||
|
||||
ImGui::Text("%s", _S("OpenXR post-processing"));
|
||||
ImGui::Indent();
|
||||
|
||||
{
|
||||
XrCompositionLayerSettingsFlagsFB current = config.openxr_post_processing.super_sampling;
|
||||
if (ImGui::BeginCombo(_S("Supersampling"), openxr_post_processing_flag_name(current).c_str()))
|
||||
{
|
||||
const XrCompositionLayerSettingsFlagsFB selectable_options[]{
|
||||
0,
|
||||
XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SUPER_SAMPLING_BIT_FB,
|
||||
XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SUPER_SAMPLING_BIT_FB};
|
||||
for (XrCompositionLayerSettingsFlagsFB option: selectable_options)
|
||||
{
|
||||
if (ImGui::Selectable(openxr_post_processing_flag_name(option).c_str(), current == option, ImGuiSelectableFlags_SelectOnRelease))
|
||||
{
|
||||
spdlog::info("Setting OpenXR super sampling to {}", openxr_post_processing_flag_name(option));
|
||||
config.openxr_post_processing.super_sampling = option;
|
||||
config.save();
|
||||
changed = true;
|
||||
}
|
||||
imgui_ctx.vibrate_on_hover();
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
imgui_ctx.vibrate_on_hover();
|
||||
if (ImGui::IsItemHovered())
|
||||
imgui_ctx.tooltip(_("Reduce flicker for high contrast edges.\nUseful when the input resolution is high compared to the headset display"));
|
||||
}
|
||||
|
||||
{
|
||||
XrCompositionLayerSettingsFlagsFB current = config.openxr_post_processing.sharpening;
|
||||
if (ImGui::BeginCombo(_S("Sharpening"), openxr_post_processing_flag_name(current).c_str()))
|
||||
{
|
||||
const XrCompositionLayerSettingsFlagsFB selectable_options[]{
|
||||
0,
|
||||
XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SHARPENING_BIT_FB,
|
||||
XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SHARPENING_BIT_FB};
|
||||
for (XrCompositionLayerSettingsFlagsFB option: selectable_options)
|
||||
{
|
||||
if (ImGui::Selectable(openxr_post_processing_flag_name(option).c_str(), current == option, ImGuiSelectableFlags_SelectOnRelease))
|
||||
{
|
||||
spdlog::info("Setting OpenXR sharpening to {}", openxr_post_processing_flag_name(option));
|
||||
config.openxr_post_processing.sharpening = option;
|
||||
config.save();
|
||||
changed = true;
|
||||
}
|
||||
imgui_ctx.vibrate_on_hover();
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
imgui_ctx.vibrate_on_hover();
|
||||
if (ImGui::IsItemHovered())
|
||||
imgui_ctx.tooltip(_("Improve clarity of high contrast edges and counteract blur.\nUseful when the input resolution is low compared to the headset display"));
|
||||
}
|
||||
|
||||
ImGui::Unindent();
|
||||
return changed;
|
||||
}
|
||||
|
||||
std::optional<battery_indicator> battery_status_indicator(XrTime now)
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
|
||||
Reference in New Issue
Block a user