X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=scene.c;h=6cf7cf5becd5856ffb84e550fca0b67457eef299;hb=fdc6eb90410f851b32b6d84135791c5df51393d9;hp=a1ff085702f745f036240cac9d048859a5ed76dd;hpb=63e9aefdfc12daef518074efa3021b7b9a0f5d38;p=atyndall%2Fcits2231.git diff --git a/scene.c b/scene.c index a1ff085..6cf7cf5 100644 --- a/scene.c +++ b/scene.c @@ -302,9 +302,18 @@ void motion(int x, int y) { //so.x, so.y, so.z if ( buttonSelected == GLUT_LEFT_BUTTON ) { // w: left/right, h: near/far - sceneObjs[curObject].x += (x - startx); + //sceneObjs[curObject].x += (x - startx)*leftrightFactor; } else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) { // w: big/small, h: up/down + + // For big/small scaling, we map negative numbers to 0->1 and positive numbers to 1->inf + float diff = (x - startx); + float scaling = ( diff + (float)height/bigsmallFactor ) / ( (float)height/bigsmallFactor ); + + sceneObjs[curObject].scale[0] *= scaling; + sceneObjs[curObject].scale[1] *= scaling; + sceneObjs[curObject].scale[2] *= scaling; + printf("Diff is %f, Scaling by %f on all axii, 1/map is %f\n", diff, sceneObjs[curObject].scale[0], scaling); } startx = x;