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

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

in vec3 finalColor;

out vec4 fragColor;
uniform float opacity = 1.0;

vec3 linear_to_srgb_attr(vec3 c)
{
  c = max(c, vec3(0.0));
  vec3 c1 = c * 12.92;
  vec3 c2 = 1.055 * pow(c, vec3(1.0 / 2.4)) - 0.055;
  return mix(c1, c2, step(vec3(0.0031308), c));
}

void main()
{
  vec3 color = linear_to_srgb_attr(finalColor);
#ifdef DRW_STATE_BLEND_ALPHA
  fragColor = vec4(color, opacity);
#else
  fragColor.rgb = mix(vec3(1.0), color, opacity);
  fragColor.a = 1.0;
#endif
}