5899a26aad
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14590 178a84e3-b1eb-0310-8ba1-8eac791a3b58
35 lines
617 B
GLSL
35 lines
617 B
GLSL
uniform sampler2D tex;
|
|
uniform int hastex;
|
|
uniform int viz;
|
|
uniform int wireframe;
|
|
uniform float objectid;
|
|
|
|
vec4 encdepth(float v) {
|
|
vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * v;
|
|
enc = fract(enc);
|
|
enc -= enc.yzww * vec4(1.0/255.0, 1.0/255.0, 1.0/255.0, 0.0);
|
|
return enc;
|
|
}
|
|
|
|
void main() {
|
|
|
|
if (hastex != 0) {
|
|
float alpha = texture2D(tex, gl_TexCoord[0].xy).a;
|
|
|
|
if (alpha < 0.5)
|
|
discard;
|
|
}
|
|
|
|
if (viz < 1)
|
|
{
|
|
gl_FragColor = vec4(encdepth(gl_FragCoord.z).xyz, objectid);
|
|
}
|
|
else {
|
|
if (wireframe > 0)
|
|
gl_FragColor = vec4(1.0);
|
|
else
|
|
gl_FragColor = texture2D(tex, gl_TexCoord[0].xy);
|
|
}
|
|
}
|
|
|