
struct fragment {
	float4 position  : POSITION;
	float3 texcoord0 : TEXCOORD0;
	float dist : TEXCOORD1;
	float invdist : TEXCOORD2;
};

fragment main(float3 tex0 : TEXCOORD0,
              float4 position : POSITION,
              uniform float4x4 modelViewProj,
              uniform float3x3 textureMatrix)
{
	fragment OUT;

	OUT.position = mul(modelViewProj, position);
//	OUT.texcoord0 = mul(textureMatrix, tex0);

	float3 tex = mul(textureMatrix, tex0);
	OUT.texcoord0 = tex;
/*	tex = 1.0-tex*2.0;

	tex.x -= 0.5;
	tex.y -= 0.5;
	tex.z -= 0.5;*/

/*	tex.y -= 0.2;
	tex.z -= 0.3;*/

	OUT.dist = 0.01*tex.x;

/*	float invdist = 1.0-OUT.dist*2.0;
	OUT.invdist = invdist;//invdist*invdist;*/

	return OUT;
}
