@galacean/effects-core 2.0.0-alpha.0 → 2.0.0-alpha.2
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/asset-loader.d.ts +13 -4
- package/dist/asset-manager.d.ts +8 -5
- package/dist/asset-migrations.d.ts +5 -0
- package/dist/components/effect-component.d.ts +1 -1
- package/dist/composition.d.ts +4 -4
- package/dist/index.js +1311 -1235
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1312 -1235
- package/dist/index.mjs.map +1 -1
- package/dist/math/utils.d.ts +0 -5
- package/dist/plugins/cal/calculate-item.d.ts +1 -1
- package/dist/scene.d.ts +2 -2
- package/dist/serialization-helper.d.ts +1 -0
- package/dist/ticker.d.ts +5 -0
- package/dist/transform.d.ts +3 -3
- package/dist/vfx-item.d.ts +1 -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.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.2
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/******************************************************************************
|
|
@@ -8193,7 +8193,7 @@ function loadMipmapImage(pointer, bins) {
|
|
|
8193
8193
|
});
|
|
8194
8194
|
}
|
|
8195
8195
|
|
|
8196
|
-
var seed$
|
|
8196
|
+
var seed$9 = 1;
|
|
8197
8197
|
/**
|
|
8198
8198
|
* Texture 抽象类
|
|
8199
8199
|
*/
|
|
@@ -8202,7 +8202,7 @@ var Texture = /** @class */ (function (_super) {
|
|
|
8202
8202
|
function Texture(engine) {
|
|
8203
8203
|
var _this = _super.call(this, engine) || this;
|
|
8204
8204
|
_this.destroyed = false;
|
|
8205
|
-
_this.id = 'Tex' + seed$
|
|
8205
|
+
_this.id = 'Tex' + seed$9++;
|
|
8206
8206
|
return _this;
|
|
8207
8207
|
}
|
|
8208
8208
|
Object.defineProperty(Texture.prototype, "isDestroyed", {
|
|
@@ -8604,7 +8604,7 @@ var MaterialRenderType;
|
|
|
8604
8604
|
* 用于设置材质默认名称的自增序号
|
|
8605
8605
|
* @internal
|
|
8606
8606
|
*/
|
|
8607
|
-
var seed$
|
|
8607
|
+
var seed$8 = 1;
|
|
8608
8608
|
/**
|
|
8609
8609
|
* Material 抽象类
|
|
8610
8610
|
*/
|
|
@@ -8619,7 +8619,7 @@ var Material = /** @class */ (function (_super) {
|
|
|
8619
8619
|
_this.destroyed = false;
|
|
8620
8620
|
_this.initialized = false;
|
|
8621
8621
|
if (props) {
|
|
8622
|
-
var _a = props.name, name_1 = _a === void 0 ? 'Material' + seed$
|
|
8622
|
+
var _a = props.name, name_1 = _a === void 0 ? 'Material' + seed$8++ : _a, _b = props.renderType, renderType = _b === void 0 ? MaterialRenderType.normal : _b, shader = props.shader, uniformSemantics = props.uniformSemantics;
|
|
8623
8623
|
_this.name = name_1;
|
|
8624
8624
|
_this.renderType = renderType; // TODO 没有地方用到
|
|
8625
8625
|
_this.shaderSource = shader;
|
|
@@ -8627,7 +8627,7 @@ var Material = /** @class */ (function (_super) {
|
|
|
8627
8627
|
_this.uniformSemantics = __assign$1({}, uniformSemantics); // TODO 废弃,待移除
|
|
8628
8628
|
}
|
|
8629
8629
|
else {
|
|
8630
|
-
_this.name = 'Material' + seed$
|
|
8630
|
+
_this.name = 'Material' + seed$8++;
|
|
8631
8631
|
_this.renderType = MaterialRenderType.normal;
|
|
8632
8632
|
}
|
|
8633
8633
|
return _this;
|
|
@@ -9052,7 +9052,7 @@ function generateEmptyTypedArray(type) {
|
|
|
9052
9052
|
return new Float32Array(0);
|
|
9053
9053
|
}
|
|
9054
9054
|
|
|
9055
|
-
var seed$
|
|
9055
|
+
var seed$7 = 1;
|
|
9056
9056
|
/**
|
|
9057
9057
|
* Mesh 抽象类
|
|
9058
9058
|
*/
|
|
@@ -9064,7 +9064,7 @@ var Mesh = /** @class */ (function (_super) {
|
|
|
9064
9064
|
_this.visible = true;
|
|
9065
9065
|
if (props) {
|
|
9066
9066
|
var material = props.material, geometry = props.geometry, _a = props.name, name_1 = _a === void 0 ? '<unnamed>' : _a, _b = props.priority, priority = _b === void 0 ? 0 : _b, _c = props.worldMatrix, worldMatrix = _c === void 0 ? Matrix4.fromIdentity() : _c;
|
|
9067
|
-
_this.id = 'Mesh' + seed$
|
|
9067
|
+
_this.id = 'Mesh' + seed$7++;
|
|
9068
9068
|
_this.name = name_1;
|
|
9069
9069
|
_this.geometry = geometry;
|
|
9070
9070
|
_this.material = material;
|
|
@@ -9072,7 +9072,7 @@ var Mesh = /** @class */ (function (_super) {
|
|
|
9072
9072
|
_this.worldMatrix = worldMatrix;
|
|
9073
9073
|
}
|
|
9074
9074
|
else {
|
|
9075
|
-
_this.id = 'Mesh' + seed$
|
|
9075
|
+
_this.id = 'Mesh' + seed$7++;
|
|
9076
9076
|
_this.name = '<unnamed>';
|
|
9077
9077
|
_this.worldMatrix = Matrix4.fromIdentity();
|
|
9078
9078
|
_this._priority = 0;
|
|
@@ -9292,7 +9292,7 @@ var RenderPassDestroyAttachmentType;
|
|
|
9292
9292
|
*/
|
|
9293
9293
|
RenderPassDestroyAttachmentType[RenderPassDestroyAttachmentType["destroy"] = 0] = "destroy";
|
|
9294
9294
|
})(RenderPassDestroyAttachmentType || (RenderPassDestroyAttachmentType = {}));
|
|
9295
|
-
var seed$
|
|
9295
|
+
var seed$6 = 1;
|
|
9296
9296
|
/**
|
|
9297
9297
|
* RenderPass 抽象类
|
|
9298
9298
|
*/
|
|
@@ -9304,7 +9304,7 @@ var RenderPass = /** @class */ (function () {
|
|
|
9304
9304
|
this.attachments = [];
|
|
9305
9305
|
this.destroyed = false;
|
|
9306
9306
|
this.initialized = false;
|
|
9307
|
-
var _a = options.name, name = _a === void 0 ? 'RenderPass_' + seed$
|
|
9307
|
+
var _a = options.name, name = _a === void 0 ? 'RenderPass_' + seed$6++ : _a, clearAction = options.clearAction, semantics = options.semantics, depthStencilAttachment = options.depthStencilAttachment, storeAction = options.storeAction, _b = options.priority, priority = _b === void 0 ? 0 : _b, _c = options.meshOrder, meshOrder = _c === void 0 ? OrderType.ascending : _c, _d = options.meshes, meshes = _d === void 0 ? [] : _d, _e = options.delegate, delegate = _e === void 0 ? {} : _e;
|
|
9308
9308
|
this.name = name;
|
|
9309
9309
|
this.renderer = renderer;
|
|
9310
9310
|
this.priority = priority;
|
|
@@ -9921,7 +9921,7 @@ var defaultGlobalVolume = {
|
|
|
9921
9921
|
};
|
|
9922
9922
|
|
|
9923
9923
|
var RENDER_PASS_NAME_PREFIX = '_effects_default_';
|
|
9924
|
-
var seed$
|
|
9924
|
+
var seed$5 = 1;
|
|
9925
9925
|
/**
|
|
9926
9926
|
* RenderFrame 抽象类
|
|
9927
9927
|
*/
|
|
@@ -10056,7 +10056,7 @@ var RenderFrame = /** @class */ (function () {
|
|
|
10056
10056
|
}
|
|
10057
10057
|
this.semantics = new SemanticMap(options.semantics);
|
|
10058
10058
|
this.clearAction = clearAction;
|
|
10059
|
-
this.name = "RenderFrame".concat(seed$
|
|
10059
|
+
this.name = "RenderFrame".concat(seed$5++);
|
|
10060
10060
|
var firstRP = renderPasses[0];
|
|
10061
10061
|
var sourceOpts = {
|
|
10062
10062
|
type: glContext.UNSIGNED_BYTE,
|
|
@@ -11279,6 +11279,12 @@ var SerializationHelper = /** @class */ (function () {
|
|
|
11279
11279
|
value.id &&
|
|
11280
11280
|
value.id.length === 32;
|
|
11281
11281
|
};
|
|
11282
|
+
// TODO 测试函数,2.0 上线后移除
|
|
11283
|
+
SerializationHelper.checkGLTFNode = function (value) {
|
|
11284
|
+
return value instanceof Object &&
|
|
11285
|
+
value.nodeIndex !== undefined &&
|
|
11286
|
+
value.isJoint !== undefined;
|
|
11287
|
+
};
|
|
11282
11288
|
SerializationHelper.deserializeProperty = function (property, engine, level) {
|
|
11283
11289
|
var e_11, _a, e_12, _b;
|
|
11284
11290
|
if (level > 10) {
|
|
@@ -11311,7 +11317,9 @@ var SerializationHelper = /** @class */ (function () {
|
|
|
11311
11317
|
else if (SerializationHelper.checkDataPath(property)) {
|
|
11312
11318
|
return engine.assetLoader.loadGUID(property.id);
|
|
11313
11319
|
}
|
|
11314
|
-
else if (property instanceof EffectsObject ||
|
|
11320
|
+
else if (property instanceof EffectsObject ||
|
|
11321
|
+
SerializationHelper.checkTypedArray(property) ||
|
|
11322
|
+
SerializationHelper.checkGLTFNode(property)) {
|
|
11315
11323
|
return property;
|
|
11316
11324
|
}
|
|
11317
11325
|
else if (property instanceof Object) {
|
|
@@ -11386,7 +11394,9 @@ var SerializationHelper = /** @class */ (function () {
|
|
|
11386
11394
|
res = _j.sent();
|
|
11387
11395
|
return [2 /*return*/, res];
|
|
11388
11396
|
case 12:
|
|
11389
|
-
if (!(property instanceof EffectsObject ||
|
|
11397
|
+
if (!(property instanceof EffectsObject ||
|
|
11398
|
+
SerializationHelper.checkTypedArray(property) ||
|
|
11399
|
+
SerializationHelper.checkGLTFNode(property))) return [3 /*break*/, 13];
|
|
11390
11400
|
return [2 /*return*/, property];
|
|
11391
11401
|
case 13:
|
|
11392
11402
|
if (!(property instanceof Object)) return [3 /*break*/, 22];
|
|
@@ -11874,20 +11884,6 @@ var particleOriginTranslateMap = (_a$3 = {},
|
|
|
11874
11884
|
_a$3[ParticleOrigin$1.PARTICLE_ORIGIN_RIGHT_BOTTOM] = [0.5, -0.5],
|
|
11875
11885
|
_a$3[ParticleOrigin$1.PARTICLE_ORIGIN_RIGHT_TOP] = [0.5, 0.5],
|
|
11876
11886
|
_a$3);
|
|
11877
|
-
/**
|
|
11878
|
-
* 提取并转换 JSON 数据中的 anchor 值
|
|
11879
|
-
*/
|
|
11880
|
-
function convertAnchor(anchor, particleOrigin) {
|
|
11881
|
-
if (anchor) {
|
|
11882
|
-
return [anchor[0] - 0.5, 0.5 - anchor[1]];
|
|
11883
|
-
}
|
|
11884
|
-
else if (particleOrigin) {
|
|
11885
|
-
return particleOriginTranslateMap[particleOrigin];
|
|
11886
|
-
}
|
|
11887
|
-
else {
|
|
11888
|
-
return [0, 0];
|
|
11889
|
-
}
|
|
11890
|
-
}
|
|
11891
11887
|
function nearestPowerOfTwo(value) {
|
|
11892
11888
|
return Math.pow(2, Math.round(Math.log(value) / Math.LN2));
|
|
11893
11889
|
}
|
|
@@ -12583,7 +12579,7 @@ function createKeyFrameMeta() {
|
|
|
12583
12579
|
}
|
|
12584
12580
|
|
|
12585
12581
|
var tempQuat$1 = new Quaternion();
|
|
12586
|
-
var seed$
|
|
12582
|
+
var seed$4 = 1;
|
|
12587
12583
|
// TODO 继承 Component
|
|
12588
12584
|
var Transform = /** @class */ (function () {
|
|
12589
12585
|
function Transform(props, parent) {
|
|
@@ -12646,7 +12642,7 @@ var Transform = /** @class */ (function () {
|
|
|
12646
12642
|
* 最终模型矩阵对应变换的缓存,当自身矩阵或父矩阵有修改时需要更新
|
|
12647
12643
|
*/
|
|
12648
12644
|
this.worldTRSCache = { position: new Vector3(0, 0, 0), quat: new Quaternion(0, 0, 0, 1), scale: new Vector3(1, 1, 1) };
|
|
12649
|
-
this.name = "transform_".concat(seed$
|
|
12645
|
+
this.name = "transform_".concat(seed$4++);
|
|
12650
12646
|
if (props) {
|
|
12651
12647
|
this.setTransform(props);
|
|
12652
12648
|
}
|
|
@@ -12826,13 +12822,11 @@ var Transform = /** @class */ (function () {
|
|
|
12826
12822
|
* 设置锚点
|
|
12827
12823
|
* @param x
|
|
12828
12824
|
* @param y
|
|
12829
|
-
* @param z
|
|
12830
12825
|
*/
|
|
12831
|
-
Transform.prototype.setAnchor = function (x, y
|
|
12832
|
-
if (this.anchor.x !== x || this.anchor.y !== y
|
|
12826
|
+
Transform.prototype.setAnchor = function (x, y) {
|
|
12827
|
+
if (this.anchor.x !== x || this.anchor.y !== y) {
|
|
12833
12828
|
this.anchor.x = x;
|
|
12834
12829
|
this.anchor.y = y;
|
|
12835
|
-
this.anchor.z = z;
|
|
12836
12830
|
this.dirtyFlags.localData = true;
|
|
12837
12831
|
this.dispatchValueChange();
|
|
12838
12832
|
}
|
|
@@ -12843,8 +12837,7 @@ var Transform = /** @class */ (function () {
|
|
|
12843
12837
|
* @param reverseEuler - 设置 rotation时,欧拉角是否需要取负值
|
|
12844
12838
|
*/
|
|
12845
12839
|
Transform.prototype.setTransform = function (props, reverseEuler) {
|
|
12846
|
-
var
|
|
12847
|
-
var position = props.position, rotation = props.rotation, scale = props.scale, quat = props.quat, name = props.name, anchor = props.anchor;
|
|
12840
|
+
var position = props.position, rotation = props.rotation, scale = props.scale, size = props.size, quat = props.quat, name = props.name, anchor = props.anchor;
|
|
12848
12841
|
if (name) {
|
|
12849
12842
|
this.name = name;
|
|
12850
12843
|
}
|
|
@@ -12881,12 +12874,15 @@ var Transform = /** @class */ (function () {
|
|
|
12881
12874
|
this.setScale(scale[0], scale[1], scale[2]);
|
|
12882
12875
|
}
|
|
12883
12876
|
}
|
|
12877
|
+
if (size) {
|
|
12878
|
+
this.setSize(size.x, size.y);
|
|
12879
|
+
}
|
|
12884
12880
|
if (anchor) {
|
|
12885
|
-
if (anchor instanceof
|
|
12886
|
-
this.setAnchor(anchor.x, anchor.y
|
|
12881
|
+
if (anchor instanceof Vector2) {
|
|
12882
|
+
this.setAnchor(anchor.x, anchor.y);
|
|
12887
12883
|
}
|
|
12888
12884
|
else {
|
|
12889
|
-
this.setAnchor(anchor[0], anchor[1]
|
|
12885
|
+
this.setAnchor(anchor[0], anchor[1]);
|
|
12890
12886
|
}
|
|
12891
12887
|
}
|
|
12892
12888
|
};
|
|
@@ -13380,7 +13376,7 @@ var HELP_LINK = {
|
|
|
13380
13376
|
|
|
13381
13377
|
var vertex = "\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n#ifdef ENV_EDITOR\n uniform vec4 uEditorTransform;\n#endif\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n #ifdef ENV_EDITOR\n gl_Position = vec4(gl_Position.xy * uEditorTransform.xy + uEditorTransform.zw * gl_Position.w, gl_Position.zw);\n #endif\n}\n";
|
|
13382
13378
|
var fragment = "\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor;\n}\n";
|
|
13383
|
-
var seed$
|
|
13379
|
+
var seed$3 = 1;
|
|
13384
13380
|
var InteractMesh = /** @class */ (function () {
|
|
13385
13381
|
function InteractMesh(props, rendererOptions, transform, engine) {
|
|
13386
13382
|
this.transform = transform;
|
|
@@ -13458,7 +13454,7 @@ var InteractMesh = /** @class */ (function () {
|
|
|
13458
13454
|
};
|
|
13459
13455
|
InteractMesh.prototype.createMesh = function (geometry, material) {
|
|
13460
13456
|
return Mesh.create(this.engine, {
|
|
13461
|
-
name: 'Interact_preview' + seed$
|
|
13457
|
+
name: 'Interact_preview' + seed$3++,
|
|
13462
13458
|
priority: 0,
|
|
13463
13459
|
worldMatrix: Matrix4.fromIdentity(),
|
|
13464
13460
|
geometry: geometry,
|
|
@@ -13943,783 +13939,1019 @@ var PlayableOutput = /** @class */ (function () {
|
|
|
13943
13939
|
* @since 2.0.0
|
|
13944
13940
|
* @internal
|
|
13945
13941
|
*/
|
|
13946
|
-
var
|
|
13947
|
-
|
|
13948
|
-
|
|
13949
|
-
|
|
13950
|
-
_this.reusable = false;
|
|
13951
|
-
_this.timelineStarted = false;
|
|
13952
|
-
_this.playableGraph = new PlayableGraph();
|
|
13953
|
-
/**
|
|
13954
|
-
* 元素动画已经播放的时间
|
|
13955
|
-
*/
|
|
13956
|
-
_this.time = 0;
|
|
13957
|
-
_this.tracks = [];
|
|
13958
|
-
_this.trackSeed = 0;
|
|
13959
|
-
return _this;
|
|
13942
|
+
var Track = /** @class */ (function () {
|
|
13943
|
+
function Track() {
|
|
13944
|
+
this.clips = [];
|
|
13945
|
+
this.clipSeed = 0;
|
|
13960
13946
|
}
|
|
13961
|
-
|
|
13962
|
-
var
|
|
13947
|
+
Track.prototype.createOutput = function () {
|
|
13948
|
+
var output = new PlayableOutput();
|
|
13949
|
+
return output;
|
|
13950
|
+
};
|
|
13951
|
+
/**
|
|
13952
|
+
* 重写该方法以创建自定义混合器
|
|
13953
|
+
*/
|
|
13954
|
+
Track.prototype.createMixerPlayable = function () {
|
|
13955
|
+
return new Playable();
|
|
13956
|
+
};
|
|
13957
|
+
Track.prototype.createPlayebleTree = function () {
|
|
13958
|
+
var e_1, _a;
|
|
13959
|
+
var defaultMixPlayable = this.createMixerPlayable();
|
|
13963
13960
|
try {
|
|
13964
|
-
|
|
13965
|
-
|
|
13966
|
-
|
|
13967
|
-
try {
|
|
13968
|
-
for (var _e = (e_2 = void 0, __values$1(track.getClips())), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
13969
|
-
var clip = _f.value;
|
|
13970
|
-
clip.start = this.item.start;
|
|
13971
|
-
clip.duration = this.item.duration;
|
|
13972
|
-
}
|
|
13973
|
-
}
|
|
13974
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
13975
|
-
finally {
|
|
13976
|
-
try {
|
|
13977
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
13978
|
-
}
|
|
13979
|
-
finally { if (e_2) throw e_2.error; }
|
|
13980
|
-
}
|
|
13961
|
+
for (var _b = __values$1(this.clips), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
13962
|
+
var clip = _c.value;
|
|
13963
|
+
defaultMixPlayable.connect(clip.playable);
|
|
13981
13964
|
}
|
|
13982
13965
|
}
|
|
13983
13966
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
13984
13967
|
finally {
|
|
13985
13968
|
try {
|
|
13986
|
-
if (
|
|
13969
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
13987
13970
|
}
|
|
13988
13971
|
finally { if (e_1) throw e_1.error; }
|
|
13989
13972
|
}
|
|
13990
|
-
|
|
13973
|
+
return defaultMixPlayable;
|
|
13991
13974
|
};
|
|
13992
|
-
|
|
13993
|
-
|
|
13994
|
-
|
|
13995
|
-
|
|
13996
|
-
|
|
13997
|
-
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
|
|
14002
|
-
|
|
14003
|
-
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
|
|
14007
|
-
|
|
14008
|
-
|
|
14009
|
-
finally {
|
|
14010
|
-
try {
|
|
14011
|
-
if (_m && !_m.done && (_b = _l.return)) _b.call(_l);
|
|
14012
|
-
}
|
|
14013
|
-
finally { if (e_4) throw e_4.error; }
|
|
14014
|
-
}
|
|
14015
|
-
}
|
|
14016
|
-
}
|
|
14017
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
14018
|
-
finally {
|
|
14019
|
-
try {
|
|
14020
|
-
if (_k && !_k.done && (_a = _j.return)) _a.call(_j);
|
|
13975
|
+
Track.prototype.createClip = function (classConstructor, name) {
|
|
13976
|
+
var newClip = new TimelineClip();
|
|
13977
|
+
newClip.playable = new classConstructor();
|
|
13978
|
+
newClip.name = name ? name : 'TimelineClip' + newClip.id;
|
|
13979
|
+
this.addClip(newClip);
|
|
13980
|
+
return newClip;
|
|
13981
|
+
};
|
|
13982
|
+
Track.prototype.getClips = function () {
|
|
13983
|
+
return this.clips;
|
|
13984
|
+
};
|
|
13985
|
+
Track.prototype.findClip = function (name) {
|
|
13986
|
+
var e_2, _a;
|
|
13987
|
+
try {
|
|
13988
|
+
for (var _b = __values$1(this.clips), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
13989
|
+
var clip = _c.value;
|
|
13990
|
+
if (clip.name === name) {
|
|
13991
|
+
return clip;
|
|
14021
13992
|
}
|
|
14022
|
-
finally { if (e_3) throw e_3.error; }
|
|
14023
13993
|
}
|
|
14024
|
-
this.timelineStarted = true;
|
|
14025
13994
|
}
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
if (this.item.delaying && now >= 0 && now <= this.item.duration) {
|
|
14029
|
-
this.item.delaying = false;
|
|
13995
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
13996
|
+
finally {
|
|
14030
13997
|
try {
|
|
14031
|
-
|
|
14032
|
-
var track = _p.value;
|
|
14033
|
-
try {
|
|
14034
|
-
for (var _q = (e_6 = void 0, __values$1(track.getClips())), _r = _q.next(); !_r.done; _r = _q.next()) {
|
|
14035
|
-
var clip = _r.value;
|
|
14036
|
-
clip.playable.onPlayablePlay();
|
|
14037
|
-
}
|
|
14038
|
-
}
|
|
14039
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
14040
|
-
finally {
|
|
14041
|
-
try {
|
|
14042
|
-
if (_r && !_r.done && (_d = _q.return)) _d.call(_q);
|
|
14043
|
-
}
|
|
14044
|
-
finally { if (e_6) throw e_6.error; }
|
|
14045
|
-
}
|
|
14046
|
-
}
|
|
14047
|
-
}
|
|
14048
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
14049
|
-
finally {
|
|
14050
|
-
try {
|
|
14051
|
-
if (_p && !_p.done && (_c = _o.return)) _c.call(_o);
|
|
14052
|
-
}
|
|
14053
|
-
finally { if (e_5) throw e_5.error; }
|
|
13998
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
14054
13999
|
}
|
|
14000
|
+
finally { if (e_2) throw e_2.error; }
|
|
14055
14001
|
}
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
|
|
14002
|
+
};
|
|
14003
|
+
Track.prototype.addClip = function (clip) {
|
|
14004
|
+
clip.playable.bindingItem = this.bindingItem;
|
|
14005
|
+
clip.id = (this.clipSeed++).toString();
|
|
14006
|
+
this.clips.push(clip);
|
|
14007
|
+
};
|
|
14008
|
+
return Track;
|
|
14009
|
+
}());
|
|
14010
|
+
/**
|
|
14011
|
+
* @since 2.0.0
|
|
14012
|
+
* @internal
|
|
14013
|
+
*/
|
|
14014
|
+
var TimelineClip = /** @class */ (function () {
|
|
14015
|
+
function TimelineClip() {
|
|
14016
|
+
this.start = 0;
|
|
14017
|
+
this.duration = 0;
|
|
14018
|
+
}
|
|
14019
|
+
return TimelineClip;
|
|
14020
|
+
}());
|
|
14021
|
+
|
|
14022
|
+
var AnimationStream = /** @class */ (function () {
|
|
14023
|
+
function AnimationStream(playable) {
|
|
14024
|
+
this.curveValues = {};
|
|
14025
|
+
this.playable = playable;
|
|
14026
|
+
}
|
|
14027
|
+
AnimationStream.prototype.setCurveValue = function (componentType, propertyName, value) {
|
|
14028
|
+
if (!this.findCurveValue(componentType, propertyName)) {
|
|
14029
|
+
this.curveValues[componentType + propertyName] = { componentType: componentType, propertyName: propertyName, value: value };
|
|
14060
14030
|
}
|
|
14061
14031
|
else {
|
|
14062
|
-
|
|
14032
|
+
this.curveValues[componentType + propertyName].value = value;
|
|
14063
14033
|
}
|
|
14064
|
-
|
|
14065
|
-
|
|
14066
|
-
|
|
14067
|
-
|
|
14068
|
-
|
|
14069
|
-
|
|
14070
|
-
|
|
14071
|
-
|
|
14072
|
-
|
|
14073
|
-
try {
|
|
14074
|
-
for (var _u = (e_8 = void 0, __values$1(track.getClips())), _v = _u.next(); !_v.done; _v = _u.next()) {
|
|
14075
|
-
var clip = _v.value;
|
|
14076
|
-
clip.playable.onPlayableDestroy();
|
|
14077
|
-
}
|
|
14078
|
-
}
|
|
14079
|
-
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
14080
|
-
finally {
|
|
14081
|
-
try {
|
|
14082
|
-
if (_v && !_v.done && (_f = _u.return)) _f.call(_u);
|
|
14083
|
-
}
|
|
14084
|
-
finally { if (e_8) throw e_8.error; }
|
|
14085
|
-
}
|
|
14086
|
-
}
|
|
14087
|
-
}
|
|
14088
|
-
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
14089
|
-
finally {
|
|
14090
|
-
try {
|
|
14091
|
-
if (_t && !_t.done && (_e = _s.return)) _e.call(_s);
|
|
14092
|
-
}
|
|
14093
|
-
finally { if (e_7) throw e_7.error; }
|
|
14094
|
-
}
|
|
14095
|
-
this.item.delaying = true;
|
|
14096
|
-
if (!this.item.reusable && !this.reusable) {
|
|
14097
|
-
this.item.dispose();
|
|
14098
|
-
return;
|
|
14099
|
-
}
|
|
14100
|
-
}
|
|
14101
|
-
}
|
|
14034
|
+
return this.curveValues[componentType + propertyName];
|
|
14035
|
+
};
|
|
14036
|
+
AnimationStream.prototype.findCurveValue = function (componentType, propertyName) {
|
|
14037
|
+
return this.curveValues[componentType + propertyName];
|
|
14038
|
+
};
|
|
14039
|
+
AnimationStream.prototype.getInputStream = function (index) {
|
|
14040
|
+
var inputPlayable = this.playable.getInput(index);
|
|
14041
|
+
if (inputPlayable instanceof AnimationPlayable) {
|
|
14042
|
+
return inputPlayable.animationStream;
|
|
14102
14043
|
}
|
|
14103
|
-
|
|
14104
|
-
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
|
|
14108
|
-
|
|
14109
|
-
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
|
|
14121
|
-
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
|
|
14044
|
+
};
|
|
14045
|
+
return AnimationStream;
|
|
14046
|
+
}());
|
|
14047
|
+
|
|
14048
|
+
var AnimationPlayable = /** @class */ (function (_super) {
|
|
14049
|
+
__extends(AnimationPlayable, _super);
|
|
14050
|
+
function AnimationPlayable() {
|
|
14051
|
+
var _this = _super.call(this) || this;
|
|
14052
|
+
_this.animationStream = new AnimationStream(_this);
|
|
14053
|
+
return _this;
|
|
14054
|
+
}
|
|
14055
|
+
return AnimationPlayable;
|
|
14056
|
+
}(Playable));
|
|
14057
|
+
|
|
14058
|
+
var tempRot$1 = new Euler();
|
|
14059
|
+
var tempSize$1 = new Vector3(1, 1, 1);
|
|
14060
|
+
var tempPos = new Vector3();
|
|
14061
|
+
/**
|
|
14062
|
+
* @since 2.0.0
|
|
14063
|
+
* @internal
|
|
14064
|
+
*/
|
|
14065
|
+
var AnimationClipPlayable = /** @class */ (function (_super) {
|
|
14066
|
+
__extends(AnimationClipPlayable, _super);
|
|
14067
|
+
function AnimationClipPlayable() {
|
|
14068
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
14069
|
+
}
|
|
14070
|
+
AnimationClipPlayable.prototype.processFrame = function (dt) {
|
|
14071
|
+
if (this.bindingItem.composition) {
|
|
14072
|
+
this.sampleAnimation();
|
|
14073
|
+
}
|
|
14074
|
+
};
|
|
14075
|
+
/**
|
|
14076
|
+
* 应用时间轴K帧数据到对象
|
|
14077
|
+
*/
|
|
14078
|
+
AnimationClipPlayable.prototype.sampleAnimation = function () {
|
|
14079
|
+
var _this = this;
|
|
14080
|
+
var duration = this.bindingItem.duration;
|
|
14081
|
+
var life = this.time / duration;
|
|
14082
|
+
life = life < 0 ? 0 : (life > 1 ? 1 : life);
|
|
14083
|
+
if (this.sizeXOverLifetime) {
|
|
14084
|
+
tempSize$1.x = this.sizeXOverLifetime.getValue(life);
|
|
14085
|
+
if (this.sizeSeparateAxes) {
|
|
14086
|
+
tempSize$1.y = this.sizeYOverLifetime.getValue(life);
|
|
14087
|
+
tempSize$1.z = this.sizeZOverLifetime.getValue(life);
|
|
14125
14088
|
}
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
try {
|
|
14129
|
-
if (_x && !_x.done && (_g = _w.return)) _g.call(_w);
|
|
14130
|
-
}
|
|
14131
|
-
finally { if (e_9) throw e_9.error; }
|
|
14089
|
+
else {
|
|
14090
|
+
tempSize$1.z = tempSize$1.y = tempSize$1.x;
|
|
14132
14091
|
}
|
|
14133
|
-
this.
|
|
14092
|
+
var startSize = this.originalTransform.scale;
|
|
14093
|
+
this.bindingItem.transform.setScale(tempSize$1.x * startSize.x, tempSize$1.y * startSize.y, tempSize$1.z * startSize.z);
|
|
14094
|
+
// this.animationStream.setCurveValue('transform', 'scale.x', tempSize.x * startSize.x);
|
|
14095
|
+
// this.animationStream.setCurveValue('transform', 'scale.y', tempSize.y * startSize.y);
|
|
14096
|
+
// this.animationStream.setCurveValue('transform', 'scale.z', tempSize.z * startSize.z);
|
|
14097
|
+
}
|
|
14098
|
+
if (this.rotationOverLifetime) {
|
|
14099
|
+
var func = function (v) { return _this.rotationOverLifetime.asRotation ? v.getValue(life) : v.getIntegrateValue(0, life, duration); };
|
|
14100
|
+
var incZ = func(this.rotationOverLifetime.z);
|
|
14101
|
+
var separateAxes = this.rotationOverLifetime.separateAxes;
|
|
14102
|
+
tempRot$1.x = separateAxes ? func(this.rotationOverLifetime.x) : 0;
|
|
14103
|
+
tempRot$1.y = separateAxes ? func(this.rotationOverLifetime.y) : 0;
|
|
14104
|
+
tempRot$1.z = incZ;
|
|
14105
|
+
var rot = tempRot$1.addEulers(this.originalTransform.rotation, tempRot$1);
|
|
14106
|
+
this.bindingItem.transform.setRotation(rot.x, rot.y, rot.z);
|
|
14107
|
+
// this.animationStream.setCurveValue('transform', 'rotation.x', rot.x);
|
|
14108
|
+
// this.animationStream.setCurveValue('transform', 'rotation.y', rot.y);
|
|
14109
|
+
// this.animationStream.setCurveValue('transform', 'rotation.z', rot.z);
|
|
14110
|
+
}
|
|
14111
|
+
if (this.positionOverLifetime) {
|
|
14112
|
+
var pos = tempPos;
|
|
14113
|
+
calculateTranslation(pos, this, this.gravity, this.time, duration, this.originalTransform.position, this.velocity);
|
|
14114
|
+
if (this.originalTransform.path) {
|
|
14115
|
+
pos.add(this.originalTransform.path.getValue(life));
|
|
14116
|
+
}
|
|
14117
|
+
this.bindingItem.transform.setPosition(pos.x, pos.y, pos.z);
|
|
14118
|
+
// this.animationStream.setCurveValue('transform', 'position.x', pos.x);
|
|
14119
|
+
// this.animationStream.setCurveValue('transform', 'position.y', pos.y);
|
|
14120
|
+
// this.animationStream.setCurveValue('transform', 'position.z', pos.z);
|
|
14134
14121
|
}
|
|
14135
14122
|
};
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
var
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14123
|
+
AnimationClipPlayable.prototype.fromData = function (data) {
|
|
14124
|
+
var _a;
|
|
14125
|
+
var scale = this.bindingItem.transform.scale;
|
|
14126
|
+
this.originalTransform = {
|
|
14127
|
+
position: this.bindingItem.transform.position.clone(),
|
|
14128
|
+
rotation: this.bindingItem.transform.getRotation().clone(),
|
|
14129
|
+
// TODO 编辑器 scale 没有z轴控制
|
|
14130
|
+
scale: new Vector3(scale.x, scale.y, scale.x),
|
|
14131
|
+
};
|
|
14132
|
+
var positionOverLifetime = data.positionOverLifetime;
|
|
14133
|
+
var rotationOverLifetime = data.rotationOverLifetime;
|
|
14134
|
+
var sizeOverLifetime = data.sizeOverLifetime;
|
|
14135
|
+
// TODO: 没有 K 帧数据的不需要传 positionOverLifetime 空对象
|
|
14136
|
+
if (positionOverLifetime && Object.keys(positionOverLifetime).length !== 0) {
|
|
14137
|
+
this.positionOverLifetime = positionOverLifetime;
|
|
14138
|
+
if (positionOverLifetime.path) {
|
|
14139
|
+
this.originalTransform.path = createValueGetter(positionOverLifetime.path);
|
|
14149
14140
|
}
|
|
14150
|
-
|
|
14151
|
-
|
|
14141
|
+
var linearVelEnable = positionOverLifetime.linearX || positionOverLifetime.linearY || positionOverLifetime.linearZ;
|
|
14142
|
+
if (linearVelEnable) {
|
|
14143
|
+
this.linearVelOverLifetime = {
|
|
14144
|
+
x: positionOverLifetime.linearX && createValueGetter(positionOverLifetime.linearX),
|
|
14145
|
+
y: positionOverLifetime.linearY && createValueGetter(positionOverLifetime.linearY),
|
|
14146
|
+
z: positionOverLifetime.linearZ && createValueGetter(positionOverLifetime.linearZ),
|
|
14147
|
+
asMovement: positionOverLifetime.asMovement,
|
|
14148
|
+
enabled: !!linearVelEnable,
|
|
14149
|
+
};
|
|
14150
|
+
}
|
|
14151
|
+
var orbitalVelEnable = positionOverLifetime.orbitalX || positionOverLifetime.orbitalY || positionOverLifetime.orbitalZ;
|
|
14152
|
+
if (orbitalVelEnable) {
|
|
14153
|
+
this.orbitalVelOverLifetime = {
|
|
14154
|
+
x: positionOverLifetime.orbitalX && createValueGetter(positionOverLifetime.orbitalX),
|
|
14155
|
+
y: positionOverLifetime.orbitalY && createValueGetter(positionOverLifetime.orbitalY),
|
|
14156
|
+
z: positionOverLifetime.orbitalZ && createValueGetter(positionOverLifetime.orbitalZ),
|
|
14157
|
+
center: ensureVec3(positionOverLifetime.orbCenter),
|
|
14158
|
+
asRotation: positionOverLifetime.asRotation,
|
|
14159
|
+
enabled: !!orbitalVelEnable,
|
|
14160
|
+
};
|
|
14152
14161
|
}
|
|
14162
|
+
this.speedOverLifetime = positionOverLifetime.speedOverLifetime && createValueGetter(positionOverLifetime.speedOverLifetime);
|
|
14153
14163
|
}
|
|
14154
|
-
|
|
14164
|
+
if (sizeOverLifetime) {
|
|
14165
|
+
if (sizeOverLifetime.separateAxes) {
|
|
14166
|
+
this.sizeSeparateAxes = true;
|
|
14167
|
+
this.sizeXOverLifetime = createValueGetter(sizeOverLifetime.x || 1);
|
|
14168
|
+
this.sizeYOverLifetime = createValueGetter(sizeOverLifetime.y || 1);
|
|
14169
|
+
this.sizeZOverLifetime = createValueGetter(sizeOverLifetime.z || 1);
|
|
14170
|
+
}
|
|
14171
|
+
else {
|
|
14172
|
+
this.sizeXOverLifetime = createValueGetter(sizeOverLifetime.size || 1);
|
|
14173
|
+
}
|
|
14174
|
+
}
|
|
14175
|
+
if (rotationOverLifetime) {
|
|
14176
|
+
this.rotationOverLifetime = {
|
|
14177
|
+
asRotation: rotationOverLifetime.asRotation,
|
|
14178
|
+
separateAxes: rotationOverLifetime.separateAxes,
|
|
14179
|
+
z: createValueGetter(rotationOverLifetime.z || 0),
|
|
14180
|
+
};
|
|
14181
|
+
if (rotationOverLifetime.separateAxes) {
|
|
14182
|
+
var rotLt = this.rotationOverLifetime;
|
|
14183
|
+
rotLt.x = createValueGetter(rotationOverLifetime.x || 0);
|
|
14184
|
+
rotLt.y = createValueGetter(rotationOverLifetime.y || 0);
|
|
14185
|
+
}
|
|
14186
|
+
}
|
|
14187
|
+
this.gravity = Vector3.fromArray((positionOverLifetime === null || positionOverLifetime === void 0 ? void 0 : positionOverLifetime.gravity) || []);
|
|
14188
|
+
this.gravityModifier = createValueGetter((_a = positionOverLifetime === null || positionOverLifetime === void 0 ? void 0 : positionOverLifetime.gravityOverLifetime) !== null && _a !== void 0 ? _a : 0);
|
|
14189
|
+
this.direction = (positionOverLifetime === null || positionOverLifetime === void 0 ? void 0 : positionOverLifetime.direction) ? Vector3.fromArray(positionOverLifetime.direction).normalize() : new Vector3();
|
|
14190
|
+
this.startSpeed = (positionOverLifetime === null || positionOverLifetime === void 0 ? void 0 : positionOverLifetime.startSpeed) || 0;
|
|
14191
|
+
this.velocity = this.direction.clone();
|
|
14192
|
+
this.velocity.multiply(this.startSpeed);
|
|
14155
14193
|
};
|
|
14156
|
-
|
|
14157
|
-
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14194
|
+
return AnimationClipPlayable;
|
|
14195
|
+
}(AnimationPlayable));
|
|
14196
|
+
/**
|
|
14197
|
+
* @since 2.0.0
|
|
14198
|
+
* @internal
|
|
14199
|
+
*/
|
|
14200
|
+
var ActivationClipPlayable = /** @class */ (function (_super) {
|
|
14201
|
+
__extends(ActivationClipPlayable, _super);
|
|
14202
|
+
function ActivationClipPlayable() {
|
|
14203
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
14204
|
+
}
|
|
14205
|
+
ActivationClipPlayable.prototype.onGraphStart = function () {
|
|
14206
|
+
this.bindingItem.transform.setValid(false);
|
|
14207
|
+
this.hideRendererComponents();
|
|
14163
14208
|
};
|
|
14164
|
-
|
|
14165
|
-
|
|
14209
|
+
ActivationClipPlayable.prototype.onPlayablePlay = function () {
|
|
14210
|
+
this.bindingItem.transform.setValid(true);
|
|
14211
|
+
this.showRendererComponents();
|
|
14166
14212
|
};
|
|
14167
|
-
|
|
14168
|
-
|
|
14213
|
+
ActivationClipPlayable.prototype.onPlayableDestroy = function () {
|
|
14214
|
+
this.bindingItem.transform.setValid(false);
|
|
14215
|
+
this.hideRendererComponents();
|
|
14216
|
+
};
|
|
14217
|
+
ActivationClipPlayable.prototype.hideRendererComponents = function () {
|
|
14218
|
+
var e_1, _a;
|
|
14169
14219
|
try {
|
|
14170
|
-
for (var _b = __values$1(this.
|
|
14171
|
-
var
|
|
14172
|
-
if (
|
|
14173
|
-
|
|
14220
|
+
for (var _b = __values$1(this.bindingItem.rendererComponents), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
14221
|
+
var rendererComponent = _c.value;
|
|
14222
|
+
if (rendererComponent.enabled) {
|
|
14223
|
+
rendererComponent.enabled = false;
|
|
14174
14224
|
}
|
|
14175
14225
|
}
|
|
14176
14226
|
}
|
|
14177
|
-
catch (
|
|
14227
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
14178
14228
|
finally {
|
|
14179
14229
|
try {
|
|
14180
14230
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
14181
14231
|
}
|
|
14182
|
-
finally { if (
|
|
14232
|
+
finally { if (e_1) throw e_1.error; }
|
|
14183
14233
|
}
|
|
14184
14234
|
};
|
|
14185
|
-
|
|
14186
|
-
|
|
14187
|
-
this.compileTracks(this.playableGraph);
|
|
14188
|
-
};
|
|
14189
|
-
TimelineComponent.prototype.compileTracks = function (graph) {
|
|
14190
|
-
var e_12, _a;
|
|
14235
|
+
ActivationClipPlayable.prototype.showRendererComponents = function () {
|
|
14236
|
+
var e_2, _a;
|
|
14191
14237
|
try {
|
|
14192
|
-
for (var _b = __values$1(this.
|
|
14193
|
-
var
|
|
14194
|
-
|
|
14195
|
-
|
|
14196
|
-
|
|
14197
|
-
trackOutput.setSourcePlayeble(trackMixPlayable);
|
|
14238
|
+
for (var _b = __values$1(this.bindingItem.rendererComponents), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
14239
|
+
var rendererComponent = _c.value;
|
|
14240
|
+
if (!rendererComponent.enabled) {
|
|
14241
|
+
rendererComponent.enabled = true;
|
|
14242
|
+
}
|
|
14198
14243
|
}
|
|
14199
14244
|
}
|
|
14200
|
-
catch (
|
|
14245
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
14201
14246
|
finally {
|
|
14202
14247
|
try {
|
|
14203
14248
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
14204
14249
|
}
|
|
14205
|
-
finally { if (
|
|
14250
|
+
finally { if (e_2) throw e_2.error; }
|
|
14206
14251
|
}
|
|
14207
14252
|
};
|
|
14208
|
-
|
|
14209
|
-
|
|
14210
|
-
this.options = {
|
|
14211
|
-
start: this.item.start,
|
|
14212
|
-
duration: this.item.duration,
|
|
14213
|
-
looping: this.item.endBehavior === END_BEHAVIOR_RESTART$1,
|
|
14214
|
-
endBehavior: this.item.endBehavior || END_BEHAVIOR_DESTROY$1,
|
|
14215
|
-
};
|
|
14216
|
-
this.id = this.item.id;
|
|
14217
|
-
this.name = this.item.name;
|
|
14218
|
-
};
|
|
14219
|
-
TimelineComponent.prototype.toData = function () {
|
|
14220
|
-
_super.prototype.toData.call(this);
|
|
14221
|
-
};
|
|
14222
|
-
__decorate([
|
|
14223
|
-
serialize()
|
|
14224
|
-
], TimelineComponent.prototype, "time", void 0);
|
|
14225
|
-
return TimelineComponent;
|
|
14226
|
-
}(ItemBehaviour));
|
|
14253
|
+
return ActivationClipPlayable;
|
|
14254
|
+
}(Playable));
|
|
14227
14255
|
|
|
14228
14256
|
/**
|
|
14229
14257
|
* @since 2.0.0
|
|
14230
14258
|
* @internal
|
|
14231
14259
|
*/
|
|
14232
|
-
var
|
|
14233
|
-
|
|
14234
|
-
|
|
14235
|
-
|
|
14260
|
+
var TimelineComponent = /** @class */ (function (_super) {
|
|
14261
|
+
__extends(TimelineComponent, _super);
|
|
14262
|
+
function TimelineComponent(engine) {
|
|
14263
|
+
var _this = _super.call(this, engine) || this;
|
|
14264
|
+
_this.reusable = false;
|
|
14265
|
+
_this.timelineStarted = false;
|
|
14266
|
+
_this.playableGraph = new PlayableGraph();
|
|
14267
|
+
/**
|
|
14268
|
+
* 元素动画已经播放的时间
|
|
14269
|
+
*/
|
|
14270
|
+
_this.time = 0;
|
|
14271
|
+
_this.tracks = [];
|
|
14272
|
+
_this.trackSeed = 0;
|
|
14273
|
+
return _this;
|
|
14236
14274
|
}
|
|
14237
|
-
|
|
14238
|
-
var
|
|
14239
|
-
return output;
|
|
14240
|
-
};
|
|
14241
|
-
/**
|
|
14242
|
-
* 重写该方法以创建自定义混合器
|
|
14243
|
-
*/
|
|
14244
|
-
Track.prototype.createMixerPlayable = function () {
|
|
14245
|
-
return new Playable();
|
|
14246
|
-
};
|
|
14247
|
-
Track.prototype.createPlayebleTree = function () {
|
|
14248
|
-
var e_1, _a;
|
|
14249
|
-
var defaultMixPlayable = this.createMixerPlayable();
|
|
14275
|
+
TimelineComponent.prototype.start = function () {
|
|
14276
|
+
var e_1, _a, e_2, _b;
|
|
14250
14277
|
try {
|
|
14251
|
-
|
|
14252
|
-
|
|
14253
|
-
|
|
14278
|
+
// TODO TimelineClip 需要传入 start 和 duration 数据
|
|
14279
|
+
for (var _c = __values$1(this.tracks), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
14280
|
+
var track = _d.value;
|
|
14281
|
+
try {
|
|
14282
|
+
for (var _e = (e_2 = void 0, __values$1(track.getClips())), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
14283
|
+
var clip = _f.value;
|
|
14284
|
+
clip.start = this.item.start;
|
|
14285
|
+
clip.duration = this.item.duration;
|
|
14286
|
+
}
|
|
14287
|
+
}
|
|
14288
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
14289
|
+
finally {
|
|
14290
|
+
try {
|
|
14291
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
14292
|
+
}
|
|
14293
|
+
finally { if (e_2) throw e_2.error; }
|
|
14294
|
+
}
|
|
14254
14295
|
}
|
|
14255
14296
|
}
|
|
14256
14297
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
14257
14298
|
finally {
|
|
14258
14299
|
try {
|
|
14259
|
-
if (
|
|
14300
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
14260
14301
|
}
|
|
14261
14302
|
finally { if (e_1) throw e_1.error; }
|
|
14262
14303
|
}
|
|
14263
|
-
|
|
14264
|
-
};
|
|
14265
|
-
Track.prototype.createClip = function (classConstructor, name) {
|
|
14266
|
-
var newClip = new TimelineClip();
|
|
14267
|
-
newClip.playable = new classConstructor();
|
|
14268
|
-
newClip.name = name ? name : 'TimelineClip' + newClip.id;
|
|
14269
|
-
this.addClip(newClip);
|
|
14270
|
-
return newClip;
|
|
14271
|
-
};
|
|
14272
|
-
Track.prototype.getClips = function () {
|
|
14273
|
-
return this.clips;
|
|
14304
|
+
this.compileTracks(this.playableGraph);
|
|
14274
14305
|
};
|
|
14275
|
-
|
|
14276
|
-
|
|
14277
|
-
|
|
14278
|
-
|
|
14279
|
-
|
|
14280
|
-
if (clip.name === name) {
|
|
14281
|
-
return clip;
|
|
14282
|
-
}
|
|
14283
|
-
}
|
|
14306
|
+
// TODO: [1.31] @十弦 vfx-item 下 onUpdate 的改动验证
|
|
14307
|
+
TimelineComponent.prototype.update = function (dt) {
|
|
14308
|
+
var e_3, _a, e_4, _b, e_5, _c, e_6, _d, e_7, _e, e_8, _f, e_9, _g, e_10, _h;
|
|
14309
|
+
if (this.item.stopped || !this.item.composition) {
|
|
14310
|
+
return;
|
|
14284
14311
|
}
|
|
14285
|
-
|
|
14286
|
-
finally {
|
|
14312
|
+
if (!this.timelineStarted) {
|
|
14287
14313
|
try {
|
|
14288
|
-
|
|
14314
|
+
for (var _j = __values$1(this.tracks), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
14315
|
+
var track = _k.value;
|
|
14316
|
+
try {
|
|
14317
|
+
for (var _l = (e_4 = void 0, __values$1(track.getClips())), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
14318
|
+
var clip = _m.value;
|
|
14319
|
+
clip.playable.onGraphStart();
|
|
14320
|
+
}
|
|
14321
|
+
}
|
|
14322
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
14323
|
+
finally {
|
|
14324
|
+
try {
|
|
14325
|
+
if (_m && !_m.done && (_b = _l.return)) _b.call(_l);
|
|
14326
|
+
}
|
|
14327
|
+
finally { if (e_4) throw e_4.error; }
|
|
14328
|
+
}
|
|
14329
|
+
}
|
|
14289
14330
|
}
|
|
14290
|
-
|
|
14291
|
-
|
|
14292
|
-
|
|
14293
|
-
|
|
14294
|
-
|
|
14295
|
-
|
|
14296
|
-
this.clips.push(clip);
|
|
14297
|
-
};
|
|
14298
|
-
return Track;
|
|
14299
|
-
}());
|
|
14300
|
-
/**
|
|
14301
|
-
* @since 2.0.0
|
|
14302
|
-
* @internal
|
|
14303
|
-
*/
|
|
14304
|
-
var TimelineClip = /** @class */ (function () {
|
|
14305
|
-
function TimelineClip() {
|
|
14306
|
-
this.start = 0;
|
|
14307
|
-
this.duration = 0;
|
|
14308
|
-
}
|
|
14309
|
-
return TimelineClip;
|
|
14310
|
-
}());
|
|
14311
|
-
|
|
14312
|
-
var singleSplits = [[0, 0, 1, 1, undefined]];
|
|
14313
|
-
var tempColor = [1, 1, 1, 1];
|
|
14314
|
-
var seed$3 = 0;
|
|
14315
|
-
var SpriteColorPlayable = /** @class */ (function (_super) {
|
|
14316
|
-
__extends(SpriteColorPlayable, _super);
|
|
14317
|
-
function SpriteColorPlayable() {
|
|
14318
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
14319
|
-
_this.renderColor = [1, 1, 1, 1];
|
|
14320
|
-
return _this;
|
|
14321
|
-
}
|
|
14322
|
-
SpriteColorPlayable.prototype.onPlayablePlay = function () {
|
|
14323
|
-
this.spriteMaterial = this.bindingItem.getComponent(SpriteComponent).material;
|
|
14324
|
-
};
|
|
14325
|
-
SpriteColorPlayable.prototype.processFrame = function (dt) {
|
|
14326
|
-
var colorInc = vecFill(tempColor, 1);
|
|
14327
|
-
var colorChanged;
|
|
14328
|
-
var life = this.time / this.bindingItem.duration;
|
|
14329
|
-
var opacityOverLifetime = this.opacityOverLifetime;
|
|
14330
|
-
var colorOverLifetime = this.colorOverLifetime;
|
|
14331
|
-
if (colorOverLifetime) {
|
|
14332
|
-
colorInc = getColorFromGradientStops(colorOverLifetime, life, true);
|
|
14333
|
-
colorChanged = true;
|
|
14334
|
-
}
|
|
14335
|
-
if (opacityOverLifetime) {
|
|
14336
|
-
colorInc[3] *= opacityOverLifetime.getValue(life);
|
|
14337
|
-
colorChanged = true;
|
|
14338
|
-
}
|
|
14339
|
-
if (colorChanged) {
|
|
14340
|
-
vecMulCombine(this.renderColor, colorInc, this.startColor);
|
|
14341
|
-
this.spriteMaterial.getVector4('_Color').setFromArray(this.renderColor);
|
|
14342
|
-
}
|
|
14343
|
-
};
|
|
14344
|
-
SpriteColorPlayable.prototype.fromData = function (clipData) {
|
|
14345
|
-
var _a;
|
|
14346
|
-
this.clipData = clipData;
|
|
14347
|
-
var colorOverLifetime = clipData.colorOverLifetime;
|
|
14348
|
-
if (colorOverLifetime) {
|
|
14349
|
-
this.opacityOverLifetime = createValueGetter((_a = colorOverLifetime.opacity) !== null && _a !== void 0 ? _a : 1);
|
|
14350
|
-
if (colorOverLifetime.color && colorOverLifetime.color[0] === ValueType$1.GRADIENT_COLOR) {
|
|
14351
|
-
this.colorOverLifetime = colorStopsFromGradient(colorOverLifetime.color[1]);
|
|
14331
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
14332
|
+
finally {
|
|
14333
|
+
try {
|
|
14334
|
+
if (_k && !_k.done && (_a = _j.return)) _a.call(_j);
|
|
14335
|
+
}
|
|
14336
|
+
finally { if (e_3) throw e_3.error; }
|
|
14352
14337
|
}
|
|
14338
|
+
this.timelineStarted = true;
|
|
14353
14339
|
}
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
var
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
-
|
|
14366
|
-
|
|
14367
|
-
|
|
14368
|
-
|
|
14369
|
-
|
|
14370
|
-
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
triangles: area.area,
|
|
14375
|
-
backfaceCulling: _this.renderer.side === SideMode$1.FRONT,
|
|
14376
|
-
};
|
|
14340
|
+
var now = this.time;
|
|
14341
|
+
// 判断动画是否开始
|
|
14342
|
+
if (this.item.delaying && now >= 0 && now <= this.item.duration) {
|
|
14343
|
+
this.item.delaying = false;
|
|
14344
|
+
try {
|
|
14345
|
+
for (var _o = __values$1(this.tracks), _p = _o.next(); !_p.done; _p = _o.next()) {
|
|
14346
|
+
var track = _p.value;
|
|
14347
|
+
try {
|
|
14348
|
+
for (var _q = (e_6 = void 0, __values$1(track.getClips())), _r = _q.next(); !_r.done; _r = _q.next()) {
|
|
14349
|
+
var clip = _r.value;
|
|
14350
|
+
clip.playable.onPlayablePlay();
|
|
14351
|
+
}
|
|
14352
|
+
}
|
|
14353
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
14354
|
+
finally {
|
|
14355
|
+
try {
|
|
14356
|
+
if (_r && !_r.done && (_d = _q.return)) _d.call(_q);
|
|
14357
|
+
}
|
|
14358
|
+
finally { if (e_6) throw e_6.error; }
|
|
14359
|
+
}
|
|
14377
14360
|
}
|
|
14378
14361
|
}
|
|
14379
|
-
|
|
14380
|
-
|
|
14381
|
-
|
|
14362
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
14363
|
+
finally {
|
|
14364
|
+
try {
|
|
14365
|
+
if (_p && !_p.done && (_c = _o.return)) _c.call(_o);
|
|
14366
|
+
}
|
|
14367
|
+
finally { if (e_5) throw e_5.error; }
|
|
14368
|
+
}
|
|
14382
14369
|
}
|
|
14383
|
-
|
|
14384
|
-
|
|
14385
|
-
|
|
14386
|
-
|
|
14387
|
-
* @param visible - true:可见,false:不可见
|
|
14388
|
-
*/
|
|
14389
|
-
SpriteComponent.prototype.setVisible = function (visible) {
|
|
14390
|
-
this.visible = visible;
|
|
14391
|
-
};
|
|
14392
|
-
/**
|
|
14393
|
-
* 获取当前 Mesh 的可见性。
|
|
14394
|
-
*/
|
|
14395
|
-
SpriteComponent.prototype.getVisible = function () {
|
|
14396
|
-
return this.visible;
|
|
14397
|
-
};
|
|
14398
|
-
SpriteComponent.prototype.render = function (renderer) {
|
|
14399
|
-
if (!this.getVisible()) {
|
|
14400
|
-
return;
|
|
14370
|
+
// 判断动画是否结束
|
|
14371
|
+
var ended;
|
|
14372
|
+
if (VFXItem.isParticle(this.item)) {
|
|
14373
|
+
ended = this.item.isEnded(now) && this.item.content.destoryed;
|
|
14401
14374
|
}
|
|
14402
|
-
|
|
14403
|
-
|
|
14404
|
-
if (renderer.renderingData.currentFrame.globalUniforms) {
|
|
14405
|
-
renderer.setGlobalMatrix('effects_ObjectToWorld', this.transform.getWorldMatrix());
|
|
14375
|
+
else {
|
|
14376
|
+
ended = this.item.isEnded(now);
|
|
14406
14377
|
}
|
|
14407
|
-
|
|
14408
|
-
|
|
14409
|
-
|
|
14410
|
-
|
|
14411
|
-
|
|
14412
|
-
|
|
14413
|
-
|
|
14414
|
-
|
|
14415
|
-
|
|
14416
|
-
|
|
14417
|
-
|
|
14418
|
-
|
|
14419
|
-
|
|
14420
|
-
|
|
14421
|
-
|
|
14422
|
-
|
|
14423
|
-
|
|
14424
|
-
|
|
14425
|
-
|
|
14426
|
-
|
|
14427
|
-
|
|
14428
|
-
|
|
14429
|
-
|
|
14430
|
-
|
|
14431
|
-
|
|
14432
|
-
|
|
14433
|
-
|
|
14434
|
-
|
|
14435
|
-
|
|
14436
|
-
|
|
14437
|
-
|
|
14438
|
-
|
|
14439
|
-
|
|
14440
|
-
|
|
14378
|
+
if (ended) {
|
|
14379
|
+
var endBehavior = this.item.endBehavior;
|
|
14380
|
+
if (!this.item.ended) {
|
|
14381
|
+
this.item.ended = true;
|
|
14382
|
+
this.item.onEnd();
|
|
14383
|
+
if (endBehavior === END_BEHAVIOR_DESTROY$1) {
|
|
14384
|
+
try {
|
|
14385
|
+
for (var _s = __values$1(this.tracks), _t = _s.next(); !_t.done; _t = _s.next()) {
|
|
14386
|
+
var track = _t.value;
|
|
14387
|
+
try {
|
|
14388
|
+
for (var _u = (e_8 = void 0, __values$1(track.getClips())), _v = _u.next(); !_v.done; _v = _u.next()) {
|
|
14389
|
+
var clip = _v.value;
|
|
14390
|
+
clip.playable.onPlayableDestroy();
|
|
14391
|
+
}
|
|
14392
|
+
}
|
|
14393
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
14394
|
+
finally {
|
|
14395
|
+
try {
|
|
14396
|
+
if (_v && !_v.done && (_f = _u.return)) _f.call(_u);
|
|
14397
|
+
}
|
|
14398
|
+
finally { if (e_8) throw e_8.error; }
|
|
14399
|
+
}
|
|
14400
|
+
}
|
|
14401
|
+
}
|
|
14402
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
14403
|
+
finally {
|
|
14404
|
+
try {
|
|
14405
|
+
if (_t && !_t.done && (_e = _s.return)) _e.call(_s);
|
|
14406
|
+
}
|
|
14407
|
+
finally { if (e_7) throw e_7.error; }
|
|
14408
|
+
}
|
|
14409
|
+
this.item.delaying = true;
|
|
14410
|
+
if (!this.item.reusable && !this.reusable) {
|
|
14411
|
+
this.item.dispose();
|
|
14412
|
+
return;
|
|
14413
|
+
}
|
|
14441
14414
|
}
|
|
14442
14415
|
}
|
|
14443
|
-
|
|
14444
|
-
|
|
14445
|
-
|
|
14446
|
-
|
|
14416
|
+
}
|
|
14417
|
+
// TODO: [1.31] @茂安 验证 https://github.com/galacean/effects-runtime/commits/main/packages/effects-core/src/vfx-item.ts
|
|
14418
|
+
// 在生命周期内更新动画
|
|
14419
|
+
if (!this.item.delaying) {
|
|
14420
|
+
var lifetime = this.time / this.item.duration;
|
|
14421
|
+
this.item.lifetime = lifetime;
|
|
14422
|
+
try {
|
|
14423
|
+
for (var _w = __values$1(this.tracks), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
14424
|
+
var track = _x.value;
|
|
14425
|
+
try {
|
|
14426
|
+
for (var _y = (e_10 = void 0, __values$1(track.getClips())), _z = _y.next(); !_z.done; _z = _y.next()) {
|
|
14427
|
+
var clip = _z.value;
|
|
14428
|
+
clip.playable.setTime(this.time);
|
|
14429
|
+
}
|
|
14430
|
+
}
|
|
14431
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
14432
|
+
finally {
|
|
14433
|
+
try {
|
|
14434
|
+
if (_z && !_z.done && (_h = _y.return)) _h.call(_y);
|
|
14435
|
+
}
|
|
14436
|
+
finally { if (e_10) throw e_10.error; }
|
|
14437
|
+
}
|
|
14438
|
+
}
|
|
14447
14439
|
}
|
|
14448
|
-
|
|
14449
|
-
|
|
14450
|
-
|
|
14440
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
14441
|
+
finally {
|
|
14442
|
+
try {
|
|
14443
|
+
if (_x && !_x.done && (_g = _w.return)) _g.call(_w);
|
|
14444
|
+
}
|
|
14445
|
+
finally { if (e_9) throw e_9.error; }
|
|
14451
14446
|
}
|
|
14452
|
-
|
|
14453
|
-
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
|
|
14447
|
+
this.playableGraph.evaluate(dt);
|
|
14448
|
+
}
|
|
14449
|
+
};
|
|
14450
|
+
// time 单位秒
|
|
14451
|
+
TimelineComponent.prototype.setTime = function (time) {
|
|
14452
|
+
this.time = time;
|
|
14453
|
+
};
|
|
14454
|
+
TimelineComponent.prototype.getTime = function () {
|
|
14455
|
+
return this.time;
|
|
14456
|
+
};
|
|
14457
|
+
TimelineComponent.prototype.toLocalTime = function (time) {
|
|
14458
|
+
var localTime = time - this.options.start;
|
|
14459
|
+
var duration = this.options.duration;
|
|
14460
|
+
if (localTime - duration > 0.001) {
|
|
14461
|
+
if (this.options.endBehavior === END_BEHAVIOR_RESTART$1) {
|
|
14462
|
+
localTime = localTime % duration;
|
|
14458
14463
|
}
|
|
14459
|
-
else {
|
|
14460
|
-
|
|
14464
|
+
else if (this.options.endBehavior === END_BEHAVIOR_FREEZE$1) {
|
|
14465
|
+
localTime = Math.min(duration, localTime);
|
|
14461
14466
|
}
|
|
14462
|
-
this.material.getVector4('_TexOffset').setFromArray([
|
|
14463
|
-
texRectX + texOffset[0],
|
|
14464
|
-
texRectH + texRectY - texOffset[1],
|
|
14465
|
-
dx, dy,
|
|
14466
|
-
]);
|
|
14467
14467
|
}
|
|
14468
|
+
return localTime;
|
|
14468
14469
|
};
|
|
14469
|
-
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
|
|
14470
|
+
TimelineComponent.prototype.createTrack = function (classConstructor, name) {
|
|
14471
|
+
var newTrack = new classConstructor();
|
|
14472
|
+
newTrack.bindingItem = this.item;
|
|
14473
|
+
newTrack.id = (this.trackSeed++).toString();
|
|
14474
|
+
newTrack.name = name ? name : 'Track' + newTrack.id;
|
|
14475
|
+
this.tracks.push(newTrack);
|
|
14476
|
+
return newTrack;
|
|
14473
14477
|
};
|
|
14474
|
-
|
|
14475
|
-
|
|
14476
|
-
|
|
14477
|
-
|
|
14478
|
+
TimelineComponent.prototype.getTracks = function () {
|
|
14479
|
+
return this.tracks;
|
|
14480
|
+
};
|
|
14481
|
+
TimelineComponent.prototype.findTrack = function (name) {
|
|
14482
|
+
var e_11, _a;
|
|
14483
|
+
try {
|
|
14484
|
+
for (var _b = __values$1(this.tracks), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
14485
|
+
var track = _c.value;
|
|
14486
|
+
if (track.name === name) {
|
|
14487
|
+
return track;
|
|
14488
|
+
}
|
|
14489
|
+
}
|
|
14478
14490
|
}
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
if (!this.wireframe) {
|
|
14484
|
-
for (var i = 0; i < idxCount; i++) {
|
|
14485
|
-
indexData[i] = pointStartIndex + index[i];
|
|
14491
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
14492
|
+
finally {
|
|
14493
|
+
try {
|
|
14494
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
14486
14495
|
}
|
|
14496
|
+
finally { if (e_11) throw e_11.error; }
|
|
14487
14497
|
}
|
|
14488
|
-
return {
|
|
14489
|
-
atlasOffset: geoData.atlasOffset,
|
|
14490
|
-
index: indexData,
|
|
14491
|
-
};
|
|
14492
14498
|
};
|
|
14493
|
-
|
|
14494
|
-
|
|
14495
|
-
|
|
14496
|
-
|
|
14497
|
-
|
|
14498
|
-
|
|
14499
|
-
|
|
14500
|
-
|
|
14501
|
-
|
|
14502
|
-
|
|
14503
|
-
|
|
14504
|
-
|
|
14505
|
-
|
|
14506
|
-
|
|
14507
|
-
var attributes = {
|
|
14508
|
-
atlasOffset: new Float32Array(data.atlasOffset.length),
|
|
14509
|
-
index: new Uint16Array(data.index.length),
|
|
14510
|
-
};
|
|
14511
|
-
attributes.atlasOffset.set(data.atlasOffset);
|
|
14512
|
-
attributes.index.set(data.index);
|
|
14513
|
-
var _a = this, material = _a.material, geometry = _a.geometry;
|
|
14514
|
-
var indexData = attributes.index;
|
|
14515
|
-
geometry.setIndexData(indexData);
|
|
14516
|
-
geometry.setAttributeData('atlasOffset', attributes.atlasOffset);
|
|
14517
|
-
geometry.setDrawCount(data.index.length);
|
|
14518
|
-
for (var i = 0; i < textures.length; i++) {
|
|
14519
|
-
var texture_1 = textures[i];
|
|
14520
|
-
material.setTexture('uSampler' + i, texture_1);
|
|
14499
|
+
TimelineComponent.prototype.rebuildGraph = function () {
|
|
14500
|
+
this.playableGraph = new PlayableGraph();
|
|
14501
|
+
this.compileTracks(this.playableGraph);
|
|
14502
|
+
};
|
|
14503
|
+
TimelineComponent.prototype.compileTracks = function (graph) {
|
|
14504
|
+
var e_12, _a;
|
|
14505
|
+
try {
|
|
14506
|
+
for (var _b = __values$1(this.tracks), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
14507
|
+
var track = _c.value;
|
|
14508
|
+
var trackMixPlayable = track.createPlayebleTree();
|
|
14509
|
+
var trackOutput = track.createOutput();
|
|
14510
|
+
graph.addOutput(trackOutput);
|
|
14511
|
+
trackOutput.setSourcePlayeble(trackMixPlayable);
|
|
14512
|
+
}
|
|
14521
14513
|
}
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
|
|
14525
|
-
|
|
14514
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
14515
|
+
finally {
|
|
14516
|
+
try {
|
|
14517
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
14518
|
+
}
|
|
14519
|
+
finally { if (e_12) throw e_12.error; }
|
|
14526
14520
|
}
|
|
14527
14521
|
};
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
data: new Float32Array([
|
|
14536
|
-
-0.5, 0.5, 0,
|
|
14537
|
-
-0.5, -0.5, 0,
|
|
14538
|
-
0.5, 0.5, 0,
|
|
14539
|
-
0.5, -0.5, 0, //右下
|
|
14540
|
-
]),
|
|
14541
|
-
},
|
|
14542
|
-
atlasOffset: {
|
|
14543
|
-
size: 2,
|
|
14544
|
-
offset: 0,
|
|
14545
|
-
releasable: true,
|
|
14546
|
-
type: glContext.FLOAT,
|
|
14547
|
-
data: new Float32Array(0),
|
|
14548
|
-
},
|
|
14549
|
-
},
|
|
14550
|
-
indices: { data: new Uint16Array(0), releasable: true },
|
|
14551
|
-
mode: mode,
|
|
14552
|
-
maxVertex: maxVertex,
|
|
14553
|
-
});
|
|
14554
|
-
};
|
|
14555
|
-
SpriteComponent.prototype.createMaterial = function (renderInfo, count) {
|
|
14556
|
-
var side = renderInfo.side, occlusion = renderInfo.occlusion, blending = renderInfo.blending, maskMode = renderInfo.maskMode, mask = renderInfo.mask;
|
|
14557
|
-
var materialProps = {
|
|
14558
|
-
shader: spriteMeshShaderFromRenderInfo(renderInfo, count, 1),
|
|
14559
|
-
};
|
|
14560
|
-
this.preMultiAlpha = getPreMultiAlpha(blending);
|
|
14561
|
-
var material = Material.create(this.engine, materialProps);
|
|
14562
|
-
var states = {
|
|
14563
|
-
side: side,
|
|
14564
|
-
blending: true,
|
|
14565
|
-
blendMode: blending,
|
|
14566
|
-
mask: mask,
|
|
14567
|
-
maskMode: maskMode,
|
|
14568
|
-
depthTest: true,
|
|
14569
|
-
depthMask: occlusion,
|
|
14522
|
+
TimelineComponent.prototype.fromData = function (data) {
|
|
14523
|
+
_super.prototype.fromData.call(this, data);
|
|
14524
|
+
this.options = {
|
|
14525
|
+
start: this.item.start,
|
|
14526
|
+
duration: this.item.duration,
|
|
14527
|
+
looping: this.item.endBehavior === END_BEHAVIOR_RESTART$1,
|
|
14528
|
+
endBehavior: this.item.endBehavior || END_BEHAVIOR_DESTROY$1,
|
|
14570
14529
|
};
|
|
14571
|
-
|
|
14572
|
-
|
|
14573
|
-
|
|
14574
|
-
|
|
14575
|
-
|
|
14576
|
-
|
|
14577
|
-
|
|
14578
|
-
|
|
14579
|
-
|
|
14530
|
+
this.id = this.item.id;
|
|
14531
|
+
this.name = this.item.name;
|
|
14532
|
+
var activationTrack = this.createTrack(Track, 'ActivationTrack');
|
|
14533
|
+
activationTrack.createClip(ActivationClipPlayable, 'ActivationTimelineClip');
|
|
14534
|
+
};
|
|
14535
|
+
TimelineComponent.prototype.toData = function () {
|
|
14536
|
+
_super.prototype.toData.call(this);
|
|
14537
|
+
};
|
|
14538
|
+
__decorate([
|
|
14539
|
+
serialize()
|
|
14540
|
+
], TimelineComponent.prototype, "time", void 0);
|
|
14541
|
+
return TimelineComponent;
|
|
14542
|
+
}(ItemBehaviour));
|
|
14543
|
+
|
|
14544
|
+
var singleSplits = [[0, 0, 1, 1, undefined]];
|
|
14545
|
+
var tempColor = [1, 1, 1, 1];
|
|
14546
|
+
var seed$2 = 0;
|
|
14547
|
+
var SpriteColorPlayable = /** @class */ (function (_super) {
|
|
14548
|
+
__extends(SpriteColorPlayable, _super);
|
|
14549
|
+
function SpriteColorPlayable() {
|
|
14550
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
14551
|
+
_this.renderColor = [1, 1, 1, 1];
|
|
14552
|
+
return _this;
|
|
14553
|
+
}
|
|
14554
|
+
SpriteColorPlayable.prototype.onPlayablePlay = function () {
|
|
14555
|
+
this.spriteMaterial = this.bindingItem.getComponent(SpriteComponent).material;
|
|
14556
|
+
};
|
|
14557
|
+
SpriteColorPlayable.prototype.processFrame = function (dt) {
|
|
14558
|
+
var colorInc = vecFill(tempColor, 1);
|
|
14559
|
+
var colorChanged;
|
|
14560
|
+
var life = this.time / this.bindingItem.duration;
|
|
14561
|
+
var opacityOverLifetime = this.opacityOverLifetime;
|
|
14562
|
+
var colorOverLifetime = this.colorOverLifetime;
|
|
14563
|
+
if (colorOverLifetime) {
|
|
14564
|
+
colorInc = getColorFromGradientStops(colorOverLifetime, life, true);
|
|
14565
|
+
colorChanged = true;
|
|
14580
14566
|
}
|
|
14581
|
-
if (
|
|
14582
|
-
|
|
14567
|
+
if (opacityOverLifetime) {
|
|
14568
|
+
colorInc[3] *= opacityOverLifetime.getValue(life);
|
|
14569
|
+
colorChanged = true;
|
|
14583
14570
|
}
|
|
14584
|
-
if (
|
|
14585
|
-
|
|
14571
|
+
if (colorChanged) {
|
|
14572
|
+
vecMulCombine(this.renderColor, colorInc, this.startColor);
|
|
14573
|
+
this.spriteMaterial.getVector4('_Color').setFromArray(this.renderColor);
|
|
14586
14574
|
}
|
|
14587
|
-
return material;
|
|
14588
14575
|
};
|
|
14589
|
-
|
|
14590
|
-
var
|
|
14591
|
-
|
|
14592
|
-
|
|
14593
|
-
|
|
14594
|
-
|
|
14595
|
-
|
|
14596
|
-
|
|
14597
|
-
for (var i = 0; i < point.length; i += 6) {
|
|
14598
|
-
point[i] *= sx;
|
|
14599
|
-
point[i + 1] *= sy;
|
|
14600
|
-
atlasOffset_1.push(aPoint[i + 2], aPoint[i + 3]);
|
|
14601
|
-
position_1.push(point[i], point[i + 1], 0.0);
|
|
14602
|
-
}
|
|
14603
|
-
this.geometry.setAttributeData('aPos', new Float32Array(position_1));
|
|
14604
|
-
return {
|
|
14605
|
-
index: index_1,
|
|
14606
|
-
atlasOffset: atlasOffset_1,
|
|
14607
|
-
};
|
|
14608
|
-
}
|
|
14609
|
-
var originData = [-.5, .5, -.5, -.5, .5, .5, .5, -.5];
|
|
14610
|
-
var atlasOffset = [];
|
|
14611
|
-
var index = [];
|
|
14612
|
-
var col = 2;
|
|
14613
|
-
var row = 2;
|
|
14614
|
-
if (splits.length === 1) {
|
|
14615
|
-
col = 1;
|
|
14616
|
-
row = 1;
|
|
14617
|
-
}
|
|
14618
|
-
var position = [];
|
|
14619
|
-
for (var x = 0; x < col; x++) {
|
|
14620
|
-
for (var y = 0; y < row; y++) {
|
|
14621
|
-
var base = (y * 2 + x) * 4;
|
|
14622
|
-
// @ts-expect-error
|
|
14623
|
-
var split = textureSheetAnimation ? [0, 0, 1, 1, splits[0][4]] : splits[y * 2 + x];
|
|
14624
|
-
var texOffset = split[4] ? [0, 0, 1, 0, 0, 1, 1, 1] : [0, 1, 0, 0, 1, 1, 1, 0];
|
|
14625
|
-
var dw = ((x + x + 1) / col - 1) / 2;
|
|
14626
|
-
var dh = ((y + y + 1) / row - 1) / 2;
|
|
14627
|
-
var tox = split[0];
|
|
14628
|
-
var toy = split[1];
|
|
14629
|
-
var tsx = split[4] ? split[3] : split[2];
|
|
14630
|
-
var tsy = split[4] ? split[2] : split[3];
|
|
14631
|
-
var origin_1 = [
|
|
14632
|
-
originData[0] / col + dw,
|
|
14633
|
-
originData[1] / row + dh,
|
|
14634
|
-
originData[2] / col + dw,
|
|
14635
|
-
originData[3] / row + dh,
|
|
14636
|
-
originData[4] / col + dw,
|
|
14637
|
-
originData[5] / row + dh,
|
|
14638
|
-
originData[6] / col + dw,
|
|
14639
|
-
originData[7] / row + dh,
|
|
14640
|
-
];
|
|
14641
|
-
atlasOffset.push(texOffset[0] * tsx + tox, texOffset[1] * tsy + toy, texOffset[2] * tsx + tox, texOffset[3] * tsy + toy, texOffset[4] * tsx + tox, texOffset[5] * tsy + toy, texOffset[6] * tsx + tox, texOffset[7] * tsy + toy);
|
|
14642
|
-
position.push((origin_1[0]) * sx, (origin_1[1]) * sy, 0.0, (origin_1[2]) * sx, (origin_1[3]) * sy, 0.0, (origin_1[4]) * sx, (origin_1[5]) * sy, 0.0, (origin_1[6]) * sx, (origin_1[7]) * sy, 0.0);
|
|
14643
|
-
index.push(base, 1 + base, 2 + base, 2 + base, 1 + base, 3 + base);
|
|
14576
|
+
SpriteColorPlayable.prototype.fromData = function (clipData) {
|
|
14577
|
+
var _a;
|
|
14578
|
+
this.clipData = clipData;
|
|
14579
|
+
var colorOverLifetime = clipData.colorOverLifetime;
|
|
14580
|
+
if (colorOverLifetime) {
|
|
14581
|
+
this.opacityOverLifetime = createValueGetter((_a = colorOverLifetime.opacity) !== null && _a !== void 0 ? _a : 1);
|
|
14582
|
+
if (colorOverLifetime.color && colorOverLifetime.color[0] === ValueType$1.GRADIENT_COLOR) {
|
|
14583
|
+
this.colorOverLifetime = colorStopsFromGradient(colorOverLifetime.color[1]);
|
|
14644
14584
|
}
|
|
14645
14585
|
}
|
|
14646
|
-
this.
|
|
14647
|
-
return
|
|
14586
|
+
this.startColor = clipData.startColor || [1, 1, 1, 1];
|
|
14587
|
+
return this;
|
|
14648
14588
|
};
|
|
14649
|
-
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
|
|
14653
|
-
|
|
14589
|
+
return SpriteColorPlayable;
|
|
14590
|
+
}(Playable));
|
|
14591
|
+
var SpriteComponent = /** @class */ (function (_super) {
|
|
14592
|
+
__extends(SpriteComponent, _super);
|
|
14593
|
+
function SpriteComponent(engine, props) {
|
|
14594
|
+
var _this = _super.call(this, engine) || this;
|
|
14595
|
+
_this.color = [1, 1, 1, 1];
|
|
14596
|
+
_this.visible = true;
|
|
14597
|
+
_this.getHitTestParams = function (force) {
|
|
14598
|
+
var _a;
|
|
14599
|
+
var ui = _this.interaction;
|
|
14600
|
+
if ((force || ui)) {
|
|
14601
|
+
var area = _this.getBoundingBox();
|
|
14602
|
+
if (area) {
|
|
14603
|
+
return {
|
|
14604
|
+
behavior: ((_a = _this.interaction) === null || _a === void 0 ? void 0 : _a.behavior) || 0,
|
|
14605
|
+
type: area.type,
|
|
14606
|
+
triangles: area.area,
|
|
14607
|
+
backfaceCulling: _this.renderer.side === SideMode$1.FRONT,
|
|
14608
|
+
};
|
|
14609
|
+
}
|
|
14610
|
+
}
|
|
14611
|
+
};
|
|
14612
|
+
if (props) {
|
|
14613
|
+
_this.fromData(props);
|
|
14654
14614
|
}
|
|
14655
|
-
return
|
|
14615
|
+
return _this;
|
|
14616
|
+
}
|
|
14617
|
+
/**
|
|
14618
|
+
* 设置当前 Mesh 的可见性。
|
|
14619
|
+
* @param visible - true:可见,false:不可见
|
|
14620
|
+
*/
|
|
14621
|
+
SpriteComponent.prototype.setVisible = function (visible) {
|
|
14622
|
+
this.visible = visible;
|
|
14656
14623
|
};
|
|
14657
14624
|
/**
|
|
14658
|
-
*
|
|
14659
|
-
* @returns
|
|
14625
|
+
* 获取当前 Mesh 的可见性。
|
|
14660
14626
|
*/
|
|
14661
|
-
SpriteComponent.prototype.
|
|
14662
|
-
|
|
14627
|
+
SpriteComponent.prototype.getVisible = function () {
|
|
14628
|
+
return this.visible;
|
|
14629
|
+
};
|
|
14630
|
+
SpriteComponent.prototype.render = function (renderer) {
|
|
14631
|
+
if (!this.getVisible()) {
|
|
14663
14632
|
return;
|
|
14664
14633
|
}
|
|
14665
|
-
var
|
|
14666
|
-
var
|
|
14667
|
-
|
|
14668
|
-
|
|
14669
|
-
worldMatrix.transformPoint(triangle.p1);
|
|
14670
|
-
worldMatrix.transformPoint(triangle.p2);
|
|
14671
|
-
});
|
|
14672
|
-
return {
|
|
14673
|
-
type: HitTestType.triangle,
|
|
14674
|
-
area: triangles,
|
|
14675
|
-
};
|
|
14676
|
-
};
|
|
14677
|
-
// TODO: [1.31] @十弦 https://github.com/galacean/effects-runtime/commit/fe8736540b9a461d8e96658f4d755ff8089a263b#diff-a3618f4527c5fe6e842f20d67d5c82984568502c6bf6fdfcbd24f69e2894ca90
|
|
14678
|
-
SpriteComponent.prototype.fromData = function (data) {
|
|
14679
|
-
var _a, _b, _c, _d, _e, _f;
|
|
14680
|
-
_super.prototype.fromData.call(this, data);
|
|
14681
|
-
var interaction = data.interaction, options = data.options, _g = data.listIndex, listIndex = _g === void 0 ? 0 : _g;
|
|
14682
|
-
var renderer = data.renderer;
|
|
14683
|
-
if (!renderer) {
|
|
14684
|
-
//@ts-expect-error
|
|
14685
|
-
renderer = {};
|
|
14634
|
+
var material = this.material;
|
|
14635
|
+
var geo = this.geometry;
|
|
14636
|
+
if (renderer.renderingData.currentFrame.globalUniforms) {
|
|
14637
|
+
renderer.setGlobalMatrix('effects_ObjectToWorld', this.transform.getWorldMatrix());
|
|
14686
14638
|
}
|
|
14687
|
-
this.
|
|
14688
|
-
|
|
14689
|
-
|
|
14690
|
-
|
|
14691
|
-
texture: (_c = renderer.texture) !== null && _c !== void 0 ? _c : this.engine.emptyTexture,
|
|
14692
|
-
occlusion: !!(renderer.occlusion),
|
|
14693
|
-
transparentOcclusion: !!(renderer.transparentOcclusion) || (renderer.maskMode === MaskMode$1.MASK),
|
|
14694
|
-
side: (_d = renderer.side) !== null && _d !== void 0 ? _d : SideMode$1.DOUBLE,
|
|
14695
|
-
shape: renderer.shape,
|
|
14696
|
-
mask: (_e = renderer.mask) !== null && _e !== void 0 ? _e : 0,
|
|
14697
|
-
maskMode: (_f = renderer.maskMode) !== null && _f !== void 0 ? _f : MaskMode$1.NONE,
|
|
14698
|
-
order: listIndex,
|
|
14699
|
-
};
|
|
14700
|
-
this.emptyTexture = this.engine.emptyTexture;
|
|
14701
|
-
this.splits = data.splits || singleSplits;
|
|
14702
|
-
this.textureSheetAnimation = data.textureSheetAnimation;
|
|
14703
|
-
this.cachePrefix = '-';
|
|
14704
|
-
this.renderInfo = getImageItemRenderInfo(this);
|
|
14705
|
-
var geometry = this.createGeometry(glContext.TRIANGLES);
|
|
14706
|
-
var material = this.createMaterial(this.renderInfo, 2);
|
|
14707
|
-
this.worldMatrix = Matrix4.fromIdentity();
|
|
14708
|
-
this.material = material;
|
|
14709
|
-
this.geometry = geometry;
|
|
14710
|
-
this.name = 'MSprite' + seed$3++;
|
|
14711
|
-
var startColor = options.startColor || [1, 1, 1, 1];
|
|
14712
|
-
this.material.setVector4('_Color', new Vector4().setFromArray(startColor));
|
|
14713
|
-
this.material.setVector4('_TexOffset', new Vector4().setFromArray([0, 0, 1, 1]));
|
|
14714
|
-
this.setItem();
|
|
14715
|
-
// 添加K帧动画
|
|
14716
|
-
var colorTrack = this.item.getComponent(TimelineComponent).createTrack(Track, 'SpriteColorTrack');
|
|
14717
|
-
colorTrack.createClip(SpriteColorPlayable, 'SpriteColorClip').playable.fromData({ colorOverLifetime: data.colorOverLifetime, startColor: data.options.startColor });
|
|
14718
|
-
};
|
|
14719
|
-
SpriteComponent.prototype.toData = function () {
|
|
14720
|
-
_super.prototype.toData.call(this);
|
|
14639
|
+
this.material.setVector2('_Size', this.transform.size);
|
|
14640
|
+
// 执行 Geometry 的数据刷新
|
|
14641
|
+
geo.flush();
|
|
14642
|
+
renderer.drawGeometry(geo, material);
|
|
14721
14643
|
};
|
|
14722
|
-
SpriteComponent =
|
|
14644
|
+
SpriteComponent.prototype.start = function () {
|
|
14645
|
+
this.priority = this.item.listIndex;
|
|
14646
|
+
this.timelineComponent = this.item.getComponent(TimelineComponent);
|
|
14647
|
+
this.item.getHitTestParams = this.getHitTestParams;
|
|
14648
|
+
};
|
|
14649
|
+
SpriteComponent.prototype.update = function (dt) {
|
|
14650
|
+
var time = this.timelineComponent.getTime();
|
|
14651
|
+
var duration = this.item.duration;
|
|
14652
|
+
var life = Math.min(Math.max(time / duration, 0.0), 1.0);
|
|
14653
|
+
var ta = this.textureSheetAnimation;
|
|
14654
|
+
if (ta) {
|
|
14655
|
+
var total = ta.total || (ta.row * ta.col);
|
|
14656
|
+
var texRectX = 0;
|
|
14657
|
+
var texRectY = 0;
|
|
14658
|
+
var texRectW = 1;
|
|
14659
|
+
var texRectH = 1;
|
|
14660
|
+
var flip = void 0;
|
|
14661
|
+
if (this.splits) {
|
|
14662
|
+
var sp = this.splits[0];
|
|
14663
|
+
flip = sp[4];
|
|
14664
|
+
texRectX = sp[0];
|
|
14665
|
+
texRectY = sp[1];
|
|
14666
|
+
if (flip) {
|
|
14667
|
+
texRectW = sp[3];
|
|
14668
|
+
texRectH = sp[2];
|
|
14669
|
+
}
|
|
14670
|
+
else {
|
|
14671
|
+
texRectW = sp[2];
|
|
14672
|
+
texRectH = sp[3];
|
|
14673
|
+
}
|
|
14674
|
+
}
|
|
14675
|
+
var dx = void 0, dy = void 0;
|
|
14676
|
+
if (flip) {
|
|
14677
|
+
dx = 1 / ta.row * texRectW;
|
|
14678
|
+
dy = 1 / ta.col * texRectH;
|
|
14679
|
+
}
|
|
14680
|
+
else {
|
|
14681
|
+
dx = 1 / ta.col * texRectW;
|
|
14682
|
+
dy = 1 / ta.row * texRectH;
|
|
14683
|
+
}
|
|
14684
|
+
var texOffset = void 0;
|
|
14685
|
+
if (ta.animate) {
|
|
14686
|
+
var frameIndex = Math.round(life * (total - 1));
|
|
14687
|
+
var yIndex = Math.floor(frameIndex / ta.col);
|
|
14688
|
+
var xIndex = frameIndex - yIndex * ta.col;
|
|
14689
|
+
texOffset = flip ? [dx * yIndex, dy * (ta.col - xIndex)] : [dx * xIndex, dy * (1 + yIndex)];
|
|
14690
|
+
}
|
|
14691
|
+
else {
|
|
14692
|
+
texOffset = [0, dy];
|
|
14693
|
+
}
|
|
14694
|
+
this.material.getVector4('_TexOffset').setFromArray([
|
|
14695
|
+
texRectX + texOffset[0],
|
|
14696
|
+
texRectH + texRectY - texOffset[1],
|
|
14697
|
+
dx, dy,
|
|
14698
|
+
]);
|
|
14699
|
+
}
|
|
14700
|
+
};
|
|
14701
|
+
SpriteComponent.prototype.onDestroy = function () {
|
|
14702
|
+
if (this.item && this.item.composition) {
|
|
14703
|
+
this.item.composition.destroyTextures(this.getTextures());
|
|
14704
|
+
}
|
|
14705
|
+
};
|
|
14706
|
+
SpriteComponent.prototype.getItemInitData = function (item, idx, pointStartIndex, textureIndex) {
|
|
14707
|
+
var geoData = item.geoData;
|
|
14708
|
+
if (!geoData) {
|
|
14709
|
+
geoData = item.geoData = this.getItemGeometryData(item, idx);
|
|
14710
|
+
}
|
|
14711
|
+
var index = geoData.index;
|
|
14712
|
+
var idxCount = index.length;
|
|
14713
|
+
// @ts-expect-error
|
|
14714
|
+
var indexData = this.wireframe ? new Uint8Array([0, 1, 1, 3, 2, 3, 2, 0]) : new index.constructor(idxCount);
|
|
14715
|
+
if (!this.wireframe) {
|
|
14716
|
+
for (var i = 0; i < idxCount; i++) {
|
|
14717
|
+
indexData[i] = pointStartIndex + index[i];
|
|
14718
|
+
}
|
|
14719
|
+
}
|
|
14720
|
+
return {
|
|
14721
|
+
atlasOffset: geoData.atlasOffset,
|
|
14722
|
+
index: indexData,
|
|
14723
|
+
};
|
|
14724
|
+
};
|
|
14725
|
+
SpriteComponent.prototype.setItem = function () {
|
|
14726
|
+
var textures = [];
|
|
14727
|
+
var texture = this.renderer.texture;
|
|
14728
|
+
if (texture) {
|
|
14729
|
+
addItem(textures, texture);
|
|
14730
|
+
}
|
|
14731
|
+
texture = this.renderer.texture;
|
|
14732
|
+
var textureIndex = texture ? textures.indexOf(texture) : -1;
|
|
14733
|
+
var data = this.getItemInitData(this, 0, 0, textureIndex);
|
|
14734
|
+
var renderer = this.renderer;
|
|
14735
|
+
var texParams = this.material.getVector4('_TexParams');
|
|
14736
|
+
texParams.x = renderer.occlusion ? +(renderer.transparentOcclusion) : 1;
|
|
14737
|
+
texParams.y = +this.preMultiAlpha;
|
|
14738
|
+
texParams.z = renderer.renderMode;
|
|
14739
|
+
var attributes = {
|
|
14740
|
+
atlasOffset: new Float32Array(data.atlasOffset.length),
|
|
14741
|
+
index: new Uint16Array(data.index.length),
|
|
14742
|
+
};
|
|
14743
|
+
attributes.atlasOffset.set(data.atlasOffset);
|
|
14744
|
+
attributes.index.set(data.index);
|
|
14745
|
+
var _a = this, material = _a.material, geometry = _a.geometry;
|
|
14746
|
+
var indexData = attributes.index;
|
|
14747
|
+
geometry.setIndexData(indexData);
|
|
14748
|
+
geometry.setAttributeData('atlasOffset', attributes.atlasOffset);
|
|
14749
|
+
geometry.setDrawCount(data.index.length);
|
|
14750
|
+
for (var i = 0; i < textures.length; i++) {
|
|
14751
|
+
var texture_1 = textures[i];
|
|
14752
|
+
material.setTexture('uSampler' + i, texture_1);
|
|
14753
|
+
}
|
|
14754
|
+
// FIXME: 内存泄漏的临时方案,后面再调整
|
|
14755
|
+
var emptyTexture = this.emptyTexture;
|
|
14756
|
+
for (var k = textures.length; k < maxSpriteMeshItemCount; k++) {
|
|
14757
|
+
material.setTexture('uSampler' + k, emptyTexture);
|
|
14758
|
+
}
|
|
14759
|
+
};
|
|
14760
|
+
SpriteComponent.prototype.createGeometry = function (mode) {
|
|
14761
|
+
var maxVertex = 12 * this.splits.length;
|
|
14762
|
+
return Geometry.create(this.engine, {
|
|
14763
|
+
attributes: {
|
|
14764
|
+
aPos: {
|
|
14765
|
+
type: glContext.FLOAT,
|
|
14766
|
+
size: 3,
|
|
14767
|
+
data: new Float32Array([
|
|
14768
|
+
-0.5, 0.5, 0,
|
|
14769
|
+
-0.5, -0.5, 0,
|
|
14770
|
+
0.5, 0.5, 0,
|
|
14771
|
+
0.5, -0.5, 0, //右下
|
|
14772
|
+
]),
|
|
14773
|
+
},
|
|
14774
|
+
atlasOffset: {
|
|
14775
|
+
size: 2,
|
|
14776
|
+
offset: 0,
|
|
14777
|
+
releasable: true,
|
|
14778
|
+
type: glContext.FLOAT,
|
|
14779
|
+
data: new Float32Array(0),
|
|
14780
|
+
},
|
|
14781
|
+
},
|
|
14782
|
+
indices: { data: new Uint16Array(0), releasable: true },
|
|
14783
|
+
mode: mode,
|
|
14784
|
+
maxVertex: maxVertex,
|
|
14785
|
+
});
|
|
14786
|
+
};
|
|
14787
|
+
SpriteComponent.prototype.createMaterial = function (renderInfo, count) {
|
|
14788
|
+
var side = renderInfo.side, occlusion = renderInfo.occlusion, blending = renderInfo.blending, maskMode = renderInfo.maskMode, mask = renderInfo.mask;
|
|
14789
|
+
var materialProps = {
|
|
14790
|
+
shader: spriteMeshShaderFromRenderInfo(renderInfo, count, 1),
|
|
14791
|
+
};
|
|
14792
|
+
this.preMultiAlpha = getPreMultiAlpha(blending);
|
|
14793
|
+
var material = Material.create(this.engine, materialProps);
|
|
14794
|
+
var states = {
|
|
14795
|
+
side: side,
|
|
14796
|
+
blending: true,
|
|
14797
|
+
blendMode: blending,
|
|
14798
|
+
mask: mask,
|
|
14799
|
+
maskMode: maskMode,
|
|
14800
|
+
depthTest: true,
|
|
14801
|
+
depthMask: occlusion,
|
|
14802
|
+
};
|
|
14803
|
+
material.blending = states.blending;
|
|
14804
|
+
material.stencilRef = states.mask !== undefined ? [states.mask, states.mask] : undefined;
|
|
14805
|
+
material.depthTest = states.depthTest;
|
|
14806
|
+
material.depthMask = states.depthMask;
|
|
14807
|
+
setBlendMode(material, states.blendMode);
|
|
14808
|
+
setMaskMode(material, states.maskMode);
|
|
14809
|
+
setSideMode(material, states.side);
|
|
14810
|
+
if (!material.hasUniform('_Color')) {
|
|
14811
|
+
material.setVector4('_Color', new Vector4(0, 0, 0, 1));
|
|
14812
|
+
}
|
|
14813
|
+
if (!material.hasUniform('_TexOffset')) {
|
|
14814
|
+
material.setVector4('_TexOffset', new Vector4());
|
|
14815
|
+
}
|
|
14816
|
+
if (!material.hasUniform('_TexParams')) {
|
|
14817
|
+
material.setVector4('_TexParams', new Vector4());
|
|
14818
|
+
}
|
|
14819
|
+
return material;
|
|
14820
|
+
};
|
|
14821
|
+
SpriteComponent.prototype.getItemGeometryData = function (item, aIndex) {
|
|
14822
|
+
var splits = item.splits, renderer = item.renderer, textureSheetAnimation = item.textureSheetAnimation;
|
|
14823
|
+
var sx = 1, sy = 1;
|
|
14824
|
+
if (renderer.shape) {
|
|
14825
|
+
var _a = renderer.shape, index_1 = _a.index, aPoint = _a.aPoint;
|
|
14826
|
+
var point = new Float32Array(aPoint);
|
|
14827
|
+
var position_1 = [];
|
|
14828
|
+
var atlasOffset_1 = [];
|
|
14829
|
+
for (var i = 0; i < point.length; i += 6) {
|
|
14830
|
+
point[i] *= sx;
|
|
14831
|
+
point[i + 1] *= sy;
|
|
14832
|
+
atlasOffset_1.push(aPoint[i + 2], aPoint[i + 3]);
|
|
14833
|
+
position_1.push(point[i], point[i + 1], 0.0);
|
|
14834
|
+
}
|
|
14835
|
+
this.geometry.setAttributeData('aPos', new Float32Array(position_1));
|
|
14836
|
+
return {
|
|
14837
|
+
index: index_1,
|
|
14838
|
+
atlasOffset: atlasOffset_1,
|
|
14839
|
+
};
|
|
14840
|
+
}
|
|
14841
|
+
var originData = [-.5, .5, -.5, -.5, .5, .5, .5, -.5];
|
|
14842
|
+
var atlasOffset = [];
|
|
14843
|
+
var index = [];
|
|
14844
|
+
var col = 2;
|
|
14845
|
+
var row = 2;
|
|
14846
|
+
if (splits.length === 1) {
|
|
14847
|
+
col = 1;
|
|
14848
|
+
row = 1;
|
|
14849
|
+
}
|
|
14850
|
+
var position = [];
|
|
14851
|
+
for (var x = 0; x < col; x++) {
|
|
14852
|
+
for (var y = 0; y < row; y++) {
|
|
14853
|
+
var base = (y * 2 + x) * 4;
|
|
14854
|
+
// @ts-expect-error
|
|
14855
|
+
var split = textureSheetAnimation ? [0, 0, 1, 1, splits[0][4]] : splits[y * 2 + x];
|
|
14856
|
+
var texOffset = split[4] ? [0, 0, 1, 0, 0, 1, 1, 1] : [0, 1, 0, 0, 1, 1, 1, 0];
|
|
14857
|
+
var dw = ((x + x + 1) / col - 1) / 2;
|
|
14858
|
+
var dh = ((y + y + 1) / row - 1) / 2;
|
|
14859
|
+
var tox = split[0];
|
|
14860
|
+
var toy = split[1];
|
|
14861
|
+
var tsx = split[4] ? split[3] : split[2];
|
|
14862
|
+
var tsy = split[4] ? split[2] : split[3];
|
|
14863
|
+
var origin_1 = [
|
|
14864
|
+
originData[0] / col + dw,
|
|
14865
|
+
originData[1] / row + dh,
|
|
14866
|
+
originData[2] / col + dw,
|
|
14867
|
+
originData[3] / row + dh,
|
|
14868
|
+
originData[4] / col + dw,
|
|
14869
|
+
originData[5] / row + dh,
|
|
14870
|
+
originData[6] / col + dw,
|
|
14871
|
+
originData[7] / row + dh,
|
|
14872
|
+
];
|
|
14873
|
+
atlasOffset.push(texOffset[0] * tsx + tox, texOffset[1] * tsy + toy, texOffset[2] * tsx + tox, texOffset[3] * tsy + toy, texOffset[4] * tsx + tox, texOffset[5] * tsy + toy, texOffset[6] * tsx + tox, texOffset[7] * tsy + toy);
|
|
14874
|
+
position.push((origin_1[0]) * sx, (origin_1[1]) * sy, 0.0, (origin_1[2]) * sx, (origin_1[3]) * sy, 0.0, (origin_1[4]) * sx, (origin_1[5]) * sy, 0.0, (origin_1[6]) * sx, (origin_1[7]) * sy, 0.0);
|
|
14875
|
+
index.push(base, 1 + base, 2 + base, 2 + base, 1 + base, 3 + base);
|
|
14876
|
+
}
|
|
14877
|
+
}
|
|
14878
|
+
this.geometry.setAttributeData('aPos', new Float32Array(position));
|
|
14879
|
+
return { index: index, atlasOffset: atlasOffset };
|
|
14880
|
+
};
|
|
14881
|
+
SpriteComponent.prototype.getTextures = function () {
|
|
14882
|
+
var ret = [];
|
|
14883
|
+
var tex = this.renderer.texture;
|
|
14884
|
+
if (tex) {
|
|
14885
|
+
ret.push(tex);
|
|
14886
|
+
}
|
|
14887
|
+
return ret;
|
|
14888
|
+
};
|
|
14889
|
+
/**
|
|
14890
|
+
* 获取图层包围盒的类型和世界坐标
|
|
14891
|
+
* @returns
|
|
14892
|
+
*/
|
|
14893
|
+
SpriteComponent.prototype.getBoundingBox = function () {
|
|
14894
|
+
if (!this.item) {
|
|
14895
|
+
return;
|
|
14896
|
+
}
|
|
14897
|
+
var worldMatrix = this.transform.getWorldMatrix();
|
|
14898
|
+
var triangles = trianglesFromRect(Vector3.ZERO, 1 / 2, 1 / 2);
|
|
14899
|
+
triangles.forEach(function (triangle) {
|
|
14900
|
+
worldMatrix.transformPoint(triangle.p0);
|
|
14901
|
+
worldMatrix.transformPoint(triangle.p1);
|
|
14902
|
+
worldMatrix.transformPoint(triangle.p2);
|
|
14903
|
+
});
|
|
14904
|
+
return {
|
|
14905
|
+
type: HitTestType.triangle,
|
|
14906
|
+
area: triangles,
|
|
14907
|
+
};
|
|
14908
|
+
};
|
|
14909
|
+
// TODO: [1.31] @十弦 https://github.com/galacean/effects-runtime/commit/fe8736540b9a461d8e96658f4d755ff8089a263b#diff-a3618f4527c5fe6e842f20d67d5c82984568502c6bf6fdfcbd24f69e2894ca90
|
|
14910
|
+
SpriteComponent.prototype.fromData = function (data) {
|
|
14911
|
+
var _a, _b, _c, _d, _e, _f;
|
|
14912
|
+
_super.prototype.fromData.call(this, data);
|
|
14913
|
+
var interaction = data.interaction, options = data.options, _g = data.listIndex, listIndex = _g === void 0 ? 0 : _g;
|
|
14914
|
+
var renderer = data.renderer;
|
|
14915
|
+
if (!renderer) {
|
|
14916
|
+
//@ts-expect-error
|
|
14917
|
+
renderer = {};
|
|
14918
|
+
}
|
|
14919
|
+
this.interaction = interaction;
|
|
14920
|
+
this.renderer = {
|
|
14921
|
+
renderMode: (_a = renderer.renderMode) !== null && _a !== void 0 ? _a : RenderMode$1.BILLBOARD,
|
|
14922
|
+
blending: (_b = renderer.blending) !== null && _b !== void 0 ? _b : BlendingMode$1.ALPHA,
|
|
14923
|
+
texture: (_c = renderer.texture) !== null && _c !== void 0 ? _c : this.engine.emptyTexture,
|
|
14924
|
+
occlusion: !!(renderer.occlusion),
|
|
14925
|
+
transparentOcclusion: !!(renderer.transparentOcclusion) || (renderer.maskMode === MaskMode$1.MASK),
|
|
14926
|
+
side: (_d = renderer.side) !== null && _d !== void 0 ? _d : SideMode$1.DOUBLE,
|
|
14927
|
+
shape: renderer.shape,
|
|
14928
|
+
mask: (_e = renderer.mask) !== null && _e !== void 0 ? _e : 0,
|
|
14929
|
+
maskMode: (_f = renderer.maskMode) !== null && _f !== void 0 ? _f : MaskMode$1.NONE,
|
|
14930
|
+
order: listIndex,
|
|
14931
|
+
};
|
|
14932
|
+
this.emptyTexture = this.engine.emptyTexture;
|
|
14933
|
+
this.splits = data.splits || singleSplits;
|
|
14934
|
+
this.textureSheetAnimation = data.textureSheetAnimation;
|
|
14935
|
+
this.cachePrefix = '-';
|
|
14936
|
+
this.renderInfo = getImageItemRenderInfo(this);
|
|
14937
|
+
var geometry = this.createGeometry(glContext.TRIANGLES);
|
|
14938
|
+
var material = this.createMaterial(this.renderInfo, 2);
|
|
14939
|
+
this.worldMatrix = Matrix4.fromIdentity();
|
|
14940
|
+
this.material = material;
|
|
14941
|
+
this.geometry = geometry;
|
|
14942
|
+
this.name = 'MSprite' + seed$2++;
|
|
14943
|
+
var startColor = options.startColor || [1, 1, 1, 1];
|
|
14944
|
+
this.material.setVector4('_Color', new Vector4().setFromArray(startColor));
|
|
14945
|
+
this.material.setVector4('_TexOffset', new Vector4().setFromArray([0, 0, 1, 1]));
|
|
14946
|
+
this.setItem();
|
|
14947
|
+
// 添加K帧动画
|
|
14948
|
+
var colorTrack = this.item.getComponent(TimelineComponent).createTrack(Track, 'SpriteColorTrack');
|
|
14949
|
+
colorTrack.createClip(SpriteColorPlayable, 'SpriteColorClip').playable.fromData({ colorOverLifetime: data.colorOverLifetime, startColor: data.options.startColor });
|
|
14950
|
+
};
|
|
14951
|
+
SpriteComponent.prototype.toData = function () {
|
|
14952
|
+
_super.prototype.toData.call(this);
|
|
14953
|
+
};
|
|
14954
|
+
SpriteComponent = __decorate([
|
|
14723
14955
|
effectsClass(DataType.SpriteComponent)
|
|
14724
14956
|
], SpriteComponent);
|
|
14725
14957
|
return SpriteComponent;
|
|
@@ -17712,7 +17944,7 @@ var ParticleSystem = /** @class */ (function (_super) {
|
|
|
17712
17944
|
sprite[1] = tsa.animationDuration.getValue(lifetime);
|
|
17713
17945
|
sprite[2] = tsa.cycles.getValue(lifetime);
|
|
17714
17946
|
}
|
|
17715
|
-
var rot = tempRot
|
|
17947
|
+
var rot = tempRot;
|
|
17716
17948
|
if (options.start3DRotation) {
|
|
17717
17949
|
// @ts-expect-error
|
|
17718
17950
|
rot.set(options.startRotationX.getValue(lifetime), options.startRotationY.getValue(lifetime), options.startRotationZ.getValue(lifetime));
|
|
@@ -17728,7 +17960,7 @@ var ParticleSystem = /** @class */ (function (_super) {
|
|
|
17728
17960
|
if (color.length === 3) {
|
|
17729
17961
|
color[3] = 1;
|
|
17730
17962
|
}
|
|
17731
|
-
var size = tempSize
|
|
17963
|
+
var size = tempSize;
|
|
17732
17964
|
if (options.start3DSize) {
|
|
17733
17965
|
size.x = options.startSizeX.getValue(lifetime);
|
|
17734
17966
|
size.y = options.startSizeY.getValue(lifetime);
|
|
@@ -17890,7 +18122,8 @@ var ParticleSystem = /** @class */ (function (_super) {
|
|
|
17890
18122
|
separateAxes: false,
|
|
17891
18123
|
x: createValueGetter(('size' in sizeOverLifetime ? sizeOverLifetime.size : sizeOverLifetime.x) || 1),
|
|
17892
18124
|
};
|
|
17893
|
-
|
|
18125
|
+
renderer.anchor = renderer.anchor || [0, 0];
|
|
18126
|
+
var anchor = Vector2.fromArray(renderer.anchor);
|
|
17894
18127
|
this.options = {
|
|
17895
18128
|
particleFollowParent: !!options.particleFollowParent,
|
|
17896
18129
|
startLifetime: createValueGetter(options.startLifetime),
|
|
@@ -17898,488 +18131,254 @@ var ParticleSystem = /** @class */ (function (_super) {
|
|
|
17898
18131
|
startSpeed: createValueGetter(positionOverLifetime.startSpeed || 0),
|
|
17899
18132
|
startColor: createValueGetter(options.startColor),
|
|
17900
18133
|
// duration:vfxItem.duration || 1,
|
|
17901
|
-
looping: false,
|
|
17902
|
-
maxCount: (_e = options.maxCount) !== null && _e !== void 0 ? _e : 0,
|
|
17903
|
-
gravityModifier: createValueGetter(gravityModifier || 0),
|
|
17904
|
-
gravity: gravity,
|
|
17905
|
-
start3DSize: !!options.start3DSize,
|
|
17906
|
-
startTurbulence: startTurbulence,
|
|
17907
|
-
turbulence: turbulence,
|
|
17908
|
-
speedOverLifetime: positionOverLifetime.speedOverLifetime && createValueGetter(positionOverLifetime.speedOverLifetime),
|
|
17909
|
-
linearVelOverLifetime: linearVelOverLifetime,
|
|
17910
|
-
orbitalVelOverLifetime: orbitalVelOverLifetime,
|
|
17911
|
-
forceTarget: forceTarget,
|
|
17912
|
-
};
|
|
17913
|
-
if (options.startRotationZ) {
|
|
17914
|
-
this.options.startRotation = createValueGetter(options.startRotationZ || 0);
|
|
17915
|
-
}
|
|
17916
|
-
if (options.startRotationX || options.startRotationY) {
|
|
17917
|
-
this.options.start3DRotation = true;
|
|
17918
|
-
this.options.startRotationX = createValueGetter(options.startRotationX || 0);
|
|
17919
|
-
this.options.startRotationY = createValueGetter(options.startRotationY || 0);
|
|
17920
|
-
this.options.startRotationZ = createValueGetter(options.startRotationZ || 0);
|
|
17921
|
-
}
|
|
17922
|
-
if (options.start3DSize) {
|
|
17923
|
-
this.options.startSizeX = createValueGetter(options.startSizeX);
|
|
17924
|
-
this.options.startSizeY = createValueGetter(options.startSizeY);
|
|
17925
|
-
}
|
|
17926
|
-
else {
|
|
17927
|
-
this.options.startSize = createValueGetter(options.startSize);
|
|
17928
|
-
this.options.sizeAspect = createValueGetter(options.sizeAspect || 1);
|
|
17929
|
-
}
|
|
17930
|
-
var particleMeshProps = {
|
|
17931
|
-
// listIndex: vfxItem.listIndex,
|
|
17932
|
-
meshSlots: options.meshSlots,
|
|
17933
|
-
name: this.name,
|
|
17934
|
-
matrix: Matrix4.IDENTITY,
|
|
17935
|
-
filter: props.filter,
|
|
17936
|
-
shaderCachePrefix: shaderCachePrefix,
|
|
17937
|
-
renderMode: renderer.renderMode || RenderMode$1.BILLBOARD,
|
|
17938
|
-
side: renderer.side || SideMode$1.DOUBLE,
|
|
17939
|
-
gravity: gravity,
|
|
17940
|
-
// duration: vfxItem.duration,
|
|
17941
|
-
blending: renderer.blending || BlendingMode$1.ALPHA,
|
|
17942
|
-
rotationOverLifetime: rotationOverLifetime,
|
|
17943
|
-
gravityModifier: this.options.gravityModifier,
|
|
17944
|
-
linearVelOverLifetime: this.options.linearVelOverLifetime,
|
|
17945
|
-
orbitalVelOverLifetime: this.options.orbitalVelOverLifetime,
|
|
17946
|
-
speedOverLifetime: this.options.speedOverLifetime,
|
|
17947
|
-
sprite: textureSheetAnimation,
|
|
17948
|
-
occlusion: !!renderer.occlusion,
|
|
17949
|
-
transparentOcclusion: !!renderer.transparentOcclusion,
|
|
17950
|
-
maxCount: options.maxCount,
|
|
17951
|
-
mask: renderer.mask,
|
|
17952
|
-
maskMode: (_f = renderer.maskMode) !== null && _f !== void 0 ? _f : MaskMode$1.NONE,
|
|
17953
|
-
forceTarget: forceTarget,
|
|
17954
|
-
diffuse: renderer.texture,
|
|
17955
|
-
sizeOverLifetime: sizeOverLifetimeGetter,
|
|
17956
|
-
anchor: anchor,
|
|
17957
|
-
};
|
|
17958
|
-
if (colorOverLifetime) {
|
|
17959
|
-
var color = colorOverLifetime.color, opacity = colorOverLifetime.opacity;
|
|
17960
|
-
particleMeshProps.colorOverLifetime = {};
|
|
17961
|
-
if (opacity) {
|
|
17962
|
-
particleMeshProps.colorOverLifetime.opacity = createValueGetter(colorOverLifetime.opacity);
|
|
17963
|
-
}
|
|
17964
|
-
if (color) {
|
|
17965
|
-
if (color[0] === ValueType$1.GRADIENT_COLOR) {
|
|
17966
|
-
particleMeshProps.colorOverLifetime.color = colorOverLifetime.color[1];
|
|
17967
|
-
}
|
|
17968
|
-
else if (color[0] === ValueType$1.RGBA_COLOR) {
|
|
17969
|
-
particleMeshProps.colorOverLifetime.color = Texture.createWithData(this.engine, {
|
|
17970
|
-
data: new Uint8Array(color[1]),
|
|
17971
|
-
width: 1,
|
|
17972
|
-
height: 1,
|
|
17973
|
-
});
|
|
17974
|
-
}
|
|
17975
|
-
else if (color instanceof Texture) {
|
|
17976
|
-
particleMeshProps.colorOverLifetime.color = color;
|
|
17977
|
-
}
|
|
17978
|
-
}
|
|
17979
|
-
}
|
|
17980
|
-
var uvs = [];
|
|
17981
|
-
var textureMap = [0, 0, 1, 1];
|
|
17982
|
-
var flip;
|
|
17983
|
-
if (props.splits) {
|
|
17984
|
-
var s = props.splits[0];
|
|
17985
|
-
flip = s[4];
|
|
17986
|
-
textureMap = flip ? [s[0], s[1], s[3], s[2]] : [s[0], s[1], s[2], s[3]];
|
|
17987
|
-
}
|
|
17988
|
-
if (textureSheetAnimation && !textureSheetAnimation.animate) {
|
|
17989
|
-
var col = flip ? textureSheetAnimation.row : textureSheetAnimation.col;
|
|
17990
|
-
var row = flip ? textureSheetAnimation.col : textureSheetAnimation.row;
|
|
17991
|
-
var total = textureSheetAnimation.total || col * row;
|
|
17992
|
-
var index$1 = 0;
|
|
17993
|
-
for (var x = 0; x < col; x++) {
|
|
17994
|
-
for (var y = 0; y < row && index$1 < total; y++, index$1++) {
|
|
17995
|
-
uvs.push([
|
|
17996
|
-
x * textureMap[2] / col + textureMap[0],
|
|
17997
|
-
y * textureMap[3] / row + textureMap[1],
|
|
17998
|
-
textureMap[2] / col,
|
|
17999
|
-
textureMap[3] / row
|
|
18000
|
-
]);
|
|
18001
|
-
}
|
|
18002
|
-
}
|
|
18003
|
-
}
|
|
18004
|
-
else {
|
|
18005
|
-
uvs.push(textureMap);
|
|
18006
|
-
}
|
|
18007
|
-
this.uvs = uvs;
|
|
18008
|
-
// @ts-expect-error
|
|
18009
|
-
particleMeshProps.textureFlip = flip;
|
|
18010
|
-
var trails = props.trails;
|
|
18011
|
-
var trailMeshProps;
|
|
18012
|
-
if (trails) {
|
|
18013
|
-
this.trails = {
|
|
18014
|
-
lifetime: createValueGetter(trails.lifetime),
|
|
18015
|
-
dieWithParticles: trails.dieWithParticles !== false,
|
|
18016
|
-
sizeAffectsWidth: !!trails.sizeAffectsWidth,
|
|
18017
|
-
sizeAffectsLifetime: !!trails.sizeAffectsLifetime,
|
|
18018
|
-
inheritParticleColor: !!trails.inheritParticleColor,
|
|
18019
|
-
parentAffectsPosition: !!trails.parentAffectsPosition,
|
|
18020
|
-
};
|
|
18021
|
-
trailMeshProps = {
|
|
18022
|
-
name: 'Trail',
|
|
18023
|
-
matrix: Matrix4.IDENTITY,
|
|
18024
|
-
minimumVertexDistance: trails.minimumVertexDistance || 0.02,
|
|
18025
|
-
maxTrailCount: options.maxCount,
|
|
18026
|
-
pointCountPerTrail: Math.round(trails.maxPointPerTrail) || 32,
|
|
18027
|
-
blending: trails.blending,
|
|
18028
|
-
texture: trails.texture,
|
|
18029
|
-
opacityOverLifetime: createValueGetter(trails.opacityOverLifetime || 1),
|
|
18030
|
-
widthOverTrail: createValueGetter(trails.widthOverTrail || 1),
|
|
18031
|
-
// order: vfxItem.listIndex + (trails.orderOffset || 0),
|
|
18032
|
-
shaderCachePrefix: shaderCachePrefix,
|
|
18033
|
-
lifetime: this.trails.lifetime,
|
|
18034
|
-
occlusion: !!trails.occlusion,
|
|
18035
|
-
transparentOcclusion: !!trails.transparentOcclusion,
|
|
18036
|
-
textureMap: trails.textureMap,
|
|
18037
|
-
mask: renderer.mask,
|
|
18038
|
-
maskMode: renderer.maskMode,
|
|
18039
|
-
};
|
|
18040
|
-
if (trails.colorOverLifetime && trails.colorOverLifetime[0] === ValueType$1.GRADIENT_COLOR) {
|
|
18041
|
-
trailMeshProps.colorOverLifetime = trails.colorOverLifetime[1];
|
|
18042
|
-
}
|
|
18043
|
-
if (trails.colorOverTrail && trails.colorOverTrail[0] === ValueType$1.GRADIENT_COLOR) {
|
|
18044
|
-
trailMeshProps.colorOverTrail = trails.colorOverTrail[1];
|
|
18045
|
-
}
|
|
18046
|
-
}
|
|
18047
|
-
this.renderer = new ParticleSystemRenderer(this.engine, particleMeshProps, trailMeshProps);
|
|
18048
|
-
this.meshes = this.renderer.meshes;
|
|
18049
|
-
// this.item = vfxItem;
|
|
18050
|
-
var interaction = props.interaction;
|
|
18051
|
-
if (interaction) {
|
|
18052
|
-
this.interaction = {
|
|
18053
|
-
multiple: interaction.multiple,
|
|
18054
|
-
radius: interaction.radius,
|
|
18055
|
-
behavior: interaction.behavior,
|
|
18056
|
-
};
|
|
18057
|
-
}
|
|
18058
|
-
this.item.getHitTestParams = this.getHitTestParams;
|
|
18059
|
-
this.item._content = this;
|
|
18060
|
-
this.renderer.item = this.item;
|
|
18061
|
-
this.item.components.push(this.renderer);
|
|
18062
|
-
this.item.rendererComponents.push(this.renderer);
|
|
18063
|
-
// 添加粒子动画 clip
|
|
18064
|
-
var timeline = this.item.getComponent(TimelineComponent);
|
|
18065
|
-
timeline.createTrack(Track).createClip(ParticleBehaviourPlayable);
|
|
18066
|
-
};
|
|
18067
|
-
ParticleSystem = __decorate([
|
|
18068
|
-
effectsClass(DataType.ParticleSystem)
|
|
18069
|
-
], ParticleSystem);
|
|
18070
|
-
return ParticleSystem;
|
|
18071
|
-
}(Component));
|
|
18072
|
-
// array performance better for small memory than Float32Array
|
|
18073
|
-
var tempDir = new Vector3();
|
|
18074
|
-
var tempSize$1 = new Vector2();
|
|
18075
|
-
var tempRot$1 = new Euler();
|
|
18076
|
-
var tmpDirX = new Vector3();
|
|
18077
|
-
var tmpDirY = new Vector3();
|
|
18078
|
-
var tempVec3 = new Vector3();
|
|
18079
|
-
var tempEuler = new Euler();
|
|
18080
|
-
var tempSprite = [0, 0, 0];
|
|
18081
|
-
var tempMat4 = new Matrix4();
|
|
18082
|
-
function getBurstOffsets(burstOffsets) {
|
|
18083
|
-
var ret = {};
|
|
18084
|
-
if (Array.isArray(burstOffsets)) {
|
|
18085
|
-
burstOffsets.forEach(function (arr) {
|
|
18086
|
-
var isArr = arr instanceof Array;
|
|
18087
|
-
var index = isArr ? arr[0] : arr.index;
|
|
18088
|
-
var offsets = ret[index];
|
|
18089
|
-
if (!offsets) {
|
|
18090
|
-
offsets = ret[index] = [];
|
|
18091
|
-
}
|
|
18092
|
-
if (isArr) {
|
|
18093
|
-
offsets.push(arr.slice(1, 4));
|
|
18094
|
-
}
|
|
18095
|
-
else {
|
|
18096
|
-
offsets.push([+arr.x, +arr.y, +arr.z]);
|
|
18097
|
-
}
|
|
18098
|
-
});
|
|
18099
|
-
}
|
|
18100
|
-
return ret;
|
|
18101
|
-
}
|
|
18102
|
-
function randomArrItem(arr, keepArr) {
|
|
18103
|
-
var index = Math.floor(Math.random() * arr.length);
|
|
18104
|
-
var item = arr[index];
|
|
18105
|
-
if (!keepArr) {
|
|
18106
|
-
arr.splice(index, 1);
|
|
18107
|
-
}
|
|
18108
|
-
return item;
|
|
18109
|
-
}
|
|
18110
|
-
|
|
18111
|
-
/**
|
|
18112
|
-
* @since 2.0.0
|
|
18113
|
-
* @internal
|
|
18114
|
-
*/
|
|
18115
|
-
var ParticleBehaviourPlayable = /** @class */ (function (_super) {
|
|
18116
|
-
__extends(ParticleBehaviourPlayable, _super);
|
|
18117
|
-
function ParticleBehaviourPlayable() {
|
|
18118
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
18119
|
-
}
|
|
18120
|
-
ParticleBehaviourPlayable.prototype.onPlayablePlay = function () {
|
|
18121
|
-
this.particleSystem = this.bindingItem.getComponent(ParticleSystem);
|
|
18122
|
-
if (this.particleSystem) {
|
|
18123
|
-
this.particleSystem.name = this.bindingItem.name;
|
|
18124
|
-
this.particleSystem.start();
|
|
18125
|
-
this.particleSystem.initEmitterTransform();
|
|
18134
|
+
looping: false,
|
|
18135
|
+
maxCount: (_e = options.maxCount) !== null && _e !== void 0 ? _e : 0,
|
|
18136
|
+
gravityModifier: createValueGetter(gravityModifier || 0),
|
|
18137
|
+
gravity: gravity,
|
|
18138
|
+
start3DSize: !!options.start3DSize,
|
|
18139
|
+
startTurbulence: startTurbulence,
|
|
18140
|
+
turbulence: turbulence,
|
|
18141
|
+
speedOverLifetime: positionOverLifetime.speedOverLifetime && createValueGetter(positionOverLifetime.speedOverLifetime),
|
|
18142
|
+
linearVelOverLifetime: linearVelOverLifetime,
|
|
18143
|
+
orbitalVelOverLifetime: orbitalVelOverLifetime,
|
|
18144
|
+
forceTarget: forceTarget,
|
|
18145
|
+
};
|
|
18146
|
+
if (options.startRotationZ) {
|
|
18147
|
+
this.options.startRotation = createValueGetter(options.startRotationZ || 0);
|
|
18126
18148
|
}
|
|
18127
|
-
|
|
18128
|
-
|
|
18129
|
-
|
|
18130
|
-
|
|
18131
|
-
this.
|
|
18132
|
-
// TODO: [1.31] @十弦 验证 https://github.com/galacean/effects-runtime/commit/3e7d73d37b7d98c2a25e4544e80e928b17801ccd#diff-fae062f28caf3771cfedd3a20dc22f9749bd054c7541bf2fd50a9a5e413153d4
|
|
18133
|
-
// particleSystem.setParentTransform(parentItem.transform);
|
|
18134
|
-
particleSystem.setVisible(true);
|
|
18135
|
-
particleSystem.onUpdate(dt);
|
|
18149
|
+
if (options.startRotationX || options.startRotationY) {
|
|
18150
|
+
this.options.start3DRotation = true;
|
|
18151
|
+
this.options.startRotationX = createValueGetter(options.startRotationX || 0);
|
|
18152
|
+
this.options.startRotationY = createValueGetter(options.startRotationY || 0);
|
|
18153
|
+
this.options.startRotationZ = createValueGetter(options.startRotationZ || 0);
|
|
18136
18154
|
}
|
|
18137
|
-
|
|
18138
|
-
|
|
18139
|
-
|
|
18140
|
-
|
|
18141
|
-
var CalculateLoader = /** @class */ (function (_super) {
|
|
18142
|
-
__extends(CalculateLoader, _super);
|
|
18143
|
-
function CalculateLoader() {
|
|
18144
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
18145
|
-
}
|
|
18146
|
-
return CalculateLoader;
|
|
18147
|
-
}(AbstractPlugin));
|
|
18148
|
-
|
|
18149
|
-
var AnimationStream = /** @class */ (function () {
|
|
18150
|
-
function AnimationStream(playable) {
|
|
18151
|
-
this.curveValues = {};
|
|
18152
|
-
this.playable = playable;
|
|
18153
|
-
}
|
|
18154
|
-
AnimationStream.prototype.setCurveValue = function (componentType, propertyName, value) {
|
|
18155
|
-
if (!this.findCurveValue(componentType, propertyName)) {
|
|
18156
|
-
this.curveValues[componentType + propertyName] = { componentType: componentType, propertyName: propertyName, value: value };
|
|
18155
|
+
if (options.start3DSize) {
|
|
18156
|
+
this.options.startSizeX = createValueGetter(options.startSizeX);
|
|
18157
|
+
this.options.startSizeY = createValueGetter(options.startSizeY);
|
|
18157
18158
|
}
|
|
18158
18159
|
else {
|
|
18159
|
-
this.
|
|
18160
|
-
|
|
18161
|
-
return this.curveValues[componentType + propertyName];
|
|
18162
|
-
};
|
|
18163
|
-
AnimationStream.prototype.findCurveValue = function (componentType, propertyName) {
|
|
18164
|
-
return this.curveValues[componentType + propertyName];
|
|
18165
|
-
};
|
|
18166
|
-
AnimationStream.prototype.getInputStream = function (index) {
|
|
18167
|
-
var inputPlayable = this.playable.getInput(index);
|
|
18168
|
-
if (inputPlayable instanceof AnimationPlayable) {
|
|
18169
|
-
return inputPlayable.animationStream;
|
|
18170
|
-
}
|
|
18171
|
-
};
|
|
18172
|
-
return AnimationStream;
|
|
18173
|
-
}());
|
|
18174
|
-
|
|
18175
|
-
var AnimationPlayable = /** @class */ (function (_super) {
|
|
18176
|
-
__extends(AnimationPlayable, _super);
|
|
18177
|
-
function AnimationPlayable() {
|
|
18178
|
-
var _this = _super.call(this) || this;
|
|
18179
|
-
_this.animationStream = new AnimationStream(_this);
|
|
18180
|
-
return _this;
|
|
18181
|
-
}
|
|
18182
|
-
return AnimationPlayable;
|
|
18183
|
-
}(Playable));
|
|
18184
|
-
|
|
18185
|
-
var tempRot = new Euler();
|
|
18186
|
-
var tempSize = new Vector3(1, 1, 1);
|
|
18187
|
-
var tempPos = new Vector3();
|
|
18188
|
-
/**
|
|
18189
|
-
* @since 2.0.0
|
|
18190
|
-
* @internal
|
|
18191
|
-
*/
|
|
18192
|
-
var AnimationClipPlayable = /** @class */ (function (_super) {
|
|
18193
|
-
__extends(AnimationClipPlayable, _super);
|
|
18194
|
-
function AnimationClipPlayable() {
|
|
18195
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
18196
|
-
}
|
|
18197
|
-
AnimationClipPlayable.prototype.processFrame = function (dt) {
|
|
18198
|
-
if (this.bindingItem.composition) {
|
|
18199
|
-
this.sampleAnimation();
|
|
18160
|
+
this.options.startSize = createValueGetter(options.startSize);
|
|
18161
|
+
this.options.sizeAspect = createValueGetter(options.sizeAspect || 1);
|
|
18200
18162
|
}
|
|
18201
|
-
|
|
18202
|
-
|
|
18203
|
-
|
|
18204
|
-
|
|
18205
|
-
|
|
18206
|
-
|
|
18207
|
-
|
|
18208
|
-
|
|
18209
|
-
|
|
18210
|
-
|
|
18211
|
-
|
|
18212
|
-
|
|
18213
|
-
|
|
18214
|
-
|
|
18163
|
+
var particleMeshProps = {
|
|
18164
|
+
// listIndex: vfxItem.listIndex,
|
|
18165
|
+
meshSlots: options.meshSlots,
|
|
18166
|
+
name: this.name,
|
|
18167
|
+
matrix: Matrix4.IDENTITY,
|
|
18168
|
+
filter: props.filter,
|
|
18169
|
+
shaderCachePrefix: shaderCachePrefix,
|
|
18170
|
+
renderMode: renderer.renderMode || RenderMode$1.BILLBOARD,
|
|
18171
|
+
side: renderer.side || SideMode$1.DOUBLE,
|
|
18172
|
+
gravity: gravity,
|
|
18173
|
+
// duration: vfxItem.duration,
|
|
18174
|
+
blending: renderer.blending || BlendingMode$1.ALPHA,
|
|
18175
|
+
rotationOverLifetime: rotationOverLifetime,
|
|
18176
|
+
gravityModifier: this.options.gravityModifier,
|
|
18177
|
+
linearVelOverLifetime: this.options.linearVelOverLifetime,
|
|
18178
|
+
orbitalVelOverLifetime: this.options.orbitalVelOverLifetime,
|
|
18179
|
+
speedOverLifetime: this.options.speedOverLifetime,
|
|
18180
|
+
sprite: textureSheetAnimation,
|
|
18181
|
+
occlusion: !!renderer.occlusion,
|
|
18182
|
+
transparentOcclusion: !!renderer.transparentOcclusion,
|
|
18183
|
+
maxCount: options.maxCount,
|
|
18184
|
+
mask: renderer.mask,
|
|
18185
|
+
maskMode: (_f = renderer.maskMode) !== null && _f !== void 0 ? _f : MaskMode$1.NONE,
|
|
18186
|
+
forceTarget: forceTarget,
|
|
18187
|
+
diffuse: renderer.texture,
|
|
18188
|
+
sizeOverLifetime: sizeOverLifetimeGetter,
|
|
18189
|
+
anchor: anchor,
|
|
18190
|
+
};
|
|
18191
|
+
if (colorOverLifetime) {
|
|
18192
|
+
var color = colorOverLifetime.color, opacity = colorOverLifetime.opacity;
|
|
18193
|
+
particleMeshProps.colorOverLifetime = {};
|
|
18194
|
+
if (opacity) {
|
|
18195
|
+
particleMeshProps.colorOverLifetime.opacity = createValueGetter(colorOverLifetime.opacity);
|
|
18215
18196
|
}
|
|
18216
|
-
|
|
18217
|
-
|
|
18197
|
+
if (color) {
|
|
18198
|
+
if (color[0] === ValueType$1.GRADIENT_COLOR) {
|
|
18199
|
+
particleMeshProps.colorOverLifetime.color = colorOverLifetime.color[1];
|
|
18200
|
+
}
|
|
18201
|
+
else if (color[0] === ValueType$1.RGBA_COLOR) {
|
|
18202
|
+
particleMeshProps.colorOverLifetime.color = Texture.createWithData(this.engine, {
|
|
18203
|
+
data: new Uint8Array(color[1]),
|
|
18204
|
+
width: 1,
|
|
18205
|
+
height: 1,
|
|
18206
|
+
});
|
|
18207
|
+
}
|
|
18208
|
+
else if (color instanceof Texture) {
|
|
18209
|
+
particleMeshProps.colorOverLifetime.color = color;
|
|
18210
|
+
}
|
|
18218
18211
|
}
|
|
18219
|
-
var startSize = this.originalTransform.scale;
|
|
18220
|
-
this.bindingItem.transform.setScale(tempSize.x * startSize.x, tempSize.y * startSize.y, tempSize.z * startSize.z);
|
|
18221
|
-
// this.animationStream.setCurveValue('transform', 'scale.x', tempSize.x * startSize.x);
|
|
18222
|
-
// this.animationStream.setCurveValue('transform', 'scale.y', tempSize.y * startSize.y);
|
|
18223
|
-
// this.animationStream.setCurveValue('transform', 'scale.z', tempSize.z * startSize.z);
|
|
18224
18212
|
}
|
|
18225
|
-
|
|
18226
|
-
|
|
18227
|
-
|
|
18228
|
-
|
|
18229
|
-
|
|
18230
|
-
|
|
18231
|
-
|
|
18232
|
-
var rot = tempRot.addEulers(this.originalTransform.rotation, tempRot);
|
|
18233
|
-
this.bindingItem.transform.setRotation(rot.x, rot.y, rot.z);
|
|
18234
|
-
// this.animationStream.setCurveValue('transform', 'rotation.x', rot.x);
|
|
18235
|
-
// this.animationStream.setCurveValue('transform', 'rotation.y', rot.y);
|
|
18236
|
-
// this.animationStream.setCurveValue('transform', 'rotation.z', rot.z);
|
|
18213
|
+
var uvs = [];
|
|
18214
|
+
var textureMap = [0, 0, 1, 1];
|
|
18215
|
+
var flip;
|
|
18216
|
+
if (props.splits) {
|
|
18217
|
+
var s = props.splits[0];
|
|
18218
|
+
flip = s[4];
|
|
18219
|
+
textureMap = flip ? [s[0], s[1], s[3], s[2]] : [s[0], s[1], s[2], s[3]];
|
|
18237
18220
|
}
|
|
18238
|
-
if (
|
|
18239
|
-
var
|
|
18240
|
-
|
|
18241
|
-
|
|
18242
|
-
|
|
18221
|
+
if (textureSheetAnimation && !textureSheetAnimation.animate) {
|
|
18222
|
+
var col = flip ? textureSheetAnimation.row : textureSheetAnimation.col;
|
|
18223
|
+
var row = flip ? textureSheetAnimation.col : textureSheetAnimation.row;
|
|
18224
|
+
var total = textureSheetAnimation.total || col * row;
|
|
18225
|
+
var index$1 = 0;
|
|
18226
|
+
for (var x = 0; x < col; x++) {
|
|
18227
|
+
for (var y = 0; y < row && index$1 < total; y++, index$1++) {
|
|
18228
|
+
uvs.push([
|
|
18229
|
+
x * textureMap[2] / col + textureMap[0],
|
|
18230
|
+
y * textureMap[3] / row + textureMap[1],
|
|
18231
|
+
textureMap[2] / col,
|
|
18232
|
+
textureMap[3] / row
|
|
18233
|
+
]);
|
|
18234
|
+
}
|
|
18243
18235
|
}
|
|
18244
|
-
this.bindingItem.transform.setPosition(pos.x, pos.y, pos.z);
|
|
18245
|
-
// this.animationStream.setCurveValue('transform', 'position.x', pos.x);
|
|
18246
|
-
// this.animationStream.setCurveValue('transform', 'position.y', pos.y);
|
|
18247
|
-
// this.animationStream.setCurveValue('transform', 'position.z', pos.z);
|
|
18248
18236
|
}
|
|
18249
|
-
|
|
18250
|
-
|
|
18251
|
-
var _a;
|
|
18252
|
-
var scale = this.bindingItem.transform.scale;
|
|
18253
|
-
this.originalTransform = {
|
|
18254
|
-
position: this.bindingItem.transform.position.clone(),
|
|
18255
|
-
rotation: this.bindingItem.transform.getRotation().clone(),
|
|
18256
|
-
// TODO 编辑器 scale 没有z轴控制
|
|
18257
|
-
scale: new Vector3(scale.x, scale.y, scale.x),
|
|
18258
|
-
};
|
|
18259
|
-
var positionOverLifetime = data.positionOverLifetime;
|
|
18260
|
-
var rotationOverLifetime = data.rotationOverLifetime;
|
|
18261
|
-
var sizeOverLifetime = data.sizeOverLifetime;
|
|
18262
|
-
// TODO: 没有 K 帧数据的不需要传 positionOverLifetime 空对象
|
|
18263
|
-
if (positionOverLifetime && Object.keys(positionOverLifetime).length !== 0) {
|
|
18264
|
-
this.positionOverLifetime = positionOverLifetime;
|
|
18265
|
-
if (positionOverLifetime.path) {
|
|
18266
|
-
this.originalTransform.path = createValueGetter(positionOverLifetime.path);
|
|
18267
|
-
}
|
|
18268
|
-
var linearVelEnable = positionOverLifetime.linearX || positionOverLifetime.linearY || positionOverLifetime.linearZ;
|
|
18269
|
-
if (linearVelEnable) {
|
|
18270
|
-
this.linearVelOverLifetime = {
|
|
18271
|
-
x: positionOverLifetime.linearX && createValueGetter(positionOverLifetime.linearX),
|
|
18272
|
-
y: positionOverLifetime.linearY && createValueGetter(positionOverLifetime.linearY),
|
|
18273
|
-
z: positionOverLifetime.linearZ && createValueGetter(positionOverLifetime.linearZ),
|
|
18274
|
-
asMovement: positionOverLifetime.asMovement,
|
|
18275
|
-
enabled: !!linearVelEnable,
|
|
18276
|
-
};
|
|
18277
|
-
}
|
|
18278
|
-
var orbitalVelEnable = positionOverLifetime.orbitalX || positionOverLifetime.orbitalY || positionOverLifetime.orbitalZ;
|
|
18279
|
-
if (orbitalVelEnable) {
|
|
18280
|
-
this.orbitalVelOverLifetime = {
|
|
18281
|
-
x: positionOverLifetime.orbitalX && createValueGetter(positionOverLifetime.orbitalX),
|
|
18282
|
-
y: positionOverLifetime.orbitalY && createValueGetter(positionOverLifetime.orbitalY),
|
|
18283
|
-
z: positionOverLifetime.orbitalZ && createValueGetter(positionOverLifetime.orbitalZ),
|
|
18284
|
-
center: ensureVec3(positionOverLifetime.orbCenter),
|
|
18285
|
-
asRotation: positionOverLifetime.asRotation,
|
|
18286
|
-
enabled: !!orbitalVelEnable,
|
|
18287
|
-
};
|
|
18288
|
-
}
|
|
18289
|
-
this.speedOverLifetime = positionOverLifetime.speedOverLifetime && createValueGetter(positionOverLifetime.speedOverLifetime);
|
|
18237
|
+
else {
|
|
18238
|
+
uvs.push(textureMap);
|
|
18290
18239
|
}
|
|
18291
|
-
|
|
18292
|
-
|
|
18293
|
-
|
|
18294
|
-
|
|
18295
|
-
|
|
18296
|
-
|
|
18240
|
+
this.uvs = uvs;
|
|
18241
|
+
// @ts-expect-error
|
|
18242
|
+
particleMeshProps.textureFlip = flip;
|
|
18243
|
+
var trails = props.trails;
|
|
18244
|
+
var trailMeshProps;
|
|
18245
|
+
if (trails) {
|
|
18246
|
+
this.trails = {
|
|
18247
|
+
lifetime: createValueGetter(trails.lifetime),
|
|
18248
|
+
dieWithParticles: trails.dieWithParticles !== false,
|
|
18249
|
+
sizeAffectsWidth: !!trails.sizeAffectsWidth,
|
|
18250
|
+
sizeAffectsLifetime: !!trails.sizeAffectsLifetime,
|
|
18251
|
+
inheritParticleColor: !!trails.inheritParticleColor,
|
|
18252
|
+
parentAffectsPosition: !!trails.parentAffectsPosition,
|
|
18253
|
+
};
|
|
18254
|
+
trailMeshProps = {
|
|
18255
|
+
name: 'Trail',
|
|
18256
|
+
matrix: Matrix4.IDENTITY,
|
|
18257
|
+
minimumVertexDistance: trails.minimumVertexDistance || 0.02,
|
|
18258
|
+
maxTrailCount: options.maxCount,
|
|
18259
|
+
pointCountPerTrail: Math.round(trails.maxPointPerTrail) || 32,
|
|
18260
|
+
blending: trails.blending,
|
|
18261
|
+
texture: trails.texture,
|
|
18262
|
+
opacityOverLifetime: createValueGetter(trails.opacityOverLifetime || 1),
|
|
18263
|
+
widthOverTrail: createValueGetter(trails.widthOverTrail || 1),
|
|
18264
|
+
// order: vfxItem.listIndex + (trails.orderOffset || 0),
|
|
18265
|
+
shaderCachePrefix: shaderCachePrefix,
|
|
18266
|
+
lifetime: this.trails.lifetime,
|
|
18267
|
+
occlusion: !!trails.occlusion,
|
|
18268
|
+
transparentOcclusion: !!trails.transparentOcclusion,
|
|
18269
|
+
textureMap: trails.textureMap,
|
|
18270
|
+
mask: renderer.mask,
|
|
18271
|
+
maskMode: renderer.maskMode,
|
|
18272
|
+
};
|
|
18273
|
+
if (trails.colorOverLifetime && trails.colorOverLifetime[0] === ValueType$1.GRADIENT_COLOR) {
|
|
18274
|
+
trailMeshProps.colorOverLifetime = trails.colorOverLifetime[1];
|
|
18297
18275
|
}
|
|
18298
|
-
|
|
18299
|
-
|
|
18276
|
+
if (trails.colorOverTrail && trails.colorOverTrail[0] === ValueType$1.GRADIENT_COLOR) {
|
|
18277
|
+
trailMeshProps.colorOverTrail = trails.colorOverTrail[1];
|
|
18300
18278
|
}
|
|
18301
18279
|
}
|
|
18302
|
-
|
|
18303
|
-
|
|
18304
|
-
|
|
18305
|
-
|
|
18306
|
-
|
|
18280
|
+
this.renderer = new ParticleSystemRenderer(this.engine, particleMeshProps, trailMeshProps);
|
|
18281
|
+
this.meshes = this.renderer.meshes;
|
|
18282
|
+
// this.item = vfxItem;
|
|
18283
|
+
var interaction = props.interaction;
|
|
18284
|
+
if (interaction) {
|
|
18285
|
+
this.interaction = {
|
|
18286
|
+
multiple: interaction.multiple,
|
|
18287
|
+
radius: interaction.radius,
|
|
18288
|
+
behavior: interaction.behavior,
|
|
18307
18289
|
};
|
|
18308
|
-
if (rotationOverLifetime.separateAxes) {
|
|
18309
|
-
var rotLt = this.rotationOverLifetime;
|
|
18310
|
-
rotLt.x = createValueGetter(rotationOverLifetime.x || 0);
|
|
18311
|
-
rotLt.y = createValueGetter(rotationOverLifetime.y || 0);
|
|
18312
|
-
}
|
|
18313
18290
|
}
|
|
18314
|
-
this.
|
|
18315
|
-
this.
|
|
18316
|
-
this.
|
|
18317
|
-
this.
|
|
18318
|
-
this.
|
|
18319
|
-
|
|
18291
|
+
this.item.getHitTestParams = this.getHitTestParams;
|
|
18292
|
+
this.item._content = this;
|
|
18293
|
+
this.renderer.item = this.item;
|
|
18294
|
+
this.item.components.push(this.renderer);
|
|
18295
|
+
this.item.rendererComponents.push(this.renderer);
|
|
18296
|
+
// 添加粒子动画 clip
|
|
18297
|
+
var timeline = this.item.getComponent(TimelineComponent);
|
|
18298
|
+
timeline.createTrack(Track).createClip(ParticleBehaviourPlayable);
|
|
18320
18299
|
};
|
|
18321
|
-
|
|
18322
|
-
|
|
18300
|
+
ParticleSystem = __decorate([
|
|
18301
|
+
effectsClass(DataType.ParticleSystem)
|
|
18302
|
+
], ParticleSystem);
|
|
18303
|
+
return ParticleSystem;
|
|
18304
|
+
}(Component));
|
|
18305
|
+
// array performance better for small memory than Float32Array
|
|
18306
|
+
var tempDir = new Vector3();
|
|
18307
|
+
var tempSize = new Vector2();
|
|
18308
|
+
var tempRot = new Euler();
|
|
18309
|
+
var tmpDirX = new Vector3();
|
|
18310
|
+
var tmpDirY = new Vector3();
|
|
18311
|
+
var tempVec3 = new Vector3();
|
|
18312
|
+
var tempEuler = new Euler();
|
|
18313
|
+
var tempSprite = [0, 0, 0];
|
|
18314
|
+
var tempMat4 = new Matrix4();
|
|
18315
|
+
function getBurstOffsets(burstOffsets) {
|
|
18316
|
+
var ret = {};
|
|
18317
|
+
if (Array.isArray(burstOffsets)) {
|
|
18318
|
+
burstOffsets.forEach(function (arr) {
|
|
18319
|
+
var isArr = arr instanceof Array;
|
|
18320
|
+
var index = isArr ? arr[0] : arr.index;
|
|
18321
|
+
var offsets = ret[index];
|
|
18322
|
+
if (!offsets) {
|
|
18323
|
+
offsets = ret[index] = [];
|
|
18324
|
+
}
|
|
18325
|
+
if (isArr) {
|
|
18326
|
+
offsets.push(arr.slice(1, 4));
|
|
18327
|
+
}
|
|
18328
|
+
else {
|
|
18329
|
+
offsets.push([+arr.x, +arr.y, +arr.z]);
|
|
18330
|
+
}
|
|
18331
|
+
});
|
|
18332
|
+
}
|
|
18333
|
+
return ret;
|
|
18334
|
+
}
|
|
18335
|
+
function randomArrItem(arr, keepArr) {
|
|
18336
|
+
var index = Math.floor(Math.random() * arr.length);
|
|
18337
|
+
var item = arr[index];
|
|
18338
|
+
if (!keepArr) {
|
|
18339
|
+
arr.splice(index, 1);
|
|
18340
|
+
}
|
|
18341
|
+
return item;
|
|
18342
|
+
}
|
|
18343
|
+
|
|
18323
18344
|
/**
|
|
18324
18345
|
* @since 2.0.0
|
|
18325
18346
|
* @internal
|
|
18326
18347
|
*/
|
|
18327
|
-
var
|
|
18328
|
-
__extends(
|
|
18329
|
-
function
|
|
18348
|
+
var ParticleBehaviourPlayable = /** @class */ (function (_super) {
|
|
18349
|
+
__extends(ParticleBehaviourPlayable, _super);
|
|
18350
|
+
function ParticleBehaviourPlayable() {
|
|
18330
18351
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
18331
18352
|
}
|
|
18332
|
-
|
|
18333
|
-
this.bindingItem.
|
|
18334
|
-
this.
|
|
18335
|
-
|
|
18336
|
-
|
|
18337
|
-
|
|
18338
|
-
this.showRendererComponents();
|
|
18339
|
-
};
|
|
18340
|
-
ActivationClipPlayable.prototype.onPlayableDestroy = function () {
|
|
18341
|
-
this.bindingItem.transform.setValid(false);
|
|
18342
|
-
this.hideRendererComponents();
|
|
18343
|
-
};
|
|
18344
|
-
ActivationClipPlayable.prototype.hideRendererComponents = function () {
|
|
18345
|
-
var e_1, _a;
|
|
18346
|
-
try {
|
|
18347
|
-
for (var _b = __values$1(this.bindingItem.rendererComponents), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
18348
|
-
var rendererComponent = _c.value;
|
|
18349
|
-
if (rendererComponent.enabled) {
|
|
18350
|
-
rendererComponent.enabled = false;
|
|
18351
|
-
}
|
|
18352
|
-
}
|
|
18353
|
-
}
|
|
18354
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
18355
|
-
finally {
|
|
18356
|
-
try {
|
|
18357
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
18358
|
-
}
|
|
18359
|
-
finally { if (e_1) throw e_1.error; }
|
|
18353
|
+
ParticleBehaviourPlayable.prototype.onPlayablePlay = function () {
|
|
18354
|
+
this.particleSystem = this.bindingItem.getComponent(ParticleSystem);
|
|
18355
|
+
if (this.particleSystem) {
|
|
18356
|
+
this.particleSystem.name = this.bindingItem.name;
|
|
18357
|
+
this.particleSystem.start();
|
|
18358
|
+
this.particleSystem.initEmitterTransform();
|
|
18360
18359
|
}
|
|
18361
18360
|
};
|
|
18362
|
-
|
|
18363
|
-
var
|
|
18364
|
-
|
|
18365
|
-
|
|
18366
|
-
|
|
18367
|
-
|
|
18368
|
-
|
|
18369
|
-
|
|
18370
|
-
}
|
|
18371
|
-
}
|
|
18372
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
18373
|
-
finally {
|
|
18374
|
-
try {
|
|
18375
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
18376
|
-
}
|
|
18377
|
-
finally { if (e_2) throw e_2.error; }
|
|
18361
|
+
ParticleBehaviourPlayable.prototype.processFrame = function (dt) {
|
|
18362
|
+
var particleSystem = this.particleSystem;
|
|
18363
|
+
if (particleSystem) {
|
|
18364
|
+
this.bindingItem.parent;
|
|
18365
|
+
// TODO: [1.31] @十弦 验证 https://github.com/galacean/effects-runtime/commit/3e7d73d37b7d98c2a25e4544e80e928b17801ccd#diff-fae062f28caf3771cfedd3a20dc22f9749bd054c7541bf2fd50a9a5e413153d4
|
|
18366
|
+
// particleSystem.setParentTransform(parentItem.transform);
|
|
18367
|
+
particleSystem.setVisible(true);
|
|
18368
|
+
particleSystem.onUpdate(dt);
|
|
18378
18369
|
}
|
|
18379
18370
|
};
|
|
18380
|
-
return
|
|
18371
|
+
return ParticleBehaviourPlayable;
|
|
18381
18372
|
}(Playable));
|
|
18382
18373
|
|
|
18374
|
+
var CalculateLoader = /** @class */ (function (_super) {
|
|
18375
|
+
__extends(CalculateLoader, _super);
|
|
18376
|
+
function CalculateLoader() {
|
|
18377
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
18378
|
+
}
|
|
18379
|
+
return CalculateLoader;
|
|
18380
|
+
}(AbstractPlugin));
|
|
18381
|
+
|
|
18383
18382
|
var TextLayout = /** @class */ (function () {
|
|
18384
18383
|
function TextLayout(options) {
|
|
18385
18384
|
this.width = 0;
|
|
@@ -19677,9 +19676,10 @@ var TextComponent = /** @class */ (function (_super) {
|
|
|
19677
19676
|
if (this.textStyle.fontSize === value) {
|
|
19678
19677
|
return;
|
|
19679
19678
|
}
|
|
19679
|
+
// 保证字号变化后位置正常
|
|
19680
|
+
var diff = this.textStyle.fontSize - value;
|
|
19681
|
+
this.textLayout.lineHeight += diff;
|
|
19680
19682
|
this.textStyle.fontSize = value;
|
|
19681
|
-
// 1.5175 = 31.43 / 20
|
|
19682
|
-
this.textLayout.lineHeight = this.textStyle.fontSize * 1.5175;
|
|
19683
19683
|
this.isDirty = true;
|
|
19684
19684
|
};
|
|
19685
19685
|
/**
|
|
@@ -20005,7 +20005,7 @@ var TextLoader = /** @class */ (function (_super) {
|
|
|
20005
20005
|
return TextLoader;
|
|
20006
20006
|
}(AbstractPlugin));
|
|
20007
20007
|
|
|
20008
|
-
var seed$
|
|
20008
|
+
var seed$1 = 1;
|
|
20009
20009
|
/**
|
|
20010
20010
|
* @since 2.0.0
|
|
20011
20011
|
* @internal
|
|
@@ -20031,24 +20031,9 @@ var EffectComponent = /** @class */ (function (_super) {
|
|
|
20031
20031
|
};
|
|
20032
20032
|
}
|
|
20033
20033
|
};
|
|
20034
|
-
_this.id = 'Mesh' + seed$
|
|
20034
|
+
_this.id = 'Mesh' + seed$1++;
|
|
20035
20035
|
_this.name = '<unnamed>';
|
|
20036
20036
|
_this._priority = 0;
|
|
20037
|
-
_this.geometry = Geometry.create(_this.engine);
|
|
20038
|
-
var geometryData = {
|
|
20039
|
-
vertices: [
|
|
20040
|
-
-1, 1, 0,
|
|
20041
|
-
-1, -1, 0,
|
|
20042
|
-
1, 1, 0,
|
|
20043
|
-
1, -1, 0, //右下
|
|
20044
|
-
],
|
|
20045
|
-
uvs: [0, 1, 0, 0, 1, 1, 1, 0],
|
|
20046
|
-
indices: [0, 1, 2, 2, 1, 3],
|
|
20047
|
-
dataType: DataType.Geometry,
|
|
20048
|
-
id: generateGUID(),
|
|
20049
|
-
};
|
|
20050
|
-
_this.geometry.fromData(geometryData);
|
|
20051
|
-
_this.triangles = geometryToTriangles(_this.geometry);
|
|
20052
20037
|
return _this;
|
|
20053
20038
|
}
|
|
20054
20039
|
Object.defineProperty(EffectComponent.prototype, "isDestroyed", {
|
|
@@ -20585,11 +20570,6 @@ var VFXItem = /** @class */ (function (_super) {
|
|
|
20585
20570
|
this.id = id.toString(); // TODO 老数据 id 是 number,需要转换
|
|
20586
20571
|
this.name = name;
|
|
20587
20572
|
this.start = delay ? delay : this.start;
|
|
20588
|
-
// TODO spec 数据需要区分 scale 和 size
|
|
20589
|
-
if (transform && transform.scale && data.type !== 'ECS') {
|
|
20590
|
-
//@ts-expect-error TODO 数据改造后移除 expect-error
|
|
20591
|
-
transform.scale.z = transform.scale.x;
|
|
20592
|
-
}
|
|
20593
20573
|
if (transform) {
|
|
20594
20574
|
//@ts-expect-error TODO 数据改造后移除 expect-error
|
|
20595
20575
|
transform.position = new Vector3().copyFrom(transform.position);
|
|
@@ -20597,51 +20577,36 @@ var VFXItem = /** @class */ (function (_super) {
|
|
|
20597
20577
|
transform.rotation = new Euler().copyFrom(transform.rotation);
|
|
20598
20578
|
//@ts-expect-error
|
|
20599
20579
|
transform.scale = new Vector3().copyFrom(transform.scale);
|
|
20580
|
+
//@ts-expect-error
|
|
20581
|
+
if (transform.size) {
|
|
20582
|
+
//@ts-expect-error
|
|
20583
|
+
transform.size = new Vector2().copyFrom(transform.size);
|
|
20584
|
+
}
|
|
20585
|
+
//@ts-expect-error
|
|
20586
|
+
if (transform.anchor) {
|
|
20587
|
+
//@ts-expect-error
|
|
20588
|
+
transform.anchor = new Vector2().copyFrom(transform.anchor);
|
|
20589
|
+
}
|
|
20600
20590
|
this.transform.setTransform(transform);
|
|
20601
20591
|
}
|
|
20602
20592
|
this.transform.name = this.name;
|
|
20603
20593
|
this.transform.engine = this.engine;
|
|
20604
|
-
// TODO spec 数据需要区分 scale 和 size
|
|
20605
|
-
if (data.type === ItemType$1.sprite && transform) {
|
|
20606
|
-
this.transform.setSize(this.transform.scale.x, this.transform.scale.y);
|
|
20607
|
-
this.transform.setScale(1, 1, 1);
|
|
20608
|
-
}
|
|
20609
20594
|
this.parentId = parentId;
|
|
20610
20595
|
this.duration = duration;
|
|
20611
20596
|
this.endBehavior = endBehavior;
|
|
20612
|
-
// TODO: 放到 Spec 处理
|
|
20613
|
-
if (this.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY$1 || this.endBehavior === END_BEHAVIOR_PAUSE$1) {
|
|
20614
|
-
this.endBehavior = END_BEHAVIOR_FREEZE$1;
|
|
20615
|
-
}
|
|
20616
20597
|
this.lifetime = -(this.start / this.duration);
|
|
20617
20598
|
this.listIndex = listIndex;
|
|
20599
|
+
//@ts-expect-error
|
|
20600
|
+
this.oldId = data.oldId;
|
|
20618
20601
|
if (!data.content) {
|
|
20619
20602
|
data.content = { options: {} };
|
|
20620
20603
|
}
|
|
20621
20604
|
var timelineComponent = this.getComponent(TimelineComponent);
|
|
20622
20605
|
timelineComponent.fromData(data.content);
|
|
20623
|
-
// TODO anchor 应该放在 transform data
|
|
20624
|
-
if (data.type === ItemType$1.sprite) {
|
|
20625
|
-
var content = data.content;
|
|
20626
|
-
if (!content.renderer) {
|
|
20627
|
-
//@ts-expect-error
|
|
20628
|
-
content.renderer = {};
|
|
20629
|
-
}
|
|
20630
|
-
var realAnchor = convertAnchor(content.renderer.anchor, content.renderer.particleOrigin);
|
|
20631
|
-
var startSize = this.transform.size;
|
|
20632
|
-
// 兼容旧JSON(anchor和particleOrigin可能同时存在)
|
|
20633
|
-
if (!content.renderer.anchor && content.renderer.particleOrigin !== undefined) {
|
|
20634
|
-
this.transform.position.add([-realAnchor[0] * startSize.x, -realAnchor[1] * startSize.y, 0]);
|
|
20635
|
-
}
|
|
20636
|
-
this.transform.setAnchor(realAnchor[0] * startSize.x, realAnchor[1] * startSize.y, 0);
|
|
20637
|
-
}
|
|
20638
|
-
// TODO 要放在上面的 if 后面添加,否则会 position 初始化错误
|
|
20639
20606
|
if (this.type !== ItemType$1.particle) {
|
|
20640
20607
|
var track = timelineComponent.createTrack(Track, 'AnimationTrack');
|
|
20641
20608
|
track.createClip(AnimationClipPlayable, 'AnimationTimelineClip').playable.fromData(data.content);
|
|
20642
20609
|
}
|
|
20643
|
-
var activationTrack = timelineComponent.createTrack(Track, 'ActivationTrack');
|
|
20644
|
-
activationTrack.createClip(ActivationClipPlayable, 'ActivationTimelineClip');
|
|
20645
20610
|
if (duration <= 0) {
|
|
20646
20611
|
throw Error("Item duration can't be less than 0, see ".concat(HELP_LINK['Item duration can\'t be less than 0']));
|
|
20647
20612
|
}
|
|
@@ -22656,7 +22621,7 @@ function isScene(scene) {
|
|
|
22656
22621
|
|
|
22657
22622
|
function version3Migration(scene) {
|
|
22658
22623
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
|
|
22659
|
-
scene.jsonScene.version = 3.0;
|
|
22624
|
+
scene.jsonScene.version = '3.0';
|
|
22660
22625
|
var ecScene = scene.jsonScene;
|
|
22661
22626
|
if (!ecScene.items) {
|
|
22662
22627
|
ecScene.items = [];
|
|
@@ -22668,6 +22633,10 @@ function version3Migration(scene) {
|
|
|
22668
22633
|
for (var i = 0; i < composition.items.length; i++) {
|
|
22669
22634
|
ecScene.items.push(composition.items[i]);
|
|
22670
22635
|
}
|
|
22636
|
+
// composition 的 endbehaviour 兼容
|
|
22637
|
+
if (composition.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY$1 || composition.endBehavior === END_BEHAVIOR_PAUSE$1) {
|
|
22638
|
+
composition.endBehavior = END_BEHAVIOR_FREEZE$1;
|
|
22639
|
+
}
|
|
22671
22640
|
}
|
|
22672
22641
|
}
|
|
22673
22642
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -22683,6 +22652,9 @@ function version3Migration(scene) {
|
|
|
22683
22652
|
for (var _j = __values$1(ecScene.items), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
22684
22653
|
var item = _k.value;
|
|
22685
22654
|
itemGuidMap[item.id] = generateGUID();
|
|
22655
|
+
// TODO: 编辑器测试用,上线后删除
|
|
22656
|
+
//@ts-expect-error
|
|
22657
|
+
item.oldId = item.id;
|
|
22686
22658
|
item.id = itemGuidMap[item.id];
|
|
22687
22659
|
}
|
|
22688
22660
|
}
|
|
@@ -22790,12 +22762,61 @@ function version3Migration(scene) {
|
|
|
22790
22762
|
if (!scale) {
|
|
22791
22763
|
scale = [1, 1, 1];
|
|
22792
22764
|
}
|
|
22765
|
+
item.transform = {
|
|
22766
|
+
//@ts-expect-error
|
|
22767
|
+
position: { x: position[0], y: position[1], z: position[2] },
|
|
22768
|
+
//@ts-expect-error
|
|
22769
|
+
rotation: { x: rotation[0], y: rotation[1], z: rotation[2] },
|
|
22770
|
+
//@ts-expect-error
|
|
22771
|
+
scale: { x: scale[0], y: scale[1], z: scale[0] },
|
|
22772
|
+
};
|
|
22773
|
+
// sprite 的 scale 转为 size
|
|
22774
|
+
if (item.type === ItemType$1.sprite) {
|
|
22775
|
+
//@ts-expect-error
|
|
22776
|
+
item.transform.size = { x: scale[0], y: scale[1] };
|
|
22777
|
+
//@ts-expect-error
|
|
22778
|
+
item.transform.scale = { x: 1, y: 1, z: 1 };
|
|
22779
|
+
}
|
|
22780
|
+
// sprite 的 anchor 修正
|
|
22781
|
+
if (item.type === ItemType$1.sprite) {
|
|
22782
|
+
var content = item.content;
|
|
22783
|
+
//@ts-expect-error
|
|
22784
|
+
if (!content.renderer) {
|
|
22785
|
+
//@ts-expect-error
|
|
22786
|
+
content.renderer = {};
|
|
22787
|
+
}
|
|
22788
|
+
//@ts-expect-error
|
|
22789
|
+
var renderer = content.renderer;
|
|
22790
|
+
var realAnchor = convertAnchor(renderer.anchor, renderer.particleOrigin);
|
|
22791
|
+
//@ts-expect-error
|
|
22792
|
+
var startSize = item.transform.size;
|
|
22793
|
+
// 兼容旧JSON(anchor和particleOrigin可能同时存在)
|
|
22794
|
+
if (!renderer.anchor && renderer.particleOrigin !== undefined) {
|
|
22795
|
+
//@ts-expect-error
|
|
22796
|
+
item.transform.position.x += -realAnchor[0] * startSize.x;
|
|
22797
|
+
//@ts-expect-error
|
|
22798
|
+
item.transform.position.y += -realAnchor[1] * startSize.y;
|
|
22799
|
+
}
|
|
22800
|
+
//@ts-expect-error
|
|
22801
|
+
item.transform.anchor = { x: realAnchor[0] * startSize.x, y: realAnchor[1] * startSize.y };
|
|
22802
|
+
}
|
|
22803
|
+
}
|
|
22804
|
+
if (item.type === ItemType$1.particle) {
|
|
22805
|
+
var content = item.content;
|
|
22793
22806
|
//@ts-expect-error
|
|
22794
|
-
|
|
22807
|
+
if (!content.renderer) {
|
|
22808
|
+
//@ts-expect-error
|
|
22809
|
+
content.renderer = {};
|
|
22810
|
+
}
|
|
22795
22811
|
//@ts-expect-error
|
|
22796
|
-
|
|
22812
|
+
var renderer = content.renderer;
|
|
22797
22813
|
//@ts-expect-error
|
|
22798
|
-
|
|
22814
|
+
content.renderer.anchor = convertAnchor(renderer.anchor, renderer.particleOrigin);
|
|
22815
|
+
}
|
|
22816
|
+
// item 的 endbehaviour 兼容
|
|
22817
|
+
// @ts-expect-error
|
|
22818
|
+
if (item.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY$1 || item.endBehavior === END_BEHAVIOR_PAUSE$1) {
|
|
22819
|
+
item.endBehavior = END_BEHAVIOR_FREEZE$1;
|
|
22799
22820
|
}
|
|
22800
22821
|
// item 的 content 转为 component data 加入 JSONScene.components
|
|
22801
22822
|
var uuid = v4().replace(/-/g, '');
|
|
@@ -22970,8 +22991,22 @@ function version3Migration(scene) {
|
|
|
22970
22991
|
}
|
|
22971
22992
|
return scene;
|
|
22972
22993
|
}
|
|
22994
|
+
/**
|
|
22995
|
+
* 提取并转换 JSON 数据中的 anchor 值
|
|
22996
|
+
*/
|
|
22997
|
+
function convertAnchor(anchor, particleOrigin) {
|
|
22998
|
+
if (anchor) {
|
|
22999
|
+
return [anchor[0] - 0.5, 0.5 - anchor[1]];
|
|
23000
|
+
}
|
|
23001
|
+
else if (particleOrigin) {
|
|
23002
|
+
return particleOriginTranslateMap[particleOrigin];
|
|
23003
|
+
}
|
|
23004
|
+
else {
|
|
23005
|
+
return [0, 0];
|
|
23006
|
+
}
|
|
23007
|
+
}
|
|
22973
23008
|
|
|
22974
|
-
var seed
|
|
23009
|
+
var seed = 1;
|
|
22975
23010
|
/**
|
|
22976
23011
|
* 资源管理器
|
|
22977
23012
|
* 用于加载和动效中所有的资源文件,包括图片、插件、图层粒子数据等
|
|
@@ -22991,7 +23026,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
22991
23026
|
* 图像资源,用于创建和释放GPU纹理资源
|
|
22992
23027
|
*/
|
|
22993
23028
|
this.assets = {};
|
|
22994
|
-
this.id = seed
|
|
23029
|
+
this.id = seed++;
|
|
22995
23030
|
/**
|
|
22996
23031
|
* 场景加载的超时定时器
|
|
22997
23032
|
*/
|
|
@@ -23007,6 +23042,26 @@ var AssetManager = /** @class */ (function () {
|
|
|
23007
23042
|
var _a = options.timeout, timeout = _a === void 0 ? 10 : _a;
|
|
23008
23043
|
this.timeout = timeout;
|
|
23009
23044
|
};
|
|
23045
|
+
/**
|
|
23046
|
+
* 根据用户传入的参数修改场景数据
|
|
23047
|
+
*/
|
|
23048
|
+
AssetManager.prototype.updateSceneData = function (compositions) {
|
|
23049
|
+
var variables = this.options.variables;
|
|
23050
|
+
if (!variables || Object.keys(variables).length <= 0) {
|
|
23051
|
+
return compositions;
|
|
23052
|
+
}
|
|
23053
|
+
compositions.forEach(function (composition) {
|
|
23054
|
+
composition.items.forEach(function (item) {
|
|
23055
|
+
if (item.type === ItemType$1.text) {
|
|
23056
|
+
var textVariable = variables[item.name];
|
|
23057
|
+
if (textVariable) {
|
|
23058
|
+
item.content.options.text = textVariable;
|
|
23059
|
+
}
|
|
23060
|
+
}
|
|
23061
|
+
});
|
|
23062
|
+
});
|
|
23063
|
+
return compositions;
|
|
23064
|
+
};
|
|
23010
23065
|
/**
|
|
23011
23066
|
* 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
|
|
23012
23067
|
* @param url - json 的 URL 链接或者 json 对象
|
|
@@ -23098,6 +23153,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23098
23153
|
for (i = 0; i < scene.images.length; i++) {
|
|
23099
23154
|
scene.textureOptions[i].image = scene.images[i];
|
|
23100
23155
|
}
|
|
23156
|
+
scene.jsonScene.compositions = this.updateSceneData(scene.jsonScene.compositions);
|
|
23101
23157
|
_e.label = 5;
|
|
23102
23158
|
case 5: return [3 /*break*/, 12];
|
|
23103
23159
|
case 6: return [4 /*yield*/, hookTimeInfo('processJSON', function () { return _this.processJSON(rawJSON); })];
|
|
@@ -23117,6 +23173,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23117
23173
|
return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(loadedImages_1, loadedBins_1, jsonScene_1); })];
|
|
23118
23174
|
case 10:
|
|
23119
23175
|
loadedTextures = _e.sent();
|
|
23176
|
+
jsonScene_1.compositions = this.updateSceneData(jsonScene_1.compositions);
|
|
23120
23177
|
scene = {
|
|
23121
23178
|
url: url,
|
|
23122
23179
|
renderLevel: this.options.renderLevel,
|
|
@@ -23963,7 +24020,9 @@ var CompositionComponent = /** @class */ (function (_super) {
|
|
|
23963
24020
|
}
|
|
23964
24021
|
// endBehaviour 类型需优化
|
|
23965
24022
|
props.content = itemData.content;
|
|
23966
|
-
item = new VFXItem(this.engine, __assign$1(__assign$1({}, props), { id: itemData.id, name: itemData.name, delay: itemData.delay, duration: itemData.duration, endBehavior: itemData.endBehavior, parentId: itemData.parentId, transform: itemData.transform
|
|
24023
|
+
item = new VFXItem(this.engine, __assign$1(__assign$1({}, props), { id: itemData.id, name: itemData.name, delay: itemData.delay, duration: itemData.duration, endBehavior: itemData.endBehavior, parentId: itemData.parentId, transform: itemData.transform,
|
|
24024
|
+
// @ts-expect-error TODO: 2.0 编辑器测试代码,后续移除
|
|
24025
|
+
oldId: itemData.oldId }));
|
|
23967
24026
|
// TODO 编辑器数据传入 composition type 后移除
|
|
23968
24027
|
item.type = ItemType$1.composition;
|
|
23969
24028
|
item.composition = this.item.composition;
|
|
@@ -24098,7 +24157,6 @@ var CompositionComponent = /** @class */ (function (_super) {
|
|
|
24098
24157
|
return CompositionComponent;
|
|
24099
24158
|
}(ItemBehaviour));
|
|
24100
24159
|
|
|
24101
|
-
var seed = 1;
|
|
24102
24160
|
/**
|
|
24103
24161
|
* 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
|
|
24104
24162
|
* 合成中包含了相关的 Item 元素,支持对 Item 元素的创建、更新和销毁。
|
|
@@ -24171,7 +24229,7 @@ var Composition = /** @class */ (function () {
|
|
|
24171
24229
|
this.width = width;
|
|
24172
24230
|
this.height = height;
|
|
24173
24231
|
this.renderOrder = baseRenderOrder;
|
|
24174
|
-
this.id =
|
|
24232
|
+
this.id = sourceContent.id;
|
|
24175
24233
|
this.renderer = renderer;
|
|
24176
24234
|
this.texInfo = imageUsage !== null && imageUsage !== void 0 ? imageUsage : {};
|
|
24177
24235
|
this.event = event;
|
|
@@ -24198,7 +24256,7 @@ var Composition = /** @class */ (function () {
|
|
|
24198
24256
|
this.rootItem.onEnd = function () {
|
|
24199
24257
|
window.setTimeout(function () {
|
|
24200
24258
|
var _a;
|
|
24201
|
-
(_a = _this.
|
|
24259
|
+
(_a = _this.onEnd) === null || _a === void 0 ? void 0 : _a.call(_this, _this);
|
|
24202
24260
|
}, 0);
|
|
24203
24261
|
};
|
|
24204
24262
|
this.pluginSystem.resetComposition(this, this.renderFrame);
|
|
@@ -24277,9 +24335,9 @@ var Composition = /** @class */ (function () {
|
|
|
24277
24335
|
* 重新开始合成
|
|
24278
24336
|
*/
|
|
24279
24337
|
Composition.prototype.restart = function () {
|
|
24280
|
-
|
|
24281
|
-
contentItems.forEach(
|
|
24282
|
-
contentItems.length = 0;
|
|
24338
|
+
this.rootComposition.items;
|
|
24339
|
+
// contentItems.forEach(item => item.dispose());
|
|
24340
|
+
// contentItems.length = 0;
|
|
24283
24341
|
this.prepareRender();
|
|
24284
24342
|
this.reset();
|
|
24285
24343
|
this.transform.setValid(true);
|
|
@@ -24562,7 +24620,8 @@ var Composition = /** @class */ (function () {
|
|
|
24562
24620
|
var time = this.getUpdateTime(deltaTime * this.speed);
|
|
24563
24621
|
this.globalTime += time;
|
|
24564
24622
|
if (this.rootTimeline.isActiveAndEnabled) {
|
|
24565
|
-
this.rootTimeline.
|
|
24623
|
+
var localTime = this.rootTimeline.toLocalTime(this.globalTime / 1000);
|
|
24624
|
+
this.rootTimeline.setTime(localTime);
|
|
24566
24625
|
}
|
|
24567
24626
|
this.updateVideo();
|
|
24568
24627
|
// 更新 model-tree-plugin
|
|
@@ -25027,6 +25086,9 @@ var Composition = /** @class */ (function () {
|
|
|
25027
25086
|
}
|
|
25028
25087
|
this.compositionSourceManager.dispose();
|
|
25029
25088
|
this.refCompositionProps.clear();
|
|
25089
|
+
if (this.renderer.env === PLAYER_OPTIONS_ENV_EDITOR) {
|
|
25090
|
+
return;
|
|
25091
|
+
}
|
|
25030
25092
|
this.renderer.clear({
|
|
25031
25093
|
stencilAction: TextureLoadAction.clear,
|
|
25032
25094
|
clearStencil: 0,
|
|
@@ -25697,9 +25759,20 @@ var Ticker = /** @class */ (function () {
|
|
|
25697
25759
|
if (fps === void 0) { fps = 60; }
|
|
25698
25760
|
this.paused = true;
|
|
25699
25761
|
this.lastTime = 0;
|
|
25762
|
+
this._deltaTime = 0;
|
|
25700
25763
|
this.setFPS(fps);
|
|
25701
25764
|
this.tickers = [];
|
|
25702
25765
|
}
|
|
25766
|
+
Object.defineProperty(Ticker.prototype, "deltaTime", {
|
|
25767
|
+
/**
|
|
25768
|
+
* 获取定时器当前帧更新的时间
|
|
25769
|
+
*/
|
|
25770
|
+
get: function () {
|
|
25771
|
+
return this._deltaTime;
|
|
25772
|
+
},
|
|
25773
|
+
enumerable: false,
|
|
25774
|
+
configurable: true
|
|
25775
|
+
});
|
|
25703
25776
|
/**
|
|
25704
25777
|
* FPS 帧率设置
|
|
25705
25778
|
*/
|
|
@@ -25726,6 +25799,7 @@ var Ticker = /** @class */ (function () {
|
|
|
25726
25799
|
Ticker.prototype.start = function () {
|
|
25727
25800
|
var _this = this;
|
|
25728
25801
|
this.paused = false;
|
|
25802
|
+
this._deltaTime = 0;
|
|
25729
25803
|
if (!this.intervalId) {
|
|
25730
25804
|
this.lastTime = performance.now();
|
|
25731
25805
|
var raf_1 = requestAnimationFrame || function (func) {
|
|
@@ -25748,6 +25822,7 @@ var Ticker = /** @class */ (function () {
|
|
|
25748
25822
|
this.intervalId = 0;
|
|
25749
25823
|
this.lastTime = 0;
|
|
25750
25824
|
this.paused = true;
|
|
25825
|
+
this._deltaTime = 0;
|
|
25751
25826
|
this.tickers = [];
|
|
25752
25827
|
};
|
|
25753
25828
|
/**
|
|
@@ -25755,12 +25830,14 @@ var Ticker = /** @class */ (function () {
|
|
|
25755
25830
|
*/
|
|
25756
25831
|
Ticker.prototype.pause = function () {
|
|
25757
25832
|
this.paused = true;
|
|
25833
|
+
this._deltaTime = 0;
|
|
25758
25834
|
};
|
|
25759
25835
|
/**
|
|
25760
25836
|
* 定时器恢复方法
|
|
25761
25837
|
*/
|
|
25762
25838
|
Ticker.prototype.resume = function () {
|
|
25763
25839
|
this.paused = false;
|
|
25840
|
+
this._deltaTime = 0;
|
|
25764
25841
|
};
|
|
25765
25842
|
/**
|
|
25766
25843
|
* 定时器 tick 方法
|
|
@@ -25770,8 +25847,8 @@ var Ticker = /** @class */ (function () {
|
|
|
25770
25847
|
return;
|
|
25771
25848
|
}
|
|
25772
25849
|
var startTime = performance.now();
|
|
25773
|
-
|
|
25774
|
-
if (
|
|
25850
|
+
this._deltaTime = startTime - this.lastTime;
|
|
25851
|
+
if (this._deltaTime >= this.interval) {
|
|
25775
25852
|
this.lastTime = startTime;
|
|
25776
25853
|
if (this.resetTickers) {
|
|
25777
25854
|
this.tickers = this.tickers.filter(function (tick) { return tick; });
|
|
@@ -25779,7 +25856,7 @@ var Ticker = /** @class */ (function () {
|
|
|
25779
25856
|
}
|
|
25780
25857
|
for (var i = 0, len = this.tickers.length; i < len; i++) {
|
|
25781
25858
|
var tick = this.tickers[i];
|
|
25782
|
-
tick(
|
|
25859
|
+
tick(this._deltaTime);
|
|
25783
25860
|
}
|
|
25784
25861
|
}
|
|
25785
25862
|
};
|
|
@@ -25804,5 +25881,5 @@ registerPlugin('cal', CalculateLoader, VFXItem, true);
|
|
|
25804
25881
|
registerPlugin('interact', InteractLoader, VFXItem, true);
|
|
25805
25882
|
// registerFilters(filters);
|
|
25806
25883
|
|
|
25807
|
-
export { AbstractPlugin, ActivationClipPlayable, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierSegments, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, CurveValue, DEFAULT_FONTS, DataType, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FILTER_NAME_NONE, FilterMode, Float16ArrayWrapper, FrameBuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractBehavior$1 as InteractBehavior, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, QCanvasViewer, QText, QTextWrapMode, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderBuffer, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderer, RendererComponent, 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, ShaderType, SpriteColorPlayable, SpriteComponent, SpriteLoader, StaticValue, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextLoader, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineClip, TimelineComponent, Track, Transform, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, alphaFrame_frag as alphaFrameFrag, alphaMask_frag as alphaMaskFrag, assertExist, asserts, blend, bloomMix_frag as bloomMixVert, bloomThreshold_frag as bloomThresholdVert, calculateTranslation, cameraMove_frag as cameraMoveFrag, cameraMove_vert as cameraMoveVert, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, combineImageTemplate1, combineImageTemplate1Async, combineImageTemplate2, combineImageTemplate2Async, combineImageTemplateAsync, compatible_frag as compatibleFrag, compatible_vert as compatibleVert,
|
|
25884
|
+
export { AbstractPlugin, ActivationClipPlayable, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierSegments, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, CurveValue, DEFAULT_FONTS, DataType, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FILTER_NAME_NONE, FilterMode, Float16ArrayWrapper, FrameBuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractBehavior$1 as InteractBehavior, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, QCanvasViewer, QText, QTextWrapMode, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderBuffer, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderer, RendererComponent, 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, ShaderType, SpriteColorPlayable, SpriteComponent, SpriteLoader, StaticValue, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextLoader, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineClip, TimelineComponent, Track, Transform, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, alphaFrame_frag as alphaFrameFrag, alphaMask_frag as alphaMaskFrag, assertExist, asserts, blend, bloomMix_frag as bloomMixVert, bloomThreshold_frag as bloomThresholdVert, calculateTranslation, cameraMove_frag as cameraMoveFrag, cameraMove_vert as cameraMoveVert, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, combineImageTemplate1, combineImageTemplate1Async, combineImageTemplate2, combineImageTemplate2Async, combineImageTemplateAsync, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, copy as copyFrag, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMarcos, createShape, createVFXItem, createValueGetter, deepClone, defaultGlobalVolume, defaultPlugins, delay_frag as delayFrag, deserializeMipmapTexture, distortion_frag as distortionFrag, distortion_vert as distortionVert, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAndroid, isArray, isFunction, isIOS, isObject, isScene, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isWebGL2, item_define as itemDefine, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadVideo, loadWebPOptional, logger, index$1 as math, maxSpriteMeshItemCount, maxSpriteTextureCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap, particleVert, pluginLoaderMap, random, registerPlugin, removeItem, requestAsync, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxFragmentTextures, setSpriteMeshMaxItemCountByGPU, sortByOrder, index as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize };
|
|
25808
25885
|
//# sourceMappingURL=index.mjs.map
|