diff options
Diffstat (limited to '')
9 files changed, 56 insertions, 70 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs index dae4cf8..3fa3f8a 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, double rx, double ry, double strength, double duration) | 153 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) |
154 | { | 154 | { |
155 | strength = TerrainUtil.MetersToSphericalStrength(strength); | 155 | strength = TerrainUtil.MetersToSphericalStrength(strength); |
156 | 156 | ||
@@ -173,10 +173,13 @@ 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 | const double solConst = (1.0 / rounds); | 176 | if (mask[x,y]) |
177 | double sedDelta = water[x, y] * solConst; | 177 | { |
178 | map[x, y] -= sedDelta; | 178 | const double solConst = (1.0 / rounds); |
179 | sediment[x, y] += sedDelta; | 179 | double sedDelta = water[x, y] * solConst; |
180 | map[x, y] -= sedDelta; | ||
181 | sediment[x, y] += sedDelta; | ||
182 | } | ||
180 | } | 183 | } |
181 | } | 184 | } |
182 | 185 | ||
@@ -292,8 +295,11 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
292 | double sedimentDeposit = sediment[x, y] - waterCapacity; | 295 | double sedimentDeposit = sediment[x, y] - waterCapacity; |
293 | if (sedimentDeposit > 0) | 296 | if (sedimentDeposit > 0) |
294 | { | 297 | { |
295 | sediment[x, y] -= sedimentDeposit; | 298 | if (mask[x,y]) |
296 | map[x, y] += sedimentDeposit; | 299 | { |
300 | sediment[x, y] -= sedimentDeposit; | ||
301 | map[x, y] += sedimentDeposit; | ||
302 | } | ||
297 | } | 303 | } |
298 | } | 304 | } |
299 | } | 305 | } |
@@ -302,10 +308,10 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
302 | // Deposit any remainder (should be minimal) | 308 | // Deposit any remainder (should be minimal) |
303 | for (x = 0; x < water.Width; x++) | 309 | for (x = 0; x < water.Width; x++) |
304 | for (y = 0; y < water.Height; y++) | 310 | for (y = 0; y < water.Height; y++) |
305 | if (sediment[x, y] > 0) | 311 | if (mask[x,y] && sediment[x, y] > 0) |
306 | map[x, y] += sediment[x, y]; | 312 | map[x, y] += sediment[x, y]; |
307 | } | 313 | } |
308 | 314 | ||
309 | #endregion | 315 | #endregion |
310 | } | 316 | } |
311 | } \ No newline at end of file | 317 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs index 1e2d611..e507481 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs | |||
@@ -25,48 +25,29 @@ | |||
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 | ||
28 | using System; | ||
28 | using OpenSim.Region.Environment.Interfaces; | 29 | using OpenSim.Region.Environment.Interfaces; |
29 | 30 | ||
30 | namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | 31 | namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes |
31 | { | 32 | { |
32 | public class FlattenSphere : ITerrainPaintableEffect | 33 | public class FlattenSphere : ITerrainPaintableEffect |
33 | { | 34 | { |
34 | |||
35 | #region ITerrainPaintableEffect Members | 35 | #region ITerrainPaintableEffect Members |
36 | 36 | ||
37 | public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration) | 37 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, 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 | 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 | ||
49 | for (x = 0; x < map.Width; x++) | ||
50 | { | ||
51 | for (y = 0; y < map.Height; y++) | ||
52 | { | ||
53 | double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); | ||
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; | ||
64 | |||
65 | // blend in map | 43 | // blend in map |
66 | for (x = 0; x < map.Width; x++) | 44 | for (x = 0; x < map.Width; x++) |
67 | { | 45 | { |
68 | for (y = 0; y < map.Height; y++) | 46 | for (y = 0; y < map.Height; y++) |
69 | { | 47 | { |
48 | if (!mask[x,y]) | ||
49 | continue; | ||
50 | |||
70 | double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration; | 51 | double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration; |
71 | 52 | ||
72 | if (z > 0) // add in non-zero amount | 53 | if (z > 0) // add in non-zero amount |
@@ -74,8 +55,18 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
74 | if (z > 1.0) | 55 | if (z > 1.0) |
75 | z = 1.0; | 56 | z = 1.0; |
76 | 57 | ||
77 | map[x, y] = (map[x, y] * (1.0 - z)) + (avg * z); | 58 | map[x, y] = (map[x, y] * (1.0 - z)) + (rz * z); |
78 | } | 59 | } |
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 | |||
79 | } | 70 | } |
80 | } | 71 | } |
81 | } | 72 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs index 08b2879..fe82396 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, double rx, double ry, double strength, double duration) | 37 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, 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,15 +42,10 @@ 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 | |||
49 | int y; | 45 | int y; |
50 | for (y = 0; y < map.Height; y++) | 46 | for (y = 0; y < map.Height; y++) |
51 | { | 47 | { |
52 | // Skip everything unlikely to be affected | 48 | if (!mask[x,y]) |
53 | if (Math.Abs(y - ry) > strength * 1.1) | ||
54 | continue; | 49 | continue; |
55 | 50 | ||
56 | // Calculate a sphere and add it to the heighmap | 51 | // Calculate a sphere and add it to the heighmap |
@@ -66,4 +61,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
66 | 61 | ||
67 | #endregion | 62 | #endregion |
68 | } | 63 | } |
69 | } \ No newline at end of file | 64 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/NoiseSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/NoiseSphere.cs index 0824efd..23f7bc5 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/NoiseSphere.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/NoiseSphere.cs | |||
@@ -35,22 +35,17 @@ 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, double rx, double ry, double strength, double duration) | 38 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, 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 | |||
49 | int y; | 45 | int y; |
50 | for (y = 0; y < map.Height; y++) | 46 | for (y = 0; y < map.Height; y++) |
51 | { | 47 | { |
52 | // Skip everything unlikely to be affected | 48 | if (!mask[x,y]) |
53 | if (Math.Abs(y - ry) > strength * 1.1) | ||
54 | continue; | 49 | continue; |
55 | 50 | ||
56 | // Calculate a sphere and add it to the heighmap | 51 | // Calculate a sphere and add it to the heighmap |
@@ -68,4 +63,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
68 | 63 | ||
69 | #endregion | 64 | #endregion |
70 | } | 65 | } |
71 | } \ No newline at end of file | 66 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/OlsenSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/OlsenSphere.cs index 6df8408..42ec794 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, double rx, double ry, double strength, double duration) | 154 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) |
155 | { | 155 | { |
156 | strength = TerrainUtil.MetersToSphericalStrength(strength); | 156 | strength = TerrainUtil.MetersToSphericalStrength(strength); |
157 | 157 | ||
@@ -162,6 +162,9 @@ 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 | |||
165 | double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); | 168 | double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); |
166 | 169 | ||
167 | if (z > 0) // add in non-zero amount | 170 | if (z > 0) // add in non-zero amount |
@@ -216,4 +219,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
216 | 219 | ||
217 | #endregion | 220 | #endregion |
218 | } | 221 | } |
219 | } \ No newline at end of file | 222 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs index e4fe091..92bac63 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, double rx, double ry, double strength, double duration) | 38 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, 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,15 +43,10 @@ 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 | |||
50 | int y; | 46 | int y; |
51 | for (y = 0; y < map.Height; y++) | 47 | for (y = 0; y < map.Height; y++) |
52 | { | 48 | { |
53 | // Skip everything unlikely to be affected | 49 | if (!mask[x,y]) |
54 | if (Math.Abs(y - ry) > strength * 1.1) | ||
55 | continue; | 50 | continue; |
56 | 51 | ||
57 | // Calculate a sphere and add it to the heighmap | 52 | // Calculate a sphere and add it to the heighmap |
@@ -67,4 +62,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
67 | 62 | ||
68 | #endregion | 63 | #endregion |
69 | } | 64 | } |
70 | } \ No newline at end of file | 65 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RevertSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RevertSphere.cs index 7a1ec72..d3a1d3d 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, double rx, double ry, double strength, double duration) | 44 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, 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,15 +54,10 @@ 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 | |||
61 | int y; | 57 | int y; |
62 | for (y = 0; y < map.Height; y++) | 58 | for (y = 0; y < map.Height; y++) |
63 | { | 59 | { |
64 | // Skip everything unlikely to be affected | 60 | if (!mask[x,y]) |
65 | if (Math.Abs(y - ry) > strength * 1.1) | ||
66 | continue; | 61 | continue; |
67 | 62 | ||
68 | // Calculate a sphere and add it to the heighmap | 63 | // 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 89d9063..c63cb90 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, double rx, double ry, double strength, double duration) | 36 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) |
37 | { | 37 | { |
38 | strength = TerrainUtil.MetersToSphericalStrength(strength); | 38 | strength = TerrainUtil.MetersToSphericalStrength(strength); |
39 | 39 | ||
@@ -76,6 +76,9 @@ 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 | |||
79 | double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); | 82 | double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); |
80 | 83 | ||
81 | if (z > 0) // add in non-zero amount | 84 | 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 b3aa732..1288419 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, double rx, double ry, double strength, double duration) | 150 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) |
151 | { | 151 | { |
152 | strength = TerrainUtil.MetersToSphericalStrength(strength); | 152 | strength = TerrainUtil.MetersToSphericalStrength(strength); |
153 | 153 | ||
@@ -158,6 +158,9 @@ 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 | |||
161 | double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); | 164 | double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); |
162 | 165 | ||
163 | if (z > 0) // add in non-zero amount | 166 | if (z > 0) // add in non-zero amount |
@@ -204,4 +207,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
204 | 207 | ||
205 | #endregion | 208 | #endregion |
206 | } | 209 | } |
207 | } \ No newline at end of file | 210 | } |