Write z data to the depth buffer.
This commit is contained in:
@@ -17,25 +17,20 @@ void main()
|
||||
if (c.a == 0.0)
|
||||
discard;
|
||||
|
||||
if (EnableDepthPreview && length(vDepthMask) > 0.0)
|
||||
{
|
||||
if (abs(DepthTextureScale) > 0.0)
|
||||
{
|
||||
// Preview vertex aware depth
|
||||
float depth = gl_FragCoord.z + DepthTextureScale * dot(x, vDepthMask);
|
||||
float depth = gl_FragCoord.z;
|
||||
if (length(vDepthMask) > 0.0)
|
||||
{
|
||||
// Preview vertex aware depth
|
||||
depth = depth + DepthTextureScale * dot(x, vDepthMask);
|
||||
}
|
||||
|
||||
// Convert to window coords
|
||||
depth = 0.5 * depth + 0.5;
|
||||
// Convert to window coords
|
||||
gl_FragDepth = 0.5 * depth + 0.5;
|
||||
|
||||
// Front of the depth buffer is at 0, but we want to render it as bright
|
||||
gl_FragColor = vec4(vec3(1.0 - depth), 1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Preview boring sprite-only depth
|
||||
float depth = dot(x, vDepthMask);
|
||||
gl_FragColor = vec4(depth, depth, depth, 1.0);
|
||||
}
|
||||
if (EnableDepthPreview)
|
||||
{
|
||||
// Front of the depth buffer is at 0, but we want to render it as bright
|
||||
gl_FragColor = vec4(vec3(1.0 - gl_FragDepth), 1.0);
|
||||
}
|
||||
else
|
||||
gl_FragColor = c;
|
||||
|
||||
Reference in New Issue
Block a user