diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs | 8 |
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 | } |