@galacean/effects-plugin-spine 2.6.5 → 2.7.0-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/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.6.5
6
+ * Version: v2.7.0-alpha.0
7
7
  */
8
8
 
9
9
  import * as EFFECTS from '@galacean/effects';
10
- import { assertExist, glContext, Mesh, Geometry, Material, math, setMaskMode, GLSLVersion, PLAYER_OPTIONS_ENV_EDITOR, serialize, effectsClass, spec, MaskProcessor, MaskMode, HitTestType, RendererComponent, registerPlugin, VFXItem, logger, AbstractPlugin } from '@galacean/effects';
10
+ import { assertExist, glContext, Mesh, Geometry, Material, setMaskMode, GLSLVersion, PLAYER_OPTIONS_ENV_EDITOR, math, serialize, effectsClass, spec, MaskProcessor, MaskMode, HitTestType, RendererComponent, registerPlugin, VFXItem, logger, AbstractPlugin } from '@galacean/effects';
11
11
 
12
12
  function _set_prototype_of(o, p) {
13
13
  _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
@@ -10678,7 +10678,7 @@ typeof SuppressedError === "function" ? SuppressedError : function _SuppressedEr
10678
10678
 
10679
10679
  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;}";
10680
10680
 
10681
- var vs = "attribute vec2 aPosition;attribute vec4 aColor;attribute vec4 aColor2;attribute vec2 aTexCoords;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec2 _Size;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvarying vec4 vLight;varying vec4 vDark;varying vec2 vTexCoords;void main(){vLight=aColor;vDark=aColor2;vTexCoords=aTexCoords;gl_Position=effects_MatrixVP*effects_ObjectToWorld*vec4(aPosition*_Size,0.0,1.0);\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}";
10681
+ var vs = "attribute vec2 aPosition;attribute vec4 aColor;attribute vec4 aColor2;attribute vec2 aTexCoords;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=aTexCoords;gl_Position=effects_MatrixVP*effects_ObjectToWorld*vec4(aPosition*_Size,0.0,1.0);}";
10682
10682
 
10683
10683
  var seed = 1;
10684
10684
  var SpineMesh = /*#__PURE__*/ function() {
@@ -10744,14 +10744,9 @@ var SpineMesh = /*#__PURE__*/ function() {
10744
10744
  };
10745
10745
  _proto.createMaterial = function createMaterial(maskMode, maskOrder) {
10746
10746
  var material = Material.create(this.engine, {
10747
- shader: createShader(this.engine),
10748
- uniformSemantics: {
10749
- effects_MatrixVP: "VIEWPROJECTION",
10750
- uEditorTransform: "EDITOR_TRANSFORM"
10751
- }
10747
+ shader: createShader(this.engine)
10752
10748
  });
10753
10749
  material.setTexture("uTexture", this.lastTexture);
10754
- material.setMatrix("effects_ObjectToWorld", math.Matrix4.fromIdentity());
10755
10750
  material.blending = true;
10756
10751
  material.culling = false;
10757
10752
  material.depthTest = false;
@@ -10791,7 +10786,6 @@ var SpineMesh = /*#__PURE__*/ function() {
10791
10786
  this.geometry.setAttributeData("aPosition", this.vertices);
10792
10787
  this.geometry.setIndexData(this.indices);
10793
10788
  this.geometry.setDrawCount(this.indicesLength);
10794
- this.material.setMatrix("effects_ObjectToWorld", worldMatrix);
10795
10789
  };
10796
10790
  _proto.startUpdate = function startUpdate() {
10797
10791
  this.verticesLength = 0;
@@ -11240,6 +11234,12 @@ var SpineComponent = /*#__PURE__*/ function(RendererComponent) {
11240
11234
  var p1 = new Vector3(centerX + width / 2, centerY - height / 2, 0);
11241
11235
  var p2 = new Vector3(centerX + width / 2, centerY + height / 2, 0);
11242
11236
  var p3 = new Vector3(centerX - width / 2, centerY + height / 2, 0);
11237
+ // TODO: 优化 Spine 初始大小逻辑
11238
+ var startSizeScaleFactor = this.startSize * this.scaleFactor;
11239
+ p0.multiply(startSizeScaleFactor);
11240
+ p1.multiply(startSizeScaleFactor);
11241
+ p2.multiply(startSizeScaleFactor);
11242
+ p3.multiply(startSizeScaleFactor);
11243
11243
  wm.projectPoint(p0);
11244
11244
  wm.projectPoint(p1);
11245
11245
  wm.projectPoint(p2);
@@ -11535,7 +11535,7 @@ registerPlugin("spine", /*#__PURE__*/ function(AbstractPlugin) {
11535
11535
  }(AbstractPlugin), VFXItem);
11536
11536
  /**
11537
11537
  * 插件版本号
11538
- */ var version = "2.6.5";
11538
+ */ var version = "2.7.0-alpha.0";
11539
11539
  logger.info("Plugin spine version: " + version + ".");
11540
11540
  if (version !== EFFECTS.version) {
11541
11541
  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!");