Welcome to mirror list, hosted at ThFree Co, Russian Federation.

shadow_vert.glsl « shaders « eevee « engines « draw « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: baaa43d84b86b4b75027807e1e8fcf5075f21609 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

uniform mat4 ModelViewProjectionMatrix;
#ifdef MESH_SHADER
uniform mat4 ModelViewMatrix;
#  ifndef USE_ATTR
uniform mat4 ModelMatrix;
#  endif
#endif

in vec3 pos;
in vec3 nor;

#ifdef MESH_SHADER
out vec3 worldPosition;
out vec3 viewPosition;
out vec3 worldNormal;
out vec3 viewNormal;
#endif

void main()
{
  gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
#ifdef MESH_SHADER
  viewPosition = (ModelViewMatrix * vec4(pos, 1.0)).xyz;
  worldPosition = (ModelMatrix * vec4(pos, 1.0)).xyz;

  worldNormal = normalize(normal_object_to_world(nor));
  /* No need to normalize since this is just a rotation. */
  viewNormal = normal_world_to_view(worldNormal);
#  ifdef USE_ATTR
  pass_attr(pos);
#  endif
#endif
}