#version 150

// Can't moj_import in things used during startup, when resource packs don't exist.
// This is a copy of dynamicimports.glsl and projection.glsl
layout(std140) uniform DynamicTransforms {
    mat4 ModelViewMat;
    vec4 ColorModulator;
    vec3 ModelOffset;
    mat4 TextureMat;
    float LineWidth;
};
layout(std140) uniform Projection {
    mat4 ProjMat;
};

in vec3 Position;
in vec4 Color;

out vec4 vertexColor;

void main() {
    gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);

    vertexColor = Color;
	
	//	make the red background on outdated packs less harsh
	if ( length(Color.rgb - vec3(0.467, 0, 0) ) < 0.1 ) { 
		vertexColor = vec4(0.435, 0.122, 0.18, 0.6);
	}
		
	//	anti-contrast (#000)
	if ( length(Color.rgb - vec3(0, 0, 0) ) < 0.1 )
		{ vertexColor = vec4(0.102, 0.078, 0.141, Color.a); }
		
	//	anti-contrast (#FFF)
	if ( length(Color.rgb - vec3(1, 1, 1) ) < 0.1 )
		{ vertexColor = vec4(1.0, 0.925, 0.82, Color.a); }
		
	//	border color of box in language selection screen
	if ( length(Color.rgb - vec3(0.502,0.502,0.502) ) < 0.1 )
		{ vertexColor = vec4(0.843,0.616,0.878, Color.a); }
}
