From 8c2386442a60bac743a6e80d5ba024efe92958c5 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 23 Sep 2021 19:11:29 -0400 Subject: graphics: light: Add intensity field. --- data/shaders/pbr-frag.glsl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'data/shaders/pbr-frag.glsl') diff --git a/data/shaders/pbr-frag.glsl b/data/shaders/pbr-frag.glsl index fff725a..e6bcdc5 100644 --- a/data/shaders/pbr-frag.glsl +++ b/data/shaders/pbr-frag.glsl @@ -20,6 +20,7 @@ struct Light { vec3 position; vec3 direction; vec4 color; + float intensity; float cutOff; }; @@ -210,14 +211,14 @@ vec3 lightDirection(Light light) { vec3 lightAttenuate(Light light) { float distance = length(light.position - fragWorldPos); float attenuation = 1.0 / (distance * distance); - return light.color.rgb * attenuation; + return light.color.rgb * light.intensity * attenuation; } vec3 lightRadiance(Light light, vec3 direction) { if(light.type == 0) { // point light return lightAttenuate(light); } else if(light.type == 1) { // directional light - return light.color.rgb; + return light.color.rgb * light.intensity; } else if(light.type == 2) { // spot light float theta = dot(direction, normalize(-light.direction)); // Spot lights only shine light in a specific conical area. -- cgit v1.2.3