From fcce20217e65756cbabddf235b28194b6aa645bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Fri, 27 Apr 2012 20:52:05 +0000 Subject: [PATCH] paysages: Fixed noise when adding texture layer. git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@308 b1fd45b6-86a6-48da-8261-f70d1f35bdcc --- TODO | 2 -- gui_qt/formtextures.cpp | 2 +- lib_paysages/textures.c | 12 +++++++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index f91f469..3c0ec2c 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,4 @@ Technology Preview 2 : -- When adding a texture layer (and maybe clouds), noise components cannot be used (they are always flat). -- Texture preview is sometimes all black. - Render tab previews should not rerender when changing render options. - Compute shadows only once for all textures at a same location. - Add antialiasing option (pay attention to memory usage). diff --git a/gui_qt/formtextures.cpp b/gui_qt/formtextures.cpp index 14021a9..f700156 100644 --- a/gui_qt/formtextures.cpp +++ b/gui_qt/formtextures.cpp @@ -140,7 +140,7 @@ FormTextures::FormTextures(QWidget *parent): addInputNoise(tr("Surface noise"), _layer.bump_noise); addInputDouble(tr("Surface noise height"), &_layer.bump_height, 0.0, 0.5, 0.001, 0.05); - addInputDouble(tr("Surface noise scaling"), &_layer.bump_scaling, 0.1, 3.0, 0.01, 0.1); + addInputDouble(tr("Surface noise scaling"), &_layer.bump_scaling, 0.01, 1.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); diff --git a/lib_paysages/textures.c b/lib_paysages/textures.c index 00ef187..239b543 100644 --- a/lib_paysages/textures.c +++ b/lib_paysages/textures.c @@ -113,9 +113,11 @@ TextureLayerDefinition texturesLayerCreateDefinition() result.zone = zoneCreate(); result.bump_noise = noiseCreateGenerator(); - result.bump_height = 0.0; - result.bump_scaling = 0.0; - result.material.base = COLOR_GREEN; + noiseGenerateBaseNoise(result.bump_noise, 102400); + noiseAddLevelsSimple(result.bump_noise, 8, 1.0, 1.0); + result.bump_height = 0.1; + result.bump_scaling = 0.1; + result.material.base = COLOR_WHITE; result.material.reflection = 0.0; result.material.shininess = 0.0; @@ -139,6 +141,10 @@ void texturesLayerCopyDefinition(TextureLayerDefinition* source, TextureLayerDef void texturesLayerValidateDefinition(TextureLayerDefinition* definition) { + if (definition->bump_scaling < 0.000001) + { + definition->bump_scaling = 0.000001; + } } int texturesGetLayerCount(TexturesDefinition* definition)