Remove duplication between world/chrome shaders.

This commit is contained in:
Paul Chote
2013-02-23 09:53:46 +13:00
parent 35a149ea87
commit a166815348
16 changed files with 8 additions and 179 deletions

18
glsl/shp.vert Normal file
View File

@@ -0,0 +1,18 @@
uniform vec2 Scroll;
uniform vec2 r1,r2; // matrix elements
vec4 DecodeChannelMask( float x )
{
if (x > 0.0)
return (x > 0.5) ? vec4(1,0,0,0) : vec4(0,1,0,0);
else
return (x < -0.5) ? vec4(0,0,0,1) : vec4(0,0,1,0);
}
void main()
{
vec2 p = (gl_Vertex.xy - Scroll.xy)*r1 + r2;
gl_Position = vec4(p.x,p.y,0,1);
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_TexCoord[1] = DecodeChannelMask(gl_MultiTexCoord0.w);
}