@galacean/effects-plugin-spine 2.8.8 → 2.9.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.8.8
6
+ * Version: v2.9.0-alpha.0
7
7
  */
8
8
 
9
9
  import * as EFFECTS from '@galacean/effects';
10
- import { assertExist, glContext, Mesh, Geometry, Material, setMaskMode, GLSLVersion, PLAYER_OPTIONS_ENV_EDITOR, math, serialize, effectsClass, spec, MaskProcessor, MaskMode, HitTestType, RendererComponent, Plugin, registerPlugin, logger } from '@galacean/effects';
10
+ import { assertExist, glContext, Mesh, Geometry, Material, GLSLVersion, PLAYER_OPTIONS_ENV_EDITOR, math, serialize, effectsClass, spec, MaskMode, 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) {
@@ -10819,12 +10819,7 @@ var SpineMesh = /*#__PURE__*/ function() {
10819
10819
  material.culling = false;
10820
10820
  material.depthTest = false;
10821
10821
  material.depthMask = false;
10822
- material.stencilRef = maskOrder !== undefined ? [
10823
- maskOrder,
10824
- maskOrder
10825
- ] : undefined;
10826
10822
  setBlending(material, this.blendMode);
10827
- setMaskMode(material, maskMode);
10828
10823
  return material;
10829
10824
  };
10830
10825
  _proto.updateMesh = function updateMesh(vertices, indices, verticesLength) {
@@ -11137,7 +11132,6 @@ var SpineComponent = /*#__PURE__*/ function(RendererComponent) {
11137
11132
  /**
11138
11133
  * aabb 包围盒的宽度与高度
11139
11134
  */ _this.size = new Vector2();
11140
- _this.maskManager = new MaskProcessor(engine);
11141
11135
  return _this;
11142
11136
  }
11143
11137
  var _proto = SpineComponent.prototype;
@@ -11152,7 +11146,7 @@ var SpineComponent = /*#__PURE__*/ function(RendererComponent) {
11152
11146
  });
11153
11147
  this.item.getHitTestParams = this.getHitTestParams.bind(this);
11154
11148
  if (data.mask) {
11155
- this.maskManager.setMaskOptions(data.mask);
11149
+ this.maskManager.setMaskOptions(this.engine, data.mask);
11156
11150
  }
11157
11151
  this.rendererOptions.maskMode = this.maskManager.maskMode;
11158
11152
  this.rendererOptions.mask = this.maskManager.getRefValue();
@@ -11182,6 +11176,7 @@ var SpineComponent = /*#__PURE__*/ function(RendererComponent) {
11182
11176
  }
11183
11177
  };
11184
11178
  _proto.onAwake = function onAwake() {
11179
+ var _this_content;
11185
11180
  if (!this.cache) {
11186
11181
  return;
11187
11182
  }
@@ -11194,6 +11189,10 @@ var SpineComponent = /*#__PURE__*/ function(RendererComponent) {
11194
11189
  this.state.apply(this.skeleton);
11195
11190
  this.onUpdate(0);
11196
11191
  this.resize();
11192
+ var _this_content_meshGroups_map;
11193
+ this.materials = (_this_content_meshGroups_map = (_this_content = this.content) == null ? void 0 : _this_content.meshGroups.map(function(mg) {
11194
+ return mg.mesh.material;
11195
+ })) != null ? _this_content_meshGroups_map : [];
11197
11196
  };
11198
11197
  _proto.onUpdate = function onUpdate(dt) {
11199
11198
  if (!(this.state && this.skeleton)) {
@@ -11211,31 +11210,27 @@ var SpineComponent = /*#__PURE__*/ function(RendererComponent) {
11211
11210
  if (!this.content) {
11212
11211
  return;
11213
11212
  }
11213
+ this.maskManager.drawStencilMask(renderer, this);
11214
11214
  for(var i = 0; i < this.content.meshGroups.length; i++){
11215
11215
  var material = this.content.meshGroups[i].mesh.material;
11216
11216
  material.setVector2("_Size", new Vector2(this.startSize * this.scaleFactor, this.startSize * this.scaleFactor));
11217
11217
  }
11218
- this.maskManager.drawStencilMask(renderer);
11219
11218
  this.content.render(renderer);
11220
11219
  };
11221
- _proto.drawStencilMask = function drawStencilMask(renderer) {
11220
+ _proto.drawStencilMask = function drawStencilMask(maskRef) {
11221
+ var _this = this;
11222
11222
  if (!this.isActiveAndEnabled) {
11223
11223
  return;
11224
11224
  }
11225
11225
  if (!this.content) {
11226
11226
  return;
11227
11227
  }
11228
- var previousColorMasks = [];
11229
- for(var i = 0; i < this.content.meshGroups.length; i++){
11230
- var material = this.content.meshGroups[i].mesh.material;
11231
- previousColorMasks.push(material.colorMask);
11232
- material.colorMask = false;
11233
- }
11234
- this.content.render(renderer);
11235
- for(var i1 = 0; i1 < this.content.meshGroups.length; i1++){
11236
- var material1 = this.content.meshGroups[i1].mesh.material;
11237
- material1.colorMask = previousColorMasks[i1];
11238
- }
11228
+ var worldMatrix = this.content.transform.getWorldMatrix();
11229
+ this.content.meshGroups.forEach(function(spineMesh) {
11230
+ var mesh = spineMesh.mesh;
11231
+ mesh.worldMatrix = worldMatrix;
11232
+ _this.maskManager.drawGeometryMask(_this.engine.renderer, mesh.geometry, worldMatrix, mesh.material, maskRef);
11233
+ });
11239
11234
  };
11240
11235
  _proto.onDestroy = function onDestroy() {
11241
11236
  if (this.item.endBehavior === spec.EndBehavior.destroy && this.state) {
@@ -11603,7 +11598,7 @@ var SpineLoader = /*#__PURE__*/ function(Plugin) {
11603
11598
  registerPlugin("spine", SpineLoader);
11604
11599
  /**
11605
11600
  * 插件版本号
11606
- */ var version = "2.8.8";
11601
+ */ var version = "2.9.0-alpha.0";
11607
11602
  logger.info("Plugin spine version: " + version + ".");
11608
11603
  if (version !== EFFECTS.version) {
11609
11604
  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!");