Started pre-release cleanup
This commit is contained in:
20
.run/SDFMapCreator.run.xml
Normal file
20
.run/SDFMapCreator.run.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="SDFMapCreator" type="DotNetProject" factoryName=".NET Project">
|
||||
<option name="EXE_PATH" value="$PROJECT_DIR$/SDFMapCreator/bin/Release/net8.0/SDFMapCreator" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/SDFMapCreator/bin/Release/net8.0" />
|
||||
<option name="PASS_PARENT_ENVS" value="1" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="PROJECT_PATH" value="$PROJECT_DIR$/SDFMapCreator/SDFMapCreator.csproj" />
|
||||
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
|
||||
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
|
||||
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
|
||||
<option name="PROJECT_KIND" value="DotNetCore" />
|
||||
<option name="PROJECT_TFM" value="net8.0" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -36,17 +36,6 @@ public static class Program {
|
||||
Images.Add(new(pixels, pixels.GetLength(0), pixels.GetLength(1)));
|
||||
}
|
||||
|
||||
/*
|
||||
var pixels = ImageUtil.LoadImage<Vector3>($"./sphereempty.png");
|
||||
Images.Add(new(pixels, pixels.GetLength(0), pixels.GetLength(1)));
|
||||
pixels = ImageUtil.LoadImage<Vector3>($"./spherehalf.png");
|
||||
Images.Add(new(pixels, pixels.GetLength(0), pixels.GetLength(1)));
|
||||
pixels = ImageUtil.LoadImage<Vector3>($"./spherecut.png");
|
||||
Images.Add(new(pixels, pixels.GetLength(0), pixels.GetLength(1)));
|
||||
pixels = ImageUtil.LoadImage<Vector3>($"./spherefull.png");
|
||||
Images.Add(new(pixels, pixels.GetLength(0), pixels.GetLength(1)));
|
||||
*/
|
||||
|
||||
//check if all the images in Images are the same resolution
|
||||
if (Images.Select(img => (img.Width, img.Height)).Distinct().Count() > 1) {
|
||||
Console.WriteLine("Error: Not all images have the same resolution.");
|
||||
@@ -171,29 +160,6 @@ public static class Program {
|
||||
static Vector3[,] Gradient(TransitionMaskData mask, SDFData sdfA, SDFData sdfB) {
|
||||
var sw = new Stopwatch();
|
||||
sw.Start();
|
||||
/*Vector3[,] temp = new Vector3[width, height];
|
||||
|
||||
var min = MAX;
|
||||
var max = MIN;
|
||||
|
||||
Console.WriteLine("Running gradient generation...");
|
||||
Parallel.For(0, width * height, parallelOptions, (i) =>
|
||||
{
|
||||
int x = (int)(i % width);
|
||||
int y = (int)(i / width);
|
||||
|
||||
if (mask.Mask[x, y].X == 0 || mask.Mask[x, y].Y > 0) return;
|
||||
|
||||
var a = sdfA.SDF[x, y].X;
|
||||
var b = sdfB.SDF[x, y].X;
|
||||
|
||||
var gradient = a / (a + b);
|
||||
temp[x, y] = new(Remap(gradient, 0, 1, MIN, MAX));
|
||||
|
||||
if (gradient < min) min = gradient;
|
||||
if (gradient > max) max = gradient;
|
||||
});*/
|
||||
|
||||
kernels.Gradient(mask.Mask, sdfA.SDF, sdfB.SDF, out var temp);
|
||||
Console.WriteLine($"Gradient Time: {sw.Elapsed.TotalSeconds:N4}s ({width * height / (float)sw.Elapsed.TotalSeconds:N0} pixels/s)");
|
||||
return temp;
|
||||
@@ -235,8 +201,7 @@ public static class Program {
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
static float EuclideanDistance(Vector2 a, Vector2 b) =>
|
||||
MathF.Sqrt(MathF.Pow(a.X - b.X, 2) + MathF.Pow(a.Y - b.Y, 2));
|
||||
static float EuclideanDistance(Vector2 a, Vector2 b) => MathF.Sqrt(MathF.Pow(a.X - b.X, 2) + MathF.Pow(a.Y - b.Y, 2));
|
||||
|
||||
static Vector3[,] GetABMask(Vector3[,] A, Vector3[,] B) {
|
||||
kernels.ABMask(A, B, out var temp);
|
||||
|
||||
@@ -5,9 +5,15 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AssemblyName>SDFMapTool</AssemblyName>
|
||||
<Company>Circle2Labs</Company>
|
||||
<Product>SDFMapTool</Product>
|
||||
<AssemblyVersion>1.0</AssemblyVersion>
|
||||
<FileVersion>1.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommandLineParser" Version="2.9.1" />
|
||||
<PackageReference Include="ILGPU" Version="1.5.2"/>
|
||||
<PackageReference Include="ILGPU.Algorithms" Version="1.5.2"/>
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.7"/>
|
||||
|
||||
@@ -133,12 +133,6 @@ public partial class SdfKernels {
|
||||
gradient.Y += i * image[x, y + i].X;
|
||||
}
|
||||
|
||||
/*
|
||||
output[x, y] = new Vector3(float.Abs((gradient.X * 0.5f) + 0.5f),
|
||||
float.Abs((gradient.Y * 0.5f) + 0.5f), 0.5f);
|
||||
return;
|
||||
*/
|
||||
|
||||
if (gradient == Vector2.Zero) {
|
||||
output[x, y] = value;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user