X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=scene.c;h=281f99f8f29cf903c31e076c2eb0275ce8d0613b;hb=2a9451d5c45eda1d68677b519784bd9756f72260;hp=eefeec1d5359f35fc00e76105bc8f3af1d486845;hpb=0bf9a194f13fd3e429d83da842d5107db8dbf967;p=atyndall%2Fcits2231.git diff --git a/scene.c b/scene.c index eefeec1..281f99f 100644 --- a/scene.c +++ b/scene.c @@ -308,6 +308,7 @@ void motion(int x, int y) { // **NOTE: Currently a work in progress, does not work correctly printf("cam angle: %f\n", rotate*camRotateFactor); + // float arc = arctan() sceneObjs[curObject].x += diffx * sin(rotate*camRotateFactor); sceneObjs[curObject].z += diffx * cos(rotate*camRotateFactor); @@ -412,7 +413,7 @@ void display() { glPushMatrix(); /* Perform scene rotations based on user mouse/keyboard input. */ - glRotatef(rotate*camRotateFactor, 0.0, 1.0, 0.0); + //glRotatef(rotate*camRotateFactor, 0.0, 1.0, 0.0); glTranslatef(camx, camy, camz); glRotatef(keyrot, 1.0, 0.0, 0.0); @@ -426,6 +427,9 @@ void display() { glPushMatrix(); SceneObject so = sceneObjs[i]; + // Apply translation vector + glTranslatef(so.x, so.y, so.z); + // Apply independant rotation vectors glRotatef(so.rotation.x, 1.0, 0.0, 0.0); glRotatef(so.rotation.y, 0.0, 1.0, 0.0); @@ -434,9 +438,6 @@ void display() { // Apply scaling vector glScalef(so.scale[0], so.scale[1], so.scale[2]); - // Apply translation vector - glTranslatef(so.x, so.y, so.z); - // Apply texture if ( so.texture.id > 0 ) { getTexture(so.texture.id); @@ -461,7 +462,6 @@ void display() { glBindTexture(GL_TEXTURE_2D, 0); glPopMatrix(); } - // Draw a white ball over the light sources glDisable(GL_LIGHTING);