From d4b61dd34b06119e87c8932ab7718d432dbc6a4f Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 22 May 2024 20:39:26 +0200 Subject: feat(engine): add point light attenuation --- engine/fragment.glsl | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'engine/fragment.glsl') diff --git a/engine/fragment.glsl b/engine/fragment.glsl index 428e87f..a9d192b 100644 --- a/engine/fragment.glsl +++ b/engine/fragment.glsl @@ -30,5 +30,10 @@ void main() in_texture_coords ); + float attenuation = calc_attenuation(light, in_frag_pos); + + diffuse_light *= attenuation; + specular_light *= attenuation; + FragColor = vec4((ambient_light + diffuse_light + specular_light), 1.0); } -- cgit v1.2.3-18-g5258