Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/overlay/shaders/paint_vertcol_frag.glsl
- This file was moved from source/blender/draw/modes/shaders/paint_vertex_frag.glsl.
| in vec3 finalColor; | in vec3 finalColor; | ||||
| out vec4 fragColor; | out vec4 fragColor; | ||||
| uniform float opacity = 1.0; | uniform float opacity = 1.0; | ||||
| uniform bool useAlphaBlend = false; | |||||
| vec3 linear_to_srgb_attr(vec3 c) | vec3 linear_to_srgb_attr(vec3 c) | ||||
| { | { | ||||
| c = max(c, vec3(0.0)); | c = max(c, vec3(0.0)); | ||||
| vec3 c1 = c * 12.92; | vec3 c1 = c * 12.92; | ||||
| vec3 c2 = 1.055 * pow(c, vec3(1.0 / 2.4)) - 0.055; | vec3 c2 = 1.055 * pow(c, vec3(1.0 / 2.4)) - 0.055; | ||||
| return mix(c1, c2, step(vec3(0.0031308), c)); | return mix(c1, c2, step(vec3(0.0031308), c)); | ||||
| } | } | ||||
| void main() | void main() | ||||
| { | { | ||||
| vec3 color = linear_to_srgb_attr(finalColor); | vec3 color = linear_to_srgb_attr(finalColor); | ||||
| #ifdef DRW_STATE_BLEND_ALPHA | |||||
| if (useAlphaBlend) { | |||||
| fragColor = vec4(color, opacity); | fragColor = vec4(color, opacity); | ||||
| #else | } | ||||
| fragColor.rgb = mix(vec3(1.0), color, opacity); | else { | ||||
| fragColor.a = 1.0; | /* mix with 1.0 -> is like opacity when using multiply blend mode */ | ||||
| #endif | fragColor = vec4(mix(vec3(1.0), color, opacity), 1.0); | ||||
| } | |||||
| } | } | ||||