variable fog length

This commit is contained in:
Andrew "Akari" Alexeyew 2012-08-05 05:39:19 +03:00
parent e2b8163447
commit e66e99e56e
3 changed files with 29 additions and 4 deletions

View file

@ -14,6 +14,7 @@ void main(void) {
#version 110
uniform sampler2D tex;
uniform float lendiv;
varying vec4 d;
varying vec4 TexCoord0;
@ -22,4 +23,4 @@ void main(void) {
vec4 texel = texture2D(tex, TexCoord0.xy);
float f = min(1.0, length(d)/3000.0);
gl_FragColor = mix(vec4(1.0), texel, 1.0-f);
}
}

View file

@ -75,6 +75,27 @@ void credits_skysphere_draw(Vector pos) {
glDisable(GL_TEXTURE_2D);
}
void credits_towerwall_draw(Vector pos) {
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, get_tex("stage6/towerwall")->gltex);
if(!tconfig.intval[NO_SHADER]) {
Shader *s = get_shader("tower_wall");
glUseProgram(s->prog);
glUniform1i(uniloc(s, "lendiv"), 2800.0 + 300.0 * sin(global.frames / 77.7));
}
glPushMatrix();
glTranslatef(pos[0], pos[1], pos[2]);
// glRotatef(90, 1,0,0);
glScalef(30,30,30);
draw_model("towerwall");
glPopMatrix();
glUseProgram(0);
glDisable(GL_TEXTURE_2D);
}
void credits_fill(void) {
credits_add("Taisei Project", 200);
credits_add("String 1\nDerp 2\nHuge derp 3", 500);
@ -90,7 +111,7 @@ void credits_init(void) {
init_stage3d(&bgcontext);
add_model(&bgcontext, credits_skysphere_draw, credits_skysphere_pos);
add_model(&bgcontext, stage6_towerwall_draw, stage6_towerwall_pos);
add_model(&bgcontext, credits_towerwall_draw, stage6_towerwall_pos);
bgcontext.cx[0] = 0;
bgcontext.cx[1] = 600;

View file

@ -37,8 +37,11 @@ void stage6_towerwall_draw(Vector pos) {
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, get_tex("stage6/towerwall")->gltex);
if(!tconfig.intval[NO_SHADER])
glUseProgram(get_shader("tower_wall")->prog);
if(!tconfig.intval[NO_SHADER]) {
Shader *s = get_shader("tower_wall");
glUseProgram(s->prog);
glUniform1i(uniloc(s, "lendiv"), 3000.0);
}
glPushMatrix();
glTranslatef(pos[0], pos[1], pos[2]);