paysages: Terrain tab redesign (WIP)
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@565 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
e082fedd19
commit
c9256e240c
12 changed files with 474 additions and 196 deletions
|
@ -64,10 +64,10 @@ bool BaseExplorerChunk::maintain()
|
||||||
_texture_changed = true;
|
_texture_changed = true;
|
||||||
_lock_data.unlock();
|
_lock_data.unlock();
|
||||||
|
|
||||||
if (_texture_current_size < 4 && _texture_current_size < _texture_max_size)
|
/*if (_texture_current_size < 4 && _texture_current_size < _texture_max_size)
|
||||||
{
|
{
|
||||||
maintain();
|
maintain();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -159,4 +159,4 @@ double BaseExplorerChunk::getDisplayedSizeHint(CameraDefinition*)
|
||||||
Color BaseExplorerChunk::getTextureColor(double, double)
|
Color BaseExplorerChunk::getTextureColor(double, double)
|
||||||
{
|
{
|
||||||
return COLOR_TRANSPARENT;
|
return COLOR_TRANSPARENT;
|
||||||
}
|
}
|
||||||
|
|
170
src/editing/common/freeformhelper.cpp
Normal file
170
src/editing/common/freeformhelper.cpp
Normal file
|
@ -0,0 +1,170 @@
|
||||||
|
#include "freeformhelper.h"
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
FreeFormHelper::FreeFormHelper(QWidget* form_widget)
|
||||||
|
:QObject()
|
||||||
|
{
|
||||||
|
_form_widget = form_widget;
|
||||||
|
_data_changed = false;
|
||||||
|
|
||||||
|
_button_apply = NULL;
|
||||||
|
_button_revert = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
FreeFormHelper::~FreeFormHelper()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeFormHelper::startManaging()
|
||||||
|
{
|
||||||
|
connect(this, SIGNAL(needLocalRefreshing()), _form_widget, SLOT(refreshFromLocalData()));
|
||||||
|
connect(this, SIGNAL(needGlobalRefreshing()), _form_widget, SLOT(refreshFromFellowData()));
|
||||||
|
connect(this, SIGNAL(needReverting()), _form_widget, SLOT(updateLocalDataFromScenery()));
|
||||||
|
connect(this, SIGNAL(needCommitting()), _form_widget, SLOT(commitLocalDataToScenery()));
|
||||||
|
|
||||||
|
emit needLocalRefreshing();
|
||||||
|
emit needGlobalRefreshing();
|
||||||
|
emit needReverting();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeFormHelper::addPreview(BasePreview* preview)
|
||||||
|
{
|
||||||
|
if (preview && preview->inherits("BasePreview"))
|
||||||
|
{
|
||||||
|
_previews.append(preview);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeFormHelper::addPreview(QString widget_name)
|
||||||
|
{
|
||||||
|
addPreview(_form_widget->findChild<BasePreview*>(widget_name));
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeFormHelper::addDoubleInputSlider(QSlider* slider, double* value, double min, double max, double small_step, double large_step)
|
||||||
|
{
|
||||||
|
if (slider && slider->inherits("QSlider"))
|
||||||
|
{
|
||||||
|
slider->setMinimum(0);
|
||||||
|
slider->setMaximum(round((max - min) / small_step));
|
||||||
|
slider->setValue(round((*value - min) / small_step));
|
||||||
|
|
||||||
|
slider->setTickInterval(round(large_step / small_step));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeFormHelper::addDoubleInputSlider(QString widget_name, double* value, double min, double max, double small_step, double large_step)
|
||||||
|
{
|
||||||
|
addDoubleInputSlider(_form_widget->findChild<QSlider*>(widget_name), value, min, max, small_step, large_step);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeFormHelper::setApplyButton(QPushButton* button)
|
||||||
|
{
|
||||||
|
if (button && button->inherits("QPushButton"))
|
||||||
|
{
|
||||||
|
_button_apply = button;
|
||||||
|
button->setEnabled(_data_changed);
|
||||||
|
|
||||||
|
connect(button, SIGNAL(clicked()), this, SLOT(processApplyClicked()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeFormHelper::setApplyButton(QString widget_name)
|
||||||
|
{
|
||||||
|
setApplyButton(_form_widget->findChild<QPushButton*>(widget_name));
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeFormHelper::setRevertButton(QPushButton* button)
|
||||||
|
{
|
||||||
|
if (button && button->inherits("QPushButton"))
|
||||||
|
{
|
||||||
|
_button_revert = button;
|
||||||
|
button->setEnabled(_data_changed);
|
||||||
|
|
||||||
|
connect(button, SIGNAL(clicked()), this, SLOT(processRevertClicked()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeFormHelper::setRevertButton(QString widget_name)
|
||||||
|
{
|
||||||
|
setRevertButton(_form_widget->findChild<QPushButton*>(widget_name));
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeFormHelper::setLabelText(QLabel* label, QString text)
|
||||||
|
{
|
||||||
|
if (label && label->inherits("QLabel"))
|
||||||
|
{
|
||||||
|
label->setText(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeFormHelper::setLabelText(QString widget_name, QString text)
|
||||||
|
{
|
||||||
|
setLabelText(_form_widget->findChild<QLabel*>(widget_name), text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeFormHelper::openDialog(QDialog* dialog)
|
||||||
|
{
|
||||||
|
if (dialog->exec())
|
||||||
|
{
|
||||||
|
processDataChange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeFormHelper::processDataChange()
|
||||||
|
{
|
||||||
|
_data_changed = true;
|
||||||
|
if (_button_apply)
|
||||||
|
{
|
||||||
|
_button_apply->setEnabled(true);
|
||||||
|
}
|
||||||
|
if (_button_revert)
|
||||||
|
{
|
||||||
|
_button_revert->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < _previews.size(); i++)
|
||||||
|
{
|
||||||
|
_previews[i]->redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
emit needLocalRefreshing();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeFormHelper::processRevertClicked()
|
||||||
|
{
|
||||||
|
emit needReverting();
|
||||||
|
|
||||||
|
_data_changed = false;
|
||||||
|
if (_button_apply)
|
||||||
|
{
|
||||||
|
_button_apply->setEnabled(false);
|
||||||
|
}
|
||||||
|
if (_button_revert)
|
||||||
|
{
|
||||||
|
_button_revert->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < _previews.size(); i++)
|
||||||
|
{
|
||||||
|
_previews[i]->redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
emit needLocalRefreshing();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeFormHelper::processApplyClicked()
|
||||||
|
{
|
||||||
|
emit needCommitting();
|
||||||
|
|
||||||
|
_data_changed = false;
|
||||||
|
if (_button_apply)
|
||||||
|
{
|
||||||
|
_button_apply->setEnabled(false);
|
||||||
|
}
|
||||||
|
if (_button_revert)
|
||||||
|
{
|
||||||
|
_button_revert->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
69
src/editing/common/freeformhelper.h
Normal file
69
src/editing/common/freeformhelper.h
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
#ifndef FREEFORMHELPER_H
|
||||||
|
#define FREEFORMHELPER_H
|
||||||
|
|
||||||
|
#include <QSlider>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include "../basepreview.h"
|
||||||
|
|
||||||
|
class FreeFormHelper:public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
FreeFormHelper(QWidget* form_widget);
|
||||||
|
~FreeFormHelper();
|
||||||
|
|
||||||
|
void startManaging();
|
||||||
|
|
||||||
|
void addPreview(BasePreview* preview);
|
||||||
|
void addPreview(QString widget_name);
|
||||||
|
|
||||||
|
void addDoubleInputSlider(QSlider* slider, double* value, double min=0.0, double max=1.0, double small_step=0.0, double large_step=0.0);
|
||||||
|
void addDoubleInputSlider(QString widget_name, double* value, double min=0.0, double max=1.0, double small_step=0.0, double large_step=0.0);
|
||||||
|
|
||||||
|
void setApplyButton(QPushButton* button);
|
||||||
|
void setApplyButton(QString widget_name);
|
||||||
|
|
||||||
|
void setRevertButton(QPushButton* button);
|
||||||
|
void setRevertButton(QString widget_name);
|
||||||
|
|
||||||
|
void setExploreButton(QPushButton* button);
|
||||||
|
void setExploreButton(QString widget_name);
|
||||||
|
|
||||||
|
void setRenderButton(QPushButton* button);
|
||||||
|
void setRenderButton(QString widget_name);
|
||||||
|
|
||||||
|
void setLabelText(QLabel* label, QString text);
|
||||||
|
void setLabelText(QString widget_name, QString text);
|
||||||
|
|
||||||
|
void openDialog(QDialog* dialog);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void dataChanged();
|
||||||
|
void revertClicked();
|
||||||
|
void applyClicked();
|
||||||
|
|
||||||
|
void needLocalRefreshing();
|
||||||
|
void needGlobalRefreshing();
|
||||||
|
void needReverting();
|
||||||
|
void needCommitting();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void processDataChange();
|
||||||
|
void processRevertClicked();
|
||||||
|
void processApplyClicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QWidget* _form_widget;
|
||||||
|
|
||||||
|
bool _data_changed;
|
||||||
|
|
||||||
|
QVector<BasePreview*> _previews;
|
||||||
|
|
||||||
|
QPushButton* _button_apply;
|
||||||
|
QPushButton* _button_revert;
|
||||||
|
QPushButton* _button_explore;
|
||||||
|
QPushButton* _button_render;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FREEFORMHELPER_H
|
|
@ -1,85 +0,0 @@
|
||||||
#include "formterrain.h"
|
|
||||||
|
|
||||||
#include <QColor>
|
|
||||||
#include <QSlider>
|
|
||||||
#include "tools.h"
|
|
||||||
#include "terrain/dialogterrainpainting.h"
|
|
||||||
#include "rendering/scenery.h"
|
|
||||||
|
|
||||||
static TerrainDefinition* _definition;
|
|
||||||
|
|
||||||
/**************** Previews ****************/
|
|
||||||
class PreviewTerrainColor:public BasePreview
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
PreviewTerrainColor(QWidget* parent):BasePreview(parent)
|
|
||||||
{
|
|
||||||
_renderer = terrainCreatePreviewRenderer();
|
|
||||||
|
|
||||||
addOsd(QString("geolocation"));
|
|
||||||
|
|
||||||
configScaling(20.0, 1000.0, 20.0, 50.0);
|
|
||||||
configScrolling(-1000.0, 1000.0, 0.0, -1000.0, 1000.0, 0.0);
|
|
||||||
}
|
|
||||||
protected:
|
|
||||||
Color getColor(double x, double y)
|
|
||||||
{
|
|
||||||
return terrainGetPreviewColor(_renderer, x, y, scaling);
|
|
||||||
}
|
|
||||||
void updateData()
|
|
||||||
{
|
|
||||||
TerrainRendererClass.bind(_renderer, _definition);
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
Renderer* _renderer;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**************** Form ****************/
|
|
||||||
FormTerrain::FormTerrain(QWidget *parent):
|
|
||||||
BaseForm(parent)
|
|
||||||
{
|
|
||||||
_definition = (TerrainDefinition*)TerrainDefinitionClass.create();
|
|
||||||
|
|
||||||
QPushButton* button = addButton(tr("Paint"));
|
|
||||||
connect(button, SIGNAL(clicked()), this, SLOT(startPainting()));
|
|
||||||
|
|
||||||
/*previewHeight = new PreviewTerrainHeight(this);*/
|
|
||||||
previewColor = new PreviewTerrainColor(this);
|
|
||||||
/*addPreview(previewHeight, tr("Height preview (normalized)"));*/
|
|
||||||
addPreview(previewColor, tr("Lighted preview (no texture)"));
|
|
||||||
|
|
||||||
//addInputNoise(tr("Noise"), _definition.height_noise);
|
|
||||||
addInputDouble(tr("Scaling"), &_definition->scaling, 0.1, 3.0, 0.03, 0.3);
|
|
||||||
addInputDouble(tr("Height modifier"), &_definition->height, 0.0, 3.0, 0.01, 0.1);
|
|
||||||
addInputDouble(tr("Shadow smoothing"), &_definition->shadow_smoothing, 0.0, 0.3, 0.003, 0.03);
|
|
||||||
|
|
||||||
revertConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FormTerrain::revertConfig()
|
|
||||||
{
|
|
||||||
sceneryGetTerrain(_definition);
|
|
||||||
BaseForm::revertConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FormTerrain::applyConfig()
|
|
||||||
{
|
|
||||||
scenerySetTerrain(_definition);
|
|
||||||
BaseForm::applyConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FormTerrain::configChangeEvent()
|
|
||||||
{
|
|
||||||
TerrainDefinitionClass.validate(_definition);
|
|
||||||
BaseForm::configChangeEvent();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FormTerrain::startPainting()
|
|
||||||
{
|
|
||||||
DialogTerrainPainting* dialog = new DialogTerrainPainting(this, _definition);
|
|
||||||
if (dialog->exec())
|
|
||||||
{
|
|
||||||
configChangeEvent();
|
|
||||||
}
|
|
||||||
delete dialog;
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
#ifndef _PAYSAGES_QT_FORMTERRAIN_H_
|
|
||||||
#define _PAYSAGES_QT_FORMTERRAIN_H_
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include "basepreview.h"
|
|
||||||
#include "baseform.h"
|
|
||||||
|
|
||||||
class FormTerrain : public BaseForm
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit FormTerrain(QWidget *parent = 0);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
virtual void revertConfig();
|
|
||||||
virtual void applyConfig();
|
|
||||||
|
|
||||||
protected slots:
|
|
||||||
virtual void configChangeEvent();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void startPainting();
|
|
||||||
|
|
||||||
private:
|
|
||||||
/*BasePreview* previewHeight;*/
|
|
||||||
BasePreview* previewColor;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include "basepreview.h"
|
#include "basepreview.h"
|
||||||
#include "formclouds.h"
|
#include "formclouds.h"
|
||||||
#include "formatmosphere.h"
|
#include "formatmosphere.h"
|
||||||
#include "formterrain.h"
|
|
||||||
#include "formtextures.h"
|
#include "formtextures.h"
|
||||||
#include "formwater.h"
|
#include "formwater.h"
|
||||||
#include "formrender.h"
|
#include "formrender.h"
|
||||||
|
@ -89,11 +88,6 @@ QMainWindow(parent)
|
||||||
tabs = new QTabWidget(this);
|
tabs = new QTabWidget(this);
|
||||||
tabs->setIconSize(QSize(32, 32));
|
tabs->setIconSize(QSize(32, 32));
|
||||||
|
|
||||||
form = new FormTerrain(tabs);
|
|
||||||
tabs->addTab(form, QIcon(getDataPath("images/tab_terrain.png")), tr("Terrain"));
|
|
||||||
QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll()), Qt::QueuedConnection);
|
|
||||||
_forms.append(form);
|
|
||||||
|
|
||||||
tabs->addTab(new MainTerrainForm(tabs), QIcon(getDataPath("images/tab_terrain.png")), tr("Landscape shape"));
|
tabs->addTab(new MainTerrainForm(tabs), QIcon(getDataPath("images/tab_terrain.png")), tr("Landscape shape"));
|
||||||
|
|
||||||
form = new FormTextures(tabs);
|
form = new FormTextures(tabs);
|
||||||
|
@ -242,7 +236,7 @@ void MainWindow::fileLoad()
|
||||||
|
|
||||||
void MainWindow::showAboutDialog()
|
void MainWindow::showAboutDialog()
|
||||||
{
|
{
|
||||||
QMessageBox::about(this, tr("Paysages 3D"), tr("A 3D landscape editing and rendering software.\n\nAuthors :\nProgramming - Michael Lemaire\n\nCredits :\nQt - http://qt.nokia.com/\nDevIL - http://openil.sourceforge.net/\nGLib - http://www.gtk.org/\n"));
|
QMessageBox::about(this, tr("Paysages 3D"), tr("A 3D landscape editing and rendering software.\n\nAuthors :\nProgramming - Michael Lemaire\n\nCredits :\nQt - http://qt-project.org/\nDevIL - http://openil.sourceforge.net/\nGLib - http://www.gtk.org/\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::quickPreview()
|
void MainWindow::quickPreview()
|
||||||
|
|
|
@ -45,7 +45,6 @@ HEADERS += \
|
||||||
inputboolean.h \
|
inputboolean.h \
|
||||||
formwater.h \
|
formwater.h \
|
||||||
formtextures.h \
|
formtextures.h \
|
||||||
formterrain.h \
|
|
||||||
formrender.h \
|
formrender.h \
|
||||||
formmaterial.h \
|
formmaterial.h \
|
||||||
formclouds.h \
|
formclouds.h \
|
||||||
|
@ -67,7 +66,9 @@ HEADERS += \
|
||||||
terrain/dialogterrainpainting.h \
|
terrain/dialogterrainpainting.h \
|
||||||
common/widgetglobalformbuttons.h \
|
common/widgetglobalformbuttons.h \
|
||||||
terrain/paintingbrush.h \
|
terrain/paintingbrush.h \
|
||||||
terrain/mainterrainform.h
|
terrain/mainterrainform.h \
|
||||||
|
common/freeformhelper.h \
|
||||||
|
terrain/previewterrainshape.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
widgetheightmap.cpp \
|
widgetheightmap.cpp \
|
||||||
|
@ -91,7 +92,6 @@ SOURCES += \
|
||||||
inputboolean.cpp \
|
inputboolean.cpp \
|
||||||
formwater.cpp \
|
formwater.cpp \
|
||||||
formtextures.cpp \
|
formtextures.cpp \
|
||||||
formterrain.cpp \
|
|
||||||
formrender.cpp \
|
formrender.cpp \
|
||||||
formmaterial.cpp \
|
formmaterial.cpp \
|
||||||
formclouds.cpp \
|
formclouds.cpp \
|
||||||
|
@ -113,7 +113,9 @@ SOURCES += \
|
||||||
terrain/dialogterrainpainting.cpp \
|
terrain/dialogterrainpainting.cpp \
|
||||||
common/widgetglobalformbuttons.cpp \
|
common/widgetglobalformbuttons.cpp \
|
||||||
terrain/paintingbrush.cpp \
|
terrain/paintingbrush.cpp \
|
||||||
terrain/mainterrainform.cpp
|
terrain/mainterrainform.cpp \
|
||||||
|
common/freeformhelper.cpp \
|
||||||
|
terrain/previewterrainshape.cpp
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
terrain/dialogterrainpainting.ui \
|
terrain/dialogterrainpainting.ui \
|
||||||
|
|
|
@ -1,14 +1,78 @@
|
||||||
#include "mainterrainform.h"
|
#include "mainterrainform.h"
|
||||||
#include "ui_mainterrainform.h"
|
#include "ui_mainterrainform.h"
|
||||||
|
|
||||||
|
#include "dialogterrainpainting.h"
|
||||||
|
#include "tools.h"
|
||||||
|
#include "rendering/scenery.h"
|
||||||
|
|
||||||
MainTerrainForm::MainTerrainForm(QWidget *parent) :
|
MainTerrainForm::MainTerrainForm(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::MainTerrainForm)
|
ui(new Ui::MainTerrainForm)
|
||||||
{
|
{
|
||||||
|
_terrain = (TerrainDefinition*)TerrainDefinitionClass.create();
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
_form_helper = new FreeFormHelper(this);
|
||||||
|
|
||||||
|
_form_helper->addPreview("preview_shape");
|
||||||
|
|
||||||
|
_form_helper->addDoubleInputSlider("input_scaling", &_terrain->scaling, 0.1, 3.0, 0.03, 0.3);
|
||||||
|
_form_helper->addDoubleInputSlider("input_height", &_terrain->height, 0.0, 3.0, 0.01, 0.1);
|
||||||
|
_form_helper->addDoubleInputSlider("input_shadow_smoothing", &_terrain->shadow_smoothing, 0.0, 0.3, 0.003, 0.03);
|
||||||
|
|
||||||
|
_form_helper->setApplyButton("button_apply");
|
||||||
|
_form_helper->setRevertButton("button_revert");
|
||||||
|
|
||||||
|
connect(findChild<QPushButton*>("button_dialog_painting"), SIGNAL(clicked()), this, SLOT(buttonPaintingPressed()));
|
||||||
|
connect(findChild<QPushButton*>("button_goto_textures"), SIGNAL(clicked()), this, SLOT(buttonTexturesPressed()));
|
||||||
|
|
||||||
|
_form_helper->startManaging();
|
||||||
}
|
}
|
||||||
|
|
||||||
MainTerrainForm::~MainTerrainForm()
|
MainTerrainForm::~MainTerrainForm()
|
||||||
{
|
{
|
||||||
|
delete _form_helper;
|
||||||
delete ui;
|
delete ui;
|
||||||
|
|
||||||
|
TerrainDefinitionClass.destroy(_terrain);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainTerrainForm::refreshFromLocalData()
|
||||||
|
{
|
||||||
|
qint64 memused = terrainGetMemoryStats(_terrain);
|
||||||
|
if (memused > 0)
|
||||||
|
{
|
||||||
|
_form_helper->setLabelText("label_painting_info", tr("Memory used by sculpted data: %1").arg(getHumanMemory(memused)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_form_helper->setLabelText("label_painting_info", tr("No manual scuplting done"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainTerrainForm::refreshFromFellowData()
|
||||||
|
{
|
||||||
|
// TODO Refresh texture info
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainTerrainForm::updateLocalDataFromScenery()
|
||||||
|
{
|
||||||
|
sceneryGetTerrain(_terrain);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainTerrainForm::commitLocalDataToScenery()
|
||||||
|
{
|
||||||
|
scenerySetTerrain(_terrain);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainTerrainForm::buttonPaintingPressed()
|
||||||
|
{
|
||||||
|
DialogTerrainPainting dialog(this, _terrain);
|
||||||
|
_form_helper->openDialog(&dialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainTerrainForm::buttonTexturesPressed()
|
||||||
|
{
|
||||||
|
// TODO Switch to textures tab
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define MAINTERRAINFORM_H
|
#define MAINTERRAINFORM_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include "common/freeformhelper.h"
|
||||||
|
#include "rendering/terrain/public.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainTerrainForm;
|
class MainTerrainForm;
|
||||||
|
@ -14,9 +16,23 @@ class MainTerrainForm : public QWidget
|
||||||
public:
|
public:
|
||||||
explicit MainTerrainForm(QWidget *parent = 0);
|
explicit MainTerrainForm(QWidget *parent = 0);
|
||||||
~MainTerrainForm();
|
~MainTerrainForm();
|
||||||
|
|
||||||
|
inline TerrainDefinition* getTerrainDefinition() {return _terrain;}
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void refreshFromLocalData();
|
||||||
|
void refreshFromFellowData();
|
||||||
|
void updateLocalDataFromScenery();
|
||||||
|
void commitLocalDataToScenery();
|
||||||
|
|
||||||
|
void buttonPaintingPressed();
|
||||||
|
void buttonTexturesPressed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainTerrainForm *ui;
|
Ui::MainTerrainForm *ui;
|
||||||
|
FreeFormHelper* _form_helper;
|
||||||
|
|
||||||
|
TerrainDefinition* _terrain;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINTERRAINFORM_H
|
#endif // MAINTERRAINFORM_H
|
||||||
|
|
|
@ -68,8 +68,6 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
<zorder>groupBox_1</zorder>
|
|
||||||
<zorder>widget</zorder>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -82,7 +80,7 @@
|
||||||
<widget class="QWidget" name="widget_5" native="true">
|
<widget class="QWidget" name="widget_5" native="true">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_7">
|
<widget class="QPushButton" name="button_dialog_painting">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -95,7 +93,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="label_painting_info">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -143,7 +141,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QSlider" name="horizontalSlider">
|
<widget class="QSlider" name="input_scaling">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
|
@ -163,7 +161,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QSlider" name="horizontalSlider_2">
|
<widget class="QSlider" name="input_height">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
|
@ -198,7 +196,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QSlider" name="horizontalSlider_3">
|
<widget class="QSlider" name="input_shadow_smoothing">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
|
@ -223,49 +221,86 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="formWidget" native="true">
|
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||||
<layout class="QFormLayout" name="formLayout_3">
|
<item>
|
||||||
<item row="0" column="0">
|
<widget class="QWidget" name="widget_7" native="true">
|
||||||
<widget class="QLabel" name="label_4">
|
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||||
<property name="text">
|
<item>
|
||||||
<string>Relative water height</string>
|
<widget class="QWidget" name="formWidget" native="true">
|
||||||
</property>
|
<layout class="QFormLayout" name="formLayout_3">
|
||||||
</widget>
|
<item row="0" column="0">
|
||||||
</item>
|
<widget class="QLabel" name="label_4">
|
||||||
<item row="0" column="1">
|
<property name="text">
|
||||||
<widget class="QSlider" name="horizontalSlider_4">
|
<string>Relative water height</string>
|
||||||
<property name="maximumSize">
|
</property>
|
||||||
<size>
|
</widget>
|
||||||
<width>400</width>
|
</item>
|
||||||
<height>16777215</height>
|
<item row="0" column="1">
|
||||||
</size>
|
<widget class="QSlider" name="horizontalSlider_4">
|
||||||
</property>
|
<property name="maximumSize">
|
||||||
<property name="orientation">
|
<size>
|
||||||
<enum>Qt::Horizontal</enum>
|
<width>400</width>
|
||||||
</property>
|
<height>16777215</height>
|
||||||
</widget>
|
</size>
|
||||||
</item>
|
</property>
|
||||||
</layout>
|
<property name="orientation">
|
||||||
</widget>
|
<enum>Qt::Horizontal</enum>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
</widget>
|
||||||
<widget class="QPushButton" name="pushButton_2">
|
</item>
|
||||||
<property name="sizePolicy">
|
</layout>
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
</widget>
|
||||||
<horstretch>0</horstretch>
|
</item>
|
||||||
<verstretch>0</verstretch>
|
<item>
|
||||||
</sizepolicy>
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
</property>
|
<item>
|
||||||
<property name="maximumSize">
|
<widget class="QPushButton" name="button_goto_textures">
|
||||||
<size>
|
<property name="sizePolicy">
|
||||||
<width>500</width>
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
<height>16777215</height>
|
<horstretch>0</horstretch>
|
||||||
</size>
|
<verstretch>0</verstretch>
|
||||||
</property>
|
</sizepolicy>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Go to textures to add small height displacements (rocks...)</string>
|
<property name="maximumSize">
|
||||||
</property>
|
<size>
|
||||||
</widget>
|
<width>500</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Go to textures to add small height displacements (rocks...)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>{ textures info }</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="widget_8" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -289,7 +324,7 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="BasePreview" name="widget_2" native="true">
|
<widget class="BasePreview" name="preview_shape" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -332,22 +367,22 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_4">
|
<widget class="QGroupBox" name="groupBox_4">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -355,7 +390,7 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_6">
|
<widget class="QPushButton" name="button_revert">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Revert modifications</string>
|
<string>Revert modifications</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -366,7 +401,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_5">
|
<widget class="QPushButton" name="button_apply">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Apply modifications</string>
|
<string>Apply modifications</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
22
src/editing/terrain/previewterrainshape.cpp
Normal file
22
src/editing/terrain/previewterrainshape.cpp
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#include "previewterrainshape.h"
|
||||||
|
|
||||||
|
PreviewTerrainShape::PreviewTerrainShape(QWidget *parent) :
|
||||||
|
BasePreview(parent)
|
||||||
|
{
|
||||||
|
_renderer = terrainCreatePreviewRenderer();
|
||||||
|
|
||||||
|
addOsd(QString("geolocation"));
|
||||||
|
|
||||||
|
configScaling(20.0, 1000.0, 20.0, 50.0);
|
||||||
|
configScrolling(-1000.0, 1000.0, 0.0, -1000.0, 1000.0, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Color PreviewTerrainShape::getColor(double x, double y)
|
||||||
|
{
|
||||||
|
return terrainGetPreviewColor(_renderer, x, y, scaling);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewTerrainShape::updateData()
|
||||||
|
{
|
||||||
|
//TerrainRendererClass.bind(_renderer, _definition);
|
||||||
|
}
|
21
src/editing/terrain/previewterrainshape.h
Normal file
21
src/editing/terrain/previewterrainshape.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef PREVIEWTERRAINSHAPE_H
|
||||||
|
#define PREVIEWTERRAINSHAPE_H
|
||||||
|
|
||||||
|
#include "basepreview.h"
|
||||||
|
#include "rendering/renderer.h"
|
||||||
|
|
||||||
|
class PreviewTerrainShape : public BasePreview
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit PreviewTerrainShape(QWidget *parent = 0);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual Color getColor(double x, double y);
|
||||||
|
virtual void updateData();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Renderer* _renderer;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PREVIEWTERRAINSHAPE_H
|
Loading…
Reference in a new issue