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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2018-10-02 11:31:49 +0300
committerAntonioya <blendergit@gmail.com>2018-10-02 11:31:49 +0300
commit03b8d6ce548eea460aee6e9cc5d22683995438a2 (patch)
treed293741b03d981cb0c843e4a457e092e23e5a58e /source
parent1a9d1317aa143e436b837ccf9b027dbb5f81fde3 (diff)
GP: Cleanup shader
Diffstat (limited to 'source')
-rw-r--r--source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_shadow_prepare_frag.glsl21
1 files changed, 7 insertions, 14 deletions
diff --git a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_shadow_prepare_frag.glsl b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_shadow_prepare_frag.glsl
index d5384900b0a..d370f1fdcb5 100644
--- a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_shadow_prepare_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_shadow_prepare_frag.glsl
@@ -29,6 +29,8 @@ uniform float pixfactor;
float defaultpixsize = pixsize * (1000.0 / pixfactor);
vec2 noffset = vec2(offset[0], offset[1]);
+float cosv = cos(rotation);
+float sinv = sin(rotation);
out vec4 FragColor;
@@ -54,8 +56,6 @@ void main()
float dx = (ProjectionMatrix[3][3] == 0.0) ? (noffset[0] / (nloc.z * defaultpixsize)) : (noffset[0] / defaultpixsize);
float dy = (ProjectionMatrix[3][3] == 0.0) ? (noffset[1] / (nloc.z * defaultpixsize)) : (noffset[1] / defaultpixsize);
- float cosv = cos(rotation);
- float sinv = sin(rotation);
/* move point to new coords system */
vec2 tpos = vec2(uv.x, uv.y) - loc2d;
@@ -77,28 +77,21 @@ void main()
vec2 texpos = tpos + loc2d;
/* wave */
- float value;
if (orientation == HORIZONTAL) {
float pval = (uv.x * M_PI) / Viewport[0];
- value = amplitude * sin((period * pval) + phase);
- texpos.y += value;
+ texpos.y += amplitude * sin((period * pval) + phase);
}
else if (orientation == VERTICAL){
float pval = (uv.y * M_PI) / Viewport[1];
- value = amplitude * sin((period * pval) + phase);
- texpos.x += value;
+ texpos.x += amplitude * sin((period * pval) + phase);
}
- float stroke_depth = texelFetch(strokeDepth, ivec2(texpos.x, texpos.y), 0).r;
- vec4 src_pixel= texelFetch(strokeColor, ivec2(texpos.x, texpos.y), 0);
- vec4 outcolor;
- outcolor = shadow_color;
-
+ vec4 src_pixel = texelFetch(strokeColor, ivec2(texpos.x, texpos.y), 0);
/* is transparent */
if (src_pixel.a == 0.0f) {
discard;
}
- gl_FragDepth = stroke_depth;
- FragColor = outcolor;
+ gl_FragDepth = texelFetch(strokeDepth, ivec2(texpos.x, texpos.y), 0).r;
+ FragColor = shadow_color;
}