diff options
author | taw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5> | 2008-05-16 00:24:24 +0000 |
---|---|---|
committer | taw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5> | 2008-05-16 00:24:24 +0000 |
commit | 096e588e4f2e93e51a2791258f3e6c4a7f7a78ae (patch) | |
tree | 351056099359cfc26e3db18f81c6ca058b8a3a71 /src | |
parent | 0ff31a9a69e4b1bd781202b9cdcde8a9a7c4e7f5 (diff) |
Tweak physical parameters
Remove old code
git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@18 84d2e878-0bd5-11dd-ad15-13eda11d74c5
Diffstat (limited to 'src')
-rw-r--r-- | src/physics.c | 8 | ||||
-rw-r--r-- | src/render.c | 85 |
2 files changed, 5 insertions, 88 deletions
diff --git a/src/physics.c b/src/physics.c index 4c1ac86..3d860df 100644 --- a/src/physics.c +++ b/src/physics.c @@ -25,19 +25,19 @@ #define GRAVITY (9.81e-6) /* Acceleration due to booster rocket, metres per ms per ms */ -#define THRUST (GRAVITY*2) +#define THRUST (GRAVITY*1.5) /* Acceleration due to forwards/backwards thrusters, m per ms per ms */ -#define FTHRUST (GRAVITY*0.5) +#define FTHRUST (GRAVITY*0.2) /* Air friction in (m per ms per ms) per (m per ms) */ -#define FRICTION 0.0008 +#define FRICTION 0.001 /* Lander craft turning speed in radians per ms per ms */ #define YAWTHRUST (M_PI/3000000) /* Conversion factor between friction and 'yawthrust' */ -#define TORQUE 1 +#define TORQUE 3 static void physics_process(ModelInstance *obj, Uint32 dt) { diff --git a/src/render.c b/src/render.c index ed28be2..23fde64 100644 --- a/src/render.c +++ b/src/render.c @@ -192,82 +192,6 @@ static int render_model_instance_draw(ModelInstance *instance, Uint32 t, RenderC } -#if 0 -static void render_configure_light(int *ilightp, Light light, Room *room, Game *game) { - - GLfloat x, y, z; - int ilight; - - GLfloat pos[4]; - GLfloat diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; - GLfloat specular[] = { 1.0, 1.0, 1.0, 1.0 }; - - ilight = *ilightp; - - x = room->rx - game->cur_room_x; - y = room->ry - game->cur_room_y; - z = room->rz - game->cur_room_z; - glPushMatrix(); - glTranslatef(10.0*x, 10.0*y, 10.0*z); - - pos[0] = light.x; - pos[1] = light.y; - pos[2] = light.z; - pos[3] = 1.0; - - if ( ilight < GL_MAX_LIGHTS ) { - glLightfv(GL_LIGHT0+ilight, GL_POSITION, pos); - glLightfv(GL_LIGHT0+ilight, GL_DIFFUSE, diffuse); - glLightfv(GL_LIGHT0+ilight, GL_SPECULAR, specular); - glLightf(GL_LIGHT0+ilight, GL_LINEAR_ATTENUATION, 0.01); - glEnable(GL_LIGHT0+ilight); - ilight++; - } - - glPopMatrix(); - - *ilightp = ilight; - -} - -static void render_setup_lighting(Game *game, Room *room_current) { - - int i, ilight; - GLfloat ambient[4]; - - /* Start with a blackout */ - for ( ilight=0; ilight<GL_MAX_LIGHTS; ilight++ ) { - glDisable(GL_LIGHT0+ilight); - } - ilight = 0; - - /* Lights within this room */ - for ( i=0; i<room_current->num_lights; i++ ) { - render_configure_light(&ilight, room_current->lights[i], room_current, game); - } - - /* Lights in rooms connected to this one */ - for ( i=0; i<room_current->num_connected; i++ ) { - - Room *room; - int j; - - room = game_find_room(game, room_current->connected[i].rx, room_current->connected[i].ry, room_current->connected[i].rz); - if ( room == NULL ) continue; /* Shouldn't happen... */ - - for ( j=0; j<room->num_lights; j++ ) { - render_configure_light(&ilight, room->lights[j], room, game); - } - - } - - ambient[0] = 0.3; ambient[1] = 0.3; ambient[2] = 0.3; ambient[3] = 1.0; - //ambient[0] = 1.0; ambient[1] = 1.0; ambient[2] = 1.0; ambient[3] = 1.0; - glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient); - -} -#endif - static void render_draw_line(GLfloat x1, GLfloat y1, GLfloat z1, GLfloat x2, GLfloat y2, GLfloat z2) { GLfloat red[] = {1.0, 0.0, 0.0, 1.0}; @@ -299,13 +223,6 @@ void render_draw(Game *game) { game->lander->x, game->lander->y, game->lander->z, sqrtf(2.0)*sinf(game->lander->yaw)*sinf(game->view_angle), sqrtf(2.0)*cosf(game->lander->yaw)*sinf(game->view_angle), sqrtf(2.0)*cosf(game->view_angle)); - //gluLookAt(game->lander->x-(1.5*sinf(game->lander->yaw)), - // game->lander->y-(1.5*cosf(game->lander->yaw)), 1.5+game->lander->z, - // game->lander->x, game->lander->y, game->lander->z, - // sqrt(2.0)*sinf(game->lander->yaw), sqrtf(2.0)*cosf(game->lander->yaw), sqrtf(2.0)); - //gluLookAt(0.0, -250.0, -495.0+250.0, - // 0.0, 0.0, -495.0, - // 0.0, sqrtf(2.0), sqrtf(2.0)); GLfloat pos[] = {-1.0, -0.8, 1.3, 0.0}; GLfloat ambient[4]; @@ -351,8 +268,8 @@ void render_draw(Game *game) { SDL_GL_SwapBuffers(); - game->render->frames++; /* Calculate FPS every half a second */ + game->render->frames++; if ( t - game->render->t_fps > 500 ) { game->render->fps = (500*game->render->frames) / (t - game->render->t_fps); game->render->t_fps = t; |