// This is C3E3f_texture from "The Cg Tutorial" (Addison-Wesley, ISBN
// 0321194969) by Randima Fernando and Mark J. Kilgard.  See page 67.

struct C3E3f_Output {
  float4 color : COLOR;
};

C3E3f_Output sinFlash(float2 texCoord : TEXCOORD0,
                           uniform sampler2D decal : TEX0,
						   uniform float3 color : COLOR,
						   uniform float elapsedTime : TIME,
						   uniform float currentTime : TIME)
{
  C3E3f_Output OUT;
  OUT.color = tex2D(decal,texCoord);
  
  //sin to alternate smoothly between on and off
  //additional math to clamp the range between 0.5 and 1.0
  OUT.color.xyz = ((sin(currentTime * 2) + 1.0f ) / 4.0f + 0.5f)* OUT.color.xyz;
  return OUT;
}

