Urho3D/bin/CoreData/Shaders/GLSL/Depth.glsl
2015-01-18 21:31:13 +08:00

25 lines
541 B
GLSL

#include "Uniforms.glsl"
#include "Samplers.glsl"
#include "Transform.glsl"
varying vec3 vTexCoord;
void VS()
{
mat4 modelMatrix = iModelMatrix;
vec3 worldPos = GetWorldPos(modelMatrix);
gl_Position = GetClipPos(worldPos);
vTexCoord = vec3(GetTexCoord(iTexCoord), GetDepth(gl_Position));
}
void PS()
{
#ifdef ALPHAMASK
float alpha = texture2D(sDiffMap, vTexCoord.xy).a;
if (alpha < 0.5)
discard;
#endif
gl_FragColor = vec4(EncodeDepth(vTexCoord.z), 1.0);
}