From 9555786a09b596d6b5bcd039f6c1e27e1b3d5f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=BCndgens?= Date: Mon, 2 Mar 2015 14:28:19 +0100 Subject: [PATCH] Ignored first two seconds of triggering to give switches time to position themselves. --- level.cc | 12 +++++++----- level.hh | 2 +- main.cc | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/level.cc b/level.cc index 03d0e5c..776f9e3 100644 --- a/level.cc +++ b/level.cc @@ -56,8 +56,8 @@ void Level::render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass, } } -void Level::update(float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPressed, bool sPressed, bool dPressed,bool kPressed, bool lPressed) { - physics.takeUpdateStep(runTime); +void Level::update(float runTimeSinceLastUpdate, float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPressed, bool sPressed, bool dPressed,bool kPressed, bool lPressed) { + physics.takeUpdateStep(runTimeSinceLastUpdate); // Ignore first two mouse updates, because they are incorrect // DON'T try to move this functionallity elsewhere @@ -102,9 +102,11 @@ void Level::update(float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPre skydome->setPosition(glm::vec3(cameraCenter->getPosition().x, 0.0f, cameraCenter->getPosition().z)); - - for(unsigned int i = 0; i 2.0f) { + for(unsigned int i = 0; i* shadowVPs=0); glm::vec3 getAmbientLight(); diff --git a/main.cc b/main.cc index 027e6be..6a876be 100644 --- a/main.cc +++ b/main.cc @@ -161,13 +161,13 @@ int main( int argc, char *argv[] ) double xpos, ypos; glfwGetCursorPos(window, &xpos, &ypos); glfwSetCursorPos(window, app.getGraphics()->getWindowSize().x/2, app.getGraphics()->getWindowSize().y/2); - app.getLevel()->update(now - lastUpdate, + app.getLevel()->update(now - lastUpdate, now, glm::vec2((float)ypos-app.getGraphics()->getWindowSize().y/2, (float)xpos-app.getGraphics()->getWindowSize().x/2), stateW == GLFW_PRESS,stateA == GLFW_PRESS,stateS == GLFW_PRESS,stateD == GLFW_PRESS,stateK == GLFW_PRESS,stateL == GLFW_PRESS); } else { - app.getLevel()->update(now - lastUpdate, glm::vec2(0.0f, 0.0f), false, false, false, false,false,false); + app.getLevel()->update(now - lastUpdate, now, glm::vec2(0.0f, 0.0f), false, false, false, false,false,false); if (app.isLocked()) { app.ignoredOneMouseUpdate(); }