From 87b313792821cb842fd54b568302b6877c4e53f8 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sat, 3 May 2008 20:00:35 +0000 Subject: * Cleaned up code in Terrain, Tree and Map modules. * Fixed a bug with Terragen loader where it would do bad things on a non 256x256 sized terrain. Now loads the array correctly. * Moved MapImageModule.cs to Modules/World/WorldMap * Changed Location.RegionHandle to use Helpers.GetUlong instead of doing it ourselves. --- OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs') diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs index daef6bd..4cb828e 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs @@ -56,7 +56,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain if (y < 0.0) y = 0.0; - int stepSize = 1; + const int stepSize = 1; double h00 = map[(int) x, (int) y]; double h10 = map[(int) x + stepSize, (int) y]; double h01 = map[(int) x, (int) y + stepSize]; @@ -116,14 +116,12 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain public static double PerlinNoise2D(double x, double y, int octaves, double persistence) { - double frequency = 0.0; - double amplitude = 0.0; double total = 0.0; for (int i = 0; i < octaves; i++) { - frequency = Math.Pow(2, i); - amplitude = Math.Pow(persistence, i); + double frequency = Math.Pow(2, i); + double amplitude = Math.Pow(persistence, i); total += InterpolatedNoise(x * frequency, y * frequency) * amplitude; } -- cgit v1.1