internal static void addNoise(List <Coord> coords, RandomProvider random, float horizontalScale, float verticalScale) { float offset = random.getFloat(); foreach (Coord coord in coords) { var perlin = ElevationUtils.getPerlin(offset, horizontalScale, coord.x, coord.y); coord.setElevation(coord.elevation + perlin * verticalScale); } }
/** * Applys perlin noise across the map with a radial bias, maximum strength at the center, 0 at map width. * Changing the horizonal scale should change the frequency of the effect. Smaller numbers = less detailed. * Change the vertical scale to change the strength of the effect. */ internal static void addRadialWeightedNoise(Vector3 center, float radius, List <Coord> coords, RandomProvider random, float horizontalScale, float verticalScale) { float offset = random.getFloat(); foreach (Coord coord in coords) { var perlin = ElevationUtils.getPerlin( offset, horizontalScale, coord.x / radius, coord.y / radius ); float distance = Vector3.Distance(center, coord.toVector3()); coord.setElevation(Mathf.Lerp(coord.elevation, coord.elevation + perlin * verticalScale, 1 - Mathf.Clamp01(distance / radius))); } }