X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=scene.c;h=34b7462dd44e86a1293acbd6d513f6b09afe4c67;hb=892a5bee9691e9566a5cf6b996f55c0b6ab14747;hp=a529c62e19f25359fbe2a4b95800aeb5434c619d;hpb=ea48dd7a038f3648d49808c3f9444ad6f636ba93;p=atyndall%2Fcits2231.git diff --git a/scene.c b/scene.c index a529c62..34b7462 100644 --- a/scene.c +++ b/scene.c @@ -256,8 +256,8 @@ void keyboard(unsigned char key, int x, int y) { */ void motion(int x, int y) { if (moving) { - zoomFactor += (x - startx); - rotateFactor += (y - starty); + zoomFactor += (y - starty); + rotateFactor += (x - startx); startx = x; starty = y; glutPostRedisplay(); @@ -298,13 +298,18 @@ void display() { glMatrixMode(GL_MODELVIEW); glLoadIdentity(); + GLfloat zcoord = 5.0 + (zoomFactor*0.2); + if ( zcoord < 0.0 ) { + zcoord = 0.0; + } + gluLookAt( - 0.0, 0.0, 5.0 + (zoomFactor*0.2), /* eye is at (x,y,z) */ + 0.0, 0.0, zcoord, /* 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 */ ); - glRotatef(75.0, 1.0, 0.0, 0.0); + glRotatef(50.0, 1.0, 0.0, 0.0); /* Reposition the light source. */ lightPosition[0] = 12*cos(lightAngle); @@ -319,7 +324,7 @@ void display() { glPushMatrix(); /* Perform scene rotations based on user mouse/keyboard input. */ - glRotatef(rotateFactor*0.2, 0.0, 1.0, 0.0); + glRotatef(rotateFactor*0.5, 0.0, 1.0, 0.0); //glTranslatef(camx, camy, camz); //glRotatef(rot, 1.0, 0.0, 0.0);