uniform float4x4 ViewProj;
uniform texture2d image;
uniform bool use_color;

sampler_state def_sampler {
	Filter   = Linear;
	AddressU = Clamp;
	AddressV = Clamp;
};

struct VertInOut {
	float4 pos : POSITION;
	float2 uv  : TEXCOORD0;
	float4 col : COLOR;
};

VertInOut VSDefault(VertInOut vert_in)
{
	VertInOut vert_out;
	vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
	vert_out.uv  = vert_in.uv;
	vert_out.col = use_color ? vert_in.col : float4(0.0, 0.0, 0.0, 1.0);
	return vert_out;
}

float4 PSDrawBare(VertInOut vert_in) : TARGET
{
	vert_in.col.a *= image.Sample(def_sampler, vert_in.uv).a;
	return vert_in.col;
}

technique Draw
{
	pass
	{
		vertex_shader = VSDefault(vert_in);
		pixel_shader  = PSDrawBare(vert_in);
	}
}
