Skip to content

Commit

Permalink
Fix multi channel combined UVs
Browse files Browse the repository at this point in the history
  • Loading branch information
KillzXGaming committed Oct 17, 2024
1 parent 995e16f commit ff65ae6
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -876,25 +876,28 @@ private static VertexBuffer GenerateVertexBuffer(ResFile resFile, IOMesh mesh, S
binormal.Z, 1));
}

int currentIdx = 0;
for (int i = 0; i < vertex.UVs?.Count; i++)
{
if (i >= TexCoords.Length)
continue;

if (settings.CombineUVs && i % 2 == 0 && i < vertex.UVs.Count - 1)
{
TexCoords[i][v] = new Vector4F(
TexCoords[currentIdx][v] = new Vector4F(
vertex.UVs[i].X,
1 - vertex.UVs[i].Y,
vertex.UVs[i + 1].X,
1 - vertex.UVs[i + 1].Y);
currentIdx++;
}
else
{
TexCoords[i][v] = new Vector4F(
TexCoords[currentIdx][v] = new Vector4F(
vertex.UVs[i].X,
1 - vertex.UVs[i].Y,
0, 0);
currentIdx++;
}
}

Expand Down

0 comments on commit ff65ae6

Please sign in to comment.