2012-01-24 13:16:20 +00:00
|
|
|
#include "auto.h"
|
|
|
|
|
2011-12-10 13:25:22 +00:00
|
|
|
#include <math.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
#include "clouds.h"
|
2012-01-29 17:39:56 +00:00
|
|
|
#include "render.h"
|
2012-01-03 15:40:50 +00:00
|
|
|
#include "textures.h"
|
2012-01-23 23:45:33 +00:00
|
|
|
#include "scenery.h"
|
2012-01-29 17:39:56 +00:00
|
|
|
#include "system.h"
|
|
|
|
#include "water.h"
|
|
|
|
#include "zone.h"
|
2011-12-10 13:25:22 +00:00
|
|
|
|
|
|
|
void autoGenRealisticLandscape(int seed)
|
|
|
|
{
|
|
|
|
WaterDefinition water;
|
2012-01-23 23:45:33 +00:00
|
|
|
CloudsDefinition clouds;
|
|
|
|
TexturesDefinition textures;
|
|
|
|
TextureLayerDefinition* texture;
|
2012-08-26 13:06:42 +00:00
|
|
|
int layer;
|
2011-12-10 13:25:22 +00:00
|
|
|
|
|
|
|
if (!seed)
|
|
|
|
{
|
|
|
|
seed = time(NULL);
|
|
|
|
}
|
|
|
|
srand(seed);
|
|
|
|
|
|
|
|
/* Cloud layer */
|
2012-01-23 23:45:33 +00:00
|
|
|
clouds = cloudsCreateDefinition();
|
2012-08-26 13:36:46 +00:00
|
|
|
layersAddLayer(clouds.layers, NULL);
|
2012-01-23 23:45:33 +00:00
|
|
|
scenerySetClouds(&clouds);
|
2012-01-26 18:20:19 +00:00
|
|
|
cloudsDeleteDefinition(&clouds);
|
2011-12-17 10:55:37 +00:00
|
|
|
|
2011-12-10 13:25:22 +00:00
|
|
|
/* Water */
|
2012-01-23 23:45:33 +00:00
|
|
|
water = waterCreateDefinition();
|
2012-11-24 12:30:51 +00:00
|
|
|
waterAutoPreset(&water, WATER_PRESET_LAKE);
|
2012-01-23 23:45:33 +00:00
|
|
|
scenerySetWater(&water);
|
|
|
|
waterDeleteDefinition(&water);
|
2011-12-10 13:25:22 +00:00
|
|
|
|
2012-01-22 18:39:42 +00:00
|
|
|
/* Textures */
|
2012-01-23 23:45:33 +00:00
|
|
|
textures = texturesCreateDefinition();
|
2012-08-26 13:06:42 +00:00
|
|
|
layer = layersAddLayer(textures.layers, NULL);
|
|
|
|
layersSetName(textures.layers, layer, "Ground");
|
|
|
|
texture = layersGetLayer(textures.layers, layer);
|
2012-05-13 19:16:00 +00:00
|
|
|
noiseClearLevels(texture->bump_noise);
|
2012-04-09 08:33:13 +00:00
|
|
|
noiseAddLevelsSimple(texture->bump_noise, 8, 1.0, 1.0);
|
2012-05-05 22:07:02 +00:00
|
|
|
texture->bump_height = 0.01;
|
2012-08-26 20:02:10 +00:00
|
|
|
texture->bump_scaling = 0.045;
|
2012-04-03 19:33:40 +00:00
|
|
|
texture->material.base.r = 0.6;
|
|
|
|
texture->material.base.g = 0.55;
|
|
|
|
texture->material.base.b = 0.57;
|
2012-04-05 16:16:32 +00:00
|
|
|
texture->material.reflection = 0.2;
|
|
|
|
texture->material.shininess = 3.0;
|
2012-05-05 22:07:02 +00:00
|
|
|
texture->thickness = 0.001;
|
|
|
|
texture->slope_range = 0.001;
|
2012-05-06 08:49:12 +00:00
|
|
|
texture->thickness_transparency = 0.0;
|
2012-08-26 13:06:42 +00:00
|
|
|
layer = layersAddLayer(textures.layers, NULL);
|
|
|
|
layersSetName(textures.layers, layer, "Grass");
|
|
|
|
texture = layersGetLayer(textures.layers, layer);
|
2012-05-09 21:11:23 +00:00
|
|
|
zoneAddHeightRangeQuick(texture->zone, 1.0, -6.0, -5.0, 3.0, 15.0);
|
|
|
|
zoneAddSlopeRangeQuick(texture->zone, 1.0, 0.0, 0.0, 0.05, 0.4);
|
2012-05-13 19:16:00 +00:00
|
|
|
noiseClearLevels(texture->bump_noise);
|
2012-04-09 19:58:08 +00:00
|
|
|
noiseAddLevelsSimple(texture->bump_noise, 5, 1.0, 0.4);
|
|
|
|
noiseAddLevelsSimple(texture->bump_noise, 2, 0.03, 0.08);
|
2012-05-05 22:07:02 +00:00
|
|
|
texture->bump_height = 0.002;
|
2012-08-26 20:02:10 +00:00
|
|
|
texture->bump_scaling = 0.03;
|
2012-04-09 19:58:08 +00:00
|
|
|
texture->material.base.r = 0.12;
|
|
|
|
texture->material.base.g = 0.19;
|
|
|
|
texture->material.base.b = 0.035;
|
2012-08-26 20:02:10 +00:00
|
|
|
texture->material.reflection = 0.03;
|
2012-04-05 16:16:32 +00:00
|
|
|
texture->material.shininess = 2.0;
|
2012-05-05 22:07:02 +00:00
|
|
|
texture->thickness = 0.02;
|
|
|
|
texture->slope_range = 0.03;
|
2012-05-06 08:49:12 +00:00
|
|
|
texture->thickness_transparency = 0.005;
|
2012-05-07 08:56:22 +00:00
|
|
|
/*texture = texturesGetLayer(&textures, texturesAddLayer(&textures));
|
2012-05-05 22:07:02 +00:00
|
|
|
zoneAddHeightRangeQuick(texture->zone, 1.0, 4.0, 5.0, 100.0, 100.0);
|
|
|
|
zoneAddSlopeRangeQuick(texture->zone, 1.0, 0.0, 0.0, 0.2, 1.0);
|
2012-01-23 23:45:33 +00:00
|
|
|
noiseGenerateBaseNoise(texture->bump_noise, 102400);
|
2012-05-13 19:16:00 +00:00
|
|
|
noiseClearLevels(texture->bump_noise);
|
2012-05-05 22:07:02 +00:00
|
|
|
noiseAddLevelsSimple(texture->bump_noise, 6, 1.0, 1.0);
|
|
|
|
texture->bump_height = 0.002;
|
|
|
|
texture->bump_scaling = 0.03;
|
|
|
|
texture->material.base.r = 1.0;
|
|
|
|
texture->material.base.g = 1.0;
|
|
|
|
texture->material.base.b = 1.0;
|
|
|
|
texture->material.reflection = 0.25;
|
|
|
|
texture->material.shininess = 0.6;
|
|
|
|
texture->thickness = 0.05;
|
|
|
|
texture->slope_range = 0.3;
|
2012-05-07 08:56:22 +00:00
|
|
|
texture->thickness_transparency = 0.015;*/
|
2012-01-23 23:45:33 +00:00
|
|
|
scenerySetTextures(&textures);
|
|
|
|
texturesDeleteDefinition(&textures);
|
2011-12-17 10:55:37 +00:00
|
|
|
|
2012-01-24 15:47:49 +00:00
|
|
|
/* Atmosphere */
|
2012-11-25 21:53:01 +00:00
|
|
|
/*atmosphere = atmosphereCreateDefinition();
|
2012-01-24 15:47:49 +00:00
|
|
|
atmosphere.distance_near = 20.0;
|
|
|
|
atmosphere.distance_far = 100.0;
|
|
|
|
atmosphere.full_mask = 0.6;
|
|
|
|
atmosphere.auto_lock_on_haze = 1;
|
|
|
|
scenerySetAtmosphere(&atmosphere);
|
2012-11-25 21:53:01 +00:00
|
|
|
atmosphereDeleteDefinition(&atmosphere);*/
|
2011-12-10 13:25:22 +00:00
|
|
|
}
|