From: Ash Tyndall Date: Sat, 22 Oct 2011 07:30:02 +0000 (+0800) Subject: (no commit message) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=122af2fd7820eda3af7a3b1dea9e2368ef3fca23;p=atyndall%2Fcits2231.git --- diff --git a/helper.c b/helper.c index 34667ec..ced1889 100644 --- a/helper.c +++ b/helper.c @@ -363,4 +363,24 @@ void updateLights() { } 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 = 3; } \ No newline at end of file diff --git a/helper.h b/helper.h index 8c55595..1f2ef90 100644 --- a/helper.h +++ b/helper.h @@ -29,4 +29,6 @@ int addSceneObject(int id); void initializeLights(); void updateLights(); +void initializeState(); + #endif /* HELPER_H */ diff --git a/scene.c b/scene.c index 78bfefd..450d160 100644 --- a/scene.c +++ b/scene.c @@ -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