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>2020-07-30 14:55:13 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-07-30 17:44:58 +0300
commitda741013a1e1b2e7c4f61a9486588253a457afd2 (patch)
treeb491c53eadf1fcc07e2a326d000b1c94fbf07f48 /source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
parent55401fbb3d0daa82c999e388c2b5b87e7113b091 (diff)
EEVEE: GLSL refactor/cleanup
- add the use of DRWShaderLibrary to EEVEE's glsl codebase to reduce code complexity and duplication. - split bsdf_common_lib.glsl into multiple sub library which are now shared with other engines. - the surface shader code is now more organised and have its own files. - change default world to use a material nodetree and make lookdev shader more clear. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D8306
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/shadow_vert.glsl')
-rw-r--r--source/blender/draw/engines/eevee/shaders/shadow_vert.glsl36
1 files changed, 12 insertions, 24 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
index c42f905cf7e..0e342938396 100644
--- a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
@@ -1,39 +1,23 @@
+#pragma BLENDER_REQUIRE(common_view_lib.glsl)
+#pragma BLENDER_REQUIRE(common_hair_lib.glsl)
+#pragma BLENDER_REQUIRE(surface_lib.glsl)
+
in vec3 pos;
in vec3 nor;
-#ifdef MESH_SHADER
-out vec3 worldPosition;
-out vec3 viewPosition;
-out vec3 worldNormal;
-out vec3 viewNormal;
-#endif
-
-#ifdef HAIR_SHADER
-out vec3 hairTangent;
-out float hairThickTime;
-out float hairThickness;
-out float hairTime;
-flat out int hairStrandID;
-#endif
-
void main()
{
-#ifdef GPU_INTEL
- /* Due to some shader compiler bug, we somewhat
- * need to access gl_VertexID to make it work. even
- * if it's actually dead code. */
- gl_Position.x = float(gl_VertexID);
-#endif
+ GPU_INTEL_VERTEX_SHADER_WORKAROUND
#ifdef HAIR_SHADER
hairStrandID = hair_get_strand_id();
- vec3 world_pos, binor;
+ vec3 pos, binor;
hair_get_pos_tan_binor_time((ProjectionMatrix[3][3] == 0.0),
ModelMatrixInverse,
ViewMatrixInverse[3].xyz,
ViewMatrixInverse[2].xyz,
- world_pos,
+ pos,
hairTangent,
binor,
hairTime,
@@ -41,6 +25,7 @@ void main()
hairThickTime);
worldNormal = cross(hairTangent, binor);
+ vec3 world_pos = pos;
#else
vec3 world_pos = point_object_to_world(pos);
#endif
@@ -57,7 +42,10 @@ void main()
/* No need to normalize since this is just a rotation. */
viewNormal = normal_world_to_view(worldNormal);
# ifdef USE_ATTR
- pass_attr(pos);
+# ifdef HAIR_SHADER
+ pos = hair_get_strand_pos();
+# endif
+ pass_attr(pos, NormalMatrix, ModelMatrixInverse);
# endif
#endif
}