paysages: Small changes.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@240 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-01-26 23:08:09 +00:00 committed by ThunderK
parent 9a198c2519
commit 08ca1e5d59
13 changed files with 363 additions and 4 deletions

16
gui_qt/dialogwanderer.cpp Normal file
View file

@ -0,0 +1,16 @@
#include "dialogwanderer.h"
#include <QGLWidget>
#include <QVBoxLayout>
DialogWanderer::DialogWanderer(QWidget *parent):
QDialog(parent)
{
setModal(true);
setWindowTitle("Paysages 3D - Explore");
setLayout(new QVBoxLayout());
}
DialogWanderer::~DialogWanderer()
{
}

14
gui_qt/dialogwanderer.h Normal file
View file

@ -0,0 +1,14 @@
#ifndef _PAYSAGES_QT_DIALOGWANDERER_H_
#define _PAYSAGES_QT_DIALOGWANDERER_H_
#include <QDialog>
class DialogWanderer : public QDialog
{
Q_OBJECT
public:
explicit DialogWanderer(QWidget *parent);
~DialogWanderer();
};
#endif

44
gui_qt/formatmosphere.cpp Normal file
View file

@ -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();
}

26
gui_qt/formatmosphere.h Normal file
View file

@ -0,0 +1,26 @@
#ifndef _PAYSAGES_QT_FORMATMOSPHERE_H_
#define _PAYSAGES_QT_FORMATMOSPHERE_H_
#include <QWidget>
#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

44
gui_qt/formclouds.cpp Normal file
View file

@ -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();
}

27
gui_qt/formclouds.h Normal file
View file

@ -0,0 +1,27 @@
#ifndef _PAYSAGES_QT_FORMCLOUDS_H_
#define _PAYSAGES_QT_FORMCLOUDS_H_
#include <QWidget>
#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

44
gui_qt/formlighting.cpp Normal file
View file

@ -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();
}

26
gui_qt/formlighting.h Normal file
View file

@ -0,0 +1,26 @@
#ifndef _PAYSAGES_QT_FORMLIGHTING_H_
#define _PAYSAGES_QT_FORMLIGHTING_H_
#include <QWidget>
#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

44
gui_qt/formtextures.cpp Normal file
View file

@ -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();
}

27
gui_qt/formtextures.h Normal file
View file

@ -0,0 +1,27 @@
#ifndef _PAYSAGES_QT_FORMTEXTURES_H_
#define _PAYSAGES_QT_FORMTEXTURES_H_
#include <QWidget>
#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

View file

@ -6,11 +6,17 @@
#include <QFileDialog> #include <QFileDialog>
#include <QTabWidget> #include <QTabWidget>
#include "formterrain.h" #include "formatmosphere.h"
#include "formwater.h" #include "formclouds.h"
#include "formlighting.h"
#include "formsky.h" #include "formsky.h"
#include "formterrain.h"
#include "formtextures.h"
#include "formwater.h"
#include "formrender.h" #include "formrender.h"
#include "dialogrender.h" #include "dialogrender.h"
#include "dialogwanderer.h"
#include "../lib_paysages/auto.h" #include "../lib_paysages/auto.h"
#include "../lib_paysages/shared/functions.h" #include "../lib_paysages/shared/functions.h"
@ -40,16 +46,33 @@ MainWindow::MainWindow(QWidget *parent) :
tabs->addTab(form, "Terrain"); tabs->addTab(form, "Terrain");
QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll())); 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); form = new FormWater(tabs);
tabs->addTab(form, "Water"); tabs->addTab(form, "Water");
QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll())); 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); form = new FormSky(tabs);
tabs->addTab(form, "Sky"); tabs->addTab(form, "Sky");
QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll())); 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); form = new FormRender(tabs);
tabs->addTab(form, "Render"); tabs->addTab(form, "Render");
//QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll()));
menu = menuBar()->addMenu("Scene"); menu = menuBar()->addMenu("Scene");
menu->addAction("New", this, SLOT(fileNew())); menu->addAction("New", this, SLOT(fileNew()));
@ -57,8 +80,9 @@ MainWindow::MainWindow(QWidget *parent) :
menu->addAction("Load", this, SLOT(fileLoad())); menu->addAction("Load", this, SLOT(fileLoad()));
menu->addAction("Quit", this, SLOT(close())); menu->addAction("Quit", this, SLOT(close()));
menu = menuBar()->addMenu("Render"); menu = menuBar()->addMenu("Actions");
menu->addAction("Quick render", this, SLOT(quickPreview()), QKeySequence("F2")); menu->addAction("Explore in 3D", this, SLOT(explore3D()), QKeySequence("F2"));
menu->addAction("Quick render", this, SLOT(quickPreview()), QKeySequence("F5"));
setCentralWidget(tabs); setCentralWidget(tabs);
@ -106,3 +130,11 @@ void MainWindow::quickPreview()
delete dialog; delete dialog;
} }
void MainWindow::explore3D()
{
DialogWanderer* dialog = new DialogWanderer(this);
dialog->exec();
delete dialog;
}

View file

@ -16,10 +16,13 @@ public:
public slots: public slots:
void refreshAll(); void refreshAll();
void fileNew(); void fileNew();
void fileSave(); void fileSave();
void fileLoad(); void fileLoad();
void quickPreview(); void quickPreview();
void explore3D();
}; };
#endif // _PAYSAGES_QT_MAINWINDOW_H_ #endif // _PAYSAGES_QT_MAINWINDOW_H_

View file

@ -3,6 +3,8 @@
###################################################################### ######################################################################
TEMPLATE = app TEMPLATE = app
CONFIG += qt
QT += opengl
TARGET = TARGET =
DEPENDPATH += . DEPENDPATH += .
INCLUDEPATH += . INCLUDEPATH += .
@ -18,9 +20,14 @@ HEADERS += ../lib_paysages/shared/functions.h ../lib_paysages/shared/types.h \
baseinput.h \ baseinput.h \
dialognoise.h \ dialognoise.h \
dialogrender.h \ dialogrender.h \
dialogwanderer.h \
formatmosphere.h \
formclouds.h \
formlighting.h \
formrender.h \ formrender.h \
formsky.h \ formsky.h \
formterrain.h \ formterrain.h \
formtextures.h \
formwater.h \ formwater.h \
inputcolor.h \ inputcolor.h \
inputcolorgradation.h \ inputcolorgradation.h \
@ -36,9 +43,14 @@ SOURCES += \
baseinput.cpp \ baseinput.cpp \
dialognoise.cpp \ dialognoise.cpp \
dialogrender.cpp \ dialogrender.cpp \
dialogwanderer.cpp \
formatmosphere.cpp \
formclouds.cpp \
formlighting.cpp \
formrender.cpp \ formrender.cpp \
formsky.cpp \ formsky.cpp \
formterrain.cpp \ formterrain.cpp \
formtextures.cpp \
formwater.cpp \ formwater.cpp \
inputcolor.cpp \ inputcolor.cpp \
inputcolorgradation.cpp \ inputcolorgradation.cpp \