X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=7ce67e4394c6473846a68dcf611830cb395ed59e;hp=a7965438f5cff2e1a6588be47718743663f9da32;hb=9ab79af89d0b03214e2455e8541a949dd47ef73b;hpb=66ac3dee15c36c09cb7cb49ffec82640f8ea500a diff --git a/scene.c b/scene.c index a796543..7ce67e4 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,16 +295,16 @@ void display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); gluLookAt( - 0.0, 0.0, 30.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 */ + 0.0, 1.0, 0.0 /* up is in postivie Y direction */ ); glTranslatef(camx, camy, camz); // **NOTE: Currently this rotation function is all that moves the camera off // the flat surface. Need to integrate function into gluLookAt - glRotatef(50.0, 1.0, 0.0, 0.0); + glRotatef(rot, 1.0, 0.0, 0.0); /* Reposition the light source. */ lightPosition[0] = 12*cos(lightAngle); @@ -310,7 +316,7 @@ void display() { /* Perform scene rotations based on user mouse input. */ glRotatef(angle, 0.0, 1.0, 0.0); - //glRotatef(angle2, 1.0, 0.0, 0.0); **NOTE: Only one degree of freedom + glRotatef(angle2, 1.0, 0.0, 0.0); //**NOTE: Only one degree of freedom glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); @@ -322,7 +328,7 @@ void display() { glPushMatrix(); glTranslatef(0.0, 1.0, 0.0); // **NOTE: Teapot does not rest on surface glColor3f(0.5, 0.5, 0.5); - glutSolidTeapot(1); + glutSolidTeapot(25); glPopMatrix(); // Draw a white ball over the light source