Welcome to mirror list, hosted at ThFree Co, Russian Federation.

image_frag.glsl « shaders « overlay « engines « draw « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 298ba1e27ed7076cab8f54db672dc1c3f84bd098 (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

uniform sampler2D imgTexture;
uniform bool imgPremultiplied;
uniform bool imgAlphaBlend;
uniform vec4 color;

in vec2 uvs;

out vec4 fragColor;

void main()
{
  vec2 uvs_clamped = clamp(uvs, 0.0, 1.0);
  vec4 tex_color;
  tex_color = texture_read_as_linearrgb(imgTexture, imgPremultiplied, uvs_clamped);

  fragColor = tex_color * color;

  if (!imgAlphaBlend) {
    /* Arbitrary discard anything below 5% opacity.
     * Note that this could be exposed to the User. */
    if (tex_color.a < 0.05) {
      discard;
    }
    else {
      fragColor.a = 1.0;
    }
  }
}