Add a visualisation mode for depth sprites.

For now this displays the raw sprites.  It will
eventually be repurposed for rendering the proper
depth data.
This commit is contained in:
Paul Chote
2015-09-28 19:47:35 +01:00
parent b08adbeb61
commit 83949b250a
7 changed files with 165 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
uniform sampler2D DiffuseTexture, Palette;
uniform bool EnableDepthPreview;
varying vec4 TexCoord;
varying vec4 ChannelMask;
varying vec4 DepthMask;
@@ -8,5 +10,17 @@ void main()
{
vec4 x = texture2D(DiffuseTexture, TexCoord.st);
vec2 p = vec2(dot(x, ChannelMask), TexCoord.p);
gl_FragColor = texture2D(Palette, p);
vec4 c = texture2D(Palette, p);
// Discard any transparent fragments (both color and depth)
if (c.a == 0.0)
discard;
if (EnableDepthPreview && length(DepthMask) > 0.0)
{
float depth = dot(x, DepthMask);
gl_FragColor = vec4(depth, depth, depth, 1);
}
else
gl_FragColor = c;
}