Compare commits
2 Commits
1c136880aa
...
84a49bb2a8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84a49bb2a8 | ||
|
|
01a92b2099 |
@@ -59,12 +59,15 @@ public class Program {
|
|||||||
private const bool outputMasks = true;
|
private const bool outputMasks = true;
|
||||||
private const bool outputSDFs = true;
|
private const bool outputSDFs = true;
|
||||||
private const bool outputGradients = true;
|
private const bool outputGradients = true;
|
||||||
|
static readonly ParallelOptions parallelOptions = new() { MaxDegreeOfParallelism = MAX_THREADS };
|
||||||
static List<ImageData> Images = new();
|
static List<ImageData> Images = new();
|
||||||
static List<MaskData> Masks = new();
|
static List<MaskData> Masks = new();
|
||||||
static List<SDFData> SDFs = new();
|
static List<SDFData> SDFs = new();
|
||||||
static List<float3[,]> Gradients = new();
|
static List<float3[,]> Gradients = new();
|
||||||
|
|
||||||
static readonly ParallelOptions parallelOptions = new() { MaxDegreeOfParallelism = MAX_THREADS };
|
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);
|
||||||
@@ -182,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/(float)(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();
|
||||||
@@ -241,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/(float)(width*height):P} | {iterCount/(sw.Elapsed.TotalSeconds):N0} pixels/s");
|
ConsoleUpdateLine($"Progress: {iterCount/(width*height):P}% | {iterCount/(sw.Elapsed.TotalSeconds):N0} pixels/s");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -326,4 +329,4 @@ public class Program {
|
|||||||
static T Remap<T>(T value, T min, T max, T newMin, T newMax)
|
static T Remap<T>(T value, T min, T max, T newMin, T newMax)
|
||||||
where T : INumber<T>, ISubtractionOperators<T, T, T>, IMultiplyOperators<T, T, T>, IAdditionOperators<T, T, T>
|
where T : INumber<T>, ISubtractionOperators<T, T, T>, IMultiplyOperators<T, T, T>, IAdditionOperators<T, T, T>
|
||||||
=> (value - min) / (max - min) * (newMax - newMin) + newMin;
|
=> (value - min) / (max - min) * (newMax - newMin) + newMin;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user