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

edit_mesh_overlay_vert.glsl « shaders « modes « draw « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8ebfa4376f01c705f324bdb9268b5fde41a72142 (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

/* Solid Wirefram implementation
 * Mike Erwin, Clément Foucault */

/* This shader follows the principles of
 * http://developer.download.nvidia.com/SDK/10/direct3d/Source/SolidWireframe/Doc/SolidWireframe.pdf */

uniform mat4 ModelViewMatrix;
uniform mat4 ModelViewProjectionMatrix;

in vec3 pos;
in ivec4 data;

out vec4 vPos;
out vec4 pPos;
out ivec4 vData;

#ifdef VERTEX_FACING
uniform mat4 ProjectionMatrix;
uniform mat3 NormalMatrix;

in vec3 vnor;
out float vFacing;
#endif

void main()
{
	vPos = ModelViewMatrix * vec4(pos, 1.0);
	pPos = ModelViewProjectionMatrix * vec4(pos, 1.0);
	vData = data;
#ifdef VERTEX_FACING
	vec3 view_normal = normalize(NormalMatrix * vnor);
	vec3 view_vec = (ProjectionMatrix[3][3] == 0.0)
		? normalize(vPos.xyz)
		: vec3(0.0, 0.0, 1.0);
	vFacing = dot(view_vec, view_normal);
#endif
}