diff --git a/Cupola.csproj b/Cupola/Cupola.csproj
similarity index 79%
rename from Cupola.csproj
rename to Cupola/Cupola.csproj
index 738b95e..fce40f7 100644
--- a/Cupola.csproj
+++ b/Cupola/Cupola.csproj
@@ -1,16 +1,16 @@
-
-
-
- Exe
- net6.0
- enable
- enable
-
-
-
-
-
-
-
-
-
+
+
+
+ Library
+ net7.0-windows10.0.17763.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
diff --git a/Cupola.sln b/Cupola/Cupola.sln
similarity index 97%
rename from Cupola.sln
rename to Cupola/Cupola.sln
index 34e6902..433f1f0 100644
--- a/Cupola.sln
+++ b/Cupola/Cupola.sln
@@ -1,25 +1,25 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.3.32901.215
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cupola", "Cupola.csproj", "{83EBE364-D0B0-4262-8AFC-539506D72116}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {83EBE364-D0B0-4262-8AFC-539506D72116}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {83EBE364-D0B0-4262-8AFC-539506D72116}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {83EBE364-D0B0-4262-8AFC-539506D72116}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {83EBE364-D0B0-4262-8AFC-539506D72116}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {AD483A57-321A-4AD6-A68F-038CC1DB8066}
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.3.32901.215
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cupola", "Cupola.csproj", "{83EBE364-D0B0-4262-8AFC-539506D72116}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {83EBE364-D0B0-4262-8AFC-539506D72116}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {83EBE364-D0B0-4262-8AFC-539506D72116}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {83EBE364-D0B0-4262-8AFC-539506D72116}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {83EBE364-D0B0-4262-8AFC-539506D72116}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {AD483A57-321A-4AD6-A68F-038CC1DB8066}
+ EndGlobalSection
+EndGlobal
diff --git a/GlobalSuppressions.cs b/Cupola/GlobalSuppressions.cs
similarity index 100%
rename from GlobalSuppressions.cs
rename to Cupola/GlobalSuppressions.cs
diff --git a/Cupola/Program.cs b/Cupola/Program.cs
new file mode 100644
index 0000000..c0c596e
--- /dev/null
+++ b/Cupola/Program.cs
@@ -0,0 +1,182 @@
+using ComputeSharp;
+using System.Xml.Linq;
+using Windows.Devices.Geolocation;
+using static Cupola.Program;
+
+namespace Cupola
+{
+ internal partial class Program
+ {
+ public static void RunSingle(string imgDir, string outDir)
+ {
+ ReadWriteTexture2D[] images = Load(imgDir);
+
+ ReadWriteTexture2D finalImage = RunSingle(images);
+
+ finalImage.Save(outDir + ".jpg");
+ }
+
+ public static ReadWriteTexture2D RunSingle(ReadWriteTexture2D[] images)
+ {
+ ReadWriteTexture2D brightest = images[0];
+ ReadWriteTexture2D output = images[0];
+
+ for (int i = 1; i < images.Length; i++)
+ {
+ Console.WriteLine(i.ToString());
+
+ ReadWriteTexture2D temp = images[i];
+
+ GraphicsDevice.GetDefault().For
+ (
+ temp.Width,
+ temp.Height,
+ new Brightest(brightest, temp)
+ );
+
+ GraphicsDevice.GetDefault().For
+ (
+ temp.Width,
+ temp.Height,
+ new Average(temp, output, 0.5f)
+ );
+
+ GraphicsDevice.GetDefault().For
+ (
+ temp.Width,
+ temp.Height,
+ new Average(temp, brightest, 0.6f)
+ );
+
+ output = temp;
+ }
+
+ return output;
+ }
+
+ static void RunMulti(string imgDir, string outDir)
+ {
+ ReadWriteTexture2D[] images = Load(imgDir);
+
+ ReadWriteTexture2D[] imagesOut = RunMulti(images);
+
+ for (int i = 0; i < imagesOut.Length; i++)
+ {
+ imagesOut[i].Save(outDir + "-" + i.ToString() + ".jpg");
+ }
+ }
+
+ public static ReadWriteTexture2D[] RunMulti(ReadWriteTexture2D[] images)
+ {
+ ReadWriteTexture2D[] outputImages = new ReadWriteTexture2D[images.Length];
+
+ ReadWriteTexture2D brightest = images[0];
+ ReadWriteTexture2D output = images[0];
+
+ outputImages[0] = output;
+
+ for (int i = 1; i < images.Length; i++)
+ {
+ Console.WriteLine(i.ToString());
+
+ ReadWriteTexture2D temp = images[i];
+
+ GraphicsDevice.GetDefault().For
+ (
+ temp.Width,
+ temp.Height,
+ new Brightest(brightest, temp)
+ );
+
+ GraphicsDevice.GetDefault().For
+ (
+ temp.Width,
+ temp.Height,
+ new Average(temp, output, 0.5f)
+ );
+
+ GraphicsDevice.GetDefault().For
+ (
+ temp.Width,
+ temp.Height,
+ new Average(temp, brightest, 0.6f)
+ );
+
+ output = temp;
+
+ outputImages[i] = output;
+ }
+
+ return outputImages;
+ }
+
+ private static ReadWriteTexture2D[] Load(string dir)
+ {
+ string[] files = Directory.GetFiles(dir);
+
+ ReadWriteTexture2D[] images = new ReadWriteTexture2D[files.Length];
+
+ for (int i = 0; i < files.Length; i++)
+ {
+ Console.WriteLine(files[i]);
+ images[i] = GraphicsDevice.GetDefault().LoadReadWriteTexture2D(files[i]);
+ }
+
+ return images;
+ }
+
+ [AutoConstructor]
+ public readonly partial struct Brightest : IComputeShader
+ {
+ public readonly IReadWriteNormalizedTexture2D input1;
+ public readonly IReadWriteNormalizedTexture2D input2;
+
+ // Other captured resources or values here...
+
+ public void Execute()
+ {
+ float3 i1 = input1[ThreadIds.XY].RGB;
+ float3 i2 = input2[ThreadIds.XY].RGB;
+
+ float i1Intensity = (i1.X * i1.X) + (i1.Y * i1.Y) + (i1.Z * i1.Z);
+ float i2Intensity = (i2.X * i2.X) + (i2.Y * i2.Y) + (i2.Z * i2.Z);
+
+ if (i1Intensity > i2Intensity)
+ {
+ input1[ThreadIds.XY].RGB = i1;
+ }
+ else
+ {
+ input1[ThreadIds.XY].RGB = i2;
+ }
+ }
+ }
+
+ [AutoConstructor]
+ public readonly partial struct Average : IComputeShader
+ {
+ public readonly IReadWriteNormalizedTexture2D input1;
+ public readonly IReadWriteNormalizedTexture2D input2;
+ public readonly float weight;
+
+ // Other captured resources or values here...
+
+ public void Execute()
+ {
+ float w1 = weight;
+ float w2 = 1 - weight;
+
+ float3 i1 = input1[ThreadIds.XY].RGB;
+ float3 i2 = input2[ThreadIds.XY].RGB;
+
+ float3 o1 = 0;
+
+ o1.X = (i1.X * w1) + (i2.X * w2);
+ o1.Y = (i1.Y * w1) + (i2.Y * w2);
+ o1.Z = (i1.Z * w1) + (i2.Z * w2);
+
+ input1[ThreadIds.XY].RGB = o1;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Program.cs b/Program.cs
deleted file mode 100644
index 4ab71ae..0000000
--- a/Program.cs
+++ /dev/null
@@ -1,169 +0,0 @@
-using ComputeSharp;
-using static Cupola.Program;
-
-namespace Cupola
-{
- internal partial class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Image Dir?");
- string? fileLoc = Console.ReadLine();
-
- if (fileLoc == null)
- throw new ArgumentException("input should not be NULL");
-
- string[] files = Directory.GetFiles(fileLoc);
-
- ReadWriteTexture2D[] images = new ReadWriteTexture2D[files.Length];
-
- for (int i = 0; i < files.Length; i++)
- {
- Console.WriteLine(files[i]);
- images[i] = GraphicsDevice.GetDefault().LoadReadWriteTexture2D(files[i]);
- }
-
- Console.WriteLine("Output: ");
-
- string? name = Console.ReadLine();
-
- if (name == null)
- throw new Exception("UwU");
-
- Console.WriteLine("mode?");
- Console.WriteLine();
- ConsoleKey key = Console.ReadKey().Key;
-
- if (key == ConsoleKey.P)
- {
- ReadWriteTexture2D brightest = images[0];
- ReadWriteTexture2D output = images[0];
-
- for (int i = 1; i < images.Length; i++)
- {
- Console.WriteLine(i.ToString());
-
- ReadWriteTexture2D temp = images[i];
-
- GraphicsDevice.GetDefault().For
- (
- temp.Width,
- temp.Height,
- new Brightest(brightest, temp)
- );
-
- GraphicsDevice.GetDefault().For
- (
- temp.Width,
- temp.Height,
- new Average(temp, output, 0.5f)
- );
-
- GraphicsDevice.GetDefault().For
- (
- temp.Width,
- temp.Height,
- new Average(temp, brightest, 0.6f)
- );
-
- output = temp;
- }
-
- output.Save(name + ".jpg");
- }
- else if (key == ConsoleKey.V)
- {
- ReadWriteTexture2D brightest = images[0];
- ReadWriteTexture2D output = images[0];
-
- output.Save(name + "-" + 0.ToString() + ".jpg");
-
- for (int i = 1; i < images.Length; i++)
- {
- Console.WriteLine(i.ToString());
-
- ReadWriteTexture2D temp = images[i];
-
- GraphicsDevice.GetDefault().For
- (
- temp.Width,
- temp.Height,
- new Brightest(brightest, temp)
- );
-
- GraphicsDevice.GetDefault().For
- (
- temp.Width,
- temp.Height,
- new Average(temp, output, 0.5f)
- );
-
- GraphicsDevice.GetDefault().For
- (
- temp.Width,
- temp.Height,
- new Average(temp, brightest, 0.6f)
- );
-
- output = temp;
-
- output.Save(name + "-" + i.ToString() + ".jpg");
- }
- }
- }
-
- [AutoConstructor]
- public readonly partial struct Brightest : IComputeShader
- {
- public readonly IReadWriteNormalizedTexture2D input1;
- public readonly IReadWriteNormalizedTexture2D input2;
-
- // Other captured resources or values here...
-
- public void Execute()
- {
- float3 i1 = input1[ThreadIds.XY].RGB;
- float3 i2 = input2[ThreadIds.XY].RGB;
-
- float i1Intensity = (i1.X * i1.X) + (i1.Y * i1.Y) + (i1.Z * i1.Z);
- float i2Intensity = (i2.X * i2.X) + (i2.Y * i2.Y) + (i2.Z * i2.Z);
-
- if (i1Intensity > i2Intensity)
- {
- input1[ThreadIds.XY].RGB = i1;
- }
- else
- {
- input1[ThreadIds.XY].RGB = i2;
- }
- }
- }
-
- [AutoConstructor]
- public readonly partial struct Average : IComputeShader
- {
- public readonly IReadWriteNormalizedTexture2D input1;
- public readonly IReadWriteNormalizedTexture2D input2;
- public readonly float weight;
-
- // Other captured resources or values here...
-
- public void Execute()
- {
- float w1 = weight;
- float w2 = 1 - weight;
-
- float3 i1 = input1[ThreadIds.XY].RGB;
- float3 i2 = input2[ThreadIds.XY].RGB;
-
- float3 o1 = 0;
-
- o1.X = (i1.X * w1) + (i2.X * w2);
- o1.Y = (i1.Y * w1) + (i2.Y * w2);
- o1.Z = (i1.Z * w1) + (i2.Z * w2);
-
- input1[ThreadIds.XY].RGB = o1;
- }
- }
- }
-}
\ No newline at end of file