(no commit message)
authorAsh Tyndall <[email protected]>
Fri, 21 Oct 2011 08:44:13 +0000 (16:44 +0800)
committerAsh Tyndall <[email protected]>
Fri, 21 Oct 2011 08:44:13 +0000 (16:44 +0800)
helper.c
helper.h
scene.c
types.h

index b13e8f9..68907c8 100644 (file)
--- a/helper.c
+++ b/helper.c
@@ -321,4 +321,21 @@ void drawAxisLines() {
   glDisable(GL_BLEND);
   glEnable(GL_LIGHTING);
   glEnable(GL_TEXTURE_2D);
+}
+
+void addSceneObject(int id) {
+  // **NOTE: Currently only adds the teapot
+
+  nObjects += 1; // New object in scene
+
+  sceneObjs[nObjects].mesh = -1;
+  sceneObjs[nObjects].texture = -1;
+  sceneObjs[nObjects].x = 0;
+  sceneObjs[nObjects].y = 0;
+  sceneObjs[nObjects].z = 0;
+
+  sceneObjs[nObjects].scale = (vector*)calloc( 3, sizeof(vector[0]) );
+
+  sceneObjs[nObjects].rotation.parameter = 0;
+  sceneObjs[nObjects].rotation.vect = (vector*)calloc( 3, sizeof(vector[0]) );
 }
\ No newline at end of file
index 0ed5d21..f6d86c8 100644 (file)
--- a/helper.h
+++ b/helper.h
@@ -24,4 +24,6 @@ void drawSquare(int recurseLevel, float x1, float z1, float x2, float z2);
 void drawFloor();
 void drawAxisLines();
 
+void addSceneObject(int id);
+
 #endif /* HELPER_H */
diff --git a/scene.c b/scene.c
index ca09d1d..07824dd 100644 (file)
--- a/scene.c
+++ b/scene.c
@@ -113,7 +113,8 @@ void processLightEvents(int id) {
  * @param id ID of object selected\r
  */\r
 void processObjectEvents(int id) {\r
-\r
+  // **NOTE: For the testing phase, only have the teapot\r
+  addSceneObject(id);\r
 }\r
 \r
 /**\r
@@ -407,7 +408,7 @@ void init() {
   glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, direction0);\r
 \r
   //glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 90.0);\r
-  glLighti(GL_LIGHT0, GL_SPOT_EXPONENT,100);\r
+  //glLighti(GL_LIGHT0, GL_SPOT_EXPONENT,100);\r
 \r
   glLightfv(GL_LIGHT1, GL_AMBIENT, ambient1);\r
   glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse1);\r
@@ -415,7 +416,7 @@ void init() {
   glLightfv(GL_LIGHT1, GL_SPOT_DIRECTION, direction1);\r
 \r
   //glLightf(GL_LIGHT1, GL_SPOT_CUTOFF, 90.0);\r
-  glLighti(GL_LIGHT1, GL_SPOT_EXPONENT,100);\r
+  //glLighti(GL_LIGHT1, GL_SPOT_EXPONENT,100);\r
 \r
   glLightModelfv(GL_LIGHT_MODEL_AMBIENT, glightmodel);\r
   glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);\r
diff --git a/types.h b/types.h
index 573418d..197eb03 100644 (file)
--- a/types.h
+++ b/types.h
@@ -34,10 +34,20 @@ typedef struct {
     GLubyte *rgbData;   // Array of bytes with the colour data for the texture
 } texture;
 
+
+typedef GLfloat vector[3]; // Vector datatyle
+
+typedef struct {
+    GLfloat parameter;  // Transform amount
+    vector* vect;        // Transform vector
+} transform;
+
 typedef struct {
-    // You'll need to add scale, rotation, material, mesh number, etc.,
-    // to this structure
-    float x,y,z;
+    int mesh;           // Mesh index number
+    int texture;        // Texture index number
+    float x,y,z;        // Scene position
+    vector* scale;       // Scale vector
+    transform rotation; // Rotation transformation
 } SceneObject;
 
 // Menu enum

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