summaryrefslogtreecommitdiff
path: root/data/shaders/phong-frag.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'data/shaders/phong-frag.glsl')
-rw-r--r--data/shaders/phong-frag.glsl5
1 files changed, 3 insertions, 2 deletions
diff --git a/data/shaders/phong-frag.glsl b/data/shaders/phong-frag.glsl
index 9c86c83..b07c8b0 100644
--- a/data/shaders/phong-frag.glsl
+++ b/data/shaders/phong-frag.glsl
@@ -13,6 +13,7 @@ struct Light {
vec3 position;
vec3 direction;
vec4 color;
+ float intensity;
float cutOff;
};
@@ -71,14 +72,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.