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:
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_basic_vert.glsl')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_basic_vert.glsl10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_basic_vert.glsl b/source/blender/gpu/shaders/gpu_shader_basic_vert.glsl
index cef28ea3026..42fbdadf1d1 100644
--- a/source/blender/gpu/shaders/gpu_shader_basic_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_basic_vert.glsl
@@ -1,6 +1,10 @@
#if defined(USE_SOLID_LIGHTING) || defined(USE_SCENE_LIGHTING)
+#if defined(USE_FLAT_NORMAL)
+varying vec3 eyespace_vert_pos;
+#else
varying vec3 varying_normal;
+#endif
#ifndef USE_SOLID_LIGHTING
varying vec3 varying_position;
@@ -28,7 +32,13 @@ void main()
vec4 co = gl_ModelViewMatrix * gl_Vertex;
#if defined(USE_SOLID_LIGHTING) || defined(USE_SCENE_LIGHTING)
+#if !defined(USE_FLAT_NORMAL)
varying_normal = normalize(gl_NormalMatrix * gl_Normal);
+#endif
+#if defined(USE_FLAT_NORMAL)
+ /* transform vertex into eyespace */
+ eyespace_vert_pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
+#endif
#ifndef USE_SOLID_LIGHTING
varying_position = co.xyz;