28 using OpenSim.Region.Framework.Interfaces;
34 #region ITerrainFloodEffect Members
37 int startX,
int endX,
int startY,
int endY)
39 double area = strength;
40 double step = strength / 4.0;
42 double[,] manipulate =
new double[map.Width,map.Height];
44 for (x = startX; x <= endX; x++)
46 for (y = startY; y <= endY; y++)
55 for (n = 0.0 - area; n < area; n += step)
58 for (l = 0.0 - area; l < area; l += step)
61 average += GetBilinearInterpolate(x + n, y + l, map);
65 manipulate[x, y] = average / avgsteps;
68 for (x = startX; x <= endX; x++)
70 for (y = startY; y <= endY; y++)
75 map[x, y] = manipulate[x, y];
82 private static double GetBilinearInterpolate(
double x,
double y,
ITerrainChannel map)
96 const int stepSize = 1;
97 double h00 = map[(int) x, (
int) y];
98 double h10 = map[(
int) x + stepSize, (
int) y];
99 double h01 = map[(
int) x, (
int) y + stepSize];
100 double h11 = map[(
int) x + stepSize, (
int) y + stepSize];
106 double a10 = h2 - h1;
107 double a01 = h3 - h1;
108 double a11 = h1 - h2 - h3 + h4;
109 double partialx = x - (
int) x;
110 double partialz = y - (
int) y;
111 double hi = a00 + (a10 * partialx) + (a01 * partialz) + (a11 * partialx * partialz);
void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength, int startX, int endX, int startY, int endY)