28 using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes;
29 using OpenSim.Region.Framework.Interfaces;
30 using OpenSim.Region.Framework.Scenes;
32 using System.Reflection;
38 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 #region ITerrainEffect Members
46 bool[,] cliffMask =
new bool[map.Width,map.Height];
47 bool[,] channelMask =
new bool[map.Width,map.Height];
48 bool[,] smoothMask =
new bool[map.Width,map.Height];
49 bool[,] allowMask =
new bool[map.Width,map.Height];
55 for (x = 0; x < map.Width; x++)
57 for (y = 0; y < map.Height; y++)
60 smoothMask[x, y] =
true;
61 allowMask[x,y] =
true;
64 map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 3, 0.25) * 5;
68 const int channelsX = 4;
69 int channelWidth = (map.Width / channelsX / 4);
70 const int channelsY = 4;
71 int channelHeight = (map.Height / channelsY / 4);
73 SetLowerChannel(map, cliffMask, channelMask, x, y, channelsX, channelWidth, map.
Width, x);
74 SetLowerChannel(map, cliffMask, channelMask, x, y, channelsY, channelHeight, map.
Height, y);
82 for (x = 0; x < map.Width; x++)
84 for (y = 0; y < map.Height; y++)
87 eroder.PaintEffect(map, allowMask, x, y, -1, 4, 0.1,0,map.Width - 1,0,map.Height - 1);
91 for (x = 0; x < map.Width; x += 2)
93 for (y = 0; y < map.Height; y += 2)
106 private static void SetLowerChannel(
ITerrainChannel map,
bool[,] cliffMask,
bool[,] channelMask,
int x,
int y,
int numChannels,
int channelWidth,
109 for (
int i = 0; i < numChannels; i++)
111 double distanceToLine = Math.Abs(rp - ((mapSize / numChannels) * i));
113 if (distanceToLine < channelWidth)
115 if (channelMask[x, y])
120 channelMask[x, y] =
true;
122 if (distanceToLine < 1)
124 cliffMask[x, y] =
true;
Thermal Weathering Paint Brush