diff --git a/SDFMapCreator.sln.DotSettings.user b/SDFMapCreator.sln.DotSettings.user
index 894dc10..95d762b 100644
--- a/SDFMapCreator.sln.DotSettings.user
+++ b/SDFMapCreator.sln.DotSettings.user
@@ -4,6 +4,7 @@
ForceIncluded
ForceIncluded
ForceIncluded
+ ForceIncluded
ForceIncluded
ForceIncluded
ForceIncluded
diff --git a/SDFMapCreator/ImageUtil.cs b/SDFMapCreator/ImageUtil.cs
index feb119e..eba36f0 100644
--- a/SDFMapCreator/ImageUtil.cs
+++ b/SDFMapCreator/ImageUtil.cs
@@ -15,12 +15,15 @@
*/
using System.Numerics;
+using LineWalker;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
namespace SDFMapCreator;
public static class ImageUtil {
+ static Logger logger = Logger.GetInstance();
+
public static T[,] LoadImage(string path) where T : struct, IEquatable {
var image = SixLabors.ImageSharp.Image.Load(path);
return image switch {
@@ -162,7 +165,7 @@ public static class ImageUtil {
Vector4[,] => 4,
_ => throw new NotSupportedException($"Type {typeof(T)} is not supported.")
};
- Console.Write($"Writing image {path}...");
+ logger.Log($"Writing image {path}...");
using Image image = new(width, height);
image.ProcessPixelRows(accessor => {
for (var y = 0; y < height; y++) {
@@ -185,12 +188,12 @@ public static class ImageUtil {
}
}
});
- Console.WriteLine($"Done!");
+ logger.Log($"Writing image {path}...Done", true);
image.Save(path);
}
static void ImageData(SixLabors.ImageSharp.Image image1, string path) {
- Console.WriteLine(
+ logger.Log(
$"""
Image file: {path}
Resolution: {image1.Width}x{image1.Height}
diff --git a/SDFMapCreator/Program.cs b/SDFMapCreator/Program.cs
index 82d2af1..a42e2c8 100644
--- a/SDFMapCreator/Program.cs
+++ b/SDFMapCreator/Program.cs
@@ -71,8 +71,6 @@ public static class Program {
static uint width;
static uint height;
- static void ConsoleUpdateLine(string s) => Console.Write("\r" + s);
-
public static void Main(string[] args) {
var parser = Parser.Default;
diff --git a/SDFMapCreator/SDFMapCreator.csproj b/SDFMapCreator/SDFMapCreator.csproj
index 6f143e0..2e69e0c 100644
--- a/SDFMapCreator/SDFMapCreator.csproj
+++ b/SDFMapCreator/SDFMapCreator.csproj
@@ -16,7 +16,7 @@
-
+
diff --git a/SDFMapCreator/SdfKernels.cs b/SDFMapCreator/SdfKernels.cs
index 7b5f100..ffe4d5e 100644
--- a/SDFMapCreator/SdfKernels.cs
+++ b/SDFMapCreator/SdfKernels.cs
@@ -20,10 +20,13 @@ using ILGPU.Runtime;
using ILGPU.Runtime.CPU;
using ILGPU.Runtime.Cuda;
using ILGPU.Runtime.OpenCL;
+using LineWalker;
namespace SDFMapCreator;
public partial class SdfKernels {
+ Logger logger = Logger.GetInstance();
+
Context gpuContext;
Accelerator accelerator;
public SdfKernels() {
@@ -36,30 +39,30 @@ public partial class SdfKernels {
.EnableAlgorithms()
);
- Console.WriteLine("Reading available accelerators (CUDA only)...");
+ logger.Log("Reading available accelerators (CUDA only)...");
foreach (var device in gpuContext.GetCudaDevices()) {
accelerator = device.CreateAccelerator(gpuContext);
- Console.WriteLine($"Found accelerator: {accelerator.Name} ({accelerator.AcceleratorType})");
+ logger.Log($"Found accelerator: {accelerator.Name} ({accelerator.AcceleratorType})");
}
- Console.WriteLine("Reading available accelerators (OpenCL only)...");
+ logger.Log("Reading available accelerators (OpenCL only)...");
foreach (var device in gpuContext.GetCLDevices()) {
accelerator = device.CreateAccelerator(gpuContext);
- Console.WriteLine($"Found accelerator: {accelerator.Name} ({accelerator.AcceleratorType})");
+ logger.Log($"Found accelerator: {accelerator.Name} ({accelerator.AcceleratorType})");
}
- Console.WriteLine("Reading available accelerators (CPU only)...");
+ logger.Log("Reading available accelerators (CPU only)...");
foreach (var device in gpuContext.GetCPUDevices()) {
accelerator = device.CreateAccelerator(gpuContext);
- Console.WriteLine($"Found accelerator: {accelerator.Name} ({accelerator.AcceleratorType})");
+ logger.Log($"Found accelerator: {accelerator.Name} ({accelerator.AcceleratorType})");
}
accelerator = gpuContext.GetPreferredDevice(false).CreateAccelerator(gpuContext);
- Console.WriteLine($"Using accelerator: {accelerator.Name} ({accelerator.AcceleratorType})");
+ logger.Log($"Using accelerator: {accelerator.Name} ({accelerator.AcceleratorType})");
}
public SdfKernels(DeviceType device) {
- Console.WriteLine($"Looking up for {device.ToString()} accelerators...");
+ logger.Log($"Looking up for {device.ToString()} accelerators...");
var builder = Context.Create();
switch (device) {
case DeviceType.CPU: builder.CPU(); break;
@@ -73,7 +76,7 @@ public partial class SdfKernels {
.ToContext();
accelerator = gpuContext.GetPreferredDevice(false).CreateAccelerator(gpuContext);
- Console.WriteLine($"Using accelerator: {accelerator.Name} ({accelerator.AcceleratorType})");
+ logger.Log($"Using accelerator: {accelerator.Name} ({accelerator.AcceleratorType})");
}
public void SelfMask(Vector3[,] input, out Vector3[,] mask) {