mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
[ts] Fix port of 899f7d7
This commit is contained in:
parent
1ef33f1d1a
commit
dc978ed05d
@ -30,6 +30,8 @@
|
|||||||
import { Utils, Color, Skeleton, RegionAttachment, TextureAtlasRegion, BlendMode, MeshAttachment, Slot } from "@esotericsoftware/spine-core";
|
import { Utils, Color, Skeleton, RegionAttachment, TextureAtlasRegion, BlendMode, MeshAttachment, Slot } from "@esotericsoftware/spine-core";
|
||||||
import { CanvasTexture } from "./CanvasTexture";
|
import { CanvasTexture } from "./CanvasTexture";
|
||||||
|
|
||||||
|
const worldVertices = Utils.newFloatArray(8);
|
||||||
|
|
||||||
export class SkeletonRenderer {
|
export class SkeletonRenderer {
|
||||||
static QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0];
|
static QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0];
|
||||||
static VERTEX_SIZE = 2 + 2 + 4;
|
static VERTEX_SIZE = 2 + 2 + 4;
|
||||||
@ -64,7 +66,8 @@ export class SkeletonRenderer {
|
|||||||
if (!bone.active) continue;
|
if (!bone.active) continue;
|
||||||
|
|
||||||
let attachment = slot.getAttachment();
|
let attachment = slot.getAttachment();
|
||||||
if (!(attachment instanceof RegionAttachment)) continue;
|
if (!(attachment instanceof RegionAttachment)) continue;
|
||||||
|
attachment.computeWorldVertices(slot, worldVertices, 0, 2);
|
||||||
let region: TextureAtlasRegion = <TextureAtlasRegion>attachment.region;
|
let region: TextureAtlasRegion = <TextureAtlasRegion>attachment.region;
|
||||||
let image: HTMLImageElement = (<CanvasTexture>region.page.texture).getImage() as HTMLImageElement;
|
let image: HTMLImageElement = (<CanvasTexture>region.page.texture).getImage() as HTMLImageElement;
|
||||||
|
|
||||||
|
|||||||
@ -93,7 +93,7 @@ export class RegionAttachment extends Attachment implements HasTextureRegion {
|
|||||||
if (region == null) {
|
if (region == null) {
|
||||||
uvs[0] = 0;
|
uvs[0] = 0;
|
||||||
uvs[1] = 0;
|
uvs[1] = 0;
|
||||||
uvs[2] = 1;
|
uvs[2] = 0;
|
||||||
uvs[3] = 1;
|
uvs[3] = 1;
|
||||||
uvs[4] = 1;
|
uvs[4] = 1;
|
||||||
uvs[5] = 1;
|
uvs[5] = 1;
|
||||||
@ -131,23 +131,23 @@ export class RegionAttachment extends Attachment implements HasTextureRegion {
|
|||||||
offset[7] = localYCos + localX2Sin;
|
offset[7] = localYCos + localX2Sin;
|
||||||
|
|
||||||
if (region.degrees == 90) {
|
if (region.degrees == 90) {
|
||||||
uvs[0] = region.u2;
|
|
||||||
uvs[1] = region.v;
|
|
||||||
uvs[2] = region.u2;
|
|
||||||
uvs[3] = region.v2;
|
|
||||||
uvs[4] = region.u;
|
|
||||||
uvs[5] = region.v2;
|
|
||||||
uvs[6] = region.u;
|
|
||||||
uvs[7] = region.v;
|
|
||||||
} else {
|
|
||||||
uvs[0] = region.u2;
|
|
||||||
uvs[1] = region.v2;
|
|
||||||
uvs[2] = region.u;
|
uvs[2] = region.u;
|
||||||
uvs[3] = region.v2;
|
uvs[3] = region.v2;
|
||||||
uvs[4] = region.u;
|
uvs[4] = region.u;
|
||||||
uvs[5] = region.v;
|
uvs[5] = region.v;
|
||||||
uvs[6] = region.u2;
|
uvs[6] = region.u2;
|
||||||
uvs[7] = region.v;
|
uvs[7] = region.v;
|
||||||
|
uvs[0] = region.u2;
|
||||||
|
uvs[1] = region.v2;
|
||||||
|
} else {
|
||||||
|
uvs[0] = region.u;
|
||||||
|
uvs[1] = region.v2;
|
||||||
|
uvs[2] = region.u;
|
||||||
|
uvs[3] = region.v;
|
||||||
|
uvs[4] = region.u2;
|
||||||
|
uvs[5] = region.v;
|
||||||
|
uvs[6] = region.u2;
|
||||||
|
uvs[7] = region.v2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user