/* =========================================================================== Copyright (C) 2006-2009 Robert Beckebans This file is part of XreaL source code. XreaL source code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. XreaL source code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XreaL source code; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ /* generic_fp.glsl */ uniform sampler2D u_Texture0Map; uniform sampler2D u_Texture1Map; uniform int u_AlphaTest; uniform int u_Texture1Env; varying vec3 var_Position; varying vec2 var_Tex1; varying vec2 var_Tex2; varying vec4 var_Color; varying float var_Discard; void main() { if(var_Discard > 0.0) { discard; return; } vec4 color = texture2D(u_Texture0Map, var_Tex1); vec4 color2 = texture2D(u_Texture1Map, var_Tex2); if (u_Texture1Env == 1) // GL_MODULATE { color *= color2; } else if (u_Texture1Env == 2) // GL_REPLACE { color = color2; } else if (u_Texture1Env == 3) // GL_DECAL { color = color * vec4(1.0 - color2.a) + color2 * vec4(color2.a); } else if (u_Texture1Env == 4) // GL_ADD { color += color2; } color *= var_Color; gl_FragColor = color; }