Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPorteries Tristan <republicthunderbolt9@gmail.com>2015-07-27 11:58:19 +0300
committerPorteries Tristan <republicthunderbolt9@gmail.com>2015-07-27 14:49:06 +0300
commit76beb7b7d4d3e8777b3cbf9eb0f85f991dd147bc (patch)
tree322ac5e13d182204a7c53e86c0802c9dfb4338e5 /source/gameengine/Ketsji
parentba146899c8ff40f61819265082781ef4048c631f (diff)
BGE: Fix T19241: draw debug shape with overlay/background scene.
It's for the function render.drawLine and physics debug.
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp5
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp8
2 files changed, 8 insertions, 5 deletions
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index 423e41e4e7f..c2ca9b82c8b 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -1252,12 +1252,15 @@ void KX_KetsjiEngine::PostRenderScene(KX_Scene* scene)
// We need to first make sure our viewport is correct (enabling multiple viewports can mess this up)
m_canvas->SetViewPort(0, 0, m_canvas->GetWidth(), m_canvas->GetHeight());
- m_rasterizer->FlushDebugShapes();
+ m_rasterizer->FlushDebugShapes(scene);
scene->Render2DFilters(m_canvas);
#ifdef WITH_PYTHON
PHY_SetActiveEnvironment(scene->GetPhysicsEnvironment());
scene->RunDrawingCallbacks(scene->GetPostDrawCB());
+
+ // Python draw callback can also call debug draw functions, so we have to clear debug shapes.
+ m_rasterizer->FlushDebugShapes(scene);
#endif
}
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 95b92a223c5..2eaacf43041 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -186,17 +186,17 @@ class KX_KetsjiEngine* KX_GetActiveEngine()
}
/* why is this in python? */
-void KX_RasterizerDrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color)
+void KX_RasterizerDrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color)
{
if (gp_Rasterizer)
- gp_Rasterizer->DrawDebugLine(from,to,color);
+ gp_Rasterizer->DrawDebugLine(gp_KetsjiScene, from, to, color);
}
void KX_RasterizerDrawDebugCircle(const MT_Vector3& center, const MT_Scalar radius, const MT_Vector3& color,
const MT_Vector3& normal, int nsector)
{
if (gp_Rasterizer)
- gp_Rasterizer->DrawDebugCircle(center, radius, color, normal, nsector);
+ gp_Rasterizer->DrawDebugCircle(gp_KetsjiScene, center, radius, color, normal, nsector);
}
#ifdef WITH_PYTHON
@@ -1265,7 +1265,7 @@ static PyObject *gPyDrawLine(PyObject *, PyObject *args)
if (!PyVecTo(ob_color, color))
return NULL;
- gp_Rasterizer->DrawDebugLine(from,to,color);
+ gp_Rasterizer->DrawDebugLine(gp_KetsjiScene, from, to, color);
Py_RETURN_NONE;
}