aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs41
1 files changed, 41 insertions, 0 deletions
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 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Region.Environment.Modules.Terrain;
5using OpenSim.Region.Environment.Interfaces;
6
7namespace 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}