mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-23 04:53:09 +00:00
Add option to toggle alpha for cubemap view
This commit is contained in:
parent
1c49911d47
commit
1b823f022a
5 changed files with 29 additions and 0 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -38,6 +38,7 @@
|
|||
this.btnRightArray = new Switch_Toolbox.Library.Forms.STButton();
|
||||
this.btnLeftArray = new Switch_Toolbox.Library.Forms.STButton();
|
||||
this.pbRightFace = new Switch_Toolbox.Library.Forms.PictureBoxCustom();
|
||||
this.chkDisplayAlpha = new Switch_Toolbox.Library.Forms.STCheckBox();
|
||||
this.contentContainer.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbTopFace)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbFrontFace)).BeginInit();
|
||||
|
@ -50,6 +51,7 @@
|
|||
// contentContainer
|
||||
//
|
||||
this.contentContainer.BackColor = System.Drawing.Color.White;
|
||||
this.contentContainer.Controls.Add(this.chkDisplayAlpha);
|
||||
this.contentContainer.Controls.Add(this.arrayLevelCounterLabel);
|
||||
this.contentContainer.Controls.Add(this.btnRightArray);
|
||||
this.contentContainer.Controls.Add(this.btnLeftArray);
|
||||
|
@ -69,6 +71,7 @@
|
|||
this.contentContainer.Controls.SetChildIndex(this.btnLeftArray, 0);
|
||||
this.contentContainer.Controls.SetChildIndex(this.btnRightArray, 0);
|
||||
this.contentContainer.Controls.SetChildIndex(this.arrayLevelCounterLabel, 0);
|
||||
this.contentContainer.Controls.SetChildIndex(this.chkDisplayAlpha, 0);
|
||||
//
|
||||
// pbTopFace
|
||||
//
|
||||
|
@ -167,6 +170,17 @@
|
|||
this.pbRightFace.TabIndex = 20;
|
||||
this.pbRightFace.TabStop = false;
|
||||
//
|
||||
// chkDisplayAlpha
|
||||
//
|
||||
this.chkDisplayAlpha.AutoSize = true;
|
||||
this.chkDisplayAlpha.Location = new System.Drawing.Point(421, 94);
|
||||
this.chkDisplayAlpha.Name = "chkDisplayAlpha";
|
||||
this.chkDisplayAlpha.Size = new System.Drawing.Size(90, 17);
|
||||
this.chkDisplayAlpha.TabIndex = 21;
|
||||
this.chkDisplayAlpha.Text = "Display Alpha";
|
||||
this.chkDisplayAlpha.UseVisualStyleBackColor = true;
|
||||
this.chkDisplayAlpha.CheckedChanged += new System.EventHandler(this.chkDisplayAlpha_CheckedChanged);
|
||||
//
|
||||
// CubeMapFaceViewer
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -198,5 +212,6 @@
|
|||
private STButton btnRightArray;
|
||||
private STButton btnLeftArray;
|
||||
private PictureBoxCustom pbRightFace;
|
||||
private STCheckBox chkDisplayAlpha;
|
||||
}
|
||||
}
|
|
@ -12,6 +12,8 @@ namespace Switch_Toolbox.Library.Forms
|
|||
{
|
||||
public partial class CubeMapFaceViewer : STForm
|
||||
{
|
||||
private bool DisplayAlpha = true;
|
||||
|
||||
public CubeMapFaceViewer()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -28,6 +30,7 @@ namespace Switch_Toolbox.Library.Forms
|
|||
pbLeftFace.Paint += CreatePictureBoxText("Left");
|
||||
pbTopFace.Paint += CreatePictureBoxText("Top");
|
||||
pbBottomFace.Paint += CreatePictureBoxText("Bottom");
|
||||
chkDisplayAlpha.Checked = DisplayAlpha;
|
||||
}
|
||||
|
||||
private PaintEventHandler CreatePictureBoxText(string Text)
|
||||
|
@ -65,9 +68,14 @@ namespace Switch_Toolbox.Library.Forms
|
|||
|
||||
private void UpdateArrayLevel(int ArrayLevel = 0)
|
||||
{
|
||||
if (ActiveTexture == null) return;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
var CubeFaceBitmap = ActiveTexture.GetBitmap(i * (ArrayLevel + 1));
|
||||
if (!DisplayAlpha)
|
||||
BitmapExtension.SetChannel(CubeFaceBitmap, ActiveTexture.RedChannel, ActiveTexture.GreenChannel, ActiveTexture.BlueChannel, STChannelType.One);
|
||||
|
||||
if (i == FRONT_FACE)
|
||||
pbFrontFace.Image = CubeFaceBitmap;
|
||||
else if (i == BACK_FACE)
|
||||
|
@ -82,5 +90,11 @@ namespace Switch_Toolbox.Library.Forms
|
|||
pbRightFace.Image = CubeFaceBitmap;
|
||||
}
|
||||
}
|
||||
|
||||
private void chkDisplayAlpha_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
DisplayAlpha = chkDisplayAlpha.Checked;
|
||||
UpdateArrayLevel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue