diff options
| author | Ryan Houdek <Sonicadvance1@gmail.com> | 2014-11-28 11:45:38 -0600 |
|---|---|---|
| committer | Ryan Houdek <Sonicadvance1@gmail.com> | 2014-11-28 11:45:38 -0600 |
| commit | ce059769f6bf13118366f77fea926727efcf4510 (patch) | |
| tree | 8ea7f2014f086f1df0f661697863c5b72d633a5b /Source/Core/VideoCommon/VertexShaderManager.cpp | |
| parent | 0e3d20c349ead263a630463beeb4335aaf512e42 (diff) | |
| parent | 6d51455195e95a1bb97eb263fcd3423c757f59e7 (diff) | |
Merge pull request #1439 from Armada651/ogl-stereo-3d
OGL: Stereoscopic 3D Support
Diffstat (limited to 'Source/Core/VideoCommon/VertexShaderManager.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VertexShaderManager.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp index 93f969b0b5..8de50c5436 100644 --- a/Source/Core/VideoCommon/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/VertexShaderManager.cpp @@ -489,7 +489,7 @@ void VertexShaderManager::SetConstants() PRIM_LOG("Projection: %f %f %f %f %f %f\n", rawProjection[0], rawProjection[1], rawProjection[2], rawProjection[3], rawProjection[4], rawProjection[5]); - if ((g_ActiveConfig.bFreeLook || g_ActiveConfig.bAnaglyphStereo ) && xfmem.projection.type == GX_PERSPECTIVE) + if (g_ActiveConfig.bFreeLook && xfmem.projection.type == GX_PERSPECTIVE) { Matrix44 mtxA; Matrix44 mtxB; @@ -512,6 +512,19 @@ void VertexShaderManager::SetConstants() Matrix44::Multiply(s_viewportCorrection, projMtx, correctedMtx); memcpy(constants.projection, correctedMtx.data, 4*16); } + + if (g_ActiveConfig.iStereoMode > 0 && xfmem.projection.type == GX_PERSPECTIVE) + { + float offset = (g_ActiveConfig.iStereoSeparation / 1000.0f) * (g_ActiveConfig.iStereoSeparationPercent / 100.0f); + constants.stereoparams[0] = (g_ActiveConfig.bStereoSwapEyes) ? offset : -offset; + constants.stereoparams[1] = (g_ActiveConfig.bStereoSwapEyes) ? -offset : offset; + constants.stereoparams[2] = (g_ActiveConfig.iStereoConvergence / 10.0f) * (g_ActiveConfig.iStereoConvergencePercent / 100.0f); + } + else + { + constants.stereoparams[0] = constants.stereoparams[1] = 0; + } + dirty = true; } } |
