paysages: Textures form (WIP) + about dialog.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@287 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
c51e9b676a
commit
d71c09e0d2
7 changed files with 107 additions and 29 deletions
2
TODO
2
TODO
|
@ -2,6 +2,6 @@
|
|||
- Add a material editor dialog.
|
||||
- Replace FILE* by a custom type for Save and Load.
|
||||
- Water and terrain LOD moves with the camera, fix it like in the wanderer.
|
||||
- Add a splash screen / about dialog.
|
||||
- Implement a file header/versioning.
|
||||
- Restore render progress.
|
||||
- Find a licence and apply it.
|
||||
|
|
|
@ -13,24 +13,41 @@ class PreviewTexturesCoverage:public BasePreview
|
|||
public:
|
||||
PreviewTexturesCoverage(QWidget* parent):BasePreview(parent)
|
||||
{
|
||||
_terrain = terrainCreateDefinition();
|
||||
|
||||
_renderer = rendererCreate();
|
||||
_renderer.render_quality = 3;
|
||||
_renderer.getTerrainHeight = _getTerrainHeight;
|
||||
_renderer.customData[0] = &_terrain;
|
||||
|
||||
_preview_layer = texturesLayerCreateDefinition();
|
||||
}
|
||||
protected:
|
||||
QColor getColor(double x, double y)
|
||||
{
|
||||
return QColor(0, 0, 0);
|
||||
Vector3 location;
|
||||
double coverage;
|
||||
location.x = x;
|
||||
location.y = terrainGetHeight(&_terrain, x, y);
|
||||
location.z = y;
|
||||
coverage = texturesGetLayerCoverage(&_preview_layer, &_renderer, location, this->scaling);
|
||||
return QColor::fromRgbF(coverage, coverage, coverage, 1.0);
|
||||
}
|
||||
void updateData()
|
||||
{
|
||||
sceneryGetTerrain(&_terrain);
|
||||
texturesLayerCopyDefinition(&_layer, &_preview_layer);
|
||||
}
|
||||
|
||||
private:
|
||||
static double _getTerrainHeight(Renderer* renderer, double x, double z)
|
||||
{
|
||||
return terrainGetHeight((TerrainDefinition*)(renderer->customData[0]), x, z);
|
||||
}
|
||||
|
||||
Renderer _renderer;
|
||||
TextureLayerDefinition _preview_layer;
|
||||
TerrainDefinition _terrain;
|
||||
};
|
||||
|
||||
class PreviewTexturesColor:public BasePreview
|
||||
|
@ -92,8 +109,8 @@ FormTextures::FormTextures(QWidget *parent):
|
|||
|
||||
previewCoverage = new PreviewTexturesCoverage(this);
|
||||
previewColor = new PreviewTexturesColor(this);
|
||||
addPreview(previewCoverage, QString("Coverage preview"));
|
||||
addPreview(previewColor, QString("Colored preview"));
|
||||
addPreview(previewCoverage, tr("Coverage preview"));
|
||||
addPreview(previewColor, tr("Lighted sample"));
|
||||
|
||||
addInputNoise(tr("Surface noise"), _layer.bump_noise);
|
||||
addInputDouble(tr("Surface noise height"), &_layer.bump_height, 0.0, 0.5, 0.001, 0.05);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <QTabWidget>
|
||||
#include <QTranslator>
|
||||
#include <QLocale>
|
||||
#include <qt4/QtGui/qmessagebox.h>
|
||||
|
||||
#include "formatmosphere.h"
|
||||
#include "formclouds.h"
|
||||
|
@ -113,6 +114,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
menu->addAction(tr("&Explore in 3D"), this, SLOT(explore3D()), QKeySequence("F2"));
|
||||
menu->addAction(tr("&Quick render"), this, SLOT(quickPreview()), QKeySequence("F5"));
|
||||
|
||||
menu = menuBar()->addMenu(tr("&Help"));
|
||||
menu->addAction(tr("&About"), this, SLOT(showAboutDialog()));
|
||||
|
||||
setCentralWidget(tabs);
|
||||
|
||||
setWindowTitle("Paysages 3D");
|
||||
|
@ -154,6 +158,11 @@ void MainWindow::fileLoad()
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::showAboutDialog()
|
||||
{
|
||||
QMessageBox::about(this, tr("Paysages 3D"), tr("A 3D landscape editing and rendering software.\n\nCredits :\nProgramming - Michael Lemaire"));
|
||||
}
|
||||
|
||||
void MainWindow::quickPreview()
|
||||
{
|
||||
_form_render->startQuickRender();
|
||||
|
|
|
@ -18,6 +18,8 @@ public slots:
|
|||
void fileSave();
|
||||
void fileLoad();
|
||||
|
||||
void showAboutDialog();
|
||||
|
||||
void quickPreview();
|
||||
void explore3D();
|
||||
|
||||
|
|
|
@ -477,32 +477,46 @@ Maintenir Ctrl : Plus rapide</translation>
|
|||
<context>
|
||||
<name>FormTextures</name>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="98"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="112"/>
|
||||
<source>Coverage preview</source>
|
||||
<translation>Aperçu de la couverture</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Colored preview</source>
|
||||
<translation type="obsolete">Rendu en couleur</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="113"/>
|
||||
<source>Lighted sample</source>
|
||||
<translation>Echantillon éclairé</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="115"/>
|
||||
<source>Surface noise</source>
|
||||
<translation>Bruit de surface</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="99"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="116"/>
|
||||
<source>Surface noise height</source>
|
||||
<translation>Hauteur du bruit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="100"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="117"/>
|
||||
<source>Surface noise scaling</source>
|
||||
<translation>Echelle du bruit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="101"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="118"/>
|
||||
<source>Base color</source>
|
||||
<translation>Couleur de base</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="102"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="119"/>
|
||||
<source>Light reflection</source>
|
||||
<translation>Réflexion de lumière</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="103"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="120"/>
|
||||
<source>Light reflection shininess</source>
|
||||
<translation>Concentration de la réflexion de lumière</translation>
|
||||
</message>
|
||||
|
@ -628,32 +642,32 @@ Maintenir Ctrl : Plus rapide</translation>
|
|||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="74"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="75"/>
|
||||
<source>Terrain</source>
|
||||
<translation>Terrain</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="78"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="79"/>
|
||||
<source>Textures</source>
|
||||
<translation>Textures</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="82"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="83"/>
|
||||
<source>Water</source>
|
||||
<translation>Eau</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="90"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="91"/>
|
||||
<source>Atmosphere</source>
|
||||
<translation>Atmosphère</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="86"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="87"/>
|
||||
<source>Sky</source>
|
||||
<translation>Ciel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="94"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="95"/>
|
||||
<source>Clouds</source>
|
||||
<translation>Nuages</translation>
|
||||
</message>
|
||||
|
@ -662,69 +676,95 @@ Maintenir Ctrl : Plus rapide</translation>
|
|||
<translation type="obsolete">Eclairage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="102"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="103"/>
|
||||
<source>Render</source>
|
||||
<translation>Rendu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="104"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="105"/>
|
||||
<source>&Scene</source>
|
||||
<translation>&Scène</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="105"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="106"/>
|
||||
<source>&New</source>
|
||||
<translation>&Nouvelle</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="105"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="106"/>
|
||||
<source>Crtl+N</source>
|
||||
<translation>Ctrl+N</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="107"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="108"/>
|
||||
<source>&Save</source>
|
||||
<translation>&Sauvegarder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="107"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="108"/>
|
||||
<source>Crtl+S</source>
|
||||
<translation>Ctrl+S</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="108"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="109"/>
|
||||
<source>&Open</source>
|
||||
<translation>&Ouvrir</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="108"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="109"/>
|
||||
<source>Crtl+O</source>
|
||||
<translation>Ctrl+O</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="110"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="111"/>
|
||||
<source>&Quit</source>
|
||||
<translation>&Quitter</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="110"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="111"/>
|
||||
<source>Crtl+Q</source>
|
||||
<translation>Ctrl+Q</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="112"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="113"/>
|
||||
<source>&Actions</source>
|
||||
<translation>&Actions</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="113"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="114"/>
|
||||
<source>&Explore in 3D</source>
|
||||
<translation>&Explorer en 3D</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="114"/>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="115"/>
|
||||
<source>&Quick render</source>
|
||||
<translation>Rendu r&apide</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="117"/>
|
||||
<source>&Help</source>
|
||||
<translation>Ai&de</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="118"/>
|
||||
<source>&About</source>
|
||||
<translation>&A propos</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="163"/>
|
||||
<source>Paysages 3D</source>
|
||||
<translation>Paysages 3D</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/mainwindow.cpp" line="163"/>
|
||||
<source>A 3D landscape editing and rendering software.
|
||||
|
||||
Credits :
|
||||
Programming - Michael Lemaire</source>
|
||||
<translation type="unfinished">Un logiciel d'édition et rendu de décors naturels en 3D
|
||||
|
||||
Crédits :
|
||||
Développement - Michaël LEMAIRE</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
|
@ -222,6 +222,15 @@ static inline Vector3 _getNormal(TextureLayerDefinition* definition, Renderer* r
|
|||
return v3Normalize(normal);
|
||||
}
|
||||
|
||||
double texturesGetLayerCoverage(TextureLayerDefinition* definition, Renderer* renderer, Vector3 location, double detail)
|
||||
{
|
||||
Vector3 normal;
|
||||
|
||||
normal = _getNormal(definition, renderer, location, detail * 0.1);
|
||||
|
||||
return zoneGetValue(definition->zone, location, normal);
|
||||
}
|
||||
|
||||
Color texturesGetLayerColor(TextureLayerDefinition* definition, Renderer* renderer, Vector3 location, double detail)
|
||||
{
|
||||
Color result;
|
||||
|
|
|
@ -47,6 +47,7 @@ TextureLayerDefinition* texturesGetLayer(TexturesDefinition* definition, int lay
|
|||
int texturesAddLayer(TexturesDefinition* definition);
|
||||
void texturesDeleteLayer(TexturesDefinition* definition, int layer);
|
||||
|
||||
double texturesGetLayerCoverage(TextureLayerDefinition* definition, Renderer* renderer, Vector3 location, double detail);
|
||||
Color texturesGetLayerColor(TextureLayerDefinition* definition, Renderer* renderer, Vector3 location, double detail);
|
||||
Color texturesGetColor(TexturesDefinition* definition, Renderer* renderer, Vector3 location, double detail);
|
||||
|
||||
|
|
Loading…
Reference in a new issue