// Pixel/Fragment shader for indexing into paletted textures

struct C3E3f_Output {
  float4 color : COLOR;
};

C3E3f_Output C3E3f_texture(float2 texCoord : TEXCOORD0,
                           uniform sampler2D decal : TEX0,
                           uniform sampler2D palette : TEX1,
                           uniform float palIndex)
{
  C3E3f_Output OUT;
  float2 palpos = tex2D(decal,texCoord).xy;
  palpos.y = palIndex;
  
  OUT.color = tex2D(palette, palpos);
  return OUT;
}

