diff options
Diffstat (limited to 'data/shaders')
-rw-r--r-- | data/shaders/pbr-frag.glsl | 5 | ||||
-rw-r--r-- | data/shaders/phong-frag.glsl | 5 |
2 files changed, 6 insertions, 4 deletions
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. 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. |