X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=scene.c;h=5dd48fdfde6d22b7f31f02a392a4a32103cec614;hb=39d7272ede4e1ad75c15c9b7c4394e833df4591b;hp=b02b4f1d1dfdf3c07d8a4c388f2d02bc0fc8d7e3;hpb=faf8b6a77994ac32ffff814c08fe59e70431f5d7;p=atyndall%2Fcits2231.git diff --git a/scene.c b/scene.c index b02b4f1..5dd48fd 100644 --- a/scene.c +++ b/scene.c @@ -307,9 +307,11 @@ void motion(int x, int y) { // w: left/right, h: near/far // **NOTE: Currently a work in progress, does not work correctly + float angler = 2*M_PI*((rotate*camRotateFactor)/360); printf("cam angle: %f\n", rotate*camRotateFactor); - sceneObjs[curObject].x += diffx * sin(rotate*camRotateFactor); - sceneObjs[curObject].z += diffx * cos(rotate*camRotateFactor); + // float arc = arctan() + sceneObjs[curObject].x += diffx * sin(angler) * 0.3; + sceneObjs[curObject].z += diffx * cos(angler) * 0.3; } else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) { // w: big/small @@ -426,6 +428,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 +439,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 +463,6 @@ void display() { glBindTexture(GL_TEXTURE_2D, 0); glPopMatrix(); } - // Draw a white ball over the light sources glDisable(GL_LIGHTING); @@ -530,8 +531,8 @@ int main(int argc, char **argv) { glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); - glutInitWindowSize(500, 500); - glutCreateWindow("Scene Editor"); + glutInitWindowSize(width, height); + glutCreateWindow("Scene Editor - Ashley Tyndall (20915779), Jenna de la Harpe (20367932)"); glShadeModel(GL_SMOOTH); // Enables Smooth Shading glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background