Update viewport properly for sampler editing
This commit is contained in:
parent
2ed4dd0971
commit
3ab44e1f63
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -8,6 +8,7 @@ using System.Text.RegularExpressions;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Switch_Toolbox.Library.Forms;
|
using Switch_Toolbox.Library.Forms;
|
||||||
|
using Switch_Toolbox.Library;
|
||||||
using Bfres.Structs;
|
using Bfres.Structs;
|
||||||
using ResUGX2 = Syroot.NintenTools.Bfres.GX2;
|
using ResUGX2 = Syroot.NintenTools.Bfres.GX2;
|
||||||
using ResGFX = Syroot.NintenTools.NSW.Bfres.GFX;
|
using ResGFX = Syroot.NintenTools.NSW.Bfres.GFX;
|
||||||
@ -176,7 +177,47 @@ namespace FirstPlugin.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnPropertyChanged() { }
|
public void OnPropertyChanged()
|
||||||
|
{
|
||||||
|
if (textureRefListView.SelectedIndices.Count <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int index = textureRefListView.SelectedIndices[0];
|
||||||
|
MatTexture ActiveMatTexture = (MatTexture)material.TextureMaps[index];
|
||||||
|
|
||||||
|
if (ActiveMatTexture.wiiUSampler != null)
|
||||||
|
{
|
||||||
|
ActiveMatTexture.wrapModeS = (int)ActiveMatTexture.wiiUSampler.ClampX;
|
||||||
|
ActiveMatTexture.wrapModeT = (int)ActiveMatTexture.wiiUSampler.ClampY;
|
||||||
|
ActiveMatTexture.wrapModeW = (int)ActiveMatTexture.wiiUSampler.ClampZ;
|
||||||
|
|
||||||
|
if (ActiveMatTexture.wiiUSampler.MinFilter == ResUGX2.GX2TexXYFilterType.Point)
|
||||||
|
ActiveMatTexture.minFilter = 1;
|
||||||
|
if (ActiveMatTexture.wiiUSampler.MagFilter == ResUGX2.GX2TexXYFilterType.Point)
|
||||||
|
ActiveMatTexture.magFilter = 1;
|
||||||
|
if (ActiveMatTexture.wiiUSampler.MinFilter == ResUGX2.GX2TexXYFilterType.Bilinear)
|
||||||
|
ActiveMatTexture.minFilter = 0;
|
||||||
|
if (ActiveMatTexture.wiiUSampler.MagFilter == ResUGX2.GX2TexXYFilterType.Bilinear)
|
||||||
|
ActiveMatTexture.magFilter = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ActiveMatTexture.wrapModeS = (int)ActiveMatTexture.switchSampler.WrapModeU;
|
||||||
|
ActiveMatTexture.wrapModeT = (int)ActiveMatTexture.switchSampler.WrapModeV;
|
||||||
|
ActiveMatTexture.wrapModeW = (int)ActiveMatTexture.switchSampler.WrapModeW;
|
||||||
|
|
||||||
|
if (ActiveMatTexture.switchSampler.ShrinkXY == ResNX.Sampler.ShrinkFilterModes.Points)
|
||||||
|
ActiveMatTexture.minFilter = 1;
|
||||||
|
if (ActiveMatTexture.switchSampler.ExpandXY == ResNX.Sampler.ExpandFilterModes.Points)
|
||||||
|
ActiveMatTexture.magFilter = 1;
|
||||||
|
if (ActiveMatTexture.switchSampler.ShrinkXY == ResNX.Sampler.ShrinkFilterModes.Linear)
|
||||||
|
ActiveMatTexture.minFilter = 0;
|
||||||
|
if (ActiveMatTexture.switchSampler.ExpandXY == ResNX.Sampler.ExpandFilterModes.Linear)
|
||||||
|
ActiveMatTexture.magFilter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LibraryGUI.Instance.UpdateViewport();
|
||||||
|
}
|
||||||
|
|
||||||
private void textureRefListView_SelectedIndexChanged(object sender, EventArgs e)
|
private void textureRefListView_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,10 @@ using System.Text;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Bfres.Structs;
|
using Bfres.Structs;
|
||||||
|
using ResUGX2 = Syroot.NintenTools.Bfres.GX2;
|
||||||
|
using Syroot.NintenTools.NSW.Bfres.GX2;
|
||||||
|
using Syroot.NintenTools.NSW.Bfres;
|
||||||
|
using Switch_Toolbox.Library;
|
||||||
|
|
||||||
namespace FirstPlugin.Forms
|
namespace FirstPlugin.Forms
|
||||||
{
|
{
|
||||||
@ -22,8 +26,12 @@ namespace FirstPlugin.Forms
|
|||||||
DisplayVertical();
|
DisplayVertical();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MatTexture ActiveMatTexture;
|
||||||
|
|
||||||
public void LoadTexture(MatTexture texture)
|
public void LoadTexture(MatTexture texture)
|
||||||
{
|
{
|
||||||
|
ActiveMatTexture = texture;
|
||||||
|
|
||||||
nameTB.Text = texture.Name;
|
nameTB.Text = texture.Name;
|
||||||
|
|
||||||
samplerCB.Items.Clear();
|
samplerCB.Items.Clear();
|
||||||
@ -67,7 +75,38 @@ namespace FirstPlugin.Forms
|
|||||||
|
|
||||||
private void OnPropertyChanged()
|
private void OnPropertyChanged()
|
||||||
{
|
{
|
||||||
|
if (ActiveMatTexture.wiiUSampler != null)
|
||||||
|
{
|
||||||
|
ActiveMatTexture.wrapModeS = (int)ActiveMatTexture.wiiUSampler.ClampX;
|
||||||
|
ActiveMatTexture.wrapModeT = (int)ActiveMatTexture.wiiUSampler.ClampY;
|
||||||
|
ActiveMatTexture.wrapModeW = (int)ActiveMatTexture.wiiUSampler.ClampZ;
|
||||||
|
|
||||||
|
if (ActiveMatTexture.wiiUSampler.MinFilter == ResUGX2.GX2TexXYFilterType.Point)
|
||||||
|
ActiveMatTexture.minFilter = 1;
|
||||||
|
if (ActiveMatTexture.wiiUSampler.MagFilter == ResUGX2.GX2TexXYFilterType.Point)
|
||||||
|
ActiveMatTexture.magFilter = 1;
|
||||||
|
if (ActiveMatTexture.wiiUSampler.MinFilter == ResUGX2.GX2TexXYFilterType.Bilinear)
|
||||||
|
ActiveMatTexture.minFilter = 0;
|
||||||
|
if (ActiveMatTexture.wiiUSampler.MagFilter == ResUGX2.GX2TexXYFilterType.Bilinear)
|
||||||
|
ActiveMatTexture.magFilter = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ActiveMatTexture.wrapModeS = (int)ActiveMatTexture.switchSampler.WrapModeU;
|
||||||
|
ActiveMatTexture.wrapModeT = (int)ActiveMatTexture.switchSampler.WrapModeV;
|
||||||
|
ActiveMatTexture.wrapModeW = (int)ActiveMatTexture.switchSampler.WrapModeW;
|
||||||
|
|
||||||
|
if (ActiveMatTexture.switchSampler.ShrinkXY == Sampler.ShrinkFilterModes.Points)
|
||||||
|
ActiveMatTexture.minFilter = 1;
|
||||||
|
if (ActiveMatTexture.switchSampler.ExpandXY == Sampler.ExpandFilterModes.Points)
|
||||||
|
ActiveMatTexture.magFilter = 1;
|
||||||
|
if (ActiveMatTexture.switchSampler.ShrinkXY == Sampler.ShrinkFilterModes.Linear)
|
||||||
|
ActiveMatTexture.minFilter = 0;
|
||||||
|
if (ActiveMatTexture.switchSampler.ExpandXY == Sampler.ExpandFilterModes.Linear)
|
||||||
|
ActiveMatTexture.magFilter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LibraryGUI.Instance.UpdateViewport();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stTextBox2_TextChanged(object sender, EventArgs e)
|
private void stTextBox2_TextChanged(object sender, EventArgs e)
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user