PostProcessing: Add support for user-supplied anaglyph shaders.

There are lots of different anaglyph glasses out there and there may be even more creative uses for stereoscopic post-processing shaders.
This commit is contained in:
Jules Blok
2015-01-03 01:33:30 +01:00
parent a93433a860
commit 262c3b19ec
14 changed files with 110 additions and 58 deletions

View File

@ -144,7 +144,7 @@ protected:
void Event_PPShader(wxCommandEvent &ev)
{
const int sel = ev.GetInt();
if (sel)
if (sel || vconfig.iStereoMode == STEREO_ANAGLYPH)
vconfig.sPostProcessingShader = WxStrToStr(ev.GetString());
else
vconfig.sPostProcessingShader.clear();
@ -152,7 +152,7 @@ protected:
// Should we enable the configuration button?
PostProcessingShaderConfiguration postprocessing_shader;
postprocessing_shader.LoadShader(vconfig.sPostProcessingShader);
button_config_pp->Enable(postprocessing_shader.HasOptions() && vconfig.iStereoMode != STEREO_ANAGLYPH);
button_config_pp->Enable(postprocessing_shader.HasOptions());
ev.Skip();
}
@ -181,15 +181,10 @@ protected:
void Event_StereoMode(wxCommandEvent &ev)
{
if (ev.GetInt() == STEREO_ANAGLYPH && vconfig.backend_info.PPShaders.size())
if (vconfig.backend_info.bSupportsPostProcessing)
{
// Anaglyph overrides post-processing shaders
choice_ppshader->Select(0);
choice_ppshader->Enable(false);
}
else if (vconfig.backend_info.PPShaders.size())
{
choice_ppshader->Enable(true);
choice_ppshader->Clear();
}
ev.Skip();
@ -214,6 +209,10 @@ protected:
virtual_xfb->Enable(vconfig.bUseXFB);
real_xfb->Enable(vconfig.bUseXFB);
// Repopulating the post-processing shaders can't be done from an event
if (choice_ppshader && choice_ppshader->IsEmpty())
PopulatePostProcessingShaders();
// Things which shouldn't be changed during emulation
if (Core::IsRunning())
{
@ -251,6 +250,7 @@ protected:
void Evt_EnterControl(wxMouseEvent& ev);
void Evt_LeaveControl(wxMouseEvent& ev);
void CreateDescriptionArea(wxPanel* const page, wxBoxSizer* const sizer);
void PopulatePostProcessingShaders();
wxChoice* choice_backend;
wxChoice* choice_adapter;