@galacean/engine-spine 4.2.0-engine-1.3 → 4.2.1-alpha.0
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/README.md +64 -42
- package/dist/browser.js +1 -1
- package/dist/main.js +635 -1056
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +635 -1056
- package/dist/module.js +634 -1056
- package/dist/module.js.map +1 -1
- package/package.json +49 -37
- package/types/index.d.ts +2 -5
- package/types/loader/LoaderUtils.d.ts +11 -17
- package/types/loader/SpineAtlasLoader.d.ts +7 -0
- package/types/loader/SpineLoader.d.ts +11 -25
- package/types/loader/SpineResource.d.ts +33 -0
- package/types/loader/SpineTexture.d.ts +13 -0
- package/types/loader/index.d.ts +4 -0
- package/types/{SpineAnimationRenderer.d.ts → renderer/SpineAnimationRenderer.d.ts} +45 -81
- package/types/{SpineGenerator.d.ts → renderer/SpineGenerator.d.ts} +12 -15
- package/types/renderer/index.d.ts +2 -0
- package/types/util/BlendMode.d.ts +1 -1
- package/types/loader/EditorSpineAtlasLoader.d.ts +0 -6
- package/types/loader/SkeletonDataResource.d.ts +0 -12
- package/types/tsconfig.tsbuildinfo +0 -1
- package/types/util/BufferReader.d.ts +0 -10
- /package/types/{SpineMaterial.d.ts → renderer/SpineMaterial.d.ts} +0 -0
package/dist/miniprogram.js
CHANGED
|
@@ -5,33 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var miniprogram = require('@galacean/engine/dist/miniprogram');
|
|
6
6
|
var engineMiniprogramAdapter = require('@galacean/engine-miniprogram-adapter');
|
|
7
7
|
|
|
8
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
9
|
-
try {
|
|
10
|
-
var info = gen[key](arg);
|
|
11
|
-
var value = info.value;
|
|
12
|
-
} catch (error) {
|
|
13
|
-
reject(error);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
if (info.done) resolve(value);
|
|
17
|
-
else Promise.resolve(value).then(_next, _throw);
|
|
18
|
-
}
|
|
19
|
-
function _async_to_generator(fn) {
|
|
20
|
-
return function() {
|
|
21
|
-
var self = this, args = arguments;
|
|
22
|
-
return new Promise(function(resolve, reject) {
|
|
23
|
-
var gen = fn.apply(self, args);
|
|
24
|
-
function _next(value) {
|
|
25
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
26
|
-
}
|
|
27
|
-
function _throw(err) {
|
|
28
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
29
|
-
}
|
|
30
|
-
_next(undefined);
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
8
|
function _set_prototype_of(o, p) {
|
|
36
9
|
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
37
10
|
o.__proto__ = p;
|
|
@@ -71,97 +44,6 @@ function __decorate(decorators, target, key, desc) {
|
|
|
71
44
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
72
45
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
73
46
|
}
|
|
74
|
-
function __generator(thisArg, body) {
|
|
75
|
-
var _ = {
|
|
76
|
-
label: 0,
|
|
77
|
-
sent: function sent() {
|
|
78
|
-
if (t[0] & 1) throw t[1];
|
|
79
|
-
return t[1];
|
|
80
|
-
},
|
|
81
|
-
trys: [],
|
|
82
|
-
ops: []
|
|
83
|
-
}, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
84
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
85
|
-
return this;
|
|
86
|
-
}), g;
|
|
87
|
-
function verb(n) {
|
|
88
|
-
return function(v) {
|
|
89
|
-
return step([
|
|
90
|
-
n,
|
|
91
|
-
v
|
|
92
|
-
]);
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
function step(op) {
|
|
96
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
97
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
98
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
99
|
-
if (y = 0, t) op = [
|
|
100
|
-
op[0] & 2,
|
|
101
|
-
t.value
|
|
102
|
-
];
|
|
103
|
-
switch(op[0]){
|
|
104
|
-
case 0:
|
|
105
|
-
case 1:
|
|
106
|
-
t = op;
|
|
107
|
-
break;
|
|
108
|
-
case 4:
|
|
109
|
-
_.label++;
|
|
110
|
-
return {
|
|
111
|
-
value: op[1],
|
|
112
|
-
done: false
|
|
113
|
-
};
|
|
114
|
-
case 5:
|
|
115
|
-
_.label++;
|
|
116
|
-
y = op[1];
|
|
117
|
-
op = [
|
|
118
|
-
0
|
|
119
|
-
];
|
|
120
|
-
continue;
|
|
121
|
-
case 7:
|
|
122
|
-
op = _.ops.pop();
|
|
123
|
-
_.trys.pop();
|
|
124
|
-
continue;
|
|
125
|
-
default:
|
|
126
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
127
|
-
_ = 0;
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
131
|
-
_.label = op[1];
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
135
|
-
_.label = t[1];
|
|
136
|
-
t = op;
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
if (t && _.label < t[2]) {
|
|
140
|
-
_.label = t[2];
|
|
141
|
-
_.ops.push(op);
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
if (t[2]) _.ops.pop();
|
|
145
|
-
_.trys.pop();
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
op = body.call(thisArg, _);
|
|
149
|
-
} catch (e) {
|
|
150
|
-
op = [
|
|
151
|
-
6,
|
|
152
|
-
e
|
|
153
|
-
];
|
|
154
|
-
y = 0;
|
|
155
|
-
} finally{
|
|
156
|
-
f = t = 0;
|
|
157
|
-
}
|
|
158
|
-
if (op[0] & 5) throw op[1];
|
|
159
|
-
return {
|
|
160
|
-
value: op[0] ? op[1] : void 0,
|
|
161
|
-
done: true
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
47
|
typeof SuppressedError === "function" ? SuppressedError : function _SuppressedError(error, suppressed, message) {
|
|
166
48
|
var e = new Error(message);
|
|
167
49
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -10591,198 +10473,33 @@ function getValue(map, property, defaultValue) {
|
|
|
10591
10473
|
}
|
|
10592
10474
|
})();
|
|
10593
10475
|
|
|
10594
|
-
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
return new SkeletonBinary(atlasLoader).readSkeletonData(new Uint8Array(skeletonTextData));
|
|
10600
|
-
}
|
|
10601
|
-
}
|
|
10602
|
-
function loadTexturesByPath(imagePaths, imageExtensions, engine) {
|
|
10603
|
-
return _loadTexturesByPath.apply(this, arguments);
|
|
10604
|
-
}
|
|
10605
|
-
function _loadTexturesByPath() {
|
|
10606
|
-
_loadTexturesByPath = _async_to_generator(function(imagePaths, imageExtensions, engine) {
|
|
10607
|
-
var textures, texturePromises, error;
|
|
10608
|
-
return __generator(this, function(_state) {
|
|
10609
|
-
switch(_state.label){
|
|
10610
|
-
case 0:
|
|
10611
|
-
texturePromises = imagePaths.map(function(imagePath, index) {
|
|
10612
|
-
var ext = imageExtensions[index];
|
|
10613
|
-
var imageLoaderType = miniprogram.AssetType.Texture2D;
|
|
10614
|
-
if (ext === 'ktx') {
|
|
10615
|
-
imageLoaderType = miniprogram.AssetType.KTX;
|
|
10616
|
-
} else if (ext === 'ktx2') {
|
|
10617
|
-
imageLoaderType = miniprogram.AssetType.KTX2;
|
|
10618
|
-
}
|
|
10619
|
-
return loadTexture(imagePath, engine, imageLoaderType);
|
|
10620
|
-
});
|
|
10621
|
-
_state.label = 1;
|
|
10622
|
-
case 1:
|
|
10623
|
-
_state.trys.push([
|
|
10624
|
-
1,
|
|
10625
|
-
3,
|
|
10626
|
-
,
|
|
10627
|
-
4
|
|
10628
|
-
]);
|
|
10629
|
-
return [
|
|
10630
|
-
4,
|
|
10631
|
-
Promise.all(texturePromises)
|
|
10632
|
-
];
|
|
10633
|
-
case 2:
|
|
10634
|
-
textures = _state.sent();
|
|
10635
|
-
return [
|
|
10636
|
-
3,
|
|
10637
|
-
4
|
|
10638
|
-
];
|
|
10639
|
-
case 3:
|
|
10640
|
-
error = _state.sent();
|
|
10641
|
-
throw error;
|
|
10642
|
-
case 4:
|
|
10643
|
-
return [
|
|
10644
|
-
2,
|
|
10645
|
-
textures
|
|
10646
|
-
];
|
|
10647
|
-
}
|
|
10648
|
-
});
|
|
10649
|
-
});
|
|
10650
|
-
return _loadTexturesByPath.apply(this, arguments);
|
|
10651
|
-
}
|
|
10652
|
-
function loadTextureAtlas(atlasPath, engine) {
|
|
10653
|
-
return _loadTextureAtlas.apply(this, arguments);
|
|
10654
|
-
}
|
|
10655
|
-
function _loadTextureAtlas() {
|
|
10656
|
-
_loadTextureAtlas = _async_to_generator(function(atlasPath, engine) {
|
|
10657
|
-
var baseUrl, atlasText, textures, err, textureAtlas, loadTexturePromises, _iterator, _step, page, textureUrl, err1;
|
|
10658
|
-
return __generator(this, function(_state) {
|
|
10659
|
-
switch(_state.label){
|
|
10660
|
-
case 0:
|
|
10661
|
-
baseUrl = getBaseUrl(atlasPath);
|
|
10662
|
-
_state.label = 1;
|
|
10663
|
-
case 1:
|
|
10664
|
-
_state.trys.push([
|
|
10665
|
-
1,
|
|
10666
|
-
3,
|
|
10667
|
-
,
|
|
10668
|
-
4
|
|
10669
|
-
]);
|
|
10670
|
-
return [
|
|
10671
|
-
4,
|
|
10672
|
-
miniprogram.request(atlasPath, {
|
|
10673
|
-
type: "text"
|
|
10674
|
-
})
|
|
10675
|
-
];
|
|
10676
|
-
case 2:
|
|
10677
|
-
atlasText = _state.sent();
|
|
10678
|
-
return [
|
|
10679
|
-
3,
|
|
10680
|
-
4
|
|
10681
|
-
];
|
|
10682
|
-
case 3:
|
|
10683
|
-
err = _state.sent();
|
|
10684
|
-
throw new Error("Spine Atlas: " + atlasPath + " load error: " + err);
|
|
10685
|
-
case 4:
|
|
10686
|
-
textureAtlas = new TextureAtlas(atlasText);
|
|
10687
|
-
loadTexturePromises = [];
|
|
10688
|
-
for(_iterator = _create_for_of_iterator_helper_loose(textureAtlas.pages); !(_step = _iterator()).done;){
|
|
10689
|
-
page = _step.value;
|
|
10690
|
-
textureUrl = baseUrl + page.name;
|
|
10691
|
-
loadTexturePromises.push(loadTexture(textureUrl, engine));
|
|
10692
|
-
}
|
|
10693
|
-
_state.label = 5;
|
|
10694
|
-
case 5:
|
|
10695
|
-
_state.trys.push([
|
|
10696
|
-
5,
|
|
10697
|
-
7,
|
|
10698
|
-
,
|
|
10699
|
-
8
|
|
10700
|
-
]);
|
|
10701
|
-
return [
|
|
10702
|
-
4,
|
|
10703
|
-
Promise.all(loadTexturePromises)
|
|
10704
|
-
];
|
|
10705
|
-
case 6:
|
|
10706
|
-
textures = _state.sent();
|
|
10707
|
-
return [
|
|
10708
|
-
3,
|
|
10709
|
-
8
|
|
10710
|
-
];
|
|
10711
|
-
case 7:
|
|
10712
|
-
err1 = _state.sent();
|
|
10713
|
-
throw new Error("Spine Texture: load error: " + err1);
|
|
10714
|
-
case 8:
|
|
10715
|
-
textureAtlas = createTextureAtlas(atlasText, textures);
|
|
10716
|
-
return [
|
|
10717
|
-
2,
|
|
10718
|
-
textureAtlas
|
|
10719
|
-
];
|
|
10720
|
-
}
|
|
10721
|
-
});
|
|
10722
|
-
});
|
|
10723
|
-
return _loadTextureAtlas.apply(this, arguments);
|
|
10724
|
-
}
|
|
10725
|
-
function createTextureAtlas(atlasText, textures) {
|
|
10726
|
-
var textureAtlas = new TextureAtlas(atlasText);
|
|
10727
|
-
textureAtlas.pages.forEach(function(page, index) {
|
|
10728
|
-
var engineTexture = textures.find(function(item) {
|
|
10729
|
-
return item.name === page.name;
|
|
10730
|
-
}) || textures[index];
|
|
10731
|
-
var texture = createAdaptiveTexture(engineTexture);
|
|
10732
|
-
page.setTexture(texture);
|
|
10733
|
-
});
|
|
10734
|
-
return textureAtlas;
|
|
10735
|
-
}
|
|
10736
|
-
function loadTexture(url, engine, imageLoaderType) {
|
|
10737
|
-
if (imageLoaderType === void 0) imageLoaderType = miniprogram.AssetType.Texture2D;
|
|
10738
|
-
return engine.resourceManager.load({
|
|
10739
|
-
url: url,
|
|
10740
|
-
type: imageLoaderType
|
|
10741
|
-
});
|
|
10742
|
-
}
|
|
10743
|
-
function createAdaptiveTexture(texture) {
|
|
10744
|
-
return new AdaptiveTexture(new engineMiniprogramAdapter.Image(), texture);
|
|
10745
|
-
}
|
|
10746
|
-
function getBaseUrl(url) {
|
|
10747
|
-
var isLocalPath = !/^(http|https|ftp):\/\/.*/i.test(url);
|
|
10748
|
-
if (isLocalPath) {
|
|
10749
|
-
var lastSlashIndex = url.lastIndexOf('/');
|
|
10750
|
-
if (lastSlashIndex === -1) {
|
|
10751
|
-
return '';
|
|
10752
|
-
}
|
|
10753
|
-
return url.substring(0, lastSlashIndex + 1);
|
|
10754
|
-
} else {
|
|
10755
|
-
var parsedUrl = new engineMiniprogramAdapter.URL(url);
|
|
10756
|
-
var basePath = parsedUrl.origin + parsedUrl.pathname;
|
|
10757
|
-
return basePath.endsWith('/') ? basePath : basePath.substring(0, basePath.lastIndexOf('/') + 1);
|
|
10758
|
-
}
|
|
10759
|
-
}
|
|
10760
|
-
var AdaptiveTexture = /*#__PURE__*/ function(Texture) {
|
|
10761
|
-
_inherits(AdaptiveTexture, Texture);
|
|
10762
|
-
function AdaptiveTexture(image, texture) {
|
|
10476
|
+
/**
|
|
10477
|
+
* @internal
|
|
10478
|
+
*/ var SpineTexture = /*#__PURE__*/ function(Texture) {
|
|
10479
|
+
_inherits(SpineTexture, Texture);
|
|
10480
|
+
function SpineTexture(image) {
|
|
10763
10481
|
var _this;
|
|
10764
10482
|
_this = Texture.call(this, image) || this;
|
|
10765
|
-
|
|
10766
|
-
_this.texture.generateMipmaps();
|
|
10483
|
+
image.generateMipmaps();
|
|
10767
10484
|
return _this;
|
|
10768
10485
|
}
|
|
10769
|
-
var _proto =
|
|
10486
|
+
var _proto = SpineTexture.prototype;
|
|
10770
10487
|
// rewrite getImage function, return galacean texture2D, then attachment can get size of texture
|
|
10771
10488
|
_proto.getImage = function getImage() {
|
|
10772
|
-
return this.
|
|
10489
|
+
return this._image;
|
|
10773
10490
|
};
|
|
10774
10491
|
_proto.setFilters = function setFilters(minFilter, magFilter) {
|
|
10775
10492
|
if (minFilter === exports.TextureFilter.Nearest) {
|
|
10776
|
-
this.
|
|
10493
|
+
this._image.filterMode = miniprogram.TextureFilterMode.Point;
|
|
10777
10494
|
} else if (magFilter === exports.TextureFilter.MipMapLinearLinear) {
|
|
10778
|
-
this.
|
|
10495
|
+
this._image.filterMode = miniprogram.TextureFilterMode.Trilinear;
|
|
10779
10496
|
} else {
|
|
10780
|
-
this.
|
|
10497
|
+
this._image.filterMode = miniprogram.TextureFilterMode.Bilinear;
|
|
10781
10498
|
}
|
|
10782
10499
|
};
|
|
10783
10500
|
_proto.setWraps = function setWraps(uWrap, vWrap) {
|
|
10784
|
-
this.
|
|
10785
|
-
this.
|
|
10501
|
+
this._image.wrapModeU = this._convertWrapMode(uWrap);
|
|
10502
|
+
this._image.wrapModeV = this._convertWrapMode(vWrap);
|
|
10786
10503
|
};
|
|
10787
10504
|
_proto.dispose = function dispose() {};
|
|
10788
10505
|
_proto._convertWrapMode = function _convertWrapMode(wrap) {
|
|
@@ -10797,63 +10514,110 @@ var AdaptiveTexture = /*#__PURE__*/ function(Texture) {
|
|
|
10797
10514
|
throw new Error("Unsupported texture wrap mode.");
|
|
10798
10515
|
}
|
|
10799
10516
|
};
|
|
10800
|
-
return
|
|
10517
|
+
return SpineTexture;
|
|
10801
10518
|
}(Texture);
|
|
10802
10519
|
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
var
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
return new
|
|
10817
|
-
}
|
|
10818
|
-
|
|
10520
|
+
/**
|
|
10521
|
+
* @internal
|
|
10522
|
+
*/ var LoaderUtils = /*#__PURE__*/ function() {
|
|
10523
|
+
function LoaderUtils() {}
|
|
10524
|
+
LoaderUtils.createSkeletonData = function createSkeletonData(skeletonRawData, textureAtlas, skeletonDataScale) {
|
|
10525
|
+
var atlasLoader = new AtlasAttachmentLoader(textureAtlas);
|
|
10526
|
+
if (typeof skeletonRawData === "string") {
|
|
10527
|
+
var skeletonJson = new SkeletonJson(atlasLoader);
|
|
10528
|
+
skeletonJson.scale = skeletonDataScale;
|
|
10529
|
+
return skeletonJson.readSkeletonData(skeletonRawData);
|
|
10530
|
+
} else {
|
|
10531
|
+
var skeletonBinary = new SkeletonBinary(atlasLoader);
|
|
10532
|
+
skeletonBinary.scale = skeletonDataScale;
|
|
10533
|
+
return skeletonBinary.readSkeletonData(new Uint8Array(skeletonRawData));
|
|
10534
|
+
}
|
|
10535
|
+
};
|
|
10536
|
+
LoaderUtils.createTextureAtlas = function createTextureAtlas(atlasText, textures) {
|
|
10537
|
+
var textureAtlas = new TextureAtlas(atlasText);
|
|
10538
|
+
textureAtlas.pages.forEach(function(page, index) {
|
|
10539
|
+
var engineTexture = textures.find(function(item) {
|
|
10540
|
+
return item.name === page.name;
|
|
10541
|
+
}) || textures[index];
|
|
10542
|
+
var texture = new SpineTexture(engineTexture);
|
|
10543
|
+
page.setTexture(texture);
|
|
10544
|
+
});
|
|
10545
|
+
return textureAtlas;
|
|
10819
10546
|
};
|
|
10820
|
-
|
|
10821
|
-
|
|
10547
|
+
LoaderUtils.loadTexturesByPaths = function loadTexturesByPaths(imagePaths, imageExtensions, engine, reject) {
|
|
10548
|
+
var resourceManager = engine.resourceManager;
|
|
10549
|
+
// @ts-ignore
|
|
10550
|
+
var virtualPathResourceMap = resourceManager._virtualPathResourceMap;
|
|
10551
|
+
var texturePromises = imagePaths.map(function(imagePath, index) {
|
|
10552
|
+
var ext = imageExtensions[index];
|
|
10553
|
+
var imageLoaderType = miniprogram.AssetType.Texture2D;
|
|
10554
|
+
var virtualElement = virtualPathResourceMap[imagePath];
|
|
10555
|
+
if (virtualElement) {
|
|
10556
|
+
imageLoaderType = virtualElement.type;
|
|
10557
|
+
} else if (ext === "ktx") {
|
|
10558
|
+
imageLoaderType = miniprogram.AssetType.KTX;
|
|
10559
|
+
} else if (ext === "ktx2") {
|
|
10560
|
+
imageLoaderType = miniprogram.AssetType.KTX2;
|
|
10561
|
+
}
|
|
10562
|
+
return resourceManager.load({
|
|
10563
|
+
url: imagePath,
|
|
10564
|
+
type: imageLoaderType
|
|
10565
|
+
});
|
|
10566
|
+
});
|
|
10567
|
+
return Promise.all(texturePromises).catch(function(error) {
|
|
10568
|
+
reject(error);
|
|
10569
|
+
return [];
|
|
10570
|
+
});
|
|
10822
10571
|
};
|
|
10823
|
-
|
|
10824
|
-
|
|
10825
|
-
|
|
10826
|
-
var
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10572
|
+
LoaderUtils.loadTextureAtlas = function loadTextureAtlas(atlasPath, engine, reject) {
|
|
10573
|
+
var baseUrl = LoaderUtils.getBaseUrl(atlasPath);
|
|
10574
|
+
var resourceManager = engine.resourceManager;
|
|
10575
|
+
var atlasText;
|
|
10576
|
+
return resourceManager// @ts-ignore
|
|
10577
|
+
._request(atlasPath, {
|
|
10578
|
+
type: "text"
|
|
10579
|
+
}).then(function(text) {
|
|
10580
|
+
atlasText = text;
|
|
10581
|
+
var textureAtlas = new TextureAtlas(atlasText);
|
|
10582
|
+
var loadTexturePromises = textureAtlas.pages.map(function(page) {
|
|
10583
|
+
var textureUrl = baseUrl + page.name;
|
|
10584
|
+
return resourceManager.load({
|
|
10585
|
+
url: textureUrl,
|
|
10586
|
+
type: miniprogram.AssetType.Texture2D
|
|
10587
|
+
});
|
|
10588
|
+
});
|
|
10589
|
+
return Promise.all(loadTexturePromises).then(function(textures) {
|
|
10590
|
+
return LoaderUtils.createTextureAtlas(atlasText, textures);
|
|
10591
|
+
});
|
|
10592
|
+
}).catch(function(err) {
|
|
10593
|
+
reject(new Error("Spine Atlas: " + atlasPath + " load error: " + err));
|
|
10594
|
+
return null;
|
|
10595
|
+
});
|
|
10596
|
+
};
|
|
10597
|
+
LoaderUtils.getBaseUrl = function getBaseUrl(url) {
|
|
10598
|
+
var isLocalPath = !/^(http|https|ftp):\/\/.*/i.test(url);
|
|
10599
|
+
if (isLocalPath) {
|
|
10600
|
+
var lastSlashIndex = url.lastIndexOf("/");
|
|
10601
|
+
if (lastSlashIndex === -1) {
|
|
10602
|
+
return "";
|
|
10603
|
+
}
|
|
10604
|
+
return url.substring(0, lastSlashIndex + 1);
|
|
10840
10605
|
} else {
|
|
10841
|
-
|
|
10606
|
+
var parsedUrl = new engineMiniprogramAdapter.URL(url);
|
|
10607
|
+
var basePath = parsedUrl.origin + parsedUrl.pathname;
|
|
10608
|
+
return basePath.endsWith("/") ? basePath : basePath.substring(0, basePath.lastIndexOf("/") + 1);
|
|
10842
10609
|
}
|
|
10843
10610
|
};
|
|
10844
|
-
|
|
10845
|
-
this._usedElementCount = 0;
|
|
10846
|
-
};
|
|
10847
|
-
return ClearablePool;
|
|
10611
|
+
return LoaderUtils;
|
|
10848
10612
|
}();
|
|
10849
10613
|
|
|
10850
10614
|
var SourceAlpha = miniprogram.BlendFactor.SourceAlpha, One = miniprogram.BlendFactor.One, DestinationColor = miniprogram.BlendFactor.DestinationColor, Zero = miniprogram.BlendFactor.Zero, OneMinusSourceColor = miniprogram.BlendFactor.OneMinusSourceColor, OneMinusSourceAlpha = miniprogram.BlendFactor.OneMinusSourceAlpha;
|
|
10851
10615
|
var Add = miniprogram.BlendOperation.Add;
|
|
10852
|
-
function setBlendMode(material, blendMode) {
|
|
10616
|
+
function setBlendMode(material, blendMode, premultipliedAlpha) {
|
|
10853
10617
|
var target = material.renderState.blendState.targetBlendState;
|
|
10854
10618
|
switch(blendMode){
|
|
10855
10619
|
case exports.BlendMode.Additive:
|
|
10856
|
-
target.sourceColorBlendFactor = SourceAlpha;
|
|
10620
|
+
target.sourceColorBlendFactor = premultipliedAlpha ? One : SourceAlpha;
|
|
10857
10621
|
target.destinationColorBlendFactor = One;
|
|
10858
10622
|
target.sourceAlphaBlendFactor = One;
|
|
10859
10623
|
target.destinationAlphaBlendFactor = One;
|
|
@@ -10874,7 +10638,7 @@ function setBlendMode(material, blendMode) {
|
|
|
10874
10638
|
target.colorBlendOperation = target.alphaBlendOperation = Add;
|
|
10875
10639
|
break;
|
|
10876
10640
|
default:
|
|
10877
|
-
target.sourceColorBlendFactor = SourceAlpha;
|
|
10641
|
+
target.sourceColorBlendFactor = premultipliedAlpha ? One : SourceAlpha;
|
|
10878
10642
|
target.destinationColorBlendFactor = OneMinusSourceAlpha;
|
|
10879
10643
|
target.sourceAlphaBlendFactor = One;
|
|
10880
10644
|
target.destinationAlphaBlendFactor = OneMinusSourceAlpha;
|
|
@@ -10896,71 +10660,101 @@ function getBlendMode(material) {
|
|
|
10896
10660
|
return exports.BlendMode.Normal;
|
|
10897
10661
|
}
|
|
10898
10662
|
|
|
10663
|
+
var ClearablePool = /*#__PURE__*/ function() {
|
|
10664
|
+
function ClearablePool(type) {
|
|
10665
|
+
this._usedElementCount = 0;
|
|
10666
|
+
this._type = type;
|
|
10667
|
+
this._elements = [];
|
|
10668
|
+
}
|
|
10669
|
+
var _proto = ClearablePool.prototype;
|
|
10670
|
+
_proto.get = function get() {
|
|
10671
|
+
var _this = this, usedElementCount = _this._usedElementCount, elements = _this._elements;
|
|
10672
|
+
this._usedElementCount++;
|
|
10673
|
+
if (elements.length === usedElementCount) {
|
|
10674
|
+
var element = new this._type();
|
|
10675
|
+
elements.push(element);
|
|
10676
|
+
return element;
|
|
10677
|
+
} else {
|
|
10678
|
+
return elements[usedElementCount];
|
|
10679
|
+
}
|
|
10680
|
+
};
|
|
10681
|
+
_proto.clear = function clear() {
|
|
10682
|
+
this._usedElementCount = 0;
|
|
10683
|
+
};
|
|
10684
|
+
return ClearablePool;
|
|
10685
|
+
}();
|
|
10686
|
+
|
|
10687
|
+
var ReturnablePool = /*#__PURE__*/ function() {
|
|
10688
|
+
function ReturnablePool(type, initializeCount) {
|
|
10689
|
+
if (initializeCount === void 0) initializeCount = 1;
|
|
10690
|
+
this._type = type;
|
|
10691
|
+
this._lastElementIndex = initializeCount - 1;
|
|
10692
|
+
var elements = this._elements = new Array(initializeCount);
|
|
10693
|
+
for(var i = 0; i < initializeCount; ++i){
|
|
10694
|
+
elements[i] = new type();
|
|
10695
|
+
}
|
|
10696
|
+
}
|
|
10697
|
+
var _proto = ReturnablePool.prototype;
|
|
10698
|
+
_proto.get = function get() {
|
|
10699
|
+
if (this._lastElementIndex < 0) {
|
|
10700
|
+
return new this._type();
|
|
10701
|
+
}
|
|
10702
|
+
return this._elements[this._lastElementIndex--];
|
|
10703
|
+
};
|
|
10704
|
+
_proto.return = function _return(element) {
|
|
10705
|
+
this._elements[++this._lastElementIndex] = element;
|
|
10706
|
+
};
|
|
10707
|
+
return ReturnablePool;
|
|
10708
|
+
}();
|
|
10709
|
+
|
|
10899
10710
|
var SubRenderItem = function SubRenderItem() {
|
|
10900
10711
|
};
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
var SpineGenerator = /*#__PURE__*/ function() {
|
|
10712
|
+
/**
|
|
10713
|
+
* @internal
|
|
10714
|
+
*/ var SpineGenerator = /*#__PURE__*/ function() {
|
|
10904
10715
|
function SpineGenerator() {
|
|
10905
|
-
this._clipper = new SkeletonClipping();
|
|
10906
|
-
this._subRenderItems = [];
|
|
10907
10716
|
this._separateSlots = new Map();
|
|
10717
|
+
this._subRenderItems = [];
|
|
10718
|
+
this._clipper = new SkeletonClipping();
|
|
10908
10719
|
this._separateSlotTextureMap = new Map();
|
|
10909
10720
|
}
|
|
10910
10721
|
var _proto = SpineGenerator.prototype;
|
|
10911
|
-
_proto.getMaxVertexCount = function getMaxVertexCount(skeletonData) {
|
|
10912
|
-
var uniqueAttachments = new Set();
|
|
10913
|
-
var skins = skeletonData.skins;
|
|
10914
|
-
var skinLen = skins.length;
|
|
10915
|
-
for(var i = 0; i < skinLen; i++){
|
|
10916
|
-
var skin = skins[i];
|
|
10917
|
-
this._collectUniqueAttachments(skin, uniqueAttachments);
|
|
10918
|
-
}
|
|
10919
|
-
return this._calculateTotalVertexCount(uniqueAttachments);
|
|
10920
|
-
};
|
|
10921
10722
|
_proto.buildPrimitive = function buildPrimitive(skeleton, renderer) {
|
|
10922
|
-
var
|
|
10723
|
+
var _indices = renderer._indices, _vertices = renderer._vertices, _localBounds = renderer._localBounds, _vertexCount = renderer._vertexCount, _subPrimitives = renderer._subPrimitives, engine = renderer.engine, zSpacing = renderer.zSpacing, premultipliedAlpha = renderer.premultipliedAlpha;
|
|
10724
|
+
_localBounds.min.set(Infinity, Infinity, Infinity);
|
|
10725
|
+
_localBounds.max.set(-Infinity, -Infinity, -Infinity);
|
|
10923
10726
|
var _this = this, _clipper = _this._clipper, _separateSlots = _this._separateSlots, _subRenderItems = _this._subRenderItems, _separateSlotTextureMap = _this._separateSlotTextureMap;
|
|
10924
|
-
var
|
|
10925
|
-
bounds.min.set(maxBoundsValue, maxBoundsValue, maxBoundsValue);
|
|
10926
|
-
bounds.max.set(minBoundsValue, minBoundsValue, minBoundsValue);
|
|
10927
|
-
var verticesLength = 0;
|
|
10928
|
-
var indicesLength = 0;
|
|
10929
|
-
var drawOrder = skeleton.drawOrder;
|
|
10930
|
-
var maxSlotCount = drawOrder.length;
|
|
10931
|
-
var engine = renderer.engine, _indices = renderer._indices, _vertices = renderer._vertices, _subPrimitives = renderer._subPrimitives;
|
|
10932
|
-
var tempVerts = SpineGenerator.tempVerts, tempTexture = SpineGenerator.tempTexture, tempBlendMode = SpineGenerator.tempBlendMode, subRenderItemPool = SpineGenerator.subRenderItemPool, subPrimitivePool = SpineGenerator.subPrimitivePool;
|
|
10727
|
+
var tempVerts = SpineGenerator.tempVerts, subRenderItemPool = SpineGenerator.subRenderItemPool, subPrimitivePool = SpineGenerator.subPrimitivePool, VERTEX_SIZE = SpineGenerator.VERTEX_SIZE;
|
|
10933
10728
|
_subRenderItems.length = 0;
|
|
10934
10729
|
subRenderItemPool.clear();
|
|
10935
|
-
var vertices = renderer._vertices;
|
|
10936
10730
|
var triangles;
|
|
10937
10731
|
var uvs;
|
|
10938
|
-
|
|
10732
|
+
var verticesLength = 0;
|
|
10733
|
+
var indicesLength = 0;
|
|
10939
10734
|
var start = 0;
|
|
10940
10735
|
var count = 0;
|
|
10941
10736
|
var blend = exports.BlendMode.Normal;
|
|
10942
10737
|
var texture = null;
|
|
10738
|
+
var tempBlendMode = null;
|
|
10739
|
+
var tempTexture = null;
|
|
10943
10740
|
var primitiveIndex = 0;
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
for(var slotIndex = 0; slotIndex < maxSlotCount; ++slotIndex){
|
|
10741
|
+
var drawOrder = skeleton.drawOrder;
|
|
10742
|
+
for(var slotIndex = 0, n = drawOrder.length; slotIndex < n; ++slotIndex){
|
|
10947
10743
|
var slot = drawOrder[slotIndex];
|
|
10948
10744
|
if (!slot.bone.active) {
|
|
10949
10745
|
_clipper.clipEndWithSlot(slot);
|
|
10950
10746
|
continue;
|
|
10951
10747
|
}
|
|
10952
10748
|
var attachment = slot.getAttachment();
|
|
10953
|
-
var attachmentColor = null;
|
|
10954
|
-
var z = zSpacing * slotIndex;
|
|
10955
|
-
var numFloats = 0;
|
|
10956
|
-
var isClipping = _clipper.isClipping();
|
|
10957
|
-
var vertexSize = isClipping ? 2 : SpineGenerator.VERTEX_SIZE;
|
|
10958
10749
|
if (!attachment) {
|
|
10959
|
-
|
|
10960
|
-
_clipper.clipEndWithSlot(slot);
|
|
10961
|
-
}
|
|
10750
|
+
_clipper.clipEndWithSlot(slot);
|
|
10962
10751
|
continue;
|
|
10963
10752
|
}
|
|
10753
|
+
var z = zSpacing * slotIndex;
|
|
10754
|
+
var isClipping = _clipper.isClipping();
|
|
10755
|
+
var numFloats = 0;
|
|
10756
|
+
var attachmentColor = null;
|
|
10757
|
+
var vertexSize = isClipping ? 2 : VERTEX_SIZE;
|
|
10964
10758
|
switch(attachment.constructor){
|
|
10965
10759
|
case RegionAttachment:
|
|
10966
10760
|
var regionAttachment = attachment;
|
|
@@ -10975,7 +10769,7 @@ var SpineGenerator = /*#__PURE__*/ function() {
|
|
|
10975
10769
|
var meshAttachment = attachment;
|
|
10976
10770
|
attachmentColor = meshAttachment.color;
|
|
10977
10771
|
numFloats = (meshAttachment.worldVerticesLength >> 1) * vertexSize;
|
|
10978
|
-
if (numFloats >
|
|
10772
|
+
if (numFloats > _vertices.length) {
|
|
10979
10773
|
SpineGenerator.tempVerts = new Array(numFloats);
|
|
10980
10774
|
}
|
|
10981
10775
|
meshAttachment.computeWorldVertices(slot, 0, meshAttachment.worldVerticesLength, tempVerts, 0, vertexSize);
|
|
@@ -10984,15 +10778,11 @@ var SpineGenerator = /*#__PURE__*/ function() {
|
|
|
10984
10778
|
texture = meshAttachment.region.texture;
|
|
10985
10779
|
break;
|
|
10986
10780
|
case ClippingAttachment:
|
|
10987
|
-
|
|
10988
|
-
|
|
10989
|
-
_clipper.clipStart(slot, clip);
|
|
10990
|
-
}
|
|
10781
|
+
var clip = attachment;
|
|
10782
|
+
_clipper.clipStart(slot, clip);
|
|
10991
10783
|
continue;
|
|
10992
10784
|
default:
|
|
10993
|
-
|
|
10994
|
-
_clipper.clipEndWithSlot(slot);
|
|
10995
|
-
}
|
|
10785
|
+
_clipper.clipEndWithSlot(slot);
|
|
10996
10786
|
continue;
|
|
10997
10787
|
}
|
|
10998
10788
|
if (texture != null) {
|
|
@@ -11003,26 +10793,32 @@ var SpineGenerator = /*#__PURE__*/ function() {
|
|
|
11003
10793
|
var _$skeleton = slot.bone.skeleton;
|
|
11004
10794
|
var skeletonColor = _$skeleton.color;
|
|
11005
10795
|
var slotColor = slot.color;
|
|
11006
|
-
var
|
|
11007
|
-
var
|
|
11008
|
-
|
|
11009
|
-
|
|
10796
|
+
var finalColor = SpineGenerator.tempColor;
|
|
10797
|
+
var finalAlpha = skeletonColor.a * slotColor.a * attachmentColor.a;
|
|
10798
|
+
finalColor.r = skeletonColor.r * slotColor.r * attachmentColor.r;
|
|
10799
|
+
finalColor.g = skeletonColor.g * slotColor.g * attachmentColor.g;
|
|
10800
|
+
finalColor.b = skeletonColor.b * slotColor.b * attachmentColor.b;
|
|
10801
|
+
finalColor.a = finalAlpha;
|
|
10802
|
+
if (premultipliedAlpha) {
|
|
10803
|
+
finalColor.r *= finalAlpha;
|
|
10804
|
+
finalColor.g *= finalAlpha;
|
|
10805
|
+
finalColor.b *= finalAlpha;
|
|
10806
|
+
}
|
|
11010
10807
|
if (isClipping) {
|
|
11011
|
-
_clipper.clipTriangles(tempVerts, triangles, triangles.length, uvs,
|
|
10808
|
+
_clipper.clipTriangles(tempVerts, triangles, triangles.length, uvs, finalColor, SpineGenerator.tempDark, false);
|
|
11012
10809
|
finalVertices = _clipper.clippedVertices;
|
|
11013
10810
|
finalVerticesLength = finalVertices.length;
|
|
11014
10811
|
finalIndices = _clipper.clippedTriangles;
|
|
11015
10812
|
finalIndicesLength = finalIndices.length;
|
|
11016
10813
|
} else {
|
|
11017
|
-
var
|
|
11018
|
-
var
|
|
11019
|
-
|
|
11020
|
-
|
|
11021
|
-
|
|
11022
|
-
|
|
11023
|
-
|
|
11024
|
-
|
|
11025
|
-
verts[v + 5] = uvs[u + 1];
|
|
10814
|
+
var r = finalColor.r, g = finalColor.g, b = finalColor.b, a = finalColor.a;
|
|
10815
|
+
for(var v = 2, u = 0, n1 = numFloats; v < n1; v += vertexSize, u += 2){
|
|
10816
|
+
tempVerts[v] = r;
|
|
10817
|
+
tempVerts[v + 1] = g;
|
|
10818
|
+
tempVerts[v + 2] = b;
|
|
10819
|
+
tempVerts[v + 3] = a;
|
|
10820
|
+
tempVerts[v + 4] = uvs[u];
|
|
10821
|
+
tempVerts[v + 5] = uvs[u + 1];
|
|
11026
10822
|
}
|
|
11027
10823
|
finalVertices = tempVerts;
|
|
11028
10824
|
finalVerticesLength = numFloats;
|
|
@@ -11034,48 +10830,37 @@ var SpineGenerator = /*#__PURE__*/ function() {
|
|
|
11034
10830
|
continue;
|
|
11035
10831
|
}
|
|
11036
10832
|
var indexStart = verticesLength / SpineGenerator.VERTEX_STRIDE;
|
|
11037
|
-
var vertices1 = _vertices;
|
|
11038
10833
|
var i = verticesLength;
|
|
11039
10834
|
var j = 0;
|
|
11040
10835
|
for(; j < finalVerticesLength;){
|
|
11041
10836
|
var x = finalVertices[j++];
|
|
11042
10837
|
var y = finalVertices[j++];
|
|
11043
|
-
|
|
11044
|
-
|
|
11045
|
-
|
|
11046
|
-
|
|
11047
|
-
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
|
|
11051
|
-
|
|
11052
|
-
this.
|
|
10838
|
+
_vertices[i++] = x;
|
|
10839
|
+
_vertices[i++] = y;
|
|
10840
|
+
_vertices[i++] = z;
|
|
10841
|
+
_vertices[i++] = finalVertices[j++];
|
|
10842
|
+
_vertices[i++] = finalVertices[j++];
|
|
10843
|
+
_vertices[i++] = finalVertices[j++];
|
|
10844
|
+
_vertices[i++] = finalVertices[j++];
|
|
10845
|
+
_vertices[i++] = finalVertices[j++];
|
|
10846
|
+
_vertices[i++] = finalVertices[j++];
|
|
10847
|
+
this._expandBounds(x, y, z, _localBounds);
|
|
11053
10848
|
}
|
|
11054
10849
|
verticesLength = i;
|
|
11055
|
-
var indicesArray = _indices;
|
|
11056
10850
|
for(i = indicesLength, j = 0; j < finalIndicesLength; i++, j++){
|
|
11057
|
-
|
|
10851
|
+
_indices[i] = finalIndices[j] + indexStart;
|
|
11058
10852
|
}
|
|
11059
10853
|
indicesLength += finalIndicesLength;
|
|
11060
10854
|
var slotData = slot.data;
|
|
11061
10855
|
var slotName = slotData.name;
|
|
11062
|
-
blend = slotData.blendMode;
|
|
11063
|
-
var blendModeChanged = tempBlendMode !== null && tempBlendMode !== slotData.blendMode;
|
|
11064
10856
|
var textureChanged = tempTexture !== null && tempTexture !== texture;
|
|
11065
10857
|
var slotNeedSeparate = _separateSlots.get(slotName);
|
|
10858
|
+
blend = slotData.blendMode;
|
|
10859
|
+
var blendModeChanged = tempBlendMode !== null && tempBlendMode !== blend;
|
|
11066
10860
|
if (slotNeedSeparate || blendModeChanged || textureChanged) {
|
|
11067
10861
|
// Finish accumulated count first
|
|
11068
10862
|
if (count > 0) {
|
|
11069
|
-
|
|
11070
|
-
origin && primitiveIndex++;
|
|
11071
|
-
var subPrimitive = origin || subPrimitivePool.get();
|
|
11072
|
-
subPrimitive.start = start;
|
|
11073
|
-
subPrimitive.count = count;
|
|
11074
|
-
var renderItem = subRenderItemPool.get();
|
|
11075
|
-
renderItem.subPrimitive = subPrimitive;
|
|
11076
|
-
renderItem.texture = tempTexture;
|
|
11077
|
-
renderItem.blendMode = tempBlendMode;
|
|
11078
|
-
_subRenderItems.push(renderItem);
|
|
10863
|
+
primitiveIndex = this._createRenderItem(_subPrimitives, primitiveIndex, start, count, tempTexture, tempBlendMode);
|
|
11079
10864
|
start += count;
|
|
11080
10865
|
count = 0;
|
|
11081
10866
|
}
|
|
@@ -11083,22 +10868,12 @@ var SpineGenerator = /*#__PURE__*/ function() {
|
|
|
11083
10868
|
// If separatedTexture exist, set texture params
|
|
11084
10869
|
var separateTexture = _separateSlotTextureMap.get(slotName);
|
|
11085
10870
|
if (separateTexture) {
|
|
11086
|
-
var oldTexture = texture.
|
|
10871
|
+
var oldTexture = texture.getImage();
|
|
11087
10872
|
separateTexture.filterMode = oldTexture.filterMode;
|
|
11088
10873
|
separateTexture.wrapModeU = oldTexture.wrapModeU;
|
|
11089
10874
|
separateTexture.wrapModeV = oldTexture.wrapModeV;
|
|
11090
10875
|
}
|
|
11091
|
-
|
|
11092
|
-
origin1 && primitiveIndex++;
|
|
11093
|
-
var subPrimitive1 = origin1 || subPrimitivePool.get();
|
|
11094
|
-
subPrimitive1.start = start;
|
|
11095
|
-
subPrimitive1.count = finalIndicesLength;
|
|
11096
|
-
var renderItem1 = subRenderItemPool.get();
|
|
11097
|
-
renderItem1.blendMode = blend;
|
|
11098
|
-
renderItem1.subPrimitive = subPrimitive1;
|
|
11099
|
-
renderItem1.texture = texture;
|
|
11100
|
-
renderItem1.slotName = slotName;
|
|
11101
|
-
_subRenderItems.push(renderItem1);
|
|
10876
|
+
primitiveIndex = this._createRenderItem(_subPrimitives, primitiveIndex, start, finalIndicesLength, texture, blend, slotName);
|
|
11102
10877
|
start += finalIndicesLength;
|
|
11103
10878
|
count = 0;
|
|
11104
10879
|
} else {
|
|
@@ -11114,44 +10889,36 @@ var SpineGenerator = /*#__PURE__*/ function() {
|
|
|
11114
10889
|
} // slot traverse end
|
|
11115
10890
|
// add reset sub primitive
|
|
11116
10891
|
if (count > 0) {
|
|
11117
|
-
|
|
11118
|
-
origin2 && primitiveIndex++;
|
|
11119
|
-
var subPrimitive2 = origin2 || subPrimitivePool.get();
|
|
11120
|
-
subPrimitive2.start = start;
|
|
11121
|
-
subPrimitive2.count = count;
|
|
11122
|
-
var renderItem2 = subRenderItemPool.get();
|
|
11123
|
-
renderItem2.blendMode = blend;
|
|
11124
|
-
renderItem2.subPrimitive = subPrimitive2;
|
|
11125
|
-
renderItem2.texture = texture;
|
|
11126
|
-
_subRenderItems.push(renderItem2);
|
|
10892
|
+
primitiveIndex = this._createRenderItem(_subPrimitives, primitiveIndex, start, count, texture, blend);
|
|
11127
10893
|
count = 0;
|
|
11128
10894
|
}
|
|
11129
10895
|
_clipper.clipEnd();
|
|
11130
10896
|
var lastLen = _subPrimitives.length;
|
|
11131
10897
|
var curLen = _subRenderItems.length;
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
subPrimitivePool.return(item);
|
|
11136
|
-
}
|
|
10898
|
+
for(var i1 = curLen; i1 < lastLen; i1++){
|
|
10899
|
+
var item = _subPrimitives[i1];
|
|
10900
|
+
subPrimitivePool.return(item);
|
|
11137
10901
|
}
|
|
11138
10902
|
renderer._clearSubPrimitives();
|
|
10903
|
+
var materialCache = SpineAnimationRenderer._materialCache;
|
|
11139
10904
|
for(var i2 = 0, l = curLen; i2 < l; ++i2){
|
|
11140
10905
|
var item1 = _subRenderItems[i2];
|
|
11141
10906
|
var slotName1 = item1.slotName, blendMode = item1.blendMode, texture1 = item1.texture;
|
|
11142
10907
|
renderer._addSubPrimitive(item1.subPrimitive);
|
|
11143
|
-
var subTexture = texture1.
|
|
11144
|
-
|
|
11145
|
-
|
|
11146
|
-
}
|
|
11147
|
-
var key = subTexture.instanceId + "_" + blendMode;
|
|
11148
|
-
var material = SpineAnimationRenderer._materialCache.get(key);
|
|
10908
|
+
var subTexture = _separateSlotTextureMap.get(slotName1) || texture1.getImage();
|
|
10909
|
+
var key = subTexture.instanceId + "_" + blendMode + "_" + premultipliedAlpha;
|
|
10910
|
+
var material = materialCache.get(key);
|
|
11149
10911
|
if (!material) {
|
|
11150
|
-
material = this._createMaterialForTexture(subTexture, engine, blendMode);
|
|
11151
|
-
|
|
10912
|
+
material = this._createMaterialForTexture(subTexture, engine, blendMode, premultipliedAlpha);
|
|
10913
|
+
materialCache.set(key, material);
|
|
11152
10914
|
}
|
|
11153
10915
|
renderer.setMaterial(i2, material);
|
|
11154
10916
|
}
|
|
10917
|
+
if (indicesLength > _vertexCount) {
|
|
10918
|
+
renderer._createAndBindBuffer(indicesLength);
|
|
10919
|
+
this.buildPrimitive(skeleton, renderer);
|
|
10920
|
+
return;
|
|
10921
|
+
}
|
|
11155
10922
|
renderer._vertexBuffer.setData(_vertices);
|
|
11156
10923
|
renderer._indexBuffer.setData(_indices);
|
|
11157
10924
|
};
|
|
@@ -11161,49 +10928,41 @@ var SpineGenerator = /*#__PURE__*/ function() {
|
|
|
11161
10928
|
_proto.addSeparateSlotTexture = function addSeparateSlotTexture(slotName, texture) {
|
|
11162
10929
|
this._separateSlotTextureMap.set(slotName, texture);
|
|
11163
10930
|
};
|
|
11164
|
-
_proto._createMaterialForTexture = function _createMaterialForTexture(texture, engine, blendMode) {
|
|
10931
|
+
_proto._createMaterialForTexture = function _createMaterialForTexture(texture, engine, blendMode, premultipliedAlpha) {
|
|
11165
10932
|
var material = SpineAnimationRenderer._getDefaultMaterial(engine);
|
|
11166
10933
|
material.shaderData.setTexture("material_SpineTexture", texture);
|
|
11167
|
-
setBlendMode(material, blendMode);
|
|
10934
|
+
setBlendMode(material, blendMode, premultipliedAlpha);
|
|
11168
10935
|
return material;
|
|
11169
10936
|
};
|
|
11170
|
-
_proto.
|
|
11171
|
-
var
|
|
11172
|
-
var
|
|
11173
|
-
|
|
11174
|
-
|
|
11175
|
-
|
|
11176
|
-
var
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11180
|
-
|
|
11181
|
-
|
|
11182
|
-
|
|
11183
|
-
|
|
11184
|
-
|
|
11185
|
-
|
|
11186
|
-
|
|
11187
|
-
|
|
11188
|
-
|
|
11189
|
-
|
|
11190
|
-
|
|
11191
|
-
}
|
|
11192
|
-
};
|
|
11193
|
-
_proto._calculateTotalVertexCount = function _calculateTotalVertexCount(uniqueAttachments) {
|
|
11194
|
-
var totalVertexCount = 0;
|
|
11195
|
-
var QUAD_TRIANGLE_LENGTH = SpineGenerator.QUAD_TRIANGLES.length;
|
|
11196
|
-
uniqueAttachments.forEach(function(attachment) {
|
|
11197
|
-
if (_instanceof1(attachment, RegionAttachment)) {
|
|
11198
|
-
totalVertexCount += QUAD_TRIANGLE_LENGTH;
|
|
11199
|
-
} else if (_instanceof1(attachment, MeshAttachment)) {
|
|
11200
|
-
totalVertexCount += attachment.triangles.length;
|
|
11201
|
-
}
|
|
11202
|
-
});
|
|
11203
|
-
return totalVertexCount;
|
|
10937
|
+
_proto._createRenderItem = function _createRenderItem(subPrimitives, primitiveIndex, start, count, texture, blend, slotName) {
|
|
10938
|
+
var subPrimitivePool = SpineGenerator.subPrimitivePool, subRenderItemPool = SpineGenerator.subRenderItemPool;
|
|
10939
|
+
var origin = subPrimitives[primitiveIndex];
|
|
10940
|
+
if (origin) {
|
|
10941
|
+
primitiveIndex++;
|
|
10942
|
+
}
|
|
10943
|
+
var subPrimitive = origin || subPrimitivePool.get();
|
|
10944
|
+
subPrimitive.start = start;
|
|
10945
|
+
subPrimitive.count = count;
|
|
10946
|
+
var renderItem = subRenderItemPool.get();
|
|
10947
|
+
renderItem.blendMode = blend;
|
|
10948
|
+
renderItem.subPrimitive = subPrimitive;
|
|
10949
|
+
renderItem.texture = texture;
|
|
10950
|
+
renderItem.slotName = slotName;
|
|
10951
|
+
this._subRenderItems.push(renderItem);
|
|
10952
|
+
return primitiveIndex;
|
|
10953
|
+
};
|
|
10954
|
+
_proto._expandBounds = function _expandBounds(x, y, z, localBounds) {
|
|
10955
|
+
var min = localBounds.min, max = localBounds.max;
|
|
10956
|
+
min.set(Math.min(min.x, x), Math.min(min.y, y), Math.min(min.z, z));
|
|
10957
|
+
max.set(Math.max(max.x, x), Math.max(max.y, y), Math.max(max.z, z));
|
|
11204
10958
|
};
|
|
11205
10959
|
return SpineGenerator;
|
|
11206
10960
|
}();
|
|
10961
|
+
SpineGenerator.VERTEX_SIZE = 8;
|
|
10962
|
+
SpineGenerator.VERTEX_STRIDE = 9;
|
|
10963
|
+
SpineGenerator.tempDark = new Color();
|
|
10964
|
+
SpineGenerator.tempColor = new Color();
|
|
10965
|
+
SpineGenerator.tempVerts = new Array(8);
|
|
11207
10966
|
SpineGenerator.QUAD_TRIANGLES = [
|
|
11208
10967
|
0,
|
|
11209
10968
|
1,
|
|
@@ -11212,18 +10971,8 @@ SpineGenerator.QUAD_TRIANGLES = [
|
|
|
11212
10971
|
3,
|
|
11213
10972
|
0
|
|
11214
10973
|
];
|
|
11215
|
-
SpineGenerator.VERTEX_SIZE = 8 // 2 2 4 position without z, uv, color
|
|
11216
|
-
;
|
|
11217
|
-
SpineGenerator.VERTEX_STRIDE = 9 // 3 2 4 position with z, uv, color
|
|
11218
|
-
;
|
|
11219
|
-
SpineGenerator.tempDark = new Color();
|
|
11220
|
-
SpineGenerator.tempColor = new Color();
|
|
11221
|
-
SpineGenerator.tempVerts = new Array(8);
|
|
11222
|
-
SpineGenerator.tempBlendMode = null;
|
|
11223
|
-
SpineGenerator.tempTexture = null;
|
|
11224
10974
|
SpineGenerator.subPrimitivePool = new ReturnablePool(miniprogram.SubPrimitive);
|
|
11225
10975
|
SpineGenerator.subRenderItemPool = new ClearablePool(SubRenderItem);
|
|
11226
|
-
SpineGenerator.bounds = new miniprogram.BoundingBox(new miniprogram.Vector3(maxBoundsValue, maxBoundsValue, maxBoundsValue), new miniprogram.Vector3(minBoundsValue, minBoundsValue, minBoundsValue));
|
|
11227
10976
|
|
|
11228
10977
|
var SpineMaterial = /*#__PURE__*/ function(Material) {
|
|
11229
10978
|
_inherits(SpineMaterial, Material);
|
|
@@ -11234,7 +10983,7 @@ var SpineMaterial = /*#__PURE__*/ function(Material) {
|
|
|
11234
10983
|
var renderState = _this.renderState;
|
|
11235
10984
|
var target = renderState.blendState.targetBlendState;
|
|
11236
10985
|
target.enabled = true;
|
|
11237
|
-
setBlendMode(_this, exports.BlendMode.Normal);
|
|
10986
|
+
setBlendMode(_this, exports.BlendMode.Normal, false);
|
|
11238
10987
|
renderState.depthState.writeEnabled = false;
|
|
11239
10988
|
renderState.rasterState.cullMode = miniprogram.CullMode.Off;
|
|
11240
10989
|
renderState.renderQueueType = miniprogram.RenderQueueType.Transparent;
|
|
@@ -11251,11 +11000,17 @@ SpineMaterial._spineFS = "\n uniform sampler2D material_SpineTexture;\n\n
|
|
|
11251
11000
|
_inherits(SpineAnimationRenderer, Renderer);
|
|
11252
11001
|
function SpineAnimationRenderer(entity) {
|
|
11253
11002
|
var _this;
|
|
11254
|
-
_this = Renderer.call(this, entity) || this, /**
|
|
11003
|
+
_this = Renderer.call(this, entity) || this, /**
|
|
11004
|
+
* The spacing between z layers.
|
|
11005
|
+
*/ _this.zSpacing = 0.01, /**
|
|
11006
|
+
* Whether to use premultiplied alpha mode for rendering.
|
|
11007
|
+
* When enabled, vertex color values are multiplied by the alpha channel.
|
|
11008
|
+
* @remarks
|
|
11009
|
+
If this option is enabled, the Spine editor must export textures with "Premultiply Alpha" checked.
|
|
11010
|
+
*/ _this.premultipliedAlpha = false, /**
|
|
11255
11011
|
* Default state for spine animation.
|
|
11256
|
-
* Contains the default animation name to be played, whether this animation should loop,
|
|
11257
|
-
|
|
11258
|
-
*/ _this.defaultState = new DefaultState(), /** @internal */ _this._subPrimitives = [], /** @internal */ _this._needResizeBuffer = false, /** @internal */ _this._vertexCount = 0;
|
|
11012
|
+
* Contains the default animation name to be played, whether this animation should loop, the default skin name.
|
|
11013
|
+
*/ _this.defaultConfig = new SpineAnimationDefaultConfig(), /** @internal */ _this._subPrimitives = [], /** @internal */ _this._vertices = new Float32Array(), /** @internal */ _this._indices = new Uint16Array(), /** @internal */ _this._needResizeBuffer = false, /** @internal */ _this._vertexCount = 0, /** @internal */ _this._localBounds = new miniprogram.BoundingBox(new miniprogram.Vector3(Infinity, Infinity, Infinity), new miniprogram.Vector3(-Infinity, -Infinity, -Infinity));
|
|
11259
11014
|
var primitive = new miniprogram.Primitive(_this._engine);
|
|
11260
11015
|
_this._primitive = primitive;
|
|
11261
11016
|
primitive.addVertexElement(SpineAnimationRenderer._positionVertexElement);
|
|
@@ -11265,49 +11020,28 @@ SpineMaterial._spineFS = "\n uniform sampler2D material_SpineTexture;\n\n
|
|
|
11265
11020
|
}
|
|
11266
11021
|
var _proto = SpineAnimationRenderer.prototype;
|
|
11267
11022
|
/**
|
|
11268
|
-
* Separate slot by slot name. This will add a new sub primitive, and new materials.
|
|
11269
|
-
*/ _proto.addSeparateSlot = function addSeparateSlot(slotName) {
|
|
11270
|
-
if (!this._skeleton) {
|
|
11271
|
-
console.error("Skeleton not found!");
|
|
11272
|
-
}
|
|
11273
|
-
var slot = this._skeleton.findSlot(slotName);
|
|
11274
|
-
if (slot) {
|
|
11275
|
-
SpineAnimationRenderer._spineGenerator.addSeparateSlot(slotName);
|
|
11276
|
-
} else {
|
|
11277
|
-
console.warn("Slot: " + slotName + " not find.");
|
|
11278
|
-
}
|
|
11279
|
-
};
|
|
11280
|
-
/**
|
|
11281
11023
|
* @internal
|
|
11282
11024
|
*/ // @ts-ignore
|
|
11283
11025
|
_proto._onEnable = function _onEnable() {
|
|
11284
|
-
this.
|
|
11026
|
+
this._applyDefaultConfig();
|
|
11285
11027
|
};
|
|
11286
11028
|
/**
|
|
11287
11029
|
* @internal
|
|
11288
11030
|
*/ _proto.update = function update(delta) {
|
|
11289
|
-
var _this = this,
|
|
11290
|
-
if (
|
|
11291
|
-
|
|
11292
|
-
|
|
11293
|
-
|
|
11294
|
-
|
|
11295
|
-
|
|
11296
|
-
|
|
11297
|
-
this._onWorldVolumeChanged();
|
|
11298
|
-
this._setDirtyFlagFalse(4);
|
|
11299
|
-
}
|
|
11300
|
-
if (this._isContainDirtyFlag(2)) {
|
|
11301
|
-
this._calculateGeneratorBounds(this.bounds);
|
|
11302
|
-
}
|
|
11303
|
-
}
|
|
11031
|
+
var _this = this, state = _this._state, skeleton = _this._skeleton;
|
|
11032
|
+
if (!state || !skeleton) return;
|
|
11033
|
+
state.update(delta);
|
|
11034
|
+
state.apply(skeleton);
|
|
11035
|
+
skeleton.update(delta);
|
|
11036
|
+
skeleton.updateWorldTransform(exports.Physics.update);
|
|
11037
|
+
SpineAnimationRenderer._spineGenerator.buildPrimitive(this._skeleton, this);
|
|
11038
|
+
this._dirtyUpdateFlag |= 1;
|
|
11304
11039
|
};
|
|
11305
11040
|
/**
|
|
11306
11041
|
* @internal
|
|
11307
11042
|
*/ // @ts-ignore
|
|
11308
11043
|
_proto._render = function _render(context) {
|
|
11309
|
-
var _this = this, _primitive = _this._primitive, _subPrimitives = _this._subPrimitives;
|
|
11310
|
-
var _this1 = this, materials = _this1._materials, engine = _this1._engine;
|
|
11044
|
+
var _this = this, _primitive = _this._primitive, _subPrimitives = _this._subPrimitives, materials = _this._materials, engine = _this._engine;
|
|
11311
11045
|
// @ts-ignore
|
|
11312
11046
|
var renderElement = engine._renderElementPool.get();
|
|
11313
11047
|
// @ts-ignore
|
|
@@ -11335,46 +11069,49 @@ SpineMaterial._spineFS = "\n uniform sampler2D material_SpineTexture;\n\n
|
|
|
11335
11069
|
* @internal
|
|
11336
11070
|
*/ // @ts-ignore
|
|
11337
11071
|
_proto._updateBounds = function _updateBounds(worldBounds) {
|
|
11338
|
-
this.
|
|
11072
|
+
miniprogram.BoundingBox.transform(this._localBounds, this.entity.transform.worldMatrix, worldBounds);
|
|
11073
|
+
};
|
|
11074
|
+
/**
|
|
11075
|
+
* @internal
|
|
11076
|
+
*/ _proto._setSkeleton = function _setSkeleton(skeleton) {
|
|
11077
|
+
this._skeleton = skeleton;
|
|
11339
11078
|
};
|
|
11340
11079
|
/**
|
|
11341
11080
|
* @internal
|
|
11342
|
-
*/ _proto.
|
|
11343
|
-
|
|
11344
|
-
miniprogram.BoundingBox.transform(bounds, this.entity.transform.worldMatrix, worldBounds);
|
|
11081
|
+
*/ _proto._setState = function _setState(state) {
|
|
11082
|
+
this._state = state;
|
|
11345
11083
|
};
|
|
11346
11084
|
/**
|
|
11347
11085
|
* @internal
|
|
11348
11086
|
*/ // @ts-ignore
|
|
11349
11087
|
_proto._cloneTo = function _cloneTo(target) {
|
|
11350
|
-
|
|
11088
|
+
var skeletonData = this._skeleton.data;
|
|
11089
|
+
var animationStateData = new AnimationStateData(skeletonData);
|
|
11090
|
+
var skeleton = new Skeleton(skeletonData);
|
|
11091
|
+
var state = new AnimationState(animationStateData);
|
|
11092
|
+
target._setSkeleton(skeleton);
|
|
11093
|
+
target._setState(state);
|
|
11351
11094
|
};
|
|
11352
11095
|
/**
|
|
11353
11096
|
* @internal
|
|
11354
11097
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
11355
|
-
var _this = this, _primitive = _this._primitive, _subPrimitives = _this._subPrimitives, _resource = _this._resource;
|
|
11356
|
-
_subPrimitives.length = 0;
|
|
11357
|
-
if (_primitive) {
|
|
11358
|
-
_primitive.destroy();
|
|
11359
|
-
}
|
|
11360
|
-
if (_resource) {
|
|
11361
|
-
this._addResourceReferCount(_resource, -1);
|
|
11362
|
-
}
|
|
11363
11098
|
this._clearMaterialCache();
|
|
11099
|
+
this._subPrimitives.length = 0;
|
|
11100
|
+
this._primitive && this._primitive.destroy();
|
|
11364
11101
|
this._primitive = null;
|
|
11365
11102
|
this._resource = null;
|
|
11366
11103
|
this._skeleton = null;
|
|
11367
11104
|
this._state = null;
|
|
11368
|
-
this.setting = null;
|
|
11369
11105
|
Renderer.prototype._onDestroy.call(this);
|
|
11370
11106
|
};
|
|
11371
11107
|
/**
|
|
11372
11108
|
* @internal
|
|
11373
|
-
*/ _proto.
|
|
11109
|
+
*/ _proto._createAndBindBuffer = function _createAndBindBuffer(vertexCount) {
|
|
11374
11110
|
var _this = this, _engine = _this._engine, _primitive = _this._primitive;
|
|
11111
|
+
this._vertexCount = vertexCount;
|
|
11375
11112
|
this._vertices = new Float32Array(vertexCount * SpineGenerator.VERTEX_STRIDE);
|
|
11376
11113
|
this._indices = new Uint16Array(vertexCount);
|
|
11377
|
-
var vertexStride = SpineGenerator.VERTEX_STRIDE * 4;
|
|
11114
|
+
var vertexStride = SpineGenerator.VERTEX_STRIDE * 4;
|
|
11378
11115
|
var vertexBuffer = new miniprogram.Buffer(_engine, miniprogram.BufferBindFlag.VertexBuffer, this._vertices, miniprogram.BufferUsage.Dynamic);
|
|
11379
11116
|
var indexBuffer = new miniprogram.Buffer(_engine, miniprogram.BufferBindFlag.IndexBuffer, this._indices, miniprogram.BufferUsage.Dynamic);
|
|
11380
11117
|
this._indexBuffer = indexBuffer;
|
|
@@ -11394,44 +11131,22 @@ SpineMaterial._spineFS = "\n uniform sampler2D material_SpineTexture;\n\n
|
|
|
11394
11131
|
*/ _proto._clearSubPrimitives = function _clearSubPrimitives() {
|
|
11395
11132
|
this._subPrimitives.length = 0;
|
|
11396
11133
|
};
|
|
11397
|
-
/**
|
|
11398
|
-
* @internal
|
|
11399
|
-
*/ _proto._isContainDirtyFlag = function _isContainDirtyFlag(type) {
|
|
11400
|
-
return (this._dirtyUpdateFlag & type) != 0;
|
|
11401
|
-
};
|
|
11402
|
-
/**
|
|
11403
|
-
* @internal
|
|
11404
|
-
*/ _proto._setDirtyFlagFalse = function _setDirtyFlagFalse(type) {
|
|
11405
|
-
this._dirtyUpdateFlag &= ~type;
|
|
11406
|
-
};
|
|
11407
|
-
/**
|
|
11408
|
-
* @internal
|
|
11409
|
-
*/ _proto._onWorldVolumeChanged = function _onWorldVolumeChanged() {
|
|
11410
|
-
this._dirtyUpdateFlag |= 1;
|
|
11411
|
-
};
|
|
11412
|
-
_proto._onAnimationStart = function _onAnimationStart() {
|
|
11413
|
-
this._dirtyUpdateFlag |= 2;
|
|
11414
|
-
};
|
|
11415
|
-
_proto._onAnimationComplete = function _onAnimationComplete(entry) {
|
|
11416
|
-
if (!entry.loop) {
|
|
11417
|
-
this._setDirtyFlagFalse(2);
|
|
11418
|
-
}
|
|
11419
|
-
};
|
|
11420
11134
|
_proto._clearMaterialCache = function _clearMaterialCache() {
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11135
|
+
var materialCache = SpineAnimationRenderer._materialCache;
|
|
11136
|
+
var _this = this, materials = _this._materials;
|
|
11137
|
+
for(var i = 0, len = materials.length; i < len; i += 1){
|
|
11138
|
+
var material = materials[i];
|
|
11139
|
+
var texture = material.shaderData.getTexture("material_SpineTexture");
|
|
11140
|
+
var blendMode = getBlendMode(material);
|
|
11424
11141
|
var key = texture.instanceId + "_" + blendMode;
|
|
11425
|
-
|
|
11426
|
-
}
|
|
11142
|
+
materialCache.delete(key);
|
|
11143
|
+
}
|
|
11427
11144
|
};
|
|
11428
|
-
_proto.
|
|
11145
|
+
_proto._applyDefaultConfig = function _applyDefaultConfig() {
|
|
11429
11146
|
var _this = this, skeleton = _this.skeleton, state = _this.state;
|
|
11430
11147
|
if (skeleton && state) {
|
|
11431
|
-
var
|
|
11432
|
-
|
|
11433
|
-
skeleton.scaleY = scale;
|
|
11434
|
-
if (skinName !== 'default') {
|
|
11148
|
+
var _this_defaultConfig = this.defaultConfig, animationName = _this_defaultConfig.animationName, skinName = _this_defaultConfig.skinName, loop = _this_defaultConfig.loop;
|
|
11149
|
+
if (skinName !== "default") {
|
|
11435
11150
|
skeleton.setSkinByName(skinName);
|
|
11436
11151
|
skeleton.setToSetupPose();
|
|
11437
11152
|
}
|
|
@@ -11456,51 +11171,11 @@ SpineMaterial._spineFS = "\n uniform sampler2D material_SpineTexture;\n\n
|
|
|
11456
11171
|
return defaultMaterial.clone();
|
|
11457
11172
|
};
|
|
11458
11173
|
_create_class(SpineAnimationRenderer, [
|
|
11459
|
-
{
|
|
11460
|
-
key: "resource",
|
|
11461
|
-
get: /**
|
|
11462
|
-
* Spine resource of current spine animation.This property allows you to switch between different animations at runtime.
|
|
11463
|
-
*/ function get() {
|
|
11464
|
-
return this._resource;
|
|
11465
|
-
},
|
|
11466
|
-
set: function set(value) {
|
|
11467
|
-
var _this = this;
|
|
11468
|
-
if (!value) {
|
|
11469
|
-
this._state = null;
|
|
11470
|
-
this._skeleton = null;
|
|
11471
|
-
this._resource = null;
|
|
11472
|
-
return;
|
|
11473
|
-
}
|
|
11474
|
-
this._resource = value;
|
|
11475
|
-
// @ts-ignore
|
|
11476
|
-
this._addResourceReferCount(value, 1);
|
|
11477
|
-
var skeletonData = value.skeletonData;
|
|
11478
|
-
this._skeleton = new Skeleton(skeletonData);
|
|
11479
|
-
var animationData = SpineAnimationRenderer._animationDataCache.get(skeletonData);
|
|
11480
|
-
if (!animationData) {
|
|
11481
|
-
animationData = new AnimationStateData(skeletonData);
|
|
11482
|
-
SpineAnimationRenderer._animationDataCache.set(skeletonData, animationData);
|
|
11483
|
-
}
|
|
11484
|
-
this._state = new AnimationState(animationData);
|
|
11485
|
-
var maxCount = SpineAnimationRenderer._spineGenerator.getMaxVertexCount(skeletonData);
|
|
11486
|
-
this._createBuffer(maxCount);
|
|
11487
|
-
this._initializeDefaultState();
|
|
11488
|
-
this._dirtyUpdateFlag |= 4;
|
|
11489
|
-
this._state.addListener({
|
|
11490
|
-
start: function() {
|
|
11491
|
-
_this._onAnimationStart();
|
|
11492
|
-
},
|
|
11493
|
-
complete: function(entry) {
|
|
11494
|
-
_this._onAnimationComplete(entry);
|
|
11495
|
-
}
|
|
11496
|
-
});
|
|
11497
|
-
}
|
|
11498
|
-
},
|
|
11499
11174
|
{
|
|
11500
11175
|
key: "state",
|
|
11501
11176
|
get: /**
|
|
11502
|
-
*
|
|
11503
|
-
*
|
|
11177
|
+
* The Spine.AnimationState object of this SpineAnimationRenderer.
|
|
11178
|
+
* Manage, blend, and transition between multiple simultaneous animations effectively.
|
|
11504
11179
|
*/ function get() {
|
|
11505
11180
|
return this._state;
|
|
11506
11181
|
}
|
|
@@ -11508,28 +11183,59 @@ SpineMaterial._spineFS = "\n uniform sampler2D material_SpineTexture;\n\n
|
|
|
11508
11183
|
{
|
|
11509
11184
|
key: "skeleton",
|
|
11510
11185
|
get: /**
|
|
11511
|
-
*
|
|
11512
|
-
*
|
|
11186
|
+
* The Spine.Skeleton object of this SpineAnimationRenderer.
|
|
11187
|
+
* Manipulate bone positions, rotations, scaling
|
|
11513
11188
|
* and change spine attachment to customize character appearances dynamically during runtime.
|
|
11514
11189
|
*/ function get() {
|
|
11515
11190
|
return this._skeleton;
|
|
11516
11191
|
}
|
|
11192
|
+
},
|
|
11193
|
+
{
|
|
11194
|
+
key: "resource",
|
|
11195
|
+
get: /**
|
|
11196
|
+
* * @deprecated This property is deprecated and will be removed in future releases.
|
|
11197
|
+
* Spine resource of current spine animation.
|
|
11198
|
+
*/ function get() {
|
|
11199
|
+
return this._resource;
|
|
11200
|
+
},
|
|
11201
|
+
set: /**
|
|
11202
|
+
* * @deprecated This property is deprecated and will be removed in future releases.
|
|
11203
|
+
* Sets the Spine resource for the current animation. This property allows switching to a different `SpineResource`.
|
|
11204
|
+
*
|
|
11205
|
+
* @param value - The new `SpineResource` to be used for the current animation
|
|
11206
|
+
*/ function set(value) {
|
|
11207
|
+
if (!value) {
|
|
11208
|
+
this._state = null;
|
|
11209
|
+
this._skeleton = null;
|
|
11210
|
+
this._resource = null;
|
|
11211
|
+
return;
|
|
11212
|
+
}
|
|
11213
|
+
this._resource = value;
|
|
11214
|
+
var skeletonData = value.skeletonData, stateData = value.stateData;
|
|
11215
|
+
var skeleton = new Skeleton(skeletonData);
|
|
11216
|
+
var state = new AnimationState(stateData);
|
|
11217
|
+
this._setSkeleton(skeleton);
|
|
11218
|
+
this._setState(state);
|
|
11219
|
+
this._applyDefaultConfig();
|
|
11220
|
+
}
|
|
11517
11221
|
}
|
|
11518
11222
|
]);
|
|
11519
11223
|
return SpineAnimationRenderer;
|
|
11520
11224
|
}(miniprogram.Renderer);
|
|
11521
11225
|
SpineAnimationRenderer._spineGenerator = new SpineGenerator();
|
|
11522
|
-
SpineAnimationRenderer._positionVertexElement = new miniprogram.VertexElement(
|
|
11523
|
-
SpineAnimationRenderer._colorVertexElement = new miniprogram.VertexElement(
|
|
11524
|
-
SpineAnimationRenderer._uvVertexElement = new miniprogram.VertexElement(
|
|
11226
|
+
SpineAnimationRenderer._positionVertexElement = new miniprogram.VertexElement("POSITION", 0, miniprogram.VertexElementFormat.Vector3, 0);
|
|
11227
|
+
SpineAnimationRenderer._colorVertexElement = new miniprogram.VertexElement("COLOR_0", 12, miniprogram.VertexElementFormat.Vector4, 0);
|
|
11228
|
+
SpineAnimationRenderer._uvVertexElement = new miniprogram.VertexElement("TEXCOORD_0", 28, miniprogram.VertexElementFormat.Vector2, 0);
|
|
11525
11229
|
/** @internal */ SpineAnimationRenderer._materialCache = new Map();
|
|
11526
|
-
/** @internal */ SpineAnimationRenderer._animationDataCache = new Map();
|
|
11527
11230
|
__decorate([
|
|
11528
|
-
miniprogram.
|
|
11529
|
-
], SpineAnimationRenderer.prototype, "
|
|
11231
|
+
miniprogram.assignmentClone
|
|
11232
|
+
], SpineAnimationRenderer.prototype, "zSpacing", void 0);
|
|
11233
|
+
__decorate([
|
|
11234
|
+
miniprogram.assignmentClone
|
|
11235
|
+
], SpineAnimationRenderer.prototype, "premultipliedAlpha", void 0);
|
|
11530
11236
|
__decorate([
|
|
11531
11237
|
miniprogram.deepClone
|
|
11532
|
-
], SpineAnimationRenderer.prototype, "
|
|
11238
|
+
], SpineAnimationRenderer.prototype, "defaultConfig", void 0);
|
|
11533
11239
|
__decorate([
|
|
11534
11240
|
miniprogram.ignoreClone
|
|
11535
11241
|
], SpineAnimationRenderer.prototype, "_primitive", void 0);
|
|
@@ -11557,151 +11263,126 @@ __decorate([
|
|
|
11557
11263
|
__decorate([
|
|
11558
11264
|
miniprogram.ignoreClone
|
|
11559
11265
|
], SpineAnimationRenderer.prototype, "_resource", void 0);
|
|
11266
|
+
__decorate([
|
|
11267
|
+
miniprogram.ignoreClone
|
|
11268
|
+
], SpineAnimationRenderer.prototype, "_localBounds", void 0);
|
|
11560
11269
|
__decorate([
|
|
11561
11270
|
miniprogram.ignoreClone
|
|
11562
11271
|
], SpineAnimationRenderer.prototype, "_skeleton", void 0);
|
|
11563
11272
|
__decorate([
|
|
11564
11273
|
miniprogram.ignoreClone
|
|
11565
11274
|
], SpineAnimationRenderer.prototype, "_state", void 0);
|
|
11566
|
-
/**
|
|
11567
|
-
* Render setting for spine rendering.
|
|
11568
|
-
*/ var SpineRenderSetting = function SpineRenderSetting(/**
|
|
11569
|
-
* The spacing between z layers @defaultValue `0.01`
|
|
11570
|
-
*/ zSpacing, /**
|
|
11571
|
-
* Whether to use clipping @defaultValue `true`
|
|
11572
|
-
*/ useClipping) {
|
|
11573
|
-
if (zSpacing === void 0) zSpacing = 0.01;
|
|
11574
|
-
if (useClipping === void 0) useClipping = true;
|
|
11575
|
-
this.zSpacing = zSpacing;
|
|
11576
|
-
this.useClipping = useClipping;
|
|
11577
|
-
};
|
|
11578
11275
|
/**
|
|
11579
11276
|
* Default state for spine animation.
|
|
11580
11277
|
* Contains the default animation name to be played, whether this animation should loop,
|
|
11581
11278
|
* the default skin name, and the default scale of the skeleton.
|
|
11582
|
-
*/ var
|
|
11583
|
-
* The default scale of the animation @defaultValue `1`
|
|
11584
|
-
*/ scale, /**
|
|
11279
|
+
*/ var SpineAnimationDefaultConfig = function SpineAnimationDefaultConfig(/**
|
|
11585
11280
|
* Whether the default animation should loop @defaultValue `true. The default animation should loop`
|
|
11586
11281
|
*/ loop, /**
|
|
11587
11282
|
* The name of the default animation @defaultValue `null. Do not play any animation by default`
|
|
11588
11283
|
*/ animationName, /**
|
|
11589
11284
|
* The name of the default skin @defaultValue `default`
|
|
11590
11285
|
*/ skinName) {
|
|
11591
|
-
if (scale === void 0) scale = 1;
|
|
11592
11286
|
if (loop === void 0) loop = true;
|
|
11593
11287
|
if (animationName === void 0) animationName = null;
|
|
11594
11288
|
if (skinName === void 0) skinName = "default";
|
|
11595
|
-
this.scale = scale;
|
|
11596
11289
|
this.loop = loop;
|
|
11597
11290
|
this.animationName = animationName;
|
|
11598
11291
|
this.skinName = skinName;
|
|
11599
11292
|
};
|
|
11600
11293
|
|
|
11601
|
-
|
|
11602
|
-
|
|
11603
|
-
|
|
11294
|
+
/**
|
|
11295
|
+
* Represents a resource that manages Spine animation data, textures, and entity templates for the Galacean engine.
|
|
11296
|
+
*
|
|
11297
|
+
*/ var SpineResource = /*#__PURE__*/ function(ReferResource) {
|
|
11298
|
+
_inherits(SpineResource, ReferResource);
|
|
11299
|
+
function SpineResource(engine, skeletonData, url) {
|
|
11604
11300
|
var _this;
|
|
11605
|
-
_this = ReferResource.call(this, engine) || this, _this.
|
|
11301
|
+
_this = ReferResource.call(this, engine) || this, _this._texturesInSpineAtlas = [];
|
|
11302
|
+
_this.url = url;
|
|
11606
11303
|
_this._skeletonData = skeletonData;
|
|
11304
|
+
_this._stateData = new AnimationStateData(skeletonData);
|
|
11607
11305
|
_this._associationTextureInSkeletonData(skeletonData);
|
|
11306
|
+
_this._createTemplate();
|
|
11608
11307
|
return _this;
|
|
11609
11308
|
}
|
|
11610
|
-
var _proto =
|
|
11309
|
+
var _proto = SpineResource.prototype;
|
|
11310
|
+
/**
|
|
11311
|
+
* Creates and returns a new instance of the spine entity template.
|
|
11312
|
+
* @returns A instance of the spine entity template
|
|
11313
|
+
*/ _proto.instantiate = function instantiate() {
|
|
11314
|
+
return this._template.clone();
|
|
11315
|
+
};
|
|
11611
11316
|
_proto._onDestroy = function _onDestroy() {
|
|
11612
11317
|
ReferResource.prototype._onDestroy.call(this);
|
|
11613
|
-
|
|
11614
|
-
textures && this._disassociationSuperResource(textures);
|
|
11615
|
-
this._clearAttachmentTextures(_skeletonData);
|
|
11616
|
-
SpineAnimationRenderer._animationDataCache.delete(_skeletonData);
|
|
11318
|
+
this._disassociationSuperResource();
|
|
11617
11319
|
this._skeletonData = null;
|
|
11618
|
-
|
|
11619
|
-
|
|
11620
|
-
|
|
11621
|
-
|
|
11622
|
-
|
|
11623
|
-
|
|
11320
|
+
this._stateData = null;
|
|
11321
|
+
};
|
|
11322
|
+
_proto._createTemplate = function _createTemplate() {
|
|
11323
|
+
var name = this._extractFileName(this.url);
|
|
11324
|
+
var spineEntity = new miniprogram.Entity(this.engine, name);
|
|
11325
|
+
var spineAnimationRenderer = spineEntity.addComponent(SpineAnimationRenderer);
|
|
11326
|
+
var skeleton = new Skeleton(this._skeletonData);
|
|
11327
|
+
var state = new AnimationState(this._stateData);
|
|
11328
|
+
spineAnimationRenderer._setSkeleton(skeleton);
|
|
11329
|
+
spineAnimationRenderer._setState(state);
|
|
11330
|
+
// @ts-ignore
|
|
11331
|
+
spineEntity._markAsTemplate(this);
|
|
11332
|
+
this._template = spineEntity;
|
|
11624
11333
|
};
|
|
11625
11334
|
_proto._associationTextureInSkeletonData = function _associationTextureInSkeletonData(skeletonData) {
|
|
11626
|
-
var
|
|
11627
|
-
var
|
|
11628
|
-
skins.
|
|
11629
|
-
var
|
|
11630
|
-
attachments.forEach(function(attachmentMap) {
|
|
11335
|
+
var skins = skeletonData.skins, slots = skeletonData.slots;
|
|
11336
|
+
var textures = this._texturesInSpineAtlas;
|
|
11337
|
+
for(var i = 0, n = skins.length; i < n; i++){
|
|
11338
|
+
for(var j = 0, m = slots.length; j < m; j++){
|
|
11631
11339
|
var _attachment_region;
|
|
11632
|
-
var
|
|
11633
|
-
|
|
11340
|
+
var slot = slots[j];
|
|
11341
|
+
var attachment = skins[i].getAttachment(slot.index, slot.name);
|
|
11634
11342
|
var texture = attachment == null ? void 0 : (_attachment_region = attachment.region) == null ? void 0 : _attachment_region.texture.texture;
|
|
11635
|
-
if (texture
|
|
11636
|
-
|
|
11637
|
-
|
|
11638
|
-
|
|
11639
|
-
|
|
11343
|
+
if (texture) {
|
|
11344
|
+
if (!textures.includes(texture)) {
|
|
11345
|
+
textures.push(texture);
|
|
11346
|
+
// @ts-ignore
|
|
11347
|
+
texture._associationSuperResource(this);
|
|
11348
|
+
}
|
|
11640
11349
|
}
|
|
11641
|
-
}
|
|
11642
|
-
}
|
|
11350
|
+
}
|
|
11351
|
+
}
|
|
11643
11352
|
};
|
|
11644
|
-
_proto.
|
|
11645
|
-
var
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
|
|
11649
|
-
|
|
11650
|
-
|
|
11651
|
-
|
|
11652
|
-
|
|
11653
|
-
|
|
11654
|
-
|
|
11655
|
-
}
|
|
11656
|
-
});
|
|
11657
|
-
});
|
|
11353
|
+
_proto._disassociationSuperResource = function _disassociationSuperResource() {
|
|
11354
|
+
var textures = this._texturesInSpineAtlas;
|
|
11355
|
+
for(var i = 0, n = textures.length; i < n; i++){
|
|
11356
|
+
// @ts-ignore
|
|
11357
|
+
textures[i]._disassociationSuperResource(this);
|
|
11358
|
+
}
|
|
11359
|
+
};
|
|
11360
|
+
_proto._extractFileName = function _extractFileName(url) {
|
|
11361
|
+
if (!url) return "Spine Entity";
|
|
11362
|
+
var match = url.match(/\/([^\/]+?)(\.[^\/]*)?$/);
|
|
11363
|
+
return match ? match[1] : "Spine Entity";
|
|
11658
11364
|
};
|
|
11659
|
-
_create_class(
|
|
11365
|
+
_create_class(SpineResource, [
|
|
11660
11366
|
{
|
|
11661
11367
|
key: "skeletonData",
|
|
11662
|
-
get:
|
|
11368
|
+
get: /**
|
|
11369
|
+
* The skeleton data associated with this Spine resource.
|
|
11370
|
+
*/ function get() {
|
|
11663
11371
|
return this._skeletonData;
|
|
11664
11372
|
}
|
|
11373
|
+
},
|
|
11374
|
+
{
|
|
11375
|
+
key: "stateData",
|
|
11376
|
+
get: /**
|
|
11377
|
+
* The animation state data associated with this Spine resource.
|
|
11378
|
+
*/ function get() {
|
|
11379
|
+
return this._stateData;
|
|
11380
|
+
}
|
|
11665
11381
|
}
|
|
11666
11382
|
]);
|
|
11667
|
-
return
|
|
11383
|
+
return SpineResource;
|
|
11668
11384
|
}(miniprogram.ReferResource);
|
|
11669
11385
|
|
|
11670
|
-
var BufferReader = /*#__PURE__*/ function() {
|
|
11671
|
-
function BufferReader(data, byteOffset, byteLength) {
|
|
11672
|
-
if (byteOffset === void 0) byteOffset = 0;
|
|
11673
|
-
this.data = data;
|
|
11674
|
-
this._dataView = new DataView(data.buffer, data.byteOffset + byteOffset, byteLength != null ? byteLength : data.byteLength - byteOffset);
|
|
11675
|
-
this._position = 0;
|
|
11676
|
-
}
|
|
11677
|
-
var _proto = BufferReader.prototype;
|
|
11678
|
-
_proto.nextUint16 = function nextUint16() {
|
|
11679
|
-
var value = this._dataView.getUint16(this._position, true);
|
|
11680
|
-
this._position += 2;
|
|
11681
|
-
return value;
|
|
11682
|
-
};
|
|
11683
|
-
_proto.nextStr = function nextStr() {
|
|
11684
|
-
var strByteLength = this.nextUint16();
|
|
11685
|
-
var uint8Array = new Uint8Array(this.data.buffer, this._position + this._dataView.byteOffset, strByteLength);
|
|
11686
|
-
this._position += strByteLength;
|
|
11687
|
-
return this.decodeText(uint8Array);
|
|
11688
|
-
};
|
|
11689
|
-
_proto.nextImageData = function nextImageData() {
|
|
11690
|
-
return new Uint8Array(this.data.buffer, this.data.byteOffset + this._position);
|
|
11691
|
-
};
|
|
11692
|
-
_proto.decodeText = function decodeText(array) {
|
|
11693
|
-
if (typeof TextDecoder !== "undefined") {
|
|
11694
|
-
return new TextDecoder().decode(array);
|
|
11695
|
-
}
|
|
11696
|
-
var s = "";
|
|
11697
|
-
for(var i = 0, il = array.length; i < il; i++){
|
|
11698
|
-
s += String.fromCharCode(array[i]);
|
|
11699
|
-
}
|
|
11700
|
-
return decodeURIComponent(encodeURIComponent(s));
|
|
11701
|
-
};
|
|
11702
|
-
return BufferReader;
|
|
11703
|
-
}();
|
|
11704
|
-
|
|
11705
11386
|
var SpineLoader = /*#__PURE__*/ function(Loader) {
|
|
11706
11387
|
_inherits(SpineLoader, Loader);
|
|
11707
11388
|
function SpineLoader() {
|
|
@@ -11710,352 +11391,249 @@ var SpineLoader = /*#__PURE__*/ function(Loader) {
|
|
|
11710
11391
|
var _proto = SpineLoader.prototype;
|
|
11711
11392
|
_proto.load = function load(item, resourceManager) {
|
|
11712
11393
|
var _this = this;
|
|
11713
|
-
return new miniprogram.AssetPromise(
|
|
11714
|
-
var
|
|
11715
|
-
|
|
11716
|
-
|
|
11717
|
-
|
|
11718
|
-
|
|
11719
|
-
|
|
11720
|
-
|
|
11721
|
-
];
|
|
11722
|
-
return [
|
|
11723
|
-
4,
|
|
11724
|
-
_this._handleOriginAsset(item, resourceManager)
|
|
11725
|
-
];
|
|
11726
|
-
case 1:
|
|
11727
|
-
resource = _state.sent();
|
|
11728
|
-
return [
|
|
11729
|
-
3,
|
|
11730
|
-
7
|
|
11731
|
-
];
|
|
11732
|
-
case 2:
|
|
11733
|
-
return [
|
|
11734
|
-
4,
|
|
11735
|
-
resourceManager._request(item.url, {
|
|
11736
|
-
type: 'arraybuffer'
|
|
11737
|
-
})
|
|
11738
|
-
];
|
|
11739
|
-
case 3:
|
|
11740
|
-
buffer = _state.sent();
|
|
11741
|
-
reader = new BufferReader(new Uint8Array(buffer));
|
|
11742
|
-
header = reader.nextStr();
|
|
11743
|
-
if (!header.startsWith('spine')) return [
|
|
11744
|
-
3,
|
|
11745
|
-
5
|
|
11746
|
-
];
|
|
11747
|
-
return [
|
|
11748
|
-
4,
|
|
11749
|
-
_this._handleEditorAsset(buffer, reader, header, resourceManager)
|
|
11750
|
-
];
|
|
11751
|
-
case 4:
|
|
11752
|
-
resource = _state.sent();
|
|
11753
|
-
return [
|
|
11754
|
-
3,
|
|
11755
|
-
7
|
|
11756
|
-
];
|
|
11757
|
-
case 5:
|
|
11758
|
-
return [
|
|
11759
|
-
4,
|
|
11760
|
-
_this._handleOriginAsset(item, resourceManager, buffer)
|
|
11761
|
-
];
|
|
11762
|
-
case 6:
|
|
11763
|
-
resource = _state.sent();
|
|
11764
|
-
_state.label = 7;
|
|
11765
|
-
case 7:
|
|
11766
|
-
resolve(resource);
|
|
11767
|
-
return [
|
|
11768
|
-
2
|
|
11769
|
-
];
|
|
11770
|
-
}
|
|
11771
|
-
});
|
|
11772
|
-
}));
|
|
11773
|
-
};
|
|
11774
|
-
_proto._handleEditorAsset = function _handleEditorAsset(buffer, reader, header, resourceManager) {
|
|
11775
|
-
return _async_to_generator(function() {
|
|
11776
|
-
var skeletonRawData, atlasRefId, type, engine, decoder, text, _JSON_parse, data, atlas, textureAtlas, skeletonData;
|
|
11777
|
-
return __generator(this, function(_state) {
|
|
11778
|
-
switch(_state.label){
|
|
11779
|
-
case 0:
|
|
11780
|
-
type = header.startsWith('spine:skel') ? 'skel' : 'json';
|
|
11781
|
-
engine = resourceManager.engine;
|
|
11782
|
-
if (type === 'skel') {
|
|
11783
|
-
atlasRefId = reader.nextStr();
|
|
11784
|
-
skeletonRawData = reader.nextImageData().buffer;
|
|
11785
|
-
} else {
|
|
11786
|
-
decoder = new TextDecoder('utf-8');
|
|
11787
|
-
text = decoder.decode(new Uint8Array(buffer));
|
|
11788
|
-
_JSON_parse = JSON.parse(text), data = _JSON_parse.data, atlas = _JSON_parse.atlas;
|
|
11789
|
-
atlasRefId = atlas.refId;
|
|
11790
|
-
skeletonRawData = data;
|
|
11791
|
-
}
|
|
11792
|
-
return [
|
|
11793
|
-
4,
|
|
11794
|
-
resourceManager.getResourceByRef({
|
|
11795
|
-
refId: atlasRefId
|
|
11796
|
-
})
|
|
11797
|
-
];
|
|
11798
|
-
case 1:
|
|
11799
|
-
textureAtlas = _state.sent();
|
|
11800
|
-
skeletonData = createSkeletonData(textureAtlas, skeletonRawData, type);
|
|
11801
|
-
return [
|
|
11802
|
-
2,
|
|
11803
|
-
new SkeletonDataResource(engine, skeletonData)
|
|
11804
|
-
];
|
|
11394
|
+
return new miniprogram.AssetPromise(function(resolve, reject) {
|
|
11395
|
+
var spineLoadContext = {
|
|
11396
|
+
fileName: "",
|
|
11397
|
+
skeletonRawData: "",
|
|
11398
|
+
spineAssetPath: {
|
|
11399
|
+
atlasPath: null,
|
|
11400
|
+
skeletonPath: null,
|
|
11401
|
+
extraPaths: []
|
|
11805
11402
|
}
|
|
11806
|
-
}
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
case 0:
|
|
11816
|
-
fileExtensions = (item.params || {}).fileExtensions;
|
|
11817
|
-
spineAssetBundle = {
|
|
11818
|
-
skeletonPath: '',
|
|
11819
|
-
skeletonExtension: '',
|
|
11820
|
-
atlasPath: '',
|
|
11821
|
-
imagePaths: [],
|
|
11822
|
-
imageExtensions: []
|
|
11823
|
-
};
|
|
11824
|
-
engine = resourceManager.engine;
|
|
11825
|
-
if (!buffer) return [
|
|
11826
|
-
3,
|
|
11827
|
-
2
|
|
11828
|
-
];
|
|
11829
|
-
fileExtension = SpineLoader.verifyFileExtensions(fileExtensions, false);
|
|
11830
|
-
SpineLoader.deriveAndAssignSpineAsset(item.url, fileExtension, spineAssetBundle);
|
|
11831
|
-
skeletonPath = spineAssetBundle.skeletonPath, atlasPath = spineAssetBundle.atlasPath;
|
|
11832
|
-
if (!skeletonPath || !atlasPath) {
|
|
11833
|
-
throw new Error('Failed to load spine assets. Please check the file path and ensure the file extension is included.');
|
|
11834
|
-
}
|
|
11835
|
-
return [
|
|
11836
|
-
4,
|
|
11837
|
-
loadTextureAtlas(atlasPath, engine)
|
|
11838
|
-
];
|
|
11839
|
-
case 1:
|
|
11840
|
-
textureAtlas = _state.sent();
|
|
11841
|
-
_this__determineSkeletonDataType = _this._determineSkeletonDataType(buffer), data = _this__determineSkeletonDataType.data, type = _this__determineSkeletonDataType.type;
|
|
11842
|
-
skeletonData = createSkeletonData(textureAtlas, data, type);
|
|
11843
|
-
return [
|
|
11844
|
-
2,
|
|
11845
|
-
new SkeletonDataResource(engine, skeletonData)
|
|
11846
|
-
];
|
|
11847
|
-
case 2:
|
|
11848
|
-
fileExtensions = SpineLoader.verifyFileExtensions(fileExtensions, true);
|
|
11849
|
-
for(i = 0; i < item.urls.length; i += 1){
|
|
11850
|
-
url = item.urls[i];
|
|
11851
|
-
extension = fileExtensions && fileExtensions[i] || null;
|
|
11852
|
-
SpineLoader.parseAndAssignSpineAsset(url, extension, spineAssetBundle);
|
|
11853
|
-
}
|
|
11854
|
-
skeletonPath1 = spineAssetBundle.skeletonPath, atlasPath1 = spineAssetBundle.atlasPath, imagePaths = spineAssetBundle.imagePaths, skeletonExtension = spineAssetBundle.skeletonExtension, imageExtensions = spineAssetBundle.imageExtensions;
|
|
11855
|
-
if (!skeletonPath1 || !atlasPath1) {
|
|
11856
|
-
throw new Error('Failed to load spine assets. Please check the file path and ensure the file extension is included.');
|
|
11857
|
-
}
|
|
11858
|
-
// @ts-ignore
|
|
11859
|
-
skeletonPromise = skeletonExtension === 'json' ? resourceManager._request(skeletonPath1, {
|
|
11860
|
-
type: 'text'
|
|
11861
|
-
}) : resourceManager._request(skeletonPath1, {
|
|
11862
|
-
type: 'arraybuffer'
|
|
11863
|
-
});
|
|
11864
|
-
type1 = skeletonExtension === 'json' ? 'json' : 'skel';
|
|
11865
|
-
loadQueue = [
|
|
11866
|
-
skeletonPromise
|
|
11867
|
-
];
|
|
11868
|
-
if (!(imagePaths.length > 0)) return [
|
|
11869
|
-
3,
|
|
11870
|
-
4
|
|
11871
|
-
];
|
|
11872
|
-
loadQueue = loadQueue.concat([
|
|
11873
|
-
// @ts-ignore
|
|
11874
|
-
resourceManager._request(atlasPath1, {
|
|
11875
|
-
type: 'text'
|
|
11876
|
-
}),
|
|
11877
|
-
loadTexturesByPath(imagePaths, imageExtensions, engine)
|
|
11878
|
-
]);
|
|
11879
|
-
return [
|
|
11880
|
-
4,
|
|
11881
|
-
Promise.all(loadQueue)
|
|
11882
|
-
];
|
|
11883
|
-
case 3:
|
|
11884
|
-
ref = _state.sent(), skeletonTextData = ref[0], atlasText = ref[1], textures = ref[2];
|
|
11885
|
-
textureAtlas1 = createTextureAtlas(atlasText, textures);
|
|
11886
|
-
return [
|
|
11887
|
-
3,
|
|
11888
|
-
6
|
|
11889
|
-
];
|
|
11890
|
-
case 4:
|
|
11891
|
-
loadQueue.push(loadTextureAtlas(atlasPath1, engine));
|
|
11892
|
-
return [
|
|
11893
|
-
4,
|
|
11894
|
-
Promise.all(loadQueue)
|
|
11895
|
-
];
|
|
11896
|
-
case 5:
|
|
11897
|
-
ref1 = _state.sent(), skeletonTextData = ref1[0], textureAtlas1 = ref1[1];
|
|
11898
|
-
_state.label = 6;
|
|
11899
|
-
case 6:
|
|
11900
|
-
skeletonData1 = createSkeletonData(textureAtlas1, skeletonTextData, type1);
|
|
11901
|
-
return [
|
|
11902
|
-
2,
|
|
11903
|
-
new SkeletonDataResource(engine, skeletonData1)
|
|
11904
|
-
];
|
|
11905
|
-
case 7:
|
|
11906
|
-
return [
|
|
11907
|
-
2
|
|
11908
|
-
];
|
|
11403
|
+
};
|
|
11404
|
+
var spineAssetPath = spineLoadContext.spineAssetPath;
|
|
11405
|
+
if (!item.urls) {
|
|
11406
|
+
SpineLoader._assignAssetPathsFromUrl(item.url, spineAssetPath, resourceManager);
|
|
11407
|
+
} else {
|
|
11408
|
+
var urls = item.urls;
|
|
11409
|
+
for(var i = 0, len = urls.length; i < len; i += 1){
|
|
11410
|
+
var url = urls[i];
|
|
11411
|
+
SpineLoader._groupAssetsByExtension(url, spineAssetPath);
|
|
11909
11412
|
}
|
|
11910
|
-
}
|
|
11911
|
-
|
|
11413
|
+
}
|
|
11414
|
+
var skeletonPath = spineAssetPath.skeletonPath, atlasPath = spineAssetPath.atlasPath;
|
|
11415
|
+
if (!skeletonPath || !atlasPath) {
|
|
11416
|
+
reject(new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included."));
|
|
11417
|
+
return;
|
|
11418
|
+
}
|
|
11419
|
+
resourceManager// @ts-ignore
|
|
11420
|
+
._request(skeletonPath, {
|
|
11421
|
+
type: "arraybuffer"
|
|
11422
|
+
}).then(function(skeletonRawData) {
|
|
11423
|
+
spineLoadContext.skeletonRawData = skeletonRawData;
|
|
11424
|
+
var skeletonString = SpineLoader._decoder.decode(skeletonRawData);
|
|
11425
|
+
if (skeletonString.startsWith("{")) {
|
|
11426
|
+
spineLoadContext.skeletonRawData = skeletonString;
|
|
11427
|
+
}
|
|
11428
|
+
return _this._loadAndCreateSpineResource(spineLoadContext, resourceManager);
|
|
11429
|
+
}).then(resolve).catch(reject);
|
|
11430
|
+
});
|
|
11912
11431
|
};
|
|
11913
|
-
_proto.
|
|
11914
|
-
var
|
|
11915
|
-
var
|
|
11916
|
-
|
|
11917
|
-
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
|
-
|
|
11924
|
-
type
|
|
11925
|
-
}
|
|
11926
|
-
return {
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
};
|
|
11432
|
+
_proto._loadAndCreateSpineResource = function _loadAndCreateSpineResource(spineLoadContext, resourceManager) {
|
|
11433
|
+
var engine = resourceManager.engine;
|
|
11434
|
+
var skeletonRawData = spineLoadContext.skeletonRawData, spineAssetPath = spineLoadContext.spineAssetPath;
|
|
11435
|
+
var skeletonPath = spineAssetPath.skeletonPath, atlasPath = spineAssetPath.atlasPath, extraPaths = spineAssetPath.extraPaths;
|
|
11436
|
+
var atlasLoadPromise = extraPaths.length === 0 ? resourceManager.load({
|
|
11437
|
+
url: atlasPath,
|
|
11438
|
+
type: "SpineAtlas"
|
|
11439
|
+
}) : resourceManager.load({
|
|
11440
|
+
urls: [
|
|
11441
|
+
atlasPath
|
|
11442
|
+
].concat(extraPaths),
|
|
11443
|
+
type: "SpineAtlas"
|
|
11444
|
+
});
|
|
11445
|
+
return atlasLoadPromise.then(function(textureAtlas) {
|
|
11446
|
+
var skeletonData = LoaderUtils.createSkeletonData(skeletonRawData, textureAtlas, 0.01);
|
|
11447
|
+
return new SpineResource(engine, skeletonData, skeletonPath);
|
|
11448
|
+
});
|
|
11930
11449
|
};
|
|
11931
|
-
SpineLoader.
|
|
11932
|
-
var
|
|
11933
|
-
var ext = SpineLoader.getUrlExtension(url, fileExtension);
|
|
11450
|
+
SpineLoader._groupAssetsByExtension = function _groupAssetsByExtension(url, assetPath) {
|
|
11451
|
+
var ext = SpineLoader._getUrlExtension(url);
|
|
11934
11452
|
if (!ext) return;
|
|
11935
|
-
if (
|
|
11936
|
-
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
}
|
|
11942
|
-
|
|
11943
|
-
|
|
11944
|
-
|
|
11453
|
+
if ([
|
|
11454
|
+
"skel",
|
|
11455
|
+
"json",
|
|
11456
|
+
"bin"
|
|
11457
|
+
].includes(ext)) {
|
|
11458
|
+
assetPath.skeletonPath = url;
|
|
11459
|
+
} else if (ext === "atlas") {
|
|
11460
|
+
assetPath.atlasPath = url;
|
|
11461
|
+
} else {
|
|
11462
|
+
assetPath.extraPaths.push(url);
|
|
11945
11463
|
}
|
|
11946
11464
|
};
|
|
11947
|
-
SpineLoader.
|
|
11948
|
-
var
|
|
11465
|
+
SpineLoader._assignAssetPathsFromUrl = function _assignAssetPathsFromUrl(url, assetPath, resourceManager) {
|
|
11466
|
+
var _resourceManager__virtualPathResourceMap_url, _resourceManager__virtualPathResourceMap;
|
|
11467
|
+
var ext = SpineLoader._getUrlExtension(url);
|
|
11949
11468
|
if (!ext) return;
|
|
11950
|
-
|
|
11951
|
-
|
|
11952
|
-
var
|
|
11953
|
-
|
|
11954
|
-
|
|
11955
|
-
|
|
11956
|
-
|
|
11957
|
-
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
|
|
11964
|
-
|
|
11965
|
-
console.error('Expect fileExtensions to be an array.');
|
|
11966
|
-
return [];
|
|
11967
|
-
} else if (!expectArray && typeof fileExtensions !== 'string') {
|
|
11968
|
-
console.error('Expect fileExtensions to be a string.');
|
|
11969
|
-
return null;
|
|
11469
|
+
assetPath.skeletonPath = url;
|
|
11470
|
+
// @ts-ignore
|
|
11471
|
+
var skeletonDependency = resourceManager == null ? void 0 : (_resourceManager__virtualPathResourceMap = resourceManager._virtualPathResourceMap) == null ? void 0 : (_resourceManager__virtualPathResourceMap_url = _resourceManager__virtualPathResourceMap[url]) == null ? void 0 : _resourceManager__virtualPathResourceMap_url.dependentAssetMap;
|
|
11472
|
+
if (skeletonDependency) {
|
|
11473
|
+
assetPath.atlasPath = skeletonDependency.atlas;
|
|
11474
|
+
} else {
|
|
11475
|
+
var extensionPattern = /\.(json|bin|skel)$/;
|
|
11476
|
+
var baseUrl;
|
|
11477
|
+
if (extensionPattern.test(url)) {
|
|
11478
|
+
baseUrl = url.replace(extensionPattern, "");
|
|
11479
|
+
}
|
|
11480
|
+
if (baseUrl) {
|
|
11481
|
+
var atlasUrl = baseUrl + ".atlas";
|
|
11482
|
+
assetPath.atlasPath = atlasUrl;
|
|
11483
|
+
}
|
|
11970
11484
|
}
|
|
11971
|
-
return fileExtensions;
|
|
11972
11485
|
};
|
|
11973
|
-
SpineLoader.
|
|
11974
|
-
|
|
11975
|
-
return fileExtension;
|
|
11976
|
-
}
|
|
11977
|
-
var regex = /\/([^\/?#]+)\.([a-zA-Z0-9]+)(\?|#|$)|\?[^#]*\.([a-zA-Z0-9]+)(\?|#|$)/;
|
|
11486
|
+
SpineLoader._getUrlExtension = function _getUrlExtension(url) {
|
|
11487
|
+
var regex = /\.(\w+)(\?|$)/;
|
|
11978
11488
|
var match = url.match(regex);
|
|
11979
|
-
|
|
11980
|
-
return match[2] || match[4];
|
|
11981
|
-
}
|
|
11982
|
-
return null;
|
|
11489
|
+
return match ? match[1] : null;
|
|
11983
11490
|
};
|
|
11984
11491
|
return SpineLoader;
|
|
11985
11492
|
}(miniprogram.Loader);
|
|
11986
|
-
SpineLoader.
|
|
11987
|
-
"png",
|
|
11988
|
-
"jpg",
|
|
11989
|
-
"webp",
|
|
11990
|
-
"jpeg",
|
|
11991
|
-
"ktx",
|
|
11992
|
-
"ktx2"
|
|
11993
|
-
];
|
|
11994
|
-
SpineLoader.skeletonExtensions = [
|
|
11995
|
-
"skel",
|
|
11996
|
-
"json",
|
|
11997
|
-
"bin"
|
|
11998
|
-
];
|
|
11493
|
+
SpineLoader._decoder = new TextDecoder("utf-8");
|
|
11999
11494
|
SpineLoader = __decorate([
|
|
12000
|
-
miniprogram.resourceLoader("
|
|
11495
|
+
miniprogram.resourceLoader("Spine", [
|
|
12001
11496
|
"json",
|
|
12002
11497
|
"bin",
|
|
12003
11498
|
"skel"
|
|
12004
11499
|
])
|
|
12005
11500
|
], SpineLoader);
|
|
11501
|
+
var DeprecatedSpineLoader = /*#__PURE__*/ function(SpineLoader) {
|
|
11502
|
+
_inherits(DeprecatedSpineLoader, SpineLoader);
|
|
11503
|
+
function DeprecatedSpineLoader() {
|
|
11504
|
+
return SpineLoader.apply(this, arguments) || this;
|
|
11505
|
+
}
|
|
11506
|
+
return DeprecatedSpineLoader;
|
|
11507
|
+
}(SpineLoader);
|
|
11508
|
+
DeprecatedSpineLoader = __decorate([
|
|
11509
|
+
miniprogram.resourceLoader("spine", [
|
|
11510
|
+
"json",
|
|
11511
|
+
"bin",
|
|
11512
|
+
"skel"
|
|
11513
|
+
])
|
|
11514
|
+
], DeprecatedSpineLoader);
|
|
12006
11515
|
|
|
12007
|
-
var
|
|
12008
|
-
_inherits(
|
|
12009
|
-
function
|
|
11516
|
+
var SpineAtlasLoader = /*#__PURE__*/ function(Loader) {
|
|
11517
|
+
_inherits(SpineAtlasLoader, Loader);
|
|
11518
|
+
function SpineAtlasLoader() {
|
|
12010
11519
|
return Loader.apply(this, arguments) || this;
|
|
12011
11520
|
}
|
|
12012
|
-
var _proto =
|
|
11521
|
+
var _proto = SpineAtlasLoader.prototype;
|
|
12013
11522
|
_proto.load = function load(item, resourceManager) {
|
|
12014
|
-
return new miniprogram.AssetPromise(
|
|
12015
|
-
var
|
|
12016
|
-
|
|
12017
|
-
|
|
12018
|
-
|
|
12019
|
-
|
|
12020
|
-
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
|
|
12025
|
-
|
|
12026
|
-
|
|
12027
|
-
|
|
11523
|
+
return new miniprogram.AssetPromise(function(resolve, reject) {
|
|
11524
|
+
var engine = resourceManager.engine;
|
|
11525
|
+
var spineAtlasAsset = {
|
|
11526
|
+
atlasPath: "",
|
|
11527
|
+
imagePaths: [],
|
|
11528
|
+
imageExtensions: []
|
|
11529
|
+
};
|
|
11530
|
+
if (!item.urls) {
|
|
11531
|
+
SpineAtlasLoader._assignAssetPathsFromUrl(item.url, spineAtlasAsset, resourceManager);
|
|
11532
|
+
} else {
|
|
11533
|
+
var urls = item.urls;
|
|
11534
|
+
for(var i = 0, len = urls.length; i < len; i += 1){
|
|
11535
|
+
var url = urls[i];
|
|
11536
|
+
SpineAtlasLoader._groupAssetsByExtension(url, spineAtlasAsset, resourceManager);
|
|
11537
|
+
}
|
|
11538
|
+
}
|
|
11539
|
+
var atlasPath = spineAtlasAsset.atlasPath;
|
|
11540
|
+
if (!atlasPath) {
|
|
11541
|
+
reject(new Error("Failed to load spine atlas. Please check the file path and ensure the file extension is included."));
|
|
11542
|
+
return;
|
|
11543
|
+
}
|
|
11544
|
+
var imagePaths = spineAtlasAsset.imagePaths;
|
|
11545
|
+
if (imagePaths.length === 0) {
|
|
11546
|
+
var atlasPath1 = item.url;
|
|
11547
|
+
LoaderUtils.loadTextureAtlas(atlasPath1, engine, reject).then(function(textureAtlas) {
|
|
11548
|
+
resolve(textureAtlas);
|
|
11549
|
+
}).catch(function(err) {
|
|
11550
|
+
reject(err);
|
|
11551
|
+
});
|
|
11552
|
+
} else {
|
|
11553
|
+
var atlasPath2 = spineAtlasAsset.atlasPath, imagePaths1 = spineAtlasAsset.imagePaths, imageExtensions = spineAtlasAsset.imageExtensions;
|
|
11554
|
+
if (imagePaths1.length > 0) {
|
|
11555
|
+
Promise.all([
|
|
12028
11556
|
// @ts-ignore
|
|
12029
|
-
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
|
|
12033
|
-
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
|
|
12038
|
-
|
|
12039
|
-
|
|
12040
|
-
|
|
11557
|
+
resourceManager._request(atlasPath2, {
|
|
11558
|
+
type: "text"
|
|
11559
|
+
}),
|
|
11560
|
+
LoaderUtils.loadTexturesByPaths(imagePaths1, imageExtensions, engine, reject)
|
|
11561
|
+
]).then(function(param) {
|
|
11562
|
+
var atlasText = param[0], textures = param[1];
|
|
11563
|
+
var textureAtlas = LoaderUtils.createTextureAtlas(atlasText, textures);
|
|
11564
|
+
resolve(textureAtlas);
|
|
11565
|
+
}).catch(function(err) {
|
|
11566
|
+
reject(err);
|
|
11567
|
+
});
|
|
11568
|
+
} else {
|
|
11569
|
+
LoaderUtils.loadTextureAtlas(atlasPath2, engine, reject).then(function(textureAtlas) {
|
|
12041
11570
|
resolve(textureAtlas);
|
|
12042
|
-
|
|
12043
|
-
|
|
12044
|
-
|
|
11571
|
+
}).catch(function(err) {
|
|
11572
|
+
reject(err);
|
|
11573
|
+
});
|
|
12045
11574
|
}
|
|
12046
|
-
}
|
|
12047
|
-
})
|
|
11575
|
+
}
|
|
11576
|
+
});
|
|
11577
|
+
};
|
|
11578
|
+
SpineAtlasLoader._groupAssetsByExtension = function _groupAssetsByExtension(url, assetPath, resourceManager) {
|
|
11579
|
+
var ext = SpineLoader._getUrlExtension(url);
|
|
11580
|
+
if (!ext) return;
|
|
11581
|
+
if (ext === "atlas") {
|
|
11582
|
+
assetPath.atlasPath = url;
|
|
11583
|
+
}
|
|
11584
|
+
if ([
|
|
11585
|
+
"png",
|
|
11586
|
+
"jpg",
|
|
11587
|
+
"webp",
|
|
11588
|
+
"jpeg",
|
|
11589
|
+
"ktx",
|
|
11590
|
+
"ktx2"
|
|
11591
|
+
].includes(ext)) {
|
|
11592
|
+
assetPath.imagePaths.push(url);
|
|
11593
|
+
}
|
|
11594
|
+
};
|
|
11595
|
+
SpineAtlasLoader._assignAssetPathsFromUrl = function _assignAssetPathsFromUrl(url, assetPath, resourceManager) {
|
|
11596
|
+
var ext = SpineLoader._getUrlExtension(url);
|
|
11597
|
+
if (ext === "atlas") {
|
|
11598
|
+
var _resourceManager__virtualPathResourceMap_url, _resourceManager__virtualPathResourceMap;
|
|
11599
|
+
assetPath.atlasPath = url;
|
|
11600
|
+
// @ts-ignore
|
|
11601
|
+
var atlasDependency = resourceManager == null ? void 0 : (_resourceManager__virtualPathResourceMap = resourceManager._virtualPathResourceMap) == null ? void 0 : (_resourceManager__virtualPathResourceMap_url = _resourceManager__virtualPathResourceMap[url]) == null ? void 0 : _resourceManager__virtualPathResourceMap_url.dependentAssetMap;
|
|
11602
|
+
if (atlasDependency) {
|
|
11603
|
+
for(var key in atlasDependency){
|
|
11604
|
+
var imageVirtualPath = atlasDependency[key];
|
|
11605
|
+
assetPath.imagePaths.push(imageVirtualPath);
|
|
11606
|
+
}
|
|
11607
|
+
}
|
|
11608
|
+
}
|
|
12048
11609
|
};
|
|
12049
|
-
return
|
|
11610
|
+
return SpineAtlasLoader;
|
|
12050
11611
|
}(miniprogram.Loader);
|
|
12051
|
-
|
|
12052
|
-
miniprogram.resourceLoader("
|
|
11612
|
+
SpineAtlasLoader = __decorate([
|
|
11613
|
+
miniprogram.resourceLoader("SpineAtlas", [
|
|
12053
11614
|
"atlas"
|
|
12054
11615
|
])
|
|
12055
|
-
],
|
|
11616
|
+
], SpineAtlasLoader);
|
|
11617
|
+
|
|
11618
|
+
var LoaderObject = /*#__PURE__*/Object.freeze({
|
|
11619
|
+
__proto__: null,
|
|
11620
|
+
SpineResource: SpineResource,
|
|
11621
|
+
LoaderUtils: LoaderUtils
|
|
11622
|
+
});
|
|
12056
11623
|
|
|
12057
|
-
var
|
|
12058
|
-
|
|
11624
|
+
var RendererObject = /*#__PURE__*/Object.freeze({
|
|
11625
|
+
__proto__: null,
|
|
11626
|
+
SpineAnimationRenderer: SpineAnimationRenderer,
|
|
11627
|
+
SpineMaterial: SpineMaterial
|
|
11628
|
+
});
|
|
11629
|
+
|
|
11630
|
+
for(var key in RendererObject){
|
|
11631
|
+
miniprogram.Loader.registerClass(key, RendererObject[key]);
|
|
11632
|
+
}
|
|
11633
|
+
for(var key1 in LoaderObject){
|
|
11634
|
+
miniprogram.Loader.registerClass(key1, LoaderObject[key1]);
|
|
11635
|
+
}
|
|
11636
|
+
var version = "4.2.1-alpha.0";
|
|
12059
11637
|
console.log("Galacean spine version: " + version);
|
|
12060
11638
|
|
|
12061
11639
|
exports.AlphaTimeline = AlphaTimeline;
|
|
@@ -12097,6 +11675,7 @@ exports.IkConstraintTimeline = IkConstraintTimeline;
|
|
|
12097
11675
|
exports.InheritTimeline = InheritTimeline;
|
|
12098
11676
|
exports.IntSet = IntSet;
|
|
12099
11677
|
exports.Interpolation = Interpolation;
|
|
11678
|
+
exports.LoaderUtils = LoaderUtils;
|
|
12100
11679
|
exports.MathUtils = MathUtils;
|
|
12101
11680
|
exports.MeshAttachment = MeshAttachment;
|
|
12102
11681
|
exports.PathAttachment = PathAttachment;
|
|
@@ -12138,13 +11717,14 @@ exports.SkeletonBinary = SkeletonBinary;
|
|
|
12138
11717
|
exports.SkeletonBounds = SkeletonBounds;
|
|
12139
11718
|
exports.SkeletonClipping = SkeletonClipping;
|
|
12140
11719
|
exports.SkeletonData = SkeletonData;
|
|
12141
|
-
exports.SkeletonDataResource = SkeletonDataResource;
|
|
12142
11720
|
exports.SkeletonJson = SkeletonJson;
|
|
12143
11721
|
exports.Skin = Skin;
|
|
12144
11722
|
exports.SkinEntry = SkinEntry;
|
|
12145
11723
|
exports.Slot = Slot;
|
|
12146
11724
|
exports.SlotData = SlotData;
|
|
12147
11725
|
exports.SpineAnimationRenderer = SpineAnimationRenderer;
|
|
11726
|
+
exports.SpineMaterial = SpineMaterial;
|
|
11727
|
+
exports.SpineResource = SpineResource;
|
|
12148
11728
|
exports.StringSet = StringSet;
|
|
12149
11729
|
exports.Texture = Texture;
|
|
12150
11730
|
exports.TextureAtlas = TextureAtlas;
|
|
@@ -12165,5 +11745,4 @@ exports.Utils = Utils;
|
|
|
12165
11745
|
exports.Vector2 = Vector2;
|
|
12166
11746
|
exports.VertexAttachment = VertexAttachment;
|
|
12167
11747
|
exports.WindowedMean = WindowedMean;
|
|
12168
|
-
exports.createTextureAtlas = createTextureAtlas;
|
|
12169
11748
|
exports.version = version;
|