diff --git a/.gitignore b/.gitignore index df123a5..053389a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,12 @@ build/ +cache/ data/i18n/paysages_*.qm gmon.out nbproject/ output/ src/editing/Makefile *.pro.user +*.pro.user.* qrc_*.cpp ui_*.h tags diff --git a/dist/Paysages3D.exe b/dist/Paysages3D.exe new file mode 100644 index 0000000..45f0397 Binary files /dev/null and b/dist/Paysages3D.exe differ diff --git a/dist/README.txt b/dist/README.txt new file mode 100644 index 0000000..5530323 --- /dev/null +++ b/dist/README.txt @@ -0,0 +1,19 @@ +Paysages 3D, a landscape generator, editor and renderer. + +This version is a development preview. Its only purpose is to demonstrate the software features and gather user feedback. +The software is provided "as-is". The authors give no warranty whatsoever regarding to this software, and disclaim any warranty of merchantability, fitness for a particular purpose, non-interference, or non-infringement. The authors cannot be kept responsible for any damage of any kind caused directly or indirectly by the software. +By installing, configuring, and/or using the software, you accept above terms. + +This version is provided free of charge, with no limits on usage. If you paid to obtain this version, please inform the authors. + +This version is distributed under the terms of the Creative Commons Licence (BY-NC-ND 3.0). Please read the full terms on the Creative Commons information website : http://creativecommons.org/licenses/by-nc-nd/3.0/ + +Authors : +Michael LEMAIRE - Developer + +Credits : +Qt - http://qt.nokia.com/ +DevIL - http://openil.sourceforge.net/ +GLib - http://www.gtk.org/ + +You can find complementary information, or contact the authors on the website : http://www.paysages3d.com/ diff --git a/src/common_post.mk b/src/common_post.mk index f86c093..28b4197 100644 --- a/src/common_post.mk +++ b/src/common_post.mk @@ -14,7 +14,7 @@ ifneq (,${LIBS}) endif CC_FLAGS += -fPIC -Wall -I${PROJECT_PATH}/src -CC_LDFLAGS += -fPIC +CC_LDFLAGS += -fPIC -lm all:prepare ${RESULT} diff --git a/src/editing/common/widgetglobalformbuttons.cpp b/src/editing/common/widgetglobalformbuttons.cpp index 0e1083b..3f0c17e 100644 --- a/src/editing/common/widgetglobalformbuttons.cpp +++ b/src/editing/common/widgetglobalformbuttons.cpp @@ -5,25 +5,11 @@ WidgetGlobalFormButtons::WidgetGlobalFormButtons(QWidget *parent) : QWidget(parent), ui(new Ui::WidgetGlobalFormButtons) { - QPushButton* button; - ui->setupUi(this); - button = findChild("button_ok"); - if (button) - { - connect(button, SIGNAL(clicked()), this, SIGNAL(okClicked())); - } - button = findChild("button_cancel"); - if (button) - { - connect(button, SIGNAL(clicked()), this, SIGNAL(cancelClicked())); - } - button = findChild("button_revert"); - if (button) - { - connect(button, SIGNAL(clicked()), this, SIGNAL(revertClicked())); - } + connect(ui->button_ok, SIGNAL(clicked()), this, SIGNAL(okClicked())); + connect(ui->button_cancel, SIGNAL(clicked()), this, SIGNAL(cancelClicked())); + connect(ui->button_revert, SIGNAL(clicked()), this, SIGNAL(revertClicked())); } WidgetGlobalFormButtons::~WidgetGlobalFormButtons() diff --git a/src/editing/terrain/dialogterrainpainting.cpp b/src/editing/terrain/dialogterrainpainting.cpp index e362a28..5d9f129 100644 --- a/src/editing/terrain/dialogterrainpainting.cpp +++ b/src/editing/terrain/dialogterrainpainting.cpp @@ -15,11 +15,7 @@ DialogTerrainPainting::DialogTerrainPainting(QWidget*parent, TerrainDefinition* _terrain_original = terrain; _terrain_modified = (TerrainDefinition*)TerrainDefinitionClass.create(); - QWidget* widget = findChild("widget_commands"); - if (widget) - { - widget->hide(); - } + ui->widget_commands->hide(); revert(); @@ -33,43 +29,26 @@ DialogTerrainPainting::~DialogTerrainPainting() void DialogTerrainPainting::keyReleaseEvent(QKeyEvent* event) { - QComboBox* input_brush_mode = findChild("input_brush_mode"); - switch (event->key()) { case Qt::Key_F2: - if (input_brush_mode) - { - input_brush_mode->setCurrentIndex(0); - } + ui->input_brush_mode->setCurrentIndex(0); event->accept(); break; case Qt::Key_F3: - if (input_brush_mode) - { - input_brush_mode->setCurrentIndex(1); - } + ui->input_brush_mode->setCurrentIndex(1); event->accept(); break; case Qt::Key_F4: - if (input_brush_mode) - { - input_brush_mode->setCurrentIndex(2); - } + ui->input_brush_mode->setCurrentIndex(2); event->accept(); break; case Qt::Key_F11: - if (input_brush_mode) - { - input_brush_mode->setCurrentIndex(3); - } + ui->input_brush_mode->setCurrentIndex(3); event->accept(); break; case Qt::Key_F12: - if (input_brush_mode) - { - input_brush_mode->setCurrentIndex(4); - } + ui->input_brush_mode->setCurrentIndex(4); event->accept(); break; default: @@ -79,32 +58,19 @@ void DialogTerrainPainting::keyReleaseEvent(QKeyEvent* event) void DialogTerrainPainting::wheelEvent(QWheelEvent* event) { - QSlider* input_brush_size = findChild("input_brush_size"); - QSlider* input_brush_smoothing = findChild("input_brush_smoothing"); - QSlider* input_brush_strength = findChild("input_brush_strength"); - if (event->modifiers() & Qt::ControlModifier) { - if (input_brush_size) - { - input_brush_size->setValue(input_brush_size->value() + (event->delta() > 0 ? 1 : -1)); - } + ui->input_brush_size->setValue(ui->input_brush_size->value() + (event->delta() > 0 ? 1 : -1)); event->accept(); } else if (event->modifiers() & Qt::ShiftModifier) { - if (input_brush_strength) - { - input_brush_strength->setValue(input_brush_strength->value() + (event->delta() > 0 ? 1 : -1)); - } + ui->input_brush_strength->setValue(ui->input_brush_strength->value() + (event->delta() > 0 ? 1 : -1)); event->accept(); } else if (event->modifiers() & Qt::AltModifier) { - if (input_brush_smoothing) - { - input_brush_smoothing->setValue(input_brush_smoothing->value() + (event->delta() > 0 ? 1 : -1)); - } + ui->input_brush_smoothing->setValue(ui->input_brush_smoothing->value() + (event->delta() > 0 ? 1 : -1)); event->accept(); } else @@ -123,75 +89,34 @@ void DialogTerrainPainting::revert() { TerrainDefinitionClass.copy(_terrain_original, _terrain_modified); - WidgetHeightMap* heightmap = findChild("widget_heightmap"); - if (heightmap) - { - heightmap->setTerrain(_terrain_modified); - heightmap->setBrush(&_brush); - } + ui->widget_heightmap->setTerrain(_terrain_modified); + ui->widget_heightmap->setBrush(&_brush); } void DialogTerrainPainting::brushConfigChanged() { - QLabel* label; - QComboBox* combobox; - QSlider* slider; - // Fill brush object - combobox = findChild("input_brush_mode"); - if (combobox) - { - _brush.setMode((PaintingBrushMode)combobox->currentIndex()); - } - slider = findChild("input_brush_size"); - if (slider) - { - _brush.setSize(slider); - } - slider = findChild("input_brush_smoothing"); - if (slider) - { - _brush.setSmoothing(slider); - } - slider = findChild("input_brush_strength"); - if (slider) - { - _brush.setStrength(slider); - } + _brush.setMode((PaintingBrushMode) ui->input_brush_mode->currentIndex()); + _brush.setSize(ui->input_brush_size); + _brush.setSmoothing(ui->input_brush_smoothing); + _brush.setStrength(ui->input_brush_strength); // Update brush description - label = findChild("label_brush_description"); - if (label) - { - label->setText(getHelpText()); - } + ui->label_brush_description->setText(getHelpText()); // Update brush preview + // TODO // Tell to 3D widget - WidgetHeightMap* heightmap = findChild("widget_heightmap"); - if (heightmap) - { - heightmap->setBrush(&_brush); - } + ui->widget_heightmap->setBrush(&_brush); } void DialogTerrainPainting::heightmapChanged() { - QLabel* label = findChild("label_memory_consumption"); - if (label) - { - qint64 memused = terrainGetMemoryStats(_terrain_modified); - label->setText(tr("Memory used: %1").arg(getHumanMemory(memused))); - - // TODO Find available memory - QProgressBar* progress = findChild("progress_memory_consumption"); - if (progress) - { - progress->setMaximum(1024); - progress->setValue(memused / 1024); - } - } + qint64 memused = terrainGetMemoryStats(_terrain_modified); + ui->label_memory_consumption->setText(tr("Memory used: %1").arg(getHumanMemory(memused))); + ui->progress_memory_consumption->setMaximum(1024); + ui->progress_memory_consumption->setValue(memused / 1024); } QString DialogTerrainPainting::getHelpText() diff --git a/src/editing/terrain/dialogterrainpainting.ui b/src/editing/terrain/dialogterrainpainting.ui index e50addc..72d405f 100644 --- a/src/editing/terrain/dialogterrainpainting.ui +++ b/src/editing/terrain/dialogterrainpainting.ui @@ -6,8 +6,8 @@ 0 0 - 1116 - 726 + 1145 + 777 @@ -831,8 +831,8 @@ brushConfigChanged() - 752 - 42 + 1115 + 53 437 @@ -847,8 +847,8 @@ brushConfigChanged() - 919 - 115 + 1115 + 143 437 @@ -879,8 +879,8 @@ reject() - 875 - 580 + 1134 + 766 711 @@ -895,8 +895,8 @@ accept() - 943 - 587 + 1134 + 766 683 @@ -911,8 +911,8 @@ revert() - 943 - 587 + 1134 + 766 747 @@ -927,12 +927,12 @@ toggleWater(bool) - 40 - 21 + 60 + 43 - 39 - 160 + 58 + 480 @@ -943,12 +943,12 @@ toggleGrid(bool) - 102 - 17 + 161 + 40 - 102 - 143 + 121 + 463 @@ -972,15 +972,15 @@ pushButton toggled(bool) widget_commands - setShown(bool) + setVisible(bool) - 516 - 20 + 734 + 40 - 517 - 50 + 536 + 104 diff --git a/src/editing/terrain/mainterrainform.cpp b/src/editing/terrain/mainterrainform.cpp index fcb9c2f..04ad6c7 100644 --- a/src/editing/terrain/mainterrainform.cpp +++ b/src/editing/terrain/mainterrainform.cpp @@ -17,20 +17,20 @@ MainTerrainForm::MainTerrainForm(QWidget *parent) : _form_helper = new FreeFormHelper(this); _renderer_shape = new PreviewTerrainShape(_terrain); - _form_helper->addPreview("preview_shape", _renderer_shape); + _form_helper->addPreview(ui->preview_shape, _renderer_shape); - _form_helper->addDoubleInputSlider("input_scaling", &_terrain->scaling, 0.1, 3.0, 0.03, 0.3); - _form_helper->addDoubleInputSlider("input_height", &_terrain->height, 1.0, 45.0, 0.3, 3.0); - _form_helper->addDoubleInputSlider("input_shadow_smoothing", &_terrain->shadow_smoothing, 0.0, 0.3, 0.003, 0.03); - _form_helper->addDoubleInputSlider("input_water_height", &_terrain->water_height, -2.0, 2.0, 0.01, 0.1); + _form_helper->addDoubleInputSlider(ui->input_scaling, &_terrain->scaling, 0.1, 3.0, 0.03, 0.3); + _form_helper->addDoubleInputSlider(ui->input_height, &_terrain->height, 1.0, 45.0, 0.3, 3.0); + _form_helper->addDoubleInputSlider(ui->input_shadow_smoothing, &_terrain->shadow_smoothing, 0.0, 0.3, 0.003, 0.03); + _form_helper->addDoubleInputSlider(ui->input_water_height, &_terrain->water_height, -2.0, 2.0, 0.01, 0.1); - _form_helper->setApplyButton("button_apply"); - _form_helper->setRevertButton("button_revert"); - _form_helper->setExploreButton("button_explore"); - _form_helper->setRenderButton("button_render"); + _form_helper->setApplyButton(ui->button_apply); + _form_helper->setRevertButton(ui->button_revert); + _form_helper->setExploreButton(ui->button_explore); + _form_helper->setRenderButton(ui->button_render); - connect(findChild("button_dialog_painting"), SIGNAL(clicked()), this, SLOT(buttonPaintingPressed())); - connect(findChild("button_goto_textures"), SIGNAL(clicked()), this, SLOT(buttonTexturesPressed())); + connect(ui->button_dialog_painting, SIGNAL(clicked()), this, SLOT(buttonPaintingPressed())); + connect(ui->button_goto_textures, SIGNAL(clicked()), this, SLOT(buttonTexturesPressed())); _form_helper->startManaging(); } diff --git a/src/rendering/clouds/clo_tools.c b/src/rendering/clouds/clo_tools.c index cadf4c0..5337e54 100644 --- a/src/rendering/clouds/clo_tools.c +++ b/src/rendering/clouds/clo_tools.c @@ -97,7 +97,6 @@ Color cloudsApplyLayer(CloudsLayerDefinition* definition, Color base, Renderer* /* TODO Crawl in segments for render */ col = definition->material.base; - col.a = 0.0; /*if (definition->transparencydepth == 0 || inside_length >= definition->transparencydepth) { col.a = 1.0; @@ -108,6 +107,7 @@ Color cloudsApplyLayer(CloudsLayerDefinition* definition, Color base, Renderer* }*/ col = renderer->atmosphere->applyAerialPerspective(renderer, start, col).final; + col.a = 0.0; colorMask(&base, &col);