(no commit message)
[atyndall/cits2231.git] / scene.c
diff --git a/scene.c b/scene.c
index b02b4f1..08daa01 100644 (file)
--- a/scene.c
+++ b/scene.c
@@ -307,9 +307,11 @@ void motion(int x, int y) {
         // w: left/right, h: near/far\r
 \r
         // **NOTE: Currently a work in progress, does not work correctly\r
+        float angler = 2 * M_PI * ( (rotate*camRotateFactor)/360.0 );\r
         printf("cam angle: %f\n", rotate*camRotateFactor);\r
-        sceneObjs[curObject].x += diffx * sin(rotate*camRotateFactor);\r
-        sceneObjs[curObject].z += diffx * cos(rotate*camRotateFactor);\r
+       // float arc = arctan()\r
+        sceneObjs[curObject].x += diffx * cos(angler) * 0.3;\r
+        sceneObjs[curObject].z += diffx * sin(angler) * 0.3;\r
 \r
       } else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) {\r
         // w: big/small\r
@@ -426,6 +428,9 @@ void display() {
       glPushMatrix();\r
         SceneObject so = sceneObjs[i];\r
 \r
+        // Apply translation vector\r
+        glTranslatef(so.x, so.y, so.z);\r
+\r
         // Apply independant rotation vectors\r
         glRotatef(so.rotation.x, 1.0, 0.0, 0.0);\r
         glRotatef(so.rotation.y, 0.0, 1.0, 0.0);\r
@@ -434,9 +439,6 @@ void display() {
         // Apply scaling vector\r
         glScalef(so.scale[0], so.scale[1], so.scale[2]);\r
 \r
-        // Apply translation vector\r
-        glTranslatef(so.x, so.y, so.z);\r
-\r
         // Apply texture\r
         if ( so.texture.id > 0 ) {\r
           getTexture(so.texture.id);\r
@@ -461,7 +463,6 @@ void display() {
         glBindTexture(GL_TEXTURE_2D, 0);\r
       glPopMatrix();\r
     }\r
-    \r
 \r
     // Draw a white ball over the light sources\r
     glDisable(GL_LIGHTING);\r
@@ -530,8 +531,8 @@ int main(int argc, char **argv) {
 \r
   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);\r
 \r
-  glutInitWindowSize(500, 500);\r
-  glutCreateWindow("Scene Editor");\r
+  glutInitWindowSize(width, height);\r
+  glutCreateWindow("Scene Editor - Ashley Tyndall (20915779), Jenna de la Harpe (20367932)");\r
 \r
   glShadeModel(GL_SMOOTH); // Enables Smooth Shading\r
   glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background\r

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