Add option to view cubemap arrays

This commit is contained in:
KillzXGaming 2019-06-27 20:12:44 -04:00
parent 1b823f022a
commit 777ccc4fb6
5 changed files with 37 additions and 3 deletions

Binary file not shown.

View file

@ -139,7 +139,6 @@
//
// btnRightArray
//
this.btnRightArray.Enabled = false;
this.btnRightArray.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnRightArray.Location = new System.Drawing.Point(552, 51);
this.btnRightArray.Name = "btnRightArray";
@ -147,6 +146,7 @@
this.btnRightArray.TabIndex = 18;
this.btnRightArray.Text = ">";
this.btnRightArray.UseVisualStyleBackColor = true;
this.btnRightArray.Click += new System.EventHandler(this.btnRightArray_Click);
//
// btnLeftArray
//
@ -158,6 +158,7 @@
this.btnLeftArray.TabIndex = 17;
this.btnLeftArray.Text = "<";
this.btnLeftArray.UseVisualStyleBackColor = true;
this.btnLeftArray.Click += new System.EventHandler(this.btnLeftArray_Click);
//
// pbRightFace
//

View file

@ -66,13 +66,20 @@ namespace Switch_Toolbox.Library.Forms
private const int LEFT_FACE = 4;
private const int RIGHT_FACE = 5;
private void UpdateArrayLevel(int ArrayLevel = 0)
private int CurArrayDisplayLevel = 0;
private int TotalArrayCount = 0;
private void UpdateArrayLevel()
{
if (ActiveTexture == null) return;
TotalArrayCount = (int)(ActiveTexture.ArrayCount / 6) - 1;
arrayLevelCounterLabel.Text = $"Array Level: {CurArrayDisplayLevel} / {TotalArrayCount}";
for (int i = 0; i < 6; i++)
{
var CubeFaceBitmap = ActiveTexture.GetBitmap(i * (ArrayLevel + 1));
var CubeFaceBitmap = ActiveTexture.GetBitmap(i + (CurArrayDisplayLevel * 6));
if (!DisplayAlpha)
BitmapExtension.SetChannel(CubeFaceBitmap, ActiveTexture.RedChannel, ActiveTexture.GreenChannel, ActiveTexture.BlueChannel, STChannelType.One);
@ -89,6 +96,16 @@ namespace Switch_Toolbox.Library.Forms
else if (i == RIGHT_FACE)
pbRightFace.Image = CubeFaceBitmap;
}
if (CurArrayDisplayLevel != TotalArrayCount)
btnRightArray.Enabled = true;
else
btnRightArray.Enabled = false;
if (CurArrayDisplayLevel != 0)
btnLeftArray.Enabled = true;
else
btnLeftArray.Enabled = false;
}
private void chkDisplayAlpha_CheckedChanged(object sender, EventArgs e)
@ -96,5 +113,21 @@ namespace Switch_Toolbox.Library.Forms
DisplayAlpha = chkDisplayAlpha.Checked;
UpdateArrayLevel();
}
private void btnRightArray_Click(object sender, EventArgs e)
{
if (CurArrayDisplayLevel != TotalArrayCount)
CurArrayDisplayLevel += 1;
UpdateArrayLevel();
}
private void btnLeftArray_Click(object sender, EventArgs e)
{
if (CurArrayDisplayLevel != 0)
CurArrayDisplayLevel -= 1;
UpdateArrayLevel();
}
}
}