Fix the flatmap scaling issues

This commit is contained in:
Jesse Boyd 2017-02-13 21:16:53 +11:00
parent 861ebad1ea
commit 760de4af24
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -158,9 +158,9 @@ public class ScalableHeightMap {
newData[index] = centerY; newData[index] = centerY;
continue; continue;
} }
raise = (yscale * raise); double raisePow = Math.pow(raise, yscale);
int diff = targetY - height; int diff = targetY - height;
double raiseScaled = diff * (Math.pow(raise, yscale) / sizePow); double raiseScaled = diff * (raisePow / sizePow);
double raiseScaledAbs = Math.abs(raiseScaled); double raiseScaledAbs = Math.abs(raiseScaled);
int random = PseudoRandom.random.random(256) < (int) ((Math.ceil(raiseScaledAbs) - Math.floor(raiseScaledAbs)) * 256) ? (diff > 0 ? 1 : -1) : 0; int random = PseudoRandom.random.random(256) < (int) ((Math.ceil(raiseScaledAbs) - Math.floor(raiseScaledAbs)) * 256) ? (diff > 0 ? 1 : -1) : 0;
int raiseScaledInt = (int) raiseScaled + random; int raiseScaledInt = (int) raiseScaled + random;