Reimplement light attenuation for spot and point lights
Showing the changes to libraries/render-utils/src/DeferredLightingEffect.cpp (1 of 18 files). Show all
Unified · Split
| @@ -98,12 +98,12 @@ void DeferredLightingEffect::init() { · 97 unmodified lines | |||
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | void DeferredLightingEffect::addPointLight(const glm::vec3& position, float radius, const glm::vec3& color, | 100 | void DeferredLightingEffect::addPointLight(const glm::vec3& position, float radius, const glm::vec3& color, |
| 101 | float intensity) { | 101 | float intensity, float falloffRadius) { |
| 102 | addSpotLight(position, radius, color, intensity); | 102 | addSpotLight(position, radius, color, intensity, falloffRadius); |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | void DeferredLightingEffect::addSpotLight(const glm::vec3& position, float radius, const glm::vec3& color, | 105 | void DeferredLightingEffect::addSpotLight(const glm::vec3& position, float radius, const glm::vec3& color, |
| 106 | float intensity, const glm::quat& orientation, float exponent, float cutoff) { | 106 | float intensity, float falloffRadius, const glm::quat& orientation, float exponent, float cutoff) { |
| 107 | 107 | ||
| 108 | unsigned int lightID = (unsigned int)(_pointLights.size() + _spotLights.size() + _globalLights.size()); | 108 | unsigned int lightID = (unsigned int)(_pointLights.size() + _spotLights.size() + _globalLights.size()); |
| 109 | if (lightID >= _allocatedLights.size()) { | 109 | if (lightID >= _allocatedLights.size()) { |
| @@ -115,7 +115,7 @@ void DeferredLightingEffect::addSpotLight(const glm::vec3& position, float radiu · 5 unmodified lines | |||
| 115 | lp->setMaximumRadius(radius); | 115 | lp->setMaximumRadius(radius); |
| 116 | lp->setColor(color); | 116 | lp->setColor(color); |
| 117 | lp->setIntensity(intensity); | 117 | lp->setIntensity(intensity); |
| 118 | //lp->setShowContour(quadraticAttenuation); | 118 | lp->setFalloffRadius(falloffRadius); |
| 119 | 119 | ||
| 120 | if (exponent == 0.0f && cutoff == PI) { | 120 | if (exponent == 0.0f && cutoff == PI) { |
| 121 | lp->setType(model::Light::POINT); | 121 | lp->setType(model::Light::POINT); |