@galacean/effects-threejs 2.0.2 → 2.1.0-alpha.0
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/README.md +1 -1
- package/dist/index.js +371 -246
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +371 -247
- package/dist/index.mjs.map +1 -1
- package/dist/three-mesh.d.ts +1 -1
- package/dist/three-sprite-component.d.ts +1 -1
- package/dist/three-text-component.d.ts +1 -2
- package/package.json +2 -2
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: v2.0.
|
|
6
|
+
* Version: v2.1.0-alpha.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -4591,7 +4591,6 @@ function getDirectStore(target) {
|
|
|
4591
4591
|
|
|
4592
4592
|
/**
|
|
4593
4593
|
* @since 2.0.0
|
|
4594
|
-
* @internal
|
|
4595
4594
|
*/ var EffectsObject = /*#__PURE__*/ function() {
|
|
4596
4595
|
function EffectsObject(engine) {
|
|
4597
4596
|
this.engine = engine;
|
|
@@ -4627,92 +4626,112 @@ function getDirectStore(target) {
|
|
|
4627
4626
|
|
|
4628
4627
|
/**
|
|
4629
4628
|
* @since 2.0.0
|
|
4630
|
-
* @internal
|
|
4631
4629
|
*/ var Component = /*#__PURE__*/ function(EffectsObject) {
|
|
4632
4630
|
_inherits(Component, EffectsObject);
|
|
4633
4631
|
function Component() {
|
|
4634
|
-
return EffectsObject.apply(this, arguments);
|
|
4635
|
-
}
|
|
4636
|
-
var _proto = Component.prototype;
|
|
4637
|
-
_proto.onAttached = function onAttached() {};
|
|
4638
|
-
_proto.onDestroy = function onDestroy() {};
|
|
4639
|
-
_proto.fromData = function fromData(data) {
|
|
4640
|
-
EffectsObject.prototype.fromData.call(this, data);
|
|
4641
|
-
if (data.item) {
|
|
4642
|
-
this.item = data.item;
|
|
4643
|
-
}
|
|
4644
|
-
};
|
|
4645
|
-
_proto.dispose = function dispose() {
|
|
4646
|
-
this.onDestroy();
|
|
4647
|
-
if (this.item) {
|
|
4648
|
-
removeItem(this.item.components, this);
|
|
4649
|
-
}
|
|
4650
|
-
};
|
|
4651
|
-
_create_class(Component, [
|
|
4652
|
-
{
|
|
4653
|
-
key: "transform",
|
|
4654
|
-
get: /**
|
|
4655
|
-
* 附加到的 VFXItem 对象 Transform 组件
|
|
4656
|
-
*/ function get() {
|
|
4657
|
-
return this.item.transform;
|
|
4658
|
-
}
|
|
4659
|
-
}
|
|
4660
|
-
]);
|
|
4661
|
-
return Component;
|
|
4662
|
-
}(EffectsObject);
|
|
4663
|
-
/**
|
|
4664
|
-
* @since 2.0.0
|
|
4665
|
-
* @internal
|
|
4666
|
-
*/ var Behaviour = /*#__PURE__*/ function(Component) {
|
|
4667
|
-
_inherits(Behaviour, Component);
|
|
4668
|
-
function Behaviour() {
|
|
4669
4632
|
var _this;
|
|
4670
|
-
_this =
|
|
4633
|
+
_this = EffectsObject.apply(this, arguments) || this;
|
|
4671
4634
|
_this.isAwakeCalled = false;
|
|
4672
4635
|
_this.isStartCalled = false;
|
|
4636
|
+
_this.isEnableCalled = false;
|
|
4673
4637
|
_this._enabled = true;
|
|
4674
4638
|
return _this;
|
|
4675
4639
|
}
|
|
4676
|
-
var _proto =
|
|
4640
|
+
var _proto = Component.prototype;
|
|
4677
4641
|
/**
|
|
4678
4642
|
* 生命周期函数,初始化后调用,生命周期内只调用一次
|
|
4679
|
-
*/ _proto.
|
|
4643
|
+
*/ _proto.onAwake = function onAwake() {
|
|
4680
4644
|
// OVERRIDE
|
|
4681
4645
|
};
|
|
4682
4646
|
/**
|
|
4683
|
-
*
|
|
4647
|
+
* 在 enabled 变为 true 时触发
|
|
4684
4648
|
*/ _proto.onEnable = function onEnable() {
|
|
4685
4649
|
// OVERRIDE
|
|
4686
4650
|
};
|
|
4687
4651
|
/**
|
|
4652
|
+
* 在 enabled 变为 false 时触发
|
|
4653
|
+
*/ _proto.onDisable = function onDisable() {
|
|
4654
|
+
// OVERRIDE
|
|
4655
|
+
};
|
|
4656
|
+
/**
|
|
4688
4657
|
* 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
|
|
4689
|
-
*/ _proto.
|
|
4658
|
+
*/ _proto.onStart = function onStart() {
|
|
4690
4659
|
// OVERRIDE
|
|
4691
4660
|
};
|
|
4692
4661
|
/**
|
|
4693
4662
|
* 生命周期函数,每帧调用一次
|
|
4694
|
-
*/ _proto.
|
|
4663
|
+
*/ _proto.onUpdate = function onUpdate(dt) {
|
|
4695
4664
|
// OVERRIDE
|
|
4696
4665
|
};
|
|
4697
4666
|
/**
|
|
4698
4667
|
* 生命周期函数,每帧调用一次,在 update 之后调用
|
|
4699
|
-
*/ _proto.
|
|
4668
|
+
*/ _proto.onLateUpdate = function onLateUpdate(dt) {
|
|
4669
|
+
// OVERRIDE
|
|
4670
|
+
};
|
|
4671
|
+
/**
|
|
4672
|
+
* 生命周期函数,在组件销毁时调用
|
|
4673
|
+
*/ _proto.onDestroy = function onDestroy() {
|
|
4700
4674
|
// OVERRIDE
|
|
4701
4675
|
};
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
this.
|
|
4676
|
+
/**
|
|
4677
|
+
* @internal
|
|
4678
|
+
*/ _proto.enable = function enable() {
|
|
4679
|
+
if (this.item.composition) {
|
|
4680
|
+
this.item.composition.sceneTicking.addComponent(this);
|
|
4681
|
+
this.isEnableCalled = true;
|
|
4682
|
+
}
|
|
4683
|
+
this.onEnable();
|
|
4684
|
+
};
|
|
4685
|
+
/**
|
|
4686
|
+
* @internal
|
|
4687
|
+
*/ _proto.disable = function disable() {
|
|
4688
|
+
this.onDisable();
|
|
4689
|
+
if (this.item.composition) {
|
|
4690
|
+
this.isEnableCalled = false;
|
|
4691
|
+
this.item.composition.sceneTicking.removeComponent(this);
|
|
4692
|
+
}
|
|
4693
|
+
};
|
|
4694
|
+
_proto.setVFXItem = function setVFXItem(item) {
|
|
4695
|
+
this.item = item;
|
|
4696
|
+
if (item.isDuringPlay) {
|
|
4697
|
+
if (!this.isAwakeCalled) {
|
|
4698
|
+
this.onAwake();
|
|
4699
|
+
this.isAwakeCalled = true;
|
|
4700
|
+
}
|
|
4701
|
+
if (item.getVisible() && this.enabled) {
|
|
4702
|
+
this.start();
|
|
4703
|
+
this.enable();
|
|
4704
|
+
}
|
|
4705
|
+
}
|
|
4706
|
+
};
|
|
4707
|
+
_proto.fromData = function fromData(data) {
|
|
4708
|
+
EffectsObject.prototype.fromData.call(this, data);
|
|
4709
|
+
if (data.item) {
|
|
4710
|
+
this.item = data.item;
|
|
4707
4711
|
}
|
|
4708
4712
|
};
|
|
4709
4713
|
_proto.dispose = function dispose() {
|
|
4714
|
+
this.onDestroy();
|
|
4710
4715
|
if (this.item) {
|
|
4711
|
-
removeItem(this.item.
|
|
4716
|
+
removeItem(this.item.components, this);
|
|
4712
4717
|
}
|
|
4713
|
-
Component.prototype.dispose.call(this);
|
|
4714
4718
|
};
|
|
4715
|
-
|
|
4719
|
+
_proto.start = function start() {
|
|
4720
|
+
if (this.isStartCalled) {
|
|
4721
|
+
return;
|
|
4722
|
+
}
|
|
4723
|
+
this.isStartCalled = true;
|
|
4724
|
+
this.onStart();
|
|
4725
|
+
};
|
|
4726
|
+
_create_class(Component, [
|
|
4727
|
+
{
|
|
4728
|
+
key: "transform",
|
|
4729
|
+
get: /**
|
|
4730
|
+
* 附加到的 VFXItem 对象 Transform 组件
|
|
4731
|
+
*/ function get() {
|
|
4732
|
+
return this.item.transform;
|
|
4733
|
+
}
|
|
4734
|
+
},
|
|
4716
4735
|
{
|
|
4717
4736
|
key: "isActiveAndEnabled",
|
|
4718
4737
|
get: /**
|
|
@@ -4727,24 +4746,46 @@ function getDirectStore(target) {
|
|
|
4727
4746
|
return this._enabled;
|
|
4728
4747
|
},
|
|
4729
4748
|
set: function set(value) {
|
|
4730
|
-
this.
|
|
4731
|
-
|
|
4732
|
-
if (
|
|
4733
|
-
this.
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4749
|
+
if (this.enabled !== value) {
|
|
4750
|
+
this._enabled = value;
|
|
4751
|
+
if (value) {
|
|
4752
|
+
if (this.isActiveAndEnabled) {
|
|
4753
|
+
this.enable();
|
|
4754
|
+
if (!this.isStartCalled) {
|
|
4755
|
+
this.onStart();
|
|
4756
|
+
this.isStartCalled = true;
|
|
4757
|
+
}
|
|
4758
|
+
}
|
|
4759
|
+
} else {
|
|
4760
|
+
if (this.isEnableCalled) {
|
|
4761
|
+
this.disable();
|
|
4762
|
+
}
|
|
4738
4763
|
}
|
|
4739
4764
|
}
|
|
4740
4765
|
}
|
|
4741
4766
|
}
|
|
4742
4767
|
]);
|
|
4743
|
-
return
|
|
4744
|
-
}(
|
|
4768
|
+
return Component;
|
|
4769
|
+
}(EffectsObject);
|
|
4745
4770
|
__decorate([
|
|
4746
4771
|
serialize()
|
|
4747
|
-
],
|
|
4772
|
+
], Component.prototype, "_enabled", void 0);
|
|
4773
|
+
/**
|
|
4774
|
+
* @since 2.0.0
|
|
4775
|
+
*/ var Behaviour = /*#__PURE__*/ function(Component) {
|
|
4776
|
+
_inherits(Behaviour, Component);
|
|
4777
|
+
function Behaviour() {
|
|
4778
|
+
return Component.apply(this, arguments);
|
|
4779
|
+
}
|
|
4780
|
+
var _proto = Behaviour.prototype;
|
|
4781
|
+
_proto.setVFXItem = function setVFXItem(item) {
|
|
4782
|
+
Component.prototype.setVFXItem.call(this, item);
|
|
4783
|
+
};
|
|
4784
|
+
_proto.dispose = function dispose() {
|
|
4785
|
+
Component.prototype.dispose.call(this);
|
|
4786
|
+
};
|
|
4787
|
+
return Behaviour;
|
|
4788
|
+
}(Component);
|
|
4748
4789
|
|
|
4749
4790
|
/**
|
|
4750
4791
|
* 所有渲染组件的基类
|
|
@@ -4754,19 +4795,14 @@ __decorate([
|
|
|
4754
4795
|
function RendererComponent() {
|
|
4755
4796
|
var _this;
|
|
4756
4797
|
_this = Component.apply(this, arguments) || this;
|
|
4757
|
-
_this.isStartCalled = false;
|
|
4758
4798
|
_this.materials = [];
|
|
4759
4799
|
_this._priority = 0;
|
|
4760
|
-
_this._enabled = true;
|
|
4761
4800
|
return _this;
|
|
4762
4801
|
}
|
|
4763
4802
|
var _proto = RendererComponent.prototype;
|
|
4764
|
-
_proto.onEnable = function onEnable() {};
|
|
4765
|
-
_proto.start = function start() {};
|
|
4766
|
-
_proto.update = function update(dt) {};
|
|
4767
|
-
_proto.lateUpdate = function lateUpdate(dt) {};
|
|
4768
4803
|
_proto.render = function render(renderer) {};
|
|
4769
|
-
_proto.
|
|
4804
|
+
_proto.setVFXItem = function setVFXItem(item) {
|
|
4805
|
+
Component.prototype.setVFXItem.call(this, item);
|
|
4770
4806
|
this.item.rendererComponents.push(this);
|
|
4771
4807
|
};
|
|
4772
4808
|
_proto.fromData = function fromData(data) {
|
|
@@ -4791,26 +4827,6 @@ __decorate([
|
|
|
4791
4827
|
this._priority = value;
|
|
4792
4828
|
}
|
|
4793
4829
|
},
|
|
4794
|
-
{
|
|
4795
|
-
key: "enabled",
|
|
4796
|
-
get: function get() {
|
|
4797
|
-
return this._enabled;
|
|
4798
|
-
},
|
|
4799
|
-
set: function set(value) {
|
|
4800
|
-
this._enabled = value;
|
|
4801
|
-
if (value) {
|
|
4802
|
-
this.onEnable();
|
|
4803
|
-
}
|
|
4804
|
-
}
|
|
4805
|
-
},
|
|
4806
|
-
{
|
|
4807
|
-
key: "isActiveAndEnabled",
|
|
4808
|
-
get: /**
|
|
4809
|
-
* 组件是否可以更新,true 更新,false 不更新
|
|
4810
|
-
*/ function get() {
|
|
4811
|
-
return this.item.getVisible() && this.enabled;
|
|
4812
|
-
}
|
|
4813
|
-
},
|
|
4814
4830
|
{
|
|
4815
4831
|
key: "material",
|
|
4816
4832
|
get: function get() {
|
|
@@ -4833,9 +4849,6 @@ __decorate([
|
|
|
4833
4849
|
__decorate([
|
|
4834
4850
|
serialize()
|
|
4835
4851
|
], RendererComponent.prototype, "_priority", void 0);
|
|
4836
|
-
__decorate([
|
|
4837
|
-
serialize()
|
|
4838
|
-
], RendererComponent.prototype, "_enabled", void 0);
|
|
4839
4852
|
|
|
4840
4853
|
/**
|
|
4841
4854
|
* 抽象插件类
|
|
@@ -4879,7 +4892,7 @@ exports.CameraController = /*#__PURE__*/ function(Behaviour) {
|
|
|
4879
4892
|
return _this;
|
|
4880
4893
|
}
|
|
4881
4894
|
var _proto = CameraController.prototype;
|
|
4882
|
-
_proto.
|
|
4895
|
+
_proto.onUpdate = function onUpdate() {
|
|
4883
4896
|
if (this.item.composition && this.item.transform.getValid()) {
|
|
4884
4897
|
var camera = this.item.composition.camera;
|
|
4885
4898
|
camera.near = this.options.near;
|
|
@@ -8111,7 +8124,7 @@ function _loadVideo() {
|
|
|
8111
8124
|
}, true);
|
|
8112
8125
|
}
|
|
8113
8126
|
video.addEventListener("error", function(e) {
|
|
8114
|
-
reject(
|
|
8127
|
+
reject("Load video fail.");
|
|
8115
8128
|
});
|
|
8116
8129
|
})
|
|
8117
8130
|
];
|
|
@@ -13277,7 +13290,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13277
13290
|
return _this;
|
|
13278
13291
|
}
|
|
13279
13292
|
var _proto = InteractComponent.prototype;
|
|
13280
|
-
_proto.
|
|
13293
|
+
_proto.onStart = function onStart() {
|
|
13281
13294
|
var _this = this;
|
|
13282
13295
|
var options = this.item.props.content.options;
|
|
13283
13296
|
var env = this.item.engine.renderer.env;
|
|
@@ -13313,8 +13326,11 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13313
13326
|
}
|
|
13314
13327
|
};
|
|
13315
13328
|
};
|
|
13316
|
-
_proto.
|
|
13329
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
13317
13330
|
var _this_previewContent;
|
|
13331
|
+
if (!this.isActiveAndEnabled) {
|
|
13332
|
+
return;
|
|
13333
|
+
}
|
|
13318
13334
|
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
13319
13335
|
if (!this.hasBeenAddedToComposition && this.item.composition) {
|
|
13320
13336
|
var options = this.item.props.content.options;
|
|
@@ -13585,7 +13601,6 @@ function _assert_this_initialized(self) {
|
|
|
13585
13601
|
/**
|
|
13586
13602
|
* 动画图,负责更新所有的动画节点
|
|
13587
13603
|
* @since 2.0.0
|
|
13588
|
-
* @internal
|
|
13589
13604
|
*/ var PlayableGraph = /*#__PURE__*/ function() {
|
|
13590
13605
|
function PlayableGraph() {
|
|
13591
13606
|
this.playableOutputs = [];
|
|
@@ -13645,7 +13660,6 @@ function _assert_this_initialized(self) {
|
|
|
13645
13660
|
/**
|
|
13646
13661
|
* 动画图可播放节点对象
|
|
13647
13662
|
* @since 2.0.0
|
|
13648
|
-
* @internal
|
|
13649
13663
|
*/ var Playable = /*#__PURE__*/ function() {
|
|
13650
13664
|
function Playable(graph, inputCount) {
|
|
13651
13665
|
if (inputCount === void 0) inputCount = 0;
|
|
@@ -13659,6 +13673,9 @@ function _assert_this_initialized(self) {
|
|
|
13659
13673
|
this.outputs = [];
|
|
13660
13674
|
this.playState = 0;
|
|
13661
13675
|
this.traversalMode = 0;
|
|
13676
|
+
/**
|
|
13677
|
+
* 当前本地播放的时间
|
|
13678
|
+
*/ this.time = 0;
|
|
13662
13679
|
graph.addPlayable(this);
|
|
13663
13680
|
this.inputs = new Array(inputCount);
|
|
13664
13681
|
this.inputOuputPorts = new Array(inputCount);
|
|
@@ -13843,7 +13860,6 @@ function _assert_this_initialized(self) {
|
|
|
13843
13860
|
/**
|
|
13844
13861
|
* 动画图输出节点对象,将动画数据采样到绑定的元素属性上
|
|
13845
13862
|
* @since 2.0.0
|
|
13846
|
-
* @internal
|
|
13847
13863
|
*/ var PlayableOutput = /*#__PURE__*/ function() {
|
|
13848
13864
|
function PlayableOutput() {
|
|
13849
13865
|
this.sourceOutputPort = 0;
|
|
@@ -13926,13 +13942,17 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
13926
13942
|
if (!_instanceof1(boundObject, exports.VFXItem)) {
|
|
13927
13943
|
return;
|
|
13928
13944
|
}
|
|
13945
|
+
if (!this.spriteComponent) {
|
|
13946
|
+
this.spriteComponent = boundObject.getComponent(exports.SpriteComponent);
|
|
13947
|
+
}
|
|
13929
13948
|
if (!this.spriteMaterial) {
|
|
13930
|
-
this.spriteMaterial =
|
|
13949
|
+
this.spriteMaterial = this.spriteComponent.material;
|
|
13931
13950
|
var startColor = this.spriteMaterial.getVector4("_Color");
|
|
13932
13951
|
if (startColor) {
|
|
13933
13952
|
this.startColor = startColor.toArray();
|
|
13934
13953
|
}
|
|
13935
13954
|
}
|
|
13955
|
+
this.spriteComponent.setAnimationTime(this.time);
|
|
13936
13956
|
var colorInc = vecFill(tempColor, 1);
|
|
13937
13957
|
var colorChanged;
|
|
13938
13958
|
var life = this.time / boundObject.duration;
|
|
@@ -13992,7 +14012,6 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13992
14012
|
_this = RendererComponent.call(this, engine) || this;
|
|
13993
14013
|
_this.cachePrefix = "-";
|
|
13994
14014
|
_this.frameAnimationLoop = false;
|
|
13995
|
-
_this.frameAnimationTime = 0;
|
|
13996
14015
|
_this.color = [
|
|
13997
14016
|
1,
|
|
13998
14017
|
1,
|
|
@@ -14000,6 +14019,8 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
14000
14019
|
1
|
|
14001
14020
|
];
|
|
14002
14021
|
_this.visible = true;
|
|
14022
|
+
_this.isManualTimeSet = false;
|
|
14023
|
+
_this.frameAnimationTime = 0;
|
|
14003
14024
|
_this.getHitTestParams = function(force) {
|
|
14004
14025
|
var ui = _this.interaction;
|
|
14005
14026
|
if (force || ui) {
|
|
@@ -14082,6 +14103,12 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
14082
14103
|
this.renderer.texture = texture;
|
|
14083
14104
|
this.material.setTexture("uSampler0", texture);
|
|
14084
14105
|
};
|
|
14106
|
+
/**
|
|
14107
|
+
* @internal
|
|
14108
|
+
*/ _proto.setAnimationTime = function setAnimationTime(time) {
|
|
14109
|
+
this.frameAnimationTime = time;
|
|
14110
|
+
this.isManualTimeSet = true;
|
|
14111
|
+
};
|
|
14085
14112
|
_proto.render = function render(renderer) {
|
|
14086
14113
|
if (!this.getVisible()) {
|
|
14087
14114
|
return;
|
|
@@ -14094,14 +14121,14 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
14094
14121
|
this.material.setVector2("_Size", this.transform.size);
|
|
14095
14122
|
renderer.drawGeometry(geo, material);
|
|
14096
14123
|
};
|
|
14097
|
-
_proto.
|
|
14124
|
+
_proto.onStart = function onStart() {
|
|
14098
14125
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
14099
|
-
if (this.item.endBehavior === EndBehavior.restart) {
|
|
14100
|
-
this.frameAnimationLoop = true;
|
|
14101
|
-
}
|
|
14102
14126
|
};
|
|
14103
|
-
_proto.
|
|
14104
|
-
this.
|
|
14127
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
14128
|
+
if (!this.isManualTimeSet) {
|
|
14129
|
+
this.frameAnimationTime += dt / 1000;
|
|
14130
|
+
this.isManualTimeSet = false;
|
|
14131
|
+
}
|
|
14105
14132
|
var time = this.frameAnimationTime;
|
|
14106
14133
|
var duration = this.item.duration;
|
|
14107
14134
|
if (time > duration && this.frameAnimationLoop) {
|
|
@@ -16496,7 +16523,6 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
|
|
|
16496
16523
|
|
|
16497
16524
|
/**
|
|
16498
16525
|
* @since 2.0.0
|
|
16499
|
-
* @internal
|
|
16500
16526
|
*/ var ParticleSystemRenderer = /*#__PURE__*/ function(RendererComponent) {
|
|
16501
16527
|
_inherits(ParticleSystemRenderer, RendererComponent);
|
|
16502
16528
|
function ParticleSystemRenderer(engine, particleMeshProps, trailMeshProps) {
|
|
@@ -16521,15 +16547,15 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
|
|
|
16521
16547
|
return _this;
|
|
16522
16548
|
}
|
|
16523
16549
|
var _proto = ParticleSystemRenderer.prototype;
|
|
16524
|
-
_proto.
|
|
16550
|
+
_proto.onStart = function onStart() {
|
|
16525
16551
|
this._priority = this.item.renderOrder;
|
|
16526
16552
|
this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);
|
|
16527
16553
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
16528
16554
|
var mesh = _step.value;
|
|
16529
|
-
mesh.
|
|
16555
|
+
mesh.onStart();
|
|
16530
16556
|
}
|
|
16531
16557
|
};
|
|
16532
|
-
_proto.
|
|
16558
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
16533
16559
|
var time = this.particleMesh.time;
|
|
16534
16560
|
this.particleMesh.mesh.material.setVector4("uParams", new Vector4(time, this.item.duration, 0, 0));
|
|
16535
16561
|
};
|
|
@@ -16753,7 +16779,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16753
16779
|
_proto.getTextures = function getTextures() {
|
|
16754
16780
|
return this.renderer.getTextures();
|
|
16755
16781
|
};
|
|
16756
|
-
_proto.
|
|
16782
|
+
_proto.startEmit = function startEmit() {
|
|
16757
16783
|
if (!this.started || this.ended) {
|
|
16758
16784
|
this.reset();
|
|
16759
16785
|
this.started = true;
|
|
@@ -16779,7 +16805,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16779
16805
|
this.frozen = false;
|
|
16780
16806
|
this.ended = false;
|
|
16781
16807
|
};
|
|
16782
|
-
_proto.
|
|
16808
|
+
_proto.update = function update(delta) {
|
|
16783
16809
|
var _this = this;
|
|
16784
16810
|
if (this.started && !this.frozen) {
|
|
16785
16811
|
var now = this.lastUpdate + delta / 1000;
|
|
@@ -17562,7 +17588,6 @@ function randomArrItem(arr, keepArr) {
|
|
|
17562
17588
|
|
|
17563
17589
|
/**
|
|
17564
17590
|
* @since 2.0.0
|
|
17565
|
-
* @internal
|
|
17566
17591
|
*/ var ParticleBehaviourPlayable = /*#__PURE__*/ function(Playable) {
|
|
17567
17592
|
_inherits(ParticleBehaviourPlayable, Playable);
|
|
17568
17593
|
function ParticleBehaviourPlayable() {
|
|
@@ -17580,7 +17605,7 @@ function randomArrItem(arr, keepArr) {
|
|
|
17580
17605
|
this.particleSystem = boundObject.getComponent(exports.ParticleSystem);
|
|
17581
17606
|
if (this.particleSystem) {
|
|
17582
17607
|
this.particleSystem.name = boundObject.name;
|
|
17583
|
-
this.particleSystem.
|
|
17608
|
+
this.particleSystem.startEmit();
|
|
17584
17609
|
this.particleSystem.initEmitterTransform();
|
|
17585
17610
|
}
|
|
17586
17611
|
};
|
|
@@ -17600,7 +17625,7 @@ function randomArrItem(arr, keepArr) {
|
|
|
17600
17625
|
if (Math.abs(this.time - this.lastTime) < 0.001) {
|
|
17601
17626
|
deltaTime = 0;
|
|
17602
17627
|
}
|
|
17603
|
-
particleSystem.
|
|
17628
|
+
particleSystem.update(deltaTime);
|
|
17604
17629
|
}
|
|
17605
17630
|
this.lastTime = this.time;
|
|
17606
17631
|
};
|
|
@@ -18622,7 +18647,6 @@ var tempSize = new Vector3(1, 1, 1);
|
|
|
18622
18647
|
var tempPos = new Vector3();
|
|
18623
18648
|
/**
|
|
18624
18649
|
* @since 2.0.0
|
|
18625
|
-
* @internal
|
|
18626
18650
|
*/ var TransformAnimationPlayable = /*#__PURE__*/ function(AnimationPlayable) {
|
|
18627
18651
|
_inherits(TransformAnimationPlayable, AnimationPlayable);
|
|
18628
18652
|
function TransformAnimationPlayable() {
|
|
@@ -18784,7 +18808,6 @@ exports.TransformPlayableAsset = __decorate([
|
|
|
18784
18808
|
], exports.TransformPlayableAsset);
|
|
18785
18809
|
/**
|
|
18786
18810
|
* @since 2.0.0
|
|
18787
|
-
* @internal
|
|
18788
18811
|
*/ var ActivationPlayable = /*#__PURE__*/ function(Playable) {
|
|
18789
18812
|
_inherits(ActivationPlayable, Playable);
|
|
18790
18813
|
function ActivationPlayable() {
|
|
@@ -18935,7 +18958,6 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
18935
18958
|
|
|
18936
18959
|
/**
|
|
18937
18960
|
* @since 2.0.0
|
|
18938
|
-
* @internal
|
|
18939
18961
|
*/ var TimelineClip = /*#__PURE__*/ function() {
|
|
18940
18962
|
function TimelineClip() {
|
|
18941
18963
|
this.start = 0;
|
|
@@ -19333,25 +19355,15 @@ var TrackSortWrapper = function TrackSortWrapper(track, originalIndex) {
|
|
|
19333
19355
|
this.track = track;
|
|
19334
19356
|
this.originalIndex = originalIndex;
|
|
19335
19357
|
};
|
|
19336
|
-
function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
19337
|
-
var current = descendantCandidate.parent;
|
|
19338
|
-
while(current){
|
|
19339
|
-
if (current === ancestorCandidate) {
|
|
19340
|
-
return true;
|
|
19341
|
-
}
|
|
19342
|
-
current = current.parent;
|
|
19343
|
-
}
|
|
19344
|
-
return false;
|
|
19345
|
-
}
|
|
19346
19358
|
function compareTracks(a, b) {
|
|
19347
19359
|
var bindingA = a.track.binding;
|
|
19348
19360
|
var bindingB = b.track.binding;
|
|
19349
19361
|
if (!_instanceof1(bindingA, exports.VFXItem) || !_instanceof1(bindingB, exports.VFXItem)) {
|
|
19350
19362
|
return a.originalIndex - b.originalIndex;
|
|
19351
19363
|
}
|
|
19352
|
-
if (isAncestor(bindingA, bindingB)) {
|
|
19364
|
+
if (exports.VFXItem.isAncestor(bindingA, bindingB)) {
|
|
19353
19365
|
return -1;
|
|
19354
|
-
} else if (isAncestor(bindingB, bindingA)) {
|
|
19366
|
+
} else if (exports.VFXItem.isAncestor(bindingB, bindingA)) {
|
|
19355
19367
|
return 1;
|
|
19356
19368
|
} else {
|
|
19357
19369
|
return a.originalIndex - b.originalIndex; // 非父子关系的元素保持原始顺序
|
|
@@ -19360,7 +19372,6 @@ function compareTracks(a, b) {
|
|
|
19360
19372
|
|
|
19361
19373
|
/**
|
|
19362
19374
|
* @since 2.0.0
|
|
19363
|
-
* @internal
|
|
19364
19375
|
*/ var CompositionComponent = /*#__PURE__*/ function(Behaviour) {
|
|
19365
19376
|
_inherits(CompositionComponent, Behaviour);
|
|
19366
19377
|
function CompositionComponent() {
|
|
@@ -19376,7 +19387,7 @@ function compareTracks(a, b) {
|
|
|
19376
19387
|
return _this;
|
|
19377
19388
|
}
|
|
19378
19389
|
var _proto = CompositionComponent.prototype;
|
|
19379
|
-
_proto.
|
|
19390
|
+
_proto.onStart = function onStart() {
|
|
19380
19391
|
var _this_item_props = this.item.props, _this_item_props_startTime = _this_item_props.startTime, startTime = _this_item_props_startTime === void 0 ? 0 : _this_item_props_startTime;
|
|
19381
19392
|
this.startTime = startTime;
|
|
19382
19393
|
this.resolveBindings();
|
|
@@ -19404,7 +19415,7 @@ function compareTracks(a, b) {
|
|
|
19404
19415
|
_proto.getReusable = function getReusable() {
|
|
19405
19416
|
return this.reusable;
|
|
19406
19417
|
};
|
|
19407
|
-
_proto.
|
|
19418
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
19408
19419
|
var time = this.time;
|
|
19409
19420
|
this.timelinePlayable.setTime(time);
|
|
19410
19421
|
this.graph.evaluate(dt);
|
|
@@ -19440,7 +19451,9 @@ function compareTracks(a, b) {
|
|
|
19440
19451
|
props.content = itemData.content;
|
|
19441
19452
|
item = assetLoader.loadGUID(itemData.id);
|
|
19442
19453
|
item.composition = this.item.composition;
|
|
19443
|
-
var compositionComponent =
|
|
19454
|
+
var compositionComponent = new CompositionComponent(this.engine);
|
|
19455
|
+
compositionComponent.item = item;
|
|
19456
|
+
item.components.push(compositionComponent);
|
|
19444
19457
|
compositionComponent.data = props;
|
|
19445
19458
|
compositionComponent.refId = refId;
|
|
19446
19459
|
item.transform.parentTransform = this.transform;
|
|
@@ -19851,8 +19864,8 @@ exports.TextComponent = /*#__PURE__*/ function(SpriteComponent) {
|
|
|
19851
19864
|
return _this;
|
|
19852
19865
|
}
|
|
19853
19866
|
var _proto = TextComponent.prototype;
|
|
19854
|
-
_proto.
|
|
19855
|
-
SpriteComponent.prototype.
|
|
19867
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
19868
|
+
SpriteComponent.prototype.onUpdate.call(this, dt);
|
|
19856
19869
|
this.updateTexture();
|
|
19857
19870
|
};
|
|
19858
19871
|
_proto.fromData = function fromData(data) {
|
|
@@ -20267,7 +20280,7 @@ exports.EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
20267
20280
|
return _this;
|
|
20268
20281
|
}
|
|
20269
20282
|
var _proto = EffectComponent.prototype;
|
|
20270
|
-
_proto.
|
|
20283
|
+
_proto.onStart = function onStart() {
|
|
20271
20284
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
20272
20285
|
};
|
|
20273
20286
|
_proto.render = function render(renderer) {
|
|
@@ -20394,7 +20407,7 @@ exports.PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
|
20394
20407
|
return _this;
|
|
20395
20408
|
}
|
|
20396
20409
|
var _proto = PostProcessVolume.prototype;
|
|
20397
|
-
_proto.
|
|
20410
|
+
_proto.onStart = function onStart() {
|
|
20398
20411
|
var composition = this.item.composition;
|
|
20399
20412
|
if (composition) {
|
|
20400
20413
|
composition.globalVolume = this;
|
|
@@ -20536,8 +20549,8 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20536
20549
|
*/ _this.ended = false;
|
|
20537
20550
|
_this.reusable = false;
|
|
20538
20551
|
_this.type = ItemType.base;
|
|
20552
|
+
_this.isDuringPlay = false;
|
|
20539
20553
|
_this.components = [];
|
|
20540
|
-
_this.itemBehaviours = [];
|
|
20541
20554
|
_this.rendererComponents = [];
|
|
20542
20555
|
/**
|
|
20543
20556
|
* 元素可见性,该值的改变会触发 `handleVisibleChanged` 回调
|
|
@@ -20547,6 +20560,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20547
20560
|
* 元素动画的速度
|
|
20548
20561
|
*/ _this.speed = 1;
|
|
20549
20562
|
_this.listIndex = 0;
|
|
20563
|
+
_this.isEnabled = false;
|
|
20550
20564
|
_this.eventProcessor = new EventEmitter();
|
|
20551
20565
|
_this.name = "VFXItem";
|
|
20552
20566
|
_this.transform.name = _this.name;
|
|
@@ -20619,8 +20633,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20619
20633
|
*/ _proto.addComponent = function addComponent(classConstructor) {
|
|
20620
20634
|
var newComponent = new classConstructor(this.engine);
|
|
20621
20635
|
this.components.push(newComponent);
|
|
20622
|
-
newComponent.
|
|
20623
|
-
newComponent.onAttached();
|
|
20636
|
+
newComponent.setVFXItem(this);
|
|
20624
20637
|
return newComponent;
|
|
20625
20638
|
};
|
|
20626
20639
|
/**
|
|
@@ -20653,21 +20666,22 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20653
20666
|
return res;
|
|
20654
20667
|
};
|
|
20655
20668
|
_proto.setParent = function setParent(vfxItem) {
|
|
20656
|
-
if (vfxItem === this) {
|
|
20669
|
+
if (vfxItem === this && !vfxItem) {
|
|
20657
20670
|
return;
|
|
20658
20671
|
}
|
|
20659
20672
|
if (this.parent) {
|
|
20660
20673
|
removeItem(this.parent.children, this);
|
|
20661
20674
|
}
|
|
20662
20675
|
this.parent = vfxItem;
|
|
20663
|
-
if (
|
|
20664
|
-
|
|
20665
|
-
|
|
20666
|
-
|
|
20667
|
-
|
|
20668
|
-
|
|
20669
|
-
|
|
20670
|
-
|
|
20676
|
+
if (!VFXItem.isCamera(this)) {
|
|
20677
|
+
this.transform.parentTransform = vfxItem.transform;
|
|
20678
|
+
}
|
|
20679
|
+
vfxItem.children.push(this);
|
|
20680
|
+
if (!this.composition) {
|
|
20681
|
+
this.composition = vfxItem.composition;
|
|
20682
|
+
}
|
|
20683
|
+
if (!this.isDuringPlay && vfxItem.isDuringPlay) {
|
|
20684
|
+
this.beginPlay();
|
|
20671
20685
|
}
|
|
20672
20686
|
};
|
|
20673
20687
|
/**
|
|
@@ -20698,6 +20712,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20698
20712
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
20699
20713
|
if (this.visible !== visible) {
|
|
20700
20714
|
this.visible = !!visible;
|
|
20715
|
+
this.onActiveChanged();
|
|
20701
20716
|
}
|
|
20702
20717
|
};
|
|
20703
20718
|
/**
|
|
@@ -20822,6 +20837,57 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20822
20837
|
}
|
|
20823
20838
|
return undefined;
|
|
20824
20839
|
};
|
|
20840
|
+
/**
|
|
20841
|
+
* @internal
|
|
20842
|
+
*/ _proto.beginPlay = function beginPlay() {
|
|
20843
|
+
this.isDuringPlay = true;
|
|
20844
|
+
if (this.composition && this.visible && !this.isEnabled) {
|
|
20845
|
+
this.onEnable();
|
|
20846
|
+
}
|
|
20847
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
20848
|
+
var child = _step.value;
|
|
20849
|
+
if (!child.isDuringPlay) {
|
|
20850
|
+
child.beginPlay();
|
|
20851
|
+
}
|
|
20852
|
+
}
|
|
20853
|
+
};
|
|
20854
|
+
/**
|
|
20855
|
+
* @internal
|
|
20856
|
+
*/ _proto.onActiveChanged = function onActiveChanged() {
|
|
20857
|
+
if (!this.isEnabled) {
|
|
20858
|
+
this.onEnable();
|
|
20859
|
+
} else {
|
|
20860
|
+
this.onDisable();
|
|
20861
|
+
}
|
|
20862
|
+
};
|
|
20863
|
+
/**
|
|
20864
|
+
* @internal
|
|
20865
|
+
*/ _proto.onEnable = function onEnable() {
|
|
20866
|
+
this.isEnabled = true;
|
|
20867
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
20868
|
+
var component = _step.value;
|
|
20869
|
+
if (component.enabled && !component.isStartCalled) {
|
|
20870
|
+
component.onStart();
|
|
20871
|
+
}
|
|
20872
|
+
}
|
|
20873
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.components), _step1; !(_step1 = _iterator1()).done;){
|
|
20874
|
+
var component1 = _step1.value;
|
|
20875
|
+
if (component1.enabled && !component1.isEnableCalled) {
|
|
20876
|
+
component1.enable();
|
|
20877
|
+
}
|
|
20878
|
+
}
|
|
20879
|
+
};
|
|
20880
|
+
/**
|
|
20881
|
+
* @internal
|
|
20882
|
+
*/ _proto.onDisable = function onDisable() {
|
|
20883
|
+
this.isEnabled = false;
|
|
20884
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
20885
|
+
var component = _step.value;
|
|
20886
|
+
if (component.enabled && component.isEnableCalled) {
|
|
20887
|
+
component.disable();
|
|
20888
|
+
}
|
|
20889
|
+
}
|
|
20890
|
+
};
|
|
20825
20891
|
_proto.fromData = function fromData(data) {
|
|
20826
20892
|
EffectsObject.prototype.fromData.call(this, data);
|
|
20827
20893
|
var id = data.id, name = data.name, delay = data.delay, parentId = data.parentId, endBehavior = data.endBehavior, transform = data.transform, _data_listIndex = data.listIndex, listIndex = _data_listIndex === void 0 ? 0 : _data_listIndex, _data_duration = data.duration, duration = _data_duration === void 0 ? 0 : _data_duration;
|
|
@@ -20871,14 +20937,10 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20871
20937
|
if (duration <= 0) {
|
|
20872
20938
|
throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
|
|
20873
20939
|
}
|
|
20874
|
-
this.itemBehaviours.length = 0;
|
|
20875
20940
|
this.rendererComponents.length = 0;
|
|
20876
20941
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
20877
20942
|
var component = _step.value;
|
|
20878
20943
|
component.item = this;
|
|
20879
|
-
if (_instanceof1(component, Behaviour)) {
|
|
20880
|
-
this.itemBehaviours.push(component);
|
|
20881
|
-
}
|
|
20882
20944
|
if (_instanceof1(component, RendererComponent)) {
|
|
20883
20945
|
this.rendererComponents.push(component);
|
|
20884
20946
|
}
|
|
@@ -20983,6 +21045,16 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20983
21045
|
VFXItem.isExtraCamera = function isExtraCamera(item) {
|
|
20984
21046
|
return item.id === "extra-camera" && item.name === "extra-camera";
|
|
20985
21047
|
};
|
|
21048
|
+
VFXItem.isAncestor = function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
21049
|
+
var current = descendantCandidate.parent;
|
|
21050
|
+
while(current){
|
|
21051
|
+
if (current === ancestorCandidate) {
|
|
21052
|
+
return true;
|
|
21053
|
+
}
|
|
21054
|
+
current = current.parent;
|
|
21055
|
+
}
|
|
21056
|
+
return false;
|
|
21057
|
+
};
|
|
20986
21058
|
_create_class(VFXItem, [
|
|
20987
21059
|
{
|
|
20988
21060
|
key: "content",
|
|
@@ -21649,7 +21721,6 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21649
21721
|
|
|
21650
21722
|
/**
|
|
21651
21723
|
* @since 2.0.0
|
|
21652
|
-
* @internal
|
|
21653
21724
|
*/ var AssetLoader = /*#__PURE__*/ function() {
|
|
21654
21725
|
function AssetLoader(engine) {
|
|
21655
21726
|
this.engine = engine;
|
|
@@ -24121,7 +24192,7 @@ var seed$1 = 1;
|
|
|
24121
24192
|
];
|
|
24122
24193
|
case 6:
|
|
24123
24194
|
e = _state.sent();
|
|
24124
|
-
throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message + ".");
|
|
24195
|
+
throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + (e.message || e) + ".");
|
|
24125
24196
|
case 7:
|
|
24126
24197
|
return [
|
|
24127
24198
|
3,
|
|
@@ -24856,6 +24927,109 @@ var listOrder = 0;
|
|
|
24856
24927
|
return CompositionSourceManager;
|
|
24857
24928
|
}();
|
|
24858
24929
|
|
|
24930
|
+
var SceneTicking = /*#__PURE__*/ function() {
|
|
24931
|
+
function SceneTicking() {
|
|
24932
|
+
this.update = new UpdateTickData();
|
|
24933
|
+
this.lateUpdate = new LateUpdateTickData();
|
|
24934
|
+
}
|
|
24935
|
+
var _proto = SceneTicking.prototype;
|
|
24936
|
+
_proto.addComponent = function addComponent(obj) {
|
|
24937
|
+
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
24938
|
+
this.update.addComponent(obj);
|
|
24939
|
+
}
|
|
24940
|
+
if (obj.onLateUpdate !== Component.prototype.onLateUpdate) {
|
|
24941
|
+
this.lateUpdate.addComponent(obj);
|
|
24942
|
+
}
|
|
24943
|
+
};
|
|
24944
|
+
_proto.removeComponent = function removeComponent(obj) {
|
|
24945
|
+
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
24946
|
+
this.update.removeComponent(obj);
|
|
24947
|
+
}
|
|
24948
|
+
if (obj.onLateUpdate !== Component.prototype.onLateUpdate) {
|
|
24949
|
+
this.lateUpdate.removeComponent(obj);
|
|
24950
|
+
}
|
|
24951
|
+
};
|
|
24952
|
+
_proto.clear = function clear() {
|
|
24953
|
+
this.update.clear();
|
|
24954
|
+
this.lateUpdate.clear();
|
|
24955
|
+
};
|
|
24956
|
+
return SceneTicking;
|
|
24957
|
+
}();
|
|
24958
|
+
var TickData = /*#__PURE__*/ function() {
|
|
24959
|
+
function TickData() {
|
|
24960
|
+
this.components = [];
|
|
24961
|
+
this.ticks = [];
|
|
24962
|
+
}
|
|
24963
|
+
var _proto = TickData.prototype;
|
|
24964
|
+
_proto.tick = function tick(dt) {
|
|
24965
|
+
this.tickComponents(this.components, dt);
|
|
24966
|
+
for(var i = 0; i < this.ticks.length; i++){
|
|
24967
|
+
this.ticks[i](dt);
|
|
24968
|
+
}
|
|
24969
|
+
};
|
|
24970
|
+
_proto.tickComponents = function tickComponents(components, dt) {
|
|
24971
|
+
// To be implemented in derived classes
|
|
24972
|
+
};
|
|
24973
|
+
_proto.addComponent = function addComponent(component) {
|
|
24974
|
+
if (!this.components.includes(component)) {
|
|
24975
|
+
this.components.push(component);
|
|
24976
|
+
}
|
|
24977
|
+
};
|
|
24978
|
+
_proto.removeComponent = function removeComponent(component) {
|
|
24979
|
+
var index = this.components.indexOf(component);
|
|
24980
|
+
if (index > -1) {
|
|
24981
|
+
this.components.splice(index, 1);
|
|
24982
|
+
}
|
|
24983
|
+
};
|
|
24984
|
+
_proto.addTick = function addTick(method, callee) {
|
|
24985
|
+
var tick = method.bind(callee);
|
|
24986
|
+
if (!this.ticks.includes(tick)) {
|
|
24987
|
+
this.ticks.push(tick);
|
|
24988
|
+
}
|
|
24989
|
+
};
|
|
24990
|
+
_proto.clear = function clear() {
|
|
24991
|
+
this.components = [];
|
|
24992
|
+
};
|
|
24993
|
+
return TickData;
|
|
24994
|
+
}();
|
|
24995
|
+
var UpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
24996
|
+
_inherits(UpdateTickData, TickData);
|
|
24997
|
+
function UpdateTickData() {
|
|
24998
|
+
return TickData.apply(this, arguments);
|
|
24999
|
+
}
|
|
25000
|
+
var _proto = UpdateTickData.prototype;
|
|
25001
|
+
_proto.tickComponents = function tickComponents(components, dt) {
|
|
25002
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(components), _step; !(_step = _iterator()).done;){
|
|
25003
|
+
var component = _step.value;
|
|
25004
|
+
component.onUpdate(dt);
|
|
25005
|
+
}
|
|
25006
|
+
};
|
|
25007
|
+
return UpdateTickData;
|
|
25008
|
+
}(TickData);
|
|
25009
|
+
var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
25010
|
+
_inherits(LateUpdateTickData, TickData);
|
|
25011
|
+
function LateUpdateTickData() {
|
|
25012
|
+
return TickData.apply(this, arguments);
|
|
25013
|
+
}
|
|
25014
|
+
var _proto = LateUpdateTickData.prototype;
|
|
25015
|
+
_proto.tickComponents = function tickComponents(components, dt) {
|
|
25016
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(components), _step; !(_step = _iterator()).done;){
|
|
25017
|
+
var component = _step.value;
|
|
25018
|
+
component.onLateUpdate(dt);
|
|
25019
|
+
}
|
|
25020
|
+
};
|
|
25021
|
+
return LateUpdateTickData;
|
|
25022
|
+
} // function compareComponents (a: Component, b: Component): number {
|
|
25023
|
+
// const itemA = a.item;
|
|
25024
|
+
// const itemB = b.item;
|
|
25025
|
+
// if (VFXItem.isAncestor(itemA, itemB)) {
|
|
25026
|
+
// return -1;
|
|
25027
|
+
// } else {
|
|
25028
|
+
// return 1;
|
|
25029
|
+
// }
|
|
25030
|
+
// }
|
|
25031
|
+
(TickData);
|
|
25032
|
+
|
|
24859
25033
|
/**
|
|
24860
25034
|
* 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
|
|
24861
25035
|
* 合成中包含了相关的 Item 元素,支持对 Item 元素的创建、更新和销毁。
|
|
@@ -24865,6 +25039,7 @@ var listOrder = 0;
|
|
|
24865
25039
|
function Composition(props, scene) {
|
|
24866
25040
|
var _this;
|
|
24867
25041
|
_this = EventEmitter.call(this) || this;
|
|
25042
|
+
_this.sceneTicking = new SceneTicking();
|
|
24868
25043
|
/**
|
|
24869
25044
|
* 动画播放速度
|
|
24870
25045
|
*/ _this.speed = 1;
|
|
@@ -24902,9 +25077,12 @@ var listOrder = 0;
|
|
|
24902
25077
|
_this.rootItem = new exports.VFXItem(_this.getEngine(), sourceContent);
|
|
24903
25078
|
_this.rootItem.name = "rootItem";
|
|
24904
25079
|
_this.rootItem.composition = _assert_this_initialized(_this);
|
|
24905
|
-
|
|
25080
|
+
// Spawn rootCompositionComponent
|
|
25081
|
+
_this.rootComposition = new CompositionComponent(_this.getEngine());
|
|
24906
25082
|
_this.rootComposition.startTime = sourceContent.startTime;
|
|
24907
25083
|
_this.rootComposition.data = sourceContent;
|
|
25084
|
+
_this.rootComposition.item = _this.rootItem;
|
|
25085
|
+
_this.rootItem.components.push(_this.rootComposition);
|
|
24908
25086
|
var imageUsage = !reusable && imgUsage;
|
|
24909
25087
|
_this.width = width;
|
|
24910
25088
|
_this.height = height;
|
|
@@ -24938,7 +25116,6 @@ var listOrder = 0;
|
|
|
24938
25116
|
_this.rendererOptions = null;
|
|
24939
25117
|
_this.rootComposition.createContent();
|
|
24940
25118
|
_this.buildItemTree(_this.rootItem);
|
|
24941
|
-
_this.callAwake(_this.rootItem);
|
|
24942
25119
|
_this.rootItem.onEnd = function() {
|
|
24943
25120
|
window.setTimeout(function() {
|
|
24944
25121
|
_this.emit("end", {
|
|
@@ -24950,6 +25127,16 @@ var listOrder = 0;
|
|
|
24950
25127
|
return _this;
|
|
24951
25128
|
}
|
|
24952
25129
|
var _proto = Composition.prototype;
|
|
25130
|
+
_proto.initializeSceneTicking = function initializeSceneTicking(item) {
|
|
25131
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
25132
|
+
var component = _step.value;
|
|
25133
|
+
this.sceneTicking.addComponent(component);
|
|
25134
|
+
}
|
|
25135
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.children), _step1; !(_step1 = _iterator1()).done;){
|
|
25136
|
+
var child = _step1.value;
|
|
25137
|
+
this.initializeSceneTicking(child);
|
|
25138
|
+
}
|
|
25139
|
+
};
|
|
24953
25140
|
/**
|
|
24954
25141
|
* 获取合成的时长
|
|
24955
25142
|
*/ _proto.getDuration = function getDuration() {
|
|
@@ -25052,7 +25239,7 @@ var listOrder = 0;
|
|
|
25052
25239
|
this.resume();
|
|
25053
25240
|
}
|
|
25054
25241
|
if (!this.rootComposition.isStartCalled) {
|
|
25055
|
-
this.rootComposition.
|
|
25242
|
+
this.rootComposition.onStart();
|
|
25056
25243
|
this.rootComposition.isStartCalled = true;
|
|
25057
25244
|
}
|
|
25058
25245
|
this.forwardTime(time + this.startTime);
|
|
@@ -25129,9 +25316,12 @@ var listOrder = 0;
|
|
|
25129
25316
|
// 更新 model-tree-plugin
|
|
25130
25317
|
this.updatePluginLoaders(deltaTime);
|
|
25131
25318
|
// scene VFXItem components lifetime function.
|
|
25132
|
-
|
|
25133
|
-
|
|
25134
|
-
|
|
25319
|
+
if (!this.rootItem.isDuringPlay) {
|
|
25320
|
+
this.callAwake(this.rootItem);
|
|
25321
|
+
this.rootItem.beginPlay();
|
|
25322
|
+
}
|
|
25323
|
+
this.sceneTicking.update.tick(time);
|
|
25324
|
+
this.sceneTicking.lateUpdate.tick(time);
|
|
25135
25325
|
this.updateCamera();
|
|
25136
25326
|
this.prepareRender();
|
|
25137
25327
|
if (this.shouldDispose()) {
|
|
@@ -25184,11 +25374,11 @@ var listOrder = 0;
|
|
|
25184
25374
|
return t;
|
|
25185
25375
|
};
|
|
25186
25376
|
_proto.callAwake = function callAwake(item) {
|
|
25187
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.
|
|
25188
|
-
var
|
|
25189
|
-
if (!
|
|
25190
|
-
|
|
25191
|
-
|
|
25377
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
25378
|
+
var component = _step.value;
|
|
25379
|
+
if (!component.isAwakeCalled) {
|
|
25380
|
+
component.onAwake();
|
|
25381
|
+
component.isAwakeCalled = true;
|
|
25192
25382
|
}
|
|
25193
25383
|
}
|
|
25194
25384
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.children), _step1; !(_step1 = _iterator1()).done;){
|
|
@@ -25196,72 +25386,6 @@ var listOrder = 0;
|
|
|
25196
25386
|
this.callAwake(child);
|
|
25197
25387
|
}
|
|
25198
25388
|
};
|
|
25199
|
-
_proto.callStart = function callStart(item) {
|
|
25200
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25201
|
-
var itemBehaviour = _step.value;
|
|
25202
|
-
if (itemBehaviour.isActiveAndEnabled && !itemBehaviour.isStartCalled) {
|
|
25203
|
-
itemBehaviour.start();
|
|
25204
|
-
itemBehaviour.isStartCalled = true;
|
|
25205
|
-
}
|
|
25206
|
-
}
|
|
25207
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25208
|
-
var rendererComponent = _step1.value;
|
|
25209
|
-
if (rendererComponent.isActiveAndEnabled && !rendererComponent.isStartCalled) {
|
|
25210
|
-
rendererComponent.start();
|
|
25211
|
-
rendererComponent.isStartCalled = true;
|
|
25212
|
-
}
|
|
25213
|
-
}
|
|
25214
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25215
|
-
var child = _step2.value;
|
|
25216
|
-
this.callStart(child);
|
|
25217
|
-
}
|
|
25218
|
-
};
|
|
25219
|
-
_proto.callUpdate = function callUpdate(item, dt) {
|
|
25220
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25221
|
-
var itemBehaviour = _step.value;
|
|
25222
|
-
if (itemBehaviour.isActiveAndEnabled && itemBehaviour.isStartCalled) {
|
|
25223
|
-
itemBehaviour.update(dt);
|
|
25224
|
-
}
|
|
25225
|
-
}
|
|
25226
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25227
|
-
var rendererComponent = _step1.value;
|
|
25228
|
-
if (rendererComponent.isActiveAndEnabled && rendererComponent.isStartCalled) {
|
|
25229
|
-
rendererComponent.update(dt);
|
|
25230
|
-
}
|
|
25231
|
-
}
|
|
25232
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25233
|
-
var child = _step2.value;
|
|
25234
|
-
if (exports.VFXItem.isComposition(child)) {
|
|
25235
|
-
if (child.ended && child.endBehavior === EndBehavior.restart) {
|
|
25236
|
-
child.ended = false;
|
|
25237
|
-
// TODO K帧动画在元素重建后需要 tick ,否则会导致元素位置和 k 帧第一帧位置不一致
|
|
25238
|
-
this.callUpdate(child, 0);
|
|
25239
|
-
} else {
|
|
25240
|
-
this.callUpdate(child, dt);
|
|
25241
|
-
}
|
|
25242
|
-
} else {
|
|
25243
|
-
this.callUpdate(child, dt);
|
|
25244
|
-
}
|
|
25245
|
-
}
|
|
25246
|
-
};
|
|
25247
|
-
_proto.callLateUpdate = function callLateUpdate(item, dt) {
|
|
25248
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25249
|
-
var itemBehaviour = _step.value;
|
|
25250
|
-
if (itemBehaviour.isActiveAndEnabled && itemBehaviour.isStartCalled) {
|
|
25251
|
-
itemBehaviour.lateUpdate(dt);
|
|
25252
|
-
}
|
|
25253
|
-
}
|
|
25254
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25255
|
-
var rendererComponent = _step1.value;
|
|
25256
|
-
if (rendererComponent.isActiveAndEnabled && rendererComponent.isStartCalled) {
|
|
25257
|
-
rendererComponent.lateUpdate(dt);
|
|
25258
|
-
}
|
|
25259
|
-
}
|
|
25260
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25261
|
-
var child = _step2.value;
|
|
25262
|
-
this.callLateUpdate(child, dt);
|
|
25263
|
-
}
|
|
25264
|
-
};
|
|
25265
25389
|
/**
|
|
25266
25390
|
* 构建父子树,同时保存到 itemCacheMap 中便于查找
|
|
25267
25391
|
*/ _proto.buildItemTree = function buildItemTree(compVFXItem) {
|
|
@@ -27135,7 +27259,6 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
27135
27259
|
|
|
27136
27260
|
/**
|
|
27137
27261
|
* @since 2.0.0
|
|
27138
|
-
* @internal
|
|
27139
27262
|
*/ var EffectsPackage = /*#__PURE__*/ function() {
|
|
27140
27263
|
function EffectsPackage() {
|
|
27141
27264
|
this.exportObjectDatas = [];
|
|
@@ -27544,11 +27667,12 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
27544
27667
|
return Engine;
|
|
27545
27668
|
}();
|
|
27546
27669
|
|
|
27670
|
+
var DEFAULT_FPS = 60;
|
|
27547
27671
|
/**
|
|
27548
27672
|
* 定时器类
|
|
27549
27673
|
*/ var Ticker = /*#__PURE__*/ function() {
|
|
27550
27674
|
function Ticker(fps) {
|
|
27551
|
-
if (fps === void 0) fps =
|
|
27675
|
+
if (fps === void 0) fps = DEFAULT_FPS;
|
|
27552
27676
|
this.paused = true;
|
|
27553
27677
|
this.lastTime = 0;
|
|
27554
27678
|
// deltaTime
|
|
@@ -27683,7 +27807,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
27683
27807
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
27684
27808
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
27685
27809
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
27686
|
-
var version$1 = "2.0.
|
|
27810
|
+
var version$1 = "2.1.0-alpha.0";
|
|
27687
27811
|
logger.info("Core version: " + version$1 + ".");
|
|
27688
27812
|
|
|
27689
27813
|
var _obj;
|
|
@@ -28616,8 +28740,8 @@ var seed = 1;
|
|
|
28616
28740
|
this.material = mtl;
|
|
28617
28741
|
this.mesh.material = mtl.material;
|
|
28618
28742
|
};
|
|
28619
|
-
_proto.
|
|
28620
|
-
Mesh.prototype.
|
|
28743
|
+
_proto.onStart = function onStart() {
|
|
28744
|
+
Mesh.prototype.onStart.call(this);
|
|
28621
28745
|
this.engine.threeGroup.add(this.mesh);
|
|
28622
28746
|
};
|
|
28623
28747
|
/**
|
|
@@ -29224,8 +29348,8 @@ exports.ThreeSpriteComponent = /*#__PURE__*/ function(SpriteComponent) {
|
|
|
29224
29348
|
}
|
|
29225
29349
|
}
|
|
29226
29350
|
};
|
|
29227
|
-
_proto.
|
|
29228
|
-
SpriteComponent.prototype.
|
|
29351
|
+
_proto.onStart = function onStart() {
|
|
29352
|
+
SpriteComponent.prototype.onStart.call(this);
|
|
29229
29353
|
this.engine.threeGroup.add(this.threeMesh);
|
|
29230
29354
|
};
|
|
29231
29355
|
_proto.render = function render(renderer) {
|
|
@@ -29296,8 +29420,8 @@ exports.ThreeTextComponent = /*#__PURE__*/ function(ThreeSpriteComponent) {
|
|
|
29296
29420
|
return _this;
|
|
29297
29421
|
}
|
|
29298
29422
|
var _proto = ThreeTextComponent.prototype;
|
|
29299
|
-
_proto.
|
|
29300
|
-
ThreeSpriteComponent.prototype.
|
|
29423
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
29424
|
+
ThreeSpriteComponent.prototype.onUpdate.call(this, dt);
|
|
29301
29425
|
this.updateTexture(false);
|
|
29302
29426
|
};
|
|
29303
29427
|
_proto.fromData = function fromData(data) {
|
|
@@ -29364,7 +29488,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
29364
29488
|
*/ Mesh.create = function(engine, props) {
|
|
29365
29489
|
return new ThreeMesh(engine, props);
|
|
29366
29490
|
};
|
|
29367
|
-
var version = "2.0.
|
|
29491
|
+
var version = "2.1.0-alpha.0";
|
|
29368
29492
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
29369
29493
|
|
|
29370
29494
|
exports.AbstractPlugin = AbstractPlugin;
|
|
@@ -29392,6 +29516,7 @@ exports.Composition = Composition;
|
|
|
29392
29516
|
exports.CompositionComponent = CompositionComponent;
|
|
29393
29517
|
exports.CompositionSourceManager = CompositionSourceManager;
|
|
29394
29518
|
exports.DEFAULT_FONTS = DEFAULT_FONTS;
|
|
29519
|
+
exports.DEFAULT_FPS = DEFAULT_FPS;
|
|
29395
29520
|
exports.Database = Database;
|
|
29396
29521
|
exports.Downloader = Downloader;
|
|
29397
29522
|
exports.EFFECTS_COPY_MESH_NAME = EFFECTS_COPY_MESH_NAME;
|