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:
parent
99aff57d6c
commit
818d82607e
4 changed files with 4 additions and 6 deletions
|
@ -12,7 +12,7 @@ LightingManager::LightingManager()
|
||||||
|
|
||||||
void LightingManager::registerFilter(LightFilter* filter)
|
void LightingManager::registerFilter(LightFilter* filter)
|
||||||
{
|
{
|
||||||
filters.insert(filter);
|
filters.push_back(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LightingManager::alterLight(LightComponent &component, const Vector3 &location)
|
bool LightingManager::alterLight(LightComponent &component, const Vector3 &location)
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
|
|
||||||
#include "software_global.h"
|
#include "software_global.h"
|
||||||
|
|
||||||
#include <set>
|
|
||||||
|
|
||||||
namespace paysages {
|
namespace paysages {
|
||||||
namespace software {
|
namespace software {
|
||||||
|
|
||||||
|
@ -42,7 +40,7 @@ public:
|
||||||
private:
|
private:
|
||||||
int specularity;
|
int specularity;
|
||||||
|
|
||||||
std::set<LightFilter*> filters;
|
std::vector<LightFilter*> filters;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,8 @@ SoftwareRenderer::SoftwareRenderer(Scenery* scenery)
|
||||||
fluid_medium = new FluidMediumManager(this);
|
fluid_medium = new FluidMediumManager(this);
|
||||||
lighting = new LightingManager();
|
lighting = new LightingManager();
|
||||||
|
|
||||||
lighting->registerFilter(terrain_renderer);
|
|
||||||
lighting->registerFilter(water_renderer);
|
lighting->registerFilter(water_renderer);
|
||||||
|
lighting->registerFilter(terrain_renderer);
|
||||||
lighting->registerFilter(clouds_renderer);
|
lighting->registerFilter(clouds_renderer);
|
||||||
|
|
||||||
this->scenery = new Scenery;
|
this->scenery = new Scenery;
|
||||||
|
|
|
@ -263,7 +263,7 @@ bool WaterRenderer::applyLightFilter(LightComponent &light, const Vector3 &at)
|
||||||
light.color.b *= factor;
|
light.color.b *= factor;
|
||||||
light.reflection *= factor;
|
light.reflection *= factor;
|
||||||
|
|
||||||
return true;
|
return factor > 0.0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue