hadean/res/shaders/depth.frag

17 lines
483 B
GLSL

//SpriteBatch will use texture unit 0
uniform sampler2D u_texture;
//"in" varyings from our vertex shader
varying vec4 vColor;
varying vec2 vTexCoord;
varying float vDepth;
void main() {
vec4 texColor = texture2D(u_texture, vTexCoord);
if(texColor == vec4(1, 0, 1, 1) || texColor == vec4(1, 0, 0, 1) || texColor.w == 0.0) {
discard;
} else {
gl_FragColor = texColor * vColor;
gl_FragColor = vec4(vDepth / 20.0, vDepth / 20.0, vDepth / 20.0, gl_FragColor.w);
}
}