aboutsummaryrefslogtreecommitdiff
path: root/src/render.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/render.c')
-rw-r--r--src/render.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/render.c b/src/render.c
index 044dd42..e18b3a6 100644
--- a/src/render.c
+++ b/src/render.c
@@ -643,11 +643,28 @@ void render_draw(Game *game, Uint32 t) {
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, r->swirly_fbo);
glClear(GL_COLOR_BUFFER_BIT);
glViewport(0, 0, 64, 64);
- if ( r->shaders ) glUseProgram(r->swirly_program);
- if ( r->shaders ) glUniform1f(glGetUniformLocation(game->render->swirly_program, "time"), t);
- if ( r->shaders ) glUniform1i(glGetUniformLocation(game->render->swirly_program, "landed"), game->lander->recharging);
- if ( r->shaders ) glUniform1i(glGetUniformLocation(game->render->swirly_program, "rechargeripple"), game->lander->recharging);
- if ( r->shaders ) glUniform2f(glGetUniformLocation(game->render->swirly_program, "lander"), game->platform_rel_x, game->platform_rel_y);
+ if ( r->shaders ) {
+
+ GLfloat rrb = 0.0;
+
+ glUseProgram(r->swirly_program);
+ glUniform1f(glGetUniformLocation(game->render->swirly_program, "time"), t);
+ glUniform1i(glGetUniformLocation(game->render->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);
+ glUniform1i(glGetUniformLocation(game->render->swirly_program, "rechargeripple"), 1);
+ } else if ( game->time_of_landing_event - t < 750 ) {
+ /* Fade out */
+ rrb = fmaxf(1.0 - ((GLfloat)t-game->time_of_landing_event)/750.0, 0.0);
+ glUniform1i(glGetUniformLocation(game->render->swirly_program, "rechargeripple"), 1);
+ } else {
+ glUniform1i(glGetUniformLocation(game->render->swirly_program, "rechargeripple"), 0);
+ }
+ glUniform1f(glGetUniformLocation(game->render->swirly_program, "rrb"), rrb);
+ glUniform2f(glGetUniformLocation(game->render->swirly_program, "lander"), game->platform_rel_x, game->platform_rel_y);
+
+ } /* else this is all a little pointless... */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);