From 81a27b1b399c063f7040924b36809276acb5e17b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Thu, 3 Oct 2013 23:27:37 +0200 Subject: [PATCH] Tweaked textures presets --- src/editing/textures/maintexturesform.cpp | 3 +- src/rendering/textures/public.h | 1 + src/rendering/textures/tex_presets.c | 41 +++++++++++++++-------- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/editing/textures/maintexturesform.cpp b/src/editing/textures/maintexturesform.cpp index 2c3612b..1afa935 100644 --- a/src/editing/textures/maintexturesform.cpp +++ b/src/editing/textures/maintexturesform.cpp @@ -43,9 +43,10 @@ MainTexturesForm::MainTexturesForm(QWidget *parent) : QWidget(parent), ui(new Ui preview_cumul->setTextures(textures); form_helper->addPreview(ui->preview_cumul, preview_cumul); + form_helper->addPreset(tr("Complex terrain")); form_helper->addPreset(tr("Rocks with grass")); form_helper->addPreset(tr("Snow covered mountains")); - form_helper->addPreset(tr("Arid canyons")); + //form_helper->addPreset(tr("Arid canyons")); form_helper->setPresetButton(ui->button_preset); connect(form_helper, SIGNAL(presetSelected(int)), this, SLOT(selectPreset(int))); diff --git a/src/rendering/textures/public.h b/src/rendering/textures/public.h index a237399..a2e455d 100644 --- a/src/rendering/textures/public.h +++ b/src/rendering/textures/public.h @@ -22,6 +22,7 @@ typedef enum typedef enum { + TEXTURES_LAYER_PRESET_MUD, TEXTURES_LAYER_PRESET_ROCK, TEXTURES_LAYER_PRESET_GRASS, TEXTURES_LAYER_PRESET_SAND, diff --git a/src/rendering/textures/tex_presets.c b/src/rendering/textures/tex_presets.c index 187115e..ebc5063 100644 --- a/src/rendering/textures/tex_presets.c +++ b/src/rendering/textures/tex_presets.c @@ -5,43 +5,47 @@ void texturesAutoPreset(TexturesDefinition* definition, TexturesPreset preset) TexturesLayerDefinition* layer; layersClear(definition->layers); + layer = layersGetLayer(definition->layers, layersAddLayer(definition->layers, NULL)); + texturesLayerAutoPreset(layer, TEXTURES_LAYER_PRESET_MUD); + layersSetName(definition->layers, 0, "Mud"); + if (preset == TEXTURES_PRESET_FULL) { layer = layersGetLayer(definition->layers, layersAddLayer(definition->layers, NULL)); texturesLayerAutoPreset(layer, TEXTURES_LAYER_PRESET_ROCK); - layersSetName(definition->layers, 0, "Ground"); + layersSetName(definition->layers, 1, "Ground"); layer = layersGetLayer(definition->layers, layersAddLayer(definition->layers, NULL)); texturesLayerAutoPreset(layer, TEXTURES_LAYER_PRESET_GRASS); - layersSetName(definition->layers, 1, "Grass"); + layersSetName(definition->layers, 2, "Grass"); layer = layersGetLayer(definition->layers, layersAddLayer(definition->layers, NULL)); texturesLayerAutoPreset(layer, TEXTURES_LAYER_PRESET_SAND); - layersSetName(definition->layers, 2, "Sand"); + layersSetName(definition->layers, 3, "Sand"); layer = layersGetLayer(definition->layers, layersAddLayer(definition->layers, NULL)); texturesLayerAutoPreset(layer, TEXTURES_LAYER_PRESET_SNOW); - layersSetName(definition->layers, 3, "Snow"); + layersSetName(definition->layers, 4, "Snow"); } else if (preset == TEXTURES_PRESET_IRELAND) { layer = layersGetLayer(definition->layers, layersAddLayer(definition->layers, NULL)); texturesLayerAutoPreset(layer, TEXTURES_LAYER_PRESET_ROCK); - layersSetName(definition->layers, 0, "Ground"); + layersSetName(definition->layers, 1, "Ground"); layer = layersGetLayer(definition->layers, layersAddLayer(definition->layers, NULL)); texturesLayerAutoPreset(layer, TEXTURES_LAYER_PRESET_GRASS); - layersSetName(definition->layers, 1, "Grass"); + layersSetName(definition->layers, 2, "Grass"); } else if (preset == TEXTURES_PRESET_ALPS) { layer = layersGetLayer(definition->layers, layersAddLayer(definition->layers, NULL)); texturesLayerAutoPreset(layer, TEXTURES_LAYER_PRESET_ROCK); - layersSetName(definition->layers, 0, "Ground"); + layersSetName(definition->layers, 1, "Ground"); layer = layersGetLayer(definition->layers, layersAddLayer(definition->layers, NULL)); texturesLayerAutoPreset(layer, TEXTURES_LAYER_PRESET_SNOW); - layersSetName(definition->layers, 1, "Snow"); + layersSetName(definition->layers, 2, "Snow"); } else if (preset == TEXTURES_PRESET_CANYON) { @@ -57,8 +61,17 @@ void texturesLayerAutoPreset(TexturesLayerDefinition* definition, TexturesLayerP zoneClear(definition->terrain_zone); switch (preset) - { +{ + case TEXTURES_LAYER_PRESET_MUD: + definition->displacement_height = 0.05; + definition->displacement_scaling = 3.0; + definition->displacement_offset = 0.0; + definition->material.base = colorToHSL(colorFromValues(0.4, 0.38, 0.35, 1.0)); + definition->material.reflection = 0.003; + definition->material.shininess = 4.0; + break; case TEXTURES_LAYER_PRESET_ROCK: + zoneAddHeightRangeQuick(definition->terrain_zone, 1.0, 0.5, 0.55, 1.0, 1.0); definition->displacement_height = 0.3; definition->displacement_scaling = 2.0; definition->displacement_offset = 0.0; @@ -77,10 +90,10 @@ void texturesLayerAutoPreset(TexturesLayerDefinition* definition, TexturesLayerP definition->material.shininess = 4.0; break; case TEXTURES_LAYER_PRESET_SAND: - zoneAddHeightRangeQuick(definition->terrain_zone, 1.0, 0.48, 0.49, 0.505, 0.51); - zoneAddSlopeRangeQuick(definition->terrain_zone, 1.0, 0.0, 0.0, 0.1, 0.3); - definition->displacement_height = 0.0; - definition->displacement_scaling = 1.0; + zoneAddHeightRangeQuick(definition->terrain_zone, 1.0, 0.498, 0.502, 0.505, 0.51); + zoneAddSlopeRangeQuick(definition->terrain_zone, 1.0, 0.0, 0.0, 0.7, 0.1); + definition->displacement_height = 0.02; + definition->displacement_scaling = 5.0; definition->displacement_offset = 0.0; definition->material.base = colorToHSL(colorFromValues(0.93, 0.9, 0.8, 1.0)); definition->material.reflection = 0.008; @@ -89,7 +102,7 @@ void texturesLayerAutoPreset(TexturesLayerDefinition* definition, TexturesLayerP case TEXTURES_LAYER_PRESET_SNOW: zoneAddHeightRangeQuick(definition->terrain_zone, 1.0, 0.77, 0.85, 1.0, 1.0); zoneAddSlopeRangeQuick(definition->terrain_zone, 1.0, 0.0, 0.0, 0.2, 1.0); - definition->displacement_height = 0.0; + definition->displacement_height = 0.1; definition->displacement_scaling = 1.0; definition->displacement_offset = 0.0; definition->material.base = colorToHSL(colorFromValues(1.0, 1.0, 1.0, 1.0));