Added textures mix preview
This commit is contained in:
parent
1db49afaed
commit
f0ed8d4b4a
9 changed files with 85 additions and 61 deletions
|
@ -52,7 +52,6 @@ HEADERS += \
|
||||||
lighting/SmallPreviewHues.h \
|
lighting/SmallPreviewHues.h \
|
||||||
textures/PreviewLayerCoverage.h \
|
textures/PreviewLayerCoverage.h \
|
||||||
textures/PreviewLayerLook.h \
|
textures/PreviewLayerLook.h \
|
||||||
textures/PreviewCumul.h \
|
|
||||||
textures/DialogTexturesLayer.h \
|
textures/DialogTexturesLayer.h \
|
||||||
desktop_global.h \
|
desktop_global.h \
|
||||||
DesktopScenery.h
|
DesktopScenery.h
|
||||||
|
@ -100,7 +99,6 @@ SOURCES += \
|
||||||
lighting/SmallPreviewHues.cpp \
|
lighting/SmallPreviewHues.cpp \
|
||||||
textures/PreviewLayerCoverage.cpp \
|
textures/PreviewLayerCoverage.cpp \
|
||||||
textures/PreviewLayerLook.cpp \
|
textures/PreviewLayerLook.cpp \
|
||||||
textures/PreviewCumul.cpp \
|
|
||||||
textures/DialogTexturesLayer.cpp \
|
textures/DialogTexturesLayer.cpp \
|
||||||
DesktopScenery.cpp
|
DesktopScenery.cpp
|
||||||
|
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
#include "PreviewCumul.h"
|
|
||||||
|
|
||||||
#include "SoftwareRenderer.h"
|
|
||||||
#include "BasePreview.h"
|
|
||||||
|
|
||||||
void PreviewCumul::setTextures(TexturesDefinition* textures)
|
|
||||||
{
|
|
||||||
this->textures = textures;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreviewCumul::setLayer(int layer)
|
|
||||||
{
|
|
||||||
this->layer = layer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreviewCumul::bindEvent(BasePreview* preview)
|
|
||||||
{
|
|
||||||
preview->addOsd(QString("geolocation"));
|
|
||||||
|
|
||||||
//preview->configHdrToneMapping(true);
|
|
||||||
|
|
||||||
preview->configScaling(20.0, 1000.0, 20.0, 200.0);
|
|
||||||
preview->configScrolling(-1000.0, 1000.0, 0.0, -1000.0, 1000.0, 0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreviewCumul::updateEvent()
|
|
||||||
{
|
|
||||||
if (textures)
|
|
||||||
{
|
|
||||||
//TexturesPreviewCumul_bind(this, textures);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Color PreviewCumul::getColor2D(double x, double y, double scaling)
|
|
||||||
{
|
|
||||||
if (textures)
|
|
||||||
{
|
|
||||||
return COLOR_BLACK;
|
|
||||||
//return TexturesPreviewCumul_getColor(this, x, y, scaling, layer);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return COLOR_BLACK;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "previewmaterial.h"
|
#include "previewmaterial.h"
|
||||||
#include "textures/PreviewLayerCoverage.h"
|
#include "textures/PreviewLayerCoverage.h"
|
||||||
#include "textures/PreviewLayerLook.h"
|
#include "textures/PreviewLayerLook.h"
|
||||||
#include "textures/PreviewCumul.h"
|
#include "TexturesMixPreviewRenderer.h"
|
||||||
#include "textures/DialogTexturesLayer.h"
|
#include "textures/DialogTexturesLayer.h"
|
||||||
|
|
||||||
MainTexturesForm::MainTexturesForm(QWidget *parent) : QWidget(parent), ui(new Ui::MainTexturesForm)
|
MainTexturesForm::MainTexturesForm(QWidget *parent) : QWidget(parent), ui(new Ui::MainTexturesForm)
|
||||||
|
@ -34,7 +34,6 @@ MainTexturesForm::MainTexturesForm(QWidget *parent) : QWidget(parent), ui(new Ui
|
||||||
form_helper->setRevertButton(ui->button_revert);
|
form_helper->setRevertButton(ui->button_revert);
|
||||||
form_helper->setExploreButton(ui->button_explore);
|
form_helper->setExploreButton(ui->button_explore);
|
||||||
form_helper->setRenderButton(ui->button_render);
|
form_helper->setRenderButton(ui->button_render);
|
||||||
form_helper->startManaging();
|
|
||||||
|
|
||||||
preview_layer_coverage = new PreviewLayerCoverage();
|
preview_layer_coverage = new PreviewLayerCoverage();
|
||||||
preview_layer_coverage->setTextures(textures);
|
preview_layer_coverage->setTextures(textures);
|
||||||
|
@ -44,7 +43,7 @@ MainTexturesForm::MainTexturesForm(QWidget *parent) : QWidget(parent), ui(new Ui
|
||||||
preview_layer_look->setTextures(textures);
|
preview_layer_look->setTextures(textures);
|
||||||
form_helper->addPreview(ui->preview_texture, preview_layer_look);
|
form_helper->addPreview(ui->preview_texture, preview_layer_look);
|
||||||
|
|
||||||
preview_cumul = new PreviewCumul();
|
preview_cumul = new TexturesMixPreviewRenderer();
|
||||||
preview_cumul->setTextures(textures);
|
preview_cumul->setTextures(textures);
|
||||||
form_helper->addPreview(ui->preview_cumul, preview_cumul);
|
form_helper->addPreview(ui->preview_cumul, preview_cumul);
|
||||||
|
|
||||||
|
@ -56,6 +55,8 @@ MainTexturesForm::MainTexturesForm(QWidget *parent) : QWidget(parent), ui(new Ui
|
||||||
connect(form_helper, SIGNAL(presetSelected(int)), this, SLOT(selectPreset(int)));
|
connect(form_helper, SIGNAL(presetSelected(int)), this, SLOT(selectPreset(int)));
|
||||||
|
|
||||||
connect(layer_helper, SIGNAL(layersChanged()), form_helper, SLOT(processDataChange()));
|
connect(layer_helper, SIGNAL(layersChanged()), form_helper, SLOT(processDataChange()));
|
||||||
|
|
||||||
|
form_helper->startManaging();
|
||||||
}
|
}
|
||||||
|
|
||||||
MainTexturesForm::~MainTexturesForm()
|
MainTexturesForm::~MainTexturesForm()
|
||||||
|
@ -133,6 +134,8 @@ void MainTexturesForm::selectPreset(int preset)
|
||||||
void MainTexturesForm::updateLocalDataFromScenery()
|
void MainTexturesForm::updateLocalDataFromScenery()
|
||||||
{
|
{
|
||||||
DesktopScenery::getCurrent()->getTextures(textures);
|
DesktopScenery::getCurrent()->getTextures(textures);
|
||||||
|
|
||||||
|
preview_cumul->setTerrain(DesktopScenery::getCurrent()->getTerrain());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainTexturesForm::commitLocalDataToScenery()
|
void MainTexturesForm::commitLocalDataToScenery()
|
||||||
|
|
|
@ -42,7 +42,7 @@ private:
|
||||||
FreeLayerHelper* layer_helper;
|
FreeLayerHelper* layer_helper;
|
||||||
PreviewLayerCoverage* preview_layer_coverage;
|
PreviewLayerCoverage* preview_layer_coverage;
|
||||||
PreviewLayerLook* preview_layer_look;
|
PreviewLayerLook* preview_layer_look;
|
||||||
PreviewCumul* preview_cumul;
|
TexturesMixPreviewRenderer* preview_cumul;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINTEXTURESFORM_H
|
#endif // MAINTEXTURESFORM_H
|
||||||
|
|
|
@ -26,6 +26,7 @@ void Base2dPreviewRenderer::choiceChangeEvent(const std::string &, int)
|
||||||
|
|
||||||
void Base2dPreviewRenderer::updateEvent()
|
void Base2dPreviewRenderer::updateEvent()
|
||||||
{
|
{
|
||||||
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Base2dPreviewRenderer::cameraEvent(double, double, double)
|
void Base2dPreviewRenderer::cameraEvent(double, double, double)
|
||||||
|
|
58
src/render/preview/TexturesMixPreviewRenderer.cpp
Normal file
58
src/render/preview/TexturesMixPreviewRenderer.cpp
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
#include "TexturesMixPreviewRenderer.h"
|
||||||
|
|
||||||
|
#include "Scenery.h"
|
||||||
|
#include "BasePreview.h"
|
||||||
|
#include "TerrainRenderer.h"
|
||||||
|
|
||||||
|
TexturesMixPreviewRenderer::TexturesMixPreviewRenderer():
|
||||||
|
Base2dPreviewRenderer()
|
||||||
|
{
|
||||||
|
textures = NULL;
|
||||||
|
|
||||||
|
render_quality = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TexturesMixPreviewRenderer::setTextures(TexturesDefinition* textures)
|
||||||
|
{
|
||||||
|
this->textures = textures;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TexturesMixPreviewRenderer::setTerrain(TerrainDefinition *terrain)
|
||||||
|
{
|
||||||
|
getScenery()->setTerrain(terrain);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TexturesMixPreviewRenderer::setLayer(int layer)
|
||||||
|
{
|
||||||
|
this->layer = layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TexturesMixPreviewRenderer::bindEvent(BasePreview* preview)
|
||||||
|
{
|
||||||
|
preview->addOsd(QString("geolocation"));
|
||||||
|
|
||||||
|
preview->configHdrToneMapping(true);
|
||||||
|
|
||||||
|
preview->configScaling(20.0, 1000.0, 20.0, 200.0);
|
||||||
|
preview->configScrolling(-1000.0, 1000.0, 0.0, -1000.0, 1000.0, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TexturesMixPreviewRenderer::updateEvent()
|
||||||
|
{
|
||||||
|
Base2dPreviewRenderer::updateEvent();
|
||||||
|
|
||||||
|
if (textures)
|
||||||
|
{
|
||||||
|
getScenery()->setTextures(textures);
|
||||||
|
}
|
||||||
|
|
||||||
|
disableAtmosphere();
|
||||||
|
disableClouds();
|
||||||
|
}
|
||||||
|
|
||||||
|
Color TexturesMixPreviewRenderer::getColor2D(double x, double y, double scaling)
|
||||||
|
{
|
||||||
|
TerrainRenderer* terrain_renderer = getTerrainRenderer();
|
||||||
|
Vector3 location(x, terrain_renderer->getHeight(x, y, 1), y);
|
||||||
|
return terrain_renderer->getFinalColor(location, scaling);
|
||||||
|
}
|
|
@ -1,17 +1,20 @@
|
||||||
#ifndef EDITING_TEXTURES_PREVIEWCUMUL_H
|
#ifndef TEXTURESMIXPREVIEWRENDERER_H
|
||||||
#define EDITING_TEXTURES_PREVIEWCUMUL_H
|
#define TEXTURESMIXPREVIEWRENDERER_H
|
||||||
|
|
||||||
#include "desktop_global.h"
|
#include "preview_global.h"
|
||||||
|
|
||||||
#include "Base2dPreviewRenderer.h"
|
#include "Base2dPreviewRenderer.h"
|
||||||
|
|
||||||
class PreviewCumul : public Base2dPreviewRenderer
|
namespace paysages {
|
||||||
|
namespace preview {
|
||||||
|
|
||||||
|
class PREVIEWSHARED_EXPORT TexturesMixPreviewRenderer:public Base2dPreviewRenderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit PreviewCumul():
|
TexturesMixPreviewRenderer();
|
||||||
Base2dPreviewRenderer(),textures(0){}
|
|
||||||
|
|
||||||
void setTextures(TexturesDefinition* textures);
|
void setTextures(TexturesDefinition* textures);
|
||||||
|
void setTerrain(TerrainDefinition* terrain);
|
||||||
void setLayer(int layer);
|
void setLayer(int layer);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -20,8 +23,11 @@ protected:
|
||||||
virtual Color getColor2D(double x, double y, double scaling);
|
virtual Color getColor2D(double x, double y, double scaling);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TexturesDefinition* textures;
|
|
||||||
int layer;
|
int layer;
|
||||||
|
TexturesDefinition* textures;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // TEXTURESMIXPREVIEWRENDERER_H
|
|
@ -23,7 +23,8 @@ SOURCES += Base2dPreviewRenderer.cpp \
|
||||||
WaterCoveragePreviewRenderer.cpp \
|
WaterCoveragePreviewRenderer.cpp \
|
||||||
WaterAspectPreviewRenderer.cpp \
|
WaterAspectPreviewRenderer.cpp \
|
||||||
TerrainShapePreviewRenderer.cpp \
|
TerrainShapePreviewRenderer.cpp \
|
||||||
SceneryTopDownPreviewRenderer.cpp
|
SceneryTopDownPreviewRenderer.cpp \
|
||||||
|
TexturesMixPreviewRenderer.cpp
|
||||||
|
|
||||||
HEADERS += Base2dPreviewRenderer.h\
|
HEADERS += Base2dPreviewRenderer.h\
|
||||||
preview_global.h \
|
preview_global.h \
|
||||||
|
@ -37,7 +38,8 @@ HEADERS += Base2dPreviewRenderer.h\
|
||||||
WaterCoveragePreviewRenderer.h \
|
WaterCoveragePreviewRenderer.h \
|
||||||
WaterAspectPreviewRenderer.h \
|
WaterAspectPreviewRenderer.h \
|
||||||
TerrainShapePreviewRenderer.h \
|
TerrainShapePreviewRenderer.h \
|
||||||
SceneryTopDownPreviewRenderer.h
|
SceneryTopDownPreviewRenderer.h \
|
||||||
|
TexturesMixPreviewRenderer.h
|
||||||
|
|
||||||
unix:!symbian {
|
unix:!symbian {
|
||||||
maemo5 {
|
maemo5 {
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace preview {
|
||||||
class WaterCoveragePreviewRenderer;
|
class WaterCoveragePreviewRenderer;
|
||||||
class WaterAspectPreviewRenderer;
|
class WaterAspectPreviewRenderer;
|
||||||
class TerrainShapePreviewRenderer;
|
class TerrainShapePreviewRenderer;
|
||||||
|
class TexturesMixPreviewRenderer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
using namespace paysages::preview;
|
using namespace paysages::preview;
|
||||||
|
|
Loading…
Reference in a new issue