diff options
3 files changed, 81 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FloodBrushes/RaiseArea.cs b/OpenSim/Region/Environment/Modules/Terrain/FloodBrushes/RaiseArea.cs new file mode 100644 index 0000000..ce83a4c --- /dev/null +++ b/OpenSim/Region/Environment/Modules/Terrain/FloodBrushes/RaiseArea.cs | |||
@@ -0,0 +1,30 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Region.Environment.Modules.Terrain; | ||
5 | using OpenSim.Region.Environment.Interfaces; | ||
6 | |||
7 | namespace OpenSim.Region.Environment.Modules.Terrain.FloodBrushes | ||
8 | { | ||
9 | class RaiseArea : ITerrainFloodEffect | ||
10 | { | ||
11 | #region ITerrainFloodEffect Members | ||
12 | |||
13 | public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength) | ||
14 | { | ||
15 | int x, y; | ||
16 | for (x = 0; x < map.Width; x++) | ||
17 | { | ||
18 | for (y = 0; y < map.Height; y++) | ||
19 | { | ||
20 | if (fillArea[x, y] == true) | ||
21 | { | ||
22 | map[x, y] += strength; | ||
23 | } | ||
24 | } | ||
25 | } | ||
26 | } | ||
27 | |||
28 | #endregion | ||
29 | } | ||
30 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs new file mode 100644 index 0000000..cf95f3f --- /dev/null +++ b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs | |||
@@ -0,0 +1,41 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Region.Environment.Modules.Terrain; | ||
5 | using OpenSim.Region.Environment.Interfaces; | ||
6 | |||
7 | namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes | ||
8 | { | ||
9 | class RaiseSphere : ITerrainPaintableEffect | ||
10 | { | ||
11 | #region ITerrainPaintableEffect Members | ||
12 | |||
13 | public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength) | ||
14 | { | ||
15 | int x, y; | ||
16 | for (x = 0; x < map.Width; x++) | ||
17 | { | ||
18 | // Skip everything unlikely to be affected | ||
19 | if (Math.Abs(x - rx) > strength * 1.1) | ||
20 | continue; | ||
21 | |||
22 | for (y = 0; y < map.Height; y++) | ||
23 | { | ||
24 | // Skip everything unlikely to be affected | ||
25 | if (Math.Abs(y - ry) > strength * 1.1) | ||
26 | continue; | ||
27 | |||
28 | // Calculate a sphere and add it to the heighmap | ||
29 | double z = strength; | ||
30 | z *= z; | ||
31 | z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); | ||
32 | |||
33 | if (z > 0.0) | ||
34 | map[x, y] += z; | ||
35 | } | ||
36 | } | ||
37 | } | ||
38 | |||
39 | #endregion | ||
40 | } | ||
41 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs index 1b765eb..4f8b377 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs | |||
@@ -39,6 +39,16 @@ using libsecondlife; | |||
39 | 39 | ||
40 | namespace OpenSim.Region.Environment.Modules.Terrain | 40 | namespace OpenSim.Region.Environment.Modules.Terrain |
41 | { | 41 | { |
42 | public interface ITerrainPaintableEffect | ||
43 | { | ||
44 | void PaintEffect(ITerrainChannel map, double x, double y, double strength); | ||
45 | } | ||
46 | |||
47 | public interface ITerrainFloodEffect | ||
48 | { | ||
49 | void FloodEffect(ITerrainChannel map, Boolean[,] fillArea, double strength); | ||
50 | } | ||
51 | |||
42 | /// <summary> | 52 | /// <summary> |
43 | /// A new version of the old Channel class, simplified | 53 | /// A new version of the old Channel class, simplified |
44 | /// </summary> | 54 | /// </summary> |