<commit_before>vec3 LINEARtoSRGB(vec3 linearIn) 
{
    #ifndef HDR 
    return pow(linearIn, vec3(1.0/2.2));
    #else 
    return linearIn;
    #endif 
}

#ifdef LIGHTING_PBR
vec3 applyTonemapping(vec3 linearIn) 
{
    #ifndef HDR 
    return czm_acesTonemapping(linearIn);
    #else 
    return linearIn;
    #endif 
}

vec3 computePbrLighting(czm_modelMaterial inputMaterial)
{
    czm_pbrParameters pbrParameters;
    pbrParameters.diffuseColor = inputMaterial.diffuse;
    pbrParameters.f0 = inputMaterial.specular;
    pbrParameters.roughness = inputMaterial.roughness;
    
    vec3 lightColorHdr = czm_lightColorHdr;

    vec3 color = czm_pbrLighting(
        v_positionEC,
        inputMaterial.normal,
        czm_lightDirectionEC,
        lightColorHdr,
        pbrParameters
    );

    color *= inputMaterial.occlusion;
    color += inputMaterial.emissive;

    // Convert high-dynamic range to low-dynamic range in HDR mode
    color = applyTonemapping(color);
    return color;
}
#endif


czm_modelMaterial lightingStage(czm_modelMaterial inputMaterial)
{
    // Even though the lighting will only set the diffuse color,
    // pass all other properties too so further stages have access to them.
    czm_modelMaterial outputMaterial = inputMaterial;
    vec3 color = vec3(0.0);

    #ifdef LIGHTING_PBR
    color = computePbrLighting(inputMaterial);
    #else // unlit
    color = inputMaterial.diffuse;
    #endif

    color = LINEARtoSRGB(color);

    outputMaterial.diffuse = color;
    return outputMaterial;
}<commit_msg>Skip pbr lighting call if the model does not have normals<commit_after>vec3 LINEARtoSRGB(vec3 linearIn) 
{
    #ifndef HDR 
    return pow(linearIn, vec3(1.0/2.2));
    #else 
    return linearIn;
    #endif 
}

#ifdef LIGHTING_PBR
vec3 applyTonemapping(vec3 linearIn) 
{
    #ifndef HDR 
    return czm_acesTonemapping(linearIn);
    #else 
    return linearIn;
    #endif 
}

vec3 computePbrLighting(czm_modelMaterial inputMaterial)
{
    czm_pbrParameters pbrParameters;
    pbrParameters.diffuseColor = inputMaterial.diffuse;
    pbrParameters.f0 = inputMaterial.specular;
    pbrParameters.roughness = inputMaterial.roughness;
    
    vec3 lightColorHdr = czm_lightColorHdr;

    vec3 color = inputMaterial.diffuse;
    #ifdef HAS_NORMALS
    color = czm_pbrLighting(
        v_positionEC,
        inputMaterial.normal,
        czm_lightDirectionEC,
        lightColorHdr,
        pbrParameters
    );
    #endif

    color *= inputMaterial.occlusion;
    color += inputMaterial.emissive;

    // Convert high-dynamic range to low-dynamic range in HDR mode
    color = applyTonemapping(color);
    return color;
}
#endif


czm_modelMaterial lightingStage(czm_modelMaterial inputMaterial)
{
    // Even though the lighting will only set the diffuse color,
    // pass all other properties too so further stages have access to them.
    czm_modelMaterial outputMaterial = inputMaterial;
    vec3 color = vec3(0.0);

    #ifdef LIGHTING_PBR
    color = computePbrLighting(inputMaterial);
    #else // unlit
    color = inputMaterial.diffuse;
    #endif

    color = LINEARtoSRGB(color);

    outputMaterial.diffuse = color;
    return outputMaterial;
}
{'fraction_non_alphanumeric': 0.07350641226149515, 'fraction_numerical': 0.010634970284641852, 'mean_word_length': 3.2413793103448274, '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': '3134235', 'n_tokens_mistral': 1044, 'n_tokens_neox': 1003, 'n_words': 237}