@esotericsoftware/spine-webgl 4.1.16 → 4.1.17
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.js +7 -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 -1
- package/dist/SkeletonRenderer.js +6 -6
- 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 +462 -283
- package/dist/iife/spine-webgl.js.map +2 -2
- package/dist/iife/spine-webgl.min.js +26 -26
- package/package.json +2 -2
package/dist/iife/spine-webgl.js
CHANGED
|
@@ -555,7 +555,7 @@ var spine = (() => {
|
|
|
555
555
|
super(name);
|
|
556
556
|
this.id = _VertexAttachment.nextID++;
|
|
557
557
|
this.bones = null;
|
|
558
|
-
this.vertices =
|
|
558
|
+
this.vertices = [];
|
|
559
559
|
this.worldVerticesLength = 0;
|
|
560
560
|
this.timelineAttahment = this;
|
|
561
561
|
}
|
|
@@ -626,8 +626,7 @@ var spine = (() => {
|
|
|
626
626
|
if (this.vertices) {
|
|
627
627
|
attachment.vertices = Utils.newFloatArray(this.vertices.length);
|
|
628
628
|
Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);
|
|
629
|
-
}
|
|
630
|
-
attachment.vertices = null;
|
|
629
|
+
}
|
|
631
630
|
attachment.worldVerticesLength = this.worldVerticesLength;
|
|
632
631
|
attachment.timelineAttahment = this.timelineAttahment;
|
|
633
632
|
}
|
|
@@ -701,8 +700,8 @@ var spine = (() => {
|
|
|
701
700
|
// spine-core/src/Animation.ts
|
|
702
701
|
var Animation = class {
|
|
703
702
|
constructor(name, timelines, duration) {
|
|
704
|
-
this.timelines =
|
|
705
|
-
this.timelineIds =
|
|
703
|
+
this.timelines = [];
|
|
704
|
+
this.timelineIds = new StringSet();
|
|
706
705
|
if (!name)
|
|
707
706
|
throw new Error("name cannot be null.");
|
|
708
707
|
this.name = name;
|
|
@@ -713,7 +712,7 @@ var spine = (() => {
|
|
|
713
712
|
if (!timelines)
|
|
714
713
|
throw new Error("timelines cannot be null.");
|
|
715
714
|
this.timelines = timelines;
|
|
716
|
-
this.timelineIds
|
|
715
|
+
this.timelineIds.clear();
|
|
717
716
|
for (var i = 0; i < timelines.length; i++)
|
|
718
717
|
this.timelineIds.addAll(timelines[i].getPropertyIds());
|
|
719
718
|
}
|
|
@@ -772,8 +771,6 @@ var spine = (() => {
|
|
|
772
771
|
};
|
|
773
772
|
var Timeline = class {
|
|
774
773
|
constructor(frameCount, propertyIds) {
|
|
775
|
-
this.propertyIds = null;
|
|
776
|
-
this.frames = null;
|
|
777
774
|
this.propertyIds = propertyIds;
|
|
778
775
|
this.frames = Utils.newFloatArray(frameCount * this.getFrameEntries());
|
|
779
776
|
}
|
|
@@ -807,7 +804,6 @@ var spine = (() => {
|
|
|
807
804
|
var CurveTimeline = class extends Timeline {
|
|
808
805
|
constructor(frameCount, bezierCount, propertyIds) {
|
|
809
806
|
super(frameCount, propertyIds);
|
|
810
|
-
this.curves = null;
|
|
811
807
|
this.curves = Utils.newFloatArray(frameCount + bezierCount * 18);
|
|
812
808
|
this.curves[frameCount - 1] = 1;
|
|
813
809
|
}
|
|
@@ -1867,8 +1863,6 @@ var spine = (() => {
|
|
|
1867
1863
|
Property.deform + "|" + slotIndex + "|" + attachment.id
|
|
1868
1864
|
]);
|
|
1869
1865
|
this.slotIndex = 0;
|
|
1870
|
-
this.attachment = null;
|
|
1871
|
-
this.vertices = null;
|
|
1872
1866
|
this.slotIndex = slotIndex;
|
|
1873
1867
|
this.attachment = attachment;
|
|
1874
1868
|
this.vertices = new Array(frameCount);
|
|
@@ -1931,6 +1925,8 @@ var spine = (() => {
|
|
|
1931
1925
|
if (!slot.bone.active)
|
|
1932
1926
|
return;
|
|
1933
1927
|
let slotAttachment = slot.getAttachment();
|
|
1928
|
+
if (!slotAttachment)
|
|
1929
|
+
return;
|
|
1934
1930
|
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttahment != this.attachment)
|
|
1935
1931
|
return;
|
|
1936
1932
|
let deform = slot.deform;
|
|
@@ -2085,7 +2081,6 @@ var spine = (() => {
|
|
|
2085
2081
|
var _EventTimeline = class extends Timeline {
|
|
2086
2082
|
constructor(frameCount) {
|
|
2087
2083
|
super(frameCount, _EventTimeline.propertyIds);
|
|
2088
|
-
this.events = null;
|
|
2089
2084
|
this.events = new Array(frameCount);
|
|
2090
2085
|
}
|
|
2091
2086
|
getFrameCount() {
|
|
@@ -2128,7 +2123,6 @@ var spine = (() => {
|
|
|
2128
2123
|
var _DrawOrderTimeline = class extends Timeline {
|
|
2129
2124
|
constructor(frameCount) {
|
|
2130
2125
|
super(frameCount, _DrawOrderTimeline.propertyIds);
|
|
2131
|
-
this.drawOrders = null;
|
|
2132
2126
|
this.drawOrders = new Array(frameCount);
|
|
2133
2127
|
}
|
|
2134
2128
|
getFrameCount() {
|
|
@@ -2149,7 +2143,8 @@ var spine = (() => {
|
|
|
2149
2143
|
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2150
2144
|
return;
|
|
2151
2145
|
}
|
|
2152
|
-
let
|
|
2146
|
+
let idx = Timeline.search1(this.frames, time);
|
|
2147
|
+
let drawOrderToSetupIndex = this.drawOrders[idx];
|
|
2153
2148
|
if (!drawOrderToSetupIndex)
|
|
2154
2149
|
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2155
2150
|
else {
|
|
@@ -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,9 +3830,8 @@ 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
3836
|
copy.timelineAttahment = this.timelineAttahment;
|
|
3838
3837
|
copy.setParentMesh(this.parentMesh ? this.parentMesh : this);
|
|
@@ -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++;
|
|
@@ -4439,7 +4436,9 @@ var spine = (() => {
|
|
|
4439
4436
|
setRawDataURI(path, data) {
|
|
4440
4437
|
this.downloader.rawDataUris[this.pathPrefix + path] = data;
|
|
4441
4438
|
}
|
|
4442
|
-
loadBinary(path, success =
|
|
4439
|
+
loadBinary(path, success = () => {
|
|
4440
|
+
}, error = () => {
|
|
4441
|
+
}) {
|
|
4443
4442
|
path = this.start(path);
|
|
4444
4443
|
this.downloader.downloadBinary(path, (data) => {
|
|
4445
4444
|
this.success(success, path, data);
|
|
@@ -4447,7 +4446,9 @@ var spine = (() => {
|
|
|
4447
4446
|
this.error(error, path, `Couldn't load binary ${path}: status ${status}, ${responseText}`);
|
|
4448
4447
|
});
|
|
4449
4448
|
}
|
|
4450
|
-
loadText(path, success =
|
|
4449
|
+
loadText(path, success = () => {
|
|
4450
|
+
}, error = () => {
|
|
4451
|
+
}) {
|
|
4451
4452
|
path = this.start(path);
|
|
4452
4453
|
this.downloader.downloadText(path, (data) => {
|
|
4453
4454
|
this.success(success, path, data);
|
|
@@ -4455,7 +4456,9 @@ var spine = (() => {
|
|
|
4455
4456
|
this.error(error, path, `Couldn't load text ${path}: status ${status}, ${responseText}`);
|
|
4456
4457
|
});
|
|
4457
4458
|
}
|
|
4458
|
-
loadJson(path, success =
|
|
4459
|
+
loadJson(path, success = () => {
|
|
4460
|
+
}, error = () => {
|
|
4461
|
+
}) {
|
|
4459
4462
|
path = this.start(path);
|
|
4460
4463
|
this.downloader.downloadJson(path, (data) => {
|
|
4461
4464
|
this.success(success, path, data);
|
|
@@ -4463,7 +4466,9 @@ var spine = (() => {
|
|
|
4463
4466
|
this.error(error, path, `Couldn't load JSON ${path}: status ${status}, ${responseText}`);
|
|
4464
4467
|
});
|
|
4465
4468
|
}
|
|
4466
|
-
loadTexture(path, success =
|
|
4469
|
+
loadTexture(path, success = () => {
|
|
4470
|
+
}, error = () => {
|
|
4471
|
+
}) {
|
|
4467
4472
|
path = this.start(path);
|
|
4468
4473
|
let isBrowser = !!(typeof window !== "undefined" && typeof navigator !== "undefined" && window.document);
|
|
4469
4474
|
let isWebWorker = !isBrowser;
|
|
@@ -4493,7 +4498,9 @@ var spine = (() => {
|
|
|
4493
4498
|
image.src = path;
|
|
4494
4499
|
}
|
|
4495
4500
|
}
|
|
4496
|
-
loadTextureAtlas(path, success =
|
|
4501
|
+
loadTextureAtlas(path, success = () => {
|
|
4502
|
+
}, error = () => {
|
|
4503
|
+
}, fileAlias) {
|
|
4497
4504
|
let index = path.lastIndexOf("/");
|
|
4498
4505
|
let parent = index >= 0 ? path.substring(0, index + 1) : "";
|
|
4499
4506
|
path = this.start(path);
|
|
@@ -4502,7 +4509,7 @@ var spine = (() => {
|
|
|
4502
4509
|
let atlas = new TextureAtlas(atlasText);
|
|
4503
4510
|
let toLoad = atlas.pages.length, abort = false;
|
|
4504
4511
|
for (let page of atlas.pages) {
|
|
4505
|
-
this.loadTexture(fileAlias
|
|
4512
|
+
this.loadTexture(!fileAlias ? parent + page.name : fileAlias[page.name], (imagePath, texture) => {
|
|
4506
4513
|
if (!abort) {
|
|
4507
4514
|
page.setTexture(texture);
|
|
4508
4515
|
if (--toLoad == 0)
|
|
@@ -4679,7 +4686,6 @@ var spine = (() => {
|
|
|
4679
4686
|
// spine-core/src/Event.ts
|
|
4680
4687
|
var Event = class {
|
|
4681
4688
|
constructor(time, data) {
|
|
4682
|
-
this.data = null;
|
|
4683
4689
|
this.intValue = 0;
|
|
4684
4690
|
this.floatValue = 0;
|
|
4685
4691
|
this.stringValue = null;
|
|
@@ -4696,7 +4702,6 @@ var spine = (() => {
|
|
|
4696
4702
|
// spine-core/src/EventData.ts
|
|
4697
4703
|
var EventData = class {
|
|
4698
4704
|
constructor(name) {
|
|
4699
|
-
this.name = null;
|
|
4700
4705
|
this.intValue = 0;
|
|
4701
4706
|
this.floatValue = 0;
|
|
4702
4707
|
this.stringValue = null;
|
|
@@ -4710,9 +4715,6 @@ var spine = (() => {
|
|
|
4710
4715
|
// spine-core/src/IkConstraint.ts
|
|
4711
4716
|
var IkConstraint = class {
|
|
4712
4717
|
constructor(data, skeleton) {
|
|
4713
|
-
this.data = null;
|
|
4714
|
-
this.bones = null;
|
|
4715
|
-
this.target = null;
|
|
4716
4718
|
this.bendDirection = 0;
|
|
4717
4719
|
this.compress = false;
|
|
4718
4720
|
this.stretch = false;
|
|
@@ -4730,9 +4732,16 @@ var spine = (() => {
|
|
|
4730
4732
|
this.compress = data.compress;
|
|
4731
4733
|
this.stretch = data.stretch;
|
|
4732
4734
|
this.bones = new Array();
|
|
4733
|
-
for (let i = 0; i < data.bones.length; i++)
|
|
4734
|
-
|
|
4735
|
-
|
|
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;
|
|
4736
4745
|
}
|
|
4737
4746
|
isActive() {
|
|
4738
4747
|
return this.active;
|
|
@@ -4753,6 +4762,8 @@ var spine = (() => {
|
|
|
4753
4762
|
}
|
|
4754
4763
|
apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
|
|
4755
4764
|
let p = bone.parent;
|
|
4765
|
+
if (!p)
|
|
4766
|
+
throw new Error("IK bone must have parent.");
|
|
4756
4767
|
let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
|
|
4757
4768
|
let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
|
|
4758
4769
|
switch (bone.data.transformMode) {
|
|
@@ -4830,6 +4841,8 @@ var spine = (() => {
|
|
|
4830
4841
|
cwy = c * cx + d * cy + parent.worldY;
|
|
4831
4842
|
}
|
|
4832
4843
|
let pp = parent.parent;
|
|
4844
|
+
if (!pp)
|
|
4845
|
+
throw new Error("IK parent must itself have a parent.");
|
|
4833
4846
|
a = pp.a;
|
|
4834
4847
|
b = pp.b;
|
|
4835
4848
|
c = pp.c;
|
|
@@ -4951,7 +4964,7 @@ var spine = (() => {
|
|
|
4951
4964
|
constructor(name) {
|
|
4952
4965
|
super(name, 0, false);
|
|
4953
4966
|
this.bones = new Array();
|
|
4954
|
-
this.
|
|
4967
|
+
this._target = null;
|
|
4955
4968
|
this.bendDirection = 1;
|
|
4956
4969
|
this.compress = false;
|
|
4957
4970
|
this.stretch = false;
|
|
@@ -4959,6 +4972,15 @@ var spine = (() => {
|
|
|
4959
4972
|
this.mix = 1;
|
|
4960
4973
|
this.softness = 0;
|
|
4961
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
|
+
}
|
|
4962
4984
|
};
|
|
4963
4985
|
|
|
4964
4986
|
// spine-core/src/PathConstraintData.ts
|
|
@@ -4966,10 +4988,10 @@ var spine = (() => {
|
|
|
4966
4988
|
constructor(name) {
|
|
4967
4989
|
super(name, 0, false);
|
|
4968
4990
|
this.bones = new Array();
|
|
4969
|
-
this.
|
|
4970
|
-
this.positionMode =
|
|
4971
|
-
this.spacingMode =
|
|
4972
|
-
this.rotateMode =
|
|
4991
|
+
this._target = null;
|
|
4992
|
+
this.positionMode = PositionMode.Fixed;
|
|
4993
|
+
this.spacingMode = SpacingMode.Fixed;
|
|
4994
|
+
this.rotateMode = RotateMode.Chain;
|
|
4973
4995
|
this.offsetRotation = 0;
|
|
4974
4996
|
this.position = 0;
|
|
4975
4997
|
this.spacing = 0;
|
|
@@ -4977,6 +4999,15 @@ var spine = (() => {
|
|
|
4977
4999
|
this.mixX = 0;
|
|
4978
5000
|
this.mixY = 0;
|
|
4979
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
|
+
}
|
|
4980
5011
|
};
|
|
4981
5012
|
var PositionMode;
|
|
4982
5013
|
(function(PositionMode2) {
|
|
@@ -5000,9 +5031,6 @@ var spine = (() => {
|
|
|
5000
5031
|
// spine-core/src/PathConstraint.ts
|
|
5001
5032
|
var _PathConstraint = class {
|
|
5002
5033
|
constructor(data, skeleton) {
|
|
5003
|
-
this.data = null;
|
|
5004
|
-
this.bones = null;
|
|
5005
|
-
this.target = null;
|
|
5006
5034
|
this.position = 0;
|
|
5007
5035
|
this.spacing = 0;
|
|
5008
5036
|
this.mixRotate = 0;
|
|
@@ -5021,9 +5049,16 @@ var spine = (() => {
|
|
|
5021
5049
|
throw new Error("skeleton cannot be null.");
|
|
5022
5050
|
this.data = data;
|
|
5023
5051
|
this.bones = new Array();
|
|
5024
|
-
for (let i = 0, n = data.bones.length; i < n; i++)
|
|
5025
|
-
|
|
5026
|
-
|
|
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;
|
|
5027
5062
|
this.position = data.position;
|
|
5028
5063
|
this.spacing = data.spacing;
|
|
5029
5064
|
this.mixRotate = data.mixRotate;
|
|
@@ -5044,7 +5079,7 @@ var spine = (() => {
|
|
|
5044
5079
|
let tangents = data.rotateMode == RotateMode.Tangent, scale = data.rotateMode == RotateMode.ChainScale;
|
|
5045
5080
|
let bones = this.bones;
|
|
5046
5081
|
let boneCount = bones.length, spacesCount = tangents ? boneCount : boneCount + 1;
|
|
5047
|
-
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) : [];
|
|
5048
5083
|
let spacing = this.spacing;
|
|
5049
5084
|
switch (data.spacingMode) {
|
|
5050
5085
|
case SpacingMode.Percent:
|
|
@@ -5165,7 +5200,7 @@ var spine = (() => {
|
|
|
5165
5200
|
computeWorldPositions(path, spacesCount, tangents) {
|
|
5166
5201
|
let target = this.target;
|
|
5167
5202
|
let position = this.position;
|
|
5168
|
-
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;
|
|
5169
5204
|
let closed2 = path.closed;
|
|
5170
5205
|
let verticesLength = path.worldVerticesLength, curveCount = verticesLength / 6, prevCurve = _PathConstraint.NONE;
|
|
5171
5206
|
if (!path.constantSpeed) {
|
|
@@ -5422,12 +5457,10 @@ var spine = (() => {
|
|
|
5422
5457
|
// spine-core/src/Slot.ts
|
|
5423
5458
|
var Slot = class {
|
|
5424
5459
|
constructor(data, bone) {
|
|
5425
|
-
this.data = null;
|
|
5426
|
-
this.bone = null;
|
|
5427
|
-
this.color = null;
|
|
5428
5460
|
this.darkColor = null;
|
|
5429
5461
|
this.attachment = null;
|
|
5430
5462
|
this.attachmentState = 0;
|
|
5463
|
+
this.sequenceIndex = -1;
|
|
5431
5464
|
this.deform = new Array();
|
|
5432
5465
|
if (!data)
|
|
5433
5466
|
throw new Error("data cannot be null.");
|
|
@@ -5470,9 +5503,6 @@ var spine = (() => {
|
|
|
5470
5503
|
// spine-core/src/TransformConstraint.ts
|
|
5471
5504
|
var TransformConstraint = class {
|
|
5472
5505
|
constructor(data, skeleton) {
|
|
5473
|
-
this.data = null;
|
|
5474
|
-
this.bones = null;
|
|
5475
|
-
this.target = null;
|
|
5476
5506
|
this.mixRotate = 0;
|
|
5477
5507
|
this.mixX = 0;
|
|
5478
5508
|
this.mixY = 0;
|
|
@@ -5493,9 +5523,16 @@ var spine = (() => {
|
|
|
5493
5523
|
this.mixScaleY = data.mixScaleY;
|
|
5494
5524
|
this.mixShearY = data.mixShearY;
|
|
5495
5525
|
this.bones = new Array();
|
|
5496
|
-
for (let i = 0; i < data.bones.length; i++)
|
|
5497
|
-
|
|
5498
|
-
|
|
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;
|
|
5499
5536
|
}
|
|
5500
5537
|
isActive() {
|
|
5501
5538
|
return this.active;
|
|
@@ -5680,16 +5717,8 @@ var spine = (() => {
|
|
|
5680
5717
|
// spine-core/src/Skeleton.ts
|
|
5681
5718
|
var Skeleton = class {
|
|
5682
5719
|
constructor(data) {
|
|
5683
|
-
this.data = null;
|
|
5684
|
-
this.bones = null;
|
|
5685
|
-
this.slots = null;
|
|
5686
|
-
this.drawOrder = null;
|
|
5687
|
-
this.ikConstraints = null;
|
|
5688
|
-
this.transformConstraints = null;
|
|
5689
|
-
this.pathConstraints = null;
|
|
5690
5720
|
this._updateCache = new Array();
|
|
5691
5721
|
this.skin = null;
|
|
5692
|
-
this.color = null;
|
|
5693
5722
|
this.scaleX = 1;
|
|
5694
5723
|
this.scaleY = 1;
|
|
5695
5724
|
this.x = 0;
|
|
@@ -5884,6 +5913,8 @@ var spine = (() => {
|
|
|
5884
5913
|
}
|
|
5885
5914
|
}
|
|
5886
5915
|
sortBone(bone) {
|
|
5916
|
+
if (!bone)
|
|
5917
|
+
return;
|
|
5887
5918
|
if (bone.sorted)
|
|
5888
5919
|
return;
|
|
5889
5920
|
let parent = bone.parent;
|
|
@@ -5920,6 +5951,8 @@ var spine = (() => {
|
|
|
5920
5951
|
}
|
|
5921
5952
|
updateWorldTransformWith(parent) {
|
|
5922
5953
|
let rootBone = this.getRootBone();
|
|
5954
|
+
if (!rootBone)
|
|
5955
|
+
throw new Error("Root bone must not be null.");
|
|
5923
5956
|
let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
|
|
5924
5957
|
rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
|
|
5925
5958
|
rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
|
|
@@ -6040,7 +6073,10 @@ var spine = (() => {
|
|
|
6040
6073
|
this.updateCache();
|
|
6041
6074
|
}
|
|
6042
6075
|
getAttachmentByName(slotName, attachmentName) {
|
|
6043
|
-
|
|
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);
|
|
6044
6080
|
}
|
|
6045
6081
|
getAttachment(slotIndex, attachmentName) {
|
|
6046
6082
|
if (!attachmentName)
|
|
@@ -6266,7 +6302,7 @@ var spine = (() => {
|
|
|
6266
6302
|
|
|
6267
6303
|
// spine-core/src/Skin.ts
|
|
6268
6304
|
var SkinEntry = class {
|
|
6269
|
-
constructor(slotIndex = 0, name
|
|
6305
|
+
constructor(slotIndex = 0, name, attachment) {
|
|
6270
6306
|
this.slotIndex = slotIndex;
|
|
6271
6307
|
this.name = name;
|
|
6272
6308
|
this.attachment = attachment;
|
|
@@ -6274,7 +6310,6 @@ var spine = (() => {
|
|
|
6274
6310
|
};
|
|
6275
6311
|
var Skin = class {
|
|
6276
6312
|
constructor(name) {
|
|
6277
|
-
this.name = null;
|
|
6278
6313
|
this.attachments = new Array();
|
|
6279
6314
|
this.bones = Array();
|
|
6280
6315
|
this.constraints = new Array();
|
|
@@ -6369,7 +6404,7 @@ var spine = (() => {
|
|
|
6369
6404
|
removeAttachment(slotIndex, name) {
|
|
6370
6405
|
let dictionary = this.attachments[slotIndex];
|
|
6371
6406
|
if (dictionary)
|
|
6372
|
-
dictionary[name]
|
|
6407
|
+
delete dictionary[name];
|
|
6373
6408
|
}
|
|
6374
6409
|
getAttachments() {
|
|
6375
6410
|
let entries = new Array();
|
|
@@ -6426,12 +6461,10 @@ var spine = (() => {
|
|
|
6426
6461
|
var SlotData = class {
|
|
6427
6462
|
constructor(index, name, boneData) {
|
|
6428
6463
|
this.index = 0;
|
|
6429
|
-
this.name = null;
|
|
6430
|
-
this.boneData = null;
|
|
6431
6464
|
this.color = new Color(1, 1, 1, 1);
|
|
6432
6465
|
this.darkColor = null;
|
|
6433
6466
|
this.attachmentName = null;
|
|
6434
|
-
this.blendMode =
|
|
6467
|
+
this.blendMode = BlendMode.Normal;
|
|
6435
6468
|
if (index < 0)
|
|
6436
6469
|
throw new Error("index must be >= 0.");
|
|
6437
6470
|
if (!name)
|
|
@@ -6456,7 +6489,7 @@ var spine = (() => {
|
|
|
6456
6489
|
constructor(name) {
|
|
6457
6490
|
super(name, 0, false);
|
|
6458
6491
|
this.bones = new Array();
|
|
6459
|
-
this.
|
|
6492
|
+
this._target = null;
|
|
6460
6493
|
this.mixRotate = 0;
|
|
6461
6494
|
this.mixX = 0;
|
|
6462
6495
|
this.mixY = 0;
|
|
@@ -6472,13 +6505,21 @@ var spine = (() => {
|
|
|
6472
6505
|
this.relative = false;
|
|
6473
6506
|
this.local = false;
|
|
6474
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
|
+
}
|
|
6475
6517
|
};
|
|
6476
6518
|
|
|
6477
6519
|
// spine-core/src/SkeletonBinary.ts
|
|
6478
6520
|
var SkeletonBinary = class {
|
|
6479
6521
|
constructor(attachmentLoader) {
|
|
6480
6522
|
this.scale = 1;
|
|
6481
|
-
this.attachmentLoader = null;
|
|
6482
6523
|
this.linkedMeshes = new Array();
|
|
6483
6524
|
this.attachmentLoader = attachmentLoader;
|
|
6484
6525
|
}
|
|
@@ -6503,11 +6544,17 @@ var spine = (() => {
|
|
|
6503
6544
|
}
|
|
6504
6545
|
let n = 0;
|
|
6505
6546
|
n = input.readInt(true);
|
|
6506
|
-
for (let i = 0; i < n; i++)
|
|
6507
|
-
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
|
+
}
|
|
6508
6553
|
n = input.readInt(true);
|
|
6509
6554
|
for (let i = 0; i < n; i++) {
|
|
6510
6555
|
let name = input.readString();
|
|
6556
|
+
if (!name)
|
|
6557
|
+
throw new Error("Bone name must not be null.");
|
|
6511
6558
|
let parent = i == 0 ? null : skeletonData.bones[input.readInt(true)];
|
|
6512
6559
|
let data = new BoneData(i, name, parent);
|
|
6513
6560
|
data.rotation = input.readFloat();
|
|
@@ -6527,6 +6574,8 @@ var spine = (() => {
|
|
|
6527
6574
|
n = input.readInt(true);
|
|
6528
6575
|
for (let i = 0; i < n; i++) {
|
|
6529
6576
|
let slotName = input.readString();
|
|
6577
|
+
if (!slotName)
|
|
6578
|
+
throw new Error("Slot name must not be null.");
|
|
6530
6579
|
let boneData = skeletonData.bones[input.readInt(true)];
|
|
6531
6580
|
let data = new SlotData(i, slotName, boneData);
|
|
6532
6581
|
Color.rgba8888ToColor(data.color, input.readInt32());
|
|
@@ -6539,7 +6588,10 @@ var spine = (() => {
|
|
|
6539
6588
|
}
|
|
6540
6589
|
n = input.readInt(true);
|
|
6541
6590
|
for (let i = 0, nn; i < n; i++) {
|
|
6542
|
-
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);
|
|
6543
6595
|
data.order = input.readInt(true);
|
|
6544
6596
|
data.skinRequired = input.readBoolean();
|
|
6545
6597
|
nn = input.readInt(true);
|
|
@@ -6556,7 +6608,10 @@ var spine = (() => {
|
|
|
6556
6608
|
}
|
|
6557
6609
|
n = input.readInt(true);
|
|
6558
6610
|
for (let i = 0, nn; i < n; i++) {
|
|
6559
|
-
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);
|
|
6560
6615
|
data.order = input.readInt(true);
|
|
6561
6616
|
data.skinRequired = input.readBoolean();
|
|
6562
6617
|
nn = input.readInt(true);
|
|
@@ -6581,7 +6636,10 @@ var spine = (() => {
|
|
|
6581
6636
|
}
|
|
6582
6637
|
n = input.readInt(true);
|
|
6583
6638
|
for (let i = 0, nn; i < n; i++) {
|
|
6584
|
-
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);
|
|
6585
6643
|
data.order = input.readInt(true);
|
|
6586
6644
|
data.skinRequired = input.readBoolean();
|
|
6587
6645
|
nn = input.readInt(true);
|
|
@@ -6611,14 +6669,24 @@ var spine = (() => {
|
|
|
6611
6669
|
{
|
|
6612
6670
|
let i = skeletonData.skins.length;
|
|
6613
6671
|
Utils.setArraySize(skeletonData.skins, n = i + input.readInt(true));
|
|
6614
|
-
for (; i < n; i++)
|
|
6615
|
-
|
|
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
|
+
}
|
|
6616
6678
|
}
|
|
6617
6679
|
n = this.linkedMeshes.length;
|
|
6618
6680
|
for (let i = 0; i < n; i++) {
|
|
6619
6681
|
let linkedMesh = this.linkedMeshes[i];
|
|
6620
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");
|
|
6621
6687
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
6688
|
+
if (!parent)
|
|
6689
|
+
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
6622
6690
|
linkedMesh.mesh.timelineAttahment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
6623
6691
|
linkedMesh.mesh.setParentMesh(parent);
|
|
6624
6692
|
if (linkedMesh.mesh.region != null)
|
|
@@ -6627,7 +6695,10 @@ var spine = (() => {
|
|
|
6627
6695
|
this.linkedMeshes.length = 0;
|
|
6628
6696
|
n = input.readInt(true);
|
|
6629
6697
|
for (let i = 0; i < n; i++) {
|
|
6630
|
-
let
|
|
6698
|
+
let eventName = input.readStringRef();
|
|
6699
|
+
if (!eventName)
|
|
6700
|
+
throw new Error();
|
|
6701
|
+
let data = new EventData(eventName);
|
|
6631
6702
|
data.intValue = input.readInt(false);
|
|
6632
6703
|
data.floatValue = input.readFloat();
|
|
6633
6704
|
data.stringValue = input.readString();
|
|
@@ -6639,8 +6710,12 @@ var spine = (() => {
|
|
|
6639
6710
|
skeletonData.events.push(data);
|
|
6640
6711
|
}
|
|
6641
6712
|
n = input.readInt(true);
|
|
6642
|
-
for (let i = 0; i < n; i++)
|
|
6643
|
-
|
|
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
|
+
}
|
|
6644
6719
|
return skeletonData;
|
|
6645
6720
|
}
|
|
6646
6721
|
readSkin(input, skeletonData, defaultSkin, nonessential) {
|
|
@@ -6652,7 +6727,10 @@ var spine = (() => {
|
|
|
6652
6727
|
return null;
|
|
6653
6728
|
skin = new Skin("default");
|
|
6654
6729
|
} else {
|
|
6655
|
-
|
|
6730
|
+
let skinName = input.readStringRef();
|
|
6731
|
+
if (!skinName)
|
|
6732
|
+
throw new Error("Skin name must not be null.");
|
|
6733
|
+
skin = new Skin(skinName);
|
|
6656
6734
|
skin.bones.length = input.readInt(true);
|
|
6657
6735
|
for (let i = 0, n = skin.bones.length; i < n; i++)
|
|
6658
6736
|
skin.bones[i] = skeletonData.bones[input.readInt(true)];
|
|
@@ -6668,6 +6746,8 @@ var spine = (() => {
|
|
|
6668
6746
|
let slotIndex = input.readInt(true);
|
|
6669
6747
|
for (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {
|
|
6670
6748
|
let name = input.readStringRef();
|
|
6749
|
+
if (!name)
|
|
6750
|
+
throw new Error("Attachment name must not be null");
|
|
6671
6751
|
let attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name, nonessential);
|
|
6672
6752
|
if (attachment)
|
|
6673
6753
|
skin.setAttachment(slotIndex, name, attachment);
|
|
@@ -6734,7 +6814,7 @@ var spine = (() => {
|
|
|
6734
6814
|
let vertices = this.readVertices(input, vertexCount);
|
|
6735
6815
|
let hullLength = input.readInt(true);
|
|
6736
6816
|
let sequence = this.readSequence(input);
|
|
6737
|
-
let edges =
|
|
6817
|
+
let edges = [];
|
|
6738
6818
|
let width = 0, height = 0;
|
|
6739
6819
|
if (nonessential) {
|
|
6740
6820
|
edges = this.readShortArray(input);
|
|
@@ -7236,6 +7316,8 @@ var spine = (() => {
|
|
|
7236
7316
|
let slotIndex = input.readInt(true);
|
|
7237
7317
|
for (let iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {
|
|
7238
7318
|
let attachmentName = input.readStringRef();
|
|
7319
|
+
if (!attachmentName)
|
|
7320
|
+
throw new Error("attachmentName must not be null.");
|
|
7239
7321
|
let attachment = skin.getAttachment(slotIndex, attachmentName);
|
|
7240
7322
|
let timelineType = input.readByte();
|
|
7241
7323
|
let frameCount = input.readInt(true);
|
|
@@ -7911,6 +7993,8 @@ var spine = (() => {
|
|
|
7911
7993
|
this.clippedVertices = new Array();
|
|
7912
7994
|
this.clippedTriangles = new Array();
|
|
7913
7995
|
this.scratch = new Array();
|
|
7996
|
+
this.clipAttachment = null;
|
|
7997
|
+
this.clippingPolygons = null;
|
|
7914
7998
|
}
|
|
7915
7999
|
clipStart(slot, clip) {
|
|
7916
8000
|
if (this.clipAttachment)
|
|
@@ -7950,7 +8034,7 @@ var spine = (() => {
|
|
|
7950
8034
|
let clipOutput = this.clipOutput, clippedVertices = this.clippedVertices;
|
|
7951
8035
|
let clippedTriangles = this.clippedTriangles;
|
|
7952
8036
|
let polygons = this.clippingPolygons;
|
|
7953
|
-
let polygonsCount =
|
|
8037
|
+
let polygonsCount = polygons.length;
|
|
7954
8038
|
let vertexSize = twoColor ? 12 : 8;
|
|
7955
8039
|
let index = 0;
|
|
7956
8040
|
clippedVertices.length = 0;
|
|
@@ -8082,7 +8166,7 @@ var spine = (() => {
|
|
|
8082
8166
|
clip(x1, y1, x2, y2, x3, y3, clippingArea, output) {
|
|
8083
8167
|
let originalOutput = output;
|
|
8084
8168
|
let clipped = false;
|
|
8085
|
-
let input
|
|
8169
|
+
let input;
|
|
8086
8170
|
if (clippingArea.length % 4 >= 2) {
|
|
8087
8171
|
input = output;
|
|
8088
8172
|
output = this.scratch;
|
|
@@ -8190,7 +8274,6 @@ var spine = (() => {
|
|
|
8190
8274
|
// spine-core/src/SkeletonJson.ts
|
|
8191
8275
|
var SkeletonJson = class {
|
|
8192
8276
|
constructor(attachmentLoader) {
|
|
8193
|
-
this.attachmentLoader = null;
|
|
8194
8277
|
this.scale = 1;
|
|
8195
8278
|
this.linkedMeshes = new Array();
|
|
8196
8279
|
this.attachmentLoader = attachmentLoader;
|
|
@@ -8238,6 +8321,8 @@ var spine = (() => {
|
|
|
8238
8321
|
for (let i = 0; i < root.slots.length; i++) {
|
|
8239
8322
|
let slotMap = root.slots[i];
|
|
8240
8323
|
let boneData = skeletonData.findBone(slotMap.bone);
|
|
8324
|
+
if (!boneData)
|
|
8325
|
+
throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotMap.name}`);
|
|
8241
8326
|
let data = new SlotData(skeletonData.slots.length, slotMap.name, boneData);
|
|
8242
8327
|
let color = getValue(slotMap, "color", null);
|
|
8243
8328
|
if (color)
|
|
@@ -8256,9 +8341,17 @@ var spine = (() => {
|
|
|
8256
8341
|
let data = new IkConstraintData(constraintMap.name);
|
|
8257
8342
|
data.order = getValue(constraintMap, "order", 0);
|
|
8258
8343
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
8259
|
-
for (let ii = 0; ii < constraintMap.bones.length; ii++)
|
|
8260
|
-
|
|
8261
|
-
|
|
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;
|
|
8262
8355
|
data.mix = getValue(constraintMap, "mix", 1);
|
|
8263
8356
|
data.softness = getValue(constraintMap, "softness", 0) * scale;
|
|
8264
8357
|
data.bendDirection = getValue(constraintMap, "bendPositive", true) ? 1 : -1;
|
|
@@ -8274,10 +8367,18 @@ var spine = (() => {
|
|
|
8274
8367
|
let data = new TransformConstraintData(constraintMap.name);
|
|
8275
8368
|
data.order = getValue(constraintMap, "order", 0);
|
|
8276
8369
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
8277
|
-
for (let ii = 0; ii < constraintMap.bones.length; ii++)
|
|
8278
|
-
|
|
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
|
+
}
|
|
8279
8377
|
let targetName = constraintMap.target;
|
|
8280
|
-
|
|
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;
|
|
8281
8382
|
data.local = getValue(constraintMap, "local", false);
|
|
8282
8383
|
data.relative = getValue(constraintMap, "relative", false);
|
|
8283
8384
|
data.offsetRotation = getValue(constraintMap, "rotation", 0);
|
|
@@ -8301,10 +8402,18 @@ var spine = (() => {
|
|
|
8301
8402
|
let data = new PathConstraintData(constraintMap.name);
|
|
8302
8403
|
data.order = getValue(constraintMap, "order", 0);
|
|
8303
8404
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
8304
|
-
for (let ii = 0; ii < constraintMap.bones.length; ii++)
|
|
8305
|
-
|
|
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
|
+
}
|
|
8306
8412
|
let targetName = constraintMap.target;
|
|
8307
|
-
|
|
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;
|
|
8308
8417
|
data.positionMode = Utils.enumValue(PositionMode, getValue(constraintMap, "positionMode", "Percent"));
|
|
8309
8418
|
data.spacingMode = Utils.enumValue(SpacingMode, getValue(constraintMap, "spacingMode", "Length"));
|
|
8310
8419
|
data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
|
|
@@ -8326,23 +8435,45 @@ var spine = (() => {
|
|
|
8326
8435
|
let skinMap = root.skins[i];
|
|
8327
8436
|
let skin = new Skin(skinMap.name);
|
|
8328
8437
|
if (skinMap.bones) {
|
|
8329
|
-
for (let ii = 0; ii < skinMap.bones.length; ii++)
|
|
8330
|
-
|
|
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
|
+
}
|
|
8331
8445
|
}
|
|
8332
8446
|
if (skinMap.ik) {
|
|
8333
|
-
for (let ii = 0; ii < skinMap.ik.length; ii++)
|
|
8334
|
-
|
|
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
|
+
}
|
|
8335
8454
|
}
|
|
8336
8455
|
if (skinMap.transform) {
|
|
8337
|
-
for (let ii = 0; ii < skinMap.transform.length; ii++)
|
|
8338
|
-
|
|
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
|
+
}
|
|
8339
8463
|
}
|
|
8340
8464
|
if (skinMap.path) {
|
|
8341
|
-
for (let ii = 0; ii < skinMap.path.length; ii++)
|
|
8342
|
-
|
|
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
|
+
}
|
|
8343
8472
|
}
|
|
8344
8473
|
for (let slotName in skinMap.attachments) {
|
|
8345
8474
|
let slot = skeletonData.findSlot(slotName);
|
|
8475
|
+
if (!slot)
|
|
8476
|
+
throw new Error(`Couldn't find slot ${slotName} for skin ${skinMap.name}.`);
|
|
8346
8477
|
let slotMap = skinMap.attachments[slotName];
|
|
8347
8478
|
for (let entryName in slotMap) {
|
|
8348
8479
|
let attachment = this.readAttachment(slotMap[entryName], skin, slot.index, entryName, skeletonData);
|
|
@@ -8358,7 +8489,11 @@ var spine = (() => {
|
|
|
8358
8489
|
for (let i = 0, n = this.linkedMeshes.length; i < n; i++) {
|
|
8359
8490
|
let linkedMesh = this.linkedMeshes[i];
|
|
8360
8491
|
let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
|
|
8492
|
+
if (!skin)
|
|
8493
|
+
throw new Error(`Skin not found: ${linkedMesh.skin}`);
|
|
8361
8494
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
8495
|
+
if (!parent)
|
|
8496
|
+
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
8362
8497
|
linkedMesh.mesh.timelineAttahment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
8363
8498
|
linkedMesh.mesh.setParentMesh(parent);
|
|
8364
8499
|
if (linkedMesh.mesh.region != null)
|
|
@@ -8542,7 +8677,10 @@ var spine = (() => {
|
|
|
8542
8677
|
if (map.slots) {
|
|
8543
8678
|
for (let slotName in map.slots) {
|
|
8544
8679
|
let slotMap = map.slots[slotName];
|
|
8545
|
-
let
|
|
8680
|
+
let slot = skeletonData.findSlot(slotName);
|
|
8681
|
+
if (!slot)
|
|
8682
|
+
throw new Error("Slot not found: " + slotName);
|
|
8683
|
+
let slotIndex = slot.index;
|
|
8546
8684
|
for (let timelineName in slotMap) {
|
|
8547
8685
|
let timelineMap = slotMap[timelineName];
|
|
8548
8686
|
if (!timelineMap)
|
|
@@ -8678,7 +8816,10 @@ var spine = (() => {
|
|
|
8678
8816
|
if (map.bones) {
|
|
8679
8817
|
for (let boneName in map.bones) {
|
|
8680
8818
|
let boneMap = map.bones[boneName];
|
|
8681
|
-
let
|
|
8819
|
+
let bone = skeletonData.findBone(boneName);
|
|
8820
|
+
if (!bone)
|
|
8821
|
+
throw new Error("Bone not found: " + boneName);
|
|
8822
|
+
let boneIndex = bone.index;
|
|
8682
8823
|
for (let timelineName in boneMap) {
|
|
8683
8824
|
let timelineMap = boneMap[timelineName];
|
|
8684
8825
|
let frames = timelineMap.length;
|
|
@@ -8724,6 +8865,8 @@ var spine = (() => {
|
|
|
8724
8865
|
if (!keyMap)
|
|
8725
8866
|
continue;
|
|
8726
8867
|
let constraint = skeletonData.findIkConstraint(constraintName);
|
|
8868
|
+
if (!constraint)
|
|
8869
|
+
throw new Error("IK Constraint not found: " + constraintName);
|
|
8727
8870
|
let constraintIndex = skeletonData.ikConstraints.indexOf(constraint);
|
|
8728
8871
|
let timeline = new IkConstraintTimeline(constraintMap.length, constraintMap.length << 1, constraintIndex);
|
|
8729
8872
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -8759,6 +8902,8 @@ var spine = (() => {
|
|
|
8759
8902
|
if (!keyMap)
|
|
8760
8903
|
continue;
|
|
8761
8904
|
let constraint = skeletonData.findTransformConstraint(constraintName);
|
|
8905
|
+
if (!constraint)
|
|
8906
|
+
throw new Error("Transform constraint not found: " + constraintName);
|
|
8762
8907
|
let constraintIndex = skeletonData.transformConstraints.indexOf(constraint);
|
|
8763
8908
|
let timeline = new TransformConstraintTimeline(timelineMap.length, timelineMap.length * 6, constraintIndex);
|
|
8764
8909
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -8807,6 +8952,8 @@ var spine = (() => {
|
|
|
8807
8952
|
for (let constraintName in map.path) {
|
|
8808
8953
|
let constraintMap = map.path[constraintName];
|
|
8809
8954
|
let constraint = skeletonData.findPathConstraint(constraintName);
|
|
8955
|
+
if (!constraint)
|
|
8956
|
+
throw new Error("Path constraint not found: " + constraintName);
|
|
8810
8957
|
let constraintIndex = skeletonData.pathConstraints.indexOf(constraint);
|
|
8811
8958
|
for (let timelineName in constraintMap) {
|
|
8812
8959
|
let timelineMap = constraintMap[timelineName];
|
|
@@ -8858,9 +9005,14 @@ var spine = (() => {
|
|
|
8858
9005
|
for (let attachmentsName in map.attachments) {
|
|
8859
9006
|
let attachmentsMap = map.attachments[attachmentsName];
|
|
8860
9007
|
let skin = skeletonData.findSkin(attachmentsName);
|
|
9008
|
+
if (!skin)
|
|
9009
|
+
throw new Error("Skin not found: " + attachmentsName);
|
|
8861
9010
|
for (let slotMapName in attachmentsMap) {
|
|
8862
9011
|
let slotMap = attachmentsMap[slotMapName];
|
|
8863
|
-
let
|
|
9012
|
+
let slot = skeletonData.findSlot(slotMapName);
|
|
9013
|
+
if (!slot)
|
|
9014
|
+
throw new Error("Slot not found: " + slotMapName);
|
|
9015
|
+
let slotIndex = slot.index;
|
|
8864
9016
|
for (let attachmentMapName in slotMap) {
|
|
8865
9017
|
let attachmentMap = slotMap[attachmentMapName];
|
|
8866
9018
|
let attachment = skin.getAttachment(slotIndex, attachmentMapName);
|
|
@@ -8940,7 +9092,10 @@ var spine = (() => {
|
|
|
8940
9092
|
let originalIndex = 0, unchangedIndex = 0;
|
|
8941
9093
|
for (let ii = 0; ii < offsets.length; ii++) {
|
|
8942
9094
|
let offsetMap = offsets[ii];
|
|
8943
|
-
let
|
|
9095
|
+
let slot = skeletonData.findSlot(offsetMap.slot);
|
|
9096
|
+
if (!slot)
|
|
9097
|
+
throw new Error("Slot not found: " + slot);
|
|
9098
|
+
let slotIndex = slot.index;
|
|
8944
9099
|
while (originalIndex != slotIndex)
|
|
8945
9100
|
unchanged[unchangedIndex++] = originalIndex++;
|
|
8946
9101
|
drawOrder[originalIndex + offsetMap.offset] = originalIndex++;
|
|
@@ -8961,6 +9116,8 @@ var spine = (() => {
|
|
|
8961
9116
|
for (let i = 0; i < map.events.length; i++, frame++) {
|
|
8962
9117
|
let eventMap = map.events[i];
|
|
8963
9118
|
let eventData = skeletonData.findEvent(eventMap.name);
|
|
9119
|
+
if (!eventData)
|
|
9120
|
+
throw new Error("Event not found: " + eventMap.name);
|
|
8964
9121
|
let event = new Event(Utils.toSinglePrecision(getValue(eventMap, "time", 0)), eventData);
|
|
8965
9122
|
event.intValue = getValue(eventMap, "int", eventData.intValue);
|
|
8966
9123
|
event.floatValue = getValue(eventMap, "float", eventData.floatValue);
|
|
@@ -9120,26 +9277,24 @@ var spine = (() => {
|
|
|
9120
9277
|
var ManagedWebGLRenderingContext = class {
|
|
9121
9278
|
constructor(canvasOrContext, contextConfig = { alpha: "true" }) {
|
|
9122
9279
|
this.restorables = new Array();
|
|
9123
|
-
if (!(canvasOrContext instanceof WebGLRenderingContext || typeof WebGL2RenderingContext !== "undefined" && canvasOrContext instanceof WebGL2RenderingContext))
|
|
9124
|
-
|
|
9125
|
-
|
|
9280
|
+
if (!(canvasOrContext instanceof WebGLRenderingContext || typeof WebGL2RenderingContext !== "undefined" && canvasOrContext instanceof WebGL2RenderingContext)) {
|
|
9281
|
+
let canvas = canvasOrContext;
|
|
9282
|
+
this.gl = canvas.getContext("webgl2", contextConfig) || canvas.getContext("webgl", contextConfig);
|
|
9283
|
+
this.canvas = canvas;
|
|
9284
|
+
canvas.addEventListener("webglcontextlost", (e) => {
|
|
9285
|
+
let event = e;
|
|
9286
|
+
if (e)
|
|
9287
|
+
e.preventDefault();
|
|
9288
|
+
});
|
|
9289
|
+
canvas.addEventListener("webglcontextrestored", (e) => {
|
|
9290
|
+
for (let i = 0, n = this.restorables.length; i < n; i++)
|
|
9291
|
+
this.restorables[i].restore();
|
|
9292
|
+
});
|
|
9293
|
+
} else {
|
|
9126
9294
|
this.gl = canvasOrContext;
|
|
9127
9295
|
this.canvas = this.gl.canvas;
|
|
9128
9296
|
}
|
|
9129
9297
|
}
|
|
9130
|
-
setupCanvas(canvas, contextConfig) {
|
|
9131
|
-
this.gl = canvas.getContext("webgl2", contextConfig) || canvas.getContext("webgl", contextConfig);
|
|
9132
|
-
this.canvas = canvas;
|
|
9133
|
-
canvas.addEventListener("webglcontextlost", (e) => {
|
|
9134
|
-
let event = e;
|
|
9135
|
-
if (e)
|
|
9136
|
-
e.preventDefault();
|
|
9137
|
-
});
|
|
9138
|
-
canvas.addEventListener("webglcontextrestored", (e) => {
|
|
9139
|
-
for (let i = 0, n = this.restorables.length; i < n; i++)
|
|
9140
|
-
this.restorables[i].restore();
|
|
9141
|
-
});
|
|
9142
|
-
}
|
|
9143
9298
|
addRestorable(restorable) {
|
|
9144
9299
|
this.restorables.push(restorable);
|
|
9145
9300
|
}
|
|
@@ -9276,7 +9431,7 @@ var spine = (() => {
|
|
|
9276
9431
|
|
|
9277
9432
|
// spine-webgl/src/AssetManager.ts
|
|
9278
9433
|
var AssetManager = class extends AssetManagerBase {
|
|
9279
|
-
constructor(context, pathPrefix = "", downloader =
|
|
9434
|
+
constructor(context, pathPrefix = "", downloader = new Downloader()) {
|
|
9280
9435
|
super((image) => {
|
|
9281
9436
|
return new GLTexture(context, image);
|
|
9282
9437
|
}, pathPrefix, downloader);
|
|
@@ -9585,7 +9740,6 @@ var spine = (() => {
|
|
|
9585
9740
|
return this.set(this.temp);
|
|
9586
9741
|
}
|
|
9587
9742
|
lookAt(position, direction, up) {
|
|
9588
|
-
_Matrix4.initTemps();
|
|
9589
9743
|
let xAxis = _Matrix4.xAxis, yAxis = _Matrix4.yAxis, zAxis = _Matrix4.zAxis;
|
|
9590
9744
|
zAxis.setFrom(direction).normalize();
|
|
9591
9745
|
xAxis.setFrom(direction).normalize();
|
|
@@ -9609,19 +9763,11 @@ var spine = (() => {
|
|
|
9609
9763
|
this.multiply(_Matrix4.tmpMatrix);
|
|
9610
9764
|
return this;
|
|
9611
9765
|
}
|
|
9612
|
-
static initTemps() {
|
|
9613
|
-
if (_Matrix4.xAxis === null)
|
|
9614
|
-
_Matrix4.xAxis = new Vector3();
|
|
9615
|
-
if (_Matrix4.yAxis === null)
|
|
9616
|
-
_Matrix4.yAxis = new Vector3();
|
|
9617
|
-
if (_Matrix4.zAxis === null)
|
|
9618
|
-
_Matrix4.zAxis = new Vector3();
|
|
9619
|
-
}
|
|
9620
9766
|
};
|
|
9621
9767
|
var Matrix42 = _Matrix4;
|
|
9622
|
-
Matrix42.xAxis =
|
|
9623
|
-
Matrix42.yAxis =
|
|
9624
|
-
Matrix42.zAxis =
|
|
9768
|
+
Matrix42.xAxis = new Vector3();
|
|
9769
|
+
Matrix42.yAxis = new Vector3();
|
|
9770
|
+
Matrix42.zAxis = new Vector3();
|
|
9625
9771
|
Matrix42.tmpMatrix = new _Matrix4();
|
|
9626
9772
|
|
|
9627
9773
|
// spine-webgl/src/Camera.ts
|
|
@@ -9758,6 +9904,8 @@ var spine = (() => {
|
|
|
9758
9904
|
if (!this.touch0 || !this.touch1) {
|
|
9759
9905
|
var touches = ev.changedTouches;
|
|
9760
9906
|
let nativeTouch = touches.item(0);
|
|
9907
|
+
if (!nativeTouch)
|
|
9908
|
+
return;
|
|
9761
9909
|
let rect = element.getBoundingClientRect();
|
|
9762
9910
|
let x = nativeTouch.clientX - rect.left;
|
|
9763
9911
|
let y = nativeTouch.clientY - rect.top;
|
|
@@ -9978,7 +10126,11 @@ var spine = (() => {
|
|
|
9978
10126
|
let gl = this.context.gl;
|
|
9979
10127
|
try {
|
|
9980
10128
|
this.vs = this.compileShader(gl.VERTEX_SHADER, this.vertexShader);
|
|
10129
|
+
if (!this.vs)
|
|
10130
|
+
throw new Error("Couldn't compile vertex shader.");
|
|
9981
10131
|
this.fs = this.compileShader(gl.FRAGMENT_SHADER, this.fragmentShader);
|
|
10132
|
+
if (!this.fs)
|
|
10133
|
+
throw new Error("Couldn#t compile fragment shader.");
|
|
9982
10134
|
this.program = this.compileProgram(this.vs, this.fs);
|
|
9983
10135
|
} catch (e) {
|
|
9984
10136
|
this.dispose();
|
|
@@ -9988,6 +10140,8 @@ var spine = (() => {
|
|
|
9988
10140
|
compileShader(type, source) {
|
|
9989
10141
|
let gl = this.context.gl;
|
|
9990
10142
|
let shader = gl.createShader(type);
|
|
10143
|
+
if (!shader)
|
|
10144
|
+
throw new Error("Couldn't create shader.");
|
|
9991
10145
|
gl.shaderSource(shader, source);
|
|
9992
10146
|
gl.compileShader(shader);
|
|
9993
10147
|
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
|
|
@@ -10001,6 +10155,8 @@ var spine = (() => {
|
|
|
10001
10155
|
compileProgram(vs, fs) {
|
|
10002
10156
|
let gl = this.context.gl;
|
|
10003
10157
|
let program = gl.createProgram();
|
|
10158
|
+
if (!program)
|
|
10159
|
+
throw new Error("Couldn't compile program.");
|
|
10004
10160
|
gl.attachShader(program, vs);
|
|
10005
10161
|
gl.attachShader(program, fs);
|
|
10006
10162
|
gl.linkProgram(program);
|
|
@@ -10053,6 +10209,8 @@ var spine = (() => {
|
|
|
10053
10209
|
}
|
|
10054
10210
|
getUniformLocation(uniform) {
|
|
10055
10211
|
let gl = this.context.gl;
|
|
10212
|
+
if (!this.program)
|
|
10213
|
+
throw new Error("Shader not compiled.");
|
|
10056
10214
|
let location = gl.getUniformLocation(this.program, uniform);
|
|
10057
10215
|
if (!location && !gl.isContextLost())
|
|
10058
10216
|
throw new Error(`Couldn't find location for uniform ${uniform}`);
|
|
@@ -10060,6 +10218,8 @@ var spine = (() => {
|
|
|
10060
10218
|
}
|
|
10061
10219
|
getAttributeLocation(attribute) {
|
|
10062
10220
|
let gl = this.context.gl;
|
|
10221
|
+
if (!this.program)
|
|
10222
|
+
throw new Error("Shader not compiled.");
|
|
10063
10223
|
let location = gl.getAttribLocation(this.program, attribute);
|
|
10064
10224
|
if (location == -1 && !gl.isContextLost())
|
|
10065
10225
|
throw new Error(`Couldn't find location for attribute ${attribute}`);
|
|
@@ -10191,8 +10351,10 @@ var spine = (() => {
|
|
|
10191
10351
|
var Mesh = class {
|
|
10192
10352
|
constructor(context, attributes, maxVertices, maxIndices) {
|
|
10193
10353
|
this.attributes = attributes;
|
|
10354
|
+
this.verticesBuffer = null;
|
|
10194
10355
|
this.verticesLength = 0;
|
|
10195
10356
|
this.dirtyVertices = false;
|
|
10357
|
+
this.indicesBuffer = null;
|
|
10196
10358
|
this.indicesLength = 0;
|
|
10197
10359
|
this.dirtyIndices = false;
|
|
10198
10360
|
this.elementsPerVertex = 0;
|
|
@@ -10367,11 +10529,13 @@ var spine = (() => {
|
|
|
10367
10529
|
// spine-webgl/src/PolygonBatcher.ts
|
|
10368
10530
|
var PolygonBatcher = class {
|
|
10369
10531
|
constructor(context, twoColorTint = true, maxVertices = 10920) {
|
|
10532
|
+
this.drawCalls = 0;
|
|
10370
10533
|
this.isDrawing = false;
|
|
10371
10534
|
this.shader = null;
|
|
10372
10535
|
this.lastTexture = null;
|
|
10373
10536
|
this.verticesLength = 0;
|
|
10374
10537
|
this.indicesLength = 0;
|
|
10538
|
+
this.cullWasEnabled = false;
|
|
10375
10539
|
if (maxVertices > 10920)
|
|
10376
10540
|
throw new Error("Can't have more than 10920 triangles per batch: " + maxVertices);
|
|
10377
10541
|
this.context = context instanceof ManagedWebGLRenderingContext ? context : new ManagedWebGLRenderingContext(context);
|
|
@@ -10428,6 +10592,10 @@ var spine = (() => {
|
|
|
10428
10592
|
flush() {
|
|
10429
10593
|
if (this.verticesLength == 0)
|
|
10430
10594
|
return;
|
|
10595
|
+
if (!this.lastTexture)
|
|
10596
|
+
throw new Error("No texture set.");
|
|
10597
|
+
if (!this.shader)
|
|
10598
|
+
throw new Error("No shader set.");
|
|
10431
10599
|
this.lastTexture.bind();
|
|
10432
10600
|
this.mesh.draw(this.shader, this.context.gl.TRIANGLES);
|
|
10433
10601
|
this.verticesLength = 0;
|
|
@@ -10463,6 +10631,7 @@ var spine = (() => {
|
|
|
10463
10631
|
this.isDrawing = false;
|
|
10464
10632
|
this.shapeType = ShapeType.Filled;
|
|
10465
10633
|
this.color = new Color(1, 1, 1, 1);
|
|
10634
|
+
this.shader = null;
|
|
10466
10635
|
this.vertexIndex = 0;
|
|
10467
10636
|
this.tmp = new Vector2();
|
|
10468
10637
|
if (maxVertices > 10920)
|
|
@@ -10500,30 +10669,30 @@ var spine = (() => {
|
|
|
10500
10669
|
setColorWith(r, g, b, a) {
|
|
10501
10670
|
this.color.set(r, g, b, a);
|
|
10502
10671
|
}
|
|
10503
|
-
point(x, y, color
|
|
10672
|
+
point(x, y, color) {
|
|
10504
10673
|
this.check(ShapeType.Point, 1);
|
|
10505
|
-
if (color
|
|
10674
|
+
if (!color)
|
|
10506
10675
|
color = this.color;
|
|
10507
10676
|
this.vertex(x, y, color);
|
|
10508
10677
|
}
|
|
10509
|
-
line(x, y, x2, y2, color
|
|
10678
|
+
line(x, y, x2, y2, color) {
|
|
10510
10679
|
this.check(ShapeType.Line, 2);
|
|
10511
10680
|
let vertices = this.mesh.getVertices();
|
|
10512
10681
|
let idx = this.vertexIndex;
|
|
10513
|
-
if (color
|
|
10682
|
+
if (!color)
|
|
10514
10683
|
color = this.color;
|
|
10515
10684
|
this.vertex(x, y, color);
|
|
10516
10685
|
this.vertex(x2, y2, color);
|
|
10517
10686
|
}
|
|
10518
|
-
triangle(filled, x, y, x2, y2, x3, y3, color
|
|
10687
|
+
triangle(filled, x, y, x2, y2, x3, y3, color, color2, color3) {
|
|
10519
10688
|
this.check(filled ? ShapeType.Filled : ShapeType.Line, 3);
|
|
10520
10689
|
let vertices = this.mesh.getVertices();
|
|
10521
10690
|
let idx = this.vertexIndex;
|
|
10522
|
-
if (color
|
|
10691
|
+
if (!color)
|
|
10523
10692
|
color = this.color;
|
|
10524
|
-
if (color2
|
|
10693
|
+
if (!color2)
|
|
10525
10694
|
color2 = this.color;
|
|
10526
|
-
if (color3
|
|
10695
|
+
if (!color3)
|
|
10527
10696
|
color3 = this.color;
|
|
10528
10697
|
if (filled) {
|
|
10529
10698
|
this.vertex(x, y, color);
|
|
@@ -10538,17 +10707,17 @@ var spine = (() => {
|
|
|
10538
10707
|
this.vertex(x, y, color2);
|
|
10539
10708
|
}
|
|
10540
10709
|
}
|
|
10541
|
-
quad(filled, x, y, x2, y2, x3, y3, x4, y4, color
|
|
10710
|
+
quad(filled, x, y, x2, y2, x3, y3, x4, y4, color, color2, color3, color4) {
|
|
10542
10711
|
this.check(filled ? ShapeType.Filled : ShapeType.Line, 3);
|
|
10543
10712
|
let vertices = this.mesh.getVertices();
|
|
10544
10713
|
let idx = this.vertexIndex;
|
|
10545
|
-
if (color
|
|
10714
|
+
if (!color)
|
|
10546
10715
|
color = this.color;
|
|
10547
|
-
if (color2
|
|
10716
|
+
if (!color2)
|
|
10548
10717
|
color2 = this.color;
|
|
10549
|
-
if (color3
|
|
10718
|
+
if (!color3)
|
|
10550
10719
|
color3 = this.color;
|
|
10551
|
-
if (color4
|
|
10720
|
+
if (!color4)
|
|
10552
10721
|
color4 = this.color;
|
|
10553
10722
|
if (filled) {
|
|
10554
10723
|
this.vertex(x, y, color);
|
|
@@ -10568,12 +10737,12 @@ var spine = (() => {
|
|
|
10568
10737
|
this.vertex(x, y, color);
|
|
10569
10738
|
}
|
|
10570
10739
|
}
|
|
10571
|
-
rect(filled, x, y, width, height, color
|
|
10740
|
+
rect(filled, x, y, width, height, color) {
|
|
10572
10741
|
this.quad(filled, x, y, x + width, y, x + width, y + height, x, y + height, color, color, color, color);
|
|
10573
10742
|
}
|
|
10574
|
-
rectLine(filled, x1, y1, x2, y2, width, color
|
|
10743
|
+
rectLine(filled, x1, y1, x2, y2, width, color) {
|
|
10575
10744
|
this.check(filled ? ShapeType.Filled : ShapeType.Line, 8);
|
|
10576
|
-
if (color
|
|
10745
|
+
if (!color)
|
|
10577
10746
|
color = this.color;
|
|
10578
10747
|
let t = this.tmp.set(y2 - y1, x1 - x2);
|
|
10579
10748
|
t.normalize();
|
|
@@ -10602,11 +10771,11 @@ var spine = (() => {
|
|
|
10602
10771
|
this.line(x - size, y - size, x + size, y + size);
|
|
10603
10772
|
this.line(x - size, y + size, x + size, y - size);
|
|
10604
10773
|
}
|
|
10605
|
-
polygon(polygonVertices, offset, count, color
|
|
10774
|
+
polygon(polygonVertices, offset, count, color) {
|
|
10606
10775
|
if (count < 3)
|
|
10607
10776
|
throw new Error("Polygon must contain at least 3 vertices");
|
|
10608
10777
|
this.check(ShapeType.Line, count * 2);
|
|
10609
|
-
if (color
|
|
10778
|
+
if (color)
|
|
10610
10779
|
color = this.color;
|
|
10611
10780
|
let vertices = this.mesh.getVertices();
|
|
10612
10781
|
let idx = this.vertexIndex;
|
|
@@ -10631,12 +10800,12 @@ var spine = (() => {
|
|
|
10631
10800
|
this.vertex(x2, y2, color);
|
|
10632
10801
|
}
|
|
10633
10802
|
}
|
|
10634
|
-
circle(filled, x, y, radius, color
|
|
10635
|
-
if (segments
|
|
10803
|
+
circle(filled, x, y, radius, color, segments = 0) {
|
|
10804
|
+
if (segments == 0)
|
|
10636
10805
|
segments = Math.max(1, 6 * MathUtils.cbrt(radius) | 0);
|
|
10637
10806
|
if (segments <= 0)
|
|
10638
10807
|
throw new Error("segments must be > 0.");
|
|
10639
|
-
if (color
|
|
10808
|
+
if (!color)
|
|
10640
10809
|
color = this.color;
|
|
10641
10810
|
let angle = 2 * MathUtils.PI / segments;
|
|
10642
10811
|
let cos = Math.cos(angle);
|
|
@@ -10671,9 +10840,9 @@ var spine = (() => {
|
|
|
10671
10840
|
cy = 0;
|
|
10672
10841
|
this.vertex(x + cx, y + cy, color);
|
|
10673
10842
|
}
|
|
10674
|
-
curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color
|
|
10843
|
+
curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color) {
|
|
10675
10844
|
this.check(ShapeType.Line, segments * 2 + 2);
|
|
10676
|
-
if (color
|
|
10845
|
+
if (color)
|
|
10677
10846
|
color = this.color;
|
|
10678
10847
|
let subdiv_step = 1 / segments;
|
|
10679
10848
|
let subdiv_step2 = subdiv_step * subdiv_step;
|
|
@@ -10729,6 +10898,8 @@ var spine = (() => {
|
|
|
10729
10898
|
flush() {
|
|
10730
10899
|
if (this.vertexIndex == 0)
|
|
10731
10900
|
return;
|
|
10901
|
+
if (!this.shader)
|
|
10902
|
+
throw new Error("No shader set.");
|
|
10732
10903
|
this.mesh.setVerticesLength(this.vertexIndex);
|
|
10733
10904
|
this.mesh.draw(this.shader, this.shapeType);
|
|
10734
10905
|
this.vertexIndex = 0;
|
|
@@ -10783,7 +10954,7 @@ var spine = (() => {
|
|
|
10783
10954
|
this.vertices = Utils.newFloatArray(2 * 1024);
|
|
10784
10955
|
this.context = context instanceof ManagedWebGLRenderingContext ? context : new ManagedWebGLRenderingContext(context);
|
|
10785
10956
|
}
|
|
10786
|
-
draw(shapes, skeleton, ignoredBones
|
|
10957
|
+
draw(shapes, skeleton, ignoredBones) {
|
|
10787
10958
|
let skeletonX = skeleton.x;
|
|
10788
10959
|
let skeletonY = skeleton.y;
|
|
10789
10960
|
let gl = this.context.gl;
|
|
@@ -10965,7 +11136,7 @@ var spine = (() => {
|
|
|
10965
11136
|
this.tempColor2 = new Color();
|
|
10966
11137
|
this.vertexSize = 2 + 2 + 4;
|
|
10967
11138
|
this.twoColorTint = false;
|
|
10968
|
-
this.renderable = new Renderable(
|
|
11139
|
+
this.renderable = new Renderable([], 0, 0);
|
|
10969
11140
|
this.clipper = new SkeletonClipping();
|
|
10970
11141
|
this.temp = new Vector2();
|
|
10971
11142
|
this.temp2 = new Vector2();
|
|
@@ -10986,10 +11157,10 @@ var spine = (() => {
|
|
|
10986
11157
|
let tempLight = this.temp3;
|
|
10987
11158
|
let tempDark = this.temp4;
|
|
10988
11159
|
let renderable = this.renderable;
|
|
10989
|
-
let uvs
|
|
10990
|
-
let triangles
|
|
11160
|
+
let uvs;
|
|
11161
|
+
let triangles;
|
|
10991
11162
|
let drawOrder = skeleton.drawOrder;
|
|
10992
|
-
let attachmentColor
|
|
11163
|
+
let attachmentColor;
|
|
10993
11164
|
let skeletonColor = skeleton.color;
|
|
10994
11165
|
let vertexSize = twoColorTint ? 12 : 8;
|
|
10995
11166
|
let inRange = false;
|
|
@@ -11013,7 +11184,7 @@ var spine = (() => {
|
|
|
11013
11184
|
inRange = false;
|
|
11014
11185
|
}
|
|
11015
11186
|
let attachment = slot.getAttachment();
|
|
11016
|
-
let texture
|
|
11187
|
+
let texture;
|
|
11017
11188
|
if (attachment instanceof RegionAttachment) {
|
|
11018
11189
|
let region = attachment;
|
|
11019
11190
|
renderable.vertices = this.vertices;
|
|
@@ -11247,6 +11418,7 @@ var spine = (() => {
|
|
|
11247
11418
|
var SceneRenderer = class {
|
|
11248
11419
|
constructor(canvas, context, twoColorTint = true) {
|
|
11249
11420
|
this.twoColorTint = false;
|
|
11421
|
+
this.activeRenderer = null;
|
|
11250
11422
|
this.canvas = canvas;
|
|
11251
11423
|
this.context = context instanceof ManagedWebGLRenderingContext ? context : new ManagedWebGLRenderingContext(context);
|
|
11252
11424
|
this.twoColorTint = twoColorTint;
|
|
@@ -11274,14 +11446,14 @@ var spine = (() => {
|
|
|
11274
11446
|
this.skeletonRenderer.premultipliedAlpha = premultipliedAlpha;
|
|
11275
11447
|
this.skeletonRenderer.draw(this.batcher, skeleton, slotRangeStart, slotRangeEnd);
|
|
11276
11448
|
}
|
|
11277
|
-
drawSkeletonDebug(skeleton, premultipliedAlpha = false, ignoredBones
|
|
11449
|
+
drawSkeletonDebug(skeleton, premultipliedAlpha = false, ignoredBones) {
|
|
11278
11450
|
this.enableRenderer(this.shapes);
|
|
11279
11451
|
this.skeletonDebugRenderer.premultipliedAlpha = premultipliedAlpha;
|
|
11280
11452
|
this.skeletonDebugRenderer.draw(this.shapes, skeleton, ignoredBones);
|
|
11281
11453
|
}
|
|
11282
|
-
drawTexture(texture, x, y, width, height, color
|
|
11454
|
+
drawTexture(texture, x, y, width, height, color) {
|
|
11283
11455
|
this.enableRenderer(this.batcher);
|
|
11284
|
-
if (color
|
|
11456
|
+
if (!color)
|
|
11285
11457
|
color = WHITE;
|
|
11286
11458
|
var i = 0;
|
|
11287
11459
|
quad[i++] = x;
|
|
@@ -11342,9 +11514,9 @@ var spine = (() => {
|
|
|
11342
11514
|
}
|
|
11343
11515
|
this.batcher.draw(texture, quad, QUAD_TRIANGLES);
|
|
11344
11516
|
}
|
|
11345
|
-
drawTextureUV(texture, x, y, width, height, u, v, u2, v2, color
|
|
11517
|
+
drawTextureUV(texture, x, y, width, height, u, v, u2, v2, color) {
|
|
11346
11518
|
this.enableRenderer(this.batcher);
|
|
11347
|
-
if (color
|
|
11519
|
+
if (!color)
|
|
11348
11520
|
color = WHITE;
|
|
11349
11521
|
var i = 0;
|
|
11350
11522
|
quad[i++] = x;
|
|
@@ -11405,9 +11577,9 @@ var spine = (() => {
|
|
|
11405
11577
|
}
|
|
11406
11578
|
this.batcher.draw(texture, quad, QUAD_TRIANGLES);
|
|
11407
11579
|
}
|
|
11408
|
-
drawTextureRotated(texture, x, y, width, height, pivotX, pivotY, angle, color
|
|
11580
|
+
drawTextureRotated(texture, x, y, width, height, pivotX, pivotY, angle, color) {
|
|
11409
11581
|
this.enableRenderer(this.batcher);
|
|
11410
|
-
if (color
|
|
11582
|
+
if (!color)
|
|
11411
11583
|
color = WHITE;
|
|
11412
11584
|
let worldOriginX = x + pivotX;
|
|
11413
11585
|
let worldOriginY = y + pivotY;
|
|
@@ -11519,9 +11691,9 @@ var spine = (() => {
|
|
|
11519
11691
|
}
|
|
11520
11692
|
this.batcher.draw(texture, quad, QUAD_TRIANGLES);
|
|
11521
11693
|
}
|
|
11522
|
-
drawRegion(region, x, y, width, height, color
|
|
11694
|
+
drawRegion(region, x, y, width, height, color) {
|
|
11523
11695
|
this.enableRenderer(this.batcher);
|
|
11524
|
-
if (color
|
|
11696
|
+
if (!color)
|
|
11525
11697
|
color = WHITE;
|
|
11526
11698
|
var i = 0;
|
|
11527
11699
|
quad[i++] = x;
|
|
@@ -11582,35 +11754,35 @@ var spine = (() => {
|
|
|
11582
11754
|
}
|
|
11583
11755
|
this.batcher.draw(region.page.texture, quad, QUAD_TRIANGLES);
|
|
11584
11756
|
}
|
|
11585
|
-
line(x, y, x2, y2, color
|
|
11757
|
+
line(x, y, x2, y2, color, color2) {
|
|
11586
11758
|
this.enableRenderer(this.shapes);
|
|
11587
11759
|
this.shapes.line(x, y, x2, y2, color);
|
|
11588
11760
|
}
|
|
11589
|
-
triangle(filled, x, y, x2, y2, x3, y3, color
|
|
11761
|
+
triangle(filled, x, y, x2, y2, x3, y3, color, color2, color3) {
|
|
11590
11762
|
this.enableRenderer(this.shapes);
|
|
11591
11763
|
this.shapes.triangle(filled, x, y, x2, y2, x3, y3, color, color2, color3);
|
|
11592
11764
|
}
|
|
11593
|
-
quad(filled, x, y, x2, y2, x3, y3, x4, y4, color
|
|
11765
|
+
quad(filled, x, y, x2, y2, x3, y3, x4, y4, color, color2, color3, color4) {
|
|
11594
11766
|
this.enableRenderer(this.shapes);
|
|
11595
11767
|
this.shapes.quad(filled, x, y, x2, y2, x3, y3, x4, y4, color, color2, color3, color4);
|
|
11596
11768
|
}
|
|
11597
|
-
rect(filled, x, y, width, height, color
|
|
11769
|
+
rect(filled, x, y, width, height, color) {
|
|
11598
11770
|
this.enableRenderer(this.shapes);
|
|
11599
11771
|
this.shapes.rect(filled, x, y, width, height, color);
|
|
11600
11772
|
}
|
|
11601
|
-
rectLine(filled, x1, y1, x2, y2, width, color
|
|
11773
|
+
rectLine(filled, x1, y1, x2, y2, width, color) {
|
|
11602
11774
|
this.enableRenderer(this.shapes);
|
|
11603
11775
|
this.shapes.rectLine(filled, x1, y1, x2, y2, width, color);
|
|
11604
11776
|
}
|
|
11605
|
-
polygon(polygonVertices, offset, count, color
|
|
11777
|
+
polygon(polygonVertices, offset, count, color) {
|
|
11606
11778
|
this.enableRenderer(this.shapes);
|
|
11607
11779
|
this.shapes.polygon(polygonVertices, offset, count, color);
|
|
11608
11780
|
}
|
|
11609
|
-
circle(filled, x, y, radius, color
|
|
11781
|
+
circle(filled, x, y, radius, color, segments = 0) {
|
|
11610
11782
|
this.enableRenderer(this.shapes);
|
|
11611
11783
|
this.shapes.circle(filled, x, y, radius, color, segments);
|
|
11612
11784
|
}
|
|
11613
|
-
curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color
|
|
11785
|
+
curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color) {
|
|
11614
11786
|
this.enableRenderer(this.shapes);
|
|
11615
11787
|
this.shapes.curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color);
|
|
11616
11788
|
}
|
|
@@ -11706,8 +11878,9 @@ var spine = (() => {
|
|
|
11706
11878
|
}
|
|
11707
11879
|
}
|
|
11708
11880
|
dispose() {
|
|
11709
|
-
|
|
11710
|
-
this.
|
|
11881
|
+
var _a, _b;
|
|
11882
|
+
(_a = this.logo) == null ? void 0 : _a.dispose();
|
|
11883
|
+
(_b = this.spinner) == null ? void 0 : _b.dispose();
|
|
11711
11884
|
}
|
|
11712
11885
|
draw(complete = false) {
|
|
11713
11886
|
if (loaded < 2 || complete && this.fadeOut > FADE_OUT)
|
|
@@ -11753,7 +11926,8 @@ var spine = (() => {
|
|
|
11753
11926
|
renderer.camera.zoom = Math.max(1, spinnerSize / canvas.height);
|
|
11754
11927
|
renderer.begin();
|
|
11755
11928
|
renderer.drawTexture(this.logo, (canvas.width - logoWidth) / 2, (canvas.height - logoHeight) / 2, logoWidth, logoHeight, tempColor);
|
|
11756
|
-
|
|
11929
|
+
if (this.spinner)
|
|
11930
|
+
renderer.drawTextureRotated(this.spinner, (canvas.width - spinnerSize) / 2, (canvas.height - spinnerSize) / 2, spinnerSize, spinnerSize, spinnerSize / 2, spinnerSize / 2, this.angle, tempColor);
|
|
11757
11931
|
renderer.end();
|
|
11758
11932
|
}
|
|
11759
11933
|
};
|
|
@@ -11764,9 +11938,9 @@ var spine = (() => {
|
|
|
11764
11938
|
var SpineCanvas = class {
|
|
11765
11939
|
constructor(canvas, config) {
|
|
11766
11940
|
this.time = new TimeKeeper();
|
|
11767
|
-
if (config.pathPrefix
|
|
11941
|
+
if (!config.pathPrefix)
|
|
11768
11942
|
config.pathPrefix = "";
|
|
11769
|
-
if (config.app
|
|
11943
|
+
if (!config.app)
|
|
11770
11944
|
config.app = {
|
|
11771
11945
|
loadAssets: () => {
|
|
11772
11946
|
},
|
|
@@ -11779,7 +11953,7 @@ var spine = (() => {
|
|
|
11779
11953
|
error: () => {
|
|
11780
11954
|
}
|
|
11781
11955
|
};
|
|
11782
|
-
if (config.webglConfig
|
|
11956
|
+
if (config.webglConfig)
|
|
11783
11957
|
config.webglConfig = { alpha: true };
|
|
11784
11958
|
this.htmlCanvas = canvas;
|
|
11785
11959
|
this.context = new ManagedWebGLRenderingContext(canvas, config.webglConfig);
|
|
@@ -11787,19 +11961,24 @@ var spine = (() => {
|
|
|
11787
11961
|
this.gl = this.context.gl;
|
|
11788
11962
|
this.assetManager = new AssetManager(this.context, config.pathPrefix);
|
|
11789
11963
|
this.input = new Input(canvas);
|
|
11790
|
-
config.app.loadAssets
|
|
11964
|
+
if (config.app.loadAssets)
|
|
11965
|
+
config.app.loadAssets(this);
|
|
11791
11966
|
let loop = () => {
|
|
11792
11967
|
requestAnimationFrame(loop);
|
|
11793
11968
|
this.time.update();
|
|
11794
|
-
config.app.update
|
|
11795
|
-
|
|
11969
|
+
if (config.app.update)
|
|
11970
|
+
config.app.update(this, this.time.delta);
|
|
11971
|
+
if (config.app.render)
|
|
11972
|
+
config.app.render(this);
|
|
11796
11973
|
};
|
|
11797
11974
|
let waitForAssets = () => {
|
|
11798
11975
|
if (this.assetManager.isLoadingComplete()) {
|
|
11799
11976
|
if (this.assetManager.hasErrors()) {
|
|
11800
|
-
config.app.error
|
|
11977
|
+
if (config.app.error)
|
|
11978
|
+
config.app.error(this, this.assetManager.getErrors());
|
|
11801
11979
|
} else {
|
|
11802
|
-
config.app.initialize
|
|
11980
|
+
if (config.app.initialize)
|
|
11981
|
+
config.app.initialize(this);
|
|
11803
11982
|
loop();
|
|
11804
11983
|
}
|
|
11805
11984
|
return;
|