diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index a999748a2..22461f236 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -146,6 +146,43 @@ void IrrDriver::renderGLSL(float dt) renderScene(camnode, glows, dt, track->hasShadows()); + // Debug physic + // Note that drawAll must be called before rendering + // the bullet debug view, since otherwise the camera + // is not set up properly. This is only used for + // the bullet debug view. + if (UserConfigParams::m_artist_debug_mode) + World::getWorld()->getPhysics()->draw(); + if (world != NULL && world->getPhysics() != NULL) + { + IrrDebugDrawer* debug_drawer = world->getPhysics()->getDebugDrawer(); + if (debug_drawer != NULL && debug_drawer->debugEnabled()) + { + const std::map >& lines = debug_drawer->getLines(); + std::map >::const_iterator it; + + + glUseProgram(UtilShader::ColoredLine::Program); + glBindVertexArray(UtilShader::ColoredLine::vao); + glBindBuffer(GL_ARRAY_BUFFER, UtilShader::ColoredLine::vbo); + for (it = lines.begin(); it != lines.end(); it++) + { + UtilShader::ColoredLine::setUniforms(it->first); + const std::vector &vertex = it->second; + const float *tmp = vertex.data(); + for (int i = 0; i < vertex.size(); i += 1024 * 6) + { + unsigned count = MIN2(vertex.size() - i, 1024 * 6); + glBufferSubData(GL_ARRAY_BUFFER, 0, count * sizeof(float), &tmp[i]); + + glDrawArrays(GL_LINES, 0, count / 3); + } + } + glUseProgram(0); + glBindVertexArray(0); + } + } + // Render the post-processed scene if (UserConfigParams::m_dynamic_lights) m_post_processing->render(camnode); @@ -153,13 +190,6 @@ void IrrDriver::renderGLSL(float dt) glDisable(GL_FRAMEBUFFER_SRGB); PROFILER_POP_CPU_MARKER(); - - // Note that drawAll must be called before rendering - // the bullet debug view, since otherwise the camera - // is not set up properly. This is only used for - // the bullet debug view. - if (UserConfigParams::m_artist_debug_mode) - World::getWorld()->getPhysics()->draw(); } // for igetNumKarts() glBindVertexArray(0); @@ -201,36 +231,6 @@ void IrrDriver::renderGLSL(float dt) #endif - if (world != NULL && world->getPhysics() != NULL) - { - IrrDebugDrawer* debug_drawer = world->getPhysics()->getDebugDrawer(); - if (debug_drawer != NULL && debug_drawer->debugEnabled()) - { - const std::map >& lines = debug_drawer->getLines(); - std::map >::const_iterator it; - - - glUseProgram(UtilShader::ColoredLine::Program); - glBindVertexArray(UtilShader::ColoredLine::vao); - glBindBuffer(GL_ARRAY_BUFFER, UtilShader::ColoredLine::vbo); - for (it = lines.begin(); it != lines.end(); it++) - { - UtilShader::ColoredLine::setUniforms(it->first); - const std::vector &vertex = it->second; - const float *tmp = vertex.data(); - for (int i = 0; i < vertex.size(); i += 1024 * 6) - { - unsigned count = MIN2(vertex.size() - i, 1024 * 6); - glBufferSubData(GL_ARRAY_BUFFER, 0, count * sizeof(float), &tmp[i]); - - glDrawArrays(GL_LINES, 0, count / 3); - } - } - glUseProgram(0); - glBindVertexArray(0); - } - } - PROFILER_PUSH_CPU_MARKER("EndSccene", 0x45, 0x75, 0x45); m_video_driver->endScene(); PROFILER_POP_CPU_MARKER();