diff --git a/data/ui_pictures.qrc b/data/ui_pictures.qrc
index b16e299..a3fa8d0 100644
--- a/data/ui_pictures.qrc
+++ b/data/ui_pictures.qrc
@@ -6,6 +6,9 @@
images/explore.png
images/render.png
images/about.png
+ images/load.png
+ images/new.png
+ images/save.png
images/tab_atmosphere.png
@@ -15,4 +18,10 @@
images/tab_textures.png
images/tab_water.png
+
+ images/logo_16.png
+ images/logo_32.png
+ images/logo_64.png
+ images/logo_256.png
+
diff --git a/src/editing/mainwindow.cpp b/src/editing/common/mainwindow.cpp
similarity index 76%
rename from src/editing/mainwindow.cpp
rename to src/editing/common/mainwindow.cpp
index b568c73..f80e078 100644
--- a/src/editing/mainwindow.cpp
+++ b/src/editing/common/mainwindow.cpp
@@ -1,10 +1,10 @@
#include "mainwindow.h"
+#include "ui_mainwindow.h"
#include
#include
#include
#include
-#include
#include
#include
#include
@@ -63,7 +63,7 @@ int main(int argc, char** argv)
BasePreview::initDrawers();
window = new MainWindow();
- window->show();
+ window->showMaximized();
splash->finish(window);
delete splash;
@@ -79,68 +79,59 @@ int main(int argc, char** argv)
}
MainWindow::MainWindow(QWidget *parent) :
-QMainWindow(parent)
+ QMainWindow(parent),
+ ui(new Ui::MainWindow)
{
+ ui->setupUi(this);
+
BaseForm* form;
- QTabWidget* tabs;
- QToolBar* toolbar;
- tabs = new QTabWidget(this);
- tabs->setIconSize(QSize(32, 32));
+ connect(ui->action_explore, SIGNAL(triggered()), this, SLOT(explore3D()));
+ connect(ui->action_quick_render, SIGNAL(triggered()), this, SLOT(quickPreview()));
+ connect(ui->action_final_render, SIGNAL(triggered()), this, SLOT(finalRender()));
+ connect(ui->action_file_new, SIGNAL(triggered()), this, SLOT(fileNew()));
+ connect(ui->action_file_save, SIGNAL(triggered()), this, SLOT(fileSave()));
+ connect(ui->action_file_load, SIGNAL(triggered()), this, SLOT(fileLoad()));
+ connect(ui->action_about, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
- tabs->addTab(new MainTerrainForm(tabs), QIcon(getDataPath("images/tab_terrain.png")), tr("Landscape shape"));
-
- form = new FormTextures(tabs);
- tabs->addTab(form, QIcon(getDataPath("images/tab_textures.png")), tr("Textures"));
+ form = new FormTextures(ui->tabs);
+ ui->tabs->addTab(form, QIcon(getDataPath("images/tab_textures.png")), tr("Textures"));
QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll()), Qt::QueuedConnection);
_forms.append(form);
- form = new FormWater(tabs);
- tabs->addTab(form, QIcon(getDataPath("images/tab_water.png")), tr("Water"));
+ form = new FormWater(ui->tabs);
+ ui->tabs->addTab(form, QIcon(getDataPath("images/tab_water.png")), tr("Water"));
QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll()), Qt::QueuedConnection);
_forms.append(form);
- form = new FormAtmosphere(tabs);
- tabs->addTab(form, QIcon(getDataPath("images/tab_atmosphere.png")), tr("Atmosphere"));
+ form = new FormAtmosphere(ui->tabs);
+ ui->tabs->addTab(form, QIcon(getDataPath("images/tab_atmosphere.png")), tr("Atmosphere"));
QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll()), Qt::QueuedConnection);
_forms.append(form);
- form = new FormClouds(tabs);
- tabs->addTab(form, QIcon(getDataPath("images/tab_clouds.png")), tr("Clouds"));
+ form = new FormClouds(ui->tabs);
+ ui->tabs->addTab(form, QIcon(getDataPath("images/tab_clouds.png")), tr("Clouds"));
QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll()), Qt::QueuedConnection);
_forms.append(form);
- _form_render = new FormRender(tabs);
- tabs->addTab(_form_render, QIcon(getDataPath("images/tab_render.png")), tr("Render"));
+ _form_render = new FormRender(ui->tabs);
+ ui->tabs->addTab(_form_render, QIcon(getDataPath("images/tab_render.png")), tr("Render"));
_forms.append(_form_render);
- toolbar = new QToolBar(this);
- toolbar->setOrientation(Qt::Vertical);
- toolbar->setAllowedAreas(Qt::LeftToolBarArea);
- toolbar->setMovable(false);
- toolbar->setFloatable(false);
- toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
- toolbar->toggleViewAction()->setEnabled(false);
- toolbar->setIconSize(QSize(32, 32));
- addToolBar(Qt::LeftToolBarArea, toolbar);
-
- toolbar->addAction(QIcon(getDataPath("images/new.png")), tr("&New"), this, SLOT(fileNew()))->setShortcut(QKeySequence(tr("Crtl+N")));
- toolbar->addAction(QIcon(getDataPath("images/save.png")), tr("&Save"), this, SLOT(fileSave()))->setShortcut(QKeySequence(tr("Crtl+S")));
- toolbar->addAction(QIcon(getDataPath("images/load.png")), tr("&Load"), this, SLOT(fileLoad()))->setShortcut(QKeySequence(tr("Crtl+L")));
- toolbar->addAction(QIcon(getDataPath("images/explore.png")), tr("&Explore (F2)"), this, SLOT(explore3D()))->setShortcut(QKeySequence(tr("F2")));
- toolbar->addAction(QIcon(getDataPath("images/render.png")), tr("&Quick\nrender (F5)"), this, SLOT(quickPreview()))->setShortcut(QKeySequence(tr("F5")));
- toolbar->addAction(QIcon(getDataPath("images/about.png")), tr("&About"), this, SLOT(showAboutDialog()));
-
- setCentralWidget(tabs);
-
- setWindowTitle("Paysages 3D");
- setWindowIcon(QIcon(getDataPath("images/logo_32.png")));
+ // TODO Decide this according to platform / screen size
+ ui->toolBar->hide();
+ ui->menuBar->hide();
scenerySetCustomDataCallback(MainWindow::guiSaveCallback, MainWindow::guiLoadCallback, this);
refreshAll();
}
+MainWindow::~MainWindow()
+{
+ delete ui;
+}
+
bool MainWindow::event(QEvent* event)
{
if (event->type() == QEvent::WindowActivate)
@@ -160,6 +151,7 @@ void MainWindow::refreshAll()
{
_forms[i]->revertConfig();
}
+ // TODO Refresh free forms
// Refresh preview OSD
CameraDefinition* camera = cameraCreateDefinition();
@@ -244,6 +236,16 @@ void MainWindow::quickPreview()
_form_render->startQuickRender();
}
+void MainWindow::finalRender()
+{
+ _form_render->startRender();
+}
+
+void MainWindow::showLastRender()
+{
+ _form_render->showRender();
+}
+
void MainWindow::explore3D()
{
CameraDefinition* camera;
diff --git a/src/editing/mainwindow.h b/src/editing/common/mainwindow.h
similarity index 72%
rename from src/editing/mainwindow.h
rename to src/editing/common/mainwindow.h
index 0a00ae8..64b73de 100644
--- a/src/editing/mainwindow.h
+++ b/src/editing/common/mainwindow.h
@@ -1,16 +1,25 @@
-#ifndef _PAYSAGES_QT_MAINWINDOW_H_
-#define _PAYSAGES_QT_MAINWINDOW_H_
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
#include
-#include "formrender.h"
+#include
#include "rendering/tools/pack.h"
+class BaseForm;
+class FormRender;
+
+namespace Ui {
+class MainWindow;
+}
+
class MainWindow : public QMainWindow
{
Q_OBJECT
-
+
public:
explicit MainWindow(QWidget *parent = 0);
+ ~MainWindow();
+
virtual bool event(QEvent* event);
static void guiSaveCallback(PackStream* stream, void* data);
@@ -26,9 +35,14 @@ public slots:
void showAboutDialog();
void quickPreview();
+ void finalRender();
+ void showLastRender();
+
void explore3D();
private:
+ Ui::MainWindow *ui;
+
void guiSave(PackStream* stream);
void guiLoad(PackStream* stream);
@@ -36,4 +50,4 @@ private:
FormRender* _form_render;
};
-#endif
+#endif // MAINWINDOW_H
diff --git a/src/editing/common/mainwindow.ui b/src/editing/common/mainwindow.ui
new file mode 100644
index 0000000..720f880
--- /dev/null
+++ b/src/editing/common/mainwindow.ui
@@ -0,0 +1,557 @@
+
+
+ MainWindow
+
+
+
+ 0
+ 0
+ 946
+ 651
+
+
+
+ Paysages 3D
+
+
+
+ :/logo/images/logo_32.png:/logo/images/logo_32.png
+
+
+
+ -
+
+
+
-
+
+
+ <html><head/><body><p><span style=" font-size:14pt; font-weight:600;">Paysages 3D</span></p><p><img src=":/logo/images/logo_32.png"/></p></body></html>
+
+
+ Qt::RichText
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
-
+
+
+ Preview
+
+
+ true
+
+
+
+ -
+
+
+ 3D
+
+
+
+ -
+
+
+ Top
+
+
+
+
+
+ -
+
+
+ QFrame::Panel
+
+
+ QFrame::Raised
+
+
+ 3
+
+
+
+ 0
+
+
+ QLayout::SetMinimumSize
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+ 200
+ 150
+
+
+
+
+ 400
+ 300
+
+
+
+
+
+ widget
+ widget
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ Actions
+
+
+
-
+
+
+ Explore in 3D
+
+
+
+ :/buttons/logo/images/explore.png:/buttons/logo/images/explore.png
+
+
+ F2
+
+
+
+ -
+
+
+ Render
+
+
+
+ :/buttons/logo/images/render.png:/buttons/logo/images/render.png
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ File
+
+
+
-
+
+
+ New
+
+
+
+ :/buttons/logo/images/new.png:/buttons/logo/images/new.png
+
+
+
+ -
+
+
+ Save
+
+
+
+ :/buttons/logo/images/save.png:/buttons/logo/images/save.png
+
+
+
+ -
+
+
+ Load
+
+
+
+ :/buttons/logo/images/load.png:/buttons/logo/images/load.png
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+ -
+
+
+ 0
+
+
+
+ 32
+ 32
+
+
+
+
+
+ :/tabs/images/tab_terrain.png:/tabs/images/tab_terrain.png
+
+
+ Lanscape shape
+
+
+
+
+
+
+
+
+ toolBar
+
+
+ false
+
+
+ Qt::LeftToolBarArea
+
+
+
+ 32
+ 32
+
+
+
+ Qt::ToolButtonTextUnderIcon
+
+
+ false
+
+
+ LeftToolBarArea
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ :/buttons/logo/images/explore.png:/buttons/logo/images/explore.png
+
+
+ Explore in 3D
+
+
+ Start exploring your scenery in real-time 3D
+
+
+ F2
+
+
+
+
+
+ :/buttons/logo/images/new.png:/buttons/logo/images/new.png
+
+
+ New scene
+
+
+ Create a virgin scene
+
+
+ Ctrl+N
+
+
+
+
+
+ :/buttons/logo/images/load.png:/buttons/logo/images/load.png
+
+
+ Load scene
+
+
+ Load a scenery from a file
+
+
+ Ctrl+O
+
+
+
+
+
+ :/buttons/logo/images/save.png:/buttons/logo/images/save.png
+
+
+ Save scene
+
+
+ Save a scenery to a file
+
+
+ Ctrl+S
+
+
+
+
+
+ :/buttons/logo/images/render.png:/buttons/logo/images/render.png
+
+
+ Quick render
+
+
+ Start a quick render
+
+
+ F5
+
+
+
+
+
+ :/buttons/logo/images/render.png:/buttons/logo/images/render.png
+
+
+ Final render
+
+
+ Start the final rendering processs
+
+
+ Ctrl+F5
+
+
+
+
+
+ :/buttons/logo/images/about.png:/buttons/logo/images/about.png
+
+
+ About
+
+
+ Display information on this software
+
+
+ F1
+
+
+
+
+
+ :/buttons/logo/images/render.png:/buttons/logo/images/render.png
+
+
+ Show last render
+
+
+ Display the last render done
+
+
+ F6
+
+
+
+
+
+ MainTerrainForm
+ QWidget
+ terrain/mainterrainform.h
+ 1
+
+
+
+
+
+
+
+ button_explore
+ clicked()
+ action_explore
+ trigger()
+
+
+ 127
+ 380
+
+
+ -1
+ -1
+
+
+
+
+ button_render
+ clicked()
+ action_final_render
+ trigger()
+
+
+ 213
+ 425
+
+
+ 213
+ 425
+
+
+
+
+ button_file_new
+ clicked()
+ action_file_new
+ trigger()
+
+
+ 213
+ 522
+
+
+ -1
+ -1
+
+
+
+
+ button_file_load
+ clicked()
+ action_file_load
+ trigger()
+
+
+ 213
+ 588
+
+
+ -1
+ -1
+
+
+
+
+ button_file_save
+ clicked()
+ action_file_save
+ trigger()
+
+
+ 213
+ 555
+
+
+ -1
+ -1
+
+
+
+
+
diff --git a/src/editing/formrender.h b/src/editing/formrender.h
index c7629ea..d0b18e6 100644
--- a/src/editing/formrender.h
+++ b/src/editing/formrender.h
@@ -21,14 +21,12 @@ public slots:
virtual void revertConfig();
virtual void applyConfig();
void startQuickRender();
+ void startRender();
+ void showRender();
protected slots:
virtual void configChangeEvent();
-private slots:
- void startRender();
- void showRender();
-
private:
RenderParams _params;
CameraDefinition* _camera;
diff --git a/src/editing/paysages-qt.pro b/src/editing/paysages-qt.pro
index 454542f..86093c6 100644
--- a/src/editing/paysages-qt.pro
+++ b/src/editing/paysages-qt.pro
@@ -31,7 +31,6 @@ HEADERS += \
previewosd.h \
previewmaterial.h \
previewcolorgradation.h \
- mainwindow.h \
inputnoise.h \
inputmaterial.h \
inputlayers.h \
@@ -70,7 +69,9 @@ HEADERS += \
common/freeformhelper.h \
terrain/previewterrainshape.h \
common/widgetsliderdecimal.h \
- common/previewrenderer.h
+ common/previewrenderer.h \
+ terrain/widgetterrainbasenoisepreview.h \
+ common/mainwindow.h
SOURCES += \
terrain/widgetheightmap.cpp \
@@ -80,7 +81,6 @@ SOURCES += \
previewosd.cpp \
previewmaterial.cpp \
previewcolorgradation.cpp \
- mainwindow.cpp \
inputnoise.cpp \
inputmaterial.cpp \
inputlayers.cpp \
@@ -119,12 +119,15 @@ SOURCES += \
common/freeformhelper.cpp \
terrain/previewterrainshape.cpp \
common/widgetsliderdecimal.cpp \
- common/previewrenderer.cpp
+ common/previewrenderer.cpp \
+ terrain/widgetterrainbasenoisepreview.cpp \
+ common/mainwindow.cpp
FORMS += \
terrain/dialogterrainpainting.ui \
common/widgetglobalformbuttons.ui \
- terrain/mainterrainform.ui
+ terrain/mainterrainform.ui \
+ common/mainwindow.ui
RESOURCES += \
../../data/ui_pictures.qrc
diff --git a/src/editing/terrain/mainterrainform.cpp b/src/editing/terrain/mainterrainform.cpp
index 71c3c08..c383327 100644
--- a/src/editing/terrain/mainterrainform.cpp
+++ b/src/editing/terrain/mainterrainform.cpp
@@ -22,7 +22,7 @@ MainTerrainForm::MainTerrainForm(QWidget *parent) :
_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, 90.0, 0.5, 5.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->addDoubleInputSlider(ui->input_water_height, &_terrain->water_height, -1.0, 1.0, 0.01, 0.1);
_form_helper->setApplyButton(ui->button_apply);
_form_helper->setRevertButton(ui->button_revert);
@@ -55,6 +55,8 @@ void MainTerrainForm::refreshFromLocalData()
{
_form_helper->setLabelText("label_painting_info", tr("No manual scuplting done"));
}
+
+ ui->widget_base_noise_preview->setNoise(_terrain->_height_noise);
}
void MainTerrainForm::refreshFromFellowData()
diff --git a/src/editing/terrain/mainterrainform.ui b/src/editing/terrain/mainterrainform.ui
index 3e08c61..12fbb1b 100644
--- a/src/editing/terrain/mainterrainform.ui
+++ b/src/editing/terrain/mainterrainform.ui
@@ -54,7 +54,7 @@
-
-
+
1
@@ -447,6 +447,12 @@
QSlider
common/widgetsliderdecimal.h
+
+ WidgetTerrainBaseNoisePreview
+ QWidget
+ terrain/widgetterrainbasenoisepreview.h
+ 1
+
diff --git a/src/editing/terrain/previewterrainshape.cpp b/src/editing/terrain/previewterrainshape.cpp
index 5582f9d..0919370 100644
--- a/src/editing/terrain/previewterrainshape.cpp
+++ b/src/editing/terrain/previewterrainshape.cpp
@@ -5,6 +5,7 @@
PreviewTerrainShape::PreviewTerrainShape(TerrainDefinition* terrain)
{
_terrain = terrain;
+ _highlight_enabled = true;
// TODO Don't delete the base renderer, just alter it
rendererDelete(renderer);
@@ -14,6 +15,7 @@ PreviewTerrainShape::PreviewTerrainShape(TerrainDefinition* terrain)
void PreviewTerrainShape::bindEvent(BasePreview* preview)
{
preview->addOsd(QString("geolocation"));
+ //preview->addToggle("highlight", tr("Coverage highlight"), true);
preview->configScaling(20.0, 1000.0, 20.0, 50.0);
preview->configScrolling(-1000.0, 1000.0, 0.0, -1000.0, 1000.0, 0.0);
@@ -26,5 +28,13 @@ void PreviewTerrainShape::updateEvent()
Color PreviewTerrainShape::getColor2D(double x, double y, double scaling)
{
- return terrainGetPreviewColor(renderer, x, y, scaling);
+ return waterGetPreviewCoverage(renderer, x, y, scaling, _highlight_enabled ? 1 : 0);
+}
+
+void PreviewTerrainShape::toggleChangeEvent(QString key, bool value)
+{
+ if (key == "highlight")
+ {
+ _highlight_enabled = value;
+ }
}
diff --git a/src/editing/terrain/previewterrainshape.h b/src/editing/terrain/previewterrainshape.h
index ae54091..c99141e 100644
--- a/src/editing/terrain/previewterrainshape.h
+++ b/src/editing/terrain/previewterrainshape.h
@@ -15,9 +15,12 @@ protected:
virtual void bindEvent(BasePreview* preview);
virtual void updateEvent();
virtual Color getColor2D(double x, double y, double scaling);
+ virtual void toggleChangeEvent(QString key, bool value);
private:
TerrainDefinition* _terrain;
+ bool _highlight_enabled;
+ double _water_height;
};
#endif // PREVIEWTERRAINSHAPE_H
diff --git a/src/editing/terrain/widgetterrainbasenoisepreview.cpp b/src/editing/terrain/widgetterrainbasenoisepreview.cpp
new file mode 100644
index 0000000..aacdc99
--- /dev/null
+++ b/src/editing/terrain/widgetterrainbasenoisepreview.cpp
@@ -0,0 +1,45 @@
+#include "widgetterrainbasenoisepreview.h"
+
+#include
+#include
+#include "tools.h"
+
+WidgetTerrainBaseNoisePreview::WidgetTerrainBaseNoisePreview(QWidget* parent) :
+ QWidget(parent)
+{
+ _noise = NULL;
+}
+
+void WidgetTerrainBaseNoisePreview::setNoise(NoiseGenerator* noise)
+{
+ _noise = noise;
+ update();
+}
+
+void WidgetTerrainBaseNoisePreview::paintEvent(QPaintEvent* event)
+{
+ QPainter painter(this);
+
+ painter.setBrush(Qt::SolidPattern);
+ painter.drawRect(rect());
+
+ int height = this->height();
+
+ if (_noise)
+ {
+ QRect boundaries = event->region().boundingRect();
+ double value, factor;
+ double minvalue, maxvalue;
+
+ noiseGetRange(_noise, &minvalue, &maxvalue);
+ factor = ((double)height) / (maxvalue - minvalue);
+
+ for (int x = boundaries.left(); x <= boundaries.right(); x++)
+ {
+ value = noiseGet1DTotal(_noise, 100.0 * ((double)x) / factor);
+
+ painter.setPen(Qt::white);
+ painter.drawLine(x, height - 1 - (value - minvalue) * factor, x, height - 1);
+ }
+ }
+}
diff --git a/src/editing/terrain/widgetterrainbasenoisepreview.h b/src/editing/terrain/widgetterrainbasenoisepreview.h
new file mode 100644
index 0000000..f3e12a5
--- /dev/null
+++ b/src/editing/terrain/widgetterrainbasenoisepreview.h
@@ -0,0 +1,26 @@
+#ifndef _PAYSAGES_EDITING_TERRAIN_WIDGETTERRAINBASENOISEPREVIEW_H_
+#define _PAYSAGES_EDITING_TERRAIN_WIDGETTERRAINBASENOISEPREVIEW_H_
+
+#include
+#include "rendering/noise.h"
+
+class WidgetTerrainBaseNoisePreview : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit WidgetTerrainBaseNoisePreview(QWidget* parent = 0);
+
+ void setNoise(NoiseGenerator* noise);
+
+protected:
+ virtual void paintEvent(QPaintEvent* event);
+
+signals:
+
+public slots:
+
+private:
+ NoiseGenerator* _noise;
+};
+
+#endif