aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/assets/notenoughupdates/shaders/shiny_cape.frag
blob: 77e2c5eb71d36316f87229f2fd8943a1b5c463c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#version 120

varying vec4 passColour;
varying vec3 passNormal;
uniform sampler2D textureIn;

uniform int millis;
uniform int eventMillis;

void main() {
    gl_FragColor = texture2D(textureIn, gl_TexCoord[0].st) * passColour;

    if(eventMillis < 350 && gl_TexCoord[0].s < 512 && gl_TexCoord[0].t < 512) {
        float scroll = (gl_TexCoord[0].s*1024.0f+gl_TexCoord[0].t*1024.0f);
        float factor = (10 - abs(scroll - eventMillis*2))/40.0f;
        if(factor > 0) {
            gl_FragColor.rgb += vec3(factor+0.25f, factor+0.25f, factor+0.25f);
        }
    }

    vec3 fakeSunNormal = normalize(vec3(0.2f,1.0f,-0.2f));
    vec3 normNormal = normalize(passNormal);
    float shading = max(0.6f, dot(fakeSunNormal, normNormal));

    gl_FragColor = vec4(gl_FragColor.rgb*shading, gl_FragColor.a);
}