paysages: Added file 'app' and 'version' headers.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@309 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
fcce20217e
commit
79e687bd09
7 changed files with 177 additions and 46 deletions
9
TODO
9
TODO
|
@ -1,7 +1,8 @@
|
|||
Technology Preview 2 :
|
||||
- Render tab previews should not rerender when changing render options.
|
||||
- Compute shadows only once for all textures at a same location.
|
||||
- Add antialiasing option (pay attention to memory usage).
|
||||
- Compute shadows only once for all textures at a same location (need an intermediary light status).
|
||||
- Add layer sorting/naming.
|
||||
- Save GUI config (views, render params).
|
||||
- Add an OSD ability on previews and use it for camera location and user landmarks.
|
||||
- Add a material editor dialog.
|
||||
- Add a zone editor dialog for localized textures.
|
||||
|
@ -9,13 +10,13 @@ Technology Preview 2 :
|
|||
- Add a noise filler (and maybe noise intervals ?).
|
||||
- Improve curve editor.
|
||||
- Water and terrain LOD moves with the camera, fix it like in the wanderer.
|
||||
- Implement a file header/versioning.
|
||||
- More threading in previews and layered previews (with a less detailed layer in the background).
|
||||
|
||||
Technology Preview 3 :
|
||||
- Restore render progress.
|
||||
- Add antialiasing option (pay attention to memory usage).
|
||||
- Add basic vegetation system (not sure).
|
||||
- Improve sky rendering (colors and light halo).
|
||||
- Add rendering steps in small previews (not sure).
|
||||
|
||||
Release Candidate :
|
||||
- Polish all features and UI.
|
||||
|
|
|
@ -154,7 +154,18 @@ void MainWindow::fileSave()
|
|||
{
|
||||
filepath = filepath.append(".p3d");
|
||||
}
|
||||
paysagesSave((char*)filepath.toStdString().c_str());
|
||||
|
||||
FileOperationResult result = paysagesSave((char*) filepath.toStdString().c_str());
|
||||
switch (result)
|
||||
{
|
||||
case FILE_OPERATION_OK:
|
||||
break;
|
||||
case FILE_OPERATION_IOERROR:
|
||||
QMessageBox::critical(this, tr("Paysages 3D - File saving error"), tr("Can't write specified file : %1").arg(filepath));
|
||||
break;
|
||||
default:
|
||||
QMessageBox::critical(this, tr("Paysages 3D - File saving error"), tr("Unexpected error while saving file : %1").arg(filepath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,15 +176,31 @@ void MainWindow::fileLoad()
|
|||
QString filepath = QFileDialog::getOpenFileName(this, tr("Paysages 3D - Choose a scenery file to load"), QString(), tr("Paysages 3D Scenery (*.p3d)"));
|
||||
if (!filepath.isNull())
|
||||
{
|
||||
paysagesLoad((char*)filepath.toStdString().c_str());
|
||||
FileOperationResult result = paysagesLoad((char*) filepath.toStdString().c_str());
|
||||
switch (result)
|
||||
{
|
||||
case FILE_OPERATION_OK:
|
||||
refreshAll();
|
||||
break;
|
||||
case FILE_OPERATION_IOERROR:
|
||||
QMessageBox::critical(this, tr("Paysages 3D - File loading error"), tr("Can't read specified file : %1").arg(filepath));
|
||||
break;
|
||||
case FILE_OPERATION_APP_MISMATCH:
|
||||
QMessageBox::critical(this, tr("Paysages 3D - File loading error"), tr("This file doesn't look like a Paysages 3D file : %1").arg(filepath));
|
||||
break;
|
||||
case FILE_OPERATION_VERSION_MISMATCH:
|
||||
QMessageBox::critical(this, tr("Paysages 3D - File loading error"), tr("This file was created with an incompatible Paysages 3D version : %1").arg(filepath));
|
||||
break;
|
||||
default:
|
||||
QMessageBox::critical(this, tr("Paysages 3D - File loading error"), tr("Unexpected error while loading file : %1").arg(filepath));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::showAboutDialog()
|
||||
{
|
||||
QMessageBox::about(this, tr("Paysages 3D"), tr("A 3D landscape editing and rendering software.\n\nCredits :\nProgramming - Michael Lemaire"));
|
||||
QMessageBox::about(this, tr("Paysages 3D"), tr("A 3D landscape editing and rendering software.\n\nAuthors :\nProgramming - Michael Lemaire\n\nQt - http://qt.nokia.com/\nDevIL - http://openil.sourceforge.net/\nGLib - http://www.gtk.org/\n"));
|
||||
}
|
||||
|
||||
void MainWindow::quickPreview()
|
||||
|
|
|
@ -772,25 +772,82 @@ rapide (F5)</translation>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="150"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="165"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="176"/>
|
||||
<source>Paysages 3D Scenery (*.p3d)</source>
|
||||
<translation>Scène Paysages 3D (*.p3d)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="163"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="164"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="167"/>
|
||||
<source>Paysages 3D - File saving error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="164"/>
|
||||
<source>Can't write specified file : %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="167"/>
|
||||
<source>Unexpected error while saving file : %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="174"/>
|
||||
<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 nons sauvegardées seront perdues.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="163"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="174"/>
|
||||
<source>Paysages 3D - Load scenery</source>
|
||||
<translation>Paysages 3D - Charger une scène</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="165"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="176"/>
|
||||
<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="186"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="189"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="192"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="195"/>
|
||||
<source>Paysages 3D - File loading error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="186"/>
|
||||
<source>Can't read specified file : %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="189"/>
|
||||
<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="192"/>
|
||||
<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="195"/>
|
||||
<source>Unexpected error while loading file : %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="203"/>
|
||||
<source>A 3D landscape editing and rendering software.
|
||||
|
||||
Authors :
|
||||
Programming - Michael Lemaire
|
||||
|
||||
Qt - http://qt.nokia.com/
|
||||
DevIL - http://openil.sourceforge.net/
|
||||
GLib - http://www.gtk.org/
|
||||
</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="88"/>
|
||||
<source>Sky</source>
|
||||
|
@ -888,17 +945,16 @@ rapide (F5)</translation>
|
|||
<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="176"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="203"/>
|
||||
<source>Paysages 3D</source>
|
||||
<translation>Paysages 3D</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="176"/>
|
||||
<source>A 3D landscape editing and rendering software.
|
||||
|
||||
Credits :
|
||||
Programming - Michael Lemaire</source>
|
||||
<translation>Un logiciel d'édition et rendu de décors naturels en 3D
|
||||
<translation type="obsolete">Un logiciel d'édition et rendu de décors naturels en 3D
|
||||
|
||||
Crédits :
|
||||
Développement - Michaël LEMAIRE</translation>
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
#include "camera.h"
|
||||
#include "scenery.h"
|
||||
#include "render.h"
|
||||
#include "main.h"
|
||||
|
||||
#define APP_HEADER 1986325632.125
|
||||
|
||||
void paysagesInit()
|
||||
{
|
||||
|
@ -55,12 +58,55 @@ void paysagesQuit()
|
|||
renderQuit();
|
||||
}
|
||||
|
||||
void paysagesSave(char* filepath)
|
||||
FileOperationResult paysagesSave(char* filepath)
|
||||
{
|
||||
scenerySaveToFile(filepath);
|
||||
PackStream* stream = packWriteFile(filepath);
|
||||
double app_header, version_header;
|
||||
|
||||
if (!stream)
|
||||
{
|
||||
return FILE_OPERATION_IOERROR;
|
||||
}
|
||||
|
||||
void paysagesLoad(char* filepath)
|
||||
{
|
||||
sceneryLoadFromFile(filepath);
|
||||
app_header = (double)APP_HEADER;
|
||||
packWriteDouble(stream, &app_header);
|
||||
version_header = (double)PAYSAGES_CURRENT_DATA_VERSION;
|
||||
packWriteDouble(stream, &version_header);
|
||||
|
||||
scenerySave(stream);
|
||||
|
||||
packCloseStream(stream);
|
||||
|
||||
return FILE_OPERATION_OK;
|
||||
}
|
||||
|
||||
FileOperationResult paysagesLoad(char* filepath)
|
||||
{
|
||||
PackStream* stream = packReadFile(filepath);
|
||||
double app_header, version_header;
|
||||
|
||||
if (!stream)
|
||||
{
|
||||
return FILE_OPERATION_IOERROR;
|
||||
}
|
||||
|
||||
packReadDouble(stream, &app_header);
|
||||
if (app_header != APP_HEADER)
|
||||
{
|
||||
packCloseStream(stream);
|
||||
return FILE_OPERATION_APP_MISMATCH;
|
||||
}
|
||||
|
||||
packReadDouble(stream, &version_header);
|
||||
if ((int)version_header != PAYSAGES_CURRENT_DATA_VERSION)
|
||||
{
|
||||
packCloseStream(stream);
|
||||
return FILE_OPERATION_VERSION_MISMATCH;
|
||||
}
|
||||
|
||||
sceneryLoad(stream);
|
||||
|
||||
packCloseStream(stream);
|
||||
|
||||
return FILE_OPERATION_OK;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,23 @@
|
|||
#ifndef _PAYSAGES_MAIN_H_
|
||||
#define _PAYSAGES_MAIN_H_
|
||||
|
||||
#define PAYSAGES_CURRENT_DATA_VERSION 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
FILE_OPERATION_OK,
|
||||
FILE_OPERATION_IOERROR,
|
||||
FILE_OPERATION_APP_MISMATCH,
|
||||
FILE_OPERATION_VERSION_MISMATCH
|
||||
} FileOperationResult;
|
||||
|
||||
void paysagesInit();
|
||||
void paysagesQuit();
|
||||
void paysagesSave(char* filepath);
|
||||
void paysagesLoad(char* filepath);
|
||||
FileOperationResult paysagesSave(char* filepath);
|
||||
FileOperationResult paysagesLoad(char* filepath);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -65,10 +65,8 @@ void sceneryQuit()
|
|||
noiseQuit();
|
||||
}
|
||||
|
||||
void scenerySaveToFile(char* filepath)
|
||||
void scenerySave(PackStream* stream)
|
||||
{
|
||||
PackStream* stream = packWriteFile(filepath);
|
||||
|
||||
noiseSave(stream);
|
||||
atmosphereSave(stream, &_atmosphere);
|
||||
cameraSave(stream, &_camera);
|
||||
|
@ -79,14 +77,10 @@ void scenerySaveToFile(char* filepath)
|
|||
texturesSave(stream, &_textures);
|
||||
vegetationSave(stream, _vegetation);
|
||||
waterSave(stream, &_water);
|
||||
|
||||
packCloseStream(stream);
|
||||
}
|
||||
|
||||
void sceneryLoadFromFile(char* filepath)
|
||||
void sceneryLoad(PackStream* stream)
|
||||
{
|
||||
PackStream* stream = packReadFile(filepath);
|
||||
|
||||
/* TODO Use intermediary definitions ? */
|
||||
|
||||
noiseLoad(stream);
|
||||
|
@ -109,8 +103,6 @@ void sceneryLoadFromFile(char* filepath)
|
|||
texturesValidateDefinition(&_textures);
|
||||
vegetationValidateDefinition(_vegetation);
|
||||
waterValidateDefinition(&_water);
|
||||
|
||||
packCloseStream(stream);
|
||||
}
|
||||
|
||||
void scenerySetAtmosphere(AtmosphereDefinition* atmosphere)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "textures.h"
|
||||
#include "vegetation.h"
|
||||
#include "water.h"
|
||||
|
||||
#include "pack.h"
|
||||
#include "renderer.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -27,8 +27,8 @@ extern "C" {
|
|||
void sceneryInit();
|
||||
void sceneryQuit();
|
||||
|
||||
void scenerySaveToFile(char* filepath);
|
||||
void sceneryLoadFromFile(char* filepath);
|
||||
void scenerySave(PackStream* stream);
|
||||
void sceneryLoad(PackStream* stream);
|
||||
|
||||
void scenerySetAtmosphere(AtmosphereDefinition* atmosphere);
|
||||
void sceneryGetAtmosphere(AtmosphereDefinition* atmosphere);
|
||||
|
|
Loading…
Reference in a new issue