@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.js CHANGED
@@ -3,7 +3,7 @@
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
  'use strict';
@@ -10842,12 +10842,7 @@ var SpineMesh = /*#__PURE__*/ function() {
10842
10842
  material.culling = false;
10843
10843
  material.depthTest = false;
10844
10844
  material.depthMask = false;
10845
- material.stencilRef = maskOrder !== undefined ? [
10846
- maskOrder,
10847
- maskOrder
10848
- ] : undefined;
10849
10845
  setBlending(material, this.blendMode);
10850
- EFFECTS.setMaskMode(material, maskMode);
10851
10846
  return material;
10852
10847
  };
10853
10848
  _proto.updateMesh = function updateMesh(vertices, indices, verticesLength) {
@@ -11160,7 +11155,6 @@ exports.SpineComponent = /*#__PURE__*/ function(RendererComponent) {
11160
11155
  /**
11161
11156
  * aabb 包围盒的宽度与高度
11162
11157
  */ _this.size = new Vector2();
11163
- _this.maskManager = new EFFECTS.MaskProcessor(engine);
11164
11158
  return _this;
11165
11159
  }
11166
11160
  var _proto = SpineComponent.prototype;
@@ -11175,7 +11169,7 @@ exports.SpineComponent = /*#__PURE__*/ function(RendererComponent) {
11175
11169
  });
11176
11170
  this.item.getHitTestParams = this.getHitTestParams.bind(this);
11177
11171
  if (data.mask) {
11178
- this.maskManager.setMaskOptions(data.mask);
11172
+ this.maskManager.setMaskOptions(this.engine, data.mask);
11179
11173
  }
11180
11174
  this.rendererOptions.maskMode = this.maskManager.maskMode;
11181
11175
  this.rendererOptions.mask = this.maskManager.getRefValue();
@@ -11205,6 +11199,7 @@ exports.SpineComponent = /*#__PURE__*/ function(RendererComponent) {
11205
11199
  }
11206
11200
  };
11207
11201
  _proto.onAwake = function onAwake() {
11202
+ var _this_content;
11208
11203
  if (!this.cache) {
11209
11204
  return;
11210
11205
  }
@@ -11217,6 +11212,10 @@ exports.SpineComponent = /*#__PURE__*/ function(RendererComponent) {
11217
11212
  this.state.apply(this.skeleton);
11218
11213
  this.onUpdate(0);
11219
11214
  this.resize();
11215
+ var _this_content_meshGroups_map;
11216
+ this.materials = (_this_content_meshGroups_map = (_this_content = this.content) == null ? void 0 : _this_content.meshGroups.map(function(mg) {
11217
+ return mg.mesh.material;
11218
+ })) != null ? _this_content_meshGroups_map : [];
11220
11219
  };
11221
11220
  _proto.onUpdate = function onUpdate(dt) {
11222
11221
  if (!(this.state && this.skeleton)) {
@@ -11234,31 +11233,27 @@ exports.SpineComponent = /*#__PURE__*/ function(RendererComponent) {
11234
11233
  if (!this.content) {
11235
11234
  return;
11236
11235
  }
11236
+ this.maskManager.drawStencilMask(renderer, this);
11237
11237
  for(var i = 0; i < this.content.meshGroups.length; i++){
11238
11238
  var material = this.content.meshGroups[i].mesh.material;
11239
11239
  material.setVector2("_Size", new Vector2(this.startSize * this.scaleFactor, this.startSize * this.scaleFactor));
11240
11240
  }
11241
- this.maskManager.drawStencilMask(renderer);
11242
11241
  this.content.render(renderer);
11243
11242
  };
11244
- _proto.drawStencilMask = function drawStencilMask(renderer) {
11243
+ _proto.drawStencilMask = function drawStencilMask(maskRef) {
11244
+ var _this = this;
11245
11245
  if (!this.isActiveAndEnabled) {
11246
11246
  return;
11247
11247
  }
11248
11248
  if (!this.content) {
11249
11249
  return;
11250
11250
  }
11251
- var previousColorMasks = [];
11252
- for(var i = 0; i < this.content.meshGroups.length; i++){
11253
- var material = this.content.meshGroups[i].mesh.material;
11254
- previousColorMasks.push(material.colorMask);
11255
- material.colorMask = false;
11256
- }
11257
- this.content.render(renderer);
11258
- for(var i1 = 0; i1 < this.content.meshGroups.length; i1++){
11259
- var material1 = this.content.meshGroups[i1].mesh.material;
11260
- material1.colorMask = previousColorMasks[i1];
11261
- }
11251
+ var worldMatrix = this.content.transform.getWorldMatrix();
11252
+ this.content.meshGroups.forEach(function(spineMesh) {
11253
+ var mesh = spineMesh.mesh;
11254
+ mesh.worldMatrix = worldMatrix;
11255
+ _this.maskManager.drawGeometryMask(_this.engine.renderer, mesh.geometry, worldMatrix, mesh.material, maskRef);
11256
+ });
11262
11257
  };
11263
11258
  _proto.onDestroy = function onDestroy() {
11264
11259
  if (this.item.endBehavior === EFFECTS.spec.EndBehavior.destroy && this.state) {
@@ -11626,7 +11621,7 @@ var SpineLoader = /*#__PURE__*/ function(Plugin) {
11626
11621
  EFFECTS.registerPlugin("spine", SpineLoader);
11627
11622
  /**
11628
11623
  * 插件版本号
11629
- */ var version = "2.8.8";
11624
+ */ var version = "2.9.0-alpha.0";
11630
11625
  EFFECTS.logger.info("Plugin spine version: " + version + ".");
11631
11626
  if (version !== EFFECTS__namespace.version) {
11632
11627
  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!");