equal
deleted
inserted
replaced
|
1 // fast painter for composition modes which can be implemented with blendfuncs |
|
2 |
|
3 uniform sampler2D mask_texture; |
|
4 uniform vec2 inv_mask_size; |
|
5 uniform vec2 mask_offset; |
|
6 uniform vec4 mask_channel; |
|
7 |
|
8 float mask() |
|
9 { |
|
10 return dot(mask_channel, texture2D(mask_texture, (gl_FragCoord.xy + mask_offset) * inv_mask_size)); |
|
11 } |
|
12 |
|
13 void main() |
|
14 { |
|
15 // combine clip and coverage channels |
|
16 float mask_alpha = mask(); |
|
17 |
|
18 gl_FragColor = brush() * mask_alpha; |
|
19 } |