2012-01-26 23:08:09 +00:00
|
|
|
#include "formclouds.h"
|
|
|
|
|
2013-11-17 21:36:18 +00:00
|
|
|
#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"
|
2012-02-05 11:31:16 +00:00
|
|
|
|
|
|
|
#include "tools.h"
|
2012-01-26 23:08:09 +00:00
|
|
|
|
|
|
|
/**************** Form ****************/
|
|
|
|
FormClouds::FormClouds(QWidget *parent):
|
2012-08-26 13:36:46 +00:00
|
|
|
BaseFormLayer(parent)
|
2012-01-26 23:08:09 +00:00
|
|
|
{
|
2012-11-24 12:30:51 +00:00
|
|
|
addAutoPreset(tr("Cirrus"));
|
2012-11-24 16:04:33 +00:00
|
|
|
addAutoPreset(tr("Cumulus"));
|
|
|
|
addAutoPreset(tr("Stratocumulus"));
|
2012-11-24 12:30:51 +00:00
|
|
|
addAutoPreset(tr("Stratus"));
|
|
|
|
|
2013-11-15 22:26:44 +00:00
|
|
|
_definition = new CloudsDefinition(NULL);
|
|
|
|
_layer = new CloudLayerDefinition(NULL);
|
2012-12-06 14:04:04 +00:00
|
|
|
|
2013-11-19 22:46:37 +00:00
|
|
|
_previewCoverageRenderer = new CloudsCoveragePreviewRenderer(_layer);
|
|
|
|
_previewCoverage = new BasePreview(parent);
|
2012-08-26 13:36:46 +00:00
|
|
|
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);
|
2012-08-26 13:36:46 +00:00
|
|
|
addPreview(_previewColor, tr("Appearance"));
|
2013-11-19 22:46:37 +00:00
|
|
|
_previewColor->setRenderer(_previewColorRenderer);
|
2012-08-26 13:36:46 +00:00
|
|
|
|
2012-12-05 15:35:25 +00:00
|
|
|
addInputEnum(tr("Clouds model"), (int*)&_layer->type, QStringList() << tr("Cirrus") << tr("Cumulus") << tr("Stratocumulus") << tr("Stratus"));
|
2012-08-26 13:36:46 +00:00
|
|
|
addInputDouble(tr("Lower altitude"), &_layer->lower_altitude, -10.0, 50.0, 0.5, 5.0);
|
|
|
|
addInputDouble(tr("Layer thickness"), &_layer->thickness, 0.0, 20.0, 0.1, 1.0);
|
|
|
|
addInputDouble(tr("Max coverage"), &_layer->base_coverage, 0.0, 1.0, 0.01, 0.1);
|
2012-08-26 20:02:10 +00:00
|
|
|
addInputDouble(tr("Shape scaling"), &_layer->shape_scaling, 3.0, 30.0, 0.3, 3.0);
|
2012-11-24 12:30:51 +00:00
|
|
|
addInputDouble(tr("Edge scaling"), &_layer->edge_scaling, 0.5, 5.0, 0.05, 0.5);
|
2012-08-26 13:36:46 +00:00
|
|
|
addInputDouble(tr("Edge length"), &_layer->edge_length, 0.0, 1.0, 0.01, 0.1);
|
2013-11-15 22:26:44 +00:00
|
|
|
addInputMaterial(tr("Material"), _layer->material);
|
2012-08-26 13:36:46 +00:00
|
|
|
addInputDouble(tr("Hardness to light"), &_layer->hardness, 0.0, 1.0, 0.01, 0.1);
|
2012-08-27 20:40:35 +00:00
|
|
|
addInputDouble(tr("Transparency depth"), &_layer->transparencydepth, 0.0, 10.0, 0.1, 1.0);
|
|
|
|
addInputDouble(tr("Light traversal depth"), &_layer->lighttraversal, 0.0, 10.0, 0.1, 1.0);
|
2012-08-26 13:36:46 +00:00
|
|
|
addInputDouble(tr("Minimum lighting"), &_layer->minimumlight, 0.0, 1.0, 0.01, 0.1);
|
|
|
|
|
2013-11-15 22:26:44 +00:00
|
|
|
setLayers(_definition);
|
2012-01-26 23:08:09 +00:00
|
|
|
}
|
|
|
|
|
2013-03-31 20:27:21 +00:00
|
|
|
FormClouds::~FormClouds()
|
|
|
|
{
|
2013-11-15 22:26:44 +00:00
|
|
|
delete _layer;
|
|
|
|
delete _definition;
|
2013-03-31 20:27:21 +00:00
|
|
|
|
|
|
|
delete _previewCoverage;
|
2013-11-19 22:46:37 +00:00
|
|
|
delete _previewCoverageRenderer;
|
|
|
|
|
2013-03-31 20:27:21 +00:00
|
|
|
delete _previewColor;
|
2013-11-19 22:46:37 +00:00
|
|
|
delete _previewColorRenderer;
|
2013-03-31 20:27:21 +00:00
|
|
|
}
|
|
|
|
|
2012-01-26 23:08:09 +00:00
|
|
|
void FormClouds::revertConfig()
|
|
|
|
{
|
2013-11-17 21:36:18 +00:00
|
|
|
RenderingScenery::getCurrent()->getClouds(_definition);
|
2012-08-26 13:36:46 +00:00
|
|
|
BaseFormLayer::revertConfig();
|
2012-01-26 23:08:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FormClouds::applyConfig()
|
|
|
|
{
|
2012-08-26 13:36:46 +00:00
|
|
|
BaseFormLayer::applyConfig();
|
2013-11-17 21:36:18 +00:00
|
|
|
RenderingScenery::getCurrent()->setClouds(_definition);
|
2012-12-05 15:35:25 +00:00
|
|
|
}
|
|
|
|
|
2012-12-06 14:04:04 +00:00
|
|
|
void FormClouds::layerReadCurrentFrom(void* layer_definition)
|
2012-07-05 17:05:03 +00:00
|
|
|
{
|
2013-11-15 22:26:44 +00:00
|
|
|
((CloudLayerDefinition*)layer_definition)->copy(_layer);
|
2012-02-05 11:31:16 +00:00
|
|
|
}
|
|
|
|
|
2012-12-06 14:04:04 +00:00
|
|
|
void FormClouds::layerWriteCurrentTo(void* layer_definition)
|
2012-07-05 15:01:58 +00:00
|
|
|
{
|
2013-11-15 22:26:44 +00:00
|
|
|
_layer->copy((CloudLayerDefinition*)layer_definition);
|
2012-02-05 11:31:16 +00:00
|
|
|
}
|
2012-11-24 12:30:51 +00:00
|
|
|
|
|
|
|
void FormClouds::autoPresetSelected(int preset)
|
|
|
|
{
|
2013-11-15 22:26:44 +00:00
|
|
|
_layer->applyPreset((CloudLayerDefinition::CloudsLayerPreset)preset);
|
2012-11-24 12:30:51 +00:00
|
|
|
BaseForm::autoPresetSelected(preset);
|
|
|
|
}
|