aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Terrain/PaintBrushes')
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/ErodeSphere.cs26
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/FlattenSphere.cs16
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/LowerSphere.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/NoiseSphere.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/OlsenSphere.cs20
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RevertSphere.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/SmoothSphere.cs14
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/WeatherSphere.cs17
9 files changed, 53 insertions, 52 deletions
diff --git a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/ErodeSphere.cs b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/ErodeSphere.cs
index a8942dc..cfb1f60 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/ErodeSphere.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/ErodeSphere.cs
@@ -25,8 +25,8 @@
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 OpenSim.Region.Environment.Interfaces;
29using System; 28using System;
29using OpenSim.Region.Environment.Interfaces;
30 30
31namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes 31namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
32{ 32{
@@ -35,18 +35,12 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
35 /// </summary> 35 /// </summary>
36 public class ErodeSphere : ITerrainPaintableEffect 36 public class ErodeSphere : ITerrainPaintableEffect
37 { 37 {
38 NeighbourSystem type = NeighbourSystem.Moore; // Parameter 38 private double rainHeight = 0.2;
39 39 private int rounds = 10;
40 double rainHeight = 0.2; 40 private NeighbourSystem type = NeighbourSystem.Moore; // Parameter
41 int rounds = 10; 41 private double waterSaturation = 0.30; // Can carry 1% of water in height
42 double waterSaturation = 0.30; // Can carry 1% of water in height
43 42
44 #region Supporting Functions 43 #region Supporting Functions
45 private enum NeighbourSystem
46 {
47 Moore,
48 VonNeumann
49 } ;
50 44
51 private int[] Neighbours(NeighbourSystem type, int index) 45 private int[] Neighbours(NeighbourSystem type, int index)
52 { 46 {
@@ -146,6 +140,12 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
146 return coord; 140 return coord;
147 } 141 }
148 142
143 private enum NeighbourSystem
144 {
145 Moore,
146 VonNeumann
147 } ;
148
149 #endregion 149 #endregion
150 150
151 #region ITerrainPaintableEffect Members 151 #region ITerrainPaintableEffect Members
@@ -266,7 +266,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
266 // Calculate how much water we can move 266 // Calculate how much water we can move
267 double waterMin = Math.Min(water[x, y], altitudeDelta); 267 double waterMin = Math.Min(water[x, y], altitudeDelta);
268 double waterDelta = waterMin * ((water[coords[0], coords[1]] + map[coords[0], coords[1]]) 268 double waterDelta = waterMin * ((water[coords[0], coords[1]] + map[coords[0], coords[1]])
269 / altitudeTotal); 269 / altitudeTotal);
270 270
271 double sedimentDelta = sediment[x, y] * (waterDelta / water[x, y]); 271 double sedimentDelta = sediment[x, y] * (waterDelta / water[x, y]);
272 272
@@ -309,4 +309,4 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
309 309
310 #endregion 310 #endregion
311 } 311 }
312} 312} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/FlattenSphere.cs b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/FlattenSphere.cs
index 9bfb981..d907ed2 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/FlattenSphere.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/FlattenSphere.cs
@@ -31,12 +31,6 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
31{ 31{
32 public class FlattenSphere : ITerrainPaintableEffect 32 public class FlattenSphere : ITerrainPaintableEffect
33 { 33 {
34 private double SphericalFactor(double x, double y, double rx, double ry, double size)
35 {
36 double z = size * size - ((x - rx) * (x - rx) + (y - ry) * (y - ry));
37 return z;
38 }
39
40// TODO: unused 34// TODO: unused
41// private double GetBilinearInterpolate(double x, double y, ITerrainChannel map) 35// private double GetBilinearInterpolate(double x, double y, ITerrainChannel map)
42// { 36// {
@@ -78,7 +72,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
78 strength = TerrainUtil.MetersToSphericalStrength(strength); 72 strength = TerrainUtil.MetersToSphericalStrength(strength);
79 73
80 int x, y; 74 int x, y;
81 double[,] tweak = new double[map.Width, map.Height]; 75 double[,] tweak = new double[map.Width,map.Height];
82 76
83 double area = strength; 77 double area = strength;
84 double step = strength / 4.0; 78 double step = strength / 4.0;
@@ -123,5 +117,11 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
123 } 117 }
124 118
125 #endregion 119 #endregion
120
121 private double SphericalFactor(double x, double y, double rx, double ry, double size)
122 {
123 double z = size * size - ((x - rx) * (x - rx) + (y - ry) * (y - ry));
124 return z;
125 }
126 } 126 }
127} 127} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/LowerSphere.cs b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/LowerSphere.cs
index 9185b5d..ead1a49 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/LowerSphere.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/LowerSphere.cs
@@ -64,4 +64,4 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
64 64
65 #endregion 65 #endregion
66 } 66 }
67} 67} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/NoiseSphere.cs b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/NoiseSphere.cs
index 9b45b34..e3babbf 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/NoiseSphere.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/NoiseSphere.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
57 z *= z; 57 z *= z;
58 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); 58 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
59 59
60 double noise = TerrainUtil.PerlinNoise2D((double)x / (double)Framework.Constants.RegionSize, (double)y / (double)Framework.Constants.RegionSize, 8, 1.0); 60 double noise = TerrainUtil.PerlinNoise2D((double) x / (double) Constants.RegionSize, (double) y / (double) Constants.RegionSize, 8, 1.0);
61 61
62 if (z > 0.0) 62 if (z > 0.0)
63 map[x, y] += noise * z * duration; 63 map[x, y] += noise * z * duration;
@@ -67,4 +67,4 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
67 67
68 #endregion 68 #endregion
69 } 69 }
70} 70} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/OlsenSphere.cs b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/OlsenSphere.cs
index 23dea8a..153fc15 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/OlsenSphere.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/OlsenSphere.cs
@@ -25,8 +25,8 @@
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 OpenSim.Region.Environment.Interfaces;
29using System; 28using System;
29using OpenSim.Region.Environment.Interfaces;
30 30
31namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes 31namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
32{ 32{
@@ -38,16 +38,10 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
38 /// </summary> 38 /// </summary>
39 public class OlsenSphere : ITerrainPaintableEffect 39 public class OlsenSphere : ITerrainPaintableEffect
40 { 40 {
41 NeighbourSystem type = NeighbourSystem.Moore; // Parameter 41 private double nConst = 1024.0;
42 42 private NeighbourSystem type = NeighbourSystem.Moore; // Parameter
43 double nConst = 1024.0;
44 43
45 #region Supporting Functions 44 #region Supporting Functions
46 private enum NeighbourSystem
47 {
48 Moore,
49 VonNeumann
50 } ;
51 45
52 private int[] Neighbours(NeighbourSystem type, int index) 46 private int[] Neighbours(NeighbourSystem type, int index)
53 { 47 {
@@ -153,6 +147,12 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
153 return z; 147 return z;
154 } 148 }
155 149
150 private enum NeighbourSystem
151 {
152 Moore,
153 VonNeumann
154 } ;
155
156 #endregion 156 #endregion
157 157
158 #region ITerrainPaintableEffect Members 158 #region ITerrainPaintableEffect Members
@@ -222,4 +222,4 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
222 222
223 #endregion 223 #endregion
224 } 224 }
225} 225} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs
index f90c407..8d61a7e 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs
@@ -64,4 +64,4 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
64 64
65 #endregion 65 #endregion
66 } 66 }
67} 67} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RevertSphere.cs b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RevertSphere.cs
index 382c756..ee0edb5 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RevertSphere.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RevertSphere.cs
@@ -32,7 +32,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
32{ 32{
33 public class RevertSphere : ITerrainPaintableEffect 33 public class RevertSphere : ITerrainPaintableEffect
34 { 34 {
35 ITerrainChannel m_revertmap; 35 private ITerrainChannel m_revertmap;
36 36
37 public RevertSphere(ITerrainChannel revertmap) 37 public RevertSphere(ITerrainChannel revertmap)
38 { 38 {
@@ -79,4 +79,4 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
79 79
80 #endregion 80 #endregion
81 } 81 }
82} 82} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/SmoothSphere.cs b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/SmoothSphere.cs
index db5fb72..86a01cc 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/SmoothSphere.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/SmoothSphere.cs
@@ -38,24 +38,24 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
38 strength = TerrainUtil.MetersToSphericalStrength(strength); 38 strength = TerrainUtil.MetersToSphericalStrength(strength);
39 39
40 int x, y; 40 int x, y;
41 double[,] tweak = new double[map.Width, map.Height]; 41 double[,] tweak = new double[map.Width,map.Height];
42 42
43 double n, l; 43 double n, l;
44 double area = strength; 44 double area = strength;
45 double step = strength / 4.0; 45 double step = strength / 4.0;
46 46
47 // compute delta map 47 // compute delta map
48 for (x = 0; x < map.Width; x++) 48 for (x = 0; x < map.Width; x++)
49 { 49 {
50 for (y = 0; y < map.Height; y++) 50 for (y = 0; y < map.Height; y++)
51 { 51 {
52 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); 52 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
53 53
54 if (z > 0) // add in non-zero amount 54 if (z > 0) // add in non-zero amount
55 { 55 {
56 double average = 0.0; 56 double average = 0.0;
57 int avgsteps = 0; 57 int avgsteps = 0;
58 58
59 for (n = 0.0 - area; n < area; n += step) 59 for (n = 0.0 - area; n < area; n += step)
60 { 60 {
61 for (l = 0.0 - area; l < area; l += step) 61 for (l = 0.0 - area; l < area; l += step)
@@ -74,7 +74,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
74 for (y = 0; y < map.Height; y++) 74 for (y = 0; y < map.Height; y++)
75 { 75 {
76 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); 76 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
77 77
78 if (z > 0) // add in non-zero amount 78 if (z > 0) // add in non-zero amount
79 { 79 {
80 double da = z; 80 double da = z;
@@ -90,4 +90,4 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
90 90
91 #endregion 91 #endregion
92 } 92 }
93} 93} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/WeatherSphere.cs b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/WeatherSphere.cs
index 79c9c63..f46ba8f 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/WeatherSphere.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/WeatherSphere.cs
@@ -34,15 +34,10 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
34 /// </summary> 34 /// </summary>
35 public class WeatherSphere : ITerrainPaintableEffect 35 public class WeatherSphere : ITerrainPaintableEffect
36 { 36 {
37 NeighbourSystem type = NeighbourSystem.Moore; // Parameter 37 private double talus = 0.2; // Number of meters max difference before stop eroding. Tweakage required.
38 double talus = 0.2; // Number of meters max difference before stop eroding. Tweakage required. 38 private NeighbourSystem type = NeighbourSystem.Moore; // Parameter
39 39
40 #region Supporting Functions 40 #region Supporting Functions
41 private enum NeighbourSystem
42 {
43 Moore,
44 VonNeumann
45 } ;
46 41
47 private int[] Neighbours(NeighbourSystem type, int index) 42 private int[] Neighbours(NeighbourSystem type, int index)
48 { 43 {
@@ -142,6 +137,12 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
142 return coord; 137 return coord;
143 } 138 }
144 139
140 private enum NeighbourSystem
141 {
142 Moore,
143 VonNeumann
144 } ;
145
145 #endregion 146 #endregion
146 147
147 #region ITerrainPaintableEffect Members 148 #region ITerrainPaintableEffect Members
@@ -203,4 +204,4 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
203 204
204 #endregion 205 #endregion
205 } 206 }
206} 207} \ No newline at end of file