2012-12-09 17:49:28 +00:00
|
|
|
#include "private.h"
|
|
|
|
|
2013-01-19 22:42:50 +00:00
|
|
|
#include <math.h>
|
|
|
|
|
2012-12-09 17:49:28 +00:00
|
|
|
/*
|
|
|
|
* Terrain presets.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void terrainAutoPreset(TerrainDefinition* definition, TerrainPreset preset)
|
|
|
|
{
|
2013-01-14 12:08:38 +00:00
|
|
|
int resolution = 8;
|
2012-12-09 17:49:28 +00:00
|
|
|
switch (preset)
|
|
|
|
{
|
|
|
|
case TERRAIN_PRESET_STANDARD:
|
2013-01-30 14:30:06 +00:00
|
|
|
noiseRandomizeOffsets(definition->_height_noise);
|
2012-12-09 17:49:28 +00:00
|
|
|
noiseClearLevels(definition->_height_noise);
|
2013-01-30 21:36:49 +00:00
|
|
|
noiseAddLevelsSimple(definition->_height_noise, resolution, pow(2.0, resolution - 1), -12.5, 12.5, 0.5);
|
2013-01-27 19:57:43 +00:00
|
|
|
noiseSetFunctionParams(definition->_height_noise, NOISE_FUNCTION_SIMPLEX, 0.0, 0.0);
|
2013-01-14 12:08:38 +00:00
|
|
|
definition->scaling = 1.0;
|
|
|
|
definition->height = 1.0;
|
2012-12-09 17:49:28 +00:00
|
|
|
definition->shadow_smoothing = 0.03;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
TerrainDefinitionClass.validate(definition);
|
|
|
|
}
|