2013-09-01 14:27:21 +00: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;
|
|
|
|
|
2013-09-23 05:15:01 +00:00
|
|
|
varying vec2 v_texCoord;
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
void main()
|
|
|
|
{
|
2013-09-23 05:15:01 +00:00
|
|
|
float transV = texture2D(transMap, v_texCoord).r;
|
2013-09-01 14:27:21 +00:00
|
|
|
float cTransV = clamp(transV, prog, prog+vague);
|
2014-12-23 17:33:33 +00:00
|
|
|
lowp float alpha = (cTransV - prog) / vague;
|
2013-09-01 14:27:21 +00:00
|
|
|
|
2013-09-23 05:15:01 +00:00
|
|
|
vec4 newFrag = texture2D(currentScene, v_texCoord);
|
|
|
|
vec4 oldFrag = texture2D(frozenScene, v_texCoord);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
gl_FragColor = mix(newFrag, oldFrag, alpha);
|
|
|
|
}
|