2013-11-16 18:12:42 +00:00
|
|
|
#include "TexturesDefinition.h"
|
|
|
|
|
|
|
|
#include "TextureLayerDefinition.h"
|
|
|
|
|
|
|
|
static BaseDefinition* _layer_constructor(Layers* parent)
|
|
|
|
{
|
|
|
|
return new TextureLayerDefinition(parent);
|
|
|
|
}
|
|
|
|
|
2015-08-12 15:02:27 +00:00
|
|
|
TexturesDefinition::TexturesDefinition(BaseDefinition *parent):
|
|
|
|
Layers(parent, "textures", _layer_constructor)
|
2013-11-16 18:12:42 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void TexturesDefinition::applyPreset(TexturesPreset preset)
|
|
|
|
{
|
|
|
|
TextureLayerDefinition* layer;
|
|
|
|
clear();
|
|
|
|
|
|
|
|
layer = getTextureLayer(addLayer());
|
|
|
|
layer->applyPreset(TextureLayerDefinition::TEXTURES_LAYER_PRESET_MUD);
|
|
|
|
layer->setName("Mud");
|
|
|
|
|
|
|
|
if (preset == TEXTURES_PRESET_FULL)
|
|
|
|
{
|
|
|
|
layer = getTextureLayer(addLayer());
|
|
|
|
layer->applyPreset(TextureLayerDefinition::TEXTURES_LAYER_PRESET_ROCK);
|
|
|
|
layer->setName("Ground");
|
|
|
|
|
|
|
|
layer = getTextureLayer(addLayer());
|
|
|
|
layer->applyPreset(TextureLayerDefinition::TEXTURES_LAYER_PRESET_GRASS);
|
|
|
|
layer->setName("Grass");
|
|
|
|
|
|
|
|
layer = getTextureLayer(addLayer());
|
|
|
|
layer->applyPreset(TextureLayerDefinition::TEXTURES_LAYER_PRESET_SAND);
|
|
|
|
layer->setName("Sand");
|
|
|
|
|
|
|
|
layer = getTextureLayer(addLayer());
|
|
|
|
layer->applyPreset(TextureLayerDefinition::TEXTURES_LAYER_PRESET_SNOW);
|
|
|
|
layer->setName("Snow");
|
|
|
|
}
|
|
|
|
else if (preset == TEXTURES_PRESET_IRELAND)
|
|
|
|
{
|
|
|
|
layer = getTextureLayer(addLayer());
|
|
|
|
layer->applyPreset(TextureLayerDefinition::TEXTURES_LAYER_PRESET_ROCK);
|
|
|
|
layer->setName("Ground");
|
|
|
|
|
|
|
|
layer = getTextureLayer(addLayer());
|
|
|
|
layer->applyPreset(TextureLayerDefinition::TEXTURES_LAYER_PRESET_GRASS);
|
|
|
|
layer->setName("Grass");
|
|
|
|
}
|
|
|
|
else if (preset == TEXTURES_PRESET_ALPS)
|
|
|
|
{
|
|
|
|
layer = getTextureLayer(addLayer());
|
|
|
|
layer->applyPreset(TextureLayerDefinition::TEXTURES_LAYER_PRESET_ROCK);
|
|
|
|
layer->setName("Ground");
|
|
|
|
|
|
|
|
layer = getTextureLayer(addLayer());
|
|
|
|
layer->applyPreset(TextureLayerDefinition::TEXTURES_LAYER_PRESET_SNOW);
|
|
|
|
layer->setName("Snow");
|
|
|
|
}
|
|
|
|
else if (preset == TEXTURES_PRESET_CANYON)
|
|
|
|
{
|
|
|
|
/* TODO */
|
|
|
|
}
|
|
|
|
}
|
2013-12-29 13:14:49 +00:00
|
|
|
|
|
|
|
double TexturesDefinition::getMaximalDisplacement()
|
|
|
|
{
|
|
|
|
double result = 0.0;
|
|
|
|
int n = count();
|
|
|
|
for (int i = 0; i < n; i++)
|
|
|
|
{
|
|
|
|
result += getTextureLayer(i)->displacement_height;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|