summaryrefslogtreecommitdiff
path: root/shaders/warsow/52.shader_test
blob: b4f6f7ca947762af2ccc3a077f47e36758171c69 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
[require]
GLSL >= 1.10

[fragment shader]
#define FRAGMENT_SHADER
// Warsow GLSL shader


varying vec4 ProjVector;

#ifdef VERTEX_SHADER
// Vertex shader

uniform float OutlineHeight;

void main(void)
{
gl_FrontColor = gl_Color;

vec4 n = vec4(gl_Normal.xyz, 0.0);
vec4 v = vec4(gl_Vertex) + n * OutlineHeight;

gl_Position = gl_ModelViewProjectionMatrix * v;
ProjVector = gl_Position;
#ifdef APPLY_CLIPPING
#ifdef __GLSL_CG_DATA_TYPES
gl_ClipVertex = gl_ModelViewMatrix * v;
#endif
#endif
}

#endif // VERTEX_SHADER


#ifdef FRAGMENT_SHADER
// Fragment shader

uniform float OutlineCutOff;

void main(void)
{

#ifdef APPLY_OUTLINES_CUTOFF
if (OutlineCutOff > 0.0 && (ProjVector.w > OutlineCutOff))
discard;
#endif

gl_FragColor = vec4 (gl_Color);
}

#endif // FRAGMENT_SHADER


[vertex shader]
#define VERTEX_SHADER
// Warsow GLSL shader


varying vec4 ProjVector;

#ifdef VERTEX_SHADER
// Vertex shader

uniform float OutlineHeight;

void main(void)
{
gl_FrontColor = gl_Color;

vec4 n = vec4(gl_Normal.xyz, 0.0);
vec4 v = vec4(gl_Vertex) + n * OutlineHeight;

gl_Position = gl_ModelViewProjectionMatrix * v;
ProjVector = gl_Position;
#ifdef APPLY_CLIPPING
#ifdef __GLSL_CG_DATA_TYPES
gl_ClipVertex = gl_ModelViewMatrix * v;
#endif
#endif
}

#endif // VERTEX_SHADER


#ifdef FRAGMENT_SHADER
// Fragment shader

uniform float OutlineCutOff;

void main(void)
{

#ifdef APPLY_OUTLINES_CUTOFF
if (OutlineCutOff > 0.0 && (ProjVector.w > OutlineCutOff))
discard;
#endif

gl_FragColor = vec4 (gl_Color);
}

#endif // FRAGMENT_SHADER