aboutsummaryrefslogtreecommitdiff
path: root/src/render.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/render.c')
-rw-r--r--src/render.c85
1 files changed, 1 insertions, 84 deletions
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;