From: Ash Tyndall Date: Thu, 20 Oct 2011 11:41:07 +0000 (+0800) Subject: (no commit message) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=bb84977df53fb16ba10eecb52b219071ff786126;p=atyndall%2Fcits2231.git --- diff --git a/globals.c b/globals.c index 03d2f6f..91fb87b 100644 --- a/globals.c +++ b/globals.c @@ -73,7 +73,7 @@ int drawFloorRecurse = 5; int floorSize = 200; /* Current camera x, y, z coords */ -GLfloat camx = 0.0, camy = 0.0, camz = 0.0; +GLfloat camx = 0.0, camy = 0.0, camz = 0.0, rot = 0.0; /* Light 0 parameters */ GLfloat diffuse0[] = {1.0, 1.0, 1.0, 1.0}; diff --git a/globals.h b/globals.h index d856c57..728bf6a 100644 --- a/globals.h +++ b/globals.h @@ -63,7 +63,7 @@ extern int drawFloorRecurse; extern int floorSize; /* Current camera position */ -extern GLfloat camx, camy, camz; +extern GLfloat camx, camy, camz, rot; /* Light 0 parameters */ extern GLfloat diffuse0[]; diff --git a/scene.c b/scene.c index d40ef09..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(); } @@ -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);