blob: 79b0f60d8c6c1fa3209df0b47621b31fb7318908 (
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
uniform int color_type;
uniform sampler2D myTexture;
in vec4 mColor;
in vec2 mTexCoord;
in vec2 uvfac;
out vec4 fragColor;
#define texture2D texture
/* keep this list synchronized with list in gpencil_engine.h */
#define GPENCIL_COLOR_SOLID 0
#define GPENCIL_COLOR_TEXTURE 1
#define GPENCIL_COLOR_PATTERN 2
void main()
{
vec4 tColor = vec4(mColor);
/* if uvfac[1] == 1, then encap (only solid mode ) */
if ((uvfac[1] == 1.0) && (color_type == GPENCIL_COLOR_SOLID)) {
vec2 center = vec2(uvfac[0], 1.0);
float dist = length(mTexCoord - center);
if (dist > 0.50) {
discard;
}
}
/* Solid */
if (color_type == GPENCIL_COLOR_SOLID) {
fragColor = tColor;
}
/* texture */
if (color_type == GPENCIL_COLOR_TEXTURE) {
fragColor = texture2D(myTexture, mTexCoord);
/* mult both alpha factor to use strength factor */
fragColor.a = min(fragColor.a * tColor.a, fragColor.a);
}
/* pattern */
if (color_type == GPENCIL_COLOR_PATTERN) {
vec4 text_color = texture2D(myTexture, mTexCoord);
fragColor = tColor;
/* mult both alpha factor to use strength factor with color alpha limit */
fragColor.a = min(text_color.a * tColor.a, tColor.a);
}
if(fragColor.a < 0.0035)
discard;
}
|