Reorganize tabs, fix opacity not settable to 80%
This commit is contained in:
@@ -206,7 +206,7 @@ void render_settings(const wivrn::gui::settings_context & ctx, const char * card
|
|||||||
namespace wivrn::gui
|
namespace wivrn::gui
|
||||||
{
|
{
|
||||||
|
|
||||||
void settings_performance(const settings_context & ctx)
|
void settings_video(const settings_context & ctx)
|
||||||
{
|
{
|
||||||
auto & config = ctx.config;
|
auto & config = ctx.config;
|
||||||
const std::string disconnect_tip = ctx.in_game ? _C("tooltip for disabled settings", "Disconnect to change this setting.") : std::string{};
|
const std::string disconnect_tip = ctx.in_game ? _C("tooltip for disabled settings", "Disconnect to change this setting.") : std::string{};
|
||||||
@@ -270,6 +270,31 @@ void settings_performance(const settings_context & ctx)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctx.instance.has_extension(XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME))
|
||||||
|
{
|
||||||
|
list.push_back({
|
||||||
|
.id = "##spacewarp",
|
||||||
|
.label = _("Application SpaceWarp"),
|
||||||
|
.description = _("Renders at half the refresh rate. The headset may synthesise frames."),
|
||||||
|
.ui = ui_kind::toggle,
|
||||||
|
.get_bool = [&config] { return config.fps_divider == 2; },
|
||||||
|
.set_bool = [&ctx, &config](bool v) { config.fps_divider = v ? 2 : 1; config.save(); if (ctx.on_streaming_changed) ctx.on_streaming_changed(); },
|
||||||
|
.default_bool = false,
|
||||||
|
.enabled = [&config] { return config.preferred_refresh_rate != 0; },
|
||||||
|
.disabled_tooltip = _("Set a refresh rate other than auto to enable this setting."),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ui::page_header(_cS("page header title", "Video"), _cS("page header subtitle", "Frame rate and resolution."));
|
||||||
|
render_settings(ctx, "##video", list);
|
||||||
|
}
|
||||||
|
|
||||||
|
void settings_streaming(const settings_context & ctx)
|
||||||
|
{
|
||||||
|
auto & config = ctx.config;
|
||||||
|
const std::string disconnect_tip = ctx.in_game ? _C("tooltip for disabled settings", "Disconnect to change this setting.") : std::string{};
|
||||||
|
std::vector<setting> list;
|
||||||
|
|
||||||
list.push_back({
|
list.push_back({
|
||||||
.id = "##foveation",
|
.id = "##foveation",
|
||||||
.label = _("Foveated encoding"),
|
.label = _("Foveated encoding"),
|
||||||
@@ -291,44 +316,6 @@ void settings_performance(const settings_context & ctx)
|
|||||||
.disabled_tooltip = disconnect_tip,
|
.disabled_tooltip = disconnect_tip,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ctx.instance.has_extension(XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME))
|
|
||||||
{
|
|
||||||
list.push_back({
|
|
||||||
.id = "##spacewarp",
|
|
||||||
.label = _("Application SpaceWarp"),
|
|
||||||
.description = _("Renders at half the refresh rate. The headset may synthesise frames."),
|
|
||||||
.ui = ui_kind::toggle,
|
|
||||||
.get_bool = [&config] { return config.fps_divider == 2; },
|
|
||||||
.set_bool = [&ctx, &config](bool v) { config.fps_divider = v ? 2 : 1; config.save(); if (ctx.on_streaming_changed) ctx.on_streaming_changed(); },
|
|
||||||
.default_bool = false,
|
|
||||||
.enabled = [&config] { return config.preferred_refresh_rate != 0; },
|
|
||||||
.disabled_tooltip = _("Set a refresh rate other than auto to enable this setting."),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctx.instance.has_extension(XR_EXT_PERFORMANCE_SETTINGS_EXTENSION_NAME))
|
|
||||||
{
|
|
||||||
list.push_back({
|
|
||||||
.id = "##high_power",
|
|
||||||
.label = _("High power mode"),
|
|
||||||
.description = _("Increase power usage to allow higher resolution and refresh rate. Drains battery and runs hot."),
|
|
||||||
.ui = ui_kind::toggle,
|
|
||||||
.get_bool = [&config] { return config.high_power_mode; },
|
|
||||||
.set_bool = [&config](bool v) { config.high_power_mode = v; config.save(); },
|
|
||||||
.default_bool = true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
ui::page_header(_cS("page header title", "Performance"), _cS("page header subtitle", "Frame rate, resolution and power draw."));
|
|
||||||
render_settings(ctx, "##performance", list);
|
|
||||||
}
|
|
||||||
|
|
||||||
void settings_streaming(const settings_context & ctx)
|
|
||||||
{
|
|
||||||
auto & config = ctx.config;
|
|
||||||
const std::string disconnect_tip = ctx.in_game ? _C("tooltip for disabled settings", "Disconnect to change this setting.") : std::string{};
|
|
||||||
std::vector<setting> list;
|
|
||||||
|
|
||||||
auto codec_name = [](std::optional<wivrn::video_codec> codec) -> std::string {
|
auto codec_name = [](std::optional<wivrn::video_codec> codec) -> std::string {
|
||||||
if (not codec)
|
if (not codec)
|
||||||
return _C("Codec", "Automatic");
|
return _C("Codec", "Automatic");
|
||||||
@@ -434,33 +421,9 @@ void settings_streaming(const settings_context & ctx)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool disable_instream_gui = false;
|
|
||||||
bool disable_instream_gui_popup_open = ImGui::IsPopupOpen("confirm disable in stream gui");
|
|
||||||
list.push_back({
|
|
||||||
.id = "##stream_gui",
|
|
||||||
.label = _C("setting name", "In-stream window"),
|
|
||||||
.description = _("Enables the configuration window to be shown while the game is streaming. If enabled, the window is activated by pressing both thumbsticks."),
|
|
||||||
.ui = ui_kind::toggle,
|
|
||||||
.get_bool = [&config, &disable_instream_gui_popup_open] { return config.enable_stream_gui and not disable_instream_gui_popup_open; },
|
|
||||||
.set_bool = [&ctx, &config, &disable_instream_gui](bool v) {
|
|
||||||
if (ctx.in_game and not v)
|
|
||||||
{
|
|
||||||
disable_instream_gui = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
config.enable_stream_gui = v;
|
|
||||||
config.save();
|
|
||||||
} },
|
|
||||||
.default_bool = true,
|
|
||||||
});
|
|
||||||
|
|
||||||
ui::page_header(_cS("page header title", "Streaming"), _cS("page header subtitle", "How video is encoded and sent to the headset."));
|
ui::page_header(_cS("page header title", "Streaming"), _cS("page header subtitle", "How video is encoded and sent to the headset."));
|
||||||
render_settings(ctx, "##streaming", list);
|
render_settings(ctx, "##streaming", list);
|
||||||
|
|
||||||
if (disable_instream_gui)
|
|
||||||
ImGui::OpenPopup("confirm disable in stream gui");
|
|
||||||
|
|
||||||
if (wivrn::ui::confirm_modal(
|
if (wivrn::ui::confirm_modal(
|
||||||
"confirm disable in stream gui",
|
"confirm disable in stream gui",
|
||||||
_C("confirmation messagebox title", "Disable in-stream window"),
|
_C("confirmation messagebox title", "Disable in-stream window"),
|
||||||
@@ -755,8 +718,45 @@ void settings_system(const settings_context & ctx)
|
|||||||
.default_bool = false,
|
.default_bool = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (ctx.instance.has_extension(XR_EXT_PERFORMANCE_SETTINGS_EXTENSION_NAME))
|
||||||
|
{
|
||||||
|
list.push_back({
|
||||||
|
.id = "##high_power",
|
||||||
|
.label = _("High power mode"),
|
||||||
|
.description = _("Increase power usage to allow higher resolution and refresh rate. Drains battery and runs hot."),
|
||||||
|
.ui = ui_kind::toggle,
|
||||||
|
.get_bool = [&config] { return config.high_power_mode; },
|
||||||
|
.set_bool = [&config](bool v) { config.high_power_mode = v; config.save(); },
|
||||||
|
.default_bool = true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
bool disable_instream_gui = false;
|
||||||
|
bool disable_instream_gui_popup_open = ImGui::IsPopupOpen("confirm disable in stream gui");
|
||||||
|
list.push_back({
|
||||||
|
.id = "##stream_gui",
|
||||||
|
.label = _C("setting name", "In-stream window"),
|
||||||
|
.description = _("Enables the configuration window to be shown while the game is streaming. If enabled, the window is activated by pressing both thumbsticks."),
|
||||||
|
.ui = ui_kind::toggle,
|
||||||
|
.get_bool = [&config, &disable_instream_gui_popup_open] { return config.enable_stream_gui and not disable_instream_gui_popup_open; },
|
||||||
|
.set_bool = [&ctx, &config, &disable_instream_gui](bool v) {
|
||||||
|
if (ctx.in_game and not v)
|
||||||
|
{
|
||||||
|
disable_instream_gui = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
config.enable_stream_gui = v;
|
||||||
|
config.save();
|
||||||
|
} },
|
||||||
|
.default_bool = true,
|
||||||
|
});
|
||||||
|
|
||||||
ui::page_header(_cS("page header title", "System"), _cS("page header suibtitle", "Language and advanced options."));
|
ui::page_header(_cS("page header title", "System"), _cS("page header suibtitle", "Language and advanced options."));
|
||||||
render_settings(ctx, "##system", list);
|
render_settings(ctx, "##system", list);
|
||||||
|
|
||||||
|
if (disable_instream_gui)
|
||||||
|
ImGui::OpenPopup("confirm disable in stream gui");
|
||||||
}
|
}
|
||||||
|
|
||||||
void settings_theme(const settings_context & ctx)
|
void settings_theme(const settings_context & ctx)
|
||||||
@@ -862,7 +862,7 @@ void settings_theme(const settings_context & ctx)
|
|||||||
|
|
||||||
// Panel transparency, independent of the selected preset
|
// Panel transparency, independent of the selected preset
|
||||||
static const int opacity_default = 75;
|
static const int opacity_default = 75;
|
||||||
int opacity = int(ui::background_alpha() * 100);
|
int opacity = int(ui::background_alpha() * 100 + 0.5);
|
||||||
ui::setting_label(_cS("setting name", "Panel opacity"), _cS("setting description", "Opacity of the panel and card backgrounds"), control_w);
|
ui::setting_label(_cS("setting name", "Panel opacity"), _cS("setting description", "Opacity of the panel and card backgrounds"), control_w);
|
||||||
if (ui::slider_int("##opacity", &opacity, 20, 100, "%d%%", {control_w, 0}, &opacity_default))
|
if (ui::slider_int("##opacity", &opacity, 20, 100, "%d%%", {control_w, 0}, &opacity_default))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ struct settings_context
|
|||||||
std::function<void()> on_foveation_override_changed; // foveation override toggled
|
std::function<void()> on_foveation_override_changed; // foveation override toggled
|
||||||
};
|
};
|
||||||
|
|
||||||
void settings_performance(const settings_context &);
|
void settings_video(const settings_context &);
|
||||||
void settings_streaming(const settings_context &);
|
void settings_streaming(const settings_context &);
|
||||||
void settings_post_processing(const settings_context &);
|
void settings_post_processing(const settings_context &);
|
||||||
void settings_audio(const settings_context &);
|
void settings_audio(const settings_context &);
|
||||||
|
|||||||
@@ -119,10 +119,10 @@ class lobby : public scene_impl<lobby>
|
|||||||
{
|
{
|
||||||
first_run,
|
first_run,
|
||||||
server_list,
|
server_list,
|
||||||
performance,
|
video,
|
||||||
|
audio,
|
||||||
streaming,
|
streaming,
|
||||||
post_processing,
|
post_processing,
|
||||||
audio,
|
|
||||||
devices,
|
devices,
|
||||||
tracking,
|
tracking,
|
||||||
system,
|
system,
|
||||||
@@ -230,7 +230,7 @@ class lobby : public scene_impl<lobby>
|
|||||||
void gui_disconnected();
|
void gui_disconnected();
|
||||||
void gui_server_list();
|
void gui_server_list();
|
||||||
void gui_new_server();
|
void gui_new_server();
|
||||||
void gui_performance();
|
void gui_video();
|
||||||
void gui_streaming();
|
void gui_streaming();
|
||||||
void gui_audio();
|
void gui_audio();
|
||||||
void gui_devices();
|
void gui_devices();
|
||||||
|
|||||||
+12
-12
@@ -1160,16 +1160,20 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> scenes::lobby::draw_gui(XrTi
|
|||||||
gui_server_list();
|
gui_server_list();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case tab::performance:
|
case tab::video:
|
||||||
gui_performance();
|
gui_video();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case tab::audio:
|
||||||
|
gui_audio();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case tab::streaming:
|
case tab::streaming:
|
||||||
gui_streaming();
|
gui_streaming();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case tab::audio:
|
case tab::post_processing:
|
||||||
gui_audio();
|
gui_post_processing();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case tab::devices:
|
case tab::devices:
|
||||||
@@ -1184,10 +1188,6 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> scenes::lobby::draw_gui(XrTi
|
|||||||
gui_system();
|
gui_system();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case tab::post_processing:
|
|
||||||
gui_post_processing();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case tab::customize:
|
case tab::customize:
|
||||||
gui_customize(predicted_display_time);
|
gui_customize(predicted_display_time);
|
||||||
break;
|
break;
|
||||||
@@ -1233,14 +1233,14 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> scenes::lobby::draw_gui(XrTi
|
|||||||
current_tab = tab::server_list;
|
current_tab = tab::server_list;
|
||||||
|
|
||||||
wivrn::ui::nav_section(_cS("tab group", "SETTINGS"));
|
wivrn::ui::nav_section(_cS("tab group", "SETTINGS"));
|
||||||
if (wivrn::ui::nav_item(ICON_FA_GAUGE_HIGH, _cS("tab label", "Performance"), current_tab == tab::performance))
|
if (wivrn::ui::nav_item(ICON_FA_IMAGE, _cS("tab label", "Video"), current_tab == tab::video))
|
||||||
current_tab = tab::performance;
|
current_tab = tab::video;
|
||||||
|
if (wivrn::ui::nav_item(ICON_FA_VOLUME_HIGH, _cS("tab label", "Audio"), current_tab == tab::audio))
|
||||||
|
current_tab = tab::audio;
|
||||||
if (wivrn::ui::nav_item(ICON_FA_TOWER_BROADCAST, _cS("tab label", "Streaming"), current_tab == tab::streaming))
|
if (wivrn::ui::nav_item(ICON_FA_TOWER_BROADCAST, _cS("tab label", "Streaming"), current_tab == tab::streaming))
|
||||||
current_tab = tab::streaming;
|
current_tab = tab::streaming;
|
||||||
if (wivrn::ui::nav_item(ICON_FA_WAND_MAGIC_SPARKLES, _cS("tab label", "Post-processing"), current_tab == tab::post_processing))
|
if (wivrn::ui::nav_item(ICON_FA_WAND_MAGIC_SPARKLES, _cS("tab label", "Post-processing"), current_tab == tab::post_processing))
|
||||||
current_tab = tab::post_processing;
|
current_tab = tab::post_processing;
|
||||||
if (wivrn::ui::nav_item(ICON_FA_VOLUME_HIGH, _cS("tab label", "Audio"), current_tab == tab::audio))
|
|
||||||
current_tab = tab::audio;
|
|
||||||
if (wivrn::ui::nav_item(ICON_FA_KEYBOARD, _cS("tab label", "Devices"), current_tab == tab::devices))
|
if (wivrn::ui::nav_item(ICON_FA_KEYBOARD, _cS("tab label", "Devices"), current_tab == tab::devices))
|
||||||
current_tab = tab::devices;
|
current_tab = tab::devices;
|
||||||
if (wivrn::ui::nav_item(ICON_FA_LOCATION_CROSSHAIRS, _cS("tab label", "Tracking"), current_tab == tab::tracking))
|
if (wivrn::ui::nav_item(ICON_FA_LOCATION_CROSSHAIRS, _cS("tab label", "Tracking"), current_tab == tab::tracking))
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ wivrn::gui::settings_context lobby_settings_context(xr::instance & instance, xr:
|
|||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void scenes::lobby::gui_performance()
|
void scenes::lobby::gui_video()
|
||||||
{
|
{
|
||||||
wivrn::gui::settings_performance(lobby_settings_context(instance, session, system, *imgui_ctx, stream_view, server_hid_forwarding));
|
wivrn::gui::settings_video(lobby_settings_context(instance, session, system, *imgui_ctx, stream_view, server_hid_forwarding));
|
||||||
}
|
}
|
||||||
|
|
||||||
void scenes::lobby::gui_streaming()
|
void scenes::lobby::gui_streaming()
|
||||||
|
|||||||
@@ -145,16 +145,16 @@ private:
|
|||||||
// settings sub-page, client-only: the wire stream_tab stays settings
|
// settings sub-page, client-only: the wire stream_tab stays settings
|
||||||
enum class settings_page
|
enum class settings_page
|
||||||
{
|
{
|
||||||
performance,
|
video,
|
||||||
|
audio,
|
||||||
streaming,
|
streaming,
|
||||||
post_processing,
|
post_processing,
|
||||||
audio,
|
|
||||||
devices,
|
devices,
|
||||||
tracking,
|
tracking,
|
||||||
theme,
|
theme,
|
||||||
system,
|
system,
|
||||||
};
|
};
|
||||||
settings_page current_settings_page = settings_page::performance;
|
settings_page current_settings_page = settings_page::video;
|
||||||
|
|
||||||
// Tab currently being displayed
|
// Tab currently being displayed
|
||||||
stream_tab gui_status = stream_tab::hidden;
|
stream_tab gui_status = stream_tab::hidden;
|
||||||
|
|||||||
@@ -428,8 +428,11 @@ void scenes::stream::gui_settings(float)
|
|||||||
|
|
||||||
switch (current_settings_page)
|
switch (current_settings_page)
|
||||||
{
|
{
|
||||||
case settings_page::performance:
|
case settings_page::video:
|
||||||
wivrn::gui::settings_performance(ctx);
|
wivrn::gui::settings_video(ctx);
|
||||||
|
break;
|
||||||
|
case settings_page::audio:
|
||||||
|
wivrn::gui::settings_audio(ctx);
|
||||||
break;
|
break;
|
||||||
case settings_page::streaming:
|
case settings_page::streaming:
|
||||||
wivrn::gui::settings_streaming(ctx);
|
wivrn::gui::settings_streaming(ctx);
|
||||||
@@ -437,9 +440,6 @@ void scenes::stream::gui_settings(float)
|
|||||||
case settings_page::post_processing:
|
case settings_page::post_processing:
|
||||||
wivrn::gui::settings_post_processing(ctx);
|
wivrn::gui::settings_post_processing(ctx);
|
||||||
break;
|
break;
|
||||||
case settings_page::audio:
|
|
||||||
wivrn::gui::settings_audio(ctx);
|
|
||||||
break;
|
|
||||||
case settings_page::devices:
|
case settings_page::devices:
|
||||||
wivrn::gui::settings_devices(ctx);
|
wivrn::gui::settings_devices(ctx);
|
||||||
break;
|
break;
|
||||||
@@ -1025,10 +1025,10 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
|
|||||||
next_gui_status = stream_tab::settings;
|
next_gui_status = stream_tab::settings;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
settings_item(ICON_FA_GAUGE_HIGH, _cS("tab label", "Performance"), settings_page::performance);
|
settings_item(ICON_FA_IMAGE, _cS("tab label", "Video"), settings_page::video);
|
||||||
|
settings_item(ICON_FA_VOLUME_HIGH, _cS("tab label", "Audio"), settings_page::audio);
|
||||||
settings_item(ICON_FA_TOWER_BROADCAST, _cS("tab label", "Streaming"), settings_page::streaming);
|
settings_item(ICON_FA_TOWER_BROADCAST, _cS("tab label", "Streaming"), settings_page::streaming);
|
||||||
settings_item(ICON_FA_WAND_MAGIC_SPARKLES, _cS("tab label", "Post-processing"), settings_page::post_processing);
|
settings_item(ICON_FA_WAND_MAGIC_SPARKLES, _cS("tab label", "Post-processing"), settings_page::post_processing);
|
||||||
settings_item(ICON_FA_VOLUME_HIGH, _cS("tab label", "Audio"), settings_page::audio);
|
|
||||||
settings_item(ICON_FA_KEYBOARD, _cS("tab label", "Devices"), settings_page::devices);
|
settings_item(ICON_FA_KEYBOARD, _cS("tab label", "Devices"), settings_page::devices);
|
||||||
settings_item(ICON_FA_LOCATION_CROSSHAIRS, _cS("tab label", "Tracking"), settings_page::tracking);
|
settings_item(ICON_FA_LOCATION_CROSSHAIRS, _cS("tab label", "Tracking"), settings_page::tracking);
|
||||||
settings_item(ICON_FA_GEARS, _cS("tab label", "System"), settings_page::system);
|
settings_item(ICON_FA_GEARS, _cS("tab label", "System"), settings_page::system);
|
||||||
|
|||||||
Reference in New Issue
Block a user