History

lightings seems to work correctly now

Sam Gateau committed 11 years ago

Commit 00a9f551 parent 8e1eebb5 files · +13 −17Browse files

Showing the changes to libraries/render-utils/src/DeferredLightingEffect.cpp (1 of 5 files). Show all

Unified · Split

libraries/render-utils/src/DeferredLightingEffect.cpp+4−4
@@ -303,8 +303,8 @@ void DeferredLightingEffect::addSpotLight(const glm::vec3& position, float radiu · 302 unmodified lines
303 lp->setPosition(position);303 lp->setPosition(position);
304 lp->setDirection(direction);304 lp->setDirection(direction);
305 lp->setMaximumRadius(radius);305 lp->setMaximumRadius(radius);
306 lp->setSpotCone(cutoff);306 lp->setSpotAngle(cutoff);
307 lp->setSpotConeExponent(exponent);307 lp->setSpotExponent(exponent);
308 lp->setColor(diffuse);308 lp->setColor(diffuse);
309 lp->setIntensity(1.0f);309 lp->setIntensity(1.0f);
310 lp->setType(model::Light::SPOT);310 lp->setType(model::Light::SPOT);
@@ -527,7 +527,7 @@ void DeferredLightingEffect::render() { · 216 unmodified lines
527 glPushMatrix();527 glPushMatrix();
528 528
529 float expandedRadius = light->getMaximumRadius() * (1.0f + SCALE_EXPANSION);529 float expandedRadius = light->getMaximumRadius() * (1.0f + SCALE_EXPANSION);
530 float edgeRadius = expandedRadius / glm::cos(light->getSpotConeAngle());530 float edgeRadius = expandedRadius / glm::cos(light->getSpotAngle());
531 if (glm::distance(eyePoint, glm::vec3(light->getPosition())) < edgeRadius + nearRadius) {531 if (glm::distance(eyePoint, glm::vec3(light->getPosition())) < edgeRadius + nearRadius) {
532 glLoadIdentity();532 glLoadIdentity();
533 glTranslatef(0.0f, 0.0f, -1.0f);533 glTranslatef(0.0f, 0.0f, -1.0f);
@@ -547,7 +547,7 @@ void DeferredLightingEffect::render() { · 13 unmodified lines
547 glm::vec3 axis = glm::axis(spotRotation);547 glm::vec3 axis = glm::axis(spotRotation);
548 glRotatef(glm::degrees(glm::angle(spotRotation)), axis.x, axis.y, axis.z); 548 glRotatef(glm::degrees(glm::angle(spotRotation)), axis.x, axis.y, axis.z);
549 glTranslatef(0.0f, 0.0f, -light->getMaximumRadius() * (1.0f + SCALE_EXPANSION * 0.5f)); 549 glTranslatef(0.0f, 0.0f, -light->getMaximumRadius() * (1.0f + SCALE_EXPANSION * 0.5f));
550 geometryCache->renderCone(expandedRadius * glm::tan(light->getSpotConeAngle()),550 geometryCache->renderCone(expandedRadius * glm::tan(light->getSpotAngle()),
551 expandedRadius, 32, 1);551 expandedRadius, 32, 1);
552 }552 }
553 553