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

lit_surface_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: fd7f3870d274340e70591276afb839313d46c868 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

uniform mat4 ModelViewProjectionMatrix;
uniform mat4 ModelMatrix;
uniform mat4 ModelViewMatrix;
uniform mat3 WorldNormalMatrix;
#ifndef ATTRIB
uniform mat3 NormalMatrix;
#endif

#ifndef HAIR_SHADER_FIBERS
in vec3 pos;
in vec3 nor;
#else
in int fiber_index;
in float curve_param;
#endif

out vec3 worldPosition;
out vec3 viewPosition;

/* Used for planar reflections */
uniform vec4 ClipPlanes[1];

#ifdef USE_FLAT_NORMAL
flat out vec3 worldNormal;
flat out vec3 viewNormal;
#else
out vec3 worldNormal;
out vec3 viewNormal;
#endif

void main() {
#ifndef HAIR_SHADER_FIBERS
	gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
#else
	vec3 pos;
	vec3 nor;
	vec2 view_offset;
	hair_fiber_get_vertex(fiber_index, curve_param, ModelViewMatrix, pos, nor, view_offset);
	gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
	gl_Position.xy += view_offset * gl_Position.w;
#endif

	viewPosition = (ModelViewMatrix * vec4(pos, 1.0)).xyz;
	worldPosition = (ModelMatrix * vec4(pos, 1.0)).xyz;
	viewNormal = normalize(NormalMatrix * nor);
	worldNormal = normalize(WorldNormalMatrix * nor);

	/* Used for planar reflections */
	gl_ClipDistance[0] = dot(vec4(worldPosition, 1.0), ClipPlanes[0]);

#ifdef ATTRIB
	pass_attrib(pos);
#endif
}