aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.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/PaintBrushes/FlattenSphere.cs
parent* Refactor: Move MoveFolder() and PurgeFolder() into CachedUserInfo (which ar... (diff)
downloadopensim-SC_OLD-87b313792821cb842fd54b568302b6877c4e53f8.zip
opensim-SC_OLD-87b313792821cb842fd54b568302b6877c4e53f8.tar.gz
opensim-SC_OLD-87b313792821cb842fd54b568302b6877c4e53f8.tar.bz2
opensim-SC_OLD-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 '')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs17
1 files changed, 3 insertions, 14 deletions
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
39 strength = TerrainUtil.MetersToSphericalStrength(strength); 39 strength = TerrainUtil.MetersToSphericalStrength(strength);
40 40
41 int x, y; 41 int x, y;
42 double[,] tweak = new double[map.Width,map.Height];
43
44 double area = strength;
45 double step = strength / 4.0;
46 42
47 double sum = 0.0; 43 double sum = 0.0;
48 double step2 = 0.0; 44 double step2 = 0.0;
49 double avg = 0.0;
50 45
51 // compute delta map 46 // compute delta map
52 for (x = 0; x < map.Width; x++) 47 for (x = 0; x < map.Width; x++)
53 { 48 {
54 for (y = 0; y < map.Height; y++) 49 for (y = 0; y < map.Height; y++)
55 { 50 {
56 double z = SphericalFactor(x, y, rx, ry, strength); 51 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
57 52
58 if (z > 0) // add in non-zero amount 53 if (z > 0) // add in non-zero amount
59 { 54 {
@@ -63,14 +58,14 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
63 } 58 }
64 } 59 }
65 60
66 avg = sum / step2; 61 double avg = sum / step2;
67 62
68 // blend in map 63 // blend in map
69 for (x = 0; x < map.Width; x++) 64 for (x = 0; x < map.Width; x++)
70 { 65 {
71 for (y = 0; y < map.Height; y++) 66 for (y = 0; y < map.Height; y++)
72 { 67 {
73 double z = SphericalFactor(x, y, rx, ry, strength) * duration; 68 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration;
74 69
75 if (z > 0) // add in non-zero amount 70 if (z > 0) // add in non-zero amount
76 { 71 {
@@ -84,11 +79,5 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
84 } 79 }
85 80
86 #endregion 81 #endregion
87
88 private double SphericalFactor(double x, double y, double rx, double ry, double size)
89 {
90 double z = size * size - ((x - rx) * (x - rx) + (y - ry) * (y - ry));
91 return z;
92 }
93 } 82 }
94} \ No newline at end of file 83} \ No newline at end of file