diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-05-02 17:59:42 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-05-02 17:59:42 +0300 |
commit | 9cfbdff71c0c04d351f12d5674d54c15e3a978d9 (patch) | |
tree | 403d6f187304ed2df375f2ae8922ef760c2c0e8c /source/blender/draw/modes/shaders | |
parent | ae1ba7679c0792361209da8e098b2c47dc60ff2b (diff) | |
parent | befbf7eb9b7d48113bb91c1fcf3febf439286134 (diff) |
Merge branch 'blender2.8' of git.blender.org:blender into blender2.8
Diffstat (limited to 'source/blender/draw/modes/shaders')
-rw-r--r-- | source/blender/draw/modes/shaders/paint_vertex_frag.glsl | 17 | ||||
-rw-r--r-- | source/blender/draw/modes/shaders/paint_vertex_vert.glsl | 21 |
2 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/draw/modes/shaders/paint_vertex_frag.glsl b/source/blender/draw/modes/shaders/paint_vertex_frag.glsl new file mode 100644 index 00000000000..5a00fec9c43 --- /dev/null +++ b/source/blender/draw/modes/shaders/paint_vertex_frag.glsl @@ -0,0 +1,17 @@ + +in vec3 finalColor; + +out vec4 fragColor; + +vec3 linear_to_srgb_attrib(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() +{ + fragColor.rgb = linear_to_srgb_attrib(finalColor); + fragColor.a = 1.0; +} diff --git a/source/blender/draw/modes/shaders/paint_vertex_vert.glsl b/source/blender/draw/modes/shaders/paint_vertex_vert.glsl new file mode 100644 index 00000000000..178f77c6b9c --- /dev/null +++ b/source/blender/draw/modes/shaders/paint_vertex_vert.glsl @@ -0,0 +1,21 @@ + +uniform mat4 ModelViewProjectionMatrix; + +in vec3 pos; +in vec3 color; + +out vec3 finalColor; + +vec3 srgb_to_linear_attrib(vec3 c) { + c = max(c, vec3(0.0)); + vec3 c1 = c * (1.0 / 12.92); + vec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4)); + return mix(c1, c2, step(vec3(0.04045), c)); +} + +void main() +{ + gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0); + + finalColor = srgb_to_linear_attrib(color); +} |