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;
|
||||
_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();
|
||||
}
|
||||
}*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
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 "formclouds.h"
|
||||
#include "formatmosphere.h"
|
||||
#include "formterrain.h"
|
||||
#include "formtextures.h"
|
||||
#include "formwater.h"
|
||||
#include "formrender.h"
|
||||
|
@ -89,11 +88,6 @@ QMainWindow(parent)
|
|||
tabs = new QTabWidget(this);
|
||||
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"));
|
||||
|
||||
form = new FormTextures(tabs);
|
||||
|
@ -242,7 +236,7 @@ void MainWindow::fileLoad()
|
|||
|
||||
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()
|
||||
|
|
|
@ -45,7 +45,6 @@ HEADERS += \
|
|||
inputboolean.h \
|
||||
formwater.h \
|
||||
formtextures.h \
|
||||
formterrain.h \
|
||||
formrender.h \
|
||||
formmaterial.h \
|
||||
formclouds.h \
|
||||
|
@ -67,7 +66,9 @@ HEADERS += \
|
|||
terrain/dialogterrainpainting.h \
|
||||
common/widgetglobalformbuttons.h \
|
||||
terrain/paintingbrush.h \
|
||||
terrain/mainterrainform.h
|
||||
terrain/mainterrainform.h \
|
||||
common/freeformhelper.h \
|
||||
terrain/previewterrainshape.h
|
||||
|
||||
SOURCES += \
|
||||
widgetheightmap.cpp \
|
||||
|
@ -91,7 +92,6 @@ SOURCES += \
|
|||
inputboolean.cpp \
|
||||
formwater.cpp \
|
||||
formtextures.cpp \
|
||||
formterrain.cpp \
|
||||
formrender.cpp \
|
||||
formmaterial.cpp \
|
||||
formclouds.cpp \
|
||||
|
@ -113,7 +113,9 @@ SOURCES += \
|
|||
terrain/dialogterrainpainting.cpp \
|
||||
common/widgetglobalformbuttons.cpp \
|
||||
terrain/paintingbrush.cpp \
|
||||
terrain/mainterrainform.cpp
|
||||
terrain/mainterrainform.cpp \
|
||||
common/freeformhelper.cpp \
|
||||
terrain/previewterrainshape.cpp
|
||||
|
||||
FORMS += \
|
||||
terrain/dialogterrainpainting.ui \
|
||||
|
|
|
@ -1,14 +1,78 @@
|
|||
#include "mainterrainform.h"
|
||||
#include "ui_mainterrainform.h"
|
||||
|
||||
#include "dialogterrainpainting.h"
|
||||
#include "tools.h"
|
||||
#include "rendering/scenery.h"
|
||||
|
||||
MainTerrainForm::MainTerrainForm(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::MainTerrainForm)
|
||||
{
|
||||
_terrain = (TerrainDefinition*)TerrainDefinitionClass.create();
|
||||
|
||||
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()
|
||||
{
|
||||
delete _form_helper;
|
||||
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
|
||||
|
||||
#include <QWidget>
|
||||
#include "common/freeformhelper.h"
|
||||
#include "rendering/terrain/public.h"
|
||||
|
||||
namespace Ui {
|
||||
class MainTerrainForm;
|
||||
|
@ -15,8 +17,22 @@ public:
|
|||
explicit MainTerrainForm(QWidget *parent = 0);
|
||||
~MainTerrainForm();
|
||||
|
||||
inline TerrainDefinition* getTerrainDefinition() {return _terrain;}
|
||||
|
||||
public slots:
|
||||
void refreshFromLocalData();
|
||||
void refreshFromFellowData();
|
||||
void updateLocalDataFromScenery();
|
||||
void commitLocalDataToScenery();
|
||||
|
||||
void buttonPaintingPressed();
|
||||
void buttonTexturesPressed();
|
||||
|
||||
private:
|
||||
Ui::MainTerrainForm *ui;
|
||||
FreeFormHelper* _form_helper;
|
||||
|
||||
TerrainDefinition* _terrain;
|
||||
};
|
||||
|
||||
#endif // MAINTERRAINFORM_H
|
||||
|
|
|
@ -68,8 +68,6 @@
|
|||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>groupBox_1</zorder>
|
||||
<zorder>widget</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -82,7 +80,7 @@
|
|||
<widget class="QWidget" name="widget_5" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_7">
|
||||
<widget class="QPushButton" name="button_dialog_painting">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -95,7 +93,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<widget class="QLabel" name="label_painting_info">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -143,7 +141,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSlider" name="horizontalSlider">
|
||||
<widget class="QSlider" name="input_scaling">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
|
@ -163,7 +161,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSlider" name="horizontalSlider_2">
|
||||
<widget class="QSlider" name="input_height">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
|
@ -198,7 +196,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSlider" name="horizontalSlider_3">
|
||||
<widget class="QSlider" name="input_shadow_smoothing">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
|
@ -223,49 +221,86 @@
|
|||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QWidget" name="formWidget" native="true">
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Relative water height</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSlider" name="horizontalSlider_4">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>500</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Go to textures to add small height displacements (rocks...)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_7" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<item>
|
||||
<widget class="QWidget" name="formWidget" native="true">
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Relative water height</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSlider" name="horizontalSlider_4">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QPushButton" name="button_goto_textures">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<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>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -289,7 +324,7 @@
|
|||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="BasePreview" name="widget_2" native="true">
|
||||
<widget class="BasePreview" name="preview_shape" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -332,22 +367,22 @@
|
|||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
</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>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
|
@ -355,7 +390,7 @@
|
|||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_6">
|
||||
<widget class="QPushButton" name="button_revert">
|
||||
<property name="text">
|
||||
<string>Revert modifications</string>
|
||||
</property>
|
||||
|
@ -366,7 +401,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_5">
|
||||
<widget class="QPushButton" name="button_apply">
|
||||
<property name="text">
|
||||
<string>Apply modifications</string>
|
||||
</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