mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2025-03-13 09:12:27 +01:00
Stereoscopic 3D Enhancements
- Increase maximum 3D depth to 255% - Fix touch screen to only render 2D when separate window layout is used - Cleanup some 3D option localizations
This commit is contained in:
parent
43dbe42b29
commit
abd2454154
@ -829,7 +829,7 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
|
||||
R.string.factor3d,
|
||||
R.string.factor3d_description,
|
||||
0,
|
||||
100,
|
||||
255,
|
||||
"%",
|
||||
IntSetting.STEREOSCOPIC_3D_DEPTH.key,
|
||||
IntSetting.STEREOSCOPIC_3D_DEPTH.defaultValue.toFloat()
|
||||
|
@ -162,7 +162,7 @@ bg_green =
|
||||
render_3d =
|
||||
|
||||
# Change 3D Intensity
|
||||
# 0 - 100: Intensity. 0 (default)
|
||||
# 0 - 255: Intensity. 0 (default)
|
||||
factor_3d =
|
||||
|
||||
# The name of the post processing shader to apply.
|
||||
|
@ -832,7 +832,7 @@ void GMainWindow::InitializeHotkeys() {
|
||||
});
|
||||
connect_shortcut(QStringLiteral("Increase 3D Factor"), [this] {
|
||||
const auto factor_3d = Settings::values.factor_3d.GetValue();
|
||||
if (factor_3d < 100) {
|
||||
if (factor_3d < 255) {
|
||||
if (factor_3d % FACTOR_3D_STEP != 0) {
|
||||
Settings::values.factor_3d =
|
||||
factor_3d + FACTOR_3D_STEP - (factor_3d % FACTOR_3D_STEP);
|
||||
|
@ -276,7 +276,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
|
@ -94,17 +94,24 @@ bool EmuWindow::IsWithinTouchscreen(const Layout::FramebufferLayout& layout, uns
|
||||
|
||||
std::tuple<unsigned, unsigned> EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) const {
|
||||
Settings::StereoRenderOption render_3d_mode = Settings::values.render_3d.GetValue();
|
||||
bool separate_win = false;
|
||||
#ifndef ANDROID
|
||||
separate_win =
|
||||
(Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows);
|
||||
#endif
|
||||
|
||||
if (new_x >= framebuffer_layout.width / 2) {
|
||||
if (render_3d_mode == Settings::StereoRenderOption::SideBySide ||
|
||||
render_3d_mode == Settings::StereoRenderOption::ReverseSideBySide)
|
||||
if ((render_3d_mode == Settings::StereoRenderOption::SideBySide ||
|
||||
render_3d_mode == Settings::StereoRenderOption::ReverseSideBySide) &&
|
||||
!separate_win)
|
||||
new_x -= framebuffer_layout.width / 2;
|
||||
else if (render_3d_mode == Settings::StereoRenderOption::CardboardVR)
|
||||
new_x -=
|
||||
(framebuffer_layout.width / 2) - (framebuffer_layout.cardboard.user_x_shift * 2);
|
||||
}
|
||||
if (render_3d_mode == Settings::StereoRenderOption::SideBySide ||
|
||||
render_3d_mode == Settings::StereoRenderOption::ReverseSideBySide) {
|
||||
if ((render_3d_mode == Settings::StereoRenderOption::SideBySide ||
|
||||
render_3d_mode == Settings::StereoRenderOption::ReverseSideBySide) &&
|
||||
!separate_win) {
|
||||
new_x = std::max(new_x, framebuffer_layout.bottom_screen.left / 2);
|
||||
new_x = std::min(new_x, framebuffer_layout.bottom_screen.right / 2 - 1);
|
||||
} else {
|
||||
@ -130,21 +137,28 @@ void EmuWindow::CreateTouchState() {
|
||||
|
||||
bool EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y) {
|
||||
Settings::StereoRenderOption render_3d_mode = Settings::values.render_3d.GetValue();
|
||||
bool separate_win = false;
|
||||
#ifndef ANDROID
|
||||
separate_win =
|
||||
(Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows);
|
||||
#endif
|
||||
|
||||
if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y))
|
||||
return false;
|
||||
|
||||
if (framebuffer_x >= framebuffer_layout.width / 2) {
|
||||
if (render_3d_mode == Settings::StereoRenderOption::SideBySide ||
|
||||
render_3d_mode == Settings::StereoRenderOption::ReverseSideBySide)
|
||||
if ((render_3d_mode == Settings::StereoRenderOption::SideBySide ||
|
||||
render_3d_mode == Settings::StereoRenderOption::ReverseSideBySide) &&
|
||||
!separate_win)
|
||||
framebuffer_x -= framebuffer_layout.width / 2;
|
||||
else if (render_3d_mode == Settings::StereoRenderOption::CardboardVR)
|
||||
framebuffer_x -=
|
||||
(framebuffer_layout.width / 2) - (framebuffer_layout.cardboard.user_x_shift * 2);
|
||||
}
|
||||
std::scoped_lock guard(touch_state->mutex);
|
||||
if (render_3d_mode == Settings::StereoRenderOption::SideBySide ||
|
||||
render_3d_mode == Settings::StereoRenderOption::ReverseSideBySide) {
|
||||
if ((render_3d_mode == Settings::StereoRenderOption::SideBySide ||
|
||||
render_3d_mode == Settings::StereoRenderOption::ReverseSideBySide) &&
|
||||
!separate_win) {
|
||||
touch_state->touch_x =
|
||||
static_cast<float>(framebuffer_x - framebuffer_layout.bottom_screen.left / 2) /
|
||||
(framebuffer_layout.bottom_screen.right / 2 -
|
||||
|
@ -793,6 +793,12 @@ void RendererOpenGL::DrawBottomScreen(const Layout::FramebufferLayout& layout,
|
||||
const auto orientation = layout.is_rotated ? Layout::DisplayOrientation::Landscape
|
||||
: Layout::DisplayOrientation::Portrait;
|
||||
|
||||
bool separate_win = false;
|
||||
#ifndef ANDROID
|
||||
separate_win =
|
||||
(Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows);
|
||||
#endif
|
||||
|
||||
switch (Settings::values.render_3d.GetValue()) {
|
||||
case Settings::StereoRenderOption::Off: {
|
||||
DrawSingleScreen(screen_infos[2], bottom_screen_left, bottom_screen_top,
|
||||
@ -801,12 +807,17 @@ void RendererOpenGL::DrawBottomScreen(const Layout::FramebufferLayout& layout,
|
||||
}
|
||||
case Settings::StereoRenderOption::SideBySide: // Bottom screen is identical on both sides
|
||||
case Settings::StereoRenderOption::ReverseSideBySide: {
|
||||
DrawSingleScreen(screen_infos[2], bottom_screen_left / 2, bottom_screen_top,
|
||||
bottom_screen_width / 2, bottom_screen_height, orientation);
|
||||
glUniform1i(uniform_layer, 1);
|
||||
DrawSingleScreen(
|
||||
screen_infos[2], static_cast<float>((bottom_screen_left / 2) + (layout.width / 2)),
|
||||
bottom_screen_top, bottom_screen_width / 2, bottom_screen_height, orientation);
|
||||
if (separate_win) {
|
||||
DrawSingleScreen(screen_infos[2], bottom_screen_left, bottom_screen_top,
|
||||
bottom_screen_width, bottom_screen_height, orientation);
|
||||
} else {
|
||||
DrawSingleScreen(screen_infos[2], bottom_screen_left / 2, bottom_screen_top,
|
||||
bottom_screen_width / 2, bottom_screen_height, orientation);
|
||||
glUniform1i(uniform_layer, 1);
|
||||
DrawSingleScreen(
|
||||
screen_infos[2], static_cast<float>((bottom_screen_left / 2) + (layout.width / 2)),
|
||||
bottom_screen_top, bottom_screen_width / 2, bottom_screen_height, orientation);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Settings::StereoRenderOption::CardboardVR: {
|
||||
@ -822,9 +833,14 @@ void RendererOpenGL::DrawBottomScreen(const Layout::FramebufferLayout& layout,
|
||||
case Settings::StereoRenderOption::Anaglyph:
|
||||
case Settings::StereoRenderOption::Interlaced:
|
||||
case Settings::StereoRenderOption::ReverseInterlaced: {
|
||||
DrawSingleScreenStereo(screen_infos[2], screen_infos[2], bottom_screen_left,
|
||||
bottom_screen_top, bottom_screen_width, bottom_screen_height,
|
||||
orientation);
|
||||
if (separate_win) {
|
||||
DrawSingleScreen(screen_infos[2], bottom_screen_left, bottom_screen_top,
|
||||
bottom_screen_width, bottom_screen_height, orientation);
|
||||
} else {
|
||||
DrawSingleScreenStereo(screen_infos[2], screen_infos[2], bottom_screen_left,
|
||||
bottom_screen_top, bottom_screen_width, bottom_screen_height,
|
||||
orientation);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -739,6 +739,12 @@ void RendererVulkan::DrawBottomScreen(const Layout::FramebufferLayout& layout,
|
||||
const auto orientation = layout.is_rotated ? Layout::DisplayOrientation::Landscape
|
||||
: Layout::DisplayOrientation::Portrait;
|
||||
|
||||
bool separate_win = false;
|
||||
#ifndef ANDROID
|
||||
separate_win =
|
||||
(Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows);
|
||||
#endif
|
||||
|
||||
switch (Settings::values.render_3d.GetValue()) {
|
||||
case Settings::StereoRenderOption::Off: {
|
||||
DrawSingleScreen(2, bottom_screen_left, bottom_screen_top, bottom_screen_width,
|
||||
@ -747,12 +753,17 @@ void RendererVulkan::DrawBottomScreen(const Layout::FramebufferLayout& layout,
|
||||
}
|
||||
case Settings::StereoRenderOption::SideBySide: // Bottom screen is identical on both sides
|
||||
case Settings::StereoRenderOption::ReverseSideBySide: {
|
||||
DrawSingleScreen(2, bottom_screen_left / 2, bottom_screen_top, bottom_screen_width / 2,
|
||||
bottom_screen_height, orientation);
|
||||
draw_info.layer = 1;
|
||||
DrawSingleScreen(2, static_cast<float>((bottom_screen_left / 2) + (layout.width / 2)),
|
||||
bottom_screen_top, bottom_screen_width / 2, bottom_screen_height,
|
||||
orientation);
|
||||
if (separate_win) {
|
||||
DrawSingleScreen(2, bottom_screen_left, bottom_screen_top, bottom_screen_width,
|
||||
bottom_screen_height, orientation);
|
||||
} else {
|
||||
DrawSingleScreen(2, bottom_screen_left / 2, bottom_screen_top, bottom_screen_width / 2,
|
||||
bottom_screen_height, orientation);
|
||||
draw_info.layer = 1;
|
||||
DrawSingleScreen(2, static_cast<float>((bottom_screen_left / 2) + (layout.width / 2)),
|
||||
bottom_screen_top, bottom_screen_width / 2, bottom_screen_height,
|
||||
orientation);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Settings::StereoRenderOption::CardboardVR: {
|
||||
@ -767,8 +778,13 @@ void RendererVulkan::DrawBottomScreen(const Layout::FramebufferLayout& layout,
|
||||
case Settings::StereoRenderOption::Anaglyph:
|
||||
case Settings::StereoRenderOption::Interlaced:
|
||||
case Settings::StereoRenderOption::ReverseInterlaced: {
|
||||
DrawSingleScreenStereo(2, 2, bottom_screen_left, bottom_screen_top, bottom_screen_width,
|
||||
bottom_screen_height, orientation);
|
||||
if (separate_win) {
|
||||
DrawSingleScreen(2, bottom_screen_left, bottom_screen_top, bottom_screen_width,
|
||||
bottom_screen_height, orientation);
|
||||
} else {
|
||||
DrawSingleScreenStereo(2, 2, bottom_screen_left, bottom_screen_top, bottom_screen_width,
|
||||
bottom_screen_height, orientation);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user