diff options
author | HampusM <hampus@hampusmat.com> | 2024-05-22 20:39:26 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-05-22 20:39:26 +0200 |
commit | d4b61dd34b06119e87c8932ab7718d432dbc6a4f (patch) | |
tree | 2240158176c11eac545a1b50bbe644700b67ab51 /engine/fragment.glsl | |
parent | 8398025d7927564637e1ea67234665571dc7bcc5 (diff) |
feat(engine): add point light attenuation
Diffstat (limited to 'engine/fragment.glsl')
-rw-r--r-- | engine/fragment.glsl | 5 |
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); } |