2008-07-15 19:21:50 +00:00
|
|
|
uniform sampler2D winTexture;
|
|
|
|
uniform float windowWidth;
|
|
|
|
uniform float windowHeight;
|
|
|
|
uniform float opacity;
|
2009-02-14 09:29:01 +00:00
|
|
|
uniform float front;
|
2009-02-22 10:58:26 +00:00
|
|
|
uniform float useTexture;
|
2008-07-15 19:21:50 +00:00
|
|
|
|
|
|
|
vec2 pix2tex(vec2 pix)
|
|
|
|
{
|
|
|
|
return vec2(pix.x / windowWidth, pix.y / windowHeight);
|
|
|
|
}
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2009-02-14 09:29:01 +00:00
|
|
|
if( front > 0.0 && gl_FrontFacing )
|
|
|
|
discard;
|
|
|
|
if( front < 0.0 && !gl_FrontFacing )
|
|
|
|
discard;
|
2009-02-22 10:58:26 +00:00
|
|
|
|
|
|
|
if( useTexture > 0.0 )
|
|
|
|
{
|
|
|
|
// remove the shadow decoration quads
|
|
|
|
if( gl_TexCoord[0].x < 0.0 || gl_TexCoord[0].x > windowWidth ||
|
|
|
|
gl_TexCoord[0].y < 0.0 || gl_TexCoord[0].y > windowHeight )
|
|
|
|
discard;
|
|
|
|
gl_FragColor.rgba = texture2D(winTexture, pix2tex(gl_TexCoord[0].xy)).rgba;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_FragColor = gl_Color;
|
|
|
|
}
|
2009-02-14 09:29:01 +00:00
|
|
|
gl_FragColor.a = gl_FragColor.a * opacity;
|
2008-07-15 19:21:50 +00:00
|
|
|
}
|