paysages3d/lib_paysages/terrain/presets.c
2013-01-30 14:30:06 +00:00

28 lines
797 B
C

#include "private.h"
#include <math.h>
/*
* Terrain presets.
*/
void terrainAutoPreset(TerrainDefinition* definition, TerrainPreset preset)
{
int resolution = 8;
switch (preset)
{
case TERRAIN_PRESET_STANDARD:
noiseRandomizeOffsets(definition->_height_noise);
noiseClearLevels(definition->_height_noise);
noiseAddLevelsSimple(definition->_height_noise, resolution, pow(2.0, resolution - 1), -12.5, 12.5);
noiseSetFunctionParams(definition->_height_noise, NOISE_FUNCTION_SIMPLEX, 0.0, 0.0);
definition->scaling = 1.0;
definition->height = 1.0;
definition->shadow_smoothing = 0.03;
break;
default:
;
}
TerrainDefinitionClass.validate(definition);
}