diff --git a/BlazorWebAssembly/Client/Core/ImageReconstructor.cs b/BlazorWebAssembly/Client/Core/ImageReconstructor.cs index 456d209..0cf31e5 100644 --- a/BlazorWebAssembly/Client/Core/ImageReconstructor.cs +++ b/BlazorWebAssembly/Client/Core/ImageReconstructor.cs @@ -79,7 +79,8 @@ public async void ReadFile(Stream stream) private (MinecraftBlock, TextureMetadata) FindBestMatchingTexture(Rgba32 pixel) { - RGB col = new() { r = pixel.R, g = pixel.G, b = pixel.B }; + float alpha = pixel.A / 255f; + RGB col = new() { r = (byte)(pixel.R * alpha), g = (byte)(pixel.G * alpha), b = (byte)(pixel.B * alpha) }; if(knownRGBs.ContainsKey(col)) { diff --git a/BlazorWebAssembly/Client/Pages/Index.razor b/BlazorWebAssembly/Client/Pages/Index.razor index c05ce7c..6ea8041 100644 --- a/BlazorWebAssembly/Client/Pages/Index.razor +++ b/BlazorWebAssembly/Client/Pages/Index.razor @@ -20,13 +20,13 @@ protected override async Task OnInitializedAsync() { + imageReconstructor.OnOutputChanged += StateHasChanged; //blockData persists across page swaps. no need to get it again. if (imageReconstructor.blockData.Length != 0) return; - var path = "images/tex_metadata.json"; + string path = "images/tex_metadata.json"; string json = await Http.GetStringAsync(path); imageReconstructor.blockData = JsonSerializer.Deserialize(json) ?? new MinecraftBlock[0]; - imageReconstructor.OnOutputChanged += StateHasChanged; } ~Index() @@ -63,12 +63,12 @@ Block Size: @blockSize - - Contrast Bias: @imageReconstructor.ContrastBias + + Smoothness: @imageReconstructor.ContrastBias - - Greedy Selection Threshold: @imageReconstructor.GreedyTextureThreshold + + Greediness: @imageReconstructor.GreedyTextureThreshold diff --git a/BlazorWebAssembly/Client/Pages/Settings.razor b/BlazorWebAssembly/Client/Pages/Settings.razor index 8f2751d..73e825a 100644 --- a/BlazorWebAssembly/Client/Pages/Settings.razor +++ b/BlazorWebAssembly/Client/Pages/Settings.razor @@ -7,7 +7,10 @@

Settings

- + + + + Block @@ -28,5 +31,11 @@ @code { - + private string filterString = ""; + private bool FilterWrapper(MinecraftBlock block) => FilterBlock(block, filterString); + private bool FilterBlock(MinecraftBlock block, string filter) + { + //inefficient but ok + return block.blockName.ToLower().Contains(filter.ToLower()); + } } diff --git a/BlazorWebAssembly/Client/Shared/MainLayout.razor b/BlazorWebAssembly/Client/Shared/MainLayout.razor index fc0a45f..0717de8 100644 --- a/BlazorWebAssembly/Client/Shared/MainLayout.razor +++ b/BlazorWebAssembly/Client/Shared/MainLayout.razor @@ -9,7 +9,7 @@
- About +
diff --git a/BlazorWebAssembly/Client/Shared/NavMenu.razor b/BlazorWebAssembly/Client/Shared/NavMenu.razor index 32a2c89..25cc67c 100644 --- a/BlazorWebAssembly/Client/Shared/NavMenu.razor +++ b/BlazorWebAssembly/Client/Shared/NavMenu.razor @@ -1,6 +1,6 @@