Skip to content

Commit 37d23a2

Browse files
BlockBuilder57Thealexbarney
authored andcommitted
Add R8G8B8A8_UNORM textures for XB1 DE
1 parent c8cd166 commit 37d23a2

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

XbTool/XbTool/Common/Textures/Decode.cs

+4
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public static byte[] DecodeTexture(this ITexture texture)
5757
Swizzle.Deswizzle(texture, 4);
5858
decoded = Dxt.DecompressBc7(texture);
5959
break;
60+
case TextureFormat.R8G8B8A8_UNORM:
61+
Swizzle.Deswizzle(texture, 4, 1);
62+
decoded = texture.Data;
63+
break;
6064
}
6165

6266
return decoded;

XbTool/XbTool/Common/Textures/TextureFormat.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ public enum TextureFormat
77
BC3 = 0x44,
88
BC4 = 0x49,
99
BC7 = 0x4D,
10-
BC6H_UF16 = 0x50
10+
BC6H_UF16 = 0x50,
11+
R8G8B8A8_UNORM = 0x25
1112
}
1213
}

XbTool/XbTool/Xb2/Textures/Swizzle.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ namespace XbTool.Xb2.Textures
55
{
66
public static class Swizzle
77
{
8-
public static void Deswizzle(ITexture texture, int bppPower)
8+
public static void Deswizzle(ITexture texture, int bppPower, int swizzleSize = 4)
99
{
1010
int bpp = 1 << bppPower;
1111

1212
int len = texture.Data.Length;
1313
int originWidth = (texture.Width + 3) / 4;
14-
int originHeight = (texture.Height + 3) / 4;
14+
int originHeight = (texture.Height + 3) / swizzleSize;
1515

1616
int xb = CountZeros(Pow2RoundUp(originWidth));
1717
int yb = CountZeros(Pow2RoundUp(originHeight));

0 commit comments

Comments
 (0)