<commit_before>struct LightParams
{
    float x,y,z,intensity;
};

layout(std430, binding = 1) readonly buffer PointLightParamsBuffer { LightParams point_light_params[]; };
layout(std430, binding = 2) readonly buffer DistantLightParamsBuffer { LightParams distant_light_params[]; };

uniform sampler2D albedo_tx2D;
uniform sampler2D normal_tx2D;
uniform sampler2D depth_tx2D;

layout(rgba16) writeonly uniform image2D tgt_tx2D;

uniform int point_light_cnt;
uniform int distant_light_cnt;

uniform mat4 inv_view_mx;
uniform mat4 inv_proj_mx;


vec3 depthToWorldPos(float depth, vec2 uv) {
    float z = depth * 2.0 - 1.0;

    vec4 cs_pos = vec4(uv * 2.0 - 1.0, z, 1.0);
    vec4 vs_pos = inv_proj_mx * cs_pos;

    // Perspective division
    vs_pos /= vs_pos.w;
    
    vec4 ws_pos = inv_view_mx * vs_pos;

    return ws_pos.xyz;
}

float lambert(vec3 normal, vec3 light_dir)
{
    return clamp(dot(normal,light_dir),0.0,1.0);
}


layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;

void main() {<commit_msg>Start Blinn Phong Function<commit_after>struct LightParams
{
    float x,y,z,intensity;
};

layout(std430, binding = 1) readonly buffer PointLightParamsBuffer { LightParams point_light_params[]; };
layout(std430, binding = 2) readonly buffer DistantLightParamsBuffer { LightParams distant_light_params[]; };

uniform sampler2D albedo_tx2D;
uniform sampler2D normal_tx2D;
uniform sampler2D depth_tx2D;

layout(rgba16) writeonly uniform image2D tgt_tx2D;

uniform int point_light_cnt;
uniform int distant_light_cnt;

uniform mat4 inv_view_mx;
uniform mat4 inv_proj_mx;

uniform vec3 ambientColor; 
uniform vec3 diffuseColor;
uniform vec3 specularColor;

uniform float k_amb;
uniform float k_diff;
uniform float k_spec;
uniform float k_exp;


vec3 depthToWorldPos(float depth, vec2 uv) {
    float z = depth * 2.0 - 1.0;

    vec4 cs_pos = vec4(uv * 2.0 - 1.0, z, 1.0);
    vec4 vs_pos = inv_proj_mx * cs_pos;

    // Perspective division
    vs_pos /= vs_pos.w;
    
    vec4 ws_pos = inv_view_mx * vs_pos;

    return ws_pos.xyz;
}

//Lambert Illumination 
float lambert(vec3 normal, vec3 light_dir)
{
    return clamp(dot(normal,light_dir),0.0,1.0);
}

//Blinn-Phong Illumination 
float blinnPhong(vec3 normal, vec3 l, vec3 v){
    vec3 Colorout = vec3(0.0);

    //Ambient Part
    //vec3 Camb = k_amb * ambientColor ;

    //Diffuse Part
    //vec3 Cdiff = diffuseColor * k_diff * dot(n,l);

    //Specular Part
    //vec3 h = normalize(v+l);
    //normal = normal / sqrt(normal.x*normal.x + normal.y*normal.y + normal.z*normal.z);
    //float costheta = dot(h,normal);
    //vec3 Cspek = specularColor * k_spec * ((k_exp + 2)/(2 * M_PI)) * pow(costheta, k_exp);

    //Final Equation
    //Colorout = Camb + Cdiff + Cspek;
    return Colorout;
}

layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;

void main() {
{'fraction_non_alphanumeric': 0.10756832515767344, 'fraction_numerical': 0.03714085494043448, 'mean_word_length': 3.9224137931034484, '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': '4037175', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1063, 'n_words': 267}