Skip to content

Commit 60df6a0

Browse files
authored
Ambienh phong fixed. Included light_color_inf coefficient
1 parent c5caf62 commit 60df6a0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Phong.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const RGBColor Phong::shade(const ShadeRec& sr) const {
3434
diffuse += Kd * std::fmax(L*N,0) * (light_color_inf * Lcolor + (1 - light_color_inf) * sr.material_ptr->color);
3535
specular += Ks * pow(std::fmax(R*V,0), specular_e) * (light_color_inf * Lcolor + (1 - light_color_inf) * sr.material_ptr->color);
3636
}
37-
const RGBColor ambient = Ka * sr.material_ptr->color;
37+
const RGBColor ambient = Ka * (light_color_inf * sr.world_ptr->m_ambient->get_color(sr) + (1 - light_color_inf) * sr.material_ptr->color);
3838

3939
return (ambient + diffuse + specular);
4040
}

0 commit comments

Comments
 (0)