X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=scene.c;h=78bfefd9a9cd3db6a7b9b4d5b9fb935d62aa07e2;hb=f35856ff3c184a948587637fd43206c901032426;hp=42b717c80db85090045f8569f37827090888ced8;hpb=df4a1058cbb4a92922dd61c514c827392ba1330e;p=atyndall%2Fcits2231.git diff --git a/scene.c b/scene.c index 42b717c..78bfefd 100644 --- a/scene.c +++ b/scene.c @@ -347,19 +347,24 @@ void motion(int x, int y) { break; case STATE_LIGHT_1_MOVE: - case STATE_LIGHT_2_MOVE:; + case STATE_LIGHT_2_MOVE: + ; // Semi-colon required to allow variable declaration below int i = 0; if ( manipulateState == STATE_LIGHT_2_MOVE ) i = 1; 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 + // **NOTE: Currently not implemented + // h: up/down + lightObjs[i].position[1] -= diffy * updownFactor; } break; @@ -497,7 +502,7 @@ int main(int argc, char **argv) { glDepthRange(0,1); glEnable(GL_DEPTH_TEST); // Enables Depth Testing glDepthFunc(GL_LEQUAL); // the type - glEnable(GL_NORMALIZE); + glEnable(GL_CULL_FACE); glLineWidth(2.0); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);