(no commit message)
[atyndall/cits2231.git] / scene.c
diff --git a/scene.c b/scene.c
index ca81321..d9a4ea3 100644 (file)
--- a/scene.c
+++ b/scene.c
@@ -206,16 +206,6 @@ void mouse(int button, int state, int x, int y) {
       moving = 0;\r
     }\r
   }\r
-  if (button == GLUT_MIDDLE_BUTTON) {\r
-    if (state == GLUT_DOWN) {\r
-      lightMoving = 1;\r
-      lightStartX = x;\r
-      lightStartY = y;\r
-    }\r
-    if (state == GLUT_UP) {\r
-      lightMoving = 0;\r
-    }\r
-  }\r
 }\r
 \r
 /**\r
@@ -266,8 +256,8 @@ void keyboard(unsigned char key, int x, int y) {
  */\r
 void motion(int x, int y) {\r
   if (moving) {\r
-    angle = angle + (x - startx);\r
-    angle2 = angle2 + (y - starty);\r
+    zoomFactor += (y - starty);\r
+    rotateFactor += (x - startx);\r
     startx = x;\r
     starty = y;\r
     glutPostRedisplay();\r
@@ -309,7 +299,7 @@ void display() {
   glLoadIdentity();\r
 \r
   gluLookAt(\r
-    0.0,  0.0,  5.0,  /* eye is at (x,y,z) */\r
+    0.0,  0.0,  5.0 + (zoomFactor*0.2),  /* eye is at (x,y,z) */\r
     0.0,  0.0,  0.0,  /* center is at (x,y,z) */\r
     0.0,  1.0,  0.0   /* up is in postivie Y direction */\r
     );\r
@@ -322,13 +312,16 @@ void display() {
   lightPosition[2] = 12*sin(lightAngle);\r
   lightPosition[3] = 0.0;\r
 \r
+\r
+    //glRotatef(angle, 0.0, 1.0, 0.0);\r
+   // glRotatef(angle2, 1.0, 0.0, 0.0);\r
+\r
   glPushMatrix();\r
 \r
     /* Perform scene rotations based on user mouse/keyboard input. */\r
-    glRotatef(angle, 0.0, 1.0, 0.0);\r
-    glRotatef(angle2, 1.0, 0.0, 0.0);\r
-    glTranslatef(camx, camy, camz);\r
-    glRotatef(rot, 1.0, 0.0, 0.0);\r
+    glRotatef(rotateFactor*0.5, 0.0, 1.0, 0.0);\r
+    //glTranslatef(camx, camy, camz);\r
+    //glRotatef(rot, 1.0, 0.0, 0.0);\r
 \r
     glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);\r
 \r
@@ -341,7 +334,7 @@ void display() {
       glTranslatef(0.0, 0.5, 0.0); // **NOTE: Teapot currently does not rest on surface\r
       glColor3f(0.0, 0.0, 0.0);\r
       glFrontFace(GL_CW);\r
-        glutSolidTeapot(1);\r
+      glutSolidTeapot(1);\r
       glFrontFace(GL_CCW);\r
     glPopMatrix();\r
 \r

UCC git Repository :: git.ucc.asn.au