aboutsummaryrefslogtreecommitdiff
path: root/src/render.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/render.c')
-rw-r--r--src/render.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/render.c b/src/render.c
index 1bddac0..76821f4 100644
--- a/src/render.c
+++ b/src/render.c
@@ -228,7 +228,7 @@ static void render_placeholder_texture(RenderContext *r) {
}
-static int render_model_instance_draw(ModelInstance *instance, Uint32 t, RenderContext *r, int *nvert, GLfloat alpha) {
+static int render_model_instance_draw(ModelInstance *instance, RenderContext *r, Game *g, int *nvert, GLfloat alpha) {
int j;
Model *m;
@@ -255,7 +255,7 @@ static int render_model_instance_draw(ModelInstance *instance, Uint32 t, RenderC
if ( ((p->attribs & ATTRIB_PULSE) && !(p->attribs & ATTRIB_SWIRLY))
|| ((p->attribs & ATTRIB_SWIRLY) && !(r->fbos && r->shaders)) ) {
float s;
- s = fabsf(0.4*cosf(t * 0.001));
+ s = fabsf(0.4*cosf(g->time * 0.001));
GLfloat c[] = {s*p->col_r, s*p->col_g, s*p->col_b, 1.0};
glMaterialfv(GL_FRONT, GL_EMISSION, c);
glColor4f(0.3, 0.3, 0.3, alpha);
@@ -370,7 +370,7 @@ static void render_draw_line(GLfloat x1, GLfloat y1, GLfloat z1, GLfloat x2, GLf
}
-static void render_draw_stuff(Game *game, Uint32 t, GLfloat alpha) {
+static void render_draw_stuff(Game *game, GLfloat alpha) {
int i;
int nvert = 0;
@@ -398,7 +398,7 @@ static void render_draw_stuff(Game *game, Uint32 t, GLfloat alpha) {
z = room->rz - game->cur_room_z;
glPushMatrix();
glTranslatef(10.0*x, 10.0*y, 10.0*z);
- render_model_instance_draw(room->objects[j], t, game->render, &nvert, alpha);
+ render_model_instance_draw(room->objects[j], game->render, game, &nvert, alpha);
glPopMatrix();
}
@@ -566,7 +566,7 @@ static void render_draw_2d(RenderContext *r, Game *game) {
}
-void render_draw(Game *game, Uint32 t) {
+void render_draw(Game *game) {
RenderContext *r;
GLfloat amb[] = { 0.0, 0.0, 0.0, 1.0 };
@@ -591,15 +591,15 @@ void render_draw(Game *game, Uint32 t) {
GLfloat rrb = 0.0;
glUseProgram(r->swirly_program);
- shaderutils_setunf(r->swirly_program, "time", t);
+ shaderutils_setunf(r->swirly_program, "time", game->time);
shaderutils_setuni(r->swirly_program, "landed", game->lander->recharging);
if ( game->lander->recharging ) {
/* Fade in */
- rrb = fminf(((GLfloat)t-game->time_of_landing_event)/1500.0, 1.0);
+ rrb = fminf(((GLfloat)game->time-game->time_of_landing_event)/1500.0, 1.0);
shaderutils_setuni(r->swirly_program, "rechargeripple", 1);
- } else if ( game->time_of_landing_event - t < 750 ) {
+ } else if ( game->time_of_landing_event - game->time < 750 ) {
/* Fade out */
- rrb = fmaxf(1.0 - ((GLfloat)t-game->time_of_landing_event)/750.0, 0.0);
+ rrb = fmaxf(1.0 - ((GLfloat)game->time-game->time_of_landing_event)/750.0, 0.0);
shaderutils_setuni(r->swirly_program, "rechargeripple", 1);
} else {
shaderutils_setuni(r->swirly_program, "rechargeripple", 0);
@@ -664,7 +664,7 @@ void render_draw(Game *game, Uint32 t) {
render_setup_lighting(game);
amb[0] = 0.02; amb[1] = 0.02; amb[2] = 0.02;
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, amb);
- render_draw_stuff(game, t, 1.0);
+ render_draw_stuff(game, 1.0);
/* Draw the lander */
glEnable(GL_LIGHT2);
@@ -675,7 +675,7 @@ void render_draw(Game *game, Uint32 t) {
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
if ( r->shaders ) glUseProgram(r->fill_program);
- render_model_instance_draw(game->lander, t, r, NULL, 1.0);
+ render_model_instance_draw(game->lander, r, game, NULL, 1.0);
glPopClientAttrib();
if ( r->shaders ) glUseProgram(0);
render_draw_line(game->lander->x, game->lander->y, game->lander->z,
@@ -690,7 +690,7 @@ void render_draw(Game *game, Uint32 t) {
render_setup_lighting(game);
amb[0] = 0.1; amb[1] = 0.1; amb[2] = 0.1;
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, amb);
- render_draw_stuff(game, t, 0.5);
+ render_draw_stuff(game, 0.5);
glDisable(GL_POLYGON_OFFSET_FILL);
glFrontFace(GL_CCW);