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/draw/engines/eevee/shaders/lit_surface_vert.glsl')
-rw-r--r--source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl60
1 files changed, 33 insertions, 27 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 141d3363a09..29ecbd694c9 100644
--- a/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
@@ -18,8 +18,9 @@ out vec3 viewPosition;
/* Used for planar reflections */
/* keep in sync with EEVEE_ClipPlanesUniformBuffer */
-layout(std140) uniform clip_block {
- vec4 ClipPlanes[1];
+layout(std140) uniform clip_block
+{
+ vec4 ClipPlanes[1];
};
#ifdef USE_FLAT_NORMAL
@@ -41,39 +42,44 @@ flat out int hairStrandID;
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);
+ /* 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
#ifdef HAIR_SHADER
- hairStrandID = hair_get_strand_id();
- vec3 pos, binor;
- hair_get_pos_tan_binor_time(
- (ProjectionMatrix[3][3] == 0.0),
- ModelMatrixInverse,
- ViewMatrixInverse[3].xyz, ViewMatrixInverse[2].xyz,
- pos, hairTangent, binor, hairTime, hairThickness, hairThickTime);
+ hairStrandID = hair_get_strand_id();
+ vec3 pos, binor;
+ hair_get_pos_tan_binor_time((ProjectionMatrix[3][3] == 0.0),
+ ModelMatrixInverse,
+ ViewMatrixInverse[3].xyz,
+ ViewMatrixInverse[2].xyz,
+ pos,
+ hairTangent,
+ binor,
+ hairTime,
+ hairThickness,
+ hairThickTime);
- gl_Position = ViewProjectionMatrix * vec4(pos, 1.0);
- viewPosition = (ViewMatrix * vec4(pos, 1.0)).xyz;
- worldPosition = pos;
- hairTangent = normalize(hairTangent);
- worldNormal = cross(binor, hairTangent);
- viewNormal = mat3(ViewMatrix) * worldNormal;
+ gl_Position = ViewProjectionMatrix * vec4(pos, 1.0);
+ viewPosition = (ViewMatrix * vec4(pos, 1.0)).xyz;
+ worldPosition = pos;
+ hairTangent = normalize(hairTangent);
+ worldNormal = cross(binor, hairTangent);
+ viewNormal = mat3(ViewMatrix) * worldNormal;
#else
- 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);
+ 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);
#endif
- /* Used for planar reflections */
- gl_ClipDistance[0] = dot(vec4(worldPosition, 1.0), ClipPlanes[0]);
+ /* Used for planar reflections */
+ gl_ClipDistance[0] = dot(vec4(worldPosition, 1.0), ClipPlanes[0]);
#ifdef USE_ATTR
- pass_attr(pos);
+ pass_attr(pos);
#endif
}