diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2013-04-12 05:52:30 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2013-04-12 05:52:30 +0400 |
commit | 1c80388a737b306ad07669b83c49801e4582a461 (patch) | |
tree | 0adac0bd2b8ecc6e553517d74bf9c8090995d319 /source/gameengine | |
parent | 502ddd312879316c13f66d84c4ffe0927df53a06 (diff) |
bge fix: framing mode "Expanded" not updated when resizing blenderplayer
now, with a 'resize' routine for the engine we can/should also recreate some
buffers that are created only at init time (e.g., 2d filters, dome fbos, ...).
This bug was always present in Blender (since 2.49 at least).
Bugfix supported by NF-UBC Nereus Program as part of the development
of OceanViz/NereusViz
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_Application.cpp | 1 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 18 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_KetsjiEngine.h | 7 |
3 files changed, 26 insertions, 0 deletions
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 58710120afa..31ce1869544 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -503,6 +503,7 @@ bool GPG_Application::processEvent(GHOST_IEvent* event) GHOST_Rect bnds; window->getClientBounds(bnds); m_canvas->Resize(bnds.getWidth(), bnds.getHeight()); + m_ketsjiengine->Resize(); } } break; diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index fab19008b25..3abc129521e 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -2012,6 +2012,24 @@ void KX_KetsjiEngine::GetOverrideFrameColor(float& r, float& g, float& b) const b = m_overrideFrameColorB; } + +void KX_KetsjiEngine::Resize() +{ + KX_SceneList::iterator sceneit; + + /* extended mode needs to recalculate camera frustrums when */ + KX_Scene* firstscene = *m_scenes.begin(); + const RAS_FrameSettings &framesettings = firstscene->GetFramingType(); + + if (framesettings.FrameType() == RAS_FrameSettings::e_frame_extend) { + for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); sceneit++) { + KX_Camera* cam = ((KX_Scene *)*sceneit)->GetActiveCamera(); + cam->InvalidateProjectionMatrix(); + } + } +} + + void KX_KetsjiEngine::SetGlobalSettings(GlobalSettings* gs) { m_globalsettings.matmode = gs->matmode; diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h index fdfe0551d18..0d7e41d7568 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.h +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h @@ -420,6 +420,13 @@ public: GlobalSettings* GetGlobalSettings(void); void SetGlobalSettings(GlobalSettings* gs); + /** + * Invalidate all the camera matrices and handle other + * needed changes when resized. + * It's only called from Blenderplayer. + */ + void Resize(); + protected: /** * Processes all scheduled scene activity. |