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
230230 glTexGenfv(GL_T, GL_OBJECT_PLANE, (const GLfloat*)&tCoefficients);
231231
232232 // enlarge the scales slightly to account for tesselation
233− const float SCALE_EXPANSION = 0.1f;
233+ const float SCALE_EXPANSION = 0.05f;
234234
235235 const glm::vec3& eyePoint = Application::getInstance()->getDisplayViewFrustum()->getPosition();
236+ float nearRadius = glm::distance(eyePoint, Application::getInstance()->getDisplayViewFrustum()->getNearTopLeft());
236237
237238 if (!_pointLights.isEmpty()) {
238239 _pointLight.bind();
@@ -254,7 +255,7 @@ void DeferredLightingEffect::render() { · 15 unmodified lines
254255 glPushMatrix();
255256
256257 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) {
258259 glLoadIdentity();
259260 glTranslatef(0.0f, 0.0f, -1.0f);
260261
@@ -303,7 +304,7 @@ void DeferredLightingEffect::render() { · 42 unmodified lines
303304
304305 float expandedRadius = light.radius * (1.0f + SCALE_EXPANSION);
305306 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) {
307308 glLoadIdentity();
308309 glTranslatef(0.0f, 0.0f, -1.0f);
309310