@galacean/effects-core 2.1.0-alpha.3 → 2.1.0-alpha.4
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 +53 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -22
- package/dist/index.mjs.map +1 -1
- package/dist/math/value-getter.d.ts +1 -0
- package/package.json +2 -2
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.4
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -4255,6 +4255,9 @@ var MaterialBlending;
|
|
|
4255
4255
|
/**
|
|
4256
4256
|
* 自发光
|
|
4257
4257
|
*/ RenderMode3D["emissive"] = "emissive";
|
|
4258
|
+
/**
|
|
4259
|
+
* 漫反射
|
|
4260
|
+
*/ RenderMode3D["diffuse"] = "diffuse";
|
|
4258
4261
|
})(RenderMode3D || (RenderMode3D = {}));
|
|
4259
4262
|
|
|
4260
4263
|
var TextOverflow;
|
|
@@ -10307,10 +10310,11 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
10307
10310
|
timeEnd: Number(e.x)
|
|
10308
10311
|
};
|
|
10309
10312
|
}
|
|
10313
|
+
this.keyTimeData = Object.keys(this.curveMap);
|
|
10310
10314
|
};
|
|
10311
10315
|
_proto.getValue = function getValue(time) {
|
|
10312
10316
|
var result = 0;
|
|
10313
|
-
var keyTimeData =
|
|
10317
|
+
var keyTimeData = this.keyTimeData;
|
|
10314
10318
|
var keyTimeStart = this.curveMap[keyTimeData[0]].timeStart;
|
|
10315
10319
|
var keyTimeEnd = this.curveMap[keyTimeData[keyTimeData.length - 1]].timeEnd;
|
|
10316
10320
|
// const keyTimeStart = Number(keyTimeData[0].split('&')[0]);
|
|
@@ -18074,10 +18078,10 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18074
18078
|
};
|
|
18075
18079
|
_proto.onUpdate = function onUpdate(dt) {
|
|
18076
18080
|
var aPosArray = this.geometry.getAttributeData("aPos"); // vector3
|
|
18077
|
-
var
|
|
18078
|
-
this.applyTranslation(
|
|
18079
|
-
this.applyRotation(
|
|
18080
|
-
this.applyLinearMove(
|
|
18081
|
+
var vertexCount = Math.ceil(aPosArray.length / 12);
|
|
18082
|
+
this.applyTranslation(vertexCount, dt);
|
|
18083
|
+
this.applyRotation(vertexCount, dt);
|
|
18084
|
+
this.applyLinearMove(vertexCount, dt);
|
|
18081
18085
|
};
|
|
18082
18086
|
_proto.minusTime = function minusTime(time) {
|
|
18083
18087
|
var aOffset = this.geometry.getAttributeData("aOffset");
|
|
@@ -18220,13 +18224,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18220
18224
|
geometry.setDrawCount(this.particleCount * 6);
|
|
18221
18225
|
}
|
|
18222
18226
|
};
|
|
18223
|
-
_proto.applyTranslation = function applyTranslation(
|
|
18227
|
+
_proto.applyTranslation = function applyTranslation(vertexCount, deltaTime) {
|
|
18224
18228
|
var localTime = this.time;
|
|
18225
18229
|
var aTranslationArray = this.geometry.getAttributeData("aTranslation");
|
|
18226
18230
|
var aVelArray = this.geometry.getAttributeData("aVel"); // vector3
|
|
18227
18231
|
var aOffsetArray = this.geometry.getAttributeData("aOffset");
|
|
18228
|
-
if (aTranslationArray.length <
|
|
18229
|
-
aTranslationArray = this.expandArray(aTranslationArray,
|
|
18232
|
+
if (aTranslationArray.length < vertexCount * 3) {
|
|
18233
|
+
aTranslationArray = this.expandArray(aTranslationArray, vertexCount * 3);
|
|
18230
18234
|
}
|
|
18231
18235
|
// const velocity = this.cachedVelocity;
|
|
18232
18236
|
var velocityX = 0;
|
|
@@ -18234,7 +18238,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18234
18238
|
var velocityZ = 0;
|
|
18235
18239
|
var uAcceleration = this.mesh.material.getVector4("uAcceleration");
|
|
18236
18240
|
var uGravityModifierValue = this.mesh.material.getVector4("uGravityModifierValue");
|
|
18237
|
-
for(var i = 0; i <
|
|
18241
|
+
for(var i = 0; i < vertexCount; i += 4){
|
|
18238
18242
|
var velOffset = i * 12 + 3;
|
|
18239
18243
|
velocityX = aVelArray[velOffset];
|
|
18240
18244
|
velocityY = aVelArray[velOffset + 1];
|
|
@@ -18266,24 +18270,36 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18266
18270
|
var aTranslationOffset = i * 3;
|
|
18267
18271
|
if (aOffsetArray[i * 4 + 2] < localTime) {
|
|
18268
18272
|
// const translation = velocity.multiply(deltaTime / 1000);
|
|
18269
|
-
|
|
18270
|
-
|
|
18271
|
-
|
|
18273
|
+
var aTranslationX = velocityX * (deltaTime / 1000);
|
|
18274
|
+
var aTranslationY = velocityY * (deltaTime / 1000);
|
|
18275
|
+
var aTranslationZ = velocityZ * (deltaTime / 1000);
|
|
18276
|
+
aTranslationArray[aTranslationOffset] += aTranslationX;
|
|
18277
|
+
aTranslationArray[aTranslationOffset + 1] += aTranslationY;
|
|
18278
|
+
aTranslationArray[aTranslationOffset + 2] += aTranslationZ;
|
|
18279
|
+
aTranslationArray[aTranslationOffset + 3] += aTranslationX;
|
|
18280
|
+
aTranslationArray[aTranslationOffset + 4] += aTranslationY;
|
|
18281
|
+
aTranslationArray[aTranslationOffset + 5] += aTranslationZ;
|
|
18282
|
+
aTranslationArray[aTranslationOffset + 6] += aTranslationX;
|
|
18283
|
+
aTranslationArray[aTranslationOffset + 7] += aTranslationY;
|
|
18284
|
+
aTranslationArray[aTranslationOffset + 8] += aTranslationZ;
|
|
18285
|
+
aTranslationArray[aTranslationOffset + 9] += aTranslationX;
|
|
18286
|
+
aTranslationArray[aTranslationOffset + 10] += aTranslationY;
|
|
18287
|
+
aTranslationArray[aTranslationOffset + 11] += aTranslationZ;
|
|
18272
18288
|
}
|
|
18273
18289
|
}
|
|
18274
18290
|
this.geometry.setAttributeData("aTranslation", aTranslationArray);
|
|
18275
18291
|
};
|
|
18276
|
-
_proto.applyRotation = function applyRotation(
|
|
18292
|
+
_proto.applyRotation = function applyRotation(vertexCount, deltaTime) {
|
|
18277
18293
|
var aRotationArray = this.geometry.getAttributeData("aRotation0");
|
|
18278
18294
|
var aOffsetArray = this.geometry.getAttributeData("aOffset");
|
|
18279
18295
|
var aRotArray = this.geometry.getAttributeData("aRot"); // vector3
|
|
18280
18296
|
var aSeedArray = this.geometry.getAttributeData("aSeed"); // float
|
|
18281
18297
|
var localTime = this.time;
|
|
18282
18298
|
var aRotationMatrix = this.cachedRotationMatrix;
|
|
18283
|
-
if (aRotationArray.length <
|
|
18284
|
-
aRotationArray = this.expandArray(aRotationArray,
|
|
18299
|
+
if (aRotationArray.length < vertexCount * 9) {
|
|
18300
|
+
aRotationArray = this.expandArray(aRotationArray, vertexCount * 9);
|
|
18285
18301
|
}
|
|
18286
|
-
for(var i = 0; i <
|
|
18302
|
+
for(var i = 0; i < vertexCount; i += 4){
|
|
18287
18303
|
var time = localTime - aOffsetArray[i * 4 + 2];
|
|
18288
18304
|
var duration = aOffsetArray[i * 4 + 3];
|
|
18289
18305
|
var life = clamp$1(time / duration, 0.0, 1.0);
|
|
@@ -18361,20 +18377,25 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18361
18377
|
var aRotationOffset = i * 9;
|
|
18362
18378
|
var matrixArray = aRotationMatrix.elements;
|
|
18363
18379
|
aRotationArray.set(matrixArray, aRotationOffset);
|
|
18380
|
+
if (i + 4 <= vertexCount) {
|
|
18381
|
+
aRotationArray.set(matrixArray, aRotationOffset + 9);
|
|
18382
|
+
aRotationArray.set(matrixArray, aRotationOffset + 18);
|
|
18383
|
+
aRotationArray.set(matrixArray, aRotationOffset + 27);
|
|
18384
|
+
}
|
|
18364
18385
|
}
|
|
18365
18386
|
this.geometry.setAttributeData("aRotation0", aRotationArray);
|
|
18366
18387
|
};
|
|
18367
|
-
_proto.applyLinearMove = function applyLinearMove(
|
|
18388
|
+
_proto.applyLinearMove = function applyLinearMove(vertexCount, deltaTime) {
|
|
18368
18389
|
var aLinearMoveArray = this.geometry.getAttributeData("aLinearMove");
|
|
18369
18390
|
var aOffsetArray = this.geometry.getAttributeData("aOffset");
|
|
18370
18391
|
var aSeedArray = this.geometry.getAttributeData("aSeed"); // float
|
|
18371
18392
|
var localTime = this.time;
|
|
18372
|
-
if (aLinearMoveArray.length <
|
|
18373
|
-
aLinearMoveArray = this.expandArray(aLinearMoveArray,
|
|
18393
|
+
if (aLinearMoveArray.length < vertexCount * 3) {
|
|
18394
|
+
aLinearMoveArray = this.expandArray(aLinearMoveArray, vertexCount * 3);
|
|
18374
18395
|
}
|
|
18375
18396
|
var linearMove = this.cachedLinearMove;
|
|
18376
18397
|
if (this.linearVelOverLifetime && this.linearVelOverLifetime.enabled) {
|
|
18377
|
-
for(var i = 0; i <
|
|
18398
|
+
for(var i = 0; i < vertexCount; i += 4){
|
|
18378
18399
|
var time = localTime - aOffsetArray[i * 4 + 2];
|
|
18379
18400
|
var duration = aOffsetArray[i * 4 + 3];
|
|
18380
18401
|
// const life = math.clamp(time / duration, 0.0, 1.0);
|
|
@@ -18431,6 +18452,15 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18431
18452
|
aLinearMoveArray[aLinearMoveOffset] = linearMove.x;
|
|
18432
18453
|
aLinearMoveArray[aLinearMoveOffset + 1] = linearMove.y;
|
|
18433
18454
|
aLinearMoveArray[aLinearMoveOffset + 2] = linearMove.z;
|
|
18455
|
+
aLinearMoveArray[aLinearMoveOffset + 3] = linearMove.x;
|
|
18456
|
+
aLinearMoveArray[aLinearMoveOffset + 4] = linearMove.y;
|
|
18457
|
+
aLinearMoveArray[aLinearMoveOffset + 5] = linearMove.z;
|
|
18458
|
+
aLinearMoveArray[aLinearMoveOffset + 6] = linearMove.x;
|
|
18459
|
+
aLinearMoveArray[aLinearMoveOffset + 7] = linearMove.y;
|
|
18460
|
+
aLinearMoveArray[aLinearMoveOffset + 8] = linearMove.z;
|
|
18461
|
+
aLinearMoveArray[aLinearMoveOffset + 9] = linearMove.x;
|
|
18462
|
+
aLinearMoveArray[aLinearMoveOffset + 10] = linearMove.y;
|
|
18463
|
+
aLinearMoveArray[aLinearMoveOffset + 11] = linearMove.z;
|
|
18434
18464
|
}
|
|
18435
18465
|
}
|
|
18436
18466
|
this.geometry.setAttributeData("aLinearMove", aLinearMoveArray);
|
|
@@ -21183,6 +21213,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
21183
21213
|
var component = _step.value;
|
|
21184
21214
|
if (component.enabled && !component.isStartCalled) {
|
|
21185
21215
|
component.onStart();
|
|
21216
|
+
component.isStartCalled = true;
|
|
21186
21217
|
}
|
|
21187
21218
|
}
|
|
21188
21219
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.components), _step1; !(_step1 = _iterator1()).done;){
|
|
@@ -28105,7 +28136,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
28105
28136
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
28106
28137
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
28107
28138
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
28108
|
-
var version = "2.1.0-alpha.
|
|
28139
|
+
var version = "2.1.0-alpha.4";
|
|
28109
28140
|
logger.info("Core version: " + version + ".");
|
|
28110
28141
|
|
|
28111
28142
|
exports.AbstractPlugin = AbstractPlugin;
|