28 using OpenSim.Region.CoreModules.World.Terrain;
29 using OpenSim.Region.Framework.Interfaces;
30 using OpenSim.Region.Framework.Scenes;
45 result =
"Usage: " + GetUsage();
50 result = this.parseParameters(args, out data);
53 if (result ==
String.Empty)
55 if (data.
bevel ==
"taper")
59 result = String.Format(
"Taper must be 0.0 to 1.0: {0}", data.bevelevation);
64 data.bevelevation = 1.0f;
69 result = String.Format(
"Noise strength must be 0.0 to 1.0: {0}", data.elevation);
74 data.shape =
"rectangle";
83 if (result ==
String.Empty)
85 this.applyModification(map, data);
94 string val =
"noise <delta> [ -rec=x1,y1,dx[,dy] | -ell=x0,y0,rx[,ry] ] [-taper=<delta2>]"
95 +
"\nAdds noise to all points within the specified range.";
101 double factor = this.computeBevel(data, x, y);
102 double noise = TerrainUtil.PerlinNoise2D((double)x / map.GetLength(0), (double)y / map.GetLength(1), 8, 1.0);
103 return map[x, y] + (data.elevation - (data.elevation - data.bevelevation) * factor) * (noise - .5);
NoiseModifier(ITerrainModule module)
override string ModifyTerrain(ITerrainChannel map, string[] args)
Creates the feature.
override string GetUsage()
Gets a string describing the usage.
override double operate(double[,] map, TerrainModifierData data, int x, int y)
Apply the appropriate operation on the specified map, at (x, y).