diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2014-01-02 03:26:15 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2014-01-02 03:26:15 +0400 |
commit | c7029f06d924e5acf5eafcaa13854aca5e7406b5 (patch) | |
tree | 409d939838d8d8cdea354d55cb371ace058a5e9b /source/gameengine/Rasterizer | |
parent | 9a1585a5331ec4dd3fcf7d024548820098181601 (diff) |
Add new BGE Stereo mode: 3DTV top-bottom.
This mode is designed for passive 3D TV: the viewport is split
horizontally - left eye above, right eye below - but the original camera
viewport is squashed in each half (with half the vertical resolution).
This is necessary to restore the aspect ratio in the 3D output because the TV expands each half to the full screen size.
Diffstat (limited to 'source/gameengine/Rasterizer')
-rw-r--r-- | source/gameengine/Rasterizer/RAS_IRasterizer.h | 1 | ||||
-rw-r--r-- | source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp | 28 |
2 files changed, 29 insertions, 0 deletions
diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h index f9369cf5e40..0776a02a79a 100644 --- a/source/gameengine/Rasterizer/RAS_IRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h @@ -126,6 +126,7 @@ public: RAS_STEREO_SIDEBYSIDE, RAS_STEREO_VINTERLACE, RAS_STEREO_DOME, + RAS_STEREO_3DTVTOPBOTTOM, RAS_STEREO_MAXSTEREO }; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index fc5e1135fa8..e03be54e87b 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -527,6 +527,28 @@ void RAS_OpenGLRasterizer::SetRenderArea() break; } break; + case RAS_STEREO_3DTVTOPBOTTOM: + switch (m_curreye) { + case RAS_STEREO_LEFTEYE: + // upper half of window + area.SetLeft(0); + area.SetBottom(m_2DCanvas->GetHeight() - + m_2DCanvas->GetHeight() / 2); + + area.SetRight(m_2DCanvas->GetWidth()); + area.SetTop(m_2DCanvas->GetHeight()); + m_2DCanvas->SetDisplayArea(&area); + break; + case RAS_STEREO_RIGHTEYE: + // lower half of window + area.SetLeft(0); + area.SetBottom(0); + area.SetRight(m_2DCanvas->GetWidth()); + area.SetTop(m_2DCanvas->GetHeight() / 2); + m_2DCanvas->SetDisplayArea(&area); + break; + } + break; case RAS_STEREO_SIDEBYSIDE: switch (m_curreye) { @@ -841,6 +863,12 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix( break; } // leave bottom and top untouched + if (m_stereomode == RAS_STEREO_3DTVTOPBOTTOM) { + // restore the vertical frustrum because the 3DTV will + // expande the top and bottom part to the full size of the screen + bottom *= 2.0f; + top *= 2.0f; + } } glMatrixMode(GL_PROJECTION); |