summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-07-04 15:15:23 +0200
committerGitHub <noreply@github.com>2018-07-04 15:15:23 +0200
commitdfc4ca9f6a713eb03a80e0e0389e9cc36ed04724 (patch)
treeb883d6ac14160e624796a145bf4b2e8d66553e50 /drivers
parent3724f1562be5caca3c5236c1cfac8d73a3303d42 (diff)
parente9a3cf8feb25c3492b30e812119cbff7e29e6739 (diff)
Merge pull request #19807 from JFonS/fix_light_vec_rotation
Fix rotation of 2D lights
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles3/shaders/canvas.glsl5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl
index 326aab4c7c..b3366a7f99 100644
--- a/drivers/gles3/shaders/canvas.glsl
+++ b/drivers/gles3/shaders/canvas.glsl
@@ -518,10 +518,9 @@ FRAGMENT_SHADER_CODE
-
#ifdef USE_LIGHTING
- vec2 light_vec = light_uv_interp.zw;; //for shadow and normal mapping
+ vec2 light_vec = (inverse(light_matrix)*vec4(normalize(light_uv_interp.zw),0.0,0.0)).xy; //for normal mapping
if (normal_used) {
normal.xy = mat2(local_rot.xy,local_rot.zw) * normal.xy;
@@ -567,7 +566,7 @@ FRAGMENT_SHADER_CODE
color*=light;
#ifdef USE_SHADOWS
-
+ light_vec = light_uv_interp.zw; //for shadows
float angle_to_light = -atan(light_vec.x,light_vec.y);
float PI = 3.14159265358979323846264;
/*int i = int(mod(floor((angle_to_light+7.0*PI/6.0)/(4.0*PI/6.0))+1.0, 3.0)); // +1 pq os indices estao em ordem 2,0,1 nos arrays