Add cubemap previewer to image editor

This commit is contained in:
KillzXGaming 2019-06-27 19:08:12 -04:00
parent 4538b86834
commit 1c49911d47
20 changed files with 786 additions and 322 deletions

Binary file not shown.

View file

@ -1,236 +0,0 @@
namespace Switch_Toolbox.Library.GUI
{
partial class CubeMapFaceCreator
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View file

@ -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();
}
}
}

View file

@ -0,0 +1,202 @@
namespace Switch_Toolbox.Library.Forms
{
partial class CubeMapFaceViewer
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View file

@ -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;
}
}
}
}

View file

@ -118,7 +118,7 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="pictureBoxCustom6.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<data name="pbRightFace.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAlgAAAJYCAMAAACJuGjuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEXMzMzNzc3Ozs7Pz8/Q0NDR0dHS
@ -325,7 +325,7 @@
mGk4zW7tt3aFGa0JAhPXKv5Grfv8ckaj93+veSuXxEAIUwAAAABJRU5ErkJggg==
</value>
</data>
<data name="pictureBoxCustom1.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<data name="pbBackFace.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAlgAAAJYCAMAAACJuGjuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEXMzMzNzc3Ozs7Pz8/Q0NDR0dHS
@ -532,7 +532,7 @@
mGk4zW7tt3aFGa0JAhPXKv5Grfv8ckaj93+veSuXxEAIUwAAAABJRU5ErkJggg==
</value>
</data>
<data name="pictureBoxCustom2.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<data name="pbBottomFace.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAlgAAAJYCAMAAACJuGjuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEXMzMzNzc3Ozs7Pz8/Q0NDR0dHS
@ -739,7 +739,7 @@
mGk4zW7tt3aFGa0JAhPXKv5Grfv8ckaj93+veSuXxEAIUwAAAABJRU5ErkJggg==
</value>
</data>
<data name="pictureBoxCustom3.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<data name="pbLeftFace.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAlgAAAJYCAMAAACJuGjuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEXMzMzNzc3Ozs7Pz8/Q0NDR0dHS
@ -946,7 +946,7 @@
mGk4zW7tt3aFGa0JAhPXKv5Grfv8ckaj93+veSuXxEAIUwAAAABJRU5ErkJggg==
</value>
</data>
<data name="pictureBoxCustom4.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<data name="pbFrontFace.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAlgAAAJYCAMAAACJuGjuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEXMzMzNzc3Ozs7Pz8/Q0NDR0dHS
@ -1153,7 +1153,7 @@
mGk4zW7tt3aFGa0JAhPXKv5Grfv8ckaj93+veSuXxEAIUwAAAABJRU5ErkJggg==
</value>
</data>
<data name="pictureBoxCustom5.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<data name="pbTopFace.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAlgAAAJYCAMAAACJuGjuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEXMzMzNzc3Ozs7Pz8/Q0NDR0dHS

View file

@ -0,0 +1,63 @@
namespace Switch_Toolbox.Library.Forms
{
partial class CubeMapFaceViewer3D
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View file

@ -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;
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -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;
}
}

View file

@ -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();
}
}
}

View file

@ -117,12 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="stContextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>351, 17</value>
</metadata>
<metadata name="stContextMenuStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>184, 17</value>
</metadata>
@ -178,6 +172,9 @@
gg==
</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>351, 17</value>
</metadata>
<data name="editBtn.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
@ -739,6 +736,9 @@
cL+T0fIXUvho1xJo195FiqmQ0PIqcY9VOy9ppv/4j/8PQJ1wavHnTdQAAAAASUVORK5CYII=
</value>
</data>
<metadata name="stContextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>108</value>
</metadata>

View file

@ -59,6 +59,14 @@ namespace Switch_Toolbox.Library
AlphaChannel = STChannelType.Alpha;
}
public bool IsCubemap
{
get
{
return ArrayCount == 6 || ArrayCount % 6 == 0;
}
}
/// <summary>
/// The swizzle method to use when decoding or encoding back a texture.
/// </summary>

View file

@ -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<byte[]> ImageData = new List<byte[]>();
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<byte[]> 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<byte>(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<byte>(TextureTarget.Texture2D, 0, t.pixelInternalFormat, t.width, t.height, 0,
t.pixelFormat, PixelType.UnsignedByte, t.data);
if (t.pixelInternalFormat != PixelInternalFormat.Rgba)
{
GL.CompressedTexImage2D<byte>(TextureTarget.Texture2D, 0, (InternalFormat)t.pixelInternalFormat,
t.width, t.height, 0, getImageSize(t), ImageData[0]);
//Debug.WriteLine(GL.GetError());
}
else
{
GL.TexImage2D<byte>(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<byte>(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<byte>(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;
}
}

View file

@ -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);
}
}
}

View file

@ -395,6 +395,12 @@
<Compile Include="Forms\Editors\HexEditor\SearchHex.Designer.cs">
<DependentUpon>SearchHex.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Editors\ImageEditor\CubeMapFaceViewer3D.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\Editors\ImageEditor\CubeMapFaceViewer3D.Designer.cs">
<DependentUpon>CubeMapFaceViewer3D.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Editors\ImageEditor\ImageFillColor.cs">
<SubType>Form</SubType>
</Compile>
@ -582,11 +588,11 @@
<Compile Include="Forms\Editors\Assimp Settings.Designer.cs">
<DependentUpon>Assimp Settings.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Editors\CubeMapFaceCreator.cs">
<Compile Include="Forms\Editors\ImageEditor\CubeMapFaceViewer.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\Editors\CubeMapFaceCreator.Designer.cs">
<DependentUpon>CubeMapFaceCreator.cs</DependentUpon>
<Compile Include="Forms\Editors\ImageEditor\CubeMapFaceViewer.Designer.cs">
<DependentUpon>CubeMapFaceViewer.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Dialogs\DialogCenter.cs" />
<Compile Include="Forms\Editors\TransformMeshTool.cs">
@ -794,8 +800,8 @@
<EmbeddedResource Include="Forms\Editors\Audio\LoopEditor.resx">
<DependentUpon>LoopEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Editors\CubeMapFaceCreator.resx">
<DependentUpon>CubeMapFaceCreator.cs</DependentUpon>
<EmbeddedResource Include="Forms\Editors\ImageEditor\CubeMapFaceViewer.resx">
<DependentUpon>CubeMapFaceViewer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Editors\HexEditor\HexEditorNew.resx">
<DependentUpon>HexEditorNew.cs</DependentUpon>
@ -806,6 +812,9 @@
<EmbeddedResource Include="Forms\Editors\HexEditor\SearchHex.resx">
<DependentUpon>SearchHex.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Editors\ImageEditor\CubeMapFaceViewer3D.resx">
<DependentUpon>CubeMapFaceViewer3D.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Editors\ImageEditor\ImageFillColor.resx">
<DependentUpon>ImageFillColor.cs</DependentUpon>
</EmbeddedResource>