forked from bartvdbraak/blender
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.
This commit is contained in:
parent
9a1585a533
commit
c7029f06d9
@ -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
|
||||
|
@ -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}
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -126,6 +126,7 @@ public:
|
||||
RAS_STEREO_SIDEBYSIDE,
|
||||
RAS_STEREO_VINTERLACE,
|
||||
RAS_STEREO_DOME,
|
||||
RAS_STEREO_3DTVTOPBOTTOM,
|
||||
|
||||
RAS_STEREO_MAXSTEREO
|
||||
};
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user