More fixes to ptcl texture replacing
This commit is contained in:
parent
2dd98141f0
commit
21577ba522
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -206,13 +206,11 @@ namespace Bfres.Structs
|
|||||||
|
|
||||||
importer.ReadOnlySwizzle = IsSwizzleReadOnly;
|
importer.ReadOnlySwizzle = IsSwizzleReadOnly;
|
||||||
importer.ReadOnlyTileMode = IsSwizzleReadOnly;
|
importer.ReadOnlyTileMode = IsSwizzleReadOnly;
|
||||||
|
importer.ReadOnlyFormat = IsFormatReadOnly;
|
||||||
|
|
||||||
if (Tex2Swizzle != 0)
|
if (Tex2Swizzle != 0)
|
||||||
setting.Swizzle = Tex2Swizzle;
|
setting.Swizzle = Tex2Swizzle;
|
||||||
|
|
||||||
if (DefaultFormat != TEX_FORMAT.UNKNOWN)
|
|
||||||
setting.Format = (GX2.GX2SurfaceFormat)ConvertToGx2Format(DefaultFormat);
|
|
||||||
|
|
||||||
if (MipMapCount != 0)
|
if (MipMapCount != 0)
|
||||||
{
|
{
|
||||||
setting.MipCount = MipMapCount;
|
setting.MipCount = MipMapCount;
|
||||||
@ -223,6 +221,9 @@ namespace Bfres.Structs
|
|||||||
|
|
||||||
importer.LoadSetting(setting);
|
importer.LoadSetting(setting);
|
||||||
|
|
||||||
|
if (DefaultFormat != TEX_FORMAT.UNKNOWN)
|
||||||
|
setting.Format = (GX2.GX2SurfaceFormat)ConvertToGx2Format(DefaultFormat);
|
||||||
|
|
||||||
if (ext == ".dds")
|
if (ext == ".dds")
|
||||||
{
|
{
|
||||||
if (setting.DataBlockOutput != null)
|
if (setting.DataBlockOutput != null)
|
||||||
|
@ -425,7 +425,7 @@ namespace FirstPlugin
|
|||||||
public override void Replace(string FileName)
|
public override void Replace(string FileName)
|
||||||
{
|
{
|
||||||
FTEX ftex = new FTEX();
|
FTEX ftex = new FTEX();
|
||||||
ftex.ReplaceTexture(FileName, 1, SupportedFormats, true, true, true, Format);
|
ftex.ReplaceTexture(FileName, MipCount, SupportedFormats, true, true, true, Format);
|
||||||
if (ftex.texture != null)
|
if (ftex.texture != null)
|
||||||
{
|
{
|
||||||
Swizzle = (byte)ftex.texture.Swizzle;
|
Swizzle = (byte)ftex.texture.Swizzle;
|
||||||
@ -485,10 +485,6 @@ namespace FirstPlugin
|
|||||||
TEX_FORMAT.BC4_SNORM,
|
TEX_FORMAT.BC4_SNORM,
|
||||||
TEX_FORMAT.BC5_UNORM,
|
TEX_FORMAT.BC5_UNORM,
|
||||||
TEX_FORMAT.BC5_SNORM,
|
TEX_FORMAT.BC5_SNORM,
|
||||||
TEX_FORMAT.BC6H_UF16,
|
|
||||||
TEX_FORMAT.BC6H_SF16,
|
|
||||||
TEX_FORMAT.BC7_UNORM,
|
|
||||||
TEX_FORMAT.BC7_UNORM_SRGB,
|
|
||||||
TEX_FORMAT.B5G5R5A1_UNORM,
|
TEX_FORMAT.B5G5R5A1_UNORM,
|
||||||
TEX_FORMAT.B5G6R5_UNORM,
|
TEX_FORMAT.B5G6R5_UNORM,
|
||||||
TEX_FORMAT.B8G8R8A8_UNORM_SRGB,
|
TEX_FORMAT.B8G8R8A8_UNORM_SRGB,
|
||||||
@ -531,8 +527,6 @@ namespace FirstPlugin
|
|||||||
public uint TileMode;
|
public uint TileMode;
|
||||||
public uint Swizzle;
|
public uint Swizzle;
|
||||||
public byte WrapMode;
|
public byte WrapMode;
|
||||||
public byte Depth;
|
|
||||||
public uint MipCount;
|
|
||||||
public uint CompSel;
|
public uint CompSel;
|
||||||
public uint ImageSize;
|
public uint ImageSize;
|
||||||
public uint ImageOffset;
|
public uint ImageOffset;
|
||||||
@ -561,7 +555,7 @@ namespace FirstPlugin
|
|||||||
|
|
||||||
if (header.IsSPBD)
|
if (header.IsSPBD)
|
||||||
{
|
{
|
||||||
MipCount = reader.ReadUInt32();
|
uint MipCount = reader.ReadUInt32();
|
||||||
CompSel = reader.ReadUInt32();
|
CompSel = reader.ReadUInt32();
|
||||||
uint enableMipLevel = reader.ReadUInt32();
|
uint enableMipLevel = reader.ReadUInt32();
|
||||||
uint mipBias = reader.ReadUInt32();
|
uint mipBias = reader.ReadUInt32();
|
||||||
@ -578,7 +572,7 @@ namespace FirstPlugin
|
|||||||
byte unk = reader.ReadByte();
|
byte unk = reader.ReadByte();
|
||||||
Depth = reader.ReadByte();
|
Depth = reader.ReadByte();
|
||||||
byte unk1 = reader.ReadByte();
|
byte unk1 = reader.ReadByte();
|
||||||
MipCount = reader.ReadUInt32();
|
uint MipCount = reader.ReadUInt32();
|
||||||
CompSel = reader.ReadUInt32();
|
CompSel = reader.ReadUInt32();
|
||||||
uint enableMipLevel = reader.ReadUInt32();
|
uint enableMipLevel = reader.ReadUInt32();
|
||||||
uint mipBias = reader.ReadUInt32();
|
uint mipBias = reader.ReadUInt32();
|
||||||
@ -591,7 +585,6 @@ namespace FirstPlugin
|
|||||||
}
|
}
|
||||||
ArrayCount = 1;
|
ArrayCount = 1;
|
||||||
|
|
||||||
|
|
||||||
if (Width != 0 && Height != 0 && SurfFormat != 0)
|
if (Width != 0 && Height != 0 && SurfFormat != 0)
|
||||||
{
|
{
|
||||||
using (reader.TemporarySeek(header.TextureBlockTableOffset + DataPos, SeekOrigin.Begin))
|
using (reader.TemporarySeek(header.TextureBlockTableOffset + DataPos, SeekOrigin.Begin))
|
||||||
@ -600,6 +593,11 @@ namespace FirstPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data != null && data.Length > 0)
|
||||||
|
{
|
||||||
|
ConvertFormat();
|
||||||
|
}
|
||||||
|
|
||||||
reader.Seek(164, SeekOrigin.Current);
|
reader.Seek(164, SeekOrigin.Current);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -619,10 +617,10 @@ namespace FirstPlugin
|
|||||||
throw new NotImplementedException("Cannot set image data! Operation not implemented!");
|
throw new NotImplementedException("Cannot set image data! Operation not implemented!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override byte[] GetImageData(int ArrayLevel = 0, int MipLevel = 0)
|
uint GX2Format = 0;
|
||||||
{
|
|
||||||
uint GX2Format = (uint)GX2.GX2SurfaceFormat.T_BC5_UNORM;
|
|
||||||
|
|
||||||
|
private void ConvertFormat()
|
||||||
|
{
|
||||||
switch (SurfFormat)
|
switch (SurfFormat)
|
||||||
{
|
{
|
||||||
case SurfaceFormat.T_BC1_UNORM:
|
case SurfaceFormat.T_BC1_UNORM:
|
||||||
@ -688,8 +686,10 @@ namespace FirstPlugin
|
|||||||
default:
|
default:
|
||||||
throw new Exception("Format unsupported! " + SurfFormat);
|
throw new Exception("Format unsupported! " + SurfFormat);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override byte[] GetImageData(int ArrayLevel = 0, int MipLevel = 0)
|
||||||
|
{
|
||||||
int swizzle = (int)Swizzle;
|
int swizzle = (int)Swizzle;
|
||||||
int pitch = (int)0;
|
int pitch = (int)0;
|
||||||
uint bpp = GX2.surfaceGetBitsPerPixel(GX2Format) >> 3;
|
uint bpp = GX2.surfaceGetBitsPerPixel(GX2Format) >> 3;
|
||||||
|
@ -63,6 +63,7 @@ namespace FirstPlugin
|
|||||||
DecompressedData.Clear();
|
DecompressedData.Clear();
|
||||||
|
|
||||||
TexName = Path.GetFileNameWithoutExtension(FileName);
|
TexName = Path.GetFileNameWithoutExtension(FileName);
|
||||||
|
|
||||||
Format = (GX2.GX2SurfaceFormat)FTEX.ConvertToGx2Format(Runtime.PreferredTexFormat);
|
Format = (GX2.GX2SurfaceFormat)FTEX.ConvertToGx2Format(Runtime.PreferredTexFormat);
|
||||||
|
|
||||||
GenerateMipmaps = true;
|
GenerateMipmaps = true;
|
||||||
|
@ -90,6 +90,14 @@ namespace FirstPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ReadOnlyFormat
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
formatComboBox.ReadOnly = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void LoadSupportedFormats(TEX_FORMAT[] Formats)
|
public void LoadSupportedFormats(TEX_FORMAT[] Formats)
|
||||||
{
|
{
|
||||||
formatComboBox.Items.Clear();
|
formatComboBox.Items.Clear();
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user