
struct fragment {
	float4 position  : POSITION;
	float2 texcoord0 : TEXCOORD0;
};

float4 main(float2 texcoord : TEXCOORD0,
			uniform sampler2D texture,
			uniform float bri,
			uniform float intensity,
			uniform float xmul,
			uniform float ymul) : COLOR0
{
	float2 paskamul = float2(xmul, ymul);
//	float2 texnew1 = texcoord*paskamul;

	float3 col = tex2D(texture, texcoord).rgb;

	float raster = 0.003;

	float ftx = fmod(texcoord.x, raster*2.0);
	float fty = fmod(texcoord.y, raster*2.0);
/*
	if (ftx > raster) {
		texcoord.x += raster;
	} else {
		texcoord.x -= raster;
	}
*/
	if (fty > raster) {
		texcoord.y += raster;
	} else {
		texcoord.y -= raster;
	}

//	bri *= max(sin(ftx*(0.5/raster)*3.14159), sin(fty*(0.5/raster)*3.14159));
	bri *= sin(fty*(0.5/raster)*3.14159);

	col = tex2D(texture, texcoord).rgb;

//	if (texcoord.y > 0.25) col = 0;

	return float4(col*bri, 1.0);
}
