History

Use near radius as threshold, since we need to switch to full screen rendering whenever any point of the near window intersects the light volume.

Andrzej Kapolka committed 12 years ago

Commit 788f1b91 parent 2c0b8c91 file · +4 −3Browse files

Showing the changes to interface/src/renderer/DeferredLightingEffect.cpp (1 of 1 file). Show all

Unified · Split

interface/src/renderer/DeferredLightingEffect.cpp+4−3
@@ -230,9 +230,10 @@ void DeferredLightingEffect::render() { · 229 unmodified lines
230 glTexGenfv(GL_T, GL_OBJECT_PLANE, (const GLfloat*)&tCoefficients);230 glTexGenfv(GL_T, GL_OBJECT_PLANE, (const GLfloat*)&tCoefficients);
231 231
232 // enlarge the scales slightly to account for tesselation232 // enlarge the scales slightly to account for tesselation
233 const float SCALE_EXPANSION = 0.1f;233 const float SCALE_EXPANSION = 0.05f;
234 234
235 const glm::vec3& eyePoint = Application::getInstance()->getDisplayViewFrustum()->getPosition();235 const glm::vec3& eyePoint = Application::getInstance()->getDisplayViewFrustum()->getPosition();
236 float nearRadius = glm::distance(eyePoint, Application::getInstance()->getDisplayViewFrustum()->getNearTopLeft());
236 237
237 if (!_pointLights.isEmpty()) {238 if (!_pointLights.isEmpty()) {
238 _pointLight.bind();239 _pointLight.bind();
@@ -254,7 +255,7 @@ void DeferredLightingEffect::render() { · 15 unmodified lines
254 glPushMatrix();255 glPushMatrix();
255 256
256 float expandedRadius = light.radius * (1.0f + SCALE_EXPANSION);257 float expandedRadius = light.radius * (1.0f + SCALE_EXPANSION);
257 if (glm::distance(eyePoint, glm::vec3(light.position)) < expandedRadius) {258 if (glm::distance(eyePoint, glm::vec3(light.position)) < expandedRadius + nearRadius) {
258 glLoadIdentity();259 glLoadIdentity();
259 glTranslatef(0.0f, 0.0f, -1.0f);260 glTranslatef(0.0f, 0.0f, -1.0f);
260 261
@@ -303,7 +304,7 @@ void DeferredLightingEffect::render() { · 42 unmodified lines
303 304
304 float expandedRadius = light.radius * (1.0f + SCALE_EXPANSION);305 float expandedRadius = light.radius * (1.0f + SCALE_EXPANSION);
305 float edgeRadius = expandedRadius / glm::cos(light.cutoff);306 float edgeRadius = expandedRadius / glm::cos(light.cutoff);
306 if (glm::distance(eyePoint, glm::vec3(light.position)) < edgeRadius) {307 if (glm::distance(eyePoint, glm::vec3(light.position)) < edgeRadius + nearRadius) {
307 glLoadIdentity();308 glLoadIdentity();
308 glTranslatef(0.0f, 0.0f, -1.0f);309 glTranslatef(0.0f, 0.0f, -1.0f);
309 310