Debian Codegraph @

pak6-patch088/glsl/generic_fp.glsl

raw
1 #version 120
2 /*
3 * generic_fp.glsl
4 * generic quake 3 shader rendering fragment program
5 * Copyright (C) 2010 Jens Loehr <[email protected]>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15 * Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21
22 /* uniform variables */
23 uniform int u_TexEnv;
24 uniform sampler2D u_Texture0;
25 uniform sampler2D u_Texture1;
26
27 /* texturing.glsl */
28 #define REPLACE 0
29 #define MODULATE 1
30 #define DECAL 2
31 #define BLEND 3
32 #define ADD 4
33 #define COMBINE 5
34
35 vec4 applyTexture2D(sampler2D textureUnit, int type, int index, vec4 color);
36
37 /*
38 * main
39 * Entry point for generic fragment program
40 */
41 void main (void) {
42 vec4 color = gl_Color;
43
44 /* fragment color */
45 color = applyTexture2D(u_Texture0, MODULATE, 0, color);
46
47 /* multi-texturing */
48 if (u_TexEnv > -1) {
49 color = applyTexture2D(u_Texture1, u_TexEnv, 1, color);
50 }
51
52 /* finish */
53 gl_FragColor = color;
54 }