X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=d73df5364263dab880977e948e1f362a23f9c521;hp=a706c5e44d4f7c167f29174a6b75a175571460af;hb=521d3ab9808ad5d15a32a9470508b4c687304ae1;hpb=c721e772ebfd5bae455e30616551c654834767ca diff --git a/scene.c b/scene.c index a706c5e..d73df53 100644 --- a/scene.c +++ b/scene.c @@ -305,7 +305,17 @@ 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*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 ( scaling < 0 ) { + scaling = (x - -height)/(0 - -height); + } else { + scaling = diff; + } + printf("Scaling by %f on all axii\n", scaling); sceneObjs[curObject].scale[0] += scaling; sceneObjs[curObject].scale[1] += scaling;