From 8f6c27ae325b1f0fface6f84cfae96984ee60102 Mon Sep 17 00:00:00 2001 From: Faerbit Date: Sat, 14 Mar 2015 14:34:45 +0100 Subject: [PATCH] Changing in which order stuff is drawn. --- game/graphics.cc | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/game/graphics.cc b/game/graphics.cc index 22a240e..e8cb64e 100644 --- a/game/graphics.cc +++ b/game/graphics.cc @@ -474,13 +474,28 @@ void Graphics::render(double time) lightingShader->setUniform("movement", wind); lightingShader->setUniform("time", (float) time); - if (renderWorld) { // render the level level->render(lightingShader, true, &lightingViewProjectionMatrix, &depthBiasVPs); } + if (renderDebug) { + debugDrawer.setDebugMode(btIDebugDraw::DBG_DrawWireframe); + level->getPhysics()->getWorld()->debugDrawWorld(); + debugDrawer.setDebugMode(btIDebugDraw::DBG_NoDebug); + unsigned int data_count = debugDrawer.getData()->size(); + float* debugData = new float[data_count]; + for (unsigned int i = 0; iat(i); + } + debug_ab->setDataElements(data_count/6, debugData); + debugDrawer.clearData(); + debugShader->use(); + debugShader->setUniform("viewProjectionMatrix", lightingViewProjectionMatrix); + debug_vao->render(); + } + // draw flames on top if (renderFlames) { flameShader->use(); @@ -528,21 +543,6 @@ void Graphics::render(double time) glBlitFramebuffer(0, 0, windowSize.x, windowSize.y, 0, 0, windowSize.x, windowSize.y, GL_COLOR_BUFFER_BIT, GL_NEAREST); } - if (renderDebug) { - debugDrawer.setDebugMode(btIDebugDraw::DBG_DrawWireframe); - level->getPhysics()->getWorld()->debugDrawWorld(); - debugDrawer.setDebugMode(btIDebugDraw::DBG_NoDebug); - unsigned int data_count = debugDrawer.getData()->size(); - float* debugData = new float[data_count]; - for (unsigned int i = 0; iat(i); - } - debug_ab->setDataElements(data_count/6, debugData); - debugDrawer.clearData(); - debugShader->use(); - debugShader->setUniform("viewProjectionMatrix", lightingViewProjectionMatrix); - debug_vao->render(); - } } }