added SetDisplayArea, GetDisplayArea was used in a confusing way
authorCampbell Barton <ideasman42@gmail.com>
Mon, 26 Oct 2009 22:33:43 +0000 (22:33 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 26 Oct 2009 22:33:43 +0000 (22:33 +0000)
source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
source/gameengine/Rasterizer/RAS_ICanvas.h
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp

index d49c877f6101f5c54ebcb3ae928ca08284580005..f3228f4b5244de1e24b9a2753de7e4192cfab2ca 100644 (file)
@@ -116,10 +116,10 @@ public:
                return m_displayarea;
        };
 
-               RAS_Rect &
-       GetDisplayArea(
+               void
+       SetDisplayArea(RAS_Rect *rect
        ) {
-               return m_displayarea;
+               m_displayarea= *rect;
        };
 
                RAS_Rect &
index dae4fb3f4d29286c46a72e87ce7a16851851d395..a5ef18275acd28b8a6b1179626e680b404e32d7e 100644 (file)
@@ -135,9 +135,9 @@ public:
        GetDisplayArea(
        ) const = 0;
 
-       virtual 
-               RAS_Rect &
-       GetDisplayArea(
+       virtual
+               void
+       SetDisplayArea(RAS_Rect *rect
        ) = 0;
 
        /**
index d16348defb2e2a67e74dd692d9d196dbddb457fd..5b732e802f6847341b3d7ef6eed5c622c13b46f3 100644 (file)
@@ -386,6 +386,7 @@ void RAS_OpenGLRasterizer::EndFrame()
 
 void RAS_OpenGLRasterizer::SetRenderArea()
 {
+       RAS_Rect area;
        // only above/below stereo method needs viewport adjustment
        switch (m_stereomode)
        {
@@ -394,19 +395,21 @@ void RAS_OpenGLRasterizer::SetRenderArea()
                        {
                                case RAS_STEREO_LEFTEYE:
                                        // upper half of window
-                                       m_2DCanvas->GetDisplayArea().SetLeft(0);
-                                       m_2DCanvas->GetDisplayArea().SetBottom(m_2DCanvas->GetHeight() -
+                                       area.SetLeft(0);
+                                       area.SetBottom(m_2DCanvas->GetHeight() -
                                                int(m_2DCanvas->GetHeight() - m_noOfScanlines) / 2);
        
-                                       m_2DCanvas->GetDisplayArea().SetRight(int(m_2DCanvas->GetWidth()));
-                                       m_2DCanvas->GetDisplayArea().SetTop(int(m_2DCanvas->GetHeight()));
+                                       area.SetRight(int(m_2DCanvas->GetWidth()));
+                                       area.SetTop(int(m_2DCanvas->GetHeight()));
+                                       m_2DCanvas->SetDisplayArea(&area);
                                        break;
                                case RAS_STEREO_RIGHTEYE:
                                        // lower half of window
-                                       m_2DCanvas->GetDisplayArea().SetLeft(0);
-                                       m_2DCanvas->GetDisplayArea().SetBottom(0);
-                                       m_2DCanvas->GetDisplayArea().SetRight(int(m_2DCanvas->GetWidth()));
-                                       m_2DCanvas->GetDisplayArea().SetTop(int(m_2DCanvas->GetHeight() - m_noOfScanlines) / 2);
+                                       area.SetLeft(0);
+                                       area.SetBottom(0);
+                                       area.SetRight(int(m_2DCanvas->GetWidth()));
+                                       area.SetTop(int(m_2DCanvas->GetHeight() - m_noOfScanlines) / 2);
+                                       m_2DCanvas->SetDisplayArea(&area);
                                        break;
                        }
                        break;
@@ -415,26 +418,29 @@ void RAS_OpenGLRasterizer::SetRenderArea()
                        {
                                case RAS_STEREO_LEFTEYE:
                                        // Left half of window
-                                       m_2DCanvas->GetDisplayArea().SetLeft(0);
-                                       m_2DCanvas->GetDisplayArea().SetBottom(0);
-                                       m_2DCanvas->GetDisplayArea().SetRight(m_2DCanvas->GetWidth()/2);
-                                       m_2DCanvas->GetDisplayArea().SetTop(m_2DCanvas->GetHeight());
+                                       area.SetLeft(0);
+                                       area.SetBottom(0);
+                                       area.SetRight(m_2DCanvas->GetWidth()/2);
+                                       area.SetTop(m_2DCanvas->GetHeight());
+                                       m_2DCanvas->SetDisplayArea(&area);
                                        break;
                                case RAS_STEREO_RIGHTEYE:
                                        // Right half of window
-                                       m_2DCanvas->GetDisplayArea().SetLeft(m_2DCanvas->GetWidth()/2);
-                                       m_2DCanvas->GetDisplayArea().SetBottom(0);
-                                       m_2DCanvas->GetDisplayArea().SetRight(m_2DCanvas->GetWidth());
-                                       m_2DCanvas->GetDisplayArea().SetTop(m_2DCanvas->GetHeight());
+                                       area.SetLeft(m_2DCanvas->GetWidth()/2);
+                                       area.SetBottom(0);
+                                       area.SetRight(m_2DCanvas->GetWidth());
+                                       area.SetTop(m_2DCanvas->GetHeight());
+                                       m_2DCanvas->SetDisplayArea(&area);
                                        break;
                        }
                        break;
                default:
                        // every available pixel
-                       m_2DCanvas->GetDisplayArea().SetLeft(0);
-                       m_2DCanvas->GetDisplayArea().SetBottom(0);
-                       m_2DCanvas->GetDisplayArea().SetRight(int(m_2DCanvas->GetWidth()));
-                       m_2DCanvas->GetDisplayArea().SetTop(int(m_2DCanvas->GetHeight()));
+                       area.SetLeft(0);
+                       area.SetBottom(0);
+                       area.SetRight(int(m_2DCanvas->GetWidth()));
+                       area.SetTop(int(m_2DCanvas->GetHeight()));
+                       m_2DCanvas->SetDisplayArea(&area);
                        break;
        }
 }