mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
* Made some terrain functions faster computationally.
This commit is contained in:
@@ -109,10 +109,8 @@ namespace libTerrain
|
||||
z *= z;
|
||||
z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry));
|
||||
|
||||
if (z < 0)
|
||||
z = 0;
|
||||
|
||||
Set(x, y, Tools.LinearInterpolate(map[x, y], height, z));
|
||||
if (z > 0.0)
|
||||
Set(x, y, Tools.LinearInterpolate(map[x, y], height, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,10 +63,8 @@ namespace libTerrain
|
||||
z *= z;
|
||||
z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry));
|
||||
|
||||
if (z < 0)
|
||||
z = 0;
|
||||
|
||||
Set(x, y, map[x, y] + (z*amount));
|
||||
if (z > 0.0)
|
||||
Set(x, y, map[x, y] + (z * amount));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,10 +86,8 @@ namespace libTerrain
|
||||
double z = size;
|
||||
z -= Math.Sqrt(((x - rx)*(x - rx)) + ((y - ry)*(y - ry)));
|
||||
|
||||
if (z < 0)
|
||||
z = 0;
|
||||
|
||||
Set(x, y, map[x, y] + (z*amount));
|
||||
if (z > 0.0)
|
||||
Set(x, y, map[x, y] + (z * amount));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,10 +122,8 @@ namespace libTerrain
|
||||
z *= z;
|
||||
z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry));
|
||||
|
||||
if (z < 0)
|
||||
z = 0;
|
||||
|
||||
Set(x, y, map[x, y] - (z*amount));
|
||||
if (z > 0.0)
|
||||
Set(x, y, map[x, y] + (z * amount));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user