Several fixes and small changes
This commit is contained in:
parent
c8f36643d0
commit
f199963867
7 changed files with 70 additions and 45 deletions
|
@ -14,6 +14,7 @@
|
||||||
<file>images/layer_down.png</file>
|
<file>images/layer_down.png</file>
|
||||||
<file>images/layer_rename.png</file>
|
<file>images/layer_rename.png</file>
|
||||||
<file>images/layer_up.png</file>
|
<file>images/layer_up.png</file>
|
||||||
|
<file>images/auto.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/tabs">
|
<qresource prefix="/tabs">
|
||||||
<file>images/tab_atmosphere.png</file>
|
<file>images/tab_atmosphere.png</file>
|
||||||
|
|
|
@ -39,15 +39,15 @@ bool FreeFormHelper::eventFilter(QObject* object, QEvent* event)
|
||||||
|
|
||||||
if (form_size.width() > 1400 && form_size.height() > 900)
|
if (form_size.width() > 1400 && form_size.height() > 900)
|
||||||
{
|
{
|
||||||
preview_size = QSize(300, 300);
|
preview_size = QSize(320, 320);
|
||||||
}
|
}
|
||||||
else if (form_size.width() < 1000 || form_size.height() < 700)
|
else if (form_size.width() < 1000 || form_size.height() < 700)
|
||||||
{
|
{
|
||||||
preview_size = QSize(160, 160);
|
preview_size = QSize(200, 200);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
preview_size = QSize(220, 220);
|
preview_size = QSize(260, 260);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < _previews.size(); i++)
|
for (int i = 0; i < _previews.size(); i++)
|
||||||
|
|
|
@ -67,12 +67,26 @@ void FreeLayerHelper::setDelButton(QPushButton* button)
|
||||||
|
|
||||||
void FreeLayerHelper::setDownButton(QPushButton* button)
|
void FreeLayerHelper::setDownButton(QPushButton* button)
|
||||||
{
|
{
|
||||||
connect(button, SIGNAL(clicked()), this, SLOT(moveLayerDown()));
|
if (_reverse)
|
||||||
|
{
|
||||||
|
connect(button, SIGNAL(clicked()), this, SLOT(moveLayerDown()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
connect(button, SIGNAL(clicked()), this, SLOT(moveLayerUp()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreeLayerHelper::setUpButton(QPushButton* button)
|
void FreeLayerHelper::setUpButton(QPushButton* button)
|
||||||
{
|
{
|
||||||
connect(button, SIGNAL(clicked()), this, SLOT(moveLayerUp()));
|
if (_reverse)
|
||||||
|
{
|
||||||
|
connect(button, SIGNAL(clicked()), this, SLOT(moveLayerUp()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
connect(button, SIGNAL(clicked()), this, SLOT(moveLayerDown()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreeLayerHelper::addLayer()
|
void FreeLayerHelper::addLayer()
|
||||||
|
@ -88,16 +102,30 @@ void FreeLayerHelper::deleteLayer()
|
||||||
{
|
{
|
||||||
layersDeleteLayer(_layers, _selected);
|
layersDeleteLayer(_layers, _selected);
|
||||||
emit(layersChanged());
|
emit(layersChanged());
|
||||||
|
refreshLayers();
|
||||||
}
|
}
|
||||||
refreshLayers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreeLayerHelper::moveLayerDown()
|
void FreeLayerHelper::moveLayerDown()
|
||||||
{
|
{
|
||||||
|
if (_selected > 0)
|
||||||
|
{
|
||||||
|
layersMove(_layers, _selected, _selected - 1);
|
||||||
|
_selected--;
|
||||||
|
emit(layersChanged());
|
||||||
|
refreshLayers();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreeLayerHelper::moveLayerUp()
|
void FreeLayerHelper::moveLayerUp()
|
||||||
{
|
{
|
||||||
|
if (_selected >= 0 && _selected < layersCount(_layers) - 1)
|
||||||
|
{
|
||||||
|
layersMove(_layers, _selected, _selected + 1);
|
||||||
|
_selected++;
|
||||||
|
emit(layersChanged());
|
||||||
|
refreshLayers();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreeLayerHelper::tableSelectionChanged(int row, int)
|
void FreeLayerHelper::tableSelectionChanged(int row, int)
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include "basepreview.h"
|
#include "basepreview.h"
|
||||||
#include "formclouds.h"
|
#include "formclouds.h"
|
||||||
#include "formatmosphere.h"
|
#include "formatmosphere.h"
|
||||||
#include "formtextures.h"
|
|
||||||
#include "formwater.h"
|
#include "formwater.h"
|
||||||
#include "formrender.h"
|
#include "formrender.h"
|
||||||
|
|
||||||
|
@ -92,16 +91,12 @@ MainWindow::MainWindow() :
|
||||||
connect(ui->action_explore, SIGNAL(triggered()), this, SLOT(explore3D()));
|
connect(ui->action_explore, SIGNAL(triggered()), this, SLOT(explore3D()));
|
||||||
connect(ui->action_quick_render, SIGNAL(triggered()), this, SLOT(quickPreview()));
|
connect(ui->action_quick_render, SIGNAL(triggered()), this, SLOT(quickPreview()));
|
||||||
connect(ui->action_final_render, SIGNAL(triggered()), this, SLOT(finalRender()));
|
connect(ui->action_final_render, SIGNAL(triggered()), this, SLOT(finalRender()));
|
||||||
|
connect(ui->action_last_render, SIGNAL(triggered()), this, SLOT(showLastRender()));
|
||||||
connect(ui->action_file_new, SIGNAL(triggered()), this, SLOT(fileNew()));
|
connect(ui->action_file_new, SIGNAL(triggered()), this, SLOT(fileNew()));
|
||||||
connect(ui->action_file_save, SIGNAL(triggered()), this, SLOT(fileSave()));
|
connect(ui->action_file_save, SIGNAL(triggered()), this, SLOT(fileSave()));
|
||||||
connect(ui->action_file_load, SIGNAL(triggered()), this, SLOT(fileLoad()));
|
connect(ui->action_file_load, SIGNAL(triggered()), this, SLOT(fileLoad()));
|
||||||
connect(ui->action_about, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
|
connect(ui->action_about, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
|
||||||
|
|
||||||
form = new FormTextures(ui->tabs);
|
|
||||||
ui->tabs->addTab(form, QIcon(getDataPath("images/tab_textures.png")), tr("Textures"));
|
|
||||||
QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll()), Qt::QueuedConnection);
|
|
||||||
_forms.append(form);
|
|
||||||
|
|
||||||
form = new FormWater(ui->tabs);
|
form = new FormWater(ui->tabs);
|
||||||
ui->tabs->addTab(form, QIcon(getDataPath("images/tab_water.png")), tr("Water"));
|
ui->tabs->addTab(form, QIcon(getDataPath("images/tab_water.png")), tr("Water"));
|
||||||
QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll()), Qt::QueuedConnection);
|
QObject::connect(form, SIGNAL(configApplied()), this, SLOT(refreshAll()), Qt::QueuedConnection);
|
||||||
|
|
|
@ -12,13 +12,6 @@ MainTexturesForm::MainTexturesForm(QWidget *parent) : QWidget(parent), ui(new Ui
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
form_helper = new FreeFormHelper(this);
|
|
||||||
form_helper->setApplyButton(ui->button_apply);
|
|
||||||
form_helper->setRevertButton(ui->button_revert);
|
|
||||||
form_helper->setExploreButton(ui->button_explore);
|
|
||||||
form_helper->setRenderButton(ui->button_render);
|
|
||||||
form_helper->startManaging();
|
|
||||||
|
|
||||||
layer_helper = new FreeLayerHelper(textures->layers, true);
|
layer_helper = new FreeLayerHelper(textures->layers, true);
|
||||||
layer_helper->setLayerTable(ui->layersGrid);
|
layer_helper->setLayerTable(ui->layersGrid);
|
||||||
layer_helper->setAddButton(ui->layer_add);
|
layer_helper->setAddButton(ui->layer_add);
|
||||||
|
@ -26,8 +19,16 @@ MainTexturesForm::MainTexturesForm(QWidget *parent) : QWidget(parent), ui(new Ui
|
||||||
layer_helper->setDownButton(ui->layer_down);
|
layer_helper->setDownButton(ui->layer_down);
|
||||||
layer_helper->setUpButton(ui->layer_up);
|
layer_helper->setUpButton(ui->layer_up);
|
||||||
connect(layer_helper, SIGNAL(tableUpdateNeeded()), this, SLOT(updateLayers()));
|
connect(layer_helper, SIGNAL(tableUpdateNeeded()), this, SLOT(updateLayers()));
|
||||||
connect(layer_helper, SIGNAL(layersChanged()), form_helper, SLOT(processDataChange()));
|
|
||||||
connect(layer_helper, SIGNAL(selectionChanged(int)), this, SLOT(selectLayer(int)));
|
connect(layer_helper, SIGNAL(selectionChanged(int)), this, SLOT(selectLayer(int)));
|
||||||
|
|
||||||
|
form_helper = new FreeFormHelper(this);
|
||||||
|
form_helper->setApplyButton(ui->button_apply);
|
||||||
|
form_helper->setRevertButton(ui->button_revert);
|
||||||
|
form_helper->setExploreButton(ui->button_explore);
|
||||||
|
form_helper->setRenderButton(ui->button_render);
|
||||||
|
form_helper->startManaging();
|
||||||
|
|
||||||
|
connect(layer_helper, SIGNAL(layersChanged()), form_helper, SLOT(processDataChange()));
|
||||||
}
|
}
|
||||||
|
|
||||||
MainTexturesForm::~MainTexturesForm()
|
MainTexturesForm::~MainTexturesForm()
|
||||||
|
|
|
@ -77,11 +77,6 @@
|
||||||
<string>Material</string>
|
<string>Material</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Modify terrain</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -186,13 +181,13 @@
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="layer_down">
|
<widget class="QPushButton" name="layer_up">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Move layer down</string>
|
<string>Move layer up</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../../../data/ui_pictures.qrc">
|
<iconset resource="../../../data/ui_pictures.qrc">
|
||||||
<normaloff>:/buttons/logo/images/layer_down.png</normaloff>:/buttons/logo/images/layer_down.png</iconset>
|
<normaloff>:/buttons/logo/images/layer_up.png</normaloff>:/buttons/logo/images/layer_up.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
|
@ -203,13 +198,13 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="layer_up">
|
<widget class="QPushButton" name="layer_down">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Move layer up</string>
|
<string>Move layer down</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../../../data/ui_pictures.qrc">
|
<iconset resource="../../../data/ui_pictures.qrc">
|
||||||
<normaloff>:/buttons/logo/images/layer_up.png</normaloff>:/buttons/logo/images/layer_up.png</iconset>
|
<normaloff>:/buttons/logo/images/layer_down.png</normaloff>:/buttons/logo/images/layer_down.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
|
@ -401,6 +396,17 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="button_preset">
|
||||||
|
<property name="text">
|
||||||
|
<string>Load preset</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../data/ui_pictures.qrc">
|
||||||
|
<normaloff>:/buttons/logo/images/auto.png</normaloff>:/buttons/logo/images/auto.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="button_revert">
|
<widget class="QPushButton" name="button_revert">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
|
@ -86,8 +86,6 @@ typedef struct
|
||||||
RenderArea* area;
|
RenderArea* area;
|
||||||
} RenderChunk;
|
} RenderChunk;
|
||||||
|
|
||||||
#define RENDER_INVERSE 1
|
|
||||||
|
|
||||||
static void _callbackStart(int width, int height, Color background) {}
|
static void _callbackStart(int width, int height, Color background) {}
|
||||||
static void _callbackDraw(int x, int y, Color col) {}
|
static void _callbackDraw(int x, int y, Color col) {}
|
||||||
static void _callbackUpdate(double progress) {}
|
static void _callbackUpdate(double progress) {}
|
||||||
|
@ -602,13 +600,9 @@ void* _renderPostProcessChunk(void* data)
|
||||||
RenderFragment* fragment;
|
RenderFragment* fragment;
|
||||||
RenderChunk* chunk = (RenderChunk*)data;
|
RenderChunk* chunk = (RenderChunk*)data;
|
||||||
|
|
||||||
#ifdef RENDER_INVERSE
|
for (x = chunk->startx; x <= chunk->endx; x++)
|
||||||
for (y = chunk->area->params.height * chunk->area->params.antialias - 1 - chunk->starty; y >= chunk->area->params.height * chunk->area->params.antialias - 1 - chunk->endy; y--)
|
{
|
||||||
#else
|
for (y = chunk->starty; y <= chunk->endy; y++)
|
||||||
for (y = chunk->starty; y <= chunk->endy; y++)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
for (x = chunk->startx; x <= chunk->endx; x++)
|
|
||||||
{
|
{
|
||||||
fragment = chunk->area->pixels + (y * chunk->area->params.width * chunk->area->params.antialias + x);
|
fragment = chunk->area->pixels + (y * chunk->area->params.width * chunk->area->params.antialias + x);
|
||||||
if (fragment->flags.dirty)
|
if (fragment->flags.dirty)
|
||||||
|
@ -681,7 +675,7 @@ void renderPostProcess(RenderArea* area, int nbchunks)
|
||||||
|
|
||||||
running = 0;
|
running = 0;
|
||||||
loops = 0;
|
loops = 0;
|
||||||
while ((y < ny && !area->renderer->render_interrupt) || running > 0)
|
while ((x < nx && !area->renderer->render_interrupt) || running > 0)
|
||||||
{
|
{
|
||||||
timeSleepMs(50);
|
timeSleepMs(50);
|
||||||
|
|
||||||
|
@ -703,7 +697,7 @@ void renderPostProcess(RenderArea* area, int nbchunks)
|
||||||
|
|
||||||
area->renderer->render_progress = 0.1 + ((double)area->pixel_done / (double)area->pixel_count) * 0.9;
|
area->renderer->render_progress = 0.1 + ((double)area->pixel_done / (double)area->pixel_count) * 0.9;
|
||||||
|
|
||||||
if (y < ny && !chunks[i].thread && !area->renderer->render_interrupt)
|
if (x < nx && !chunks[i].thread && !area->renderer->render_interrupt)
|
||||||
{
|
{
|
||||||
chunks[i].finished = 0;
|
chunks[i].finished = 0;
|
||||||
chunks[i].interrupt = 0;
|
chunks[i].interrupt = 0;
|
||||||
|
@ -729,10 +723,10 @@ void renderPostProcess(RenderArea* area, int nbchunks)
|
||||||
chunks[i].thread = threadCreate(_renderPostProcessChunk, (void*)(chunks + i));
|
chunks[i].thread = threadCreate(_renderPostProcessChunk, (void*)(chunks + i));
|
||||||
running++;
|
running++;
|
||||||
|
|
||||||
if (++x >= nx)
|
if (++y >= ny)
|
||||||
{
|
{
|
||||||
y++;
|
x++;
|
||||||
x = 0;
|
y = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue