Skip to content

Commit

Permalink
Hotfix about generation of heightmap with color option enabled withou…
Browse files Browse the repository at this point in the history
…t cm
  • Loading branch information
Zarbuz committed Jul 29, 2021
1 parent b0f5689 commit 282299a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions SchematicToVoxCore/Converter/Image/DirectBitmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,25 @@ namespace FileToVox.Converter.Image
{
public class DirectBitmap : IDisposable
{
#region Fields

public int[] Bits { get; }
public bool Disposed { get; private set; }
public int Length { get; }
public int Width { get; }
public int Height { get; private set; }
public Dictionary<int, int> Heights { get; private set; }


#endregion

public DirectBitmap(Bitmap bitmap, int height)
{
if (bitmap == null)
{
return;
}

Width = bitmap.Width;
Length = bitmap.Height;
Height = height;
Expand Down Expand Up @@ -91,6 +101,7 @@ public int GetHeight(int x, int y)
public void Dispose()
{
if (Disposed) return;

Disposed = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion SchematicToVoxCore/FileToVox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
<ApplicationIcon />
<Authors>Zarbuz</Authors>
<Version>1.12.5</Version>
<Version>1.12.6</Version>
<PackageProjectUrl>https://github.com/Zarbuz/FileToVox</PackageProjectUrl>
<RepositoryUrl>https://github.com/Zarbuz/FileToVox</RepositoryUrl>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions SchematicToVoxCore/Utils/ImageUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public static Schematic WriteSchematicFromImage(Bitmap bitmap, Bitmap colorBitma
}
else if (heightmapStep.EnableColor)
{
if (heightmapStep.ColorLimit != 256 || colorBitmap.CountColor() > 256)
if (heightmapStep.ColorLimit != 256 || bitmap.CountColor() > 256)
{
Quantizer.Quantizer quantizer = new Quantizer.Quantizer();
colorBitmap = quantizer.QuantizeImage(colorBitmap, 10, 70, heightmapStep.ColorLimit);
bitmap = quantizer.QuantizeImage(bitmap, 10, 70, heightmapStep.ColorLimit);
}
}

Expand Down

0 comments on commit 282299a

Please sign in to comment.