@esotericsoftware/spine-webgl 4.2.1 → 4.2.4
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/AssetManager.js +3 -3
- package/dist/GLTexture.js +1 -1
- package/dist/Input.d.ts +2 -2
- package/dist/Input.js +3 -1
- package/dist/LoadingScreen.js +6 -4
- package/dist/Matrix4.d.ts +0 -1
- package/dist/Matrix4.js +4 -13
- package/dist/Mesh.js +3 -1
- package/dist/PolygonBatcher.d.ts +1 -0
- package/dist/PolygonBatcher.js +12 -1
- package/dist/SceneRenderer.js +19 -18
- package/dist/Shader.d.ts +2 -2
- package/dist/Shader.js +13 -1
- package/dist/ShapeRenderer.js +27 -24
- package/dist/SkeletonDebugRenderer.js +2 -2
- package/dist/SkeletonRenderer.d.ts +1 -2
- package/dist/SkeletonRenderer.js +25 -119
- package/dist/SpineCanvas.js +14 -9
- package/dist/WebGL.d.ts +1 -2
- package/dist/WebGL.js +15 -16
- package/dist/iife/spine-webgl.js +521 -458
- package/dist/iife/spine-webgl.js.map +3 -3
- package/dist/iife/spine-webgl.min.js +26 -26
- package/package.json +2 -2
package/dist/iife/spine-webgl.js
CHANGED
|
@@ -56,7 +56,6 @@ var spine = (() => {
|
|
|
56
56
|
Input: () => Input,
|
|
57
57
|
IntSet: () => IntSet,
|
|
58
58
|
Interpolation: () => Interpolation,
|
|
59
|
-
JitterEffect: () => JitterEffect,
|
|
60
59
|
LoadingScreen: () => LoadingScreen,
|
|
61
60
|
M00: () => M00,
|
|
62
61
|
M01: () => M01,
|
|
@@ -132,7 +131,6 @@ var spine = (() => {
|
|
|
132
131
|
SpacingMode: () => SpacingMode,
|
|
133
132
|
SpineCanvas: () => SpineCanvas,
|
|
134
133
|
StringSet: () => StringSet,
|
|
135
|
-
SwirlEffect: () => SwirlEffect,
|
|
136
134
|
TexCoordAttribute: () => TexCoordAttribute,
|
|
137
135
|
Texture: () => Texture,
|
|
138
136
|
TextureAtlas: () => TextureAtlas,
|
|
@@ -555,9 +553,9 @@ var spine = (() => {
|
|
|
555
553
|
super(name);
|
|
556
554
|
this.id = _VertexAttachment.nextID++;
|
|
557
555
|
this.bones = null;
|
|
558
|
-
this.vertices =
|
|
556
|
+
this.vertices = [];
|
|
559
557
|
this.worldVerticesLength = 0;
|
|
560
|
-
this.
|
|
558
|
+
this.timelineAttachment = this;
|
|
561
559
|
}
|
|
562
560
|
computeWorldVertices(slot, start, count, worldVertices, offset, stride) {
|
|
563
561
|
count = offset + (count >> 1) * stride;
|
|
@@ -626,10 +624,9 @@ var spine = (() => {
|
|
|
626
624
|
if (this.vertices) {
|
|
627
625
|
attachment.vertices = Utils.newFloatArray(this.vertices.length);
|
|
628
626
|
Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);
|
|
629
|
-
}
|
|
630
|
-
attachment.vertices = null;
|
|
627
|
+
}
|
|
631
628
|
attachment.worldVerticesLength = this.worldVerticesLength;
|
|
632
|
-
attachment.
|
|
629
|
+
attachment.timelineAttachment = this.timelineAttachment;
|
|
633
630
|
}
|
|
634
631
|
};
|
|
635
632
|
var VertexAttachment = _VertexAttachment;
|
|
@@ -701,8 +698,8 @@ var spine = (() => {
|
|
|
701
698
|
// spine-core/src/Animation.ts
|
|
702
699
|
var Animation = class {
|
|
703
700
|
constructor(name, timelines, duration) {
|
|
704
|
-
this.timelines =
|
|
705
|
-
this.timelineIds =
|
|
701
|
+
this.timelines = [];
|
|
702
|
+
this.timelineIds = new StringSet();
|
|
706
703
|
if (!name)
|
|
707
704
|
throw new Error("name cannot be null.");
|
|
708
705
|
this.name = name;
|
|
@@ -713,7 +710,7 @@ var spine = (() => {
|
|
|
713
710
|
if (!timelines)
|
|
714
711
|
throw new Error("timelines cannot be null.");
|
|
715
712
|
this.timelines = timelines;
|
|
716
|
-
this.timelineIds
|
|
713
|
+
this.timelineIds.clear();
|
|
717
714
|
for (var i = 0; i < timelines.length; i++)
|
|
718
715
|
this.timelineIds.addAll(timelines[i].getPropertyIds());
|
|
719
716
|
}
|
|
@@ -772,8 +769,6 @@ var spine = (() => {
|
|
|
772
769
|
};
|
|
773
770
|
var Timeline = class {
|
|
774
771
|
constructor(frameCount, propertyIds) {
|
|
775
|
-
this.propertyIds = null;
|
|
776
|
-
this.frames = null;
|
|
777
772
|
this.propertyIds = propertyIds;
|
|
778
773
|
this.frames = Utils.newFloatArray(frameCount * this.getFrameEntries());
|
|
779
774
|
}
|
|
@@ -807,7 +802,6 @@ var spine = (() => {
|
|
|
807
802
|
var CurveTimeline = class extends Timeline {
|
|
808
803
|
constructor(frameCount, bezierCount, propertyIds) {
|
|
809
804
|
super(frameCount, propertyIds);
|
|
810
|
-
this.curves = null;
|
|
811
805
|
this.curves = Utils.newFloatArray(frameCount + bezierCount * 18);
|
|
812
806
|
this.curves[frameCount - 1] = 1;
|
|
813
807
|
}
|
|
@@ -1867,8 +1861,6 @@ var spine = (() => {
|
|
|
1867
1861
|
Property.deform + "|" + slotIndex + "|" + attachment.id
|
|
1868
1862
|
]);
|
|
1869
1863
|
this.slotIndex = 0;
|
|
1870
|
-
this.attachment = null;
|
|
1871
|
-
this.vertices = null;
|
|
1872
1864
|
this.slotIndex = slotIndex;
|
|
1873
1865
|
this.attachment = attachment;
|
|
1874
1866
|
this.vertices = new Array(frameCount);
|
|
@@ -1931,7 +1923,9 @@ var spine = (() => {
|
|
|
1931
1923
|
if (!slot.bone.active)
|
|
1932
1924
|
return;
|
|
1933
1925
|
let slotAttachment = slot.getAttachment();
|
|
1934
|
-
if (!
|
|
1926
|
+
if (!slotAttachment)
|
|
1927
|
+
return;
|
|
1928
|
+
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != this.attachment)
|
|
1935
1929
|
return;
|
|
1936
1930
|
let deform = slot.deform;
|
|
1937
1931
|
if (deform.length == 0)
|
|
@@ -2085,7 +2079,6 @@ var spine = (() => {
|
|
|
2085
2079
|
var _EventTimeline = class extends Timeline {
|
|
2086
2080
|
constructor(frameCount) {
|
|
2087
2081
|
super(frameCount, _EventTimeline.propertyIds);
|
|
2088
|
-
this.events = null;
|
|
2089
2082
|
this.events = new Array(frameCount);
|
|
2090
2083
|
}
|
|
2091
2084
|
getFrameCount() {
|
|
@@ -2128,7 +2121,6 @@ var spine = (() => {
|
|
|
2128
2121
|
var _DrawOrderTimeline = class extends Timeline {
|
|
2129
2122
|
constructor(frameCount) {
|
|
2130
2123
|
super(frameCount, _DrawOrderTimeline.propertyIds);
|
|
2131
|
-
this.drawOrders = null;
|
|
2132
2124
|
this.drawOrders = new Array(frameCount);
|
|
2133
2125
|
}
|
|
2134
2126
|
getFrameCount() {
|
|
@@ -2149,7 +2141,8 @@ var spine = (() => {
|
|
|
2149
2141
|
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2150
2142
|
return;
|
|
2151
2143
|
}
|
|
2152
|
-
let
|
|
2144
|
+
let idx = Timeline.search1(this.frames, time);
|
|
2145
|
+
let drawOrderToSetupIndex = this.drawOrders[idx];
|
|
2153
2146
|
if (!drawOrderToSetupIndex)
|
|
2154
2147
|
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2155
2148
|
else {
|
|
@@ -2511,7 +2504,7 @@ var spine = (() => {
|
|
|
2511
2504
|
let slotAttachment = slot.attachment;
|
|
2512
2505
|
let attachment = this.attachment;
|
|
2513
2506
|
if (slotAttachment != attachment) {
|
|
2514
|
-
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.
|
|
2507
|
+
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != attachment)
|
|
2515
2508
|
return;
|
|
2516
2509
|
}
|
|
2517
2510
|
let frames = this.frames;
|
|
@@ -2524,6 +2517,8 @@ var spine = (() => {
|
|
|
2524
2517
|
let before = frames[i];
|
|
2525
2518
|
let modeAndIndex = frames[i + _SequenceTimeline.MODE];
|
|
2526
2519
|
let delay = frames[i + _SequenceTimeline.DELAY];
|
|
2520
|
+
if (!this.attachment.sequence)
|
|
2521
|
+
return;
|
|
2527
2522
|
let index = modeAndIndex >> 4, count = this.attachment.sequence.regions.length;
|
|
2528
2523
|
let mode = SequenceModeValues[modeAndIndex & 15];
|
|
2529
2524
|
if (mode != SequenceMode.hold) {
|
|
@@ -2537,7 +2532,7 @@ var spine = (() => {
|
|
|
2537
2532
|
break;
|
|
2538
2533
|
case SequenceMode.pingpong: {
|
|
2539
2534
|
let n = (count << 1) - 2;
|
|
2540
|
-
index
|
|
2535
|
+
index = n == 0 ? 0 : index % n;
|
|
2541
2536
|
if (index >= count)
|
|
2542
2537
|
index = n - index;
|
|
2543
2538
|
break;
|
|
@@ -2550,7 +2545,7 @@ var spine = (() => {
|
|
|
2550
2545
|
break;
|
|
2551
2546
|
case SequenceMode.pingpongReverse: {
|
|
2552
2547
|
let n = (count << 1) - 2;
|
|
2553
|
-
index = (index + count - 1) % n;
|
|
2548
|
+
index = n == 0 ? 0 : (index + count - 1) % n;
|
|
2554
2549
|
if (index >= count)
|
|
2555
2550
|
index = n - index;
|
|
2556
2551
|
}
|
|
@@ -2565,9 +2560,8 @@ var spine = (() => {
|
|
|
2565
2560
|
SequenceTimeline.DELAY = 2;
|
|
2566
2561
|
|
|
2567
2562
|
// spine-core/src/AnimationState.ts
|
|
2568
|
-
var
|
|
2563
|
+
var _AnimationState = class {
|
|
2569
2564
|
constructor(data) {
|
|
2570
|
-
this.data = null;
|
|
2571
2565
|
this.tracks = new Array();
|
|
2572
2566
|
this.timeScale = 1;
|
|
2573
2567
|
this.unkeyedState = 0;
|
|
@@ -2580,9 +2574,7 @@ var spine = (() => {
|
|
|
2580
2574
|
this.data = data;
|
|
2581
2575
|
}
|
|
2582
2576
|
static emptyAnimation() {
|
|
2583
|
-
|
|
2584
|
-
_emptyAnimation = new Animation("<empty>", [], 0);
|
|
2585
|
-
return _emptyAnimation;
|
|
2577
|
+
return _AnimationState._emptyAnimation;
|
|
2586
2578
|
}
|
|
2587
2579
|
update(delta) {
|
|
2588
2580
|
delta *= this.timeScale;
|
|
@@ -3015,13 +3007,13 @@ var spine = (() => {
|
|
|
3015
3007
|
return entry;
|
|
3016
3008
|
}
|
|
3017
3009
|
setEmptyAnimation(trackIndex, mixDuration = 0) {
|
|
3018
|
-
let entry = this.setAnimationWith(trackIndex,
|
|
3010
|
+
let entry = this.setAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false);
|
|
3019
3011
|
entry.mixDuration = mixDuration;
|
|
3020
3012
|
entry.trackEnd = mixDuration;
|
|
3021
3013
|
return entry;
|
|
3022
3014
|
}
|
|
3023
3015
|
addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
|
|
3024
|
-
let entry = this.addAnimationWith(trackIndex,
|
|
3016
|
+
let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
|
|
3025
3017
|
if (delay <= 0)
|
|
3026
3018
|
entry.delay += entry.mixDuration - mixDuration;
|
|
3027
3019
|
entry.mixDuration = mixDuration;
|
|
@@ -3160,6 +3152,8 @@ var spine = (() => {
|
|
|
3160
3152
|
this.queue.clear();
|
|
3161
3153
|
}
|
|
3162
3154
|
};
|
|
3155
|
+
var AnimationState = _AnimationState;
|
|
3156
|
+
AnimationState._emptyAnimation = new Animation("<empty>", [], 0);
|
|
3163
3157
|
var TrackEntry = class {
|
|
3164
3158
|
constructor() {
|
|
3165
3159
|
this.animation = null;
|
|
@@ -3241,7 +3235,6 @@ var spine = (() => {
|
|
|
3241
3235
|
constructor(animState) {
|
|
3242
3236
|
this.objects = [];
|
|
3243
3237
|
this.drainDisabled = false;
|
|
3244
|
-
this.animState = null;
|
|
3245
3238
|
this.animState = animState;
|
|
3246
3239
|
}
|
|
3247
3240
|
start(entry) {
|
|
@@ -3284,45 +3277,57 @@ var spine = (() => {
|
|
|
3284
3277
|
case EventType.start:
|
|
3285
3278
|
if (entry.listener && entry.listener.start)
|
|
3286
3279
|
entry.listener.start(entry);
|
|
3287
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3288
|
-
|
|
3289
|
-
|
|
3280
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3281
|
+
let listener = listeners[ii];
|
|
3282
|
+
if (listener.start)
|
|
3283
|
+
listener.start(entry);
|
|
3284
|
+
}
|
|
3290
3285
|
break;
|
|
3291
3286
|
case EventType.interrupt:
|
|
3292
3287
|
if (entry.listener && entry.listener.interrupt)
|
|
3293
3288
|
entry.listener.interrupt(entry);
|
|
3294
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3295
|
-
|
|
3296
|
-
|
|
3289
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3290
|
+
let listener = listeners[ii];
|
|
3291
|
+
if (listener.interrupt)
|
|
3292
|
+
listener.interrupt(entry);
|
|
3293
|
+
}
|
|
3297
3294
|
break;
|
|
3298
3295
|
case EventType.end:
|
|
3299
3296
|
if (entry.listener && entry.listener.end)
|
|
3300
3297
|
entry.listener.end(entry);
|
|
3301
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3302
|
-
|
|
3303
|
-
|
|
3298
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3299
|
+
let listener = listeners[ii];
|
|
3300
|
+
if (listener.end)
|
|
3301
|
+
listener.end(entry);
|
|
3302
|
+
}
|
|
3304
3303
|
case EventType.dispose:
|
|
3305
3304
|
if (entry.listener && entry.listener.dispose)
|
|
3306
3305
|
entry.listener.dispose(entry);
|
|
3307
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3308
|
-
|
|
3309
|
-
|
|
3306
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3307
|
+
let listener = listeners[ii];
|
|
3308
|
+
if (listener.dispose)
|
|
3309
|
+
listener.dispose(entry);
|
|
3310
|
+
}
|
|
3310
3311
|
this.animState.trackEntryPool.free(entry);
|
|
3311
3312
|
break;
|
|
3312
3313
|
case EventType.complete:
|
|
3313
3314
|
if (entry.listener && entry.listener.complete)
|
|
3314
3315
|
entry.listener.complete(entry);
|
|
3315
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3316
|
-
|
|
3317
|
-
|
|
3316
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3317
|
+
let listener = listeners[ii];
|
|
3318
|
+
if (listener.complete)
|
|
3319
|
+
listener.complete(entry);
|
|
3320
|
+
}
|
|
3318
3321
|
break;
|
|
3319
3322
|
case EventType.event:
|
|
3320
3323
|
let event = objects[i++ + 2];
|
|
3321
3324
|
if (entry.listener && entry.listener.event)
|
|
3322
3325
|
entry.listener.event(entry, event);
|
|
3323
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3327
|
+
let listener = listeners[ii];
|
|
3328
|
+
if (listener.event)
|
|
3329
|
+
listener.event(entry, event);
|
|
3330
|
+
}
|
|
3326
3331
|
break;
|
|
3327
3332
|
}
|
|
3328
3333
|
}
|
|
@@ -3363,12 +3368,10 @@ var spine = (() => {
|
|
|
3363
3368
|
var HOLD_MIX = 4;
|
|
3364
3369
|
var SETUP = 1;
|
|
3365
3370
|
var CURRENT = 2;
|
|
3366
|
-
var _emptyAnimation = null;
|
|
3367
3371
|
|
|
3368
3372
|
// spine-core/src/AnimationStateData.ts
|
|
3369
3373
|
var AnimationStateData = class {
|
|
3370
3374
|
constructor(skeletonData) {
|
|
3371
|
-
this.skeletonData = null;
|
|
3372
3375
|
this.animationToMixTime = {};
|
|
3373
3376
|
this.defaultMix = 0;
|
|
3374
3377
|
if (!skeletonData)
|
|
@@ -3485,65 +3488,63 @@ var spine = (() => {
|
|
|
3485
3488
|
this.regions = new Array();
|
|
3486
3489
|
let reader = new TextureAtlasReader(atlasText);
|
|
3487
3490
|
let entry = new Array(4);
|
|
3488
|
-
let page = null;
|
|
3489
|
-
let region = null;
|
|
3490
3491
|
let pageFields = {};
|
|
3491
|
-
pageFields["size"] = () => {
|
|
3492
|
-
|
|
3493
|
-
|
|
3492
|
+
pageFields["size"] = (page2) => {
|
|
3493
|
+
page2.width = parseInt(entry[1]);
|
|
3494
|
+
page2.height = parseInt(entry[2]);
|
|
3494
3495
|
};
|
|
3495
3496
|
pageFields["format"] = () => {
|
|
3496
3497
|
};
|
|
3497
|
-
pageFields["filter"] = () => {
|
|
3498
|
-
|
|
3499
|
-
|
|
3498
|
+
pageFields["filter"] = (page2) => {
|
|
3499
|
+
page2.minFilter = Utils.enumValue(TextureFilter, entry[1]);
|
|
3500
|
+
page2.magFilter = Utils.enumValue(TextureFilter, entry[2]);
|
|
3500
3501
|
};
|
|
3501
|
-
pageFields["repeat"] = () => {
|
|
3502
|
+
pageFields["repeat"] = (page2) => {
|
|
3502
3503
|
if (entry[1].indexOf("x") != -1)
|
|
3503
|
-
|
|
3504
|
+
page2.uWrap = TextureWrap.Repeat;
|
|
3504
3505
|
if (entry[1].indexOf("y") != -1)
|
|
3505
|
-
|
|
3506
|
+
page2.vWrap = TextureWrap.Repeat;
|
|
3506
3507
|
};
|
|
3507
|
-
pageFields["pma"] = () => {
|
|
3508
|
-
|
|
3508
|
+
pageFields["pma"] = (page2) => {
|
|
3509
|
+
page2.pma = entry[1] == "true";
|
|
3509
3510
|
};
|
|
3510
3511
|
var regionFields = {};
|
|
3511
|
-
regionFields["xy"] = () => {
|
|
3512
|
+
regionFields["xy"] = (region) => {
|
|
3512
3513
|
region.x = parseInt(entry[1]);
|
|
3513
3514
|
region.y = parseInt(entry[2]);
|
|
3514
3515
|
};
|
|
3515
|
-
regionFields["size"] = () => {
|
|
3516
|
+
regionFields["size"] = (region) => {
|
|
3516
3517
|
region.width = parseInt(entry[1]);
|
|
3517
3518
|
region.height = parseInt(entry[2]);
|
|
3518
3519
|
};
|
|
3519
|
-
regionFields["bounds"] = () => {
|
|
3520
|
+
regionFields["bounds"] = (region) => {
|
|
3520
3521
|
region.x = parseInt(entry[1]);
|
|
3521
3522
|
region.y = parseInt(entry[2]);
|
|
3522
3523
|
region.width = parseInt(entry[3]);
|
|
3523
3524
|
region.height = parseInt(entry[4]);
|
|
3524
3525
|
};
|
|
3525
|
-
regionFields["offset"] = () => {
|
|
3526
|
+
regionFields["offset"] = (region) => {
|
|
3526
3527
|
region.offsetX = parseInt(entry[1]);
|
|
3527
3528
|
region.offsetY = parseInt(entry[2]);
|
|
3528
3529
|
};
|
|
3529
|
-
regionFields["orig"] = () => {
|
|
3530
|
+
regionFields["orig"] = (region) => {
|
|
3530
3531
|
region.originalWidth = parseInt(entry[1]);
|
|
3531
3532
|
region.originalHeight = parseInt(entry[2]);
|
|
3532
3533
|
};
|
|
3533
|
-
regionFields["offsets"] = () => {
|
|
3534
|
+
regionFields["offsets"] = (region) => {
|
|
3534
3535
|
region.offsetX = parseInt(entry[1]);
|
|
3535
3536
|
region.offsetY = parseInt(entry[2]);
|
|
3536
3537
|
region.originalWidth = parseInt(entry[3]);
|
|
3537
3538
|
region.originalHeight = parseInt(entry[4]);
|
|
3538
3539
|
};
|
|
3539
|
-
regionFields["rotate"] = () => {
|
|
3540
|
+
regionFields["rotate"] = (region) => {
|
|
3540
3541
|
let value = entry[1];
|
|
3541
3542
|
if (value == "true")
|
|
3542
3543
|
region.degrees = 90;
|
|
3543
3544
|
else if (value != "false")
|
|
3544
3545
|
region.degrees = parseInt(value);
|
|
3545
3546
|
};
|
|
3546
|
-
regionFields["index"] = () => {
|
|
3547
|
+
regionFields["index"] = (region) => {
|
|
3547
3548
|
region.index = parseInt(entry[1]);
|
|
3548
3549
|
};
|
|
3549
3550
|
let line = reader.readLine();
|
|
@@ -3556,6 +3557,7 @@ var spine = (() => {
|
|
|
3556
3557
|
break;
|
|
3557
3558
|
line = reader.readLine();
|
|
3558
3559
|
}
|
|
3560
|
+
let page = null;
|
|
3559
3561
|
let names = null;
|
|
3560
3562
|
let values = null;
|
|
3561
3563
|
while (true) {
|
|
@@ -3565,32 +3567,29 @@ var spine = (() => {
|
|
|
3565
3567
|
page = null;
|
|
3566
3568
|
line = reader.readLine();
|
|
3567
3569
|
} else if (!page) {
|
|
3568
|
-
page = new TextureAtlasPage();
|
|
3569
|
-
page.name = line.trim();
|
|
3570
|
+
page = new TextureAtlasPage(line.trim());
|
|
3570
3571
|
while (true) {
|
|
3571
3572
|
if (reader.readEntry(entry, line = reader.readLine()) == 0)
|
|
3572
3573
|
break;
|
|
3573
3574
|
let field = pageFields[entry[0]];
|
|
3574
3575
|
if (field)
|
|
3575
|
-
field();
|
|
3576
|
+
field(page);
|
|
3576
3577
|
}
|
|
3577
3578
|
this.pages.push(page);
|
|
3578
3579
|
} else {
|
|
3579
|
-
region = new TextureAtlasRegion();
|
|
3580
|
-
region.page = page;
|
|
3581
|
-
region.name = line;
|
|
3580
|
+
let region = new TextureAtlasRegion(page, line);
|
|
3582
3581
|
while (true) {
|
|
3583
3582
|
let count = reader.readEntry(entry, line = reader.readLine());
|
|
3584
3583
|
if (count == 0)
|
|
3585
3584
|
break;
|
|
3586
3585
|
let field = regionFields[entry[0]];
|
|
3587
3586
|
if (field)
|
|
3588
|
-
field();
|
|
3587
|
+
field(region);
|
|
3589
3588
|
else {
|
|
3590
|
-
if (!names)
|
|
3589
|
+
if (!names)
|
|
3591
3590
|
names = [];
|
|
3591
|
+
if (!values)
|
|
3592
3592
|
values = [];
|
|
3593
|
-
}
|
|
3594
3593
|
names.push(entry[0]);
|
|
3595
3594
|
let entryValues = [];
|
|
3596
3595
|
for (let i = 0; i < count; i++)
|
|
@@ -3602,7 +3601,7 @@ var spine = (() => {
|
|
|
3602
3601
|
region.originalWidth = region.width;
|
|
3603
3602
|
region.originalHeight = region.height;
|
|
3604
3603
|
}
|
|
3605
|
-
if (names && names.length > 0) {
|
|
3604
|
+
if (names && names.length > 0 && values && values.length > 0) {
|
|
3606
3605
|
region.names = names;
|
|
3607
3606
|
region.values = values;
|
|
3608
3607
|
names = null;
|
|
@@ -3634,14 +3633,14 @@ var spine = (() => {
|
|
|
3634
3633
|
page.setTexture(assetManager.get(pathPrefix + page.name));
|
|
3635
3634
|
}
|
|
3636
3635
|
dispose() {
|
|
3636
|
+
var _a;
|
|
3637
3637
|
for (let i = 0; i < this.pages.length; i++) {
|
|
3638
|
-
this.pages[i].texture.dispose();
|
|
3638
|
+
(_a = this.pages[i].texture) == null ? void 0 : _a.dispose();
|
|
3639
3639
|
}
|
|
3640
3640
|
}
|
|
3641
3641
|
};
|
|
3642
3642
|
var TextureAtlasReader = class {
|
|
3643
3643
|
constructor(text) {
|
|
3644
|
-
this.lines = null;
|
|
3645
3644
|
this.index = 0;
|
|
3646
3645
|
this.lines = text.split(/\r\n|\r|\n/);
|
|
3647
3646
|
}
|
|
@@ -3674,8 +3673,7 @@ var spine = (() => {
|
|
|
3674
3673
|
}
|
|
3675
3674
|
};
|
|
3676
3675
|
var TextureAtlasPage = class {
|
|
3677
|
-
constructor() {
|
|
3678
|
-
this.name = null;
|
|
3676
|
+
constructor(name) {
|
|
3679
3677
|
this.minFilter = TextureFilter.Nearest;
|
|
3680
3678
|
this.magFilter = TextureFilter.Nearest;
|
|
3681
3679
|
this.uWrap = TextureWrap.ClampToEdge;
|
|
@@ -3684,6 +3682,7 @@ var spine = (() => {
|
|
|
3684
3682
|
this.width = 0;
|
|
3685
3683
|
this.height = 0;
|
|
3686
3684
|
this.pma = false;
|
|
3685
|
+
this.name = name;
|
|
3687
3686
|
}
|
|
3688
3687
|
setTexture(texture) {
|
|
3689
3688
|
this.texture = texture;
|
|
@@ -3692,10 +3691,8 @@ var spine = (() => {
|
|
|
3692
3691
|
}
|
|
3693
3692
|
};
|
|
3694
3693
|
var TextureAtlasRegion = class extends TextureRegion {
|
|
3695
|
-
constructor() {
|
|
3696
|
-
super(
|
|
3697
|
-
this.page = null;
|
|
3698
|
-
this.name = null;
|
|
3694
|
+
constructor(page, name) {
|
|
3695
|
+
super();
|
|
3699
3696
|
this.x = 0;
|
|
3700
3697
|
this.y = 0;
|
|
3701
3698
|
this.offsetX = 0;
|
|
@@ -3706,28 +3703,32 @@ var spine = (() => {
|
|
|
3706
3703
|
this.degrees = 0;
|
|
3707
3704
|
this.names = null;
|
|
3708
3705
|
this.values = null;
|
|
3706
|
+
this.page = page;
|
|
3707
|
+
this.name = name;
|
|
3709
3708
|
}
|
|
3710
3709
|
};
|
|
3711
3710
|
|
|
3712
3711
|
// spine-core/src/attachments/MeshAttachment.ts
|
|
3713
3712
|
var MeshAttachment = class extends VertexAttachment {
|
|
3714
|
-
constructor(name) {
|
|
3713
|
+
constructor(name, path) {
|
|
3715
3714
|
super(name);
|
|
3716
3715
|
this.region = null;
|
|
3717
|
-
this.
|
|
3718
|
-
this.
|
|
3719
|
-
this.
|
|
3720
|
-
this.triangles = null;
|
|
3716
|
+
this.regionUVs = [];
|
|
3717
|
+
this.uvs = [];
|
|
3718
|
+
this.triangles = [];
|
|
3721
3719
|
this.color = new Color(1, 1, 1, 1);
|
|
3722
3720
|
this.width = 0;
|
|
3723
3721
|
this.height = 0;
|
|
3724
3722
|
this.hullLength = 0;
|
|
3725
|
-
this.edges =
|
|
3723
|
+
this.edges = [];
|
|
3726
3724
|
this.parentMesh = null;
|
|
3727
3725
|
this.sequence = null;
|
|
3728
3726
|
this.tempColor = new Color(0, 0, 0, 0);
|
|
3727
|
+
this.path = path;
|
|
3729
3728
|
}
|
|
3730
3729
|
updateRegion() {
|
|
3730
|
+
if (!this.region)
|
|
3731
|
+
throw new Error("Region not set.");
|
|
3731
3732
|
let regionUVs = this.regionUVs;
|
|
3732
3733
|
if (!this.uvs || this.uvs.length != regionUVs.length)
|
|
3733
3734
|
this.uvs = Utils.newFloatArray(regionUVs.length);
|
|
@@ -3803,9 +3804,8 @@ var spine = (() => {
|
|
|
3803
3804
|
copy() {
|
|
3804
3805
|
if (this.parentMesh)
|
|
3805
3806
|
return this.newLinkedMesh();
|
|
3806
|
-
let copy = new MeshAttachment(this.name);
|
|
3807
|
+
let copy = new MeshAttachment(this.name, this.path);
|
|
3807
3808
|
copy.region = this.region;
|
|
3808
|
-
copy.path = this.path;
|
|
3809
3809
|
copy.color.setFromColor(this.color);
|
|
3810
3810
|
this.copyTo(copy);
|
|
3811
3811
|
copy.regionUVs = new Array(this.regionUVs.length);
|
|
@@ -3830,11 +3830,10 @@ var spine = (() => {
|
|
|
3830
3830
|
super.computeWorldVertices(slot, start, count, worldVertices, offset, stride);
|
|
3831
3831
|
}
|
|
3832
3832
|
newLinkedMesh() {
|
|
3833
|
-
let copy = new MeshAttachment(this.name);
|
|
3833
|
+
let copy = new MeshAttachment(this.name, this.path);
|
|
3834
3834
|
copy.region = this.region;
|
|
3835
|
-
copy.path = this.path;
|
|
3836
3835
|
copy.color.setFromColor(this.color);
|
|
3837
|
-
copy.
|
|
3836
|
+
copy.timelineAttachment = this.timelineAttachment;
|
|
3838
3837
|
copy.setParentMesh(this.parentMesh ? this.parentMesh : this);
|
|
3839
3838
|
if (copy.region != null)
|
|
3840
3839
|
copy.updateRegion();
|
|
@@ -3846,7 +3845,7 @@ var spine = (() => {
|
|
|
3846
3845
|
var PathAttachment = class extends VertexAttachment {
|
|
3847
3846
|
constructor(name) {
|
|
3848
3847
|
super(name);
|
|
3849
|
-
this.lengths =
|
|
3848
|
+
this.lengths = [];
|
|
3850
3849
|
this.closed = false;
|
|
3851
3850
|
this.constantSpeed = false;
|
|
3852
3851
|
this.color = new Color(1, 1, 1, 1);
|
|
@@ -3895,7 +3894,7 @@ var spine = (() => {
|
|
|
3895
3894
|
|
|
3896
3895
|
// spine-core/src/attachments/RegionAttachment.ts
|
|
3897
3896
|
var _RegionAttachment = class extends Attachment {
|
|
3898
|
-
constructor(name) {
|
|
3897
|
+
constructor(name, path) {
|
|
3899
3898
|
super(name);
|
|
3900
3899
|
this.x = 0;
|
|
3901
3900
|
this.y = 0;
|
|
@@ -3905,15 +3904,17 @@ var spine = (() => {
|
|
|
3905
3904
|
this.width = 0;
|
|
3906
3905
|
this.height = 0;
|
|
3907
3906
|
this.color = new Color(1, 1, 1, 1);
|
|
3908
|
-
this.path = null;
|
|
3909
3907
|
this.rendererObject = null;
|
|
3910
3908
|
this.region = null;
|
|
3911
3909
|
this.sequence = null;
|
|
3912
3910
|
this.offset = Utils.newFloatArray(8);
|
|
3913
3911
|
this.uvs = Utils.newFloatArray(8);
|
|
3914
3912
|
this.tempColor = new Color(1, 1, 1, 1);
|
|
3913
|
+
this.path = path;
|
|
3915
3914
|
}
|
|
3916
3915
|
updateRegion() {
|
|
3916
|
+
if (!this.region)
|
|
3917
|
+
throw new Error("Region not set.");
|
|
3917
3918
|
let region = this.region;
|
|
3918
3919
|
let regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
|
3919
3920
|
let regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
|
@@ -3992,10 +3993,9 @@ var spine = (() => {
|
|
|
3992
3993
|
worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
|
|
3993
3994
|
}
|
|
3994
3995
|
copy() {
|
|
3995
|
-
let copy = new _RegionAttachment(this.name);
|
|
3996
|
+
let copy = new _RegionAttachment(this.name, this.path);
|
|
3996
3997
|
copy.region = this.region;
|
|
3997
3998
|
copy.rendererObject = this.rendererObject;
|
|
3998
|
-
copy.path = this.path;
|
|
3999
3999
|
copy.x = this.x;
|
|
4000
4000
|
copy.y = this.y;
|
|
4001
4001
|
copy.scaleX = this.scaleX;
|
|
@@ -4047,21 +4047,21 @@ var spine = (() => {
|
|
|
4047
4047
|
// spine-core/src/AtlasAttachmentLoader.ts
|
|
4048
4048
|
var AtlasAttachmentLoader = class {
|
|
4049
4049
|
constructor(atlas) {
|
|
4050
|
-
this.atlas = null;
|
|
4051
4050
|
this.atlas = atlas;
|
|
4052
4051
|
}
|
|
4053
4052
|
loadSequence(name, basePath, sequence) {
|
|
4054
4053
|
let regions = sequence.regions;
|
|
4055
4054
|
for (let i = 0, n = regions.length; i < n; i++) {
|
|
4056
4055
|
let path = sequence.getPath(basePath, i);
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
if (regions[i] == null)
|
|
4056
|
+
let region = this.atlas.findRegion(path);
|
|
4057
|
+
if (region == null)
|
|
4060
4058
|
throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
|
|
4059
|
+
regions[i] = region;
|
|
4060
|
+
regions[i].renderObject = regions[i];
|
|
4061
4061
|
}
|
|
4062
4062
|
}
|
|
4063
4063
|
newRegionAttachment(skin, name, path, sequence) {
|
|
4064
|
-
let attachment = new RegionAttachment(name);
|
|
4064
|
+
let attachment = new RegionAttachment(name, path);
|
|
4065
4065
|
if (sequence != null) {
|
|
4066
4066
|
this.loadSequence(name, path, sequence);
|
|
4067
4067
|
} else {
|
|
@@ -4074,7 +4074,7 @@ var spine = (() => {
|
|
|
4074
4074
|
return attachment;
|
|
4075
4075
|
}
|
|
4076
4076
|
newMeshAttachment(skin, name, path, sequence) {
|
|
4077
|
-
let attachment = new MeshAttachment(name);
|
|
4077
|
+
let attachment = new MeshAttachment(name, path);
|
|
4078
4078
|
if (sequence != null) {
|
|
4079
4079
|
this.loadSequence(name, path, sequence);
|
|
4080
4080
|
} else {
|
|
@@ -4104,7 +4104,6 @@ var spine = (() => {
|
|
|
4104
4104
|
var BoneData = class {
|
|
4105
4105
|
constructor(index, name, parent) {
|
|
4106
4106
|
this.index = 0;
|
|
4107
|
-
this.name = null;
|
|
4108
4107
|
this.parent = null;
|
|
4109
4108
|
this.length = 0;
|
|
4110
4109
|
this.x = 0;
|
|
@@ -4138,8 +4137,6 @@ var spine = (() => {
|
|
|
4138
4137
|
// spine-core/src/Bone.ts
|
|
4139
4138
|
var Bone = class {
|
|
4140
4139
|
constructor(data, skeleton, parent) {
|
|
4141
|
-
this.data = null;
|
|
4142
|
-
this.skeleton = null;
|
|
4143
4140
|
this.parent = null;
|
|
4144
4141
|
this.children = new Array();
|
|
4145
4142
|
this.x = 0;
|
|
@@ -4392,15 +4389,15 @@ var spine = (() => {
|
|
|
4392
4389
|
|
|
4393
4390
|
// spine-core/src/AssetManagerBase.ts
|
|
4394
4391
|
var AssetManagerBase = class {
|
|
4395
|
-
constructor(textureLoader, pathPrefix = "", downloader =
|
|
4396
|
-
this.pathPrefix =
|
|
4392
|
+
constructor(textureLoader, pathPrefix = "", downloader = new Downloader()) {
|
|
4393
|
+
this.pathPrefix = "";
|
|
4397
4394
|
this.assets = {};
|
|
4398
4395
|
this.errors = {};
|
|
4399
4396
|
this.toLoad = 0;
|
|
4400
4397
|
this.loaded = 0;
|
|
4401
4398
|
this.textureLoader = textureLoader;
|
|
4402
4399
|
this.pathPrefix = pathPrefix;
|
|
4403
|
-
this.downloader = downloader
|
|
4400
|
+
this.downloader = downloader;
|
|
4404
4401
|
}
|
|
4405
4402
|
start(path) {
|
|
4406
4403
|
this.toLoad++;
|
|
@@ -4420,10 +4417,28 @@ var spine = (() => {
|
|
|
4420
4417
|
if (callback)
|
|
4421
4418
|
callback(path, message);
|
|
4422
4419
|
}
|
|
4420
|
+
loadAll() {
|
|
4421
|
+
let promise = new Promise((resolve, reject) => {
|
|
4422
|
+
let check = () => {
|
|
4423
|
+
if (this.isLoadingComplete()) {
|
|
4424
|
+
if (this.hasErrors())
|
|
4425
|
+
reject(this.errors);
|
|
4426
|
+
else
|
|
4427
|
+
resolve(this);
|
|
4428
|
+
return;
|
|
4429
|
+
}
|
|
4430
|
+
requestAnimationFrame(check);
|
|
4431
|
+
};
|
|
4432
|
+
requestAnimationFrame(check);
|
|
4433
|
+
});
|
|
4434
|
+
return promise;
|
|
4435
|
+
}
|
|
4423
4436
|
setRawDataURI(path, data) {
|
|
4424
4437
|
this.downloader.rawDataUris[this.pathPrefix + path] = data;
|
|
4425
4438
|
}
|
|
4426
|
-
loadBinary(path, success =
|
|
4439
|
+
loadBinary(path, success = () => {
|
|
4440
|
+
}, error = () => {
|
|
4441
|
+
}) {
|
|
4427
4442
|
path = this.start(path);
|
|
4428
4443
|
this.downloader.downloadBinary(path, (data) => {
|
|
4429
4444
|
this.success(success, path, data);
|
|
@@ -4431,7 +4446,9 @@ var spine = (() => {
|
|
|
4431
4446
|
this.error(error, path, `Couldn't load binary ${path}: status ${status}, ${responseText}`);
|
|
4432
4447
|
});
|
|
4433
4448
|
}
|
|
4434
|
-
loadText(path, success =
|
|
4449
|
+
loadText(path, success = () => {
|
|
4450
|
+
}, error = () => {
|
|
4451
|
+
}) {
|
|
4435
4452
|
path = this.start(path);
|
|
4436
4453
|
this.downloader.downloadText(path, (data) => {
|
|
4437
4454
|
this.success(success, path, data);
|
|
@@ -4439,7 +4456,9 @@ var spine = (() => {
|
|
|
4439
4456
|
this.error(error, path, `Couldn't load text ${path}: status ${status}, ${responseText}`);
|
|
4440
4457
|
});
|
|
4441
4458
|
}
|
|
4442
|
-
loadJson(path, success =
|
|
4459
|
+
loadJson(path, success = () => {
|
|
4460
|
+
}, error = () => {
|
|
4461
|
+
}) {
|
|
4443
4462
|
path = this.start(path);
|
|
4444
4463
|
this.downloader.downloadJson(path, (data) => {
|
|
4445
4464
|
this.success(success, path, data);
|
|
@@ -4447,7 +4466,9 @@ var spine = (() => {
|
|
|
4447
4466
|
this.error(error, path, `Couldn't load JSON ${path}: status ${status}, ${responseText}`);
|
|
4448
4467
|
});
|
|
4449
4468
|
}
|
|
4450
|
-
loadTexture(path, success =
|
|
4469
|
+
loadTexture(path, success = () => {
|
|
4470
|
+
}, error = () => {
|
|
4471
|
+
}) {
|
|
4451
4472
|
path = this.start(path);
|
|
4452
4473
|
let isBrowser = !!(typeof window !== "undefined" && typeof navigator !== "undefined" && window.document);
|
|
4453
4474
|
let isWebWorker = !isBrowser;
|
|
@@ -4477,7 +4498,9 @@ var spine = (() => {
|
|
|
4477
4498
|
image.src = path;
|
|
4478
4499
|
}
|
|
4479
4500
|
}
|
|
4480
|
-
loadTextureAtlas(path, success =
|
|
4501
|
+
loadTextureAtlas(path, success = () => {
|
|
4502
|
+
}, error = () => {
|
|
4503
|
+
}, fileAlias) {
|
|
4481
4504
|
let index = path.lastIndexOf("/");
|
|
4482
4505
|
let parent = index >= 0 ? path.substring(0, index + 1) : "";
|
|
4483
4506
|
path = this.start(path);
|
|
@@ -4486,7 +4509,7 @@ var spine = (() => {
|
|
|
4486
4509
|
let atlas = new TextureAtlas(atlasText);
|
|
4487
4510
|
let toLoad = atlas.pages.length, abort = false;
|
|
4488
4511
|
for (let page of atlas.pages) {
|
|
4489
|
-
this.loadTexture(fileAlias
|
|
4512
|
+
this.loadTexture(!fileAlias ? parent + page.name : fileAlias[page.name], (imagePath, texture) => {
|
|
4490
4513
|
if (!abort) {
|
|
4491
4514
|
page.setTexture(texture);
|
|
4492
4515
|
if (--toLoad == 0)
|
|
@@ -4663,7 +4686,6 @@ var spine = (() => {
|
|
|
4663
4686
|
// spine-core/src/Event.ts
|
|
4664
4687
|
var Event = class {
|
|
4665
4688
|
constructor(time, data) {
|
|
4666
|
-
this.data = null;
|
|
4667
4689
|
this.intValue = 0;
|
|
4668
4690
|
this.floatValue = 0;
|
|
4669
4691
|
this.stringValue = null;
|
|
@@ -4680,7 +4702,6 @@ var spine = (() => {
|
|
|
4680
4702
|
// spine-core/src/EventData.ts
|
|
4681
4703
|
var EventData = class {
|
|
4682
4704
|
constructor(name) {
|
|
4683
|
-
this.name = null;
|
|
4684
4705
|
this.intValue = 0;
|
|
4685
4706
|
this.floatValue = 0;
|
|
4686
4707
|
this.stringValue = null;
|
|
@@ -4694,9 +4715,6 @@ var spine = (() => {
|
|
|
4694
4715
|
// spine-core/src/IkConstraint.ts
|
|
4695
4716
|
var IkConstraint = class {
|
|
4696
4717
|
constructor(data, skeleton) {
|
|
4697
|
-
this.data = null;
|
|
4698
|
-
this.bones = null;
|
|
4699
|
-
this.target = null;
|
|
4700
4718
|
this.bendDirection = 0;
|
|
4701
4719
|
this.compress = false;
|
|
4702
4720
|
this.stretch = false;
|
|
@@ -4714,9 +4732,16 @@ var spine = (() => {
|
|
|
4714
4732
|
this.compress = data.compress;
|
|
4715
4733
|
this.stretch = data.stretch;
|
|
4716
4734
|
this.bones = new Array();
|
|
4717
|
-
for (let i = 0; i < data.bones.length; i++)
|
|
4718
|
-
|
|
4719
|
-
|
|
4735
|
+
for (let i = 0; i < data.bones.length; i++) {
|
|
4736
|
+
let bone = skeleton.findBone(data.bones[i].name);
|
|
4737
|
+
if (!bone)
|
|
4738
|
+
throw new Error(`Couldn't find bone ${data.bones[i].name}`);
|
|
4739
|
+
this.bones.push(bone);
|
|
4740
|
+
}
|
|
4741
|
+
let target = skeleton.findBone(data.target.name);
|
|
4742
|
+
if (!target)
|
|
4743
|
+
throw new Error(`Couldn't find bone ${data.target.name}`);
|
|
4744
|
+
this.target = target;
|
|
4720
4745
|
}
|
|
4721
4746
|
isActive() {
|
|
4722
4747
|
return this.active;
|
|
@@ -4737,6 +4762,8 @@ var spine = (() => {
|
|
|
4737
4762
|
}
|
|
4738
4763
|
apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
|
|
4739
4764
|
let p = bone.parent;
|
|
4765
|
+
if (!p)
|
|
4766
|
+
throw new Error("IK bone must have parent.");
|
|
4740
4767
|
let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
|
|
4741
4768
|
let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
|
|
4742
4769
|
switch (bone.data.transformMode) {
|
|
@@ -4814,6 +4841,8 @@ var spine = (() => {
|
|
|
4814
4841
|
cwy = c * cx + d * cy + parent.worldY;
|
|
4815
4842
|
}
|
|
4816
4843
|
let pp = parent.parent;
|
|
4844
|
+
if (!pp)
|
|
4845
|
+
throw new Error("IK parent must itself have a parent.");
|
|
4817
4846
|
a = pp.a;
|
|
4818
4847
|
b = pp.b;
|
|
4819
4848
|
c = pp.c;
|
|
@@ -4935,7 +4964,7 @@ var spine = (() => {
|
|
|
4935
4964
|
constructor(name) {
|
|
4936
4965
|
super(name, 0, false);
|
|
4937
4966
|
this.bones = new Array();
|
|
4938
|
-
this.
|
|
4967
|
+
this._target = null;
|
|
4939
4968
|
this.bendDirection = 1;
|
|
4940
4969
|
this.compress = false;
|
|
4941
4970
|
this.stretch = false;
|
|
@@ -4943,6 +4972,15 @@ var spine = (() => {
|
|
|
4943
4972
|
this.mix = 1;
|
|
4944
4973
|
this.softness = 0;
|
|
4945
4974
|
}
|
|
4975
|
+
set target(boneData) {
|
|
4976
|
+
this._target = boneData;
|
|
4977
|
+
}
|
|
4978
|
+
get target() {
|
|
4979
|
+
if (!this._target)
|
|
4980
|
+
throw new Error("BoneData not set.");
|
|
4981
|
+
else
|
|
4982
|
+
return this._target;
|
|
4983
|
+
}
|
|
4946
4984
|
};
|
|
4947
4985
|
|
|
4948
4986
|
// spine-core/src/PathConstraintData.ts
|
|
@@ -4950,10 +4988,10 @@ var spine = (() => {
|
|
|
4950
4988
|
constructor(name) {
|
|
4951
4989
|
super(name, 0, false);
|
|
4952
4990
|
this.bones = new Array();
|
|
4953
|
-
this.
|
|
4954
|
-
this.positionMode =
|
|
4955
|
-
this.spacingMode =
|
|
4956
|
-
this.rotateMode =
|
|
4991
|
+
this._target = null;
|
|
4992
|
+
this.positionMode = PositionMode.Fixed;
|
|
4993
|
+
this.spacingMode = SpacingMode.Fixed;
|
|
4994
|
+
this.rotateMode = RotateMode.Chain;
|
|
4957
4995
|
this.offsetRotation = 0;
|
|
4958
4996
|
this.position = 0;
|
|
4959
4997
|
this.spacing = 0;
|
|
@@ -4961,6 +4999,15 @@ var spine = (() => {
|
|
|
4961
4999
|
this.mixX = 0;
|
|
4962
5000
|
this.mixY = 0;
|
|
4963
5001
|
}
|
|
5002
|
+
set target(slotData) {
|
|
5003
|
+
this._target = slotData;
|
|
5004
|
+
}
|
|
5005
|
+
get target() {
|
|
5006
|
+
if (!this._target)
|
|
5007
|
+
throw new Error("SlotData not set.");
|
|
5008
|
+
else
|
|
5009
|
+
return this._target;
|
|
5010
|
+
}
|
|
4964
5011
|
};
|
|
4965
5012
|
var PositionMode;
|
|
4966
5013
|
(function(PositionMode2) {
|
|
@@ -4984,9 +5031,6 @@ var spine = (() => {
|
|
|
4984
5031
|
// spine-core/src/PathConstraint.ts
|
|
4985
5032
|
var _PathConstraint = class {
|
|
4986
5033
|
constructor(data, skeleton) {
|
|
4987
|
-
this.data = null;
|
|
4988
|
-
this.bones = null;
|
|
4989
|
-
this.target = null;
|
|
4990
5034
|
this.position = 0;
|
|
4991
5035
|
this.spacing = 0;
|
|
4992
5036
|
this.mixRotate = 0;
|
|
@@ -5005,9 +5049,16 @@ var spine = (() => {
|
|
|
5005
5049
|
throw new Error("skeleton cannot be null.");
|
|
5006
5050
|
this.data = data;
|
|
5007
5051
|
this.bones = new Array();
|
|
5008
|
-
for (let i = 0, n = data.bones.length; i < n; i++)
|
|
5009
|
-
|
|
5010
|
-
|
|
5052
|
+
for (let i = 0, n = data.bones.length; i < n; i++) {
|
|
5053
|
+
let bone = skeleton.findBone(data.bones[i].name);
|
|
5054
|
+
if (!bone)
|
|
5055
|
+
throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
5056
|
+
this.bones.push(bone);
|
|
5057
|
+
}
|
|
5058
|
+
let target = skeleton.findSlot(data.target.name);
|
|
5059
|
+
if (!target)
|
|
5060
|
+
throw new Error(`Couldn't find target bone ${data.target.name}`);
|
|
5061
|
+
this.target = target;
|
|
5011
5062
|
this.position = data.position;
|
|
5012
5063
|
this.spacing = data.spacing;
|
|
5013
5064
|
this.mixRotate = data.mixRotate;
|
|
@@ -5028,7 +5079,7 @@ var spine = (() => {
|
|
|
5028
5079
|
let tangents = data.rotateMode == RotateMode.Tangent, scale = data.rotateMode == RotateMode.ChainScale;
|
|
5029
5080
|
let bones = this.bones;
|
|
5030
5081
|
let boneCount = bones.length, spacesCount = tangents ? boneCount : boneCount + 1;
|
|
5031
|
-
let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) :
|
|
5082
|
+
let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : [];
|
|
5032
5083
|
let spacing = this.spacing;
|
|
5033
5084
|
switch (data.spacingMode) {
|
|
5034
5085
|
case SpacingMode.Percent:
|
|
@@ -5149,7 +5200,7 @@ var spine = (() => {
|
|
|
5149
5200
|
computeWorldPositions(path, spacesCount, tangents) {
|
|
5150
5201
|
let target = this.target;
|
|
5151
5202
|
let position = this.position;
|
|
5152
|
-
let spaces = this.spaces, out = Utils.setArraySize(this.positions, spacesCount * 3 + 2), world =
|
|
5203
|
+
let spaces = this.spaces, out = Utils.setArraySize(this.positions, spacesCount * 3 + 2), world = this.world;
|
|
5153
5204
|
let closed2 = path.closed;
|
|
5154
5205
|
let verticesLength = path.worldVerticesLength, curveCount = verticesLength / 6, prevCurve = _PathConstraint.NONE;
|
|
5155
5206
|
if (!path.constantSpeed) {
|
|
@@ -5406,12 +5457,10 @@ var spine = (() => {
|
|
|
5406
5457
|
// spine-core/src/Slot.ts
|
|
5407
5458
|
var Slot = class {
|
|
5408
5459
|
constructor(data, bone) {
|
|
5409
|
-
this.data = null;
|
|
5410
|
-
this.bone = null;
|
|
5411
|
-
this.color = null;
|
|
5412
5460
|
this.darkColor = null;
|
|
5413
5461
|
this.attachment = null;
|
|
5414
5462
|
this.attachmentState = 0;
|
|
5463
|
+
this.sequenceIndex = -1;
|
|
5415
5464
|
this.deform = new Array();
|
|
5416
5465
|
if (!data)
|
|
5417
5466
|
throw new Error("data cannot be null.");
|
|
@@ -5432,7 +5481,7 @@ var spine = (() => {
|
|
|
5432
5481
|
setAttachment(attachment) {
|
|
5433
5482
|
if (this.attachment == attachment)
|
|
5434
5483
|
return;
|
|
5435
|
-
if (!(attachment instanceof VertexAttachment) || !(this.attachment instanceof VertexAttachment) || attachment.
|
|
5484
|
+
if (!(attachment instanceof VertexAttachment) || !(this.attachment instanceof VertexAttachment) || attachment.timelineAttachment != this.attachment.timelineAttachment) {
|
|
5436
5485
|
this.deform.length = 0;
|
|
5437
5486
|
}
|
|
5438
5487
|
this.attachment = attachment;
|
|
@@ -5454,9 +5503,6 @@ var spine = (() => {
|
|
|
5454
5503
|
// spine-core/src/TransformConstraint.ts
|
|
5455
5504
|
var TransformConstraint = class {
|
|
5456
5505
|
constructor(data, skeleton) {
|
|
5457
|
-
this.data = null;
|
|
5458
|
-
this.bones = null;
|
|
5459
|
-
this.target = null;
|
|
5460
5506
|
this.mixRotate = 0;
|
|
5461
5507
|
this.mixX = 0;
|
|
5462
5508
|
this.mixY = 0;
|
|
@@ -5477,9 +5523,16 @@ var spine = (() => {
|
|
|
5477
5523
|
this.mixScaleY = data.mixScaleY;
|
|
5478
5524
|
this.mixShearY = data.mixShearY;
|
|
5479
5525
|
this.bones = new Array();
|
|
5480
|
-
for (let i = 0; i < data.bones.length; i++)
|
|
5481
|
-
|
|
5482
|
-
|
|
5526
|
+
for (let i = 0; i < data.bones.length; i++) {
|
|
5527
|
+
let bone = skeleton.findBone(data.bones[i].name);
|
|
5528
|
+
if (!bone)
|
|
5529
|
+
throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
5530
|
+
this.bones.push(bone);
|
|
5531
|
+
}
|
|
5532
|
+
let target = skeleton.findBone(data.target.name);
|
|
5533
|
+
if (!target)
|
|
5534
|
+
throw new Error(`Couldn't find target bone ${data.target.name}.`);
|
|
5535
|
+
this.target = target;
|
|
5483
5536
|
}
|
|
5484
5537
|
isActive() {
|
|
5485
5538
|
return this.active;
|
|
@@ -5664,16 +5717,8 @@ var spine = (() => {
|
|
|
5664
5717
|
// spine-core/src/Skeleton.ts
|
|
5665
5718
|
var Skeleton = class {
|
|
5666
5719
|
constructor(data) {
|
|
5667
|
-
this.data = null;
|
|
5668
|
-
this.bones = null;
|
|
5669
|
-
this.slots = null;
|
|
5670
|
-
this.drawOrder = null;
|
|
5671
|
-
this.ikConstraints = null;
|
|
5672
|
-
this.transformConstraints = null;
|
|
5673
|
-
this.pathConstraints = null;
|
|
5674
5720
|
this._updateCache = new Array();
|
|
5675
5721
|
this.skin = null;
|
|
5676
|
-
this.color = null;
|
|
5677
5722
|
this.scaleX = 1;
|
|
5678
5723
|
this.scaleY = 1;
|
|
5679
5724
|
this.x = 0;
|
|
@@ -5868,6 +5913,8 @@ var spine = (() => {
|
|
|
5868
5913
|
}
|
|
5869
5914
|
}
|
|
5870
5915
|
sortBone(bone) {
|
|
5916
|
+
if (!bone)
|
|
5917
|
+
return;
|
|
5871
5918
|
if (bone.sorted)
|
|
5872
5919
|
return;
|
|
5873
5920
|
let parent = bone.parent;
|
|
@@ -5904,6 +5951,8 @@ var spine = (() => {
|
|
|
5904
5951
|
}
|
|
5905
5952
|
updateWorldTransformWith(parent) {
|
|
5906
5953
|
let rootBone = this.getRootBone();
|
|
5954
|
+
if (!rootBone)
|
|
5955
|
+
throw new Error("Root bone must not be null.");
|
|
5907
5956
|
let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
|
|
5908
5957
|
rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
|
|
5909
5958
|
rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
|
|
@@ -6024,7 +6073,10 @@ var spine = (() => {
|
|
|
6024
6073
|
this.updateCache();
|
|
6025
6074
|
}
|
|
6026
6075
|
getAttachmentByName(slotName, attachmentName) {
|
|
6027
|
-
|
|
6076
|
+
let slot = this.data.findSlot(slotName);
|
|
6077
|
+
if (!slot)
|
|
6078
|
+
throw new Error(`Can't find slot with name ${slotName}`);
|
|
6079
|
+
return this.getAttachment(slot.index, attachmentName);
|
|
6028
6080
|
}
|
|
6029
6081
|
getAttachment(slotIndex, attachmentName) {
|
|
6030
6082
|
if (!attachmentName)
|
|
@@ -6090,6 +6142,12 @@ var spine = (() => {
|
|
|
6090
6142
|
}
|
|
6091
6143
|
return null;
|
|
6092
6144
|
}
|
|
6145
|
+
getBoundsRect() {
|
|
6146
|
+
let offset = new Vector2();
|
|
6147
|
+
let size = new Vector2();
|
|
6148
|
+
this.getBounds(offset, size);
|
|
6149
|
+
return { x: offset.x, y: offset.y, width: size.x, height: size.y };
|
|
6150
|
+
}
|
|
6093
6151
|
getBounds(offset, size, temp = new Array(2)) {
|
|
6094
6152
|
if (!offset)
|
|
6095
6153
|
throw new Error("offset cannot be null.");
|
|
@@ -6244,7 +6302,7 @@ var spine = (() => {
|
|
|
6244
6302
|
|
|
6245
6303
|
// spine-core/src/Skin.ts
|
|
6246
6304
|
var SkinEntry = class {
|
|
6247
|
-
constructor(slotIndex = 0, name
|
|
6305
|
+
constructor(slotIndex = 0, name, attachment) {
|
|
6248
6306
|
this.slotIndex = slotIndex;
|
|
6249
6307
|
this.name = name;
|
|
6250
6308
|
this.attachment = attachment;
|
|
@@ -6252,7 +6310,6 @@ var spine = (() => {
|
|
|
6252
6310
|
};
|
|
6253
6311
|
var Skin = class {
|
|
6254
6312
|
constructor(name) {
|
|
6255
|
-
this.name = null;
|
|
6256
6313
|
this.attachments = new Array();
|
|
6257
6314
|
this.bones = Array();
|
|
6258
6315
|
this.constraints = new Array();
|
|
@@ -6347,7 +6404,7 @@ var spine = (() => {
|
|
|
6347
6404
|
removeAttachment(slotIndex, name) {
|
|
6348
6405
|
let dictionary = this.attachments[slotIndex];
|
|
6349
6406
|
if (dictionary)
|
|
6350
|
-
dictionary[name]
|
|
6407
|
+
delete dictionary[name];
|
|
6351
6408
|
}
|
|
6352
6409
|
getAttachments() {
|
|
6353
6410
|
let entries = new Array();
|
|
@@ -6404,12 +6461,10 @@ var spine = (() => {
|
|
|
6404
6461
|
var SlotData = class {
|
|
6405
6462
|
constructor(index, name, boneData) {
|
|
6406
6463
|
this.index = 0;
|
|
6407
|
-
this.name = null;
|
|
6408
|
-
this.boneData = null;
|
|
6409
6464
|
this.color = new Color(1, 1, 1, 1);
|
|
6410
6465
|
this.darkColor = null;
|
|
6411
6466
|
this.attachmentName = null;
|
|
6412
|
-
this.blendMode =
|
|
6467
|
+
this.blendMode = BlendMode.Normal;
|
|
6413
6468
|
if (index < 0)
|
|
6414
6469
|
throw new Error("index must be >= 0.");
|
|
6415
6470
|
if (!name)
|
|
@@ -6434,7 +6489,7 @@ var spine = (() => {
|
|
|
6434
6489
|
constructor(name) {
|
|
6435
6490
|
super(name, 0, false);
|
|
6436
6491
|
this.bones = new Array();
|
|
6437
|
-
this.
|
|
6492
|
+
this._target = null;
|
|
6438
6493
|
this.mixRotate = 0;
|
|
6439
6494
|
this.mixX = 0;
|
|
6440
6495
|
this.mixY = 0;
|
|
@@ -6450,13 +6505,21 @@ var spine = (() => {
|
|
|
6450
6505
|
this.relative = false;
|
|
6451
6506
|
this.local = false;
|
|
6452
6507
|
}
|
|
6508
|
+
set target(boneData) {
|
|
6509
|
+
this._target = boneData;
|
|
6510
|
+
}
|
|
6511
|
+
get target() {
|
|
6512
|
+
if (!this._target)
|
|
6513
|
+
throw new Error("BoneData not set.");
|
|
6514
|
+
else
|
|
6515
|
+
return this._target;
|
|
6516
|
+
}
|
|
6453
6517
|
};
|
|
6454
6518
|
|
|
6455
6519
|
// spine-core/src/SkeletonBinary.ts
|
|
6456
6520
|
var SkeletonBinary = class {
|
|
6457
6521
|
constructor(attachmentLoader) {
|
|
6458
6522
|
this.scale = 1;
|
|
6459
|
-
this.attachmentLoader = null;
|
|
6460
6523
|
this.linkedMeshes = new Array();
|
|
6461
6524
|
this.attachmentLoader = attachmentLoader;
|
|
6462
6525
|
}
|
|
@@ -6481,11 +6544,17 @@ var spine = (() => {
|
|
|
6481
6544
|
}
|
|
6482
6545
|
let n = 0;
|
|
6483
6546
|
n = input.readInt(true);
|
|
6484
|
-
for (let i = 0; i < n; i++)
|
|
6485
|
-
input.
|
|
6547
|
+
for (let i = 0; i < n; i++) {
|
|
6548
|
+
let str = input.readString();
|
|
6549
|
+
if (!str)
|
|
6550
|
+
throw new Error("String in string table must not be null.");
|
|
6551
|
+
input.strings.push(str);
|
|
6552
|
+
}
|
|
6486
6553
|
n = input.readInt(true);
|
|
6487
6554
|
for (let i = 0; i < n; i++) {
|
|
6488
6555
|
let name = input.readString();
|
|
6556
|
+
if (!name)
|
|
6557
|
+
throw new Error("Bone name must not be null.");
|
|
6489
6558
|
let parent = i == 0 ? null : skeletonData.bones[input.readInt(true)];
|
|
6490
6559
|
let data = new BoneData(i, name, parent);
|
|
6491
6560
|
data.rotation = input.readFloat();
|
|
@@ -6505,6 +6574,8 @@ var spine = (() => {
|
|
|
6505
6574
|
n = input.readInt(true);
|
|
6506
6575
|
for (let i = 0; i < n; i++) {
|
|
6507
6576
|
let slotName = input.readString();
|
|
6577
|
+
if (!slotName)
|
|
6578
|
+
throw new Error("Slot name must not be null.");
|
|
6508
6579
|
let boneData = skeletonData.bones[input.readInt(true)];
|
|
6509
6580
|
let data = new SlotData(i, slotName, boneData);
|
|
6510
6581
|
Color.rgba8888ToColor(data.color, input.readInt32());
|
|
@@ -6517,7 +6588,10 @@ var spine = (() => {
|
|
|
6517
6588
|
}
|
|
6518
6589
|
n = input.readInt(true);
|
|
6519
6590
|
for (let i = 0, nn; i < n; i++) {
|
|
6520
|
-
let
|
|
6591
|
+
let name = input.readString();
|
|
6592
|
+
if (!name)
|
|
6593
|
+
throw new Error("IK constraint data name must not be null.");
|
|
6594
|
+
let data = new IkConstraintData(name);
|
|
6521
6595
|
data.order = input.readInt(true);
|
|
6522
6596
|
data.skinRequired = input.readBoolean();
|
|
6523
6597
|
nn = input.readInt(true);
|
|
@@ -6534,7 +6608,10 @@ var spine = (() => {
|
|
|
6534
6608
|
}
|
|
6535
6609
|
n = input.readInt(true);
|
|
6536
6610
|
for (let i = 0, nn; i < n; i++) {
|
|
6537
|
-
let
|
|
6611
|
+
let name = input.readString();
|
|
6612
|
+
if (!name)
|
|
6613
|
+
throw new Error("Transform constraint data name must not be null.");
|
|
6614
|
+
let data = new TransformConstraintData(name);
|
|
6538
6615
|
data.order = input.readInt(true);
|
|
6539
6616
|
data.skinRequired = input.readBoolean();
|
|
6540
6617
|
nn = input.readInt(true);
|
|
@@ -6559,7 +6636,10 @@ var spine = (() => {
|
|
|
6559
6636
|
}
|
|
6560
6637
|
n = input.readInt(true);
|
|
6561
6638
|
for (let i = 0, nn; i < n; i++) {
|
|
6562
|
-
let
|
|
6639
|
+
let name = input.readString();
|
|
6640
|
+
if (!name)
|
|
6641
|
+
throw new Error("Path constraint data name must not be null.");
|
|
6642
|
+
let data = new PathConstraintData(name);
|
|
6563
6643
|
data.order = input.readInt(true);
|
|
6564
6644
|
data.skinRequired = input.readBoolean();
|
|
6565
6645
|
nn = input.readInt(true);
|
|
@@ -6589,15 +6669,25 @@ var spine = (() => {
|
|
|
6589
6669
|
{
|
|
6590
6670
|
let i = skeletonData.skins.length;
|
|
6591
6671
|
Utils.setArraySize(skeletonData.skins, n = i + input.readInt(true));
|
|
6592
|
-
for (; i < n; i++)
|
|
6593
|
-
|
|
6672
|
+
for (; i < n; i++) {
|
|
6673
|
+
let skin = this.readSkin(input, skeletonData, false, nonessential);
|
|
6674
|
+
if (!skin)
|
|
6675
|
+
throw new Error("readSkin() should not have returned null.");
|
|
6676
|
+
skeletonData.skins[i] = skin;
|
|
6677
|
+
}
|
|
6594
6678
|
}
|
|
6595
6679
|
n = this.linkedMeshes.length;
|
|
6596
6680
|
for (let i = 0; i < n; i++) {
|
|
6597
6681
|
let linkedMesh = this.linkedMeshes[i];
|
|
6598
6682
|
let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
|
|
6683
|
+
if (!skin)
|
|
6684
|
+
throw new Error("Not skin found for linked mesh.");
|
|
6685
|
+
if (!linkedMesh.parent)
|
|
6686
|
+
throw new Error("Linked mesh parent must not be null");
|
|
6599
6687
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
6600
|
-
|
|
6688
|
+
if (!parent)
|
|
6689
|
+
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
6690
|
+
linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
6601
6691
|
linkedMesh.mesh.setParentMesh(parent);
|
|
6602
6692
|
if (linkedMesh.mesh.region != null)
|
|
6603
6693
|
linkedMesh.mesh.updateRegion();
|
|
@@ -6605,7 +6695,10 @@ var spine = (() => {
|
|
|
6605
6695
|
this.linkedMeshes.length = 0;
|
|
6606
6696
|
n = input.readInt(true);
|
|
6607
6697
|
for (let i = 0; i < n; i++) {
|
|
6608
|
-
let
|
|
6698
|
+
let eventName = input.readStringRef();
|
|
6699
|
+
if (!eventName)
|
|
6700
|
+
throw new Error();
|
|
6701
|
+
let data = new EventData(eventName);
|
|
6609
6702
|
data.intValue = input.readInt(false);
|
|
6610
6703
|
data.floatValue = input.readFloat();
|
|
6611
6704
|
data.stringValue = input.readString();
|
|
@@ -6617,8 +6710,12 @@ var spine = (() => {
|
|
|
6617
6710
|
skeletonData.events.push(data);
|
|
6618
6711
|
}
|
|
6619
6712
|
n = input.readInt(true);
|
|
6620
|
-
for (let i = 0; i < n; i++)
|
|
6621
|
-
|
|
6713
|
+
for (let i = 0; i < n; i++) {
|
|
6714
|
+
let animationName = input.readString();
|
|
6715
|
+
if (!animationName)
|
|
6716
|
+
throw new Error("Animatio name must not be null.");
|
|
6717
|
+
skeletonData.animations.push(this.readAnimation(input, animationName, skeletonData));
|
|
6718
|
+
}
|
|
6622
6719
|
return skeletonData;
|
|
6623
6720
|
}
|
|
6624
6721
|
readSkin(input, skeletonData, defaultSkin, nonessential) {
|
|
@@ -6630,7 +6727,10 @@ var spine = (() => {
|
|
|
6630
6727
|
return null;
|
|
6631
6728
|
skin = new Skin("default");
|
|
6632
6729
|
} else {
|
|
6633
|
-
|
|
6730
|
+
let skinName = input.readStringRef();
|
|
6731
|
+
if (!skinName)
|
|
6732
|
+
throw new Error("Skin name must not be null.");
|
|
6733
|
+
skin = new Skin(skinName);
|
|
6634
6734
|
skin.bones.length = input.readInt(true);
|
|
6635
6735
|
for (let i = 0, n = skin.bones.length; i < n; i++)
|
|
6636
6736
|
skin.bones[i] = skeletonData.bones[input.readInt(true)];
|
|
@@ -6646,6 +6746,8 @@ var spine = (() => {
|
|
|
6646
6746
|
let slotIndex = input.readInt(true);
|
|
6647
6747
|
for (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {
|
|
6648
6748
|
let name = input.readStringRef();
|
|
6749
|
+
if (!name)
|
|
6750
|
+
throw new Error("Attachment name must not be null");
|
|
6649
6751
|
let attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name, nonessential);
|
|
6650
6752
|
if (attachment)
|
|
6651
6753
|
skin.setAttachment(slotIndex, name, attachment);
|
|
@@ -6712,7 +6814,7 @@ var spine = (() => {
|
|
|
6712
6814
|
let vertices = this.readVertices(input, vertexCount);
|
|
6713
6815
|
let hullLength = input.readInt(true);
|
|
6714
6816
|
let sequence = this.readSequence(input);
|
|
6715
|
-
let edges =
|
|
6817
|
+
let edges = [];
|
|
6716
6818
|
let width = 0, height = 0;
|
|
6717
6819
|
if (nonessential) {
|
|
6718
6820
|
edges = this.readShortArray(input);
|
|
@@ -7214,6 +7316,8 @@ var spine = (() => {
|
|
|
7214
7316
|
let slotIndex = input.readInt(true);
|
|
7215
7317
|
for (let iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {
|
|
7216
7318
|
let attachmentName = input.readStringRef();
|
|
7319
|
+
if (!attachmentName)
|
|
7320
|
+
throw new Error("attachmentName must not be null.");
|
|
7217
7321
|
let attachment = skin.getAttachment(slotIndex, attachmentName);
|
|
7218
7322
|
let timelineType = input.readByte();
|
|
7219
7323
|
let frameCount = input.readInt(true);
|
|
@@ -7388,7 +7492,7 @@ var spine = (() => {
|
|
|
7388
7492
|
let chars = "";
|
|
7389
7493
|
let charCount = 0;
|
|
7390
7494
|
for (let i = 0; i < byteCount; ) {
|
|
7391
|
-
let b = this.
|
|
7495
|
+
let b = this.readUnsignedByte();
|
|
7392
7496
|
switch (b >> 4) {
|
|
7393
7497
|
case 12:
|
|
7394
7498
|
case 13:
|
|
@@ -7889,6 +7993,8 @@ var spine = (() => {
|
|
|
7889
7993
|
this.clippedVertices = new Array();
|
|
7890
7994
|
this.clippedTriangles = new Array();
|
|
7891
7995
|
this.scratch = new Array();
|
|
7996
|
+
this.clipAttachment = null;
|
|
7997
|
+
this.clippingPolygons = null;
|
|
7892
7998
|
}
|
|
7893
7999
|
clipStart(slot, clip) {
|
|
7894
8000
|
if (this.clipAttachment)
|
|
@@ -7928,7 +8034,7 @@ var spine = (() => {
|
|
|
7928
8034
|
let clipOutput = this.clipOutput, clippedVertices = this.clippedVertices;
|
|
7929
8035
|
let clippedTriangles = this.clippedTriangles;
|
|
7930
8036
|
let polygons = this.clippingPolygons;
|
|
7931
|
-
let polygonsCount =
|
|
8037
|
+
let polygonsCount = polygons.length;
|
|
7932
8038
|
let vertexSize = twoColor ? 12 : 8;
|
|
7933
8039
|
let index = 0;
|
|
7934
8040
|
clippedVertices.length = 0;
|
|
@@ -8060,7 +8166,7 @@ var spine = (() => {
|
|
|
8060
8166
|
clip(x1, y1, x2, y2, x3, y3, clippingArea, output) {
|
|
8061
8167
|
let originalOutput = output;
|
|
8062
8168
|
let clipped = false;
|
|
8063
|
-
let input
|
|
8169
|
+
let input;
|
|
8064
8170
|
if (clippingArea.length % 4 >= 2) {
|
|
8065
8171
|
input = output;
|
|
8066
8172
|
output = this.scratch;
|
|
@@ -8168,7 +8274,6 @@ var spine = (() => {
|
|
|
8168
8274
|
// spine-core/src/SkeletonJson.ts
|
|
8169
8275
|
var SkeletonJson = class {
|
|
8170
8276
|
constructor(attachmentLoader) {
|
|
8171
|
-
this.attachmentLoader = null;
|
|
8172
8277
|
this.scale = 1;
|
|
8173
8278
|
this.linkedMeshes = new Array();
|
|
8174
8279
|
this.attachmentLoader = attachmentLoader;
|
|
@@ -8216,6 +8321,8 @@ var spine = (() => {
|
|
|
8216
8321
|
for (let i = 0; i < root.slots.length; i++) {
|
|
8217
8322
|
let slotMap = root.slots[i];
|
|
8218
8323
|
let boneData = skeletonData.findBone(slotMap.bone);
|
|
8324
|
+
if (!boneData)
|
|
8325
|
+
throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotMap.name}`);
|
|
8219
8326
|
let data = new SlotData(skeletonData.slots.length, slotMap.name, boneData);
|
|
8220
8327
|
let color = getValue(slotMap, "color", null);
|
|
8221
8328
|
if (color)
|
|
@@ -8234,9 +8341,17 @@ var spine = (() => {
|
|
|
8234
8341
|
let data = new IkConstraintData(constraintMap.name);
|
|
8235
8342
|
data.order = getValue(constraintMap, "order", 0);
|
|
8236
8343
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
8237
|
-
for (let ii = 0; ii < constraintMap.bones.length; ii++)
|
|
8238
|
-
|
|
8239
|
-
|
|
8344
|
+
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
8345
|
+
let bone = skeletonData.findBone(constraintMap.bones[ii]);
|
|
8346
|
+
if (!bone)
|
|
8347
|
+
throw new Error(`Couldn't find bone ${constraintMap.bones[ii]} for IK constraint ${constraintMap.name}.`);
|
|
8348
|
+
data.bones.push(bone);
|
|
8349
|
+
}
|
|
8350
|
+
let target = skeletonData.findBone(constraintMap.target);
|
|
8351
|
+
;
|
|
8352
|
+
if (!target)
|
|
8353
|
+
throw new Error(`Couldn't find target bone ${constraintMap.target} for IK constraint ${constraintMap.name}.`);
|
|
8354
|
+
data.target = target;
|
|
8240
8355
|
data.mix = getValue(constraintMap, "mix", 1);
|
|
8241
8356
|
data.softness = getValue(constraintMap, "softness", 0) * scale;
|
|
8242
8357
|
data.bendDirection = getValue(constraintMap, "bendPositive", true) ? 1 : -1;
|
|
@@ -8252,10 +8367,18 @@ var spine = (() => {
|
|
|
8252
8367
|
let data = new TransformConstraintData(constraintMap.name);
|
|
8253
8368
|
data.order = getValue(constraintMap, "order", 0);
|
|
8254
8369
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
8255
|
-
for (let ii = 0; ii < constraintMap.bones.length; ii++)
|
|
8256
|
-
|
|
8370
|
+
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
8371
|
+
let boneName = constraintMap.bones[ii];
|
|
8372
|
+
let bone = skeletonData.findBone(boneName);
|
|
8373
|
+
if (!bone)
|
|
8374
|
+
throw new Error(`Couldn't find bone ${boneName} for transform constraint ${constraintMap.name}.`);
|
|
8375
|
+
data.bones.push(bone);
|
|
8376
|
+
}
|
|
8257
8377
|
let targetName = constraintMap.target;
|
|
8258
|
-
|
|
8378
|
+
let target = skeletonData.findBone(targetName);
|
|
8379
|
+
if (!target)
|
|
8380
|
+
throw new Error(`Couldn't find target bone ${targetName} for transform constraint ${constraintMap.name}.`);
|
|
8381
|
+
data.target = target;
|
|
8259
8382
|
data.local = getValue(constraintMap, "local", false);
|
|
8260
8383
|
data.relative = getValue(constraintMap, "relative", false);
|
|
8261
8384
|
data.offsetRotation = getValue(constraintMap, "rotation", 0);
|
|
@@ -8279,10 +8402,18 @@ var spine = (() => {
|
|
|
8279
8402
|
let data = new PathConstraintData(constraintMap.name);
|
|
8280
8403
|
data.order = getValue(constraintMap, "order", 0);
|
|
8281
8404
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
8282
|
-
for (let ii = 0; ii < constraintMap.bones.length; ii++)
|
|
8283
|
-
|
|
8405
|
+
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
8406
|
+
let boneName = constraintMap.bones[ii];
|
|
8407
|
+
let bone = skeletonData.findBone(boneName);
|
|
8408
|
+
if (!bone)
|
|
8409
|
+
throw new Error(`Couldn't find bone ${boneName} for path constraint ${constraintMap.name}.`);
|
|
8410
|
+
data.bones.push(bone);
|
|
8411
|
+
}
|
|
8284
8412
|
let targetName = constraintMap.target;
|
|
8285
|
-
|
|
8413
|
+
let target = skeletonData.findSlot(targetName);
|
|
8414
|
+
if (!target)
|
|
8415
|
+
throw new Error(`Couldn't find target slot ${targetName} for path constraint ${constraintMap.name}.`);
|
|
8416
|
+
data.target = target;
|
|
8286
8417
|
data.positionMode = Utils.enumValue(PositionMode, getValue(constraintMap, "positionMode", "Percent"));
|
|
8287
8418
|
data.spacingMode = Utils.enumValue(SpacingMode, getValue(constraintMap, "spacingMode", "Length"));
|
|
8288
8419
|
data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
|
|
@@ -8304,23 +8435,45 @@ var spine = (() => {
|
|
|
8304
8435
|
let skinMap = root.skins[i];
|
|
8305
8436
|
let skin = new Skin(skinMap.name);
|
|
8306
8437
|
if (skinMap.bones) {
|
|
8307
|
-
for (let ii = 0; ii < skinMap.bones.length; ii++)
|
|
8308
|
-
|
|
8438
|
+
for (let ii = 0; ii < skinMap.bones.length; ii++) {
|
|
8439
|
+
let boneName = skinMap.bones[ii];
|
|
8440
|
+
let bone = skeletonData.findBone(boneName);
|
|
8441
|
+
if (!bone)
|
|
8442
|
+
throw new Error(`Couldn't find bone ${boneName} for skin ${skinMap.name}.`);
|
|
8443
|
+
skin.bones.push(bone);
|
|
8444
|
+
}
|
|
8309
8445
|
}
|
|
8310
8446
|
if (skinMap.ik) {
|
|
8311
|
-
for (let ii = 0; ii < skinMap.ik.length; ii++)
|
|
8312
|
-
|
|
8447
|
+
for (let ii = 0; ii < skinMap.ik.length; ii++) {
|
|
8448
|
+
let constraintName = skinMap.ik[ii];
|
|
8449
|
+
let constraint = skeletonData.findIkConstraint(constraintName);
|
|
8450
|
+
if (!constraint)
|
|
8451
|
+
throw new Error(`Couldn't find IK constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
8452
|
+
skin.constraints.push(constraint);
|
|
8453
|
+
}
|
|
8313
8454
|
}
|
|
8314
8455
|
if (skinMap.transform) {
|
|
8315
|
-
for (let ii = 0; ii < skinMap.transform.length; ii++)
|
|
8316
|
-
|
|
8456
|
+
for (let ii = 0; ii < skinMap.transform.length; ii++) {
|
|
8457
|
+
let constraintName = skinMap.transform[ii];
|
|
8458
|
+
let constraint = skeletonData.findTransformConstraint(constraintName);
|
|
8459
|
+
if (!constraint)
|
|
8460
|
+
throw new Error(`Couldn't find transform constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
8461
|
+
skin.constraints.push(constraint);
|
|
8462
|
+
}
|
|
8317
8463
|
}
|
|
8318
8464
|
if (skinMap.path) {
|
|
8319
|
-
for (let ii = 0; ii < skinMap.path.length; ii++)
|
|
8320
|
-
|
|
8465
|
+
for (let ii = 0; ii < skinMap.path.length; ii++) {
|
|
8466
|
+
let constraintName = skinMap.path[ii];
|
|
8467
|
+
let constraint = skeletonData.findPathConstraint(constraintName);
|
|
8468
|
+
if (!constraint)
|
|
8469
|
+
throw new Error(`Couldn't find path constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
8470
|
+
skin.constraints.push(constraint);
|
|
8471
|
+
}
|
|
8321
8472
|
}
|
|
8322
8473
|
for (let slotName in skinMap.attachments) {
|
|
8323
8474
|
let slot = skeletonData.findSlot(slotName);
|
|
8475
|
+
if (!slot)
|
|
8476
|
+
throw new Error(`Couldn't find slot ${slotName} for skin ${skinMap.name}.`);
|
|
8324
8477
|
let slotMap = skinMap.attachments[slotName];
|
|
8325
8478
|
for (let entryName in slotMap) {
|
|
8326
8479
|
let attachment = this.readAttachment(slotMap[entryName], skin, slot.index, entryName, skeletonData);
|
|
@@ -8336,8 +8489,12 @@ var spine = (() => {
|
|
|
8336
8489
|
for (let i = 0, n = this.linkedMeshes.length; i < n; i++) {
|
|
8337
8490
|
let linkedMesh = this.linkedMeshes[i];
|
|
8338
8491
|
let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
|
|
8492
|
+
if (!skin)
|
|
8493
|
+
throw new Error(`Skin not found: ${linkedMesh.skin}`);
|
|
8339
8494
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
8340
|
-
|
|
8495
|
+
if (!parent)
|
|
8496
|
+
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
8497
|
+
linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
8341
8498
|
linkedMesh.mesh.setParentMesh(parent);
|
|
8342
8499
|
if (linkedMesh.mesh.region != null)
|
|
8343
8500
|
linkedMesh.mesh.updateRegion();
|
|
@@ -8520,7 +8677,10 @@ var spine = (() => {
|
|
|
8520
8677
|
if (map.slots) {
|
|
8521
8678
|
for (let slotName in map.slots) {
|
|
8522
8679
|
let slotMap = map.slots[slotName];
|
|
8523
|
-
let
|
|
8680
|
+
let slot = skeletonData.findSlot(slotName);
|
|
8681
|
+
if (!slot)
|
|
8682
|
+
throw new Error("Slot not found: " + slotName);
|
|
8683
|
+
let slotIndex = slot.index;
|
|
8524
8684
|
for (let timelineName in slotMap) {
|
|
8525
8685
|
let timelineMap = slotMap[timelineName];
|
|
8526
8686
|
if (!timelineMap)
|
|
@@ -8656,7 +8816,10 @@ var spine = (() => {
|
|
|
8656
8816
|
if (map.bones) {
|
|
8657
8817
|
for (let boneName in map.bones) {
|
|
8658
8818
|
let boneMap = map.bones[boneName];
|
|
8659
|
-
let
|
|
8819
|
+
let bone = skeletonData.findBone(boneName);
|
|
8820
|
+
if (!bone)
|
|
8821
|
+
throw new Error("Bone not found: " + boneName);
|
|
8822
|
+
let boneIndex = bone.index;
|
|
8660
8823
|
for (let timelineName in boneMap) {
|
|
8661
8824
|
let timelineMap = boneMap[timelineName];
|
|
8662
8825
|
let frames = timelineMap.length;
|
|
@@ -8702,6 +8865,8 @@ var spine = (() => {
|
|
|
8702
8865
|
if (!keyMap)
|
|
8703
8866
|
continue;
|
|
8704
8867
|
let constraint = skeletonData.findIkConstraint(constraintName);
|
|
8868
|
+
if (!constraint)
|
|
8869
|
+
throw new Error("IK Constraint not found: " + constraintName);
|
|
8705
8870
|
let constraintIndex = skeletonData.ikConstraints.indexOf(constraint);
|
|
8706
8871
|
let timeline = new IkConstraintTimeline(constraintMap.length, constraintMap.length << 1, constraintIndex);
|
|
8707
8872
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -8737,6 +8902,8 @@ var spine = (() => {
|
|
|
8737
8902
|
if (!keyMap)
|
|
8738
8903
|
continue;
|
|
8739
8904
|
let constraint = skeletonData.findTransformConstraint(constraintName);
|
|
8905
|
+
if (!constraint)
|
|
8906
|
+
throw new Error("Transform constraint not found: " + constraintName);
|
|
8740
8907
|
let constraintIndex = skeletonData.transformConstraints.indexOf(constraint);
|
|
8741
8908
|
let timeline = new TransformConstraintTimeline(timelineMap.length, timelineMap.length * 6, constraintIndex);
|
|
8742
8909
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -8785,6 +8952,8 @@ var spine = (() => {
|
|
|
8785
8952
|
for (let constraintName in map.path) {
|
|
8786
8953
|
let constraintMap = map.path[constraintName];
|
|
8787
8954
|
let constraint = skeletonData.findPathConstraint(constraintName);
|
|
8955
|
+
if (!constraint)
|
|
8956
|
+
throw new Error("Path constraint not found: " + constraintName);
|
|
8788
8957
|
let constraintIndex = skeletonData.pathConstraints.indexOf(constraint);
|
|
8789
8958
|
for (let timelineName in constraintMap) {
|
|
8790
8959
|
let timelineMap = constraintMap[timelineName];
|
|
@@ -8836,9 +9005,14 @@ var spine = (() => {
|
|
|
8836
9005
|
for (let attachmentsName in map.attachments) {
|
|
8837
9006
|
let attachmentsMap = map.attachments[attachmentsName];
|
|
8838
9007
|
let skin = skeletonData.findSkin(attachmentsName);
|
|
9008
|
+
if (!skin)
|
|
9009
|
+
throw new Error("Skin not found: " + attachmentsName);
|
|
8839
9010
|
for (let slotMapName in attachmentsMap) {
|
|
8840
9011
|
let slotMap = attachmentsMap[slotMapName];
|
|
8841
|
-
let
|
|
9012
|
+
let slot = skeletonData.findSlot(slotMapName);
|
|
9013
|
+
if (!slot)
|
|
9014
|
+
throw new Error("Slot not found: " + slotMapName);
|
|
9015
|
+
let slotIndex = slot.index;
|
|
8842
9016
|
for (let attachmentMapName in slotMap) {
|
|
8843
9017
|
let attachmentMap = slotMap[attachmentMapName];
|
|
8844
9018
|
let attachment = skin.getAttachment(slotIndex, attachmentMapName);
|
|
@@ -8918,7 +9092,10 @@ var spine = (() => {
|
|
|
8918
9092
|
let originalIndex = 0, unchangedIndex = 0;
|
|
8919
9093
|
for (let ii = 0; ii < offsets.length; ii++) {
|
|
8920
9094
|
let offsetMap = offsets[ii];
|
|
8921
|
-
let
|
|
9095
|
+
let slot = skeletonData.findSlot(offsetMap.slot);
|
|
9096
|
+
if (!slot)
|
|
9097
|
+
throw new Error("Slot not found: " + slot);
|
|
9098
|
+
let slotIndex = slot.index;
|
|
8922
9099
|
while (originalIndex != slotIndex)
|
|
8923
9100
|
unchanged[unchangedIndex++] = originalIndex++;
|
|
8924
9101
|
drawOrder[originalIndex + offsetMap.offset] = originalIndex++;
|
|
@@ -8939,6 +9116,8 @@ var spine = (() => {
|
|
|
8939
9116
|
for (let i = 0; i < map.events.length; i++, frame++) {
|
|
8940
9117
|
let eventMap = map.events[i];
|
|
8941
9118
|
let eventData = skeletonData.findEvent(eventMap.name);
|
|
9119
|
+
if (!eventData)
|
|
9120
|
+
throw new Error("Event not found: " + eventMap.name);
|
|
8942
9121
|
let event = new Event(Utils.toSinglePrecision(getValue(eventMap, "time", 0)), eventData);
|
|
8943
9122
|
event.intValue = getValue(eventMap, "int", eventData.intValue);
|
|
8944
9123
|
event.floatValue = getValue(eventMap, "float", eventData.floatValue);
|
|
@@ -9042,82 +9221,28 @@ var spine = (() => {
|
|
|
9042
9221
|
}
|
|
9043
9222
|
})();
|
|
9044
9223
|
|
|
9045
|
-
// spine-core/src/vertexeffects/JitterEffect.ts
|
|
9046
|
-
var JitterEffect = class {
|
|
9047
|
-
constructor(jitterX, jitterY) {
|
|
9048
|
-
this.jitterX = 0;
|
|
9049
|
-
this.jitterY = 0;
|
|
9050
|
-
this.jitterX = jitterX;
|
|
9051
|
-
this.jitterY = jitterY;
|
|
9052
|
-
}
|
|
9053
|
-
begin(skeleton) {
|
|
9054
|
-
}
|
|
9055
|
-
transform(position, uv, light, dark) {
|
|
9056
|
-
position.x += MathUtils.randomTriangular(-this.jitterX, this.jitterY);
|
|
9057
|
-
position.y += MathUtils.randomTriangular(-this.jitterX, this.jitterY);
|
|
9058
|
-
}
|
|
9059
|
-
end() {
|
|
9060
|
-
}
|
|
9061
|
-
};
|
|
9062
|
-
|
|
9063
|
-
// spine-core/src/vertexeffects/SwirlEffect.ts
|
|
9064
|
-
var _SwirlEffect = class {
|
|
9065
|
-
constructor(radius) {
|
|
9066
|
-
this.centerX = 0;
|
|
9067
|
-
this.centerY = 0;
|
|
9068
|
-
this.radius = 0;
|
|
9069
|
-
this.angle = 0;
|
|
9070
|
-
this.worldX = 0;
|
|
9071
|
-
this.worldY = 0;
|
|
9072
|
-
this.radius = radius;
|
|
9073
|
-
}
|
|
9074
|
-
begin(skeleton) {
|
|
9075
|
-
this.worldX = skeleton.x + this.centerX;
|
|
9076
|
-
this.worldY = skeleton.y + this.centerY;
|
|
9077
|
-
}
|
|
9078
|
-
transform(position, uv, light, dark) {
|
|
9079
|
-
let radAngle = this.angle * MathUtils.degreesToRadians;
|
|
9080
|
-
let x = position.x - this.worldX;
|
|
9081
|
-
let y = position.y - this.worldY;
|
|
9082
|
-
let dist = Math.sqrt(x * x + y * y);
|
|
9083
|
-
if (dist < this.radius) {
|
|
9084
|
-
let theta = _SwirlEffect.interpolation.apply(0, radAngle, (this.radius - dist) / this.radius);
|
|
9085
|
-
let cos = Math.cos(theta);
|
|
9086
|
-
let sin = Math.sin(theta);
|
|
9087
|
-
position.x = cos * x - sin * y + this.worldX;
|
|
9088
|
-
position.y = sin * x + cos * y + this.worldY;
|
|
9089
|
-
}
|
|
9090
|
-
}
|
|
9091
|
-
end() {
|
|
9092
|
-
}
|
|
9093
|
-
};
|
|
9094
|
-
var SwirlEffect = _SwirlEffect;
|
|
9095
|
-
SwirlEffect.interpolation = new PowOut(2);
|
|
9096
|
-
|
|
9097
9224
|
// spine-webgl/src/WebGL.ts
|
|
9098
9225
|
var ManagedWebGLRenderingContext = class {
|
|
9099
9226
|
constructor(canvasOrContext, contextConfig = { alpha: "true" }) {
|
|
9100
9227
|
this.restorables = new Array();
|
|
9101
|
-
if (!(canvasOrContext instanceof WebGLRenderingContext || typeof WebGL2RenderingContext !== "undefined" && canvasOrContext instanceof WebGL2RenderingContext))
|
|
9102
|
-
|
|
9103
|
-
|
|
9228
|
+
if (!(canvasOrContext instanceof WebGLRenderingContext || typeof WebGL2RenderingContext !== "undefined" && canvasOrContext instanceof WebGL2RenderingContext)) {
|
|
9229
|
+
let canvas = canvasOrContext;
|
|
9230
|
+
this.gl = canvas.getContext("webgl2", contextConfig) || canvas.getContext("webgl", contextConfig);
|
|
9231
|
+
this.canvas = canvas;
|
|
9232
|
+
canvas.addEventListener("webglcontextlost", (e) => {
|
|
9233
|
+
let event = e;
|
|
9234
|
+
if (e)
|
|
9235
|
+
e.preventDefault();
|
|
9236
|
+
});
|
|
9237
|
+
canvas.addEventListener("webglcontextrestored", (e) => {
|
|
9238
|
+
for (let i = 0, n = this.restorables.length; i < n; i++)
|
|
9239
|
+
this.restorables[i].restore();
|
|
9240
|
+
});
|
|
9241
|
+
} else {
|
|
9104
9242
|
this.gl = canvasOrContext;
|
|
9105
9243
|
this.canvas = this.gl.canvas;
|
|
9106
9244
|
}
|
|
9107
9245
|
}
|
|
9108
|
-
setupCanvas(canvas, contextConfig) {
|
|
9109
|
-
this.gl = canvas.getContext("webgl2", contextConfig) || canvas.getContext("webgl", contextConfig);
|
|
9110
|
-
this.canvas = canvas;
|
|
9111
|
-
canvas.addEventListener("webglcontextlost", (e) => {
|
|
9112
|
-
let event = e;
|
|
9113
|
-
if (e)
|
|
9114
|
-
e.preventDefault();
|
|
9115
|
-
});
|
|
9116
|
-
canvas.addEventListener("webglcontextrestored", (e) => {
|
|
9117
|
-
for (let i = 0, n = this.restorables.length; i < n; i++)
|
|
9118
|
-
this.restorables[i].restore();
|
|
9119
|
-
});
|
|
9120
|
-
}
|
|
9121
9246
|
addRestorable(restorable) {
|
|
9122
9247
|
this.restorables.push(restorable);
|
|
9123
9248
|
}
|
|
@@ -9254,7 +9379,7 @@ var spine = (() => {
|
|
|
9254
9379
|
|
|
9255
9380
|
// spine-webgl/src/AssetManager.ts
|
|
9256
9381
|
var AssetManager = class extends AssetManagerBase {
|
|
9257
|
-
constructor(context, pathPrefix = "", downloader =
|
|
9382
|
+
constructor(context, pathPrefix = "", downloader = new Downloader()) {
|
|
9258
9383
|
super((image) => {
|
|
9259
9384
|
return new GLTexture(context, image);
|
|
9260
9385
|
}, pathPrefix, downloader);
|
|
@@ -9563,7 +9688,6 @@ var spine = (() => {
|
|
|
9563
9688
|
return this.set(this.temp);
|
|
9564
9689
|
}
|
|
9565
9690
|
lookAt(position, direction, up) {
|
|
9566
|
-
_Matrix4.initTemps();
|
|
9567
9691
|
let xAxis = _Matrix4.xAxis, yAxis = _Matrix4.yAxis, zAxis = _Matrix4.zAxis;
|
|
9568
9692
|
zAxis.setFrom(direction).normalize();
|
|
9569
9693
|
xAxis.setFrom(direction).normalize();
|
|
@@ -9587,19 +9711,11 @@ var spine = (() => {
|
|
|
9587
9711
|
this.multiply(_Matrix4.tmpMatrix);
|
|
9588
9712
|
return this;
|
|
9589
9713
|
}
|
|
9590
|
-
static initTemps() {
|
|
9591
|
-
if (_Matrix4.xAxis === null)
|
|
9592
|
-
_Matrix4.xAxis = new Vector3();
|
|
9593
|
-
if (_Matrix4.yAxis === null)
|
|
9594
|
-
_Matrix4.yAxis = new Vector3();
|
|
9595
|
-
if (_Matrix4.zAxis === null)
|
|
9596
|
-
_Matrix4.zAxis = new Vector3();
|
|
9597
|
-
}
|
|
9598
9714
|
};
|
|
9599
9715
|
var Matrix42 = _Matrix4;
|
|
9600
|
-
Matrix42.xAxis =
|
|
9601
|
-
Matrix42.yAxis =
|
|
9602
|
-
Matrix42.zAxis =
|
|
9716
|
+
Matrix42.xAxis = new Vector3();
|
|
9717
|
+
Matrix42.yAxis = new Vector3();
|
|
9718
|
+
Matrix42.zAxis = new Vector3();
|
|
9603
9719
|
Matrix42.tmpMatrix = new _Matrix4();
|
|
9604
9720
|
|
|
9605
9721
|
// spine-webgl/src/Camera.ts
|
|
@@ -9736,6 +9852,8 @@ var spine = (() => {
|
|
|
9736
9852
|
if (!this.touch0 || !this.touch1) {
|
|
9737
9853
|
var touches = ev.changedTouches;
|
|
9738
9854
|
let nativeTouch = touches.item(0);
|
|
9855
|
+
if (!nativeTouch)
|
|
9856
|
+
return;
|
|
9739
9857
|
let rect = element.getBoundingClientRect();
|
|
9740
9858
|
let x = nativeTouch.clientX - rect.left;
|
|
9741
9859
|
let y = nativeTouch.clientY - rect.top;
|
|
@@ -9956,7 +10074,11 @@ var spine = (() => {
|
|
|
9956
10074
|
let gl = this.context.gl;
|
|
9957
10075
|
try {
|
|
9958
10076
|
this.vs = this.compileShader(gl.VERTEX_SHADER, this.vertexShader);
|
|
10077
|
+
if (!this.vs)
|
|
10078
|
+
throw new Error("Couldn't compile vertex shader.");
|
|
9959
10079
|
this.fs = this.compileShader(gl.FRAGMENT_SHADER, this.fragmentShader);
|
|
10080
|
+
if (!this.fs)
|
|
10081
|
+
throw new Error("Couldn#t compile fragment shader.");
|
|
9960
10082
|
this.program = this.compileProgram(this.vs, this.fs);
|
|
9961
10083
|
} catch (e) {
|
|
9962
10084
|
this.dispose();
|
|
@@ -9966,6 +10088,8 @@ var spine = (() => {
|
|
|
9966
10088
|
compileShader(type, source) {
|
|
9967
10089
|
let gl = this.context.gl;
|
|
9968
10090
|
let shader = gl.createShader(type);
|
|
10091
|
+
if (!shader)
|
|
10092
|
+
throw new Error("Couldn't create shader.");
|
|
9969
10093
|
gl.shaderSource(shader, source);
|
|
9970
10094
|
gl.compileShader(shader);
|
|
9971
10095
|
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
|
|
@@ -9979,6 +10103,8 @@ var spine = (() => {
|
|
|
9979
10103
|
compileProgram(vs, fs) {
|
|
9980
10104
|
let gl = this.context.gl;
|
|
9981
10105
|
let program = gl.createProgram();
|
|
10106
|
+
if (!program)
|
|
10107
|
+
throw new Error("Couldn't compile program.");
|
|
9982
10108
|
gl.attachShader(program, vs);
|
|
9983
10109
|
gl.attachShader(program, fs);
|
|
9984
10110
|
gl.linkProgram(program);
|
|
@@ -10031,6 +10157,8 @@ var spine = (() => {
|
|
|
10031
10157
|
}
|
|
10032
10158
|
getUniformLocation(uniform) {
|
|
10033
10159
|
let gl = this.context.gl;
|
|
10160
|
+
if (!this.program)
|
|
10161
|
+
throw new Error("Shader not compiled.");
|
|
10034
10162
|
let location = gl.getUniformLocation(this.program, uniform);
|
|
10035
10163
|
if (!location && !gl.isContextLost())
|
|
10036
10164
|
throw new Error(`Couldn't find location for uniform ${uniform}`);
|
|
@@ -10038,6 +10166,8 @@ var spine = (() => {
|
|
|
10038
10166
|
}
|
|
10039
10167
|
getAttributeLocation(attribute) {
|
|
10040
10168
|
let gl = this.context.gl;
|
|
10169
|
+
if (!this.program)
|
|
10170
|
+
throw new Error("Shader not compiled.");
|
|
10041
10171
|
let location = gl.getAttribLocation(this.program, attribute);
|
|
10042
10172
|
if (location == -1 && !gl.isContextLost())
|
|
10043
10173
|
throw new Error(`Couldn't find location for attribute ${attribute}`);
|
|
@@ -10169,8 +10299,10 @@ var spine = (() => {
|
|
|
10169
10299
|
var Mesh = class {
|
|
10170
10300
|
constructor(context, attributes, maxVertices, maxIndices) {
|
|
10171
10301
|
this.attributes = attributes;
|
|
10302
|
+
this.verticesBuffer = null;
|
|
10172
10303
|
this.verticesLength = 0;
|
|
10173
10304
|
this.dirtyVertices = false;
|
|
10305
|
+
this.indicesBuffer = null;
|
|
10174
10306
|
this.indicesLength = 0;
|
|
10175
10307
|
this.dirtyIndices = false;
|
|
10176
10308
|
this.elementsPerVertex = 0;
|
|
@@ -10345,11 +10477,13 @@ var spine = (() => {
|
|
|
10345
10477
|
// spine-webgl/src/PolygonBatcher.ts
|
|
10346
10478
|
var PolygonBatcher = class {
|
|
10347
10479
|
constructor(context, twoColorTint = true, maxVertices = 10920) {
|
|
10480
|
+
this.drawCalls = 0;
|
|
10348
10481
|
this.isDrawing = false;
|
|
10349
10482
|
this.shader = null;
|
|
10350
10483
|
this.lastTexture = null;
|
|
10351
10484
|
this.verticesLength = 0;
|
|
10352
10485
|
this.indicesLength = 0;
|
|
10486
|
+
this.cullWasEnabled = false;
|
|
10353
10487
|
if (maxVertices > 10920)
|
|
10354
10488
|
throw new Error("Can't have more than 10920 triangles per batch: " + maxVertices);
|
|
10355
10489
|
this.context = context instanceof ManagedWebGLRenderingContext ? context : new ManagedWebGLRenderingContext(context);
|
|
@@ -10370,6 +10504,9 @@ var spine = (() => {
|
|
|
10370
10504
|
let gl = this.context.gl;
|
|
10371
10505
|
gl.enable(gl.BLEND);
|
|
10372
10506
|
gl.blendFuncSeparate(this.srcColorBlend, this.dstBlend, this.srcAlphaBlend, this.dstBlend);
|
|
10507
|
+
this.cullWasEnabled = gl.isEnabled(gl.CULL_FACE);
|
|
10508
|
+
if (this.cullWasEnabled)
|
|
10509
|
+
gl.disable(gl.CULL_FACE);
|
|
10373
10510
|
}
|
|
10374
10511
|
setBlendMode(srcColorBlend, srcAlphaBlend, dstBlend) {
|
|
10375
10512
|
if (this.srcColorBlend == srcColorBlend && this.srcAlphaBlend == srcAlphaBlend && this.dstBlend == dstBlend)
|
|
@@ -10403,6 +10540,10 @@ var spine = (() => {
|
|
|
10403
10540
|
flush() {
|
|
10404
10541
|
if (this.verticesLength == 0)
|
|
10405
10542
|
return;
|
|
10543
|
+
if (!this.lastTexture)
|
|
10544
|
+
throw new Error("No texture set.");
|
|
10545
|
+
if (!this.shader)
|
|
10546
|
+
throw new Error("No shader set.");
|
|
10406
10547
|
this.lastTexture.bind();
|
|
10407
10548
|
this.mesh.draw(this.shader, this.context.gl.TRIANGLES);
|
|
10408
10549
|
this.verticesLength = 0;
|
|
@@ -10421,6 +10562,8 @@ var spine = (() => {
|
|
|
10421
10562
|
this.isDrawing = false;
|
|
10422
10563
|
let gl = this.context.gl;
|
|
10423
10564
|
gl.disable(gl.BLEND);
|
|
10565
|
+
if (this.cullWasEnabled)
|
|
10566
|
+
gl.enable(gl.CULL_FACE);
|
|
10424
10567
|
}
|
|
10425
10568
|
getDrawCalls() {
|
|
10426
10569
|
return this.drawCalls;
|
|
@@ -10436,6 +10579,7 @@ var spine = (() => {
|
|
|
10436
10579
|
this.isDrawing = false;
|
|
10437
10580
|
this.shapeType = ShapeType.Filled;
|
|
10438
10581
|
this.color = new Color(1, 1, 1, 1);
|
|
10582
|
+
this.shader = null;
|
|
10439
10583
|
this.vertexIndex = 0;
|
|
10440
10584
|
this.tmp = new Vector2();
|
|
10441
10585
|
if (maxVertices > 10920)
|
|
@@ -10473,30 +10617,30 @@ var spine = (() => {
|
|
|
10473
10617
|
setColorWith(r, g, b, a) {
|
|
10474
10618
|
this.color.set(r, g, b, a);
|
|
10475
10619
|
}
|
|
10476
|
-
point(x, y, color
|
|
10620
|
+
point(x, y, color) {
|
|
10477
10621
|
this.check(ShapeType.Point, 1);
|
|
10478
|
-
if (color
|
|
10622
|
+
if (!color)
|
|
10479
10623
|
color = this.color;
|
|
10480
10624
|
this.vertex(x, y, color);
|
|
10481
10625
|
}
|
|
10482
|
-
line(x, y, x2, y2, color
|
|
10626
|
+
line(x, y, x2, y2, color) {
|
|
10483
10627
|
this.check(ShapeType.Line, 2);
|
|
10484
10628
|
let vertices = this.mesh.getVertices();
|
|
10485
10629
|
let idx = this.vertexIndex;
|
|
10486
|
-
if (color
|
|
10630
|
+
if (!color)
|
|
10487
10631
|
color = this.color;
|
|
10488
10632
|
this.vertex(x, y, color);
|
|
10489
10633
|
this.vertex(x2, y2, color);
|
|
10490
10634
|
}
|
|
10491
|
-
triangle(filled, x, y, x2, y2, x3, y3, color
|
|
10635
|
+
triangle(filled, x, y, x2, y2, x3, y3, color, color2, color3) {
|
|
10492
10636
|
this.check(filled ? ShapeType.Filled : ShapeType.Line, 3);
|
|
10493
10637
|
let vertices = this.mesh.getVertices();
|
|
10494
10638
|
let idx = this.vertexIndex;
|
|
10495
|
-
if (color
|
|
10639
|
+
if (!color)
|
|
10496
10640
|
color = this.color;
|
|
10497
|
-
if (color2
|
|
10641
|
+
if (!color2)
|
|
10498
10642
|
color2 = this.color;
|
|
10499
|
-
if (color3
|
|
10643
|
+
if (!color3)
|
|
10500
10644
|
color3 = this.color;
|
|
10501
10645
|
if (filled) {
|
|
10502
10646
|
this.vertex(x, y, color);
|
|
@@ -10511,17 +10655,17 @@ var spine = (() => {
|
|
|
10511
10655
|
this.vertex(x, y, color2);
|
|
10512
10656
|
}
|
|
10513
10657
|
}
|
|
10514
|
-
quad(filled, x, y, x2, y2, x3, y3, x4, y4, color
|
|
10658
|
+
quad(filled, x, y, x2, y2, x3, y3, x4, y4, color, color2, color3, color4) {
|
|
10515
10659
|
this.check(filled ? ShapeType.Filled : ShapeType.Line, 3);
|
|
10516
10660
|
let vertices = this.mesh.getVertices();
|
|
10517
10661
|
let idx = this.vertexIndex;
|
|
10518
|
-
if (color
|
|
10662
|
+
if (!color)
|
|
10519
10663
|
color = this.color;
|
|
10520
|
-
if (color2
|
|
10664
|
+
if (!color2)
|
|
10521
10665
|
color2 = this.color;
|
|
10522
|
-
if (color3
|
|
10666
|
+
if (!color3)
|
|
10523
10667
|
color3 = this.color;
|
|
10524
|
-
if (color4
|
|
10668
|
+
if (!color4)
|
|
10525
10669
|
color4 = this.color;
|
|
10526
10670
|
if (filled) {
|
|
10527
10671
|
this.vertex(x, y, color);
|
|
@@ -10541,12 +10685,12 @@ var spine = (() => {
|
|
|
10541
10685
|
this.vertex(x, y, color);
|
|
10542
10686
|
}
|
|
10543
10687
|
}
|
|
10544
|
-
rect(filled, x, y, width, height, color
|
|
10688
|
+
rect(filled, x, y, width, height, color) {
|
|
10545
10689
|
this.quad(filled, x, y, x + width, y, x + width, y + height, x, y + height, color, color, color, color);
|
|
10546
10690
|
}
|
|
10547
|
-
rectLine(filled, x1, y1, x2, y2, width, color
|
|
10691
|
+
rectLine(filled, x1, y1, x2, y2, width, color) {
|
|
10548
10692
|
this.check(filled ? ShapeType.Filled : ShapeType.Line, 8);
|
|
10549
|
-
if (color
|
|
10693
|
+
if (!color)
|
|
10550
10694
|
color = this.color;
|
|
10551
10695
|
let t = this.tmp.set(y2 - y1, x1 - x2);
|
|
10552
10696
|
t.normalize();
|
|
@@ -10575,11 +10719,11 @@ var spine = (() => {
|
|
|
10575
10719
|
this.line(x - size, y - size, x + size, y + size);
|
|
10576
10720
|
this.line(x - size, y + size, x + size, y - size);
|
|
10577
10721
|
}
|
|
10578
|
-
polygon(polygonVertices, offset, count, color
|
|
10722
|
+
polygon(polygonVertices, offset, count, color) {
|
|
10579
10723
|
if (count < 3)
|
|
10580
10724
|
throw new Error("Polygon must contain at least 3 vertices");
|
|
10581
10725
|
this.check(ShapeType.Line, count * 2);
|
|
10582
|
-
if (color
|
|
10726
|
+
if (color)
|
|
10583
10727
|
color = this.color;
|
|
10584
10728
|
let vertices = this.mesh.getVertices();
|
|
10585
10729
|
let idx = this.vertexIndex;
|
|
@@ -10604,12 +10748,12 @@ var spine = (() => {
|
|
|
10604
10748
|
this.vertex(x2, y2, color);
|
|
10605
10749
|
}
|
|
10606
10750
|
}
|
|
10607
|
-
circle(filled, x, y, radius, color
|
|
10608
|
-
if (segments
|
|
10751
|
+
circle(filled, x, y, radius, color, segments = 0) {
|
|
10752
|
+
if (segments == 0)
|
|
10609
10753
|
segments = Math.max(1, 6 * MathUtils.cbrt(radius) | 0);
|
|
10610
10754
|
if (segments <= 0)
|
|
10611
10755
|
throw new Error("segments must be > 0.");
|
|
10612
|
-
if (color
|
|
10756
|
+
if (!color)
|
|
10613
10757
|
color = this.color;
|
|
10614
10758
|
let angle = 2 * MathUtils.PI / segments;
|
|
10615
10759
|
let cos = Math.cos(angle);
|
|
@@ -10644,9 +10788,9 @@ var spine = (() => {
|
|
|
10644
10788
|
cy = 0;
|
|
10645
10789
|
this.vertex(x + cx, y + cy, color);
|
|
10646
10790
|
}
|
|
10647
|
-
curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color
|
|
10791
|
+
curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color) {
|
|
10648
10792
|
this.check(ShapeType.Line, segments * 2 + 2);
|
|
10649
|
-
if (color
|
|
10793
|
+
if (color)
|
|
10650
10794
|
color = this.color;
|
|
10651
10795
|
let subdiv_step = 1 / segments;
|
|
10652
10796
|
let subdiv_step2 = subdiv_step * subdiv_step;
|
|
@@ -10702,6 +10846,8 @@ var spine = (() => {
|
|
|
10702
10846
|
flush() {
|
|
10703
10847
|
if (this.vertexIndex == 0)
|
|
10704
10848
|
return;
|
|
10849
|
+
if (!this.shader)
|
|
10850
|
+
throw new Error("No shader set.");
|
|
10705
10851
|
this.mesh.setVerticesLength(this.vertexIndex);
|
|
10706
10852
|
this.mesh.draw(this.shader, this.shapeType);
|
|
10707
10853
|
this.vertexIndex = 0;
|
|
@@ -10756,7 +10902,7 @@ var spine = (() => {
|
|
|
10756
10902
|
this.vertices = Utils.newFloatArray(2 * 1024);
|
|
10757
10903
|
this.context = context instanceof ManagedWebGLRenderingContext ? context : new ManagedWebGLRenderingContext(context);
|
|
10758
10904
|
}
|
|
10759
|
-
draw(shapes, skeleton, ignoredBones
|
|
10905
|
+
draw(shapes, skeleton, ignoredBones) {
|
|
10760
10906
|
let skeletonX = skeleton.x;
|
|
10761
10907
|
let skeletonY = skeleton.y;
|
|
10762
10908
|
let gl = this.context.gl;
|
|
@@ -10933,12 +11079,11 @@ var spine = (() => {
|
|
|
10933
11079
|
var _SkeletonRenderer = class {
|
|
10934
11080
|
constructor(context, twoColorTint = true) {
|
|
10935
11081
|
this.premultipliedAlpha = false;
|
|
10936
|
-
this.vertexEffect = null;
|
|
10937
11082
|
this.tempColor = new Color();
|
|
10938
11083
|
this.tempColor2 = new Color();
|
|
10939
11084
|
this.vertexSize = 2 + 2 + 4;
|
|
10940
11085
|
this.twoColorTint = false;
|
|
10941
|
-
this.renderable = new Renderable(
|
|
11086
|
+
this.renderable = new Renderable([], 0, 0);
|
|
10942
11087
|
this.clipper = new SkeletonClipping();
|
|
10943
11088
|
this.temp = new Vector2();
|
|
10944
11089
|
this.temp2 = new Vector2();
|
|
@@ -10959,10 +11104,10 @@ var spine = (() => {
|
|
|
10959
11104
|
let tempLight = this.temp3;
|
|
10960
11105
|
let tempDark = this.temp4;
|
|
10961
11106
|
let renderable = this.renderable;
|
|
10962
|
-
let uvs
|
|
10963
|
-
let triangles
|
|
11107
|
+
let uvs;
|
|
11108
|
+
let triangles;
|
|
10964
11109
|
let drawOrder = skeleton.drawOrder;
|
|
10965
|
-
let attachmentColor
|
|
11110
|
+
let attachmentColor;
|
|
10966
11111
|
let skeletonColor = skeleton.color;
|
|
10967
11112
|
let vertexSize = twoColorTint ? 12 : 8;
|
|
10968
11113
|
let inRange = false;
|
|
@@ -10986,7 +11131,7 @@ var spine = (() => {
|
|
|
10986
11131
|
inRange = false;
|
|
10987
11132
|
}
|
|
10988
11133
|
let attachment = slot.getAttachment();
|
|
10989
|
-
let texture
|
|
11134
|
+
let texture;
|
|
10990
11135
|
if (attachment instanceof RegionAttachment) {
|
|
10991
11136
|
let region = attachment;
|
|
10992
11137
|
renderable.vertices = this.vertices;
|
|
@@ -11052,120 +11197,30 @@ var spine = (() => {
|
|
|
11052
11197
|
clipper.clipTriangles(renderable.vertices, renderable.numFloats, triangles, triangles.length, uvs, finalColor, darkColor, twoColorTint);
|
|
11053
11198
|
let clippedVertices = new Float32Array(clipper.clippedVertices);
|
|
11054
11199
|
let clippedTriangles = clipper.clippedTriangles;
|
|
11055
|
-
if (this.vertexEffect) {
|
|
11056
|
-
let vertexEffect = this.vertexEffect;
|
|
11057
|
-
let verts = clippedVertices;
|
|
11058
|
-
if (!twoColorTint) {
|
|
11059
|
-
for (let v = 0, n2 = clippedVertices.length; v < n2; v += vertexSize) {
|
|
11060
|
-
tempPos.x = verts[v];
|
|
11061
|
-
tempPos.y = verts[v + 1];
|
|
11062
|
-
tempLight.set(verts[v + 2], verts[v + 3], verts[v + 4], verts[v + 5]);
|
|
11063
|
-
tempUv.x = verts[v + 6];
|
|
11064
|
-
tempUv.y = verts[v + 7];
|
|
11065
|
-
tempDark.set(0, 0, 0, 0);
|
|
11066
|
-
vertexEffect.transform(tempPos, tempUv, tempLight, tempDark);
|
|
11067
|
-
verts[v] = tempPos.x;
|
|
11068
|
-
verts[v + 1] = tempPos.y;
|
|
11069
|
-
verts[v + 2] = tempLight.r;
|
|
11070
|
-
verts[v + 3] = tempLight.g;
|
|
11071
|
-
verts[v + 4] = tempLight.b;
|
|
11072
|
-
verts[v + 5] = tempLight.a;
|
|
11073
|
-
verts[v + 6] = tempUv.x;
|
|
11074
|
-
verts[v + 7] = tempUv.y;
|
|
11075
|
-
}
|
|
11076
|
-
} else {
|
|
11077
|
-
for (let v = 0, n2 = clippedVertices.length; v < n2; v += vertexSize) {
|
|
11078
|
-
tempPos.x = verts[v];
|
|
11079
|
-
tempPos.y = verts[v + 1];
|
|
11080
|
-
tempLight.set(verts[v + 2], verts[v + 3], verts[v + 4], verts[v + 5]);
|
|
11081
|
-
tempUv.x = verts[v + 6];
|
|
11082
|
-
tempUv.y = verts[v + 7];
|
|
11083
|
-
tempDark.set(verts[v + 8], verts[v + 9], verts[v + 10], verts[v + 11]);
|
|
11084
|
-
vertexEffect.transform(tempPos, tempUv, tempLight, tempDark);
|
|
11085
|
-
verts[v] = tempPos.x;
|
|
11086
|
-
verts[v + 1] = tempPos.y;
|
|
11087
|
-
verts[v + 2] = tempLight.r;
|
|
11088
|
-
verts[v + 3] = tempLight.g;
|
|
11089
|
-
verts[v + 4] = tempLight.b;
|
|
11090
|
-
verts[v + 5] = tempLight.a;
|
|
11091
|
-
verts[v + 6] = tempUv.x;
|
|
11092
|
-
verts[v + 7] = tempUv.y;
|
|
11093
|
-
verts[v + 8] = tempDark.r;
|
|
11094
|
-
verts[v + 9] = tempDark.g;
|
|
11095
|
-
verts[v + 10] = tempDark.b;
|
|
11096
|
-
verts[v + 11] = tempDark.a;
|
|
11097
|
-
}
|
|
11098
|
-
}
|
|
11099
|
-
}
|
|
11100
11200
|
batcher.draw(texture, clippedVertices, clippedTriangles);
|
|
11101
11201
|
} else {
|
|
11102
11202
|
let verts = renderable.vertices;
|
|
11103
|
-
if (
|
|
11104
|
-
let
|
|
11105
|
-
|
|
11106
|
-
|
|
11107
|
-
|
|
11108
|
-
|
|
11109
|
-
|
|
11110
|
-
|
|
11111
|
-
tempLight.setFromColor(finalColor);
|
|
11112
|
-
tempDark.set(0, 0, 0, 0);
|
|
11113
|
-
vertexEffect.transform(tempPos, tempUv, tempLight, tempDark);
|
|
11114
|
-
verts[v] = tempPos.x;
|
|
11115
|
-
verts[v + 1] = tempPos.y;
|
|
11116
|
-
verts[v + 2] = tempLight.r;
|
|
11117
|
-
verts[v + 3] = tempLight.g;
|
|
11118
|
-
verts[v + 4] = tempLight.b;
|
|
11119
|
-
verts[v + 5] = tempLight.a;
|
|
11120
|
-
verts[v + 6] = tempUv.x;
|
|
11121
|
-
verts[v + 7] = tempUv.y;
|
|
11122
|
-
}
|
|
11123
|
-
} else {
|
|
11124
|
-
for (let v = 0, u = 0, n2 = renderable.numFloats; v < n2; v += vertexSize, u += 2) {
|
|
11125
|
-
tempPos.x = verts[v];
|
|
11126
|
-
tempPos.y = verts[v + 1];
|
|
11127
|
-
tempUv.x = uvs[u];
|
|
11128
|
-
tempUv.y = uvs[u + 1];
|
|
11129
|
-
tempLight.setFromColor(finalColor);
|
|
11130
|
-
tempDark.setFromColor(darkColor);
|
|
11131
|
-
vertexEffect.transform(tempPos, tempUv, tempLight, tempDark);
|
|
11132
|
-
verts[v] = tempPos.x;
|
|
11133
|
-
verts[v + 1] = tempPos.y;
|
|
11134
|
-
verts[v + 2] = tempLight.r;
|
|
11135
|
-
verts[v + 3] = tempLight.g;
|
|
11136
|
-
verts[v + 4] = tempLight.b;
|
|
11137
|
-
verts[v + 5] = tempLight.a;
|
|
11138
|
-
verts[v + 6] = tempUv.x;
|
|
11139
|
-
verts[v + 7] = tempUv.y;
|
|
11140
|
-
verts[v + 8] = tempDark.r;
|
|
11141
|
-
verts[v + 9] = tempDark.g;
|
|
11142
|
-
verts[v + 10] = tempDark.b;
|
|
11143
|
-
verts[v + 11] = tempDark.a;
|
|
11144
|
-
}
|
|
11203
|
+
if (!twoColorTint) {
|
|
11204
|
+
for (let v = 2, u = 0, n2 = renderable.numFloats; v < n2; v += vertexSize, u += 2) {
|
|
11205
|
+
verts[v] = finalColor.r;
|
|
11206
|
+
verts[v + 1] = finalColor.g;
|
|
11207
|
+
verts[v + 2] = finalColor.b;
|
|
11208
|
+
verts[v + 3] = finalColor.a;
|
|
11209
|
+
verts[v + 4] = uvs[u];
|
|
11210
|
+
verts[v + 5] = uvs[u + 1];
|
|
11145
11211
|
}
|
|
11146
11212
|
} else {
|
|
11147
|
-
|
|
11148
|
-
|
|
11149
|
-
|
|
11150
|
-
|
|
11151
|
-
|
|
11152
|
-
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
|
|
11157
|
-
|
|
11158
|
-
verts[v] = finalColor.r;
|
|
11159
|
-
verts[v + 1] = finalColor.g;
|
|
11160
|
-
verts[v + 2] = finalColor.b;
|
|
11161
|
-
verts[v + 3] = finalColor.a;
|
|
11162
|
-
verts[v + 4] = uvs[u];
|
|
11163
|
-
verts[v + 5] = uvs[u + 1];
|
|
11164
|
-
verts[v + 6] = darkColor.r;
|
|
11165
|
-
verts[v + 7] = darkColor.g;
|
|
11166
|
-
verts[v + 8] = darkColor.b;
|
|
11167
|
-
verts[v + 9] = darkColor.a;
|
|
11168
|
-
}
|
|
11213
|
+
for (let v = 2, u = 0, n2 = renderable.numFloats; v < n2; v += vertexSize, u += 2) {
|
|
11214
|
+
verts[v] = finalColor.r;
|
|
11215
|
+
verts[v + 1] = finalColor.g;
|
|
11216
|
+
verts[v + 2] = finalColor.b;
|
|
11217
|
+
verts[v + 3] = finalColor.a;
|
|
11218
|
+
verts[v + 4] = uvs[u];
|
|
11219
|
+
verts[v + 5] = uvs[u + 1];
|
|
11220
|
+
verts[v + 6] = darkColor.r;
|
|
11221
|
+
verts[v + 7] = darkColor.g;
|
|
11222
|
+
verts[v + 8] = darkColor.b;
|
|
11223
|
+
verts[v + 9] = darkColor.a;
|
|
11169
11224
|
}
|
|
11170
11225
|
}
|
|
11171
11226
|
let view = renderable.vertices.subarray(0, renderable.numFloats);
|
|
@@ -11220,6 +11275,7 @@ var spine = (() => {
|
|
|
11220
11275
|
var SceneRenderer = class {
|
|
11221
11276
|
constructor(canvas, context, twoColorTint = true) {
|
|
11222
11277
|
this.twoColorTint = false;
|
|
11278
|
+
this.activeRenderer = null;
|
|
11223
11279
|
this.canvas = canvas;
|
|
11224
11280
|
this.context = context instanceof ManagedWebGLRenderingContext ? context : new ManagedWebGLRenderingContext(context);
|
|
11225
11281
|
this.twoColorTint = twoColorTint;
|
|
@@ -11247,14 +11303,14 @@ var spine = (() => {
|
|
|
11247
11303
|
this.skeletonRenderer.premultipliedAlpha = premultipliedAlpha;
|
|
11248
11304
|
this.skeletonRenderer.draw(this.batcher, skeleton, slotRangeStart, slotRangeEnd);
|
|
11249
11305
|
}
|
|
11250
|
-
drawSkeletonDebug(skeleton, premultipliedAlpha = false, ignoredBones
|
|
11306
|
+
drawSkeletonDebug(skeleton, premultipliedAlpha = false, ignoredBones) {
|
|
11251
11307
|
this.enableRenderer(this.shapes);
|
|
11252
11308
|
this.skeletonDebugRenderer.premultipliedAlpha = premultipliedAlpha;
|
|
11253
11309
|
this.skeletonDebugRenderer.draw(this.shapes, skeleton, ignoredBones);
|
|
11254
11310
|
}
|
|
11255
|
-
drawTexture(texture, x, y, width, height, color
|
|
11311
|
+
drawTexture(texture, x, y, width, height, color) {
|
|
11256
11312
|
this.enableRenderer(this.batcher);
|
|
11257
|
-
if (color
|
|
11313
|
+
if (!color)
|
|
11258
11314
|
color = WHITE;
|
|
11259
11315
|
var i = 0;
|
|
11260
11316
|
quad[i++] = x;
|
|
@@ -11315,9 +11371,9 @@ var spine = (() => {
|
|
|
11315
11371
|
}
|
|
11316
11372
|
this.batcher.draw(texture, quad, QUAD_TRIANGLES);
|
|
11317
11373
|
}
|
|
11318
|
-
drawTextureUV(texture, x, y, width, height, u, v, u2, v2, color
|
|
11374
|
+
drawTextureUV(texture, x, y, width, height, u, v, u2, v2, color) {
|
|
11319
11375
|
this.enableRenderer(this.batcher);
|
|
11320
|
-
if (color
|
|
11376
|
+
if (!color)
|
|
11321
11377
|
color = WHITE;
|
|
11322
11378
|
var i = 0;
|
|
11323
11379
|
quad[i++] = x;
|
|
@@ -11378,9 +11434,9 @@ var spine = (() => {
|
|
|
11378
11434
|
}
|
|
11379
11435
|
this.batcher.draw(texture, quad, QUAD_TRIANGLES);
|
|
11380
11436
|
}
|
|
11381
|
-
drawTextureRotated(texture, x, y, width, height, pivotX, pivotY, angle, color
|
|
11437
|
+
drawTextureRotated(texture, x, y, width, height, pivotX, pivotY, angle, color) {
|
|
11382
11438
|
this.enableRenderer(this.batcher);
|
|
11383
|
-
if (color
|
|
11439
|
+
if (!color)
|
|
11384
11440
|
color = WHITE;
|
|
11385
11441
|
let worldOriginX = x + pivotX;
|
|
11386
11442
|
let worldOriginY = y + pivotY;
|
|
@@ -11492,9 +11548,9 @@ var spine = (() => {
|
|
|
11492
11548
|
}
|
|
11493
11549
|
this.batcher.draw(texture, quad, QUAD_TRIANGLES);
|
|
11494
11550
|
}
|
|
11495
|
-
drawRegion(region, x, y, width, height, color
|
|
11551
|
+
drawRegion(region, x, y, width, height, color) {
|
|
11496
11552
|
this.enableRenderer(this.batcher);
|
|
11497
|
-
if (color
|
|
11553
|
+
if (!color)
|
|
11498
11554
|
color = WHITE;
|
|
11499
11555
|
var i = 0;
|
|
11500
11556
|
quad[i++] = x;
|
|
@@ -11555,35 +11611,35 @@ var spine = (() => {
|
|
|
11555
11611
|
}
|
|
11556
11612
|
this.batcher.draw(region.page.texture, quad, QUAD_TRIANGLES);
|
|
11557
11613
|
}
|
|
11558
|
-
line(x, y, x2, y2, color
|
|
11614
|
+
line(x, y, x2, y2, color, color2) {
|
|
11559
11615
|
this.enableRenderer(this.shapes);
|
|
11560
11616
|
this.shapes.line(x, y, x2, y2, color);
|
|
11561
11617
|
}
|
|
11562
|
-
triangle(filled, x, y, x2, y2, x3, y3, color
|
|
11618
|
+
triangle(filled, x, y, x2, y2, x3, y3, color, color2, color3) {
|
|
11563
11619
|
this.enableRenderer(this.shapes);
|
|
11564
11620
|
this.shapes.triangle(filled, x, y, x2, y2, x3, y3, color, color2, color3);
|
|
11565
11621
|
}
|
|
11566
|
-
quad(filled, x, y, x2, y2, x3, y3, x4, y4, color
|
|
11622
|
+
quad(filled, x, y, x2, y2, x3, y3, x4, y4, color, color2, color3, color4) {
|
|
11567
11623
|
this.enableRenderer(this.shapes);
|
|
11568
11624
|
this.shapes.quad(filled, x, y, x2, y2, x3, y3, x4, y4, color, color2, color3, color4);
|
|
11569
11625
|
}
|
|
11570
|
-
rect(filled, x, y, width, height, color
|
|
11626
|
+
rect(filled, x, y, width, height, color) {
|
|
11571
11627
|
this.enableRenderer(this.shapes);
|
|
11572
11628
|
this.shapes.rect(filled, x, y, width, height, color);
|
|
11573
11629
|
}
|
|
11574
|
-
rectLine(filled, x1, y1, x2, y2, width, color
|
|
11630
|
+
rectLine(filled, x1, y1, x2, y2, width, color) {
|
|
11575
11631
|
this.enableRenderer(this.shapes);
|
|
11576
11632
|
this.shapes.rectLine(filled, x1, y1, x2, y2, width, color);
|
|
11577
11633
|
}
|
|
11578
|
-
polygon(polygonVertices, offset, count, color
|
|
11634
|
+
polygon(polygonVertices, offset, count, color) {
|
|
11579
11635
|
this.enableRenderer(this.shapes);
|
|
11580
11636
|
this.shapes.polygon(polygonVertices, offset, count, color);
|
|
11581
11637
|
}
|
|
11582
|
-
circle(filled, x, y, radius, color
|
|
11638
|
+
circle(filled, x, y, radius, color, segments = 0) {
|
|
11583
11639
|
this.enableRenderer(this.shapes);
|
|
11584
11640
|
this.shapes.circle(filled, x, y, radius, color, segments);
|
|
11585
11641
|
}
|
|
11586
|
-
curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color
|
|
11642
|
+
curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color) {
|
|
11587
11643
|
this.enableRenderer(this.shapes);
|
|
11588
11644
|
this.shapes.curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color);
|
|
11589
11645
|
}
|
|
@@ -11679,8 +11735,9 @@ var spine = (() => {
|
|
|
11679
11735
|
}
|
|
11680
11736
|
}
|
|
11681
11737
|
dispose() {
|
|
11682
|
-
|
|
11683
|
-
this.
|
|
11738
|
+
var _a, _b;
|
|
11739
|
+
(_a = this.logo) == null ? void 0 : _a.dispose();
|
|
11740
|
+
(_b = this.spinner) == null ? void 0 : _b.dispose();
|
|
11684
11741
|
}
|
|
11685
11742
|
draw(complete = false) {
|
|
11686
11743
|
if (loaded < 2 || complete && this.fadeOut > FADE_OUT)
|
|
@@ -11726,7 +11783,8 @@ var spine = (() => {
|
|
|
11726
11783
|
renderer.camera.zoom = Math.max(1, spinnerSize / canvas.height);
|
|
11727
11784
|
renderer.begin();
|
|
11728
11785
|
renderer.drawTexture(this.logo, (canvas.width - logoWidth) / 2, (canvas.height - logoHeight) / 2, logoWidth, logoHeight, tempColor);
|
|
11729
|
-
|
|
11786
|
+
if (this.spinner)
|
|
11787
|
+
renderer.drawTextureRotated(this.spinner, (canvas.width - spinnerSize) / 2, (canvas.height - spinnerSize) / 2, spinnerSize, spinnerSize, spinnerSize / 2, spinnerSize / 2, this.angle, tempColor);
|
|
11730
11788
|
renderer.end();
|
|
11731
11789
|
}
|
|
11732
11790
|
};
|
|
@@ -11737,9 +11795,9 @@ var spine = (() => {
|
|
|
11737
11795
|
var SpineCanvas = class {
|
|
11738
11796
|
constructor(canvas, config) {
|
|
11739
11797
|
this.time = new TimeKeeper();
|
|
11740
|
-
if (config.pathPrefix
|
|
11798
|
+
if (!config.pathPrefix)
|
|
11741
11799
|
config.pathPrefix = "";
|
|
11742
|
-
if (config.app
|
|
11800
|
+
if (!config.app)
|
|
11743
11801
|
config.app = {
|
|
11744
11802
|
loadAssets: () => {
|
|
11745
11803
|
},
|
|
@@ -11752,7 +11810,7 @@ var spine = (() => {
|
|
|
11752
11810
|
error: () => {
|
|
11753
11811
|
}
|
|
11754
11812
|
};
|
|
11755
|
-
if (config.webglConfig
|
|
11813
|
+
if (config.webglConfig)
|
|
11756
11814
|
config.webglConfig = { alpha: true };
|
|
11757
11815
|
this.htmlCanvas = canvas;
|
|
11758
11816
|
this.context = new ManagedWebGLRenderingContext(canvas, config.webglConfig);
|
|
@@ -11760,19 +11818,24 @@ var spine = (() => {
|
|
|
11760
11818
|
this.gl = this.context.gl;
|
|
11761
11819
|
this.assetManager = new AssetManager(this.context, config.pathPrefix);
|
|
11762
11820
|
this.input = new Input(canvas);
|
|
11763
|
-
config.app.loadAssets
|
|
11821
|
+
if (config.app.loadAssets)
|
|
11822
|
+
config.app.loadAssets(this);
|
|
11764
11823
|
let loop = () => {
|
|
11765
11824
|
requestAnimationFrame(loop);
|
|
11766
11825
|
this.time.update();
|
|
11767
|
-
config.app.update
|
|
11768
|
-
|
|
11826
|
+
if (config.app.update)
|
|
11827
|
+
config.app.update(this, this.time.delta);
|
|
11828
|
+
if (config.app.render)
|
|
11829
|
+
config.app.render(this);
|
|
11769
11830
|
};
|
|
11770
11831
|
let waitForAssets = () => {
|
|
11771
11832
|
if (this.assetManager.isLoadingComplete()) {
|
|
11772
11833
|
if (this.assetManager.hasErrors()) {
|
|
11773
|
-
config.app.error
|
|
11834
|
+
if (config.app.error)
|
|
11835
|
+
config.app.error(this, this.assetManager.getErrors());
|
|
11774
11836
|
} else {
|
|
11775
|
-
config.app.initialize
|
|
11837
|
+
if (config.app.initialize)
|
|
11838
|
+
config.app.initialize(this);
|
|
11776
11839
|
loop();
|
|
11777
11840
|
}
|
|
11778
11841
|
return;
|