2013-03-31 20:27:21 +00:00
|
|
|
#include "private.h"
|
|
|
|
|
|
|
|
void texturesAutoPreset(TexturesDefinition* definition, TexturesPreset preset)
|
|
|
|
{
|
2013-04-12 20:11:29 +00:00
|
|
|
TexturesLayerDefinition* layer;
|
2013-03-31 20:27:21 +00:00
|
|
|
layersClear(definition->layers);
|
|
|
|
|
|
|
|
if (preset == TEXTURES_PRESET_IRELAND)
|
|
|
|
{
|
2013-04-12 20:11:29 +00:00
|
|
|
layer = layersGetLayer(definition->layers, layersAddLayer(definition->layers, NULL));
|
|
|
|
texturesLayerAutoPreset(layer, TEXTURES_LAYER_PRESET_ROCK);
|
|
|
|
layersSetName(definition->layers, 0, "Ground");
|
|
|
|
|
|
|
|
layer = layersGetLayer(definition->layers, layersAddLayer(definition->layers, NULL));
|
|
|
|
texturesLayerAutoPreset(layer, TEXTURES_LAYER_PRESET_GRASS);
|
|
|
|
layersSetName(definition->layers, 1, "Grass");
|
2013-03-31 20:27:21 +00:00
|
|
|
}
|
2013-04-03 20:37:29 +00:00
|
|
|
else if (preset == TEXTURES_PRESET_ALPS)
|
2013-03-31 20:27:21 +00:00
|
|
|
{
|
2013-04-12 20:11:29 +00:00
|
|
|
/* TODO */
|
2013-03-31 20:27:21 +00:00
|
|
|
}
|
2013-04-03 20:37:29 +00:00
|
|
|
else if (preset == TEXTURES_PRESET_CANYON)
|
2013-03-31 20:27:21 +00:00
|
|
|
{
|
2013-04-12 20:11:29 +00:00
|
|
|
/* TODO */
|
2013-03-31 20:27:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void texturesLayerAutoPreset(TexturesLayerDefinition* definition, TexturesLayerPreset preset)
|
|
|
|
{
|
|
|
|
noiseRandomizeOffsets(definition->_displacement_noise);
|
2013-04-12 20:11:29 +00:00
|
|
|
noiseRandomizeOffsets(definition->_detail_noise);
|
|
|
|
|
|
|
|
zoneClear(definition->terrain_zone);
|
2013-03-31 20:27:21 +00:00
|
|
|
|
|
|
|
switch (preset)
|
|
|
|
{
|
|
|
|
case TEXTURES_LAYER_PRESET_ROCK:
|
2013-04-12 20:11:29 +00:00
|
|
|
definition->displacement_height = 0.1;
|
|
|
|
definition->displacement_scaling = 2.0;
|
|
|
|
definition->displacement_offset = 0.0;
|
|
|
|
definition->material.base.r = 0.6;
|
|
|
|
definition->material.base.g = 0.55;
|
|
|
|
definition->material.base.b = 0.57;
|
|
|
|
definition->material.reflection = 0.02;
|
|
|
|
definition->material.shininess = 3.0;
|
2013-03-31 20:27:21 +00:00
|
|
|
break;
|
|
|
|
case TEXTURES_LAYER_PRESET_GRASS:
|
2013-04-12 20:11:29 +00:00
|
|
|
zoneAddHeightRangeQuick(definition->terrain_zone, 1.0, -6.0, -5.0, 3.0, 15.0);
|
|
|
|
zoneAddSlopeRangeQuick(definition->terrain_zone, 1.0, 0.0, 0.0, 0.05, 0.4);
|
|
|
|
definition->displacement_height = 0.0;
|
|
|
|
definition->displacement_scaling = 1.0;
|
|
|
|
definition->displacement_offset = 0.0;
|
|
|
|
definition->material.base.r = 0.12;
|
|
|
|
definition->material.base.g = 0.19;
|
|
|
|
definition->material.base.b = 0.035;
|
|
|
|
definition->material.reflection = 0.003;
|
|
|
|
definition->material.shininess = 2.0;
|
2013-03-31 20:27:21 +00:00
|
|
|
break;
|
|
|
|
case TEXTURES_LAYER_PRESET_SAND:
|
2013-04-12 20:11:29 +00:00
|
|
|
zoneAddHeightRangeQuick(definition->terrain_zone, 1.0, -5.5, -4.5, -4.0, -3.0);
|
|
|
|
zoneAddSlopeRangeQuick(definition->terrain_zone, 1.0, 0.0, 0.0, 0.15, 0.3);
|
|
|
|
definition->displacement_height = 0.0;
|
|
|
|
definition->displacement_scaling = 1.0;
|
|
|
|
definition->displacement_offset = 0.0;
|
|
|
|
definition->material.base.r = 0.30;
|
|
|
|
definition->material.base.g = 0.28;
|
|
|
|
definition->material.base.b = 0.02;
|
|
|
|
definition->material.reflection = 0.008;
|
|
|
|
definition->material.shininess = 6.0;
|
2013-03-31 20:27:21 +00:00
|
|
|
break;
|
|
|
|
case TEXTURES_LAYER_PRESET_SNOW:
|
2013-04-12 20:11:29 +00:00
|
|
|
zoneAddHeightRangeQuick(definition->terrain_zone, 1.0, 4.0, 5.0, 100.0, 100.0);
|
|
|
|
zoneAddSlopeRangeQuick(definition->terrain_zone, 1.0, 0.0, 0.0, 0.2, 1.0);
|
|
|
|
definition->displacement_height = 0.0;
|
|
|
|
definition->displacement_scaling = 1.0;
|
|
|
|
definition->displacement_offset = 0.0;
|
|
|
|
definition->material.base.r = 1.0;
|
|
|
|
definition->material.base.g = 1.0;
|
|
|
|
definition->material.base.b = 1.0;
|
|
|
|
definition->material.reflection = 0.25;
|
|
|
|
definition->material.shininess = 0.6;
|
2013-03-31 20:27:21 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-04-03 20:37:29 +00:00
|
|
|
texturesGetLayerType().callback_validate(definition);
|
2013-03-31 20:27:21 +00:00
|
|
|
}
|