mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-14 05:55:13 +01:00
Merge pull request #5580 from oneup03/master
Implement Reverse Interlaced 3D
This commit is contained in:
commit
a89261d397
@ -143,7 +143,8 @@ void Config::ReadValues() {
|
|||||||
std::string default_shader = "none (builtin)";
|
std::string default_shader = "none (builtin)";
|
||||||
if (Settings::values.render_3d == Settings::StereoRenderOption::Anaglyph)
|
if (Settings::values.render_3d == Settings::StereoRenderOption::Anaglyph)
|
||||||
default_shader = "dubois (builtin)";
|
default_shader = "dubois (builtin)";
|
||||||
else if (Settings::values.render_3d == Settings::StereoRenderOption::Interlaced)
|
else if (Settings::values.render_3d == Settings::StereoRenderOption::Interlaced ||
|
||||||
|
Settings::values.render_3d == Settings::StereoRenderOption::ReverseInterlaced)
|
||||||
default_shader = "horizontal (builtin)";
|
default_shader = "horizontal (builtin)";
|
||||||
Settings::values.pp_shader_name =
|
Settings::values.pp_shader_name =
|
||||||
sdl2_config->GetString("Renderer", "pp_shader_name", default_shader);
|
sdl2_config->GetString("Renderer", "pp_shader_name", default_shader);
|
||||||
|
@ -159,7 +159,7 @@ bg_blue =
|
|||||||
bg_green =
|
bg_green =
|
||||||
|
|
||||||
# Whether and how Stereoscopic 3D should be rendered
|
# Whether and how Stereoscopic 3D should be rendered
|
||||||
# 0 (default): Off, 1: Side by Side, 2: Anaglyph, 3: Interlaced
|
# 0 (default): Off, 1: Side by Side, 2: Anaglyph, 3: Interlaced, 4: Reverse Interlaced
|
||||||
render_3d =
|
render_3d =
|
||||||
|
|
||||||
# Change 3D Intensity
|
# Change 3D Intensity
|
||||||
|
@ -81,7 +81,8 @@ void ConfigureEnhancements::updateShaders(Settings::StereoRenderOption stereo_op
|
|||||||
|
|
||||||
if (stereo_option == Settings::StereoRenderOption::Anaglyph)
|
if (stereo_option == Settings::StereoRenderOption::Anaglyph)
|
||||||
ui->shader_combobox->addItem(QStringLiteral("dubois (builtin)"));
|
ui->shader_combobox->addItem(QStringLiteral("dubois (builtin)"));
|
||||||
else if (stereo_option == Settings::StereoRenderOption::Interlaced)
|
else if (stereo_option == Settings::StereoRenderOption::Interlaced ||
|
||||||
|
stereo_option == Settings::StereoRenderOption::ReverseInterlaced)
|
||||||
ui->shader_combobox->addItem(QStringLiteral("horizontal (builtin)"));
|
ui->shader_combobox->addItem(QStringLiteral("horizontal (builtin)"));
|
||||||
else
|
else
|
||||||
ui->shader_combobox->addItem(QStringLiteral("none (builtin)"));
|
ui->shader_combobox->addItem(QStringLiteral("none (builtin)"));
|
||||||
|
@ -171,6 +171,11 @@
|
|||||||
<string>Interlaced</string>
|
<string>Interlaced</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Reverse Interlaced</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -32,7 +32,7 @@ enum class MicInputType {
|
|||||||
Static,
|
Static,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class StereoRenderOption { Off, SideBySide, Anaglyph, Interlaced };
|
enum class StereoRenderOption { Off, SideBySide, Anaglyph, Interlaced, ReverseInterlaced };
|
||||||
|
|
||||||
namespace NativeButton {
|
namespace NativeButton {
|
||||||
enum Values {
|
enum Values {
|
||||||
|
@ -302,9 +302,11 @@ uniform vec4 o_resolution;
|
|||||||
uniform sampler2D color_texture;
|
uniform sampler2D color_texture;
|
||||||
uniform sampler2D color_texture_r;
|
uniform sampler2D color_texture_r;
|
||||||
|
|
||||||
|
uniform int reverse_interlaced;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
float screen_row = o_resolution.x * frag_tex_coord.x;
|
float screen_row = o_resolution.x * frag_tex_coord.x;
|
||||||
if (int(screen_row) % 2 == 0)
|
if (int(screen_row) % 2 == reverse_interlaced)
|
||||||
color = texture(color_texture, frag_tex_coord);
|
color = texture(color_texture, frag_tex_coord);
|
||||||
else
|
else
|
||||||
color = texture(color_texture_r, frag_tex_coord);
|
color = texture(color_texture_r, frag_tex_coord);
|
||||||
@ -692,7 +694,8 @@ void RendererOpenGL::ReloadShader() {
|
|||||||
shader_data += shader_text;
|
shader_data += shader_text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Settings::values.render_3d == Settings::StereoRenderOption::Interlaced) {
|
} else if (Settings::values.render_3d == Settings::StereoRenderOption::Interlaced ||
|
||||||
|
Settings::values.render_3d == Settings::StereoRenderOption::ReverseInterlaced) {
|
||||||
if (Settings::values.pp_shader_name == "horizontal (builtin)") {
|
if (Settings::values.pp_shader_name == "horizontal (builtin)") {
|
||||||
shader_data += fragment_shader_interlaced;
|
shader_data += fragment_shader_interlaced;
|
||||||
} else {
|
} else {
|
||||||
@ -725,9 +728,19 @@ void RendererOpenGL::ReloadShader() {
|
|||||||
uniform_modelview_matrix = glGetUniformLocation(shader.handle, "modelview_matrix");
|
uniform_modelview_matrix = glGetUniformLocation(shader.handle, "modelview_matrix");
|
||||||
uniform_color_texture = glGetUniformLocation(shader.handle, "color_texture");
|
uniform_color_texture = glGetUniformLocation(shader.handle, "color_texture");
|
||||||
if (Settings::values.render_3d == Settings::StereoRenderOption::Anaglyph ||
|
if (Settings::values.render_3d == Settings::StereoRenderOption::Anaglyph ||
|
||||||
Settings::values.render_3d == Settings::StereoRenderOption::Interlaced) {
|
Settings::values.render_3d == Settings::StereoRenderOption::Interlaced ||
|
||||||
|
Settings::values.render_3d == Settings::StereoRenderOption::ReverseInterlaced) {
|
||||||
uniform_color_texture_r = glGetUniformLocation(shader.handle, "color_texture_r");
|
uniform_color_texture_r = glGetUniformLocation(shader.handle, "color_texture_r");
|
||||||
}
|
}
|
||||||
|
if (Settings::values.render_3d == Settings::StereoRenderOption::Interlaced ||
|
||||||
|
Settings::values.render_3d == Settings::StereoRenderOption::ReverseInterlaced) {
|
||||||
|
GLuint uniform_reverse_interlaced =
|
||||||
|
glGetUniformLocation(shader.handle, "reverse_interlaced");
|
||||||
|
if (Settings::values.render_3d == Settings::StereoRenderOption::ReverseInterlaced)
|
||||||
|
glUniform1i(uniform_reverse_interlaced, 1);
|
||||||
|
else
|
||||||
|
glUniform1i(uniform_reverse_interlaced, 0);
|
||||||
|
}
|
||||||
uniform_i_resolution = glGetUniformLocation(shader.handle, "i_resolution");
|
uniform_i_resolution = glGetUniformLocation(shader.handle, "i_resolution");
|
||||||
uniform_o_resolution = glGetUniformLocation(shader.handle, "o_resolution");
|
uniform_o_resolution = glGetUniformLocation(shader.handle, "o_resolution");
|
||||||
uniform_layer = glGetUniformLocation(shader.handle, "layer");
|
uniform_layer = glGetUniformLocation(shader.handle, "layer");
|
||||||
@ -973,7 +986,8 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f
|
|||||||
|
|
||||||
const bool stereo_single_screen =
|
const bool stereo_single_screen =
|
||||||
Settings::values.render_3d == Settings::StereoRenderOption::Anaglyph ||
|
Settings::values.render_3d == Settings::StereoRenderOption::Anaglyph ||
|
||||||
Settings::values.render_3d == Settings::StereoRenderOption::Interlaced;
|
Settings::values.render_3d == Settings::StereoRenderOption::Interlaced ||
|
||||||
|
Settings::values.render_3d == Settings::StereoRenderOption::ReverseInterlaced;
|
||||||
|
|
||||||
// Bind a second texture for the right eye if in Anaglyph mode
|
// Bind a second texture for the right eye if in Anaglyph mode
|
||||||
if (stereo_single_screen) {
|
if (stereo_single_screen) {
|
||||||
|
Loading…
Reference in New Issue
Block a user