summaryrefslogtreecommitdiff
path: root/engine/fragment.glsl
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-05-22 20:39:26 +0200
committerHampusM <hampus@hampusmat.com>2024-05-22 20:39:26 +0200
commitd4b61dd34b06119e87c8932ab7718d432dbc6a4f (patch)
tree2240158176c11eac545a1b50bbe644700b67ab51 /engine/fragment.glsl
parent8398025d7927564637e1ea67234665571dc7bcc5 (diff)
feat(engine): add point light attenuation
Diffstat (limited to 'engine/fragment.glsl')
-rw-r--r--engine/fragment.glsl5
1 files changed, 5 insertions, 0 deletions
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);
}