Optimized lighting of underwater terrain

The water light filter is now applied first to avoid computing
terrain shadows when no light passes through the water layer.
This commit is contained in:
Michaël Lemaire 2014-08-22 17:34:07 +02:00
parent 99aff57d6c
commit 818d82607e
4 changed files with 4 additions and 6 deletions

View file

@ -12,7 +12,7 @@ LightingManager::LightingManager()
void LightingManager::registerFilter(LightFilter* filter)
{
filters.insert(filter);
filters.push_back(filter);
}
bool LightingManager::alterLight(LightComponent &component, const Vector3 &location)

View file

@ -3,8 +3,6 @@
#include "software_global.h"
#include <set>
namespace paysages {
namespace software {
@ -42,7 +40,7 @@ public:
private:
int specularity;
std::set<LightFilter*> filters;
std::vector<LightFilter*> filters;
};
}

View file

@ -36,8 +36,8 @@ SoftwareRenderer::SoftwareRenderer(Scenery* scenery)
fluid_medium = new FluidMediumManager(this);
lighting = new LightingManager();
lighting->registerFilter(terrain_renderer);
lighting->registerFilter(water_renderer);
lighting->registerFilter(terrain_renderer);
lighting->registerFilter(clouds_renderer);
this->scenery = new Scenery;

View file

@ -263,7 +263,7 @@ bool WaterRenderer::applyLightFilter(LightComponent &light, const Vector3 &at)
light.color.b *= factor;
light.reflection *= factor;
return true;
return factor > 0.0;
}
else
{