@galacean/effects 1.1.0 → 1.1.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/weapp.mjs CHANGED
@@ -14925,6 +14925,11 @@ var VFXItem = /** @class */ (function () {
14925
14925
  }
14926
14926
  else if (this.endBehavior === END_BEHAVIOR_DESTROY$1) {
14927
14927
  this._contentVisible = false;
14928
+ // 预合成配置 reusable 且销毁时, 需要隐藏其中的元素
14929
+ if (this.type === ItemType$1.composition) {
14930
+ this.handleVisibleChanged(false);
14931
+ this.onItemUpdate(0, lifetime);
14932
+ }
14928
14933
  }
14929
14934
  lifetime = Math.min(lifetime, 1);
14930
14935
  }
@@ -15170,6 +15175,7 @@ var VFXItem = /** @class */ (function () {
15170
15175
  this.reset();
15171
15176
  this.onUpdate = function () { return -1; };
15172
15177
  this.composition = null;
15178
+ this._contentVisible = false;
15173
15179
  this.transform.setValid(false);
15174
15180
  }
15175
15181
  };
@@ -19354,18 +19360,19 @@ var SpriteMesh = /** @class */ (function () {
19354
19360
  var uSizeStart = start + 4;
19355
19361
  var uQuatStart = start + 8;
19356
19362
  var uColorStart = start + 12;
19357
- if (!selfData.visible && !init) {
19358
- mainDataArray[uSizeStart + 2] = -1;
19359
- return;
19360
- }
19361
- var uColor = selfData.color || [mainDataArray[uColorStart], mainDataArray[uColorStart + 1], mainDataArray[uColorStart + 2], mainDataArray[uColorStart + 3]];
19362
- // if (selfData.startSize) {
19363
- // selfData.transform.scaleBy(1 / selfData.startSize[0], 1 / selfData.startSize[1], 1);
19364
- // }
19365
19363
  var tempPos = new Vector3();
19366
19364
  var tempQuat = new Quaternion();
19367
19365
  var tempScale = new Vector3();
19368
- selfData.transform.assignWorldTRS(tempPos, tempQuat, tempScale);
19366
+ var uColor = selfData.color || [mainDataArray[uColorStart], mainDataArray[uColorStart + 1], mainDataArray[uColorStart + 2], mainDataArray[uColorStart + 3]];
19367
+ if (selfData.visible) {
19368
+ selfData.transform.assignWorldTRS(tempPos, tempQuat, tempScale);
19369
+ }
19370
+ else {
19371
+ if (!init) {
19372
+ mainDataArray[uSizeStart + 2] = -1;
19373
+ return;
19374
+ }
19375
+ }
19369
19376
  var uPos = __spreadArray$2(__spreadArray$2([], __read$3(tempPos.toArray()), false), [0], false);
19370
19377
  var uSize = __spreadArray$2(__spreadArray$2([], __read$3(tempScale.toArray()), false), [0], false);
19371
19378
  var uQuat = tempQuat.toArray();
@@ -24140,13 +24147,6 @@ var ParticleVFXItem = /** @class */ (function (_super) {
24140
24147
  enumerable: false,
24141
24148
  configurable: true
24142
24149
  });
24143
- Object.defineProperty(ParticleVFXItem.prototype, "contentVisible", {
24144
- get: function () {
24145
- return !this.destroyed;
24146
- },
24147
- enumerable: false,
24148
- configurable: true
24149
- });
24150
24150
  ParticleVFXItem.prototype.onConstructed = function (props) {
24151
24151
  this.particle = props.content;
24152
24152
  };
@@ -24164,7 +24164,7 @@ var ParticleVFXItem = /** @class */ (function (_super) {
24164
24164
  ParticleVFXItem.prototype.onItemUpdate = function (dt, lifetime) {
24165
24165
  var _a;
24166
24166
  if (this.content) {
24167
- var hide = !this.visible;
24167
+ var hide = !this.contentVisible;
24168
24168
  var parentItem = this.parentId && ((_a = this.composition) === null || _a === void 0 ? void 0 : _a.getItemByID(this.parentId));
24169
24169
  if (!hide && parentItem) {
24170
24170
  var parentData = parentItem.getRenderData();
@@ -26226,9 +26226,9 @@ var TextVFXItem = /** @class */ (function (_super) {
26226
26226
  this.textContext = props.content;
26227
26227
  };
26228
26228
  TextVFXItem.prototype.onLifetimeBegin = function (composition, content) {
26229
- var _a;
26229
+ var _a, _b;
26230
26230
  content.active = true;
26231
- (_a = this.content) === null || _a === void 0 ? void 0 : _a.mesh.setItems([this.content]);
26231
+ (_b = (_a = this.content) === null || _a === void 0 ? void 0 : _a.mesh) === null || _b === void 0 ? void 0 : _b.setItems([this.content]);
26232
26232
  this.content.updateTexture();
26233
26233
  };
26234
26234
  TextVFXItem.prototype.onItemRemoved = function (composition, content) {
@@ -29163,6 +29163,7 @@ var CompositionSourceManager = /** @class */ (function () {
29163
29163
  var e_1, _a;
29164
29164
  this.refCompositions = new Map();
29165
29165
  this.refCompositionProps = new Map();
29166
+ this.mask = 0;
29166
29167
  // 资源
29167
29168
  var jsonScene = scene.jsonScene, renderLevel = scene.renderLevel, textureOptions = scene.textureOptions, pluginSystem = scene.pluginSystem, totalTime = scene.totalTime;
29168
29169
  var compositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, compositionId = jsonScene.compositionId;
@@ -29201,7 +29202,6 @@ var CompositionSourceManager = /** @class */ (function () {
29201
29202
  this.totalTime = totalTime !== null && totalTime !== void 0 ? totalTime : 0;
29202
29203
  this.imgUsage = imgUsage !== null && imgUsage !== void 0 ? imgUsage : {};
29203
29204
  this.textures = cachedTextures;
29204
- this.mask = 0;
29205
29205
  listOrder = 0;
29206
29206
  this.textureOptions = textureOptions;
29207
29207
  this.sourceContent = this.getContent(this.composition);
@@ -29226,10 +29226,7 @@ var CompositionSourceManager = /** @class */ (function () {
29226
29226
  CompositionSourceManager.prototype.assembleItems = function (composition) {
29227
29227
  var _this = this;
29228
29228
  var items = [];
29229
- var mask = this.mask;
29230
- if (isNaN(mask)) {
29231
- mask = 0;
29232
- }
29229
+ this.mask++;
29233
29230
  composition.items.forEach(function (item) {
29234
29231
  var _a;
29235
29232
  var option = {};
@@ -29246,13 +29243,7 @@ var CompositionSourceManager = /** @class */ (function () {
29246
29243
  if (renderContent.renderer) {
29247
29244
  renderContent.renderer = _this.changeTex(renderContent.renderer);
29248
29245
  if (!renderContent.renderer.mask) {
29249
- var maskMode = renderContent.renderer.maskMode;
29250
- if (maskMode === MaskMode$1.MASK) {
29251
- renderContent.renderer.mask = ++mask;
29252
- }
29253
- else if (maskMode === MaskMode$1.OBSCURED || maskMode === MaskMode$1.REVERSE_OBSCURED) {
29254
- renderContent.renderer.mask = mask;
29255
- }
29246
+ _this.processMask(renderContent.renderer, _this.mask);
29256
29247
  }
29257
29248
  var split = renderContent.splits && !renderContent.textureSheetAnimation && renderContent.splits[0];
29258
29249
  if (Number.isInteger(renderContent.renderer.shape)) {
@@ -29298,16 +29289,18 @@ var CompositionSourceManager = /** @class */ (function () {
29298
29289
  }
29299
29290
  // 处理预合成的渲染顺序
29300
29291
  if (option.type === ItemType$1.composition) {
29292
+ var maskRef_1 = ++_this.mask;
29301
29293
  var refId = item.content.options.refId;
29302
29294
  if (!_this.refCompositions.get(refId)) {
29303
29295
  throw new Error('Invalid Ref Composition id: ' + refId);
29304
29296
  }
29297
+ var ref = _this.getContent(_this.refCompositions.get(refId));
29305
29298
  if (!_this.refCompositionProps.has(refId)) {
29306
- _this.refCompositionProps.set(refId, _this.getContent(_this.refCompositions.get(refId)));
29299
+ _this.refCompositionProps.set(refId, ref);
29307
29300
  }
29308
- var ref = _this.refCompositionProps.get(refId);
29309
29301
  ref.items.forEach(function (item) {
29310
29302
  item.listIndex = listOrder++;
29303
+ _this.processMask(item.content, maskRef_1);
29311
29304
  });
29312
29305
  option.items = ref.items;
29313
29306
  }
@@ -29343,6 +29336,17 @@ var CompositionSourceManager = /** @class */ (function () {
29343
29336
  }
29344
29337
  }
29345
29338
  };
29339
+ /**
29340
+ * 处理蒙版和遮挡关系写入 stencil 的 ref 值
29341
+ */
29342
+ CompositionSourceManager.prototype.processMask = function (renderer, maskRef) {
29343
+ if (!renderer.mask) {
29344
+ var maskMode = renderer.maskMode;
29345
+ if (maskMode !== MaskMode$1.NONE) {
29346
+ renderer.mask = maskRef;
29347
+ }
29348
+ }
29349
+ };
29346
29350
  CompositionSourceManager.prototype.dispose = function () {
29347
29351
  this.textureOptions = [];
29348
29352
  this.textures = [];
@@ -29937,7 +29941,7 @@ var CompVFXItem = /** @class */ (function (_super) {
29937
29941
  throw new Error("\u5F15\u7528\u7684Id: ".concat(refId, " \u7684\u9884\u5408\u6210\u4E0D\u5B58\u5728"));
29938
29942
  }
29939
29943
  props.content = itemProps.content;
29940
- item = new CompVFXItem(__assign$1(__assign$1({}, props), { refId: refId, id: itemProps.id, name: itemProps.name, duration: itemProps.duration, endBehavior: itemProps.endBehavior, parentId: itemProps.parentId, transform: itemProps.transform }), this.composition);
29944
+ item = new CompVFXItem(__assign$1(__assign$1({}, props), { refId: refId, delay: itemProps.delay, id: itemProps.id, name: itemProps.name, duration: itemProps.duration, endBehavior: itemProps.endBehavior, parentId: itemProps.parentId, transform: itemProps.transform }), this.composition);
29941
29945
  item.contentProps = itemProps.content;
29942
29946
  item.transform.parentTransform = this.transform;
29943
29947
  this.composition.refContent.push(item);
@@ -36348,9 +36352,9 @@ Renderer.create = function (canvas, framework, renderOptions) {
36348
36352
  Engine.create = function (gl) {
36349
36353
  return new GLEngine(gl);
36350
36354
  };
36351
- var version = "1.1.0";
36355
+ var version = "1.1.2";
36352
36356
  console.info({
36353
- content: '[Galacean Effects Player] version: ' + "1.1.0",
36357
+ content: '[Galacean Effects Player] version: ' + "1.1.2",
36354
36358
  type: LOG_TYPE,
36355
36359
  });
36356
36360