Skip to content

Commit

Permalink
bugfix: fix quad-view-rendering menu entry
Browse files Browse the repository at this point in the history
  • Loading branch information
Detegr committed Aug 4, 2024
1 parent 1981fb0 commit a699235
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions src/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ struct Config {
RenderTarget companion_eye = LeftEye;
int world_scale = 1000;
bool quad_view_rendering = false;
bool wanted_quad_view_rendering = false;
D3DMULTISAMPLE_TYPE peripheral_msaa = D3DMULTISAMPLE_NONE;
bool openxr_motion_compensation = false; // OpenXR-MotionCompensation support https://github.com/BuzzteeBear/OpenXR-MotionCompensation

Expand Down Expand Up @@ -134,6 +135,7 @@ struct Config {
debug_mode = rhs.debug_mode;
world_scale = rhs.world_scale;
quad_view_rendering = rhs.quad_view_rendering;
wanted_quad_view_rendering = rhs.wanted_quad_view_rendering;
peripheral_msaa = rhs.peripheral_msaa;
openxr_motion_compensation = rhs.openxr_motion_compensation;
return *this;
Expand Down Expand Up @@ -162,6 +164,7 @@ struct Config {
&& companion_eye == rhs.companion_eye
&& world_scale == rhs.world_scale
&& quad_view_rendering == rhs.quad_view_rendering
&& wanted_quad_view_rendering == rhs.wanted_quad_view_rendering
&& peripheral_msaa == rhs.peripheral_msaa
&& openxr_motion_compensation == rhs.openxr_motion_compensation;
}
Expand Down Expand Up @@ -221,7 +224,7 @@ struct Config {

toml::table openxr;
openxr.insert("worldScale", world_scale);
openxr.insert("quadViewRendering", quad_view_rendering);
openxr.insert("quadViewRendering", wanted_quad_view_rendering);
openxr.insert("peripheralAntiAliasing", peripheral_msaa);
openxr.insert("motionCompensation", openxr_motion_compensation);
out.insert("OpenXR", openxr);
Expand Down Expand Up @@ -306,7 +309,7 @@ struct Config {
auto oxrnode = parsed["OpenXR"];
if (oxrnode.is_table()) {
cfg.world_scale = std::clamp(oxrnode["worldScale"].value_or(1000), 500, 1500);
cfg.quad_view_rendering = oxrnode["quadViewRendering"].value_or(false);
cfg.quad_view_rendering = cfg.wanted_quad_view_rendering = oxrnode["quadViewRendering"].value_or(false);
cfg.peripheral_msaa = static_cast<D3DMULTISAMPLE_TYPE>(oxrnode["peripheralAntiAliasing"].value_or(0));
cfg.openxr_motion_compensation = oxrnode["motionCompensation"].value_or(false);
}
Expand Down
12 changes: 6 additions & 6 deletions src/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ static class Menu overlay_menu = { "openRBRVR overlay settings", {
}};

static const auto window_step = 1;
static const auto left_eye = g::vr && g::vr->is_using_quad_view_rendering() ? FocusLeft : LeftEye; // Cache the left eye as cfg.quad_view_rendering is modified during gameplay
static const auto left_eye = g::vr && g::vr->is_using_quad_view_rendering() ? FocusLeft : LeftEye; // Cache the left eye as cfg.wanted_quad_view_rendering is modified during gameplay
static class Menu companion_menu = { "openRBRVR desktop window settings", {
{ .text = [] { return std::format("Desktop window mode: {}", companion_mode_str_pretty(g::cfg.companion_mode)); },
.long_text = { "Choose what is visible on the desktop monitor while driving.", "Off: Don't draw anything", "VR view: Draw what is seen in the VR headset", "Bonnet camera: Use normal 2D bonnet camera (WITH SIGNIFICANT PERFORMANCE COST)"},
Expand Down Expand Up @@ -371,19 +371,19 @@ static class Menu openxr_menu = { "openRBRVR OpenXR settings", {
.left_action = [] { g::cfg.world_scale = std::max(g::cfg.world_scale - world_scale_step, 500); },
.right_action = [] { g::cfg.world_scale = std::min(g::cfg.world_scale + world_scale_step, 1500); },
},
{ .text = [] { return std::format("Use quad-view rendering: {}", g::cfg.quad_view_rendering ? "ON" : "OFF"); },
{ .text = [] { return std::format("Use quad-view rendering: {} {}", g::cfg.wanted_quad_view_rendering ? "ON" : "OFF", g::cfg.quad_view_rendering != g::cfg.wanted_quad_view_rendering ? "(RESTART REQUIRED)" : ""); },
.long_text = { "Enable the use of quad view rendering.", "", "Designed to be used with Quad-Views-Foveated OpenXR layer for foveated rendering.", "Requires game restart to take an effect.", "", "See openRBRVR documentation for installation and setup instructions.", },
.menu_color = IRBRGame::EMenuColors::MENU_TEXT,
.left_action = [] { g::cfg.quad_view_rendering = !g::cfg.quad_view_rendering; },
.right_action = [] { g::cfg.quad_view_rendering = !g::cfg.quad_view_rendering; },
.select_action = [] { g::cfg.quad_view_rendering = !g::cfg.quad_view_rendering; },
.left_action = [] { g::cfg.wanted_quad_view_rendering = !g::cfg.wanted_quad_view_rendering; },
.right_action = [] { g::cfg.wanted_quad_view_rendering = !g::cfg.wanted_quad_view_rendering; },
.select_action = [] { g::cfg.wanted_quad_view_rendering = !g::cfg.wanted_quad_view_rendering; },
},
{ .text = [] { return std::format("Peripheral view anti-aliasing: {}x", static_cast<int>(g::cfg.peripheral_msaa)); },
.long_text = { "Set the anti-aliasing factor of the peripheral view of quad view rendering.", "Keep this at 0 unless you get untolerable jagged edges in the peripheral view." },
.menu_color = IRBRGame::EMenuColors::MENU_TEXT,
.left_action = [] { g::cfg.peripheral_msaa = static_cast<D3DMULTISAMPLE_TYPE>(std::clamp(g::cfg.peripheral_msaa - 2, 0, 8)); },
.right_action = [] { g::cfg.peripheral_msaa = g::cfg.peripheral_msaa = static_cast<D3DMULTISAMPLE_TYPE>(std::clamp(g::cfg.peripheral_msaa + 2, 0, 8)); },
.visible = [] { return g::cfg.quad_view_rendering; }
.visible = [] { return g::cfg.wanted_quad_view_rendering; }
},
{ .text = [] { return std::format("Support for OpenXR Motion Compensation: {}", g::cfg.openxr_motion_compensation ? "ON" : "OFF"); },
.long_text = {
Expand Down

0 comments on commit a699235

Please sign in to comment.