mkxp-z/shader/trans.frag

25 lines
587 B
GLSL
Raw Normal View History

2013-09-01 16:27:21 +02:00
/* Fragment shader dealing with transitions */
uniform sampler2D currentScene;
uniform sampler2D frozenScene;
uniform sampler2D transMap;
/* Normalized */
uniform float prog;
/* Vague [0, 512] normalized */
uniform float vague;
in vec2 v_texCoord;
out vec4 fragColor;
void main() {
float transV = texture(transMap, v_texCoord).r;
float cTransV = clamp(transV, prog, prog + vague);
lowp float alpha = (cTransV - prog) / vague;
vec4 newFrag = texture(currentScene, v_texCoord);
vec4 oldFrag = texture(frozenScene, v_texCoord);
fragColor = mix(newFrag, oldFrag, alpha);
2013-09-01 16:27:21 +02:00
}