28 using OpenSim.Region.Framework.Interfaces;
29 using OpenSim.Region.Framework.Scenes;
38 private const double talus = 0.2;
39 private const NeighbourSystem type = NeighbourSystem.Moore;
41 #region Supporting Functions
43 private static int[] Neighbours(NeighbourSystem neighbourType,
int index)
45 int[] coord =
new int[2];
49 switch (neighbourType)
51 case NeighbourSystem.Moore:
104 case NeighbourSystem.VonNeumann:
141 private enum NeighbourSystem
149 #region ITerrainPaintableEffect Members
152 double strength,
double duration,
int startX,
int endX,
int startY,
int endY)
154 strength = TerrainUtil.MetersToSphericalStrength(strength);
158 for (x = startX; x <= endX; x++)
160 for (y = startY; y <= endY; y++)
165 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
169 const int NEIGHBOUR_ME = 4;
170 const int NEIGHBOUR_MAX = 9;
172 for (
int j = 0; j < NEIGHBOUR_MAX; j++)
174 if (j != NEIGHBOUR_ME)
176 int[] coords = Neighbours(type, j);
181 if (coords[0] > map.
Width - 1)
183 if (coords[1] > map.
Height - 1)
190 double heightF = map[x, y];
191 double target = map[coords[0], coords[1]];
193 if (target > heightF + talus)
195 double calc = duration * ((target - heightF) - talus) * z;
201 map[coords[0], coords[1]] = target;
void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration, int startX, int endX, int startY, int endY)
Thermal Weathering Paint Brush