Image Editor : Add option to preview 3D HDR alpha encoded cubemaps
This commit is contained in:
parent
d923705c3c
commit
c9aef08482
@ -17,6 +17,8 @@ namespace Toolbox.Library.Forms
|
||||
{
|
||||
public partial class CubeMapFaceViewer3D : STForm
|
||||
{
|
||||
public bool HDREncoded = false;
|
||||
|
||||
private GL_ControlBase glControl;
|
||||
public CubeMapFaceViewer3D()
|
||||
{
|
||||
@ -41,6 +43,7 @@ namespace Toolbox.Library.Forms
|
||||
var skybox = new DrawableSkybox();
|
||||
skybox.ForceDisplay = true;
|
||||
skybox.LoadCustomTexture(ActiveTexture);
|
||||
skybox.HDREncoded = HDREncoded;
|
||||
|
||||
glControl.MainDrawable = skybox;
|
||||
}
|
||||
|
@ -31,9 +31,9 @@
|
||||
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 Toolbox.Library.Forms.STPanel();
|
||||
this.stPanel1 = new Toolbox.Library.Forms.STPanel();
|
||||
this.backgroundPB = new System.Windows.Forms.PictureBox();
|
||||
this.stPanel4 = new Toolbox.Library.Forms.STPanel();
|
||||
this.noteifcationLbl = new Toolbox.Library.Forms.STLabel();
|
||||
this.stPanel5 = new Toolbox.Library.Forms.STPanel();
|
||||
@ -42,7 +42,6 @@
|
||||
this.stContextMenuStrip2 = new Toolbox.Library.Forms.STContextMenuStrip(this.components);
|
||||
this.copyImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.stPanel3 = new Toolbox.Library.Forms.STPanel();
|
||||
this.backgroundPB = new System.Windows.Forms.PictureBox();
|
||||
this.alphaBtn = new Toolbox.Library.Forms.STButton();
|
||||
this.editBtn = new Toolbox.Library.Forms.STButton();
|
||||
this.saveBtn = new Toolbox.Library.Forms.STButton();
|
||||
@ -87,16 +86,18 @@
|
||||
this.rToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.adjustmentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.gammaFixToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.stContextMenuStrip3 = new Toolbox.Library.Forms.STContextMenuStrip(this.components);
|
||||
this.previewCubemap3DHDRAlphaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.stPanel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.backgroundPB)).BeginInit();
|
||||
this.stPanel4.SuspendLayout();
|
||||
this.stPanel5.SuspendLayout();
|
||||
this.stContextMenuStrip2.SuspendLayout();
|
||||
this.stPanel3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.backgroundPB)).BeginInit();
|
||||
this.stContextMenuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@ -143,6 +144,15 @@
|
||||
this.stPanel1.Size = new System.Drawing.Size(389, 502);
|
||||
this.stPanel1.TabIndex = 2;
|
||||
//
|
||||
// backgroundPB
|
||||
//
|
||||
this.backgroundPB.Location = new System.Drawing.Point(363, 0);
|
||||
this.backgroundPB.Name = "backgroundPB";
|
||||
this.backgroundPB.Size = new System.Drawing.Size(23, 24);
|
||||
this.backgroundPB.TabIndex = 18;
|
||||
this.backgroundPB.TabStop = false;
|
||||
this.backgroundPB.MouseClick += new System.Windows.Forms.MouseEventHandler(this.imageBGComboBox_MouseClick);
|
||||
//
|
||||
// stPanel4
|
||||
//
|
||||
this.stPanel4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
@ -225,15 +235,6 @@
|
||||
this.stPanel3.TabIndex = 3;
|
||||
this.stPanel3.Paint += new System.Windows.Forms.PaintEventHandler(this.stPanel3_Paint);
|
||||
//
|
||||
// backgroundPB
|
||||
//
|
||||
this.backgroundPB.Location = new System.Drawing.Point(363, 0);
|
||||
this.backgroundPB.Name = "backgroundPB";
|
||||
this.backgroundPB.Size = new System.Drawing.Size(23, 24);
|
||||
this.backgroundPB.TabIndex = 18;
|
||||
this.backgroundPB.TabStop = false;
|
||||
this.backgroundPB.MouseClick += new System.Windows.Forms.MouseEventHandler(this.imageBGComboBox_MouseClick);
|
||||
//
|
||||
// alphaBtn
|
||||
//
|
||||
this.alphaBtn.BackColor = System.Drawing.Color.Transparent;
|
||||
@ -484,6 +485,7 @@
|
||||
this.useComponentSelectorToolStripMenuItem,
|
||||
this.previewCubemapToolStripMenuItem,
|
||||
this.previewCubemap3DToolStripMenuItem,
|
||||
this.previewCubemap3DHDRAlphaToolStripMenuItem,
|
||||
this.previewGammaFixSmashUltimateToolStripMenuItem});
|
||||
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
|
||||
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
|
||||
@ -641,6 +643,13 @@
|
||||
this.stContextMenuStrip3.Name = "stContextMenuStrip3";
|
||||
this.stContextMenuStrip3.Size = new System.Drawing.Size(61, 4);
|
||||
//
|
||||
// previewCubemap3DHDRAlphaToolStripMenuItem
|
||||
//
|
||||
this.previewCubemap3DHDRAlphaToolStripMenuItem.Name = "previewCubemap3DHDRAlphaToolStripMenuItem";
|
||||
this.previewCubemap3DHDRAlphaToolStripMenuItem.Size = new System.Drawing.Size(272, 22);
|
||||
this.previewCubemap3DHDRAlphaToolStripMenuItem.Text = "Preview Cubemap (3D HDR Alpha)";
|
||||
this.previewCubemap3DHDRAlphaToolStripMenuItem.Click += new System.EventHandler(this.previewCubemap3DHDRToolStripMenuItem_Click);
|
||||
//
|
||||
// ImageEditorBase
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -653,6 +662,7 @@
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.stPanel1.ResumeLayout(false);
|
||||
this.stPanel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.backgroundPB)).EndInit();
|
||||
this.stPanel4.ResumeLayout(false);
|
||||
this.stPanel4.PerformLayout();
|
||||
this.stPanel5.ResumeLayout(false);
|
||||
@ -660,7 +670,6 @@
|
||||
this.stContextMenuStrip2.ResumeLayout(false);
|
||||
this.stPanel3.ResumeLayout(false);
|
||||
this.stPanel3.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.backgroundPB)).EndInit();
|
||||
this.stContextMenuStrip1.ResumeLayout(false);
|
||||
this.stContextMenuStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
@ -726,5 +735,6 @@
|
||||
private STLabel noteifcationLbl;
|
||||
private System.Windows.Forms.ToolStripMenuItem gammaFixToolStripMenuItem;
|
||||
private System.Windows.Forms.PictureBox backgroundPB;
|
||||
private System.Windows.Forms.ToolStripMenuItem previewCubemap3DHDRAlphaToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -1383,6 +1383,15 @@ namespace Toolbox.Library.Forms
|
||||
private void previewCubemap3DToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
CubeMapFaceViewer3D viewer = new CubeMapFaceViewer3D();
|
||||
viewer.HDREncoded = false;
|
||||
viewer.LoadTexture(ActiveTexture);
|
||||
viewer.Show();
|
||||
}
|
||||
|
||||
private void previewCubemap3DHDRToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
CubeMapFaceViewer3D viewer = new CubeMapFaceViewer3D();
|
||||
viewer.HDREncoded = true;
|
||||
viewer.LoadTexture(ActiveTexture);
|
||||
viewer.Show();
|
||||
}
|
||||
|
@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="stContextMenuStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>184, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="alphaBtn.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
@ -736,9 +739,6 @@
|
||||
<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="stContextMenuStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>184, 17</value>
|
||||
</metadata>
|
||||
<metadata name="stContextMenuStrip3.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>448, 21</value>
|
||||
</metadata>
|
||||
|
@ -14,6 +14,8 @@ namespace Toolbox.Library.Rendering
|
||||
{
|
||||
public class DrawableSkybox : AbstractGlDrawable
|
||||
{
|
||||
public bool HDREncoded = false;
|
||||
|
||||
public bool ForceDisplay = false;
|
||||
|
||||
ShaderProgram defaultShaderProgram;
|
||||
@ -83,6 +85,8 @@ namespace Toolbox.Library.Rendering
|
||||
defaultShaderProgram.SetMatrix4x4("projection", ref proj);
|
||||
defaultShaderProgram.SetMatrix4x4("rotView", ref rot);
|
||||
|
||||
defaultShaderProgram.SetBoolToInt("hdrEncoded", HDREncoded);
|
||||
|
||||
if (CustomCubemap != null)
|
||||
{
|
||||
GL.ActiveTexture(TextureUnit.Texture0);
|
||||
|
@ -4,13 +4,19 @@ out vec4 FragColor;
|
||||
in vec3 TexCoords;
|
||||
|
||||
uniform samplerCube environmentMap;
|
||||
uniform int hdrEncoded;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 envColor = textureLod(environmentMap, TexCoords, 0.0).rgb;
|
||||
vec4 envTexture = textureLod(environmentMap, TexCoords, 0.0).rgba;
|
||||
vec3 envColor = envTexture.rgb;
|
||||
|
||||
envColor = envColor / (envColor + vec3(1.0));
|
||||
envColor = pow(envColor, vec3(1.0/2.2));
|
||||
if (hdrEncoded == 1)
|
||||
{
|
||||
envColor = envTexture.rgb * pow(envTexture.a, 4) * 1024;
|
||||
envColor = envColor / (envColor + vec3(1.0));
|
||||
envColor = pow(envColor, vec3(1.0/2.2));
|
||||
}
|
||||
|
||||
FragColor = vec4(envColor, 1.0);
|
||||
}
|
Loading…
Reference in New Issue
Block a user