mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-22 04:23:09 +00:00
Fix adding new textures to BFRES
This commit is contained in:
parent
b48c09beea
commit
66d3d50090
1 changed files with 39 additions and 43 deletions
|
@ -376,50 +376,46 @@ namespace FirstPlugin.Forms
|
||||||
|
|
||||||
private void btnAdd_Click(object sender, EventArgs e)
|
private void btnAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = MessageBox.Show("NOTE! Texture maps are adjusted by shader options which link by shaders. These are not possible to edit yet, do you want to continue?", "Material Editor", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
|
var tex = new MatTexture();
|
||||||
if (result == DialogResult.OK)
|
tex.SamplerName = GetSamplerName("_a0");
|
||||||
|
tex.FragShaderSampler = "_a0";
|
||||||
|
tex.Name = "Untitled";
|
||||||
|
tex.Type = Toolbox.Library.STGenericMatTexture.TextureType.Unknown;
|
||||||
|
tex.WrapModeS = STTextureWrapMode.Repeat;
|
||||||
|
tex.WrapModeT = STTextureWrapMode.Repeat;
|
||||||
|
tex.WrapModeW = STTextureWrapMode.Clamp;
|
||||||
|
|
||||||
|
if (material.GetResFileU() != null)
|
||||||
{
|
{
|
||||||
var tex = new MatTexture();
|
var texSampler = new ResUGX2.TexSampler();
|
||||||
tex.SamplerName = GetSamplerName("_a0");
|
texSampler.BorderType = ResUGX2.GX2TexBorderType.ClearBlack;
|
||||||
tex.FragShaderSampler = "_a0";
|
texSampler.ClampX = ResUGX2.GX2TexClamp.Wrap;
|
||||||
tex.Name = "Untitled";
|
texSampler.ClampY = ResUGX2.GX2TexClamp.Wrap;
|
||||||
tex.Type = Toolbox.Library.STGenericMatTexture.TextureType.Unknown;
|
texSampler.ClampZ = ResUGX2.GX2TexClamp.Clamp;
|
||||||
tex.WrapModeS = STTextureWrapMode.Repeat;
|
texSampler.DepthCompareEnabled = false;
|
||||||
tex.WrapModeT = STTextureWrapMode.Repeat;
|
texSampler.DepthCompareFunc = ResUGX2.GX2CompareFunction.Never;
|
||||||
tex.WrapModeW = STTextureWrapMode.Clamp;
|
texSampler.MagFilter = ResUGX2.GX2TexXYFilterType.Point;
|
||||||
|
texSampler.MaxAnisotropicRatio = ResUGX2.GX2TexAnisoRatio.Ratio_1_1;
|
||||||
if (material.GetResFileU() != null)
|
texSampler.MinFilter = ResUGX2.GX2TexXYFilterType.Point;
|
||||||
{
|
texSampler.MipFilter = ResUGX2.GX2TexMipFilterType.Linear;
|
||||||
var texSampler = new ResUGX2.TexSampler();
|
texSampler.ZFilter = 0;
|
||||||
texSampler.BorderType = ResUGX2.GX2TexBorderType.ClearBlack;
|
texSampler.MaxLod = 13;
|
||||||
texSampler.ClampX = ResUGX2.GX2TexClamp.Wrap;
|
texSampler.MinLod = 0;
|
||||||
texSampler.ClampY = ResUGX2.GX2TexClamp.Wrap;
|
texSampler.LodBias = 0;
|
||||||
texSampler.ClampZ = ResUGX2.GX2TexClamp.Clamp;
|
tex.wiiUSampler = texSampler;
|
||||||
texSampler.DepthCompareEnabled = false;
|
|
||||||
texSampler.DepthCompareFunc = ResUGX2.GX2CompareFunction.Never;
|
|
||||||
texSampler.MagFilter = ResUGX2.GX2TexXYFilterType.Point;
|
|
||||||
texSampler.MaxAnisotropicRatio = ResUGX2.GX2TexAnisoRatio.Ratio_1_1;
|
|
||||||
texSampler.MinFilter = ResUGX2.GX2TexXYFilterType.Point;
|
|
||||||
texSampler.MipFilter = ResUGX2.GX2TexMipFilterType.Linear;
|
|
||||||
texSampler.ZFilter = 0;
|
|
||||||
texSampler.MaxLod = 13;
|
|
||||||
texSampler.MinLod = 0;
|
|
||||||
texSampler.LodBias = 0;
|
|
||||||
tex.wiiUSampler = texSampler;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var texSampler = new ResNX.Sampler();
|
|
||||||
tex.switchSampler = texSampler;
|
|
||||||
}
|
|
||||||
material.TextureMaps.Add(tex);
|
|
||||||
|
|
||||||
var item = new ListViewItem();
|
|
||||||
item.Text = "Untitled";
|
|
||||||
item.SubItems.Add(tex.SamplerName);
|
|
||||||
item.SubItems.Add(tex.FragShaderSampler);
|
|
||||||
textureRefListView.Items.Add(item);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var texSampler = new ResNX.Sampler();
|
||||||
|
tex.switchSampler = texSampler;
|
||||||
|
}
|
||||||
|
material.TextureMaps.Add(tex);
|
||||||
|
|
||||||
|
var item = new ListViewItem();
|
||||||
|
item.Text = "Untitled";
|
||||||
|
item.SubItems.Add(tex.SamplerName);
|
||||||
|
item.SubItems.Add(tex.FragShaderSampler);
|
||||||
|
textureRefListView.Items.Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnRemove_Click(object sender, EventArgs e)
|
private void btnRemove_Click(object sender, EventArgs e)
|
||||||
|
@ -428,7 +424,7 @@ namespace FirstPlugin.Forms
|
||||||
{
|
{
|
||||||
string FirstSelecteItem = textureRefListView.SelectedItems[0].Text;
|
string FirstSelecteItem = textureRefListView.SelectedItems[0].Text;
|
||||||
|
|
||||||
var result = MessageBox.Show("NOTE! Texture maps are adjusted by shader options which link by shaders. These are not possible to edit yet, do you want to continue?", "Material Editor", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
|
var result = MessageBox.Show("NOTE! Removing texture maps could cause issues with shaders, do you want to continue?", "Material Editor", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
|
||||||
|
|
||||||
if (result == DialogResult.Yes)
|
if (result == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue