Improved logging
This commit is contained in:
@@ -48,6 +48,8 @@ public static class ArrayExt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class Program {
|
public class Program {
|
||||||
private const float MAX = 65535f;
|
private const float MAX = 65535f;
|
||||||
private const float MIN = 0f;
|
private const float MIN = 0f;
|
||||||
@@ -59,6 +61,10 @@ public class Program {
|
|||||||
static List<SDFData> SDFs = new();
|
static List<SDFData> SDFs = new();
|
||||||
static List<float3[,]> Gradients = new();
|
static List<float3[,]> Gradients = new();
|
||||||
|
|
||||||
|
static void ConsoleUpdateLine(string s) {
|
||||||
|
Console.Write("\r"+s);
|
||||||
|
}
|
||||||
|
|
||||||
static void LoadImage(string imgPath) {
|
static void LoadImage(string imgPath) {
|
||||||
var image = new MagickImage(imgPath);
|
var image = new MagickImage(imgPath);
|
||||||
float3[,] pixels;
|
float3[,] pixels;
|
||||||
@@ -179,7 +185,7 @@ public class Program {
|
|||||||
lock(maskData.Edges) maskData.Edges.Add(new(x, y));
|
lock(maskData.Edges) maskData.Edges.Add(new(x, y));
|
||||||
iterCount++;
|
iterCount++;
|
||||||
if (iterCount % (width * height / 100) == 0) {
|
if (iterCount % (width * height / 100) == 0) {
|
||||||
Console.WriteLine($"Progress: {iterCount/(width*height):P}% | {iterCount/(sw.Elapsed.TotalSeconds):N0} pixels/s");
|
ConsoleUpdateLine($"Progress: {iterCount/(width*height):P}% | {iterCount/(sw.Elapsed.TotalSeconds):N0} pixels/s");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
@@ -238,7 +244,7 @@ public class Program {
|
|||||||
if (minDist > AbsMax) AbsMax = minDist;
|
if (minDist > AbsMax) AbsMax = minDist;
|
||||||
iterCount++;
|
iterCount++;
|
||||||
if (iterCount % (width * height / 100) == 0) {
|
if (iterCount % (width * height / 100) == 0) {
|
||||||
Console.WriteLine($"Progress: {iterCount/(width*height):P}% | {iterCount/(sw.Elapsed.TotalSeconds):N0} pixels/s");
|
ConsoleUpdateLine($"Progress: {iterCount/(width*height):P}% | {iterCount/(sw.Elapsed.TotalSeconds):N0} pixels/s");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user