Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CodeWalker.Core/GameFiles/Resources/Texture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ public int CalcDataSize()
len += slicePitch;
div *= 2;
}

return len * Depth;
}
public ushort CalculateStride()
Expand Down Expand Up @@ -1099,6 +1100,13 @@ public override void Read(ResourceDataReader reader, params object[] parameters)
int Levels = Convert.ToInt32(parameters[3]);
int Stride = Convert.ToInt32(parameters[4]);

bool compressed = DDSIO.DXTex.IsCompressed(DDSIO.GetDXGIFormat((TextureFormat)format));

if (compressed && Height % 4 != 0)
{
Height = Math.Max(4, (Height + 3) & ~3);
}

int fullLength = 0;
int length = Stride * Height;
for (int i = 0; i < Levels; i++)
Expand Down