X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=helper.c;h=8135854e751bdd83c6c4f770ab6480ffa2a71e00;hp=5ebcc094ef6371b9b13d02cf4e35bab584b02ba5;hb=5b211bce232b1e75aa7cd3a08c533a8dd446f2fa;hpb=cc01320b8824eb601505dc5cdb101cfe8b7d1271 diff --git a/helper.c b/helper.c index 5ebcc09..8135854 100644 --- a/helper.c +++ b/helper.c @@ -351,15 +351,36 @@ void updateLights() { glLightf(GL_LIGHT0 + i, GL_SPOT_CUTOFF, lightObjs[i].cutoff); glLighti(GL_LIGHT0 + i, GL_SPOT_EXPONENT, (int)lightObjs[i].exponent ); + glEnable(GL_LIGHT0 + i); + // Draw light ball for light glPushMatrix(); - glColor3f(1.0, 1.0, 1.0); + glColor3f(0.0, 1.0, 1.0); glTranslatef(lightObjs[i].position[0], lightObjs[i].position[1], lightObjs[i].position[2]); - glutSolidSphere(lightBallSize, 20, 20); + glutSolidSphere(lightBallSize, 20, 20);; glPopMatrix(); - glEnable(GL_LIGHT0 + i); } glEnable(GL_LIGHTING); +} + +/** + * Sets variables to the state they are in to begin with. + */ +void initializeState() { + /* 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; + + /* Initial floor texture */ + currentGroundTexture = 5; } \ No newline at end of file