Add mip maps to importer

This commit is contained in:
KillzXGaming 2018-11-19 13:08:41 -05:00
parent 2e1d311649
commit d302808d24
6 changed files with 30 additions and 6 deletions

1
.gitignore vendored
View file

@ -24,3 +24,4 @@ Release/
.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm
.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide
.vs/Switch_Toolbox/v15/.suo
.vs/Switch_Toolbox/v15/.suo

Binary file not shown.

View file

@ -470,9 +470,9 @@ namespace FirstPlugin
case ((int)GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC5_SNORM):
decomp = DDSCompressor.DecompressBC5(data, (int)Width, (int)Height, true); break;
case ((int)GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_TC_R8_G8_B8_A8_SNORM):
break;
decomp = DDS_PixelDecode.DecodeR8G8B8A8(data, (int)Width, (int)Height); break;
case ((int)GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_TC_R8_G8_B8_A8_UINT):
break;
decomp = DDS_PixelDecode.DecodeR8G8B8A8(data, (int)Width, (int)Height); break;
default:
decomp = Properties.Resources.TextureError;
Console.WriteLine($"Format {Format} not supported!");

View file

@ -53,7 +53,6 @@ namespace FirstPlugin
mipLevelCounterLabel.Text = $"{CurMipDisplayLevel} / {textureData.mipmaps[CurArrayDisplayLevel].Count - 1}";
arrayLevelCounterLabel.Text = $"{CurArrayDisplayLevel} / {textureData.mipmaps.Count - 1}";
if (Thread != null && Thread.IsAlive)
Thread.Abort();

View file

@ -184,6 +184,7 @@
this.MipmapNum.Name = "MipmapNum";
this.MipmapNum.Size = new System.Drawing.Size(130, 16);
this.MipmapNum.TabIndex = 20;
this.MipmapNum.ValueChanged += new System.EventHandler(this.MipmapNum_ValueChanged);
//
// WidthLabel
//
@ -248,7 +249,8 @@
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.ForeColor = System.Drawing.Color.White;
this.Text = "BinaryTextureImporterList";
this.Text = "Texture Importer";
this.Load += new System.EventHandler(this.BinaryTextureImporterList_Load);
((System.ComponentModel.ISupportInitialize)(this.SwizzleNum)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.MipmapNum)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();

View file

@ -162,7 +162,29 @@ namespace FirstPlugin
formatComboBox.SelectedItem = SelectedTexSettings.Format;
SetupSettings();
MipmapNum.Value = 0;
uint num = Math.Max(SelectedTexSettings.TexHeight, SelectedTexSettings.TexWidth);
while (true)
{
num >>= 1;
if (num > 0)
++MipmapNum.Value;
else
break;
}
MipmapNum.Maximum = MipmapNum.Value;
}
}
private void BinaryTextureImporterList_Load(object sender, EventArgs e)
{
}
private void MipmapNum_ValueChanged(object sender, EventArgs e)
{
SelectedTexSettings.MipCount = (uint)MipmapNum.Value;
}
}
}