[Bf-blender-cvs] [be0e58d980d] blender2.8: GP: Fix Shadow rotation bug

Antonioya noreply at git.blender.org
Mon Oct 1 11:36:26 CEST 2018


Commit: be0e58d980d963c60869c412ada86641baaa2e48
Author: Antonioya
Date:   Mon Oct 1 11:36:06 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBbe0e58d980d963c60869c412ada86641baaa2e48

GP: Fix Shadow rotation bug

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

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 e2bd725ec0d..d5384900b0a 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
@@ -60,6 +60,12 @@ void main()
 	/* move point to new coords system */
 	vec2 tpos = vec2(uv.x, uv.y) - loc2d;
 
+	/* rotation */
+	if (rotation != 0) {
+		vec2 rotpoint = vec2((tpos.x * cosv) - (tpos.y * sinv), (tpos.x * sinv) + (tpos.y * cosv));
+		tpos = rotpoint;
+	}
+	
 	/* apply offset */
 	tpos = vec2(tpos.x - dx, tpos.y - dy);
 	
@@ -67,10 +73,6 @@ void main()
 	tpos.x *= 1.0 / scale[0];
 	tpos.y *= 1.0 / scale[1];
 	
-	/* rotation */
-	tpos.x = (tpos.x * cosv) - (tpos.y * sinv);
-	tpos.y = (tpos.x * sinv) + (tpos.y * cosv);
-	
 	/* back to original coords system */
 	vec2 texpos = tpos + loc2d;



More information about the Bf-blender-cvs mailing list