diff --git a/Source/AssetRipper.AssemblyDumper/Passes/Pass039_InjectEnumValues.cs b/Source/AssetRipper.AssemblyDumper/Passes/Pass039_InjectEnumValues.cs index bb2066e54..4531ec674 100644 --- a/Source/AssetRipper.AssemblyDumper/Passes/Pass039_InjectEnumValues.cs +++ b/Source/AssetRipper.AssemblyDumper/Passes/Pass039_InjectEnumValues.cs @@ -25,11 +25,15 @@ internal static class Pass039_InjectEnumValues { "UnityEngine.TextureFormat", new() { + ("ARGBFloat", 6, ""), + ("BGR24", 8, ""), ("DXT3", 11, ""), } }, { "UnityEditor.TextureImporterFormat", new() { + ("ARGBFloat", 6, ""), + ("BGR24", 8, ""), ("DXT3", 11, ""), } }, { "UnityEngine.MeshTopology", diff --git a/Source/AssetRipper.Export.Modules.Textures/AssetRipper.Export.Modules.Textures.csproj b/Source/AssetRipper.Export.Modules.Textures/AssetRipper.Export.Modules.Textures.csproj index 359ffd932..53a025fff 100644 --- a/Source/AssetRipper.Export.Modules.Textures/AssetRipper.Export.Modules.Textures.csproj +++ b/Source/AssetRipper.Export.Modules.Textures/AssetRipper.Export.Modules.Textures.csproj @@ -13,7 +13,7 @@ - + diff --git a/Source/AssetRipper.Export.Modules.Textures/DirectBitmap`1.cs b/Source/AssetRipper.Export.Modules.Textures/DirectBitmap`1.cs index 61e671150..a4b955c67 100644 --- a/Source/AssetRipper.Export.Modules.Textures/DirectBitmap`1.cs +++ b/Source/AssetRipper.Export.Modules.Textures/DirectBitmap`1.cs @@ -130,13 +130,13 @@ public sealed class DirectBitmap : DirectBitmap { if (UseFastBmp) { - if (typeof(TColor) == typeof(ColorBGRA32)) + if (typeof(TColor) == typeof(ColorBGRA)) { BmpWriter.WriteBmp(Data, Width, Height * Depth, stream); } else { - RgbConverter.Convert(Bits, Width, Height * Depth, out byte[] data); + RgbConverter.Convert, byte>(Bits, Width, Height * Depth, out byte[] data); BmpWriter.WriteBmp(data, Width, Height * Depth, stream); } } diff --git a/Source/AssetRipper.Export.Modules.Textures/TextureConverter.cs b/Source/AssetRipper.Export.Modules.Textures/TextureConverter.cs index 4951dfe35..1a27ea7fb 100644 --- a/Source/AssetRipper.Export.Modules.Textures/TextureConverter.cs +++ b/Source/AssetRipper.Export.Modules.Textures/TextureConverter.cs @@ -199,11 +199,13 @@ public static class TextureConverter TextureFormat.ARGB4444 => TryConvertToBitmap(textureFormat, width, height, depth, imageSize, version, data, out bitmap), TextureFormat.RGB24 => TryConvertToBitmap, byte>(textureFormat, width, height, depth, imageSize, version, data, out bitmap), TextureFormat.RGBA32 => TryConvertToBitmap, byte>(textureFormat, width, height, depth, imageSize, version, data, out bitmap), - TextureFormat.ARGB32 => TryConvertToBitmap(textureFormat, width, height, depth, imageSize, version, data, out bitmap), + TextureFormat.ARGB32 => TryConvertToBitmap, byte>(textureFormat, width, height, depth, imageSize, version, data, out bitmap), + TextureFormat.ARGBFloat => TryConvertToBitmap, float>(textureFormat, width, height, depth, imageSize, version, data, out bitmap), TextureFormat.RGB565 => TryConvertToBitmap(textureFormat, width, height, depth, imageSize, version, data, out bitmap), + TextureFormat.BGR24 => TryConvertToBitmap, byte>(textureFormat, width, height, depth, imageSize, version, data, out bitmap), TextureFormat.R16 => TryConvertToBitmap, ushort>(textureFormat, width, height, depth, imageSize, version, data, out bitmap), TextureFormat.RGBA4444 => TryConvertToBitmap(textureFormat, width, height, depth, imageSize, version, data, out bitmap), - TextureFormat.BGRA32_14 or TextureFormat.BGRA32_37 => TryConvertToBitmap(textureFormat, width, height, depth, imageSize, version, data, out bitmap), + TextureFormat.BGRA32_14 or TextureFormat.BGRA32_37 => TryConvertToBitmap, byte>(textureFormat, width, height, depth, imageSize, version, data, out bitmap), TextureFormat.RHalf => TryConvertToBitmap, Half>(textureFormat, width, height, depth, imageSize, version, data, out bitmap), TextureFormat.RGHalf => TryConvertToBitmap, Half>(textureFormat, width, height, depth, imageSize, version, data, out bitmap), TextureFormat.RGBAHalf => TryConvertToBitmap, Half>(textureFormat, width, height, depth, imageSize, version, data, out bitmap), @@ -442,11 +444,17 @@ public static class TextureConverter return RgbConverter.Convert, byte, TColor, TChannelValue>(inputSpan, width, height, outputSpan); case TextureFormat.ARGB32: - return RgbConverter.Convert(inputSpan, width, height, outputSpan); + return RgbConverter.Convert, byte, TColor, TChannelValue>(inputSpan, width, height, outputSpan); + + case TextureFormat.ARGBFloat: + return RgbConverter.Convert, float, TColor, TChannelValue>(inputSpan, width, height, outputSpan); + + case TextureFormat.BGR24: + return RgbConverter.Convert, byte, TColor, TChannelValue>(inputSpan, width, height, outputSpan); case TextureFormat.BGRA32_14: case TextureFormat.BGRA32_37: - return RgbConverter.Convert(inputSpan, width, height, outputSpan); + return RgbConverter.Convert, byte, TColor, TChannelValue>(inputSpan, width, height, outputSpan); case TextureFormat.R16: return RgbConverter.Convert, ushort, TColor, TChannelValue>(inputSpan, width, height, outputSpan); diff --git a/Source/AssetRipper.SourceGenerated.Extensions/SwitchSwizzle.cs b/Source/AssetRipper.SourceGenerated.Extensions/SwitchSwizzle.cs index d3faf6e0f..b610c3100 100644 --- a/Source/AssetRipper.SourceGenerated.Extensions/SwitchSwizzle.cs +++ b/Source/AssetRipper.SourceGenerated.Extensions/SwitchSwizzle.cs @@ -173,6 +173,7 @@ public static class SwitchSwizzle TextureFormat.RFloat => new Size(4, 1), TextureFormat.RGFloat => new Size(2, 1), TextureFormat.RGBAFloat => new Size(1, 1), + TextureFormat.ARGBFloat => new Size(1, 1), _ => null, }; @@ -194,6 +195,7 @@ public static class SwitchSwizzle TextureFormat.RGB48 => TextureFormat.RGBA64, TextureFormat.RGB24_SIGNED => TextureFormat.RGBA32_SIGNED, TextureFormat.RGB48_SIGNED => TextureFormat.RGBA64_SIGNED, + TextureFormat.BGR24 => TextureFormat.BGRA32_14, _ => format }; }