public async Task SaveLayers() { Blur b = new Blur(); var dr = new BallDrainageSimulator(); var vl = new VisualLogger(); var file = "SavedFiles/rvrnw.bmp"; var i = Image.FromFile(file); var bitmap = new Bitmap(i); var layer = new LayerConverter().LoadLayer(bitmap); ILayer blured = new Layer2DObject(layer.Resolution); //b.Process(layer, blured, 3); blured = layer; vl.Log(blured, "base"); var drainagemap = dr.GetDrainageMap(blured, 10); //logger shit drainagemap[0, 0] = 0; vl.Log(drainagemap, "drainage"); }
public async Task SaveLayers() { var file = "SavedFiles/test.bmp"; var i = Image.FromFile(file); var bitmap = new Bitmap(i); var conerted = new LayerConverter().LoadLayer(bitmap); var h = new BasicHydraulicErosion(); var vl = new VisualLogger(); vl.Log(conerted, "baseNoEro"); h.Erode(conerted, new HydroErosionParams() { Strenght = 50 }); vl.Log(conerted, "baseWithEro"); }
public ISubGenerator Build(int seed) { if (_layerBuilder == null) { throw new InvalidBuildStateException("layer parameters was not set"); } if (_noiseBuilder == null) { throw new InvalidBuildStateException("noise parameters was not set"); } var visualLogger = new VisualLogger(); var gens = builders.Select(r => { r.Layer(_layerBuilder); r.Noise(_noiseBuilder); return(r.Build(seed)); } ).ToList(); return(new CombinedGenerator(gens, _layerBuilder.Build(), visualLogger)); }
private static void printVoronoi(int countOfCells, ISegmendDivider sd) { var l = new Layer2DObject(res); // TODO change rand approach var rnd = new Rand(seed); var c = new VoronoiConverter(sd); var g = new VoronoiGenerator(c); var gg = new VoronoiAreaGenerator(g, rnd); var vd = new VoronoiAreaDrawer(); var areas = gg.GenerateAreas(res, res * .5f, countOfCells); vd.PrintToLayer(l, areas, new Vector2()); var vl = new VisualLogger(); vl.Log(l, "profile"); }