paysages : Small changes.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@398 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-07-23 21:14:26 +00:00 committed by ThunderK
parent fe561c2062
commit 8654276b07
5 changed files with 13 additions and 9 deletions

View file

@ -87,7 +87,7 @@ void heightmapChangeResolution(HeightMap* heightmap, int resolution_x, int resol
} }
} }
double heightmapGetLimits(HeightMap* heightmap, double* ymin, double* ymax) void heightmapGetLimits(HeightMap* heightmap, double* ymin, double* ymax)
{ {
double y; double y;
int i; int i;

View file

@ -32,7 +32,7 @@ void heightmapValidate(HeightMap* heightmap);
void heightmapSave(PackStream* stream, HeightMap* heightmap); void heightmapSave(PackStream* stream, HeightMap* heightmap);
void heightmapLoad(PackStream* stream, HeightMap* heightmap); void heightmapLoad(PackStream* stream, HeightMap* heightmap);
double heightmapGetLimits(HeightMap* heightmap, double* ymin, double* ymax); void heightmapGetLimits(HeightMap* heightmap, double* ymin, double* ymax);
double heightmapGetRawValue(HeightMap* heightmap, double x, double z); double heightmapGetRawValue(HeightMap* heightmap, double x, double z);
double heightmapGetValue(HeightMap* heightmap, double x, double z); double heightmapGetValue(HeightMap* heightmap, double x, double z);

View file

@ -156,7 +156,7 @@ Color terrainLightFilter(TerrainDefinition* definition, Renderer* renderer, Colo
double inc_value, inc_base, inc_factor, height, diff, light_factor, smoothing, length; double inc_value, inc_base, inc_factor, height, diff, light_factor, smoothing, length;
direction_to_light = v3Normalize(direction_to_light); direction_to_light = v3Normalize(direction_to_light);
if (fabs(direction_to_light.x) < 0.0001 && fabs(direction_to_light.z) < 0.0001) if ((fabs(direction_to_light.x) < 0.0001 && fabs(direction_to_light.z) < 0.0001) || definition->height_factor < 0.001)
{ {
return light; return light;
} }

View file

@ -18,9 +18,10 @@ TerrainCanvas* terrainCanvasCreate()
heightmapChangeResolution(&result->height_map, 256, 256); heightmapChangeResolution(&result->height_map, 256, 256);
result->height_factor = 1.0; result->height_factor = 1.0;
result->detail_noise = noiseCreateGenerator(); result->detail_noise = noiseCreateGenerator();
noiseAddLevelsSimple(result->detail_noise, 6, 1.0, 1.0); noiseGenerateBaseNoise(result->detail_noise, 1048576);
result->detail_height_factor = 0.002; noiseAddLevelsSimple(result->detail_noise, 5, 1.0, 1.0);
result->detail_scaling = 0.002; result->detail_height_factor = 0.2;
result->detail_scaling = 0.4;
result->mask.mode = INTEGRATIONMASK_MODE_CIRCLE; result->mask.mode = INTEGRATIONMASK_MODE_CIRCLE;
result->mask.smoothing = 0.1; result->mask.smoothing = 0.1;
@ -107,9 +108,12 @@ void terrainCanvasLoad(PackStream* stream, TerrainCanvas* canvas)
packReadDouble(stream, &canvas->mask.smoothing); packReadDouble(stream, &canvas->mask.smoothing);
} }
double terrainCanvasGetLimits(TerrainCanvas* canvas, double* ymin, double* ymax) void terrainCanvasGetLimits(TerrainCanvas* canvas, double* ymin, double* ymax)
{ {
return heightmapGetLimits(&canvas->height_map, ymin, ymax); double noise_max = noiseGetMaxValue(canvas->detail_noise) * canvas->detail_height_factor;
heightmapGetLimits(&canvas->height_map, ymin, ymax);
*ymin -= noise_max;
*ymax += noise_max;
} }
void terrainCanvasRevertToTerrain(TerrainCanvas* canvas, TerrainDefinition* terrain, int only_masked) void terrainCanvasRevertToTerrain(TerrainCanvas* canvas, TerrainDefinition* terrain, int only_masked)

View file

@ -52,7 +52,7 @@ LayerType terrainCanvasGetLayerType();
void terrainCanvasSave(PackStream* stream, TerrainCanvas* canvas); void terrainCanvasSave(PackStream* stream, TerrainCanvas* canvas);
void terrainCanvasLoad(PackStream* stream, TerrainCanvas* canvas); void terrainCanvasLoad(PackStream* stream, TerrainCanvas* canvas);
double terrainCanvasGetLimits(TerrainCanvas* canvas, double* ymin, double* ymax); void terrainCanvasGetLimits(TerrainCanvas* canvas, double* ymin, double* ymax);
void terrainCanvasRevertToTerrain(TerrainCanvas* canvas, TerrainDefinition* terrain, int only_masked); void terrainCanvasRevertToTerrain(TerrainCanvas* canvas, TerrainDefinition* terrain, int only_masked);
Vector3 terrainCanvasApply(TerrainCanvas* canvas, Vector3 location); Vector3 terrainCanvasApply(TerrainCanvas* canvas, Vector3 location);