Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl
| Show First 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | else { | ||||
| } | } | ||||
| else { | else { | ||||
| ocolor = (flip == 0) ? mix(color, color2, factor) : mix(color2, color, factor); | ocolor = (flip == 0) ? mix(color, color2, factor) : mix(color2, color, factor); | ||||
| } | } | ||||
| } | } | ||||
| ocolor.a *= layer_opacity; | ocolor.a *= layer_opacity; | ||||
| } | } | ||||
| float linearrgb_to_srgb(float c) | |||||
| { | |||||
| if (c < 0.0031308) { | |||||
| return (c < 0.0) ? 0.0 : c * 12.92; | |||||
| } | |||||
| else { | |||||
| return 1.055 * pow(c, 1.0 / 2.4) - 0.055; | |||||
| } | |||||
| } | |||||
| vec4 texture_read_as_srgb(sampler2D tex, bool premultiplied, vec2 co) | |||||
| { | |||||
| /* By convention image textures return scene linear colors, but | |||||
| * grease pencil still works in srgb. */ | |||||
| vec4 color = texture(tex, co); | |||||
| /* Unpremultiply if stored multiplied, since straight alpha is expected by shaders. */ | |||||
| if (premultiplied && !(color.a == 0.0 || color.a == 1.0)) { | |||||
| color.rgb = color.rgb / color.a; | |||||
| } | |||||
| color.r = linearrgb_to_srgb(color.r); | |||||
| color.g = linearrgb_to_srgb(color.g); | |||||
| color.b = linearrgb_to_srgb(color.b); | |||||
| return color; | |||||
| } | |||||
| void main() | void main() | ||||
| { | { | ||||
| vec2 t_center = vec2(0.5, 0.5); | vec2 t_center = vec2(0.5, 0.5); | ||||
| mat2 matrot_tex = mat2( | mat2 matrot_tex = mat2( | ||||
| cos(texture_angle), -sin(texture_angle), sin(texture_angle), cos(texture_angle)); | cos(texture_angle), -sin(texture_angle), sin(texture_angle), cos(texture_angle)); | ||||
| vec2 rot_tex = (matrot_tex * (texCoord_interp - t_center)) + t_center + texture_offset; | vec2 rot_tex = (matrot_tex * (texCoord_interp - t_center)) + t_center + texture_offset; | ||||
| vec4 tmp_color; | vec4 tmp_color; | ||||
| tmp_color = (texture_clamp == 0) ? | tmp_color = (texture_clamp == 0) ? | ||||
| ▲ Show 20 Lines • Show All 114 Lines • Show Last 20 Lines | |||||