[unity] Fixed GetRepackedSkin issue with polygon packing and 270 degree rotation and atlas is non-square. Closes #2445.

This commit is contained in:
Harald Csaszar 2024-01-10 17:06:34 +01:00
parent 43d2564b0a
commit b3aa3e0c48
2 changed files with 7 additions and 6 deletions

View File

@ -740,11 +740,12 @@ namespace Spine.Unity.AttachmentTools {
float v2 = uvRect.yMin; float v2 = uvRect.yMin;
if (referenceRegion.degrees == 270) { if (referenceRegion.degrees == 270) {
// at a 270 degree region, u2/v2 deltas are swapped, and delta-v is negative. // at a 270 degree region, u2/v2 deltas and atlas width/height are swapped, and delta-v is negative.
float du = u2 - u; float du = uvRect.width; // u2 - u;
float dv = v - v2; float dv = uvRect.height; // v - v2;
u2 = u + dv; float atlasAspectRatio = page.width / page.height;
v2 = v - du; u2 = u + (dv / atlasAspectRatio);
v2 = v - (du * atlasAspectRatio);
} }
return new AtlasRegion { return new AtlasRegion {

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.spine-unity", "name": "com.esotericsoftware.spine.spine-unity",
"displayName": "spine-unity Runtime", "displayName": "spine-unity Runtime",
"description": "This plugin provides the spine-unity runtime core.", "description": "This plugin provides the spine-unity runtime core.",
"version": "4.1.33", "version": "4.1.34",
"unity": "2018.3", "unity": "2018.3",
"author": { "author": {
"name": "Esoteric Software", "name": "Esoteric Software",