<commit_before>#version 330 core

in vec3 Normal;
in vec3 FragPos;
in vec3 LightPos;
in vec3 ViewPos;
in vec3 Color;

out vec4 FragColor;

uniform bool opacity;

void main()
{
    vec3 objectColor = Color;
    vec3 lightColor = vec3(0.7, 0.7, 0.7);
    vec3 ambient = vec3(0.2, 0.2, 0.2);
    float specularStrength = 0.5;
    float shininess = 16;

    vec3 norm = normalize(Normal);
    vec3 lightDir = normalize(LightPos - FragPos);
    vec3 viewDir = normalize(ViewPos - FragPos);
    vec3 reflectDir = reflect(-lightDir, norm);
    float diff = max(dot(norm, lightDir), 0.0);
    vec3 diffuse = diff * lightColor;
    float spec = pow(max(dot(viewDir, reflectDir), 0.0), shininess);
    vec3 specular = specularStrength * spec * lightColor;
    vec3 result = (ambient + diffuse + specular) * objectColor;
    FragColor = vec4(result, opacity);
}<commit_msg>Improved lighting model in triangle renderer<commit_after>#version 330 core

in vec3 Normal;
in vec3 FragPos;
in vec3 LightPos;
in vec3 ViewPos;
in vec3 Color;

out vec4 FragColor;

uniform bool opacity;

void main()
{
    vec3 objectColor = Color;
    vec3 lightColor = vec3(0.7, 0.7, 0.7);
    vec3 ambientColor = vec3(0.2, 0.2, 0.2);
    vec3 specularColor = vec3(1.0, 1.0, 1.0);
    float shininess = 16;

    // ambient
    vec3 ambient = lightColor * ambientColor;

    // diffuse
    vec3 norm = normalize(Normal);
    vec3 lightDir = normalize(LightPos - FragPos);
    float diff = max(dot(norm, lightDir), 0.0);
    vec3 diffuse = lightColor * (diff * objectColor);

    // specular
    vec3 viewDir = normalize(ViewPos - FragPos);
    vec3 reflectDir = reflect(-lightDir, norm);
    float spec = pow(max(dot(viewDir, reflectDir), 0.0), shininess);
    vec3 specular = lightColor * (spec * specularColor);

    vec3 result = ambient + diffuse + specular;
    FragColor = vec4(result, opacity);
}
{'fraction_non_alphanumeric': 0.11629153269024652, 'fraction_numerical': 0.04876741693461951, 'mean_word_length': 3.3723653395784545, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6345591', 'n_tokens_mistral': 699, 'n_tokens_neox': 647, 'n_words': 192}