Add a secondary texture coordinate to Vertex.

This commit is contained in:
Paul Chote
2016-04-10 12:46:31 -04:00
parent f07a5d6f69
commit 7c67b10d28
11 changed files with 59 additions and 47 deletions

View File

@@ -4,13 +4,14 @@ uniform bool EnableDepthPreview;
uniform float DepthTextureScale;
varying vec4 vTexCoord;
varying vec2 vTexMetadata;
varying vec4 vChannelMask;
varying vec4 vDepthMask;
void main()
{
vec4 x = texture2D(DiffuseTexture, vTexCoord.st);
vec2 p = vec2(dot(x, vChannelMask), vTexCoord.p);
vec2 p = vec2(dot(x, vChannelMask), vTexMetadata.s);
vec4 c = texture2D(Palette, p);
// Discard any transparent fragments (both color and depth)

View File

@@ -3,7 +3,9 @@ uniform vec3 r1, r2;
attribute vec4 aVertexPosition;
attribute vec4 aVertexTexCoord;
attribute vec2 aVertexTexMetadata;
varying vec4 vTexCoord;
varying vec2 vTexMetadata;
varying vec4 vChannelMask;
varying vec4 vDepthMask;
@@ -38,6 +40,7 @@ void main()
{
gl_Position = vec4((aVertexPosition.xyz - Scroll.xyz) * r1 + r2, 1);
vTexCoord = aVertexTexCoord;
vChannelMask = DecodeChannelMask(aVertexTexCoord.w);
vDepthMask = DecodeDepthChannelMask(aVertexTexCoord.w);
vTexMetadata = aVertexTexMetadata;
vChannelMask = DecodeChannelMask(aVertexTexMetadata.t);
vDepthMask = DecodeDepthChannelMask(aVertexTexMetadata.t);
}

View File

@@ -3,6 +3,7 @@ uniform mat4 TransformMatrix;
attribute vec4 aVertexPosition;
attribute vec4 aVertexTexCoord;
attribute vec2 aVertexTexMetadata;
varying vec4 vTexCoord;
varying vec4 vChannelMask;
varying vec4 vNormalsMask;
@@ -19,6 +20,6 @@ void main()
{
gl_Position = View*TransformMatrix*aVertexPosition;
vTexCoord = aVertexTexCoord;
vChannelMask = DecodeMask(aVertexTexCoord.z);
vNormalsMask = DecodeMask(aVertexTexCoord.w);
vChannelMask = DecodeMask(aVertexTexMetadata.s);
vNormalsMask = DecodeMask(aVertexTexMetadata.t);
}