mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-07-04 23:55:17 +02:00
24 lines
587 B
GLSL
24 lines
587 B
GLSL
/* 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);
|
|
}
|