Added alterLight to cloudsRenderer (not used yet) + fixed clouds ui

This commit is contained in:
Michaël Lemaire 2013-12-04 23:28:34 +01:00
parent 9be090b1ff
commit e32738564b
2 changed files with 33 additions and 3 deletions

View file

@ -27,8 +27,20 @@ FormClouds::FormClouds(QWidget *parent):
addPreview(_previewColor, tr("Appearance")); addPreview(_previewColor, tr("Appearance"));
_previewColor->setRenderer(_previewColorRenderer); _previewColor->setRenderer(_previewColorRenderer);
addInputEnum(tr("Clouds model"), (int*)&_layer->type, QStringList() << tr("Cirrus") << tr("Cumulus") << tr("Stratocumulus") << tr("Stratus")); QStringList cloud_models;
addInputDouble(tr("Lower altitude"), &_layer->altitude, 0.0, 1.0, 0.01, 0.1); cloud_models << tr("Stratus")
<< tr("Nimbo-stratus")
<< tr("Cumulus")
<< tr("Strato-cumulus")
<< tr("Alto-cumulus")
<< tr("Alto-stratus")
<< tr("Cumulo-nimbus")
<< tr("Cirro-cumulus")
<< tr("Cirro-stratus")
<< tr("Cirrus");
addInputEnum(tr("Clouds model"), (int*)&_layer->type, cloud_models);
addInputDouble(tr("Altitude"), &_layer->altitude, 0.0, 1.0, 0.01, 0.1);
addInputDouble(tr("Scaling"), &_layer->scaling, 0.0, 1.0, 0.01, 0.1); addInputDouble(tr("Scaling"), &_layer->scaling, 0.0, 1.0, 0.01, 0.1);
addInputDouble(tr("Coverage"), &_layer->coverage, 0.0, 1.0, 0.01, 0.1); addInputDouble(tr("Coverage"), &_layer->coverage, 0.0, 1.0, 0.01, 0.1);

View file

@ -133,6 +133,24 @@ Color CloudsRenderer::getColor(const Vector3 &eye, const Vector3 &location, cons
} }
bool CloudsRenderer::alterLight(LightDefinition* light, const Vector3 &eye, const Vector3 &location) bool CloudsRenderer::alterLight(LightDefinition* light, const Vector3 &eye, const Vector3 &location)
{
CloudsDefinition* definition = parent->getScenery()->getClouds();
int n = definition->count();
if (n < 1)
{ {
return false; return false;
} }
/* TODO Iter layers in sorted order */
bool altered = false;
for (int i = 0; i < n; i++)
{
BaseCloudLayerRenderer* layer_renderer = getLayerRenderer(i);
BaseCloudsModel* layer_model = getLayerModel(i);
altered = altered || layer_renderer->alterLight(layer_model, light, eye, location);
}
return altered;
}