From: Ash Tyndall Date: Sat, 22 Oct 2011 07:21:10 +0000 (+0800) Subject: (no commit message) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=f17147662a091d75d8ab9fb984722caf0e3067ae;p=atyndall%2Fcits2231.git --- diff --git a/globals.c b/globals.c index 0616875..10163a9 100644 --- a/globals.c +++ b/globals.c @@ -88,6 +88,7 @@ GLfloat zoom = 0.0, rotate = 0.0, camAngle = 40.0; GLfloat zoomFactor = 0.2, camRotateFactor = 0.5, camAngleFactor = 0.5; GLfloat leftrightFactor = 0.05, nearfarFactor = 0.1, bigsmallFactor = 0.6; GLfloat updownFactor = 0.03, rotateFactor = 0.8, texscaleFactor = 0.2; +GLfloat lleftrightFactor = 0.005, lnearfarFactor = 0.05; /* Beginning width, height */ int width = 700, height = 700; diff --git a/globals.h b/globals.h index 6ec54ba..c75caf7 100644 --- a/globals.h +++ b/globals.h @@ -86,6 +86,7 @@ extern GLfloat zoom, rotate, camAngle; extern GLfloat zoomFactor, camRotateFactor, camAngleFactor; extern GLfloat leftrightFactor, nearfarFactor, bigsmallFactor; extern GLfloat updownFactor, rotateFactor, texscaleFactor; +extern GLfloat lleftrightFactor, lnearfarFactor; /* Texture state tracking */ extern int currentGroundTexture, currentMeshTexture; diff --git a/scene.c b/scene.c index 3ffe29f..618c1ae 100644 --- a/scene.c +++ b/scene.c @@ -356,8 +356,8 @@ void motion(int x, int y) { if ( buttonSelected == GLUT_LEFT_BUTTON ) { // w: left/right, h: near/far float angler = 2 * M_PI * ( (rotate*camRotateFactor)/360.0 ); - lightObjs[i].position[0] += diffx * cos(angler) * leftrightFactor + diffy * cos(M_PI/2 + angler) * nearfarFactor; - lightObjs[i].position[2] += diffx * sin(angler) * leftrightFactor + diffy * sin(M_PI/2 + angler) * nearfarFactor; + lightObjs[i].position[0] += diffx * cos(angler) * lleftrightFactor + diffy * cos(M_PI/2 + angler) * lnearfarFactor; + lightObjs[i].position[2] += diffx * sin(angler) * lleftrightFactor + diffy * sin(M_PI/2 + angler) * lnearfarFactor; } else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) { // w: increase/decrease some light param