mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
Support for rotated atlas regions.
This commit is contained in:
parent
6b60a311f4
commit
6cf7dcf413
@ -33,6 +33,7 @@ import com.esotericsoftware.spine.Skeleton;
|
||||
import com.esotericsoftware.spine.Slot;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.utils.FloatArray;
|
||||
import com.badlogic.gdx.utils.NumberUtils;
|
||||
@ -167,9 +168,16 @@ public class MeshAttachment extends Attachment {
|
||||
w = region.getU2() - u;
|
||||
h = region.getV2() - v;
|
||||
}
|
||||
for (int i = 0, ii = 3, n = vertices.length; i < n; i += 2, ii += 5) {
|
||||
worldVertices[ii] = u + uvs[i] * w;
|
||||
worldVertices[ii + 1] = v + uvs[i + 1] * h;
|
||||
if (region instanceof AtlasRegion && ((AtlasRegion)region).rotate) {
|
||||
for (int i = 0, ii = 3, n = vertices.length; i < n; i += 2, ii += 5) {
|
||||
worldVertices[ii] = u + uvs[i + 1] * w;
|
||||
worldVertices[ii + 1] = v + h - uvs[i] * h;
|
||||
}
|
||||
} else {
|
||||
for (int i = 0, ii = 3, n = vertices.length; i < n; i += 2, ii += 5) {
|
||||
worldVertices[ii] = u + uvs[i] * w;
|
||||
worldVertices[ii + 1] = v + uvs[i + 1] * h;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@ import com.esotericsoftware.spine.Skeleton;
|
||||
import com.esotericsoftware.spine.Slot;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.utils.FloatArray;
|
||||
import com.badlogic.gdx.utils.NumberUtils;
|
||||
@ -203,9 +204,16 @@ public class SkinnedMeshAttachment extends Attachment {
|
||||
w = region.getU2() - u;
|
||||
h = region.getV2() - v;
|
||||
}
|
||||
for (int i = 0, ii = 3; i < uvsLength; i += 2, ii += 5) {
|
||||
worldVertices[ii] = u + uvs[i] * w;
|
||||
worldVertices[ii + 1] = v + uvs[i + 1] * h;
|
||||
if (region instanceof AtlasRegion && ((AtlasRegion)region).rotate) {
|
||||
for (int i = 0, ii = 3; i < uvsLength; i += 2, ii += 5) {
|
||||
worldVertices[ii] = u + uvs[i + 1] * w;
|
||||
worldVertices[ii + 1] = v + h - uvs[i] * h;
|
||||
}
|
||||
} else {
|
||||
for (int i = 0, ii = 3; i < uvsLength; i += 2, ii += 5) {
|
||||
worldVertices[ii] = u + uvs[i] * w;
|
||||
worldVertices[ii + 1] = v + uvs[i + 1] * h;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user