aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs
diff options
context:
space:
mode:
authorDahlia Trimble2009-06-18 23:02:12 +0000
committerDahlia Trimble2009-06-18 23:02:12 +0000
commit00d042f3d18483a5ca54c605d2aa22c6c330e9eb (patch)
treeb9e1522a3b3abf1aa77942d4d2f762d43a16146e /OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs
parentApplied patch from Mantis #3817, which fixes a error when using MSSQL. I don'... (diff)
downloadopensim-SC_OLD-00d042f3d18483a5ca54c605d2aa22c6c330e9eb.zip
opensim-SC_OLD-00d042f3d18483a5ca54c605d2aa22c6c330e9eb.tar.gz
opensim-SC_OLD-00d042f3d18483a5ca54c605d2aa22c6c330e9eb.tar.bz2
opensim-SC_OLD-00d042f3d18483a5ca54c605d2aa22c6c330e9eb.tar.xz
Thanks Michelle Argus for Mantis #0003742: Terrain editor - Flatten tool lowers Land
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs53
1 files changed, 17 insertions, 36 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs
index 2fa0c3f..9aa3dff 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs
@@ -41,34 +41,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes
41 41
42 int x, y; 42 int x, y;
43 43
44 duration = 0.009; //MCP Should be read from ini file
45
46 // Disabled - just use the client value.
47 /*
48 if (rz < 0) {
49 double sum = 0.0;
50 double step2 = 0.0;
51
52
53 // compute delta map
54 for (x = 0; x < map.Width; x++)
55 {
56 for (y = 0; y < map.Height; y++)
57 {
58 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
59
60 if (z > 0) // add in non-zero amount
61 {
62 sum += map[x, y] * z;
63 step2 += z;
64 }
65 }
66 }
67 rz = sum / step2;
68 }
69 */
70
71
72 // blend in map 44 // blend in map
73 for (x = 0; x < map.Width; x++) 45 for (x = 0; x < map.Width; x++)
74 { 46 {
@@ -77,19 +49,28 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes
77 if (!mask[x,y]) 49 if (!mask[x,y])
78 continue; 50 continue;
79 51
80 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration; 52 double z;
81 53 if (duration < 4.0)
82 if (z > 0) // add in non-zero amount
83 { 54 {
84 if (z > 1.0) 55 z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration * 0.25;
85 z = 1.0; 56 }
86 57 else {
87 map[x, y] = (map[x, y] * (1.0 - z)) + (rz * z); 58 z = 1.0;
88 } 59 }
89 60
90 double delta = rz - map[x, y]; 61 double delta = rz - map[x, y];
91 if (Math.Abs(delta) > 0.1) 62 if (Math.Abs(delta) > 0.1)
92 delta *= 0.25; 63 {
64 if (z > 1.0)
65 {
66 z = 1.0;
67 }
68 else if (z < 0.0)
69 {
70 z = 0.0;
71 }
72 delta *= z;
73 }
93 74
94 if (delta != 0) // add in non-zero amount 75 if (delta != 0) // add in non-zero amount
95 { 76 {