paysages : Preetham approximation for sky (WIP) - Added InputEnum.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@357 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
4a6d9bb001
commit
323dc8122c
9 changed files with 93 additions and 19 deletions
1
TODO
1
TODO
|
@ -1,6 +1,5 @@
|
|||
Technology Preview 2 :
|
||||
- Finalize Preetham's model usage
|
||||
=> Add enumarate to choose model in formsky
|
||||
=> Hide fields based on chosen model
|
||||
=> Update all fields when "auto from daytime" is selected
|
||||
=> Apply the skydome lighting by directly sampling it (no more amplitude in lights)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "inputnoise.h"
|
||||
#include "inputcurve.h"
|
||||
#include "inputmaterial.h"
|
||||
#include "inputenum.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
|
@ -264,6 +265,11 @@ void BaseForm::addInputMaterial(QString label, SurfaceMaterial* material)
|
|||
addInput(new InputMaterial(form, label, material));
|
||||
}
|
||||
|
||||
void BaseForm::addInputEnum(QString label, int* value, const QStringList& values)
|
||||
{
|
||||
addInput(new InputEnum(form, label, value, values));
|
||||
}
|
||||
|
||||
int BaseForm::currentLayer()
|
||||
{
|
||||
if (with_layers)
|
||||
|
|
|
@ -46,6 +46,7 @@ protected:
|
|||
void addInputNoise(QString label, NoiseGenerator* value);
|
||||
void addInputCurve(QString label, Curve* value, double xmin, double xmax, double ymin, double ymax);
|
||||
void addInputMaterial(QString label, SurfaceMaterial* material);
|
||||
void addInputEnum(QString label, int* value, const QStringList& values);
|
||||
|
||||
int currentLayer();
|
||||
void setLayerCount(int layer_count);
|
||||
|
|
|
@ -104,6 +104,7 @@ FormSky::FormSky(QWidget *parent):
|
|||
previewEast = new PreviewSkyEast(this);
|
||||
addPreview(previewEast, QString(tr("East preview")));
|
||||
|
||||
addInputEnum(tr("Color model"), (int*)&_definition.model, QStringList(tr("Custom model")) << tr("Mixed Preetham/Shirley approximation"));
|
||||
addInputDouble(tr("Day time"), &_definition.daytime, 0.0, 1.0, 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);
|
||||
|
|
29
gui_qt/inputenum.cpp
Normal file
29
gui_qt/inputenum.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#include "inputenum.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
|
||||
InputEnum::InputEnum(QWidget* form, QString label, int* value, const QStringList& values) : BaseInput(form, label)
|
||||
{
|
||||
_value = value;
|
||||
|
||||
_preview = new QWidget(form);
|
||||
_control = new QComboBox(form);
|
||||
((QComboBox*)_control)->addItems(values);
|
||||
|
||||
connect(_control, SIGNAL(currentIndexChanged(int)), this, SLOT(applyValue()));
|
||||
}
|
||||
|
||||
void InputEnum::applyValue()
|
||||
{
|
||||
*_value = ((QComboBox*)_control)->currentIndex();
|
||||
|
||||
BaseInput::applyValue();
|
||||
}
|
||||
|
||||
void InputEnum::revert()
|
||||
{
|
||||
((QComboBox*)_control)->setCurrentIndex(*_value);
|
||||
|
||||
BaseInput::revert();
|
||||
}
|
23
gui_qt/inputenum.h
Normal file
23
gui_qt/inputenum.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
#ifndef _PAYSAGES_QT_INPUTENUM_H_
|
||||
#define _PAYSAGES_QT_INPUTENUM_H_
|
||||
|
||||
#include <QWidget>
|
||||
#include <QStringList>
|
||||
#include "baseinput.h"
|
||||
|
||||
class InputEnum:public BaseInput
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
InputEnum(QWidget* form, QString label, int* value, const QStringList& values);
|
||||
|
||||
public slots:
|
||||
virtual void applyValue();
|
||||
virtual void revert();
|
||||
|
||||
private:
|
||||
int* _value;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -44,5 +44,5 @@ void InputInt::revert()
|
|||
{
|
||||
slider->setValue(*value);
|
||||
|
||||
BaseInput::revert();
|
||||
BaseInput::revert();
|
||||
}
|
||||
|
|
|
@ -26,4 +26,4 @@ private:
|
|||
int large_step;
|
||||
};
|
||||
|
||||
#endif // _PAYSAGES_QT_INPUTINT_H_
|
||||
#endif
|
||||
|
|
|
@ -4,32 +4,32 @@
|
|||
<context>
|
||||
<name>BaseForm</name>
|
||||
<message>
|
||||
<location filename="../gui_qt/baseform.cpp" line="39"/>
|
||||
<location filename="../gui_qt/baseform.cpp" line="40"/>
|
||||
<source>Layers : </source>
|
||||
<translation>Niveaux :</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/baseform.cpp" line="47"/>
|
||||
<location filename="../gui_qt/baseform.cpp" line="48"/>
|
||||
<source>Add layer</source>
|
||||
<translation>Ajouter un niveau</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/baseform.cpp" line="51"/>
|
||||
<location filename="../gui_qt/baseform.cpp" line="52"/>
|
||||
<source>Delete layer</source>
|
||||
<translation>Supprimer un niveau</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/baseform.cpp" line="87"/>
|
||||
<location filename="../gui_qt/baseform.cpp" line="88"/>
|
||||
<source>Apply</source>
|
||||
<translation>Appliquer</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/baseform.cpp" line="90"/>
|
||||
<location filename="../gui_qt/baseform.cpp" line="91"/>
|
||||
<source>Revert</source>
|
||||
<translation>Annuler les modifications</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/baseform.cpp" line="290"/>
|
||||
<location filename="../gui_qt/baseform.cpp" line="296"/>
|
||||
<source>Layer %1</source>
|
||||
<translation>Niveau %1</translation>
|
||||
</message>
|
||||
|
@ -603,56 +603,71 @@ Maintenir Ctrl : Plus rapide</translation>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="107"/>
|
||||
<source>Color model</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="107"/>
|
||||
<source>Mixed Preetham/Shirley approximation</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="107"/>
|
||||
<source>Custom model</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="108"/>
|
||||
<source>Day time</source>
|
||||
<translation>Heure du jour</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="108"/>
|
||||
<location filename="../gui_qt/formsky.cpp" line="109"/>
|
||||
<source>Sun color</source>
|
||||
<translation>Couleur du soleil</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="109"/>
|
||||
<location filename="../gui_qt/formsky.cpp" line="110"/>
|
||||
<source>Sun radius</source>
|
||||
<translation>Diamètre apparent du soleil</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="110"/>
|
||||
<location filename="../gui_qt/formsky.cpp" line="111"/>
|
||||
<source>Sun halo radius</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="111"/>
|
||||
<location filename="../gui_qt/formsky.cpp" line="112"/>
|
||||
<source>Sun halo profile</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="112"/>
|
||||
<location filename="../gui_qt/formsky.cpp" line="113"/>
|
||||
<source>Auto from daytime</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="117"/>
|
||||
<location filename="../gui_qt/formsky.cpp" line="118"/>
|
||||
<source>Turbidity</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="113"/>
|
||||
<location filename="../gui_qt/formsky.cpp" line="114"/>
|
||||
<source>Zenith color</source>
|
||||
<translation>Couleur du ciel au zénith</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="114"/>
|
||||
<location filename="../gui_qt/formsky.cpp" line="115"/>
|
||||
<source>Haze color</source>
|
||||
<translation>Couleur de la brume</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="115"/>
|
||||
<location filename="../gui_qt/formsky.cpp" line="116"/>
|
||||
<source>Haze height</source>
|
||||
<translation>Hauteur apparente de la brume</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="116"/>
|
||||
<location filename="../gui_qt/formsky.cpp" line="117"/>
|
||||
<source>Haze smoothing</source>
|
||||
<translation>Facteur de lissage de la brume</translation>
|
||||
</message>
|
||||
|
|
Loading…
Reference in a new issue