diff --git a/ChangeLog b/ChangeLog index f9f1d64..1c4f8e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ Scenery : * Added sun halo control. * New cloud model with 2 noises : one for the global shape and one for edges. * Terrain shadows have been improved and are now configurable. + * New sky model (based on Preetham's work). Rendering : * New texture model (perpendicular displacement and thickness). diff --git a/TODO b/TODO index cd31cc5..8fd5f5c 100644 --- a/TODO +++ b/TODO @@ -7,7 +7,6 @@ Technology Preview 2 : - Keep skydome lights in cache for a render. - Disable form fields when no layer is selected. - Add buttons to restore "auto" default values in tabs and dialogs. -- Remove color gradations (replace with automatic boolean and simple colors). - Replace zone ranges with curves (with curve input and curve dialog). - Interface for textures thickness, slope_range and thickness_transparency (and correct slider ranges). - Add "hardness to light" and shadow control ("minimum lighting") to material. @@ -35,16 +34,16 @@ Technology Preview 2 : Technology Preview 3 : - Restore render progress. - Implement High Dynamic Range. +- Implement Sub Surface Scattering for water. - Use bicubic interpolation for antialiasing. -- Improve large render/antialias memory consumption. +- Allow for larger renders/antialias (will need several two-pass chunks). - Add basic vegetation system ? - Texture shadowing and self-shadowing ? -- Improve sky rendering (colors and light halo). - Add a progress indicator on previews. - Multi threaded first pass. - Mark modified tabs and ask for losing modifications (idem for layers). - Fix potential holes in land rendering. -- Progressive final render. +- Progressive final render (increasing resolution, for second pass only). - Propose several backgrounds for water preview (grid, sinus...). - Water and terrain LOD moves with the camera, fix it like in the wanderer. - Improve 3d explorer diff --git a/gui_qt/basepreview.cpp b/gui_qt/basepreview.cpp index d8cff7d..9c621fe 100644 --- a/gui_qt/basepreview.cpp +++ b/gui_qt/basepreview.cpp @@ -297,6 +297,11 @@ BasePreview::~BasePreview() delete lock_drawing; } +void BasePreview::addOsd(QString name) +{ + _osd.append(PreviewOsd::getInstance(name)); +} + void BasePreview::initDrawers() { _drawing_manager = new PreviewDrawingManager(); @@ -442,6 +447,14 @@ void BasePreview::paintEvent(QPaintEvent* event) { QPainter painter(this); painter.drawImage(0, 0, *this->pixbuf); + + QImage osd(pixbuf->size(), pixbuf->format()); + osd.fill(0x00000000); + for (int i = 0; i < _osd.size(); i++) + { + _osd[i]->apply(&osd, xoffset, yoffset, scaling); + } + painter.drawImage(0, 0, osd); } void BasePreview::updateScaling() diff --git a/gui_qt/basepreview.h b/gui_qt/basepreview.h index 356a6b8..d6e70d2 100644 --- a/gui_qt/basepreview.h +++ b/gui_qt/basepreview.h @@ -7,6 +7,7 @@ #include #include #include +#include "previewosd.h" class BasePreview : public QWidget { Q_OBJECT @@ -14,6 +15,8 @@ class BasePreview : public QWidget { public: BasePreview(QWidget* parent); ~BasePreview(); + + void addOsd(QString name); static void initDrawers(); static void stopDrawers(); @@ -52,6 +55,7 @@ private: QMutex* lock_drawing; QImage* pixbuf; + QVector _osd; int _width; int _height; diff --git a/gui_qt/formsky.cpp b/gui_qt/formsky.cpp index 6556767..27dcc24 100644 --- a/gui_qt/formsky.cpp +++ b/gui_qt/formsky.cpp @@ -107,7 +107,7 @@ FormSky::FormSky(QWidget *parent): addPreview(previewEast, QString(tr("East preview"))); addInputEnum(tr("Color model"), (int*)&_definition.model, QStringList(tr("Custom model")) << tr("Rayleigh/Mie scattering") << tr("Preetham/Shirley analytic model")); - addInputDouble(tr("Day time"), &_definition.daytime, 0.0, 1.0, 0.002, 0.1); + addInputDouble(tr("Day time"), &_definition.daytime, 0.14, 0.86, 0.002, 0.1); addInputColor(tr("Sun color"), &_definition.sun_color); addInputDouble(tr("Sun radius"), &_definition.sun_radius, 0.0, 0.4, 0.004, 0.04); addInputDouble(tr("Sun halo radius"), &_definition.sun_halo_size, 0.0, 0.4, 0.004, 0.04); diff --git a/gui_qt/formterrain.cpp b/gui_qt/formterrain.cpp index a31f7ce..57a7a26 100644 --- a/gui_qt/formterrain.cpp +++ b/gui_qt/formterrain.cpp @@ -1,9 +1,9 @@ #include "formterrain.h" -#include "tools.h" +#include #include #include -#include +#include "tools.h" #include "../lib_paysages/terrain.h" #include "../lib_paysages/scenery.h" @@ -19,6 +19,8 @@ public: { _preview_definition = terrainCreateDefinition(); + addOsd(QString("geolocation")); + configScaling(0.5, 200.0, 3.0, 50.0); configScrolling(-1000.0, 1000.0, 0.0, -1000.0, 1000.0, 0.0); } @@ -93,6 +95,8 @@ public: _renderer.customData[0] = &_terrain; _renderer.customData[1] = &_textures; _renderer.customData[2] = &_lighting; + + addOsd(QString("geolocation")); configScaling(0.5, 200.0, 3.0, 50.0); configScrolling(-1000.0, 1000.0, 0.0, -1000.0, 1000.0, 0.0); diff --git a/gui_qt/mainwindow.cpp b/gui_qt/mainwindow.cpp index ed21702..3ef14bf 100644 --- a/gui_qt/mainwindow.cpp +++ b/gui_qt/mainwindow.cpp @@ -143,11 +143,15 @@ bool MainWindow::event(QEvent* event) void MainWindow::refreshAll() { + // Refresh all tabs QList list_forms = this->findChildren("_base_form_"); for (int i = 0; i < list_forms.size(); i++) { list_forms[i]->revertConfig(); } + + // Refresh preview OSD + //PreviewOsd* osd = PreviewOsd::getInstance(QString("geolocation")); } void MainWindow::fileNew() diff --git a/gui_qt/previewosd.cpp b/gui_qt/previewosd.cpp new file mode 100644 index 0000000..86b927f --- /dev/null +++ b/gui_qt/previewosd.cpp @@ -0,0 +1,75 @@ +#include "previewosd.h" + +#include +#include + +static QHash _instances; + +/*************** PreviewOsdItem ***************/ +PreviewOsdItem::PreviewOsdItem(int width, int height) : QImage(width, height, QImage::Format_ARGB32) +{ + _xlocation = 0.0; + _ylocation = 0.0; +} + +void PreviewOsdItem::setLocation(double x, double y) +{ + _xlocation = x; + _ylocation = y; +} + +/*************** PreviewOsd ***************/ +PreviewOsd::PreviewOsd() +{ + newItem(50, 50)->fill(0x88888888); +} + +PreviewOsd::~PreviewOsd() +{ + for (int i = 0; i < _items.size(); i++) + { + delete _items[i]; + } +} + +PreviewOsd* PreviewOsd::getInstance(QString name) +{ + if (_instances.contains(name)) + { + return _instances[name]; + } + else + { + PreviewOsd* instance = new PreviewOsd(); + _instances.insert(name, instance); + return instance; + } +} + +PreviewOsdItem* PreviewOsd::newItem(int width, int height) +{ + PreviewOsdItem* item = new PreviewOsdItem(width, height); + _items.append(item); + return item; +} + +PreviewOsdItem* PreviewOsd::newItem(QImage image) +{ + PreviewOsdItem* item = newItem(image.width(), image.height()); + QPainter painter(item); + painter.drawImage(0, 0, image); + return item; +} + +void PreviewOsd::apply(QImage* mask, double xoffset, double yoffset, double scaling) +{ + QPainter painter(mask); + + for (int i = 0; i < _items.size(); i++) + { + PreviewOsdItem* item = _items[i]; + int x = (int)(mask->width() / 2 - (xoffset - item->xlocation()) / scaling - item->width() / 2); + int y = (int)(mask->height() / 2 - (yoffset - item->ylocation()) / scaling - item->height() / 2); + painter.drawImage(x, y, *item); + } +} diff --git a/gui_qt/previewosd.h b/gui_qt/previewosd.h new file mode 100644 index 0000000..7261f07 --- /dev/null +++ b/gui_qt/previewosd.h @@ -0,0 +1,36 @@ +#ifndef _PAYSAGES_QT_PREVIEWOSD_H_ +#define _PAYSAGES_QT_PREVIEWOSD_H_ + +#include + +class PreviewOsdItem:public QImage +{ +public: + PreviewOsdItem(int width, int height); + + void setLocation(double x, double y); + inline double xlocation() {return _xlocation;}; + inline double ylocation() {return _ylocation;}; + +private: + double _xlocation; + double _ylocation; +}; + +class PreviewOsd +{ +public: + PreviewOsd(); + ~PreviewOsd(); + + static PreviewOsd* getInstance(QString name); + + PreviewOsdItem* newItem(int width, int height); + PreviewOsdItem* newItem(QImage image); + void apply(QImage* mask, double xoffset, double yoffset, double scaling); + +private: + QVector _items; +}; + +#endif diff --git a/i18n/paysages_fr.ts b/i18n/paysages_fr.ts index 4c7b4c8..75b9d33 100644 --- a/i18n/paysages_fr.ts +++ b/i18n/paysages_fr.ts @@ -689,7 +689,7 @@ Maintenir Ctrl : Plus rapide FormTerrain - + Height preview (normalized) Aperçu de la hauteur (normalisée) @@ -698,27 +698,27 @@ Maintenir Ctrl : Plus rapide Aperçu du rendu (sans ombres) - + Lighted preview (no texture) Aperçu éclairé (sans texture) - + Noise Bruit - + Height Hauteur - + Scaling Echelle - + Shadow smoothing @@ -1007,87 +1007,87 @@ rapide (F5) F5 - + Do you want to start a new scenery ? Any unsaved changes will be lost. Voulez-vous commencer un nouveau paysage ? Les modifications non sauvegardées seront perdues. - + Paysages 3D - New scenery Paysages 3D - Nouvelle scène - + Paysages 3D - Choose a file to save the scenery Paysages 3D - Choisissez un fichier pour enregistrer la scène - - + + Paysages 3D Scenery (*.p3d) Scène Paysages 3D (*.p3d) - - + + Paysages 3D - File saving error - + Can't write specified file : %1 - + Unexpected error while saving file : %1 - + Do you want to load a scenery from file ? Any unsaved changes will be lost. Voulez-vous charger une scène ? Les modifications non sauvegardées seront perdues. - + Paysages 3D - Load scenery Paysages 3D - Charger une scène - + Paysages 3D - Choose a scenery file to load Paysages 3D - Choisissez un fichier de scène à charger - - - - + + + + Paysages 3D - File loading error - + Can't read specified file : %1 - + This file doesn't look like a Paysages 3D file : %1 - + This file was created with an incompatible Paysages 3D version : %1 - + Unexpected error while loading file : %1 - + A 3D landscape editing and rendering software. Authors : @@ -1197,7 +1197,7 @@ GLib - http://www.gtk.org/ Voulez-vous charger un paysage ? Les modifications nons sauvegardées seront perdues. - + Paysages 3D Paysages 3D