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
27
28
29
30
31
|
uniform sampler2D colorBuf;
uniform sampler2D revealBuf;
uniform sampler2D maskBuf;
uniform int blendMode;
uniform float blendOpacity;
in vec4 uvcoordsvar;
/* Reminder: This is considered SRC color in blend equations.
* Same operation on all buffers. */
layout(location = 0) out vec4 fragColor;
layout(location = 1) out vec4 fragRevealage;
void main()
{
vec4 color;
/* Remember, this is associated alpha (aka. premult). */
color.rgb = textureLod(colorBuf, uvcoordsvar.xy, 0).rgb;
/* Stroke only render mono-chromatic revealage. We convert to alpha. */
color.a = 1.0 - textureLod(revealBuf, uvcoordsvar.xy, 0).r;
float mask = textureLod(maskBuf, uvcoordsvar.xy, 0).r;
mask *= blendOpacity;
fragColor = vec4(1.0, 0.0, 1.0, 1.0);
fragRevealage = vec4(1.0, 0.0, 1.0, 1.0);
blend_mode_output(blendMode, color, mask, fragColor, fragRevealage);
}
|