* Made some terrain functions faster computationally.

ThreadPoolClientBranch
Adam Frisby 2008-02-08 18:18:34 +00:00
parent dd4c011806
commit 23e0ef3492
2 changed files with 8 additions and 16 deletions

View File

@ -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));
}
}
}

View File

@ -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));
}
}
}