paysages: Textures form (WIP).
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@285 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
a7e1c8e5d8
commit
b831dd717f
9 changed files with 175 additions and 37 deletions
2
TODO
2
TODO
|
@ -1,5 +1,7 @@
|
||||||
- Implement scaling and scrolling on previews.
|
- Implement scaling and scrolling on previews.
|
||||||
|
- Add a material editor dialog.
|
||||||
- Replace FILE* by a custom type for Save and Load.
|
- Replace FILE* by a custom type for Save and Load.
|
||||||
- Water and terrain LOD moves with the camera, fix it like in the wanderer.
|
- Water and terrain LOD moves with the camera, fix it like in the wanderer.
|
||||||
|
- Add a splash screen / about dialog.
|
||||||
- Restore render progress.
|
- Restore render progress.
|
||||||
- Find a licence and apply it.
|
- Find a licence and apply it.
|
||||||
|
|
|
@ -51,6 +51,7 @@ BaseForm::BaseForm(QWidget* parent, bool auto_apply, bool with_layers) : QWidget
|
||||||
|
|
||||||
previews = new QWidget(this);
|
previews = new QWidget(this);
|
||||||
previews->setLayout(new QVBoxLayout());
|
previews->setLayout(new QVBoxLayout());
|
||||||
|
previews->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
|
|
||||||
form = new QWidget(this);
|
form = new QWidget(this);
|
||||||
form->setLayout(new QGridLayout());
|
form->setLayout(new QGridLayout());
|
||||||
|
@ -150,7 +151,12 @@ void BaseForm::layerListChanged()
|
||||||
|
|
||||||
void BaseForm::addPreview(BasePreview* preview, QString label)
|
void BaseForm::addPreview(BasePreview* preview, QString label)
|
||||||
{
|
{
|
||||||
previews->layout()->addWidget(new QLabel(label, previews));
|
QLabel* label_widget;
|
||||||
|
|
||||||
|
label_widget = new QLabel(label, previews);
|
||||||
|
label_widget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
|
||||||
|
|
||||||
|
previews->layout()->addWidget(label_widget);
|
||||||
previews->layout()->addWidget(preview);
|
previews->layout()->addWidget(preview);
|
||||||
|
|
||||||
preview->start();
|
preview->start();
|
||||||
|
|
|
@ -4,23 +4,76 @@
|
||||||
#include "../lib_paysages/scenery.h"
|
#include "../lib_paysages/scenery.h"
|
||||||
|
|
||||||
static TexturesDefinition _definition;
|
static TexturesDefinition _definition;
|
||||||
|
static TextureLayerDefinition _layer;
|
||||||
|
|
||||||
/**************** Previews ****************/
|
/**************** Previews ****************/
|
||||||
|
class PreviewTexturesCoverage:public BasePreview
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PreviewTexturesCoverage(QWidget* parent):BasePreview(parent)
|
||||||
|
{
|
||||||
|
_renderer = rendererCreate();
|
||||||
|
_renderer.render_quality = 3;
|
||||||
|
|
||||||
|
_preview_layer = texturesLayerCreateDefinition();
|
||||||
|
}
|
||||||
|
protected:
|
||||||
|
QColor getColor(double x, double y)
|
||||||
|
{
|
||||||
|
return QColor(0, 0, 0);
|
||||||
|
}
|
||||||
|
void updateData()
|
||||||
|
{
|
||||||
|
texturesLayerCopyDefinition(&_layer, &_preview_layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Renderer _renderer;
|
||||||
|
TextureLayerDefinition _preview_layer;
|
||||||
|
};
|
||||||
|
|
||||||
|
class PreviewTexturesColor:public BasePreview
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PreviewTexturesColor(QWidget* parent):BasePreview(parent)
|
||||||
|
{
|
||||||
|
_renderer = rendererCreate();
|
||||||
|
_renderer.render_quality = 3;
|
||||||
|
|
||||||
|
_preview_layer = texturesLayerCreateDefinition();
|
||||||
|
}
|
||||||
|
protected:
|
||||||
|
QColor getColor(double x, double y)
|
||||||
|
{
|
||||||
|
return QColor(0, 0, 0);
|
||||||
|
}
|
||||||
|
void updateData()
|
||||||
|
{
|
||||||
|
texturesLayerCopyDefinition(&_layer, &_preview_layer);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
Renderer _renderer;
|
||||||
|
TextureLayerDefinition _preview_layer;
|
||||||
|
};
|
||||||
|
|
||||||
/**************** Form ****************/
|
/**************** Form ****************/
|
||||||
FormTextures::FormTextures(QWidget *parent):
|
FormTextures::FormTextures(QWidget *parent):
|
||||||
BaseForm(parent)
|
BaseForm(parent, false, true)
|
||||||
{
|
{
|
||||||
_definition = texturesCreateDefinition();
|
_definition = texturesCreateDefinition();
|
||||||
|
_layer = texturesLayerCreateDefinition();
|
||||||
|
|
||||||
/*previewHeight = new PreviewTerrainHeight(this);
|
previewCoverage = new PreviewTexturesCoverage(this);
|
||||||
previewColor = new PreviewTerrainColor(this);
|
previewColor = new PreviewTexturesColor(this);
|
||||||
addPreview(previewHeight, QString("Height preview (normalized)"));
|
addPreview(previewCoverage, QString("Coverage preview"));
|
||||||
addPreview(previewColor, QString("Textured preview (no shadow)"));*/
|
addPreview(previewColor, QString("Colored preview"));
|
||||||
|
|
||||||
/*addInputNoise("Noise", _definition.height_noise);
|
addInputNoise(tr("Surface noise"), _layer.bump_noise);
|
||||||
addInputDouble("Height", &_definition.height_factor, 0.0, 20.0, 0.1, 1.0);
|
addInputDouble(tr("Surface noise height"), &_layer.bump_height, 0.0, 0.5, 0.001, 0.05);
|
||||||
addInputDouble("Scaling", &_definition.scaling, 1.0, 20.0, 0.1, 1.0);*/
|
addInputDouble(tr("Surface noise scaling"), &_layer.bump_scaling, 0.1, 3.0, 0.01, 0.1);
|
||||||
|
addInputColor(tr("Base color"), &_layer.material.base);
|
||||||
|
addInputDouble(tr("Light reflection"), &_layer.material.reflection, 0.0, 1.0, 0.01, 0.1);
|
||||||
|
addInputDouble(tr("Light reflection shininess"), &_layer.material.shininess, 0.0, 20.0, 0.1, 1.0);
|
||||||
|
|
||||||
revertConfig();
|
revertConfig();
|
||||||
}
|
}
|
||||||
|
@ -28,6 +81,7 @@ FormTextures::FormTextures(QWidget *parent):
|
||||||
void FormTextures::revertConfig()
|
void FormTextures::revertConfig()
|
||||||
{
|
{
|
||||||
sceneryGetTextures(&_definition);
|
sceneryGetTextures(&_definition);
|
||||||
|
setLayerCount(texturesGetLayerCount(&_definition));
|
||||||
BaseForm::revertConfig();
|
BaseForm::revertConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +93,29 @@ void FormTextures::applyConfig()
|
||||||
|
|
||||||
void FormTextures::configChangeEvent()
|
void FormTextures::configChangeEvent()
|
||||||
{
|
{
|
||||||
|
texturesLayerCopyDefinition(&_layer, texturesGetLayer(&_definition, currentLayer()));
|
||||||
texturesValidateDefinition(&_definition);
|
texturesValidateDefinition(&_definition);
|
||||||
BaseForm::configChangeEvent();
|
BaseForm::configChangeEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FormTextures::layerAddedEvent()
|
||||||
|
{
|
||||||
|
if (texturesAddLayer(&_definition) >= 0)
|
||||||
|
{
|
||||||
|
BaseForm::layerAddedEvent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormTextures::layerDeletedEvent(int layer)
|
||||||
|
{
|
||||||
|
texturesDeleteLayer(&_definition, layer);
|
||||||
|
|
||||||
|
BaseForm::layerDeletedEvent(layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormTextures::layerSelectedEvent(int layer)
|
||||||
|
{
|
||||||
|
texturesLayerCopyDefinition(texturesGetLayer(&_definition, layer), &_layer);
|
||||||
|
|
||||||
|
BaseForm::layerSelectedEvent(layer);
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,11 @@ class FormTextures : public BaseForm
|
||||||
public:
|
public:
|
||||||
explicit FormTextures(QWidget *parent = 0);
|
explicit FormTextures(QWidget *parent = 0);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void layerAddedEvent();
|
||||||
|
virtual void layerDeletedEvent(int layer);
|
||||||
|
virtual void layerSelectedEvent(int layer);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void revertConfig();
|
virtual void revertConfig();
|
||||||
virtual void applyConfig();
|
virtual void applyConfig();
|
||||||
|
|
|
@ -19,17 +19,17 @@
|
||||||
<translation>Supprimer un niveau</translation>
|
<translation>Supprimer un niveau</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/baseform.cpp" line="73"/>
|
<location filename="../gui_qt/baseform.cpp" line="74"/>
|
||||||
<source>Apply</source>
|
<source>Apply</source>
|
||||||
<translation>Appliquer</translation>
|
<translation>Appliquer</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/baseform.cpp" line="76"/>
|
<location filename="../gui_qt/baseform.cpp" line="77"/>
|
||||||
<source>Revert</source>
|
<source>Revert</source>
|
||||||
<translation>Annuler les modifications</translation>
|
<translation>Annuler les modifications</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/baseform.cpp" line="239"/>
|
<location filename="../gui_qt/baseform.cpp" line="245"/>
|
||||||
<source>Layer %1</source>
|
<source>Layer %1</source>
|
||||||
<translation>Niveau %1</translation>
|
<translation>Niveau %1</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -474,6 +474,39 @@ Maintenir Ctrl : Plus rapide</translation>
|
||||||
<translation>Echelle</translation>
|
<translation>Echelle</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>FormTextures</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../gui_qt/formtextures.cpp" line="71"/>
|
||||||
|
<source>Surface noise</source>
|
||||||
|
<translation>Bruit de surface</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../gui_qt/formtextures.cpp" line="72"/>
|
||||||
|
<source>Surface noise height</source>
|
||||||
|
<translation>Hauteur du bruit</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../gui_qt/formtextures.cpp" line="73"/>
|
||||||
|
<source>Surface noise scaling</source>
|
||||||
|
<translation>Echelle du bruit</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../gui_qt/formtextures.cpp" line="74"/>
|
||||||
|
<source>Base color</source>
|
||||||
|
<translation>Couleur de base</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../gui_qt/formtextures.cpp" line="75"/>
|
||||||
|
<source>Light reflection</source>
|
||||||
|
<translation>Réflexion de lumière</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../gui_qt/formtextures.cpp" line="76"/>
|
||||||
|
<source>Light reflection shininess</source>
|
||||||
|
<translation>Concentration de la réflexion de lumière</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>FormWater</name>
|
<name>FormWater</name>
|
||||||
<message>
|
<message>
|
||||||
|
|
|
@ -171,18 +171,26 @@ void autoGenRealisticLandscape(int seed)
|
||||||
textures = texturesCreateDefinition();
|
textures = texturesCreateDefinition();
|
||||||
texture = texturesGetLayer(&textures, texturesAddLayer(&textures));
|
texture = texturesGetLayer(&textures, texturesAddLayer(&textures));
|
||||||
noiseGenerateBaseNoise(texture->bump_noise, 102400);
|
noiseGenerateBaseNoise(texture->bump_noise, 102400);
|
||||||
noiseAddLevelsSimple(texture->bump_noise, 6, 0.01, 0.01);
|
noiseAddLevelsSimple(texture->bump_noise, 6, 1.0, 1.0);
|
||||||
texture->color.r = 0.6;
|
texture->bump_height = 0.01;
|
||||||
texture->color.g = 0.55;
|
texture->bump_scaling = 1.0;
|
||||||
texture->color.b = 0.57;
|
texture->material.base.r = 0.6;
|
||||||
|
texture->material.base.g = 0.55;
|
||||||
|
texture->material.base.b = 0.57;
|
||||||
|
texture->material.reflection = 0.4;
|
||||||
|
texture->material.shininess = 0.1;
|
||||||
texture = texturesGetLayer(&textures, texturesAddLayer(&textures));
|
texture = texturesGetLayer(&textures, texturesAddLayer(&textures));
|
||||||
zoneAddHeightRange(texture->zone, 1.0, -1.0, 0.0, 3.0, 15.0);
|
zoneAddHeightRange(texture->zone, 1.0, -1.0, 0.0, 3.0, 15.0);
|
||||||
zoneAddSteepnessRange(texture->zone, 1.0, 0.0, 0.0, 0.2, 0.3);
|
zoneAddSteepnessRange(texture->zone, 1.0, 0.0, 0.0, 0.2, 0.3);
|
||||||
noiseGenerateBaseNoise(texture->bump_noise, 102400);
|
noiseGenerateBaseNoise(texture->bump_noise, 102400);
|
||||||
noiseAddLevelsSimple(texture->bump_noise, 6, 0.02, 0.008);
|
noiseAddLevelsSimple(texture->bump_noise, 6, 1.0, 0.4);
|
||||||
texture->color.r = 0.2;
|
texture->bump_height = 0.02;
|
||||||
texture->color.g = 0.24;
|
texture->bump_scaling = 1.0;
|
||||||
texture->color.b = 0.05;
|
texture->material.base.r = 0.2;
|
||||||
|
texture->material.base.g = 0.24;
|
||||||
|
texture->material.base.b = 0.05;
|
||||||
|
texture->material.reflection = 0.2;
|
||||||
|
texture->material.shininess = 0.02;
|
||||||
/*texture = texturesGetLayer(&textures, texturesAddLayer(&textures));
|
/*texture = texturesGetLayer(&textures, texturesAddLayer(&textures));
|
||||||
zoneAddHeightRange(texture->zone, 1.0, 3.0, 4.0, 100.0, 100.0);
|
zoneAddHeightRange(texture->zone, 1.0, 3.0, 4.0, 100.0, 100.0);
|
||||||
noiseGenerateBaseNoise(texture->bump_noise, 102400);
|
noiseGenerateBaseNoise(texture->bump_noise, 102400);
|
||||||
|
|
|
@ -33,7 +33,7 @@ struct RenderArea
|
||||||
RenderCallbackUpdate callback_update;
|
RenderCallbackUpdate callback_update;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define RENDER_INVERSE 1
|
/*#define RENDER_INVERSE 1*/
|
||||||
#define RENDER_WIREFRAME 1
|
#define RENDER_WIREFRAME 1
|
||||||
|
|
||||||
static void _callbackStart(int width, int height, Color background) {}
|
static void _callbackStart(int width, int height, Color background) {}
|
||||||
|
|
|
@ -34,7 +34,9 @@ void texturesSave(FILE* f, TexturesDefinition* definition)
|
||||||
{
|
{
|
||||||
zoneSave(f, definition->textures[i].zone);
|
zoneSave(f, definition->textures[i].zone);
|
||||||
noiseSaveGenerator(f, definition->textures[i].bump_noise);
|
noiseSaveGenerator(f, definition->textures[i].bump_noise);
|
||||||
colorSave(f, &definition->textures[i].color);
|
toolsSaveDouble(f, &definition->textures[i].bump_height);
|
||||||
|
toolsSaveDouble(f, &definition->textures[i].bump_scaling);
|
||||||
|
materialSave(f, &definition->textures[i].material);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +57,9 @@ void texturesLoad(FILE* f, TexturesDefinition* definition)
|
||||||
|
|
||||||
zoneLoad(f, layer->zone);
|
zoneLoad(f, layer->zone);
|
||||||
noiseLoadGenerator(f, layer->bump_noise);
|
noiseLoadGenerator(f, layer->bump_noise);
|
||||||
colorLoad(f, &layer->color);
|
toolsLoadDouble(f, &layer->bump_height);
|
||||||
|
toolsLoadDouble(f, &layer->bump_scaling);
|
||||||
|
materialLoad(f, &layer->material);
|
||||||
}
|
}
|
||||||
|
|
||||||
texturesValidateDefinition(definition);
|
texturesValidateDefinition(definition);
|
||||||
|
@ -109,7 +113,11 @@ TextureLayerDefinition texturesLayerCreateDefinition()
|
||||||
|
|
||||||
result.zone = zoneCreate();
|
result.zone = zoneCreate();
|
||||||
result.bump_noise = noiseCreateGenerator();
|
result.bump_noise = noiseCreateGenerator();
|
||||||
result.color = COLOR_GREEN;
|
result.bump_height = 0.0;
|
||||||
|
result.bump_scaling = 0.0;
|
||||||
|
result.material.base = COLOR_GREEN;
|
||||||
|
result.material.reflection = 0.0;
|
||||||
|
result.material.shininess = 0.0;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +130,9 @@ void texturesLayerDeleteDefinition(TextureLayerDefinition* definition)
|
||||||
|
|
||||||
void texturesLayerCopyDefinition(TextureLayerDefinition* source, TextureLayerDefinition* destination)
|
void texturesLayerCopyDefinition(TextureLayerDefinition* source, TextureLayerDefinition* destination)
|
||||||
{
|
{
|
||||||
destination->color = source->color;
|
destination->material = source->material;
|
||||||
|
destination->bump_height = source->bump_height;
|
||||||
|
destination->bump_scaling = source->bump_scaling;
|
||||||
noiseCopy(source->bump_noise, destination->bump_noise);
|
noiseCopy(source->bump_noise, destination->bump_noise);
|
||||||
zoneCopy(source->zone, destination->zone);
|
zoneCopy(source->zone, destination->zone);
|
||||||
}
|
}
|
||||||
|
@ -181,17 +191,17 @@ static inline Vector3 _getNormal(TextureLayerDefinition* definition, Renderer* r
|
||||||
|
|
||||||
ref.x = 0.0;
|
ref.x = 0.0;
|
||||||
ref.y = 0.0;
|
ref.y = 0.0;
|
||||||
point.y = renderer->getTerrainHeight(renderer, point.x, point.z) + noiseGet2DTotal(definition->bump_noise, point.x, point.z);
|
point.y = renderer->getTerrainHeight(renderer, point.x, point.z) + noiseGet2DTotal(definition->bump_noise, point.x / definition->bump_scaling, point.z / definition->bump_scaling) * definition->bump_height;
|
||||||
|
|
||||||
dpoint.x = point.x - scale;
|
dpoint.x = point.x - scale;
|
||||||
dpoint.z = point.z;
|
dpoint.z = point.z;
|
||||||
dpoint.y = renderer->getTerrainHeight(renderer, dpoint.x, dpoint.z) + noiseGet2DTotal(definition->bump_noise, dpoint.x, dpoint.z);
|
dpoint.y = renderer->getTerrainHeight(renderer, dpoint.x, dpoint.z) + noiseGet2DTotal(definition->bump_noise, dpoint.x / definition->bump_scaling, dpoint.z / definition->bump_scaling) * definition->bump_height;
|
||||||
ref.z = -1.0;
|
ref.z = -1.0;
|
||||||
normal = v3Normalize(v3Cross(ref, v3Sub(dpoint, point)));
|
normal = v3Normalize(v3Cross(ref, v3Sub(dpoint, point)));
|
||||||
|
|
||||||
dpoint.x = point.x + scale;
|
dpoint.x = point.x + scale;
|
||||||
dpoint.z = point.z;
|
dpoint.z = point.z;
|
||||||
dpoint.y = renderer->getTerrainHeight(renderer, dpoint.x, dpoint.z) + noiseGet2DTotal(definition->bump_noise, dpoint.x, dpoint.z);
|
dpoint.y = renderer->getTerrainHeight(renderer, dpoint.x, dpoint.z) + noiseGet2DTotal(definition->bump_noise, dpoint.x / definition->bump_scaling, dpoint.z / definition->bump_scaling) * definition->bump_height;
|
||||||
ref.z = 1.0;
|
ref.z = 1.0;
|
||||||
normal = v3Add(normal, v3Normalize(v3Cross(ref, v3Sub(dpoint, point))));
|
normal = v3Add(normal, v3Normalize(v3Cross(ref, v3Sub(dpoint, point))));
|
||||||
|
|
||||||
|
@ -199,13 +209,13 @@ static inline Vector3 _getNormal(TextureLayerDefinition* definition, Renderer* r
|
||||||
|
|
||||||
dpoint.x = point.x;
|
dpoint.x = point.x;
|
||||||
dpoint.z = point.z - scale;
|
dpoint.z = point.z - scale;
|
||||||
dpoint.y = renderer->getTerrainHeight(renderer, dpoint.x, dpoint.z) + noiseGet2DTotal(definition->bump_noise, dpoint.x, dpoint.z);
|
dpoint.y = renderer->getTerrainHeight(renderer, dpoint.x, dpoint.z) + noiseGet2DTotal(definition->bump_noise, dpoint.x / definition->bump_scaling, dpoint.z / definition->bump_scaling) * definition->bump_height;
|
||||||
ref.x = 1.0;
|
ref.x = 1.0;
|
||||||
normal = v3Add(normal, v3Normalize(v3Cross(ref, v3Sub(dpoint, point))));
|
normal = v3Add(normal, v3Normalize(v3Cross(ref, v3Sub(dpoint, point))));
|
||||||
|
|
||||||
dpoint.x = point.x;
|
dpoint.x = point.x;
|
||||||
dpoint.z = point.z + scale;
|
dpoint.z = point.z + scale;
|
||||||
dpoint.y = renderer->getTerrainHeight(renderer, dpoint.x, dpoint.z) + noiseGet2DTotal(definition->bump_noise, dpoint.x, dpoint.z);
|
dpoint.y = renderer->getTerrainHeight(renderer, dpoint.x, dpoint.z) + noiseGet2DTotal(definition->bump_noise, dpoint.x / definition->bump_scaling, dpoint.z / definition->bump_scaling) * definition->bump_height;
|
||||||
ref.x = -1.0;
|
ref.x = -1.0;
|
||||||
normal = v3Add(normal, v3Normalize(v3Cross(ref, v3Sub(dpoint, point))));
|
normal = v3Add(normal, v3Normalize(v3Cross(ref, v3Sub(dpoint, point))));
|
||||||
|
|
||||||
|
@ -217,7 +227,6 @@ Color texturesGetLayerColor(TextureLayerDefinition* definition, Renderer* render
|
||||||
Color result;
|
Color result;
|
||||||
Vector3 normal;
|
Vector3 normal;
|
||||||
double coverage;
|
double coverage;
|
||||||
SurfaceMaterial material;
|
|
||||||
|
|
||||||
result = COLOR_TRANSPARENT;
|
result = COLOR_TRANSPARENT;
|
||||||
normal = _getNormal(definition, renderer, location, detail * 0.1);
|
normal = _getNormal(definition, renderer, location, detail * 0.1);
|
||||||
|
@ -225,11 +234,7 @@ Color texturesGetLayerColor(TextureLayerDefinition* definition, Renderer* render
|
||||||
coverage = zoneGetValue(definition->zone, location, normal);
|
coverage = zoneGetValue(definition->zone, location, normal);
|
||||||
if (coverage > 0.0)
|
if (coverage > 0.0)
|
||||||
{
|
{
|
||||||
material.base = definition->color;
|
result = renderer->applyLightingToSurface(renderer, location, normal, definition->material);
|
||||||
material.reflection = 0.1;
|
|
||||||
material.shininess = 4.0;
|
|
||||||
|
|
||||||
result = renderer->applyLightingToSurface(renderer, location, normal, material);
|
|
||||||
result.a = coverage;
|
result.a = coverage;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -16,7 +16,9 @@ typedef struct
|
||||||
{
|
{
|
||||||
Zone* zone;
|
Zone* zone;
|
||||||
NoiseGenerator* bump_noise;
|
NoiseGenerator* bump_noise;
|
||||||
Color color;
|
double bump_scaling;
|
||||||
|
double bump_height;
|
||||||
|
SurfaceMaterial material;
|
||||||
} TextureLayerDefinition;
|
} TextureLayerDefinition;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
Loading…
Reference in a new issue