diff --git a/engine/src/main.cpp b/engine/src/main.cpp index 9703b54..21f76cd 100644 --- a/engine/src/main.cpp +++ b/engine/src/main.cpp @@ -10,10 +10,11 @@ #include "draw.hpp" #include "parse.hpp" -float cameraAngle = 90.0f; +float cameraAngle = 0.0f; float cameraAngleY = 0.0f; Configuration c; + void reshape(int w, int h) { float aspect_ratio = (float)w / (float)h; @@ -28,6 +29,7 @@ void reshape(int w, int h) { // Reset the modelview matrix glMatrixMode(GL_MODELVIEW); glLoadIdentity(); + } void drawAxis(void) { @@ -35,19 +37,20 @@ void drawAxis(void) { glBegin(GL_LINES); // x-axis (red) glColor3f(50.0f, 0.0f, 0.0f); - glVertex3f(-50.0f, 0.0f, 0.0f); - glVertex3f(50.0f, 0.0f, 0.0f); + glVertex3f(-500.0f, 0.0f, 0.0f); + glVertex3f(500.0f, 0.0f, 0.0f); // y-axis (green) glColor3f(0.0f, 50.0f, 0.0f); - glVertex3f(0.0f, -50.0f, 0.0f); - glVertex3f(0.0f, 50.0f, 0.0f); + glVertex3f(0.0f, -500.0f, 0.0f); + glVertex3f(0.0f, 500.0f, 0.0f); // z-axis (blue) glColor3f(0.0f, 0.0f, 50.0f); - glVertex3f(0.0f, 0.0f, -50.0f); - glVertex3f(0.0f, 0.0f, 50.0f); + glVertex3f(0.0f, 0.0f, -500.0f); + glVertex3f(0.0f, 0.0f, 500.0f); glEnd(); } + void renderScene(void) { // clear buffers glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -58,10 +61,12 @@ void renderScene(void) { c.camera.lookAt.x, c.camera.lookAt.y, c.camera.lookAt.z, c.camera.up.x, c.camera.up.y, c.camera.up.z); + glRotatef(cameraAngleY, 0.0f, 1.0f, 0.0f); + glRotatef(cameraAngle, 1.0f, 0.0f, 0.0f); // put drawing instructions here drawAxis(); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + glPolygonMode(GL_FRONT, GL_LINE); for (std::string model : c.models) { drawFile(model.data()); } @@ -73,16 +78,16 @@ void renderScene(void) { void processSpecialKeys(int key, int xx, int yy) { switch (key) { case GLUT_KEY_LEFT: - cameraAngle -= 0.1f; + cameraAngle -= 1.0f; break; case GLUT_KEY_RIGHT: - cameraAngle += 0.1f; + cameraAngle += 1.0f; break; case GLUT_KEY_UP: - cameraAngleY += 0.1f; + cameraAngleY += 1.0f; break; case GLUT_KEY_DOWN: - cameraAngleY -= 0.1f; + cameraAngleY -= 1.0f; break; default: break;