diff --git a/client/configuration.cpp b/client/configuration.cpp index c959dcf4..5a9d926e 100644 --- a/client/configuration.cpp +++ b/client/configuration.cpp @@ -117,6 +117,11 @@ configuration::configuration(const std::string & path) preferred_refresh_rate = val.get_double(); } + if (auto val = root["resolution_scale"]; val.is_double()) + { + resolution_scale = val.get_double(); + } + if (auto val = root["microphone"]; val.is_bool()) microphone = val.get_bool(); @@ -153,6 +158,7 @@ void configuration::save() << "\"show_performance_metrics\":" << std::boolalpha << show_performance_metrics; if (preferred_refresh_rate != 0.) json << ",\"preferred_refresh_rate\":" << preferred_refresh_rate; + json << ",\"resolution_scale\":" << resolution_scale; json << ",\"microphone\":" << std::boolalpha << microphone; json << ",\"passthrough_enabled\":" << std::boolalpha << passthrough_enabled; json << "}"; diff --git a/client/configuration.h b/client/configuration.h index 01124c3a..6f573434 100644 --- a/client/configuration.h +++ b/client/configuration.h @@ -41,6 +41,7 @@ public: std::map servers; float preferred_refresh_rate = 0; + float resolution_scale = 1.0; bool show_performance_metrics = false; bool microphone = false; bool passthrough_enabled = false; diff --git a/client/scenes/lobby_gui.cpp b/client/scenes/lobby_gui.cpp index c5d8fded..296adfb1 100644 --- a/client/scenes/lobby_gui.cpp +++ b/client/scenes/lobby_gui.cpp @@ -360,6 +360,24 @@ void scenes::lobby::gui_settings() } } + { + const auto available_scales = {0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0}; + const auto current = config.resolution_scale; + if (ImGui::BeginCombo("Resolution scale", fmt::format("{}", current).c_str())) + { + for (float scale: available_scales) + { + if (ImGui::Selectable(fmt::format("{}", scale).c_str(), scale == current) and scale != current) + { + config.resolution_scale = scale; + config.save(); + } + } + ImGui::EndCombo(); + } + vibrate_on_hover(); + } + if (ImGui::Checkbox("Enable microphone", &config.microphone)) { #ifdef __ANDROID__ diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index 6446522c..4564cd57 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -86,6 +86,11 @@ std::shared_ptr scenes::stream::create(std::unique_ptrsystem.view_configuration_views(self->viewconfig)[0]; view = override_view(view, guess_model()); + auto resolution_scale = application::get_config().resolution_scale; + + view.recommendedImageRectWidth *= resolution_scale; + view.recommendedImageRectHeight *= resolution_scale; + info.recommended_eye_width = view.recommendedImageRectWidth; info.recommended_eye_height = view.recommendedImageRectHeight;