[WIP] Texture form previews
This commit is contained in:
parent
f0ed8d4b4a
commit
ec71b09f2e
13 changed files with 174 additions and 136 deletions
|
@ -50,8 +50,6 @@ HEADERS += \
|
||||||
lighting/DialogMaterialEditor.h \
|
lighting/DialogMaterialEditor.h \
|
||||||
lighting/SmallPreviewColor.h \
|
lighting/SmallPreviewColor.h \
|
||||||
lighting/SmallPreviewHues.h \
|
lighting/SmallPreviewHues.h \
|
||||||
textures/PreviewLayerCoverage.h \
|
|
||||||
textures/PreviewLayerLook.h \
|
|
||||||
textures/DialogTexturesLayer.h \
|
textures/DialogTexturesLayer.h \
|
||||||
desktop_global.h \
|
desktop_global.h \
|
||||||
DesktopScenery.h
|
DesktopScenery.h
|
||||||
|
@ -97,8 +95,6 @@ SOURCES += \
|
||||||
lighting/DialogMaterialEditor.cpp \
|
lighting/DialogMaterialEditor.cpp \
|
||||||
lighting/SmallPreviewColor.cpp \
|
lighting/SmallPreviewColor.cpp \
|
||||||
lighting/SmallPreviewHues.cpp \
|
lighting/SmallPreviewHues.cpp \
|
||||||
textures/PreviewLayerCoverage.cpp \
|
|
||||||
textures/PreviewLayerLook.cpp \
|
|
||||||
textures/DialogTexturesLayer.cpp \
|
textures/DialogTexturesLayer.cpp \
|
||||||
DesktopScenery.cpp
|
DesktopScenery.cpp
|
||||||
|
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
#include "PreviewLayerCoverage.h"
|
|
||||||
|
|
||||||
#include "SoftwareRenderer.h"
|
|
||||||
#include "BasePreview.h"
|
|
||||||
|
|
||||||
void PreviewLayerCoverage::setTextures(TexturesDefinition* textures)
|
|
||||||
{
|
|
||||||
this->textures = textures;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreviewLayerCoverage::setLayer(int layer)
|
|
||||||
{
|
|
||||||
this->layer = layer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreviewLayerCoverage::bindEvent(BasePreview* preview)
|
|
||||||
{
|
|
||||||
preview->addOsd(QString("geolocation"));
|
|
||||||
|
|
||||||
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 PreviewLayerCoverage::updateEvent()
|
|
||||||
{
|
|
||||||
if (textures)
|
|
||||||
{
|
|
||||||
//TexturesPreviewLayerCoverage_bind(this, textures);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Color PreviewLayerCoverage::getColor2D(double x, double y, double scaling)
|
|
||||||
{
|
|
||||||
if (textures)
|
|
||||||
{
|
|
||||||
return COLOR_BLACK;
|
|
||||||
//return TexturesPreviewLayerCoverage_getColor(this, x, y, scaling, layer);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return COLOR_BLACK;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
#include "PreviewLayerLook.h"
|
|
||||||
|
|
||||||
#include "SoftwareRenderer.h"
|
|
||||||
#include "BasePreview.h"
|
|
||||||
|
|
||||||
void PreviewLayerLook::setTextures(TexturesDefinition* textures)
|
|
||||||
{
|
|
||||||
this->textures = textures;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreviewLayerLook::setLayer(int layer)
|
|
||||||
{
|
|
||||||
this->layer = layer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreviewLayerLook::bindEvent(BasePreview* preview)
|
|
||||||
{
|
|
||||||
//preview->configHdrToneMapping(true);
|
|
||||||
|
|
||||||
preview->configScaling(0.01, 1.0, 0.01, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreviewLayerLook::updateEvent()
|
|
||||||
{
|
|
||||||
if (textures)
|
|
||||||
{
|
|
||||||
//TexturesPreviewLayerLook_bind(this, textures);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Color PreviewLayerLook::getColor2D(double x, double y, double scaling)
|
|
||||||
{
|
|
||||||
if (textures)
|
|
||||||
{
|
|
||||||
return COLOR_BLACK;
|
|
||||||
//return TexturesPreviewLayerLook_getColor(this, x, y, scaling, layer);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return COLOR_BLACK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
#ifndef EDITING_TEXTURES_PREVIEWLAYERLOOK_H
|
|
||||||
#define EDITING_TEXTURES_PREVIEWLAYERLOOK_H
|
|
||||||
|
|
||||||
#include "desktop_global.h"
|
|
||||||
|
|
||||||
#include "Base2dPreviewRenderer.h"
|
|
||||||
|
|
||||||
class PreviewLayerLook : public Base2dPreviewRenderer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit PreviewLayerLook():
|
|
||||||
Base2dPreviewRenderer(),textures(0){}
|
|
||||||
|
|
||||||
void setTextures(TexturesDefinition* textures);
|
|
||||||
void setLayer(int layer);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void bindEvent(BasePreview* preview);
|
|
||||||
virtual void updateEvent();
|
|
||||||
virtual Color getColor2D(double x, double y, double scaling);
|
|
||||||
|
|
||||||
private:
|
|
||||||
TexturesDefinition* textures;
|
|
||||||
int layer;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -7,10 +7,10 @@
|
||||||
#include "TexturesDefinition.h"
|
#include "TexturesDefinition.h"
|
||||||
#include "TextureLayerDefinition.h"
|
#include "TextureLayerDefinition.h"
|
||||||
#include "previewmaterial.h"
|
#include "previewmaterial.h"
|
||||||
#include "textures/PreviewLayerCoverage.h"
|
|
||||||
#include "textures/PreviewLayerLook.h"
|
|
||||||
#include "TexturesMixPreviewRenderer.h"
|
|
||||||
#include "textures/DialogTexturesLayer.h"
|
#include "textures/DialogTexturesLayer.h"
|
||||||
|
#include "TexturesMixPreviewRenderer.h"
|
||||||
|
#include "TextureLayerCoveragePreviewRenderer.h"
|
||||||
|
#include "TextureLayerAspectPreviewRenderer.h"
|
||||||
|
|
||||||
MainTexturesForm::MainTexturesForm(QWidget *parent) : QWidget(parent), ui(new Ui::MainTexturesForm)
|
MainTexturesForm::MainTexturesForm(QWidget *parent) : QWidget(parent), ui(new Ui::MainTexturesForm)
|
||||||
{
|
{
|
||||||
|
@ -35,11 +35,11 @@ MainTexturesForm::MainTexturesForm(QWidget *parent) : QWidget(parent), ui(new Ui
|
||||||
form_helper->setExploreButton(ui->button_explore);
|
form_helper->setExploreButton(ui->button_explore);
|
||||||
form_helper->setRenderButton(ui->button_render);
|
form_helper->setRenderButton(ui->button_render);
|
||||||
|
|
||||||
preview_layer_coverage = new PreviewLayerCoverage();
|
preview_layer_coverage = new TextureLayerCoveragePreviewRenderer();
|
||||||
preview_layer_coverage->setTextures(textures);
|
preview_layer_coverage->setTextures(textures);
|
||||||
form_helper->addPreview(ui->preview_coverage, preview_layer_coverage);
|
form_helper->addPreview(ui->preview_coverage, preview_layer_coverage);
|
||||||
|
|
||||||
preview_layer_look = new PreviewLayerLook();
|
preview_layer_look = new TextureLayerAspectPreviewRenderer();
|
||||||
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);
|
||||||
|
|
||||||
|
@ -135,6 +135,7 @@ void MainTexturesForm::updateLocalDataFromScenery()
|
||||||
{
|
{
|
||||||
DesktopScenery::getCurrent()->getTextures(textures);
|
DesktopScenery::getCurrent()->getTextures(textures);
|
||||||
|
|
||||||
|
preview_layer_coverage->setTerrain(DesktopScenery::getCurrent()->getTerrain());
|
||||||
preview_cumul->setTerrain(DesktopScenery::getCurrent()->getTerrain());
|
preview_cumul->setTerrain(DesktopScenery::getCurrent()->getTerrain());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,8 @@ private:
|
||||||
TexturesDefinition* textures;
|
TexturesDefinition* textures;
|
||||||
FreeFormHelper* form_helper;
|
FreeFormHelper* form_helper;
|
||||||
FreeLayerHelper* layer_helper;
|
FreeLayerHelper* layer_helper;
|
||||||
PreviewLayerCoverage* preview_layer_coverage;
|
TextureLayerCoveragePreviewRenderer* preview_layer_coverage;
|
||||||
PreviewLayerLook* preview_layer_look;
|
TextureLayerAspectPreviewRenderer* preview_layer_look;
|
||||||
TexturesMixPreviewRenderer* preview_cumul;
|
TexturesMixPreviewRenderer* preview_cumul;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
51
src/render/preview/TextureLayerAspectPreviewRenderer.cpp
Normal file
51
src/render/preview/TextureLayerAspectPreviewRenderer.cpp
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
#include "TextureLayerAspectPreviewRenderer.h"
|
||||||
|
|
||||||
|
#include "Scenery.h"
|
||||||
|
#include "BasePreview.h"
|
||||||
|
#include "TexturesRenderer.h"
|
||||||
|
|
||||||
|
TextureLayerAspectPreviewRenderer::TextureLayerAspectPreviewRenderer():
|
||||||
|
Base2dPreviewRenderer()
|
||||||
|
{
|
||||||
|
textures = NULL;
|
||||||
|
|
||||||
|
render_quality = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextureLayerAspectPreviewRenderer::setTextures(TexturesDefinition* textures)
|
||||||
|
{
|
||||||
|
this->textures = textures;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextureLayerAspectPreviewRenderer::setLayer(int layer)
|
||||||
|
{
|
||||||
|
this->layer = layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextureLayerAspectPreviewRenderer::bindEvent(BasePreview* preview)
|
||||||
|
{
|
||||||
|
preview->addOsd(QString("geolocation"));
|
||||||
|
|
||||||
|
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 TextureLayerAspectPreviewRenderer::updateEvent()
|
||||||
|
{
|
||||||
|
Base2dPreviewRenderer::updateEvent();
|
||||||
|
|
||||||
|
if (textures)
|
||||||
|
{
|
||||||
|
getScenery()->setTextures(textures);
|
||||||
|
}
|
||||||
|
|
||||||
|
disableAtmosphere();
|
||||||
|
disableClouds();
|
||||||
|
}
|
||||||
|
|
||||||
|
Color TextureLayerAspectPreviewRenderer::getColor2D(double x, double y, double)
|
||||||
|
{
|
||||||
|
TexturesRenderer* textures_renderer = getTexturesRenderer();
|
||||||
|
|
||||||
|
return textures_renderer->applyToTerrain(x, y).final_color;
|
||||||
|
}
|
|
@ -1,15 +1,17 @@
|
||||||
#ifndef EDITING_TEXTURES_PREVIEWLAYERCOVERAGE_H
|
#ifndef TEXTURELAYERASPECTPREVIEWRENDERER_H
|
||||||
#define EDITING_TEXTURES_PREVIEWLAYERCOVERAGE_H
|
#define TEXTURELAYERASPECTPREVIEWRENDERER_H
|
||||||
|
|
||||||
#include "desktop_global.h"
|
#include "preview_global.h"
|
||||||
|
|
||||||
#include "Base2dPreviewRenderer.h"
|
#include "Base2dPreviewRenderer.h"
|
||||||
|
|
||||||
class PreviewLayerCoverage : public Base2dPreviewRenderer
|
namespace paysages {
|
||||||
|
namespace preview {
|
||||||
|
|
||||||
|
class PREVIEWSHARED_EXPORT TextureLayerAspectPreviewRenderer: public Base2dPreviewRenderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit PreviewLayerCoverage():
|
TextureLayerAspectPreviewRenderer();
|
||||||
Base2dPreviewRenderer(),textures(0){}
|
|
||||||
|
|
||||||
void setTextures(TexturesDefinition* textures);
|
void setTextures(TexturesDefinition* textures);
|
||||||
void setLayer(int layer);
|
void setLayer(int layer);
|
||||||
|
@ -24,4 +26,7 @@ private:
|
||||||
int layer;
|
int layer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // TEXTURELAYERASPECTPREVIEWRENDERER_H
|
59
src/render/preview/TextureLayerCoveragePreviewRenderer.cpp
Normal file
59
src/render/preview/TextureLayerCoveragePreviewRenderer.cpp
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
#include "TextureLayerCoveragePreviewRenderer.h"
|
||||||
|
|
||||||
|
#include "Scenery.h"
|
||||||
|
#include "BasePreview.h"
|
||||||
|
#include "TexturesRenderer.h"
|
||||||
|
|
||||||
|
TextureLayerCoveragePreviewRenderer::TextureLayerCoveragePreviewRenderer():
|
||||||
|
Base2dPreviewRenderer()
|
||||||
|
{
|
||||||
|
textures = NULL;
|
||||||
|
|
||||||
|
render_quality = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextureLayerCoveragePreviewRenderer::setTextures(TexturesDefinition* textures)
|
||||||
|
{
|
||||||
|
this->textures = textures;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextureLayerCoveragePreviewRenderer::setTerrain(TerrainDefinition *terrain)
|
||||||
|
{
|
||||||
|
getScenery()->setTerrain(terrain);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextureLayerCoveragePreviewRenderer::setLayer(int layer)
|
||||||
|
{
|
||||||
|
this->layer = layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextureLayerCoveragePreviewRenderer::bindEvent(BasePreview* preview)
|
||||||
|
{
|
||||||
|
preview->addOsd(QString("geolocation"));
|
||||||
|
|
||||||
|
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 TextureLayerCoveragePreviewRenderer::updateEvent()
|
||||||
|
{
|
||||||
|
Base2dPreviewRenderer::updateEvent();
|
||||||
|
|
||||||
|
if (textures)
|
||||||
|
{
|
||||||
|
getScenery()->setTextures(textures);
|
||||||
|
}
|
||||||
|
|
||||||
|
disableAtmosphere();
|
||||||
|
disableClouds();
|
||||||
|
}
|
||||||
|
|
||||||
|
Color TextureLayerCoveragePreviewRenderer::getColor2D(double x, double y, double)
|
||||||
|
{
|
||||||
|
TexturesRenderer* textures_renderer = getTexturesRenderer();
|
||||||
|
TerrainRenderer* terrain_renderer = getTerrainRenderer();
|
||||||
|
|
||||||
|
double presence = textures_renderer->getBasePresence(layer, terrain_renderer->getResult(x, y, 1, 0));
|
||||||
|
|
||||||
|
return Color(presence, presence, presence);
|
||||||
|
}
|
33
src/render/preview/TextureLayerCoveragePreviewRenderer.h
Normal file
33
src/render/preview/TextureLayerCoveragePreviewRenderer.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#ifndef TEXTURELAYERCOVERAGEPREVIEWRENDERER_H
|
||||||
|
#define TEXTURELAYERCOVERAGEPREVIEWRENDERER_H
|
||||||
|
|
||||||
|
#include "preview_global.h"
|
||||||
|
|
||||||
|
#include "Base2dPreviewRenderer.h"
|
||||||
|
|
||||||
|
namespace paysages {
|
||||||
|
namespace preview {
|
||||||
|
|
||||||
|
class PREVIEWSHARED_EXPORT TextureLayerCoveragePreviewRenderer: public Base2dPreviewRenderer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TextureLayerCoveragePreviewRenderer();
|
||||||
|
|
||||||
|
void setTextures(TexturesDefinition* textures);
|
||||||
|
void setTerrain(TerrainDefinition* terrain);
|
||||||
|
void setLayer(int layer);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void bindEvent(BasePreview* preview);
|
||||||
|
virtual void updateEvent();
|
||||||
|
virtual Color getColor2D(double x, double y, double scaling);
|
||||||
|
|
||||||
|
private:
|
||||||
|
TexturesDefinition* textures;
|
||||||
|
int layer;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // TEXTURELAYERCOVERAGEPREVIEWRENDERER_H
|
|
@ -18,9 +18,9 @@ public:
|
||||||
void setLayer(int layer);
|
void setLayer(int layer);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void bindEvent(BasePreview* preview);
|
virtual void bindEvent(BasePreview* preview) override;
|
||||||
virtual void updateEvent();
|
virtual void updateEvent() override;
|
||||||
virtual Color getColor2D(double x, double y, double scaling);
|
virtual Color getColor2D(double x, double y, double scaling) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int layer;
|
int layer;
|
||||||
|
|
|
@ -24,7 +24,9 @@ SOURCES += Base2dPreviewRenderer.cpp \
|
||||||
WaterAspectPreviewRenderer.cpp \
|
WaterAspectPreviewRenderer.cpp \
|
||||||
TerrainShapePreviewRenderer.cpp \
|
TerrainShapePreviewRenderer.cpp \
|
||||||
SceneryTopDownPreviewRenderer.cpp \
|
SceneryTopDownPreviewRenderer.cpp \
|
||||||
TexturesMixPreviewRenderer.cpp
|
TexturesMixPreviewRenderer.cpp \
|
||||||
|
TextureLayerCoveragePreviewRenderer.cpp \
|
||||||
|
TextureLayerAspectPreviewRenderer.cpp
|
||||||
|
|
||||||
HEADERS += Base2dPreviewRenderer.h\
|
HEADERS += Base2dPreviewRenderer.h\
|
||||||
preview_global.h \
|
preview_global.h \
|
||||||
|
@ -39,7 +41,9 @@ HEADERS += Base2dPreviewRenderer.h\
|
||||||
WaterAspectPreviewRenderer.h \
|
WaterAspectPreviewRenderer.h \
|
||||||
TerrainShapePreviewRenderer.h \
|
TerrainShapePreviewRenderer.h \
|
||||||
SceneryTopDownPreviewRenderer.h \
|
SceneryTopDownPreviewRenderer.h \
|
||||||
TexturesMixPreviewRenderer.h
|
TexturesMixPreviewRenderer.h \
|
||||||
|
TextureLayerCoveragePreviewRenderer.h \
|
||||||
|
TextureLayerAspectPreviewRenderer.h
|
||||||
|
|
||||||
unix:!symbian {
|
unix:!symbian {
|
||||||
maemo5 {
|
maemo5 {
|
||||||
|
|
|
@ -24,6 +24,8 @@ namespace preview {
|
||||||
class WaterAspectPreviewRenderer;
|
class WaterAspectPreviewRenderer;
|
||||||
class TerrainShapePreviewRenderer;
|
class TerrainShapePreviewRenderer;
|
||||||
class TexturesMixPreviewRenderer;
|
class TexturesMixPreviewRenderer;
|
||||||
|
class TextureLayerCoveragePreviewRenderer;
|
||||||
|
class TextureLayerAspectPreviewRenderer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
using namespace paysages::preview;
|
using namespace paysages::preview;
|
||||||
|
|
Loading…
Reference in a new issue