ecere/gfx/drivers/OpenGL: Fixed two-sided lighting
[sdk] / ecere / src / gfx / drivers / gl3 / fixed.frag
1 #version 150
2
3 uniform sampler2D diffuseTex;
4 uniform bool texturingOn;
5 uniform bool lightingOn;
6 uniform mat4 texture_matrix;
7 uniform bool matTwoSided;
8
9 in vec2 fTexCoord;
10 in vec4 fColor;
11 in vec4 fColorBack;
12
13 out vec4 fragColor;
14
15 void main(void)
16 {
17    vec4 c = (matTwoSided && lightingOn && !gl_FrontFacing) ? fColorBack : fColor;
18    fragColor = texturingOn ? c * texture(diffuseTex, (vec4(fTexCoord, 0, 1) * texture_matrix).xy) : c;
19 }