diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2018-08-12 14:59:39 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2018-08-12 14:59:39 +0300 |
commit | b8ab411185c11ce98e7e791b0d30a9d9b1ce6d69 (patch) | |
tree | 9c219e06fc6a1f9b09d6fbf7d86c8526cfa6d775 /source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_flip_frag.glsl | |
parent | 209686f1c8189bc01f91d14a922651844df8b201 (diff) | |
parent | dc2d841b7c50565302af2986d62ddbd29c332acd (diff) |
Merge branch 'hair_guides' into hair_guides_groominghair_guides_grooming
Diffstat (limited to 'source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_flip_frag.glsl')
-rw-r--r-- | source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_flip_frag.glsl | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_flip_frag.glsl b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_flip_frag.glsl new file mode 100644 index 00000000000..43589461cd1 --- /dev/null +++ b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_flip_frag.glsl @@ -0,0 +1,37 @@ +out vec4 FragColor; + +uniform sampler2D strokeColor; +uniform sampler2D strokeDepth; +uniform vec2 wsize; +uniform int flipmode; + +void main() +{ + vec2 mode = vec2(0,0); + /* horz. */ + if (flipmode >= 110) { + mode[0] = 1; + } + /* vert. */ + if ((flipmode == 101) || (flipmode == 111)) { + mode[1] = 1; + } + + vec2 uv = vec2(gl_FragCoord.xy); + float stroke_depth; + vec4 outcolor; + + if (mode[0] > 0) { + uv.x = wsize.x - uv.x; + } + if (mode[1] > 0) { + uv.y = wsize.y - uv.y; + } + + ivec2 iuv = ivec2(uv.x, uv.y); + stroke_depth = texelFetch(strokeDepth, iuv, 0).r; + outcolor = texelFetch(strokeColor, iuv, 0); + + gl_FragDepth = stroke_depth; + FragColor = outcolor; +} |