mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
[libgdx] Still compute RegionAttachment offsets when the region is null.
This lets computeWorldVertices work even when there is no region, which can be useful.
This commit is contained in:
parent
30d4cb9820
commit
a012479fc4
@ -81,18 +81,6 @@ public class RegionAttachment extends Attachment implements HasTextureRegion {
|
||||
/** Calculates the {@link #offset} and {@link #uvs} using the region and the attachment's transform. Must be called if the
|
||||
* region, the region's properties, or the transform are changed. */
|
||||
public void updateRegion () {
|
||||
if (region == null) {
|
||||
uvs[BLX] = 0;
|
||||
uvs[BLY] = 0;
|
||||
uvs[ULX] = 0;
|
||||
uvs[ULY] = 1;
|
||||
uvs[URX] = 1;
|
||||
uvs[URY] = 1;
|
||||
uvs[BRX] = 1;
|
||||
uvs[BRY] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
float width = getWidth(), height = getHeight();
|
||||
float localX2 = width / 2;
|
||||
float localY2 = height / 2;
|
||||
@ -137,7 +125,16 @@ public class RegionAttachment extends Attachment implements HasTextureRegion {
|
||||
offset[BRY] = localYCos + localX2Sin;
|
||||
|
||||
float[] uvs = this.uvs;
|
||||
if (rotated) {
|
||||
if (region == null) {
|
||||
uvs[BLX] = 0;
|
||||
uvs[BLY] = 0;
|
||||
uvs[ULX] = 0;
|
||||
uvs[ULY] = 1;
|
||||
uvs[URX] = 1;
|
||||
uvs[URY] = 1;
|
||||
uvs[BRX] = 1;
|
||||
uvs[BRY] = 0;
|
||||
} else if (rotated) {
|
||||
uvs[BLX] = region.getU2();
|
||||
uvs[BLY] = region.getV();
|
||||
uvs[ULX] = region.getU2();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user