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

gpu_shader_basic_vert.glsl « shaders « gpu « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 42fbdadf1d1edf7dd0ce793d08a2c593ee049a74 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

#if defined(USE_SOLID_LIGHTING) || defined(USE_SCENE_LIGHTING)
#if defined(USE_FLAT_NORMAL)
varying vec3 eyespace_vert_pos;
#else
varying vec3 varying_normal;
#endif

#ifndef USE_SOLID_LIGHTING
varying vec3 varying_position;
#endif
#endif

#ifdef USE_COLOR
#ifdef DRAW_LINE
varying vec4 varying_vertex_color_line;
#else
varying vec4 varying_vertex_color;
#endif
#endif

#ifdef USE_TEXTURE
varying vec2 varying_texture_coord;
#endif

#ifdef CLIP_WORKAROUND
varying float gl_ClipDistance[6];
#endif

void main()
{
	vec4 co = gl_ModelViewMatrix * gl_Vertex;

#if defined(USE_SOLID_LIGHTING) || defined(USE_SCENE_LIGHTING)
#if !defined(USE_FLAT_NORMAL)
	varying_normal = normalize(gl_NormalMatrix * gl_Normal);
#endif
#if defined(USE_FLAT_NORMAL)
	/* transform vertex into eyespace */
	eyespace_vert_pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
#endif

#ifndef USE_SOLID_LIGHTING
	varying_position = co.xyz;
#endif
#endif

	gl_Position = gl_ProjectionMatrix * co;

#ifdef CLIP_WORKAROUND
	int i;
	for (i = 0; i < 6; i++)
		gl_ClipDistance[i] = dot(co, gl_ClipPlane[i]);
#elif !defined(GPU_ATI)
	// Setting gl_ClipVertex is necessary to get glClipPlane working on NVIDIA
	// graphic cards, while on ATI it can cause a software fallback.
	gl_ClipVertex = co; 
#endif 

#ifdef USE_COLOR
#ifdef DRAW_LINE
	varying_vertex_color_line = gl_Color;
#else
	varying_vertex_color = gl_Color;
#endif
#endif

#ifdef USE_TEXTURE
	varying_texture_coord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).st;
#endif
}