28 using OpenSim.Region.CoreModules.World.Terrain;
29 using OpenSim.Region.Framework.Interfaces;
44 result =
"Usage: " + GetUsage();
49 result = this.parseParameters(args, out data);
52 if (result ==
String.Empty)
54 if (data.
bevel ==
"taper")
58 result = String.Format(
"Taper must be 0.01 to 0.99: {0}", data.bevelevation);
63 data.bevelevation = 2.0f / 3.0f;
68 result = String.Format(
"Smoothing strength must be 0.0 to 1.0: {0}", data.elevation);
73 data.shape =
"rectangle";
82 if (result ==
String.Empty)
84 this.applyModification(map, data);
93 string val =
"smooth <strength> [ -rec=x1,y1,dx[,dy] | -ell=x0,y0,rx[,ry] ] [-taper=<fraction>]"
94 +
"\nSmooths all points within the specified range using a simple averaging algorithm.";
100 double[] scale =
new double[3];
101 scale[0] = data.elevation;
102 scale[1] = ((1.0 - scale[0]) * data.
bevelevation) / 8.0;
103 scale[2] = ((1.0 - scale[0]) * (1.0 - data.
bevelevation)) / 16.0;
104 int xMax = map.GetLength(0);
105 int yMax = map.GetLength(1);
107 if ((x == 0) || (y == 0) || (x == (xMax - 1)) || (y == (yMax - 1)))
114 for(
int yPos = (y - 2); yPos < (y + 3); yPos++)
116 int yVal = (yPos <= 0) ? 0 : ((yPos < yMax) ? yPos : yMax - 1);
117 for(
int xPos = (x - 2); xPos < (x + 3); xPos++)
119 int xVal = (xPos <= 0) ? 0 : ((xPos < xMax) ? xPos : xMax - 1);
120 int dist = Math.Max(Math.Abs(x - xVal), Math.Abs(y - yVal));
121 result += map[xVal, yVal] * scale[dist];
override double operate(double[,] map, TerrainModifierData data, int x, int y)
Apply the appropriate operation on the specified map, at (x, y).
override string GetUsage()
Gets a string describing the usage.
override string ModifyTerrain(ITerrainChannel map, string[] args)
Creates the feature.
SmoothModifier(ITerrainModule module)