@galacean/effects-core 2.1.0-alpha.1 → 2.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/effect-component.d.ts +1 -0
- package/dist/index.js +286 -251
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +286 -251
- package/dist/index.mjs.map +1 -1
- package/dist/math/value-getter.d.ts +2 -0
- package/dist/plugins/cal/playable-graph.d.ts +0 -1
- package/dist/plugins/cal/timeline-asset.d.ts +2 -5
- package/dist/plugins/particle/burst.d.ts +2 -0
- package/dist/plugins/particle/particle-mesh.d.ts +8 -5
- package/dist/plugins/particle/particle-system.d.ts +2 -2
- package/dist/texture/texture.d.ts +2 -2
- package/dist/vfx-item.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.js
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.1.0-alpha.
|
|
6
|
+
* Version: v2.1.0-alpha.3
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -8352,7 +8352,7 @@ var seed$8 = 1;
|
|
|
8352
8352
|
* 通过 URL 创建 Texture 对象。
|
|
8353
8353
|
* @param url - 要创建的 Texture URL
|
|
8354
8354
|
* @since 2.0.0
|
|
8355
|
-
*/ Texture.fromImage = function fromImage(url, engine) {
|
|
8355
|
+
*/ Texture.fromImage = function fromImage(url, engine, options) {
|
|
8356
8356
|
return _async_to_generator(function() {
|
|
8357
8357
|
var image, texture;
|
|
8358
8358
|
return __generator(this, function(_state) {
|
|
@@ -8364,12 +8364,13 @@ var seed$8 = 1;
|
|
|
8364
8364
|
];
|
|
8365
8365
|
case 1:
|
|
8366
8366
|
image = _state.sent();
|
|
8367
|
-
texture = Texture.create(engine, {
|
|
8367
|
+
texture = Texture.create(engine, _extends({
|
|
8368
8368
|
sourceType: exports.TextureSourceType.image,
|
|
8369
8369
|
image: image,
|
|
8370
|
+
target: glContext.TEXTURE_2D,
|
|
8370
8371
|
id: generateGUID(),
|
|
8371
8372
|
flipY: true
|
|
8372
|
-
});
|
|
8373
|
+
}, options));
|
|
8373
8374
|
texture.initialize();
|
|
8374
8375
|
return [
|
|
8375
8376
|
2,
|
|
@@ -10301,15 +10302,19 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
10301
10302
|
points: points,
|
|
10302
10303
|
timeInterval: timeInterval,
|
|
10303
10304
|
valueInterval: valueInterval,
|
|
10304
|
-
curve: curve
|
|
10305
|
+
curve: curve,
|
|
10306
|
+
timeStart: Number(s.x),
|
|
10307
|
+
timeEnd: Number(e.x)
|
|
10305
10308
|
};
|
|
10306
10309
|
}
|
|
10307
10310
|
};
|
|
10308
10311
|
_proto.getValue = function getValue(time) {
|
|
10309
10312
|
var result = 0;
|
|
10310
10313
|
var keyTimeData = Object.keys(this.curveMap);
|
|
10311
|
-
var keyTimeStart =
|
|
10312
|
-
var keyTimeEnd =
|
|
10314
|
+
var keyTimeStart = this.curveMap[keyTimeData[0]].timeStart;
|
|
10315
|
+
var keyTimeEnd = this.curveMap[keyTimeData[keyTimeData.length - 1]].timeEnd;
|
|
10316
|
+
// const keyTimeStart = Number(keyTimeData[0].split('&')[0]);
|
|
10317
|
+
// const keyTimeEnd = Number(keyTimeData[keyTimeData.length - 1].split('&')[1]);
|
|
10313
10318
|
if (time <= keyTimeStart) {
|
|
10314
10319
|
return this.getCurveValue(keyTimeData[0], keyTimeStart);
|
|
10315
10320
|
}
|
|
@@ -10317,7 +10322,9 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
10317
10322
|
return this.getCurveValue(keyTimeData[keyTimeData.length - 1], keyTimeEnd);
|
|
10318
10323
|
}
|
|
10319
10324
|
for(var i = 0; i < keyTimeData.length; i++){
|
|
10320
|
-
var
|
|
10325
|
+
var xMin = this.curveMap[keyTimeData[i]].timeStart;
|
|
10326
|
+
var xMax = this.curveMap[keyTimeData[i]].timeEnd;
|
|
10327
|
+
// const [xMin, xMax] = keyTimeData[i].split('&');
|
|
10321
10328
|
if (time >= Number(xMin) && time < Number(xMax)) {
|
|
10322
10329
|
result = this.getCurveValue(keyTimeData[i], time);
|
|
10323
10330
|
break;
|
|
@@ -10330,12 +10337,13 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
10330
10337
|
var time = (t1 - t0) / ts;
|
|
10331
10338
|
var result = 0;
|
|
10332
10339
|
var keyTimeData = Object.keys(this.curveMap);
|
|
10333
|
-
var keyTimeStart =
|
|
10340
|
+
var keyTimeStart = this.curveMap[keyTimeData[0]].timeStart;
|
|
10334
10341
|
if (time <= keyTimeStart) {
|
|
10335
10342
|
return 0;
|
|
10336
10343
|
}
|
|
10337
10344
|
for(var i = 0; i < keyTimeData.length; i++){
|
|
10338
|
-
var
|
|
10345
|
+
var xMin = this.curveMap[keyTimeData[i]].timeStart;
|
|
10346
|
+
var xMax = this.curveMap[keyTimeData[i]].timeEnd;
|
|
10339
10347
|
if (time >= Number(xMax)) {
|
|
10340
10348
|
result += ts * this.getCurveIntegrateValue(keyTimeData[i], Number(xMax));
|
|
10341
10349
|
}
|
|
@@ -13597,25 +13605,25 @@ function _assert_this_initialized(self) {
|
|
|
13597
13605
|
}
|
|
13598
13606
|
var _proto = PlayableGraph.prototype;
|
|
13599
13607
|
_proto.evaluate = function evaluate(dt) {
|
|
13600
|
-
// 初始化节点状态
|
|
13601
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.playables), _step; !(_step = _iterator()).done;){
|
|
13602
|
-
var playable = _step.value;
|
|
13603
|
-
this.updatePlayableTime(playable, dt);
|
|
13604
|
-
}
|
|
13605
13608
|
// 初始化输出节点状态
|
|
13606
|
-
for(var
|
|
13607
|
-
var playableOutput =
|
|
13609
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.playableOutputs), _step; !(_step = _iterator()).done;){
|
|
13610
|
+
var playableOutput = _step.value;
|
|
13608
13611
|
playableOutput.context.deltaTime = dt;
|
|
13609
13612
|
}
|
|
13610
13613
|
// 执行生命周期函数
|
|
13611
|
-
for(var
|
|
13612
|
-
var playableOutput1 =
|
|
13614
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.playableOutputs), _step1; !(_step1 = _iterator1()).done;){
|
|
13615
|
+
var playableOutput1 = _step1.value;
|
|
13613
13616
|
this.prepareFrameWithRoot(playableOutput1);
|
|
13614
13617
|
}
|
|
13615
|
-
for(var
|
|
13616
|
-
var playableOutput2 =
|
|
13618
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(this.playableOutputs), _step2; !(_step2 = _iterator2()).done;){
|
|
13619
|
+
var playableOutput2 = _step2.value;
|
|
13617
13620
|
this.processFrameWithRoot(playableOutput2);
|
|
13618
13621
|
}
|
|
13622
|
+
// 更新节点时间
|
|
13623
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(this.playables), _step3; !(_step3 = _iterator3()).done;){
|
|
13624
|
+
var playable = _step3.value;
|
|
13625
|
+
this.updatePlayableTime(playable, dt);
|
|
13626
|
+
}
|
|
13619
13627
|
};
|
|
13620
13628
|
_proto.connect = function connect(source, sourceOutputPort, destination, destinationInputPort) {
|
|
13621
13629
|
destination.connectInput(destinationInputPort, source, sourceOutputPort);
|
|
@@ -13638,11 +13646,7 @@ function _assert_this_initialized(self) {
|
|
|
13638
13646
|
if (playable.getPlayState() !== 0) {
|
|
13639
13647
|
return;
|
|
13640
13648
|
}
|
|
13641
|
-
|
|
13642
|
-
playable.overrideTimeNextEvaluation = false;
|
|
13643
|
-
} else {
|
|
13644
|
-
playable.setTime(playable.getTime() + deltaTime);
|
|
13645
|
-
}
|
|
13649
|
+
playable.setTime(playable.getTime() + deltaTime);
|
|
13646
13650
|
};
|
|
13647
13651
|
return PlayableGraph;
|
|
13648
13652
|
}();
|
|
@@ -13654,7 +13658,6 @@ function _assert_this_initialized(self) {
|
|
|
13654
13658
|
if (inputCount === void 0) inputCount = 0;
|
|
13655
13659
|
this.onPlayablePlayFlag = true;
|
|
13656
13660
|
this.onPlayablePauseFlag = false;
|
|
13657
|
-
this.overrideTimeNextEvaluation = false;
|
|
13658
13661
|
this.destroyed = false;
|
|
13659
13662
|
this.inputs = [];
|
|
13660
13663
|
this.inputOuputPorts = [];
|
|
@@ -13743,7 +13746,6 @@ function _assert_this_initialized(self) {
|
|
|
13743
13746
|
};
|
|
13744
13747
|
_proto.setTime = function setTime(time) {
|
|
13745
13748
|
this.time = time;
|
|
13746
|
-
this.overrideTimeNextEvaluation = true;
|
|
13747
13749
|
};
|
|
13748
13750
|
_proto.getTime = function getTime() {
|
|
13749
13751
|
return this.time;
|
|
@@ -16546,8 +16548,9 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
|
|
|
16546
16548
|
};
|
|
16547
16549
|
_proto.onUpdate = function onUpdate(dt) {
|
|
16548
16550
|
var time = this.particleMesh.time;
|
|
16549
|
-
|
|
16550
|
-
this.particleMesh.
|
|
16551
|
+
var _this_particleMesh_mesh_material_getVector4;
|
|
16552
|
+
var uParams = (_this_particleMesh_mesh_material_getVector4 = this.particleMesh.mesh.material.getVector4("uParams")) != null ? _this_particleMesh_mesh_material_getVector4 : new Vector4();
|
|
16553
|
+
this.particleMesh.mesh.material.setVector4("uParams", uParams.set(time, this.item.duration, 0, 0));
|
|
16551
16554
|
};
|
|
16552
16555
|
_proto.render = function render(renderer) {
|
|
16553
16556
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
@@ -16562,7 +16565,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
|
|
|
16562
16565
|
};
|
|
16563
16566
|
_proto.updateTime = function updateTime(now, delta) {
|
|
16564
16567
|
this.particleMesh.time = now;
|
|
16565
|
-
|
|
16568
|
+
this.particleMesh.onUpdate(delta);
|
|
16566
16569
|
if (this.trailMesh) {
|
|
16567
16570
|
this.trailMesh.time = now;
|
|
16568
16571
|
this.trailMesh.onUpdate(delta);
|
|
@@ -16856,7 +16859,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16856
16859
|
break;
|
|
16857
16860
|
}
|
|
16858
16861
|
var burst = bursts[j];
|
|
16859
|
-
var opts = burst.getGeneratorOptions(timePassed, lifetime);
|
|
16862
|
+
var opts = !burst.disabled && burst.getGeneratorOptions(timePassed, lifetime);
|
|
16860
16863
|
if (opts) {
|
|
16861
16864
|
var originVec = [
|
|
16862
16865
|
0,
|
|
@@ -16865,6 +16868,9 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16865
16868
|
];
|
|
16866
16869
|
var offsets = emission.burstOffsets[j];
|
|
16867
16870
|
var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
|
|
16871
|
+
if (burst.once) {
|
|
16872
|
+
this.removeBurst(j);
|
|
16873
|
+
}
|
|
16868
16874
|
for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
|
|
16869
16875
|
var _p_transform;
|
|
16870
16876
|
if (shouldSkipGenerate()) {
|
|
@@ -17669,6 +17675,10 @@ var particleUniformTypeMap = {
|
|
|
17669
17675
|
var ParticleMesh = /*#__PURE__*/ function() {
|
|
17670
17676
|
function ParticleMesh(engine, props) {
|
|
17671
17677
|
this.particleCount = 0;
|
|
17678
|
+
this.cachedRotationVector3 = new Vector3();
|
|
17679
|
+
this.cachedRotationMatrix = new Matrix3();
|
|
17680
|
+
this.cachedLinearMove = new Vector3();
|
|
17681
|
+
this.tempMatrix3 = new Matrix3();
|
|
17672
17682
|
this.VERT_MAX_KEY_FRAME_COUNT = 0;
|
|
17673
17683
|
var _engine_renderer;
|
|
17674
17684
|
var env = ((_engine_renderer = engine.renderer) != null ? _engine_renderer : {}).env;
|
|
@@ -18064,69 +18074,10 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18064
18074
|
};
|
|
18065
18075
|
_proto.onUpdate = function onUpdate(dt) {
|
|
18066
18076
|
var aPosArray = this.geometry.getAttributeData("aPos"); // vector3
|
|
18067
|
-
var aVelArray = this.geometry.getAttributeData("aVel"); // vector3
|
|
18068
|
-
var aOffsetArray = this.geometry.getAttributeData("aOffset");
|
|
18069
|
-
var aRotArray = this.geometry.getAttributeData("aRot"); // vector3
|
|
18070
|
-
var aSeedArray = this.geometry.getAttributeData("aSeed"); // float
|
|
18071
|
-
// const uParams = this.mesh.material.getVector4('uParams');
|
|
18072
|
-
// if (!uParams) {
|
|
18073
|
-
// return;
|
|
18074
|
-
// }
|
|
18075
|
-
var localTime = new Float32Array([
|
|
18076
|
-
this.time
|
|
18077
|
-
])[0];
|
|
18078
18077
|
var particleCount = Math.ceil(aPosArray.length / 12);
|
|
18079
|
-
|
|
18080
|
-
|
|
18081
|
-
|
|
18082
|
-
aTranslationArray = new Float32Array(particleCount * 3);
|
|
18083
|
-
}
|
|
18084
|
-
var velocity = new Vector3(0, 0, 0);
|
|
18085
|
-
for(var i = 0; i < particleCount; i++){
|
|
18086
|
-
var velOffset = i * 12 + 3;
|
|
18087
|
-
velocity.set(aVelArray[velOffset], aVelArray[velOffset + 1], aVelArray[velOffset + 2]);
|
|
18088
|
-
var trans = this.calculateTranslation(velocity, aOffsetArray[i * 4 + 2], localTime, aOffsetArray[i * 4 + 3]);
|
|
18089
|
-
var aTranslationOffset = i * 3;
|
|
18090
|
-
aTranslationArray[aTranslationOffset] = trans.x;
|
|
18091
|
-
aTranslationArray[aTranslationOffset + 1] = trans.y;
|
|
18092
|
-
aTranslationArray[aTranslationOffset + 2] = trans.z;
|
|
18093
|
-
}
|
|
18094
|
-
this.geometry.setAttributeData("aTranslation", aTranslationArray);
|
|
18095
|
-
// calculate particle rotation
|
|
18096
|
-
var aRotationArray = this.geometry.getAttributeData("aRotation0");
|
|
18097
|
-
if (aRotationArray.length < particleCount * 9) {
|
|
18098
|
-
aRotationArray = new Float32Array(particleCount * 9);
|
|
18099
|
-
}
|
|
18100
|
-
for(var i1 = 0; i1 < particleCount; i1++){
|
|
18101
|
-
var time = localTime - aOffsetArray[i1 * 4 + 2];
|
|
18102
|
-
var duration = aOffsetArray[i1 * 4 + 3];
|
|
18103
|
-
var life = clamp$1(time / duration, 0.0, 1.0);
|
|
18104
|
-
var aRotOffset = i1 * 8;
|
|
18105
|
-
var aRot = new Vector3(aRotArray[aRotOffset], aRotArray[aRotOffset + 1], aRotArray[aRotOffset + 2]);
|
|
18106
|
-
var aSeed = aSeedArray[i1 * 8 + 3];
|
|
18107
|
-
var aRotation = this.transformFromRotation(aRot, life, duration, aSeed);
|
|
18108
|
-
var aRotationOffset = i1 * 9;
|
|
18109
|
-
var matrixArray = aRotation.toArray();
|
|
18110
|
-
aRotationArray.set(matrixArray, aRotationOffset);
|
|
18111
|
-
}
|
|
18112
|
-
this.geometry.setAttributeData("aRotation0", aRotationArray);
|
|
18113
|
-
// calculate linear movement
|
|
18114
|
-
var aLinearMoveArray = this.geometry.getAttributeData("aLinearMove");
|
|
18115
|
-
if (aLinearMoveArray.length < particleCount * 3) {
|
|
18116
|
-
aLinearMoveArray = new Float32Array(particleCount * 3);
|
|
18117
|
-
}
|
|
18118
|
-
for(var i2 = 0; i2 < particleCount; i2++){
|
|
18119
|
-
var time1 = localTime - aOffsetArray[i2 * 4 + 2];
|
|
18120
|
-
var duration1 = aOffsetArray[i2 * 4 + 3];
|
|
18121
|
-
// const life = math.clamp(time / duration, 0.0, 1.0);
|
|
18122
|
-
var aSeed1 = aSeedArray[i2 * 8 + 3];
|
|
18123
|
-
var linearMove = this.calLinearMov(time1, duration1, aSeed1);
|
|
18124
|
-
var aLinearMoveOffset = i2 * 3;
|
|
18125
|
-
aLinearMoveArray[aLinearMoveOffset] = linearMove.x;
|
|
18126
|
-
aLinearMoveArray[aLinearMoveOffset + 1] = linearMove.y;
|
|
18127
|
-
aLinearMoveArray[aLinearMoveOffset + 2] = linearMove.z;
|
|
18128
|
-
}
|
|
18129
|
-
this.geometry.setAttributeData("aLinearMove", aLinearMoveArray);
|
|
18078
|
+
this.applyTranslation(particleCount, dt);
|
|
18079
|
+
this.applyRotation(particleCount, dt);
|
|
18080
|
+
this.applyLinearMove(particleCount, dt);
|
|
18130
18081
|
};
|
|
18131
18082
|
_proto.minusTime = function minusTime(time) {
|
|
18132
18083
|
var aOffset = this.geometry.getAttributeData("aOffset");
|
|
@@ -18136,158 +18087,6 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18136
18087
|
this.geometry.setAttributeData("aOffset", aOffset);
|
|
18137
18088
|
this.time -= time;
|
|
18138
18089
|
};
|
|
18139
|
-
_proto.calculateTranslation = function calculateTranslation(velocity, t0, t1, duration) {
|
|
18140
|
-
var uAcceleration = this.mesh.material.getVector4("uAcceleration");
|
|
18141
|
-
var uGravityModifierValue = this.mesh.material.getVector4("uGravityModifierValue");
|
|
18142
|
-
if (!uAcceleration || !uGravityModifierValue) {
|
|
18143
|
-
return new Vector3();
|
|
18144
|
-
}
|
|
18145
|
-
var dt = t1 - t0; // 相对delay的时间
|
|
18146
|
-
var d = this.gravityModifier.getIntegrateByTime(0, dt);
|
|
18147
|
-
var acc = [
|
|
18148
|
-
uAcceleration.x * d,
|
|
18149
|
-
uAcceleration.y * d,
|
|
18150
|
-
uAcceleration.z * d
|
|
18151
|
-
];
|
|
18152
|
-
// ret.addScaledVector(velData, speedIntegrate);
|
|
18153
|
-
// ret.addScaledVector(acc, d);
|
|
18154
|
-
// speedIntegrate = speedOverLifetime.getIntegrateValue(0, time, duration);
|
|
18155
|
-
if (this.speedOverLifetime) {
|
|
18156
|
-
// dt / dur 归一化
|
|
18157
|
-
var speed = this.speedOverLifetime.getIntegrateValue(0, dt, duration);
|
|
18158
|
-
return velocity.clone().multiply(speed).add(acc);
|
|
18159
|
-
}
|
|
18160
|
-
return velocity.clone().multiply(dt).add(acc);
|
|
18161
|
-
};
|
|
18162
|
-
_proto.transformFromRotation = function transformFromRotation(rot, life, dur, aSeed) {
|
|
18163
|
-
var rotation = rot.clone();
|
|
18164
|
-
if (!this.rotationOverLifetime) {
|
|
18165
|
-
return new Matrix3();
|
|
18166
|
-
}
|
|
18167
|
-
if (this.rotationOverLifetime.asRotation) {
|
|
18168
|
-
// Adjust rotation based on the specified lifetime components
|
|
18169
|
-
if (this.rotationOverLifetime.x) {
|
|
18170
|
-
if (_instanceof1(this.rotationOverLifetime.x, RandomValue)) {
|
|
18171
|
-
rotation.x += this.rotationOverLifetime.x.getValue(life, aSeed);
|
|
18172
|
-
} else {
|
|
18173
|
-
rotation.x += this.rotationOverLifetime.x.getValue(life);
|
|
18174
|
-
}
|
|
18175
|
-
}
|
|
18176
|
-
if (this.rotationOverLifetime.y) {
|
|
18177
|
-
if (_instanceof1(this.rotationOverLifetime.y, RandomValue)) {
|
|
18178
|
-
rotation.y += this.rotationOverLifetime.y.getValue(life, aSeed);
|
|
18179
|
-
} else {
|
|
18180
|
-
rotation.y += this.rotationOverLifetime.y.getValue(life);
|
|
18181
|
-
}
|
|
18182
|
-
}
|
|
18183
|
-
if (this.rotationOverLifetime.z) {
|
|
18184
|
-
if (_instanceof1(this.rotationOverLifetime.z, RandomValue)) {
|
|
18185
|
-
rotation.z += this.rotationOverLifetime.z.getValue(life, aSeed);
|
|
18186
|
-
} else {
|
|
18187
|
-
rotation.z += this.rotationOverLifetime.z.getValue(life);
|
|
18188
|
-
}
|
|
18189
|
-
}
|
|
18190
|
-
} else {
|
|
18191
|
-
// Adjust rotation based on the specified lifetime components
|
|
18192
|
-
if (this.rotationOverLifetime.x) {
|
|
18193
|
-
if (_instanceof1(this.rotationOverLifetime.x, RandomValue)) {
|
|
18194
|
-
rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, aSeed) * dur;
|
|
18195
|
-
} else {
|
|
18196
|
-
rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, dur) * dur;
|
|
18197
|
-
}
|
|
18198
|
-
}
|
|
18199
|
-
if (this.rotationOverLifetime.y) {
|
|
18200
|
-
if (_instanceof1(this.rotationOverLifetime.y, RandomValue)) {
|
|
18201
|
-
rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, aSeed) * dur;
|
|
18202
|
-
} else {
|
|
18203
|
-
rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, dur) * dur;
|
|
18204
|
-
}
|
|
18205
|
-
}
|
|
18206
|
-
if (this.rotationOverLifetime.z) {
|
|
18207
|
-
if (_instanceof1(this.rotationOverLifetime.z, RandomValue)) {
|
|
18208
|
-
rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, aSeed) * dur;
|
|
18209
|
-
} else {
|
|
18210
|
-
rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, dur) * dur;
|
|
18211
|
-
}
|
|
18212
|
-
}
|
|
18213
|
-
}
|
|
18214
|
-
// If the rotation vector is zero, return the identity matrix
|
|
18215
|
-
if (rotation.dot(rotation) === 0.0) {
|
|
18216
|
-
return new Matrix3().identity();
|
|
18217
|
-
}
|
|
18218
|
-
// Return the rotation matrix derived from the rotation vector
|
|
18219
|
-
return this.mat3FromRotation(rotation);
|
|
18220
|
-
};
|
|
18221
|
-
_proto.mat3FromRotation = function mat3FromRotation(rotation) {
|
|
18222
|
-
var d2r = Math.PI / 180;
|
|
18223
|
-
var sinR = rotation.clone().multiply(d2r);
|
|
18224
|
-
sinR.x = Math.sin(sinR.x);
|
|
18225
|
-
sinR.y = Math.sin(sinR.y);
|
|
18226
|
-
sinR.z = Math.sin(sinR.z);
|
|
18227
|
-
var cosR = rotation.clone().multiply(d2r);
|
|
18228
|
-
cosR.x = Math.cos(cosR.x);
|
|
18229
|
-
cosR.y = Math.cos(cosR.y);
|
|
18230
|
-
cosR.z = Math.cos(cosR.z);
|
|
18231
|
-
var rotZ = new Matrix3(cosR.z, -sinR.z, 0., sinR.z, cosR.z, 0., 0., 0., 1.);
|
|
18232
|
-
var rotY = new Matrix3(cosR.y, 0., sinR.y, 0., 1., 0., -sinR.y, 0, cosR.y);
|
|
18233
|
-
var rotX = new Matrix3(1., 0., 0., 0, cosR.x, -sinR.x, 0., sinR.x, cosR.x);
|
|
18234
|
-
var result = rotZ.multiply(rotY).multiply(rotX);
|
|
18235
|
-
return result;
|
|
18236
|
-
};
|
|
18237
|
-
_proto.calLinearMov = function calLinearMov(time, duration, aSeed) {
|
|
18238
|
-
var mov = new Vector3();
|
|
18239
|
-
var lifetime = time / duration;
|
|
18240
|
-
if (!this.linearVelOverLifetime || !this.linearVelOverLifetime.enabled) {
|
|
18241
|
-
return new Vector3();
|
|
18242
|
-
}
|
|
18243
|
-
if (this.linearVelOverLifetime.asMovement) {
|
|
18244
|
-
if (this.linearVelOverLifetime.x) {
|
|
18245
|
-
if (_instanceof1(this.linearVelOverLifetime.x, RandomValue)) {
|
|
18246
|
-
mov.x = this.linearVelOverLifetime.x.getValue(lifetime, aSeed);
|
|
18247
|
-
} else {
|
|
18248
|
-
mov.x = this.linearVelOverLifetime.x.getValue(lifetime);
|
|
18249
|
-
}
|
|
18250
|
-
}
|
|
18251
|
-
if (this.linearVelOverLifetime.y) {
|
|
18252
|
-
if (_instanceof1(this.linearVelOverLifetime.y, RandomValue)) {
|
|
18253
|
-
mov.y = this.linearVelOverLifetime.y.getValue(lifetime, aSeed);
|
|
18254
|
-
} else {
|
|
18255
|
-
mov.y = this.linearVelOverLifetime.y.getValue(lifetime);
|
|
18256
|
-
}
|
|
18257
|
-
}
|
|
18258
|
-
if (this.linearVelOverLifetime.z) {
|
|
18259
|
-
if (_instanceof1(this.linearVelOverLifetime.z, RandomValue)) {
|
|
18260
|
-
mov.z = this.linearVelOverLifetime.z.getValue(lifetime, aSeed);
|
|
18261
|
-
} else {
|
|
18262
|
-
mov.z = this.linearVelOverLifetime.z.getValue(lifetime);
|
|
18263
|
-
}
|
|
18264
|
-
}
|
|
18265
|
-
} else {
|
|
18266
|
-
// Adjust rotation based on the specified lifetime components
|
|
18267
|
-
if (this.linearVelOverLifetime.x) {
|
|
18268
|
-
if (_instanceof1(this.linearVelOverLifetime.x, RandomValue)) {
|
|
18269
|
-
mov.x = this.linearVelOverLifetime.x.getIntegrateValue(0.0, time, aSeed);
|
|
18270
|
-
} else {
|
|
18271
|
-
mov.x = this.linearVelOverLifetime.x.getIntegrateValue(0.0, time, duration);
|
|
18272
|
-
}
|
|
18273
|
-
}
|
|
18274
|
-
if (this.linearVelOverLifetime.y) {
|
|
18275
|
-
if (_instanceof1(this.linearVelOverLifetime.y, RandomValue)) {
|
|
18276
|
-
mov.y = this.linearVelOverLifetime.y.getIntegrateValue(0.0, time, aSeed);
|
|
18277
|
-
} else {
|
|
18278
|
-
mov.y = this.linearVelOverLifetime.y.getIntegrateValue(0.0, time, duration);
|
|
18279
|
-
}
|
|
18280
|
-
}
|
|
18281
|
-
if (this.linearVelOverLifetime.z) {
|
|
18282
|
-
if (_instanceof1(this.linearVelOverLifetime.z, RandomValue)) {
|
|
18283
|
-
mov.z = this.linearVelOverLifetime.z.getIntegrateValue(0.0, time, aSeed);
|
|
18284
|
-
} else {
|
|
18285
|
-
mov.z = this.linearVelOverLifetime.z.getIntegrateValue(0.0, time, duration);
|
|
18286
|
-
}
|
|
18287
|
-
}
|
|
18288
|
-
}
|
|
18289
|
-
return mov;
|
|
18290
|
-
};
|
|
18291
18090
|
_proto.removePoint = function removePoint(index) {
|
|
18292
18091
|
if (index < this.particleCount) {
|
|
18293
18092
|
this.geometry.setAttributeSubData("aOffset", index * 16, new Float32Array(16));
|
|
@@ -18311,7 +18110,8 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18311
18110
|
var pointData = {
|
|
18312
18111
|
aPos: new Float32Array(48),
|
|
18313
18112
|
aRot: new Float32Array(32),
|
|
18314
|
-
aOffset: new Float32Array(16)
|
|
18113
|
+
aOffset: new Float32Array(16),
|
|
18114
|
+
aTranslation: new Float32Array(12)
|
|
18315
18115
|
};
|
|
18316
18116
|
var useSprite = this.useSprite;
|
|
18317
18117
|
if (useSprite) {
|
|
@@ -18420,6 +18220,226 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18420
18220
|
geometry.setDrawCount(this.particleCount * 6);
|
|
18421
18221
|
}
|
|
18422
18222
|
};
|
|
18223
|
+
_proto.applyTranslation = function applyTranslation(particleCount, deltaTime) {
|
|
18224
|
+
var localTime = this.time;
|
|
18225
|
+
var aTranslationArray = this.geometry.getAttributeData("aTranslation");
|
|
18226
|
+
var aVelArray = this.geometry.getAttributeData("aVel"); // vector3
|
|
18227
|
+
var aOffsetArray = this.geometry.getAttributeData("aOffset");
|
|
18228
|
+
if (aTranslationArray.length < particleCount * 3) {
|
|
18229
|
+
aTranslationArray = this.expandArray(aTranslationArray, particleCount * 3);
|
|
18230
|
+
}
|
|
18231
|
+
// const velocity = this.cachedVelocity;
|
|
18232
|
+
var velocityX = 0;
|
|
18233
|
+
var velocityY = 0;
|
|
18234
|
+
var velocityZ = 0;
|
|
18235
|
+
var uAcceleration = this.mesh.material.getVector4("uAcceleration");
|
|
18236
|
+
var uGravityModifierValue = this.mesh.material.getVector4("uGravityModifierValue");
|
|
18237
|
+
for(var i = 0; i < particleCount; i++){
|
|
18238
|
+
var velOffset = i * 12 + 3;
|
|
18239
|
+
velocityX = aVelArray[velOffset];
|
|
18240
|
+
velocityY = aVelArray[velOffset + 1];
|
|
18241
|
+
velocityZ = aVelArray[velOffset + 2];
|
|
18242
|
+
// velocity.set(aVelArray[velOffset], aVelArray[velOffset + 1], aVelArray[velOffset + 2]);
|
|
18243
|
+
var dt = localTime - aOffsetArray[i * 4 + 2]; // 相对delay的时间
|
|
18244
|
+
var duration = aOffsetArray[i * 4 + 3];
|
|
18245
|
+
if (uAcceleration && uGravityModifierValue) {
|
|
18246
|
+
var d = this.gravityModifier.getIntegrateValue(0, dt, duration);
|
|
18247
|
+
// const acc = this.tempVector3.set(uAcceleration.x * d, uAcceleration.y * d, uAcceleration.z * d);
|
|
18248
|
+
var accX = uAcceleration.x * d;
|
|
18249
|
+
var accY = uAcceleration.y * d;
|
|
18250
|
+
var accZ = uAcceleration.z * d;
|
|
18251
|
+
// speedIntegrate = speedOverLifetime.getIntegrateValue(0, time, duration);
|
|
18252
|
+
if (this.speedOverLifetime) {
|
|
18253
|
+
// dt / dur 归一化
|
|
18254
|
+
var speed = this.speedOverLifetime.getValue(dt / duration);
|
|
18255
|
+
velocityX = velocityX * speed + accX;
|
|
18256
|
+
velocityY = velocityY * speed + accY;
|
|
18257
|
+
velocityZ = velocityZ * speed + accZ;
|
|
18258
|
+
// velocity.multiply(speed).add(acc);
|
|
18259
|
+
} else {
|
|
18260
|
+
velocityX = velocityX + accX;
|
|
18261
|
+
velocityY = velocityY + accY;
|
|
18262
|
+
velocityZ = velocityZ + accZ;
|
|
18263
|
+
// velocity.add(acc);
|
|
18264
|
+
}
|
|
18265
|
+
}
|
|
18266
|
+
var aTranslationOffset = i * 3;
|
|
18267
|
+
if (aOffsetArray[i * 4 + 2] < localTime) {
|
|
18268
|
+
// const translation = velocity.multiply(deltaTime / 1000);
|
|
18269
|
+
aTranslationArray[aTranslationOffset] += velocityX * (deltaTime / 1000);
|
|
18270
|
+
aTranslationArray[aTranslationOffset + 1] += velocityY * (deltaTime / 1000);
|
|
18271
|
+
aTranslationArray[aTranslationOffset + 2] += velocityZ * (deltaTime / 1000);
|
|
18272
|
+
}
|
|
18273
|
+
}
|
|
18274
|
+
this.geometry.setAttributeData("aTranslation", aTranslationArray);
|
|
18275
|
+
};
|
|
18276
|
+
_proto.applyRotation = function applyRotation(particleCount, deltaTime) {
|
|
18277
|
+
var aRotationArray = this.geometry.getAttributeData("aRotation0");
|
|
18278
|
+
var aOffsetArray = this.geometry.getAttributeData("aOffset");
|
|
18279
|
+
var aRotArray = this.geometry.getAttributeData("aRot"); // vector3
|
|
18280
|
+
var aSeedArray = this.geometry.getAttributeData("aSeed"); // float
|
|
18281
|
+
var localTime = this.time;
|
|
18282
|
+
var aRotationMatrix = this.cachedRotationMatrix;
|
|
18283
|
+
if (aRotationArray.length < particleCount * 9) {
|
|
18284
|
+
aRotationArray = this.expandArray(aRotationArray, particleCount * 9);
|
|
18285
|
+
}
|
|
18286
|
+
for(var i = 0; i < particleCount; i++){
|
|
18287
|
+
var time = localTime - aOffsetArray[i * 4 + 2];
|
|
18288
|
+
var duration = aOffsetArray[i * 4 + 3];
|
|
18289
|
+
var life = clamp$1(time / duration, 0.0, 1.0);
|
|
18290
|
+
var aRotOffset = i * 8;
|
|
18291
|
+
var aRot = this.cachedRotationVector3.set(aRotArray[aRotOffset], aRotArray[aRotOffset + 1], aRotArray[aRotOffset + 2]);
|
|
18292
|
+
var aSeed = aSeedArray[i * 8 + 3];
|
|
18293
|
+
var rotation = aRot;
|
|
18294
|
+
if (!this.rotationOverLifetime) {
|
|
18295
|
+
aRotationMatrix.setZero();
|
|
18296
|
+
} else if (this.rotationOverLifetime.asRotation) {
|
|
18297
|
+
// Adjust rotation based on the specified lifetime components
|
|
18298
|
+
if (this.rotationOverLifetime.x) {
|
|
18299
|
+
if (_instanceof1(this.rotationOverLifetime.x, RandomValue)) {
|
|
18300
|
+
rotation.x += this.rotationOverLifetime.x.getValue(life, aSeed);
|
|
18301
|
+
} else {
|
|
18302
|
+
rotation.x += this.rotationOverLifetime.x.getValue(life);
|
|
18303
|
+
}
|
|
18304
|
+
}
|
|
18305
|
+
if (this.rotationOverLifetime.y) {
|
|
18306
|
+
if (_instanceof1(this.rotationOverLifetime.y, RandomValue)) {
|
|
18307
|
+
rotation.y += this.rotationOverLifetime.y.getValue(life, aSeed);
|
|
18308
|
+
} else {
|
|
18309
|
+
rotation.y += this.rotationOverLifetime.y.getValue(life);
|
|
18310
|
+
}
|
|
18311
|
+
}
|
|
18312
|
+
if (this.rotationOverLifetime.z) {
|
|
18313
|
+
if (_instanceof1(this.rotationOverLifetime.z, RandomValue)) {
|
|
18314
|
+
rotation.z += this.rotationOverLifetime.z.getValue(life, aSeed);
|
|
18315
|
+
} else {
|
|
18316
|
+
rotation.z += this.rotationOverLifetime.z.getValue(life);
|
|
18317
|
+
}
|
|
18318
|
+
}
|
|
18319
|
+
} else {
|
|
18320
|
+
// Adjust rotation based on the specified lifetime components
|
|
18321
|
+
if (this.rotationOverLifetime.x) {
|
|
18322
|
+
if (_instanceof1(this.rotationOverLifetime.x, RandomValue)) {
|
|
18323
|
+
rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, aSeed) * duration;
|
|
18324
|
+
} else {
|
|
18325
|
+
rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, duration) * duration;
|
|
18326
|
+
}
|
|
18327
|
+
}
|
|
18328
|
+
if (this.rotationOverLifetime.y) {
|
|
18329
|
+
if (_instanceof1(this.rotationOverLifetime.y, RandomValue)) {
|
|
18330
|
+
rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, aSeed) * duration;
|
|
18331
|
+
} else {
|
|
18332
|
+
rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, duration) * duration;
|
|
18333
|
+
}
|
|
18334
|
+
}
|
|
18335
|
+
if (this.rotationOverLifetime.z) {
|
|
18336
|
+
if (_instanceof1(this.rotationOverLifetime.z, RandomValue)) {
|
|
18337
|
+
rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, aSeed) * duration;
|
|
18338
|
+
} else {
|
|
18339
|
+
rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, duration) * duration;
|
|
18340
|
+
}
|
|
18341
|
+
}
|
|
18342
|
+
}
|
|
18343
|
+
// If the rotation vector is zero, return the identity matrix
|
|
18344
|
+
if (rotation.dot(rotation) === 0.0) {
|
|
18345
|
+
aRotationMatrix.identity();
|
|
18346
|
+
}
|
|
18347
|
+
var d2r = Math.PI / 180;
|
|
18348
|
+
var rotationXD2r = rotation.x * d2r;
|
|
18349
|
+
var rotationYD2r = rotation.y * d2r;
|
|
18350
|
+
var rotationZD2r = rotation.z * d2r;
|
|
18351
|
+
var sinRX = Math.sin(rotationXD2r);
|
|
18352
|
+
var sinRY = Math.sin(rotationYD2r);
|
|
18353
|
+
var sinRZ = Math.sin(rotationZD2r);
|
|
18354
|
+
var cosRX = Math.cos(rotationXD2r);
|
|
18355
|
+
var cosRY = Math.cos(rotationYD2r);
|
|
18356
|
+
var cosRZ = Math.cos(rotationZD2r);
|
|
18357
|
+
// rotZ * rotY * rotX
|
|
18358
|
+
aRotationMatrix.set(cosRZ, -sinRZ, 0., sinRZ, cosRZ, 0., 0., 0., 1.); //rotZ
|
|
18359
|
+
aRotationMatrix.multiply(this.tempMatrix3.set(cosRY, 0., sinRY, 0., 1., 0., -sinRY, 0, cosRY)); //rotY
|
|
18360
|
+
aRotationMatrix.multiply(this.tempMatrix3.set(1., 0., 0., 0, cosRX, -sinRX, 0., sinRX, cosRX)); //rotX
|
|
18361
|
+
var aRotationOffset = i * 9;
|
|
18362
|
+
var matrixArray = aRotationMatrix.elements;
|
|
18363
|
+
aRotationArray.set(matrixArray, aRotationOffset);
|
|
18364
|
+
}
|
|
18365
|
+
this.geometry.setAttributeData("aRotation0", aRotationArray);
|
|
18366
|
+
};
|
|
18367
|
+
_proto.applyLinearMove = function applyLinearMove(particleCount, deltaTime) {
|
|
18368
|
+
var aLinearMoveArray = this.geometry.getAttributeData("aLinearMove");
|
|
18369
|
+
var aOffsetArray = this.geometry.getAttributeData("aOffset");
|
|
18370
|
+
var aSeedArray = this.geometry.getAttributeData("aSeed"); // float
|
|
18371
|
+
var localTime = this.time;
|
|
18372
|
+
if (aLinearMoveArray.length < particleCount * 3) {
|
|
18373
|
+
aLinearMoveArray = this.expandArray(aLinearMoveArray, particleCount * 3);
|
|
18374
|
+
}
|
|
18375
|
+
var linearMove = this.cachedLinearMove;
|
|
18376
|
+
if (this.linearVelOverLifetime && this.linearVelOverLifetime.enabled) {
|
|
18377
|
+
for(var i = 0; i < particleCount; i++){
|
|
18378
|
+
var time = localTime - aOffsetArray[i * 4 + 2];
|
|
18379
|
+
var duration = aOffsetArray[i * 4 + 3];
|
|
18380
|
+
// const life = math.clamp(time / duration, 0.0, 1.0);
|
|
18381
|
+
var lifetime = time / duration;
|
|
18382
|
+
var aSeed = aSeedArray[i * 8 + 3];
|
|
18383
|
+
linearMove.setZero();
|
|
18384
|
+
if (this.linearVelOverLifetime.asMovement) {
|
|
18385
|
+
if (this.linearVelOverLifetime.x) {
|
|
18386
|
+
if (_instanceof1(this.linearVelOverLifetime.x, RandomValue)) {
|
|
18387
|
+
linearMove.x = this.linearVelOverLifetime.x.getValue(lifetime, aSeed);
|
|
18388
|
+
} else {
|
|
18389
|
+
linearMove.x = this.linearVelOverLifetime.x.getValue(lifetime);
|
|
18390
|
+
}
|
|
18391
|
+
}
|
|
18392
|
+
if (this.linearVelOverLifetime.y) {
|
|
18393
|
+
if (_instanceof1(this.linearVelOverLifetime.y, RandomValue)) {
|
|
18394
|
+
linearMove.y = this.linearVelOverLifetime.y.getValue(lifetime, aSeed);
|
|
18395
|
+
} else {
|
|
18396
|
+
linearMove.y = this.linearVelOverLifetime.y.getValue(lifetime);
|
|
18397
|
+
}
|
|
18398
|
+
}
|
|
18399
|
+
if (this.linearVelOverLifetime.z) {
|
|
18400
|
+
if (_instanceof1(this.linearVelOverLifetime.z, RandomValue)) {
|
|
18401
|
+
linearMove.z = this.linearVelOverLifetime.z.getValue(lifetime, aSeed);
|
|
18402
|
+
} else {
|
|
18403
|
+
linearMove.z = this.linearVelOverLifetime.z.getValue(lifetime);
|
|
18404
|
+
}
|
|
18405
|
+
}
|
|
18406
|
+
} else {
|
|
18407
|
+
// Adjust rotation based on the specified lifetime components
|
|
18408
|
+
if (this.linearVelOverLifetime.x) {
|
|
18409
|
+
if (_instanceof1(this.linearVelOverLifetime.x, RandomValue)) {
|
|
18410
|
+
linearMove.x = this.linearVelOverLifetime.x.getIntegrateValue(0.0, time, aSeed);
|
|
18411
|
+
} else {
|
|
18412
|
+
linearMove.x = this.linearVelOverLifetime.x.getIntegrateValue(0.0, time, duration);
|
|
18413
|
+
}
|
|
18414
|
+
}
|
|
18415
|
+
if (this.linearVelOverLifetime.y) {
|
|
18416
|
+
if (_instanceof1(this.linearVelOverLifetime.y, RandomValue)) {
|
|
18417
|
+
linearMove.y = this.linearVelOverLifetime.y.getIntegrateValue(0.0, time, aSeed);
|
|
18418
|
+
} else {
|
|
18419
|
+
linearMove.y = this.linearVelOverLifetime.y.getIntegrateValue(0.0, time, duration);
|
|
18420
|
+
}
|
|
18421
|
+
}
|
|
18422
|
+
if (this.linearVelOverLifetime.z) {
|
|
18423
|
+
if (_instanceof1(this.linearVelOverLifetime.z, RandomValue)) {
|
|
18424
|
+
linearMove.z = this.linearVelOverLifetime.z.getIntegrateValue(0.0, time, aSeed);
|
|
18425
|
+
} else {
|
|
18426
|
+
linearMove.z = this.linearVelOverLifetime.z.getIntegrateValue(0.0, time, duration);
|
|
18427
|
+
}
|
|
18428
|
+
}
|
|
18429
|
+
}
|
|
18430
|
+
var aLinearMoveOffset = i * 3;
|
|
18431
|
+
aLinearMoveArray[aLinearMoveOffset] = linearMove.x;
|
|
18432
|
+
aLinearMoveArray[aLinearMoveOffset + 1] = linearMove.y;
|
|
18433
|
+
aLinearMoveArray[aLinearMoveOffset + 2] = linearMove.z;
|
|
18434
|
+
}
|
|
18435
|
+
}
|
|
18436
|
+
this.geometry.setAttributeData("aLinearMove", aLinearMoveArray);
|
|
18437
|
+
};
|
|
18438
|
+
_proto.expandArray = function expandArray(array, newSize) {
|
|
18439
|
+
var newArr = new Float32Array(newSize);
|
|
18440
|
+
newArr.set(array);
|
|
18441
|
+
return newArr;
|
|
18442
|
+
};
|
|
18423
18443
|
return ParticleMesh;
|
|
18424
18444
|
}();
|
|
18425
18445
|
var gl2UniformSlots = [
|
|
@@ -19051,7 +19071,13 @@ exports.TransformPlayableAsset = __decorate([
|
|
|
19051
19071
|
return Playable.apply(this, arguments);
|
|
19052
19072
|
}
|
|
19053
19073
|
var _proto = ActivationPlayable.prototype;
|
|
19054
|
-
_proto.processFrame = function processFrame(context) {
|
|
19074
|
+
_proto.processFrame = function processFrame(context) {
|
|
19075
|
+
var vfxItem = context.output.getUserData();
|
|
19076
|
+
if (!_instanceof1(vfxItem, exports.VFXItem)) {
|
|
19077
|
+
return;
|
|
19078
|
+
}
|
|
19079
|
+
vfxItem.time = this.time;
|
|
19080
|
+
};
|
|
19055
19081
|
return ActivationPlayable;
|
|
19056
19082
|
}(Playable);
|
|
19057
19083
|
exports.ActivationPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
@@ -19204,7 +19230,7 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
19204
19230
|
_proto.toLocalTime = function toLocalTime(time) {
|
|
19205
19231
|
var localTime = time - this.start;
|
|
19206
19232
|
var duration = this.duration;
|
|
19207
|
-
if (localTime - duration > 0
|
|
19233
|
+
if (localTime - duration > 0) {
|
|
19208
19234
|
if (this.endBehavior === EndBehavior.restart) {
|
|
19209
19235
|
localTime = localTime % duration;
|
|
19210
19236
|
} else if (this.endBehavior === EndBehavior.freeze) {
|
|
@@ -19333,7 +19359,7 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
19333
19359
|
var ended = false;
|
|
19334
19360
|
var started = false;
|
|
19335
19361
|
var boundObject = this.track.binding;
|
|
19336
|
-
if (localTime
|
|
19362
|
+
if (localTime >= clip.start + clip.duration && clip.endBehavior === EndBehavior.destroy) {
|
|
19337
19363
|
if (_instanceof1(boundObject, exports.VFXItem) && exports.VFXItem.isParticle(boundObject) && this.particleSystem && !this.particleSystem.destroyed) {
|
|
19338
19364
|
weight = 1.0;
|
|
19339
19365
|
} else {
|
|
@@ -20563,6 +20589,12 @@ exports.EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
20563
20589
|
_proto.onStart = function onStart() {
|
|
20564
20590
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
20565
20591
|
};
|
|
20592
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
20593
|
+
var time = this.item.time;
|
|
20594
|
+
var _this_material_getVector4;
|
|
20595
|
+
var _Time = (_this_material_getVector4 = this.material.getVector4("_Time")) != null ? _this_material_getVector4 : new Vector4();
|
|
20596
|
+
this.material.setVector4("_Time", _Time.set(time / 20, time, time * 2, time * 3));
|
|
20597
|
+
};
|
|
20566
20598
|
_proto.render = function render(renderer) {
|
|
20567
20599
|
if (renderer.renderingData.currentFrame.globalUniforms) {
|
|
20568
20600
|
renderer.setGlobalMatrix("effects_ObjectToWorld", this.transform.getWorldMatrix());
|
|
@@ -20816,6 +20848,9 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20816
20848
|
* 元素的变换包含位置、旋转、缩放。
|
|
20817
20849
|
*/ _this.transform = new Transform();
|
|
20818
20850
|
/**
|
|
20851
|
+
* 元素动画的当前时间
|
|
20852
|
+
*/ _this.time = 0;
|
|
20853
|
+
/**
|
|
20819
20854
|
* 元素动画的持续时间
|
|
20820
20855
|
*/ _this.duration = 0;
|
|
20821
20856
|
/**
|
|
@@ -28070,7 +28105,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
28070
28105
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
28071
28106
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
28072
28107
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
28073
|
-
var version = "2.1.0-alpha.
|
|
28108
|
+
var version = "2.1.0-alpha.3";
|
|
28074
28109
|
logger.info("Core version: " + version + ".");
|
|
28075
28110
|
|
|
28076
28111
|
exports.AbstractPlugin = AbstractPlugin;
|