Optimise Notchy.CreateHeightmap

This commit is contained in:
UnknownShadow200 2017-03-02 10:47:06 +11:00
parent 0748f54f87
commit 8f44f43ef2

View File

@ -62,10 +62,13 @@ namespace ClassicalSharp.Generator {
for (int z = 0; z < Length; z++) {
CurrentProgress = (float)z / Length;
for (int x = 0; x < Width; x++) {
double hLow = n1.Compute(x * 1.3f, z * 1.3f) / 6 - 4;
double hHigh = n2.Compute(x * 1.3f, z * 1.3f) / 5 + 6;
double hLow = n1.Compute(x * 1.3f, z * 1.3f) / 6 - 4, height = hLow;
if (n3.Compute(x, z) <= 0) {
double hHigh = n2.Compute(x * 1.3f, z * 1.3f) / 5 + 6;
height = Math.Max(hLow, hHigh);
}
double height = n3.Compute(x, z) > 0 ? hLow : Math.Max(hLow, hHigh);
height *= 0.5;
if (height < 0) height *= 0.8f;