diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index 90c5971d..86545353 100644 Binary files a/.vs/Switch_Toolbox/v15/.suo and b/.vs/Switch_Toolbox/v15/.suo differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide index bfe3fed8..87602614 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal index 9c14a33d..7c288fea 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal differ diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache index e40d45c6..6f6e133e 100644 Binary files a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache and b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache differ diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache index edca7657..c365392a 100644 Binary files a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache and b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache differ diff --git a/Switch_Toolbox_Library/Forms/Editors/CubeMapFaceCreator.Designer.cs b/Switch_Toolbox_Library/Forms/Editors/CubeMapFaceCreator.Designer.cs deleted file mode 100644 index 42e635c2..00000000 --- a/Switch_Toolbox_Library/Forms/Editors/CubeMapFaceCreator.Designer.cs +++ /dev/null @@ -1,236 +0,0 @@ -namespace Switch_Toolbox.Library.GUI -{ - partial class CubeMapFaceCreator - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CubeMapFaceCreator)); - this.pictureBoxCustom6 = new Switch_Toolbox.Library.Forms.PictureBoxCustom(); - this.pictureBoxCustom1 = new Switch_Toolbox.Library.Forms.PictureBoxCustom(); - this.pictureBoxCustom2 = new Switch_Toolbox.Library.Forms.PictureBoxCustom(); - this.pictureBoxCustom3 = new Switch_Toolbox.Library.Forms.PictureBoxCustom(); - this.pictureBoxCustom4 = new Switch_Toolbox.Library.Forms.PictureBoxCustom(); - this.pictureBoxCustom5 = new Switch_Toolbox.Library.Forms.PictureBoxCustom(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustom6)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustom1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustom2)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustom3)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustom4)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustom5)).BeginInit(); - this.SuspendLayout(); - // - // pictureBoxCustom6 - // - this.pictureBoxCustom6.BackColor = System.Drawing.Color.Transparent; - this.pictureBoxCustom6.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBoxCustom6.BackgroundImage"))); - this.pictureBoxCustom6.Location = new System.Drawing.Point(217, 12); - this.pictureBoxCustom6.Name = "pictureBoxCustom6"; - this.pictureBoxCustom6.Size = new System.Drawing.Size(200, 200); - this.pictureBoxCustom6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBoxCustom6.TabIndex = 5; - this.pictureBoxCustom6.TabStop = false; - // - // pictureBoxCustom1 - // - this.pictureBoxCustom1.BackColor = System.Drawing.Color.Transparent; - this.pictureBoxCustom1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBoxCustom1.BackgroundImage"))); - this.pictureBoxCustom1.Location = new System.Drawing.Point(217, 218); - this.pictureBoxCustom1.Name = "pictureBoxCustom1"; - this.pictureBoxCustom1.Size = new System.Drawing.Size(200, 200); - this.pictureBoxCustom1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBoxCustom1.TabIndex = 6; - this.pictureBoxCustom1.TabStop = false; - // - // pictureBoxCustom2 - // - this.pictureBoxCustom2.BackColor = System.Drawing.Color.Transparent; - this.pictureBoxCustom2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBoxCustom2.BackgroundImage"))); - this.pictureBoxCustom2.Location = new System.Drawing.Point(11, 218); - this.pictureBoxCustom2.Name = "pictureBoxCustom2"; - this.pictureBoxCustom2.Size = new System.Drawing.Size(200, 200); - this.pictureBoxCustom2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBoxCustom2.TabIndex = 7; - this.pictureBoxCustom2.TabStop = false; - // - // pictureBoxCustom3 - // - this.pictureBoxCustom3.BackColor = System.Drawing.Color.Transparent; - this.pictureBoxCustom3.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBoxCustom3.BackgroundImage"))); - this.pictureBoxCustom3.Location = new System.Drawing.Point(217, 424); - this.pictureBoxCustom3.Name = "pictureBoxCustom3"; - this.pictureBoxCustom3.Size = new System.Drawing.Size(200, 200); - this.pictureBoxCustom3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBoxCustom3.TabIndex = 8; - this.pictureBoxCustom3.TabStop = false; - // - // pictureBoxCustom4 - // - this.pictureBoxCustom4.BackColor = System.Drawing.Color.Transparent; - this.pictureBoxCustom4.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBoxCustom4.BackgroundImage"))); - this.pictureBoxCustom4.Location = new System.Drawing.Point(423, 218); - this.pictureBoxCustom4.Name = "pictureBoxCustom4"; - this.pictureBoxCustom4.Size = new System.Drawing.Size(200, 200); - this.pictureBoxCustom4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBoxCustom4.TabIndex = 9; - this.pictureBoxCustom4.TabStop = false; - // - // pictureBoxCustom5 - // - this.pictureBoxCustom5.BackColor = System.Drawing.Color.Transparent; - this.pictureBoxCustom5.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBoxCustom5.BackgroundImage"))); - this.pictureBoxCustom5.Location = new System.Drawing.Point(629, 218); - this.pictureBoxCustom5.Name = "pictureBoxCustom5"; - this.pictureBoxCustom5.Size = new System.Drawing.Size(200, 200); - this.pictureBoxCustom5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBoxCustom5.TabIndex = 10; - this.pictureBoxCustom5.TabStop = false; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.BackColor = System.Drawing.Color.White; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.ForeColor = System.Drawing.Color.Black; - this.label1.Location = new System.Drawing.Point(274, 300); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(76, 24); - this.label1.TabIndex = 11; - this.label1.Text = "FRONT"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.BackColor = System.Drawing.Color.White; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.ForeColor = System.Drawing.Color.Black; - this.label2.Location = new System.Drawing.Point(488, 300); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(67, 24); - this.label2.TabIndex = 12; - this.label2.Text = "RIGHT"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.BackColor = System.Drawing.Color.White; - this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label3.ForeColor = System.Drawing.Color.Black; - this.label3.Location = new System.Drawing.Point(78, 300); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(57, 24); - this.label3.TabIndex = 13; - this.label3.Text = "LEFT"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.BackColor = System.Drawing.Color.White; - this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label4.ForeColor = System.Drawing.Color.Black; - this.label4.Location = new System.Drawing.Point(716, 300); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(60, 24); - this.label4.TabIndex = 14; - this.label4.Text = "BACK"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.BackColor = System.Drawing.Color.White; - this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label5.ForeColor = System.Drawing.Color.Black; - this.label5.Location = new System.Drawing.Point(283, 90); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(49, 24); - this.label5.TabIndex = 15; - this.label5.Text = "TOP"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.BackColor = System.Drawing.Color.White; - this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label6.ForeColor = System.Drawing.Color.Black; - this.label6.Location = new System.Drawing.Point(268, 528); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(92, 24); - this.label6.TabIndex = 16; - this.label6.Text = "BOTTOM"; - // - // CubeMapFaceCreator - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); - this.ClientSize = new System.Drawing.Size(840, 630); - this.Controls.Add(this.label6); - this.Controls.Add(this.label5); - this.Controls.Add(this.label4); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.pictureBoxCustom5); - this.Controls.Add(this.pictureBoxCustom4); - this.Controls.Add(this.pictureBoxCustom3); - this.Controls.Add(this.pictureBoxCustom2); - this.Controls.Add(this.pictureBoxCustom1); - this.Controls.Add(this.pictureBoxCustom6); - this.Name = "CubeMapFaceCreator"; - this.Text = "CubeMap Face Creator"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustom6)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustom1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustom2)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustom3)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustom4)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustom5)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private Forms.PictureBoxCustom pictureBoxCustom6; - private Forms.PictureBoxCustom pictureBoxCustom1; - private Forms.PictureBoxCustom pictureBoxCustom2; - private Forms.PictureBoxCustom pictureBoxCustom3; - private Forms.PictureBoxCustom pictureBoxCustom4; - private Forms.PictureBoxCustom pictureBoxCustom5; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label6; - } -} \ No newline at end of file diff --git a/Switch_Toolbox_Library/Forms/Editors/CubeMapFaceCreator.cs b/Switch_Toolbox_Library/Forms/Editors/CubeMapFaceCreator.cs deleted file mode 100644 index e470a87b..00000000 --- a/Switch_Toolbox_Library/Forms/Editors/CubeMapFaceCreator.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Switch_Toolbox.Library.GUI -{ - public partial class CubeMapFaceCreator : Form - { - public CubeMapFaceCreator() - { - InitializeComponent(); - } - } -} diff --git a/Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer.Designer.cs b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer.Designer.cs new file mode 100644 index 00000000..1dac86ff --- /dev/null +++ b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer.Designer.cs @@ -0,0 +1,202 @@ +namespace Switch_Toolbox.Library.Forms +{ + partial class CubeMapFaceViewer + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CubeMapFaceViewer)); + this.pbTopFace = new Switch_Toolbox.Library.Forms.PictureBoxCustom(); + this.pbFrontFace = new Switch_Toolbox.Library.Forms.PictureBoxCustom(); + this.pbLeftFace = new Switch_Toolbox.Library.Forms.PictureBoxCustom(); + this.pbBottomFace = new Switch_Toolbox.Library.Forms.PictureBoxCustom(); + this.pbBackFace = new Switch_Toolbox.Library.Forms.PictureBoxCustom(); + this.arrayLevelCounterLabel = new Switch_Toolbox.Library.Forms.STLabel(); + 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.contentContainer.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pbTopFace)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbFrontFace)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbLeftFace)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbBottomFace)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbBackFace)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbRightFace)).BeginInit(); + this.SuspendLayout(); + // + // contentContainer + // + this.contentContainer.BackColor = System.Drawing.Color.White; + this.contentContainer.Controls.Add(this.arrayLevelCounterLabel); + this.contentContainer.Controls.Add(this.btnRightArray); + this.contentContainer.Controls.Add(this.btnLeftArray); + this.contentContainer.Controls.Add(this.pbRightFace); + this.contentContainer.Controls.Add(this.pbBackFace); + this.contentContainer.Controls.Add(this.pbBottomFace); + this.contentContainer.Controls.Add(this.pbLeftFace); + this.contentContainer.Controls.Add(this.pbFrontFace); + this.contentContainer.Controls.Add(this.pbTopFace); + this.contentContainer.Size = new System.Drawing.Size(830, 650); + this.contentContainer.Controls.SetChildIndex(this.pbTopFace, 0); + this.contentContainer.Controls.SetChildIndex(this.pbFrontFace, 0); + this.contentContainer.Controls.SetChildIndex(this.pbLeftFace, 0); + this.contentContainer.Controls.SetChildIndex(this.pbBottomFace, 0); + this.contentContainer.Controls.SetChildIndex(this.pbBackFace, 0); + this.contentContainer.Controls.SetChildIndex(this.pbRightFace, 0); + this.contentContainer.Controls.SetChildIndex(this.btnLeftArray, 0); + this.contentContainer.Controls.SetChildIndex(this.btnRightArray, 0); + this.contentContainer.Controls.SetChildIndex(this.arrayLevelCounterLabel, 0); + // + // pbTopFace + // + this.pbTopFace.BackColor = System.Drawing.Color.Transparent; + this.pbTopFace.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pbTopFace.BackgroundImage"))); + this.pbTopFace.Location = new System.Drawing.Point(211, 31); + this.pbTopFace.Name = "pbTopFace"; + this.pbTopFace.Size = new System.Drawing.Size(200, 200); + this.pbTopFace.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pbTopFace.TabIndex = 5; + this.pbTopFace.TabStop = false; + // + // pbFrontFace + // + this.pbFrontFace.BackColor = System.Drawing.Color.Transparent; + this.pbFrontFace.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pbFrontFace.BackgroundImage"))); + this.pbFrontFace.Location = new System.Drawing.Point(211, 237); + this.pbFrontFace.Name = "pbFrontFace"; + this.pbFrontFace.Size = new System.Drawing.Size(200, 200); + this.pbFrontFace.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pbFrontFace.TabIndex = 6; + this.pbFrontFace.TabStop = false; + // + // pbLeftFace + // + this.pbLeftFace.BackColor = System.Drawing.Color.Transparent; + this.pbLeftFace.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pbLeftFace.BackgroundImage"))); + this.pbLeftFace.Location = new System.Drawing.Point(5, 237); + this.pbLeftFace.Name = "pbLeftFace"; + this.pbLeftFace.Size = new System.Drawing.Size(200, 200); + this.pbLeftFace.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pbLeftFace.TabIndex = 7; + this.pbLeftFace.TabStop = false; + // + // pbBottomFace + // + this.pbBottomFace.BackColor = System.Drawing.Color.Transparent; + this.pbBottomFace.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pbBottomFace.BackgroundImage"))); + this.pbBottomFace.Location = new System.Drawing.Point(211, 443); + this.pbBottomFace.Name = "pbBottomFace"; + this.pbBottomFace.Size = new System.Drawing.Size(200, 200); + this.pbBottomFace.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pbBottomFace.TabIndex = 8; + this.pbBottomFace.TabStop = false; + // + // pbBackFace + // + this.pbBackFace.BackColor = System.Drawing.Color.Transparent; + this.pbBackFace.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pbBackFace.BackgroundImage"))); + this.pbBackFace.Location = new System.Drawing.Point(623, 237); + this.pbBackFace.Name = "pbBackFace"; + this.pbBackFace.Size = new System.Drawing.Size(200, 200); + this.pbBackFace.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pbBackFace.TabIndex = 10; + this.pbBackFace.TabStop = false; + // + // arrayLevelCounterLabel + // + this.arrayLevelCounterLabel.AutoSize = true; + this.arrayLevelCounterLabel.Location = new System.Drawing.Point(418, 55); + this.arrayLevelCounterLabel.Name = "arrayLevelCounterLabel"; + this.arrayLevelCounterLabel.Size = new System.Drawing.Size(101, 13); + this.arrayLevelCounterLabel.TabIndex = 19; + this.arrayLevelCounterLabel.Text = "Array Level: 00 / 00"; + // + // 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"; + this.btnRightArray.Size = new System.Drawing.Size(21, 21); + this.btnRightArray.TabIndex = 18; + this.btnRightArray.Text = ">"; + this.btnRightArray.UseVisualStyleBackColor = true; + // + // btnLeftArray + // + this.btnLeftArray.Enabled = false; + this.btnLeftArray.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnLeftArray.Location = new System.Drawing.Point(525, 51); + this.btnLeftArray.Name = "btnLeftArray"; + this.btnLeftArray.Size = new System.Drawing.Size(21, 21); + this.btnLeftArray.TabIndex = 17; + this.btnLeftArray.Text = "<"; + this.btnLeftArray.UseVisualStyleBackColor = true; + // + // pbRightFace + // + this.pbRightFace.BackColor = System.Drawing.Color.Transparent; + this.pbRightFace.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pbRightFace.BackgroundImage"))); + this.pbRightFace.Location = new System.Drawing.Point(421, 237); + this.pbRightFace.Name = "pbRightFace"; + this.pbRightFace.Size = new System.Drawing.Size(200, 200); + this.pbRightFace.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pbRightFace.TabIndex = 20; + this.pbRightFace.TabStop = false; + // + // CubeMapFaceViewer + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); + this.ClientSize = new System.Drawing.Size(836, 655); + this.Name = "CubeMapFaceViewer"; + this.Text = "CubeMap Face View"; + this.contentContainer.ResumeLayout(false); + this.contentContainer.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pbTopFace)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbFrontFace)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbLeftFace)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbBottomFace)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbBackFace)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbRightFace)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private Forms.PictureBoxCustom pbTopFace; + private Forms.PictureBoxCustom pbFrontFace; + private Forms.PictureBoxCustom pbLeftFace; + private Forms.PictureBoxCustom pbBottomFace; + private Forms.PictureBoxCustom pbBackFace; + private STLabel arrayLevelCounterLabel; + private STButton btnRightArray; + private STButton btnLeftArray; + private PictureBoxCustom pbRightFace; + } +} \ No newline at end of file diff --git a/Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer.cs b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer.cs new file mode 100644 index 00000000..a333477b --- /dev/null +++ b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Switch_Toolbox.Library.Forms +{ + public partial class CubeMapFaceViewer : STForm + { + public CubeMapFaceViewer() + { + InitializeComponent(); + + BackColor = FormThemes.BaseTheme.FormBackColor; + ForeColor = FormThemes.BaseTheme.FormForeColor; + + contentContainer.BackColor = FormThemes.BaseTheme.FormBackColor; + contentContainer.ForeColor = FormThemes.BaseTheme.FormForeColor; + + pbFrontFace.Paint += CreatePictureBoxText("Front"); + pbBackFace.Paint += CreatePictureBoxText("Back"); + pbRightFace.Paint += CreatePictureBoxText("Right"); + pbLeftFace.Paint += CreatePictureBoxText("Left"); + pbTopFace.Paint += CreatePictureBoxText("Top"); + pbBottomFace.Paint += CreatePictureBoxText("Bottom"); + } + + private PaintEventHandler CreatePictureBoxText(string Text) + { + return new PaintEventHandler((sender, e) => + { + e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; + e.Graphics.DrawString(Text, Font, Brushes.Black, 0, 0); + }); + } + + private STGenericTexture ActiveTexture; + private int ArrayCounter = 1; + + public void LoadTexture(STGenericTexture Texture) + { + ActiveTexture = Texture; + + ArrayCounter = 0; + for (int i = 0; i < Texture.ArrayCount; i++) + { + if ((i + 1) % 6 == 0) + ArrayCounter += 1; + } + + UpdateArrayLevel(); + } + + private const int FRONT_FACE = 0; + private const int BACK_FACE = 1; + private const int TOP_FACE = 2; + private const int BOTTOM_FACE = 3; + private const int LEFT_FACE = 4; + private const int RIGHT_FACE = 5; + + private void UpdateArrayLevel(int ArrayLevel = 0) + { + for (int i = 0; i < 6; i++) + { + var CubeFaceBitmap = ActiveTexture.GetBitmap(i * (ArrayLevel + 1)); + if (i == FRONT_FACE) + pbFrontFace.Image = CubeFaceBitmap; + else if (i == BACK_FACE) + pbBackFace.Image = CubeFaceBitmap; + else if (i == BOTTOM_FACE) + pbBottomFace.Image = CubeFaceBitmap; + else if (i == TOP_FACE) + pbTopFace.Image = CubeFaceBitmap; + else if (i == LEFT_FACE) + pbLeftFace.Image = CubeFaceBitmap; + else if (i == RIGHT_FACE) + pbRightFace.Image = CubeFaceBitmap; + } + } + } +} diff --git a/Switch_Toolbox_Library/Forms/Editors/CubeMapFaceCreator.resx b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer.resx similarity index 99% rename from Switch_Toolbox_Library/Forms/Editors/CubeMapFaceCreator.resx rename to Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer.resx index 28040db4..a23e3c62 100644 --- a/Switch_Toolbox_Library/Forms/Editors/CubeMapFaceCreator.resx +++ b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer.resx @@ -118,7 +118,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + iVBORw0KGgoAAAANSUhEUgAAAlgAAAJYCAMAAACJuGjuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEXMzMzNzc3Ozs7Pz8/Q0NDR0dHS @@ -325,7 +325,7 @@ mGk4zW7tt3aFGa0JAhPXKv5Grfv8ckaj93+veSuXxEAIUwAAAABJRU5ErkJggg== - + iVBORw0KGgoAAAANSUhEUgAAAlgAAAJYCAMAAACJuGjuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEXMzMzNzc3Ozs7Pz8/Q0NDR0dHS @@ -532,7 +532,7 @@ mGk4zW7tt3aFGa0JAhPXKv5Grfv8ckaj93+veSuXxEAIUwAAAABJRU5ErkJggg== - + iVBORw0KGgoAAAANSUhEUgAAAlgAAAJYCAMAAACJuGjuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEXMzMzNzc3Ozs7Pz8/Q0NDR0dHS @@ -739,7 +739,7 @@ mGk4zW7tt3aFGa0JAhPXKv5Grfv8ckaj93+veSuXxEAIUwAAAABJRU5ErkJggg== - + iVBORw0KGgoAAAANSUhEUgAAAlgAAAJYCAMAAACJuGjuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEXMzMzNzc3Ozs7Pz8/Q0NDR0dHS @@ -946,7 +946,7 @@ mGk4zW7tt3aFGa0JAhPXKv5Grfv8ckaj93+veSuXxEAIUwAAAABJRU5ErkJggg== - + iVBORw0KGgoAAAANSUhEUgAAAlgAAAJYCAMAAACJuGjuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEXMzMzNzc3Ozs7Pz8/Q0NDR0dHS @@ -1153,7 +1153,7 @@ mGk4zW7tt3aFGa0JAhPXKv5Grfv8ckaj93+veSuXxEAIUwAAAABJRU5ErkJggg== - + iVBORw0KGgoAAAANSUhEUgAAAlgAAAJYCAMAAACJuGjuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEXMzMzNzc3Ozs7Pz8/Q0NDR0dHS diff --git a/Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer3D.Designer.cs b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer3D.Designer.cs new file mode 100644 index 00000000..9efb2707 --- /dev/null +++ b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer3D.Designer.cs @@ -0,0 +1,63 @@ +namespace Switch_Toolbox.Library.Forms +{ + partial class CubeMapFaceViewer3D + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel(); + this.contentContainer.SuspendLayout(); + this.SuspendLayout(); + // + // contentContainer + // + this.contentContainer.Controls.Add(this.stPanel1); + this.contentContainer.Size = new System.Drawing.Size(314, 332); + this.contentContainer.Controls.SetChildIndex(this.stPanel1, 0); + // + // stPanel1 + // + this.stPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.stPanel1.Location = new System.Drawing.Point(0, 25); + this.stPanel1.Name = "stPanel1"; + this.stPanel1.Size = new System.Drawing.Size(314, 307); + this.stPanel1.TabIndex = 11; + // + // CubeMapFaceViewer3D + // + this.ClientSize = new System.Drawing.Size(320, 337); + this.Name = "CubeMapFaceViewer3D"; + this.Text = "CubeMapFaceViewer3D"; + this.contentContainer.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private STPanel stPanel1; + } +} \ No newline at end of file diff --git a/Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer3D.cs b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer3D.cs new file mode 100644 index 00000000..b4987592 --- /dev/null +++ b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer3D.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using GL_EditorFramework.GL_Core; +using GL_EditorFramework.EditorDrawables; +using GL_EditorFramework.StandardCameras; +using Switch_Toolbox.Library; +using Switch_Toolbox.Library.Rendering; + +namespace Switch_Toolbox.Library.Forms +{ + public partial class CubeMapFaceViewer3D : STForm + { + private GL_ControlBase glControl; + public CubeMapFaceViewer3D() + { + InitializeComponent(); + + if (Runtime.UseLegacyGL) + glControl = new GL_ControlLegacy(); + else + glControl = new GL_ControlModern(); + + glControl.Dock = DockStyle.Fill; + glControl.ActiveCamera = new InspectCamera(Runtime.MaxCameraSpeed); + stPanel1.Controls.Add(glControl); + } + + private STGenericTexture ActiveTexture; + public void LoadTexture(STGenericTexture texture) + { + ActiveTexture = texture; + + var skybox = new DrawableSkybox(); + skybox.LoadCustomTexture(ActiveTexture); + + glControl.MainDrawable = skybox; + } + } +} diff --git a/Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer3D.resx b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer3D.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/CubeMapFaceViewer3D.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.Designer.cs b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.Designer.cs index baf719f1..e9585d07 100644 --- a/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.Designer.cs +++ b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.Designer.cs @@ -31,7 +31,6 @@ this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ImageEditorBase)); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.stPanel2 = new Switch_Toolbox.Library.Forms.STPanel(); this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel(); this.stPanel4 = new Switch_Toolbox.Library.Forms.STPanel(); @@ -71,6 +70,7 @@ this.displayVerticalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.displayAlphaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.useComponentSelectorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.previewCubemapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.imageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.generateMipmapsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.resizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -83,6 +83,8 @@ this.adjustmentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.hueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.brightnessContrastToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.previewCubemap3DToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.SuspendLayout(); @@ -407,28 +409,28 @@ // replacRedToolStripMenuItem // this.replacRedToolStripMenuItem.Name = "replacRedToolStripMenuItem"; - this.replacRedToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.replacRedToolStripMenuItem.Size = new System.Drawing.Size(149, 22); this.replacRedToolStripMenuItem.Text = "Replace Red"; this.replacRedToolStripMenuItem.Click += new System.EventHandler(this.replacRedToolStripMenuItem_Click); // // replaceGreenToolStripMenuItem // this.replaceGreenToolStripMenuItem.Name = "replaceGreenToolStripMenuItem"; - this.replaceGreenToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.replaceGreenToolStripMenuItem.Size = new System.Drawing.Size(149, 22); this.replaceGreenToolStripMenuItem.Text = "Replace Green"; this.replaceGreenToolStripMenuItem.Click += new System.EventHandler(this.replaceGreenToolStripMenuItem_Click); // // replaceBlueToolStripMenuItem // this.replaceBlueToolStripMenuItem.Name = "replaceBlueToolStripMenuItem"; - this.replaceBlueToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.replaceBlueToolStripMenuItem.Size = new System.Drawing.Size(149, 22); this.replaceBlueToolStripMenuItem.Text = "Replace Blue"; this.replaceBlueToolStripMenuItem.Click += new System.EventHandler(this.replaceBlueToolStripMenuItem_Click); // // replaceAlphaToolStripMenuItem // this.replaceAlphaToolStripMenuItem.Name = "replaceAlphaToolStripMenuItem"; - this.replaceAlphaToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.replaceAlphaToolStripMenuItem.Size = new System.Drawing.Size(149, 22); this.replaceAlphaToolStripMenuItem.Text = "Replace Alpha"; this.replaceAlphaToolStripMenuItem.Click += new System.EventHandler(this.replaceAlphaToolStripMenuItem_Click); // @@ -453,7 +455,9 @@ this.propertyGridToolStripMenuItem, this.displayVerticalToolStripMenuItem, this.displayAlphaToolStripMenuItem, - this.useComponentSelectorToolStripMenuItem}); + this.useComponentSelectorToolStripMenuItem, + this.previewCubemapToolStripMenuItem, + this.previewCubemap3DToolStripMenuItem}); this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20); this.viewToolStripMenuItem.Text = "View"; @@ -497,6 +501,13 @@ this.useComponentSelectorToolStripMenuItem.Text = "Use Component Selector"; this.useComponentSelectorToolStripMenuItem.Click += new System.EventHandler(this.useComponentSelectorToolStripMenuItem_Click); // + // previewCubemapToolStripMenuItem + // + this.previewCubemapToolStripMenuItem.Name = "previewCubemapToolStripMenuItem"; + this.previewCubemapToolStripMenuItem.Size = new System.Drawing.Size(205, 22); + this.previewCubemapToolStripMenuItem.Text = "Preview Cubemap"; + this.previewCubemapToolStripMenuItem.Click += new System.EventHandler(this.previewCubemapToolStripMenuItem_Click); + // // imageToolStripMenuItem // this.imageToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -592,6 +603,13 @@ this.brightnessContrastToolStripMenuItem.Size = new System.Drawing.Size(185, 22); this.brightnessContrastToolStripMenuItem.Text = "Brightness / Contrast"; // + // previewCubemap3DToolStripMenuItem + // + this.previewCubemap3DToolStripMenuItem.Name = "previewCubemap3DToolStripMenuItem"; + this.previewCubemap3DToolStripMenuItem.Size = new System.Drawing.Size(205, 22); + this.previewCubemap3DToolStripMenuItem.Text = "Preview Cubemap (3D)"; + this.previewCubemap3DToolStripMenuItem.Click += new System.EventHandler(this.previewCubemap3DToolStripMenuItem_Click); + // // ImageEditorBase // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -670,5 +688,7 @@ private System.Windows.Forms.ToolStripMenuItem replaceGreenToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem replaceBlueToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem replaceAlphaToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem previewCubemapToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem previewCubemap3DToolStripMenuItem; } } \ No newline at end of file diff --git a/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.cs b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.cs index 12e9212c..5d825bbe 100644 --- a/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.cs +++ b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.cs @@ -1275,5 +1275,22 @@ namespace Switch_Toolbox.Library.Forms private void replaceAlphaToolStripMenuItem_Click(object sender, EventArgs e) { propertiesEditor.EditChannel(STChannelType.Alpha); } + + private void previewCubemapToolStripMenuItem_Click(object sender, EventArgs e) + { + if (!ActiveTexture.IsCubemap) + return; + + CubeMapFaceViewer viewer = new CubeMapFaceViewer(); + viewer.LoadTexture(ActiveTexture); + viewer.Show(); + } + + private void previewCubemap3DToolStripMenuItem_Click(object sender, EventArgs e) + { + CubeMapFaceViewer3D viewer = new CubeMapFaceViewer3D(); + viewer.LoadTexture(ActiveTexture); + viewer.Show(); + } } } diff --git a/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.resx b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.resx index 0fe51b03..0c3dc06a 100644 --- a/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.resx +++ b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.resx @@ -117,12 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 17 - - - 351, 17 - 184, 17 @@ -178,6 +172,9 @@ gg== + + 351, 17 + iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 @@ -739,6 +736,9 @@ cL+T0fIXUvho1xJo195FiqmQ0PIqcY9VOy9ppv/4j/8PQJ1wavHnTdQAAAAASUVORK5CYII= + + 17, 17 + 108 diff --git a/Switch_Toolbox_Library/Generics/GenericTexture.cs b/Switch_Toolbox_Library/Generics/GenericTexture.cs index dfee79c9..3fe64745 100644 --- a/Switch_Toolbox_Library/Generics/GenericTexture.cs +++ b/Switch_Toolbox_Library/Generics/GenericTexture.cs @@ -59,6 +59,14 @@ namespace Switch_Toolbox.Library AlphaChannel = STChannelType.Alpha; } + public bool IsCubemap + { + get + { + return ArrayCount == 6 || ArrayCount % 6 == 0; + } + } + /// /// The swizzle method to use when decoding or encoding back a texture. /// diff --git a/Switch_Toolbox_Library/Generics/RenderableTex.cs b/Switch_Toolbox_Library/Generics/RenderableTex.cs index 5716af04..51e8a0b8 100644 --- a/Switch_Toolbox_Library/Generics/RenderableTex.cs +++ b/Switch_Toolbox_Library/Generics/RenderableTex.cs @@ -8,6 +8,7 @@ using System.Runtime.InteropServices; namespace Switch_Toolbox.Library.Rendering { + //Parts roughly based on this helpful gl wrapper https://github.com/ScanMountGoat/SFGraphics/blob/89f96b754e17078153315a259baef3859ef5984d/Projects/SFGraphics/GLObjects/Textures/Texture.cs public class RenderableTex { public int width, height; @@ -15,33 +16,111 @@ namespace Switch_Toolbox.Library.Rendering public PixelInternalFormat pixelInternalFormat; public PixelFormat pixelFormat; public PixelType pixelType = PixelType.UnsignedByte; - public byte[] data; + public TextureTarget TextureTarget = TextureTarget.Texture2D; public bool GLInitialized = false; + public int ImageSize; + public bool IsCubeMap = false; + + public TextureWrapMode TextureWrapS + { + get { return textureWrapS; } + set + { + textureWrapS = value; + SetTextureParameter(TextureParameterName.TextureWrapS, (int)value); + } + } + + public TextureWrapMode TextureWrapT + { + get { return textureWrapT; } + set + { + textureWrapT = value; + SetTextureParameter(TextureParameterName.TextureWrapT, (int)value); + } + } + + public TextureWrapMode TextureWrapR + { + get { return textureWrapR; } + set + { + textureWrapR = value; + SetTextureParameter(TextureParameterName.TextureWrapR, (int)value); + } + } + + public TextureMinFilter TextureMinFilter + { + get { return textureMinFilter; } + set + { + textureMinFilter = value; + SetTextureParameter(TextureParameterName.TextureMinFilter, (int)value); + } + } + + public TextureMagFilter TextureMagFilter + { + get { return textureMagFilter; } + set + { + textureMagFilter = value; + SetTextureParameter(TextureParameterName.TextureMinFilter, (int)value); + } + } + + private TextureWrapMode textureWrapS = TextureWrapMode.Repeat; + private TextureWrapMode textureWrapT = TextureWrapMode.Repeat; + private TextureWrapMode textureWrapR = TextureWrapMode.Clamp; + private TextureMinFilter textureMinFilter = TextureMinFilter.Linear; + private TextureMagFilter textureMagFilter = TextureMagFilter.Linear; public void Dispose() { GL.DeleteTexture(TexID); - data = null; } - public void LoadOpenGLTexture(STGenericTexture GenericTexture) + public void SetTextureParameter(TextureParameterName param, int value) + { + Bind(); + GL.TexParameter(TextureTarget, param, value); + } + + public void LoadOpenGLTexture(STGenericTexture GenericTexture, int ArrayStartIndex = 0) { if (!Runtime.OpenTKInitialized || GLInitialized || Runtime.UseLegacyGL) return; - if (GenericTexture.ArrayCount <= 0) - { - throw new Exception($"No texture data found with texture {GenericTexture.Text}"); - } - width = (int)GenericTexture.Width; height = (int)GenericTexture.Height; + if (GenericTexture.ArrayCount == 0) + GenericTexture.ArrayCount = 1; - data = GenericTexture.GetImageData(0, 0); + List ImageData = new List(); + for (int i = 0; i < GenericTexture.ArrayCount; i++) + { + if (i >= ArrayStartIndex && i <= ArrayStartIndex + 6) //Only load up to 6 faces + ImageData.Add(GenericTexture.GetImageData(i, 0)); + } - if (data.Length <= 0) + if (ImageData.Count == 0 || ImageData[0].Length == 0) throw new Exception("Data is empty!"); + IsCubeMap = ImageData.Count == 6; + ImageSize = ImageData[0].Length; + + if (IsCubeMap) + { + TextureTarget = TextureTarget.TextureCubeMap; + TextureWrapS = TextureWrapMode.Clamp; + TextureWrapT = TextureWrapMode.Clamp; + TextureWrapR = TextureWrapMode.Clamp; + TextureMinFilter = TextureMinFilter.LinearMipmapLinear; + TextureMagFilter = TextureMagFilter.Linear; + } + switch (GenericTexture.Format) { case TEX_FORMAT.BC1_UNORM: @@ -68,11 +147,11 @@ namespace Switch_Toolbox.Library.Rendering //While shaders could prevent this, converting is easier and works fine across all editors if (Runtime.UseDirectXTexDecoder) { - data = STGenericTexture.DecodeBlock(data, + ImageData.Add(STGenericTexture.DecodeBlock(ImageData[0], GenericTexture.Width, GenericTexture.Height, GenericTexture.Format, - GenericTexture.PlatformSwizzle); + GenericTexture.PlatformSwizzle)); pixelInternalFormat = PixelInternalFormat.Rgba; pixelFormat = OpenTK.Graphics.OpenGL.PixelFormat.Rgba; } @@ -85,8 +164,8 @@ namespace Switch_Toolbox.Library.Rendering case TEX_FORMAT.BC5_SNORM: pixelInternalFormat = PixelInternalFormat.CompressedRgRgtc2; - data = DDSCompressor.DecompressBC5(GenericTexture.GetImageData(0,0), - (int)GenericTexture.Width, (int)GenericTexture.Height, true, true); + ImageData.Add(DDSCompressor.DecompressBC5(ImageData[0], + (int)GenericTexture.Width, (int)GenericTexture.Height, true, true)); pixelInternalFormat = PixelInternalFormat.Rgba; pixelFormat = OpenTK.Graphics.OpenGL.PixelFormat.Rgba; break; @@ -116,11 +195,11 @@ namespace Switch_Toolbox.Library.Rendering default: if (Runtime.UseDirectXTexDecoder) { - data = STGenericTexture.DecodeBlock(data, + ImageData.Add(STGenericTexture.DecodeBlock(ImageData[0], GenericTexture.Width, GenericTexture.Height, GenericTexture.Format, - GenericTexture.PlatformSwizzle); + GenericTexture.PlatformSwizzle)); pixelInternalFormat = PixelInternalFormat.Rgba; pixelFormat = OpenTK.Graphics.OpenGL.PixelFormat.Rgba; @@ -129,38 +208,82 @@ namespace Switch_Toolbox.Library.Rendering } GLInitialized = true; - TexID = loadImage(this); + TexID = GenerateOpenGLTexture(this, ImageData); + + ImageData.Clear(); } - public static int loadImage(RenderableTex t) + public static int GenerateOpenGLTexture(RenderableTex t, List ImageData) { if (!t.GLInitialized) return -1; int texID = GL.GenTexture(); - GL.BindTexture(TextureTarget.Texture2D, texID); - - if (t.pixelInternalFormat != PixelInternalFormat.Rgba) + GL.BindTexture(t.TextureTarget, texID); + if (t.IsCubeMap) { - GL.CompressedTexImage2D(TextureTarget.Texture2D, 0, (InternalFormat)t.pixelInternalFormat, - t.width, t.height, 0, getImageSize(t), t.data); - //Debug.WriteLine(GL.GetError()); + if (t.pixelInternalFormat != PixelInternalFormat.Rgba) + { + t.LoadCompressedMips(TextureTarget.TextureCubeMapPositiveX, ImageData[0]); + t.LoadCompressedMips(TextureTarget.TextureCubeMapNegativeX, ImageData[1]); + + t.LoadCompressedMips(TextureTarget.TextureCubeMapPositiveY, ImageData[2]); + t.LoadCompressedMips(TextureTarget.TextureCubeMapNegativeY, ImageData[3]); + + t.LoadCompressedMips(TextureTarget.TextureCubeMapPositiveZ, ImageData[4]); + t.LoadCompressedMips(TextureTarget.TextureCubeMapNegativeZ, ImageData[5]); + } + else + { + t.LoadUncompressedMips(TextureTarget.TextureCubeMapPositiveX, ImageData[0]); + t.LoadUncompressedMips(TextureTarget.TextureCubeMapNegativeX, ImageData[1]); + + t.LoadUncompressedMips(TextureTarget.TextureCubeMapPositiveY, ImageData[2]); + t.LoadUncompressedMips(TextureTarget.TextureCubeMapNegativeY, ImageData[3]); + + t.LoadUncompressedMips(TextureTarget.TextureCubeMapPositiveZ, ImageData[4]); + t.LoadUncompressedMips(TextureTarget.TextureCubeMapNegativeZ, ImageData[5]); + } } else { - GL.TexImage2D(TextureTarget.Texture2D, 0, t.pixelInternalFormat, t.width, t.height, 0, - t.pixelFormat, PixelType.UnsignedByte, t.data); + if (t.pixelInternalFormat != PixelInternalFormat.Rgba) + { + GL.CompressedTexImage2D(TextureTarget.Texture2D, 0, (InternalFormat)t.pixelInternalFormat, + t.width, t.height, 0, getImageSize(t), ImageData[0]); + //Debug.WriteLine(GL.GetError()); + } + else + { + GL.TexImage2D(TextureTarget.Texture2D, 0, t.pixelInternalFormat, t.width, t.height, 0, + t.pixelFormat, PixelType.UnsignedByte, ImageData[0]); + } + GL.GenerateMipmap(GenerateMipmapTarget.Texture2D); } - GL.GenerateMipmap(GenerateMipmapTarget.Texture2D); - return texID; } + private void LoadUncompressedMips(TextureTarget textureTarget, byte[] ImageData, int MipLevel = 0) + { + GL.TexImage2D(textureTarget, MipLevel, pixelInternalFormat, width, height, 0, + pixelFormat, PixelType.UnsignedByte, ImageData); + + GL.GenerateMipmap((GenerateMipmapTarget)textureTarget); + } + + private void LoadCompressedMips(TextureTarget textureTarget, byte[] ImageData, int MipLevel = 0) + { + GL.CompressedTexImage2D(textureTarget, MipLevel, (InternalFormat)pixelInternalFormat, + width, height, 0, getImageSize(this), ImageData); + + GL.GenerateMipmap((GenerateMipmapTarget)textureTarget); + } + public void Bind() { - GL.BindTexture(TextureTarget.Texture2D, TexID); + GL.BindTexture(TextureTarget, TexID); } private static int getImageSize(RenderableTex t) @@ -182,9 +305,9 @@ namespace Switch_Toolbox.Library.Rendering case PixelInternalFormat.CompressedSrgbAlphaBptcUnorm: return (t.width * t.height); case PixelInternalFormat.Rgba: - return t.data.Length; + return t.ImageSize; default: - return t.data.Length; + return t.ImageSize; } } diff --git a/Switch_Toolbox_Library/Rendering/DrawableSkybox.cs b/Switch_Toolbox_Library/Rendering/DrawableSkybox.cs index ea85b959..66e02a58 100644 --- a/Switch_Toolbox_Library/Rendering/DrawableSkybox.cs +++ b/Switch_Toolbox_Library/Rendering/DrawableSkybox.cs @@ -16,6 +16,15 @@ namespace Switch_Toolbox.Library.Rendering { ShaderProgram defaultShaderProgram; + private RenderableTex CustomCubemap = null; + public void LoadCustomTexture(STGenericTexture GenericTexture) + { + CustomCubemap = GenericTexture.RenderableTex; + + if (CustomCubemap == null || !CustomCubemap.GLInitialized) + GenericTexture.LoadOpenGLTexture(); + } + public override void Prepare(GL_ControlModern control) { string pathFrag = System.IO.Path.Combine(Runtime.ExecutableDir, "Shader", "HDRSkyBox") + "\\HDRSkyBox.frag"; @@ -34,6 +43,13 @@ namespace Switch_Toolbox.Library.Rendering { if (!Runtime.OpenTKInitialized || pass == Pass.TRANSPARENT) return; + + GL.Disable(EnableCap.CullFace); + + GL.Enable(EnableCap.DepthTest); + GL.DepthFunc(DepthFunction.Lequal); + + } @@ -65,23 +81,31 @@ namespace Switch_Toolbox.Library.Rendering defaultShaderProgram.SetMatrix4x4("projection", ref proj); defaultShaderProgram.SetMatrix4x4("rotView", ref rot); - if (Runtime.PBR.UseDiffuseSkyTexture) + if (CustomCubemap != null) { - //Load Cubemap - if (RenderTools.diffusePbr != null) - { - GL.ActiveTexture(TextureUnit.Texture0); - - RenderTools.diffusePbr.Bind(); - } + GL.ActiveTexture(TextureUnit.Texture0); + CustomCubemap.Bind(); } else { - //Load Cubemap - if (RenderTools.specularPbr != null) + if (Runtime.PBR.UseDiffuseSkyTexture) { - GL.ActiveTexture(TextureUnit.Texture0); - RenderTools.specularPbr.Bind(); + //Load Cubemap + if (RenderTools.diffusePbr != null) + { + GL.ActiveTexture(TextureUnit.Texture0); + + RenderTools.diffusePbr.Bind(); + } + } + else + { + //Load Cubemap + if (RenderTools.specularPbr != null) + { + GL.ActiveTexture(TextureUnit.Texture0); + RenderTools.specularPbr.Bind(); + } } } @@ -152,6 +176,8 @@ namespace Switch_Toolbox.Library.Rendering GL.BindVertexArray(cubeVBO); GL.DrawArrays(PrimitiveType.Triangles, 0, 36); GL.BindVertexArray(0); + + GL.Enable(EnableCap.CullFace); } } } diff --git a/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj b/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj index 57f826a6..4e210443 100644 --- a/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj +++ b/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj @@ -395,6 +395,12 @@ SearchHex.cs + + Form + + + CubeMapFaceViewer3D.cs + Form @@ -582,11 +588,11 @@ Assimp Settings.cs - + Form - - CubeMapFaceCreator.cs + + CubeMapFaceViewer.cs @@ -794,8 +800,8 @@ LoopEditor.cs - - CubeMapFaceCreator.cs + + CubeMapFaceViewer.cs HexEditorNew.cs @@ -806,6 +812,9 @@ SearchHex.cs + + CubeMapFaceViewer3D.cs + ImageFillColor.cs