(no commit message)
[atyndall/cits2231.git] / scene.c
diff --git a/scene.c b/scene.c
index 642fdcd..c024bf1 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,19 +256,12 @@ 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 += (x - startx);\r
+    rotateFactor += (y - starty);\r
     startx = x;\r
     starty = y;\r
     glutPostRedisplay();\r
   }\r
-  if (lightMoving) {\r
-    lightAngle += (x - lightStartX)/40.0;\r
-    lightHeight += (lightStartY - y)/20.0;\r
-    lightStartX = x;\r
-    lightStartY = y;\r
-    glutPostRedisplay();\r
-  }\r
 }\r
 \r
 /**\r
@@ -309,26 +292,19 @@ 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,  /* 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
 \r
   glRotatef(75.0, 1.0, 0.0, 0.0);\r
 \r
-  /* Reposition the light source. */\r
-  lightPosition[0] = 12*cos(lightAngle);\r
-  lightPosition[1] = lightHeight;\r
-  lightPosition[2] = 12*sin(lightAngle);\r
-  lightPosition[3] = 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.0, 0.0, 1.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

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