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
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2019-05-08 21:13:24 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-05-08 21:13:32 +0300
commitf2f62b184c67f6b548da1cd9c022c9383e541bb0 (patch)
tree12896f71f49dda76cc6c430c2cdb5ae454d58762 /source/blender/draw/engines
parentbb41626ab3de31f670fcbe3365b61064e899c87f (diff)
DRW: Remove WorldNormalMatrix
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r--source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl8
-rw-r--r--source/blender/draw/engines/eevee/shaders/shadow_vert.glsl8
2 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl b/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
index 40075ed64be..cddc8e87a1e 100644
--- a/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
@@ -1,10 +1,8 @@
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 ModelViewMatrix;
-uniform mat3 WorldNormalMatrix;
#ifndef USE_ATTR
uniform mat4 ModelMatrix;
-uniform mat3 NormalMatrix;
uniform mat4 ModelMatrixInverse;
#endif
@@ -67,8 +65,10 @@ void main()
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
viewPosition = (ModelViewMatrix * vec4(pos, 1.0)).xyz;
worldPosition = (ModelMatrix * vec4(pos, 1.0)).xyz;
- worldNormal = normalize(WorldNormalMatrix * nor);
- viewNormal = normalize(NormalMatrix * nor);
+
+ worldNormal = normalize(transform_normal_object_to_world(nor));
+ /* No need to normalize since this is just a rotation. */
+ viewNormal = transform_normal_world_to_view(worldNormal);
#endif
/* Used for planar reflections */
diff --git a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
index f9225cd100b..f8850300dc4 100644
--- a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
@@ -2,10 +2,8 @@
uniform mat4 ModelViewProjectionMatrix;
#ifdef MESH_SHADER
uniform mat4 ModelViewMatrix;
-uniform mat3 WorldNormalMatrix;
# ifndef USE_ATTR
uniform mat4 ModelMatrix;
-uniform mat3 NormalMatrix;
# endif
#endif
@@ -25,8 +23,10 @@ void main()
#ifdef MESH_SHADER
viewPosition = (ModelViewMatrix * vec4(pos, 1.0)).xyz;
worldPosition = (ModelMatrix * vec4(pos, 1.0)).xyz;
- viewNormal = normalize(NormalMatrix * nor);
- worldNormal = normalize(WorldNormalMatrix * nor);
+
+ worldNormal = normalize(transform_normal_object_to_world(nor));
+ /* No need to normalize since this is just a rotation. */
+ viewNormal = transform_normal_world_to_view(worldNormal);
# ifdef USE_ATTR
pass_attr(pos);
# endif