pixijs / spine-v8

PixiJS v8 port of the official spine runtime
https://pixijs.io/spine-v8/examples/
MIT License
38 stars 6 forks source link

fix: uvs array might change if the region is updated and the uvs are more #35

Closed davidetan closed 3 months ago

davidetan commented 3 months ago

The cacheData structure might hold an old uvs array when a region is updated.

The PR just always reassigns the current uvs to the cache. The alternative would have been to check if the uvs length differs like this:

if (cacheData.uvs !== attachment.uvs)
{
    cacheData.uvs = attachment.uvs as Float32Array;
}

But the result would have been almost the same with an additional if check. In general uvs array changes very rarely, so in most of the case the if body would not have been executed. I don't see any performance improvement in keeping that if, so I just removed it and kept only the assignment.

This fixes a bug reported by a user on discord: https://discord.com/channels/734147990985375826/968068622327111681/1270951771564675134