paysages3d/src/interface/desktop/formclouds.cpp

71 lines
2 KiB
C++
Raw Normal View History

#include "formclouds.h"
#include "RenderingScenery.h"
2013-11-12 22:15:35 +00:00
#include "BasePreview.h"
#include "renderer.h"
2013-11-15 22:26:44 +00:00
#include "CloudsDefinition.h"
#include "CloudLayerDefinition.h"
2013-11-19 22:46:37 +00:00
#include "CloudsCoveragePreviewRenderer.h"
#include "CloudsAspectPreviewRenderer.h"
#include "tools.h"
/**************** Form ****************/
FormClouds::FormClouds(QWidget *parent):
BaseFormLayer(parent)
{
2013-11-15 22:26:44 +00:00
_definition = new CloudsDefinition(NULL);
_layer = new CloudLayerDefinition(NULL);
2013-11-19 22:46:37 +00:00
_previewCoverageRenderer = new CloudsCoveragePreviewRenderer(_layer);
_previewCoverage = new BasePreview(parent);
addPreview(_previewCoverage, tr("Layer coverage (no lighting)"));
2013-11-19 22:46:37 +00:00
_previewCoverage->setRenderer(_previewCoverageRenderer);
_previewColorRenderer = new CloudsAspectPreviewRenderer(_layer);
_previewColor = new BasePreview(parent);
addPreview(_previewColor, tr("Appearance"));
2013-11-19 22:46:37 +00:00
_previewColor->setRenderer(_previewColorRenderer);
addInputEnum(tr("Clouds model"), (int*)&_layer->type, QStringList() << tr("Cirrus") << tr("Cumulus") << tr("Stratocumulus") << tr("Stratus"));
2013-12-04 21:52:18 +00:00
addInputDouble(tr("Lower 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("Coverage"), &_layer->coverage, 0.0, 1.0, 0.01, 0.1);
2013-11-15 22:26:44 +00:00
setLayers(_definition);
}
FormClouds::~FormClouds()
{
2013-11-15 22:26:44 +00:00
delete _layer;
delete _definition;
delete _previewCoverage;
2013-11-19 22:46:37 +00:00
delete _previewCoverageRenderer;
delete _previewColor;
2013-11-19 22:46:37 +00:00
delete _previewColorRenderer;
}
void FormClouds::revertConfig()
{
RenderingScenery::getCurrent()->getClouds(_definition);
BaseFormLayer::revertConfig();
}
void FormClouds::applyConfig()
{
BaseFormLayer::applyConfig();
RenderingScenery::getCurrent()->setClouds(_definition);
}
void FormClouds::layerReadCurrentFrom(void* layer_definition)
{
2013-11-15 22:26:44 +00:00
((CloudLayerDefinition*)layer_definition)->copy(_layer);
}
void FormClouds::layerWriteCurrentTo(void* layer_definition)
{
2013-11-15 22:26:44 +00:00
_layer->copy((CloudLayerDefinition*)layer_definition);
}