paysages: New terrain main form (WIP)
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@564 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
1a193f4e78
commit
e082fedd19
19 changed files with 1284 additions and 363 deletions
1
TODO
1
TODO
|
@ -10,6 +10,7 @@ Technology Preview 2 :
|
|||
=> Displacement on 3d explorer and previews.
|
||||
=> Optimize ray marching (for tracing and shadows), using base terrain and displacement power.
|
||||
- Fix rendering when inside a cloud layer, with other upper or lower layers.
|
||||
- Compress and ship bruneton cache data.
|
||||
- Translations.
|
||||
|
||||
Technlogy Preview 3 :
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -3,5 +3,15 @@
|
|||
<file>images/apply.png</file>
|
||||
<file>images/cancel.png</file>
|
||||
<file>images/revert.png</file>
|
||||
<file>images/explore.png</file>
|
||||
<file>images/render.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/tabs">
|
||||
<file>images/tab_atmosphere.png</file>
|
||||
<file>images/tab_clouds.png</file>
|
||||
<file>images/tab_render.png</file>
|
||||
<file>images/tab_terrain.png</file>
|
||||
<file>images/tab_textures.png</file>
|
||||
<file>images/tab_water.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <QColor>
|
||||
#include <QSlider>
|
||||
#include "tools.h"
|
||||
#include "dialogheightmap.h"
|
||||
#include "terrain/dialogterrainpainting.h"
|
||||
#include "rendering/scenery.h"
|
||||
|
||||
|
@ -78,11 +77,9 @@ void FormTerrain::configChangeEvent()
|
|||
void FormTerrain::startPainting()
|
||||
{
|
||||
DialogTerrainPainting* dialog = new DialogTerrainPainting(this, _definition);
|
||||
dialog->exec();
|
||||
delete dialog;
|
||||
|
||||
/*if (DialogHeightMap::editHeightMap(this, _definition))
|
||||
if (dialog->exec())
|
||||
{
|
||||
configChangeEvent();
|
||||
}*/
|
||||
}
|
||||
delete dialog;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include "formwater.h"
|
||||
#include "formrender.h"
|
||||
|
||||
#include "terrain/mainterrainform.h"
|
||||
|
||||
#include "dialogrender.h"
|
||||
#include "dialogexplorer.h"
|
||||
|
||||
|
@ -92,6 +94,8 @@ QMainWindow(parent)
|
|||
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);
|
||||
tabs->addTab(form, QIcon(getDataPath("images/tab_textures.png")), tr("Textures"));
|
||||
QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll()), Qt::QueuedConnection);
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
isEmpty(PROJECT_PATH) {
|
||||
PROJECT_PATH = ../..
|
||||
}
|
||||
|
||||
TEMPLATE = app
|
||||
CONFIG += qt
|
||||
QT += core gui opengl
|
||||
|
@ -19,9 +23,6 @@ win32:LIBS += ../libpaysages.a ../libpaysages_exploring.a -lDevIL -lILU -lILUT -
|
|||
|
||||
TRANSLATIONS = $$PROJECT_PATH/data/i18n/paysages_fr.ts
|
||||
|
||||
#system(lupdate paysages-qt.pro)
|
||||
#system(lrelease $$TRANSLATIONS)
|
||||
|
||||
HEADERS += \
|
||||
widgetheightmap.h \
|
||||
widgetexplorer.h \
|
||||
|
@ -65,7 +66,8 @@ HEADERS += \
|
|||
baseexplorerchunk.h \
|
||||
terrain/dialogterrainpainting.h \
|
||||
common/widgetglobalformbuttons.h \
|
||||
terrain/paintingbrush.h
|
||||
terrain/paintingbrush.h \
|
||||
terrain/mainterrainform.h
|
||||
|
||||
SOURCES += \
|
||||
widgetheightmap.cpp \
|
||||
|
@ -110,11 +112,13 @@ SOURCES += \
|
|||
baseexplorerchunk.cpp \
|
||||
terrain/dialogterrainpainting.cpp \
|
||||
common/widgetglobalformbuttons.cpp \
|
||||
terrain/paintingbrush.cpp
|
||||
terrain/paintingbrush.cpp \
|
||||
terrain/mainterrainform.cpp
|
||||
|
||||
FORMS += \
|
||||
terrain/dialogterrainpainting.ui \
|
||||
common/widgetglobalformbuttons.ui
|
||||
common/widgetglobalformbuttons.ui \
|
||||
terrain/mainterrainform.ui
|
||||
|
||||
RESOURCES += \
|
||||
../../data/ui_pictures.qrc
|
||||
|
|
|
@ -42,6 +42,7 @@ void DialogTerrainPainting::revert()
|
|||
|
||||
void DialogTerrainPainting::brushConfigChanged()
|
||||
{
|
||||
QLabel* label;
|
||||
QComboBox* combobox;
|
||||
QSlider* slider;
|
||||
|
||||
|
@ -68,6 +69,11 @@ void DialogTerrainPainting::brushConfigChanged()
|
|||
}
|
||||
|
||||
// Update brush description
|
||||
label = findChild<QLabel*>("label_brush_description");
|
||||
if (label)
|
||||
{
|
||||
label->setText(getHelpText());
|
||||
}
|
||||
|
||||
// Update brush preview
|
||||
|
||||
|
@ -96,3 +102,9 @@ void DialogTerrainPainting::heightmapChanged()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString DialogTerrainPainting::getHelpText()
|
||||
{
|
||||
QString result = _brush.getHelpText();
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ public slots:
|
|||
void revert();
|
||||
|
||||
private:
|
||||
QString getHelpText();
|
||||
|
||||
Ui::DialogTerrainPainting *ui;
|
||||
|
||||
TerrainDefinition* _terrain_modified;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>912</width>
|
||||
<height>619</height>
|
||||
<width>949</width>
|
||||
<height>618</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -31,7 +31,7 @@
|
|||
<item>
|
||||
<widget class="WidgetHeightMap" name="widget_heightmap" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -166,10 +166,28 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<widget class="QLabel" name="label_brush_description">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">{ Brush information }</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
|
@ -188,7 +206,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<widget class="QWidget" name="widget_brush_preview" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
|
@ -318,22 +336,6 @@
|
|||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>input_brush_size</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>DialogTerrainPainting</receiver>
|
||||
<slot>brushConfigChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>676</x>
|
||||
<y>67</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>437</x>
|
||||
<y>72</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>input_brush_smoothing</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
|
@ -350,6 +352,22 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>input_brush_mode</sender>
|
||||
<signal>currentIndexChanged(int)</signal>
|
||||
<receiver>DialogTerrainPainting</receiver>
|
||||
<slot>brushConfigChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>752</x>
|
||||
<y>42</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>437</x>
|
||||
<y>40</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>input_brush_strength</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
|
@ -367,18 +385,18 @@
|
|||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>input_brush_mode</sender>
|
||||
<signal>currentIndexChanged(int)</signal>
|
||||
<sender>input_brush_size</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>DialogTerrainPainting</receiver>
|
||||
<slot>brushConfigChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>752</x>
|
||||
<y>42</y>
|
||||
<x>676</x>
|
||||
<y>67</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>437</x>
|
||||
<y>40</y>
|
||||
<y>72</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
|
@ -398,22 +416,6 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>widget_4</sender>
|
||||
<signal>okClicked()</signal>
|
||||
<receiver>DialogTerrainPainting</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>816</x>
|
||||
<y>593</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>683</x>
|
||||
<y>615</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>widget_4</sender>
|
||||
<signal>cancelClicked()</signal>
|
||||
|
@ -430,6 +432,22 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>widget_4</sender>
|
||||
<signal>okClicked()</signal>
|
||||
<receiver>DialogTerrainPainting</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>816</x>
|
||||
<y>593</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>683</x>
|
||||
<y>615</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>widget_4</sender>
|
||||
<signal>revertClicked()</signal>
|
||||
|
|
14
src/editing/terrain/mainterrainform.cpp
Normal file
14
src/editing/terrain/mainterrainform.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include "mainterrainform.h"
|
||||
#include "ui_mainterrainform.h"
|
||||
|
||||
MainTerrainForm::MainTerrainForm(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::MainTerrainForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
MainTerrainForm::~MainTerrainForm()
|
||||
{
|
||||
delete ui;
|
||||
}
|
22
src/editing/terrain/mainterrainform.h
Normal file
22
src/editing/terrain/mainterrainform.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef MAINTERRAINFORM_H
|
||||
#define MAINTERRAINFORM_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class MainTerrainForm;
|
||||
}
|
||||
|
||||
class MainTerrainForm : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainTerrainForm(QWidget *parent = 0);
|
||||
~MainTerrainForm();
|
||||
|
||||
private:
|
||||
Ui::MainTerrainForm *ui;
|
||||
};
|
||||
|
||||
#endif // MAINTERRAINFORM_H
|
398
src/editing/terrain/mainterrainform.ui
Normal file
398
src/editing/terrain/mainterrainform.ui
Normal file
|
@ -0,0 +1,398 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainTerrainForm</class>
|
||||
<widget class="QWidget" name="MainTerrainForm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1073</width>
|
||||
<height>662</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="verticalWidget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>15</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Infinite base shape</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Generate base noise</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_6" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>150</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>groupBox_1</zorder>
|
||||
<zorder>widget</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Manual modifications</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_5" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_7">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sculpt the terrain shape</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>{ heightmap info }</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_1">
|
||||
<property name="title">
|
||||
<string>Global modifiers</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-style:italic;">These modifiers change the base shape and manual modifications altogether</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Scaling</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSlider" name="horizontalSlider">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Height</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSlider" name="horizontalSlider_2">
|
||||
<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>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_6">
|
||||
<property name="title">
|
||||
<string>Rendering control</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_4" native="true">
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Shadow smoothing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSlider" name="horizontalSlider_3">
|
||||
<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>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_7">
|
||||
<property name="title">
|
||||
<string>Links to other modules</string>
|
||||
</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>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Result preview</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="BasePreview" name="widget_2" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="text">
|
||||
<string>Render preview</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/buttons/logo/images/render.png</normaloff>:/buttons/logo/images/render.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_4">
|
||||
<property name="text">
|
||||
<string>Explore in 3D</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/buttons/logo/images/explore.png</normaloff>:/buttons/logo/images/explore.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<string>Actions</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_6">
|
||||
<property name="text">
|
||||
<string>Revert modifications</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/buttons/logo/images/revert.png</normaloff>:/buttons/logo/images/revert.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_5">
|
||||
<property name="text">
|
||||
<string>Apply modifications</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/buttons/logo/images/apply.png</normaloff>:/buttons/logo/images/apply.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BasePreview</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>basepreview.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../data/ui_pictures.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -8,6 +8,7 @@ PaintingBrush::PaintingBrush()
|
|||
_size = 0.0;
|
||||
_smoothing = 0.0;
|
||||
_strength = 0.0;
|
||||
_height = 0.0;
|
||||
_noise = noiseCreateGenerator();
|
||||
noiseAddLevelsSimple(_noise, 10, 1.0, -0.5, 0.5, 0.5);
|
||||
}
|
||||
|
@ -79,6 +80,24 @@ void PaintingBrush::drawPreview(QWidget* widget)
|
|||
|
||||
}
|
||||
|
||||
QString PaintingBrush::getHelpText()
|
||||
{
|
||||
switch (_mode)
|
||||
{
|
||||
case PAINTING_BRUSH_RAISE:
|
||||
return QObject::tr("<strong>Left click</strong>: raise terrain<br><br><strong>Right click</strong>: lower terrain");
|
||||
case PAINTING_BRUSH_SMOOTH:
|
||||
return QObject::tr("<strong>Left click</strong>: add random noise to terrain<br><br><strong>Right click</strong>: smooth details");
|
||||
case PAINTING_BRUSH_FLATTEN:
|
||||
return QObject::tr("<strong>Left click</strong>: flatten at height picked with right click<br><br><strong>Right click</strong>: pick height at center");
|
||||
case PAINTING_BRUSH_FIX_DISCONTINUITIES:
|
||||
return QObject::tr("<strong>Left click</strong>: fix discontinuities in slope");
|
||||
case PAINTING_BRUSH_RESTORE:
|
||||
return QObject::tr("<strong>Left click</strong>: cancel all modifications on terrain");
|
||||
}
|
||||
return QString("");
|
||||
}
|
||||
|
||||
void PaintingBrush::applyToTerrain(TerrainDefinition* terrain, double x, double z, double duration, bool reverse)
|
||||
{
|
||||
double brush_strength;
|
||||
|
@ -111,6 +130,16 @@ void PaintingBrush::applyToTerrain(TerrainDefinition* terrain, double x, double
|
|||
terrainBrushAddNoise(terrain->height_map, &brush, _noise, brush_strength * 0.5);
|
||||
}
|
||||
break;
|
||||
case PAINTING_BRUSH_FLATTEN:
|
||||
if (reverse)
|
||||
{
|
||||
_height = terrainGetInterpolatedHeight(terrain, x, z, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
terrainBrushFlatten(terrain->height_map, &brush, _height, brush_strength);
|
||||
}
|
||||
break;
|
||||
case PAINTING_BRUSH_RESTORE:
|
||||
terrainBrushReset(terrain->height_map, &brush, brush_strength);
|
||||
break;
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
double getInfluence(double relative_x, double relative_z);
|
||||
|
||||
void drawPreview(QWidget* widget);
|
||||
QString getHelpText();
|
||||
|
||||
void applyToTerrain(TerrainDefinition* terrain, double x, double z, double duration, bool reverse);
|
||||
|
||||
|
@ -40,6 +41,7 @@ private:
|
|||
double _size;
|
||||
double _smoothing;
|
||||
double _strength;
|
||||
double _height;
|
||||
NoiseGenerator* _noise;
|
||||
};
|
||||
|
||||
|
|
|
@ -462,12 +462,12 @@ void WidgetHeightMap::scrollTopCamera(double dx, double dz)
|
|||
{
|
||||
if (dx != 0.0)
|
||||
{
|
||||
_target_x += dx;
|
||||
_target_x += dx * _zoom * 0.05;
|
||||
}
|
||||
if (dz != 0.0)
|
||||
{
|
||||
|
||||
_target_z += dz;
|
||||
_target_z += dz * _zoom * 0.05;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,13 +16,6 @@ typedef struct
|
|||
int painted;
|
||||
} _VertexInfo;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
HEIGHTMAP_BRUSH_RAISE = 0,
|
||||
HEIGHTMAP_BRUSH_SMOOTH = 1,
|
||||
HEIGHTMAP_BRUSH_RESTORE = 2
|
||||
} HeightMapBrushMode;
|
||||
|
||||
class WidgetHeightMap : public QGLWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -124,3 +124,5 @@ unix:!symbian {
|
|||
}
|
||||
INSTALLS += target
|
||||
}
|
||||
|
||||
FORMS +=
|
||||
|
|
|
@ -81,6 +81,7 @@ void terrainBrushElevation(TerrainHeightMap* heightmap, TerrainBrush* brush, dou
|
|||
void terrainBrushSmooth(TerrainHeightMap* heightmap, TerrainBrush* brush, double value);
|
||||
void terrainBrushAddNoise(TerrainHeightMap* heightmap, TerrainBrush* brush, NoiseGenerator* generator, double value);
|
||||
void terrainBrushReset(TerrainHeightMap* heightmap, TerrainBrush* brush, double value);
|
||||
void terrainBrushFlatten(TerrainHeightMap* heightmap, TerrainBrush* brush, double height, double force);
|
||||
void terrainEndBrushStroke(TerrainHeightMap* heightmap);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -508,6 +508,21 @@ void terrainBrushElevation(TerrainHeightMap* heightmap, TerrainBrush* brush, dou
|
|||
_applyBrush(heightmap, brush, value, NULL, _applyBrushElevation);
|
||||
}
|
||||
|
||||
static double _applyBrushFlatten(TerrainHeightMap* heightmap, TerrainBrush* brush, double x, double z, double basevalue, double influence, double force, void* data)
|
||||
{
|
||||
UNUSED(heightmap);
|
||||
UNUSED(brush);
|
||||
UNUSED(data);
|
||||
|
||||
double ideal = *((double*)data);
|
||||
return basevalue + (ideal - basevalue) * influence * force;
|
||||
}
|
||||
|
||||
void terrainBrushFlatten(TerrainHeightMap* heightmap, TerrainBrush* brush, double height, double force)
|
||||
{
|
||||
_applyBrush(heightmap, brush, force, &height, _applyBrushFlatten);
|
||||
}
|
||||
|
||||
static double _applyBrushSmooth(TerrainHeightMap* heightmap, TerrainBrush* brush, double x, double z, double basevalue, double influence, double force, void* data)
|
||||
{
|
||||
UNUSED(data);
|
||||
|
|
Loading…
Reference in a new issue