From a725cf8b43b79c066440a0b714b92423236cc668 Mon Sep 17 00:00:00 2001 From: Faerbit Date: Fri, 13 Mar 2015 15:43:10 +0100 Subject: [PATCH] Added switch for rendering world. --- game/graphics.cc | 18 +++++++++++++++--- game/graphics.hh | 3 +++ game/main.cc | 3 +++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/game/graphics.cc b/game/graphics.cc index 9b625bb..22a240e 100644 --- a/game/graphics.cc +++ b/game/graphics.cc @@ -28,6 +28,7 @@ Graphics::Graphics(glm::uvec2 windowSize, float nearPlane, gameStart = false; renderShadows = true; renderFlames = true; + renderWorld = true; renderDebug = false; } @@ -473,9 +474,12 @@ void Graphics::render(double time) lightingShader->setUniform("movement", wind); lightingShader->setUniform("time", (float) time); - - // render the level - level->render(lightingShader, true, &lightingViewProjectionMatrix, &depthBiasVPs); + + + if (renderWorld) { + // render the level + level->render(lightingShader, true, &lightingViewProjectionMatrix, &depthBiasVPs); + } // draw flames on top if (renderFlames) { @@ -702,3 +706,11 @@ void Graphics::setRenderDebug(bool state) { bool Graphics::getRenderDebug() { return renderDebug; } + +void Graphics::setRenderWorld(bool state) { + renderWorld = state; +} + +bool Graphics::getRenderWorld() { + return renderWorld; +} diff --git a/game/graphics.hh b/game/graphics.hh index 4026594..503fbdb 100644 --- a/game/graphics.hh +++ b/game/graphics.hh @@ -28,9 +28,11 @@ class Graphics { void setRenderShadows(bool state); void setRenderFlames(bool state); void setRenderDebug(bool state); + void setRenderWorld(bool state); bool getRenderShadows(); bool getRenderFlames(); bool getRenderDebug(); + bool getRenderWorld(); private: void bindTextureUnits(); void updateLights(); @@ -81,6 +83,7 @@ class Graphics { bool renderShadows; bool renderFlames; bool renderDebug; + bool renderWorld; DebugDraw debugDrawer; SharedArrayBuffer debug_ab; SharedVertexArrayObject debug_vao; diff --git a/game/main.cc b/game/main.cc index e6667bb..a15b5cf 100644 --- a/game/main.cc +++ b/game/main.cc @@ -32,6 +32,9 @@ static void keyCallback(GLFWwindow* _window, int _key, int, int _action, int) if (_key == GLFW_KEY_F7 && _action == GLFW_PRESS) { app.getGraphics()->setRenderDebug(!app.getGraphics()->getRenderDebug()); } + if (_key == GLFW_KEY_F8 && _action == GLFW_PRESS) { + app.getGraphics()->setRenderWorld(!app.getGraphics()->getRenderWorld()); + } } static void mouseCallback(GLFWwindow* window, int button, int action, int) {