X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=shaderlib%2Fphong.glsl;h=32fa43cc61ef6143343fd893c2d304ee72107229;hb=ab23d3910ac081066b42c184c6229aaa397dd46c;hp=570024ab1b5aaa27f22c8796a05d2353c8349511;hpb=4c11957c4e26b2c369f0399c85bafcb6eb58edd4;p=libs%2Fgl.git diff --git a/shaderlib/phong.glsl b/shaderlib/phong.glsl index 570024ab..32fa43cc 100644 --- a/shaderlib/phong.glsl +++ b/shaderlib/phong.glsl @@ -79,30 +79,29 @@ vec3 phong_ambient(vec3 surface_diffuse) return ambient_color.rgb*surface_diffuse; } -vec3 phong_one_light(vec3 light, vec3 normal, vec3 look, vec3 light_color, vec3 surface_diffuse, vec3 surface_specular, float shininess) +vec3 phong_one_light(vec3 light, vec3 normal, vec3 look, vec3 surface_diffuse, vec3 surface_specular, float shininess) { float diffuse_intensity = max(dot(light, normal), 0.0); - vec3 color = light_color*surface_diffuse*diffuse_intensity; + vec3 color = surface_diffuse*diffuse_intensity; if(use_specular) { vec3 reflected = reflect(look, normal); float specular_intensity = pow(max(dot(reflected, light), 0.0), shininess); - color += light_color*surface_specular*specular_intensity; + color += surface_specular*specular_intensity; } return color; } vec3 phong_lighting(vec3 normal, vec3 look, vec3 surface_diffuse, vec3 surface_specular, float shininess) { - vec3 light; - if(use_normal_map) - light = normalize(tbn_light_dir); - else - light = normalize(eye_light_dir); - vec3 color = phong_ambient(surface_diffuse); - float shadow = get_shadow_factor(0); - color += phong_one_light(light, normal, look, light_sources[0].diffuse.rgb, surface_diffuse, surface_specular, shininess)*shadow; + for(int i=0; i