X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=d794a0f1976ffd061a33b679e98a4053977bf932;hp=2a452b073d8036f545e16ec44c2465d3a17c2e6c;hb=4907cd758a8f2d227b76fb82e557487b1197d0be;hpb=c0ede11eba8b0b5ebfd1a177a630a5d33cc0842b diff --git a/scene.c b/scene.c index 2a452b0..d794a0f 100644 --- a/scene.c +++ b/scene.c @@ -112,6 +112,7 @@ void processLightEvents(int id) { void processObjectEvents(int id) { // **NOTE: For the testing phase, only have the teapot addSceneObject(id); + glutPostRedisplay(); } /** @@ -384,18 +385,18 @@ void display() { drawFloor(); // Draw sceneObjs array - glPushMatrix(); - for ( int i = 0; i < nObjects; i++ ) { + for ( int i = 0; i < nObjects; i++ ) { + glPushMatrix(); SceneObject so = sceneObjs[i]; // Apply rotation vector - vector* rv = so.rotation.vect; - printf("%d, %d, %d\n", *rv[0], *rv[1], *rv[2]); - /* glRotatef(so.rotation.parameter, *rv[0], *rv[1], *rv[2]); + GLfloat* rv = &so.rotation.vector; + printf("%f, %f, %f\n", rv[0], rv[1], rv[2]); + glRotatef(so.rotation.amount, rv[0], rv[1], rv[2]); // Apply scaling vector - vector* sv = so.scale; - glScalef(*sv[0], *sv[1], *sv[2]); + GLfloat* sv = &so.scale; + glScalef(sv[0], sv[1], sv[2]); // Apply translation vector glTranslatef(so.x, so.y, so.z); @@ -406,7 +407,7 @@ void display() { glBindTexture(GL_TEXTURE_2D, so.texture); } else { glBindTexture(GL_TEXTURE_2D, 0); - }*/ + } // Draw actual object if ( so.mesh > 0 ) { @@ -419,8 +420,9 @@ void display() { } glBindTexture(GL_TEXTURE_2D, 0); - } - glPopMatrix(); + glPopMatrix(); + } + // Draw a white ball over the light source glPushMatrix();