diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2009-04-30 06:41:07 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2009-04-30 06:41:07 +0400 |
commit | 5908e2aa779b0b95a27dad96e2bb8d3be926956a (patch) | |
tree | 7bc71dc1e858a639bed048a7c57c1aa65b6532c7 /source/gameengine/Ketsji/KX_Dome.cpp | |
parent | 199341ad7be34cc07f784c6be0d9b1e5473c9346 (diff) |
BGE Dome update. Spurious black seams (finally) fixed.
The solution is a hack. It's a workaround for another bug (#18655).
Now it's working in all modes: fullscreen, maximized screen and gameplayer.
* small change to always set the perspective mode as true during dome mode.
Diffstat (limited to 'source/gameengine/Ketsji/KX_Dome.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_Dome.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index 9565c53e0bf..e4c3d92fbf2 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -147,7 +147,7 @@ KX_Dome::~KX_Dome (void) void KX_Dome::SetViewPort(GLuint viewport[4]) { - if(canvaswidth != m_canvas->GetWidth() || canvasheight != m_canvas->GetHeight()) + if(canvaswidth != m_viewport.GetWidth() || canvasheight != m_viewport.GetHeight()) { m_viewport.SetLeft(viewport[0]); m_viewport.SetBottom(viewport[1]); @@ -201,12 +201,25 @@ void KX_Dome::CalculateImageSize(void) - reduce the buffer for better performace - create a power of 2 texture bigger than the buffer */ +/* +Blender handles Canvas size differently when in fullscreen mode. +We are manually checking for that. Although it's a hack, it works. + +Bug reported here: #18655 - Inconsistency of pixels in canvas dimensions when in maximized mode (affecting BGE Dome) +http://projects.blender.org/tracker/?func=detail&aid=18655&group_id=9&atid=125 +*/ canvaswidth = m_canvas->GetWidth(); canvasheight = m_canvas->GetHeight(); + bool fullscreen(false); //XXX HACK + fullscreen = (canvaswidth != m_viewport.GetWidth()); + m_buffersize = (canvaswidth > canvasheight?canvasheight:canvaswidth); m_buffersize = (int)(m_buffersize*m_resbuffer); //reduce buffer size for better performance + + if (fullscreen) //XXX HACK + m_buffersize --; int i = 0; while ((1 << i) <= m_buffersize) @@ -227,6 +240,9 @@ void KX_Dome::CalculateImageSize(void) i++; warp.imageheight = (1 << i); } + //XXX HACK + canvaswidth = m_viewport.GetWidth(); + canvasheight = m_viewport.GetHeight(); } bool KX_Dome::CreateDL(){ @@ -1365,7 +1381,7 @@ void KX_Dome::CalculateFrustum(KX_Camera * cam) /* // manually creating a 90º Field of View Frustum - the original formula: + the original formula: top = tan(fov*3.14159/360.0) * near [for fov in degrees] fov*0.5 = arctan ((top-bottom)*0.5 / near) [for fov in radians] bottom = -top @@ -1913,7 +1929,7 @@ void KX_Dome::RenderDomeFrame(KX_Scene* scene, KX_Camera* cam, int i) MT_Transform camtrans(cam->GetWorldToCamera()); MT_Matrix4x4 viewmat(camtrans); - m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), cam->GetCameraData()->m_perspective); + m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), 1.0); cam->SetModelviewMatrix(viewmat); scene->CalculateVisibleMeshes(m_rasterizer,cam); |