<commit_before>struct DirectionalLight {
    vec4 ambient;
    vec4 diffuse;
    vec4 specular;
    vec3 direction;
};

void calculateLight(in DirectionalLight _light, in vec3 _eyeToPoint, in vec3 _normal){

    #ifdef TANGRAM_MATERIAL_AMBIENT
        g_light_accumulator_ambient += _light.ambient;
    #endif

    float nDotVP = clamp(dot(_normal, -_light.direction), 0.0, 1.0);

    #ifdef TANGRAM_MATERIAL_DIFFUSE
        g_light_accumulator_diffuse += _light.diffuse * nDotVP;
    #endif

    #ifdef TANGRAM_MATERIAL_SPECULAR
        float pf = 0.0;
        if (nDotVP > 0.0) {
            vec3 reflectVector = reflect(_light.direction, _normal);
            float eyeDotR = max(dot(normalize(_eyeToPoint), reflectVector), 0.0);
            pf = pow(eyeDotR, g_material.shininess);
        }
        g_light_accumulator_specular += _light.specular * pf;
    #endif
}
<commit_msg>normalize light direction<commit_after>struct DirectionalLight {
    vec4 ambient;
    vec4 diffuse;
    vec4 specular;
    vec3 direction;
};

void calculateLight(in DirectionalLight _light, in vec3 _eyeToPoint, in vec3 _normal){

    #ifdef TANGRAM_MATERIAL_AMBIENT
        g_light_accumulator_ambient += _light.ambient;
    #endif

    float nDotVP = clamp(dot(_normal, -normalize(_light.direction)), 0.0, 1.0);

    #ifdef TANGRAM_MATERIAL_DIFFUSE
        g_light_accumulator_diffuse += _light.diffuse * nDotVP;
    #endif

    #ifdef TANGRAM_MATERIAL_SPECULAR
        float pf = 0.0;
        if (nDotVP > 0.0) {
            vec3 reflectVector = reflect(normalize(_light.direction), _normal);
            float eyeDotR = max(dot(normalize(_eyeToPoint), reflectVector), 0.0);
            pf = pow(eyeDotR, g_material.shininess);
        }
        g_light_accumulator_specular += _light.specular * pf;
    #endif
}

{'fraction_non_alphanumeric': 0.09222222222222222, 'fraction_numerical': 0.01888888888888889, 'mean_word_length': 3.029082774049217, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4315765', 'n_tokens_mistral': 657, 'n_tokens_neox': 600, 'n_words': 124}