@galacean/effects-threejs 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/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v1.1.0
6
+ * Version: v1.1.2
7
7
  */
8
8
 
9
9
  'use strict';
@@ -14957,6 +14957,11 @@ var VFXItem = /** @class */ (function () {
14957
14957
  }
14958
14958
  else if (this.endBehavior === END_BEHAVIOR_DESTROY$1) {
14959
14959
  this._contentVisible = false;
14960
+ // 预合成配置 reusable 且销毁时, 需要隐藏其中的元素
14961
+ if (this.type === ItemType$1.composition) {
14962
+ this.handleVisibleChanged(false);
14963
+ this.onItemUpdate(0, lifetime);
14964
+ }
14960
14965
  }
14961
14966
  lifetime = Math.min(lifetime, 1);
14962
14967
  }
@@ -15202,6 +15207,7 @@ var VFXItem = /** @class */ (function () {
15202
15207
  this.reset();
15203
15208
  this.onUpdate = function () { return -1; };
15204
15209
  this.composition = null;
15210
+ this._contentVisible = false;
15205
15211
  this.transform.setValid(false);
15206
15212
  }
15207
15213
  };
@@ -19386,18 +19392,19 @@ var SpriteMesh = /** @class */ (function () {
19386
19392
  var uSizeStart = start + 4;
19387
19393
  var uQuatStart = start + 8;
19388
19394
  var uColorStart = start + 12;
19389
- if (!selfData.visible && !init) {
19390
- mainDataArray[uSizeStart + 2] = -1;
19391
- return;
19392
- }
19393
- var uColor = selfData.color || [mainDataArray[uColorStart], mainDataArray[uColorStart + 1], mainDataArray[uColorStart + 2], mainDataArray[uColorStart + 3]];
19394
- // if (selfData.startSize) {
19395
- // selfData.transform.scaleBy(1 / selfData.startSize[0], 1 / selfData.startSize[1], 1);
19396
- // }
19397
19395
  var tempPos = new Vector3();
19398
19396
  var tempQuat = new Quaternion();
19399
19397
  var tempScale = new Vector3();
19400
- selfData.transform.assignWorldTRS(tempPos, tempQuat, tempScale);
19398
+ var uColor = selfData.color || [mainDataArray[uColorStart], mainDataArray[uColorStart + 1], mainDataArray[uColorStart + 2], mainDataArray[uColorStart + 3]];
19399
+ if (selfData.visible) {
19400
+ selfData.transform.assignWorldTRS(tempPos, tempQuat, tempScale);
19401
+ }
19402
+ else {
19403
+ if (!init) {
19404
+ mainDataArray[uSizeStart + 2] = -1;
19405
+ return;
19406
+ }
19407
+ }
19401
19408
  var uPos = __spreadArray$2(__spreadArray$2([], __read$3(tempPos.toArray()), false), [0], false);
19402
19409
  var uSize = __spreadArray$2(__spreadArray$2([], __read$3(tempScale.toArray()), false), [0], false);
19403
19410
  var uQuat = tempQuat.toArray();
@@ -24172,13 +24179,6 @@ var ParticleVFXItem = /** @class */ (function (_super) {
24172
24179
  enumerable: false,
24173
24180
  configurable: true
24174
24181
  });
24175
- Object.defineProperty(ParticleVFXItem.prototype, "contentVisible", {
24176
- get: function () {
24177
- return !this.destroyed;
24178
- },
24179
- enumerable: false,
24180
- configurable: true
24181
- });
24182
24182
  ParticleVFXItem.prototype.onConstructed = function (props) {
24183
24183
  this.particle = props.content;
24184
24184
  };
@@ -24196,7 +24196,7 @@ var ParticleVFXItem = /** @class */ (function (_super) {
24196
24196
  ParticleVFXItem.prototype.onItemUpdate = function (dt, lifetime) {
24197
24197
  var _a;
24198
24198
  if (this.content) {
24199
- var hide = !this.visible;
24199
+ var hide = !this.contentVisible;
24200
24200
  var parentItem = this.parentId && ((_a = this.composition) === null || _a === void 0 ? void 0 : _a.getItemByID(this.parentId));
24201
24201
  if (!hide && parentItem) {
24202
24202
  var parentData = parentItem.getRenderData();
@@ -26258,9 +26258,9 @@ var TextVFXItem = /** @class */ (function (_super) {
26258
26258
  this.textContext = props.content;
26259
26259
  };
26260
26260
  TextVFXItem.prototype.onLifetimeBegin = function (composition, content) {
26261
- var _a;
26261
+ var _a, _b;
26262
26262
  content.active = true;
26263
- (_a = this.content) === null || _a === void 0 ? void 0 : _a.mesh.setItems([this.content]);
26263
+ (_b = (_a = this.content) === null || _a === void 0 ? void 0 : _a.mesh) === null || _b === void 0 ? void 0 : _b.setItems([this.content]);
26264
26264
  this.content.updateTexture();
26265
26265
  };
26266
26266
  TextVFXItem.prototype.onItemRemoved = function (composition, content) {
@@ -29195,6 +29195,7 @@ var CompositionSourceManager = /** @class */ (function () {
29195
29195
  var e_1, _a;
29196
29196
  this.refCompositions = new Map();
29197
29197
  this.refCompositionProps = new Map();
29198
+ this.mask = 0;
29198
29199
  // 资源
29199
29200
  var jsonScene = scene.jsonScene, renderLevel = scene.renderLevel, textureOptions = scene.textureOptions, pluginSystem = scene.pluginSystem, totalTime = scene.totalTime;
29200
29201
  var compositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, compositionId = jsonScene.compositionId;
@@ -29233,7 +29234,6 @@ var CompositionSourceManager = /** @class */ (function () {
29233
29234
  this.totalTime = totalTime !== null && totalTime !== void 0 ? totalTime : 0;
29234
29235
  this.imgUsage = imgUsage !== null && imgUsage !== void 0 ? imgUsage : {};
29235
29236
  this.textures = cachedTextures;
29236
- this.mask = 0;
29237
29237
  listOrder = 0;
29238
29238
  this.textureOptions = textureOptions;
29239
29239
  this.sourceContent = this.getContent(this.composition);
@@ -29258,10 +29258,7 @@ var CompositionSourceManager = /** @class */ (function () {
29258
29258
  CompositionSourceManager.prototype.assembleItems = function (composition) {
29259
29259
  var _this = this;
29260
29260
  var items = [];
29261
- var mask = this.mask;
29262
- if (isNaN(mask)) {
29263
- mask = 0;
29264
- }
29261
+ this.mask++;
29265
29262
  composition.items.forEach(function (item) {
29266
29263
  var _a;
29267
29264
  var option = {};
@@ -29278,13 +29275,7 @@ var CompositionSourceManager = /** @class */ (function () {
29278
29275
  if (renderContent.renderer) {
29279
29276
  renderContent.renderer = _this.changeTex(renderContent.renderer);
29280
29277
  if (!renderContent.renderer.mask) {
29281
- var maskMode = renderContent.renderer.maskMode;
29282
- if (maskMode === MaskMode$1.MASK) {
29283
- renderContent.renderer.mask = ++mask;
29284
- }
29285
- else if (maskMode === MaskMode$1.OBSCURED || maskMode === MaskMode$1.REVERSE_OBSCURED) {
29286
- renderContent.renderer.mask = mask;
29287
- }
29278
+ _this.processMask(renderContent.renderer, _this.mask);
29288
29279
  }
29289
29280
  var split = renderContent.splits && !renderContent.textureSheetAnimation && renderContent.splits[0];
29290
29281
  if (Number.isInteger(renderContent.renderer.shape)) {
@@ -29330,16 +29321,18 @@ var CompositionSourceManager = /** @class */ (function () {
29330
29321
  }
29331
29322
  // 处理预合成的渲染顺序
29332
29323
  if (option.type === ItemType$1.composition) {
29324
+ var maskRef_1 = ++_this.mask;
29333
29325
  var refId = item.content.options.refId;
29334
29326
  if (!_this.refCompositions.get(refId)) {
29335
29327
  throw new Error('Invalid Ref Composition id: ' + refId);
29336
29328
  }
29329
+ var ref = _this.getContent(_this.refCompositions.get(refId));
29337
29330
  if (!_this.refCompositionProps.has(refId)) {
29338
- _this.refCompositionProps.set(refId, _this.getContent(_this.refCompositions.get(refId)));
29331
+ _this.refCompositionProps.set(refId, ref);
29339
29332
  }
29340
- var ref = _this.refCompositionProps.get(refId);
29341
29333
  ref.items.forEach(function (item) {
29342
29334
  item.listIndex = listOrder++;
29335
+ _this.processMask(item.content, maskRef_1);
29343
29336
  });
29344
29337
  option.items = ref.items;
29345
29338
  }
@@ -29375,6 +29368,17 @@ var CompositionSourceManager = /** @class */ (function () {
29375
29368
  }
29376
29369
  }
29377
29370
  };
29371
+ /**
29372
+ * 处理蒙版和遮挡关系写入 stencil 的 ref 值
29373
+ */
29374
+ CompositionSourceManager.prototype.processMask = function (renderer, maskRef) {
29375
+ if (!renderer.mask) {
29376
+ var maskMode = renderer.maskMode;
29377
+ if (maskMode !== MaskMode$1.NONE) {
29378
+ renderer.mask = maskRef;
29379
+ }
29380
+ }
29381
+ };
29378
29382
  CompositionSourceManager.prototype.dispose = function () {
29379
29383
  this.textureOptions = [];
29380
29384
  this.textures = [];
@@ -29969,7 +29973,7 @@ var CompVFXItem = /** @class */ (function (_super) {
29969
29973
  throw new Error("\u5F15\u7528\u7684Id: ".concat(refId, " \u7684\u9884\u5408\u6210\u4E0D\u5B58\u5728"));
29970
29974
  }
29971
29975
  props.content = itemProps.content;
29972
- 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);
29976
+ 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);
29973
29977
  item.contentProps = itemProps.content;
29974
29978
  item.transform.parentTransform = this.transform;
29975
29979
  this.composition.refContent.push(item);
@@ -32777,9 +32781,9 @@ Geometry.create = function (engine, options) {
32777
32781
  Mesh.create = function (engine, props) {
32778
32782
  return new ThreeMesh(engine, props);
32779
32783
  };
32780
- var version = "1.1.0";
32784
+ var version = "1.1.2";
32781
32785
  console.info({
32782
- content: '[Galacean Effects THREEJS] version: ' + "1.1.0",
32786
+ content: '[Galacean Effects THREEJS] version: ' + "1.1.2",
32783
32787
  type: LOG_TYPE,
32784
32788
  });
32785
32789