i know still a lot to fix and much work to do but sometimes experiments are fun :)

for all the plugins implemented per pixel lighting, this will make games that uses lighting  a lot nice. (just look at mario sunshine and compare :))
for dx9: implemented temporal anaglyph stereo: just grab your red-cyan glasses  and enjoy.
stereo calibration: use stereo separation ( distance of the point from you are looking) and Focal Angle: the angle necessary to focus in one particular object.
this settings are different in every games as they use different depth ranges.
please for any regression and bug introduced by this commit.
if you ask why i did not implement stereo in dx11 and opengl the reason is one: they don't work right when i have more time will try to find a way to make them work.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6224 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Rodolfo Osvaldo Bogado
2010-09-23 02:17:48 +00:00
parent 5e806eb7b2
commit e641323de2
30 changed files with 558 additions and 79 deletions

View File

@ -74,6 +74,7 @@ BEGIN_EVENT_TABLE(GFXConfigDialogOGL,wxDialog)
EVT_RADIOBUTTON(ID_RADIO_SAFETEXTURECACHE_FAST, GFXConfigDialogOGL::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_DSTALPHAPASS,GFXConfigDialogOGL::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_CHECKBOX_DISABLECOPYEFB, GFXConfigDialogOGL::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_PIXELLIGHTING, GFXConfigDialogOGL::AdvancedSettingsChanged)
EVT_RADIOBUTTON(ID_RADIO_COPYEFBTORAM, GFXConfigDialogOGL::AdvancedSettingsChanged)
EVT_RADIOBUTTON(ID_RADIO_COPYEFBTOGL, GFXConfigDialogOGL::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_DLISTCACHING, GFXConfigDialogOGL::AdvancedSettingsChanged)
@ -240,7 +241,8 @@ void GFXConfigDialogOGL::InitializeGUIValues()
m_HiresTextures->SetValue(g_Config.bHiresTextures);
m_DumpEFBTarget->SetValue(g_Config.bDumpEFBTarget);
m_DumpFrames->SetValue(g_Config.bDumpFrames);
m_FreeLook->SetValue(g_Config.bFreeLook);
m_FreeLook->SetValue(g_Config.bFreeLook);
m_PixelLighting->SetValue(g_Config.bEnablePixelLigting);;
// Hacks controls
m_PhackvalueCB->SetSelection(g_Config.iPhackvalue);
@ -308,6 +310,8 @@ void GFXConfigDialogOGL::InitializeGUITooltips()
m_FreeLook->SetToolTip(
wxT("Use WASD to move around, 0 and 9 to move faster or slower, and the")
wxT(" left mouse button to pan the view."));
m_PixelLighting->SetToolTip(
wxT("Enables Pixel ligting to improve Ilumination."));
// Hacks controls
m_SafeTextureCache->SetToolTip(wxT("This is useful to prevent Metroid Prime from crashing, but can cause problems in other games.")
@ -450,6 +454,7 @@ void GFXConfigDialogOGL::CreateGUIControls()
m_DisableTexturing = new wxCheckBox(m_PageAdvanced, ID_DISABLETEXTURING, wxT("Disable Texturing"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_DstAlphaPass = new wxCheckBox(m_PageAdvanced, ID_DSTALPHAPASS, wxT("Disable Destination Alpha Pass"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_DisableFog = new wxCheckBox(m_PageAdvanced, ID_DISABLEFOG, wxT("Disable Fog"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_PixelLighting = new wxCheckBox(m_PageAdvanced, ID_PIXELLIGHTING, wxT("Enable Pixel Lighting"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_StaticBox_EFB = new wxStaticBox(m_PageAdvanced, ID_STATICBOX_EFB, wxT("EFB Copy"));
m_CheckBox_DisableCopyEFB = new wxCheckBox(m_PageAdvanced, ID_CHECKBOX_DISABLECOPYEFB, wxT("Disable"));
@ -462,7 +467,7 @@ void GFXConfigDialogOGL::CreateGUIControls()
m_HiresTextures = new wxCheckBox(m_PageAdvanced, ID_HIRESTEXTURES, wxT("Load Hires textures"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_DumpEFBTarget = new wxCheckBox(m_PageAdvanced, ID_DUMPEFBTARGET, wxT("Dump EFB Target"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_DumpFrames = new wxCheckBox(m_PageAdvanced, ID_DUMPFRAMES, wxT("Dump Rendered Frames"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_FreeLook = new wxCheckBox(m_PageAdvanced, ID_FREELOOK, wxT("Free Look"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_FreeLook = new wxCheckBox(m_PageAdvanced, ID_FREELOOK, wxT("Free Look"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
// Hacks controls
sHacks = new wxStaticBoxSizer(wxVERTICAL, m_PageAdvanced, wxT("Hacks"));
@ -503,6 +508,7 @@ void GFXConfigDialogOGL::CreateGUIControls()
sRendering->Add(m_DstAlphaPass, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALL, 4);
sRendering->Add(m_DisableFog, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALL, 4);
sRendering->Add(m_DlistCaching, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALL, 4);
sRendering->Add(m_PixelLighting, wxGBPosition(6, 0), wxGBSpan(1, 1), wxALL, 4);
sRenderBoxRow1->Add(sRendering, 0, wxALL|wxEXPAND, 1);
wxStaticBoxSizer *sSBox = new wxStaticBoxSizer(m_StaticBox_EFB, wxVERTICAL);
@ -683,6 +689,9 @@ void GFXConfigDialogOGL::AdvancedSettingsChanged(wxCommandEvent& event)
case ID_DISABLEFOG:
g_Config.bDisableFog = m_DisableFog->IsChecked();
break;
case ID_PIXELLIGHTING:
g_Config.bEnablePixelLigting = m_PixelLighting->IsChecked();
break;
case ID_DSTALPHAPASS:
g_Config.bDstAlphaPass = m_DstAlphaPass->IsChecked();
break;

View File

@ -119,6 +119,7 @@ class GFXConfigDialogOGL : public wxDialog
wxCheckBox *m_DumpEFBTarget;
wxCheckBox *m_DumpFrames;
wxCheckBox *m_FreeLook;
wxCheckBox *m_PixelLighting;
wxStaticBox * m_StaticBox_EFB;
wxCheckBox *m_CheckBox_DisableCopyEFB;
wxRadioButton *m_Radio_CopyEFBToRAM, *m_Radio_CopyEFBToGL;
@ -174,6 +175,7 @@ class GFXConfigDialogOGL : public wxDialog
ID_WIREFRAME,
ID_DISABLELIGHTING,
ID_PIXELLIGHTING,
ID_DISABLETEXTURING,
ID_DISABLEFOG,
ID_STATICBOX_EFB,

View File

@ -155,8 +155,9 @@ void FreeLookInput( UINT iMsg, WPARAM wParam )
{
static float debugSpeed = 1.0f;
static bool mouseLookEnabled = false;
static bool mouseMoveEnabled = false;
static float lastMouse[2];
POINT point;
switch( iMsg )
{
case WM_USER_KEYDOWN:
@ -189,24 +190,38 @@ void FreeLookInput( UINT iMsg, WPARAM wParam )
case WM_MOUSEMOVE:
if (mouseLookEnabled) {
POINT point;
GetCursorPos(&point);
VertexShaderManager::RotateView((point.x - lastMouse[0]) / 200.0f, (point.y - lastMouse[1]) / 200.0f);
lastMouse[0] = point.x;
lastMouse[1] = point.y;
}
if (mouseMoveEnabled) {
GetCursorPos(&point);
VertexShaderManager::TranslateView((point.x - lastMouse[0]) / 50.0f, (point.y - lastMouse[1]) / 50.0f);
lastMouse[0] = point.x;
lastMouse[1] = point.y;
}
break;
case WM_RBUTTONDOWN:
POINT point;
GetCursorPos(&point);
lastMouse[0] = point.x;
lastMouse[1] = point.y;
mouseLookEnabled= true;
break;
case WM_MBUTTONDOWN:
GetCursorPos(&point);
lastMouse[0] = point.x;
lastMouse[1] = point.y;
mouseMoveEnabled= true;
break;
case WM_RBUTTONUP:
mouseLookEnabled = false;
break;
case WM_MBUTTONUP:
mouseMoveEnabled = false;
break;
}
}

View File

@ -185,7 +185,7 @@ GLuint PixelShaderCache::GetDepthMatrixProgram()
}
FRAGMENTSHADER* PixelShaderCache::GetShader(bool dstAlphaEnable)
FRAGMENTSHADER* PixelShaderCache::GetShader(bool dstAlphaEnable,u32 components)
{
DVSTARTPROFILE();
PIXELSHADERUID uid;
@ -214,7 +214,7 @@ FRAGMENTSHADER* PixelShaderCache::GetShader(bool dstAlphaEnable)
PSCacheEntry& newentry = pshaders[uid];
newentry.frameCount = frameCount;
pShaderLast = &newentry.shader;
const char *code = GeneratePixelShaderCode(dstAlphaEnable,API_OPENGL);
const char *code = GeneratePixelShaderCode(dstAlphaEnable,API_OPENGL,components);
#if defined(_DEBUG) || defined(DEBUGFAST)
if (g_ActiveConfig.iLog & CONF_SAVESHADERS && code) {

View File

@ -71,7 +71,7 @@ public:
static void Init();
static void Shutdown();
static FRAGMENTSHADER* GetShader(bool dstAlphaEnable);
static FRAGMENTSHADER* GetShader(bool dstAlphaEnable,u32 components);
static bool CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrprogram);
static GLuint GetColorMatrixProgram();

View File

@ -894,7 +894,6 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
DVSTARTPROFILE();
ResetAPIState();
TargetRectangle back_rc;
ComputeDrawRectangle(m_CustomWidth, m_CustomHeight, true, &back_rc);
@ -1083,7 +1082,8 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
}
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
TextureMngr::DisableStage(0);
if(g_ActiveConfig.bAnaglyphStereo)
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
// Wireframe
if (g_ActiveConfig.bWireFrame)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
@ -1305,8 +1305,11 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
GL_REPORT_ERRORD();
// Clear framebuffer
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
if(!g_ActiveConfig.bAnaglyphStereo)
{
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
}
GL_REPORT_ERRORD();

View File

@ -289,7 +289,7 @@ void Flush()
}
}
FRAGMENTSHADER* ps = PixelShaderCache::GetShader(false);
FRAGMENTSHADER* ps = PixelShaderCache::GetShader(false,g_nativeVertexFmt->m_components);
VERTEXSHADER* vs = VertexShaderCache::GetShader(g_nativeVertexFmt->m_components);
// set global constants
@ -306,7 +306,7 @@ void Flush()
// run through vertex groups again to set alpha
if (!g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate)
{
ps = PixelShaderCache::GetShader(true);
ps = PixelShaderCache::GetShader(true,g_nativeVertexFmt->m_components);
if (ps)PixelShaderCache::SetCurrentShader(ps->glprogid);