2019-07-09 23:50:50 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Threading.Tasks;
|
2019-07-16 23:35:21 +02:00
|
|
|
|
using Toolbox;
|
2019-07-09 23:50:50 +02:00
|
|
|
|
using System.Windows.Forms;
|
2019-07-16 23:35:21 +02:00
|
|
|
|
using Toolbox.Library;
|
|
|
|
|
using Toolbox.Library.Forms;
|
|
|
|
|
using Toolbox.Library.IO;
|
2020-02-12 01:19:23 +01:00
|
|
|
|
using System.ComponentModel;
|
2019-07-09 23:50:50 +02:00
|
|
|
|
|
|
|
|
|
namespace FirstPlugin
|
|
|
|
|
{
|
2019-11-10 18:36:56 +01:00
|
|
|
|
public class TPL : TreeNodeFile, IFileFormat, ITextureContainer
|
2019-07-09 23:50:50 +02:00
|
|
|
|
{
|
|
|
|
|
public FileType FileType { get; set; } = FileType.Image;
|
|
|
|
|
|
|
|
|
|
public bool CanSave { get; set; }
|
|
|
|
|
public string[] Description { get; set; } = new string[] { "TPL" };
|
|
|
|
|
public string[] Extension { get; set; } = new string[] { "*.tpl" };
|
|
|
|
|
public string FileName { get; set; }
|
|
|
|
|
public string FilePath { get; set; }
|
|
|
|
|
public IFileInfo IFileInfo { get; set; }
|
|
|
|
|
|
|
|
|
|
public bool Identify(System.IO.Stream stream)
|
|
|
|
|
{
|
|
|
|
|
using (var reader = new FileReader(stream, true))
|
|
|
|
|
{
|
|
|
|
|
reader.ByteOrder = Syroot.BinaryData.ByteOrder.BigEndian;
|
2019-08-04 19:31:16 +02:00
|
|
|
|
return reader.ReadUInt32() == 0x0020AF30 || Utils.GetExtension(FileName) == ".tpl";
|
2019-07-09 23:50:50 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Type[] Types
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
List<Type> types = new List<Type>();
|
|
|
|
|
return types.ToArray();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-10 18:36:56 +01:00
|
|
|
|
public bool DisplayIcons => true;
|
|
|
|
|
|
|
|
|
|
public List<STGenericTexture> TextureList
|
2019-08-04 19:31:16 +02:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
List<STGenericTexture> textures = new List<STGenericTexture>();
|
|
|
|
|
foreach (STGenericTexture node in Nodes)
|
|
|
|
|
textures.Add(node);
|
|
|
|
|
|
|
|
|
|
return textures;
|
|
|
|
|
}
|
|
|
|
|
set { }
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-04 18:21:28 +02:00
|
|
|
|
public List<ImageHeader> ImageHeaders = new List<ImageHeader>();
|
|
|
|
|
public List<PaletteHeader> PaletteHeaders = new List<PaletteHeader>();
|
2019-07-09 23:50:50 +02:00
|
|
|
|
|
2019-09-14 01:42:16 +02:00
|
|
|
|
public override void OnAfterAdded()
|
|
|
|
|
{
|
|
|
|
|
if (Nodes.Count > 0 && this.TreeView != null)
|
|
|
|
|
this.TreeView.SelectedNode = Nodes[0];
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-09 23:50:50 +02:00
|
|
|
|
public void Load(System.IO.Stream stream)
|
|
|
|
|
{
|
|
|
|
|
Text = FileName;
|
|
|
|
|
|
2019-08-04 18:21:28 +02:00
|
|
|
|
using (var reader = new FileReader(stream))
|
|
|
|
|
{
|
2019-08-04 19:31:16 +02:00
|
|
|
|
reader.SetByteOrder(true);
|
|
|
|
|
|
2019-08-04 18:21:28 +02:00
|
|
|
|
uint Identifier = reader.ReadUInt32();
|
|
|
|
|
|
2019-08-04 19:31:16 +02:00
|
|
|
|
//TPL has multiple versions i assume? Some games like F Zero use a custom one so try that
|
|
|
|
|
if (Identifier != 0x0020AF30)
|
2019-08-04 18:21:28 +02:00
|
|
|
|
{
|
2019-08-04 19:31:16 +02:00
|
|
|
|
reader.Position = 0;
|
|
|
|
|
uint ImageCount = reader.ReadUInt32();
|
|
|
|
|
for (int i = 0; i < ImageCount; i++)
|
|
|
|
|
{
|
|
|
|
|
reader.SeekBegin(4 + (i * 0x10));
|
|
|
|
|
|
2020-02-12 01:19:23 +01:00
|
|
|
|
var image = new ImageHeader();
|
|
|
|
|
|
|
|
|
|
image.Format = (Decode_Gamecube.TextureFormats)reader.ReadUInt32();
|
|
|
|
|
image.ImageOffset = reader.ReadUInt32();
|
|
|
|
|
image.Width = reader.ReadUInt16();
|
|
|
|
|
image.Height = reader.ReadUInt16();
|
|
|
|
|
image.MaxLOD = (byte)reader.ReadUInt16();
|
2019-08-04 19:31:16 +02:00
|
|
|
|
ushort unknown = reader.ReadUInt16();
|
|
|
|
|
|
2020-02-12 01:19:23 +01:00
|
|
|
|
if ((uint)image.Format == 256)
|
2019-08-04 19:31:16 +02:00
|
|
|
|
break;
|
|
|
|
|
|
2020-02-12 01:19:23 +01:00
|
|
|
|
Console.WriteLine(image.ImageOffset);
|
|
|
|
|
Console.WriteLine(image.Format);
|
2019-08-04 18:21:28 +02:00
|
|
|
|
|
2019-08-04 19:31:16 +02:00
|
|
|
|
//Now create a wrapper
|
2020-02-12 01:19:23 +01:00
|
|
|
|
var texWrapper = new TplTextureWrapper(this, image);
|
|
|
|
|
string name = System.IO.Path.GetFileNameWithoutExtension(FileName);
|
|
|
|
|
if (ImageCount == 1)
|
|
|
|
|
texWrapper.Text = name;
|
|
|
|
|
else
|
|
|
|
|
texWrapper.Text = $"{name}_{i}";
|
2019-08-04 19:31:16 +02:00
|
|
|
|
texWrapper.ImageKey = "Texture";
|
|
|
|
|
texWrapper.SelectedImageKey = "Texture";
|
2020-02-12 01:19:23 +01:00
|
|
|
|
texWrapper.Format = Decode_Gamecube.ToGenericFormat(image.Format);
|
|
|
|
|
texWrapper.Width = image.Width;
|
|
|
|
|
texWrapper.Height = image.Height;
|
|
|
|
|
texWrapper.MipCount = image.MaxLOD;
|
|
|
|
|
texWrapper.ImageData = reader.getSection(image.ImageOffset, (uint)Decode_Gamecube.GetDataSize(image.Format, (int)image.Width, (int)image.Height));
|
2019-08-04 19:31:16 +02:00
|
|
|
|
texWrapper.PlatformSwizzle = PlatformSwizzle.Platform_Gamecube;
|
|
|
|
|
Nodes.Add(texWrapper);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
uint ImageCount = reader.ReadUInt32();
|
|
|
|
|
uint ImageOffsetTable = reader.ReadUInt32();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < ImageCount; i++)
|
2019-08-04 18:21:28 +02:00
|
|
|
|
{
|
2019-08-04 19:31:16 +02:00
|
|
|
|
reader.SeekBegin(ImageOffsetTable + (i * 8));
|
|
|
|
|
|
|
|
|
|
uint ImageHeaderOffset = reader.ReadUInt32();
|
|
|
|
|
uint PaletteHeaderOffset = reader.ReadUInt32();
|
|
|
|
|
|
2019-08-04 18:21:28 +02:00
|
|
|
|
reader.SeekBegin(ImageHeaderOffset);
|
|
|
|
|
var image = new ImageHeader();
|
|
|
|
|
image.Read(reader);
|
|
|
|
|
ImageHeaders.Add(image);
|
2019-08-04 19:31:16 +02:00
|
|
|
|
|
2019-08-04 19:45:11 +02:00
|
|
|
|
Console.WriteLine($"ImageOffset {image.ImageOffset}");
|
|
|
|
|
|
|
|
|
|
//Now create a wrapper
|
2020-02-12 01:19:23 +01:00
|
|
|
|
var texWrapper = new TplTextureWrapper(this, image);
|
|
|
|
|
string name = System.IO.Path.GetFileNameWithoutExtension(FileName);
|
|
|
|
|
if (ImageCount == 1)
|
|
|
|
|
texWrapper.Text = name;
|
|
|
|
|
else
|
|
|
|
|
texWrapper.Text = $"{name}_{i}";
|
|
|
|
|
|
2019-08-04 19:45:11 +02:00
|
|
|
|
texWrapper.ImageKey = "Texture";
|
|
|
|
|
texWrapper.SelectedImageKey = "Texture";
|
2020-02-12 01:19:23 +01:00
|
|
|
|
texWrapper.Format = Decode_Gamecube.ToGenericFormat(image.Format);
|
2019-08-04 19:45:11 +02:00
|
|
|
|
texWrapper.Width = image.Width;
|
|
|
|
|
texWrapper.Height = image.Height;
|
|
|
|
|
texWrapper.MipCount = 1;
|
|
|
|
|
texWrapper.PlatformSwizzle = PlatformSwizzle.Platform_Gamecube;
|
|
|
|
|
texWrapper.ImageData = reader.getSection(image.ImageOffset,
|
2020-02-12 01:19:23 +01:00
|
|
|
|
(uint)Decode_Gamecube.GetDataSize(image.Format, (int)image.Width, (int)image.Height));
|
2019-08-04 19:45:11 +02:00
|
|
|
|
|
2020-01-15 01:19:02 +01:00
|
|
|
|
Console.WriteLine($"PaletteHeaderOffset {PaletteHeaderOffset}");
|
2020-02-12 01:19:23 +01:00
|
|
|
|
Console.WriteLine($"ImageData { texWrapper.ImageData.Length}");
|
2020-01-15 01:19:02 +01:00
|
|
|
|
|
2019-08-04 19:31:16 +02:00
|
|
|
|
//Palette is sometimes unused to check
|
|
|
|
|
if (PaletteHeaderOffset != 0)
|
|
|
|
|
{
|
|
|
|
|
reader.SeekBegin(PaletteHeaderOffset);
|
|
|
|
|
var palette = new PaletteHeader();
|
|
|
|
|
palette.Read(reader);
|
|
|
|
|
PaletteHeaders.Add(palette);
|
|
|
|
|
|
2019-10-17 00:55:18 +02:00
|
|
|
|
var GXPaletteFormat = (Decode_Gamecube.PaletteFormats)palette.PaletteFormat;
|
2020-02-12 01:19:23 +01:00
|
|
|
|
image.PaletteFormat = GXPaletteFormat;
|
2019-08-04 19:31:16 +02:00
|
|
|
|
|
2019-10-17 01:21:47 +02:00
|
|
|
|
Console.WriteLine($"GXPaletteFormat {GXPaletteFormat}");
|
2019-08-04 19:45:11 +02:00
|
|
|
|
texWrapper.SetPaletteData(palette.Data, Decode_Gamecube.ToGenericPaletteFormat(GXPaletteFormat));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Nodes.Add(texWrapper);
|
2019-08-04 18:21:28 +02:00
|
|
|
|
}
|
2019-08-04 19:31:16 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class TplTextureWrapper : STGenericTexture
|
|
|
|
|
{
|
2020-02-12 01:19:23 +01:00
|
|
|
|
public TPL TPLParent { get; set; }
|
|
|
|
|
|
2019-08-04 19:31:16 +02:00
|
|
|
|
public byte[] ImageData { get; set; }
|
2020-02-12 01:19:23 +01:00
|
|
|
|
public ImageHeader ImageHeader;
|
|
|
|
|
|
|
|
|
|
public TplTextureWrapper(TPL tpl, ImageHeader header) {
|
|
|
|
|
TPLParent = tpl;
|
|
|
|
|
ImageHeader = header;
|
2020-02-12 22:56:16 +01:00
|
|
|
|
|
|
|
|
|
CanReplace = true;
|
2020-02-12 01:19:23 +01:00
|
|
|
|
}
|
2019-08-04 18:21:28 +02:00
|
|
|
|
|
2019-08-04 19:31:16 +02:00
|
|
|
|
public override TEX_FORMAT[] SupportedFormats
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return new TEX_FORMAT[]
|
2019-08-04 18:21:28 +02:00
|
|
|
|
{
|
2019-08-04 19:31:16 +02:00
|
|
|
|
TEX_FORMAT.I4,
|
|
|
|
|
TEX_FORMAT.I8,
|
|
|
|
|
TEX_FORMAT.IA4,
|
|
|
|
|
TEX_FORMAT.IA8,
|
|
|
|
|
TEX_FORMAT.RGB565,
|
|
|
|
|
TEX_FORMAT.RGB5A3,
|
|
|
|
|
TEX_FORMAT.RGBA32,
|
|
|
|
|
TEX_FORMAT.C4,
|
|
|
|
|
TEX_FORMAT.C8,
|
|
|
|
|
TEX_FORMAT.C14X2,
|
|
|
|
|
TEX_FORMAT.CMPR,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override bool CanEdit { get; set; } = false;
|
|
|
|
|
|
|
|
|
|
public override void SetImageData(System.Drawing.Bitmap bitmap, int ArrayLevel)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-15 01:19:02 +01:00
|
|
|
|
public override byte[] GetImageData(int ArrayLevel = 0, int MipLevel = 0, int DepthLevel = 0)
|
2019-08-04 19:31:16 +02:00
|
|
|
|
{
|
2019-08-09 01:58:14 +02:00
|
|
|
|
return Decode_Gamecube.GetMipLevel(ImageData, Width, Height, MipCount, (uint)MipLevel, Format);
|
2019-08-04 19:31:16 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnClick(TreeView treeView)
|
|
|
|
|
{
|
|
|
|
|
ImageEditorBase editor = (ImageEditorBase)LibraryGUI.GetActiveContent(typeof(ImageEditorBase));
|
|
|
|
|
if (editor == null)
|
|
|
|
|
{
|
|
|
|
|
editor = new ImageEditorBase();
|
|
|
|
|
editor.Dock = DockStyle.Fill;
|
|
|
|
|
LibraryGUI.LoadEditor(editor);
|
2019-08-04 18:21:28 +02:00
|
|
|
|
}
|
2019-08-04 19:31:16 +02:00
|
|
|
|
|
2020-02-12 01:19:23 +01:00
|
|
|
|
editor.LoadProperties(ImageHeader);
|
2019-08-04 19:31:16 +02:00
|
|
|
|
editor.LoadImage(this);
|
2019-08-04 18:21:28 +02:00
|
|
|
|
}
|
2020-02-12 22:56:16 +01:00
|
|
|
|
|
|
|
|
|
public void UpdateEditor()
|
|
|
|
|
{
|
|
|
|
|
ImageEditorBase editor = (ImageEditorBase)LibraryGUI.GetActiveContent(typeof(ImageEditorBase));
|
|
|
|
|
if (editor == null)
|
|
|
|
|
{
|
|
|
|
|
editor = new ImageEditorBase();
|
|
|
|
|
editor.Dock = DockStyle.Fill;
|
|
|
|
|
LibraryGUI.LoadEditor(editor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
editor.LoadProperties(GenericProperties);
|
|
|
|
|
editor.LoadImage(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Replace(string FileName)
|
|
|
|
|
{
|
|
|
|
|
GamecubeTextureImporterList importer = new GamecubeTextureImporterList(SupportedFormats);
|
|
|
|
|
GameCubeTextureImporterSettings settings = new GameCubeTextureImporterSettings();
|
|
|
|
|
|
|
|
|
|
importer.ForceMipCount = true;
|
|
|
|
|
importer.SelectedMipCount = 1;
|
|
|
|
|
|
|
|
|
|
if (Utils.GetExtension(FileName) == ".dds" ||
|
|
|
|
|
Utils.GetExtension(FileName) == ".dds2")
|
|
|
|
|
{
|
|
|
|
|
settings.LoadDDS(FileName);
|
|
|
|
|
importer.LoadSettings(new List<GameCubeTextureImporterSettings>() { settings, });
|
|
|
|
|
|
|
|
|
|
ApplySettings(settings);
|
|
|
|
|
UpdateEditor();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
settings.LoadBitMap(FileName);
|
|
|
|
|
importer.LoadSettings(new List<GameCubeTextureImporterSettings>() { settings, });
|
|
|
|
|
|
|
|
|
|
if (importer.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
if (settings.GenerateMipmaps && !settings.IsFinishedCompressing)
|
|
|
|
|
settings.Compress();
|
|
|
|
|
|
|
|
|
|
ApplySettings(settings);
|
|
|
|
|
UpdateEditor();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ApplySettings(GameCubeTextureImporterSettings settings)
|
|
|
|
|
{
|
|
|
|
|
this.ImageData = settings.DataBlockOutput[0];
|
|
|
|
|
this.Width = settings.TexWidth;
|
|
|
|
|
this.Height = settings.TexHeight;
|
|
|
|
|
this.Format = settings.GenericFormat;
|
|
|
|
|
this.MipCount = 1; //Always 1
|
|
|
|
|
this.Depth = 1;
|
|
|
|
|
this.ArrayCount = (uint)settings.DataBlockOutput.Count;
|
|
|
|
|
}
|
2019-07-09 23:50:50 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-08-04 18:21:28 +02:00
|
|
|
|
public class PaletteHeader
|
|
|
|
|
{
|
|
|
|
|
public ushort EntryCount { get; set; }
|
|
|
|
|
public byte Unpacked { get; set; }
|
|
|
|
|
public uint PaletteFormat { get; set; }
|
|
|
|
|
public uint PaletteDataOffset { get; set; }
|
|
|
|
|
|
2019-08-04 19:45:11 +02:00
|
|
|
|
public byte[] Data;
|
|
|
|
|
|
2019-08-04 18:21:28 +02:00
|
|
|
|
public void Read(FileReader reader)
|
|
|
|
|
{
|
|
|
|
|
EntryCount = reader.ReadUInt16();
|
|
|
|
|
Unpacked = reader.ReadByte();
|
2019-10-17 00:55:18 +02:00
|
|
|
|
reader.ReadByte();
|
2019-08-04 18:21:28 +02:00
|
|
|
|
PaletteFormat = reader.ReadUInt32();
|
|
|
|
|
PaletteDataOffset = reader.ReadUInt32();
|
2019-08-04 19:45:11 +02:00
|
|
|
|
|
|
|
|
|
using (reader.TemporarySeek(PaletteDataOffset, SeekOrigin.Begin))
|
|
|
|
|
{
|
|
|
|
|
Data = reader.ReadBytes(EntryCount * 2);
|
|
|
|
|
}
|
2019-08-04 18:21:28 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Write(FileWriter writer)
|
|
|
|
|
{
|
|
|
|
|
writer.Write(EntryCount);
|
|
|
|
|
writer.Write(Unpacked);
|
2019-10-17 00:55:18 +02:00
|
|
|
|
writer.Write((byte)0);
|
2019-08-04 18:21:28 +02:00
|
|
|
|
writer.Write(PaletteFormat);
|
|
|
|
|
writer.Write(PaletteDataOffset);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ImageHeader
|
|
|
|
|
{
|
2020-02-12 01:19:23 +01:00
|
|
|
|
[ReadOnly(true)]
|
|
|
|
|
public Decode_Gamecube.TextureFormats Format { get; set; }
|
|
|
|
|
[ReadOnly(true)]
|
|
|
|
|
public Decode_Gamecube.PaletteFormats PaletteFormat { get; set; }
|
|
|
|
|
|
|
|
|
|
[ReadOnly(true)]
|
2019-08-04 18:21:28 +02:00
|
|
|
|
public ushort Width { get; set; }
|
2020-02-12 01:19:23 +01:00
|
|
|
|
[ReadOnly(true)]
|
2019-08-04 18:21:28 +02:00
|
|
|
|
public ushort Height { get; set; }
|
2020-02-12 01:19:23 +01:00
|
|
|
|
[Browsable(false)]
|
2019-08-04 18:21:28 +02:00
|
|
|
|
public uint ImageOffset { get; set; }
|
2020-02-12 01:19:23 +01:00
|
|
|
|
|
2019-08-04 18:21:28 +02:00
|
|
|
|
public float LODBias { get; set; }
|
|
|
|
|
public bool EdgeLODEnable { get; set; }
|
2020-02-12 01:19:23 +01:00
|
|
|
|
|
|
|
|
|
public WrapMode WrapS { get; set; }
|
|
|
|
|
public WrapMode WrapT { get; set; }
|
|
|
|
|
public FilterMode MinFilter { get; set; }
|
|
|
|
|
public FilterMode MagFilter { get; set; }
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
2019-08-04 18:21:28 +02:00
|
|
|
|
public byte MinLOD { get; set; }
|
2020-02-12 01:19:23 +01:00
|
|
|
|
[Browsable(false)]
|
2019-08-04 18:21:28 +02:00
|
|
|
|
public byte MaxLOD { get; set; }
|
2020-02-12 01:19:23 +01:00
|
|
|
|
[Browsable(false)]
|
2019-08-04 18:21:28 +02:00
|
|
|
|
public byte Unpacked { get; set; }
|
|
|
|
|
|
|
|
|
|
public void Read(FileReader reader)
|
|
|
|
|
{
|
|
|
|
|
Height = reader.ReadUInt16();
|
2019-08-04 19:46:54 +02:00
|
|
|
|
Width = reader.ReadUInt16();
|
2020-02-12 01:19:23 +01:00
|
|
|
|
Format = (Decode_Gamecube.TextureFormats)reader.ReadUInt32();
|
2019-08-04 18:21:28 +02:00
|
|
|
|
ImageOffset = reader.ReadUInt32();
|
2020-02-12 01:19:23 +01:00
|
|
|
|
WrapS = (WrapMode)reader.ReadUInt32();
|
|
|
|
|
WrapT = (WrapMode)reader.ReadUInt32();
|
|
|
|
|
MinFilter = (FilterMode)reader.ReadUInt32();
|
|
|
|
|
MagFilter = (FilterMode)reader.ReadUInt32();
|
2019-08-04 18:21:28 +02:00
|
|
|
|
LODBias = reader.ReadSingle();
|
|
|
|
|
EdgeLODEnable = reader.ReadBoolean();
|
|
|
|
|
MinLOD = reader.ReadByte();
|
|
|
|
|
MaxLOD = reader.ReadByte();
|
|
|
|
|
Unpacked = reader.ReadByte();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Write(FileWriter writer)
|
|
|
|
|
{
|
|
|
|
|
writer.Write(Width);
|
|
|
|
|
writer.Write(Height);
|
2020-02-12 01:19:23 +01:00
|
|
|
|
writer.Write((uint)Format);
|
2019-08-04 18:21:28 +02:00
|
|
|
|
writer.Write(ImageOffset);
|
2020-02-12 01:19:23 +01:00
|
|
|
|
writer.Write((uint)WrapS);
|
|
|
|
|
writer.Write((uint)WrapT);
|
|
|
|
|
writer.Write((uint)MinFilter);
|
|
|
|
|
writer.Write((uint)MagFilter);
|
2019-08-04 18:21:28 +02:00
|
|
|
|
writer.Write(LODBias);
|
|
|
|
|
writer.Write(EdgeLODEnable);
|
|
|
|
|
writer.Write(MinLOD);
|
|
|
|
|
writer.Write(MaxLOD);
|
|
|
|
|
writer.Write(Unpacked);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-07-09 23:50:50 +02:00
|
|
|
|
|
2020-02-12 01:19:23 +01:00
|
|
|
|
public enum WrapMode : uint
|
|
|
|
|
{
|
|
|
|
|
Clamp,
|
|
|
|
|
Repeat,
|
|
|
|
|
Mirror
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum FilterMode : uint
|
|
|
|
|
{
|
|
|
|
|
Nearest,
|
|
|
|
|
Linear,
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-09 23:50:50 +02:00
|
|
|
|
public void Unload()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-06 23:35:18 +02:00
|
|
|
|
public void Save(System.IO.Stream stream)
|
2019-07-09 23:50:50 +02:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|