diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2011-08-27 07:19:46 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2011-08-27 07:19:46 +0400 |
commit | 555f6cbe08db7c44ed4c6604f256a055b465d769 (patch) | |
tree | ff3702be8669b1870aaea608ea942c4eefbc7bde | |
parent | 70c955c48437b6387285e963bf8c6f7294700ca2 (diff) |
BGE: Post drawing callbacks are now done per viewport instead of per scene. This is handy for things like having a different HUD for each player in a splitscreen game. To figure out what viewport you're drawing too, check the scene's active_camera.
-rw-r--r-- | source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 0aa36b4cd5f..f41e0c16457 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -862,6 +862,8 @@ void KX_KetsjiEngine::Render() { if((*it)->GetViewport()) { + // Change the active camera so Python scripts can figure out what viewport they're in + scene->SetActiveCamera(*it); if (scene->IsClearingZBuffer()) m_rasterizer->ClearDepthBuffer(); @@ -873,6 +875,10 @@ void KX_KetsjiEngine::Render() it++; } + + // Now change the camera back + scene->SetActiveCamera(cam); + PostRenderScene(scene); } @@ -1315,6 +1321,10 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) if (scene->GetPhysicsEnvironment()) scene->GetPhysicsEnvironment()->debugDrawWorld(); + +#ifdef WITH_PYTHON + scene->RunDrawingCallbacks(scene->GetPostDrawCB()); +#endif } void KX_KetsjiEngine::RenderFonts(KX_Scene* scene) @@ -1336,9 +1346,6 @@ void KX_KetsjiEngine::PostRenderScene(KX_Scene* scene) { m_rendertools->MotionBlur(m_rasterizer); scene->Render2DFilters(m_canvas); -#ifdef WITH_PYTHON - scene->RunDrawingCallbacks(scene->GetPostDrawCB()); -#endif m_rasterizer->FlushDebugLines(); } |