@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.mjs 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
  import * as THREE from 'three';
@@ -14933,6 +14933,11 @@ var VFXItem = /** @class */ (function () {
14933
14933
  }
14934
14934
  else if (this.endBehavior === END_BEHAVIOR_DESTROY$1) {
14935
14935
  this._contentVisible = false;
14936
+ // 预合成配置 reusable 且销毁时, 需要隐藏其中的元素
14937
+ if (this.type === ItemType$1.composition) {
14938
+ this.handleVisibleChanged(false);
14939
+ this.onItemUpdate(0, lifetime);
14940
+ }
14936
14941
  }
14937
14942
  lifetime = Math.min(lifetime, 1);
14938
14943
  }
@@ -15178,6 +15183,7 @@ var VFXItem = /** @class */ (function () {
15178
15183
  this.reset();
15179
15184
  this.onUpdate = function () { return -1; };
15180
15185
  this.composition = null;
15186
+ this._contentVisible = false;
15181
15187
  this.transform.setValid(false);
15182
15188
  }
15183
15189
  };
@@ -19362,18 +19368,19 @@ var SpriteMesh = /** @class */ (function () {
19362
19368
  var uSizeStart = start + 4;
19363
19369
  var uQuatStart = start + 8;
19364
19370
  var uColorStart = start + 12;
19365
- if (!selfData.visible && !init) {
19366
- mainDataArray[uSizeStart + 2] = -1;
19367
- return;
19368
- }
19369
- var uColor = selfData.color || [mainDataArray[uColorStart], mainDataArray[uColorStart + 1], mainDataArray[uColorStart + 2], mainDataArray[uColorStart + 3]];
19370
- // if (selfData.startSize) {
19371
- // selfData.transform.scaleBy(1 / selfData.startSize[0], 1 / selfData.startSize[1], 1);
19372
- // }
19373
19371
  var tempPos = new Vector3();
19374
19372
  var tempQuat = new Quaternion();
19375
19373
  var tempScale = new Vector3();
19376
- selfData.transform.assignWorldTRS(tempPos, tempQuat, tempScale);
19374
+ var uColor = selfData.color || [mainDataArray[uColorStart], mainDataArray[uColorStart + 1], mainDataArray[uColorStart + 2], mainDataArray[uColorStart + 3]];
19375
+ if (selfData.visible) {
19376
+ selfData.transform.assignWorldTRS(tempPos, tempQuat, tempScale);
19377
+ }
19378
+ else {
19379
+ if (!init) {
19380
+ mainDataArray[uSizeStart + 2] = -1;
19381
+ return;
19382
+ }
19383
+ }
19377
19384
  var uPos = __spreadArray$2(__spreadArray$2([], __read$3(tempPos.toArray()), false), [0], false);
19378
19385
  var uSize = __spreadArray$2(__spreadArray$2([], __read$3(tempScale.toArray()), false), [0], false);
19379
19386
  var uQuat = tempQuat.toArray();
@@ -24148,13 +24155,6 @@ var ParticleVFXItem = /** @class */ (function (_super) {
24148
24155
  enumerable: false,
24149
24156
  configurable: true
24150
24157
  });
24151
- Object.defineProperty(ParticleVFXItem.prototype, "contentVisible", {
24152
- get: function () {
24153
- return !this.destroyed;
24154
- },
24155
- enumerable: false,
24156
- configurable: true
24157
- });
24158
24158
  ParticleVFXItem.prototype.onConstructed = function (props) {
24159
24159
  this.particle = props.content;
24160
24160
  };
@@ -24172,7 +24172,7 @@ var ParticleVFXItem = /** @class */ (function (_super) {
24172
24172
  ParticleVFXItem.prototype.onItemUpdate = function (dt, lifetime) {
24173
24173
  var _a;
24174
24174
  if (this.content) {
24175
- var hide = !this.visible;
24175
+ var hide = !this.contentVisible;
24176
24176
  var parentItem = this.parentId && ((_a = this.composition) === null || _a === void 0 ? void 0 : _a.getItemByID(this.parentId));
24177
24177
  if (!hide && parentItem) {
24178
24178
  var parentData = parentItem.getRenderData();
@@ -26234,9 +26234,9 @@ var TextVFXItem = /** @class */ (function (_super) {
26234
26234
  this.textContext = props.content;
26235
26235
  };
26236
26236
  TextVFXItem.prototype.onLifetimeBegin = function (composition, content) {
26237
- var _a;
26237
+ var _a, _b;
26238
26238
  content.active = true;
26239
- (_a = this.content) === null || _a === void 0 ? void 0 : _a.mesh.setItems([this.content]);
26239
+ (_b = (_a = this.content) === null || _a === void 0 ? void 0 : _a.mesh) === null || _b === void 0 ? void 0 : _b.setItems([this.content]);
26240
26240
  this.content.updateTexture();
26241
26241
  };
26242
26242
  TextVFXItem.prototype.onItemRemoved = function (composition, content) {
@@ -29171,6 +29171,7 @@ var CompositionSourceManager = /** @class */ (function () {
29171
29171
  var e_1, _a;
29172
29172
  this.refCompositions = new Map();
29173
29173
  this.refCompositionProps = new Map();
29174
+ this.mask = 0;
29174
29175
  // 资源
29175
29176
  var jsonScene = scene.jsonScene, renderLevel = scene.renderLevel, textureOptions = scene.textureOptions, pluginSystem = scene.pluginSystem, totalTime = scene.totalTime;
29176
29177
  var compositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, compositionId = jsonScene.compositionId;
@@ -29209,7 +29210,6 @@ var CompositionSourceManager = /** @class */ (function () {
29209
29210
  this.totalTime = totalTime !== null && totalTime !== void 0 ? totalTime : 0;
29210
29211
  this.imgUsage = imgUsage !== null && imgUsage !== void 0 ? imgUsage : {};
29211
29212
  this.textures = cachedTextures;
29212
- this.mask = 0;
29213
29213
  listOrder = 0;
29214
29214
  this.textureOptions = textureOptions;
29215
29215
  this.sourceContent = this.getContent(this.composition);
@@ -29234,10 +29234,7 @@ var CompositionSourceManager = /** @class */ (function () {
29234
29234
  CompositionSourceManager.prototype.assembleItems = function (composition) {
29235
29235
  var _this = this;
29236
29236
  var items = [];
29237
- var mask = this.mask;
29238
- if (isNaN(mask)) {
29239
- mask = 0;
29240
- }
29237
+ this.mask++;
29241
29238
  composition.items.forEach(function (item) {
29242
29239
  var _a;
29243
29240
  var option = {};
@@ -29254,13 +29251,7 @@ var CompositionSourceManager = /** @class */ (function () {
29254
29251
  if (renderContent.renderer) {
29255
29252
  renderContent.renderer = _this.changeTex(renderContent.renderer);
29256
29253
  if (!renderContent.renderer.mask) {
29257
- var maskMode = renderContent.renderer.maskMode;
29258
- if (maskMode === MaskMode$1.MASK) {
29259
- renderContent.renderer.mask = ++mask;
29260
- }
29261
- else if (maskMode === MaskMode$1.OBSCURED || maskMode === MaskMode$1.REVERSE_OBSCURED) {
29262
- renderContent.renderer.mask = mask;
29263
- }
29254
+ _this.processMask(renderContent.renderer, _this.mask);
29264
29255
  }
29265
29256
  var split = renderContent.splits && !renderContent.textureSheetAnimation && renderContent.splits[0];
29266
29257
  if (Number.isInteger(renderContent.renderer.shape)) {
@@ -29306,16 +29297,18 @@ var CompositionSourceManager = /** @class */ (function () {
29306
29297
  }
29307
29298
  // 处理预合成的渲染顺序
29308
29299
  if (option.type === ItemType$1.composition) {
29300
+ var maskRef_1 = ++_this.mask;
29309
29301
  var refId = item.content.options.refId;
29310
29302
  if (!_this.refCompositions.get(refId)) {
29311
29303
  throw new Error('Invalid Ref Composition id: ' + refId);
29312
29304
  }
29305
+ var ref = _this.getContent(_this.refCompositions.get(refId));
29313
29306
  if (!_this.refCompositionProps.has(refId)) {
29314
- _this.refCompositionProps.set(refId, _this.getContent(_this.refCompositions.get(refId)));
29307
+ _this.refCompositionProps.set(refId, ref);
29315
29308
  }
29316
- var ref = _this.refCompositionProps.get(refId);
29317
29309
  ref.items.forEach(function (item) {
29318
29310
  item.listIndex = listOrder++;
29311
+ _this.processMask(item.content, maskRef_1);
29319
29312
  });
29320
29313
  option.items = ref.items;
29321
29314
  }
@@ -29351,6 +29344,17 @@ var CompositionSourceManager = /** @class */ (function () {
29351
29344
  }
29352
29345
  }
29353
29346
  };
29347
+ /**
29348
+ * 处理蒙版和遮挡关系写入 stencil 的 ref 值
29349
+ */
29350
+ CompositionSourceManager.prototype.processMask = function (renderer, maskRef) {
29351
+ if (!renderer.mask) {
29352
+ var maskMode = renderer.maskMode;
29353
+ if (maskMode !== MaskMode$1.NONE) {
29354
+ renderer.mask = maskRef;
29355
+ }
29356
+ }
29357
+ };
29354
29358
  CompositionSourceManager.prototype.dispose = function () {
29355
29359
  this.textureOptions = [];
29356
29360
  this.textures = [];
@@ -29945,7 +29949,7 @@ var CompVFXItem = /** @class */ (function (_super) {
29945
29949
  throw new Error("\u5F15\u7528\u7684Id: ".concat(refId, " \u7684\u9884\u5408\u6210\u4E0D\u5B58\u5728"));
29946
29950
  }
29947
29951
  props.content = itemProps.content;
29948
- 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);
29952
+ 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);
29949
29953
  item.contentProps = itemProps.content;
29950
29954
  item.transform.parentTransform = this.transform;
29951
29955
  this.composition.refContent.push(item);
@@ -32753,9 +32757,9 @@ Geometry.create = function (engine, options) {
32753
32757
  Mesh.create = function (engine, props) {
32754
32758
  return new ThreeMesh(engine, props);
32755
32759
  };
32756
- var version = "1.1.0";
32760
+ var version = "1.1.2";
32757
32761
  console.info({
32758
- content: '[Galacean Effects THREEJS] version: ' + "1.1.0",
32762
+ content: '[Galacean Effects THREEJS] version: ' + "1.1.2",
32759
32763
  type: LOG_TYPE,
32760
32764
  });
32761
32765