matrix complete;
matrix world;
float4 eye;

struct vsinput
{
	float4 pos				: POSITION;
    float4 normal			: NORMAL;
};

struct vsoutput
{
    float4 pos				: POSITION;
    float2 tc				: TEXCOORD0;
    float3 diffuse			: COLOR0;
};


vsoutput main(vsinput v)
{
	vsoutput o;
	
	// ganger normalen med world
	v.normal = mul(v.normal, world);
	
	// og posisjon med complete
	o.pos = mul(v.pos, complete); 
	
	// lager caustics
	float4 invec = normalize(v.pos-eye);
	float4 outvec = refract(invec, v.normal, 0.45);
	
	o.tc.x = 0.3 * outvec.x + 0.7;
	o.tc.y = 0.3 * outvec.y + 0.7;
	o.diffuse = 1;
	
	return o;
}