<commit_before>
#ifndef NB_POINT_LIGHTS
#define NB_POINT_LIGHTS 0
#endif

#ifndef NB_SPOT_LIGHTS
#define NB_SPOT_LIGHTS 0
#endif

#ifndef NB_DIRECTIONAL_LIGHTS
#define NB_DIRECTIONAL_LIGHTS 0
#endif

struct Material {
    sampler2D diffuse;
    sampler2D specular;
    float shininess;
    vec2 textureCoordsOffset;
};

// [0] = ambient, [1] = diffuse, [2] = specular intensities
#define BaseLight vec3
// [0] = direction, [1] = BaseLight
#define DirLight mat2x3
// [0] = Position, [1] = BaseLight, [2] = constant/linear/quadratic
#define PointLight mat3

uniform vec3 viewPos;
#if defined(NB_DIRECTIONAL_LIGHTS) && NB_DIRECTIONAL_LIGHTS > 0
uniform DirLight dirLights[NB_DIRECTIONAL_LIGHTS];
#endif
#if defined(NB_POINT_LIGHTS) && NB_POINT_LIGHTS > 0
uniform PointLight pointLights[NB_POINT_LIGHTS];
#endif
uniform Material material;

vec4 CalcLightBase(BaseLight light, vec3 lightDir, vec3 normal, vec3 viewDir) {
    // Diffuse shading
    float diff = max(dot(normal, lightDir), 0.0);
    // Specular shading
    vec3 reflectDir = reflect(-lightDir, normal);
    float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);
    // Combine results
    vec4 diffTex = texture(material.diffuse, GetTexCoords(material.textureCoordsOffset));
    #ifdef ALPHAMASK
        if (diffTex.a < 0.1) {
            discard;
        }
    #endif
    vec4 specTex = texture(material.specular, GetTexCoords(material.textureCoordsOffset));
    #ifdef ALPHAMASK
        if (specTex.a < 0.1) {
            discard;
        }
    #endif
    vec4 ambient = light[0] * diffTex;
    vec4 diffuse = light[1] * diff * diffTex;
    vec4 specular = light[2] * spec * specTex;<commit_msg>Make lighting shader more receptive to alpha<commit_after>
#ifndef NB_POINT_LIGHTS
#define NB_POINT_LIGHTS 0
#endif

#ifndef NB_SPOT_LIGHTS
#define NB_SPOT_LIGHTS 0
#endif

#ifndef NB_DIRECTIONAL_LIGHTS
#define NB_DIRECTIONAL_LIGHTS 0
#endif

struct Material {
    sampler2D diffuse;
    sampler2D specular;
    float shininess;
    vec2 textureCoordsOffset;
};

// [0] = ambient, [1] = diffuse, [2] = specular intensities
#define BaseLight vec3
// [0] = direction, [1] = BaseLight
#define DirLight mat2x3
// [0] = Position, [1] = BaseLight, [2] = constant/linear/quadratic
#define PointLight mat3

uniform vec3 viewPos;
#if defined(NB_DIRECTIONAL_LIGHTS) && NB_DIRECTIONAL_LIGHTS > 0
uniform DirLight dirLights[NB_DIRECTIONAL_LIGHTS];
#endif
#if defined(NB_POINT_LIGHTS) && NB_POINT_LIGHTS > 0
uniform PointLight pointLights[NB_POINT_LIGHTS];
#endif
uniform Material material;

vec4 CalcLightBase(BaseLight light, vec3 lightDir, vec3 normal, vec3 viewDir) {
    // Diffuse shading
    float diff = max(dot(normal, lightDir), 0.0);
    // Specular shading
    vec3 reflectDir = reflect(-lightDir, normal);
    float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);
    // Combine results
    vec4 diffTex = texture(material.diffuse, GetTexCoords(material.textureCoordsOffset));
    #ifdef ALPHAMASK
        if (diffTex.a < 0.01) {
            discard;
        }
    #endif
    vec4 specTex = texture(material.specular, GetTexCoords(material.textureCoordsOffset));
    #ifdef ALPHAMASK
        if (specTex.a < 0.01) {
            discard;
        }
    #endif
    vec4 ambient = light[0] * diffTex;
    vec4 diffuse = light[1] * diff * diffTex;
    vec4 specular = light[2] * spec * specTex;
{'fraction_non_alphanumeric': 0.10398818316100443, 'fraction_numerical': 0.025406203840472673, 'mean_word_length': 3.844062947067239, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7563940', 'n_tokens_mistral': 1256, 'n_tokens_neox': 1193, 'n_words': 291}