Remove no longer necessary light vector parameter.

This commit is contained in:
Geenz 2016-05-22 21:50:48 -04:00
parent 180f4ba4f5
commit ff3fca3dc3
3 changed files with 4 additions and 6 deletions

View file

@ -98,10 +98,8 @@ float getLightShowContour(Light l) {
return l._control.w;
}
// Light is the light source its self, d is the light's distance, and ulightvec is the unnormalized light vector.
// Note that ulightvec should be calculated as light position - fragment position.
// Additionally, length(light position) != dot(light position, light position).
float evalLightAttenuation(Light l, float d, vec3 ulightvec) {
// Light is the light source its self, d is the light's distance calculated as length(unnormalized light vector).
float evalLightAttenuation(Light l, float d) {
float radius = getLightRadius(l);
float denom = d / radius + 1.0;
float attenuation = 1.0 / (denom * denom);

View file

@ -67,7 +67,7 @@ void main(void) {
vec4 shading = evalFragShading(fragNormal, fragLightDir, fragEyeDir, frag.metallic, frag.specular, frag.roughness);
// Eval attenuation
float radialAttenuation = evalLightAttenuation(light, fragLightDistance, fragLightVec);
float radialAttenuation = evalLightAttenuation(light, fragLightDistance);
// Final Lighting color
vec3 fragColor = (shading.w * frag.diffuse + shading.xyz);

View file

@ -74,7 +74,7 @@ void main(void) {
vec4 shading = evalFragShading(fragNormal, fragLightDir, fragEyeDir, frag.metallic, frag.specular, frag.roughness);
// Eval attenuation
float radialAttenuation = evalLightAttenuation(light, fragLightDistance, fragLightVec);
float radialAttenuation = evalLightAttenuation(light, fragLightDistance4);
float angularAttenuation = evalLightSpotAttenuation(light, cosSpotAngle);
// Final Lighting color