paysages : Several bugfixes.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@466 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-11-24 14:19:43 +00:00 committed by ThunderK
parent b9ccbe7685
commit d0bd8ee511
11 changed files with 40 additions and 16 deletions

1
TODO
View file

@ -16,6 +16,7 @@ Technology Preview 2 :
=> Add detail boost (adds granularity)
=> Add step boost (for marching algorithms)
- Waves noise should not change layers offsets each time a setting is changed (layers are reconstructed currently).
- Fix rendering when inside a cloud layer, with other upper or lower layers.
- Add "hardness to light" and shadow control ("minimum lighting") to material.
Technlogy Preview 3 :

View file

@ -427,7 +427,7 @@ void BasePreview::updateData()
{
}
QColor BasePreview::getColor(double x, double y)
QColor BasePreview::getColor(double, double)
{
return QColor(0, 0, 0);
}
@ -606,7 +606,7 @@ void BasePreview::choiceSelected(QAction* action)
}
}
void BasePreview::showEvent(QShowEvent* event)
void BasePreview::showEvent(QShowEvent*)
{
updateChunks();
}
@ -643,7 +643,7 @@ void BasePreview::resizeEvent(QResizeEvent* event)
this->_lock_drawing->unlock();
}
void BasePreview::paintEvent(QPaintEvent* event)
void BasePreview::paintEvent(QPaintEvent*)
{
QPainter painter(this);
painter.drawImage(0, 0, *this->_pixbuf);
@ -964,7 +964,7 @@ void BasePreview::wheelEvent(QWheelEvent* event)
event->accept();
}
void BasePreview::leaveEvent(QEvent* event)
void BasePreview::leaveEvent(QEvent*)
{
_info->setVisible(false);
}

View file

@ -58,7 +58,7 @@ public:
setMinimumSize(800, 600);
}
void paintEvent(QPaintEvent* event)
void paintEvent(QPaintEvent*)
{
QPainter painter(this);
painter.drawImage(0, 0, *_current_dialog->pixbuf);

View file

@ -179,10 +179,18 @@ void FormTextures::applyConfig()
void FormTextures::layerGetCopy(void* layer_definition)
{
texturesLayerCopyDefinition((TextureLayerDefinition*)layer_definition, _layer);
TextureLayerDefinition* source = (TextureLayerDefinition*)layer_definition;
texturesLayerCopyDefinition(source, _layer);
zoneGetHeightCurve(source->zone, _supp.height_curve);
zoneGetSlopeCurve(source->zone, _supp.slope_curve);
}
void FormTextures::layerApply(void* layer_definition)
{
texturesLayerCopyDefinition(_layer, (TextureLayerDefinition*)layer_definition);
TextureLayerDefinition* destination = (TextureLayerDefinition*)layer_definition;
texturesLayerCopyDefinition(_layer, destination);
zoneSetHeightCurve(destination->zone, _supp.height_curve);
zoneSetSlopeCurve(destination->zone, _supp.slope_curve);
}

View file

@ -4,6 +4,7 @@
#include <QPushButton>
#include <QPainter>
#include <QColorDialog>
#include "tools.h"
class ColorPreview:public QWidget
{
@ -13,7 +14,7 @@ public:
{
}
void paintEvent(QPaintEvent* event)
void paintEvent(QPaintEvent*)
{
QPainter painter(this);
painter.fillRect(this->rect(), col);
@ -50,7 +51,7 @@ void InputColor::applyValue()
void InputColor::revert()
{
((ColorPreview*)_preview)->col = QColor::fromRgbF(_value->r, _value->g, _value->b);
((ColorPreview*)_preview)->col = colorToQColor(*_value);
BaseInput::revert();
}

View file

@ -4,6 +4,7 @@
#include <QPushButton>
#include <QPainter>
#include "dialogcurve.h"
#include "tools.h"
class CurveSmallPreview:public QWidget
{
@ -17,13 +18,13 @@ public:
_ymax = ymax;
}
void paintEvent(QPaintEvent* event)
void paintEvent(QPaintEvent*)
{
if (!_curve)
{
return;
}
QPainter painter(this);
int width = this->width();
int height = this->height();

View file

@ -39,22 +39,28 @@ void InputDouble::updatePreview()
BaseInput::updatePreview();
}
void InputDouble::applyValue()
double InputDouble::getValue()
{
double result;
int ivalue = _slider->value();
if (ivalue == _slider->maximum())
{
*_value = _max;
result = _max;
}
else
{
*_value = _min + ((double)ivalue) * _small_step;
result = _min + ((double)ivalue) * _small_step;
}
if (fabs(*_value) < 0.0000001)
{
*_value = 0.0;
result = 0.0;
}
return result;
}
void InputDouble::applyValue()
{
*_value = getValue();
BaseInput::applyValue();
}

View file

@ -16,6 +16,9 @@ public slots:
virtual void updatePreview();
virtual void applyValue();
virtual void revert();
protected:
double getValue();
private:
QSlider* _slider;

View file

@ -16,7 +16,7 @@ void InputInt::updatePreview()
void InputInt::applyValue()
{
*_value = (int)_dvalue;
*_value = (int)getValue();
InputDouble::applyValue();
}

View file

@ -127,6 +127,7 @@ double colorNormalize(Color* col)
{
double max = colorGetValue(col);
assert(max >= 0.0);
assert(col->r >= 0.0);
assert(col->g >= 0.0);
assert(col->b >= 0.0);

View file

@ -61,6 +61,8 @@ WaterDefinition waterCreateDefinition()
result.height = -4.0;
result._waves_noise = noiseCreateGenerator();
waterAutoPreset(&result, WATER_PRESET_LAKE);
return result;
}
@ -115,6 +117,7 @@ void waterAutoPreset(WaterDefinition* definition, WaterPreset preset)
definition->foam_material.base.r = 0.8;
definition->foam_material.base.g = 0.8;
definition->foam_material.base.b = 0.8;
definition->foam_material.base.a = 1.0;
definition->foam_material.reflection = 0.4;
definition->foam_material.shininess = 1.5;