private void BrushLine(Vector2 _from, Vector2 _to, Canvas.Brush _brush) { var aCrd = GetPixelAtWld(_from); var bCrd = GetPixelAtWld(_to); canvas.BrushLine(aCrd, bCrd, _brush); }
private void PaintWaterways() { var wws = Host.WaterFlux; var fMin = float.PositiveInfinity; var fMax = float.NegativeInfinity; foreach (var ww in wws) { if (ww.Flux < fMin) { fMin = ww.Flux; } if (ww.Flux > fMax) { fMax = ww.Flux; } } var fSpan = fMax - fMin; float debugPaintSizeMax = 10; //TODO debug //float debugPaintFluxCutoff = 0f; var debugPaintFluxCutoff = fSpan * 0.1f; var sitePositions = Host.TMesh.GetAllSitePositions(); for (var wIdx = 0; wIdx < wws.Length; ++wIdx) { m_Progress.Update(wIdx / wws.Length, "Painting Waterways"); var ww = wws[wIdx]; if (ww.NodeTo == null) { continue; } //if (ww.Flux < (fMin + fSpan / 16f)) // TODO in Settings? // continue; var fNorm = (ww.Flux - fMin) / fSpan; if (fNorm < debugPaintFluxCutoff) { continue; } if (sitePositions[ww.SiteIdx].z < Host.WaterSurfaceZ) { continue; } var paintSize = (int)(debugPaintSizeMax * fNorm); var a = sitePositions[ww.SiteIdx].ToVec2(); var b = sitePositions[ww.NodeTo.SiteIdx].ToVec2(); var brush = new Canvas.Brush(Canvas.Brush.Shape.Circle, paintSize, new Color(0f, 0f, 1f)); //TODO Dynamic sizing BrushLine(a, b, brush); } }
public void PaintRivers() { var fMin = float.PositiveInfinity; var fMax = float.NegativeInfinity; foreach (var ww in Host.WaterFlux) { if (ww.Flux < fMin) { fMin = ww.Flux; } if (ww.Flux > fMax) { fMax = ww.Flux; } } var fSpan = fMax - fMin; float debugPaintSizeMax = 10; //TODO debug var sitePositions = Host.TMesh.GetAllSitePositions(); for (var rIdx = 0; rIdx < Host.RiverSites.Length; ++rIdx) { m_Progress.Update((float)rIdx / Host.RiverSites.Length, "Painting Waterways"); var sIdx = Host.RiverSites[rIdx]; var ww = Host.WaterFlux[sIdx]; if (ww.NodeTo == null) { continue; } var fNorm = (ww.Flux - fMin) / fSpan; //TODO use river ww span (not total) var paintSize = (int)(debugPaintSizeMax * fNorm); var a = sitePositions[ww.SiteIdx].ToVec2(); var b = sitePositions[ww.NodeTo.SiteIdx].ToVec2(); var colWater = Host.TBiome.BiomeWater.ColTerrain; var brush = new Canvas.Brush(Canvas.Brush.Shape.Circle, paintSize, colWater); //TODO Dynamic sizing BrushLine(a, b, brush); } }