paysages: Fixed noise when adding texture layer.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@308 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-04-27 20:52:05 +00:00 committed by ThunderK
parent cf8be66654
commit fcce20217e
3 changed files with 10 additions and 6 deletions

2
TODO
View file

@ -1,6 +1,4 @@
Technology Preview 2 : 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. - Render tab previews should not rerender when changing render options.
- Compute shadows only once for all textures at a same location. - Compute shadows only once for all textures at a same location.
- Add antialiasing option (pay attention to memory usage). - Add antialiasing option (pay attention to memory usage).

View file

@ -140,7 +140,7 @@ FormTextures::FormTextures(QWidget *parent):
addInputNoise(tr("Surface noise"), _layer.bump_noise); 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 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); 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"), &_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); addInputDouble(tr("Light reflection shininess"), &_layer.material.shininess, 0.0, 20.0, 0.1, 1.0);

View file

@ -113,9 +113,11 @@ TextureLayerDefinition texturesLayerCreateDefinition()
result.zone = zoneCreate(); result.zone = zoneCreate();
result.bump_noise = noiseCreateGenerator(); result.bump_noise = noiseCreateGenerator();
result.bump_height = 0.0; noiseGenerateBaseNoise(result.bump_noise, 102400);
result.bump_scaling = 0.0; noiseAddLevelsSimple(result.bump_noise, 8, 1.0, 1.0);
result.material.base = COLOR_GREEN; result.bump_height = 0.1;
result.bump_scaling = 0.1;
result.material.base = COLOR_WHITE;
result.material.reflection = 0.0; result.material.reflection = 0.0;
result.material.shininess = 0.0; result.material.shininess = 0.0;
@ -139,6 +141,10 @@ void texturesLayerCopyDefinition(TextureLayerDefinition* source, TextureLayerDef
void texturesLayerValidateDefinition(TextureLayerDefinition* definition) void texturesLayerValidateDefinition(TextureLayerDefinition* definition)
{ {
if (definition->bump_scaling < 0.000001)
{
definition->bump_scaling = 0.000001;
}
} }
int texturesGetLayerCount(TexturesDefinition* definition) int texturesGetLayerCount(TexturesDefinition* definition)