paysages : Added GUI state saving/loading.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@364 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
f5d2396256
commit
834f96d3a6
13 changed files with 197 additions and 56 deletions
|
@ -24,6 +24,7 @@ GUI :
|
|||
* Improved curve rendering.
|
||||
* New material editor.
|
||||
* Added render timer.
|
||||
* Previews locations and render params are now saved.
|
||||
* Added camera location to previews.
|
||||
|
||||
Misc :
|
||||
|
|
1
TODO
1
TODO
|
@ -13,7 +13,6 @@ Technology Preview 2 :
|
|||
- Render tab previews should not rerender when changing render options.
|
||||
- Add layer sorting/naming.
|
||||
- Add logarithmic sliders for some float values.
|
||||
- Save GUI config (views, render params).
|
||||
- Improve previews.
|
||||
=> Add a right click menu for toggles and modes
|
||||
=> Add user markers on OSD
|
||||
|
|
|
@ -104,6 +104,28 @@ void BaseForm::hideButtons()
|
|||
button_revert->hide();
|
||||
}
|
||||
|
||||
void BaseForm::savePack(PackStream* stream)
|
||||
{
|
||||
// Save previews status
|
||||
// TODO Ensure same order in save and load
|
||||
QList<BasePreview*> list_previews = previews->findChildren<BasePreview*>("_form_preview_");
|
||||
for (int i = 0; i < list_previews.size(); i++)
|
||||
{
|
||||
list_previews[i]->savePack(stream);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseForm::loadPack(PackStream* stream)
|
||||
{
|
||||
// Load previews status
|
||||
// TODO Ensure same order in save and load
|
||||
QList<BasePreview*> list_previews = previews->findChildren<BasePreview*>("_form_preview_");
|
||||
for (int i = 0; i < list_previews.size(); i++)
|
||||
{
|
||||
list_previews[i]->loadPack(stream);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseForm::configChangeEvent()
|
||||
{
|
||||
if (auto_apply)
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "../lib_paysages/noise.h"
|
||||
#include "../lib_paysages/curve.h"
|
||||
#include "../lib_paysages/color.h"
|
||||
#include "../lib_paysages/pack.h"
|
||||
|
||||
class BaseForm:public QWidget
|
||||
{
|
||||
|
@ -18,6 +19,8 @@ class BaseForm:public QWidget
|
|||
public:
|
||||
BaseForm(QWidget* parent, bool auto_apply=false, bool with_layers=false);
|
||||
void hideButtons();
|
||||
virtual void savePack(PackStream* stream);
|
||||
virtual void loadPack(PackStream* stream);
|
||||
|
||||
signals:
|
||||
void configApplied();
|
||||
|
|
|
@ -309,6 +309,21 @@ void BasePreview::addOsd(QString name)
|
|||
setMouseTracking(true);
|
||||
}
|
||||
|
||||
void BasePreview::savePack(PackStream* stream)
|
||||
{
|
||||
packWriteDouble(stream, &this->xoffset);
|
||||
packWriteDouble(stream, &this->yoffset);
|
||||
packWriteDouble(stream, &this->scaling);
|
||||
}
|
||||
|
||||
void BasePreview::loadPack(PackStream* stream)
|
||||
{
|
||||
packReadDouble(stream, &this->xoffset);
|
||||
packReadDouble(stream, &this->yoffset);
|
||||
packReadDouble(stream, &this->scaling);
|
||||
emit contentChange();
|
||||
}
|
||||
|
||||
void BasePreview::initDrawers()
|
||||
{
|
||||
_drawing_manager = new PreviewDrawingManager();
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <QList>
|
||||
#include <QLabel>
|
||||
#include "previewosd.h"
|
||||
#include "../lib_paysages/pack.h"
|
||||
|
||||
class BasePreview : public QWidget {
|
||||
Q_OBJECT
|
||||
|
@ -19,6 +20,9 @@ public:
|
|||
|
||||
void addOsd(QString name);
|
||||
|
||||
virtual void savePack(PackStream* stream);
|
||||
virtual void loadPack(PackStream* stream);
|
||||
|
||||
static void initDrawers();
|
||||
static void stopDrawers();
|
||||
static void reviveAll();
|
||||
|
|
|
@ -143,6 +143,28 @@ FormRender::~FormRender()
|
|||
}
|
||||
}
|
||||
|
||||
void FormRender::savePack(PackStream* stream)
|
||||
{
|
||||
BaseForm::savePack(stream);
|
||||
|
||||
packWriteInt(stream, &_params.width);
|
||||
packWriteInt(stream, &_params.height);
|
||||
packWriteInt(stream, &_params.antialias);
|
||||
packWriteInt(stream, &_params.quality);
|
||||
}
|
||||
|
||||
void FormRender::loadPack(PackStream* stream)
|
||||
{
|
||||
BaseForm::loadPack(stream);
|
||||
|
||||
packReadInt(stream, &_params.width);
|
||||
packReadInt(stream, &_params.height);
|
||||
packReadInt(stream, &_params.antialias);
|
||||
packReadInt(stream, &_params.quality);
|
||||
|
||||
revertConfig();
|
||||
}
|
||||
|
||||
void FormRender::revertConfig()
|
||||
{
|
||||
sceneryGetCamera(&_camera);
|
||||
|
|
|
@ -14,6 +14,9 @@ public:
|
|||
explicit FormRender(QWidget *parent = 0);
|
||||
~FormRender();
|
||||
|
||||
virtual void savePack(PackStream* stream);
|
||||
virtual void loadPack(PackStream* stream);
|
||||
|
||||
public slots:
|
||||
virtual void revertConfig();
|
||||
virtual void applyConfig();
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "../lib_paysages/main.h"
|
||||
#include "../lib_paysages/auto.h"
|
||||
#include "../lib_paysages/scenery.h"
|
||||
#include "tools.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -130,6 +131,8 @@ QMainWindow(parent)
|
|||
setWindowTitle("Paysages 3D");
|
||||
setWindowIcon(QIcon("images/logo_32.png"));
|
||||
|
||||
scenerySetCustomDataCallback(MainWindow::guiSaveCallback, MainWindow::guiLoadCallback, this);
|
||||
|
||||
refreshAll();
|
||||
}
|
||||
|
||||
|
@ -145,6 +148,8 @@ bool MainWindow::event(QEvent* event)
|
|||
|
||||
void MainWindow::refreshAll()
|
||||
{
|
||||
logDebug("[MainWindow] Refreshing whole UI");
|
||||
|
||||
// Refresh all tabs
|
||||
QList<BaseForm*> list_forms = this->findChildren<BaseForm*>("_base_form_");
|
||||
for (int i = 0; i < list_forms.size(); i++)
|
||||
|
@ -254,3 +259,35 @@ void MainWindow::explore3D()
|
|||
refreshAll();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::guiSaveCallback(PackStream* stream, void* data)
|
||||
{
|
||||
((MainWindow*)data)->guiSave(stream);
|
||||
}
|
||||
|
||||
void MainWindow::guiLoadCallback(PackStream* stream, void* data)
|
||||
{
|
||||
((MainWindow*)data)->guiLoad(stream);
|
||||
}
|
||||
|
||||
void MainWindow::guiSave(PackStream* stream)
|
||||
{
|
||||
// Save all tabs status
|
||||
// TODO Ensure same order in save and load
|
||||
QList<BaseForm*> list_forms = this->findChildren<BaseForm*>("_base_form_");
|
||||
for (int i = 0; i < list_forms.size(); i++)
|
||||
{
|
||||
list_forms[i]->savePack(stream);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::guiLoad(PackStream* stream)
|
||||
{
|
||||
// Load all tabs status
|
||||
// TODO Ensure same order in save and load
|
||||
QList<BaseForm*> list_forms = this->findChildren<BaseForm*>("_base_form_");
|
||||
for (int i = 0; i < list_forms.size(); i++)
|
||||
{
|
||||
list_forms[i]->loadPack(stream);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <QMainWindow>
|
||||
#include "formrender.h"
|
||||
#include "../lib_paysages/pack.h"
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
|
@ -11,6 +12,9 @@ class MainWindow : public QMainWindow
|
|||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
virtual bool event(QEvent* event);
|
||||
|
||||
static void guiSaveCallback(PackStream* stream, void* data);
|
||||
static void guiLoadCallback(PackStream* stream, void* data);
|
||||
|
||||
public slots:
|
||||
void refreshAll();
|
||||
|
@ -25,6 +29,9 @@ public slots:
|
|||
void explore3D();
|
||||
|
||||
private:
|
||||
void guiSave(PackStream* stream);
|
||||
void guiLoad(PackStream* stream);
|
||||
|
||||
FormRender* _form_render;
|
||||
};
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<translation>Annuler les modifications</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/baseform.cpp" line="304"/>
|
||||
<location filename="../gui_qt/baseform.cpp" line="326"/>
|
||||
<source>Layer %1</source>
|
||||
<translation>Niveau %1</translation>
|
||||
</message>
|
||||
|
@ -565,17 +565,17 @@ Maintenir Ctrl : Plus rapide</translation>
|
|||
<translation>Sauvegarder le dernier rendu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formrender.cpp" line="212"/>
|
||||
<location filename="../gui_qt/formrender.cpp" line="234"/>
|
||||
<source>Paysages 3D - Choose a filename to save the last render</source>
|
||||
<translation>Paysages 3D - Choisissez un nom de fichier pour le rendu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formrender.cpp" line="212"/>
|
||||
<location filename="../gui_qt/formrender.cpp" line="234"/>
|
||||
<source>Images (*.png *.jpg)</source>
|
||||
<translation>Images (*.png *.jpg)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formrender.cpp" line="225"/>
|
||||
<location filename="../gui_qt/formrender.cpp" line="247"/>
|
||||
<source>Can't write to file : %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -588,7 +588,7 @@ Maintenir Ctrl : Plus rapide</translation>
|
|||
<translation type="obsolete">Choisissez un nom de fichier pour le rendu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formrender.cpp" line="221"/>
|
||||
<location filename="../gui_qt/formrender.cpp" line="243"/>
|
||||
<source>The picture %1 has been saved.</source>
|
||||
<translation>L'image %1 a été sauvegardée.</translation>
|
||||
</message>
|
||||
|
@ -955,144 +955,144 @@ Maintenir Ctrl : Plus rapide</translation>
|
|||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="81"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="82"/>
|
||||
<source>Terrain</source>
|
||||
<translation>Terrain</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="85"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="86"/>
|
||||
<source>Textures</source>
|
||||
<translation>Textures</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="89"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="90"/>
|
||||
<source>Water</source>
|
||||
<translation>Eau</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="97"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="98"/>
|
||||
<source>Atmosphere</source>
|
||||
<translation>Atmosphère</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="123"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="124"/>
|
||||
<source>&Load</source>
|
||||
<translation>&Ouvrir</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="123"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="124"/>
|
||||
<source>Crtl+L</source>
|
||||
<translation>Ctrl+O</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="124"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="125"/>
|
||||
<source>&Explore (F2)</source>
|
||||
<translation>&Explorer (F2)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="124"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="125"/>
|
||||
<source>F2</source>
|
||||
<translation>F2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="125"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="126"/>
|
||||
<source>&Quick
|
||||
render (F5)</source>
|
||||
<translation>&Rendu
|
||||
rapide (F5)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="125"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="126"/>
|
||||
<source>F5</source>
|
||||
<translation>F5</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="162"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="167"/>
|
||||
<source>Camera</source>
|
||||
<translation type="unfinished">Caméra</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="168"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="173"/>
|
||||
<source>Do you want to start a new scenery ? Any unsaved changes will be lost.</source>
|
||||
<translation>Voulez-vous commencer un nouveau paysage ? Les modifications non sauvegardées seront perdues.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="168"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="173"/>
|
||||
<source>Paysages 3D - New scenery</source>
|
||||
<translation>Paysages 3D - Nouvelle scène</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="178"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="183"/>
|
||||
<source>Paysages 3D - Choose a file to save the scenery</source>
|
||||
<translation>Paysages 3D - Choisissez un fichier pour enregistrer la scène</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="178"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="204"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="183"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="209"/>
|
||||
<source>Paysages 3D Scenery (*.p3d)</source>
|
||||
<translation>Scène Paysages 3D (*.p3d)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="192"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="195"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="197"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="200"/>
|
||||
<source>Paysages 3D - File saving error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="192"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="197"/>
|
||||
<source>Can't write specified file : %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="195"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="200"/>
|
||||
<source>Unexpected error while saving file : %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="202"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="207"/>
|
||||
<source>Do you want to load a scenery from file ? Any unsaved changes will be lost.</source>
|
||||
<translation>Voulez-vous charger une scène ? Les modifications non sauvegardées seront perdues.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="202"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="207"/>
|
||||
<source>Paysages 3D - Load scenery</source>
|
||||
<translation>Paysages 3D - Charger une scène</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="204"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="209"/>
|
||||
<source>Paysages 3D - Choose a scenery file to load</source>
|
||||
<translation>Paysages 3D - Choisissez un fichier de scène à charger</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="214"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="217"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="220"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="223"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="219"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="222"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="225"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="228"/>
|
||||
<source>Paysages 3D - File loading error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="214"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="219"/>
|
||||
<source>Can't read specified file : %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="217"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="222"/>
|
||||
<source>This file doesn't look like a Paysages 3D file : %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="220"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="225"/>
|
||||
<source>This file was created with an incompatible Paysages 3D version : %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="223"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="228"/>
|
||||
<source>Unexpected error while loading file : %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="231"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="236"/>
|
||||
<source>A 3D landscape editing and rendering software.
|
||||
|
||||
Authors :
|
||||
|
@ -1106,12 +1106,12 @@ GLib - http://www.gtk.org/
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="93"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="94"/>
|
||||
<source>Sky</source>
|
||||
<translation>Ciel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="101"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="102"/>
|
||||
<source>Clouds</source>
|
||||
<translation>Nuages</translation>
|
||||
</message>
|
||||
|
@ -1120,7 +1120,7 @@ GLib - http://www.gtk.org/
|
|||
<translation type="obsolete">Eclairage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="109"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="110"/>
|
||||
<source>Render</source>
|
||||
<translation>Rendu</translation>
|
||||
</message>
|
||||
|
@ -1129,22 +1129,22 @@ GLib - http://www.gtk.org/
|
|||
<translation type="obsolete">&Scène</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="121"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="122"/>
|
||||
<source>&New</source>
|
||||
<translation>&Nouveau</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="121"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="122"/>
|
||||
<source>Crtl+N</source>
|
||||
<translation>Ctrl+N</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="122"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="123"/>
|
||||
<source>&Save</source>
|
||||
<translation>&Sauvegarder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="122"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="123"/>
|
||||
<source>Crtl+S</source>
|
||||
<translation>Ctrl+S</translation>
|
||||
</message>
|
||||
|
@ -1181,7 +1181,7 @@ GLib - http://www.gtk.org/
|
|||
<translation type="obsolete">Ai&de</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="126"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="127"/>
|
||||
<source>&About</source>
|
||||
<translation>&A propos</translation>
|
||||
</message>
|
||||
|
@ -1202,7 +1202,7 @@ GLib - http://www.gtk.org/
|
|||
<translation type="obsolete">Voulez-vous charger un paysage ? Les modifications nons sauvegardées seront perdues.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="231"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="236"/>
|
||||
<source>Paysages 3D</source>
|
||||
<translation>Paysages 3D</translation>
|
||||
</message>
|
||||
|
|
|
@ -7,15 +7,19 @@
|
|||
#include "system.h"
|
||||
#include "vegetation.h"
|
||||
|
||||
AtmosphereDefinition _atmosphere;
|
||||
CameraDefinition _camera;
|
||||
CloudsDefinition _clouds;
|
||||
LightingDefinition _lighting;
|
||||
SkyDefinition _sky;
|
||||
TerrainDefinition _terrain;
|
||||
TexturesDefinition _textures;
|
||||
VegetationDefinition* _vegetation;
|
||||
WaterDefinition _water;
|
||||
static AtmosphereDefinition _atmosphere;
|
||||
static CameraDefinition _camera;
|
||||
static CloudsDefinition _clouds;
|
||||
static LightingDefinition _lighting;
|
||||
static SkyDefinition _sky;
|
||||
static TerrainDefinition _terrain;
|
||||
static TexturesDefinition _textures;
|
||||
static VegetationDefinition* _vegetation;
|
||||
static WaterDefinition _water;
|
||||
|
||||
static SceneryCustomDataCallback _custom_save = NULL;
|
||||
static SceneryCustomDataCallback _custom_load = NULL;
|
||||
static void* _custom_data = NULL;
|
||||
|
||||
void sceneryInit()
|
||||
{
|
||||
|
@ -39,6 +43,9 @@ void sceneryInit()
|
|||
_textures = texturesCreateDefinition();
|
||||
_vegetation = vegetationCreateDefinition();
|
||||
_water = waterCreateDefinition();
|
||||
|
||||
_custom_save = NULL;
|
||||
_custom_load = NULL;
|
||||
}
|
||||
|
||||
void sceneryQuit()
|
||||
|
@ -65,6 +72,13 @@ void sceneryQuit()
|
|||
noiseQuit();
|
||||
}
|
||||
|
||||
void scenerySetCustomDataCallback(SceneryCustomDataCallback callback_save, SceneryCustomDataCallback callback_load, void* data)
|
||||
{
|
||||
_custom_save = callback_save;
|
||||
_custom_load = callback_load;
|
||||
_custom_data = data;
|
||||
}
|
||||
|
||||
void scenerySave(PackStream* stream)
|
||||
{
|
||||
noiseSave(stream);
|
||||
|
@ -77,6 +91,11 @@ void scenerySave(PackStream* stream)
|
|||
texturesSave(stream, &_textures);
|
||||
vegetationSave(stream, _vegetation);
|
||||
waterSave(stream, &_water);
|
||||
|
||||
if (_custom_save)
|
||||
{
|
||||
_custom_save(stream, _custom_data);
|
||||
}
|
||||
}
|
||||
|
||||
void sceneryLoad(PackStream* stream)
|
||||
|
@ -103,6 +122,11 @@ void sceneryLoad(PackStream* stream)
|
|||
texturesValidateDefinition(&_textures);
|
||||
vegetationValidateDefinition(_vegetation);
|
||||
waterValidateDefinition(&_water);
|
||||
|
||||
if (_custom_load)
|
||||
{
|
||||
_custom_load(stream, _custom_data);
|
||||
}
|
||||
}
|
||||
|
||||
void scenerySetAtmosphere(AtmosphereDefinition* atmosphere)
|
||||
|
|
|
@ -24,9 +24,13 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*SceneryCustomDataCallback)(PackStream* stream, void* data);
|
||||
|
||||
void sceneryInit();
|
||||
void sceneryQuit();
|
||||
|
||||
void scenerySetCustomDataCallback(SceneryCustomDataCallback callback_save, SceneryCustomDataCallback callback_load, void* data);
|
||||
|
||||
void scenerySave(PackStream* stream);
|
||||
void sceneryLoad(PackStream* stream);
|
||||
|
||||
|
|
Loading…
Reference in a new issue