By looking at your way I think my engine is either outdated or just bad as I have to use a .txt file for the most part.
#version 400 core
in vec2 pass_textureCoordinates;
in vec3 surfaceNormal;
in vec3 toLightVector[4];
in vec3 toCameraVector;
in float visibility;
out vec4 out_Color;
uniform sampler2D backgroundTexture;
uniform sampler2D rTexture;
uniform sampler2D gTexture;
uniform sampler2D bTexture;
uniform sampler2D blendMap;
uniform vec3 lightColour[4];
uniform vec3 attenuation[4];
uniform float shineDamper;
uniform float reflectivity;
uniform vec3 skyColour;
uniform vec3 biomeColour;
uniform vec3 biomeAttenuation;
uniform vec3 biomePosition;
void main(void){
vec4 blendMapColour = texture(blendMap, pass_textureCoordinates);
float backTextureAmount = 1 - (blendMapColour.r + blendMapColour.g + blendMapColour.b);
vec2 tiledCoords = pass_textureCoordinates * 40.0;
vec4 backgroundTextureColour = texture(backgroundTexture, tiledCoords) * backTextureAmount;
vec4 rTextureColour = texture(rTexture, tiledCoords) * blendMapColour.r;
vec4 gTextureColour = texture(gTexture, tiledCoords) * blendMapColour.g;
vec4 bTextureColour = texture(bTexture, tiledCoords) * blendMapColour.b;
vec4 totalColour = backgroundTextureColour + rTextureColour + gTextureColour + bTextureColour;
vec3 unitNormal = normalize(surfaceNormal);
vec3 unitVectorToCamera = normalize(toCameraVector);
vec3 totalDiffuse = vec3(0.0);
vec3 totalSpecular = vec3(0.0);
float biomeDistance =length(biomePosition);
float biomeAttFactor = biomeAttenuation.x + (biomeAttenuation.y * biomeDistance) + (biomeAttenuation.z * biomeDistance * biomeDistance);
vec3 finalBiomeColour = biomeColour / biomeAttFactor;
for(int i = 0; i < 4; i++) {
float distance = length(toLightVector[i]);
float attFactor = attenuation[i].x + (attenuation[i].y * distance) + (attenuation[i].z * distance * distance);
vec3 unitLightVector = normalize(toLightVector[i]);
float nDotl = dot(unitNormal,unitLightVector);
float brightness = max(nDotl,0.0);
vec3 lightDirection = -unitLightVector;
vec3 reflectedLightDirection = reflect(lightDirection,unitNormal);
float specularFactor = dot(reflectedLightDirection , unitVectorToCamera);
specularFactor = max(specularFactor,0.0);
float dampedFactor = pow(specularFactor,shineDamper);
totalDiffuse = totalDiffuse + (brightness * lightColour[i])/attFactor;
totalSpecular = totalSpecular + (dampedFactor * reflectivity * lightColour[i])/attFactor;
}
totalDiffuse = max(totalDiffuse, 0.2);
out_Color = vec4(totalDiffuse,1.0) * totalColour + vec4(totalSpecular,1.0);
out_Color = mix(vec4(skyColour, 1.0), out_Color, visibility);
out_Color = mix(vec4(finalBiomeColour, 1.0), out_Color, visibility);
}