X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=450d16019e17ca86246a533feee76067804534df;hp=3ffe29f0c5dd883bf2fb936bd144411d23fbe9c0;hb=122af2fd7820eda3af7a3b1dea9e2368ef3fca23;hpb=a1e8cc05bcd4c196af65e62a757a7a8fdc06ace7 diff --git a/scene.c b/scene.c index 3ffe29f..450d160 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 @@ -502,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); @@ -514,20 +514,8 @@ int main(int argc, char **argv) { glutMotionFunc(motion); makeMenu(); - initializeLights(); - - /* Initial light 0 position. */ - lightObjs[0].position[0] = 4; - lightObjs[0].position[1] = 5; - lightObjs[0].position[2] = 6; - lightObjs[0].position[3] = 0.0; - - /* Initial light 1 position. */ - lightObjs[1].position[0] = -4; - lightObjs[1].position[1] = 5; - lightObjs[1].position[2] = -6; - lightObjs[1].position[3] = 0.0; + initializeState(); glutMainLoop(); } \ No newline at end of file