Skip to content

Commit

Permalink
Attempt to fix some texture errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebane1 committed Aug 13, 2023
1 parent abcc178 commit f06aaa3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
25 changes: 16 additions & 9 deletions Penumbra/Import/Textures/CombinedTexture.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Numerics;
using System.Threading.Tasks;
using FFXIVLooseTextureCompiler.ImageProcessing;

Check failure on line 6 in Penumbra/Import/Textures/CombinedTexture.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'FFXIVLooseTextureCompiler' could not be found (are you missing a using directive or an assembly reference?)
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.PixelFormats;
using Image = SixLabors.ImageSharp.Image;

namespace Penumbra.Import.Textures;

Expand Down Expand Up @@ -147,15 +154,15 @@ public void ImageToEyeMaps(string path, string textureCompilerDLC)

try
{
var image = Image.LoadPixelData<Rgba32>(_current.RGBAPixels, _current.TextureWrap!.Width,
var image = Image.LoadPixelData<Rgba32>(_current.RgbaPixels, _current.TextureWrap!.Width,
_current.TextureWrap!.Height);
image.Save(path, new PngEncoder() { CompressionLevel = PngCompressionLevel.NoCompression });
ImageManipulation.ConvertToEyeMaps(path, textureCompilerDLC);
SaveException = null;
//SaveException = null;
}
catch (Exception e)
{
SaveException = e;
//SaveException = e;
}
}
internal void EyeMultiToGrayscale(string path)
Expand All @@ -167,16 +174,16 @@ internal void EyeMultiToGrayscale(string path)

try
{
var image = Image.LoadPixelData<Rgba32>(_current.RGBAPixels, _current.TextureWrap!.Width,
var image = Image.LoadPixelData<Rgba32>(_current.RgbaPixels, _current.TextureWrap!.Width,
_current.TextureWrap!.Height);
image.Save(path, new PngEncoder() { CompressionLevel = PngCompressionLevel.NoCompression });
Bitmap multi = TexLoader.ResolveBitmap(path);
ImageManipulation.ExtractRed(multi).Save(ImageManipulation.AddSuffix(path, "_grayscale"));
SaveException = null;
//SaveException = null;
}
catch (Exception e)
{
SaveException = e;
// SaveException = e;
}
}

Expand All @@ -189,16 +196,16 @@ public void AtramentumLuminisDiffuseToGlowMap(string path)

try
{
var image = Image.LoadPixelData<Rgba32>(_current.RGBAPixels, _current.TextureWrap!.Width,
var image = Image.LoadPixelData<Rgba32>(_current.RgbaPixels, _current.TextureWrap!.Width,
_current.TextureWrap!.Height);
image.Save(path, new PngEncoder() { CompressionLevel = PngCompressionLevel.NoCompression });
Bitmap diffuse = TexLoader.ResolveBitmap(path);
AtramentumLuminisGlow.ExtractGlowMapFromDiffuse(diffuse).Save(path, ImageFormat.Png);
SaveException = null;
// SaveException = null;
}
catch (Exception e)
{
SaveException = e;
// SaveException = e;
}
}
}
8 changes: 8 additions & 0 deletions Penumbra/Import/Textures/Texture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ public enum TextureType
Tex,
Png,
Bitmap,
AsIsTex,
AsIsDds,
RgbaTex,
RgbaDds,
Bc3Tex,
Bc3Dds,
Bc7Tex,
Bc7Dds,
}

public sealed class Texture : IDisposable
Expand Down

0 comments on commit f06aaa3

Please sign in to comment.