X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=scene.c;h=77d2c108dc75dbdf1e1e7ea3ea58fcb96ef2f087;hb=47f587200c6be35f945d40d837a50d3c415c8588;hp=386586e549f2e1656f3f6d9a73095ad7a7ec90e5;hpb=d6176afd69975dd4fd1a474db49995b4066a8548;p=atyndall%2Fcits2231.git diff --git a/scene.c b/scene.c index 386586e..77d2c10 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,17 +385,15 @@ 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; - glRotatef(so.rotation.parameter, *rv[0], *rv[1], *rv[2]); + glRotatef(so.rotation.amount, so.rotation.vector[0], so.rotation.vector[1], so.rotation.vector[2]); // Apply scaling vector - vector* sv = so.scale; - glScalef(*sv[0], *sv[1], *sv[2]); + glScalef(so.scale[0], so.scale[1], so.scale[2]); // Apply translation vector glTranslatef(so.x, so.y, so.z); @@ -404,7 +403,6 @@ void display() { getTexture(so.texture); glBindTexture(GL_TEXTURE_2D, so.texture); } else { - getTexture(0); glBindTexture(GL_TEXTURE_2D, 0); } @@ -419,8 +417,9 @@ void display() { } glBindTexture(GL_TEXTURE_2D, 0); - } - glPopMatrix(); + glPopMatrix(); + } + // Draw a white ball over the light source glPushMatrix();