mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-23 16:27:47 +01:00
Some updates.
This commit is contained in:
parent
c2e74ed382
commit
221b18751d
121 changed files with 338 additions and 328 deletions
|
|
@ -103,7 +103,7 @@ public readonly struct BaseImage : IDisposable
|
|||
{
|
||||
null => 0,
|
||||
ScratchImage s => s.Meta.MipLevels,
|
||||
TexFile t => t.Header.MipLevelsCount,
|
||||
TexFile t => t.Header.MipCount,
|
||||
_ => 1,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ public static class TexFileParser
|
|||
w.Write(header.Width);
|
||||
w.Write(header.Height);
|
||||
w.Write(header.Depth);
|
||||
w.Write(header.MipLevelsCount);
|
||||
w.Write((byte)0); // TODO Lumina Update
|
||||
w.Write(header.MipCount);
|
||||
w.Write(header.MipUnknownFlag); // TODO Lumina Update
|
||||
unsafe
|
||||
{
|
||||
w.Write(header.LodOffset[0]);
|
||||
|
|
@ -96,11 +96,11 @@ public static class TexFileParser
|
|||
var meta = scratch.Meta;
|
||||
var ret = new TexFile.TexHeader()
|
||||
{
|
||||
Height = (ushort)meta.Height,
|
||||
Width = (ushort)meta.Width,
|
||||
Depth = (ushort)Math.Max(meta.Depth, 1),
|
||||
MipLevelsCount = (byte)Math.Min(meta.MipLevels, 13),
|
||||
Format = meta.Format.ToTexFormat(),
|
||||
Height = (ushort)meta.Height,
|
||||
Width = (ushort)meta.Width,
|
||||
Depth = (ushort)Math.Max(meta.Depth, 1),
|
||||
MipCount = (byte)Math.Min(meta.MipLevels, 13),
|
||||
Format = meta.Format.ToTexFormat(),
|
||||
Type = meta.Dimension switch
|
||||
{
|
||||
_ when meta.IsCubeMap => TexFile.Attribute.TextureTypeCube,
|
||||
|
|
@ -143,7 +143,7 @@ public static class TexFileParser
|
|||
Height = header.Height,
|
||||
Width = header.Width,
|
||||
Depth = Math.Max(header.Depth, (ushort)1),
|
||||
MipLevels = header.MipLevelsCount,
|
||||
MipLevels = header.MipCount,
|
||||
ArraySize = 1,
|
||||
Format = header.Format.ToDXGI(),
|
||||
Dimension = header.Type.ToDimension(),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.Textures.TextureWraps;
|
||||
using OtterTex;
|
||||
|
||||
namespace Penumbra.Import.Textures;
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public static class TextureDrawer
|
|||
ImGuiUtil.DrawTableColumn("Format");
|
||||
ImGuiUtil.DrawTableColumn(t.Header.Format.ToString());
|
||||
ImGuiUtil.DrawTableColumn("Mip Levels");
|
||||
ImGuiUtil.DrawTableColumn(t.Header.MipLevelsCount.ToString());
|
||||
ImGuiUtil.DrawTableColumn(t.Header.MipCount.ToString());
|
||||
ImGuiUtil.DrawTableColumn("Data Size");
|
||||
ImGuiUtil.DrawTableColumn($"{Functions.HumanReadableSize(t.ImageData.Length)} ({t.ImageData.Length} Bytes)");
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.Textures;
|
||||
using Dalamud.Interface.Textures.TextureWraps;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Lumina.Data.Files;
|
||||
using OtterGui.Log;
|
||||
|
|
@ -13,7 +13,7 @@ using Image = SixLabors.ImageSharp.Image;
|
|||
|
||||
namespace Penumbra.Import.Textures;
|
||||
|
||||
public sealed class TextureManager(UiBuilder uiBuilder, IDataManager gameData, Logger logger)
|
||||
public sealed class TextureManager(IDataManager gameData, Logger logger, ITextureProvider textureProvider)
|
||||
: SingleTaskQueue, IDisposable, IService
|
||||
{
|
||||
private readonly Logger _logger = logger;
|
||||
|
|
@ -211,7 +211,7 @@ public sealed class TextureManager(UiBuilder uiBuilder, IDataManager gameData, L
|
|||
|
||||
/// <summary> Load a texture wrap for a given image. </summary>
|
||||
public IDalamudTextureWrap LoadTextureWrap(byte[] rgba, int width, int height)
|
||||
=> uiBuilder.LoadImageRaw(rgba, width, height, 4);
|
||||
=> textureProvider.CreateFromRaw(RawImageSpecification.Rgba32(width, height), rgba, "Penumbra.Texture");
|
||||
|
||||
/// <summary> Load any supported file from game data or drive depending on extension and if the path is rooted. </summary>
|
||||
public (BaseImage, TextureType) Load(string path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue