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 light = normalize(world_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;
+ color += phong_one_light(light, normal, look, light_sources[0].color, surface_diffuse, surface_specular, shininess)*shadow;
if(use_emission)
color += get_emission_color();
void main()
{
- vec3 normal;
- vec3 look;
- if(use_normal_map)
- {
- normal = get_fragment_normal();
- look = normalize(tbn_look_dir);
- }
- else
- {
- normal = normalize(eye_normal);
- look = normalize(eye_look_dir);
- }
+ vec3 normal = get_fragment_normal();
+ vec3 look = normalize(world_look_dir);
vec4 surface_diffuse = get_diffuse_color();
vec3 surface_specular = get_specular_color();