forked from bartvdbraak/blender
Fix: The debug lines of Physics Debug Visualization were drawn incorrectly when using overlay scenes (it was using the wrong camera)
This commit is contained in:
parent
abb338ddf9
commit
6e85d00055
@ -1112,6 +1112,11 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam)
|
||||
|
||||
scene->RenderBuckets(camtrans, m_rasterizer, m_rendertools);
|
||||
|
||||
if (scene->GetPhysicsEnvironment())
|
||||
scene->GetPhysicsEnvironment()->debugDrawWorld();
|
||||
|
||||
m_rasterizer->FlushDebugLines();
|
||||
|
||||
PostRenderFrame();
|
||||
}
|
||||
|
||||
|
@ -563,6 +563,11 @@ void CcdPhysicsEnvironment::beginFrame()
|
||||
|
||||
}
|
||||
|
||||
void CcdPhysicsEnvironment::debugDrawWorld()
|
||||
{
|
||||
if (m_dynamicsWorld->getDebugDrawer() && m_dynamicsWorld->getDebugDrawer()->getDebugMode() >0)
|
||||
m_dynamicsWorld->debugDrawWorld();
|
||||
}
|
||||
|
||||
bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep)
|
||||
{
|
||||
@ -599,9 +604,6 @@ bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep)
|
||||
veh->SyncWheels();
|
||||
}
|
||||
|
||||
if (m_dynamicsWorld->getDebugDrawer() && m_dynamicsWorld->getDebugDrawer()->getDebugMode() >0)
|
||||
m_dynamicsWorld->debugDrawWorld();
|
||||
|
||||
|
||||
CallbackTriggers();
|
||||
|
||||
|
@ -110,6 +110,8 @@ protected:
|
||||
virtual void endFrame() {};
|
||||
/// Perform an integration step of duration 'timeStep'.
|
||||
virtual bool proceedDeltaTime(double curTime,float timeStep);
|
||||
|
||||
virtual void debugDrawWorld();
|
||||
// virtual bool proceedDeltaTimeOneStep(float timeStep);
|
||||
|
||||
virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep){};
|
||||
|
@ -90,6 +90,8 @@ class PHY_IPhysicsEnvironment
|
||||
virtual void endFrame() = 0;
|
||||
/// Perform an integration step of duration 'timeStep'.
|
||||
virtual bool proceedDeltaTime(double curTime,float timeStep)=0;
|
||||
///draw debug lines (make sure to call this during the render phase, otherwise lines are not drawn properly)
|
||||
virtual void debugDrawWorld(){}
|
||||
virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep)=0;
|
||||
//returns 0.f if no fixed timestep is used
|
||||
virtual float getFixedTimeStep()=0;
|
||||
|
@ -361,6 +361,8 @@ public:
|
||||
virtual void SetPolygonOffset(float mult, float add) = 0;
|
||||
|
||||
virtual void DrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color)=0;
|
||||
virtual void FlushDebugLines()=0;
|
||||
|
||||
|
||||
|
||||
virtual void SetTexCoordNum(int num) = 0;
|
||||
|
@ -327,13 +327,12 @@ void RAS_OpenGLRasterizer::ClearCachingInfo(void)
|
||||
m_materialCachingInfo = 0;
|
||||
}
|
||||
|
||||
|
||||
void RAS_OpenGLRasterizer::EndFrame()
|
||||
void RAS_OpenGLRasterizer::FlushDebugLines()
|
||||
{
|
||||
//DrawDebugLines
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
//DrawDebugLines
|
||||
glBegin(GL_LINES);
|
||||
for (unsigned int i=0;i<m_debugLines.size();i++)
|
||||
{
|
||||
@ -348,8 +347,19 @@ void RAS_OpenGLRasterizer::EndFrame()
|
||||
}
|
||||
glEnd();
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
m_debugLines.clear();
|
||||
|
||||
}
|
||||
|
||||
void RAS_OpenGLRasterizer::EndFrame()
|
||||
{
|
||||
|
||||
|
||||
FlushDebugLines();
|
||||
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
m_2DCanvas->EndFrame();
|
||||
}
|
||||
|
@ -240,6 +240,8 @@ public:
|
||||
|
||||
virtual void SetPolygonOffset(float mult, float add);
|
||||
|
||||
virtual void FlushDebugLines();
|
||||
|
||||
virtual void DrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color)
|
||||
{
|
||||
OglDebugLine line;
|
||||
|
Loading…
Reference in New Issue
Block a user