X-Git-Url: https://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=main.cpp;h=742c8983840eff62fbb68652ba0365fe2da0c72b;hp=f7b2f85a4644f12ba6df69a5f02363926686afe7;hb=85f8f7278f24fe73fef1a19174376b155319072f;hpb=ba9c738e8660304aa0341eb44118e63502a4a009 diff --git a/main.cpp b/main.cpp index f7b2f85..742c898 100644 --- a/main.cpp +++ b/main.cpp @@ -29,7 +29,7 @@ glm::vec3 camUp = glm::vec3(0.0f, 1.0f, 0.0f); float yaw = 1.57, pitch = 0; bool doScale, doRotate, doTranslate; Model *monkeyHead, *chest; -glm::vec3 chestPos(0); +glm::vec3 lightPos(0); const int WIDTH = 800, HEIGHT = 600; const float ASPECT = (float)WIDTH / (float)HEIGHT; @@ -157,7 +157,6 @@ void display() { float d = (float)glutGet(GLUT_ELAPSED_TIME) * 0.001f; /* glm::vec3 lightPos = glm::vec3(sin(d / 10.f) * 10, 0, cos(d / 10.f) * 10); */ - glm::vec3 lightPos = chestPos; glm::vec4 lightColor(1, 1, 1, 1); drawLight(d, lightPos, lightColor); @@ -182,7 +181,7 @@ void display() { /* Model::Node *key = chest->find("key"); */ /* key->model = glm::translate(glm::mat4(1), glm::vec3(0, 0, sin(d))); */ - /* chest->getRoot()->model = glm::translate(glm::mat4(1), chestPos); */ + /* chest->getRoot()->model = glm::translate(glm::mat4(1), lightPos); */ chest->draw(); glutSwapBuffers(); @@ -486,7 +485,7 @@ void init() { validateProgram(textureProgId); monkeyHead = new Model("monkeyhead_smooth.dae", solidProgId); - chest = new Model("chest.dae", textureProgId); + chest = new Model("models/chest.dae", textureProgId); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); @@ -523,12 +522,12 @@ void timer(int _) { if (keyStates['e']) ySpeed = -0.1f; - if (keyStates['j']) chestPos.z += 0.1f; - if (keyStates['k']) chestPos.z -= 0.1f; - if (keyStates['h']) chestPos.x -= 0.1f; - if (keyStates['l']) chestPos.x += 0.1f; - if (keyStates['m']) chestPos.y -= 0.1f; - if (keyStates['n']) chestPos.y += 0.1f; + if (keyStates['j']) lightPos.z += 0.1f; + if (keyStates['k']) lightPos.z -= 0.1f; + if (keyStates['h']) lightPos.x -= 0.1f; + if (keyStates['l']) lightPos.x += 0.1f; + if (keyStates['m']) lightPos.y -= 0.1f; + if (keyStates['n']) lightPos.y += 0.1f; camPos.x += xSpeed * sin(yaw) + zSpeed * cos(yaw); camPos.y += ySpeed;