#version 150

#moj_import <minecraft:fog.glsl>
#moj_import <minecraft:dynamictransforms.glsl>
#moj_import <minecraft:projection.glsl>

in vec3 Position;
//uniform mat4 ModelViewMat;

out float sphericalVertexDistance;
out float cylindricalVertexDistance;

void main() {
    vec4 pos = vec4(Position, 1.0);
	
	/*
	if(ProjMat[3][2] != -2.0) { 
		//		make sky cover entire sky
		pos = ProjMat * vec4(Position, 1.0);
		pos.y -= pos.z;
	} else { 
		//		vanilla behavior (for text highlight)
		pos = ProjMat * ModelViewMat * vec4(Position, 1.0);
	}
	
	*/
	
	//		make sky cover entire sky
	pos = ProjMat * vec4(Position, 1.0);
	pos.y -= pos.z;
	
	//def rest
	gl_Position = ProjMat * ModelViewMat * vec4(pos.xyz, 1.0); //pos;
	
    //vertexDistance = length(  (ModelViewMat * vec4(Position, 1.0)).xyz );
	
	sphericalVertexDistance = fog_spherical_distance(pos.xyz);
    cylindricalVertexDistance = fog_cylindrical_distance(pos.xyz);
}
