summaryrefslogtreecommitdiff
path: root/shaders/warzone2100/4.shader_test
blob: 64dd0c5351168339fe07e1f54d08ecc6f158c18b (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
[require]
GLSL >= 1.10

[fragment shader]
#version 120
#pragma debug(on)

uniform sampler2D Texture0;
uniform sampler2D Texture1;
uniform vec4 teamcolour;
uniform int tcmask;
//uniform int fogEnabled;

void main(void)
{
	vec4 mask, colour;

	// Get color from texture unit 0
	colour = texture2D(Texture0, gl_TexCoord[0].st);

	if (tcmask == 1)
	{
		// Get tcmask information from texture unit 1
		mask = texture2D(Texture1, gl_TexCoord[0].st);
	
		// Apply color using grain merge with tcmask
		gl_FragColor = (colour + (teamcolour - 0.5) * mask.a) * gl_Color;
	}
	else
	{
		gl_FragColor = colour * gl_Color;
	}
}


[vertex shader]
#version 120
#pragma debug(on)

void main(void)
{
	// Pass texture coordinates to fragment shader
	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;

	// Pass glColor to fragment shader
	gl_FrontColor = gl_Color;
	
	// Translate every vertex according to the Model View and Projection Matrix
	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}