Added terrain base noise preview + main window refactoring
This commit is contained in:
parent
06764427a6
commit
d60a169751
12 changed files with 732 additions and 57 deletions
|
@ -6,6 +6,9 @@
|
|||
<file>images/explore.png</file>
|
||||
<file>images/render.png</file>
|
||||
<file>images/about.png</file>
|
||||
<file>images/load.png</file>
|
||||
<file>images/new.png</file>
|
||||
<file>images/save.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/tabs">
|
||||
<file>images/tab_atmosphere.png</file>
|
||||
|
@ -15,4 +18,10 @@
|
|||
<file>images/tab_textures.png</file>
|
||||
<file>images/tab_water.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/logo">
|
||||
<file>images/logo_16.png</file>
|
||||
<file>images/logo_32.png</file>
|
||||
<file>images/logo_64.png</file>
|
||||
<file>images/logo_256.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMenuBar>
|
||||
#include <QMenu>
|
||||
#include <QIcon>
|
||||
#include <QToolBar>
|
||||
#include <QFileDialog>
|
||||
#include <QTabWidget>
|
||||
#include <QTranslator>
|
||||
|
@ -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;
|
|
@ -1,16 +1,25 @@
|
|||
#ifndef _PAYSAGES_QT_MAINWINDOW_H_
|
||||
#define _PAYSAGES_QT_MAINWINDOW_H_
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include "formrender.h"
|
||||
#include <QVector>
|
||||
#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
|
557
src/editing/common/mainwindow.ui
Normal file
557
src/editing/common/mainwindow.ui
Normal file
|
@ -0,0 +1,557 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>946</width>
|
||||
<height>651</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Paysages 3D</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/logo/images/logo_32.png</normaloff>:/logo/images/logo_32.png</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="tool_panel" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><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></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<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>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_3">
|
||||
<property name="text">
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_2">
|
||||
<property name="text">
|
||||
<string>3D</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton">
|
||||
<property name="text">
|
||||
<string>Top</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>150</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>widget</zorder>
|
||||
<zorder>widget</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<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_2">
|
||||
<property name="title">
|
||||
<string>Actions</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="button_explore">
|
||||
<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>
|
||||
<property name="shortcut">
|
||||
<string>F2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="button_render">
|
||||
<property name="text">
|
||||
<string>Render</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>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<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">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QPushButton" name="button_file_new">
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/buttons/logo/images/new.png</normaloff>:/buttons/logo/images/new.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="button_file_save">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/buttons/logo/images/save.png</normaloff>:/buttons/logo/images/save.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="button_file_load">
|
||||
<property name="text">
|
||||
<string>Load</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/buttons/logo/images/load.png</normaloff>:/buttons/logo/images/load.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>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabs">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<widget class="MainTerrainForm" name="tab_terrain">
|
||||
<attribute name="icon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/tabs/images/tab_terrain.png</normaloff>:/tabs/images/tab_terrain.png</iconset>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string>Lanscape shape</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
</property>
|
||||
<property name="movable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::LeftToolBarArea</set>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
<property name="floatable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>LeftToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="action_file_new"/>
|
||||
<addaction name="action_file_save"/>
|
||||
<addaction name="action_file_load"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="action_explore"/>
|
||||
<addaction name="action_final_render"/>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>946</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="action_file_new"/>
|
||||
<addaction name="action_file_save"/>
|
||||
<addaction name="action_file_load"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuActions">
|
||||
<property name="title">
|
||||
<string>Actions</string>
|
||||
</property>
|
||||
<addaction name="action_explore"/>
|
||||
<addaction name="action_quick_render"/>
|
||||
<addaction name="action_final_render"/>
|
||||
<addaction name="action_last_render"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
<addaction name="action_about"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuActions"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
<action name="action_explore">
|
||||
<property name="icon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/buttons/logo/images/explore.png</normaloff>:/buttons/logo/images/explore.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Explore in 3D</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Start exploring your scenery in real-time 3D</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>F2</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_file_new">
|
||||
<property name="icon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/buttons/logo/images/new.png</normaloff>:/buttons/logo/images/new.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New scene</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Create a virgin scene</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+N</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_file_load">
|
||||
<property name="icon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/buttons/logo/images/load.png</normaloff>:/buttons/logo/images/load.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load scene</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Load a scenery from a file</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+O</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_file_save">
|
||||
<property name="icon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/buttons/logo/images/save.png</normaloff>:/buttons/logo/images/save.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save scene</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Save a scenery to a file</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_quick_render">
|
||||
<property name="icon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/buttons/logo/images/render.png</normaloff>:/buttons/logo/images/render.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Quick render</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Start a quick render</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>F5</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_final_render">
|
||||
<property name="icon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/buttons/logo/images/render.png</normaloff>:/buttons/logo/images/render.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Final render</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Start the final rendering processs</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+F5</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_about">
|
||||
<property name="icon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/buttons/logo/images/about.png</normaloff>:/buttons/logo/images/about.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>About</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Display information on this software</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>F1</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_last_render">
|
||||
<property name="icon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/buttons/logo/images/render.png</normaloff>:/buttons/logo/images/render.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show last render</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Display the last render done</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>F6</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>MainTerrainForm</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>terrain/mainterrainform.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../data/ui_pictures.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>button_explore</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>action_explore</receiver>
|
||||
<slot>trigger()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>127</x>
|
||||
<y>380</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>button_render</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>action_final_render</receiver>
|
||||
<slot>trigger()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>213</x>
|
||||
<y>425</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>213</x>
|
||||
<y>425</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>button_file_new</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>action_file_new</receiver>
|
||||
<slot>trigger()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>213</x>
|
||||
<y>522</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>button_file_load</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>action_file_load</receiver>
|
||||
<slot>trigger()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>213</x>
|
||||
<y>588</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>button_file_save</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>action_file_save</receiver>
|
||||
<slot>trigger()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>213</x>
|
||||
<y>555</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<widget class="WidgetTerrainBaseNoisePreview" name="widget_base_noise_preview" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
|
@ -447,6 +447,12 @@
|
|||
<extends>QSlider</extends>
|
||||
<header>common/widgetsliderdecimal.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>WidgetTerrainBaseNoisePreview</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>terrain/widgetterrainbasenoisepreview.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../data/ui_pictures.qrc"/>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
45
src/editing/terrain/widgetterrainbasenoisepreview.cpp
Normal file
45
src/editing/terrain/widgetterrainbasenoisepreview.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include "widgetterrainbasenoisepreview.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QPaintEvent>
|
||||
#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);
|
||||
}
|
||||
}
|
||||
}
|
26
src/editing/terrain/widgetterrainbasenoisepreview.h
Normal file
26
src/editing/terrain/widgetterrainbasenoisepreview.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
#ifndef _PAYSAGES_EDITING_TERRAIN_WIDGETTERRAINBASENOISEPREVIEW_H_
|
||||
#define _PAYSAGES_EDITING_TERRAIN_WIDGETTERRAINBASENOISEPREVIEW_H_
|
||||
|
||||
#include <QWidget>
|
||||
#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
|
Loading…
Reference in a new issue