public override Task <ILayerMasked> GenerateLayer() { var oldpoints = _layerLocalParameters.Polygon.Points.ToList(); var mask = getBlurredMask(oldpoints); Vector2 resolution = mask.Resolution; var noisescaleDown = .33f; const float thatMakesItGoDown = -1; _logger.Log(mask, "canyonMask"); var blured = getBlurredProfile(oldpoints, resolution); var layer = _noise.Do(resolution); _layerUtility.IterateValues(blured, (coor, val) => { var cv = val.HasValue ? val.Value : 0; layer[coor] = layer[coor] * noisescaleDown + cv + thatMakesItGoDown; }); _logger.Log(layer, "canyon"); layer.Mask = mask; applyOffset(_layerLocalParameters.ExtendSize, oldpoints, layer); return(Task.FromResult(layer)); }
public override Task <ILayerMasked> GenerateLayer() { var pts = _layerLocalParameters.Polygon.Points.ToList(); var bounds = new GeometryUtils().GetBoundsForPoints(pts); var mask = obtainBluredMask(pts, _layerLocalParameters.BlurSize, _layerLocalParameters.ExtendSize); var size = mask.Resolution; int count = (int)JryMath.Max(size.X, size.Y) / 100 + 1; var areas = _voronoiAreGenerator.GenerateAreas(size, bounds.GetSize(), count); _areaLoggerWithFill.LogAreas(size, areas, "loggedAreasFilled"); var layer = new Layer2DObject(new Vector2(size.X + _layerLocalParameters.ExtendSize, size.Y + _layerLocalParameters.ExtendSize)); var layerSize = layer.Resolution; var deltaX = (layerSize.X - size.X) / 2; var deltaY = (layerSize.Y - size.Y) / 2; var translateVector = new Vector2(deltaX, deltaY); _voronoiAreaDrawer.PrintToLayer(layer, areas, translateVector); layer.Mask = mask; _logger.Log(layer, "mountain"); applyOffset(_layerLocalParameters.ExtendSize, _layerLocalParameters.Polygon.Points.ToList(), layer); _layUtils.Normalize(layer); layer.Mask = mask; return(Task.FromResult((ILayerMasked)layer)); }
public void LogAreas(IntVector2 size, IList <IArea> areas, string name) { var debugColoredAreas = drawSiteToLayer(size, areas); _logger.Log(debugColoredAreas, name); }
private void postProcessWholeLayer(ILayerMasked final, IErosionDescriptor bs, int riverAmount) { _visualLogger.Log(final, "baseNoEro"); doErosion(final, bs); generateRIvers(final, riverAmount); }