Use explicit shader attributes.

This commit is contained in:
Paul Chote
2015-12-19 23:57:52 +00:00
parent 788def1c31
commit be29ec5342
11 changed files with 64 additions and 38 deletions

View File

@@ -2,23 +2,23 @@ uniform sampler2D DiffuseTexture, Palette;
uniform bool EnableDepthPreview;
varying vec4 TexCoord;
varying vec4 ChannelMask;
varying vec4 DepthMask;
varying vec4 vTexCoord;
varying vec4 vChannelMask;
varying vec4 vDepthMask;
void main()
{
vec4 x = texture2D(DiffuseTexture, TexCoord.st);
vec2 p = vec2(dot(x, ChannelMask), TexCoord.p);
vec4 x = texture2D(DiffuseTexture, vTexCoord.st);
vec2 p = vec2(dot(x, vChannelMask), vTexCoord.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)
if (EnableDepthPreview && length(vDepthMask) > 0.0)
{
float depth = dot(x, DepthMask);
float depth = dot(x, vDepthMask);
gl_FragColor = vec4(depth, depth, depth, 1);
}
else