aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes
diff options
context:
space:
mode:
authorCharles Krinke2008-10-06 00:58:43 +0000
committerCharles Krinke2008-10-06 00:58:43 +0000
commite575ef7ad2245aad17f57273f6bd7b774f99f057 (patch)
treea85fd727bac7f3d39259df3aaea6c93f3f32ba05 /OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes
parentMantis#2336. Thank you kindly, Ralphos for a patch that: (diff)
downloadopensim-SC_OLD-e575ef7ad2245aad17f57273f6bd7b774f99f057.zip
opensim-SC_OLD-e575ef7ad2245aad17f57273f6bd7b774f99f057.tar.gz
opensim-SC_OLD-e575ef7ad2245aad17f57273f6bd7b774f99f057.tar.bz2
opensim-SC_OLD-e575ef7ad2245aad17f57273f6bd7b774f99f057.tar.xz
Revert r6697 patch as the build fails.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs24
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs41
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs11
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/NoiseSphere.cs11
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/OlsenSphere.cs7
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs11
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RevertSphere.cs9
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/WeatherSphere.cs7
9 files changed, 70 insertions, 56 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs
index 3fa3f8a..dae4cf8 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs
@@ -150,7 +150,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
150 150
151 #region ITerrainPaintableEffect Members 151 #region ITerrainPaintableEffect Members
152 152
153 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 153 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
154 { 154 {
155 strength = TerrainUtil.MetersToSphericalStrength(strength); 155 strength = TerrainUtil.MetersToSphericalStrength(strength);
156 156
@@ -173,13 +173,10 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
173 { 173 {
174 for (y = 0; y < water.Height; y++) 174 for (y = 0; y < water.Height; y++)
175 { 175 {
176 if (mask[x,y]) 176 const double solConst = (1.0 / rounds);
177 { 177 double sedDelta = water[x, y] * solConst;
178 const double solConst = (1.0 / rounds); 178 map[x, y] -= sedDelta;
179 double sedDelta = water[x, y] * solConst; 179 sediment[x, y] += sedDelta;
180 map[x, y] -= sedDelta;
181 sediment[x, y] += sedDelta;
182 }
183 } 180 }
184 } 181 }
185 182
@@ -295,11 +292,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
295 double sedimentDeposit = sediment[x, y] - waterCapacity; 292 double sedimentDeposit = sediment[x, y] - waterCapacity;
296 if (sedimentDeposit > 0) 293 if (sedimentDeposit > 0)
297 { 294 {
298 if (mask[x,y]) 295 sediment[x, y] -= sedimentDeposit;
299 { 296 map[x, y] += sedimentDeposit;
300 sediment[x, y] -= sedimentDeposit;
301 map[x, y] += sedimentDeposit;
302 }
303 } 297 }
304 } 298 }
305 } 299 }
@@ -308,10 +302,10 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
308 // Deposit any remainder (should be minimal) 302 // Deposit any remainder (should be minimal)
309 for (x = 0; x < water.Width; x++) 303 for (x = 0; x < water.Width; x++)
310 for (y = 0; y < water.Height; y++) 304 for (y = 0; y < water.Height; y++)
311 if (mask[x,y] && sediment[x, y] > 0) 305 if (sediment[x, y] > 0)
312 map[x, y] += sediment[x, y]; 306 map[x, y] += sediment[x, y];
313 } 307 }
314 308
315 #endregion 309 #endregion
316 } 310 }
317} 311} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs
index e507481..1e2d611 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs
@@ -25,29 +25,48 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using OpenSim.Region.Environment.Interfaces; 28using OpenSim.Region.Environment.Interfaces;
30 29
31namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes 30namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
32{ 31{
33 public class FlattenSphere : ITerrainPaintableEffect 32 public class FlattenSphere : ITerrainPaintableEffect
34 { 33 {
34
35 #region ITerrainPaintableEffect Members 35 #region ITerrainPaintableEffect Members
36 36
37 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 37 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
38 { 38 {
39 strength = TerrainUtil.MetersToSphericalStrength(strength); 39 strength = TerrainUtil.MetersToSphericalStrength(strength);
40 40
41 int x, y; 41 int x, y;
42 42
43 // blend in map 43 double sum = 0.0;
44 double step2 = 0.0;
45 duration = 0.009; //MCP Should be read from ini file
46
47
48 // compute delta map
44 for (x = 0; x < map.Width; x++) 49 for (x = 0; x < map.Width; x++)
45 { 50 {
46 for (y = 0; y < map.Height; y++) 51 for (y = 0; y < map.Height; y++)
47 { 52 {
48 if (!mask[x,y]) 53 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
49 continue; 54
55 if (z > 0) // add in non-zero amount
56 {
57 sum += map[x, y] * z;
58 step2 += z;
59 }
60 }
61 }
62
63 double avg = sum / step2;
50 64
65 // blend in map
66 for (x = 0; x < map.Width; x++)
67 {
68 for (y = 0; y < map.Height; y++)
69 {
51 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration; 70 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration;
52 71
53 if (z > 0) // add in non-zero amount 72 if (z > 0) // add in non-zero amount
@@ -55,18 +74,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
55 if (z > 1.0) 74 if (z > 1.0)
56 z = 1.0; 75 z = 1.0;
57 76
58 map[x, y] = (map[x, y] * (1.0 - z)) + (rz * z); 77 map[x, y] = (map[x, y] * (1.0 - z)) + (avg * z);
59 } 78 }
60
61 double delta = rz - map[x, y];
62 if (Math.Abs(delta) > 0.1)
63 delta *= 0.25;
64
65 if (delta != 0) // add in non-zero amount
66 {
67 map[x, y] += delta;
68 }
69
70 } 79 }
71 } 80 }
72 } 81 }
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs
index fe82396..08b2879 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs
@@ -34,7 +34,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
34 { 34 {
35 #region ITerrainPaintableEffect Members 35 #region ITerrainPaintableEffect Members
36 36
37 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 37 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
38 { 38 {
39 strength = TerrainUtil.MetersToSphericalStrength(strength); 39 strength = TerrainUtil.MetersToSphericalStrength(strength);
40 duration = 0.03; //MCP Should be read from ini file 40 duration = 0.03; //MCP Should be read from ini file
@@ -42,10 +42,15 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
42 int x; 42 int x;
43 for (x = 0; x < map.Width; x++) 43 for (x = 0; x < map.Width; x++)
44 { 44 {
45 // Skip everything unlikely to be affected
46 if (Math.Abs(x - rx) > strength * 1.1)
47 continue;
48
45 int y; 49 int y;
46 for (y = 0; y < map.Height; y++) 50 for (y = 0; y < map.Height; y++)
47 { 51 {
48 if (!mask[x,y]) 52 // Skip everything unlikely to be affected
53 if (Math.Abs(y - ry) > strength * 1.1)
49 continue; 54 continue;
50 55
51 // Calculate a sphere and add it to the heighmap 56 // Calculate a sphere and add it to the heighmap
@@ -61,4 +66,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
61 66
62 #endregion 67 #endregion
63 } 68 }
64} 69} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/NoiseSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/NoiseSphere.cs
index 23f7bc5..0824efd 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/NoiseSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/NoiseSphere.cs
@@ -35,17 +35,22 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
35 { 35 {
36 #region ITerrainPaintableEffect Members 36 #region ITerrainPaintableEffect Members
37 37
38 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 38 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
39 { 39 {
40 strength = TerrainUtil.MetersToSphericalStrength(strength); 40 strength = TerrainUtil.MetersToSphericalStrength(strength);
41 41
42 int x; 42 int x;
43 for (x = 0; x < map.Width; x++) 43 for (x = 0; x < map.Width; x++)
44 { 44 {
45 // Skip everything unlikely to be affected
46 if (Math.Abs(x - rx) > strength * 1.1)
47 continue;
48
45 int y; 49 int y;
46 for (y = 0; y < map.Height; y++) 50 for (y = 0; y < map.Height; y++)
47 { 51 {
48 if (!mask[x,y]) 52 // Skip everything unlikely to be affected
53 if (Math.Abs(y - ry) > strength * 1.1)
49 continue; 54 continue;
50 55
51 // Calculate a sphere and add it to the heighmap 56 // Calculate a sphere and add it to the heighmap
@@ -63,4 +68,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
63 68
64 #endregion 69 #endregion
65 } 70 }
66} 71} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/OlsenSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/OlsenSphere.cs
index 42ec794..6df8408 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/OlsenSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/OlsenSphere.cs
@@ -151,7 +151,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
151 151
152 #region ITerrainPaintableEffect Members 152 #region ITerrainPaintableEffect Members
153 153
154 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 154 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
155 { 155 {
156 strength = TerrainUtil.MetersToSphericalStrength(strength); 156 strength = TerrainUtil.MetersToSphericalStrength(strength);
157 157
@@ -162,9 +162,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
162 int y; 162 int y;
163 for (y = 0; y < map.Height; y++) 163 for (y = 0; y < map.Height; y++)
164 { 164 {
165 if (!mask[x,y])
166 continue;
167
168 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); 165 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
169 166
170 if (z > 0) // add in non-zero amount 167 if (z > 0) // add in non-zero amount
@@ -219,4 +216,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
219 216
220 #endregion 217 #endregion
221 } 218 }
222} 219} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs
index 92bac63..e4fe091 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs
@@ -35,7 +35,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
35 #region ITerrainPaintableEffect Members 35 #region ITerrainPaintableEffect Members
36 36
37 37
38 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 38 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
39 { 39 {
40 duration = 0.03; //MCP Should be read from ini file 40 duration = 0.03; //MCP Should be read from ini file
41 strength = TerrainUtil.MetersToSphericalStrength(strength); 41 strength = TerrainUtil.MetersToSphericalStrength(strength);
@@ -43,10 +43,15 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
43 int x; 43 int x;
44 for (x = 0; x < map.Width; x++) 44 for (x = 0; x < map.Width; x++)
45 { 45 {
46 // Skip everything unlikely to be affected
47 if (Math.Abs(x - rx) > strength * 1.1)
48 continue;
49
46 int y; 50 int y;
47 for (y = 0; y < map.Height; y++) 51 for (y = 0; y < map.Height; y++)
48 { 52 {
49 if (!mask[x,y]) 53 // Skip everything unlikely to be affected
54 if (Math.Abs(y - ry) > strength * 1.1)
50 continue; 55 continue;
51 56
52 // Calculate a sphere and add it to the heighmap 57 // Calculate a sphere and add it to the heighmap
@@ -62,4 +67,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
62 67
63 #endregion 68 #endregion
64 } 69 }
65} 70} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RevertSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RevertSphere.cs
index d3a1d3d..7a1ec72 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RevertSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RevertSphere.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
41 41
42 #region ITerrainPaintableEffect Members 42 #region ITerrainPaintableEffect Members
43 43
44 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 44 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
45 { 45 {
46 strength = TerrainUtil.MetersToSphericalStrength(strength); 46 strength = TerrainUtil.MetersToSphericalStrength(strength);
47 duration = 0.03; //MCP Should be read from ini file 47 duration = 0.03; //MCP Should be read from ini file
@@ -54,10 +54,15 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
54 int x; 54 int x;
55 for (x = 0; x < map.Width; x++) 55 for (x = 0; x < map.Width; x++)
56 { 56 {
57 // Skip everything unlikely to be affected
58 if (Math.Abs(x - rx) > strength * 1.1)
59 continue;
60
57 int y; 61 int y;
58 for (y = 0; y < map.Height; y++) 62 for (y = 0; y < map.Height; y++)
59 { 63 {
60 if (!mask[x,y]) 64 // Skip everything unlikely to be affected
65 if (Math.Abs(y - ry) > strength * 1.1)
61 continue; 66 continue;
62 67
63 // Calculate a sphere and add it to the heighmap 68 // Calculate a sphere and add it to the heighmap
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs
index c63cb90..89d9063 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs
@@ -33,7 +33,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
33 { 33 {
34 #region ITerrainPaintableEffect Members 34 #region ITerrainPaintableEffect Members
35 35
36 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 36 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
37 { 37 {
38 strength = TerrainUtil.MetersToSphericalStrength(strength); 38 strength = TerrainUtil.MetersToSphericalStrength(strength);
39 39
@@ -76,9 +76,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
76 { 76 {
77 for (y = 0; y < map.Height; y++) 77 for (y = 0; y < map.Height; y++)
78 { 78 {
79 if (!mask[x,y])
80 continue;
81
82 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); 79 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
83 80
84 if (z > 0) // add in non-zero amount 81 if (z > 0) // add in non-zero amount
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/WeatherSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/WeatherSphere.cs
index 1288419..b3aa732 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/WeatherSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/WeatherSphere.cs
@@ -147,7 +147,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
147 147
148 #region ITerrainPaintableEffect Members 148 #region ITerrainPaintableEffect Members
149 149
150 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 150 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
151 { 151 {
152 strength = TerrainUtil.MetersToSphericalStrength(strength); 152 strength = TerrainUtil.MetersToSphericalStrength(strength);
153 153
@@ -158,9 +158,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
158 int y; 158 int y;
159 for (y = 0; y < map.Height; y++) 159 for (y = 0; y < map.Height; y++)
160 { 160 {
161 if (!mask[x,y])
162 continue;
163
164 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); 161 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
165 162
166 if (z > 0) // add in non-zero amount 163 if (z > 0) // add in non-zero amount
@@ -207,4 +204,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
207 204
208 #endregion 205 #endregion
209 } 206 }
210} 207} \ No newline at end of file