matrix complete;
matrix world;
float4 eye;
float4 target;
float4 const_mount;

struct vsinput
{
    float4 pos				: POSITION;
    float4 normal			: NORMAL;
    float2 tc				: TEXCOORD0;
};

struct vsoutput
{
    float4 pos				: POSITION;
    float2 bump				: TEXCOORD0;
    float2 sky				: TEXCOORD1;
    float4 diffuse			: COLOR0;
};


vsoutput main(vsinput v)
{
	vsoutput o;
	float4 invec;
	float4 outvec;
	float4 lookvec;
	
	// Bare ganger normalen med world
	v.normal = mul(v.normal, world);
	
	// og posisjon med complete
	o.pos = mul(v.pos, complete); 
	
	// diffuse
	// hvis man ser vinkelrett p vannet s er diffuse lav
	// ser man langs med vannet fr man mye refleksjon
	// alts:
	invec = normalize(v.pos - eye);		// finner frst vektoren punkt-->eye
	o.diffuse = 1+dot(invec, v.normal);	// dotter med normalen for  finne alpha
	
	// reflekterer omgivelsene i sjen
	outvec = reflect(invec, v.normal);
	o.sky.x = 0.4 * outvec.x + 0.4;
	o.sky.y = 0.4 * outvec.y + 0.4;
	
	// bumpmap
	// statiske teksturkoordinater
	o.bump.x = v.pos.x * 0.01;
	o.bump.y = v.pos.y * 0.01;
	
	return o;	
}