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