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 | |
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')
5 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index b0aa818d49a..9fb3135c8a5 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -678,6 +678,7 @@ typedef struct GameData { #define STEREO_SIDEBYSIDE 6 #define STEREO_VINTERLACE 7 //#define STEREO_DOME 8 +#define STEREO_3DTVTOPBOTTOM 9 /* physicsEngine */ #define WOPHY_NONE 0 diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 6602c0f4069..8f73b59c7db 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3087,6 +3087,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) {STEREO_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", ""}, {STEREO_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-side", ""}, {STEREO_VINTERLACE, "VINTERLACE", 0, "Vinterlace", ""}, + {STEREO_3DTVTOPBOTTOM, "3DTVTOPBOTTOM", 0, "3DTV Top-Bottom", ""}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index ba580bc038c..7d792ca37c8 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -660,6 +660,9 @@ int main(int argc, char** argv) else if (!strcmp(argv[i], "syncdoubling")) stereomode = RAS_IRasterizer::RAS_STEREO_ABOVEBELOW; + else if (!strcmp(argv[i], "3dtvtopbottom")) + stereomode = RAS_IRasterizer::RAS_STEREO_3DTVTOPBOTTOM; + else if (!strcmp(argv[i], "anaglyph")) stereomode = RAS_IRasterizer::RAS_STEREO_ANAGLYPH; 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); |