Skip to content

Commit

Permalink
Well, kinda works now, but its kinda shit
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans Doof committed Dec 15, 2020
1 parent 6b77107 commit 23bf95b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion App.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
Expand Down
2 changes: 1 addition & 1 deletion ColorMatch3D.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>ColorMatch3D</RootNamespace>
<AssemblyName>ColorMatch3D</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
Expand Down
4 changes: 2 additions & 2 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@
</WrapPanel>
<Label ToolTip="Use interpolation if the 3D LUT needs to generalize better and not merely fit one image">Interpolation</Label>
<WrapPanel>
<RadioButton x:Name="interpNone_radio" Checked="interp_radio_Checked" IsChecked="True">None (default)</RadioButton>
<RadioButton x:Name="interpDualLinear_radio" Checked="interp_radio_Checked" ToolTip="Takes two surrounding values in each direction, calculates the change, averages all info.">Dual Linear (experimental, slow)</RadioButton>
<RadioButton x:Name="interpNone_radio" Checked="Interp_radio_Checked" IsChecked="True">None (default)</RadioButton>
<RadioButton x:Name="interpDualLinear_radio" Checked="Interp_radio_Checked" ToolTip="Takes two surrounding values in each direction, calculates the change, averages all info.">Dual Linear (experimental, slow)</RadioButton>
</WrapPanel>
</StackPanel>
</Grid>
Expand Down
17 changes: 13 additions & 4 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public MainWindow()

private void readGUISettings()
{
try {
if(aggrAbsolute_radio.IsChecked == true)
{
aggregateWhat = AggregateVariable.ABSOLUTE;
Expand All @@ -45,11 +46,13 @@ private void readGUISettings()
{
interpolationType = InterpolationType.NONE;
}
if(interpDualLinear_radio.IsChecked == true)
if (interpDualLinear_radio.IsChecked == true)
{
interpolationType = InterpolationType.DUALLINEAR;
}

}
catch (Exception e) { //fuck, it's just called too early and the objects dont exist. whatever.
}
//Win.MessageBox.Show(aggregateWhat.ToString());
}

Expand Down Expand Up @@ -578,7 +581,6 @@ public struct Color
if (interpolationType == InterpolationType.DUALLINEAR)
{
int unsolvedNaNs = 0;
int hintsRequiredInFirstLoop = 10; // How many hints (directions) are required during the first loop to calculate the correct value. The start value is arbitrary
bool thisIsNaN = false;


Expand Down Expand Up @@ -634,6 +636,7 @@ public struct Color
FloatColor cubeHere = new FloatColor();
FloatColor cubeThere = new FloatColor();

int hintsRequiredInFirstLoop = directions.Length; // How many hints (directions) are required during the first loop to calculate the correct value. The start value is arbitrary
int hintsRequired = hintsRequiredInFirstLoop;
int NaNsSolvedInThisLoop = 0;
AverageData averageOfResolvedHints = new AverageData();
Expand All @@ -643,6 +646,7 @@ public struct Color
do
{
NaNsSolvedInThisLoop = 0;
unsolvedNaNs = 0;
// Go through all cells
for (currentLocation.X = 0; currentLocation.X < outputValueCount; currentLocation.X++)
{
Expand Down Expand Up @@ -724,6 +728,9 @@ public struct Color
}
cube[(int)currentLocation.X, (int)currentLocation.Y, (int)currentLocation.Z].color = averageOfResolvedHints.color / averageOfResolvedHints.divisor;
NaNsSolvedInThisLoop++;
} else
{
unsolvedNaNs++;
}
}

Expand All @@ -739,6 +746,8 @@ public struct Color
break;
}
}

progress.Report(new MatchReport("Interpolating, Dual Linear algorithm [" + unsolvedNaNs + " unsolved remaining] "));
} while (unsolvedNaNs > 0);
}

Expand Down Expand Up @@ -827,7 +836,7 @@ private void AggrVariable_radio_Checked(object sender, win.RoutedEventArgs e)
readGUISettings();
}

private void interp_radio_Checked(object sender, win.RoutedEventArgs e)
private void Interp_radio_Checked(object sender, win.RoutedEventArgs e)
{
readGUISettings();
}
Expand Down

0 comments on commit 23bf95b

Please sign in to comment.