@galacean/effects-threejs 1.1.4 → 1.1.6

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.4
6
+ * Version: v1.1.6
7
7
  */
8
8
 
9
9
  import * as THREE from 'three';
@@ -14947,7 +14947,6 @@ var VFXItem = /** @class */ (function () {
14947
14947
  shouldUpdate = true;
14948
14948
  if (this.endBehavior === END_BEHAVIOR_RESTART$1) {
14949
14949
  this.ended = true;
14950
- lifetime = lifetime % 1;
14951
14950
  }
14952
14951
  }
14953
14952
  }
@@ -14955,7 +14954,7 @@ var VFXItem = /** @class */ (function () {
14955
14954
  this.setVisible(true);
14956
14955
  this.callEnd = false;
14957
14956
  }
14958
- this.lifetime = lifetime;
14957
+ this.lifetime = lifetime % 1;
14959
14958
  shouldUpdate && this.onItemUpdate(dt, lifetime);
14960
14959
  }
14961
14960
  }
@@ -19278,19 +19277,28 @@ var SpriteMesh = /** @class */ (function () {
19278
19277
  var aPointLen = 0;
19279
19278
  var indexLen = 0;
19280
19279
  var pointCount = 0;
19280
+ var renderInfo;
19281
19281
  if (!items.length) {
19282
19282
  this.mesh.setVisible(false);
19283
19283
  return true;
19284
19284
  }
19285
+ for (var i = 0; i < items.length; i++) {
19286
+ if (items[i].renderInfo) {
19287
+ renderInfo = items[i].renderInfo;
19288
+ break;
19289
+ }
19290
+ }
19291
+ if (!renderInfo) {
19292
+ return true;
19293
+ }
19285
19294
  this.items = items.slice();
19286
19295
  if (items.length > 2) {
19287
19296
  itemSlot = maxSpriteMeshItemCount;
19288
19297
  }
19289
- var renderInfo = items[0].renderInfo;
19290
19298
  if (this.mtlSlotCount !== itemSlot) {
19291
19299
  this.mesh.setMaterial(this.createMaterial(renderInfo, itemSlot), { textures: DestroyOptions.keep });
19292
19300
  }
19293
- var attachmentLength = (_d = (_c = (_b = (_a = renderInfo === null || renderInfo === void 0 ? void 0 : renderInfo.filter) === null || _a === void 0 ? void 0 : _a.passSplitOptions) === null || _b === void 0 ? void 0 : _b.attachments) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0;
19301
+ var attachmentLength = (_d = (_c = (_b = (_a = renderInfo.filter) === null || _a === void 0 ? void 0 : _a.passSplitOptions) === null || _b === void 0 ? void 0 : _b.attachments) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0;
19294
19302
  this.splitLayer = attachmentLength > 0;
19295
19303
  for (var i = 0; i < items.length; i++) {
19296
19304
  var item = items[i];
@@ -23889,9 +23897,7 @@ var ParticleSystem = /** @class */ (function () {
23889
23897
  if (options.removeParticle) {
23890
23898
  mesh.removePoint(pointIndex);
23891
23899
  this.clearPointTrail(pointIndex);
23892
- link.removeNode(node);
23893
- node.content = [0];
23894
- // link.shiftNode(node.content); // 删了又加回去 没明白什么意思
23900
+ node.content[0] = 0;
23895
23901
  }
23896
23902
  hitPositions.push(pos);
23897
23903
  if (!options.multiple) {
@@ -24145,7 +24151,9 @@ function randomArrItem(arr, keepArr) {
24145
24151
  var ParticleVFXItem = /** @class */ (function (_super) {
24146
24152
  __extends(ParticleVFXItem, _super);
24147
24153
  function ParticleVFXItem() {
24148
- return _super !== null && _super.apply(this, arguments) || this;
24154
+ var _this = _super !== null && _super.apply(this, arguments) || this;
24155
+ _this.destroyed = false;
24156
+ return _this;
24149
24157
  }
24150
24158
  Object.defineProperty(ParticleVFXItem.prototype, "type", {
24151
24159
  get: function () {
@@ -30468,7 +30476,7 @@ var Composition = /** @class */ (function () {
30468
30476
  });
30469
30477
  Object.defineProperty(Composition.prototype, "startTime", {
30470
30478
  /**
30471
- * 获取合成开始时间
30479
+ * 获取合成开始渲染的时间
30472
30480
  */
30473
30481
  get: function () {
30474
30482
  var _a;
@@ -30548,7 +30556,12 @@ var Composition = /** @class */ (function () {
30548
30556
  if (this.content.ended && this.reusable) {
30549
30557
  this.restart();
30550
30558
  }
30551
- this.gotoAndPlay(this.time);
30559
+ if (this.content.started) {
30560
+ this.gotoAndPlay(this.time - this.startTime);
30561
+ }
30562
+ else {
30563
+ this.gotoAndPlay(0);
30564
+ }
30552
30565
  };
30553
30566
  /**
30554
30567
  * 暂停合成的播放
@@ -30562,14 +30575,21 @@ var Composition = /** @class */ (function () {
30562
30575
  Composition.prototype.resume = function () {
30563
30576
  this.paused = false;
30564
30577
  };
30578
+ /**
30579
+ * 跳转合成到指定时间播放
30580
+ * @param time - 相对 startTime 的时间
30581
+ */
30565
30582
  Composition.prototype.gotoAndPlay = function (time) {
30566
30583
  this.resume();
30567
30584
  if (!this.content.started) {
30568
30585
  this.content.start();
30569
- this.forwardTime(this.startTime);
30570
30586
  }
30571
- this.forwardTime(time);
30587
+ this.forwardTime(time + this.startTime);
30572
30588
  };
30589
+ /**
30590
+ * 跳转合成到指定时间并暂停
30591
+ * @param time - 相对 startTime 的时间
30592
+ */
30573
30593
  Composition.prototype.gotoAndStop = function (time) {
30574
30594
  this.gotoAndPlay(time);
30575
30595
  this.pause();
@@ -30589,21 +30609,29 @@ var Composition = /** @class */ (function () {
30589
30609
  };
30590
30610
  /**
30591
30611
  * 跳到指定时间点(不做任何播放行为)
30592
- * @param time - 指定的时间
30612
+ * @param time - 相对 startTime 的时间
30593
30613
  */
30594
30614
  Composition.prototype.setTime = function (time) {
30595
30615
  var pause = this.paused;
30596
30616
  if (pause) {
30597
30617
  this.resume();
30598
30618
  }
30599
- this.forwardTime(time, true);
30619
+ if (!this.content.started) {
30620
+ this.content.start();
30621
+ }
30622
+ this.forwardTime(time + this.startTime, true);
30600
30623
  if (pause) {
30601
30624
  this.pause();
30602
30625
  }
30603
30626
  };
30627
+ /**
30628
+ * 前进合成到指定时间
30629
+ * @param time - 相对0时刻的时间
30630
+ * @param skipRender - 是否跳过渲染
30631
+ */
30604
30632
  Composition.prototype.forwardTime = function (time, skipRender) {
30605
30633
  if (skipRender === void 0) { skipRender = false; }
30606
- var deltaTime = (this.startTime + Math.max(0, time)) * 1000 - this.content.timeInms;
30634
+ var deltaTime = time * 1000 - this.content.timeInms;
30607
30635
  var reverse = deltaTime < 0;
30608
30636
  var step = 15;
30609
30637
  var t = Math.abs(deltaTime);
@@ -32786,9 +32814,9 @@ Geometry.create = function (engine, options) {
32786
32814
  Mesh.create = function (engine, props) {
32787
32815
  return new ThreeMesh(engine, props);
32788
32816
  };
32789
- var version = "1.1.4";
32817
+ var version = "1.1.6";
32790
32818
  console.info({
32791
- content: '[Galacean Effects THREEJS] version: ' + "1.1.4",
32819
+ content: '[Galacean Effects THREEJS] version: ' + "1.1.6",
32792
32820
  type: LOG_TYPE,
32793
32821
  });
32794
32822