Merge branch 'master' into perspective_correction

This commit is contained in:
Michaël Lemaire 2013-05-28 15:00:02 +02:00 committed by Michael Lemaire
commit 7029d78365
9 changed files with 84 additions and 152 deletions

2
.gitignore vendored
View file

@ -1,10 +1,12 @@
build/ build/
cache/
data/i18n/paysages_*.qm data/i18n/paysages_*.qm
gmon.out gmon.out
nbproject/ nbproject/
output/ output/
src/editing/Makefile src/editing/Makefile
*.pro.user *.pro.user
*.pro.user.*
qrc_*.cpp qrc_*.cpp
ui_*.h ui_*.h
tags tags

BIN
dist/Paysages3D.exe vendored Normal file

Binary file not shown.

19
dist/README.txt vendored Normal file
View file

@ -0,0 +1,19 @@
Paysages 3D, a landscape generator, editor and renderer.
This version is a development preview. Its only purpose is to demonstrate the software features and gather user feedback.
The software is provided "as-is". The authors give no warranty whatsoever regarding to this software, and disclaim any warranty of merchantability, fitness for a particular purpose, non-interference, or non-infringement. The authors cannot be kept responsible for any damage of any kind caused directly or indirectly by the software.
By installing, configuring, and/or using the software, you accept above terms.
This version is provided free of charge, with no limits on usage. If you paid to obtain this version, please inform the authors.
This version is distributed under the terms of the Creative Commons Licence (BY-NC-ND 3.0). Please read the full terms on the Creative Commons information website : http://creativecommons.org/licenses/by-nc-nd/3.0/
Authors :
Michael LEMAIRE - Developer
Credits :
Qt - http://qt.nokia.com/
DevIL - http://openil.sourceforge.net/
GLib - http://www.gtk.org/
You can find complementary information, or contact the authors on the website : http://www.paysages3d.com/

View file

@ -14,7 +14,7 @@ ifneq (,${LIBS})
endif endif
CC_FLAGS += -fPIC -Wall -I${PROJECT_PATH}/src CC_FLAGS += -fPIC -Wall -I${PROJECT_PATH}/src
CC_LDFLAGS += -fPIC CC_LDFLAGS += -fPIC -lm
all:prepare ${RESULT} all:prepare ${RESULT}

View file

@ -5,25 +5,11 @@ WidgetGlobalFormButtons::WidgetGlobalFormButtons(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::WidgetGlobalFormButtons) ui(new Ui::WidgetGlobalFormButtons)
{ {
QPushButton* button;
ui->setupUi(this); ui->setupUi(this);
button = findChild<QPushButton*>("button_ok"); connect(ui->button_ok, SIGNAL(clicked()), this, SIGNAL(okClicked()));
if (button) connect(ui->button_cancel, SIGNAL(clicked()), this, SIGNAL(cancelClicked()));
{ connect(ui->button_revert, SIGNAL(clicked()), this, SIGNAL(revertClicked()));
connect(button, SIGNAL(clicked()), this, SIGNAL(okClicked()));
}
button = findChild<QPushButton*>("button_cancel");
if (button)
{
connect(button, SIGNAL(clicked()), this, SIGNAL(cancelClicked()));
}
button = findChild<QPushButton*>("button_revert");
if (button)
{
connect(button, SIGNAL(clicked()), this, SIGNAL(revertClicked()));
}
} }
WidgetGlobalFormButtons::~WidgetGlobalFormButtons() WidgetGlobalFormButtons::~WidgetGlobalFormButtons()

View file

@ -15,11 +15,7 @@ DialogTerrainPainting::DialogTerrainPainting(QWidget*parent, TerrainDefinition*
_terrain_original = terrain; _terrain_original = terrain;
_terrain_modified = (TerrainDefinition*)TerrainDefinitionClass.create(); _terrain_modified = (TerrainDefinition*)TerrainDefinitionClass.create();
QWidget* widget = findChild<QWidget*>("widget_commands"); ui->widget_commands->hide();
if (widget)
{
widget->hide();
}
revert(); revert();
@ -33,43 +29,26 @@ DialogTerrainPainting::~DialogTerrainPainting()
void DialogTerrainPainting::keyReleaseEvent(QKeyEvent* event) void DialogTerrainPainting::keyReleaseEvent(QKeyEvent* event)
{ {
QComboBox* input_brush_mode = findChild<QComboBox*>("input_brush_mode");
switch (event->key()) switch (event->key())
{ {
case Qt::Key_F2: case Qt::Key_F2:
if (input_brush_mode) ui->input_brush_mode->setCurrentIndex(0);
{
input_brush_mode->setCurrentIndex(0);
}
event->accept(); event->accept();
break; break;
case Qt::Key_F3: case Qt::Key_F3:
if (input_brush_mode) ui->input_brush_mode->setCurrentIndex(1);
{
input_brush_mode->setCurrentIndex(1);
}
event->accept(); event->accept();
break; break;
case Qt::Key_F4: case Qt::Key_F4:
if (input_brush_mode) ui->input_brush_mode->setCurrentIndex(2);
{
input_brush_mode->setCurrentIndex(2);
}
event->accept(); event->accept();
break; break;
case Qt::Key_F11: case Qt::Key_F11:
if (input_brush_mode) ui->input_brush_mode->setCurrentIndex(3);
{
input_brush_mode->setCurrentIndex(3);
}
event->accept(); event->accept();
break; break;
case Qt::Key_F12: case Qt::Key_F12:
if (input_brush_mode) ui->input_brush_mode->setCurrentIndex(4);
{
input_brush_mode->setCurrentIndex(4);
}
event->accept(); event->accept();
break; break;
default: default:
@ -79,32 +58,19 @@ void DialogTerrainPainting::keyReleaseEvent(QKeyEvent* event)
void DialogTerrainPainting::wheelEvent(QWheelEvent* event) void DialogTerrainPainting::wheelEvent(QWheelEvent* event)
{ {
QSlider* input_brush_size = findChild<QSlider*>("input_brush_size");
QSlider* input_brush_smoothing = findChild<QSlider*>("input_brush_smoothing");
QSlider* input_brush_strength = findChild<QSlider*>("input_brush_strength");
if (event->modifiers() & Qt::ControlModifier) if (event->modifiers() & Qt::ControlModifier)
{ {
if (input_brush_size) ui->input_brush_size->setValue(ui->input_brush_size->value() + (event->delta() > 0 ? 1 : -1));
{
input_brush_size->setValue(input_brush_size->value() + (event->delta() > 0 ? 1 : -1));
}
event->accept(); event->accept();
} }
else if (event->modifiers() & Qt::ShiftModifier) else if (event->modifiers() & Qt::ShiftModifier)
{ {
if (input_brush_strength) ui->input_brush_strength->setValue(ui->input_brush_strength->value() + (event->delta() > 0 ? 1 : -1));
{
input_brush_strength->setValue(input_brush_strength->value() + (event->delta() > 0 ? 1 : -1));
}
event->accept(); event->accept();
} }
else if (event->modifiers() & Qt::AltModifier) else if (event->modifiers() & Qt::AltModifier)
{ {
if (input_brush_smoothing) ui->input_brush_smoothing->setValue(ui->input_brush_smoothing->value() + (event->delta() > 0 ? 1 : -1));
{
input_brush_smoothing->setValue(input_brush_smoothing->value() + (event->delta() > 0 ? 1 : -1));
}
event->accept(); event->accept();
} }
else else
@ -123,75 +89,34 @@ void DialogTerrainPainting::revert()
{ {
TerrainDefinitionClass.copy(_terrain_original, _terrain_modified); TerrainDefinitionClass.copy(_terrain_original, _terrain_modified);
WidgetHeightMap* heightmap = findChild<WidgetHeightMap*>("widget_heightmap"); ui->widget_heightmap->setTerrain(_terrain_modified);
if (heightmap) ui->widget_heightmap->setBrush(&_brush);
{
heightmap->setTerrain(_terrain_modified);
heightmap->setBrush(&_brush);
}
} }
void DialogTerrainPainting::brushConfigChanged() void DialogTerrainPainting::brushConfigChanged()
{ {
QLabel* label;
QComboBox* combobox;
QSlider* slider;
// Fill brush object // Fill brush object
combobox = findChild<QComboBox*>("input_brush_mode"); _brush.setMode((PaintingBrushMode) ui->input_brush_mode->currentIndex());
if (combobox) _brush.setSize(ui->input_brush_size);
{ _brush.setSmoothing(ui->input_brush_smoothing);
_brush.setMode((PaintingBrushMode)combobox->currentIndex()); _brush.setStrength(ui->input_brush_strength);
}
slider = findChild<QSlider*>("input_brush_size");
if (slider)
{
_brush.setSize(slider);
}
slider = findChild<QSlider*>("input_brush_smoothing");
if (slider)
{
_brush.setSmoothing(slider);
}
slider = findChild<QSlider*>("input_brush_strength");
if (slider)
{
_brush.setStrength(slider);
}
// Update brush description // Update brush description
label = findChild<QLabel*>("label_brush_description"); ui->label_brush_description->setText(getHelpText());
if (label)
{
label->setText(getHelpText());
}
// Update brush preview // Update brush preview
// TODO
// Tell to 3D widget // Tell to 3D widget
WidgetHeightMap* heightmap = findChild<WidgetHeightMap*>("widget_heightmap"); ui->widget_heightmap->setBrush(&_brush);
if (heightmap)
{
heightmap->setBrush(&_brush);
}
} }
void DialogTerrainPainting::heightmapChanged() void DialogTerrainPainting::heightmapChanged()
{ {
QLabel* label = findChild<QLabel*>("label_memory_consumption"); qint64 memused = terrainGetMemoryStats(_terrain_modified);
if (label) ui->label_memory_consumption->setText(tr("Memory used: %1").arg(getHumanMemory(memused)));
{ ui->progress_memory_consumption->setMaximum(1024);
qint64 memused = terrainGetMemoryStats(_terrain_modified); ui->progress_memory_consumption->setValue(memused / 1024);
label->setText(tr("Memory used: %1").arg(getHumanMemory(memused)));
// TODO Find available memory
QProgressBar* progress = findChild<QProgressBar*>("progress_memory_consumption");
if (progress)
{
progress->setMaximum(1024);
progress->setValue(memused / 1024);
}
}
} }
QString DialogTerrainPainting::getHelpText() QString DialogTerrainPainting::getHelpText()

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1116</width> <width>1145</width>
<height>726</height> <height>777</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -831,8 +831,8 @@
<slot>brushConfigChanged()</slot> <slot>brushConfigChanged()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>752</x> <x>1115</x>
<y>42</y> <y>53</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>437</x> <x>437</x>
@ -847,8 +847,8 @@
<slot>brushConfigChanged()</slot> <slot>brushConfigChanged()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>919</x> <x>1115</x>
<y>115</y> <y>143</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>437</x> <x>437</x>
@ -879,8 +879,8 @@
<slot>reject()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>875</x> <x>1134</x>
<y>580</y> <y>766</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>711</x> <x>711</x>
@ -895,8 +895,8 @@
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>943</x> <x>1134</x>
<y>587</y> <y>766</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>683</x> <x>683</x>
@ -911,8 +911,8 @@
<slot>revert()</slot> <slot>revert()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>943</x> <x>1134</x>
<y>587</y> <y>766</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>747</x> <x>747</x>
@ -927,12 +927,12 @@
<slot>toggleWater(bool)</slot> <slot>toggleWater(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>40</x> <x>60</x>
<y>21</y> <y>43</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>39</x> <x>58</x>
<y>160</y> <y>480</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -943,12 +943,12 @@
<slot>toggleGrid(bool)</slot> <slot>toggleGrid(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>102</x> <x>161</x>
<y>17</y> <y>40</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>102</x> <x>121</x>
<y>143</y> <y>463</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -972,15 +972,15 @@
<sender>pushButton</sender> <sender>pushButton</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
<receiver>widget_commands</receiver> <receiver>widget_commands</receiver>
<slot>setShown(bool)</slot> <slot>setVisible(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>516</x> <x>734</x>
<y>20</y> <y>40</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>517</x> <x>536</x>
<y>50</y> <y>104</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>

View file

@ -17,20 +17,20 @@ MainTerrainForm::MainTerrainForm(QWidget *parent) :
_form_helper = new FreeFormHelper(this); _form_helper = new FreeFormHelper(this);
_renderer_shape = new PreviewTerrainShape(_terrain); _renderer_shape = new PreviewTerrainShape(_terrain);
_form_helper->addPreview("preview_shape", _renderer_shape); _form_helper->addPreview(ui->preview_shape, _renderer_shape);
_form_helper->addDoubleInputSlider("input_scaling", &_terrain->scaling, 0.1, 3.0, 0.03, 0.3); _form_helper->addDoubleInputSlider(ui->input_scaling, &_terrain->scaling, 0.1, 3.0, 0.03, 0.3);
_form_helper->addDoubleInputSlider("input_height", &_terrain->height, 1.0, 45.0, 0.3, 3.0); _form_helper->addDoubleInputSlider(ui->input_height, &_terrain->height, 1.0, 45.0, 0.3, 3.0);
_form_helper->addDoubleInputSlider("input_shadow_smoothing", &_terrain->shadow_smoothing, 0.0, 0.3, 0.003, 0.03); _form_helper->addDoubleInputSlider(ui->input_shadow_smoothing, &_terrain->shadow_smoothing, 0.0, 0.3, 0.003, 0.03);
_form_helper->addDoubleInputSlider("input_water_height", &_terrain->water_height, -2.0, 2.0, 0.01, 0.1); _form_helper->addDoubleInputSlider(ui->input_water_height, &_terrain->water_height, -2.0, 2.0, 0.01, 0.1);
_form_helper->setApplyButton("button_apply"); _form_helper->setApplyButton(ui->button_apply);
_form_helper->setRevertButton("button_revert"); _form_helper->setRevertButton(ui->button_revert);
_form_helper->setExploreButton("button_explore"); _form_helper->setExploreButton(ui->button_explore);
_form_helper->setRenderButton("button_render"); _form_helper->setRenderButton(ui->button_render);
connect(findChild<QPushButton*>("button_dialog_painting"), SIGNAL(clicked()), this, SLOT(buttonPaintingPressed())); connect(ui->button_dialog_painting, SIGNAL(clicked()), this, SLOT(buttonPaintingPressed()));
connect(findChild<QPushButton*>("button_goto_textures"), SIGNAL(clicked()), this, SLOT(buttonTexturesPressed())); connect(ui->button_goto_textures, SIGNAL(clicked()), this, SLOT(buttonTexturesPressed()));
_form_helper->startManaging(); _form_helper->startManaging();
} }

View file

@ -97,7 +97,6 @@ Color cloudsApplyLayer(CloudsLayerDefinition* definition, Color base, Renderer*
/* TODO Crawl in segments for render */ /* TODO Crawl in segments for render */
col = definition->material.base; col = definition->material.base;
col.a = 0.0;
/*if (definition->transparencydepth == 0 || inside_length >= definition->transparencydepth) /*if (definition->transparencydepth == 0 || inside_length >= definition->transparencydepth)
{ {
col.a = 1.0; col.a = 1.0;
@ -108,6 +107,7 @@ Color cloudsApplyLayer(CloudsLayerDefinition* definition, Color base, Renderer*
}*/ }*/
col = renderer->atmosphere->applyAerialPerspective(renderer, start, col).final; col = renderer->atmosphere->applyAerialPerspective(renderer, start, col).final;
col.a = 0.0;
colorMask(&base, &col); colorMask(&base, &col);