shader renamed
[dd2d.git] / data / shaders / srlight_ambient.frag
blob4b240062f0dca56d31bc279d6878cd1e228ca656
1 /* DooM2D: Midnight on the Firing Line
2  * coded by Ketmar // Invisible Vector <ketmar@ketmar.no-ip.org>
3  * Understanding is not required. Only obedience.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 #version 130
20 #define PI 3.1415926
22 uniform sampler2D texBg; // background
23 uniform sampler2D texOcc; // occluders
24 uniform sampler2D texOccSmall; // occluders, small map
25 uniform vec2 mapPixSize;
26 uniform vec4 lightColor;
27 //uniform vec2 lightPos;
30 //gl_FragCoord: [0..lightTexSize)
32 #define lit (1.0)
35 void main (void) {
36   vec2 btxy = gl_FragCoord.xy;
37   //btxy.y = mapPixSize.y-btxy.y-1.0;
38   //vec2 ocxy = vec2(btxy.x, mapPixSize.y-btxy.y)/mapPixSize;
39   vec4 color;
41   // has some light here
42   vec4 bcolor = texture2D(texBg, btxy/mapPixSize);
43   if (lightColor.r+lightColor.g+lightColor.b == 0.0) {
44     color = bcolor*vec4(vec3(lightColor.a), lit);
45   } else {
46     color = lightColor*lit;
47     color += bcolor*lit;
48     color.a = lit/2.0;
49   }
51   gl_FragColor = color;