(no commit message)
authorAsh Tyndall <[email protected]>
Sat, 22 Oct 2011 07:30:02 +0000 (15:30 +0800)
committerAsh Tyndall <[email protected]>
Sat, 22 Oct 2011 07:30:02 +0000 (15:30 +0800)
helper.c
helper.h
scene.c

index 34667ec..ced1889 100644 (file)
--- a/helper.c
+++ b/helper.c
@@ -363,4 +363,24 @@ void updateLights() {
   }
 
   glEnable(GL_LIGHTING);
   }
 
   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
 }
\ No newline at end of file
index 8c55595..1f2ef90 100644 (file)
--- a/helper.h
+++ b/helper.h
@@ -29,4 +29,6 @@ int addSceneObject(int id);
 void initializeLights();
 void updateLights();
 
 void initializeLights();
 void updateLights();
 
+void initializeState();
+
 #endif /* HELPER_H */
 #endif /* HELPER_H */
diff --git a/scene.c b/scene.c
index 78bfefd..450d160 100644 (file)
--- a/scene.c
+++ b/scene.c
@@ -514,20 +514,8 @@ int main(int argc, char **argv) {
   glutMotionFunc(motion);\r
 \r
   makeMenu();\r
   glutMotionFunc(motion);\r
 \r
   makeMenu();\r
-\r
   initializeLights();\r
   initializeLights();\r
-\r
-  /* Initial light 0 position. */\r
-  lightObjs[0].position[0] = 4;\r
-  lightObjs[0].position[1] = 5;\r
-  lightObjs[0].position[2] = 6;\r
-  lightObjs[0].position[3] = 0.0;\r
-\r
-  /* Initial light 1 position. */\r
-  lightObjs[1].position[0] = -4;\r
-  lightObjs[1].position[1] = 5;\r
-  lightObjs[1].position[2] = -6;\r
-  lightObjs[1].position[3] = 0.0;\r
+  initializeState();\r
 \r
   glutMainLoop();\r
 }
\ No newline at end of file
 \r
   glutMainLoop();\r
 }
\ No newline at end of file

UCC git Repository :: git.ucc.asn.au