feat: added immersive window support for VR race views

- Introduced a new configuration option for immersive window mode in runtime_config.h.
- Updated the parsing and setting functions to handle the immersive window state.
- Modified the OpenXR backend to support rendering with the immersive window, blending the race view with the surrounding environment.
- Enhanced the settings overlay to allow users to select between immersive, immersive window, and flat screen race views.
- Implemented GPU rendering logic for the immersive window mask, ensuring correct visual output in various rendering paths.
- Added tests to validate the immersive window functionality and its interaction with existing race view settings.
This commit is contained in:
iChris4 committed 2026-09-24 21:28:17 +02:00
1 parent 1969dda0bf
commit 1cf9389d69
20 files changed
+917 -53

No files matched your search

@@ -116,14 +116,28 @@ class SettingsPage(
private fun buildVr() {
// Flat Screen mode keeps races on the menu screen, which none of the race view rows reach.
val immersive = { c: TomlConfig -> !(c.bool("vr", "flat_screen") ?: false) }
// The immersive window is still the stereo race view, seen through the race HUD's screen.
val window = { c: TomlConfig -> immersive(c) && (c.bool("vr", "immersive_window") ?: false) }
val firstPerson = { c: TomlConfig -> immersive(c) && (c.bool("vr", "first_person") ?: false) }
// The steering wheel and hand steering belong to the cockpit seat.
val cockpit = { c: TomlConfig -> firstPerson(c) && stringIndex(c, "vr", "first_person_seat", SEATS) == 0 }
section(R.string.section_vr_camera) {
toggle(
R.string.vr_flat_screen, R.string.vr_flat_screen_helper,
read = { !immersive(it) },
write = { c, value -> c.setBool("vr", "flat_screen", value) },
// One setting in two keys, read as runtime_config.h's VrRaceView reads them: Flat
// Screen mode wins over the immersive window.
choice(
R.string.vr_race_view, R.string.vr_race_view_helper,
listOf(R.string.vr_race_view_immersive, R.string.vr_race_view_window, R.string.vr_race_view_flat),
read = {
when {
!immersive(it) -> 2
window(it) -> 1
else -> 0
}
},
write = { c, index ->
c.setBool("vr", "flat_screen", index == 2)
c.setBool("vr", "immersive_window", index == 1)
},
)
choice(
R.string.vr_camera, R.string.vr_camera_helper,
@@ -217,11 +231,12 @@ class SettingsPage(
)
}
section(R.string.section_vr_screen) {
// The immersive window is that screen and always carries the HUD.
toggle(
R.string.vr_hud_screen, R.string.vr_hud_screen_helper,
read = { it.bool("vr", "hud_virtual_screen") ?: true },
write = { c, value -> c.setBool("vr", "hud_virtual_screen", value) },
enabledIf = immersive,
enabledIf = { immersive(it) && !window(it) },
)
slider(
R.string.vr_hud_distance, R.string.vr_hud_distance_helper, 0.5, 5.0, 0.1,
+6 -3
View File
@@ -508,8 +508,11 @@
<!-- VR tab -->
<string name="section_vr_camera">Camera</string>
<string name="vr_flat_screen">Flat Screen mode</string>
<string name="vr_flat_screen_helper">Plays races on the same flat screen as the menus instead of all around you. The camera settings below do not apply while it is on.</string>
<string name="vr_race_view">Race view</string>
<string name="vr_race_view_helper">Immersive plays races all around you in stereo. Immersive window keeps that stereo view but shows it only through a window where the menu screen sits, with your room around it. Flat screen plays races on the menu screen; the camera settings below do not apply to it.</string>
<string name="vr_race_view_immersive">Immersive</string>
<string name="vr_race_view_window">Immersive window</string>
<string name="vr_race_view_flat">Flat screen</string>
<string name="vr_camera">Camera</string>
<string name="vr_camera_helper">Ride behind the kart like the game, or sit in the driver\'s seat.</string>
<string name="vr_camera_chase">Chase camera</string>
@@ -562,7 +565,7 @@
<string name="vr_hud_width">Screen width</string>
<string name="vr_hud_width_helper">How wide the menu screen and race HUD are.</string>
<string name="vr_passthrough">Passthrough around the menu screen</string>
<string name="vr_passthrough_helper">Shows your room through the headset\'s cameras around the menus instead of black. Races stay fully virtual, except in Flat Screen mode.</string>
<string name="vr_passthrough_helper">Shows your room through the headset\'s cameras around the menus instead of black. Immersive races stay fully virtual; the immersive window and the flat screen race have the room around them too.</string>
<!-- Graphics tab -->
<string name="section_graphics">Rendering</string>