@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.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.1.0-alpha.
|
|
6
|
+
* Version: v2.1.0-alpha.3
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -8348,7 +8348,7 @@ var seed$8 = 1;
|
|
|
8348
8348
|
* 通过 URL 创建 Texture 对象。
|
|
8349
8349
|
* @param url - 要创建的 Texture URL
|
|
8350
8350
|
* @since 2.0.0
|
|
8351
|
-
*/ Texture.fromImage = function fromImage(url, engine) {
|
|
8351
|
+
*/ Texture.fromImage = function fromImage(url, engine, options) {
|
|
8352
8352
|
return _async_to_generator(function() {
|
|
8353
8353
|
var image, texture;
|
|
8354
8354
|
return __generator(this, function(_state) {
|
|
@@ -8360,12 +8360,13 @@ var seed$8 = 1;
|
|
|
8360
8360
|
];
|
|
8361
8361
|
case 1:
|
|
8362
8362
|
image = _state.sent();
|
|
8363
|
-
texture = Texture.create(engine, {
|
|
8363
|
+
texture = Texture.create(engine, _extends({
|
|
8364
8364
|
sourceType: TextureSourceType.image,
|
|
8365
8365
|
image: image,
|
|
8366
|
+
target: glContext.TEXTURE_2D,
|
|
8366
8367
|
id: generateGUID(),
|
|
8367
8368
|
flipY: true
|
|
8368
|
-
});
|
|
8369
|
+
}, options));
|
|
8369
8370
|
texture.initialize();
|
|
8370
8371
|
return [
|
|
8371
8372
|
2,
|
|
@@ -10297,15 +10298,19 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
10297
10298
|
points: points,
|
|
10298
10299
|
timeInterval: timeInterval,
|
|
10299
10300
|
valueInterval: valueInterval,
|
|
10300
|
-
curve: curve
|
|
10301
|
+
curve: curve,
|
|
10302
|
+
timeStart: Number(s.x),
|
|
10303
|
+
timeEnd: Number(e.x)
|
|
10301
10304
|
};
|
|
10302
10305
|
}
|
|
10303
10306
|
};
|
|
10304
10307
|
_proto.getValue = function getValue(time) {
|
|
10305
10308
|
var result = 0;
|
|
10306
10309
|
var keyTimeData = Object.keys(this.curveMap);
|
|
10307
|
-
var keyTimeStart =
|
|
10308
|
-
var keyTimeEnd =
|
|
10310
|
+
var keyTimeStart = this.curveMap[keyTimeData[0]].timeStart;
|
|
10311
|
+
var keyTimeEnd = this.curveMap[keyTimeData[keyTimeData.length - 1]].timeEnd;
|
|
10312
|
+
// const keyTimeStart = Number(keyTimeData[0].split('&')[0]);
|
|
10313
|
+
// const keyTimeEnd = Number(keyTimeData[keyTimeData.length - 1].split('&')[1]);
|
|
10309
10314
|
if (time <= keyTimeStart) {
|
|
10310
10315
|
return this.getCurveValue(keyTimeData[0], keyTimeStart);
|
|
10311
10316
|
}
|
|
@@ -10313,7 +10318,9 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
10313
10318
|
return this.getCurveValue(keyTimeData[keyTimeData.length - 1], keyTimeEnd);
|
|
10314
10319
|
}
|
|
10315
10320
|
for(var i = 0; i < keyTimeData.length; i++){
|
|
10316
|
-
var
|
|
10321
|
+
var xMin = this.curveMap[keyTimeData[i]].timeStart;
|
|
10322
|
+
var xMax = this.curveMap[keyTimeData[i]].timeEnd;
|
|
10323
|
+
// const [xMin, xMax] = keyTimeData[i].split('&');
|
|
10317
10324
|
if (time >= Number(xMin) && time < Number(xMax)) {
|
|
10318
10325
|
result = this.getCurveValue(keyTimeData[i], time);
|
|
10319
10326
|
break;
|
|
@@ -10326,12 +10333,13 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
10326
10333
|
var time = (t1 - t0) / ts;
|
|
10327
10334
|
var result = 0;
|
|
10328
10335
|
var keyTimeData = Object.keys(this.curveMap);
|
|
10329
|
-
var keyTimeStart =
|
|
10336
|
+
var keyTimeStart = this.curveMap[keyTimeData[0]].timeStart;
|
|
10330
10337
|
if (time <= keyTimeStart) {
|
|
10331
10338
|
return 0;
|
|
10332
10339
|
}
|
|
10333
10340
|
for(var i = 0; i < keyTimeData.length; i++){
|
|
10334
|
-
var
|
|
10341
|
+
var xMin = this.curveMap[keyTimeData[i]].timeStart;
|
|
10342
|
+
var xMax = this.curveMap[keyTimeData[i]].timeEnd;
|
|
10335
10343
|
if (time >= Number(xMax)) {
|
|
10336
10344
|
result += ts * this.getCurveIntegrateValue(keyTimeData[i], Number(xMax));
|
|
10337
10345
|
}
|
|
@@ -13593,25 +13601,25 @@ function _assert_this_initialized(self) {
|
|
|
13593
13601
|
}
|
|
13594
13602
|
var _proto = PlayableGraph.prototype;
|
|
13595
13603
|
_proto.evaluate = function evaluate(dt) {
|
|
13596
|
-
// 初始化节点状态
|
|
13597
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.playables), _step; !(_step = _iterator()).done;){
|
|
13598
|
-
var playable = _step.value;
|
|
13599
|
-
this.updatePlayableTime(playable, dt);
|
|
13600
|
-
}
|
|
13601
13604
|
// 初始化输出节点状态
|
|
13602
|
-
for(var
|
|
13603
|
-
var playableOutput =
|
|
13605
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.playableOutputs), _step; !(_step = _iterator()).done;){
|
|
13606
|
+
var playableOutput = _step.value;
|
|
13604
13607
|
playableOutput.context.deltaTime = dt;
|
|
13605
13608
|
}
|
|
13606
13609
|
// 执行生命周期函数
|
|
13607
|
-
for(var
|
|
13608
|
-
var playableOutput1 =
|
|
13610
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.playableOutputs), _step1; !(_step1 = _iterator1()).done;){
|
|
13611
|
+
var playableOutput1 = _step1.value;
|
|
13609
13612
|
this.prepareFrameWithRoot(playableOutput1);
|
|
13610
13613
|
}
|
|
13611
|
-
for(var
|
|
13612
|
-
var playableOutput2 =
|
|
13614
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(this.playableOutputs), _step2; !(_step2 = _iterator2()).done;){
|
|
13615
|
+
var playableOutput2 = _step2.value;
|
|
13613
13616
|
this.processFrameWithRoot(playableOutput2);
|
|
13614
13617
|
}
|
|
13618
|
+
// 更新节点时间
|
|
13619
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(this.playables), _step3; !(_step3 = _iterator3()).done;){
|
|
13620
|
+
var playable = _step3.value;
|
|
13621
|
+
this.updatePlayableTime(playable, dt);
|
|
13622
|
+
}
|
|
13615
13623
|
};
|
|
13616
13624
|
_proto.connect = function connect(source, sourceOutputPort, destination, destinationInputPort) {
|
|
13617
13625
|
destination.connectInput(destinationInputPort, source, sourceOutputPort);
|
|
@@ -13634,11 +13642,7 @@ function _assert_this_initialized(self) {
|
|
|
13634
13642
|
if (playable.getPlayState() !== 0) {
|
|
13635
13643
|
return;
|
|
13636
13644
|
}
|
|
13637
|
-
|
|
13638
|
-
playable.overrideTimeNextEvaluation = false;
|
|
13639
|
-
} else {
|
|
13640
|
-
playable.setTime(playable.getTime() + deltaTime);
|
|
13641
|
-
}
|
|
13645
|
+
playable.setTime(playable.getTime() + deltaTime);
|
|
13642
13646
|
};
|
|
13643
13647
|
return PlayableGraph;
|
|
13644
13648
|
}();
|
|
@@ -13650,7 +13654,6 @@ function _assert_this_initialized(self) {
|
|
|
13650
13654
|
if (inputCount === void 0) inputCount = 0;
|
|
13651
13655
|
this.onPlayablePlayFlag = true;
|
|
13652
13656
|
this.onPlayablePauseFlag = false;
|
|
13653
|
-
this.overrideTimeNextEvaluation = false;
|
|
13654
13657
|
this.destroyed = false;
|
|
13655
13658
|
this.inputs = [];
|
|
13656
13659
|
this.inputOuputPorts = [];
|
|
@@ -13739,7 +13742,6 @@ function _assert_this_initialized(self) {
|
|
|
13739
13742
|
};
|
|
13740
13743
|
_proto.setTime = function setTime(time) {
|
|
13741
13744
|
this.time = time;
|
|
13742
|
-
this.overrideTimeNextEvaluation = true;
|
|
13743
13745
|
};
|
|
13744
13746
|
_proto.getTime = function getTime() {
|
|
13745
13747
|
return this.time;
|
|
@@ -16542,8 +16544,9 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
|
|
|
16542
16544
|
};
|
|
16543
16545
|
_proto.onUpdate = function onUpdate(dt) {
|
|
16544
16546
|
var time = this.particleMesh.time;
|
|
16545
|
-
|
|
16546
|
-
this.particleMesh.
|
|
16547
|
+
var _this_particleMesh_mesh_material_getVector4;
|
|
16548
|
+
var uParams = (_this_particleMesh_mesh_material_getVector4 = this.particleMesh.mesh.material.getVector4("uParams")) != null ? _this_particleMesh_mesh_material_getVector4 : new Vector4();
|
|
16549
|
+
this.particleMesh.mesh.material.setVector4("uParams", uParams.set(time, this.item.duration, 0, 0));
|
|
16547
16550
|
};
|
|
16548
16551
|
_proto.render = function render(renderer) {
|
|
16549
16552
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
@@ -16558,7 +16561,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
|
|
|
16558
16561
|
};
|
|
16559
16562
|
_proto.updateTime = function updateTime(now, delta) {
|
|
16560
16563
|
this.particleMesh.time = now;
|
|
16561
|
-
|
|
16564
|
+
this.particleMesh.onUpdate(delta);
|
|
16562
16565
|
if (this.trailMesh) {
|
|
16563
16566
|
this.trailMesh.time = now;
|
|
16564
16567
|
this.trailMesh.onUpdate(delta);
|
|
@@ -16852,7 +16855,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16852
16855
|
break;
|
|
16853
16856
|
}
|
|
16854
16857
|
var burst = bursts[j];
|
|
16855
|
-
var opts = burst.getGeneratorOptions(timePassed, lifetime);
|
|
16858
|
+
var opts = !burst.disabled && burst.getGeneratorOptions(timePassed, lifetime);
|
|
16856
16859
|
if (opts) {
|
|
16857
16860
|
var originVec = [
|
|
16858
16861
|
0,
|
|
@@ -16861,6 +16864,9 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16861
16864
|
];
|
|
16862
16865
|
var offsets = emission.burstOffsets[j];
|
|
16863
16866
|
var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
|
|
16867
|
+
if (burst.once) {
|
|
16868
|
+
this.removeBurst(j);
|
|
16869
|
+
}
|
|
16864
16870
|
for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
|
|
16865
16871
|
var _p_transform;
|
|
16866
16872
|
if (shouldSkipGenerate()) {
|
|
@@ -17665,6 +17671,10 @@ var particleUniformTypeMap = {
|
|
|
17665
17671
|
var ParticleMesh = /*#__PURE__*/ function() {
|
|
17666
17672
|
function ParticleMesh(engine, props) {
|
|
17667
17673
|
this.particleCount = 0;
|
|
17674
|
+
this.cachedRotationVector3 = new Vector3();
|
|
17675
|
+
this.cachedRotationMatrix = new Matrix3();
|
|
17676
|
+
this.cachedLinearMove = new Vector3();
|
|
17677
|
+
this.tempMatrix3 = new Matrix3();
|
|
17668
17678
|
this.VERT_MAX_KEY_FRAME_COUNT = 0;
|
|
17669
17679
|
var _engine_renderer;
|
|
17670
17680
|
var env = ((_engine_renderer = engine.renderer) != null ? _engine_renderer : {}).env;
|
|
@@ -18060,69 +18070,10 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18060
18070
|
};
|
|
18061
18071
|
_proto.onUpdate = function onUpdate(dt) {
|
|
18062
18072
|
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
18073
|
var particleCount = Math.ceil(aPosArray.length / 12);
|
|
18075
|
-
|
|
18076
|
-
|
|
18077
|
-
|
|
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);
|
|
18074
|
+
this.applyTranslation(particleCount, dt);
|
|
18075
|
+
this.applyRotation(particleCount, dt);
|
|
18076
|
+
this.applyLinearMove(particleCount, dt);
|
|
18126
18077
|
};
|
|
18127
18078
|
_proto.minusTime = function minusTime(time) {
|
|
18128
18079
|
var aOffset = this.geometry.getAttributeData("aOffset");
|
|
@@ -18132,158 +18083,6 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18132
18083
|
this.geometry.setAttributeData("aOffset", aOffset);
|
|
18133
18084
|
this.time -= time;
|
|
18134
18085
|
};
|
|
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
|
-
};
|
|
18287
18086
|
_proto.removePoint = function removePoint(index) {
|
|
18288
18087
|
if (index < this.particleCount) {
|
|
18289
18088
|
this.geometry.setAttributeSubData("aOffset", index * 16, new Float32Array(16));
|
|
@@ -18307,7 +18106,8 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18307
18106
|
var pointData = {
|
|
18308
18107
|
aPos: new Float32Array(48),
|
|
18309
18108
|
aRot: new Float32Array(32),
|
|
18310
|
-
aOffset: new Float32Array(16)
|
|
18109
|
+
aOffset: new Float32Array(16),
|
|
18110
|
+
aTranslation: new Float32Array(12)
|
|
18311
18111
|
};
|
|
18312
18112
|
var useSprite = this.useSprite;
|
|
18313
18113
|
if (useSprite) {
|
|
@@ -18416,6 +18216,226 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18416
18216
|
geometry.setDrawCount(this.particleCount * 6);
|
|
18417
18217
|
}
|
|
18418
18218
|
};
|
|
18219
|
+
_proto.applyTranslation = function applyTranslation(particleCount, deltaTime) {
|
|
18220
|
+
var localTime = this.time;
|
|
18221
|
+
var aTranslationArray = this.geometry.getAttributeData("aTranslation");
|
|
18222
|
+
var aVelArray = this.geometry.getAttributeData("aVel"); // vector3
|
|
18223
|
+
var aOffsetArray = this.geometry.getAttributeData("aOffset");
|
|
18224
|
+
if (aTranslationArray.length < particleCount * 3) {
|
|
18225
|
+
aTranslationArray = this.expandArray(aTranslationArray, particleCount * 3);
|
|
18226
|
+
}
|
|
18227
|
+
// const velocity = this.cachedVelocity;
|
|
18228
|
+
var velocityX = 0;
|
|
18229
|
+
var velocityY = 0;
|
|
18230
|
+
var velocityZ = 0;
|
|
18231
|
+
var uAcceleration = this.mesh.material.getVector4("uAcceleration");
|
|
18232
|
+
var uGravityModifierValue = this.mesh.material.getVector4("uGravityModifierValue");
|
|
18233
|
+
for(var i = 0; i < particleCount; i++){
|
|
18234
|
+
var velOffset = i * 12 + 3;
|
|
18235
|
+
velocityX = aVelArray[velOffset];
|
|
18236
|
+
velocityY = aVelArray[velOffset + 1];
|
|
18237
|
+
velocityZ = aVelArray[velOffset + 2];
|
|
18238
|
+
// velocity.set(aVelArray[velOffset], aVelArray[velOffset + 1], aVelArray[velOffset + 2]);
|
|
18239
|
+
var dt = localTime - aOffsetArray[i * 4 + 2]; // 相对delay的时间
|
|
18240
|
+
var duration = aOffsetArray[i * 4 + 3];
|
|
18241
|
+
if (uAcceleration && uGravityModifierValue) {
|
|
18242
|
+
var d = this.gravityModifier.getIntegrateValue(0, dt, duration);
|
|
18243
|
+
// const acc = this.tempVector3.set(uAcceleration.x * d, uAcceleration.y * d, uAcceleration.z * d);
|
|
18244
|
+
var accX = uAcceleration.x * d;
|
|
18245
|
+
var accY = uAcceleration.y * d;
|
|
18246
|
+
var accZ = uAcceleration.z * d;
|
|
18247
|
+
// speedIntegrate = speedOverLifetime.getIntegrateValue(0, time, duration);
|
|
18248
|
+
if (this.speedOverLifetime) {
|
|
18249
|
+
// dt / dur 归一化
|
|
18250
|
+
var speed = this.speedOverLifetime.getValue(dt / duration);
|
|
18251
|
+
velocityX = velocityX * speed + accX;
|
|
18252
|
+
velocityY = velocityY * speed + accY;
|
|
18253
|
+
velocityZ = velocityZ * speed + accZ;
|
|
18254
|
+
// velocity.multiply(speed).add(acc);
|
|
18255
|
+
} else {
|
|
18256
|
+
velocityX = velocityX + accX;
|
|
18257
|
+
velocityY = velocityY + accY;
|
|
18258
|
+
velocityZ = velocityZ + accZ;
|
|
18259
|
+
// velocity.add(acc);
|
|
18260
|
+
}
|
|
18261
|
+
}
|
|
18262
|
+
var aTranslationOffset = i * 3;
|
|
18263
|
+
if (aOffsetArray[i * 4 + 2] < localTime) {
|
|
18264
|
+
// const translation = velocity.multiply(deltaTime / 1000);
|
|
18265
|
+
aTranslationArray[aTranslationOffset] += velocityX * (deltaTime / 1000);
|
|
18266
|
+
aTranslationArray[aTranslationOffset + 1] += velocityY * (deltaTime / 1000);
|
|
18267
|
+
aTranslationArray[aTranslationOffset + 2] += velocityZ * (deltaTime / 1000);
|
|
18268
|
+
}
|
|
18269
|
+
}
|
|
18270
|
+
this.geometry.setAttributeData("aTranslation", aTranslationArray);
|
|
18271
|
+
};
|
|
18272
|
+
_proto.applyRotation = function applyRotation(particleCount, deltaTime) {
|
|
18273
|
+
var aRotationArray = this.geometry.getAttributeData("aRotation0");
|
|
18274
|
+
var aOffsetArray = this.geometry.getAttributeData("aOffset");
|
|
18275
|
+
var aRotArray = this.geometry.getAttributeData("aRot"); // vector3
|
|
18276
|
+
var aSeedArray = this.geometry.getAttributeData("aSeed"); // float
|
|
18277
|
+
var localTime = this.time;
|
|
18278
|
+
var aRotationMatrix = this.cachedRotationMatrix;
|
|
18279
|
+
if (aRotationArray.length < particleCount * 9) {
|
|
18280
|
+
aRotationArray = this.expandArray(aRotationArray, particleCount * 9);
|
|
18281
|
+
}
|
|
18282
|
+
for(var i = 0; i < particleCount; i++){
|
|
18283
|
+
var time = localTime - aOffsetArray[i * 4 + 2];
|
|
18284
|
+
var duration = aOffsetArray[i * 4 + 3];
|
|
18285
|
+
var life = clamp$1(time / duration, 0.0, 1.0);
|
|
18286
|
+
var aRotOffset = i * 8;
|
|
18287
|
+
var aRot = this.cachedRotationVector3.set(aRotArray[aRotOffset], aRotArray[aRotOffset + 1], aRotArray[aRotOffset + 2]);
|
|
18288
|
+
var aSeed = aSeedArray[i * 8 + 3];
|
|
18289
|
+
var rotation = aRot;
|
|
18290
|
+
if (!this.rotationOverLifetime) {
|
|
18291
|
+
aRotationMatrix.setZero();
|
|
18292
|
+
} else if (this.rotationOverLifetime.asRotation) {
|
|
18293
|
+
// Adjust rotation based on the specified lifetime components
|
|
18294
|
+
if (this.rotationOverLifetime.x) {
|
|
18295
|
+
if (_instanceof1(this.rotationOverLifetime.x, RandomValue)) {
|
|
18296
|
+
rotation.x += this.rotationOverLifetime.x.getValue(life, aSeed);
|
|
18297
|
+
} else {
|
|
18298
|
+
rotation.x += this.rotationOverLifetime.x.getValue(life);
|
|
18299
|
+
}
|
|
18300
|
+
}
|
|
18301
|
+
if (this.rotationOverLifetime.y) {
|
|
18302
|
+
if (_instanceof1(this.rotationOverLifetime.y, RandomValue)) {
|
|
18303
|
+
rotation.y += this.rotationOverLifetime.y.getValue(life, aSeed);
|
|
18304
|
+
} else {
|
|
18305
|
+
rotation.y += this.rotationOverLifetime.y.getValue(life);
|
|
18306
|
+
}
|
|
18307
|
+
}
|
|
18308
|
+
if (this.rotationOverLifetime.z) {
|
|
18309
|
+
if (_instanceof1(this.rotationOverLifetime.z, RandomValue)) {
|
|
18310
|
+
rotation.z += this.rotationOverLifetime.z.getValue(life, aSeed);
|
|
18311
|
+
} else {
|
|
18312
|
+
rotation.z += this.rotationOverLifetime.z.getValue(life);
|
|
18313
|
+
}
|
|
18314
|
+
}
|
|
18315
|
+
} else {
|
|
18316
|
+
// Adjust rotation based on the specified lifetime components
|
|
18317
|
+
if (this.rotationOverLifetime.x) {
|
|
18318
|
+
if (_instanceof1(this.rotationOverLifetime.x, RandomValue)) {
|
|
18319
|
+
rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, aSeed) * duration;
|
|
18320
|
+
} else {
|
|
18321
|
+
rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, duration) * duration;
|
|
18322
|
+
}
|
|
18323
|
+
}
|
|
18324
|
+
if (this.rotationOverLifetime.y) {
|
|
18325
|
+
if (_instanceof1(this.rotationOverLifetime.y, RandomValue)) {
|
|
18326
|
+
rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, aSeed) * duration;
|
|
18327
|
+
} else {
|
|
18328
|
+
rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, duration) * duration;
|
|
18329
|
+
}
|
|
18330
|
+
}
|
|
18331
|
+
if (this.rotationOverLifetime.z) {
|
|
18332
|
+
if (_instanceof1(this.rotationOverLifetime.z, RandomValue)) {
|
|
18333
|
+
rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, aSeed) * duration;
|
|
18334
|
+
} else {
|
|
18335
|
+
rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, duration) * duration;
|
|
18336
|
+
}
|
|
18337
|
+
}
|
|
18338
|
+
}
|
|
18339
|
+
// If the rotation vector is zero, return the identity matrix
|
|
18340
|
+
if (rotation.dot(rotation) === 0.0) {
|
|
18341
|
+
aRotationMatrix.identity();
|
|
18342
|
+
}
|
|
18343
|
+
var d2r = Math.PI / 180;
|
|
18344
|
+
var rotationXD2r = rotation.x * d2r;
|
|
18345
|
+
var rotationYD2r = rotation.y * d2r;
|
|
18346
|
+
var rotationZD2r = rotation.z * d2r;
|
|
18347
|
+
var sinRX = Math.sin(rotationXD2r);
|
|
18348
|
+
var sinRY = Math.sin(rotationYD2r);
|
|
18349
|
+
var sinRZ = Math.sin(rotationZD2r);
|
|
18350
|
+
var cosRX = Math.cos(rotationXD2r);
|
|
18351
|
+
var cosRY = Math.cos(rotationYD2r);
|
|
18352
|
+
var cosRZ = Math.cos(rotationZD2r);
|
|
18353
|
+
// rotZ * rotY * rotX
|
|
18354
|
+
aRotationMatrix.set(cosRZ, -sinRZ, 0., sinRZ, cosRZ, 0., 0., 0., 1.); //rotZ
|
|
18355
|
+
aRotationMatrix.multiply(this.tempMatrix3.set(cosRY, 0., sinRY, 0., 1., 0., -sinRY, 0, cosRY)); //rotY
|
|
18356
|
+
aRotationMatrix.multiply(this.tempMatrix3.set(1., 0., 0., 0, cosRX, -sinRX, 0., sinRX, cosRX)); //rotX
|
|
18357
|
+
var aRotationOffset = i * 9;
|
|
18358
|
+
var matrixArray = aRotationMatrix.elements;
|
|
18359
|
+
aRotationArray.set(matrixArray, aRotationOffset);
|
|
18360
|
+
}
|
|
18361
|
+
this.geometry.setAttributeData("aRotation0", aRotationArray);
|
|
18362
|
+
};
|
|
18363
|
+
_proto.applyLinearMove = function applyLinearMove(particleCount, deltaTime) {
|
|
18364
|
+
var aLinearMoveArray = this.geometry.getAttributeData("aLinearMove");
|
|
18365
|
+
var aOffsetArray = this.geometry.getAttributeData("aOffset");
|
|
18366
|
+
var aSeedArray = this.geometry.getAttributeData("aSeed"); // float
|
|
18367
|
+
var localTime = this.time;
|
|
18368
|
+
if (aLinearMoveArray.length < particleCount * 3) {
|
|
18369
|
+
aLinearMoveArray = this.expandArray(aLinearMoveArray, particleCount * 3);
|
|
18370
|
+
}
|
|
18371
|
+
var linearMove = this.cachedLinearMove;
|
|
18372
|
+
if (this.linearVelOverLifetime && this.linearVelOverLifetime.enabled) {
|
|
18373
|
+
for(var i = 0; i < particleCount; i++){
|
|
18374
|
+
var time = localTime - aOffsetArray[i * 4 + 2];
|
|
18375
|
+
var duration = aOffsetArray[i * 4 + 3];
|
|
18376
|
+
// const life = math.clamp(time / duration, 0.0, 1.0);
|
|
18377
|
+
var lifetime = time / duration;
|
|
18378
|
+
var aSeed = aSeedArray[i * 8 + 3];
|
|
18379
|
+
linearMove.setZero();
|
|
18380
|
+
if (this.linearVelOverLifetime.asMovement) {
|
|
18381
|
+
if (this.linearVelOverLifetime.x) {
|
|
18382
|
+
if (_instanceof1(this.linearVelOverLifetime.x, RandomValue)) {
|
|
18383
|
+
linearMove.x = this.linearVelOverLifetime.x.getValue(lifetime, aSeed);
|
|
18384
|
+
} else {
|
|
18385
|
+
linearMove.x = this.linearVelOverLifetime.x.getValue(lifetime);
|
|
18386
|
+
}
|
|
18387
|
+
}
|
|
18388
|
+
if (this.linearVelOverLifetime.y) {
|
|
18389
|
+
if (_instanceof1(this.linearVelOverLifetime.y, RandomValue)) {
|
|
18390
|
+
linearMove.y = this.linearVelOverLifetime.y.getValue(lifetime, aSeed);
|
|
18391
|
+
} else {
|
|
18392
|
+
linearMove.y = this.linearVelOverLifetime.y.getValue(lifetime);
|
|
18393
|
+
}
|
|
18394
|
+
}
|
|
18395
|
+
if (this.linearVelOverLifetime.z) {
|
|
18396
|
+
if (_instanceof1(this.linearVelOverLifetime.z, RandomValue)) {
|
|
18397
|
+
linearMove.z = this.linearVelOverLifetime.z.getValue(lifetime, aSeed);
|
|
18398
|
+
} else {
|
|
18399
|
+
linearMove.z = this.linearVelOverLifetime.z.getValue(lifetime);
|
|
18400
|
+
}
|
|
18401
|
+
}
|
|
18402
|
+
} else {
|
|
18403
|
+
// Adjust rotation based on the specified lifetime components
|
|
18404
|
+
if (this.linearVelOverLifetime.x) {
|
|
18405
|
+
if (_instanceof1(this.linearVelOverLifetime.x, RandomValue)) {
|
|
18406
|
+
linearMove.x = this.linearVelOverLifetime.x.getIntegrateValue(0.0, time, aSeed);
|
|
18407
|
+
} else {
|
|
18408
|
+
linearMove.x = this.linearVelOverLifetime.x.getIntegrateValue(0.0, time, duration);
|
|
18409
|
+
}
|
|
18410
|
+
}
|
|
18411
|
+
if (this.linearVelOverLifetime.y) {
|
|
18412
|
+
if (_instanceof1(this.linearVelOverLifetime.y, RandomValue)) {
|
|
18413
|
+
linearMove.y = this.linearVelOverLifetime.y.getIntegrateValue(0.0, time, aSeed);
|
|
18414
|
+
} else {
|
|
18415
|
+
linearMove.y = this.linearVelOverLifetime.y.getIntegrateValue(0.0, time, duration);
|
|
18416
|
+
}
|
|
18417
|
+
}
|
|
18418
|
+
if (this.linearVelOverLifetime.z) {
|
|
18419
|
+
if (_instanceof1(this.linearVelOverLifetime.z, RandomValue)) {
|
|
18420
|
+
linearMove.z = this.linearVelOverLifetime.z.getIntegrateValue(0.0, time, aSeed);
|
|
18421
|
+
} else {
|
|
18422
|
+
linearMove.z = this.linearVelOverLifetime.z.getIntegrateValue(0.0, time, duration);
|
|
18423
|
+
}
|
|
18424
|
+
}
|
|
18425
|
+
}
|
|
18426
|
+
var aLinearMoveOffset = i * 3;
|
|
18427
|
+
aLinearMoveArray[aLinearMoveOffset] = linearMove.x;
|
|
18428
|
+
aLinearMoveArray[aLinearMoveOffset + 1] = linearMove.y;
|
|
18429
|
+
aLinearMoveArray[aLinearMoveOffset + 2] = linearMove.z;
|
|
18430
|
+
}
|
|
18431
|
+
}
|
|
18432
|
+
this.geometry.setAttributeData("aLinearMove", aLinearMoveArray);
|
|
18433
|
+
};
|
|
18434
|
+
_proto.expandArray = function expandArray(array, newSize) {
|
|
18435
|
+
var newArr = new Float32Array(newSize);
|
|
18436
|
+
newArr.set(array);
|
|
18437
|
+
return newArr;
|
|
18438
|
+
};
|
|
18419
18439
|
return ParticleMesh;
|
|
18420
18440
|
}();
|
|
18421
18441
|
var gl2UniformSlots = [
|
|
@@ -19047,7 +19067,13 @@ TransformPlayableAsset = __decorate([
|
|
|
19047
19067
|
return Playable.apply(this, arguments);
|
|
19048
19068
|
}
|
|
19049
19069
|
var _proto = ActivationPlayable.prototype;
|
|
19050
|
-
_proto.processFrame = function processFrame(context) {
|
|
19070
|
+
_proto.processFrame = function processFrame(context) {
|
|
19071
|
+
var vfxItem = context.output.getUserData();
|
|
19072
|
+
if (!_instanceof1(vfxItem, VFXItem)) {
|
|
19073
|
+
return;
|
|
19074
|
+
}
|
|
19075
|
+
vfxItem.time = this.time;
|
|
19076
|
+
};
|
|
19051
19077
|
return ActivationPlayable;
|
|
19052
19078
|
}(Playable);
|
|
19053
19079
|
var ActivationPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
@@ -19200,7 +19226,7 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
19200
19226
|
_proto.toLocalTime = function toLocalTime(time) {
|
|
19201
19227
|
var localTime = time - this.start;
|
|
19202
19228
|
var duration = this.duration;
|
|
19203
|
-
if (localTime - duration > 0
|
|
19229
|
+
if (localTime - duration > 0) {
|
|
19204
19230
|
if (this.endBehavior === EndBehavior.restart) {
|
|
19205
19231
|
localTime = localTime % duration;
|
|
19206
19232
|
} else if (this.endBehavior === EndBehavior.freeze) {
|
|
@@ -19329,7 +19355,7 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
19329
19355
|
var ended = false;
|
|
19330
19356
|
var started = false;
|
|
19331
19357
|
var boundObject = this.track.binding;
|
|
19332
|
-
if (localTime
|
|
19358
|
+
if (localTime >= clip.start + clip.duration && clip.endBehavior === EndBehavior.destroy) {
|
|
19333
19359
|
if (_instanceof1(boundObject, VFXItem) && VFXItem.isParticle(boundObject) && this.particleSystem && !this.particleSystem.destroyed) {
|
|
19334
19360
|
weight = 1.0;
|
|
19335
19361
|
} else {
|
|
@@ -20559,6 +20585,12 @@ var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
20559
20585
|
_proto.onStart = function onStart() {
|
|
20560
20586
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
20561
20587
|
};
|
|
20588
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
20589
|
+
var time = this.item.time;
|
|
20590
|
+
var _this_material_getVector4;
|
|
20591
|
+
var _Time = (_this_material_getVector4 = this.material.getVector4("_Time")) != null ? _this_material_getVector4 : new Vector4();
|
|
20592
|
+
this.material.setVector4("_Time", _Time.set(time / 20, time, time * 2, time * 3));
|
|
20593
|
+
};
|
|
20562
20594
|
_proto.render = function render(renderer) {
|
|
20563
20595
|
if (renderer.renderingData.currentFrame.globalUniforms) {
|
|
20564
20596
|
renderer.setGlobalMatrix("effects_ObjectToWorld", this.transform.getWorldMatrix());
|
|
@@ -20812,6 +20844,9 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20812
20844
|
* 元素的变换包含位置、旋转、缩放。
|
|
20813
20845
|
*/ _this.transform = new Transform();
|
|
20814
20846
|
/**
|
|
20847
|
+
* 元素动画的当前时间
|
|
20848
|
+
*/ _this.time = 0;
|
|
20849
|
+
/**
|
|
20815
20850
|
* 元素动画的持续时间
|
|
20816
20851
|
*/ _this.duration = 0;
|
|
20817
20852
|
/**
|
|
@@ -28066,7 +28101,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
28066
28101
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
28067
28102
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
28068
28103
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
28069
|
-
var version = "2.1.0-alpha.
|
|
28104
|
+
var version = "2.1.0-alpha.3";
|
|
28070
28105
|
logger.info("Core version: " + version + ".");
|
|
28071
28106
|
|
|
28072
28107
|
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 };
|