[Bf-blender-cvs] [03b8d6ce548] blender2.8: GP: Cleanup shader

Antonioya noreply at git.blender.org
Tue Oct 2 10:32:03 CEST 2018


Commit: 03b8d6ce548eea460aee6e9cc5d22683995438a2
Author: Antonioya
Date:   Tue Oct 2 10:31:49 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB03b8d6ce548eea460aee6e9cc5d22683995438a2

GP: Cleanup shader

===================================================================

M	source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_shadow_prepare_frag.glsl

===================================================================

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;
 }



More information about the Bf-blender-cvs mailing list