From 08ca1e5d596a0eb41d4433f0f5e5e4e880920219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Thu, 26 Jan 2012 23:08:09 +0000 Subject: [PATCH] paysages: Small changes. git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@240 b1fd45b6-86a6-48da-8261-f70d1f35bdcc --- gui_qt/dialogwanderer.cpp | 16 ++++++++++++++ gui_qt/dialogwanderer.h | 14 +++++++++++++ gui_qt/formatmosphere.cpp | 44 +++++++++++++++++++++++++++++++++++++++ gui_qt/formatmosphere.h | 26 +++++++++++++++++++++++ gui_qt/formclouds.cpp | 44 +++++++++++++++++++++++++++++++++++++++ gui_qt/formclouds.h | 27 ++++++++++++++++++++++++ gui_qt/formlighting.cpp | 44 +++++++++++++++++++++++++++++++++++++++ gui_qt/formlighting.h | 26 +++++++++++++++++++++++ gui_qt/formtextures.cpp | 44 +++++++++++++++++++++++++++++++++++++++ gui_qt/formtextures.h | 27 ++++++++++++++++++++++++ gui_qt/mainwindow.cpp | 40 +++++++++++++++++++++++++++++++---- gui_qt/mainwindow.h | 3 +++ gui_qt/paysages-qt.pro | 12 +++++++++++ 13 files changed, 363 insertions(+), 4 deletions(-) create mode 100644 gui_qt/dialogwanderer.cpp create mode 100644 gui_qt/dialogwanderer.h create mode 100644 gui_qt/formatmosphere.cpp create mode 100644 gui_qt/formatmosphere.h create mode 100644 gui_qt/formclouds.cpp create mode 100644 gui_qt/formclouds.h create mode 100644 gui_qt/formlighting.cpp create mode 100644 gui_qt/formlighting.h create mode 100644 gui_qt/formtextures.cpp create mode 100644 gui_qt/formtextures.h diff --git a/gui_qt/dialogwanderer.cpp b/gui_qt/dialogwanderer.cpp new file mode 100644 index 0000000..1da133a --- /dev/null +++ b/gui_qt/dialogwanderer.cpp @@ -0,0 +1,16 @@ +#include "dialogwanderer.h" + +#include +#include + +DialogWanderer::DialogWanderer(QWidget *parent): + QDialog(parent) +{ + setModal(true); + setWindowTitle("Paysages 3D - Explore"); + setLayout(new QVBoxLayout()); +} + +DialogWanderer::~DialogWanderer() +{ +} diff --git a/gui_qt/dialogwanderer.h b/gui_qt/dialogwanderer.h new file mode 100644 index 0000000..cb19aa1 --- /dev/null +++ b/gui_qt/dialogwanderer.h @@ -0,0 +1,14 @@ +#ifndef _PAYSAGES_QT_DIALOGWANDERER_H_ +#define _PAYSAGES_QT_DIALOGWANDERER_H_ + +#include + +class DialogWanderer : public QDialog +{ + Q_OBJECT +public: + explicit DialogWanderer(QWidget *parent); + ~DialogWanderer(); +}; + +#endif diff --git a/gui_qt/formatmosphere.cpp b/gui_qt/formatmosphere.cpp new file mode 100644 index 0000000..734f48e --- /dev/null +++ b/gui_qt/formatmosphere.cpp @@ -0,0 +1,44 @@ +#include "formatmosphere.h" + +#include "../lib_paysages/atmosphere.h" +#include "../lib_paysages/scenery.h" + +static AtmosphereDefinition _definition; + +/**************** Previews ****************/ + +/**************** Form ****************/ +FormAtmosphere::FormAtmosphere(QWidget *parent): + BaseForm(parent) +{ + _definition = atmosphereCreateDefinition(); + + /*previewHeight = new PreviewTerrainHeight(this); + previewColor = new PreviewTerrainColor(this); + addPreview(previewHeight, QString("Height preview (normalized)")); + addPreview(previewColor, QString("Textured preview (no shadow)"));*/ + + /*addInputNoise("Noise", _definition.height_noise); + addInputDouble("Height", &_definition.height_factor, 0.0, 20.0, 0.1, 1.0); + addInputDouble("Scaling", &_definition.scaling, 1.0, 20.0, 0.1, 1.0);*/ + + revertConfig(); +} + +void FormAtmosphere::revertConfig() +{ + sceneryGetAtmosphere(&_definition); + BaseForm::revertConfig(); +} + +void FormAtmosphere::applyConfig() +{ + scenerySetAtmosphere(&_definition); + BaseForm::applyConfig(); +} + +void FormAtmosphere::configChangeEvent() +{ + atmosphereValidateDefinition(&_definition); + BaseForm::configChangeEvent(); +} diff --git a/gui_qt/formatmosphere.h b/gui_qt/formatmosphere.h new file mode 100644 index 0000000..20b6b93 --- /dev/null +++ b/gui_qt/formatmosphere.h @@ -0,0 +1,26 @@ +#ifndef _PAYSAGES_QT_FORMATMOSPHERE_H_ +#define _PAYSAGES_QT_FORMATMOSPHERE_H_ + +#include +#include "preview.h" +#include "baseform.h" + +class FormAtmosphere : public BaseForm +{ + Q_OBJECT + +public: + explicit FormAtmosphere(QWidget *parent = 0); + +public slots: + virtual void revertConfig(); + virtual void applyConfig(); + +protected slots: + virtual void configChangeEvent(); + +private: + Preview* previewColor; +}; + +#endif diff --git a/gui_qt/formclouds.cpp b/gui_qt/formclouds.cpp new file mode 100644 index 0000000..b88558c --- /dev/null +++ b/gui_qt/formclouds.cpp @@ -0,0 +1,44 @@ +#include "formclouds.h" + +#include "../lib_paysages/clouds.h" +#include "../lib_paysages/scenery.h" + +static CloudsDefinition _definition; + +/**************** Previews ****************/ + +/**************** Form ****************/ +FormClouds::FormClouds(QWidget *parent): + BaseForm(parent) +{ + _definition = cloudsCreateDefinition(); + + /*previewHeight = new PreviewTerrainHeight(this); + previewColor = new PreviewTerrainColor(this); + addPreview(previewHeight, QString("Height preview (normalized)")); + addPreview(previewColor, QString("Textured preview (no shadow)"));*/ + + /*addInputNoise("Noise", _definition.height_noise); + addInputDouble("Height", &_definition.height_factor, 0.0, 20.0, 0.1, 1.0); + addInputDouble("Scaling", &_definition.scaling, 1.0, 20.0, 0.1, 1.0);*/ + + revertConfig(); +} + +void FormClouds::revertConfig() +{ + sceneryGetClouds(&_definition); + BaseForm::revertConfig(); +} + +void FormClouds::applyConfig() +{ + scenerySetClouds(&_definition); + BaseForm::applyConfig(); +} + +void FormClouds::configChangeEvent() +{ + cloudsValidateDefinition(&_definition); + BaseForm::configChangeEvent(); +} diff --git a/gui_qt/formclouds.h b/gui_qt/formclouds.h new file mode 100644 index 0000000..e4879e4 --- /dev/null +++ b/gui_qt/formclouds.h @@ -0,0 +1,27 @@ +#ifndef _PAYSAGES_QT_FORMCLOUDS_H_ +#define _PAYSAGES_QT_FORMCLOUDS_H_ + +#include +#include "preview.h" +#include "baseform.h" + +class FormClouds : public BaseForm +{ + Q_OBJECT + +public: + explicit FormClouds(QWidget *parent = 0); + +public slots: + virtual void revertConfig(); + virtual void applyConfig(); + +protected slots: + virtual void configChangeEvent(); + +private: + Preview* previewCoverage; + Preview* previewColor; +}; + +#endif diff --git a/gui_qt/formlighting.cpp b/gui_qt/formlighting.cpp new file mode 100644 index 0000000..81c38be --- /dev/null +++ b/gui_qt/formlighting.cpp @@ -0,0 +1,44 @@ +#include "formlighting.h" + +#include "../lib_paysages/lighting.h" +#include "../lib_paysages/scenery.h" + +static LightingDefinition _definition; + +/**************** Previews ****************/ + +/**************** Form ****************/ +FormLighting::FormLighting(QWidget *parent): + BaseForm(parent) +{ + _definition = lightingCreateDefinition(); + + /*previewHeight = new PreviewTerrainHeight(this); + previewColor = new PreviewTerrainColor(this); + addPreview(previewHeight, QString("Height preview (normalized)")); + addPreview(previewColor, QString("Textured preview (no shadow)"));*/ + + /*addInputNoise("Noise", _definition.height_noise); + addInputDouble("Height", &_definition.height_factor, 0.0, 20.0, 0.1, 1.0); + addInputDouble("Scaling", &_definition.scaling, 1.0, 20.0, 0.1, 1.0);*/ + + revertConfig(); +} + +void FormLighting::revertConfig() +{ + sceneryGetLighting(&_definition); + BaseForm::revertConfig(); +} + +void FormLighting::applyConfig() +{ + scenerySetLighting(&_definition); + BaseForm::applyConfig(); +} + +void FormLighting::configChangeEvent() +{ + lightingValidateDefinition(&_definition); + BaseForm::configChangeEvent(); +} diff --git a/gui_qt/formlighting.h b/gui_qt/formlighting.h new file mode 100644 index 0000000..acfd37e --- /dev/null +++ b/gui_qt/formlighting.h @@ -0,0 +1,26 @@ +#ifndef _PAYSAGES_QT_FORMLIGHTING_H_ +#define _PAYSAGES_QT_FORMLIGHTING_H_ + +#include +#include "preview.h" +#include "baseform.h" + +class FormLighting : public BaseForm +{ + Q_OBJECT + +public: + explicit FormLighting(QWidget *parent = 0); + +public slots: + virtual void revertConfig(); + virtual void applyConfig(); + +protected slots: + virtual void configChangeEvent(); + +private: + Preview* previewColor; +}; + +#endif diff --git a/gui_qt/formtextures.cpp b/gui_qt/formtextures.cpp new file mode 100644 index 0000000..57fa988 --- /dev/null +++ b/gui_qt/formtextures.cpp @@ -0,0 +1,44 @@ +#include "formtextures.h" + +#include "../lib_paysages/textures.h" +#include "../lib_paysages/scenery.h" + +static TexturesDefinition _definition; + +/**************** Previews ****************/ + +/**************** Form ****************/ +FormTextures::FormTextures(QWidget *parent): + BaseForm(parent) +{ + _definition = texturesCreateDefinition(); + + /*previewHeight = new PreviewTerrainHeight(this); + previewColor = new PreviewTerrainColor(this); + addPreview(previewHeight, QString("Height preview (normalized)")); + addPreview(previewColor, QString("Textured preview (no shadow)"));*/ + + /*addInputNoise("Noise", _definition.height_noise); + addInputDouble("Height", &_definition.height_factor, 0.0, 20.0, 0.1, 1.0); + addInputDouble("Scaling", &_definition.scaling, 1.0, 20.0, 0.1, 1.0);*/ + + revertConfig(); +} + +void FormTextures::revertConfig() +{ + sceneryGetTextures(&_definition); + BaseForm::revertConfig(); +} + +void FormTextures::applyConfig() +{ + scenerySetTextures(&_definition); + BaseForm::applyConfig(); +} + +void FormTextures::configChangeEvent() +{ + texturesValidateDefinition(&_definition); + BaseForm::configChangeEvent(); +} diff --git a/gui_qt/formtextures.h b/gui_qt/formtextures.h new file mode 100644 index 0000000..56276aa --- /dev/null +++ b/gui_qt/formtextures.h @@ -0,0 +1,27 @@ +#ifndef _PAYSAGES_QT_FORMTEXTURES_H_ +#define _PAYSAGES_QT_FORMTEXTURES_H_ + +#include +#include "preview.h" +#include "baseform.h" + +class FormTextures : public BaseForm +{ + Q_OBJECT + +public: + explicit FormTextures(QWidget *parent = 0); + +public slots: + virtual void revertConfig(); + virtual void applyConfig(); + +protected slots: + virtual void configChangeEvent(); + +private: + Preview* previewCoverage; + Preview* previewColor; +}; + +#endif diff --git a/gui_qt/mainwindow.cpp b/gui_qt/mainwindow.cpp index 0f57037..321baad 100644 --- a/gui_qt/mainwindow.cpp +++ b/gui_qt/mainwindow.cpp @@ -6,11 +6,17 @@ #include #include -#include "formterrain.h" -#include "formwater.h" +#include "formatmosphere.h" +#include "formclouds.h" +#include "formlighting.h" #include "formsky.h" +#include "formterrain.h" +#include "formtextures.h" +#include "formwater.h" #include "formrender.h" + #include "dialogrender.h" +#include "dialogwanderer.h" #include "../lib_paysages/auto.h" #include "../lib_paysages/shared/functions.h" @@ -40,16 +46,33 @@ MainWindow::MainWindow(QWidget *parent) : tabs->addTab(form, "Terrain"); QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll())); + form = new FormTextures(tabs); + tabs->addTab(form, "Textures"); + QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll())); + form = new FormWater(tabs); tabs->addTab(form, "Water"); QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll())); + form = new FormAtmosphere(tabs); + tabs->addTab(form, "Atmosphere"); + QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll())); + form = new FormSky(tabs); tabs->addTab(form, "Sky"); QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll())); + form = new FormClouds(tabs); + tabs->addTab(form, "Clouds"); + QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll())); + + form = new FormLighting(tabs); + tabs->addTab(form, "Lighting"); + QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll())); + form = new FormRender(tabs); tabs->addTab(form, "Render"); + //QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll())); menu = menuBar()->addMenu("Scene"); menu->addAction("New", this, SLOT(fileNew())); @@ -57,8 +80,9 @@ MainWindow::MainWindow(QWidget *parent) : menu->addAction("Load", this, SLOT(fileLoad())); menu->addAction("Quit", this, SLOT(close())); - menu = menuBar()->addMenu("Render"); - menu->addAction("Quick render", this, SLOT(quickPreview()), QKeySequence("F2")); + menu = menuBar()->addMenu("Actions"); + menu->addAction("Explore in 3D", this, SLOT(explore3D()), QKeySequence("F2")); + menu->addAction("Quick render", this, SLOT(quickPreview()), QKeySequence("F5")); setCentralWidget(tabs); @@ -106,3 +130,11 @@ void MainWindow::quickPreview() delete dialog; } + +void MainWindow::explore3D() +{ + DialogWanderer* dialog = new DialogWanderer(this); + dialog->exec(); + + delete dialog; +} diff --git a/gui_qt/mainwindow.h b/gui_qt/mainwindow.h index 9b14af6..8fe9eef 100644 --- a/gui_qt/mainwindow.h +++ b/gui_qt/mainwindow.h @@ -16,10 +16,13 @@ public: public slots: void refreshAll(); + void fileNew(); void fileSave(); void fileLoad(); + void quickPreview(); + void explore3D(); }; #endif // _PAYSAGES_QT_MAINWINDOW_H_ diff --git a/gui_qt/paysages-qt.pro b/gui_qt/paysages-qt.pro index 459b130..7c00395 100644 --- a/gui_qt/paysages-qt.pro +++ b/gui_qt/paysages-qt.pro @@ -3,6 +3,8 @@ ###################################################################### TEMPLATE = app +CONFIG += qt +QT += opengl TARGET = DEPENDPATH += . INCLUDEPATH += . @@ -18,9 +20,14 @@ HEADERS += ../lib_paysages/shared/functions.h ../lib_paysages/shared/types.h \ baseinput.h \ dialognoise.h \ dialogrender.h \ + dialogwanderer.h \ + formatmosphere.h \ + formclouds.h \ + formlighting.h \ formrender.h \ formsky.h \ formterrain.h \ + formtextures.h \ formwater.h \ inputcolor.h \ inputcolorgradation.h \ @@ -36,9 +43,14 @@ SOURCES += \ baseinput.cpp \ dialognoise.cpp \ dialogrender.cpp \ + dialogwanderer.cpp \ + formatmosphere.cpp \ + formclouds.cpp \ + formlighting.cpp \ formrender.cpp \ formsky.cpp \ formterrain.cpp \ + formtextures.cpp \ formwater.cpp \ inputcolor.cpp \ inputcolorgradation.cpp \