<commit_before>// -*-c-*-

float invSquareFalloff(const in float lampdist, const in float dist)
{
    return lampdist/(lampdist + dist*dist);
}
float invLinearFalloff(const in float lampdist, const in float dist)
{
    return lampdist/(lampdist + dist);
}

void computeLightDirection(const in vec3 lampvec, out vec3 lv )
{
    lv = -lampvec;
}

void computeLightPoint(const in vec3 vertexPosition, const in vec3 lampPosition, out vec3 lightVector, out float dist)
{
    lightVector = lampPosition-vertexPosition;
    dist = length(lightVector);
    lightVector = normalize(lightVector);
}

float specularCookTorrance(const in vec3 n, const in vec3 l, const in vec3 v, const in float hard)
{
    vec3 h = normalize(v + l);
    float nh = dot(n, h);
    float specfac = 0.0;

    if(nh > 0.0) {
        float nv = max(dot(n, v), 0.0);
        float i = pow(nh, hard);

        i = i/(0.1+nv);
        specfac = i;
    }
    return specfac;
}<commit_msg>optims as reading to find why I don't give lifht dir anymore<commit_after>// -*-c-*-

float invSquareFalloff(const in float lampdist, const in float dist)
{
    return lampdist/(lampdist + dist*dist);
}
float invLinearFalloff(const in float lampdist, const in float dist)
{
    return lampdist/(lampdist + dist);
}

void computeLightDirection(const in vec3 lampvec, out vec3 lv )
{
    lv = -lampvec;
}

void computeLightPoint(const in vec3 vertexPosition, const in vec3 lampPosition, out vec3 lightVector, out float dist)
{
    lightVector = lampPosition-vertexPosition;
    dist = length(lightVector);
    lightVector = dist > 0.0 ? 1.0 dist;  vec3(0.0,1.0,1.0);
}

float specularCookTorrance(const in vec3 n, const in vec3 l, const in vec3 v, const in float hard)
{
    vec3 h = normalize(v + l);
    float nh = dot(n, h);
    float specfac = 0.0;

    if(nh > 0.0) {
        float nv = max(dot(n, v), 0.0);
        float i = pow(nh, hard);

        i = i / (0.1 + nv);
        specfac = i;
    }
    return specfac;
}
{'fraction_non_alphanumeric': 0.11511156186612576, 'fraction_numerical': 0.02281947261663286, 'mean_word_length': 3.043032786885246, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '513723', 'n_tokens_mistral': 700, 'n_tokens_neox': 674, 'n_words': 221}