
// ------- UNIFORMS (SHADER CONSTS) -------
cbuffer PMV
{
	mat4		hu_mPMVMatrix;
};
mat4			hu_mMMatrix;
vec3			hu_vCameraPos;

// ------- ATTRIBUTES (VERTEX BUFFER DATA) -------
struct VIn
{
	vec4	position: POSITION;
	vec4	color: COLOR;
};

// ------- INTERPOLATORS (SHADER OUTPUTS) -------
struct PIn
{
    vec4	position: SV_POSITION;
	vec4	color: COLOR;
	float	distToCamera: TEXCOORD;
};

PIn main(VIn input)
{
	PIn output;
	vec4 vWorldPos = mul(hu_mMMatrix, input.position);
	vec3 vDiff = vWorldPos.xyz - hu_vCameraPos;

	output.distToCamera = length(vDiff);
	output.color = input.color;
	output.position = mul(hu_mPMVMatrix, input.position);
	return output;
}
