PostProcessing: Add support for anaglyph stereoscopy mode.
This commit is contained in:
parent
6c8f3fa861
commit
c3ad6e7820
|
@ -399,7 +399,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
|||
if (vconfig.backend_info.PPShaders.size())
|
||||
{
|
||||
wxFlexGridSizer* const szr_pp = new wxFlexGridSizer(3, 5, 5);
|
||||
wxChoice *const choice_ppshader = new wxChoice(page_enh, -1);
|
||||
choice_ppshader = new wxChoice(page_enh, -1);
|
||||
RegisterControl(choice_ppshader, wxGetTranslation(ppshader_desc));
|
||||
choice_ppshader->AppendString(_("(off)"));
|
||||
|
||||
|
@ -428,6 +428,11 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
|||
szr_pp->Add(button_config_pp);
|
||||
szr_enh->Add(szr_pp);
|
||||
}
|
||||
else
|
||||
{
|
||||
choice_ppshader = nullptr;
|
||||
button_config_pp = nullptr;
|
||||
}
|
||||
|
||||
// Scaled copy, PL, Bilinear filter
|
||||
szr_enh->Add(CreateCheckBox(page_enh, _("Scaled EFB Copy"), wxGetTranslation(scaled_efb_copy_desc), vconfig.bCopyEFBScaled));
|
||||
|
@ -447,9 +452,9 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
|||
{
|
||||
wxGridSizer* const szr_stereo = new wxGridSizer(2, 5, 5);
|
||||
|
||||
const wxString stereo_choices[] = { "Off", "Side-by-Side" };
|
||||
const wxString stereo_choices[] = { "Off", "Side-by-Side", "Anaglyph" };
|
||||
szr_stereo->Add(new wxStaticText(page_enh, -1, _("Stereo 3D Mode:")), 1, wxALIGN_CENTER_VERTICAL, 0);
|
||||
szr_stereo->Add(CreateChoice(page_enh, vconfig.iStereoMode, wxGetTranslation(stereo_3d_desc), 2, stereo_choices));
|
||||
szr_stereo->Add(CreateChoice(page_enh, vconfig.iStereoMode, wxGetTranslation(stereo_3d_desc), 3, stereo_choices));
|
||||
|
||||
wxSlider* const sep_slider = new wxSlider(page_enh, wxID_ANY, vconfig.iStereoSeparation, 30, 90, wxDefaultPosition, wxDefaultSize, wxSL_VALUE_LABEL);
|
||||
sep_slider->Bind(wxEVT_SLIDER, &VideoConfigDiag::Event_StereoSep, this);
|
||||
|
|
|
@ -198,6 +198,12 @@ protected:
|
|||
virtual_xfb->Enable(vconfig.bUseXFB);
|
||||
real_xfb->Enable(vconfig.bUseXFB);
|
||||
|
||||
// PP Shaders
|
||||
if (choice_ppshader)
|
||||
choice_ppshader->Enable(vconfig.iStereoMode != STEREO_ANAGLYPH);
|
||||
if (button_config_pp)
|
||||
button_config_pp->Enable(vconfig.iStereoMode != STEREO_ANAGLYPH);
|
||||
|
||||
// Things which shouldn't be changed during emulation
|
||||
if (Core::IsRunning())
|
||||
{
|
||||
|
@ -262,6 +268,8 @@ protected:
|
|||
|
||||
wxCheckBox* progressive_scan_checkbox;
|
||||
|
||||
wxChoice* choice_ppshader;
|
||||
|
||||
std::map<wxWindow*, wxString> ctrl_descs; // maps setting controls to their descriptions
|
||||
std::map<wxWindow*, wxStaticText*> desc_texts; // maps dialog tabs (which are the parents of the setting controls) to their description text objects
|
||||
|
||||
|
|
|
@ -166,10 +166,13 @@ void OpenGLPostProcessing::ApplyShader()
|
|||
m_shader.Destroy();
|
||||
m_uniform_bindings.clear();
|
||||
|
||||
// load shader from disk
|
||||
std::string default_shader = "void main() { SetOutput(Sample()); }\n";
|
||||
// load shader code
|
||||
std::string code = "";
|
||||
if (g_ActiveConfig.sPostProcessingShader != "")
|
||||
std::string default_shader = "void main() { SetOutput(Sample()); }\n";
|
||||
|
||||
if (g_ActiveConfig.iStereoMode == STEREO_ANAGLYPH)
|
||||
code = "void main() { SetOutput(float4(SampleLayer(1).r, SampleLayer(0).gba)); }\n";
|
||||
else if (g_ActiveConfig.sPostProcessingShader != "")
|
||||
code = m_config.LoadShader();
|
||||
|
||||
if (code == "")
|
||||
|
@ -253,7 +256,12 @@ void OpenGLPostProcessing::CreateHeader()
|
|||
"\treturn texture(samp9, float3(location, layer));\n"
|
||||
"}\n"
|
||||
|
||||
"#define SampleOffset(offset) textureOffset(samp9, uv0, offset)\n"
|
||||
"float4 SampleLayer(int layer)\n"
|
||||
"{\n"
|
||||
"\treturn texture(samp9, float3(uv0, layer));\n"
|
||||
"}\n"
|
||||
|
||||
"#define SampleOffset(offset) textureOffset(samp9, float3(uv0, layer), offset)\n"
|
||||
|
||||
"float4 SampleFontLocation(float2 location)\n"
|
||||
"{\n"
|
||||
|
|
|
@ -47,7 +47,8 @@ enum EFBScale
|
|||
enum StereoMode
|
||||
{
|
||||
STEREO_OFF = 0,
|
||||
STEREO_SBS
|
||||
STEREO_SBS,
|
||||
STEREO_ANAGLYPH
|
||||
};
|
||||
|
||||
// NEVER inherit from this class.
|
||||
|
|
Loading…
Reference in New Issue