@galacean/effects-core 2.0.4 → 2.1.0-alpha.1
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/comp-vfx-item.d.ts +2 -2
- package/dist/components/component.d.ts +27 -18
- package/dist/components/effect-component.d.ts +1 -1
- package/dist/components/post-process-volume.d.ts +1 -1
- package/dist/components/renderer-component.d.ts +2 -13
- package/dist/composition/scene-ticking.d.ts +26 -0
- package/dist/composition.d.ts +3 -3
- package/dist/index.js +609 -224
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +609 -224
- package/dist/index.mjs.map +1 -1
- package/dist/math/value-getter.d.ts +2 -1
- package/dist/plugins/camera/camera-controller-node.d.ts +1 -1
- package/dist/plugins/interact/interact-item.d.ts +2 -2
- package/dist/plugins/particle/particle-mesh.d.ts +7 -0
- package/dist/plugins/particle/particle-system-renderer.d.ts +2 -2
- package/dist/plugins/particle/particle-system.d.ts +2 -2
- package/dist/plugins/sprite/sprite-item.d.ts +2 -2
- package/dist/plugins/text/text-item.d.ts +1 -1
- package/dist/vfx-item.d.ts +4 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.0.
|
|
6
|
+
* Version: v2.1.0-alpha.1
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -4603,87 +4603,115 @@ function getDirectStore(target) {
|
|
|
4603
4603
|
*/ var Component = /*#__PURE__*/ function(EffectsObject) {
|
|
4604
4604
|
_inherits(Component, EffectsObject);
|
|
4605
4605
|
function Component() {
|
|
4606
|
-
return EffectsObject.apply(this, arguments);
|
|
4607
|
-
}
|
|
4608
|
-
var _proto = Component.prototype;
|
|
4609
|
-
_proto.onAttached = function onAttached() {};
|
|
4610
|
-
_proto.onDestroy = function onDestroy() {};
|
|
4611
|
-
_proto.fromData = function fromData(data) {
|
|
4612
|
-
EffectsObject.prototype.fromData.call(this, data);
|
|
4613
|
-
if (data.item) {
|
|
4614
|
-
this.item = data.item;
|
|
4615
|
-
}
|
|
4616
|
-
};
|
|
4617
|
-
_proto.dispose = function dispose() {
|
|
4618
|
-
this.onDestroy();
|
|
4619
|
-
if (this.item) {
|
|
4620
|
-
removeItem(this.item.components, this);
|
|
4621
|
-
}
|
|
4622
|
-
};
|
|
4623
|
-
_create_class(Component, [
|
|
4624
|
-
{
|
|
4625
|
-
key: "transform",
|
|
4626
|
-
get: /**
|
|
4627
|
-
* 附加到的 VFXItem 对象 Transform 组件
|
|
4628
|
-
*/ function get() {
|
|
4629
|
-
return this.item.transform;
|
|
4630
|
-
}
|
|
4631
|
-
}
|
|
4632
|
-
]);
|
|
4633
|
-
return Component;
|
|
4634
|
-
}(EffectsObject);
|
|
4635
|
-
/**
|
|
4636
|
-
* @since 2.0.0
|
|
4637
|
-
*/ var Behaviour = /*#__PURE__*/ function(Component) {
|
|
4638
|
-
_inherits(Behaviour, Component);
|
|
4639
|
-
function Behaviour() {
|
|
4640
4606
|
var _this;
|
|
4641
|
-
_this =
|
|
4607
|
+
_this = EffectsObject.apply(this, arguments) || this;
|
|
4642
4608
|
_this.isAwakeCalled = false;
|
|
4643
4609
|
_this.isStartCalled = false;
|
|
4610
|
+
_this.isEnableCalled = false;
|
|
4644
4611
|
_this._enabled = true;
|
|
4645
4612
|
return _this;
|
|
4646
4613
|
}
|
|
4647
|
-
var _proto =
|
|
4614
|
+
var _proto = Component.prototype;
|
|
4648
4615
|
/**
|
|
4649
4616
|
* 生命周期函数,初始化后调用,生命周期内只调用一次
|
|
4650
|
-
*/ _proto.
|
|
4617
|
+
*/ _proto.onAwake = function onAwake() {
|
|
4651
4618
|
// OVERRIDE
|
|
4652
4619
|
};
|
|
4653
4620
|
/**
|
|
4654
|
-
*
|
|
4621
|
+
* 在 enabled 变为 true 时触发
|
|
4655
4622
|
*/ _proto.onEnable = function onEnable() {
|
|
4656
4623
|
// OVERRIDE
|
|
4657
4624
|
};
|
|
4658
4625
|
/**
|
|
4626
|
+
* 在 enabled 变为 false 时触发
|
|
4627
|
+
*/ _proto.onDisable = function onDisable() {
|
|
4628
|
+
// OVERRIDE
|
|
4629
|
+
};
|
|
4630
|
+
/**
|
|
4659
4631
|
* 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
|
|
4660
|
-
*/ _proto.
|
|
4632
|
+
*/ _proto.onStart = function onStart() {
|
|
4661
4633
|
// OVERRIDE
|
|
4662
4634
|
};
|
|
4663
4635
|
/**
|
|
4664
4636
|
* 生命周期函数,每帧调用一次
|
|
4665
|
-
*/ _proto.
|
|
4637
|
+
*/ _proto.onUpdate = function onUpdate(dt) {
|
|
4666
4638
|
// OVERRIDE
|
|
4667
4639
|
};
|
|
4668
4640
|
/**
|
|
4669
4641
|
* 生命周期函数,每帧调用一次,在 update 之后调用
|
|
4670
|
-
*/ _proto.
|
|
4642
|
+
*/ _proto.onLateUpdate = function onLateUpdate(dt) {
|
|
4671
4643
|
// OVERRIDE
|
|
4672
4644
|
};
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4645
|
+
/**
|
|
4646
|
+
* 生命周期函数,在组件销毁时调用
|
|
4647
|
+
*/ _proto.onDestroy = function onDestroy() {
|
|
4648
|
+
// OVERRIDE
|
|
4649
|
+
};
|
|
4650
|
+
/**
|
|
4651
|
+
* @internal
|
|
4652
|
+
*/ _proto.enable = function enable() {
|
|
4653
|
+
if (this.item.composition) {
|
|
4654
|
+
this.item.composition.sceneTicking.addComponent(this);
|
|
4655
|
+
this.isEnableCalled = true;
|
|
4656
|
+
}
|
|
4657
|
+
this.onEnable();
|
|
4658
|
+
};
|
|
4659
|
+
/**
|
|
4660
|
+
* @internal
|
|
4661
|
+
*/ _proto.disable = function disable() {
|
|
4662
|
+
this.onDisable();
|
|
4663
|
+
if (this.item.composition) {
|
|
4664
|
+
this.isEnableCalled = false;
|
|
4665
|
+
this.item.composition.sceneTicking.removeComponent(this);
|
|
4666
|
+
}
|
|
4667
|
+
};
|
|
4668
|
+
_proto.setVFXItem = function setVFXItem(item) {
|
|
4669
|
+
this.item = item;
|
|
4670
|
+
if (item.isDuringPlay) {
|
|
4671
|
+
if (!this.isAwakeCalled) {
|
|
4672
|
+
this.onAwake();
|
|
4673
|
+
this.isAwakeCalled = true;
|
|
4674
|
+
}
|
|
4675
|
+
if (item.getVisible() && this.enabled) {
|
|
4676
|
+
this.start();
|
|
4677
|
+
this.enable();
|
|
4678
|
+
}
|
|
4679
|
+
}
|
|
4680
|
+
};
|
|
4681
|
+
_proto.fromData = function fromData(data) {
|
|
4682
|
+
EffectsObject.prototype.fromData.call(this, data);
|
|
4683
|
+
if (data.item) {
|
|
4684
|
+
this.item = data.item;
|
|
4678
4685
|
}
|
|
4679
4686
|
};
|
|
4680
4687
|
_proto.dispose = function dispose() {
|
|
4688
|
+
if (this.isEnableCalled) {
|
|
4689
|
+
this.disable();
|
|
4690
|
+
}
|
|
4691
|
+
if (this.isAwakeCalled) {
|
|
4692
|
+
this.isAwakeCalled = false;
|
|
4693
|
+
this.onDestroy();
|
|
4694
|
+
}
|
|
4681
4695
|
if (this.item) {
|
|
4682
|
-
removeItem(this.item.
|
|
4696
|
+
removeItem(this.item.components, this);
|
|
4683
4697
|
}
|
|
4684
|
-
Component.prototype.dispose.call(this);
|
|
4685
4698
|
};
|
|
4686
|
-
|
|
4699
|
+
_proto.start = function start() {
|
|
4700
|
+
if (this.isStartCalled) {
|
|
4701
|
+
return;
|
|
4702
|
+
}
|
|
4703
|
+
this.isStartCalled = true;
|
|
4704
|
+
this.onStart();
|
|
4705
|
+
};
|
|
4706
|
+
_create_class(Component, [
|
|
4707
|
+
{
|
|
4708
|
+
key: "transform",
|
|
4709
|
+
get: /**
|
|
4710
|
+
* 附加到的 VFXItem 对象 Transform 组件
|
|
4711
|
+
*/ function get() {
|
|
4712
|
+
return this.item.transform;
|
|
4713
|
+
}
|
|
4714
|
+
},
|
|
4687
4715
|
{
|
|
4688
4716
|
key: "isActiveAndEnabled",
|
|
4689
4717
|
get: /**
|
|
@@ -4698,24 +4726,46 @@ function getDirectStore(target) {
|
|
|
4698
4726
|
return this._enabled;
|
|
4699
4727
|
},
|
|
4700
4728
|
set: function set(value) {
|
|
4701
|
-
this.
|
|
4702
|
-
|
|
4703
|
-
if (
|
|
4704
|
-
this.
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4729
|
+
if (this.enabled !== value) {
|
|
4730
|
+
this._enabled = value;
|
|
4731
|
+
if (value) {
|
|
4732
|
+
if (this.isActiveAndEnabled) {
|
|
4733
|
+
this.enable();
|
|
4734
|
+
if (!this.isStartCalled) {
|
|
4735
|
+
this.onStart();
|
|
4736
|
+
this.isStartCalled = true;
|
|
4737
|
+
}
|
|
4738
|
+
}
|
|
4739
|
+
} else {
|
|
4740
|
+
if (this.isEnableCalled) {
|
|
4741
|
+
this.disable();
|
|
4742
|
+
}
|
|
4709
4743
|
}
|
|
4710
4744
|
}
|
|
4711
4745
|
}
|
|
4712
4746
|
}
|
|
4713
4747
|
]);
|
|
4714
|
-
return
|
|
4715
|
-
}(
|
|
4748
|
+
return Component;
|
|
4749
|
+
}(EffectsObject);
|
|
4716
4750
|
__decorate([
|
|
4717
4751
|
serialize()
|
|
4718
|
-
],
|
|
4752
|
+
], Component.prototype, "_enabled", void 0);
|
|
4753
|
+
/**
|
|
4754
|
+
* @since 2.0.0
|
|
4755
|
+
*/ var Behaviour = /*#__PURE__*/ function(Component) {
|
|
4756
|
+
_inherits(Behaviour, Component);
|
|
4757
|
+
function Behaviour() {
|
|
4758
|
+
return Component.apply(this, arguments);
|
|
4759
|
+
}
|
|
4760
|
+
var _proto = Behaviour.prototype;
|
|
4761
|
+
_proto.setVFXItem = function setVFXItem(item) {
|
|
4762
|
+
Component.prototype.setVFXItem.call(this, item);
|
|
4763
|
+
};
|
|
4764
|
+
_proto.dispose = function dispose() {
|
|
4765
|
+
Component.prototype.dispose.call(this);
|
|
4766
|
+
};
|
|
4767
|
+
return Behaviour;
|
|
4768
|
+
}(Component);
|
|
4719
4769
|
|
|
4720
4770
|
/**
|
|
4721
4771
|
* 所有渲染组件的基类
|
|
@@ -4725,19 +4775,14 @@ __decorate([
|
|
|
4725
4775
|
function RendererComponent() {
|
|
4726
4776
|
var _this;
|
|
4727
4777
|
_this = Component.apply(this, arguments) || this;
|
|
4728
|
-
_this.isStartCalled = false;
|
|
4729
4778
|
_this.materials = [];
|
|
4730
4779
|
_this._priority = 0;
|
|
4731
|
-
_this._enabled = true;
|
|
4732
4780
|
return _this;
|
|
4733
4781
|
}
|
|
4734
4782
|
var _proto = RendererComponent.prototype;
|
|
4735
|
-
_proto.onEnable = function onEnable() {};
|
|
4736
|
-
_proto.start = function start() {};
|
|
4737
|
-
_proto.update = function update(dt) {};
|
|
4738
|
-
_proto.lateUpdate = function lateUpdate(dt) {};
|
|
4739
4783
|
_proto.render = function render(renderer) {};
|
|
4740
|
-
_proto.
|
|
4784
|
+
_proto.setVFXItem = function setVFXItem(item) {
|
|
4785
|
+
Component.prototype.setVFXItem.call(this, item);
|
|
4741
4786
|
this.item.rendererComponents.push(this);
|
|
4742
4787
|
};
|
|
4743
4788
|
_proto.fromData = function fromData(data) {
|
|
@@ -4762,26 +4807,6 @@ __decorate([
|
|
|
4762
4807
|
this._priority = value;
|
|
4763
4808
|
}
|
|
4764
4809
|
},
|
|
4765
|
-
{
|
|
4766
|
-
key: "enabled",
|
|
4767
|
-
get: function get() {
|
|
4768
|
-
return this._enabled;
|
|
4769
|
-
},
|
|
4770
|
-
set: function set(value) {
|
|
4771
|
-
this._enabled = value;
|
|
4772
|
-
if (value) {
|
|
4773
|
-
this.onEnable();
|
|
4774
|
-
}
|
|
4775
|
-
}
|
|
4776
|
-
},
|
|
4777
|
-
{
|
|
4778
|
-
key: "isActiveAndEnabled",
|
|
4779
|
-
get: /**
|
|
4780
|
-
* 组件是否可以更新,true 更新,false 不更新
|
|
4781
|
-
*/ function get() {
|
|
4782
|
-
return this.item.getVisible() && this.enabled;
|
|
4783
|
-
}
|
|
4784
|
-
},
|
|
4785
4810
|
{
|
|
4786
4811
|
key: "material",
|
|
4787
4812
|
get: function get() {
|
|
@@ -4804,9 +4829,6 @@ __decorate([
|
|
|
4804
4829
|
__decorate([
|
|
4805
4830
|
serialize()
|
|
4806
4831
|
], RendererComponent.prototype, "_priority", void 0);
|
|
4807
|
-
__decorate([
|
|
4808
|
-
serialize()
|
|
4809
|
-
], RendererComponent.prototype, "_enabled", void 0);
|
|
4810
4832
|
|
|
4811
4833
|
/**
|
|
4812
4834
|
* 抽象插件类
|
|
@@ -4850,7 +4872,7 @@ var CameraController = /*#__PURE__*/ function(Behaviour) {
|
|
|
4850
4872
|
return _this;
|
|
4851
4873
|
}
|
|
4852
4874
|
var _proto = CameraController.prototype;
|
|
4853
|
-
_proto.
|
|
4875
|
+
_proto.onUpdate = function onUpdate() {
|
|
4854
4876
|
if (this.item.composition && this.item.transform.getValid()) {
|
|
4855
4877
|
var camera = this.item.composition.camera;
|
|
4856
4878
|
camera.near = this.options.near;
|
|
@@ -10010,8 +10032,13 @@ var RandomValue = /*#__PURE__*/ function(ValueGetter) {
|
|
|
10010
10032
|
this.min = props[0];
|
|
10011
10033
|
this.max = props[1];
|
|
10012
10034
|
};
|
|
10013
|
-
_proto.getValue = function getValue(time) {
|
|
10014
|
-
|
|
10035
|
+
_proto.getValue = function getValue(time, seed) {
|
|
10036
|
+
var randomSeed = seed != null ? seed : Math.random();
|
|
10037
|
+
return this.min + randomSeed * (this.max - this.min);
|
|
10038
|
+
};
|
|
10039
|
+
_proto.getIntegrateValue = function getIntegrateValue(t0, t1, timeScale) {
|
|
10040
|
+
var seed = timeScale != null ? timeScale : 1.0;
|
|
10041
|
+
return (this.min + seed * (this.max - this.min)) * (t1 - t0);
|
|
10015
10042
|
};
|
|
10016
10043
|
_proto.toUniform = function toUniform() {
|
|
10017
10044
|
return new Float32Array([
|
|
@@ -11538,7 +11565,7 @@ var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord
|
|
|
11538
11565
|
|
|
11539
11566
|
var particleFrag = "#version 100\nprecision mediump float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n";
|
|
11540
11567
|
|
|
11541
|
-
var particleVert = "#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;attribute vec3 aPos;attribute vec4 aOffset;attribute vec3 aVel;attribute vec3 aRot;attribute vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;\n#ifdef USE_SPRITE\nattribute vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);varying vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uAcceleration;uniform vec4 uGravityModifierValue;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef ROT_X_LIFETIME\nuniform vec4 uRXByLifeTimeValue;\n#endif\n#ifdef ROT_Y_LIFETIME\nuniform vec4 uRYByLifeTimeValue;\n#endif\n#ifdef ROT_Z_LIFETIME\nuniform vec4 uRZByLifeTimeValue;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n#if LINEAR_VEL_X\nuniform vec4 uLinearXByLifetimeValue;\n#endif\n#if LINEAR_VEL_Y\nuniform vec4 uLinearYByLifetimeValue;\n#endif\n#if LINEAR_VEL_Z\nuniform vec4 uLinearZByLifetimeValue;\n#endif\n#endif\n#ifdef SPEED_OVER_LIFETIME\nuniform vec4 uSpeedLifetimeValue;\n#endif\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n#if ORB_VEL_X\nuniform vec4 uOrbXByLifetimeValue;\n#endif\n#if ORB_VEL_Y\nuniform vec4 uOrbYByLifetimeValue;\n#endif\n#if ORB_VEL_Z\nuniform vec4 uOrbZByLifetimeValue;\n#endif\nuniform vec3 uOrbCenter;\n#endif\nuniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nvarying float vLife;varying vec4 vColor;varying vec2 vTexCoord;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}vec3 calLinearMov(float _life,float _dur){vec3 mov=vec3(0.0);\n#ifdef AS_LINEAR_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if LINEAR_VEL_X\nmov.x=FUNC(uLinearXByLifetimeValue);\n#endif\n#if LINEAR_VEL_Y\nmov.y=FUNC(uLinearYByLifetimeValue);\n#endif\n#if LINEAR_VEL_Z\nmov.z=FUNC(uLinearZByLifetimeValue);\n#endif\n#undef FUNC\nreturn mov;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvec3 calculateTranslation(vec3 vel,float t0,float t1,float dur){float dt=t1-t0;float d=getIntegrateByTimeFromTime(0.,dt,uGravityModifierValue);vec3 acc=uAcceleration.xyz*d;\n#ifdef SPEED_OVER_LIFETIME\nreturn vel*getIntegrateFromTime0(dt/dur,uSpeedLifetimeValue)*dur+acc;\n#endif\nreturn vel*dt+acc;}mat3 transformFromRotation(vec3 rot,float _life,float _dur){vec3 rotation=rot;\n#ifdef ROT_LIFETIME_AS_MOVEMENT\n#define FUNC1(a) getValueFromTime(_life,a)\n#else\n#define FUNC1(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#ifdef ROT_X_LIFETIME\nrotation.x+=FUNC1(uRXByLifeTimeValue);\n#endif\n#ifdef ROT_Y_LIFETIME\nrotation.y+=FUNC1(uRYByLifeTimeValue);\n#endif\n#ifdef ROT_Z_LIFETIME\nrotation.z+=FUNC1(uRZByLifeTimeValue);\n#endif\nif(dot(rotation,rotation)==0.0){return mat3(1.0);}\n#undef FUNC1\nreturn mat3FromRotation(rotation);}void main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nvec3 point=transformFromRotation(aRot,life,dur)*(aDirX*size.x+aDirY*size.y);vec3 pt=calculateTranslation(aVel,aOffset.z,uParams.x,dur);vec3 _pos=aPos+pt;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n_pos.xyz+=calLinearMov(life,dur);\n#endif\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}}";
|
|
11568
|
+
var particleVert = "#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;attribute vec3 aPos;attribute vec4 aOffset;attribute vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;attribute vec3 aTranslation;attribute vec3 aRotation0;attribute vec3 aRotation1;attribute vec3 aRotation2;attribute vec3 aLinearMove;\n#ifdef USE_SPRITE\nattribute vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);varying vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nuniform vec4 uOrbXByLifetimeValue;uniform vec4 uOrbYByLifetimeValue;uniform vec4 uOrbZByLifetimeValue;uniform vec3 uOrbCenter;uniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nvarying float vLife;varying vec4 vColor;varying vec2 vTexCoord;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvoid main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nmat3 aRotation=mat3(aRotation0,aRotation1,aRotation2);vec3 point=aRotation*(aDirX*size.x+aDirY*size.y);vec3 _pos=aPos+aTranslation;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n_pos.xyz+=aLinearMove;\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}}";
|
|
11542
11569
|
|
|
11543
11570
|
var trailVert = "#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}attribute vec4 aPos;attribute vec3 aDir;attribute vec3 aInfo;attribute vec4 aColor;attribute float aTime;\n#ifdef ATTR_TRAIL_START\nattribute float aTrailStart;\n#else\nuniform float uTrailStart[64];attribute float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 _pa=effects_MatrixVP*vec4(aPos.xyz,1.);vec4 _pb=effects_MatrixVP*vec4(aPos.xyz+aDir,1.);vec2 dir=normalize(_pb.xy/_pb.w-_pa.xy/_pa.w);vec2 screen_xy=vec2(-dir.y,dir.x);vec4 pos=effects_ObjectToWorld*vec4(aPos.xyz,1.);\n#ifdef ATTR_TRAIL_START\nfloat ts=aTrailStart;\n#else\nfloat ts=uTrailStart[int(aTrailStartIndex)];\n#endif\nfloat trail=(ts-aInfo.y)/uParams.y;float width=aPos.w*getValueFromTime(trail,uWidthOverTrail)/max(abs(screen_xy.x),abs(screen_xy.y));pos.xyz+=(effects_MatrixInvV[0].xyz*screen_xy.x+effects_MatrixInvV[1].xyz*screen_xy.y)*width;float time=min((uTime-aTime)/aInfo.x,1.0);gl_Position=effects_MatrixVP*pos;vColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(time,0.));\n#endif\n#endif\n#ifdef COLOR_OVER_TRAIL\nvColor*=texture2D(uColorOverTrail,vec2(trail,0.));\n#endif\nvColor.a*=clamp(getValueFromTime(time,uOpacityOverLifetimeValue),0.,1.);vLife=time;vTexCoord=uTextureMap.xy+vec2(trail,aInfo.z)*uTextureMap.zw;vSeed=aSeed;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}";
|
|
11544
11571
|
|
|
@@ -13248,7 +13275,7 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13248
13275
|
return _this;
|
|
13249
13276
|
}
|
|
13250
13277
|
var _proto = InteractComponent.prototype;
|
|
13251
|
-
_proto.
|
|
13278
|
+
_proto.onStart = function onStart() {
|
|
13252
13279
|
var _this = this;
|
|
13253
13280
|
var options = this.item.props.content.options;
|
|
13254
13281
|
var env = this.item.engine.renderer.env;
|
|
@@ -13284,8 +13311,11 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13284
13311
|
}
|
|
13285
13312
|
};
|
|
13286
13313
|
};
|
|
13287
|
-
_proto.
|
|
13314
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
13288
13315
|
var _this_previewContent;
|
|
13316
|
+
if (!this.isActiveAndEnabled) {
|
|
13317
|
+
return;
|
|
13318
|
+
}
|
|
13289
13319
|
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
13290
13320
|
if (!this.hasBeenAddedToComposition && this.item.composition) {
|
|
13291
13321
|
var options = this.item.props.content.options;
|
|
@@ -13628,6 +13658,9 @@ function _assert_this_initialized(self) {
|
|
|
13628
13658
|
this.outputs = [];
|
|
13629
13659
|
this.playState = 0;
|
|
13630
13660
|
this.traversalMode = 0;
|
|
13661
|
+
/**
|
|
13662
|
+
* 当前本地播放的时间
|
|
13663
|
+
*/ this.time = 0;
|
|
13631
13664
|
graph.addPlayable(this);
|
|
13632
13665
|
this.inputs = new Array(inputCount);
|
|
13633
13666
|
this.inputOuputPorts = new Array(inputCount);
|
|
@@ -14073,10 +14106,10 @@ var SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
14073
14106
|
this.material.setVector2("_Size", this.transform.size);
|
|
14074
14107
|
renderer.drawGeometry(geo, material);
|
|
14075
14108
|
};
|
|
14076
|
-
_proto.
|
|
14109
|
+
_proto.onStart = function onStart() {
|
|
14077
14110
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
14078
14111
|
};
|
|
14079
|
-
_proto.
|
|
14112
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
14080
14113
|
if (!this.isManualTimeSet) {
|
|
14081
14114
|
this.frameAnimationTime += dt / 1000;
|
|
14082
14115
|
this.isManualTimeSet = false;
|
|
@@ -16499,17 +16532,18 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
|
|
|
16499
16532
|
return _this;
|
|
16500
16533
|
}
|
|
16501
16534
|
var _proto = ParticleSystemRenderer.prototype;
|
|
16502
|
-
_proto.
|
|
16535
|
+
_proto.onStart = function onStart() {
|
|
16503
16536
|
this._priority = this.item.renderOrder;
|
|
16504
16537
|
this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);
|
|
16505
16538
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
16506
16539
|
var mesh = _step.value;
|
|
16507
|
-
mesh.
|
|
16540
|
+
mesh.onStart();
|
|
16508
16541
|
}
|
|
16509
16542
|
};
|
|
16510
|
-
_proto.
|
|
16543
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
16511
16544
|
var time = this.particleMesh.time;
|
|
16512
16545
|
this.particleMesh.mesh.material.setVector4("uParams", new Vector4(time, this.item.duration, 0, 0));
|
|
16546
|
+
this.particleMesh.onUpdate(dt);
|
|
16513
16547
|
};
|
|
16514
16548
|
_proto.render = function render(renderer) {
|
|
16515
16549
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
@@ -16524,6 +16558,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
|
|
|
16524
16558
|
};
|
|
16525
16559
|
_proto.updateTime = function updateTime(now, delta) {
|
|
16526
16560
|
this.particleMesh.time = now;
|
|
16561
|
+
// this.particleMesh.onUpdate(delta);
|
|
16527
16562
|
if (this.trailMesh) {
|
|
16528
16563
|
this.trailMesh.time = now;
|
|
16529
16564
|
this.trailMesh.onUpdate(delta);
|
|
@@ -16734,7 +16769,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16734
16769
|
_proto.getTextures = function getTextures() {
|
|
16735
16770
|
return this.renderer.getTextures();
|
|
16736
16771
|
};
|
|
16737
|
-
_proto.
|
|
16772
|
+
_proto.startEmit = function startEmit() {
|
|
16738
16773
|
if (!this.started || this.ended) {
|
|
16739
16774
|
this.reset();
|
|
16740
16775
|
this.started = true;
|
|
@@ -16760,7 +16795,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16760
16795
|
this.frozen = false;
|
|
16761
16796
|
this.ended = false;
|
|
16762
16797
|
};
|
|
16763
|
-
_proto.
|
|
16798
|
+
_proto.update = function update(delta) {
|
|
16764
16799
|
var _this = this;
|
|
16765
16800
|
if (this.started && !this.frozen) {
|
|
16766
16801
|
var now = this.lastUpdate + delta / 1000;
|
|
@@ -17560,7 +17595,7 @@ function randomArrItem(arr, keepArr) {
|
|
|
17560
17595
|
this.particleSystem = boundObject.getComponent(ParticleSystem);
|
|
17561
17596
|
if (this.particleSystem) {
|
|
17562
17597
|
this.particleSystem.name = boundObject.name;
|
|
17563
|
-
this.particleSystem.
|
|
17598
|
+
this.particleSystem.startEmit();
|
|
17564
17599
|
this.particleSystem.initEmitterTransform();
|
|
17565
17600
|
}
|
|
17566
17601
|
};
|
|
@@ -17577,7 +17612,7 @@ function randomArrItem(arr, keepArr) {
|
|
|
17577
17612
|
if (Math.abs(this.time - this.lastTime) < 0.001) {
|
|
17578
17613
|
deltaTime = 0;
|
|
17579
17614
|
}
|
|
17580
|
-
particleSystem.
|
|
17615
|
+
particleSystem.update(deltaTime);
|
|
17581
17616
|
}
|
|
17582
17617
|
this.lastTime = this.time;
|
|
17583
17618
|
};
|
|
@@ -17630,6 +17665,7 @@ var particleUniformTypeMap = {
|
|
|
17630
17665
|
var ParticleMesh = /*#__PURE__*/ function() {
|
|
17631
17666
|
function ParticleMesh(engine, props) {
|
|
17632
17667
|
this.particleCount = 0;
|
|
17668
|
+
this.VERT_MAX_KEY_FRAME_COUNT = 0;
|
|
17633
17669
|
var _engine_renderer;
|
|
17634
17670
|
var env = ((_engine_renderer = engine.renderer) != null ? _engine_renderer : {}).env;
|
|
17635
17671
|
var speedOverLifetime = props.speedOverLifetime, colorOverLifetime = props.colorOverLifetime, linearVelOverLifetime = props.linearVelOverLifetime, orbitalVelOverLifetime = props.orbitalVelOverLifetime, sizeOverLifetime = props.sizeOverLifetime, rotationOverLifetime = props.rotationOverLifetime, sprite = props.sprite, gravityModifier = props.gravityModifier, maxCount = props.maxCount, textureFlip = props.textureFlip, useSprite = props.useSprite, name = props.name, gravity = props.gravity, forceTarget = props.forceTarget, side = props.side, occlusion = props.occlusion, anchor = props.anchor, blending = props.blending, maskMode = props.maskMode, mask = props.mask, transparentOcclusion = props.transparentOcclusion, meshSlots = props.meshSlots, _props_renderMode = props.renderMode, renderMode = _props_renderMode === void 0 ? 0 : _props_renderMode, _props_diffuse = props.diffuse, diffuse = _props_diffuse === void 0 ? Texture.createWithData(engine) : _props_diffuse;
|
|
@@ -17848,6 +17884,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
17848
17884
|
"FRAG_MAX_KEY_FRAME_COUNT",
|
|
17849
17885
|
fragmentKeyFrameMeta.max
|
|
17850
17886
|
]);
|
|
17887
|
+
this.VERT_MAX_KEY_FRAME_COUNT = vertexKeyFrameMeta.max;
|
|
17851
17888
|
var fragment = particleFrag;
|
|
17852
17889
|
var originalVertex = "#define LOOKUP_TEXTURE_CURVE " + vertex_lookup_texture + "\n" + particleVert;
|
|
17853
17890
|
var vertex = originalVertex;
|
|
@@ -17956,6 +17993,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
17956
17993
|
this.orbitalVelOverLifetime = orbitalVelOverLifetime;
|
|
17957
17994
|
this.orbitalVelOverLifetime = orbitalVelOverLifetime;
|
|
17958
17995
|
this.gravityModifier = gravityModifier;
|
|
17996
|
+
this.rotationOverLifetime = rotationOverLifetime;
|
|
17959
17997
|
this.maxCount = maxCount;
|
|
17960
17998
|
// this.duration = duration;
|
|
17961
17999
|
this.textureOffsets = textureFlip ? [
|
|
@@ -18020,15 +18058,232 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18020
18058
|
// @ts-expect-error
|
|
18021
18059
|
geometry.setIndexData(new index.constructor(0));
|
|
18022
18060
|
};
|
|
18061
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
18062
|
+
var aPosArray = this.geometry.getAttributeData("aPos"); // vector3
|
|
18063
|
+
var aVelArray = this.geometry.getAttributeData("aVel"); // vector3
|
|
18064
|
+
var aOffsetArray = this.geometry.getAttributeData("aOffset");
|
|
18065
|
+
var aRotArray = this.geometry.getAttributeData("aRot"); // vector3
|
|
18066
|
+
var aSeedArray = this.geometry.getAttributeData("aSeed"); // float
|
|
18067
|
+
// const uParams = this.mesh.material.getVector4('uParams');
|
|
18068
|
+
// if (!uParams) {
|
|
18069
|
+
// return;
|
|
18070
|
+
// }
|
|
18071
|
+
var localTime = new Float32Array([
|
|
18072
|
+
this.time
|
|
18073
|
+
])[0];
|
|
18074
|
+
var particleCount = Math.ceil(aPosArray.length / 12);
|
|
18075
|
+
// calculate particle translation
|
|
18076
|
+
var aTranslationArray = this.geometry.getAttributeData("aTranslation");
|
|
18077
|
+
if (aTranslationArray.length < particleCount * 3) {
|
|
18078
|
+
aTranslationArray = new Float32Array(particleCount * 3);
|
|
18079
|
+
}
|
|
18080
|
+
var velocity = new Vector3(0, 0, 0);
|
|
18081
|
+
for(var i = 0; i < particleCount; i++){
|
|
18082
|
+
var velOffset = i * 12 + 3;
|
|
18083
|
+
velocity.set(aVelArray[velOffset], aVelArray[velOffset + 1], aVelArray[velOffset + 2]);
|
|
18084
|
+
var trans = this.calculateTranslation(velocity, aOffsetArray[i * 4 + 2], localTime, aOffsetArray[i * 4 + 3]);
|
|
18085
|
+
var aTranslationOffset = i * 3;
|
|
18086
|
+
aTranslationArray[aTranslationOffset] = trans.x;
|
|
18087
|
+
aTranslationArray[aTranslationOffset + 1] = trans.y;
|
|
18088
|
+
aTranslationArray[aTranslationOffset + 2] = trans.z;
|
|
18089
|
+
}
|
|
18090
|
+
this.geometry.setAttributeData("aTranslation", aTranslationArray);
|
|
18091
|
+
// calculate particle rotation
|
|
18092
|
+
var aRotationArray = this.geometry.getAttributeData("aRotation0");
|
|
18093
|
+
if (aRotationArray.length < particleCount * 9) {
|
|
18094
|
+
aRotationArray = new Float32Array(particleCount * 9);
|
|
18095
|
+
}
|
|
18096
|
+
for(var i1 = 0; i1 < particleCount; i1++){
|
|
18097
|
+
var time = localTime - aOffsetArray[i1 * 4 + 2];
|
|
18098
|
+
var duration = aOffsetArray[i1 * 4 + 3];
|
|
18099
|
+
var life = clamp$1(time / duration, 0.0, 1.0);
|
|
18100
|
+
var aRotOffset = i1 * 8;
|
|
18101
|
+
var aRot = new Vector3(aRotArray[aRotOffset], aRotArray[aRotOffset + 1], aRotArray[aRotOffset + 2]);
|
|
18102
|
+
var aSeed = aSeedArray[i1 * 8 + 3];
|
|
18103
|
+
var aRotation = this.transformFromRotation(aRot, life, duration, aSeed);
|
|
18104
|
+
var aRotationOffset = i1 * 9;
|
|
18105
|
+
var matrixArray = aRotation.toArray();
|
|
18106
|
+
aRotationArray.set(matrixArray, aRotationOffset);
|
|
18107
|
+
}
|
|
18108
|
+
this.geometry.setAttributeData("aRotation0", aRotationArray);
|
|
18109
|
+
// calculate linear movement
|
|
18110
|
+
var aLinearMoveArray = this.geometry.getAttributeData("aLinearMove");
|
|
18111
|
+
if (aLinearMoveArray.length < particleCount * 3) {
|
|
18112
|
+
aLinearMoveArray = new Float32Array(particleCount * 3);
|
|
18113
|
+
}
|
|
18114
|
+
for(var i2 = 0; i2 < particleCount; i2++){
|
|
18115
|
+
var time1 = localTime - aOffsetArray[i2 * 4 + 2];
|
|
18116
|
+
var duration1 = aOffsetArray[i2 * 4 + 3];
|
|
18117
|
+
// const life = math.clamp(time / duration, 0.0, 1.0);
|
|
18118
|
+
var aSeed1 = aSeedArray[i2 * 8 + 3];
|
|
18119
|
+
var linearMove = this.calLinearMov(time1, duration1, aSeed1);
|
|
18120
|
+
var aLinearMoveOffset = i2 * 3;
|
|
18121
|
+
aLinearMoveArray[aLinearMoveOffset] = linearMove.x;
|
|
18122
|
+
aLinearMoveArray[aLinearMoveOffset + 1] = linearMove.y;
|
|
18123
|
+
aLinearMoveArray[aLinearMoveOffset + 2] = linearMove.z;
|
|
18124
|
+
}
|
|
18125
|
+
this.geometry.setAttributeData("aLinearMove", aLinearMoveArray);
|
|
18126
|
+
};
|
|
18023
18127
|
_proto.minusTime = function minusTime(time) {
|
|
18024
|
-
var
|
|
18025
|
-
|
|
18026
|
-
|
|
18027
|
-
data[i + 2] -= time;
|
|
18128
|
+
var aOffset = this.geometry.getAttributeData("aOffset");
|
|
18129
|
+
for(var i = 0; i < aOffset.length; i += 4){
|
|
18130
|
+
aOffset[i + 2] -= time;
|
|
18028
18131
|
}
|
|
18029
|
-
this.geometry.setAttributeData("aOffset",
|
|
18132
|
+
this.geometry.setAttributeData("aOffset", aOffset);
|
|
18030
18133
|
this.time -= time;
|
|
18031
18134
|
};
|
|
18135
|
+
_proto.calculateTranslation = function calculateTranslation(velocity, t0, t1, duration) {
|
|
18136
|
+
var uAcceleration = this.mesh.material.getVector4("uAcceleration");
|
|
18137
|
+
var uGravityModifierValue = this.mesh.material.getVector4("uGravityModifierValue");
|
|
18138
|
+
if (!uAcceleration || !uGravityModifierValue) {
|
|
18139
|
+
return new Vector3();
|
|
18140
|
+
}
|
|
18141
|
+
var dt = t1 - t0; // 相对delay的时间
|
|
18142
|
+
var d = this.gravityModifier.getIntegrateByTime(0, dt);
|
|
18143
|
+
var acc = [
|
|
18144
|
+
uAcceleration.x * d,
|
|
18145
|
+
uAcceleration.y * d,
|
|
18146
|
+
uAcceleration.z * d
|
|
18147
|
+
];
|
|
18148
|
+
// ret.addScaledVector(velData, speedIntegrate);
|
|
18149
|
+
// ret.addScaledVector(acc, d);
|
|
18150
|
+
// speedIntegrate = speedOverLifetime.getIntegrateValue(0, time, duration);
|
|
18151
|
+
if (this.speedOverLifetime) {
|
|
18152
|
+
// dt / dur 归一化
|
|
18153
|
+
var speed = this.speedOverLifetime.getIntegrateValue(0, dt, duration);
|
|
18154
|
+
return velocity.clone().multiply(speed).add(acc);
|
|
18155
|
+
}
|
|
18156
|
+
return velocity.clone().multiply(dt).add(acc);
|
|
18157
|
+
};
|
|
18158
|
+
_proto.transformFromRotation = function transformFromRotation(rot, life, dur, aSeed) {
|
|
18159
|
+
var rotation = rot.clone();
|
|
18160
|
+
if (!this.rotationOverLifetime) {
|
|
18161
|
+
return new Matrix3();
|
|
18162
|
+
}
|
|
18163
|
+
if (this.rotationOverLifetime.asRotation) {
|
|
18164
|
+
// Adjust rotation based on the specified lifetime components
|
|
18165
|
+
if (this.rotationOverLifetime.x) {
|
|
18166
|
+
if (_instanceof1(this.rotationOverLifetime.x, RandomValue)) {
|
|
18167
|
+
rotation.x += this.rotationOverLifetime.x.getValue(life, aSeed);
|
|
18168
|
+
} else {
|
|
18169
|
+
rotation.x += this.rotationOverLifetime.x.getValue(life);
|
|
18170
|
+
}
|
|
18171
|
+
}
|
|
18172
|
+
if (this.rotationOverLifetime.y) {
|
|
18173
|
+
if (_instanceof1(this.rotationOverLifetime.y, RandomValue)) {
|
|
18174
|
+
rotation.y += this.rotationOverLifetime.y.getValue(life, aSeed);
|
|
18175
|
+
} else {
|
|
18176
|
+
rotation.y += this.rotationOverLifetime.y.getValue(life);
|
|
18177
|
+
}
|
|
18178
|
+
}
|
|
18179
|
+
if (this.rotationOverLifetime.z) {
|
|
18180
|
+
if (_instanceof1(this.rotationOverLifetime.z, RandomValue)) {
|
|
18181
|
+
rotation.z += this.rotationOverLifetime.z.getValue(life, aSeed);
|
|
18182
|
+
} else {
|
|
18183
|
+
rotation.z += this.rotationOverLifetime.z.getValue(life);
|
|
18184
|
+
}
|
|
18185
|
+
}
|
|
18186
|
+
} else {
|
|
18187
|
+
// Adjust rotation based on the specified lifetime components
|
|
18188
|
+
if (this.rotationOverLifetime.x) {
|
|
18189
|
+
if (_instanceof1(this.rotationOverLifetime.x, RandomValue)) {
|
|
18190
|
+
rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, aSeed) * dur;
|
|
18191
|
+
} else {
|
|
18192
|
+
rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, dur) * dur;
|
|
18193
|
+
}
|
|
18194
|
+
}
|
|
18195
|
+
if (this.rotationOverLifetime.y) {
|
|
18196
|
+
if (_instanceof1(this.rotationOverLifetime.y, RandomValue)) {
|
|
18197
|
+
rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, aSeed) * dur;
|
|
18198
|
+
} else {
|
|
18199
|
+
rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, dur) * dur;
|
|
18200
|
+
}
|
|
18201
|
+
}
|
|
18202
|
+
if (this.rotationOverLifetime.z) {
|
|
18203
|
+
if (_instanceof1(this.rotationOverLifetime.z, RandomValue)) {
|
|
18204
|
+
rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, aSeed) * dur;
|
|
18205
|
+
} else {
|
|
18206
|
+
rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, dur) * dur;
|
|
18207
|
+
}
|
|
18208
|
+
}
|
|
18209
|
+
}
|
|
18210
|
+
// If the rotation vector is zero, return the identity matrix
|
|
18211
|
+
if (rotation.dot(rotation) === 0.0) {
|
|
18212
|
+
return new Matrix3().identity();
|
|
18213
|
+
}
|
|
18214
|
+
// Return the rotation matrix derived from the rotation vector
|
|
18215
|
+
return this.mat3FromRotation(rotation);
|
|
18216
|
+
};
|
|
18217
|
+
_proto.mat3FromRotation = function mat3FromRotation(rotation) {
|
|
18218
|
+
var d2r = Math.PI / 180;
|
|
18219
|
+
var sinR = rotation.clone().multiply(d2r);
|
|
18220
|
+
sinR.x = Math.sin(sinR.x);
|
|
18221
|
+
sinR.y = Math.sin(sinR.y);
|
|
18222
|
+
sinR.z = Math.sin(sinR.z);
|
|
18223
|
+
var cosR = rotation.clone().multiply(d2r);
|
|
18224
|
+
cosR.x = Math.cos(cosR.x);
|
|
18225
|
+
cosR.y = Math.cos(cosR.y);
|
|
18226
|
+
cosR.z = Math.cos(cosR.z);
|
|
18227
|
+
var rotZ = new Matrix3(cosR.z, -sinR.z, 0., sinR.z, cosR.z, 0., 0., 0., 1.);
|
|
18228
|
+
var rotY = new Matrix3(cosR.y, 0., sinR.y, 0., 1., 0., -sinR.y, 0, cosR.y);
|
|
18229
|
+
var rotX = new Matrix3(1., 0., 0., 0, cosR.x, -sinR.x, 0., sinR.x, cosR.x);
|
|
18230
|
+
var result = rotZ.multiply(rotY).multiply(rotX);
|
|
18231
|
+
return result;
|
|
18232
|
+
};
|
|
18233
|
+
_proto.calLinearMov = function calLinearMov(time, duration, aSeed) {
|
|
18234
|
+
var mov = new Vector3();
|
|
18235
|
+
var lifetime = time / duration;
|
|
18236
|
+
if (!this.linearVelOverLifetime || !this.linearVelOverLifetime.enabled) {
|
|
18237
|
+
return new Vector3();
|
|
18238
|
+
}
|
|
18239
|
+
if (this.linearVelOverLifetime.asMovement) {
|
|
18240
|
+
if (this.linearVelOverLifetime.x) {
|
|
18241
|
+
if (_instanceof1(this.linearVelOverLifetime.x, RandomValue)) {
|
|
18242
|
+
mov.x = this.linearVelOverLifetime.x.getValue(lifetime, aSeed);
|
|
18243
|
+
} else {
|
|
18244
|
+
mov.x = this.linearVelOverLifetime.x.getValue(lifetime);
|
|
18245
|
+
}
|
|
18246
|
+
}
|
|
18247
|
+
if (this.linearVelOverLifetime.y) {
|
|
18248
|
+
if (_instanceof1(this.linearVelOverLifetime.y, RandomValue)) {
|
|
18249
|
+
mov.y = this.linearVelOverLifetime.y.getValue(lifetime, aSeed);
|
|
18250
|
+
} else {
|
|
18251
|
+
mov.y = this.linearVelOverLifetime.y.getValue(lifetime);
|
|
18252
|
+
}
|
|
18253
|
+
}
|
|
18254
|
+
if (this.linearVelOverLifetime.z) {
|
|
18255
|
+
if (_instanceof1(this.linearVelOverLifetime.z, RandomValue)) {
|
|
18256
|
+
mov.z = this.linearVelOverLifetime.z.getValue(lifetime, aSeed);
|
|
18257
|
+
} else {
|
|
18258
|
+
mov.z = this.linearVelOverLifetime.z.getValue(lifetime);
|
|
18259
|
+
}
|
|
18260
|
+
}
|
|
18261
|
+
} else {
|
|
18262
|
+
// Adjust rotation based on the specified lifetime components
|
|
18263
|
+
if (this.linearVelOverLifetime.x) {
|
|
18264
|
+
if (_instanceof1(this.linearVelOverLifetime.x, RandomValue)) {
|
|
18265
|
+
mov.x = this.linearVelOverLifetime.x.getIntegrateValue(0.0, time, aSeed);
|
|
18266
|
+
} else {
|
|
18267
|
+
mov.x = this.linearVelOverLifetime.x.getIntegrateValue(0.0, time, duration);
|
|
18268
|
+
}
|
|
18269
|
+
}
|
|
18270
|
+
if (this.linearVelOverLifetime.y) {
|
|
18271
|
+
if (_instanceof1(this.linearVelOverLifetime.y, RandomValue)) {
|
|
18272
|
+
mov.y = this.linearVelOverLifetime.y.getIntegrateValue(0.0, time, aSeed);
|
|
18273
|
+
} else {
|
|
18274
|
+
mov.y = this.linearVelOverLifetime.y.getIntegrateValue(0.0, time, duration);
|
|
18275
|
+
}
|
|
18276
|
+
}
|
|
18277
|
+
if (this.linearVelOverLifetime.z) {
|
|
18278
|
+
if (_instanceof1(this.linearVelOverLifetime.z, RandomValue)) {
|
|
18279
|
+
mov.z = this.linearVelOverLifetime.z.getIntegrateValue(0.0, time, aSeed);
|
|
18280
|
+
} else {
|
|
18281
|
+
mov.z = this.linearVelOverLifetime.z.getIntegrateValue(0.0, time, duration);
|
|
18282
|
+
}
|
|
18283
|
+
}
|
|
18284
|
+
}
|
|
18285
|
+
return mov;
|
|
18286
|
+
};
|
|
18032
18287
|
_proto.removePoint = function removePoint(index) {
|
|
18033
18288
|
if (index < this.particleCount) {
|
|
18034
18289
|
this.geometry.setAttributeSubData("aOffset", index * 16, new Float32Array(16));
|
|
@@ -18230,6 +18485,32 @@ function generateGeometryProps(maxVertex, useSprite, name) {
|
|
|
18230
18485
|
size: 4,
|
|
18231
18486
|
stride: 4 * bpe,
|
|
18232
18487
|
data: new Float32Array(0)
|
|
18488
|
+
},
|
|
18489
|
+
aTranslation: {
|
|
18490
|
+
size: 3,
|
|
18491
|
+
data: new Float32Array(0)
|
|
18492
|
+
},
|
|
18493
|
+
aLinearMove: {
|
|
18494
|
+
size: 3,
|
|
18495
|
+
data: new Float32Array(0)
|
|
18496
|
+
},
|
|
18497
|
+
aRotation0: {
|
|
18498
|
+
size: 3,
|
|
18499
|
+
offset: 0,
|
|
18500
|
+
stride: 9 * bpe,
|
|
18501
|
+
data: new Float32Array(0)
|
|
18502
|
+
},
|
|
18503
|
+
aRotation1: {
|
|
18504
|
+
size: 3,
|
|
18505
|
+
offset: 3 * bpe,
|
|
18506
|
+
stride: 9 * bpe,
|
|
18507
|
+
dataSource: "aRotation0"
|
|
18508
|
+
},
|
|
18509
|
+
aRotation2: {
|
|
18510
|
+
size: 3,
|
|
18511
|
+
offset: 6 * bpe,
|
|
18512
|
+
stride: 9 * bpe,
|
|
18513
|
+
dataSource: "aRotation0"
|
|
18233
18514
|
}
|
|
18234
18515
|
};
|
|
18235
18516
|
if (useSprite) {
|
|
@@ -19307,25 +19588,15 @@ var TrackSortWrapper = function TrackSortWrapper(track, originalIndex) {
|
|
|
19307
19588
|
this.track = track;
|
|
19308
19589
|
this.originalIndex = originalIndex;
|
|
19309
19590
|
};
|
|
19310
|
-
function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
19311
|
-
var current = descendantCandidate.parent;
|
|
19312
|
-
while(current){
|
|
19313
|
-
if (current === ancestorCandidate) {
|
|
19314
|
-
return true;
|
|
19315
|
-
}
|
|
19316
|
-
current = current.parent;
|
|
19317
|
-
}
|
|
19318
|
-
return false;
|
|
19319
|
-
}
|
|
19320
19591
|
function compareTracks(a, b) {
|
|
19321
19592
|
var bindingA = a.track.binding;
|
|
19322
19593
|
var bindingB = b.track.binding;
|
|
19323
19594
|
if (!_instanceof1(bindingA, VFXItem) || !_instanceof1(bindingB, VFXItem)) {
|
|
19324
19595
|
return a.originalIndex - b.originalIndex;
|
|
19325
19596
|
}
|
|
19326
|
-
if (isAncestor(bindingA, bindingB)) {
|
|
19597
|
+
if (VFXItem.isAncestor(bindingA, bindingB)) {
|
|
19327
19598
|
return -1;
|
|
19328
|
-
} else if (isAncestor(bindingB, bindingA)) {
|
|
19599
|
+
} else if (VFXItem.isAncestor(bindingB, bindingA)) {
|
|
19329
19600
|
return 1;
|
|
19330
19601
|
} else {
|
|
19331
19602
|
return a.originalIndex - b.originalIndex; // 非父子关系的元素保持原始顺序
|
|
@@ -19349,7 +19620,7 @@ function compareTracks(a, b) {
|
|
|
19349
19620
|
return _this;
|
|
19350
19621
|
}
|
|
19351
19622
|
var _proto = CompositionComponent.prototype;
|
|
19352
|
-
_proto.
|
|
19623
|
+
_proto.onStart = function onStart() {
|
|
19353
19624
|
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;
|
|
19354
19625
|
this.startTime = startTime;
|
|
19355
19626
|
this.resolveBindings();
|
|
@@ -19377,7 +19648,7 @@ function compareTracks(a, b) {
|
|
|
19377
19648
|
_proto.getReusable = function getReusable() {
|
|
19378
19649
|
return this.reusable;
|
|
19379
19650
|
};
|
|
19380
|
-
_proto.
|
|
19651
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
19381
19652
|
var time = this.time;
|
|
19382
19653
|
this.timelinePlayable.setTime(time);
|
|
19383
19654
|
this.graph.evaluate(dt);
|
|
@@ -19413,7 +19684,9 @@ function compareTracks(a, b) {
|
|
|
19413
19684
|
props.content = itemData.content;
|
|
19414
19685
|
item = assetLoader.loadGUID(itemData.id);
|
|
19415
19686
|
item.composition = this.item.composition;
|
|
19416
|
-
var compositionComponent =
|
|
19687
|
+
var compositionComponent = new CompositionComponent(this.engine);
|
|
19688
|
+
compositionComponent.item = item;
|
|
19689
|
+
item.components.push(compositionComponent);
|
|
19417
19690
|
compositionComponent.data = props;
|
|
19418
19691
|
compositionComponent.refId = refId;
|
|
19419
19692
|
item.transform.parentTransform = this.transform;
|
|
@@ -19867,8 +20140,8 @@ var TextComponent = /*#__PURE__*/ function(SpriteComponent) {
|
|
|
19867
20140
|
return _this;
|
|
19868
20141
|
}
|
|
19869
20142
|
var _proto = TextComponent.prototype;
|
|
19870
|
-
_proto.
|
|
19871
|
-
SpriteComponent.prototype.
|
|
20143
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
20144
|
+
SpriteComponent.prototype.onUpdate.call(this, dt);
|
|
19872
20145
|
this.updateTexture();
|
|
19873
20146
|
};
|
|
19874
20147
|
_proto.fromData = function fromData(data) {
|
|
@@ -20283,7 +20556,7 @@ var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
20283
20556
|
return _this;
|
|
20284
20557
|
}
|
|
20285
20558
|
var _proto = EffectComponent.prototype;
|
|
20286
|
-
_proto.
|
|
20559
|
+
_proto.onStart = function onStart() {
|
|
20287
20560
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
20288
20561
|
};
|
|
20289
20562
|
_proto.render = function render(renderer) {
|
|
@@ -20410,7 +20683,7 @@ var PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
|
20410
20683
|
return _this;
|
|
20411
20684
|
}
|
|
20412
20685
|
var _proto = PostProcessVolume.prototype;
|
|
20413
|
-
_proto.
|
|
20686
|
+
_proto.onStart = function onStart() {
|
|
20414
20687
|
var composition = this.item.composition;
|
|
20415
20688
|
if (composition) {
|
|
20416
20689
|
composition.globalVolume = this;
|
|
@@ -20552,8 +20825,8 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20552
20825
|
*/ _this.ended = false;
|
|
20553
20826
|
_this.reusable = false;
|
|
20554
20827
|
_this.type = ItemType.base;
|
|
20828
|
+
_this.isDuringPlay = false;
|
|
20555
20829
|
_this.components = [];
|
|
20556
|
-
_this.itemBehaviours = [];
|
|
20557
20830
|
_this.rendererComponents = [];
|
|
20558
20831
|
/**
|
|
20559
20832
|
* 元素可见性,该值的改变会触发 `handleVisibleChanged` 回调
|
|
@@ -20563,6 +20836,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20563
20836
|
* 元素动画的速度
|
|
20564
20837
|
*/ _this.speed = 1;
|
|
20565
20838
|
_this.listIndex = 0;
|
|
20839
|
+
_this.isEnabled = false;
|
|
20566
20840
|
_this.eventProcessor = new EventEmitter();
|
|
20567
20841
|
_this.name = "VFXItem";
|
|
20568
20842
|
_this.transform.name = _this.name;
|
|
@@ -20635,8 +20909,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20635
20909
|
*/ _proto.addComponent = function addComponent(classConstructor) {
|
|
20636
20910
|
var newComponent = new classConstructor(this.engine);
|
|
20637
20911
|
this.components.push(newComponent);
|
|
20638
|
-
newComponent.
|
|
20639
|
-
newComponent.onAttached();
|
|
20912
|
+
newComponent.setVFXItem(this);
|
|
20640
20913
|
return newComponent;
|
|
20641
20914
|
};
|
|
20642
20915
|
/**
|
|
@@ -20669,21 +20942,22 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20669
20942
|
return res;
|
|
20670
20943
|
};
|
|
20671
20944
|
_proto.setParent = function setParent(vfxItem) {
|
|
20672
|
-
if (vfxItem === this) {
|
|
20945
|
+
if (vfxItem === this && !vfxItem) {
|
|
20673
20946
|
return;
|
|
20674
20947
|
}
|
|
20675
20948
|
if (this.parent) {
|
|
20676
20949
|
removeItem(this.parent.children, this);
|
|
20677
20950
|
}
|
|
20678
20951
|
this.parent = vfxItem;
|
|
20679
|
-
if (
|
|
20680
|
-
|
|
20681
|
-
|
|
20682
|
-
|
|
20683
|
-
|
|
20684
|
-
|
|
20685
|
-
|
|
20686
|
-
|
|
20952
|
+
if (!VFXItem.isCamera(this)) {
|
|
20953
|
+
this.transform.parentTransform = vfxItem.transform;
|
|
20954
|
+
}
|
|
20955
|
+
vfxItem.children.push(this);
|
|
20956
|
+
if (!this.composition) {
|
|
20957
|
+
this.composition = vfxItem.composition;
|
|
20958
|
+
}
|
|
20959
|
+
if (!this.isDuringPlay && vfxItem.isDuringPlay) {
|
|
20960
|
+
this.beginPlay();
|
|
20687
20961
|
}
|
|
20688
20962
|
};
|
|
20689
20963
|
/**
|
|
@@ -20714,6 +20988,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20714
20988
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
20715
20989
|
if (this.visible !== visible) {
|
|
20716
20990
|
this.visible = !!visible;
|
|
20991
|
+
this.onActiveChanged();
|
|
20717
20992
|
}
|
|
20718
20993
|
};
|
|
20719
20994
|
/**
|
|
@@ -20838,6 +21113,57 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20838
21113
|
}
|
|
20839
21114
|
return undefined;
|
|
20840
21115
|
};
|
|
21116
|
+
/**
|
|
21117
|
+
* @internal
|
|
21118
|
+
*/ _proto.beginPlay = function beginPlay() {
|
|
21119
|
+
this.isDuringPlay = true;
|
|
21120
|
+
if (this.composition && this.visible && !this.isEnabled) {
|
|
21121
|
+
this.onEnable();
|
|
21122
|
+
}
|
|
21123
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
21124
|
+
var child = _step.value;
|
|
21125
|
+
if (!child.isDuringPlay) {
|
|
21126
|
+
child.beginPlay();
|
|
21127
|
+
}
|
|
21128
|
+
}
|
|
21129
|
+
};
|
|
21130
|
+
/**
|
|
21131
|
+
* @internal
|
|
21132
|
+
*/ _proto.onActiveChanged = function onActiveChanged() {
|
|
21133
|
+
if (!this.isEnabled) {
|
|
21134
|
+
this.onEnable();
|
|
21135
|
+
} else {
|
|
21136
|
+
this.onDisable();
|
|
21137
|
+
}
|
|
21138
|
+
};
|
|
21139
|
+
/**
|
|
21140
|
+
* @internal
|
|
21141
|
+
*/ _proto.onEnable = function onEnable() {
|
|
21142
|
+
this.isEnabled = true;
|
|
21143
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
21144
|
+
var component = _step.value;
|
|
21145
|
+
if (component.enabled && !component.isStartCalled) {
|
|
21146
|
+
component.onStart();
|
|
21147
|
+
}
|
|
21148
|
+
}
|
|
21149
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.components), _step1; !(_step1 = _iterator1()).done;){
|
|
21150
|
+
var component1 = _step1.value;
|
|
21151
|
+
if (component1.enabled && !component1.isEnableCalled) {
|
|
21152
|
+
component1.enable();
|
|
21153
|
+
}
|
|
21154
|
+
}
|
|
21155
|
+
};
|
|
21156
|
+
/**
|
|
21157
|
+
* @internal
|
|
21158
|
+
*/ _proto.onDisable = function onDisable() {
|
|
21159
|
+
this.isEnabled = false;
|
|
21160
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
21161
|
+
var component = _step.value;
|
|
21162
|
+
if (component.enabled && component.isEnableCalled) {
|
|
21163
|
+
component.disable();
|
|
21164
|
+
}
|
|
21165
|
+
}
|
|
21166
|
+
};
|
|
20841
21167
|
_proto.fromData = function fromData(data) {
|
|
20842
21168
|
EffectsObject.prototype.fromData.call(this, data);
|
|
20843
21169
|
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;
|
|
@@ -20887,14 +21213,10 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20887
21213
|
if (duration <= 0) {
|
|
20888
21214
|
throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
|
|
20889
21215
|
}
|
|
20890
|
-
this.itemBehaviours.length = 0;
|
|
20891
21216
|
this.rendererComponents.length = 0;
|
|
20892
21217
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
20893
21218
|
var component = _step.value;
|
|
20894
21219
|
component.item = this;
|
|
20895
|
-
if (_instanceof1(component, Behaviour)) {
|
|
20896
|
-
this.itemBehaviours.push(component);
|
|
20897
|
-
}
|
|
20898
21220
|
if (_instanceof1(component, RendererComponent)) {
|
|
20899
21221
|
this.rendererComponents.push(component);
|
|
20900
21222
|
}
|
|
@@ -20999,6 +21321,16 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20999
21321
|
VFXItem.isExtraCamera = function isExtraCamera(item) {
|
|
21000
21322
|
return item.id === "extra-camera" && item.name === "extra-camera";
|
|
21001
21323
|
};
|
|
21324
|
+
VFXItem.isAncestor = function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
21325
|
+
var current = descendantCandidate.parent;
|
|
21326
|
+
while(current){
|
|
21327
|
+
if (current === ancestorCandidate) {
|
|
21328
|
+
return true;
|
|
21329
|
+
}
|
|
21330
|
+
current = current.parent;
|
|
21331
|
+
}
|
|
21332
|
+
return false;
|
|
21333
|
+
};
|
|
21002
21334
|
_create_class(VFXItem, [
|
|
21003
21335
|
{
|
|
21004
21336
|
key: "content",
|
|
@@ -24853,6 +25185,109 @@ var listOrder = 0;
|
|
|
24853
25185
|
return CompositionSourceManager;
|
|
24854
25186
|
}();
|
|
24855
25187
|
|
|
25188
|
+
var SceneTicking = /*#__PURE__*/ function() {
|
|
25189
|
+
function SceneTicking() {
|
|
25190
|
+
this.update = new UpdateTickData();
|
|
25191
|
+
this.lateUpdate = new LateUpdateTickData();
|
|
25192
|
+
}
|
|
25193
|
+
var _proto = SceneTicking.prototype;
|
|
25194
|
+
_proto.addComponent = function addComponent(obj) {
|
|
25195
|
+
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
25196
|
+
this.update.addComponent(obj);
|
|
25197
|
+
}
|
|
25198
|
+
if (obj.onLateUpdate !== Component.prototype.onLateUpdate) {
|
|
25199
|
+
this.lateUpdate.addComponent(obj);
|
|
25200
|
+
}
|
|
25201
|
+
};
|
|
25202
|
+
_proto.removeComponent = function removeComponent(obj) {
|
|
25203
|
+
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
25204
|
+
this.update.removeComponent(obj);
|
|
25205
|
+
}
|
|
25206
|
+
if (obj.onLateUpdate !== Component.prototype.onLateUpdate) {
|
|
25207
|
+
this.lateUpdate.removeComponent(obj);
|
|
25208
|
+
}
|
|
25209
|
+
};
|
|
25210
|
+
_proto.clear = function clear() {
|
|
25211
|
+
this.update.clear();
|
|
25212
|
+
this.lateUpdate.clear();
|
|
25213
|
+
};
|
|
25214
|
+
return SceneTicking;
|
|
25215
|
+
}();
|
|
25216
|
+
var TickData = /*#__PURE__*/ function() {
|
|
25217
|
+
function TickData() {
|
|
25218
|
+
this.components = [];
|
|
25219
|
+
this.ticks = [];
|
|
25220
|
+
}
|
|
25221
|
+
var _proto = TickData.prototype;
|
|
25222
|
+
_proto.tick = function tick(dt) {
|
|
25223
|
+
this.tickComponents(this.components, dt);
|
|
25224
|
+
for(var i = 0; i < this.ticks.length; i++){
|
|
25225
|
+
this.ticks[i](dt);
|
|
25226
|
+
}
|
|
25227
|
+
};
|
|
25228
|
+
_proto.tickComponents = function tickComponents(components, dt) {
|
|
25229
|
+
// To be implemented in derived classes
|
|
25230
|
+
};
|
|
25231
|
+
_proto.addComponent = function addComponent(component) {
|
|
25232
|
+
if (!this.components.includes(component)) {
|
|
25233
|
+
this.components.push(component);
|
|
25234
|
+
}
|
|
25235
|
+
};
|
|
25236
|
+
_proto.removeComponent = function removeComponent(component) {
|
|
25237
|
+
var index = this.components.indexOf(component);
|
|
25238
|
+
if (index > -1) {
|
|
25239
|
+
this.components.splice(index, 1);
|
|
25240
|
+
}
|
|
25241
|
+
};
|
|
25242
|
+
_proto.addTick = function addTick(method, callee) {
|
|
25243
|
+
var tick = method.bind(callee);
|
|
25244
|
+
if (!this.ticks.includes(tick)) {
|
|
25245
|
+
this.ticks.push(tick);
|
|
25246
|
+
}
|
|
25247
|
+
};
|
|
25248
|
+
_proto.clear = function clear() {
|
|
25249
|
+
this.components = [];
|
|
25250
|
+
};
|
|
25251
|
+
return TickData;
|
|
25252
|
+
}();
|
|
25253
|
+
var UpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
25254
|
+
_inherits(UpdateTickData, TickData);
|
|
25255
|
+
function UpdateTickData() {
|
|
25256
|
+
return TickData.apply(this, arguments);
|
|
25257
|
+
}
|
|
25258
|
+
var _proto = UpdateTickData.prototype;
|
|
25259
|
+
_proto.tickComponents = function tickComponents(components, dt) {
|
|
25260
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(components), _step; !(_step = _iterator()).done;){
|
|
25261
|
+
var component = _step.value;
|
|
25262
|
+
component.onUpdate(dt);
|
|
25263
|
+
}
|
|
25264
|
+
};
|
|
25265
|
+
return UpdateTickData;
|
|
25266
|
+
}(TickData);
|
|
25267
|
+
var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
25268
|
+
_inherits(LateUpdateTickData, TickData);
|
|
25269
|
+
function LateUpdateTickData() {
|
|
25270
|
+
return TickData.apply(this, arguments);
|
|
25271
|
+
}
|
|
25272
|
+
var _proto = LateUpdateTickData.prototype;
|
|
25273
|
+
_proto.tickComponents = function tickComponents(components, dt) {
|
|
25274
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(components), _step; !(_step = _iterator()).done;){
|
|
25275
|
+
var component = _step.value;
|
|
25276
|
+
component.onLateUpdate(dt);
|
|
25277
|
+
}
|
|
25278
|
+
};
|
|
25279
|
+
return LateUpdateTickData;
|
|
25280
|
+
} // function compareComponents (a: Component, b: Component): number {
|
|
25281
|
+
// const itemA = a.item;
|
|
25282
|
+
// const itemB = b.item;
|
|
25283
|
+
// if (VFXItem.isAncestor(itemA, itemB)) {
|
|
25284
|
+
// return -1;
|
|
25285
|
+
// } else {
|
|
25286
|
+
// return 1;
|
|
25287
|
+
// }
|
|
25288
|
+
// }
|
|
25289
|
+
(TickData);
|
|
25290
|
+
|
|
24856
25291
|
/**
|
|
24857
25292
|
* 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
|
|
24858
25293
|
* 合成中包含了相关的 Item 元素,支持对 Item 元素的创建、更新和销毁。
|
|
@@ -24862,6 +25297,7 @@ var listOrder = 0;
|
|
|
24862
25297
|
function Composition(props, scene) {
|
|
24863
25298
|
var _this;
|
|
24864
25299
|
_this = EventEmitter.call(this) || this;
|
|
25300
|
+
_this.sceneTicking = new SceneTicking();
|
|
24865
25301
|
/**
|
|
24866
25302
|
* 动画播放速度
|
|
24867
25303
|
*/ _this.speed = 1;
|
|
@@ -24899,9 +25335,12 @@ var listOrder = 0;
|
|
|
24899
25335
|
_this.rootItem = new VFXItem(_this.getEngine(), sourceContent);
|
|
24900
25336
|
_this.rootItem.name = "rootItem";
|
|
24901
25337
|
_this.rootItem.composition = _assert_this_initialized(_this);
|
|
24902
|
-
|
|
25338
|
+
// Spawn rootCompositionComponent
|
|
25339
|
+
_this.rootComposition = new CompositionComponent(_this.getEngine());
|
|
24903
25340
|
_this.rootComposition.startTime = sourceContent.startTime;
|
|
24904
25341
|
_this.rootComposition.data = sourceContent;
|
|
25342
|
+
_this.rootComposition.item = _this.rootItem;
|
|
25343
|
+
_this.rootItem.components.push(_this.rootComposition);
|
|
24905
25344
|
var imageUsage = !reusable && imgUsage;
|
|
24906
25345
|
_this.width = width;
|
|
24907
25346
|
_this.height = height;
|
|
@@ -24935,7 +25374,6 @@ var listOrder = 0;
|
|
|
24935
25374
|
_this.rendererOptions = null;
|
|
24936
25375
|
_this.rootComposition.createContent();
|
|
24937
25376
|
_this.buildItemTree(_this.rootItem);
|
|
24938
|
-
_this.callAwake(_this.rootItem);
|
|
24939
25377
|
_this.rootItem.onEnd = function() {
|
|
24940
25378
|
window.setTimeout(function() {
|
|
24941
25379
|
_this.emit("end", {
|
|
@@ -24947,6 +25385,16 @@ var listOrder = 0;
|
|
|
24947
25385
|
return _this;
|
|
24948
25386
|
}
|
|
24949
25387
|
var _proto = Composition.prototype;
|
|
25388
|
+
_proto.initializeSceneTicking = function initializeSceneTicking(item) {
|
|
25389
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
25390
|
+
var component = _step.value;
|
|
25391
|
+
this.sceneTicking.addComponent(component);
|
|
25392
|
+
}
|
|
25393
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.children), _step1; !(_step1 = _iterator1()).done;){
|
|
25394
|
+
var child = _step1.value;
|
|
25395
|
+
this.initializeSceneTicking(child);
|
|
25396
|
+
}
|
|
25397
|
+
};
|
|
24950
25398
|
/**
|
|
24951
25399
|
* 获取合成的时长
|
|
24952
25400
|
*/ _proto.getDuration = function getDuration() {
|
|
@@ -25050,7 +25498,7 @@ var listOrder = 0;
|
|
|
25050
25498
|
this.resume();
|
|
25051
25499
|
}
|
|
25052
25500
|
if (!this.rootComposition.isStartCalled) {
|
|
25053
|
-
this.rootComposition.
|
|
25501
|
+
this.rootComposition.onStart();
|
|
25054
25502
|
this.rootComposition.isStartCalled = true;
|
|
25055
25503
|
}
|
|
25056
25504
|
this.setSpeed(1);
|
|
@@ -25127,9 +25575,12 @@ var listOrder = 0;
|
|
|
25127
25575
|
// 更新 model-tree-plugin
|
|
25128
25576
|
this.updatePluginLoaders(deltaTime);
|
|
25129
25577
|
// scene VFXItem components lifetime function.
|
|
25130
|
-
|
|
25131
|
-
|
|
25132
|
-
|
|
25578
|
+
if (!this.rootItem.isDuringPlay) {
|
|
25579
|
+
this.callAwake(this.rootItem);
|
|
25580
|
+
this.rootItem.beginPlay();
|
|
25581
|
+
}
|
|
25582
|
+
this.sceneTicking.update.tick(time);
|
|
25583
|
+
this.sceneTicking.lateUpdate.tick(time);
|
|
25133
25584
|
this.updateCamera();
|
|
25134
25585
|
this.prepareRender();
|
|
25135
25586
|
if (this.shouldDispose()) {
|
|
@@ -25182,11 +25633,11 @@ var listOrder = 0;
|
|
|
25182
25633
|
return t;
|
|
25183
25634
|
};
|
|
25184
25635
|
_proto.callAwake = function callAwake(item) {
|
|
25185
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.
|
|
25186
|
-
var
|
|
25187
|
-
if (!
|
|
25188
|
-
|
|
25189
|
-
|
|
25636
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
25637
|
+
var component = _step.value;
|
|
25638
|
+
if (!component.isAwakeCalled) {
|
|
25639
|
+
component.onAwake();
|
|
25640
|
+
component.isAwakeCalled = true;
|
|
25190
25641
|
}
|
|
25191
25642
|
}
|
|
25192
25643
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.children), _step1; !(_step1 = _iterator1()).done;){
|
|
@@ -25194,72 +25645,6 @@ var listOrder = 0;
|
|
|
25194
25645
|
this.callAwake(child);
|
|
25195
25646
|
}
|
|
25196
25647
|
};
|
|
25197
|
-
_proto.callStart = function callStart(item) {
|
|
25198
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25199
|
-
var itemBehaviour = _step.value;
|
|
25200
|
-
if (itemBehaviour.isActiveAndEnabled && !itemBehaviour.isStartCalled) {
|
|
25201
|
-
itemBehaviour.start();
|
|
25202
|
-
itemBehaviour.isStartCalled = true;
|
|
25203
|
-
}
|
|
25204
|
-
}
|
|
25205
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25206
|
-
var rendererComponent = _step1.value;
|
|
25207
|
-
if (rendererComponent.isActiveAndEnabled && !rendererComponent.isStartCalled) {
|
|
25208
|
-
rendererComponent.start();
|
|
25209
|
-
rendererComponent.isStartCalled = true;
|
|
25210
|
-
}
|
|
25211
|
-
}
|
|
25212
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25213
|
-
var child = _step2.value;
|
|
25214
|
-
this.callStart(child);
|
|
25215
|
-
}
|
|
25216
|
-
};
|
|
25217
|
-
_proto.callUpdate = function callUpdate(item, dt) {
|
|
25218
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25219
|
-
var itemBehaviour = _step.value;
|
|
25220
|
-
if (itemBehaviour.isActiveAndEnabled && itemBehaviour.isStartCalled) {
|
|
25221
|
-
itemBehaviour.update(dt);
|
|
25222
|
-
}
|
|
25223
|
-
}
|
|
25224
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25225
|
-
var rendererComponent = _step1.value;
|
|
25226
|
-
if (rendererComponent.isActiveAndEnabled && rendererComponent.isStartCalled) {
|
|
25227
|
-
rendererComponent.update(dt);
|
|
25228
|
-
}
|
|
25229
|
-
}
|
|
25230
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25231
|
-
var child = _step2.value;
|
|
25232
|
-
if (VFXItem.isComposition(child)) {
|
|
25233
|
-
if (child.ended && child.endBehavior === EndBehavior.restart) {
|
|
25234
|
-
child.ended = false;
|
|
25235
|
-
// TODO K帧动画在元素重建后需要 tick ,否则会导致元素位置和 k 帧第一帧位置不一致
|
|
25236
|
-
this.callUpdate(child, 0);
|
|
25237
|
-
} else {
|
|
25238
|
-
this.callUpdate(child, dt);
|
|
25239
|
-
}
|
|
25240
|
-
} else {
|
|
25241
|
-
this.callUpdate(child, dt);
|
|
25242
|
-
}
|
|
25243
|
-
}
|
|
25244
|
-
};
|
|
25245
|
-
_proto.callLateUpdate = function callLateUpdate(item, dt) {
|
|
25246
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25247
|
-
var itemBehaviour = _step.value;
|
|
25248
|
-
if (itemBehaviour.isActiveAndEnabled && itemBehaviour.isStartCalled) {
|
|
25249
|
-
itemBehaviour.lateUpdate(dt);
|
|
25250
|
-
}
|
|
25251
|
-
}
|
|
25252
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25253
|
-
var rendererComponent = _step1.value;
|
|
25254
|
-
if (rendererComponent.isActiveAndEnabled && rendererComponent.isStartCalled) {
|
|
25255
|
-
rendererComponent.lateUpdate(dt);
|
|
25256
|
-
}
|
|
25257
|
-
}
|
|
25258
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25259
|
-
var child = _step2.value;
|
|
25260
|
-
this.callLateUpdate(child, dt);
|
|
25261
|
-
}
|
|
25262
|
-
};
|
|
25263
25648
|
/**
|
|
25264
25649
|
* 构建父子树,同时保存到 itemCacheMap 中便于查找
|
|
25265
25650
|
*/ _proto.buildItemTree = function buildItemTree(compVFXItem) {
|
|
@@ -27681,7 +28066,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
27681
28066
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
27682
28067
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
27683
28068
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
27684
|
-
var version = "2.0.
|
|
28069
|
+
var version = "2.1.0-alpha.1";
|
|
27685
28070
|
logger.info("Core version: " + version + ".");
|
|
27686
28071
|
|
|
27687
28072
|
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|