@galacean/effects 2.0.0-alpha.2 → 2.0.0-alpha.3

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.js CHANGED
@@ -7336,275 +7336,6 @@ function generateSerializableMember(type, sourceName) {
7336
7336
  };
7337
7337
  }
7338
7338
 
7339
- /**
7340
- * @since 2.0.0
7341
- * @internal
7342
- */
7343
- var EffectsObject = /** @class */ (function () {
7344
- function EffectsObject(engine) {
7345
- this.engine = engine;
7346
- this.guid = generateGUID();
7347
- this.taggedProperties = {};
7348
- this.engine.addInstance(this);
7349
- }
7350
- EffectsObject.prototype.getInstanceId = function () {
7351
- return this.guid;
7352
- };
7353
- EffectsObject.prototype.setInstanceId = function (guid) {
7354
- this.engine.removeInstance(this.guid);
7355
- this.guid = guid;
7356
- this.engine.addInstance(this);
7357
- };
7358
- EffectsObject.prototype.toData = function () { };
7359
- /**
7360
- * 反序列化函数
7361
- *
7362
- * @param data - 对象的序列化的数据
7363
- */
7364
- EffectsObject.prototype.fromData = function (data) {
7365
- if (data.id) {
7366
- this.setInstanceId(data.id);
7367
- }
7368
- };
7369
- EffectsObject.prototype.dispose = function () { };
7370
- __decorate([
7371
- serialize()
7372
- ], EffectsObject.prototype, "guid", void 0);
7373
- return EffectsObject;
7374
- }());
7375
-
7376
- /**
7377
- * @since 2.0.0
7378
- * @internal
7379
- */
7380
- var Component = /** @class */ (function (_super) {
7381
- __extends(Component, _super);
7382
- function Component() {
7383
- return _super !== null && _super.apply(this, arguments) || this;
7384
- }
7385
- Object.defineProperty(Component.prototype, "transform", {
7386
- /**
7387
- * 附加到的 VFXItem 对象 Transform 组件
7388
- */
7389
- get: function () {
7390
- return this.item.transform;
7391
- },
7392
- enumerable: false,
7393
- configurable: true
7394
- });
7395
- Component.prototype.onAttached = function () { };
7396
- Component.prototype.onDestroy = function () { };
7397
- Component.prototype.fromData = function (data) {
7398
- _super.prototype.fromData.call(this, data);
7399
- if (data.item) {
7400
- this.item = data.item;
7401
- }
7402
- };
7403
- Component.prototype.dispose = function () {
7404
- this.onDestroy();
7405
- if (this.item) {
7406
- removeItem(this.item.components, this);
7407
- }
7408
- };
7409
- return Component;
7410
- }(EffectsObject));
7411
- /**
7412
- * @since 2.0.0
7413
- * @internal
7414
- */
7415
- var Behaviour = /** @class */ (function (_super) {
7416
- __extends(Behaviour, _super);
7417
- function Behaviour() {
7418
- var _this = _super !== null && _super.apply(this, arguments) || this;
7419
- _this._enabled = true;
7420
- return _this;
7421
- }
7422
- Object.defineProperty(Behaviour.prototype, "isActiveAndEnabled", {
7423
- /**
7424
- * 组件是否可以更新,true 更新,false 不更新
7425
- */
7426
- get: function () {
7427
- return this.item.getVisible() && this.enabled;
7428
- },
7429
- enumerable: false,
7430
- configurable: true
7431
- });
7432
- Object.defineProperty(Behaviour.prototype, "enabled", {
7433
- get: function () {
7434
- return this._enabled;
7435
- },
7436
- set: function (value) {
7437
- this._enabled = value;
7438
- if (value) {
7439
- this.onBehaviourEnable();
7440
- }
7441
- },
7442
- enumerable: false,
7443
- configurable: true
7444
- });
7445
- Behaviour.prototype.onBehaviourEnable = function () { };
7446
- Behaviour.prototype.fromData = function (data) {
7447
- _super.prototype.fromData.call(this, data);
7448
- };
7449
- Behaviour.prototype.toData = function () {
7450
- _super.prototype.toData.call(this);
7451
- };
7452
- __decorate([
7453
- serialize()
7454
- ], Behaviour.prototype, "_enabled", void 0);
7455
- return Behaviour;
7456
- }(Component));
7457
- /**
7458
- * @since 2.0.0
7459
- * @internal
7460
- */
7461
- var ItemBehaviour = /** @class */ (function (_super) {
7462
- __extends(ItemBehaviour, _super);
7463
- function ItemBehaviour() {
7464
- var _this = _super !== null && _super.apply(this, arguments) || this;
7465
- _this.started = false;
7466
- return _this;
7467
- }
7468
- // /**
7469
- // * 生命周期函数,初始化后调用,生命周期内只调用一次
7470
- // */
7471
- // awake () {
7472
- // // OVERRIDE
7473
- // }
7474
- /**
7475
- * 在每次设置 enabled 为 true 时触发
7476
- */
7477
- ItemBehaviour.prototype.onEnable = function () { };
7478
- /**
7479
- * 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
7480
- */
7481
- ItemBehaviour.prototype.start = function () {
7482
- // OVERRIDE
7483
- };
7484
- /**
7485
- * 生命周期函数,每帧调用一次
7486
- */
7487
- ItemBehaviour.prototype.update = function (dt) {
7488
- // OVERRIDE
7489
- };
7490
- /**
7491
- * 生命周期函数,每帧调用一次,在 update 之后调用
7492
- */
7493
- ItemBehaviour.prototype.lateUpdate = function (dt) {
7494
- // OVERRIDE
7495
- };
7496
- ItemBehaviour.prototype.onAttached = function () {
7497
- this.item.itemBehaviours.push(this);
7498
- };
7499
- ItemBehaviour.prototype.dispose = function () {
7500
- if (this.item) {
7501
- removeItem(this.item.itemBehaviours, this);
7502
- }
7503
- _super.prototype.dispose.call(this);
7504
- };
7505
- ItemBehaviour.prototype.onBehaviourEnable = function () {
7506
- this.onEnable();
7507
- if (!this.started) {
7508
- this.start();
7509
- this.started = true;
7510
- }
7511
- };
7512
- return ItemBehaviour;
7513
- }(Behaviour));
7514
-
7515
- /**
7516
- * 所有渲染组件的基类
7517
- * @since 2.0.0
7518
- */
7519
- var RendererComponent = /** @class */ (function (_super) {
7520
- __extends(RendererComponent, _super);
7521
- function RendererComponent() {
7522
- var _this = _super !== null && _super.apply(this, arguments) || this;
7523
- _this.started = false;
7524
- _this.materials = [];
7525
- _this._enabled = true;
7526
- return _this;
7527
- }
7528
- Object.defineProperty(RendererComponent.prototype, "priority", {
7529
- get: function () {
7530
- return this._priority;
7531
- },
7532
- set: function (value) {
7533
- this._priority = value;
7534
- },
7535
- enumerable: false,
7536
- configurable: true
7537
- });
7538
- Object.defineProperty(RendererComponent.prototype, "enabled", {
7539
- get: function () {
7540
- return this._enabled;
7541
- },
7542
- set: function (value) {
7543
- this._enabled = value;
7544
- if (value) {
7545
- this.onEnable();
7546
- }
7547
- },
7548
- enumerable: false,
7549
- configurable: true
7550
- });
7551
- Object.defineProperty(RendererComponent.prototype, "isActiveAndEnabled", {
7552
- /**
7553
- * 组件是否可以更新,true 更新,false 不更新
7554
- */
7555
- get: function () {
7556
- return this.item.getVisible() && this.enabled;
7557
- },
7558
- enumerable: false,
7559
- configurable: true
7560
- });
7561
- Object.defineProperty(RendererComponent.prototype, "material", {
7562
- get: function () {
7563
- return this.materials[0];
7564
- },
7565
- set: function (material) {
7566
- if (this.materials.length === 0) {
7567
- this.materials.push(material);
7568
- }
7569
- else {
7570
- this.materials[0] = material;
7571
- }
7572
- },
7573
- enumerable: false,
7574
- configurable: true
7575
- });
7576
- RendererComponent.prototype.onEnable = function () { };
7577
- RendererComponent.prototype.start = function () { };
7578
- RendererComponent.prototype.update = function (dt) { };
7579
- RendererComponent.prototype.lateUpdate = function (dt) { };
7580
- RendererComponent.prototype.render = function (renderer) { };
7581
- RendererComponent.prototype.onAttached = function () {
7582
- this.item.rendererComponents.push(this);
7583
- };
7584
- RendererComponent.prototype.fromData = function (data) {
7585
- _super.prototype.fromData.call(this, data);
7586
- };
7587
- RendererComponent.prototype.toData = function () {
7588
- _super.prototype.toData.call(this);
7589
- };
7590
- RendererComponent.prototype.dispose = function () {
7591
- if (this.item) {
7592
- removeItem(this.item.rendererComponents, this);
7593
- }
7594
- _super.prototype.dispose.call(this);
7595
- };
7596
- __decorate([
7597
- serialize()
7598
- ], RendererComponent.prototype, "materials", void 0);
7599
- __decorate([
7600
- serialize()
7601
- ], RendererComponent.prototype, "_priority", void 0);
7602
- __decorate([
7603
- serialize()
7604
- ], RendererComponent.prototype, "_enabled", void 0);
7605
- return RendererComponent;
7606
- }(Component));
7607
-
7608
7339
  exports.ShaderType = void 0;
7609
7340
  (function (ShaderType) {
7610
7341
  ShaderType[ShaderType["vertex"] = 0] = "vertex";
@@ -8191,6 +7922,43 @@ function loadMipmapImage(pointer, bins) {
8191
7922
  });
8192
7923
  }
8193
7924
 
7925
+ /**
7926
+ * @since 2.0.0
7927
+ * @internal
7928
+ */
7929
+ var EffectsObject = /** @class */ (function () {
7930
+ function EffectsObject(engine) {
7931
+ this.engine = engine;
7932
+ this.guid = generateGUID();
7933
+ this.taggedProperties = {};
7934
+ this.engine.addInstance(this);
7935
+ }
7936
+ EffectsObject.prototype.getInstanceId = function () {
7937
+ return this.guid;
7938
+ };
7939
+ EffectsObject.prototype.setInstanceId = function (guid) {
7940
+ this.engine.removeInstance(this.guid);
7941
+ this.guid = guid;
7942
+ this.engine.addInstance(this);
7943
+ };
7944
+ EffectsObject.prototype.toData = function () { };
7945
+ /**
7946
+ * 反序列化函数
7947
+ *
7948
+ * @param data - 对象的序列化的数据
7949
+ */
7950
+ EffectsObject.prototype.fromData = function (data) {
7951
+ if (data.id) {
7952
+ this.setInstanceId(data.id);
7953
+ }
7954
+ };
7955
+ EffectsObject.prototype.dispose = function () { };
7956
+ __decorate([
7957
+ serialize()
7958
+ ], EffectsObject.prototype, "guid", void 0);
7959
+ return EffectsObject;
7960
+ }());
7961
+
8194
7962
  var seed$d = 1;
8195
7963
  /**
8196
7964
  * Texture 抽象类
@@ -9001,54 +8769,286 @@ var SemanticMap = /** @class */ (function () {
9001
8769
  SemanticMap.prototype.hasSemanticValue = function (name) {
9002
8770
  return name in this.semantics;
9003
8771
  };
9004
- SemanticMap.prototype.dispose = function () {
9005
- var _this = this;
9006
- Object.keys(this.semantics).forEach(function (name) {
9007
- delete _this.semantics[name];
9008
- });
8772
+ SemanticMap.prototype.dispose = function () {
8773
+ var _this = this;
8774
+ Object.keys(this.semantics).forEach(function (name) {
8775
+ delete _this.semantics[name];
8776
+ });
8777
+ };
8778
+ return SemanticMap;
8779
+ }());
8780
+
8781
+ var _a$8;
8782
+ var BYTES_TYPE_MAP = (_a$8 = {},
8783
+ _a$8[glContext.FLOAT] = Float32Array.BYTES_PER_ELEMENT,
8784
+ _a$8[glContext.INT] = Int32Array.BYTES_PER_ELEMENT,
8785
+ _a$8[glContext.SHORT] = Int16Array.BYTES_PER_ELEMENT,
8786
+ _a$8[glContext.BYTE] = Int8Array.BYTES_PER_ELEMENT,
8787
+ _a$8);
8788
+ /**
8789
+ * Geometry 抽象类
8790
+ */
8791
+ var Geometry = /** @class */ (function (_super) {
8792
+ __extends(Geometry, _super);
8793
+ function Geometry() {
8794
+ return _super !== null && _super.apply(this, arguments) || this;
8795
+ }
8796
+ /**
8797
+ * 初始化 GPU 资源
8798
+ * @override
8799
+ */
8800
+ Geometry.prototype.initialize = function () {
8801
+ // OVERRIDE
8802
+ };
8803
+ /**
8804
+ * 几何数据刷新
8805
+ */
8806
+ Geometry.prototype.flush = function () {
8807
+ // OVERRIDE
8808
+ };
8809
+ return Geometry;
8810
+ }(EffectsObject));
8811
+ function generateEmptyTypedArray(type) {
8812
+ if (type === glContext.INT) {
8813
+ return new Int32Array(0);
8814
+ }
8815
+ if (type === glContext.SHORT) {
8816
+ return new Int16Array(0);
8817
+ }
8818
+ return new Float32Array(0);
8819
+ }
8820
+
8821
+ /**
8822
+ * @since 2.0.0
8823
+ * @internal
8824
+ */
8825
+ var Component = /** @class */ (function (_super) {
8826
+ __extends(Component, _super);
8827
+ function Component() {
8828
+ return _super !== null && _super.apply(this, arguments) || this;
8829
+ }
8830
+ Object.defineProperty(Component.prototype, "transform", {
8831
+ /**
8832
+ * 附加到的 VFXItem 对象 Transform 组件
8833
+ */
8834
+ get: function () {
8835
+ return this.item.transform;
8836
+ },
8837
+ enumerable: false,
8838
+ configurable: true
8839
+ });
8840
+ Component.prototype.onAttached = function () { };
8841
+ Component.prototype.onDestroy = function () { };
8842
+ Component.prototype.fromData = function (data) {
8843
+ _super.prototype.fromData.call(this, data);
8844
+ if (data.item) {
8845
+ this.item = data.item;
8846
+ }
8847
+ };
8848
+ Component.prototype.dispose = function () {
8849
+ this.onDestroy();
8850
+ if (this.item) {
8851
+ removeItem(this.item.components, this);
8852
+ }
8853
+ };
8854
+ return Component;
8855
+ }(EffectsObject));
8856
+ /**
8857
+ * @since 2.0.0
8858
+ * @internal
8859
+ */
8860
+ var Behaviour = /** @class */ (function (_super) {
8861
+ __extends(Behaviour, _super);
8862
+ function Behaviour() {
8863
+ var _this = _super !== null && _super.apply(this, arguments) || this;
8864
+ _this._enabled = true;
8865
+ return _this;
8866
+ }
8867
+ Object.defineProperty(Behaviour.prototype, "isActiveAndEnabled", {
8868
+ /**
8869
+ * 组件是否可以更新,true 更新,false 不更新
8870
+ */
8871
+ get: function () {
8872
+ return this.item.getVisible() && this.enabled;
8873
+ },
8874
+ enumerable: false,
8875
+ configurable: true
8876
+ });
8877
+ Object.defineProperty(Behaviour.prototype, "enabled", {
8878
+ get: function () {
8879
+ return this._enabled;
8880
+ },
8881
+ set: function (value) {
8882
+ this._enabled = value;
8883
+ if (value) {
8884
+ this.onBehaviourEnable();
8885
+ }
8886
+ },
8887
+ enumerable: false,
8888
+ configurable: true
8889
+ });
8890
+ Behaviour.prototype.onBehaviourEnable = function () { };
8891
+ Behaviour.prototype.fromData = function (data) {
8892
+ _super.prototype.fromData.call(this, data);
8893
+ };
8894
+ Behaviour.prototype.toData = function () {
8895
+ _super.prototype.toData.call(this);
9009
8896
  };
9010
- return SemanticMap;
9011
- }());
9012
-
9013
- var _a$8;
9014
- var BYTES_TYPE_MAP = (_a$8 = {},
9015
- _a$8[glContext.FLOAT] = Float32Array.BYTES_PER_ELEMENT,
9016
- _a$8[glContext.INT] = Int32Array.BYTES_PER_ELEMENT,
9017
- _a$8[glContext.SHORT] = Int16Array.BYTES_PER_ELEMENT,
9018
- _a$8[glContext.BYTE] = Int8Array.BYTES_PER_ELEMENT,
9019
- _a$8);
8897
+ __decorate([
8898
+ serialize()
8899
+ ], Behaviour.prototype, "_enabled", void 0);
8900
+ return Behaviour;
8901
+ }(Component));
9020
8902
  /**
9021
- * Geometry 抽象类
8903
+ * @since 2.0.0
8904
+ * @internal
9022
8905
  */
9023
- var Geometry = /** @class */ (function (_super) {
9024
- __extends(Geometry, _super);
9025
- function Geometry() {
9026
- return _super !== null && _super.apply(this, arguments) || this;
8906
+ var ItemBehaviour = /** @class */ (function (_super) {
8907
+ __extends(ItemBehaviour, _super);
8908
+ function ItemBehaviour() {
8909
+ var _this = _super !== null && _super.apply(this, arguments) || this;
8910
+ _this.started = false;
8911
+ return _this;
9027
8912
  }
8913
+ // /**
8914
+ // * 生命周期函数,初始化后调用,生命周期内只调用一次
8915
+ // */
8916
+ // awake () {
8917
+ // // OVERRIDE
8918
+ // }
9028
8919
  /**
9029
- * 初始化 GPU 资源
9030
- * @override
8920
+ * 在每次设置 enabled 为 true 时触发
9031
8921
  */
9032
- Geometry.prototype.initialize = function () {
8922
+ ItemBehaviour.prototype.onEnable = function () { };
8923
+ /**
8924
+ * 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
8925
+ */
8926
+ ItemBehaviour.prototype.start = function () {
9033
8927
  // OVERRIDE
9034
8928
  };
9035
8929
  /**
9036
- * 几何数据刷新
8930
+ * 生命周期函数,每帧调用一次
9037
8931
  */
9038
- Geometry.prototype.flush = function () {
8932
+ ItemBehaviour.prototype.update = function (dt) {
9039
8933
  // OVERRIDE
9040
8934
  };
9041
- return Geometry;
9042
- }(EffectsObject));
9043
- function generateEmptyTypedArray(type) {
9044
- if (type === glContext.INT) {
9045
- return new Int32Array(0);
9046
- }
9047
- if (type === glContext.SHORT) {
9048
- return new Int16Array(0);
8935
+ /**
8936
+ * 生命周期函数,每帧调用一次,在 update 之后调用
8937
+ */
8938
+ ItemBehaviour.prototype.lateUpdate = function (dt) {
8939
+ // OVERRIDE
8940
+ };
8941
+ ItemBehaviour.prototype.onAttached = function () {
8942
+ this.item.itemBehaviours.push(this);
8943
+ };
8944
+ ItemBehaviour.prototype.dispose = function () {
8945
+ if (this.item) {
8946
+ removeItem(this.item.itemBehaviours, this);
8947
+ }
8948
+ _super.prototype.dispose.call(this);
8949
+ };
8950
+ ItemBehaviour.prototype.onBehaviourEnable = function () {
8951
+ this.onEnable();
8952
+ if (!this.started) {
8953
+ this.start();
8954
+ this.started = true;
8955
+ }
8956
+ };
8957
+ return ItemBehaviour;
8958
+ }(Behaviour));
8959
+
8960
+ /**
8961
+ * 所有渲染组件的基类
8962
+ * @since 2.0.0
8963
+ */
8964
+ var RendererComponent = /** @class */ (function (_super) {
8965
+ __extends(RendererComponent, _super);
8966
+ function RendererComponent() {
8967
+ var _this = _super !== null && _super.apply(this, arguments) || this;
8968
+ _this.started = false;
8969
+ _this.materials = [];
8970
+ _this._enabled = true;
8971
+ return _this;
9049
8972
  }
9050
- return new Float32Array(0);
9051
- }
8973
+ Object.defineProperty(RendererComponent.prototype, "priority", {
8974
+ get: function () {
8975
+ return this._priority;
8976
+ },
8977
+ set: function (value) {
8978
+ this._priority = value;
8979
+ },
8980
+ enumerable: false,
8981
+ configurable: true
8982
+ });
8983
+ Object.defineProperty(RendererComponent.prototype, "enabled", {
8984
+ get: function () {
8985
+ return this._enabled;
8986
+ },
8987
+ set: function (value) {
8988
+ this._enabled = value;
8989
+ if (value) {
8990
+ this.onEnable();
8991
+ }
8992
+ },
8993
+ enumerable: false,
8994
+ configurable: true
8995
+ });
8996
+ Object.defineProperty(RendererComponent.prototype, "isActiveAndEnabled", {
8997
+ /**
8998
+ * 组件是否可以更新,true 更新,false 不更新
8999
+ */
9000
+ get: function () {
9001
+ return this.item.getVisible() && this.enabled;
9002
+ },
9003
+ enumerable: false,
9004
+ configurable: true
9005
+ });
9006
+ Object.defineProperty(RendererComponent.prototype, "material", {
9007
+ get: function () {
9008
+ return this.materials[0];
9009
+ },
9010
+ set: function (material) {
9011
+ if (this.materials.length === 0) {
9012
+ this.materials.push(material);
9013
+ }
9014
+ else {
9015
+ this.materials[0] = material;
9016
+ }
9017
+ },
9018
+ enumerable: false,
9019
+ configurable: true
9020
+ });
9021
+ RendererComponent.prototype.onEnable = function () { };
9022
+ RendererComponent.prototype.start = function () { };
9023
+ RendererComponent.prototype.update = function (dt) { };
9024
+ RendererComponent.prototype.lateUpdate = function (dt) { };
9025
+ RendererComponent.prototype.render = function (renderer) { };
9026
+ RendererComponent.prototype.onAttached = function () {
9027
+ this.item.rendererComponents.push(this);
9028
+ };
9029
+ RendererComponent.prototype.fromData = function (data) {
9030
+ _super.prototype.fromData.call(this, data);
9031
+ };
9032
+ RendererComponent.prototype.toData = function () {
9033
+ _super.prototype.toData.call(this);
9034
+ };
9035
+ RendererComponent.prototype.dispose = function () {
9036
+ if (this.item) {
9037
+ removeItem(this.item.rendererComponents, this);
9038
+ }
9039
+ _super.prototype.dispose.call(this);
9040
+ };
9041
+ __decorate([
9042
+ serialize()
9043
+ ], RendererComponent.prototype, "materials", void 0);
9044
+ __decorate([
9045
+ serialize()
9046
+ ], RendererComponent.prototype, "_priority", void 0);
9047
+ __decorate([
9048
+ serialize()
9049
+ ], RendererComponent.prototype, "_enabled", void 0);
9050
+ return RendererComponent;
9051
+ }(Component));
9052
9052
 
9053
9053
  var seed$b = 1;
9054
9054
  /**
@@ -11285,7 +11285,7 @@ var SerializationHelper = /** @class */ (function () {
11285
11285
  };
11286
11286
  SerializationHelper.deserializeProperty = function (property, engine, level) {
11287
11287
  var e_11, _a, e_12, _b;
11288
- if (level > 10) {
11288
+ if (level > 14) {
11289
11289
  console.error('序列化数据的内嵌对象层数大于上限');
11290
11290
  return;
11291
11291
  }
@@ -11346,7 +11346,7 @@ var SerializationHelper = /** @class */ (function () {
11346
11346
  return __generator(this, function (_j) {
11347
11347
  switch (_j.label) {
11348
11348
  case 0:
11349
- if (level > 10) {
11349
+ if (level > 14) {
11350
11350
  console.error('序列化数据的内嵌对象层数大于上限');
11351
11351
  return [2 /*return*/];
11352
11352
  }
@@ -11437,7 +11437,7 @@ var SerializationHelper = /** @class */ (function () {
11437
11437
  };
11438
11438
  SerializationHelper.serializeObjectProperty = function (objectProperty, serializedData, level) {
11439
11439
  var e_15, _a;
11440
- if (level > 10) {
11440
+ if (level > 14) {
11441
11441
  console.error('序列化数据的内嵌对象层数大于上限');
11442
11442
  return;
11443
11443
  }
@@ -11482,7 +11482,7 @@ var SerializationHelper = /** @class */ (function () {
11482
11482
  }
11483
11483
  };
11484
11484
  SerializationHelper.serializeArrayProperty = function (arrayProperty, serializedData, level) {
11485
- if (level > 10) {
11485
+ if (level > 14) {
11486
11486
  console.error('序列化数据的内嵌对象层数大于上限');
11487
11487
  return;
11488
11488
  }
@@ -11648,24 +11648,24 @@ var Database = /** @class */ (function () {
11648
11648
  }());
11649
11649
  exports.DataType = void 0;
11650
11650
  (function (DataType) {
11651
- DataType[DataType["VFXItemData"] = 0] = "VFXItemData";
11652
- DataType[DataType["EffectComponent"] = 1] = "EffectComponent";
11653
- DataType[DataType["Material"] = 2] = "Material";
11654
- DataType[DataType["Shader"] = 3] = "Shader";
11655
- DataType[DataType["SpriteComponent"] = 4] = "SpriteComponent";
11656
- DataType[DataType["ParticleSystem"] = 5] = "ParticleSystem";
11657
- DataType[DataType["InteractComponent"] = 6] = "InteractComponent";
11658
- DataType[DataType["CameraController"] = 7] = "CameraController";
11659
- DataType[DataType["Geometry"] = 8] = "Geometry";
11660
- DataType[DataType["Texture"] = 9] = "Texture";
11661
- DataType[DataType["TextComponent"] = 10] = "TextComponent";
11651
+ DataType["VFXItemData"] = "VFXItemData";
11652
+ DataType["EffectComponent"] = "EffectComponent";
11653
+ DataType["Material"] = "Material";
11654
+ DataType["Shader"] = "Shader";
11655
+ DataType["SpriteComponent"] = "SpriteComponent";
11656
+ DataType["ParticleSystem"] = "ParticleSystem";
11657
+ DataType["InteractComponent"] = "InteractComponent";
11658
+ DataType["CameraController"] = "CameraController";
11659
+ DataType["Geometry"] = "Geometry";
11660
+ DataType["Texture"] = "Texture";
11661
+ DataType["TextComponent"] = "TextComponent";
11662
11662
  // FIXME: 先完成ECS的场景转换,后面移到spec中
11663
- DataType[DataType["MeshComponent"] = 10000] = "MeshComponent";
11664
- DataType[DataType["SkyboxComponent"] = 10001] = "SkyboxComponent";
11665
- DataType[DataType["LightComponent"] = 10002] = "LightComponent";
11666
- DataType[DataType["CameraComponent"] = 10003] = "CameraComponent";
11667
- DataType[DataType["ModelPluginComponent"] = 10004] = "ModelPluginComponent";
11668
- DataType[DataType["TreeComponent"] = 10005] = "TreeComponent";
11663
+ DataType["MeshComponent"] = "MeshComponent";
11664
+ DataType["SkyboxComponent"] = "SkyboxComponent";
11665
+ DataType["LightComponent"] = "LightComponent";
11666
+ DataType["CameraComponent"] = "CameraComponent";
11667
+ DataType["ModelPluginComponent"] = "ModelPluginComponent";
11668
+ DataType["TreeComponent"] = "TreeComponent";
11669
11669
  })(exports.DataType || (exports.DataType = {}));
11670
11670
 
11671
11671
  /**
@@ -13932,15 +13932,25 @@ var PlayableOutput = /** @class */ (function () {
13932
13932
  };
13933
13933
  return PlayableOutput;
13934
13934
  }());
13935
+ var PlayableAsset = /** @class */ (function () {
13936
+ function PlayableAsset() {
13937
+ }
13938
+ PlayableAsset.prototype.fromData = function (data) {
13939
+ };
13940
+ return PlayableAsset;
13941
+ }());
13935
13942
 
13936
13943
  /**
13937
13944
  * @since 2.0.0
13938
13945
  * @internal
13939
13946
  */
13940
- var Track = /** @class */ (function () {
13947
+ var Track = /** @class */ (function (_super) {
13948
+ __extends(Track, _super);
13941
13949
  function Track() {
13942
- this.clips = [];
13943
- this.clipSeed = 0;
13950
+ var _this = _super !== null && _super.apply(this, arguments) || this;
13951
+ _this.clips = [];
13952
+ _this.clipSeed = 0;
13953
+ return _this;
13944
13954
  }
13945
13955
  Track.prototype.createOutput = function () {
13946
13956
  var output = new PlayableOutput();
@@ -13952,7 +13962,7 @@ var Track = /** @class */ (function () {
13952
13962
  Track.prototype.createMixerPlayable = function () {
13953
13963
  return new Playable();
13954
13964
  };
13955
- Track.prototype.createPlayebleTree = function () {
13965
+ Track.prototype.createPlayable = function () {
13956
13966
  var e_1, _a;
13957
13967
  var defaultMixPlayable = this.createMixerPlayable();
13958
13968
  try {
@@ -14004,7 +14014,7 @@ var Track = /** @class */ (function () {
14004
14014
  this.clips.push(clip);
14005
14015
  };
14006
14016
  return Track;
14007
- }());
14017
+ }(PlayableAsset));
14008
14018
  /**
14009
14019
  * @since 2.0.0
14010
14020
  * @internal
@@ -14060,12 +14070,12 @@ var tempPos = new Vector3();
14060
14070
  * @since 2.0.0
14061
14071
  * @internal
14062
14072
  */
14063
- var AnimationClipPlayable = /** @class */ (function (_super) {
14064
- __extends(AnimationClipPlayable, _super);
14065
- function AnimationClipPlayable() {
14073
+ var TransformAnimationPlayable = /** @class */ (function (_super) {
14074
+ __extends(TransformAnimationPlayable, _super);
14075
+ function TransformAnimationPlayable() {
14066
14076
  return _super !== null && _super.apply(this, arguments) || this;
14067
14077
  }
14068
- AnimationClipPlayable.prototype.processFrame = function (dt) {
14078
+ TransformAnimationPlayable.prototype.processFrame = function (dt) {
14069
14079
  if (this.bindingItem.composition) {
14070
14080
  this.sampleAnimation();
14071
14081
  }
@@ -14073,7 +14083,7 @@ var AnimationClipPlayable = /** @class */ (function (_super) {
14073
14083
  /**
14074
14084
  * 应用时间轴K帧数据到对象
14075
14085
  */
14076
- AnimationClipPlayable.prototype.sampleAnimation = function () {
14086
+ TransformAnimationPlayable.prototype.sampleAnimation = function () {
14077
14087
  var _this = this;
14078
14088
  var duration = this.bindingItem.duration;
14079
14089
  var life = this.time / duration;
@@ -14118,7 +14128,7 @@ var AnimationClipPlayable = /** @class */ (function (_super) {
14118
14128
  // this.animationStream.setCurveValue('transform', 'position.z', pos.z);
14119
14129
  }
14120
14130
  };
14121
- AnimationClipPlayable.prototype.fromData = function (data) {
14131
+ TransformAnimationPlayable.prototype.fromData = function (data) {
14122
14132
  var _a;
14123
14133
  var scale = this.bindingItem.transform.scale;
14124
14134
  this.originalTransform = {
@@ -14189,30 +14199,45 @@ var AnimationClipPlayable = /** @class */ (function (_super) {
14189
14199
  this.velocity = this.direction.clone();
14190
14200
  this.velocity.multiply(this.startSpeed);
14191
14201
  };
14192
- return AnimationClipPlayable;
14202
+ return TransformAnimationPlayable;
14193
14203
  }(AnimationPlayable));
14204
+ var TransformAnimationPlayableAsset = /** @class */ (function (_super) {
14205
+ __extends(TransformAnimationPlayableAsset, _super);
14206
+ function TransformAnimationPlayableAsset() {
14207
+ return _super !== null && _super.apply(this, arguments) || this;
14208
+ }
14209
+ TransformAnimationPlayableAsset.prototype.createPlayable = function () {
14210
+ var transformAnimationPlayable = new TransformAnimationPlayable();
14211
+ transformAnimationPlayable.fromData(this.transformAnimationData);
14212
+ return transformAnimationPlayable;
14213
+ };
14214
+ TransformAnimationPlayableAsset.prototype.fromData = function (data) {
14215
+ this.transformAnimationData = data;
14216
+ };
14217
+ return TransformAnimationPlayableAsset;
14218
+ }(PlayableAsset));
14194
14219
  /**
14195
14220
  * @since 2.0.0
14196
14221
  * @internal
14197
14222
  */
14198
- var ActivationClipPlayable = /** @class */ (function (_super) {
14199
- __extends(ActivationClipPlayable, _super);
14200
- function ActivationClipPlayable() {
14223
+ var ActivationPlayable = /** @class */ (function (_super) {
14224
+ __extends(ActivationPlayable, _super);
14225
+ function ActivationPlayable() {
14201
14226
  return _super !== null && _super.apply(this, arguments) || this;
14202
14227
  }
14203
- ActivationClipPlayable.prototype.onGraphStart = function () {
14228
+ ActivationPlayable.prototype.onGraphStart = function () {
14204
14229
  this.bindingItem.transform.setValid(false);
14205
14230
  this.hideRendererComponents();
14206
14231
  };
14207
- ActivationClipPlayable.prototype.onPlayablePlay = function () {
14232
+ ActivationPlayable.prototype.onPlayablePlay = function () {
14208
14233
  this.bindingItem.transform.setValid(true);
14209
14234
  this.showRendererComponents();
14210
14235
  };
14211
- ActivationClipPlayable.prototype.onPlayableDestroy = function () {
14236
+ ActivationPlayable.prototype.onPlayableDestroy = function () {
14212
14237
  this.bindingItem.transform.setValid(false);
14213
14238
  this.hideRendererComponents();
14214
14239
  };
14215
- ActivationClipPlayable.prototype.hideRendererComponents = function () {
14240
+ ActivationPlayable.prototype.hideRendererComponents = function () {
14216
14241
  var e_1, _a;
14217
14242
  try {
14218
14243
  for (var _b = __values$1(this.bindingItem.rendererComponents), _c = _b.next(); !_c.done; _c = _b.next()) {
@@ -14230,7 +14255,7 @@ var ActivationClipPlayable = /** @class */ (function (_super) {
14230
14255
  finally { if (e_1) throw e_1.error; }
14231
14256
  }
14232
14257
  };
14233
- ActivationClipPlayable.prototype.showRendererComponents = function () {
14258
+ ActivationPlayable.prototype.showRendererComponents = function () {
14234
14259
  var e_2, _a;
14235
14260
  try {
14236
14261
  for (var _b = __values$1(this.bindingItem.rendererComponents), _c = _b.next(); !_c.done; _c = _b.next()) {
@@ -14248,7 +14273,7 @@ var ActivationClipPlayable = /** @class */ (function (_super) {
14248
14273
  finally { if (e_2) throw e_2.error; }
14249
14274
  }
14250
14275
  };
14251
- return ActivationClipPlayable;
14276
+ return ActivationPlayable;
14252
14277
  }(Playable));
14253
14278
 
14254
14279
  /**
@@ -14503,7 +14528,7 @@ var TimelineComponent = /** @class */ (function (_super) {
14503
14528
  try {
14504
14529
  for (var _b = __values$1(this.tracks), _c = _b.next(); !_c.done; _c = _b.next()) {
14505
14530
  var track = _c.value;
14506
- var trackMixPlayable = track.createPlayebleTree();
14531
+ var trackMixPlayable = track.createPlayable();
14507
14532
  var trackOutput = track.createOutput();
14508
14533
  graph.addOutput(trackOutput);
14509
14534
  trackOutput.setSourcePlayeble(trackMixPlayable);
@@ -14518,6 +14543,7 @@ var TimelineComponent = /** @class */ (function (_super) {
14518
14543
  }
14519
14544
  };
14520
14545
  TimelineComponent.prototype.fromData = function (data) {
14546
+ var e_13, _a, e_14, _b;
14521
14547
  _super.prototype.fromData.call(this, data);
14522
14548
  this.options = {
14523
14549
  start: this.item.start,
@@ -14528,7 +14554,47 @@ var TimelineComponent = /** @class */ (function (_super) {
14528
14554
  this.id = this.item.id;
14529
14555
  this.name = this.item.name;
14530
14556
  var activationTrack = this.createTrack(Track, 'ActivationTrack');
14531
- activationTrack.createClip(ActivationClipPlayable, 'ActivationTimelineClip');
14557
+ activationTrack.createClip(ActivationPlayable, 'ActivationTimelineClip');
14558
+ //@ts-expect-error
14559
+ if (data.tracks) {
14560
+ //@ts-expect-error
14561
+ var tracks = data.tracks;
14562
+ try {
14563
+ for (var tracks_1 = __values$1(tracks), tracks_1_1 = tracks_1.next(); !tracks_1_1.done; tracks_1_1 = tracks_1.next()) {
14564
+ var track = tracks_1_1.value;
14565
+ var newTrack = this.createTrack(Track);
14566
+ try {
14567
+ for (var _c = (e_14 = void 0, __values$1(track.clips)), _d = _c.next(); !_d.done; _d = _c.next()) {
14568
+ var clipAsset = _d.value;
14569
+ switch (clipAsset.dataType) {
14570
+ case 'TransformAnimationPlayableAsset':
14571
+ newTrack.name = 'AnimationTrack';
14572
+ newTrack.createClip(TransformAnimationPlayable, 'AnimationTimelineClip').playable.fromData(clipAsset.animationClip);
14573
+ break;
14574
+ case 'SpriteColorAnimationPlayableAsset':
14575
+ newTrack.name = 'SpriteColorTrack';
14576
+ newTrack.createClip(SpriteColorPlayable, 'SpriteColorClip').playable.fromData(clipAsset.animationClip);
14577
+ break;
14578
+ }
14579
+ }
14580
+ }
14581
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
14582
+ finally {
14583
+ try {
14584
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
14585
+ }
14586
+ finally { if (e_14) throw e_14.error; }
14587
+ }
14588
+ }
14589
+ }
14590
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
14591
+ finally {
14592
+ try {
14593
+ if (tracks_1_1 && !tracks_1_1.done && (_a = tracks_1.return)) _a.call(tracks_1);
14594
+ }
14595
+ finally { if (e_13) throw e_13.error; }
14596
+ }
14597
+ }
14532
14598
  };
14533
14599
  TimelineComponent.prototype.toData = function () {
14534
14600
  _super.prototype.toData.call(this);
@@ -14942,9 +15008,6 @@ var SpriteComponent = /** @class */ (function (_super) {
14942
15008
  this.material.setVector4('_Color', new Vector4$1().setFromArray(startColor));
14943
15009
  this.material.setVector4('_TexOffset', new Vector4$1().setFromArray([0, 0, 1, 1]));
14944
15010
  this.setItem();
14945
- // 添加K帧动画
14946
- var colorTrack = this.item.getComponent(TimelineComponent).createTrack(Track, 'SpriteColorTrack');
14947
- colorTrack.createClip(SpriteColorPlayable, 'SpriteColorClip').playable.fromData({ colorOverLifetime: data.colorOverLifetime, startColor: data.options.startColor });
14948
15011
  };
14949
15012
  SpriteComponent.prototype.toData = function () {
14950
15013
  _super.prototype.toData.call(this);
@@ -20601,10 +20664,6 @@ var VFXItem = /** @class */ (function (_super) {
20601
20664
  }
20602
20665
  var timelineComponent = this.getComponent(TimelineComponent);
20603
20666
  timelineComponent.fromData(data.content);
20604
- if (this.type !== ItemType$1.particle) {
20605
- var track = timelineComponent.createTrack(Track, 'AnimationTrack');
20606
- track.createClip(AnimationClipPlayable, 'AnimationTimelineClip').playable.fromData(data.content);
20607
- }
20608
20667
  if (duration <= 0) {
20609
20668
  throw Error("Item duration can't be less than 0, see ".concat(HELP_LINK$1['Item duration can\'t be less than 0']));
20610
20669
  }
@@ -22816,6 +22875,49 @@ function version3Migration(scene) {
22816
22875
  if (item.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY$1 || item.endBehavior === END_BEHAVIOR_PAUSE$1) {
22817
22876
  item.endBehavior = END_BEHAVIOR_FREEZE$1;
22818
22877
  }
22878
+ // 动画数据转化 TODO: 动画数据移到 TimelineComponentData
22879
+ //@ts-expect-error
22880
+ item.content.tracks = [];
22881
+ //@ts-expect-error
22882
+ var tracks = item.content.tracks;
22883
+ if (item.type !== ItemType$1.particle) {
22884
+ tracks.push({
22885
+ clips: [
22886
+ {
22887
+ dataType: 'TransformAnimationPlayableAsset',
22888
+ animationClip: {
22889
+ //@ts-expect-error
22890
+ sizeOverLifetime: item.content.sizeOverLifetime,
22891
+ //@ts-expect-error
22892
+ rotationOverLifetime: item.content.rotationOverLifetime,
22893
+ //@ts-expect-error
22894
+ positionOverLifetime: item.content.positionOverLifetime,
22895
+ },
22896
+ },
22897
+ ],
22898
+ });
22899
+ }
22900
+ if (item.type === ItemType$1.sprite) {
22901
+ tracks.push({
22902
+ clips: [
22903
+ {
22904
+ dataType: 'SpriteColorAnimationPlayableAsset',
22905
+ animationClip: {
22906
+ //@ts-expect-error
22907
+ colorOverLifetime: item.content.colorOverLifetime,
22908
+ //@ts-expect-error
22909
+ startColor: item.content.options.startColor,
22910
+ },
22911
+ },
22912
+ ],
22913
+ });
22914
+ }
22915
+ // gizmo 的 target id 转换为新的 item guid
22916
+ //@ts-expect-error
22917
+ if (item.content.options.target) {
22918
+ //@ts-expect-error
22919
+ item.content.options.target = itemGuidMap[item.content.options.target];
22920
+ }
22819
22921
  // item 的 content 转为 component data 加入 JSONScene.components
22820
22922
  var uuid = v4().replace(/-/g, '');
22821
22923
  if (item.type === ItemType$1.sprite) {
@@ -27944,9 +28046,9 @@ var GLMaterial = /** @class */ (function (_super) {
27944
28046
  this.setColor(name, new Color(colorValue.r, colorValue.g, colorValue.b, colorValue.a));
27945
28047
  }
27946
28048
  for (name in propertiesData.textures) {
27947
- var texture = propertiesData.textures[name];
28049
+ var textureProperties = propertiesData.textures[name];
27948
28050
  // TODO 纹理通过 id 加入场景数据
27949
- this.setTexture(name, texture);
28051
+ this.setTexture(name, textureProperties.texture);
27950
28052
  }
27951
28053
  if (data.shader) {
27952
28054
  this.shader = data.shader;
@@ -31112,12 +31214,11 @@ Renderer.create = function (canvas, framework, renderOptions) {
31112
31214
  Engine.create = function (gl) {
31113
31215
  return new GLEngine(gl);
31114
31216
  };
31115
- var version = "2.0.0-alpha.2";
31217
+ var version = "2.0.0-alpha.3";
31116
31218
  logger.info('player version: ' + version);
31117
31219
 
31118
31220
  exports.AbstractPlugin = AbstractPlugin;
31119
- exports.ActivationClipPlayable = ActivationClipPlayable;
31120
- exports.AnimationClipPlayable = AnimationClipPlayable;
31221
+ exports.ActivationPlayable = ActivationPlayable;
31121
31222
  exports.AssetLoader = AssetLoader;
31122
31223
  exports.AssetManager = AssetManager;
31123
31224
  exports.BYTES_TYPE_MAP = BYTES_TYPE_MAP;
@@ -31220,6 +31321,8 @@ exports.TimelineClip = TimelineClip;
31220
31321
  exports.TimelineComponent = TimelineComponent;
31221
31322
  exports.Track = Track;
31222
31323
  exports.Transform = Transform;
31324
+ exports.TransformAnimationPlayable = TransformAnimationPlayable;
31325
+ exports.TransformAnimationPlayableAsset = TransformAnimationPlayableAsset;
31223
31326
  exports.VFXItem = VFXItem;
31224
31327
  exports.ValueGetter = ValueGetter;
31225
31328
  exports.addByOrder = addByOrder;