X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=1654527fcb2cc554b304153043d7b0172c091b67;hp=e667b02e047a70d6c6ed33b540b44086e2ce783d;hb=bb84977df53fb16ba10eecb52b219071ff786126;hpb=b049bea0f179ce1373839add4960a19a979c682c diff --git a/scene.c b/scene.c index e667b02..1654527 100644 --- a/scene.c +++ b/scene.c @@ -255,8 +255,14 @@ void keyboard(unsigned char key, int x, int y) { case 'e': camy = camy - 1; break; + case 'z': + rot = rot + 1; + break; + case 'x': + rot = rot - 1; + break; } - printf("Camera is now at (%f, %f, %f)\n", camx, camy, camz); + printf("Camera is now at (%f, %f, %f), angle %f\n", camx, camy, camz, rot); glutPostRedisplay(); } @@ -289,7 +295,7 @@ void display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); gluLookAt( - 0.0, 100.0, 100.0, /* eye is at (x,y,z) */ + 100.0, 100.0, 100.0, /* eye is at (x,y,z) */ 0.0, 0.0, 0.0, /* center is at (x,y,z) */ 0.0, 1.0, 0.0 /* up is in postivie Y direction */ ); @@ -298,7 +304,7 @@ void display() { // **NOTE: Currently this rotation function is all that moves the camera off // the flat surface. Need to integrate function into gluLookAt - //glRotatef(30.0, 1.0, 0.0, 0.0); + glRotatef(rot, 1.0, 0.0, 0.0); /* Reposition the light source. */ lightPosition[0] = 12*cos(lightAngle);