From: Ash Tyndall Date: Sat, 22 Oct 2011 05:14:52 +0000 (+0800) Subject: (no commit message) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=39d7272ede4e1ad75c15c9b7c4394e833df4591b;p=atyndall%2Fcits2231.git --- diff --git a/globals.h b/globals.h index 5dd4300..fe6d362 100644 --- a/globals.h +++ b/globals.h @@ -13,6 +13,10 @@ #define NTEXTURE 30 // The number of textures (in the models-textures dir) #define MAXOBJECTS 256 +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + // Meshes and textures arrays extern mesh* meshes[]; extern texture* textures[]; diff --git a/scene.c b/scene.c index 0834fa2..5dd48fd 100644 --- a/scene.c +++ b/scene.c @@ -307,10 +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); // float arc = arctan() - sceneObjs[curObject].x += diffx * sin(rotate*camRotateFactor) * 0.3; - sceneObjs[curObject].z += diffx * cos(rotate*camRotateFactor) * 0.3; + 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