aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-05-03 20:00:35 +0000
committerAdam Frisby2008-05-03 20:00:35 +0000
commit87b313792821cb842fd54b568302b6877c4e53f8 (patch)
tree446719156d1e8d8c12bc3bcd69546f04ba0d79ab /OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs
parent* Refactor: Move MoveFolder() and PurgeFolder() into CachedUserInfo (which ar... (diff)
downloadopensim-SC-87b313792821cb842fd54b568302b6877c4e53f8.zip
opensim-SC-87b313792821cb842fd54b568302b6877c4e53f8.tar.gz
opensim-SC-87b313792821cb842fd54b568302b6877c4e53f8.tar.bz2
opensim-SC-87b313792821cb842fd54b568302b6877c4e53f8.tar.xz
* 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.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs8
1 files changed, 3 insertions, 5 deletions
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
56 if (y < 0.0) 56 if (y < 0.0)
57 y = 0.0; 57 y = 0.0;
58 58
59 int stepSize = 1; 59 const int stepSize = 1;
60 double h00 = map[(int) x, (int) y]; 60 double h00 = map[(int) x, (int) y];
61 double h10 = map[(int) x + stepSize, (int) y]; 61 double h10 = map[(int) x + stepSize, (int) y];
62 double h01 = map[(int) x, (int) y + stepSize]; 62 double h01 = map[(int) x, (int) y + stepSize];
@@ -116,14 +116,12 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
116 116
117 public static double PerlinNoise2D(double x, double y, int octaves, double persistence) 117 public static double PerlinNoise2D(double x, double y, int octaves, double persistence)
118 { 118 {
119 double frequency = 0.0;
120 double amplitude = 0.0;
121 double total = 0.0; 119 double total = 0.0;
122 120
123 for (int i = 0; i < octaves; i++) 121 for (int i = 0; i < octaves; i++)
124 { 122 {
125 frequency = Math.Pow(2, i); 123 double frequency = Math.Pow(2, i);
126 amplitude = Math.Pow(persistence, i); 124 double amplitude = Math.Pow(persistence, i);
127 125
128 total += InterpolatedNoise(x * frequency, y * frequency) * amplitude; 126 total += InterpolatedNoise(x * frequency, y * frequency) * amplitude;
129 } 127 }