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. --- .../Modules/World/Terrain/PaintBrushes/FlattenSphere.cs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs') diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs index dee455f..0c4e3de 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs @@ -39,21 +39,16 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes strength = TerrainUtil.MetersToSphericalStrength(strength); int x, y; - double[,] tweak = new double[map.Width,map.Height]; - - double area = strength; - double step = strength / 4.0; double sum = 0.0; double step2 = 0.0; - double avg = 0.0; // compute delta map for (x = 0; x < map.Width; x++) { for (y = 0; y < map.Height; y++) { - double z = SphericalFactor(x, y, rx, ry, strength); + double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); if (z > 0) // add in non-zero amount { @@ -63,14 +58,14 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes } } - avg = sum / step2; + double avg = sum / step2; // blend in map for (x = 0; x < map.Width; x++) { for (y = 0; y < map.Height; y++) { - double z = SphericalFactor(x, y, rx, ry, strength) * duration; + double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration; if (z > 0) // add in non-zero amount { @@ -84,11 +79,5 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes } #endregion - - private double SphericalFactor(double x, double y, double rx, double ry, double size) - { - double z = size * size - ((x - rx) * (x - rx) + (y - ry) * (y - ry)); - return z; - } } } \ No newline at end of file -- cgit v1.1