@esotericsoftware/spine-webgl 4.1.15 → 4.1.18
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 -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 +482 -448
- 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,7 +553,7 @@ 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
558
|
this.timelineAttahment = this;
|
|
561
559
|
}
|
|
@@ -626,8 +624,7 @@ 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
629
|
attachment.timelineAttahment = this.timelineAttahment;
|
|
633
630
|
}
|
|
@@ -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,6 +1923,8 @@ var spine = (() => {
|
|
|
1931
1923
|
if (!slot.bone.active)
|
|
1932
1924
|
return;
|
|
1933
1925
|
let slotAttachment = slot.getAttachment();
|
|
1926
|
+
if (!slotAttachment)
|
|
1927
|
+
return;
|
|
1934
1928
|
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttahment != this.attachment)
|
|
1935
1929
|
return;
|
|
1936
1930
|
let deform = slot.deform;
|
|
@@ -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 {
|
|
@@ -2565,9 +2558,8 @@ var spine = (() => {
|
|
|
2565
2558
|
SequenceTimeline.DELAY = 2;
|
|
2566
2559
|
|
|
2567
2560
|
// spine-core/src/AnimationState.ts
|
|
2568
|
-
var
|
|
2561
|
+
var _AnimationState = class {
|
|
2569
2562
|
constructor(data) {
|
|
2570
|
-
this.data = null;
|
|
2571
2563
|
this.tracks = new Array();
|
|
2572
2564
|
this.timeScale = 1;
|
|
2573
2565
|
this.unkeyedState = 0;
|
|
@@ -2580,9 +2572,7 @@ var spine = (() => {
|
|
|
2580
2572
|
this.data = data;
|
|
2581
2573
|
}
|
|
2582
2574
|
static emptyAnimation() {
|
|
2583
|
-
|
|
2584
|
-
_emptyAnimation = new Animation("<empty>", [], 0);
|
|
2585
|
-
return _emptyAnimation;
|
|
2575
|
+
return _AnimationState._emptyAnimation;
|
|
2586
2576
|
}
|
|
2587
2577
|
update(delta) {
|
|
2588
2578
|
delta *= this.timeScale;
|
|
@@ -3015,13 +3005,13 @@ var spine = (() => {
|
|
|
3015
3005
|
return entry;
|
|
3016
3006
|
}
|
|
3017
3007
|
setEmptyAnimation(trackIndex, mixDuration = 0) {
|
|
3018
|
-
let entry = this.setAnimationWith(trackIndex,
|
|
3008
|
+
let entry = this.setAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false);
|
|
3019
3009
|
entry.mixDuration = mixDuration;
|
|
3020
3010
|
entry.trackEnd = mixDuration;
|
|
3021
3011
|
return entry;
|
|
3022
3012
|
}
|
|
3023
3013
|
addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
|
|
3024
|
-
let entry = this.addAnimationWith(trackIndex,
|
|
3014
|
+
let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
|
|
3025
3015
|
if (delay <= 0)
|
|
3026
3016
|
entry.delay += entry.mixDuration - mixDuration;
|
|
3027
3017
|
entry.mixDuration = mixDuration;
|
|
@@ -3160,6 +3150,8 @@ var spine = (() => {
|
|
|
3160
3150
|
this.queue.clear();
|
|
3161
3151
|
}
|
|
3162
3152
|
};
|
|
3153
|
+
var AnimationState = _AnimationState;
|
|
3154
|
+
AnimationState._emptyAnimation = new Animation("<empty>", [], 0);
|
|
3163
3155
|
var TrackEntry = class {
|
|
3164
3156
|
constructor() {
|
|
3165
3157
|
this.animation = null;
|
|
@@ -3241,7 +3233,6 @@ var spine = (() => {
|
|
|
3241
3233
|
constructor(animState) {
|
|
3242
3234
|
this.objects = [];
|
|
3243
3235
|
this.drainDisabled = false;
|
|
3244
|
-
this.animState = null;
|
|
3245
3236
|
this.animState = animState;
|
|
3246
3237
|
}
|
|
3247
3238
|
start(entry) {
|
|
@@ -3284,45 +3275,57 @@ var spine = (() => {
|
|
|
3284
3275
|
case EventType.start:
|
|
3285
3276
|
if (entry.listener && entry.listener.start)
|
|
3286
3277
|
entry.listener.start(entry);
|
|
3287
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3288
|
-
|
|
3289
|
-
|
|
3278
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3279
|
+
let listener = listeners[ii];
|
|
3280
|
+
if (listener.start)
|
|
3281
|
+
listener.start(entry);
|
|
3282
|
+
}
|
|
3290
3283
|
break;
|
|
3291
3284
|
case EventType.interrupt:
|
|
3292
3285
|
if (entry.listener && entry.listener.interrupt)
|
|
3293
3286
|
entry.listener.interrupt(entry);
|
|
3294
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3295
|
-
|
|
3296
|
-
|
|
3287
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3288
|
+
let listener = listeners[ii];
|
|
3289
|
+
if (listener.interrupt)
|
|
3290
|
+
listener.interrupt(entry);
|
|
3291
|
+
}
|
|
3297
3292
|
break;
|
|
3298
3293
|
case EventType.end:
|
|
3299
3294
|
if (entry.listener && entry.listener.end)
|
|
3300
3295
|
entry.listener.end(entry);
|
|
3301
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3302
|
-
|
|
3303
|
-
|
|
3296
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3297
|
+
let listener = listeners[ii];
|
|
3298
|
+
if (listener.end)
|
|
3299
|
+
listener.end(entry);
|
|
3300
|
+
}
|
|
3304
3301
|
case EventType.dispose:
|
|
3305
3302
|
if (entry.listener && entry.listener.dispose)
|
|
3306
3303
|
entry.listener.dispose(entry);
|
|
3307
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3308
|
-
|
|
3309
|
-
|
|
3304
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3305
|
+
let listener = listeners[ii];
|
|
3306
|
+
if (listener.dispose)
|
|
3307
|
+
listener.dispose(entry);
|
|
3308
|
+
}
|
|
3310
3309
|
this.animState.trackEntryPool.free(entry);
|
|
3311
3310
|
break;
|
|
3312
3311
|
case EventType.complete:
|
|
3313
3312
|
if (entry.listener && entry.listener.complete)
|
|
3314
3313
|
entry.listener.complete(entry);
|
|
3315
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3316
|
-
|
|
3317
|
-
|
|
3314
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3315
|
+
let listener = listeners[ii];
|
|
3316
|
+
if (listener.complete)
|
|
3317
|
+
listener.complete(entry);
|
|
3318
|
+
}
|
|
3318
3319
|
break;
|
|
3319
3320
|
case EventType.event:
|
|
3320
3321
|
let event = objects[i++ + 2];
|
|
3321
3322
|
if (entry.listener && entry.listener.event)
|
|
3322
3323
|
entry.listener.event(entry, event);
|
|
3323
|
-
for (let ii = 0; ii < listeners.length; ii++)
|
|
3324
|
-
|
|
3325
|
-
|
|
3324
|
+
for (let ii = 0; ii < listeners.length; ii++) {
|
|
3325
|
+
let listener = listeners[ii];
|
|
3326
|
+
if (listener.event)
|
|
3327
|
+
listener.event(entry, event);
|
|
3328
|
+
}
|
|
3326
3329
|
break;
|
|
3327
3330
|
}
|
|
3328
3331
|
}
|
|
@@ -3363,12 +3366,10 @@ var spine = (() => {
|
|
|
3363
3366
|
var HOLD_MIX = 4;
|
|
3364
3367
|
var SETUP = 1;
|
|
3365
3368
|
var CURRENT = 2;
|
|
3366
|
-
var _emptyAnimation = null;
|
|
3367
3369
|
|
|
3368
3370
|
// spine-core/src/AnimationStateData.ts
|
|
3369
3371
|
var AnimationStateData = class {
|
|
3370
3372
|
constructor(skeletonData) {
|
|
3371
|
-
this.skeletonData = null;
|
|
3372
3373
|
this.animationToMixTime = {};
|
|
3373
3374
|
this.defaultMix = 0;
|
|
3374
3375
|
if (!skeletonData)
|
|
@@ -3485,65 +3486,63 @@ var spine = (() => {
|
|
|
3485
3486
|
this.regions = new Array();
|
|
3486
3487
|
let reader = new TextureAtlasReader(atlasText);
|
|
3487
3488
|
let entry = new Array(4);
|
|
3488
|
-
let page = null;
|
|
3489
|
-
let region = null;
|
|
3490
3489
|
let pageFields = {};
|
|
3491
|
-
pageFields["size"] = () => {
|
|
3492
|
-
|
|
3493
|
-
|
|
3490
|
+
pageFields["size"] = (page2) => {
|
|
3491
|
+
page2.width = parseInt(entry[1]);
|
|
3492
|
+
page2.height = parseInt(entry[2]);
|
|
3494
3493
|
};
|
|
3495
3494
|
pageFields["format"] = () => {
|
|
3496
3495
|
};
|
|
3497
|
-
pageFields["filter"] = () => {
|
|
3498
|
-
|
|
3499
|
-
|
|
3496
|
+
pageFields["filter"] = (page2) => {
|
|
3497
|
+
page2.minFilter = Utils.enumValue(TextureFilter, entry[1]);
|
|
3498
|
+
page2.magFilter = Utils.enumValue(TextureFilter, entry[2]);
|
|
3500
3499
|
};
|
|
3501
|
-
pageFields["repeat"] = () => {
|
|
3500
|
+
pageFields["repeat"] = (page2) => {
|
|
3502
3501
|
if (entry[1].indexOf("x") != -1)
|
|
3503
|
-
|
|
3502
|
+
page2.uWrap = TextureWrap.Repeat;
|
|
3504
3503
|
if (entry[1].indexOf("y") != -1)
|
|
3505
|
-
|
|
3504
|
+
page2.vWrap = TextureWrap.Repeat;
|
|
3506
3505
|
};
|
|
3507
|
-
pageFields["pma"] = () => {
|
|
3508
|
-
|
|
3506
|
+
pageFields["pma"] = (page2) => {
|
|
3507
|
+
page2.pma = entry[1] == "true";
|
|
3509
3508
|
};
|
|
3510
3509
|
var regionFields = {};
|
|
3511
|
-
regionFields["xy"] = () => {
|
|
3510
|
+
regionFields["xy"] = (region) => {
|
|
3512
3511
|
region.x = parseInt(entry[1]);
|
|
3513
3512
|
region.y = parseInt(entry[2]);
|
|
3514
3513
|
};
|
|
3515
|
-
regionFields["size"] = () => {
|
|
3514
|
+
regionFields["size"] = (region) => {
|
|
3516
3515
|
region.width = parseInt(entry[1]);
|
|
3517
3516
|
region.height = parseInt(entry[2]);
|
|
3518
3517
|
};
|
|
3519
|
-
regionFields["bounds"] = () => {
|
|
3518
|
+
regionFields["bounds"] = (region) => {
|
|
3520
3519
|
region.x = parseInt(entry[1]);
|
|
3521
3520
|
region.y = parseInt(entry[2]);
|
|
3522
3521
|
region.width = parseInt(entry[3]);
|
|
3523
3522
|
region.height = parseInt(entry[4]);
|
|
3524
3523
|
};
|
|
3525
|
-
regionFields["offset"] = () => {
|
|
3524
|
+
regionFields["offset"] = (region) => {
|
|
3526
3525
|
region.offsetX = parseInt(entry[1]);
|
|
3527
3526
|
region.offsetY = parseInt(entry[2]);
|
|
3528
3527
|
};
|
|
3529
|
-
regionFields["orig"] = () => {
|
|
3528
|
+
regionFields["orig"] = (region) => {
|
|
3530
3529
|
region.originalWidth = parseInt(entry[1]);
|
|
3531
3530
|
region.originalHeight = parseInt(entry[2]);
|
|
3532
3531
|
};
|
|
3533
|
-
regionFields["offsets"] = () => {
|
|
3532
|
+
regionFields["offsets"] = (region) => {
|
|
3534
3533
|
region.offsetX = parseInt(entry[1]);
|
|
3535
3534
|
region.offsetY = parseInt(entry[2]);
|
|
3536
3535
|
region.originalWidth = parseInt(entry[3]);
|
|
3537
3536
|
region.originalHeight = parseInt(entry[4]);
|
|
3538
3537
|
};
|
|
3539
|
-
regionFields["rotate"] = () => {
|
|
3538
|
+
regionFields["rotate"] = (region) => {
|
|
3540
3539
|
let value = entry[1];
|
|
3541
3540
|
if (value == "true")
|
|
3542
3541
|
region.degrees = 90;
|
|
3543
3542
|
else if (value != "false")
|
|
3544
3543
|
region.degrees = parseInt(value);
|
|
3545
3544
|
};
|
|
3546
|
-
regionFields["index"] = () => {
|
|
3545
|
+
regionFields["index"] = (region) => {
|
|
3547
3546
|
region.index = parseInt(entry[1]);
|
|
3548
3547
|
};
|
|
3549
3548
|
let line = reader.readLine();
|
|
@@ -3556,6 +3555,7 @@ var spine = (() => {
|
|
|
3556
3555
|
break;
|
|
3557
3556
|
line = reader.readLine();
|
|
3558
3557
|
}
|
|
3558
|
+
let page = null;
|
|
3559
3559
|
let names = null;
|
|
3560
3560
|
let values = null;
|
|
3561
3561
|
while (true) {
|
|
@@ -3565,32 +3565,29 @@ var spine = (() => {
|
|
|
3565
3565
|
page = null;
|
|
3566
3566
|
line = reader.readLine();
|
|
3567
3567
|
} else if (!page) {
|
|
3568
|
-
page = new TextureAtlasPage();
|
|
3569
|
-
page.name = line.trim();
|
|
3568
|
+
page = new TextureAtlasPage(line.trim());
|
|
3570
3569
|
while (true) {
|
|
3571
3570
|
if (reader.readEntry(entry, line = reader.readLine()) == 0)
|
|
3572
3571
|
break;
|
|
3573
3572
|
let field = pageFields[entry[0]];
|
|
3574
3573
|
if (field)
|
|
3575
|
-
field();
|
|
3574
|
+
field(page);
|
|
3576
3575
|
}
|
|
3577
3576
|
this.pages.push(page);
|
|
3578
3577
|
} else {
|
|
3579
|
-
region = new TextureAtlasRegion();
|
|
3580
|
-
region.page = page;
|
|
3581
|
-
region.name = line;
|
|
3578
|
+
let region = new TextureAtlasRegion(page, line);
|
|
3582
3579
|
while (true) {
|
|
3583
3580
|
let count = reader.readEntry(entry, line = reader.readLine());
|
|
3584
3581
|
if (count == 0)
|
|
3585
3582
|
break;
|
|
3586
3583
|
let field = regionFields[entry[0]];
|
|
3587
3584
|
if (field)
|
|
3588
|
-
field();
|
|
3585
|
+
field(region);
|
|
3589
3586
|
else {
|
|
3590
|
-
if (!names)
|
|
3587
|
+
if (!names)
|
|
3591
3588
|
names = [];
|
|
3589
|
+
if (!values)
|
|
3592
3590
|
values = [];
|
|
3593
|
-
}
|
|
3594
3591
|
names.push(entry[0]);
|
|
3595
3592
|
let entryValues = [];
|
|
3596
3593
|
for (let i = 0; i < count; i++)
|
|
@@ -3602,7 +3599,7 @@ var spine = (() => {
|
|
|
3602
3599
|
region.originalWidth = region.width;
|
|
3603
3600
|
region.originalHeight = region.height;
|
|
3604
3601
|
}
|
|
3605
|
-
if (names && names.length > 0) {
|
|
3602
|
+
if (names && names.length > 0 && values && values.length > 0) {
|
|
3606
3603
|
region.names = names;
|
|
3607
3604
|
region.values = values;
|
|
3608
3605
|
names = null;
|
|
@@ -3634,14 +3631,14 @@ var spine = (() => {
|
|
|
3634
3631
|
page.setTexture(assetManager.get(pathPrefix + page.name));
|
|
3635
3632
|
}
|
|
3636
3633
|
dispose() {
|
|
3634
|
+
var _a;
|
|
3637
3635
|
for (let i = 0; i < this.pages.length; i++) {
|
|
3638
|
-
this.pages[i].texture.dispose();
|
|
3636
|
+
(_a = this.pages[i].texture) == null ? void 0 : _a.dispose();
|
|
3639
3637
|
}
|
|
3640
3638
|
}
|
|
3641
3639
|
};
|
|
3642
3640
|
var TextureAtlasReader = class {
|
|
3643
3641
|
constructor(text) {
|
|
3644
|
-
this.lines = null;
|
|
3645
3642
|
this.index = 0;
|
|
3646
3643
|
this.lines = text.split(/\r\n|\r|\n/);
|
|
3647
3644
|
}
|
|
@@ -3674,8 +3671,7 @@ var spine = (() => {
|
|
|
3674
3671
|
}
|
|
3675
3672
|
};
|
|
3676
3673
|
var TextureAtlasPage = class {
|
|
3677
|
-
constructor() {
|
|
3678
|
-
this.name = null;
|
|
3674
|
+
constructor(name) {
|
|
3679
3675
|
this.minFilter = TextureFilter.Nearest;
|
|
3680
3676
|
this.magFilter = TextureFilter.Nearest;
|
|
3681
3677
|
this.uWrap = TextureWrap.ClampToEdge;
|
|
@@ -3684,6 +3680,7 @@ var spine = (() => {
|
|
|
3684
3680
|
this.width = 0;
|
|
3685
3681
|
this.height = 0;
|
|
3686
3682
|
this.pma = false;
|
|
3683
|
+
this.name = name;
|
|
3687
3684
|
}
|
|
3688
3685
|
setTexture(texture) {
|
|
3689
3686
|
this.texture = texture;
|
|
@@ -3692,10 +3689,8 @@ var spine = (() => {
|
|
|
3692
3689
|
}
|
|
3693
3690
|
};
|
|
3694
3691
|
var TextureAtlasRegion = class extends TextureRegion {
|
|
3695
|
-
constructor() {
|
|
3696
|
-
super(
|
|
3697
|
-
this.page = null;
|
|
3698
|
-
this.name = null;
|
|
3692
|
+
constructor(page, name) {
|
|
3693
|
+
super();
|
|
3699
3694
|
this.x = 0;
|
|
3700
3695
|
this.y = 0;
|
|
3701
3696
|
this.offsetX = 0;
|
|
@@ -3706,28 +3701,32 @@ var spine = (() => {
|
|
|
3706
3701
|
this.degrees = 0;
|
|
3707
3702
|
this.names = null;
|
|
3708
3703
|
this.values = null;
|
|
3704
|
+
this.page = page;
|
|
3705
|
+
this.name = name;
|
|
3709
3706
|
}
|
|
3710
3707
|
};
|
|
3711
3708
|
|
|
3712
3709
|
// spine-core/src/attachments/MeshAttachment.ts
|
|
3713
3710
|
var MeshAttachment = class extends VertexAttachment {
|
|
3714
|
-
constructor(name) {
|
|
3711
|
+
constructor(name, path) {
|
|
3715
3712
|
super(name);
|
|
3716
3713
|
this.region = null;
|
|
3717
|
-
this.
|
|
3718
|
-
this.
|
|
3719
|
-
this.
|
|
3720
|
-
this.triangles = null;
|
|
3714
|
+
this.regionUVs = [];
|
|
3715
|
+
this.uvs = [];
|
|
3716
|
+
this.triangles = [];
|
|
3721
3717
|
this.color = new Color(1, 1, 1, 1);
|
|
3722
3718
|
this.width = 0;
|
|
3723
3719
|
this.height = 0;
|
|
3724
3720
|
this.hullLength = 0;
|
|
3725
|
-
this.edges =
|
|
3721
|
+
this.edges = [];
|
|
3726
3722
|
this.parentMesh = null;
|
|
3727
3723
|
this.sequence = null;
|
|
3728
3724
|
this.tempColor = new Color(0, 0, 0, 0);
|
|
3725
|
+
this.path = path;
|
|
3729
3726
|
}
|
|
3730
3727
|
updateRegion() {
|
|
3728
|
+
if (!this.region)
|
|
3729
|
+
throw new Error("Region not set.");
|
|
3731
3730
|
let regionUVs = this.regionUVs;
|
|
3732
3731
|
if (!this.uvs || this.uvs.length != regionUVs.length)
|
|
3733
3732
|
this.uvs = Utils.newFloatArray(regionUVs.length);
|
|
@@ -3803,9 +3802,8 @@ var spine = (() => {
|
|
|
3803
3802
|
copy() {
|
|
3804
3803
|
if (this.parentMesh)
|
|
3805
3804
|
return this.newLinkedMesh();
|
|
3806
|
-
let copy = new MeshAttachment(this.name);
|
|
3805
|
+
let copy = new MeshAttachment(this.name, this.path);
|
|
3807
3806
|
copy.region = this.region;
|
|
3808
|
-
copy.path = this.path;
|
|
3809
3807
|
copy.color.setFromColor(this.color);
|
|
3810
3808
|
this.copyTo(copy);
|
|
3811
3809
|
copy.regionUVs = new Array(this.regionUVs.length);
|
|
@@ -3830,9 +3828,8 @@ var spine = (() => {
|
|
|
3830
3828
|
super.computeWorldVertices(slot, start, count, worldVertices, offset, stride);
|
|
3831
3829
|
}
|
|
3832
3830
|
newLinkedMesh() {
|
|
3833
|
-
let copy = new MeshAttachment(this.name);
|
|
3831
|
+
let copy = new MeshAttachment(this.name, this.path);
|
|
3834
3832
|
copy.region = this.region;
|
|
3835
|
-
copy.path = this.path;
|
|
3836
3833
|
copy.color.setFromColor(this.color);
|
|
3837
3834
|
copy.timelineAttahment = this.timelineAttahment;
|
|
3838
3835
|
copy.setParentMesh(this.parentMesh ? this.parentMesh : this);
|
|
@@ -3846,7 +3843,7 @@ var spine = (() => {
|
|
|
3846
3843
|
var PathAttachment = class extends VertexAttachment {
|
|
3847
3844
|
constructor(name) {
|
|
3848
3845
|
super(name);
|
|
3849
|
-
this.lengths =
|
|
3846
|
+
this.lengths = [];
|
|
3850
3847
|
this.closed = false;
|
|
3851
3848
|
this.constantSpeed = false;
|
|
3852
3849
|
this.color = new Color(1, 1, 1, 1);
|
|
@@ -3895,7 +3892,7 @@ var spine = (() => {
|
|
|
3895
3892
|
|
|
3896
3893
|
// spine-core/src/attachments/RegionAttachment.ts
|
|
3897
3894
|
var _RegionAttachment = class extends Attachment {
|
|
3898
|
-
constructor(name) {
|
|
3895
|
+
constructor(name, path) {
|
|
3899
3896
|
super(name);
|
|
3900
3897
|
this.x = 0;
|
|
3901
3898
|
this.y = 0;
|
|
@@ -3905,15 +3902,17 @@ var spine = (() => {
|
|
|
3905
3902
|
this.width = 0;
|
|
3906
3903
|
this.height = 0;
|
|
3907
3904
|
this.color = new Color(1, 1, 1, 1);
|
|
3908
|
-
this.path = null;
|
|
3909
3905
|
this.rendererObject = null;
|
|
3910
3906
|
this.region = null;
|
|
3911
3907
|
this.sequence = null;
|
|
3912
3908
|
this.offset = Utils.newFloatArray(8);
|
|
3913
3909
|
this.uvs = Utils.newFloatArray(8);
|
|
3914
3910
|
this.tempColor = new Color(1, 1, 1, 1);
|
|
3911
|
+
this.path = path;
|
|
3915
3912
|
}
|
|
3916
3913
|
updateRegion() {
|
|
3914
|
+
if (!this.region)
|
|
3915
|
+
throw new Error("Region not set.");
|
|
3917
3916
|
let region = this.region;
|
|
3918
3917
|
let regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
|
3919
3918
|
let regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
|
@@ -3992,10 +3991,9 @@ var spine = (() => {
|
|
|
3992
3991
|
worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
|
|
3993
3992
|
}
|
|
3994
3993
|
copy() {
|
|
3995
|
-
let copy = new _RegionAttachment(this.name);
|
|
3994
|
+
let copy = new _RegionAttachment(this.name, this.path);
|
|
3996
3995
|
copy.region = this.region;
|
|
3997
3996
|
copy.rendererObject = this.rendererObject;
|
|
3998
|
-
copy.path = this.path;
|
|
3999
3997
|
copy.x = this.x;
|
|
4000
3998
|
copy.y = this.y;
|
|
4001
3999
|
copy.scaleX = this.scaleX;
|
|
@@ -4047,21 +4045,21 @@ var spine = (() => {
|
|
|
4047
4045
|
// spine-core/src/AtlasAttachmentLoader.ts
|
|
4048
4046
|
var AtlasAttachmentLoader = class {
|
|
4049
4047
|
constructor(atlas) {
|
|
4050
|
-
this.atlas = null;
|
|
4051
4048
|
this.atlas = atlas;
|
|
4052
4049
|
}
|
|
4053
4050
|
loadSequence(name, basePath, sequence) {
|
|
4054
4051
|
let regions = sequence.regions;
|
|
4055
4052
|
for (let i = 0, n = regions.length; i < n; i++) {
|
|
4056
4053
|
let path = sequence.getPath(basePath, i);
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
if (regions[i] == null)
|
|
4054
|
+
let region = this.atlas.findRegion(path);
|
|
4055
|
+
if (region == null)
|
|
4060
4056
|
throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
|
|
4057
|
+
regions[i] = region;
|
|
4058
|
+
regions[i].renderObject = regions[i];
|
|
4061
4059
|
}
|
|
4062
4060
|
}
|
|
4063
4061
|
newRegionAttachment(skin, name, path, sequence) {
|
|
4064
|
-
let attachment = new RegionAttachment(name);
|
|
4062
|
+
let attachment = new RegionAttachment(name, path);
|
|
4065
4063
|
if (sequence != null) {
|
|
4066
4064
|
this.loadSequence(name, path, sequence);
|
|
4067
4065
|
} else {
|
|
@@ -4074,7 +4072,7 @@ var spine = (() => {
|
|
|
4074
4072
|
return attachment;
|
|
4075
4073
|
}
|
|
4076
4074
|
newMeshAttachment(skin, name, path, sequence) {
|
|
4077
|
-
let attachment = new MeshAttachment(name);
|
|
4075
|
+
let attachment = new MeshAttachment(name, path);
|
|
4078
4076
|
if (sequence != null) {
|
|
4079
4077
|
this.loadSequence(name, path, sequence);
|
|
4080
4078
|
} else {
|
|
@@ -4104,7 +4102,6 @@ var spine = (() => {
|
|
|
4104
4102
|
var BoneData = class {
|
|
4105
4103
|
constructor(index, name, parent) {
|
|
4106
4104
|
this.index = 0;
|
|
4107
|
-
this.name = null;
|
|
4108
4105
|
this.parent = null;
|
|
4109
4106
|
this.length = 0;
|
|
4110
4107
|
this.x = 0;
|
|
@@ -4138,8 +4135,6 @@ var spine = (() => {
|
|
|
4138
4135
|
// spine-core/src/Bone.ts
|
|
4139
4136
|
var Bone = class {
|
|
4140
4137
|
constructor(data, skeleton, parent) {
|
|
4141
|
-
this.data = null;
|
|
4142
|
-
this.skeleton = null;
|
|
4143
4138
|
this.parent = null;
|
|
4144
4139
|
this.children = new Array();
|
|
4145
4140
|
this.x = 0;
|
|
@@ -4392,15 +4387,15 @@ var spine = (() => {
|
|
|
4392
4387
|
|
|
4393
4388
|
// spine-core/src/AssetManagerBase.ts
|
|
4394
4389
|
var AssetManagerBase = class {
|
|
4395
|
-
constructor(textureLoader, pathPrefix = "", downloader =
|
|
4396
|
-
this.pathPrefix =
|
|
4390
|
+
constructor(textureLoader, pathPrefix = "", downloader = new Downloader()) {
|
|
4391
|
+
this.pathPrefix = "";
|
|
4397
4392
|
this.assets = {};
|
|
4398
4393
|
this.errors = {};
|
|
4399
4394
|
this.toLoad = 0;
|
|
4400
4395
|
this.loaded = 0;
|
|
4401
4396
|
this.textureLoader = textureLoader;
|
|
4402
4397
|
this.pathPrefix = pathPrefix;
|
|
4403
|
-
this.downloader = downloader
|
|
4398
|
+
this.downloader = downloader;
|
|
4404
4399
|
}
|
|
4405
4400
|
start(path) {
|
|
4406
4401
|
this.toLoad++;
|
|
@@ -4439,7 +4434,9 @@ var spine = (() => {
|
|
|
4439
4434
|
setRawDataURI(path, data) {
|
|
4440
4435
|
this.downloader.rawDataUris[this.pathPrefix + path] = data;
|
|
4441
4436
|
}
|
|
4442
|
-
loadBinary(path, success =
|
|
4437
|
+
loadBinary(path, success = () => {
|
|
4438
|
+
}, error = () => {
|
|
4439
|
+
}) {
|
|
4443
4440
|
path = this.start(path);
|
|
4444
4441
|
this.downloader.downloadBinary(path, (data) => {
|
|
4445
4442
|
this.success(success, path, data);
|
|
@@ -4447,7 +4444,9 @@ var spine = (() => {
|
|
|
4447
4444
|
this.error(error, path, `Couldn't load binary ${path}: status ${status}, ${responseText}`);
|
|
4448
4445
|
});
|
|
4449
4446
|
}
|
|
4450
|
-
loadText(path, success =
|
|
4447
|
+
loadText(path, success = () => {
|
|
4448
|
+
}, error = () => {
|
|
4449
|
+
}) {
|
|
4451
4450
|
path = this.start(path);
|
|
4452
4451
|
this.downloader.downloadText(path, (data) => {
|
|
4453
4452
|
this.success(success, path, data);
|
|
@@ -4455,7 +4454,9 @@ var spine = (() => {
|
|
|
4455
4454
|
this.error(error, path, `Couldn't load text ${path}: status ${status}, ${responseText}`);
|
|
4456
4455
|
});
|
|
4457
4456
|
}
|
|
4458
|
-
loadJson(path, success =
|
|
4457
|
+
loadJson(path, success = () => {
|
|
4458
|
+
}, error = () => {
|
|
4459
|
+
}) {
|
|
4459
4460
|
path = this.start(path);
|
|
4460
4461
|
this.downloader.downloadJson(path, (data) => {
|
|
4461
4462
|
this.success(success, path, data);
|
|
@@ -4463,7 +4464,9 @@ var spine = (() => {
|
|
|
4463
4464
|
this.error(error, path, `Couldn't load JSON ${path}: status ${status}, ${responseText}`);
|
|
4464
4465
|
});
|
|
4465
4466
|
}
|
|
4466
|
-
loadTexture(path, success =
|
|
4467
|
+
loadTexture(path, success = () => {
|
|
4468
|
+
}, error = () => {
|
|
4469
|
+
}) {
|
|
4467
4470
|
path = this.start(path);
|
|
4468
4471
|
let isBrowser = !!(typeof window !== "undefined" && typeof navigator !== "undefined" && window.document);
|
|
4469
4472
|
let isWebWorker = !isBrowser;
|
|
@@ -4493,7 +4496,9 @@ var spine = (() => {
|
|
|
4493
4496
|
image.src = path;
|
|
4494
4497
|
}
|
|
4495
4498
|
}
|
|
4496
|
-
loadTextureAtlas(path, success =
|
|
4499
|
+
loadTextureAtlas(path, success = () => {
|
|
4500
|
+
}, error = () => {
|
|
4501
|
+
}, fileAlias) {
|
|
4497
4502
|
let index = path.lastIndexOf("/");
|
|
4498
4503
|
let parent = index >= 0 ? path.substring(0, index + 1) : "";
|
|
4499
4504
|
path = this.start(path);
|
|
@@ -4502,7 +4507,7 @@ var spine = (() => {
|
|
|
4502
4507
|
let atlas = new TextureAtlas(atlasText);
|
|
4503
4508
|
let toLoad = atlas.pages.length, abort = false;
|
|
4504
4509
|
for (let page of atlas.pages) {
|
|
4505
|
-
this.loadTexture(fileAlias
|
|
4510
|
+
this.loadTexture(!fileAlias ? parent + page.name : fileAlias[page.name], (imagePath, texture) => {
|
|
4506
4511
|
if (!abort) {
|
|
4507
4512
|
page.setTexture(texture);
|
|
4508
4513
|
if (--toLoad == 0)
|
|
@@ -4679,7 +4684,6 @@ var spine = (() => {
|
|
|
4679
4684
|
// spine-core/src/Event.ts
|
|
4680
4685
|
var Event = class {
|
|
4681
4686
|
constructor(time, data) {
|
|
4682
|
-
this.data = null;
|
|
4683
4687
|
this.intValue = 0;
|
|
4684
4688
|
this.floatValue = 0;
|
|
4685
4689
|
this.stringValue = null;
|
|
@@ -4696,7 +4700,6 @@ var spine = (() => {
|
|
|
4696
4700
|
// spine-core/src/EventData.ts
|
|
4697
4701
|
var EventData = class {
|
|
4698
4702
|
constructor(name) {
|
|
4699
|
-
this.name = null;
|
|
4700
4703
|
this.intValue = 0;
|
|
4701
4704
|
this.floatValue = 0;
|
|
4702
4705
|
this.stringValue = null;
|
|
@@ -4710,9 +4713,6 @@ var spine = (() => {
|
|
|
4710
4713
|
// spine-core/src/IkConstraint.ts
|
|
4711
4714
|
var IkConstraint = class {
|
|
4712
4715
|
constructor(data, skeleton) {
|
|
4713
|
-
this.data = null;
|
|
4714
|
-
this.bones = null;
|
|
4715
|
-
this.target = null;
|
|
4716
4716
|
this.bendDirection = 0;
|
|
4717
4717
|
this.compress = false;
|
|
4718
4718
|
this.stretch = false;
|
|
@@ -4730,9 +4730,16 @@ var spine = (() => {
|
|
|
4730
4730
|
this.compress = data.compress;
|
|
4731
4731
|
this.stretch = data.stretch;
|
|
4732
4732
|
this.bones = new Array();
|
|
4733
|
-
for (let i = 0; i < data.bones.length; i++)
|
|
4734
|
-
|
|
4735
|
-
|
|
4733
|
+
for (let i = 0; i < data.bones.length; i++) {
|
|
4734
|
+
let bone = skeleton.findBone(data.bones[i].name);
|
|
4735
|
+
if (!bone)
|
|
4736
|
+
throw new Error(`Couldn't find bone ${data.bones[i].name}`);
|
|
4737
|
+
this.bones.push(bone);
|
|
4738
|
+
}
|
|
4739
|
+
let target = skeleton.findBone(data.target.name);
|
|
4740
|
+
if (!target)
|
|
4741
|
+
throw new Error(`Couldn't find bone ${data.target.name}`);
|
|
4742
|
+
this.target = target;
|
|
4736
4743
|
}
|
|
4737
4744
|
isActive() {
|
|
4738
4745
|
return this.active;
|
|
@@ -4753,6 +4760,8 @@ var spine = (() => {
|
|
|
4753
4760
|
}
|
|
4754
4761
|
apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
|
|
4755
4762
|
let p = bone.parent;
|
|
4763
|
+
if (!p)
|
|
4764
|
+
throw new Error("IK bone must have parent.");
|
|
4756
4765
|
let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
|
|
4757
4766
|
let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
|
|
4758
4767
|
switch (bone.data.transformMode) {
|
|
@@ -4830,6 +4839,8 @@ var spine = (() => {
|
|
|
4830
4839
|
cwy = c * cx + d * cy + parent.worldY;
|
|
4831
4840
|
}
|
|
4832
4841
|
let pp = parent.parent;
|
|
4842
|
+
if (!pp)
|
|
4843
|
+
throw new Error("IK parent must itself have a parent.");
|
|
4833
4844
|
a = pp.a;
|
|
4834
4845
|
b = pp.b;
|
|
4835
4846
|
c = pp.c;
|
|
@@ -4951,7 +4962,7 @@ var spine = (() => {
|
|
|
4951
4962
|
constructor(name) {
|
|
4952
4963
|
super(name, 0, false);
|
|
4953
4964
|
this.bones = new Array();
|
|
4954
|
-
this.
|
|
4965
|
+
this._target = null;
|
|
4955
4966
|
this.bendDirection = 1;
|
|
4956
4967
|
this.compress = false;
|
|
4957
4968
|
this.stretch = false;
|
|
@@ -4959,6 +4970,15 @@ var spine = (() => {
|
|
|
4959
4970
|
this.mix = 1;
|
|
4960
4971
|
this.softness = 0;
|
|
4961
4972
|
}
|
|
4973
|
+
set target(boneData) {
|
|
4974
|
+
this._target = boneData;
|
|
4975
|
+
}
|
|
4976
|
+
get target() {
|
|
4977
|
+
if (!this._target)
|
|
4978
|
+
throw new Error("BoneData not set.");
|
|
4979
|
+
else
|
|
4980
|
+
return this._target;
|
|
4981
|
+
}
|
|
4962
4982
|
};
|
|
4963
4983
|
|
|
4964
4984
|
// spine-core/src/PathConstraintData.ts
|
|
@@ -4966,10 +4986,10 @@ var spine = (() => {
|
|
|
4966
4986
|
constructor(name) {
|
|
4967
4987
|
super(name, 0, false);
|
|
4968
4988
|
this.bones = new Array();
|
|
4969
|
-
this.
|
|
4970
|
-
this.positionMode =
|
|
4971
|
-
this.spacingMode =
|
|
4972
|
-
this.rotateMode =
|
|
4989
|
+
this._target = null;
|
|
4990
|
+
this.positionMode = PositionMode.Fixed;
|
|
4991
|
+
this.spacingMode = SpacingMode.Fixed;
|
|
4992
|
+
this.rotateMode = RotateMode.Chain;
|
|
4973
4993
|
this.offsetRotation = 0;
|
|
4974
4994
|
this.position = 0;
|
|
4975
4995
|
this.spacing = 0;
|
|
@@ -4977,6 +4997,15 @@ var spine = (() => {
|
|
|
4977
4997
|
this.mixX = 0;
|
|
4978
4998
|
this.mixY = 0;
|
|
4979
4999
|
}
|
|
5000
|
+
set target(slotData) {
|
|
5001
|
+
this._target = slotData;
|
|
5002
|
+
}
|
|
5003
|
+
get target() {
|
|
5004
|
+
if (!this._target)
|
|
5005
|
+
throw new Error("SlotData not set.");
|
|
5006
|
+
else
|
|
5007
|
+
return this._target;
|
|
5008
|
+
}
|
|
4980
5009
|
};
|
|
4981
5010
|
var PositionMode;
|
|
4982
5011
|
(function(PositionMode2) {
|
|
@@ -5000,9 +5029,6 @@ var spine = (() => {
|
|
|
5000
5029
|
// spine-core/src/PathConstraint.ts
|
|
5001
5030
|
var _PathConstraint = class {
|
|
5002
5031
|
constructor(data, skeleton) {
|
|
5003
|
-
this.data = null;
|
|
5004
|
-
this.bones = null;
|
|
5005
|
-
this.target = null;
|
|
5006
5032
|
this.position = 0;
|
|
5007
5033
|
this.spacing = 0;
|
|
5008
5034
|
this.mixRotate = 0;
|
|
@@ -5021,9 +5047,16 @@ var spine = (() => {
|
|
|
5021
5047
|
throw new Error("skeleton cannot be null.");
|
|
5022
5048
|
this.data = data;
|
|
5023
5049
|
this.bones = new Array();
|
|
5024
|
-
for (let i = 0, n = data.bones.length; i < n; i++)
|
|
5025
|
-
|
|
5026
|
-
|
|
5050
|
+
for (let i = 0, n = data.bones.length; i < n; i++) {
|
|
5051
|
+
let bone = skeleton.findBone(data.bones[i].name);
|
|
5052
|
+
if (!bone)
|
|
5053
|
+
throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
5054
|
+
this.bones.push(bone);
|
|
5055
|
+
}
|
|
5056
|
+
let target = skeleton.findSlot(data.target.name);
|
|
5057
|
+
if (!target)
|
|
5058
|
+
throw new Error(`Couldn't find target bone ${data.target.name}`);
|
|
5059
|
+
this.target = target;
|
|
5027
5060
|
this.position = data.position;
|
|
5028
5061
|
this.spacing = data.spacing;
|
|
5029
5062
|
this.mixRotate = data.mixRotate;
|
|
@@ -5044,7 +5077,7 @@ var spine = (() => {
|
|
|
5044
5077
|
let tangents = data.rotateMode == RotateMode.Tangent, scale = data.rotateMode == RotateMode.ChainScale;
|
|
5045
5078
|
let bones = this.bones;
|
|
5046
5079
|
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) :
|
|
5080
|
+
let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : [];
|
|
5048
5081
|
let spacing = this.spacing;
|
|
5049
5082
|
switch (data.spacingMode) {
|
|
5050
5083
|
case SpacingMode.Percent:
|
|
@@ -5165,7 +5198,7 @@ var spine = (() => {
|
|
|
5165
5198
|
computeWorldPositions(path, spacesCount, tangents) {
|
|
5166
5199
|
let target = this.target;
|
|
5167
5200
|
let position = this.position;
|
|
5168
|
-
let spaces = this.spaces, out = Utils.setArraySize(this.positions, spacesCount * 3 + 2), world =
|
|
5201
|
+
let spaces = this.spaces, out = Utils.setArraySize(this.positions, spacesCount * 3 + 2), world = this.world;
|
|
5169
5202
|
let closed2 = path.closed;
|
|
5170
5203
|
let verticesLength = path.worldVerticesLength, curveCount = verticesLength / 6, prevCurve = _PathConstraint.NONE;
|
|
5171
5204
|
if (!path.constantSpeed) {
|
|
@@ -5422,12 +5455,10 @@ var spine = (() => {
|
|
|
5422
5455
|
// spine-core/src/Slot.ts
|
|
5423
5456
|
var Slot = class {
|
|
5424
5457
|
constructor(data, bone) {
|
|
5425
|
-
this.data = null;
|
|
5426
|
-
this.bone = null;
|
|
5427
|
-
this.color = null;
|
|
5428
5458
|
this.darkColor = null;
|
|
5429
5459
|
this.attachment = null;
|
|
5430
5460
|
this.attachmentState = 0;
|
|
5461
|
+
this.sequenceIndex = -1;
|
|
5431
5462
|
this.deform = new Array();
|
|
5432
5463
|
if (!data)
|
|
5433
5464
|
throw new Error("data cannot be null.");
|
|
@@ -5470,9 +5501,6 @@ var spine = (() => {
|
|
|
5470
5501
|
// spine-core/src/TransformConstraint.ts
|
|
5471
5502
|
var TransformConstraint = class {
|
|
5472
5503
|
constructor(data, skeleton) {
|
|
5473
|
-
this.data = null;
|
|
5474
|
-
this.bones = null;
|
|
5475
|
-
this.target = null;
|
|
5476
5504
|
this.mixRotate = 0;
|
|
5477
5505
|
this.mixX = 0;
|
|
5478
5506
|
this.mixY = 0;
|
|
@@ -5493,9 +5521,16 @@ var spine = (() => {
|
|
|
5493
5521
|
this.mixScaleY = data.mixScaleY;
|
|
5494
5522
|
this.mixShearY = data.mixShearY;
|
|
5495
5523
|
this.bones = new Array();
|
|
5496
|
-
for (let i = 0; i < data.bones.length; i++)
|
|
5497
|
-
|
|
5498
|
-
|
|
5524
|
+
for (let i = 0; i < data.bones.length; i++) {
|
|
5525
|
+
let bone = skeleton.findBone(data.bones[i].name);
|
|
5526
|
+
if (!bone)
|
|
5527
|
+
throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
5528
|
+
this.bones.push(bone);
|
|
5529
|
+
}
|
|
5530
|
+
let target = skeleton.findBone(data.target.name);
|
|
5531
|
+
if (!target)
|
|
5532
|
+
throw new Error(`Couldn't find target bone ${data.target.name}.`);
|
|
5533
|
+
this.target = target;
|
|
5499
5534
|
}
|
|
5500
5535
|
isActive() {
|
|
5501
5536
|
return this.active;
|
|
@@ -5680,16 +5715,8 @@ var spine = (() => {
|
|
|
5680
5715
|
// spine-core/src/Skeleton.ts
|
|
5681
5716
|
var Skeleton = class {
|
|
5682
5717
|
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
5718
|
this._updateCache = new Array();
|
|
5691
5719
|
this.skin = null;
|
|
5692
|
-
this.color = null;
|
|
5693
5720
|
this.scaleX = 1;
|
|
5694
5721
|
this.scaleY = 1;
|
|
5695
5722
|
this.x = 0;
|
|
@@ -5884,6 +5911,8 @@ var spine = (() => {
|
|
|
5884
5911
|
}
|
|
5885
5912
|
}
|
|
5886
5913
|
sortBone(bone) {
|
|
5914
|
+
if (!bone)
|
|
5915
|
+
return;
|
|
5887
5916
|
if (bone.sorted)
|
|
5888
5917
|
return;
|
|
5889
5918
|
let parent = bone.parent;
|
|
@@ -5920,6 +5949,8 @@ var spine = (() => {
|
|
|
5920
5949
|
}
|
|
5921
5950
|
updateWorldTransformWith(parent) {
|
|
5922
5951
|
let rootBone = this.getRootBone();
|
|
5952
|
+
if (!rootBone)
|
|
5953
|
+
throw new Error("Root bone must not be null.");
|
|
5923
5954
|
let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
|
|
5924
5955
|
rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
|
|
5925
5956
|
rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
|
|
@@ -6040,7 +6071,10 @@ var spine = (() => {
|
|
|
6040
6071
|
this.updateCache();
|
|
6041
6072
|
}
|
|
6042
6073
|
getAttachmentByName(slotName, attachmentName) {
|
|
6043
|
-
|
|
6074
|
+
let slot = this.data.findSlot(slotName);
|
|
6075
|
+
if (!slot)
|
|
6076
|
+
throw new Error(`Can't find slot with name ${slotName}`);
|
|
6077
|
+
return this.getAttachment(slot.index, attachmentName);
|
|
6044
6078
|
}
|
|
6045
6079
|
getAttachment(slotIndex, attachmentName) {
|
|
6046
6080
|
if (!attachmentName)
|
|
@@ -6266,7 +6300,7 @@ var spine = (() => {
|
|
|
6266
6300
|
|
|
6267
6301
|
// spine-core/src/Skin.ts
|
|
6268
6302
|
var SkinEntry = class {
|
|
6269
|
-
constructor(slotIndex = 0, name
|
|
6303
|
+
constructor(slotIndex = 0, name, attachment) {
|
|
6270
6304
|
this.slotIndex = slotIndex;
|
|
6271
6305
|
this.name = name;
|
|
6272
6306
|
this.attachment = attachment;
|
|
@@ -6274,7 +6308,6 @@ var spine = (() => {
|
|
|
6274
6308
|
};
|
|
6275
6309
|
var Skin = class {
|
|
6276
6310
|
constructor(name) {
|
|
6277
|
-
this.name = null;
|
|
6278
6311
|
this.attachments = new Array();
|
|
6279
6312
|
this.bones = Array();
|
|
6280
6313
|
this.constraints = new Array();
|
|
@@ -6369,7 +6402,7 @@ var spine = (() => {
|
|
|
6369
6402
|
removeAttachment(slotIndex, name) {
|
|
6370
6403
|
let dictionary = this.attachments[slotIndex];
|
|
6371
6404
|
if (dictionary)
|
|
6372
|
-
dictionary[name]
|
|
6405
|
+
delete dictionary[name];
|
|
6373
6406
|
}
|
|
6374
6407
|
getAttachments() {
|
|
6375
6408
|
let entries = new Array();
|
|
@@ -6426,12 +6459,10 @@ var spine = (() => {
|
|
|
6426
6459
|
var SlotData = class {
|
|
6427
6460
|
constructor(index, name, boneData) {
|
|
6428
6461
|
this.index = 0;
|
|
6429
|
-
this.name = null;
|
|
6430
|
-
this.boneData = null;
|
|
6431
6462
|
this.color = new Color(1, 1, 1, 1);
|
|
6432
6463
|
this.darkColor = null;
|
|
6433
6464
|
this.attachmentName = null;
|
|
6434
|
-
this.blendMode =
|
|
6465
|
+
this.blendMode = BlendMode.Normal;
|
|
6435
6466
|
if (index < 0)
|
|
6436
6467
|
throw new Error("index must be >= 0.");
|
|
6437
6468
|
if (!name)
|
|
@@ -6456,7 +6487,7 @@ var spine = (() => {
|
|
|
6456
6487
|
constructor(name) {
|
|
6457
6488
|
super(name, 0, false);
|
|
6458
6489
|
this.bones = new Array();
|
|
6459
|
-
this.
|
|
6490
|
+
this._target = null;
|
|
6460
6491
|
this.mixRotate = 0;
|
|
6461
6492
|
this.mixX = 0;
|
|
6462
6493
|
this.mixY = 0;
|
|
@@ -6472,13 +6503,21 @@ var spine = (() => {
|
|
|
6472
6503
|
this.relative = false;
|
|
6473
6504
|
this.local = false;
|
|
6474
6505
|
}
|
|
6506
|
+
set target(boneData) {
|
|
6507
|
+
this._target = boneData;
|
|
6508
|
+
}
|
|
6509
|
+
get target() {
|
|
6510
|
+
if (!this._target)
|
|
6511
|
+
throw new Error("BoneData not set.");
|
|
6512
|
+
else
|
|
6513
|
+
return this._target;
|
|
6514
|
+
}
|
|
6475
6515
|
};
|
|
6476
6516
|
|
|
6477
6517
|
// spine-core/src/SkeletonBinary.ts
|
|
6478
6518
|
var SkeletonBinary = class {
|
|
6479
6519
|
constructor(attachmentLoader) {
|
|
6480
6520
|
this.scale = 1;
|
|
6481
|
-
this.attachmentLoader = null;
|
|
6482
6521
|
this.linkedMeshes = new Array();
|
|
6483
6522
|
this.attachmentLoader = attachmentLoader;
|
|
6484
6523
|
}
|
|
@@ -6503,11 +6542,17 @@ var spine = (() => {
|
|
|
6503
6542
|
}
|
|
6504
6543
|
let n = 0;
|
|
6505
6544
|
n = input.readInt(true);
|
|
6506
|
-
for (let i = 0; i < n; i++)
|
|
6507
|
-
input.
|
|
6545
|
+
for (let i = 0; i < n; i++) {
|
|
6546
|
+
let str = input.readString();
|
|
6547
|
+
if (!str)
|
|
6548
|
+
throw new Error("String in string table must not be null.");
|
|
6549
|
+
input.strings.push(str);
|
|
6550
|
+
}
|
|
6508
6551
|
n = input.readInt(true);
|
|
6509
6552
|
for (let i = 0; i < n; i++) {
|
|
6510
6553
|
let name = input.readString();
|
|
6554
|
+
if (!name)
|
|
6555
|
+
throw new Error("Bone name must not be null.");
|
|
6511
6556
|
let parent = i == 0 ? null : skeletonData.bones[input.readInt(true)];
|
|
6512
6557
|
let data = new BoneData(i, name, parent);
|
|
6513
6558
|
data.rotation = input.readFloat();
|
|
@@ -6527,6 +6572,8 @@ var spine = (() => {
|
|
|
6527
6572
|
n = input.readInt(true);
|
|
6528
6573
|
for (let i = 0; i < n; i++) {
|
|
6529
6574
|
let slotName = input.readString();
|
|
6575
|
+
if (!slotName)
|
|
6576
|
+
throw new Error("Slot name must not be null.");
|
|
6530
6577
|
let boneData = skeletonData.bones[input.readInt(true)];
|
|
6531
6578
|
let data = new SlotData(i, slotName, boneData);
|
|
6532
6579
|
Color.rgba8888ToColor(data.color, input.readInt32());
|
|
@@ -6539,7 +6586,10 @@ var spine = (() => {
|
|
|
6539
6586
|
}
|
|
6540
6587
|
n = input.readInt(true);
|
|
6541
6588
|
for (let i = 0, nn; i < n; i++) {
|
|
6542
|
-
let
|
|
6589
|
+
let name = input.readString();
|
|
6590
|
+
if (!name)
|
|
6591
|
+
throw new Error("IK constraint data name must not be null.");
|
|
6592
|
+
let data = new IkConstraintData(name);
|
|
6543
6593
|
data.order = input.readInt(true);
|
|
6544
6594
|
data.skinRequired = input.readBoolean();
|
|
6545
6595
|
nn = input.readInt(true);
|
|
@@ -6556,7 +6606,10 @@ var spine = (() => {
|
|
|
6556
6606
|
}
|
|
6557
6607
|
n = input.readInt(true);
|
|
6558
6608
|
for (let i = 0, nn; i < n; i++) {
|
|
6559
|
-
let
|
|
6609
|
+
let name = input.readString();
|
|
6610
|
+
if (!name)
|
|
6611
|
+
throw new Error("Transform constraint data name must not be null.");
|
|
6612
|
+
let data = new TransformConstraintData(name);
|
|
6560
6613
|
data.order = input.readInt(true);
|
|
6561
6614
|
data.skinRequired = input.readBoolean();
|
|
6562
6615
|
nn = input.readInt(true);
|
|
@@ -6581,7 +6634,10 @@ var spine = (() => {
|
|
|
6581
6634
|
}
|
|
6582
6635
|
n = input.readInt(true);
|
|
6583
6636
|
for (let i = 0, nn; i < n; i++) {
|
|
6584
|
-
let
|
|
6637
|
+
let name = input.readString();
|
|
6638
|
+
if (!name)
|
|
6639
|
+
throw new Error("Path constraint data name must not be null.");
|
|
6640
|
+
let data = new PathConstraintData(name);
|
|
6585
6641
|
data.order = input.readInt(true);
|
|
6586
6642
|
data.skinRequired = input.readBoolean();
|
|
6587
6643
|
nn = input.readInt(true);
|
|
@@ -6611,14 +6667,24 @@ var spine = (() => {
|
|
|
6611
6667
|
{
|
|
6612
6668
|
let i = skeletonData.skins.length;
|
|
6613
6669
|
Utils.setArraySize(skeletonData.skins, n = i + input.readInt(true));
|
|
6614
|
-
for (; i < n; i++)
|
|
6615
|
-
|
|
6670
|
+
for (; i < n; i++) {
|
|
6671
|
+
let skin = this.readSkin(input, skeletonData, false, nonessential);
|
|
6672
|
+
if (!skin)
|
|
6673
|
+
throw new Error("readSkin() should not have returned null.");
|
|
6674
|
+
skeletonData.skins[i] = skin;
|
|
6675
|
+
}
|
|
6616
6676
|
}
|
|
6617
6677
|
n = this.linkedMeshes.length;
|
|
6618
6678
|
for (let i = 0; i < n; i++) {
|
|
6619
6679
|
let linkedMesh = this.linkedMeshes[i];
|
|
6620
6680
|
let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
|
|
6681
|
+
if (!skin)
|
|
6682
|
+
throw new Error("Not skin found for linked mesh.");
|
|
6683
|
+
if (!linkedMesh.parent)
|
|
6684
|
+
throw new Error("Linked mesh parent must not be null");
|
|
6621
6685
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
6686
|
+
if (!parent)
|
|
6687
|
+
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
6622
6688
|
linkedMesh.mesh.timelineAttahment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
6623
6689
|
linkedMesh.mesh.setParentMesh(parent);
|
|
6624
6690
|
if (linkedMesh.mesh.region != null)
|
|
@@ -6627,7 +6693,10 @@ var spine = (() => {
|
|
|
6627
6693
|
this.linkedMeshes.length = 0;
|
|
6628
6694
|
n = input.readInt(true);
|
|
6629
6695
|
for (let i = 0; i < n; i++) {
|
|
6630
|
-
let
|
|
6696
|
+
let eventName = input.readStringRef();
|
|
6697
|
+
if (!eventName)
|
|
6698
|
+
throw new Error();
|
|
6699
|
+
let data = new EventData(eventName);
|
|
6631
6700
|
data.intValue = input.readInt(false);
|
|
6632
6701
|
data.floatValue = input.readFloat();
|
|
6633
6702
|
data.stringValue = input.readString();
|
|
@@ -6639,8 +6708,12 @@ var spine = (() => {
|
|
|
6639
6708
|
skeletonData.events.push(data);
|
|
6640
6709
|
}
|
|
6641
6710
|
n = input.readInt(true);
|
|
6642
|
-
for (let i = 0; i < n; i++)
|
|
6643
|
-
|
|
6711
|
+
for (let i = 0; i < n; i++) {
|
|
6712
|
+
let animationName = input.readString();
|
|
6713
|
+
if (!animationName)
|
|
6714
|
+
throw new Error("Animatio name must not be null.");
|
|
6715
|
+
skeletonData.animations.push(this.readAnimation(input, animationName, skeletonData));
|
|
6716
|
+
}
|
|
6644
6717
|
return skeletonData;
|
|
6645
6718
|
}
|
|
6646
6719
|
readSkin(input, skeletonData, defaultSkin, nonessential) {
|
|
@@ -6652,7 +6725,10 @@ var spine = (() => {
|
|
|
6652
6725
|
return null;
|
|
6653
6726
|
skin = new Skin("default");
|
|
6654
6727
|
} else {
|
|
6655
|
-
|
|
6728
|
+
let skinName = input.readStringRef();
|
|
6729
|
+
if (!skinName)
|
|
6730
|
+
throw new Error("Skin name must not be null.");
|
|
6731
|
+
skin = new Skin(skinName);
|
|
6656
6732
|
skin.bones.length = input.readInt(true);
|
|
6657
6733
|
for (let i = 0, n = skin.bones.length; i < n; i++)
|
|
6658
6734
|
skin.bones[i] = skeletonData.bones[input.readInt(true)];
|
|
@@ -6668,6 +6744,8 @@ var spine = (() => {
|
|
|
6668
6744
|
let slotIndex = input.readInt(true);
|
|
6669
6745
|
for (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {
|
|
6670
6746
|
let name = input.readStringRef();
|
|
6747
|
+
if (!name)
|
|
6748
|
+
throw new Error("Attachment name must not be null");
|
|
6671
6749
|
let attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name, nonessential);
|
|
6672
6750
|
if (attachment)
|
|
6673
6751
|
skin.setAttachment(slotIndex, name, attachment);
|
|
@@ -6734,7 +6812,7 @@ var spine = (() => {
|
|
|
6734
6812
|
let vertices = this.readVertices(input, vertexCount);
|
|
6735
6813
|
let hullLength = input.readInt(true);
|
|
6736
6814
|
let sequence = this.readSequence(input);
|
|
6737
|
-
let edges =
|
|
6815
|
+
let edges = [];
|
|
6738
6816
|
let width = 0, height = 0;
|
|
6739
6817
|
if (nonessential) {
|
|
6740
6818
|
edges = this.readShortArray(input);
|
|
@@ -7236,6 +7314,8 @@ var spine = (() => {
|
|
|
7236
7314
|
let slotIndex = input.readInt(true);
|
|
7237
7315
|
for (let iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {
|
|
7238
7316
|
let attachmentName = input.readStringRef();
|
|
7317
|
+
if (!attachmentName)
|
|
7318
|
+
throw new Error("attachmentName must not be null.");
|
|
7239
7319
|
let attachment = skin.getAttachment(slotIndex, attachmentName);
|
|
7240
7320
|
let timelineType = input.readByte();
|
|
7241
7321
|
let frameCount = input.readInt(true);
|
|
@@ -7410,7 +7490,7 @@ var spine = (() => {
|
|
|
7410
7490
|
let chars = "";
|
|
7411
7491
|
let charCount = 0;
|
|
7412
7492
|
for (let i = 0; i < byteCount; ) {
|
|
7413
|
-
let b = this.
|
|
7493
|
+
let b = this.readUnsignedByte();
|
|
7414
7494
|
switch (b >> 4) {
|
|
7415
7495
|
case 12:
|
|
7416
7496
|
case 13:
|
|
@@ -7911,6 +7991,8 @@ var spine = (() => {
|
|
|
7911
7991
|
this.clippedVertices = new Array();
|
|
7912
7992
|
this.clippedTriangles = new Array();
|
|
7913
7993
|
this.scratch = new Array();
|
|
7994
|
+
this.clipAttachment = null;
|
|
7995
|
+
this.clippingPolygons = null;
|
|
7914
7996
|
}
|
|
7915
7997
|
clipStart(slot, clip) {
|
|
7916
7998
|
if (this.clipAttachment)
|
|
@@ -7950,7 +8032,7 @@ var spine = (() => {
|
|
|
7950
8032
|
let clipOutput = this.clipOutput, clippedVertices = this.clippedVertices;
|
|
7951
8033
|
let clippedTriangles = this.clippedTriangles;
|
|
7952
8034
|
let polygons = this.clippingPolygons;
|
|
7953
|
-
let polygonsCount =
|
|
8035
|
+
let polygonsCount = polygons.length;
|
|
7954
8036
|
let vertexSize = twoColor ? 12 : 8;
|
|
7955
8037
|
let index = 0;
|
|
7956
8038
|
clippedVertices.length = 0;
|
|
@@ -8082,7 +8164,7 @@ var spine = (() => {
|
|
|
8082
8164
|
clip(x1, y1, x2, y2, x3, y3, clippingArea, output) {
|
|
8083
8165
|
let originalOutput = output;
|
|
8084
8166
|
let clipped = false;
|
|
8085
|
-
let input
|
|
8167
|
+
let input;
|
|
8086
8168
|
if (clippingArea.length % 4 >= 2) {
|
|
8087
8169
|
input = output;
|
|
8088
8170
|
output = this.scratch;
|
|
@@ -8190,7 +8272,6 @@ var spine = (() => {
|
|
|
8190
8272
|
// spine-core/src/SkeletonJson.ts
|
|
8191
8273
|
var SkeletonJson = class {
|
|
8192
8274
|
constructor(attachmentLoader) {
|
|
8193
|
-
this.attachmentLoader = null;
|
|
8194
8275
|
this.scale = 1;
|
|
8195
8276
|
this.linkedMeshes = new Array();
|
|
8196
8277
|
this.attachmentLoader = attachmentLoader;
|
|
@@ -8238,6 +8319,8 @@ var spine = (() => {
|
|
|
8238
8319
|
for (let i = 0; i < root.slots.length; i++) {
|
|
8239
8320
|
let slotMap = root.slots[i];
|
|
8240
8321
|
let boneData = skeletonData.findBone(slotMap.bone);
|
|
8322
|
+
if (!boneData)
|
|
8323
|
+
throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotMap.name}`);
|
|
8241
8324
|
let data = new SlotData(skeletonData.slots.length, slotMap.name, boneData);
|
|
8242
8325
|
let color = getValue(slotMap, "color", null);
|
|
8243
8326
|
if (color)
|
|
@@ -8256,9 +8339,17 @@ var spine = (() => {
|
|
|
8256
8339
|
let data = new IkConstraintData(constraintMap.name);
|
|
8257
8340
|
data.order = getValue(constraintMap, "order", 0);
|
|
8258
8341
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
8259
|
-
for (let ii = 0; ii < constraintMap.bones.length; ii++)
|
|
8260
|
-
|
|
8261
|
-
|
|
8342
|
+
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
8343
|
+
let bone = skeletonData.findBone(constraintMap.bones[ii]);
|
|
8344
|
+
if (!bone)
|
|
8345
|
+
throw new Error(`Couldn't find bone ${constraintMap.bones[ii]} for IK constraint ${constraintMap.name}.`);
|
|
8346
|
+
data.bones.push(bone);
|
|
8347
|
+
}
|
|
8348
|
+
let target = skeletonData.findBone(constraintMap.target);
|
|
8349
|
+
;
|
|
8350
|
+
if (!target)
|
|
8351
|
+
throw new Error(`Couldn't find target bone ${constraintMap.target} for IK constraint ${constraintMap.name}.`);
|
|
8352
|
+
data.target = target;
|
|
8262
8353
|
data.mix = getValue(constraintMap, "mix", 1);
|
|
8263
8354
|
data.softness = getValue(constraintMap, "softness", 0) * scale;
|
|
8264
8355
|
data.bendDirection = getValue(constraintMap, "bendPositive", true) ? 1 : -1;
|
|
@@ -8274,10 +8365,18 @@ var spine = (() => {
|
|
|
8274
8365
|
let data = new TransformConstraintData(constraintMap.name);
|
|
8275
8366
|
data.order = getValue(constraintMap, "order", 0);
|
|
8276
8367
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
8277
|
-
for (let ii = 0; ii < constraintMap.bones.length; ii++)
|
|
8278
|
-
|
|
8368
|
+
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
8369
|
+
let boneName = constraintMap.bones[ii];
|
|
8370
|
+
let bone = skeletonData.findBone(boneName);
|
|
8371
|
+
if (!bone)
|
|
8372
|
+
throw new Error(`Couldn't find bone ${boneName} for transform constraint ${constraintMap.name}.`);
|
|
8373
|
+
data.bones.push(bone);
|
|
8374
|
+
}
|
|
8279
8375
|
let targetName = constraintMap.target;
|
|
8280
|
-
|
|
8376
|
+
let target = skeletonData.findBone(targetName);
|
|
8377
|
+
if (!target)
|
|
8378
|
+
throw new Error(`Couldn't find target bone ${targetName} for transform constraint ${constraintMap.name}.`);
|
|
8379
|
+
data.target = target;
|
|
8281
8380
|
data.local = getValue(constraintMap, "local", false);
|
|
8282
8381
|
data.relative = getValue(constraintMap, "relative", false);
|
|
8283
8382
|
data.offsetRotation = getValue(constraintMap, "rotation", 0);
|
|
@@ -8301,10 +8400,18 @@ var spine = (() => {
|
|
|
8301
8400
|
let data = new PathConstraintData(constraintMap.name);
|
|
8302
8401
|
data.order = getValue(constraintMap, "order", 0);
|
|
8303
8402
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
8304
|
-
for (let ii = 0; ii < constraintMap.bones.length; ii++)
|
|
8305
|
-
|
|
8403
|
+
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
8404
|
+
let boneName = constraintMap.bones[ii];
|
|
8405
|
+
let bone = skeletonData.findBone(boneName);
|
|
8406
|
+
if (!bone)
|
|
8407
|
+
throw new Error(`Couldn't find bone ${boneName} for path constraint ${constraintMap.name}.`);
|
|
8408
|
+
data.bones.push(bone);
|
|
8409
|
+
}
|
|
8306
8410
|
let targetName = constraintMap.target;
|
|
8307
|
-
|
|
8411
|
+
let target = skeletonData.findSlot(targetName);
|
|
8412
|
+
if (!target)
|
|
8413
|
+
throw new Error(`Couldn't find target slot ${targetName} for path constraint ${constraintMap.name}.`);
|
|
8414
|
+
data.target = target;
|
|
8308
8415
|
data.positionMode = Utils.enumValue(PositionMode, getValue(constraintMap, "positionMode", "Percent"));
|
|
8309
8416
|
data.spacingMode = Utils.enumValue(SpacingMode, getValue(constraintMap, "spacingMode", "Length"));
|
|
8310
8417
|
data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
|
|
@@ -8326,23 +8433,45 @@ var spine = (() => {
|
|
|
8326
8433
|
let skinMap = root.skins[i];
|
|
8327
8434
|
let skin = new Skin(skinMap.name);
|
|
8328
8435
|
if (skinMap.bones) {
|
|
8329
|
-
for (let ii = 0; ii < skinMap.bones.length; ii++)
|
|
8330
|
-
|
|
8436
|
+
for (let ii = 0; ii < skinMap.bones.length; ii++) {
|
|
8437
|
+
let boneName = skinMap.bones[ii];
|
|
8438
|
+
let bone = skeletonData.findBone(boneName);
|
|
8439
|
+
if (!bone)
|
|
8440
|
+
throw new Error(`Couldn't find bone ${boneName} for skin ${skinMap.name}.`);
|
|
8441
|
+
skin.bones.push(bone);
|
|
8442
|
+
}
|
|
8331
8443
|
}
|
|
8332
8444
|
if (skinMap.ik) {
|
|
8333
|
-
for (let ii = 0; ii < skinMap.ik.length; ii++)
|
|
8334
|
-
|
|
8445
|
+
for (let ii = 0; ii < skinMap.ik.length; ii++) {
|
|
8446
|
+
let constraintName = skinMap.ik[ii];
|
|
8447
|
+
let constraint = skeletonData.findIkConstraint(constraintName);
|
|
8448
|
+
if (!constraint)
|
|
8449
|
+
throw new Error(`Couldn't find IK constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
8450
|
+
skin.constraints.push(constraint);
|
|
8451
|
+
}
|
|
8335
8452
|
}
|
|
8336
8453
|
if (skinMap.transform) {
|
|
8337
|
-
for (let ii = 0; ii < skinMap.transform.length; ii++)
|
|
8338
|
-
|
|
8454
|
+
for (let ii = 0; ii < skinMap.transform.length; ii++) {
|
|
8455
|
+
let constraintName = skinMap.transform[ii];
|
|
8456
|
+
let constraint = skeletonData.findTransformConstraint(constraintName);
|
|
8457
|
+
if (!constraint)
|
|
8458
|
+
throw new Error(`Couldn't find transform constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
8459
|
+
skin.constraints.push(constraint);
|
|
8460
|
+
}
|
|
8339
8461
|
}
|
|
8340
8462
|
if (skinMap.path) {
|
|
8341
|
-
for (let ii = 0; ii < skinMap.path.length; ii++)
|
|
8342
|
-
|
|
8463
|
+
for (let ii = 0; ii < skinMap.path.length; ii++) {
|
|
8464
|
+
let constraintName = skinMap.path[ii];
|
|
8465
|
+
let constraint = skeletonData.findPathConstraint(constraintName);
|
|
8466
|
+
if (!constraint)
|
|
8467
|
+
throw new Error(`Couldn't find path constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
8468
|
+
skin.constraints.push(constraint);
|
|
8469
|
+
}
|
|
8343
8470
|
}
|
|
8344
8471
|
for (let slotName in skinMap.attachments) {
|
|
8345
8472
|
let slot = skeletonData.findSlot(slotName);
|
|
8473
|
+
if (!slot)
|
|
8474
|
+
throw new Error(`Couldn't find slot ${slotName} for skin ${skinMap.name}.`);
|
|
8346
8475
|
let slotMap = skinMap.attachments[slotName];
|
|
8347
8476
|
for (let entryName in slotMap) {
|
|
8348
8477
|
let attachment = this.readAttachment(slotMap[entryName], skin, slot.index, entryName, skeletonData);
|
|
@@ -8358,7 +8487,11 @@ var spine = (() => {
|
|
|
8358
8487
|
for (let i = 0, n = this.linkedMeshes.length; i < n; i++) {
|
|
8359
8488
|
let linkedMesh = this.linkedMeshes[i];
|
|
8360
8489
|
let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
|
|
8490
|
+
if (!skin)
|
|
8491
|
+
throw new Error(`Skin not found: ${linkedMesh.skin}`);
|
|
8361
8492
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
8493
|
+
if (!parent)
|
|
8494
|
+
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
8362
8495
|
linkedMesh.mesh.timelineAttahment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
8363
8496
|
linkedMesh.mesh.setParentMesh(parent);
|
|
8364
8497
|
if (linkedMesh.mesh.region != null)
|
|
@@ -8542,7 +8675,10 @@ var spine = (() => {
|
|
|
8542
8675
|
if (map.slots) {
|
|
8543
8676
|
for (let slotName in map.slots) {
|
|
8544
8677
|
let slotMap = map.slots[slotName];
|
|
8545
|
-
let
|
|
8678
|
+
let slot = skeletonData.findSlot(slotName);
|
|
8679
|
+
if (!slot)
|
|
8680
|
+
throw new Error("Slot not found: " + slotName);
|
|
8681
|
+
let slotIndex = slot.index;
|
|
8546
8682
|
for (let timelineName in slotMap) {
|
|
8547
8683
|
let timelineMap = slotMap[timelineName];
|
|
8548
8684
|
if (!timelineMap)
|
|
@@ -8678,7 +8814,10 @@ var spine = (() => {
|
|
|
8678
8814
|
if (map.bones) {
|
|
8679
8815
|
for (let boneName in map.bones) {
|
|
8680
8816
|
let boneMap = map.bones[boneName];
|
|
8681
|
-
let
|
|
8817
|
+
let bone = skeletonData.findBone(boneName);
|
|
8818
|
+
if (!bone)
|
|
8819
|
+
throw new Error("Bone not found: " + boneName);
|
|
8820
|
+
let boneIndex = bone.index;
|
|
8682
8821
|
for (let timelineName in boneMap) {
|
|
8683
8822
|
let timelineMap = boneMap[timelineName];
|
|
8684
8823
|
let frames = timelineMap.length;
|
|
@@ -8724,6 +8863,8 @@ var spine = (() => {
|
|
|
8724
8863
|
if (!keyMap)
|
|
8725
8864
|
continue;
|
|
8726
8865
|
let constraint = skeletonData.findIkConstraint(constraintName);
|
|
8866
|
+
if (!constraint)
|
|
8867
|
+
throw new Error("IK Constraint not found: " + constraintName);
|
|
8727
8868
|
let constraintIndex = skeletonData.ikConstraints.indexOf(constraint);
|
|
8728
8869
|
let timeline = new IkConstraintTimeline(constraintMap.length, constraintMap.length << 1, constraintIndex);
|
|
8729
8870
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -8759,6 +8900,8 @@ var spine = (() => {
|
|
|
8759
8900
|
if (!keyMap)
|
|
8760
8901
|
continue;
|
|
8761
8902
|
let constraint = skeletonData.findTransformConstraint(constraintName);
|
|
8903
|
+
if (!constraint)
|
|
8904
|
+
throw new Error("Transform constraint not found: " + constraintName);
|
|
8762
8905
|
let constraintIndex = skeletonData.transformConstraints.indexOf(constraint);
|
|
8763
8906
|
let timeline = new TransformConstraintTimeline(timelineMap.length, timelineMap.length * 6, constraintIndex);
|
|
8764
8907
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -8807,6 +8950,8 @@ var spine = (() => {
|
|
|
8807
8950
|
for (let constraintName in map.path) {
|
|
8808
8951
|
let constraintMap = map.path[constraintName];
|
|
8809
8952
|
let constraint = skeletonData.findPathConstraint(constraintName);
|
|
8953
|
+
if (!constraint)
|
|
8954
|
+
throw new Error("Path constraint not found: " + constraintName);
|
|
8810
8955
|
let constraintIndex = skeletonData.pathConstraints.indexOf(constraint);
|
|
8811
8956
|
for (let timelineName in constraintMap) {
|
|
8812
8957
|
let timelineMap = constraintMap[timelineName];
|
|
@@ -8858,9 +9003,14 @@ var spine = (() => {
|
|
|
8858
9003
|
for (let attachmentsName in map.attachments) {
|
|
8859
9004
|
let attachmentsMap = map.attachments[attachmentsName];
|
|
8860
9005
|
let skin = skeletonData.findSkin(attachmentsName);
|
|
9006
|
+
if (!skin)
|
|
9007
|
+
throw new Error("Skin not found: " + attachmentsName);
|
|
8861
9008
|
for (let slotMapName in attachmentsMap) {
|
|
8862
9009
|
let slotMap = attachmentsMap[slotMapName];
|
|
8863
|
-
let
|
|
9010
|
+
let slot = skeletonData.findSlot(slotMapName);
|
|
9011
|
+
if (!slot)
|
|
9012
|
+
throw new Error("Slot not found: " + slotMapName);
|
|
9013
|
+
let slotIndex = slot.index;
|
|
8864
9014
|
for (let attachmentMapName in slotMap) {
|
|
8865
9015
|
let attachmentMap = slotMap[attachmentMapName];
|
|
8866
9016
|
let attachment = skin.getAttachment(slotIndex, attachmentMapName);
|
|
@@ -8940,7 +9090,10 @@ var spine = (() => {
|
|
|
8940
9090
|
let originalIndex = 0, unchangedIndex = 0;
|
|
8941
9091
|
for (let ii = 0; ii < offsets.length; ii++) {
|
|
8942
9092
|
let offsetMap = offsets[ii];
|
|
8943
|
-
let
|
|
9093
|
+
let slot = skeletonData.findSlot(offsetMap.slot);
|
|
9094
|
+
if (!slot)
|
|
9095
|
+
throw new Error("Slot not found: " + slot);
|
|
9096
|
+
let slotIndex = slot.index;
|
|
8944
9097
|
while (originalIndex != slotIndex)
|
|
8945
9098
|
unchanged[unchangedIndex++] = originalIndex++;
|
|
8946
9099
|
drawOrder[originalIndex + offsetMap.offset] = originalIndex++;
|
|
@@ -8961,6 +9114,8 @@ var spine = (() => {
|
|
|
8961
9114
|
for (let i = 0; i < map.events.length; i++, frame++) {
|
|
8962
9115
|
let eventMap = map.events[i];
|
|
8963
9116
|
let eventData = skeletonData.findEvent(eventMap.name);
|
|
9117
|
+
if (!eventData)
|
|
9118
|
+
throw new Error("Event not found: " + eventMap.name);
|
|
8964
9119
|
let event = new Event(Utils.toSinglePrecision(getValue(eventMap, "time", 0)), eventData);
|
|
8965
9120
|
event.intValue = getValue(eventMap, "int", eventData.intValue);
|
|
8966
9121
|
event.floatValue = getValue(eventMap, "float", eventData.floatValue);
|
|
@@ -9064,82 +9219,28 @@ var spine = (() => {
|
|
|
9064
9219
|
}
|
|
9065
9220
|
})();
|
|
9066
9221
|
|
|
9067
|
-
// spine-core/src/vertexeffects/JitterEffect.ts
|
|
9068
|
-
var JitterEffect = class {
|
|
9069
|
-
constructor(jitterX, jitterY) {
|
|
9070
|
-
this.jitterX = 0;
|
|
9071
|
-
this.jitterY = 0;
|
|
9072
|
-
this.jitterX = jitterX;
|
|
9073
|
-
this.jitterY = jitterY;
|
|
9074
|
-
}
|
|
9075
|
-
begin(skeleton) {
|
|
9076
|
-
}
|
|
9077
|
-
transform(position, uv, light, dark) {
|
|
9078
|
-
position.x += MathUtils.randomTriangular(-this.jitterX, this.jitterY);
|
|
9079
|
-
position.y += MathUtils.randomTriangular(-this.jitterX, this.jitterY);
|
|
9080
|
-
}
|
|
9081
|
-
end() {
|
|
9082
|
-
}
|
|
9083
|
-
};
|
|
9084
|
-
|
|
9085
|
-
// spine-core/src/vertexeffects/SwirlEffect.ts
|
|
9086
|
-
var _SwirlEffect = class {
|
|
9087
|
-
constructor(radius) {
|
|
9088
|
-
this.centerX = 0;
|
|
9089
|
-
this.centerY = 0;
|
|
9090
|
-
this.radius = 0;
|
|
9091
|
-
this.angle = 0;
|
|
9092
|
-
this.worldX = 0;
|
|
9093
|
-
this.worldY = 0;
|
|
9094
|
-
this.radius = radius;
|
|
9095
|
-
}
|
|
9096
|
-
begin(skeleton) {
|
|
9097
|
-
this.worldX = skeleton.x + this.centerX;
|
|
9098
|
-
this.worldY = skeleton.y + this.centerY;
|
|
9099
|
-
}
|
|
9100
|
-
transform(position, uv, light, dark) {
|
|
9101
|
-
let radAngle = this.angle * MathUtils.degreesToRadians;
|
|
9102
|
-
let x = position.x - this.worldX;
|
|
9103
|
-
let y = position.y - this.worldY;
|
|
9104
|
-
let dist = Math.sqrt(x * x + y * y);
|
|
9105
|
-
if (dist < this.radius) {
|
|
9106
|
-
let theta = _SwirlEffect.interpolation.apply(0, radAngle, (this.radius - dist) / this.radius);
|
|
9107
|
-
let cos = Math.cos(theta);
|
|
9108
|
-
let sin = Math.sin(theta);
|
|
9109
|
-
position.x = cos * x - sin * y + this.worldX;
|
|
9110
|
-
position.y = sin * x + cos * y + this.worldY;
|
|
9111
|
-
}
|
|
9112
|
-
}
|
|
9113
|
-
end() {
|
|
9114
|
-
}
|
|
9115
|
-
};
|
|
9116
|
-
var SwirlEffect = _SwirlEffect;
|
|
9117
|
-
SwirlEffect.interpolation = new PowOut(2);
|
|
9118
|
-
|
|
9119
9222
|
// spine-webgl/src/WebGL.ts
|
|
9120
9223
|
var ManagedWebGLRenderingContext = class {
|
|
9121
9224
|
constructor(canvasOrContext, contextConfig = { alpha: "true" }) {
|
|
9122
9225
|
this.restorables = new Array();
|
|
9123
|
-
if (!(canvasOrContext instanceof WebGLRenderingContext || typeof WebGL2RenderingContext !== "undefined" && canvasOrContext instanceof WebGL2RenderingContext))
|
|
9124
|
-
|
|
9125
|
-
|
|
9226
|
+
if (!(canvasOrContext instanceof WebGLRenderingContext || typeof WebGL2RenderingContext !== "undefined" && canvasOrContext instanceof WebGL2RenderingContext)) {
|
|
9227
|
+
let canvas = canvasOrContext;
|
|
9228
|
+
this.gl = canvas.getContext("webgl2", contextConfig) || canvas.getContext("webgl", contextConfig);
|
|
9229
|
+
this.canvas = canvas;
|
|
9230
|
+
canvas.addEventListener("webglcontextlost", (e) => {
|
|
9231
|
+
let event = e;
|
|
9232
|
+
if (e)
|
|
9233
|
+
e.preventDefault();
|
|
9234
|
+
});
|
|
9235
|
+
canvas.addEventListener("webglcontextrestored", (e) => {
|
|
9236
|
+
for (let i = 0, n = this.restorables.length; i < n; i++)
|
|
9237
|
+
this.restorables[i].restore();
|
|
9238
|
+
});
|
|
9239
|
+
} else {
|
|
9126
9240
|
this.gl = canvasOrContext;
|
|
9127
9241
|
this.canvas = this.gl.canvas;
|
|
9128
9242
|
}
|
|
9129
9243
|
}
|
|
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
9244
|
addRestorable(restorable) {
|
|
9144
9245
|
this.restorables.push(restorable);
|
|
9145
9246
|
}
|
|
@@ -9276,7 +9377,7 @@ var spine = (() => {
|
|
|
9276
9377
|
|
|
9277
9378
|
// spine-webgl/src/AssetManager.ts
|
|
9278
9379
|
var AssetManager = class extends AssetManagerBase {
|
|
9279
|
-
constructor(context, pathPrefix = "", downloader =
|
|
9380
|
+
constructor(context, pathPrefix = "", downloader = new Downloader()) {
|
|
9280
9381
|
super((image) => {
|
|
9281
9382
|
return new GLTexture(context, image);
|
|
9282
9383
|
}, pathPrefix, downloader);
|
|
@@ -9585,7 +9686,6 @@ var spine = (() => {
|
|
|
9585
9686
|
return this.set(this.temp);
|
|
9586
9687
|
}
|
|
9587
9688
|
lookAt(position, direction, up) {
|
|
9588
|
-
_Matrix4.initTemps();
|
|
9589
9689
|
let xAxis = _Matrix4.xAxis, yAxis = _Matrix4.yAxis, zAxis = _Matrix4.zAxis;
|
|
9590
9690
|
zAxis.setFrom(direction).normalize();
|
|
9591
9691
|
xAxis.setFrom(direction).normalize();
|
|
@@ -9609,19 +9709,11 @@ var spine = (() => {
|
|
|
9609
9709
|
this.multiply(_Matrix4.tmpMatrix);
|
|
9610
9710
|
return this;
|
|
9611
9711
|
}
|
|
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
9712
|
};
|
|
9621
9713
|
var Matrix42 = _Matrix4;
|
|
9622
|
-
Matrix42.xAxis =
|
|
9623
|
-
Matrix42.yAxis =
|
|
9624
|
-
Matrix42.zAxis =
|
|
9714
|
+
Matrix42.xAxis = new Vector3();
|
|
9715
|
+
Matrix42.yAxis = new Vector3();
|
|
9716
|
+
Matrix42.zAxis = new Vector3();
|
|
9625
9717
|
Matrix42.tmpMatrix = new _Matrix4();
|
|
9626
9718
|
|
|
9627
9719
|
// spine-webgl/src/Camera.ts
|
|
@@ -9758,6 +9850,8 @@ var spine = (() => {
|
|
|
9758
9850
|
if (!this.touch0 || !this.touch1) {
|
|
9759
9851
|
var touches = ev.changedTouches;
|
|
9760
9852
|
let nativeTouch = touches.item(0);
|
|
9853
|
+
if (!nativeTouch)
|
|
9854
|
+
return;
|
|
9761
9855
|
let rect = element.getBoundingClientRect();
|
|
9762
9856
|
let x = nativeTouch.clientX - rect.left;
|
|
9763
9857
|
let y = nativeTouch.clientY - rect.top;
|
|
@@ -9978,7 +10072,11 @@ var spine = (() => {
|
|
|
9978
10072
|
let gl = this.context.gl;
|
|
9979
10073
|
try {
|
|
9980
10074
|
this.vs = this.compileShader(gl.VERTEX_SHADER, this.vertexShader);
|
|
10075
|
+
if (!this.vs)
|
|
10076
|
+
throw new Error("Couldn't compile vertex shader.");
|
|
9981
10077
|
this.fs = this.compileShader(gl.FRAGMENT_SHADER, this.fragmentShader);
|
|
10078
|
+
if (!this.fs)
|
|
10079
|
+
throw new Error("Couldn#t compile fragment shader.");
|
|
9982
10080
|
this.program = this.compileProgram(this.vs, this.fs);
|
|
9983
10081
|
} catch (e) {
|
|
9984
10082
|
this.dispose();
|
|
@@ -9988,6 +10086,8 @@ var spine = (() => {
|
|
|
9988
10086
|
compileShader(type, source) {
|
|
9989
10087
|
let gl = this.context.gl;
|
|
9990
10088
|
let shader = gl.createShader(type);
|
|
10089
|
+
if (!shader)
|
|
10090
|
+
throw new Error("Couldn't create shader.");
|
|
9991
10091
|
gl.shaderSource(shader, source);
|
|
9992
10092
|
gl.compileShader(shader);
|
|
9993
10093
|
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
|
|
@@ -10001,6 +10101,8 @@ var spine = (() => {
|
|
|
10001
10101
|
compileProgram(vs, fs) {
|
|
10002
10102
|
let gl = this.context.gl;
|
|
10003
10103
|
let program = gl.createProgram();
|
|
10104
|
+
if (!program)
|
|
10105
|
+
throw new Error("Couldn't compile program.");
|
|
10004
10106
|
gl.attachShader(program, vs);
|
|
10005
10107
|
gl.attachShader(program, fs);
|
|
10006
10108
|
gl.linkProgram(program);
|
|
@@ -10053,6 +10155,8 @@ var spine = (() => {
|
|
|
10053
10155
|
}
|
|
10054
10156
|
getUniformLocation(uniform) {
|
|
10055
10157
|
let gl = this.context.gl;
|
|
10158
|
+
if (!this.program)
|
|
10159
|
+
throw new Error("Shader not compiled.");
|
|
10056
10160
|
let location = gl.getUniformLocation(this.program, uniform);
|
|
10057
10161
|
if (!location && !gl.isContextLost())
|
|
10058
10162
|
throw new Error(`Couldn't find location for uniform ${uniform}`);
|
|
@@ -10060,6 +10164,8 @@ var spine = (() => {
|
|
|
10060
10164
|
}
|
|
10061
10165
|
getAttributeLocation(attribute) {
|
|
10062
10166
|
let gl = this.context.gl;
|
|
10167
|
+
if (!this.program)
|
|
10168
|
+
throw new Error("Shader not compiled.");
|
|
10063
10169
|
let location = gl.getAttribLocation(this.program, attribute);
|
|
10064
10170
|
if (location == -1 && !gl.isContextLost())
|
|
10065
10171
|
throw new Error(`Couldn't find location for attribute ${attribute}`);
|
|
@@ -10191,8 +10297,10 @@ var spine = (() => {
|
|
|
10191
10297
|
var Mesh = class {
|
|
10192
10298
|
constructor(context, attributes, maxVertices, maxIndices) {
|
|
10193
10299
|
this.attributes = attributes;
|
|
10300
|
+
this.verticesBuffer = null;
|
|
10194
10301
|
this.verticesLength = 0;
|
|
10195
10302
|
this.dirtyVertices = false;
|
|
10303
|
+
this.indicesBuffer = null;
|
|
10196
10304
|
this.indicesLength = 0;
|
|
10197
10305
|
this.dirtyIndices = false;
|
|
10198
10306
|
this.elementsPerVertex = 0;
|
|
@@ -10367,11 +10475,13 @@ var spine = (() => {
|
|
|
10367
10475
|
// spine-webgl/src/PolygonBatcher.ts
|
|
10368
10476
|
var PolygonBatcher = class {
|
|
10369
10477
|
constructor(context, twoColorTint = true, maxVertices = 10920) {
|
|
10478
|
+
this.drawCalls = 0;
|
|
10370
10479
|
this.isDrawing = false;
|
|
10371
10480
|
this.shader = null;
|
|
10372
10481
|
this.lastTexture = null;
|
|
10373
10482
|
this.verticesLength = 0;
|
|
10374
10483
|
this.indicesLength = 0;
|
|
10484
|
+
this.cullWasEnabled = false;
|
|
10375
10485
|
if (maxVertices > 10920)
|
|
10376
10486
|
throw new Error("Can't have more than 10920 triangles per batch: " + maxVertices);
|
|
10377
10487
|
this.context = context instanceof ManagedWebGLRenderingContext ? context : new ManagedWebGLRenderingContext(context);
|
|
@@ -10428,6 +10538,10 @@ var spine = (() => {
|
|
|
10428
10538
|
flush() {
|
|
10429
10539
|
if (this.verticesLength == 0)
|
|
10430
10540
|
return;
|
|
10541
|
+
if (!this.lastTexture)
|
|
10542
|
+
throw new Error("No texture set.");
|
|
10543
|
+
if (!this.shader)
|
|
10544
|
+
throw new Error("No shader set.");
|
|
10431
10545
|
this.lastTexture.bind();
|
|
10432
10546
|
this.mesh.draw(this.shader, this.context.gl.TRIANGLES);
|
|
10433
10547
|
this.verticesLength = 0;
|
|
@@ -10463,6 +10577,7 @@ var spine = (() => {
|
|
|
10463
10577
|
this.isDrawing = false;
|
|
10464
10578
|
this.shapeType = ShapeType.Filled;
|
|
10465
10579
|
this.color = new Color(1, 1, 1, 1);
|
|
10580
|
+
this.shader = null;
|
|
10466
10581
|
this.vertexIndex = 0;
|
|
10467
10582
|
this.tmp = new Vector2();
|
|
10468
10583
|
if (maxVertices > 10920)
|
|
@@ -10500,30 +10615,30 @@ var spine = (() => {
|
|
|
10500
10615
|
setColorWith(r, g, b, a) {
|
|
10501
10616
|
this.color.set(r, g, b, a);
|
|
10502
10617
|
}
|
|
10503
|
-
point(x, y, color
|
|
10618
|
+
point(x, y, color) {
|
|
10504
10619
|
this.check(ShapeType.Point, 1);
|
|
10505
|
-
if (color
|
|
10620
|
+
if (!color)
|
|
10506
10621
|
color = this.color;
|
|
10507
10622
|
this.vertex(x, y, color);
|
|
10508
10623
|
}
|
|
10509
|
-
line(x, y, x2, y2, color
|
|
10624
|
+
line(x, y, x2, y2, color) {
|
|
10510
10625
|
this.check(ShapeType.Line, 2);
|
|
10511
10626
|
let vertices = this.mesh.getVertices();
|
|
10512
10627
|
let idx = this.vertexIndex;
|
|
10513
|
-
if (color
|
|
10628
|
+
if (!color)
|
|
10514
10629
|
color = this.color;
|
|
10515
10630
|
this.vertex(x, y, color);
|
|
10516
10631
|
this.vertex(x2, y2, color);
|
|
10517
10632
|
}
|
|
10518
|
-
triangle(filled, x, y, x2, y2, x3, y3, color
|
|
10633
|
+
triangle(filled, x, y, x2, y2, x3, y3, color, color2, color3) {
|
|
10519
10634
|
this.check(filled ? ShapeType.Filled : ShapeType.Line, 3);
|
|
10520
10635
|
let vertices = this.mesh.getVertices();
|
|
10521
10636
|
let idx = this.vertexIndex;
|
|
10522
|
-
if (color
|
|
10637
|
+
if (!color)
|
|
10523
10638
|
color = this.color;
|
|
10524
|
-
if (color2
|
|
10639
|
+
if (!color2)
|
|
10525
10640
|
color2 = this.color;
|
|
10526
|
-
if (color3
|
|
10641
|
+
if (!color3)
|
|
10527
10642
|
color3 = this.color;
|
|
10528
10643
|
if (filled) {
|
|
10529
10644
|
this.vertex(x, y, color);
|
|
@@ -10538,17 +10653,17 @@ var spine = (() => {
|
|
|
10538
10653
|
this.vertex(x, y, color2);
|
|
10539
10654
|
}
|
|
10540
10655
|
}
|
|
10541
|
-
quad(filled, x, y, x2, y2, x3, y3, x4, y4, color
|
|
10656
|
+
quad(filled, x, y, x2, y2, x3, y3, x4, y4, color, color2, color3, color4) {
|
|
10542
10657
|
this.check(filled ? ShapeType.Filled : ShapeType.Line, 3);
|
|
10543
10658
|
let vertices = this.mesh.getVertices();
|
|
10544
10659
|
let idx = this.vertexIndex;
|
|
10545
|
-
if (color
|
|
10660
|
+
if (!color)
|
|
10546
10661
|
color = this.color;
|
|
10547
|
-
if (color2
|
|
10662
|
+
if (!color2)
|
|
10548
10663
|
color2 = this.color;
|
|
10549
|
-
if (color3
|
|
10664
|
+
if (!color3)
|
|
10550
10665
|
color3 = this.color;
|
|
10551
|
-
if (color4
|
|
10666
|
+
if (!color4)
|
|
10552
10667
|
color4 = this.color;
|
|
10553
10668
|
if (filled) {
|
|
10554
10669
|
this.vertex(x, y, color);
|
|
@@ -10568,12 +10683,12 @@ var spine = (() => {
|
|
|
10568
10683
|
this.vertex(x, y, color);
|
|
10569
10684
|
}
|
|
10570
10685
|
}
|
|
10571
|
-
rect(filled, x, y, width, height, color
|
|
10686
|
+
rect(filled, x, y, width, height, color) {
|
|
10572
10687
|
this.quad(filled, x, y, x + width, y, x + width, y + height, x, y + height, color, color, color, color);
|
|
10573
10688
|
}
|
|
10574
|
-
rectLine(filled, x1, y1, x2, y2, width, color
|
|
10689
|
+
rectLine(filled, x1, y1, x2, y2, width, color) {
|
|
10575
10690
|
this.check(filled ? ShapeType.Filled : ShapeType.Line, 8);
|
|
10576
|
-
if (color
|
|
10691
|
+
if (!color)
|
|
10577
10692
|
color = this.color;
|
|
10578
10693
|
let t = this.tmp.set(y2 - y1, x1 - x2);
|
|
10579
10694
|
t.normalize();
|
|
@@ -10602,11 +10717,11 @@ var spine = (() => {
|
|
|
10602
10717
|
this.line(x - size, y - size, x + size, y + size);
|
|
10603
10718
|
this.line(x - size, y + size, x + size, y - size);
|
|
10604
10719
|
}
|
|
10605
|
-
polygon(polygonVertices, offset, count, color
|
|
10720
|
+
polygon(polygonVertices, offset, count, color) {
|
|
10606
10721
|
if (count < 3)
|
|
10607
10722
|
throw new Error("Polygon must contain at least 3 vertices");
|
|
10608
10723
|
this.check(ShapeType.Line, count * 2);
|
|
10609
|
-
if (color
|
|
10724
|
+
if (color)
|
|
10610
10725
|
color = this.color;
|
|
10611
10726
|
let vertices = this.mesh.getVertices();
|
|
10612
10727
|
let idx = this.vertexIndex;
|
|
@@ -10631,12 +10746,12 @@ var spine = (() => {
|
|
|
10631
10746
|
this.vertex(x2, y2, color);
|
|
10632
10747
|
}
|
|
10633
10748
|
}
|
|
10634
|
-
circle(filled, x, y, radius, color
|
|
10635
|
-
if (segments
|
|
10749
|
+
circle(filled, x, y, radius, color, segments = 0) {
|
|
10750
|
+
if (segments == 0)
|
|
10636
10751
|
segments = Math.max(1, 6 * MathUtils.cbrt(radius) | 0);
|
|
10637
10752
|
if (segments <= 0)
|
|
10638
10753
|
throw new Error("segments must be > 0.");
|
|
10639
|
-
if (color
|
|
10754
|
+
if (!color)
|
|
10640
10755
|
color = this.color;
|
|
10641
10756
|
let angle = 2 * MathUtils.PI / segments;
|
|
10642
10757
|
let cos = Math.cos(angle);
|
|
@@ -10671,9 +10786,9 @@ var spine = (() => {
|
|
|
10671
10786
|
cy = 0;
|
|
10672
10787
|
this.vertex(x + cx, y + cy, color);
|
|
10673
10788
|
}
|
|
10674
|
-
curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color
|
|
10789
|
+
curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color) {
|
|
10675
10790
|
this.check(ShapeType.Line, segments * 2 + 2);
|
|
10676
|
-
if (color
|
|
10791
|
+
if (color)
|
|
10677
10792
|
color = this.color;
|
|
10678
10793
|
let subdiv_step = 1 / segments;
|
|
10679
10794
|
let subdiv_step2 = subdiv_step * subdiv_step;
|
|
@@ -10729,6 +10844,8 @@ var spine = (() => {
|
|
|
10729
10844
|
flush() {
|
|
10730
10845
|
if (this.vertexIndex == 0)
|
|
10731
10846
|
return;
|
|
10847
|
+
if (!this.shader)
|
|
10848
|
+
throw new Error("No shader set.");
|
|
10732
10849
|
this.mesh.setVerticesLength(this.vertexIndex);
|
|
10733
10850
|
this.mesh.draw(this.shader, this.shapeType);
|
|
10734
10851
|
this.vertexIndex = 0;
|
|
@@ -10783,7 +10900,7 @@ var spine = (() => {
|
|
|
10783
10900
|
this.vertices = Utils.newFloatArray(2 * 1024);
|
|
10784
10901
|
this.context = context instanceof ManagedWebGLRenderingContext ? context : new ManagedWebGLRenderingContext(context);
|
|
10785
10902
|
}
|
|
10786
|
-
draw(shapes, skeleton, ignoredBones
|
|
10903
|
+
draw(shapes, skeleton, ignoredBones) {
|
|
10787
10904
|
let skeletonX = skeleton.x;
|
|
10788
10905
|
let skeletonY = skeleton.y;
|
|
10789
10906
|
let gl = this.context.gl;
|
|
@@ -10960,12 +11077,11 @@ var spine = (() => {
|
|
|
10960
11077
|
var _SkeletonRenderer = class {
|
|
10961
11078
|
constructor(context, twoColorTint = true) {
|
|
10962
11079
|
this.premultipliedAlpha = false;
|
|
10963
|
-
this.vertexEffect = null;
|
|
10964
11080
|
this.tempColor = new Color();
|
|
10965
11081
|
this.tempColor2 = new Color();
|
|
10966
11082
|
this.vertexSize = 2 + 2 + 4;
|
|
10967
11083
|
this.twoColorTint = false;
|
|
10968
|
-
this.renderable = new Renderable(
|
|
11084
|
+
this.renderable = new Renderable([], 0, 0);
|
|
10969
11085
|
this.clipper = new SkeletonClipping();
|
|
10970
11086
|
this.temp = new Vector2();
|
|
10971
11087
|
this.temp2 = new Vector2();
|
|
@@ -10986,10 +11102,10 @@ var spine = (() => {
|
|
|
10986
11102
|
let tempLight = this.temp3;
|
|
10987
11103
|
let tempDark = this.temp4;
|
|
10988
11104
|
let renderable = this.renderable;
|
|
10989
|
-
let uvs
|
|
10990
|
-
let triangles
|
|
11105
|
+
let uvs;
|
|
11106
|
+
let triangles;
|
|
10991
11107
|
let drawOrder = skeleton.drawOrder;
|
|
10992
|
-
let attachmentColor
|
|
11108
|
+
let attachmentColor;
|
|
10993
11109
|
let skeletonColor = skeleton.color;
|
|
10994
11110
|
let vertexSize = twoColorTint ? 12 : 8;
|
|
10995
11111
|
let inRange = false;
|
|
@@ -11013,7 +11129,7 @@ var spine = (() => {
|
|
|
11013
11129
|
inRange = false;
|
|
11014
11130
|
}
|
|
11015
11131
|
let attachment = slot.getAttachment();
|
|
11016
|
-
let texture
|
|
11132
|
+
let texture;
|
|
11017
11133
|
if (attachment instanceof RegionAttachment) {
|
|
11018
11134
|
let region = attachment;
|
|
11019
11135
|
renderable.vertices = this.vertices;
|
|
@@ -11079,120 +11195,30 @@ var spine = (() => {
|
|
|
11079
11195
|
clipper.clipTriangles(renderable.vertices, renderable.numFloats, triangles, triangles.length, uvs, finalColor, darkColor, twoColorTint);
|
|
11080
11196
|
let clippedVertices = new Float32Array(clipper.clippedVertices);
|
|
11081
11197
|
let clippedTriangles = clipper.clippedTriangles;
|
|
11082
|
-
if (this.vertexEffect) {
|
|
11083
|
-
let vertexEffect = this.vertexEffect;
|
|
11084
|
-
let verts = clippedVertices;
|
|
11085
|
-
if (!twoColorTint) {
|
|
11086
|
-
for (let v = 0, n2 = clippedVertices.length; v < n2; v += vertexSize) {
|
|
11087
|
-
tempPos.x = verts[v];
|
|
11088
|
-
tempPos.y = verts[v + 1];
|
|
11089
|
-
tempLight.set(verts[v + 2], verts[v + 3], verts[v + 4], verts[v + 5]);
|
|
11090
|
-
tempUv.x = verts[v + 6];
|
|
11091
|
-
tempUv.y = verts[v + 7];
|
|
11092
|
-
tempDark.set(0, 0, 0, 0);
|
|
11093
|
-
vertexEffect.transform(tempPos, tempUv, tempLight, tempDark);
|
|
11094
|
-
verts[v] = tempPos.x;
|
|
11095
|
-
verts[v + 1] = tempPos.y;
|
|
11096
|
-
verts[v + 2] = tempLight.r;
|
|
11097
|
-
verts[v + 3] = tempLight.g;
|
|
11098
|
-
verts[v + 4] = tempLight.b;
|
|
11099
|
-
verts[v + 5] = tempLight.a;
|
|
11100
|
-
verts[v + 6] = tempUv.x;
|
|
11101
|
-
verts[v + 7] = tempUv.y;
|
|
11102
|
-
}
|
|
11103
|
-
} else {
|
|
11104
|
-
for (let v = 0, n2 = clippedVertices.length; v < n2; v += vertexSize) {
|
|
11105
|
-
tempPos.x = verts[v];
|
|
11106
|
-
tempPos.y = verts[v + 1];
|
|
11107
|
-
tempLight.set(verts[v + 2], verts[v + 3], verts[v + 4], verts[v + 5]);
|
|
11108
|
-
tempUv.x = verts[v + 6];
|
|
11109
|
-
tempUv.y = verts[v + 7];
|
|
11110
|
-
tempDark.set(verts[v + 8], verts[v + 9], verts[v + 10], verts[v + 11]);
|
|
11111
|
-
vertexEffect.transform(tempPos, tempUv, tempLight, tempDark);
|
|
11112
|
-
verts[v] = tempPos.x;
|
|
11113
|
-
verts[v + 1] = tempPos.y;
|
|
11114
|
-
verts[v + 2] = tempLight.r;
|
|
11115
|
-
verts[v + 3] = tempLight.g;
|
|
11116
|
-
verts[v + 4] = tempLight.b;
|
|
11117
|
-
verts[v + 5] = tempLight.a;
|
|
11118
|
-
verts[v + 6] = tempUv.x;
|
|
11119
|
-
verts[v + 7] = tempUv.y;
|
|
11120
|
-
verts[v + 8] = tempDark.r;
|
|
11121
|
-
verts[v + 9] = tempDark.g;
|
|
11122
|
-
verts[v + 10] = tempDark.b;
|
|
11123
|
-
verts[v + 11] = tempDark.a;
|
|
11124
|
-
}
|
|
11125
|
-
}
|
|
11126
|
-
}
|
|
11127
11198
|
batcher.draw(texture, clippedVertices, clippedTriangles);
|
|
11128
11199
|
} else {
|
|
11129
11200
|
let verts = renderable.vertices;
|
|
11130
|
-
if (
|
|
11131
|
-
let
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11137
|
-
|
|
11138
|
-
tempLight.setFromColor(finalColor);
|
|
11139
|
-
tempDark.set(0, 0, 0, 0);
|
|
11140
|
-
vertexEffect.transform(tempPos, tempUv, tempLight, tempDark);
|
|
11141
|
-
verts[v] = tempPos.x;
|
|
11142
|
-
verts[v + 1] = tempPos.y;
|
|
11143
|
-
verts[v + 2] = tempLight.r;
|
|
11144
|
-
verts[v + 3] = tempLight.g;
|
|
11145
|
-
verts[v + 4] = tempLight.b;
|
|
11146
|
-
verts[v + 5] = tempLight.a;
|
|
11147
|
-
verts[v + 6] = tempUv.x;
|
|
11148
|
-
verts[v + 7] = tempUv.y;
|
|
11149
|
-
}
|
|
11150
|
-
} else {
|
|
11151
|
-
for (let v = 0, u = 0, n2 = renderable.numFloats; v < n2; v += vertexSize, u += 2) {
|
|
11152
|
-
tempPos.x = verts[v];
|
|
11153
|
-
tempPos.y = verts[v + 1];
|
|
11154
|
-
tempUv.x = uvs[u];
|
|
11155
|
-
tempUv.y = uvs[u + 1];
|
|
11156
|
-
tempLight.setFromColor(finalColor);
|
|
11157
|
-
tempDark.setFromColor(darkColor);
|
|
11158
|
-
vertexEffect.transform(tempPos, tempUv, tempLight, tempDark);
|
|
11159
|
-
verts[v] = tempPos.x;
|
|
11160
|
-
verts[v + 1] = tempPos.y;
|
|
11161
|
-
verts[v + 2] = tempLight.r;
|
|
11162
|
-
verts[v + 3] = tempLight.g;
|
|
11163
|
-
verts[v + 4] = tempLight.b;
|
|
11164
|
-
verts[v + 5] = tempLight.a;
|
|
11165
|
-
verts[v + 6] = tempUv.x;
|
|
11166
|
-
verts[v + 7] = tempUv.y;
|
|
11167
|
-
verts[v + 8] = tempDark.r;
|
|
11168
|
-
verts[v + 9] = tempDark.g;
|
|
11169
|
-
verts[v + 10] = tempDark.b;
|
|
11170
|
-
verts[v + 11] = tempDark.a;
|
|
11171
|
-
}
|
|
11201
|
+
if (!twoColorTint) {
|
|
11202
|
+
for (let v = 2, u = 0, n2 = renderable.numFloats; v < n2; v += vertexSize, u += 2) {
|
|
11203
|
+
verts[v] = finalColor.r;
|
|
11204
|
+
verts[v + 1] = finalColor.g;
|
|
11205
|
+
verts[v + 2] = finalColor.b;
|
|
11206
|
+
verts[v + 3] = finalColor.a;
|
|
11207
|
+
verts[v + 4] = uvs[u];
|
|
11208
|
+
verts[v + 5] = uvs[u + 1];
|
|
11172
11209
|
}
|
|
11173
11210
|
} else {
|
|
11174
|
-
|
|
11175
|
-
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11180
|
-
|
|
11181
|
-
|
|
11182
|
-
|
|
11183
|
-
|
|
11184
|
-
|
|
11185
|
-
verts[v] = finalColor.r;
|
|
11186
|
-
verts[v + 1] = finalColor.g;
|
|
11187
|
-
verts[v + 2] = finalColor.b;
|
|
11188
|
-
verts[v + 3] = finalColor.a;
|
|
11189
|
-
verts[v + 4] = uvs[u];
|
|
11190
|
-
verts[v + 5] = uvs[u + 1];
|
|
11191
|
-
verts[v + 6] = darkColor.r;
|
|
11192
|
-
verts[v + 7] = darkColor.g;
|
|
11193
|
-
verts[v + 8] = darkColor.b;
|
|
11194
|
-
verts[v + 9] = darkColor.a;
|
|
11195
|
-
}
|
|
11211
|
+
for (let v = 2, u = 0, n2 = renderable.numFloats; v < n2; v += vertexSize, u += 2) {
|
|
11212
|
+
verts[v] = finalColor.r;
|
|
11213
|
+
verts[v + 1] = finalColor.g;
|
|
11214
|
+
verts[v + 2] = finalColor.b;
|
|
11215
|
+
verts[v + 3] = finalColor.a;
|
|
11216
|
+
verts[v + 4] = uvs[u];
|
|
11217
|
+
verts[v + 5] = uvs[u + 1];
|
|
11218
|
+
verts[v + 6] = darkColor.r;
|
|
11219
|
+
verts[v + 7] = darkColor.g;
|
|
11220
|
+
verts[v + 8] = darkColor.b;
|
|
11221
|
+
verts[v + 9] = darkColor.a;
|
|
11196
11222
|
}
|
|
11197
11223
|
}
|
|
11198
11224
|
let view = renderable.vertices.subarray(0, renderable.numFloats);
|
|
@@ -11247,6 +11273,7 @@ var spine = (() => {
|
|
|
11247
11273
|
var SceneRenderer = class {
|
|
11248
11274
|
constructor(canvas, context, twoColorTint = true) {
|
|
11249
11275
|
this.twoColorTint = false;
|
|
11276
|
+
this.activeRenderer = null;
|
|
11250
11277
|
this.canvas = canvas;
|
|
11251
11278
|
this.context = context instanceof ManagedWebGLRenderingContext ? context : new ManagedWebGLRenderingContext(context);
|
|
11252
11279
|
this.twoColorTint = twoColorTint;
|
|
@@ -11274,14 +11301,14 @@ var spine = (() => {
|
|
|
11274
11301
|
this.skeletonRenderer.premultipliedAlpha = premultipliedAlpha;
|
|
11275
11302
|
this.skeletonRenderer.draw(this.batcher, skeleton, slotRangeStart, slotRangeEnd);
|
|
11276
11303
|
}
|
|
11277
|
-
drawSkeletonDebug(skeleton, premultipliedAlpha = false, ignoredBones
|
|
11304
|
+
drawSkeletonDebug(skeleton, premultipliedAlpha = false, ignoredBones) {
|
|
11278
11305
|
this.enableRenderer(this.shapes);
|
|
11279
11306
|
this.skeletonDebugRenderer.premultipliedAlpha = premultipliedAlpha;
|
|
11280
11307
|
this.skeletonDebugRenderer.draw(this.shapes, skeleton, ignoredBones);
|
|
11281
11308
|
}
|
|
11282
|
-
drawTexture(texture, x, y, width, height, color
|
|
11309
|
+
drawTexture(texture, x, y, width, height, color) {
|
|
11283
11310
|
this.enableRenderer(this.batcher);
|
|
11284
|
-
if (color
|
|
11311
|
+
if (!color)
|
|
11285
11312
|
color = WHITE;
|
|
11286
11313
|
var i = 0;
|
|
11287
11314
|
quad[i++] = x;
|
|
@@ -11342,9 +11369,9 @@ var spine = (() => {
|
|
|
11342
11369
|
}
|
|
11343
11370
|
this.batcher.draw(texture, quad, QUAD_TRIANGLES);
|
|
11344
11371
|
}
|
|
11345
|
-
drawTextureUV(texture, x, y, width, height, u, v, u2, v2, color
|
|
11372
|
+
drawTextureUV(texture, x, y, width, height, u, v, u2, v2, color) {
|
|
11346
11373
|
this.enableRenderer(this.batcher);
|
|
11347
|
-
if (color
|
|
11374
|
+
if (!color)
|
|
11348
11375
|
color = WHITE;
|
|
11349
11376
|
var i = 0;
|
|
11350
11377
|
quad[i++] = x;
|
|
@@ -11405,9 +11432,9 @@ var spine = (() => {
|
|
|
11405
11432
|
}
|
|
11406
11433
|
this.batcher.draw(texture, quad, QUAD_TRIANGLES);
|
|
11407
11434
|
}
|
|
11408
|
-
drawTextureRotated(texture, x, y, width, height, pivotX, pivotY, angle, color
|
|
11435
|
+
drawTextureRotated(texture, x, y, width, height, pivotX, pivotY, angle, color) {
|
|
11409
11436
|
this.enableRenderer(this.batcher);
|
|
11410
|
-
if (color
|
|
11437
|
+
if (!color)
|
|
11411
11438
|
color = WHITE;
|
|
11412
11439
|
let worldOriginX = x + pivotX;
|
|
11413
11440
|
let worldOriginY = y + pivotY;
|
|
@@ -11519,9 +11546,9 @@ var spine = (() => {
|
|
|
11519
11546
|
}
|
|
11520
11547
|
this.batcher.draw(texture, quad, QUAD_TRIANGLES);
|
|
11521
11548
|
}
|
|
11522
|
-
drawRegion(region, x, y, width, height, color
|
|
11549
|
+
drawRegion(region, x, y, width, height, color) {
|
|
11523
11550
|
this.enableRenderer(this.batcher);
|
|
11524
|
-
if (color
|
|
11551
|
+
if (!color)
|
|
11525
11552
|
color = WHITE;
|
|
11526
11553
|
var i = 0;
|
|
11527
11554
|
quad[i++] = x;
|
|
@@ -11582,35 +11609,35 @@ var spine = (() => {
|
|
|
11582
11609
|
}
|
|
11583
11610
|
this.batcher.draw(region.page.texture, quad, QUAD_TRIANGLES);
|
|
11584
11611
|
}
|
|
11585
|
-
line(x, y, x2, y2, color
|
|
11612
|
+
line(x, y, x2, y2, color, color2) {
|
|
11586
11613
|
this.enableRenderer(this.shapes);
|
|
11587
11614
|
this.shapes.line(x, y, x2, y2, color);
|
|
11588
11615
|
}
|
|
11589
|
-
triangle(filled, x, y, x2, y2, x3, y3, color
|
|
11616
|
+
triangle(filled, x, y, x2, y2, x3, y3, color, color2, color3) {
|
|
11590
11617
|
this.enableRenderer(this.shapes);
|
|
11591
11618
|
this.shapes.triangle(filled, x, y, x2, y2, x3, y3, color, color2, color3);
|
|
11592
11619
|
}
|
|
11593
|
-
quad(filled, x, y, x2, y2, x3, y3, x4, y4, color
|
|
11620
|
+
quad(filled, x, y, x2, y2, x3, y3, x4, y4, color, color2, color3, color4) {
|
|
11594
11621
|
this.enableRenderer(this.shapes);
|
|
11595
11622
|
this.shapes.quad(filled, x, y, x2, y2, x3, y3, x4, y4, color, color2, color3, color4);
|
|
11596
11623
|
}
|
|
11597
|
-
rect(filled, x, y, width, height, color
|
|
11624
|
+
rect(filled, x, y, width, height, color) {
|
|
11598
11625
|
this.enableRenderer(this.shapes);
|
|
11599
11626
|
this.shapes.rect(filled, x, y, width, height, color);
|
|
11600
11627
|
}
|
|
11601
|
-
rectLine(filled, x1, y1, x2, y2, width, color
|
|
11628
|
+
rectLine(filled, x1, y1, x2, y2, width, color) {
|
|
11602
11629
|
this.enableRenderer(this.shapes);
|
|
11603
11630
|
this.shapes.rectLine(filled, x1, y1, x2, y2, width, color);
|
|
11604
11631
|
}
|
|
11605
|
-
polygon(polygonVertices, offset, count, color
|
|
11632
|
+
polygon(polygonVertices, offset, count, color) {
|
|
11606
11633
|
this.enableRenderer(this.shapes);
|
|
11607
11634
|
this.shapes.polygon(polygonVertices, offset, count, color);
|
|
11608
11635
|
}
|
|
11609
|
-
circle(filled, x, y, radius, color
|
|
11636
|
+
circle(filled, x, y, radius, color, segments = 0) {
|
|
11610
11637
|
this.enableRenderer(this.shapes);
|
|
11611
11638
|
this.shapes.circle(filled, x, y, radius, color, segments);
|
|
11612
11639
|
}
|
|
11613
|
-
curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color
|
|
11640
|
+
curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color) {
|
|
11614
11641
|
this.enableRenderer(this.shapes);
|
|
11615
11642
|
this.shapes.curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color);
|
|
11616
11643
|
}
|
|
@@ -11706,8 +11733,9 @@ var spine = (() => {
|
|
|
11706
11733
|
}
|
|
11707
11734
|
}
|
|
11708
11735
|
dispose() {
|
|
11709
|
-
|
|
11710
|
-
this.
|
|
11736
|
+
var _a, _b;
|
|
11737
|
+
(_a = this.logo) == null ? void 0 : _a.dispose();
|
|
11738
|
+
(_b = this.spinner) == null ? void 0 : _b.dispose();
|
|
11711
11739
|
}
|
|
11712
11740
|
draw(complete = false) {
|
|
11713
11741
|
if (loaded < 2 || complete && this.fadeOut > FADE_OUT)
|
|
@@ -11753,7 +11781,8 @@ var spine = (() => {
|
|
|
11753
11781
|
renderer.camera.zoom = Math.max(1, spinnerSize / canvas.height);
|
|
11754
11782
|
renderer.begin();
|
|
11755
11783
|
renderer.drawTexture(this.logo, (canvas.width - logoWidth) / 2, (canvas.height - logoHeight) / 2, logoWidth, logoHeight, tempColor);
|
|
11756
|
-
|
|
11784
|
+
if (this.spinner)
|
|
11785
|
+
renderer.drawTextureRotated(this.spinner, (canvas.width - spinnerSize) / 2, (canvas.height - spinnerSize) / 2, spinnerSize, spinnerSize, spinnerSize / 2, spinnerSize / 2, this.angle, tempColor);
|
|
11757
11786
|
renderer.end();
|
|
11758
11787
|
}
|
|
11759
11788
|
};
|
|
@@ -11764,9 +11793,9 @@ var spine = (() => {
|
|
|
11764
11793
|
var SpineCanvas = class {
|
|
11765
11794
|
constructor(canvas, config) {
|
|
11766
11795
|
this.time = new TimeKeeper();
|
|
11767
|
-
if (config.pathPrefix
|
|
11796
|
+
if (!config.pathPrefix)
|
|
11768
11797
|
config.pathPrefix = "";
|
|
11769
|
-
if (config.app
|
|
11798
|
+
if (!config.app)
|
|
11770
11799
|
config.app = {
|
|
11771
11800
|
loadAssets: () => {
|
|
11772
11801
|
},
|
|
@@ -11779,7 +11808,7 @@ var spine = (() => {
|
|
|
11779
11808
|
error: () => {
|
|
11780
11809
|
}
|
|
11781
11810
|
};
|
|
11782
|
-
if (config.webglConfig
|
|
11811
|
+
if (config.webglConfig)
|
|
11783
11812
|
config.webglConfig = { alpha: true };
|
|
11784
11813
|
this.htmlCanvas = canvas;
|
|
11785
11814
|
this.context = new ManagedWebGLRenderingContext(canvas, config.webglConfig);
|
|
@@ -11787,19 +11816,24 @@ var spine = (() => {
|
|
|
11787
11816
|
this.gl = this.context.gl;
|
|
11788
11817
|
this.assetManager = new AssetManager(this.context, config.pathPrefix);
|
|
11789
11818
|
this.input = new Input(canvas);
|
|
11790
|
-
config.app.loadAssets
|
|
11819
|
+
if (config.app.loadAssets)
|
|
11820
|
+
config.app.loadAssets(this);
|
|
11791
11821
|
let loop = () => {
|
|
11792
11822
|
requestAnimationFrame(loop);
|
|
11793
11823
|
this.time.update();
|
|
11794
|
-
config.app.update
|
|
11795
|
-
|
|
11824
|
+
if (config.app.update)
|
|
11825
|
+
config.app.update(this, this.time.delta);
|
|
11826
|
+
if (config.app.render)
|
|
11827
|
+
config.app.render(this);
|
|
11796
11828
|
};
|
|
11797
11829
|
let waitForAssets = () => {
|
|
11798
11830
|
if (this.assetManager.isLoadingComplete()) {
|
|
11799
11831
|
if (this.assetManager.hasErrors()) {
|
|
11800
|
-
config.app.error
|
|
11832
|
+
if (config.app.error)
|
|
11833
|
+
config.app.error(this, this.assetManager.getErrors());
|
|
11801
11834
|
} else {
|
|
11802
|
-
config.app.initialize
|
|
11835
|
+
if (config.app.initialize)
|
|
11836
|
+
config.app.initialize(this);
|
|
11803
11837
|
loop();
|
|
11804
11838
|
}
|
|
11805
11839
|
return;
|