@esotericsoftware/spine-core 4.3.9 → 4.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Skeleton.d.ts +1 -1
- package/dist/Skeleton.js +1 -1
- package/dist/SkeletonClipping.js +40 -23
- package/dist/SkeletonData.d.ts +1 -1
- package/dist/SkeletonData.js +1 -1
- package/dist/SkeletonRendererCore.js +15 -5
- package/dist/esm/spine-core.min.mjs +2 -2
- package/dist/esm/spine-core.mjs +52 -24
- package/dist/esm/spine-core.mjs.map +2 -2
- package/dist/iife/spine-core.js +52 -24
- package/dist/iife/spine-core.js.map +2 -2
- package/dist/iife/spine-core.min.js +2 -2
- package/package.json +1 -1
package/dist/iife/spine-core.js
CHANGED
|
@@ -11219,7 +11219,7 @@ ${error}` : ""}`);
|
|
|
11219
11219
|
t = triangles[i + 2];
|
|
11220
11220
|
const x3 = vertices[t * stride], y3 = vertices[t * stride + 1];
|
|
11221
11221
|
const u3 = uvs[t << 1], v3 = uvs[(t << 1) + 1];
|
|
11222
|
-
|
|
11222
|
+
let d0 = 0, d1 = 0, d2 = 0, d4 = 0, d = 0;
|
|
11223
11223
|
for (let p = 0; p < polygonsCount; p++) {
|
|
11224
11224
|
let s = clippedVertices.length;
|
|
11225
11225
|
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p])) {
|
|
@@ -11227,6 +11227,13 @@ ${error}` : ""}`);
|
|
|
11227
11227
|
const clipOutputLength = clipOutput.length;
|
|
11228
11228
|
if (clipOutputLength === 0) continue;
|
|
11229
11229
|
let clipOutputCount = clipOutputLength >> 1;
|
|
11230
|
+
if (d === 0) {
|
|
11231
|
+
d0 = y2 - y3;
|
|
11232
|
+
d1 = x3 - x2;
|
|
11233
|
+
d2 = x1 - x3;
|
|
11234
|
+
d4 = y3 - y1;
|
|
11235
|
+
d = 1 / (d0 * d2 - d1 * d4);
|
|
11236
|
+
}
|
|
11230
11237
|
const cv = Utils.setArraySize(clippedVertices, s + clipOutputCount * stride);
|
|
11231
11238
|
for (let ii = 0; ii < clipOutputLength; ii += 2, s += stride) {
|
|
11232
11239
|
const x = clipOutputItems[ii], y = clipOutputItems[ii + 1];
|
|
@@ -11426,7 +11433,7 @@ ${error}` : ""}`);
|
|
|
11426
11433
|
const x3 = vertices[vertexStart + v], y3 = vertices[vertexStart + v + 1];
|
|
11427
11434
|
uv = t << 1;
|
|
11428
11435
|
const u3 = uvs[uv], v3 = uvs[uv + 1];
|
|
11429
|
-
|
|
11436
|
+
let d0 = 0, d1 = 0, d2 = 0, d4 = 0, d = 0;
|
|
11430
11437
|
for (let p = 0; p < polygonsCount; p++) {
|
|
11431
11438
|
let s = this.clippedVerticesLength;
|
|
11432
11439
|
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p])) {
|
|
@@ -11434,6 +11441,13 @@ ${error}` : ""}`);
|
|
|
11434
11441
|
const clipOutputLength = clipOutput.length;
|
|
11435
11442
|
if (clipOutputLength === 0) continue;
|
|
11436
11443
|
let clipOutputCount = clipOutputLength >> 1;
|
|
11444
|
+
if (d === 0) {
|
|
11445
|
+
d0 = y2 - y3;
|
|
11446
|
+
d1 = x3 - x2;
|
|
11447
|
+
d2 = x1 - x3;
|
|
11448
|
+
d4 = y3 - y1;
|
|
11449
|
+
d = 1 / (d0 * d2 - d1 * d4);
|
|
11450
|
+
}
|
|
11437
11451
|
const newLength = s + clipOutputCount * stride;
|
|
11438
11452
|
if (clippedVertices.length < newLength) {
|
|
11439
11453
|
this._clippedVerticesTyped = new Float32Array(newLength * 2);
|
|
@@ -11550,16 +11564,15 @@ ${error}` : ""}`);
|
|
|
11550
11564
|
const edgeX = v[i], edgeY = v[i + 1], ex = edgeX - v[i + 2], ey = edgeY - v[i + 3];
|
|
11551
11565
|
const outputStart = output.length;
|
|
11552
11566
|
const iv2 = input;
|
|
11553
|
-
|
|
11554
|
-
|
|
11555
|
-
|
|
11556
|
-
|
|
11567
|
+
x1 = iv2[0];
|
|
11568
|
+
y1 = iv2[1];
|
|
11569
|
+
let s1 = ey * (edgeX - x1) - ex * (edgeY - y1);
|
|
11570
|
+
for (let ii = 2, nn = input.length - 2; ii <= nn; ii += 2) {
|
|
11557
11571
|
x2 = iv2[ii];
|
|
11558
11572
|
y2 = iv2[ii + 1];
|
|
11559
|
-
const s2 = ey * (edgeX - x2)
|
|
11560
|
-
const s1 = ey * (edgeX - x1) - ex * (edgeY - y1);
|
|
11573
|
+
const s2 = ey * (edgeX - x2) - ex * (edgeY - y2);
|
|
11561
11574
|
if (s1 > 0) {
|
|
11562
|
-
if (s2)
|
|
11575
|
+
if (s2 > 0)
|
|
11563
11576
|
output.push(x2, y2);
|
|
11564
11577
|
else {
|
|
11565
11578
|
const ix = x2 - x1, iy = y2 - y1, t = s1 / (ix * ey - iy * ex);
|
|
@@ -11569,7 +11582,7 @@ ${error}` : ""}`);
|
|
|
11569
11582
|
} else
|
|
11570
11583
|
output.push(x2, y2);
|
|
11571
11584
|
}
|
|
11572
|
-
} else if (s2) {
|
|
11585
|
+
} else if (s2 > 0) {
|
|
11573
11586
|
const ix = x2 - x1, iy = y2 - y1, t = s1 / (ix * ey - iy * ex);
|
|
11574
11587
|
if (t >= 0 && t <= 1) {
|
|
11575
11588
|
output.push(x1 + ix * t, y1 + iy * t, x2, y2);
|
|
@@ -11578,6 +11591,9 @@ ${error}` : ""}`);
|
|
|
11578
11591
|
output.push(x2, y2);
|
|
11579
11592
|
} else
|
|
11580
11593
|
clipped = true;
|
|
11594
|
+
x1 = x2;
|
|
11595
|
+
y1 = y2;
|
|
11596
|
+
s1 = s2;
|
|
11581
11597
|
}
|
|
11582
11598
|
if (outputStart === output.length) {
|
|
11583
11599
|
originalOutput.length = 0;
|
|
@@ -11625,16 +11641,15 @@ ${error}` : ""}`);
|
|
|
11625
11641
|
const outputStart = output.length, fragmentStart = this.inverseVertices.length;
|
|
11626
11642
|
this.inverseVertices.push(0);
|
|
11627
11643
|
iv = input;
|
|
11628
|
-
|
|
11629
|
-
|
|
11630
|
-
|
|
11631
|
-
|
|
11644
|
+
x1 = iv[0];
|
|
11645
|
+
y1 = iv[1];
|
|
11646
|
+
let s1 = ey * (edgeX - x1) - ex * (edgeY - y1);
|
|
11647
|
+
for (let ii = 2, nn = input.length - 2; ii <= nn; ii += 2) {
|
|
11632
11648
|
x2 = iv[ii];
|
|
11633
11649
|
y2 = iv[ii + 1];
|
|
11634
|
-
const s2 = ey * (edgeX - x2)
|
|
11635
|
-
const s1 = ey * (edgeX - x1) - ex * (edgeY - y1);
|
|
11650
|
+
const s2 = ey * (edgeX - x2) - ex * (edgeY - y2);
|
|
11636
11651
|
if (s1 > 0) {
|
|
11637
|
-
if (s2)
|
|
11652
|
+
if (s2 > 0)
|
|
11638
11653
|
output.push(x2, y2);
|
|
11639
11654
|
else {
|
|
11640
11655
|
const ix = x2 - x1, iy = y2 - y1, t = s1 / (ix * ey - iy * ex);
|
|
@@ -11645,16 +11660,19 @@ ${error}` : ""}`);
|
|
|
11645
11660
|
} else
|
|
11646
11661
|
output.push(x2, y2);
|
|
11647
11662
|
}
|
|
11648
|
-
} else if (s2) {
|
|
11649
|
-
const
|
|
11663
|
+
} else if (s2 > 0) {
|
|
11664
|
+
const ix = x2 - x1, iy = y2 - y1, t = s1 / (ix * ey - iy * ex);
|
|
11650
11665
|
if (t >= 0 && t <= 1) {
|
|
11651
|
-
const cx = x1 +
|
|
11666
|
+
const cx = x1 + ix * t, cy = y1 + iy * t;
|
|
11652
11667
|
this.inverseVertices.push(cx, cy);
|
|
11653
11668
|
output.push(cx, cy, x2, y2);
|
|
11654
11669
|
} else
|
|
11655
11670
|
output.push(x2, y2);
|
|
11656
11671
|
} else
|
|
11657
11672
|
this.inverseVertices.push(x2, y2);
|
|
11673
|
+
x1 = x2;
|
|
11674
|
+
y1 = y2;
|
|
11675
|
+
s1 = s2;
|
|
11658
11676
|
}
|
|
11659
11677
|
const fragmentSize = this.inverseVertices.length - fragmentStart - 1;
|
|
11660
11678
|
if (fragmentSize >= 6)
|
|
@@ -13021,17 +13039,21 @@ ${error}` : ""}`);
|
|
|
13021
13039
|
this.renderCommands.length = 0;
|
|
13022
13040
|
const clipper = this.clipping;
|
|
13023
13041
|
const drawOrder = skeleton.drawOrder.appliedPose;
|
|
13024
|
-
for (let i = 0; i <
|
|
13042
|
+
for (let i = 0, n = drawOrder.length; i < n; i++) {
|
|
13025
13043
|
const slot = drawOrder[i];
|
|
13026
|
-
|
|
13027
|
-
if (!attachment) {
|
|
13044
|
+
if (!slot.bone.active) {
|
|
13028
13045
|
clipper.clipEnd(slot);
|
|
13029
13046
|
continue;
|
|
13030
13047
|
}
|
|
13031
13048
|
const pose = slot.appliedPose;
|
|
13049
|
+
const attachment = pose.attachment;
|
|
13050
|
+
if (!attachment) {
|
|
13051
|
+
clipper.clipEnd(slot);
|
|
13052
|
+
continue;
|
|
13053
|
+
}
|
|
13032
13054
|
const slotColor = pose.color;
|
|
13033
13055
|
const alpha = slotColor.a;
|
|
13034
|
-
if (
|
|
13056
|
+
if (alpha === 0 && !(attachment instanceof ClippingAttachment)) {
|
|
13035
13057
|
clipper.clipEnd(slot);
|
|
13036
13058
|
continue;
|
|
13037
13059
|
}
|
|
@@ -13075,9 +13097,15 @@ ${error}` : ""}`);
|
|
|
13075
13097
|
indicesCount = indices.length;
|
|
13076
13098
|
texture = sequence.regions[sequenceIndex]?.texture;
|
|
13077
13099
|
} else if (attachment instanceof ClippingAttachment) {
|
|
13100
|
+
clipper.clipEnd(slot);
|
|
13078
13101
|
clipper.clipStart(skeleton, slot, attachment);
|
|
13079
13102
|
continue;
|
|
13080
13103
|
} else {
|
|
13104
|
+
clipper.clipEnd(slot);
|
|
13105
|
+
continue;
|
|
13106
|
+
}
|
|
13107
|
+
if (!texture) {
|
|
13108
|
+
clipper.clipEnd(slot);
|
|
13081
13109
|
continue;
|
|
13082
13110
|
}
|
|
13083
13111
|
const skelColor = skeleton.color;
|