@esotericsoftware/spine-webgl 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/iife/spine-webgl.js
CHANGED
|
@@ -11262,7 +11262,7 @@ ${error}` : ""}`);
|
|
|
11262
11262
|
t = triangles[i + 2];
|
|
11263
11263
|
const x3 = vertices[t * stride], y3 = vertices[t * stride + 1];
|
|
11264
11264
|
const u3 = uvs[t << 1], v3 = uvs[(t << 1) + 1];
|
|
11265
|
-
|
|
11265
|
+
let d0 = 0, d1 = 0, d2 = 0, d4 = 0, d = 0;
|
|
11266
11266
|
for (let p = 0; p < polygonsCount; p++) {
|
|
11267
11267
|
let s = clippedVertices.length;
|
|
11268
11268
|
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p])) {
|
|
@@ -11270,6 +11270,13 @@ ${error}` : ""}`);
|
|
|
11270
11270
|
const clipOutputLength = clipOutput.length;
|
|
11271
11271
|
if (clipOutputLength === 0) continue;
|
|
11272
11272
|
let clipOutputCount = clipOutputLength >> 1;
|
|
11273
|
+
if (d === 0) {
|
|
11274
|
+
d0 = y2 - y3;
|
|
11275
|
+
d1 = x3 - x2;
|
|
11276
|
+
d2 = x1 - x3;
|
|
11277
|
+
d4 = y3 - y1;
|
|
11278
|
+
d = 1 / (d0 * d2 - d1 * d4);
|
|
11279
|
+
}
|
|
11273
11280
|
const cv = Utils.setArraySize(clippedVertices, s + clipOutputCount * stride);
|
|
11274
11281
|
for (let ii = 0; ii < clipOutputLength; ii += 2, s += stride) {
|
|
11275
11282
|
const x = clipOutputItems[ii], y = clipOutputItems[ii + 1];
|
|
@@ -11469,7 +11476,7 @@ ${error}` : ""}`);
|
|
|
11469
11476
|
const x3 = vertices[vertexStart + v], y3 = vertices[vertexStart + v + 1];
|
|
11470
11477
|
uv = t << 1;
|
|
11471
11478
|
const u3 = uvs[uv], v3 = uvs[uv + 1];
|
|
11472
|
-
|
|
11479
|
+
let d0 = 0, d1 = 0, d2 = 0, d4 = 0, d = 0;
|
|
11473
11480
|
for (let p = 0; p < polygonsCount; p++) {
|
|
11474
11481
|
let s = this.clippedVerticesLength;
|
|
11475
11482
|
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p])) {
|
|
@@ -11477,6 +11484,13 @@ ${error}` : ""}`);
|
|
|
11477
11484
|
const clipOutputLength = clipOutput.length;
|
|
11478
11485
|
if (clipOutputLength === 0) continue;
|
|
11479
11486
|
let clipOutputCount = clipOutputLength >> 1;
|
|
11487
|
+
if (d === 0) {
|
|
11488
|
+
d0 = y2 - y3;
|
|
11489
|
+
d1 = x3 - x2;
|
|
11490
|
+
d2 = x1 - x3;
|
|
11491
|
+
d4 = y3 - y1;
|
|
11492
|
+
d = 1 / (d0 * d2 - d1 * d4);
|
|
11493
|
+
}
|
|
11480
11494
|
const newLength = s + clipOutputCount * stride;
|
|
11481
11495
|
if (clippedVertices.length < newLength) {
|
|
11482
11496
|
this._clippedVerticesTyped = new Float32Array(newLength * 2);
|
|
@@ -11593,16 +11607,15 @@ ${error}` : ""}`);
|
|
|
11593
11607
|
const edgeX = v[i], edgeY = v[i + 1], ex = edgeX - v[i + 2], ey = edgeY - v[i + 3];
|
|
11594
11608
|
const outputStart = output.length;
|
|
11595
11609
|
const iv2 = input;
|
|
11596
|
-
|
|
11597
|
-
|
|
11598
|
-
|
|
11599
|
-
|
|
11610
|
+
x1 = iv2[0];
|
|
11611
|
+
y1 = iv2[1];
|
|
11612
|
+
let s1 = ey * (edgeX - x1) - ex * (edgeY - y1);
|
|
11613
|
+
for (let ii = 2, nn = input.length - 2; ii <= nn; ii += 2) {
|
|
11600
11614
|
x2 = iv2[ii];
|
|
11601
11615
|
y2 = iv2[ii + 1];
|
|
11602
|
-
const s2 = ey * (edgeX - x2)
|
|
11603
|
-
const s1 = ey * (edgeX - x1) - ex * (edgeY - y1);
|
|
11616
|
+
const s2 = ey * (edgeX - x2) - ex * (edgeY - y2);
|
|
11604
11617
|
if (s1 > 0) {
|
|
11605
|
-
if (s2)
|
|
11618
|
+
if (s2 > 0)
|
|
11606
11619
|
output.push(x2, y2);
|
|
11607
11620
|
else {
|
|
11608
11621
|
const ix = x2 - x1, iy = y2 - y1, t = s1 / (ix * ey - iy * ex);
|
|
@@ -11612,7 +11625,7 @@ ${error}` : ""}`);
|
|
|
11612
11625
|
} else
|
|
11613
11626
|
output.push(x2, y2);
|
|
11614
11627
|
}
|
|
11615
|
-
} else if (s2) {
|
|
11628
|
+
} else if (s2 > 0) {
|
|
11616
11629
|
const ix = x2 - x1, iy = y2 - y1, t = s1 / (ix * ey - iy * ex);
|
|
11617
11630
|
if (t >= 0 && t <= 1) {
|
|
11618
11631
|
output.push(x1 + ix * t, y1 + iy * t, x2, y2);
|
|
@@ -11621,6 +11634,9 @@ ${error}` : ""}`);
|
|
|
11621
11634
|
output.push(x2, y2);
|
|
11622
11635
|
} else
|
|
11623
11636
|
clipped = true;
|
|
11637
|
+
x1 = x2;
|
|
11638
|
+
y1 = y2;
|
|
11639
|
+
s1 = s2;
|
|
11624
11640
|
}
|
|
11625
11641
|
if (outputStart === output.length) {
|
|
11626
11642
|
originalOutput.length = 0;
|
|
@@ -11668,16 +11684,15 @@ ${error}` : ""}`);
|
|
|
11668
11684
|
const outputStart = output.length, fragmentStart = this.inverseVertices.length;
|
|
11669
11685
|
this.inverseVertices.push(0);
|
|
11670
11686
|
iv = input;
|
|
11671
|
-
|
|
11672
|
-
|
|
11673
|
-
|
|
11674
|
-
|
|
11687
|
+
x1 = iv[0];
|
|
11688
|
+
y1 = iv[1];
|
|
11689
|
+
let s1 = ey * (edgeX - x1) - ex * (edgeY - y1);
|
|
11690
|
+
for (let ii = 2, nn = input.length - 2; ii <= nn; ii += 2) {
|
|
11675
11691
|
x2 = iv[ii];
|
|
11676
11692
|
y2 = iv[ii + 1];
|
|
11677
|
-
const s2 = ey * (edgeX - x2)
|
|
11678
|
-
const s1 = ey * (edgeX - x1) - ex * (edgeY - y1);
|
|
11693
|
+
const s2 = ey * (edgeX - x2) - ex * (edgeY - y2);
|
|
11679
11694
|
if (s1 > 0) {
|
|
11680
|
-
if (s2)
|
|
11695
|
+
if (s2 > 0)
|
|
11681
11696
|
output.push(x2, y2);
|
|
11682
11697
|
else {
|
|
11683
11698
|
const ix = x2 - x1, iy = y2 - y1, t = s1 / (ix * ey - iy * ex);
|
|
@@ -11688,16 +11703,19 @@ ${error}` : ""}`);
|
|
|
11688
11703
|
} else
|
|
11689
11704
|
output.push(x2, y2);
|
|
11690
11705
|
}
|
|
11691
|
-
} else if (s2) {
|
|
11692
|
-
const
|
|
11706
|
+
} else if (s2 > 0) {
|
|
11707
|
+
const ix = x2 - x1, iy = y2 - y1, t = s1 / (ix * ey - iy * ex);
|
|
11693
11708
|
if (t >= 0 && t <= 1) {
|
|
11694
|
-
const cx = x1 +
|
|
11709
|
+
const cx = x1 + ix * t, cy = y1 + iy * t;
|
|
11695
11710
|
this.inverseVertices.push(cx, cy);
|
|
11696
11711
|
output.push(cx, cy, x2, y2);
|
|
11697
11712
|
} else
|
|
11698
11713
|
output.push(x2, y2);
|
|
11699
11714
|
} else
|
|
11700
11715
|
this.inverseVertices.push(x2, y2);
|
|
11716
|
+
x1 = x2;
|
|
11717
|
+
y1 = y2;
|
|
11718
|
+
s1 = s2;
|
|
11701
11719
|
}
|
|
11702
11720
|
const fragmentSize = this.inverseVertices.length - fragmentStart - 1;
|
|
11703
11721
|
if (fragmentSize >= 6)
|
|
@@ -13064,17 +13082,21 @@ ${error}` : ""}`);
|
|
|
13064
13082
|
this.renderCommands.length = 0;
|
|
13065
13083
|
const clipper = this.clipping;
|
|
13066
13084
|
const drawOrder = skeleton.drawOrder.appliedPose;
|
|
13067
|
-
for (let i = 0; i <
|
|
13085
|
+
for (let i = 0, n = drawOrder.length; i < n; i++) {
|
|
13068
13086
|
const slot = drawOrder[i];
|
|
13069
|
-
|
|
13070
|
-
if (!attachment) {
|
|
13087
|
+
if (!slot.bone.active) {
|
|
13071
13088
|
clipper.clipEnd(slot);
|
|
13072
13089
|
continue;
|
|
13073
13090
|
}
|
|
13074
13091
|
const pose = slot.appliedPose;
|
|
13092
|
+
const attachment = pose.attachment;
|
|
13093
|
+
if (!attachment) {
|
|
13094
|
+
clipper.clipEnd(slot);
|
|
13095
|
+
continue;
|
|
13096
|
+
}
|
|
13075
13097
|
const slotColor = pose.color;
|
|
13076
13098
|
const alpha = slotColor.a;
|
|
13077
|
-
if (
|
|
13099
|
+
if (alpha === 0 && !(attachment instanceof ClippingAttachment)) {
|
|
13078
13100
|
clipper.clipEnd(slot);
|
|
13079
13101
|
continue;
|
|
13080
13102
|
}
|
|
@@ -13118,9 +13140,15 @@ ${error}` : ""}`);
|
|
|
13118
13140
|
indicesCount = indices.length;
|
|
13119
13141
|
texture = sequence.regions[sequenceIndex]?.texture;
|
|
13120
13142
|
} else if (attachment instanceof ClippingAttachment) {
|
|
13143
|
+
clipper.clipEnd(slot);
|
|
13121
13144
|
clipper.clipStart(skeleton, slot, attachment);
|
|
13122
13145
|
continue;
|
|
13123
13146
|
} else {
|
|
13147
|
+
clipper.clipEnd(slot);
|
|
13148
|
+
continue;
|
|
13149
|
+
}
|
|
13150
|
+
if (!texture) {
|
|
13151
|
+
clipper.clipEnd(slot);
|
|
13124
13152
|
continue;
|
|
13125
13153
|
}
|
|
13126
13154
|
const skelColor = skeleton.color;
|