(no commit message)
authorAsh Tyndall <[email protected]>
Sat, 22 Oct 2011 01:33:17 +0000 (09:33 +0800)
committerAsh Tyndall <[email protected]>
Sat, 22 Oct 2011 01:33:17 +0000 (09:33 +0800)
globals.c
scene.c

index a08eee1..719d6ae 100644 (file)
--- a/globals.c
+++ b/globals.c
@@ -92,7 +92,7 @@ GLfloat emission[] = {0.0, 0.3, 0.3, 1.0};
 /* Zoom and rotate tracking */
 GLfloat zoom = 0.0, rotate = 0.0, camAngle = 40.0;
 GLfloat zoomFactor = 0.2, rotateFactor = 0.5, camAngleFactor = 0.5;
 /* Zoom and rotate tracking */
 GLfloat zoom = 0.0, rotate = 0.0, camAngle = 40.0;
 GLfloat zoomFactor = 0.2, rotateFactor = 0.5, camAngleFactor = 0.5;
-GLfloat leftrightFactor = 0.5, nearfarFactor = 0.5, bigsmallFactor = 0.2, updownFactor = 0.5;
+GLfloat leftrightFactor = 0.5, nearfarFactor = 0.5, bigsmallFactor = 0.05, updownFactor = 0.5;
 
 /* Beginning width, height */
 int width = 500, height = 500;
 
 /* Beginning width, height */
 int width = 500, height = 500;
diff --git a/scene.c b/scene.c
index 7d5456f..d73df53 100644 (file)
--- a/scene.c
+++ b/scene.c
@@ -305,7 +305,17 @@ void motion(int x, int y) {
         //sceneObjs[curObject].x += (x - startx)*leftrightFactor;\r
       } else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) {\r
         // w: big/small, h: up/down\r
         //sceneObjs[curObject].x += (x - startx)*leftrightFactor;\r
       } else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) {\r
         // w: big/small, h: up/down\r
-        float scaling = (y - starty);//*bigsmallFactor;\r
+\r
+        // For big/small scaling, we map negative numbers to 0->1 and positive numbers to 1->inf\r
+        float diff = (y - starty);\r
+        float scaling;\r
+\r
+        if ( scaling < 0 ) {\r
+          scaling = (x - -height)/(0 - -height);\r
+        } else {\r
+          scaling = diff;\r
+        }\r
+        \r
         printf("Scaling by %f on all axii\n", scaling);\r
         sceneObjs[curObject].scale[0] += scaling;\r
         sceneObjs[curObject].scale[1] += scaling;\r
         printf("Scaling by %f on all axii\n", scaling);\r
         sceneObjs[curObject].scale[0] += scaling;\r
         sceneObjs[curObject].scale[1] += scaling;\r

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