<commit_before>#version 110

uniform sampler2D normal_map;
uniform sampler2D colour_map;

float far  = 150.0;
float near = 0.3;
varying vec3 NORMAL;
varying vec2 texcord;
varying mat3 TBN;

varying vec3 POSITION;

#define MAX_LIGHTS 4


float LinearizeDepth(float depth)
{
    float z = depth * 2.0 - 1.0;
    return (2.0 * near * far) / (far + near - z * (far - near));
}

void main()
{
        vec3 normal = TBN * vec3(texture2D(normal_map, texcord));
        float NormalMapFactor = dot(normal, vec3(-vec3(POSITION) + vec3(0.2)));
        float l = length(vec3(POSITION) - vec3(0.2));
    float depth = LinearizeDepth(gl_FragCoord.z) / far;
         gl_FragDepth = depth;

        vec4 finalColor = vec4(0.0, 0.0, 0.0, 0.0);

        for (int i=0; i < MAX_LIGHTS; i++)
            {
               vec3 L = normalize(gl_LightSource[i].position.xyz - POSITION);
               vec3 E = normalize(-POSITION);
               vec3 R = normalize(-reflect(L, NORMAL));

               //calculate Ambient Term:
               vec4 Iamb = gl_FrontLightProduct[i].ambient;

               //calculate Diffuse Term:
               vec4 Idiff = gl_FrontLightProduct[i].diffuse * max(dot(NORMAL, L), 0.0);
               Idiff = clamp(Idiff, 0.0, 1.0);

               // calculate Specular Term:
               /*
               vec4 Ispec = gl_FrontLightProduct[i].specular
                            * pow(max(dot(R,E),0.0),0.3*gl_FrontMaterial.shininess);
               Ispec = clamp(Ispec, 0.0, 1.0);
               */

               finalColor += Iamb + Idiff /*+ Ispec*/;
            }


               // write Total Color:
               gl_FragColor = vec4(vec3(texture2D(colour_map, texcord)),  texture2D(colour_map, texcord).a) + gl_FrontLightModelProduct.sceneColor + finalColor;

}<commit_msg>sineas light algorithm implementation<commit_after>#version 110

uniform sampler2D normal_map;
uniform sampler2D colour_map;

float far  = 150.0;
float near = 0.3;
varying vec3 NORMAL;
varying vec2 texcord;
varying mat3 TBN;

varying vec3 POSITION;


#define MAX_LIGHTS 4


float LinearizeDepth(float depth)
{
    float z = depth * 2.0 - 1.0;
    return (2.0 * near * far) / (far + near - z * (far - near));
}

void main()
{
        vec3 normal = TBN * vec3(texture2D(normal_map, texcord));
        float NormalMapFactor = dot(normal, vec3(-vec3(POSITION) + vec3(0.2)));
        float l;
    float depth = LinearizeDepth(gl_FragCoord.z) / far;
         gl_FragDepth = depth;


        for (int i=0; i < MAX_LIGHTS; i++)
            {
               l = length(gl_LightSource[i].position.xyz - POSITION);
               gl_FragColor += vec4(vec3(texture2D(colour_map, texcord)) / l,  texture2D(colour_map, texcord).a);
            }

}
{'fraction_non_alphanumeric': 0.12280701754385964, 'fraction_numerical': 0.038011695906432746, 'mean_word_length': 2.197429906542056, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '1669391', 'n_tokens_mistral': 1010, 'n_tokens_neox': 944, 'n_words': 219}