X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=939594deb5ed37203bd2ed6621ce6b0999a1827d;hp=6d47393250a084c9a7075613fa8c04882d1cd8a1;hb=933954a445fd282f85c1cc9427fddc505422ec54;hpb=5e6a932345dfe95c3d2b289053b93abfb5c5d4fb diff --git a/scene.c b/scene.c index 6d47393..939594d 100644 --- a/scene.c +++ b/scene.c @@ -305,7 +305,18 @@ void motion(int x, int y) { //sceneObjs[curObject].x += (x - startx)*leftrightFactor; } else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) { // w: big/small, h: up/down - float scaling = (y - starty)*bigsmallFactor; + + // For big/small scaling, we map negative numbers to 0->1 and positive numbers to 1->inf + float diff = (y - starty); + float scaling; + + if ( diff < 0 ) { + scaling = (x - -height)/(0 - -height); + } else { + scaling = diff; + } + + printf("Diff is %f, Scaling by %f on all axii\n", diff, scaling); sceneObjs[curObject].scale[0] += scaling; sceneObjs[curObject].scale[1] += scaling; sceneObjs[curObject].scale[2] += scaling;