#version 430
#define WEIGHT_R 0.299
#define WEIGHT_G 0.587
#define WEIGHT_B 0.114

uniform vec4 color_gbl;

smooth in vec4 bary;
out vec4 out_Color;

void main(void) {
	float baselum = 0.0;
	baselum += bary.r * WEIGHT_R;
	baselum += bary.g * WEIGHT_G;
	baselum += bary.b * WEIGHT_B;
	float boost = color_gbl.z / baselum;
	out_Color.r = bary.r * boost;
	out_Color.g = bary.g * boost;
	out_Color.b = bary.b * boost;
	out_Color.a = 1.0f;
}
