From 39d7272ede4e1ad75c15c9b7c4394e833df4591b Mon Sep 17 00:00:00 2001 From: Ash Tyndall Date: Sat, 22 Oct 2011 13:14:52 +0800 Subject: [PATCH] --- globals.h | 4 ++++ scene.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) 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 -- 2.20.1