X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=55b185623f5a2b8f6a46e9d6c735ed285a718bab;hp=78bfefd9a9cd3db6a7b9b4d5b9fb935d62aa07e2;hb=e167fee487eef79406a5baa2757a7262811b027b;hpb=f35856ff3c184a948587637fd43206c901032426 diff --git a/scene.c b/scene.c index 78bfefd..55b1856 100644 --- a/scene.c +++ b/scene.c @@ -216,66 +216,6 @@ void mouse(int button, int state, int x, int y) { } } -/** - * Keybord event handler - * w/s increase/decrease the z - * a/d increase/decrease the x - * q/e increase/decrease the y - * z/x increase/decrease the angle - * @param key Key pressed - * @param x x co-ordinate of mouse - * @param y y co-ordinate of mouse - */ -void keyboard(unsigned char key, int x, int y) { - switch(key) { - case 'w': - case 'W': - camz -= factor; - break; - case 'a': - case 'A': - camx -= factor; - break; - case 's': - case 'S': - camz += factor; - break; - case 'd': - case 'D': - camx += factor; - break; - case 'q': - case 'Q': - camy += factor; - break; - case 'e': - case 'E': - camy -= factor; - break; - case 'z': - case 'Z': - keyrot += factor; - break; - case 'x': - case 'X': - keyrot -= factor; - break; - case '=': - case '+': - factor += 0.1; - printf("Factor of change is now %f\n", factor); - break; - case '-': - case '_': - factor -= 0.1; - printf("Factor of change is now %f\n", factor); - break; - - } - printf("Camera is now at (%f, %f, %f), angle %f\n", camx, camy, camz, keyrot); - glutPostRedisplay(); -} - /** * Called when motion event occurs * @param x Mouse x position @@ -502,32 +442,19 @@ int main(int argc, char **argv) { glDepthRange(0,1); glEnable(GL_DEPTH_TEST); // Enables Depth Testing glDepthFunc(GL_LEQUAL); // the type - glEnable(GL_CULL_FACE); - glLineWidth(2.0); + //glEnable(GL_CULL_FACE); + glLineWidth(1.0); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glutReshapeFunc(windowReshape); glutDisplayFunc(display); glutMouseFunc(mouse); - glutKeyboardFunc(keyboard); glutMotionFunc(motion); makeMenu(); - initializeLights(); - - /* Initial light 0 position. */ - lightObjs[0].position[0] = 4; - lightObjs[0].position[1] = 5; - lightObjs[0].position[2] = 6; - lightObjs[0].position[3] = 0.0; - - /* Initial light 1 position. */ - lightObjs[1].position[0] = -4; - lightObjs[1].position[1] = 5; - lightObjs[1].position[2] = -6; - lightObjs[1].position[3] = 0.0; + initializeState(); glutMainLoop(); } \ No newline at end of file