aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/ErodeSphere.cs28
1 files changed, 19 insertions, 9 deletions
diff --git a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/ErodeSphere.cs b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/ErodeSphere.cs
index d6f666d..2d46fd9 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/ErodeSphere.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/ErodeSphere.cs
@@ -37,9 +37,9 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
37 { 37 {
38 NeighbourSystem type = NeighbourSystem.Moore; // Parameter 38 NeighbourSystem type = NeighbourSystem.Moore; // Parameter
39 39
40 double rainHeight = 1.0; 40 double rainHeight = 0.2;
41 int rounds = 10; 41 int rounds = 10;
42 double waterSaturation = 0.01; // Can carry 1% of water in height 42 double waterSaturation = 0.30; // Can carry 1% of water in height
43 43
44 #region Supporting Functions 44 #region Supporting Functions
45 private enum NeighbourSystem 45 private enum NeighbourSystem
@@ -257,7 +257,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
257 double altitudeNeighbour = water[coords[0], coords[1]] + map[coords[0], coords[1]]; 257 double altitudeNeighbour = water[coords[0], coords[1]] + map[coords[0], coords[1]];
258 258
259 // If it's greater than me... 259 // If it's greater than me...
260 if (altitudeNeighbour - altitudeMe > 0) 260 if (altitudeNeighbour - altitudeMe < 0)
261 { 261 {
262 // Add it to our calculations 262 // Add it to our calculations
263 neighbours++; 263 neighbours++;
@@ -290,13 +290,20 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
290 if (coords[1] < 0) 290 if (coords[1] < 0)
291 continue; 291 continue;
292 292
293 // Skip if we dont have water to begin with.
294 if (water[x, y] < 0)
295 continue;
296
293 // Calculate our delta average 297 // Calculate our delta average
294 double altitudeDelta = altitudeMe - altitudeAvg; 298 double altitudeDelta = altitudeMe - altitudeAvg;
295 299
300 if (altitudeDelta < 0)
301 continue;
302
296 // Calculate how much water we can move 303 // Calculate how much water we can move
297 double waterDelta = Math.Min(water[x, y], altitudeDelta) 304 double waterMin = Math.Min(water[x, y], altitudeDelta);
298 * (water[coords[0], coords[1]] + map[coords[0], coords[1]]) 305 double waterDelta = waterMin * ((water[coords[0], coords[1]] + map[coords[0], coords[1]])
299 / altitudeTotal; 306 / altitudeTotal);
300 307
301 double sedimentDelta = sediment[x, y] * (waterDelta / water[x, y]); 308 double sedimentDelta = sediment[x, y] * (waterDelta / water[x, y]);
302 309
@@ -320,9 +327,12 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
320 327
321 double waterCapacity = waterSaturation * water[x, y]; 328 double waterCapacity = waterSaturation * water[x, y];
322 329
323 double sedimentDeposit = Math.Max(0, sediment[x, y] - waterCapacity); 330 double sedimentDeposit = sediment[x, y] - waterCapacity;
324 sediment[x, y] -= sedimentDeposit; 331 if (sedimentDeposit > 0)
325 map[x, y] += sedimentDeposit; 332 {
333 sediment[x, y] -= sedimentDeposit;
334 map[x, y] += sedimentDeposit;
335 }
326 } 336 }
327 } 337 }
328 } 338 }