@galacean/effects-plugin-spine 2.10.0-alpha.0 → 2.10.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alipay.js +1 -1
- package/dist/alipay.js.map +1 -1
- package/dist/alipay.mjs +1 -1
- package/dist/alipay.mjs.map +1 -1
- package/dist/douyin.js +1 -1
- package/dist/douyin.js.map +1 -1
- package/dist/douyin.mjs +1 -1
- package/dist/douyin.mjs.map +1 -1
- package/dist/index.js +33 -46
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +34 -47
- package/dist/index.mjs.map +1 -1
- package/dist/slot-group.d.ts +0 -8
- package/dist/spine-component.d.ts +11 -5
- package/dist/spine-mesh.d.ts +1 -5
- package/dist/weapp.js +1 -1
- package/dist/weapp.js.map +1 -1
- package/dist/weapp.mjs +1 -1
- package/dist/weapp.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Description: Galacean Effects player spine plugin
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 十弦
|
|
6
|
-
* Version: v2.10.0-alpha.
|
|
6
|
+
* Version: v2.10.0-alpha.2
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as EFFECTS from '@galacean/effects';
|
|
10
|
-
import { assertExist, glContext, Mesh, Geometry, Material, GLSLVersion, PLAYER_OPTIONS_ENV_EDITOR, math, serialize, effectsClass, spec,
|
|
10
|
+
import { assertExist, glContext, Mesh, VertexBuffer, Geometry, Material, GLSLVersion, PLAYER_OPTIONS_ENV_EDITOR, math, serialize, effectsClass, spec, HitTestType, RendererComponent, Plugin, registerPlugin, logger } from '@galacean/effects';
|
|
11
11
|
|
|
12
12
|
function _set_prototype_of(o, p) {
|
|
13
13
|
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
@@ -10746,21 +10746,20 @@ typeof SuppressedError === "function" ? SuppressedError : function _SuppressedEr
|
|
|
10746
10746
|
|
|
10747
10747
|
var fs = "precision mediump float;varying mediump vec4 vLight;varying mediump vec4 vDark;varying vec2 vTexCoords;uniform sampler2D uTexture;void main(){vec4 texColor=texture2D(uTexture,vTexCoords);gl_FragColor.a=texColor.a*vLight.a;gl_FragColor.rgb=((texColor.a-1.0)*vDark.a+1.0-texColor.rgb)*vDark.rgb+texColor.rgb*vLight.rgb;gl_FragColor.rgb*=gl_FragColor.a;}";
|
|
10748
10748
|
|
|
10749
|
-
var vs = "attribute vec2
|
|
10749
|
+
var vs = "attribute vec2 aPos;attribute vec4 aColor;attribute vec4 aColor2;attribute vec2 aUV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec2 _Size;varying vec4 vLight;varying vec4 vDark;varying vec2 vTexCoords;void main(){vLight=aColor;vDark=aColor2;vTexCoords=aUV;gl_Position=effects_MatrixVP*effects_ObjectToWorld*vec4(aPos*_Size,0.0,1.0);}";
|
|
10750
10750
|
|
|
10751
10751
|
var seed = 1;
|
|
10752
10752
|
var SpineMesh = /*#__PURE__*/ function() {
|
|
10753
10753
|
function SpineMesh(renderInfo) {
|
|
10754
10754
|
this.verticesLength = 0;
|
|
10755
10755
|
this.indicesLength = 0;
|
|
10756
|
-
var blendMode = renderInfo.blendMode, texture = renderInfo.texture, priority = renderInfo.priority,
|
|
10757
|
-
var _renderOptions_mask = renderOptions.mask, mask = _renderOptions_mask === void 0 ? 0 : _renderOptions_mask, _renderOptions_maskMode = renderOptions.maskMode, maskMode = _renderOptions_maskMode === void 0 ? 0 : _renderOptions_maskMode;
|
|
10756
|
+
var blendMode = renderInfo.blendMode, texture = renderInfo.texture, priority = renderInfo.priority, _renderInfo_name = renderInfo.name, name = _renderInfo_name === void 0 ? "MSpine" : _renderInfo_name, engine = renderInfo.engine;
|
|
10758
10757
|
this.blendMode = blendMode;
|
|
10759
10758
|
this.lastTexture = texture;
|
|
10760
10759
|
this.priority = priority;
|
|
10761
10760
|
this.engine = engine;
|
|
10762
10761
|
this.geometry = this.createGeometry();
|
|
10763
|
-
this.material = this.createMaterial(
|
|
10762
|
+
this.material = this.createMaterial();
|
|
10764
10763
|
this.mesh = Mesh.create(engine, {
|
|
10765
10764
|
name: name + seed++,
|
|
10766
10765
|
priority: this.priority,
|
|
@@ -10774,43 +10773,39 @@ var SpineMesh = /*#__PURE__*/ function() {
|
|
|
10774
10773
|
_proto.createGeometry = function createGeometry() {
|
|
10775
10774
|
var BYTES_PER_ELEMENT = Float32Array.BYTES_PER_ELEMENT;
|
|
10776
10775
|
var stride = BYTES_PER_ELEMENT * SlotGroup.VERTEX_SIZE;
|
|
10777
|
-
var
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
stride: stride,
|
|
10800
|
-
dataSource: "aPosition"
|
|
10801
|
-
}
|
|
10802
|
-
};
|
|
10776
|
+
var _obj;
|
|
10777
|
+
var attributes = (_obj = {}, _obj[VertexBuffer.PositionKind] = {
|
|
10778
|
+
size: 2,
|
|
10779
|
+
offset: 0,
|
|
10780
|
+
stride: stride,
|
|
10781
|
+
data: new Float32Array(0)
|
|
10782
|
+
}, _obj[VertexBuffer.ColorKind] = {
|
|
10783
|
+
size: 4,
|
|
10784
|
+
offset: 2 * BYTES_PER_ELEMENT,
|
|
10785
|
+
stride: stride,
|
|
10786
|
+
dataSource: VertexBuffer.PositionKind
|
|
10787
|
+
}, _obj[VertexBuffer.UVKind] = {
|
|
10788
|
+
size: 2,
|
|
10789
|
+
offset: 6 * BYTES_PER_ELEMENT,
|
|
10790
|
+
stride: stride,
|
|
10791
|
+
dataSource: VertexBuffer.PositionKind
|
|
10792
|
+
}, _obj.aColor2 = {
|
|
10793
|
+
size: 4,
|
|
10794
|
+
offset: 8 * BYTES_PER_ELEMENT,
|
|
10795
|
+
stride: stride,
|
|
10796
|
+
dataSource: VertexBuffer.PositionKind
|
|
10797
|
+
}, _obj);
|
|
10803
10798
|
return Geometry.create(this.engine, {
|
|
10804
10799
|
attributes: attributes,
|
|
10805
10800
|
indices: {
|
|
10806
|
-
data: new Uint16Array(0)
|
|
10807
|
-
releasable: true
|
|
10801
|
+
data: new Uint16Array(0)
|
|
10808
10802
|
},
|
|
10809
10803
|
mode: glContext.TRIANGLES,
|
|
10810
|
-
maxVertex: SlotGroup.MAX_VERTICES
|
|
10804
|
+
maxVertex: SlotGroup.MAX_VERTICES,
|
|
10805
|
+
bufferUsage: glContext.DYNAMIC_DRAW
|
|
10811
10806
|
});
|
|
10812
10807
|
};
|
|
10813
|
-
_proto.createMaterial = function createMaterial(
|
|
10808
|
+
_proto.createMaterial = function createMaterial() {
|
|
10814
10809
|
var material = Material.create(this.engine, {
|
|
10815
10810
|
shader: createShader(this.engine)
|
|
10816
10811
|
});
|
|
@@ -10846,7 +10841,7 @@ var SpineMesh = /*#__PURE__*/ function() {
|
|
|
10846
10841
|
for(var i1 = this.indicesLength; i1 < this.indices.length; i1++){
|
|
10847
10842
|
this.indices[i1] = 0;
|
|
10848
10843
|
}
|
|
10849
|
-
this.geometry.setAttributeData(
|
|
10844
|
+
this.geometry.setAttributeData(VertexBuffer.PositionKind, this.vertices);
|
|
10850
10845
|
this.geometry.setIndexData(this.indices);
|
|
10851
10846
|
this.geometry.setDrawCount(this.indicesLength);
|
|
10852
10847
|
};
|
|
@@ -10923,7 +10918,6 @@ var SlotGroup = /*#__PURE__*/ function() {
|
|
|
10923
10918
|
this.transform = props.transform;
|
|
10924
10919
|
this.listIndex = props.listIndex;
|
|
10925
10920
|
this.pma = props.pma;
|
|
10926
|
-
this.renderOptions = props.renderOptions;
|
|
10927
10921
|
this.engine = props.engine;
|
|
10928
10922
|
}
|
|
10929
10923
|
var _proto = SlotGroup.prototype;
|
|
@@ -11056,7 +11050,6 @@ var SlotGroup = /*#__PURE__*/ function() {
|
|
|
11056
11050
|
texture: texture,
|
|
11057
11051
|
name: this.meshName,
|
|
11058
11052
|
priority: this.listIndex += 0.01,
|
|
11059
|
-
renderOptions: this.renderOptions,
|
|
11060
11053
|
engine: this.engine
|
|
11061
11054
|
});
|
|
11062
11055
|
currentIndex = this.meshGroups.length;
|
|
@@ -11140,16 +11133,11 @@ var SpineComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
11140
11133
|
this.options = data.options;
|
|
11141
11134
|
this.rendererOptions = _extends({
|
|
11142
11135
|
renderMode: spec.RenderMode.MESH
|
|
11143
|
-
}, data.renderer || {}
|
|
11144
|
-
mask: 0,
|
|
11145
|
-
maskMode: MaskMode.NONE
|
|
11146
|
-
});
|
|
11136
|
+
}, data.renderer || {});
|
|
11147
11137
|
this.item.getHitTestParams = this.getHitTestParams.bind(this);
|
|
11148
11138
|
if (data.mask) {
|
|
11149
11139
|
this.maskManager.setMaskOptions(this.engine, data.mask);
|
|
11150
11140
|
}
|
|
11151
|
-
this.rendererOptions.maskMode = this.maskManager.maskMode;
|
|
11152
|
-
this.rendererOptions.mask = this.maskManager.getRefValue();
|
|
11153
11141
|
// 兼容编辑器逻辑
|
|
11154
11142
|
if (!this.resource || !Object.keys(this.resource).length) {
|
|
11155
11143
|
return;
|
|
@@ -11273,7 +11261,6 @@ var SpineComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
11273
11261
|
meshName: this.name,
|
|
11274
11262
|
transform: this.transform,
|
|
11275
11263
|
pma: this.pma,
|
|
11276
|
-
renderOptions: this.rendererOptions,
|
|
11277
11264
|
engine: this.engine
|
|
11278
11265
|
});
|
|
11279
11266
|
};
|
|
@@ -11599,7 +11586,7 @@ var SpineLoader = /*#__PURE__*/ function(Plugin) {
|
|
|
11599
11586
|
registerPlugin("spine", SpineLoader);
|
|
11600
11587
|
/**
|
|
11601
11588
|
* 插件版本号
|
|
11602
|
-
*/ var version = "2.10.0-alpha.
|
|
11589
|
+
*/ var version = "2.10.0-alpha.2";
|
|
11603
11590
|
logger.info("Plugin spine version: " + version + ".");
|
|
11604
11591
|
if (version !== EFFECTS.version) {
|
|
11605
11592
|
console.error("注意:请统一 Spine 插件与 Player 版本,不统一的版本混用会有不可预知的后果!", "\nAttention: Please ensure the Spine plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!");
|