[Bf-blender-cvs] [c7029f0] master: 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.

Benoit Bolsee noreply at git.blender.org
Thu Jan 2 00:46:39 CET 2014


Commit: c7029f06d924e5acf5eafcaa13854aca5e7406b5
Author: Benoit Bolsee
Date:   Thu Jan 2 00:26:15 2014 +0100
https://developer.blender.org/rBc7029f06d924e5acf5eafcaa13854aca5e7406b5

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.

===================================================================

M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_scene.c
M	source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
M	source/gameengine/Rasterizer/RAS_IRasterizer.h
M	source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp

===================================================================

diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index b0aa818..9fb3135 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 6602c0f..8f73b59 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 ba580bc..7d792ca 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 f9369cf..0776a02 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 fc5e113..e03be54 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);




More information about the Bf-blender-cvs mailing list