@galacean/effects 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/index.js +1338 -1245
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +1339 -1245
- package/dist/index.mjs.map +1 -1
- package/dist/weapp.js +1337 -1244
- package/dist/weapp.js.map +1 -1
- package/dist/weapp.mjs +1338 -1244
- package/dist/weapp.mjs.map +1 -1
- package/package.json +3 -3
package/dist/weapp.mjs
CHANGED
|
@@ -8187,7 +8187,7 @@ function loadMipmapImage(pointer, bins) {
|
|
|
8187
8187
|
});
|
|
8188
8188
|
}
|
|
8189
8189
|
|
|
8190
|
-
var seed$
|
|
8190
|
+
var seed$d = 1;
|
|
8191
8191
|
/**
|
|
8192
8192
|
* Texture 抽象类
|
|
8193
8193
|
*/
|
|
@@ -8196,7 +8196,7 @@ var Texture = /** @class */ (function (_super) {
|
|
|
8196
8196
|
function Texture(engine) {
|
|
8197
8197
|
var _this = _super.call(this, engine) || this;
|
|
8198
8198
|
_this.destroyed = false;
|
|
8199
|
-
_this.id = 'Tex' + seed$
|
|
8199
|
+
_this.id = 'Tex' + seed$d++;
|
|
8200
8200
|
return _this;
|
|
8201
8201
|
}
|
|
8202
8202
|
Object.defineProperty(Texture.prototype, "isDestroyed", {
|
|
@@ -8598,7 +8598,7 @@ var MaterialRenderType;
|
|
|
8598
8598
|
* 用于设置材质默认名称的自增序号
|
|
8599
8599
|
* @internal
|
|
8600
8600
|
*/
|
|
8601
|
-
var seed$
|
|
8601
|
+
var seed$c = 1;
|
|
8602
8602
|
/**
|
|
8603
8603
|
* Material 抽象类
|
|
8604
8604
|
*/
|
|
@@ -8613,7 +8613,7 @@ var Material = /** @class */ (function (_super) {
|
|
|
8613
8613
|
_this.destroyed = false;
|
|
8614
8614
|
_this.initialized = false;
|
|
8615
8615
|
if (props) {
|
|
8616
|
-
var _a = props.name, name_1 = _a === void 0 ? 'Material' + seed$
|
|
8616
|
+
var _a = props.name, name_1 = _a === void 0 ? 'Material' + seed$c++ : _a, _b = props.renderType, renderType = _b === void 0 ? MaterialRenderType.normal : _b, shader = props.shader, uniformSemantics = props.uniformSemantics;
|
|
8617
8617
|
_this.name = name_1;
|
|
8618
8618
|
_this.renderType = renderType; // TODO 没有地方用到
|
|
8619
8619
|
_this.shaderSource = shader;
|
|
@@ -8621,7 +8621,7 @@ var Material = /** @class */ (function (_super) {
|
|
|
8621
8621
|
_this.uniformSemantics = __assign$1({}, uniformSemantics); // TODO 废弃,待移除
|
|
8622
8622
|
}
|
|
8623
8623
|
else {
|
|
8624
|
-
_this.name = 'Material' + seed$
|
|
8624
|
+
_this.name = 'Material' + seed$c++;
|
|
8625
8625
|
_this.renderType = MaterialRenderType.normal;
|
|
8626
8626
|
}
|
|
8627
8627
|
return _this;
|
|
@@ -9046,7 +9046,7 @@ function generateEmptyTypedArray(type) {
|
|
|
9046
9046
|
return new Float32Array(0);
|
|
9047
9047
|
}
|
|
9048
9048
|
|
|
9049
|
-
var seed$
|
|
9049
|
+
var seed$b = 1;
|
|
9050
9050
|
/**
|
|
9051
9051
|
* Mesh 抽象类
|
|
9052
9052
|
*/
|
|
@@ -9058,7 +9058,7 @@ var Mesh = /** @class */ (function (_super) {
|
|
|
9058
9058
|
_this.visible = true;
|
|
9059
9059
|
if (props) {
|
|
9060
9060
|
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$1.fromIdentity() : _c;
|
|
9061
|
-
_this.id = 'Mesh' + seed$
|
|
9061
|
+
_this.id = 'Mesh' + seed$b++;
|
|
9062
9062
|
_this.name = name_1;
|
|
9063
9063
|
_this.geometry = geometry;
|
|
9064
9064
|
_this.material = material;
|
|
@@ -9066,7 +9066,7 @@ var Mesh = /** @class */ (function (_super) {
|
|
|
9066
9066
|
_this.worldMatrix = worldMatrix;
|
|
9067
9067
|
}
|
|
9068
9068
|
else {
|
|
9069
|
-
_this.id = 'Mesh' + seed$
|
|
9069
|
+
_this.id = 'Mesh' + seed$b++;
|
|
9070
9070
|
_this.name = '<unnamed>';
|
|
9071
9071
|
_this.worldMatrix = Matrix4$1.fromIdentity();
|
|
9072
9072
|
_this._priority = 0;
|
|
@@ -9286,7 +9286,7 @@ var RenderPassDestroyAttachmentType;
|
|
|
9286
9286
|
*/
|
|
9287
9287
|
RenderPassDestroyAttachmentType[RenderPassDestroyAttachmentType["destroy"] = 0] = "destroy";
|
|
9288
9288
|
})(RenderPassDestroyAttachmentType || (RenderPassDestroyAttachmentType = {}));
|
|
9289
|
-
var seed$
|
|
9289
|
+
var seed$a = 1;
|
|
9290
9290
|
/**
|
|
9291
9291
|
* RenderPass 抽象类
|
|
9292
9292
|
*/
|
|
@@ -9298,7 +9298,7 @@ var RenderPass = /** @class */ (function () {
|
|
|
9298
9298
|
this.attachments = [];
|
|
9299
9299
|
this.destroyed = false;
|
|
9300
9300
|
this.initialized = false;
|
|
9301
|
-
var _a = options.name, name = _a === void 0 ? 'RenderPass_' + seed$
|
|
9301
|
+
var _a = options.name, name = _a === void 0 ? 'RenderPass_' + seed$a++ : _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;
|
|
9302
9302
|
this.name = name;
|
|
9303
9303
|
this.renderer = renderer;
|
|
9304
9304
|
this.priority = priority;
|
|
@@ -9915,7 +9915,7 @@ var defaultGlobalVolume = {
|
|
|
9915
9915
|
};
|
|
9916
9916
|
|
|
9917
9917
|
var RENDER_PASS_NAME_PREFIX = '_effects_default_';
|
|
9918
|
-
var seed$
|
|
9918
|
+
var seed$9 = 1;
|
|
9919
9919
|
/**
|
|
9920
9920
|
* RenderFrame 抽象类
|
|
9921
9921
|
*/
|
|
@@ -10050,7 +10050,7 @@ var RenderFrame = /** @class */ (function () {
|
|
|
10050
10050
|
}
|
|
10051
10051
|
this.semantics = new SemanticMap(options.semantics);
|
|
10052
10052
|
this.clearAction = clearAction;
|
|
10053
|
-
this.name = "RenderFrame".concat(seed$
|
|
10053
|
+
this.name = "RenderFrame".concat(seed$9++);
|
|
10054
10054
|
var firstRP = renderPasses[0];
|
|
10055
10055
|
var sourceOpts = {
|
|
10056
10056
|
type: glContext.UNSIGNED_BYTE,
|
|
@@ -11273,6 +11273,12 @@ var SerializationHelper = /** @class */ (function () {
|
|
|
11273
11273
|
value.id &&
|
|
11274
11274
|
value.id.length === 32;
|
|
11275
11275
|
};
|
|
11276
|
+
// TODO 测试函数,2.0 上线后移除
|
|
11277
|
+
SerializationHelper.checkGLTFNode = function (value) {
|
|
11278
|
+
return value instanceof Object &&
|
|
11279
|
+
value.nodeIndex !== undefined &&
|
|
11280
|
+
value.isJoint !== undefined;
|
|
11281
|
+
};
|
|
11276
11282
|
SerializationHelper.deserializeProperty = function (property, engine, level) {
|
|
11277
11283
|
var e_11, _a, e_12, _b;
|
|
11278
11284
|
if (level > 10) {
|
|
@@ -11305,7 +11311,9 @@ var SerializationHelper = /** @class */ (function () {
|
|
|
11305
11311
|
else if (SerializationHelper.checkDataPath(property)) {
|
|
11306
11312
|
return engine.assetLoader.loadGUID(property.id);
|
|
11307
11313
|
}
|
|
11308
|
-
else if (property instanceof EffectsObject ||
|
|
11314
|
+
else if (property instanceof EffectsObject ||
|
|
11315
|
+
SerializationHelper.checkTypedArray(property) ||
|
|
11316
|
+
SerializationHelper.checkGLTFNode(property)) {
|
|
11309
11317
|
return property;
|
|
11310
11318
|
}
|
|
11311
11319
|
else if (property instanceof Object) {
|
|
@@ -11380,7 +11388,9 @@ var SerializationHelper = /** @class */ (function () {
|
|
|
11380
11388
|
res = _j.sent();
|
|
11381
11389
|
return [2 /*return*/, res];
|
|
11382
11390
|
case 12:
|
|
11383
|
-
if (!(property instanceof EffectsObject ||
|
|
11391
|
+
if (!(property instanceof EffectsObject ||
|
|
11392
|
+
SerializationHelper.checkTypedArray(property) ||
|
|
11393
|
+
SerializationHelper.checkGLTFNode(property))) return [3 /*break*/, 13];
|
|
11384
11394
|
return [2 /*return*/, property];
|
|
11385
11395
|
case 13:
|
|
11386
11396
|
if (!(property instanceof Object)) return [3 /*break*/, 22];
|
|
@@ -11868,20 +11878,6 @@ var particleOriginTranslateMap = (_a$7 = {},
|
|
|
11868
11878
|
_a$7[ParticleOrigin$1.PARTICLE_ORIGIN_RIGHT_BOTTOM] = [0.5, -0.5],
|
|
11869
11879
|
_a$7[ParticleOrigin$1.PARTICLE_ORIGIN_RIGHT_TOP] = [0.5, 0.5],
|
|
11870
11880
|
_a$7);
|
|
11871
|
-
/**
|
|
11872
|
-
* 提取并转换 JSON 数据中的 anchor 值
|
|
11873
|
-
*/
|
|
11874
|
-
function convertAnchor(anchor, particleOrigin) {
|
|
11875
|
-
if (anchor) {
|
|
11876
|
-
return [anchor[0] - 0.5, 0.5 - anchor[1]];
|
|
11877
|
-
}
|
|
11878
|
-
else if (particleOrigin) {
|
|
11879
|
-
return particleOriginTranslateMap[particleOrigin];
|
|
11880
|
-
}
|
|
11881
|
-
else {
|
|
11882
|
-
return [0, 0];
|
|
11883
|
-
}
|
|
11884
|
-
}
|
|
11885
11881
|
function nearestPowerOfTwo(value) {
|
|
11886
11882
|
return Math.pow(2, Math.round(Math.log(value) / Math.LN2));
|
|
11887
11883
|
}
|
|
@@ -12577,7 +12573,7 @@ function createKeyFrameMeta() {
|
|
|
12577
12573
|
}
|
|
12578
12574
|
|
|
12579
12575
|
var tempQuat$1 = new Quaternion();
|
|
12580
|
-
var seed$
|
|
12576
|
+
var seed$8 = 1;
|
|
12581
12577
|
// TODO 继承 Component
|
|
12582
12578
|
var Transform = /** @class */ (function () {
|
|
12583
12579
|
function Transform(props, parent) {
|
|
@@ -12640,7 +12636,7 @@ var Transform = /** @class */ (function () {
|
|
|
12640
12636
|
* 最终模型矩阵对应变换的缓存,当自身矩阵或父矩阵有修改时需要更新
|
|
12641
12637
|
*/
|
|
12642
12638
|
this.worldTRSCache = { position: new Vector3(0, 0, 0), quat: new Quaternion(0, 0, 0, 1), scale: new Vector3(1, 1, 1) };
|
|
12643
|
-
this.name = "transform_".concat(seed$
|
|
12639
|
+
this.name = "transform_".concat(seed$8++);
|
|
12644
12640
|
if (props) {
|
|
12645
12641
|
this.setTransform(props);
|
|
12646
12642
|
}
|
|
@@ -12820,13 +12816,11 @@ var Transform = /** @class */ (function () {
|
|
|
12820
12816
|
* 设置锚点
|
|
12821
12817
|
* @param x
|
|
12822
12818
|
* @param y
|
|
12823
|
-
* @param z
|
|
12824
12819
|
*/
|
|
12825
|
-
Transform.prototype.setAnchor = function (x, y
|
|
12826
|
-
if (this.anchor.x !== x || this.anchor.y !== y
|
|
12820
|
+
Transform.prototype.setAnchor = function (x, y) {
|
|
12821
|
+
if (this.anchor.x !== x || this.anchor.y !== y) {
|
|
12827
12822
|
this.anchor.x = x;
|
|
12828
12823
|
this.anchor.y = y;
|
|
12829
|
-
this.anchor.z = z;
|
|
12830
12824
|
this.dirtyFlags.localData = true;
|
|
12831
12825
|
this.dispatchValueChange();
|
|
12832
12826
|
}
|
|
@@ -12837,8 +12831,7 @@ var Transform = /** @class */ (function () {
|
|
|
12837
12831
|
* @param reverseEuler - 设置 rotation时,欧拉角是否需要取负值
|
|
12838
12832
|
*/
|
|
12839
12833
|
Transform.prototype.setTransform = function (props, reverseEuler) {
|
|
12840
|
-
var
|
|
12841
|
-
var position = props.position, rotation = props.rotation, scale = props.scale, quat = props.quat, name = props.name, anchor = props.anchor;
|
|
12834
|
+
var position = props.position, rotation = props.rotation, scale = props.scale, size = props.size, quat = props.quat, name = props.name, anchor = props.anchor;
|
|
12842
12835
|
if (name) {
|
|
12843
12836
|
this.name = name;
|
|
12844
12837
|
}
|
|
@@ -12875,12 +12868,15 @@ var Transform = /** @class */ (function () {
|
|
|
12875
12868
|
this.setScale(scale[0], scale[1], scale[2]);
|
|
12876
12869
|
}
|
|
12877
12870
|
}
|
|
12871
|
+
if (size) {
|
|
12872
|
+
this.setSize(size.x, size.y);
|
|
12873
|
+
}
|
|
12878
12874
|
if (anchor) {
|
|
12879
|
-
if (anchor instanceof
|
|
12880
|
-
this.setAnchor(anchor.x, anchor.y
|
|
12875
|
+
if (anchor instanceof Vector2) {
|
|
12876
|
+
this.setAnchor(anchor.x, anchor.y);
|
|
12881
12877
|
}
|
|
12882
12878
|
else {
|
|
12883
|
-
this.setAnchor(anchor[0], anchor[1]
|
|
12879
|
+
this.setAnchor(anchor[0], anchor[1]);
|
|
12884
12880
|
}
|
|
12885
12881
|
}
|
|
12886
12882
|
};
|
|
@@ -13374,7 +13370,7 @@ var HELP_LINK$1 = {
|
|
|
13374
13370
|
|
|
13375
13371
|
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";
|
|
13376
13372
|
var fragment = "\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor;\n}\n";
|
|
13377
|
-
var seed$
|
|
13373
|
+
var seed$7 = 1;
|
|
13378
13374
|
var InteractMesh = /** @class */ (function () {
|
|
13379
13375
|
function InteractMesh(props, rendererOptions, transform, engine) {
|
|
13380
13376
|
this.transform = transform;
|
|
@@ -13452,7 +13448,7 @@ var InteractMesh = /** @class */ (function () {
|
|
|
13452
13448
|
};
|
|
13453
13449
|
InteractMesh.prototype.createMesh = function (geometry, material) {
|
|
13454
13450
|
return Mesh.create(this.engine, {
|
|
13455
|
-
name: 'Interact_preview' + seed$
|
|
13451
|
+
name: 'Interact_preview' + seed$7++,
|
|
13456
13452
|
priority: 0,
|
|
13457
13453
|
worldMatrix: Matrix4$1.fromIdentity(),
|
|
13458
13454
|
geometry: geometry,
|
|
@@ -13937,783 +13933,1019 @@ var PlayableOutput = /** @class */ (function () {
|
|
|
13937
13933
|
* @since 2.0.0
|
|
13938
13934
|
* @internal
|
|
13939
13935
|
*/
|
|
13940
|
-
var
|
|
13941
|
-
|
|
13942
|
-
|
|
13943
|
-
|
|
13944
|
-
_this.reusable = false;
|
|
13945
|
-
_this.timelineStarted = false;
|
|
13946
|
-
_this.playableGraph = new PlayableGraph();
|
|
13947
|
-
/**
|
|
13948
|
-
* 元素动画已经播放的时间
|
|
13949
|
-
*/
|
|
13950
|
-
_this.time = 0;
|
|
13951
|
-
_this.tracks = [];
|
|
13952
|
-
_this.trackSeed = 0;
|
|
13953
|
-
return _this;
|
|
13936
|
+
var Track = /** @class */ (function () {
|
|
13937
|
+
function Track() {
|
|
13938
|
+
this.clips = [];
|
|
13939
|
+
this.clipSeed = 0;
|
|
13954
13940
|
}
|
|
13955
|
-
|
|
13956
|
-
var
|
|
13941
|
+
Track.prototype.createOutput = function () {
|
|
13942
|
+
var output = new PlayableOutput();
|
|
13943
|
+
return output;
|
|
13944
|
+
};
|
|
13945
|
+
/**
|
|
13946
|
+
* 重写该方法以创建自定义混合器
|
|
13947
|
+
*/
|
|
13948
|
+
Track.prototype.createMixerPlayable = function () {
|
|
13949
|
+
return new Playable();
|
|
13950
|
+
};
|
|
13951
|
+
Track.prototype.createPlayebleTree = function () {
|
|
13952
|
+
var e_1, _a;
|
|
13953
|
+
var defaultMixPlayable = this.createMixerPlayable();
|
|
13957
13954
|
try {
|
|
13958
|
-
|
|
13959
|
-
|
|
13960
|
-
|
|
13961
|
-
try {
|
|
13962
|
-
for (var _e = (e_2 = void 0, __values$1(track.getClips())), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
13963
|
-
var clip = _f.value;
|
|
13964
|
-
clip.start = this.item.start;
|
|
13965
|
-
clip.duration = this.item.duration;
|
|
13966
|
-
}
|
|
13967
|
-
}
|
|
13968
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
13969
|
-
finally {
|
|
13970
|
-
try {
|
|
13971
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
13972
|
-
}
|
|
13973
|
-
finally { if (e_2) throw e_2.error; }
|
|
13974
|
-
}
|
|
13955
|
+
for (var _b = __values$1(this.clips), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
13956
|
+
var clip = _c.value;
|
|
13957
|
+
defaultMixPlayable.connect(clip.playable);
|
|
13975
13958
|
}
|
|
13976
13959
|
}
|
|
13977
13960
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
13978
13961
|
finally {
|
|
13979
13962
|
try {
|
|
13980
|
-
if (
|
|
13963
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
13981
13964
|
}
|
|
13982
13965
|
finally { if (e_1) throw e_1.error; }
|
|
13983
13966
|
}
|
|
13984
|
-
|
|
13967
|
+
return defaultMixPlayable;
|
|
13985
13968
|
};
|
|
13986
|
-
|
|
13987
|
-
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
-
|
|
13992
|
-
|
|
13993
|
-
|
|
13994
|
-
|
|
13995
|
-
|
|
13996
|
-
|
|
13997
|
-
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
|
|
14002
|
-
|
|
14003
|
-
finally {
|
|
14004
|
-
try {
|
|
14005
|
-
if (_m && !_m.done && (_b = _l.return)) _b.call(_l);
|
|
14006
|
-
}
|
|
14007
|
-
finally { if (e_4) throw e_4.error; }
|
|
14008
|
-
}
|
|
14009
|
-
}
|
|
14010
|
-
}
|
|
14011
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
14012
|
-
finally {
|
|
14013
|
-
try {
|
|
14014
|
-
if (_k && !_k.done && (_a = _j.return)) _a.call(_j);
|
|
13969
|
+
Track.prototype.createClip = function (classConstructor, name) {
|
|
13970
|
+
var newClip = new TimelineClip();
|
|
13971
|
+
newClip.playable = new classConstructor();
|
|
13972
|
+
newClip.name = name ? name : 'TimelineClip' + newClip.id;
|
|
13973
|
+
this.addClip(newClip);
|
|
13974
|
+
return newClip;
|
|
13975
|
+
};
|
|
13976
|
+
Track.prototype.getClips = function () {
|
|
13977
|
+
return this.clips;
|
|
13978
|
+
};
|
|
13979
|
+
Track.prototype.findClip = function (name) {
|
|
13980
|
+
var e_2, _a;
|
|
13981
|
+
try {
|
|
13982
|
+
for (var _b = __values$1(this.clips), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
13983
|
+
var clip = _c.value;
|
|
13984
|
+
if (clip.name === name) {
|
|
13985
|
+
return clip;
|
|
14015
13986
|
}
|
|
14016
|
-
finally { if (e_3) throw e_3.error; }
|
|
14017
13987
|
}
|
|
14018
|
-
this.timelineStarted = true;
|
|
14019
13988
|
}
|
|
14020
|
-
|
|
14021
|
-
|
|
14022
|
-
if (this.item.delaying && now >= 0 && now <= this.item.duration) {
|
|
14023
|
-
this.item.delaying = false;
|
|
13989
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
13990
|
+
finally {
|
|
14024
13991
|
try {
|
|
14025
|
-
|
|
14026
|
-
var track = _p.value;
|
|
14027
|
-
try {
|
|
14028
|
-
for (var _q = (e_6 = void 0, __values$1(track.getClips())), _r = _q.next(); !_r.done; _r = _q.next()) {
|
|
14029
|
-
var clip = _r.value;
|
|
14030
|
-
clip.playable.onPlayablePlay();
|
|
14031
|
-
}
|
|
14032
|
-
}
|
|
14033
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
14034
|
-
finally {
|
|
14035
|
-
try {
|
|
14036
|
-
if (_r && !_r.done && (_d = _q.return)) _d.call(_q);
|
|
14037
|
-
}
|
|
14038
|
-
finally { if (e_6) throw e_6.error; }
|
|
14039
|
-
}
|
|
14040
|
-
}
|
|
14041
|
-
}
|
|
14042
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
14043
|
-
finally {
|
|
14044
|
-
try {
|
|
14045
|
-
if (_p && !_p.done && (_c = _o.return)) _c.call(_o);
|
|
14046
|
-
}
|
|
14047
|
-
finally { if (e_5) throw e_5.error; }
|
|
13992
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
14048
13993
|
}
|
|
13994
|
+
finally { if (e_2) throw e_2.error; }
|
|
14049
13995
|
}
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
14053
|
-
|
|
13996
|
+
};
|
|
13997
|
+
Track.prototype.addClip = function (clip) {
|
|
13998
|
+
clip.playable.bindingItem = this.bindingItem;
|
|
13999
|
+
clip.id = (this.clipSeed++).toString();
|
|
14000
|
+
this.clips.push(clip);
|
|
14001
|
+
};
|
|
14002
|
+
return Track;
|
|
14003
|
+
}());
|
|
14004
|
+
/**
|
|
14005
|
+
* @since 2.0.0
|
|
14006
|
+
* @internal
|
|
14007
|
+
*/
|
|
14008
|
+
var TimelineClip = /** @class */ (function () {
|
|
14009
|
+
function TimelineClip() {
|
|
14010
|
+
this.start = 0;
|
|
14011
|
+
this.duration = 0;
|
|
14012
|
+
}
|
|
14013
|
+
return TimelineClip;
|
|
14014
|
+
}());
|
|
14015
|
+
|
|
14016
|
+
var AnimationStream = /** @class */ (function () {
|
|
14017
|
+
function AnimationStream(playable) {
|
|
14018
|
+
this.curveValues = {};
|
|
14019
|
+
this.playable = playable;
|
|
14020
|
+
}
|
|
14021
|
+
AnimationStream.prototype.setCurveValue = function (componentType, propertyName, value) {
|
|
14022
|
+
if (!this.findCurveValue(componentType, propertyName)) {
|
|
14023
|
+
this.curveValues[componentType + propertyName] = { componentType: componentType, propertyName: propertyName, value: value };
|
|
14054
14024
|
}
|
|
14055
14025
|
else {
|
|
14056
|
-
|
|
14026
|
+
this.curveValues[componentType + propertyName].value = value;
|
|
14057
14027
|
}
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
|
|
14061
|
-
|
|
14062
|
-
|
|
14063
|
-
|
|
14064
|
-
|
|
14065
|
-
|
|
14066
|
-
|
|
14067
|
-
try {
|
|
14068
|
-
for (var _u = (e_8 = void 0, __values$1(track.getClips())), _v = _u.next(); !_v.done; _v = _u.next()) {
|
|
14069
|
-
var clip = _v.value;
|
|
14070
|
-
clip.playable.onPlayableDestroy();
|
|
14071
|
-
}
|
|
14072
|
-
}
|
|
14073
|
-
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
14074
|
-
finally {
|
|
14075
|
-
try {
|
|
14076
|
-
if (_v && !_v.done && (_f = _u.return)) _f.call(_u);
|
|
14077
|
-
}
|
|
14078
|
-
finally { if (e_8) throw e_8.error; }
|
|
14079
|
-
}
|
|
14080
|
-
}
|
|
14081
|
-
}
|
|
14082
|
-
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
14083
|
-
finally {
|
|
14084
|
-
try {
|
|
14085
|
-
if (_t && !_t.done && (_e = _s.return)) _e.call(_s);
|
|
14086
|
-
}
|
|
14087
|
-
finally { if (e_7) throw e_7.error; }
|
|
14088
|
-
}
|
|
14089
|
-
this.item.delaying = true;
|
|
14090
|
-
if (!this.item.reusable && !this.reusable) {
|
|
14091
|
-
this.item.dispose();
|
|
14092
|
-
return;
|
|
14093
|
-
}
|
|
14094
|
-
}
|
|
14095
|
-
}
|
|
14028
|
+
return this.curveValues[componentType + propertyName];
|
|
14029
|
+
};
|
|
14030
|
+
AnimationStream.prototype.findCurveValue = function (componentType, propertyName) {
|
|
14031
|
+
return this.curveValues[componentType + propertyName];
|
|
14032
|
+
};
|
|
14033
|
+
AnimationStream.prototype.getInputStream = function (index) {
|
|
14034
|
+
var inputPlayable = this.playable.getInput(index);
|
|
14035
|
+
if (inputPlayable instanceof AnimationPlayable) {
|
|
14036
|
+
return inputPlayable.animationStream;
|
|
14096
14037
|
}
|
|
14097
|
-
|
|
14098
|
-
|
|
14099
|
-
|
|
14100
|
-
|
|
14101
|
-
|
|
14102
|
-
|
|
14103
|
-
|
|
14104
|
-
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
|
|
14108
|
-
|
|
14109
|
-
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14038
|
+
};
|
|
14039
|
+
return AnimationStream;
|
|
14040
|
+
}());
|
|
14041
|
+
|
|
14042
|
+
var AnimationPlayable = /** @class */ (function (_super) {
|
|
14043
|
+
__extends(AnimationPlayable, _super);
|
|
14044
|
+
function AnimationPlayable() {
|
|
14045
|
+
var _this = _super.call(this) || this;
|
|
14046
|
+
_this.animationStream = new AnimationStream(_this);
|
|
14047
|
+
return _this;
|
|
14048
|
+
}
|
|
14049
|
+
return AnimationPlayable;
|
|
14050
|
+
}(Playable));
|
|
14051
|
+
|
|
14052
|
+
var tempRot$1 = new Euler();
|
|
14053
|
+
var tempSize$1 = new Vector3(1, 1, 1);
|
|
14054
|
+
var tempPos = new Vector3();
|
|
14055
|
+
/**
|
|
14056
|
+
* @since 2.0.0
|
|
14057
|
+
* @internal
|
|
14058
|
+
*/
|
|
14059
|
+
var AnimationClipPlayable = /** @class */ (function (_super) {
|
|
14060
|
+
__extends(AnimationClipPlayable, _super);
|
|
14061
|
+
function AnimationClipPlayable() {
|
|
14062
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
14063
|
+
}
|
|
14064
|
+
AnimationClipPlayable.prototype.processFrame = function (dt) {
|
|
14065
|
+
if (this.bindingItem.composition) {
|
|
14066
|
+
this.sampleAnimation();
|
|
14067
|
+
}
|
|
14068
|
+
};
|
|
14069
|
+
/**
|
|
14070
|
+
* 应用时间轴K帧数据到对象
|
|
14071
|
+
*/
|
|
14072
|
+
AnimationClipPlayable.prototype.sampleAnimation = function () {
|
|
14073
|
+
var _this = this;
|
|
14074
|
+
var duration = this.bindingItem.duration;
|
|
14075
|
+
var life = this.time / duration;
|
|
14076
|
+
life = life < 0 ? 0 : (life > 1 ? 1 : life);
|
|
14077
|
+
if (this.sizeXOverLifetime) {
|
|
14078
|
+
tempSize$1.x = this.sizeXOverLifetime.getValue(life);
|
|
14079
|
+
if (this.sizeSeparateAxes) {
|
|
14080
|
+
tempSize$1.y = this.sizeYOverLifetime.getValue(life);
|
|
14081
|
+
tempSize$1.z = this.sizeZOverLifetime.getValue(life);
|
|
14119
14082
|
}
|
|
14120
|
-
|
|
14121
|
-
|
|
14122
|
-
try {
|
|
14123
|
-
if (_x && !_x.done && (_g = _w.return)) _g.call(_w);
|
|
14124
|
-
}
|
|
14125
|
-
finally { if (e_9) throw e_9.error; }
|
|
14083
|
+
else {
|
|
14084
|
+
tempSize$1.z = tempSize$1.y = tempSize$1.x;
|
|
14126
14085
|
}
|
|
14127
|
-
this.
|
|
14086
|
+
var startSize = this.originalTransform.scale;
|
|
14087
|
+
this.bindingItem.transform.setScale(tempSize$1.x * startSize.x, tempSize$1.y * startSize.y, tempSize$1.z * startSize.z);
|
|
14088
|
+
// this.animationStream.setCurveValue('transform', 'scale.x', tempSize.x * startSize.x);
|
|
14089
|
+
// this.animationStream.setCurveValue('transform', 'scale.y', tempSize.y * startSize.y);
|
|
14090
|
+
// this.animationStream.setCurveValue('transform', 'scale.z', tempSize.z * startSize.z);
|
|
14091
|
+
}
|
|
14092
|
+
if (this.rotationOverLifetime) {
|
|
14093
|
+
var func = function (v) { return _this.rotationOverLifetime.asRotation ? v.getValue(life) : v.getIntegrateValue(0, life, duration); };
|
|
14094
|
+
var incZ = func(this.rotationOverLifetime.z);
|
|
14095
|
+
var separateAxes = this.rotationOverLifetime.separateAxes;
|
|
14096
|
+
tempRot$1.x = separateAxes ? func(this.rotationOverLifetime.x) : 0;
|
|
14097
|
+
tempRot$1.y = separateAxes ? func(this.rotationOverLifetime.y) : 0;
|
|
14098
|
+
tempRot$1.z = incZ;
|
|
14099
|
+
var rot = tempRot$1.addEulers(this.originalTransform.rotation, tempRot$1);
|
|
14100
|
+
this.bindingItem.transform.setRotation(rot.x, rot.y, rot.z);
|
|
14101
|
+
// this.animationStream.setCurveValue('transform', 'rotation.x', rot.x);
|
|
14102
|
+
// this.animationStream.setCurveValue('transform', 'rotation.y', rot.y);
|
|
14103
|
+
// this.animationStream.setCurveValue('transform', 'rotation.z', rot.z);
|
|
14104
|
+
}
|
|
14105
|
+
if (this.positionOverLifetime) {
|
|
14106
|
+
var pos = tempPos;
|
|
14107
|
+
calculateTranslation(pos, this, this.gravity, this.time, duration, this.originalTransform.position, this.velocity);
|
|
14108
|
+
if (this.originalTransform.path) {
|
|
14109
|
+
pos.add(this.originalTransform.path.getValue(life));
|
|
14110
|
+
}
|
|
14111
|
+
this.bindingItem.transform.setPosition(pos.x, pos.y, pos.z);
|
|
14112
|
+
// this.animationStream.setCurveValue('transform', 'position.x', pos.x);
|
|
14113
|
+
// this.animationStream.setCurveValue('transform', 'position.y', pos.y);
|
|
14114
|
+
// this.animationStream.setCurveValue('transform', 'position.z', pos.z);
|
|
14128
14115
|
}
|
|
14129
14116
|
};
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
var
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14117
|
+
AnimationClipPlayable.prototype.fromData = function (data) {
|
|
14118
|
+
var _a;
|
|
14119
|
+
var scale = this.bindingItem.transform.scale;
|
|
14120
|
+
this.originalTransform = {
|
|
14121
|
+
position: this.bindingItem.transform.position.clone(),
|
|
14122
|
+
rotation: this.bindingItem.transform.getRotation().clone(),
|
|
14123
|
+
// TODO 编辑器 scale 没有z轴控制
|
|
14124
|
+
scale: new Vector3(scale.x, scale.y, scale.x),
|
|
14125
|
+
};
|
|
14126
|
+
var positionOverLifetime = data.positionOverLifetime;
|
|
14127
|
+
var rotationOverLifetime = data.rotationOverLifetime;
|
|
14128
|
+
var sizeOverLifetime = data.sizeOverLifetime;
|
|
14129
|
+
// TODO: 没有 K 帧数据的不需要传 positionOverLifetime 空对象
|
|
14130
|
+
if (positionOverLifetime && Object.keys(positionOverLifetime).length !== 0) {
|
|
14131
|
+
this.positionOverLifetime = positionOverLifetime;
|
|
14132
|
+
if (positionOverLifetime.path) {
|
|
14133
|
+
this.originalTransform.path = createValueGetter(positionOverLifetime.path);
|
|
14143
14134
|
}
|
|
14144
|
-
|
|
14145
|
-
|
|
14135
|
+
var linearVelEnable = positionOverLifetime.linearX || positionOverLifetime.linearY || positionOverLifetime.linearZ;
|
|
14136
|
+
if (linearVelEnable) {
|
|
14137
|
+
this.linearVelOverLifetime = {
|
|
14138
|
+
x: positionOverLifetime.linearX && createValueGetter(positionOverLifetime.linearX),
|
|
14139
|
+
y: positionOverLifetime.linearY && createValueGetter(positionOverLifetime.linearY),
|
|
14140
|
+
z: positionOverLifetime.linearZ && createValueGetter(positionOverLifetime.linearZ),
|
|
14141
|
+
asMovement: positionOverLifetime.asMovement,
|
|
14142
|
+
enabled: !!linearVelEnable,
|
|
14143
|
+
};
|
|
14144
|
+
}
|
|
14145
|
+
var orbitalVelEnable = positionOverLifetime.orbitalX || positionOverLifetime.orbitalY || positionOverLifetime.orbitalZ;
|
|
14146
|
+
if (orbitalVelEnable) {
|
|
14147
|
+
this.orbitalVelOverLifetime = {
|
|
14148
|
+
x: positionOverLifetime.orbitalX && createValueGetter(positionOverLifetime.orbitalX),
|
|
14149
|
+
y: positionOverLifetime.orbitalY && createValueGetter(positionOverLifetime.orbitalY),
|
|
14150
|
+
z: positionOverLifetime.orbitalZ && createValueGetter(positionOverLifetime.orbitalZ),
|
|
14151
|
+
center: ensureVec3(positionOverLifetime.orbCenter),
|
|
14152
|
+
asRotation: positionOverLifetime.asRotation,
|
|
14153
|
+
enabled: !!orbitalVelEnable,
|
|
14154
|
+
};
|
|
14146
14155
|
}
|
|
14156
|
+
this.speedOverLifetime = positionOverLifetime.speedOverLifetime && createValueGetter(positionOverLifetime.speedOverLifetime);
|
|
14147
14157
|
}
|
|
14148
|
-
|
|
14158
|
+
if (sizeOverLifetime) {
|
|
14159
|
+
if (sizeOverLifetime.separateAxes) {
|
|
14160
|
+
this.sizeSeparateAxes = true;
|
|
14161
|
+
this.sizeXOverLifetime = createValueGetter(sizeOverLifetime.x || 1);
|
|
14162
|
+
this.sizeYOverLifetime = createValueGetter(sizeOverLifetime.y || 1);
|
|
14163
|
+
this.sizeZOverLifetime = createValueGetter(sizeOverLifetime.z || 1);
|
|
14164
|
+
}
|
|
14165
|
+
else {
|
|
14166
|
+
this.sizeXOverLifetime = createValueGetter(sizeOverLifetime.size || 1);
|
|
14167
|
+
}
|
|
14168
|
+
}
|
|
14169
|
+
if (rotationOverLifetime) {
|
|
14170
|
+
this.rotationOverLifetime = {
|
|
14171
|
+
asRotation: rotationOverLifetime.asRotation,
|
|
14172
|
+
separateAxes: rotationOverLifetime.separateAxes,
|
|
14173
|
+
z: createValueGetter(rotationOverLifetime.z || 0),
|
|
14174
|
+
};
|
|
14175
|
+
if (rotationOverLifetime.separateAxes) {
|
|
14176
|
+
var rotLt = this.rotationOverLifetime;
|
|
14177
|
+
rotLt.x = createValueGetter(rotationOverLifetime.x || 0);
|
|
14178
|
+
rotLt.y = createValueGetter(rotationOverLifetime.y || 0);
|
|
14179
|
+
}
|
|
14180
|
+
}
|
|
14181
|
+
this.gravity = Vector3.fromArray((positionOverLifetime === null || positionOverLifetime === void 0 ? void 0 : positionOverLifetime.gravity) || []);
|
|
14182
|
+
this.gravityModifier = createValueGetter((_a = positionOverLifetime === null || positionOverLifetime === void 0 ? void 0 : positionOverLifetime.gravityOverLifetime) !== null && _a !== void 0 ? _a : 0);
|
|
14183
|
+
this.direction = (positionOverLifetime === null || positionOverLifetime === void 0 ? void 0 : positionOverLifetime.direction) ? Vector3.fromArray(positionOverLifetime.direction).normalize() : new Vector3();
|
|
14184
|
+
this.startSpeed = (positionOverLifetime === null || positionOverLifetime === void 0 ? void 0 : positionOverLifetime.startSpeed) || 0;
|
|
14185
|
+
this.velocity = this.direction.clone();
|
|
14186
|
+
this.velocity.multiply(this.startSpeed);
|
|
14149
14187
|
};
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14156
|
-
|
|
14188
|
+
return AnimationClipPlayable;
|
|
14189
|
+
}(AnimationPlayable));
|
|
14190
|
+
/**
|
|
14191
|
+
* @since 2.0.0
|
|
14192
|
+
* @internal
|
|
14193
|
+
*/
|
|
14194
|
+
var ActivationClipPlayable = /** @class */ (function (_super) {
|
|
14195
|
+
__extends(ActivationClipPlayable, _super);
|
|
14196
|
+
function ActivationClipPlayable() {
|
|
14197
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
14198
|
+
}
|
|
14199
|
+
ActivationClipPlayable.prototype.onGraphStart = function () {
|
|
14200
|
+
this.bindingItem.transform.setValid(false);
|
|
14201
|
+
this.hideRendererComponents();
|
|
14157
14202
|
};
|
|
14158
|
-
|
|
14159
|
-
|
|
14203
|
+
ActivationClipPlayable.prototype.onPlayablePlay = function () {
|
|
14204
|
+
this.bindingItem.transform.setValid(true);
|
|
14205
|
+
this.showRendererComponents();
|
|
14160
14206
|
};
|
|
14161
|
-
|
|
14162
|
-
|
|
14207
|
+
ActivationClipPlayable.prototype.onPlayableDestroy = function () {
|
|
14208
|
+
this.bindingItem.transform.setValid(false);
|
|
14209
|
+
this.hideRendererComponents();
|
|
14210
|
+
};
|
|
14211
|
+
ActivationClipPlayable.prototype.hideRendererComponents = function () {
|
|
14212
|
+
var e_1, _a;
|
|
14163
14213
|
try {
|
|
14164
|
-
for (var _b = __values$1(this.
|
|
14165
|
-
var
|
|
14166
|
-
if (
|
|
14167
|
-
|
|
14214
|
+
for (var _b = __values$1(this.bindingItem.rendererComponents), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
14215
|
+
var rendererComponent = _c.value;
|
|
14216
|
+
if (rendererComponent.enabled) {
|
|
14217
|
+
rendererComponent.enabled = false;
|
|
14168
14218
|
}
|
|
14169
14219
|
}
|
|
14170
14220
|
}
|
|
14171
|
-
catch (
|
|
14221
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
14172
14222
|
finally {
|
|
14173
14223
|
try {
|
|
14174
14224
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
14175
14225
|
}
|
|
14176
|
-
finally { if (
|
|
14226
|
+
finally { if (e_1) throw e_1.error; }
|
|
14177
14227
|
}
|
|
14178
14228
|
};
|
|
14179
|
-
|
|
14180
|
-
|
|
14181
|
-
this.compileTracks(this.playableGraph);
|
|
14182
|
-
};
|
|
14183
|
-
TimelineComponent.prototype.compileTracks = function (graph) {
|
|
14184
|
-
var e_12, _a;
|
|
14229
|
+
ActivationClipPlayable.prototype.showRendererComponents = function () {
|
|
14230
|
+
var e_2, _a;
|
|
14185
14231
|
try {
|
|
14186
|
-
for (var _b = __values$1(this.
|
|
14187
|
-
var
|
|
14188
|
-
|
|
14189
|
-
|
|
14190
|
-
|
|
14191
|
-
trackOutput.setSourcePlayeble(trackMixPlayable);
|
|
14232
|
+
for (var _b = __values$1(this.bindingItem.rendererComponents), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
14233
|
+
var rendererComponent = _c.value;
|
|
14234
|
+
if (!rendererComponent.enabled) {
|
|
14235
|
+
rendererComponent.enabled = true;
|
|
14236
|
+
}
|
|
14192
14237
|
}
|
|
14193
14238
|
}
|
|
14194
|
-
catch (
|
|
14239
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
14195
14240
|
finally {
|
|
14196
14241
|
try {
|
|
14197
14242
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
14198
14243
|
}
|
|
14199
|
-
finally { if (
|
|
14244
|
+
finally { if (e_2) throw e_2.error; }
|
|
14200
14245
|
}
|
|
14201
14246
|
};
|
|
14202
|
-
|
|
14203
|
-
|
|
14204
|
-
this.options = {
|
|
14205
|
-
start: this.item.start,
|
|
14206
|
-
duration: this.item.duration,
|
|
14207
|
-
looping: this.item.endBehavior === END_BEHAVIOR_RESTART$1,
|
|
14208
|
-
endBehavior: this.item.endBehavior || END_BEHAVIOR_DESTROY$1,
|
|
14209
|
-
};
|
|
14210
|
-
this.id = this.item.id;
|
|
14211
|
-
this.name = this.item.name;
|
|
14212
|
-
};
|
|
14213
|
-
TimelineComponent.prototype.toData = function () {
|
|
14214
|
-
_super.prototype.toData.call(this);
|
|
14215
|
-
};
|
|
14216
|
-
__decorate([
|
|
14217
|
-
serialize()
|
|
14218
|
-
], TimelineComponent.prototype, "time", void 0);
|
|
14219
|
-
return TimelineComponent;
|
|
14220
|
-
}(ItemBehaviour));
|
|
14247
|
+
return ActivationClipPlayable;
|
|
14248
|
+
}(Playable));
|
|
14221
14249
|
|
|
14222
14250
|
/**
|
|
14223
14251
|
* @since 2.0.0
|
|
14224
14252
|
* @internal
|
|
14225
14253
|
*/
|
|
14226
|
-
var
|
|
14227
|
-
|
|
14228
|
-
|
|
14229
|
-
|
|
14254
|
+
var TimelineComponent = /** @class */ (function (_super) {
|
|
14255
|
+
__extends(TimelineComponent, _super);
|
|
14256
|
+
function TimelineComponent(engine) {
|
|
14257
|
+
var _this = _super.call(this, engine) || this;
|
|
14258
|
+
_this.reusable = false;
|
|
14259
|
+
_this.timelineStarted = false;
|
|
14260
|
+
_this.playableGraph = new PlayableGraph();
|
|
14261
|
+
/**
|
|
14262
|
+
* 元素动画已经播放的时间
|
|
14263
|
+
*/
|
|
14264
|
+
_this.time = 0;
|
|
14265
|
+
_this.tracks = [];
|
|
14266
|
+
_this.trackSeed = 0;
|
|
14267
|
+
return _this;
|
|
14230
14268
|
}
|
|
14231
|
-
|
|
14232
|
-
var
|
|
14233
|
-
return output;
|
|
14234
|
-
};
|
|
14235
|
-
/**
|
|
14236
|
-
* 重写该方法以创建自定义混合器
|
|
14237
|
-
*/
|
|
14238
|
-
Track.prototype.createMixerPlayable = function () {
|
|
14239
|
-
return new Playable();
|
|
14240
|
-
};
|
|
14241
|
-
Track.prototype.createPlayebleTree = function () {
|
|
14242
|
-
var e_1, _a;
|
|
14243
|
-
var defaultMixPlayable = this.createMixerPlayable();
|
|
14269
|
+
TimelineComponent.prototype.start = function () {
|
|
14270
|
+
var e_1, _a, e_2, _b;
|
|
14244
14271
|
try {
|
|
14245
|
-
|
|
14246
|
-
|
|
14247
|
-
|
|
14272
|
+
// TODO TimelineClip 需要传入 start 和 duration 数据
|
|
14273
|
+
for (var _c = __values$1(this.tracks), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
14274
|
+
var track = _d.value;
|
|
14275
|
+
try {
|
|
14276
|
+
for (var _e = (e_2 = void 0, __values$1(track.getClips())), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
14277
|
+
var clip = _f.value;
|
|
14278
|
+
clip.start = this.item.start;
|
|
14279
|
+
clip.duration = this.item.duration;
|
|
14280
|
+
}
|
|
14281
|
+
}
|
|
14282
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
14283
|
+
finally {
|
|
14284
|
+
try {
|
|
14285
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
14286
|
+
}
|
|
14287
|
+
finally { if (e_2) throw e_2.error; }
|
|
14288
|
+
}
|
|
14248
14289
|
}
|
|
14249
14290
|
}
|
|
14250
14291
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
14251
14292
|
finally {
|
|
14252
14293
|
try {
|
|
14253
|
-
if (
|
|
14294
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
14254
14295
|
}
|
|
14255
14296
|
finally { if (e_1) throw e_1.error; }
|
|
14256
14297
|
}
|
|
14257
|
-
|
|
14258
|
-
};
|
|
14259
|
-
Track.prototype.createClip = function (classConstructor, name) {
|
|
14260
|
-
var newClip = new TimelineClip();
|
|
14261
|
-
newClip.playable = new classConstructor();
|
|
14262
|
-
newClip.name = name ? name : 'TimelineClip' + newClip.id;
|
|
14263
|
-
this.addClip(newClip);
|
|
14264
|
-
return newClip;
|
|
14265
|
-
};
|
|
14266
|
-
Track.prototype.getClips = function () {
|
|
14267
|
-
return this.clips;
|
|
14298
|
+
this.compileTracks(this.playableGraph);
|
|
14268
14299
|
};
|
|
14269
|
-
|
|
14270
|
-
|
|
14271
|
-
|
|
14272
|
-
|
|
14273
|
-
|
|
14274
|
-
if (clip.name === name) {
|
|
14275
|
-
return clip;
|
|
14276
|
-
}
|
|
14277
|
-
}
|
|
14300
|
+
// TODO: [1.31] @十弦 vfx-item 下 onUpdate 的改动验证
|
|
14301
|
+
TimelineComponent.prototype.update = function (dt) {
|
|
14302
|
+
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;
|
|
14303
|
+
if (this.item.stopped || !this.item.composition) {
|
|
14304
|
+
return;
|
|
14278
14305
|
}
|
|
14279
|
-
|
|
14280
|
-
finally {
|
|
14306
|
+
if (!this.timelineStarted) {
|
|
14281
14307
|
try {
|
|
14282
|
-
|
|
14308
|
+
for (var _j = __values$1(this.tracks), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
14309
|
+
var track = _k.value;
|
|
14310
|
+
try {
|
|
14311
|
+
for (var _l = (e_4 = void 0, __values$1(track.getClips())), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
14312
|
+
var clip = _m.value;
|
|
14313
|
+
clip.playable.onGraphStart();
|
|
14314
|
+
}
|
|
14315
|
+
}
|
|
14316
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
14317
|
+
finally {
|
|
14318
|
+
try {
|
|
14319
|
+
if (_m && !_m.done && (_b = _l.return)) _b.call(_l);
|
|
14320
|
+
}
|
|
14321
|
+
finally { if (e_4) throw e_4.error; }
|
|
14322
|
+
}
|
|
14323
|
+
}
|
|
14283
14324
|
}
|
|
14284
|
-
|
|
14285
|
-
|
|
14286
|
-
|
|
14287
|
-
|
|
14288
|
-
|
|
14289
|
-
|
|
14290
|
-
this.clips.push(clip);
|
|
14291
|
-
};
|
|
14292
|
-
return Track;
|
|
14293
|
-
}());
|
|
14294
|
-
/**
|
|
14295
|
-
* @since 2.0.0
|
|
14296
|
-
* @internal
|
|
14297
|
-
*/
|
|
14298
|
-
var TimelineClip = /** @class */ (function () {
|
|
14299
|
-
function TimelineClip() {
|
|
14300
|
-
this.start = 0;
|
|
14301
|
-
this.duration = 0;
|
|
14302
|
-
}
|
|
14303
|
-
return TimelineClip;
|
|
14304
|
-
}());
|
|
14305
|
-
|
|
14306
|
-
var singleSplits = [[0, 0, 1, 1, undefined]];
|
|
14307
|
-
var tempColor = [1, 1, 1, 1];
|
|
14308
|
-
var seed$7 = 0;
|
|
14309
|
-
var SpriteColorPlayable = /** @class */ (function (_super) {
|
|
14310
|
-
__extends(SpriteColorPlayable, _super);
|
|
14311
|
-
function SpriteColorPlayable() {
|
|
14312
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
14313
|
-
_this.renderColor = [1, 1, 1, 1];
|
|
14314
|
-
return _this;
|
|
14315
|
-
}
|
|
14316
|
-
SpriteColorPlayable.prototype.onPlayablePlay = function () {
|
|
14317
|
-
this.spriteMaterial = this.bindingItem.getComponent(SpriteComponent).material;
|
|
14318
|
-
};
|
|
14319
|
-
SpriteColorPlayable.prototype.processFrame = function (dt) {
|
|
14320
|
-
var colorInc = vecFill(tempColor, 1);
|
|
14321
|
-
var colorChanged;
|
|
14322
|
-
var life = this.time / this.bindingItem.duration;
|
|
14323
|
-
var opacityOverLifetime = this.opacityOverLifetime;
|
|
14324
|
-
var colorOverLifetime = this.colorOverLifetime;
|
|
14325
|
-
if (colorOverLifetime) {
|
|
14326
|
-
colorInc = getColorFromGradientStops(colorOverLifetime, life, true);
|
|
14327
|
-
colorChanged = true;
|
|
14328
|
-
}
|
|
14329
|
-
if (opacityOverLifetime) {
|
|
14330
|
-
colorInc[3] *= opacityOverLifetime.getValue(life);
|
|
14331
|
-
colorChanged = true;
|
|
14332
|
-
}
|
|
14333
|
-
if (colorChanged) {
|
|
14334
|
-
vecMulCombine(this.renderColor, colorInc, this.startColor);
|
|
14335
|
-
this.spriteMaterial.getVector4('_Color').setFromArray(this.renderColor);
|
|
14336
|
-
}
|
|
14337
|
-
};
|
|
14338
|
-
SpriteColorPlayable.prototype.fromData = function (clipData) {
|
|
14339
|
-
var _a;
|
|
14340
|
-
this.clipData = clipData;
|
|
14341
|
-
var colorOverLifetime = clipData.colorOverLifetime;
|
|
14342
|
-
if (colorOverLifetime) {
|
|
14343
|
-
this.opacityOverLifetime = createValueGetter((_a = colorOverLifetime.opacity) !== null && _a !== void 0 ? _a : 1);
|
|
14344
|
-
if (colorOverLifetime.color && colorOverLifetime.color[0] === ValueType$1.GRADIENT_COLOR) {
|
|
14345
|
-
this.colorOverLifetime = colorStopsFromGradient(colorOverLifetime.color[1]);
|
|
14325
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
14326
|
+
finally {
|
|
14327
|
+
try {
|
|
14328
|
+
if (_k && !_k.done && (_a = _j.return)) _a.call(_j);
|
|
14329
|
+
}
|
|
14330
|
+
finally { if (e_3) throw e_3.error; }
|
|
14346
14331
|
}
|
|
14332
|
+
this.timelineStarted = true;
|
|
14347
14333
|
}
|
|
14348
|
-
|
|
14349
|
-
|
|
14350
|
-
|
|
14351
|
-
|
|
14352
|
-
|
|
14353
|
-
var
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
-
|
|
14366
|
-
|
|
14367
|
-
|
|
14368
|
-
triangles: area.area,
|
|
14369
|
-
backfaceCulling: _this.renderer.side === SideMode$1.FRONT,
|
|
14370
|
-
};
|
|
14334
|
+
var now = this.time;
|
|
14335
|
+
// 判断动画是否开始
|
|
14336
|
+
if (this.item.delaying && now >= 0 && now <= this.item.duration) {
|
|
14337
|
+
this.item.delaying = false;
|
|
14338
|
+
try {
|
|
14339
|
+
for (var _o = __values$1(this.tracks), _p = _o.next(); !_p.done; _p = _o.next()) {
|
|
14340
|
+
var track = _p.value;
|
|
14341
|
+
try {
|
|
14342
|
+
for (var _q = (e_6 = void 0, __values$1(track.getClips())), _r = _q.next(); !_r.done; _r = _q.next()) {
|
|
14343
|
+
var clip = _r.value;
|
|
14344
|
+
clip.playable.onPlayablePlay();
|
|
14345
|
+
}
|
|
14346
|
+
}
|
|
14347
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
14348
|
+
finally {
|
|
14349
|
+
try {
|
|
14350
|
+
if (_r && !_r.done && (_d = _q.return)) _d.call(_q);
|
|
14351
|
+
}
|
|
14352
|
+
finally { if (e_6) throw e_6.error; }
|
|
14353
|
+
}
|
|
14371
14354
|
}
|
|
14372
14355
|
}
|
|
14373
|
-
|
|
14374
|
-
|
|
14375
|
-
|
|
14356
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
14357
|
+
finally {
|
|
14358
|
+
try {
|
|
14359
|
+
if (_p && !_p.done && (_c = _o.return)) _c.call(_o);
|
|
14360
|
+
}
|
|
14361
|
+
finally { if (e_5) throw e_5.error; }
|
|
14362
|
+
}
|
|
14376
14363
|
}
|
|
14377
|
-
|
|
14378
|
-
|
|
14379
|
-
|
|
14380
|
-
|
|
14381
|
-
* @param visible - true:可见,false:不可见
|
|
14382
|
-
*/
|
|
14383
|
-
SpriteComponent.prototype.setVisible = function (visible) {
|
|
14384
|
-
this.visible = visible;
|
|
14385
|
-
};
|
|
14386
|
-
/**
|
|
14387
|
-
* 获取当前 Mesh 的可见性。
|
|
14388
|
-
*/
|
|
14389
|
-
SpriteComponent.prototype.getVisible = function () {
|
|
14390
|
-
return this.visible;
|
|
14391
|
-
};
|
|
14392
|
-
SpriteComponent.prototype.render = function (renderer) {
|
|
14393
|
-
if (!this.getVisible()) {
|
|
14394
|
-
return;
|
|
14364
|
+
// 判断动画是否结束
|
|
14365
|
+
var ended;
|
|
14366
|
+
if (VFXItem.isParticle(this.item)) {
|
|
14367
|
+
ended = this.item.isEnded(now) && this.item.content.destoryed;
|
|
14395
14368
|
}
|
|
14396
|
-
|
|
14397
|
-
|
|
14398
|
-
if (renderer.renderingData.currentFrame.globalUniforms) {
|
|
14399
|
-
renderer.setGlobalMatrix('effects_ObjectToWorld', this.transform.getWorldMatrix());
|
|
14369
|
+
else {
|
|
14370
|
+
ended = this.item.isEnded(now);
|
|
14400
14371
|
}
|
|
14401
|
-
|
|
14402
|
-
|
|
14403
|
-
|
|
14404
|
-
|
|
14405
|
-
|
|
14406
|
-
|
|
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
|
-
|
|
14372
|
+
if (ended) {
|
|
14373
|
+
var endBehavior = this.item.endBehavior;
|
|
14374
|
+
if (!this.item.ended) {
|
|
14375
|
+
this.item.ended = true;
|
|
14376
|
+
this.item.onEnd();
|
|
14377
|
+
if (endBehavior === END_BEHAVIOR_DESTROY$1) {
|
|
14378
|
+
try {
|
|
14379
|
+
for (var _s = __values$1(this.tracks), _t = _s.next(); !_t.done; _t = _s.next()) {
|
|
14380
|
+
var track = _t.value;
|
|
14381
|
+
try {
|
|
14382
|
+
for (var _u = (e_8 = void 0, __values$1(track.getClips())), _v = _u.next(); !_v.done; _v = _u.next()) {
|
|
14383
|
+
var clip = _v.value;
|
|
14384
|
+
clip.playable.onPlayableDestroy();
|
|
14385
|
+
}
|
|
14386
|
+
}
|
|
14387
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
14388
|
+
finally {
|
|
14389
|
+
try {
|
|
14390
|
+
if (_v && !_v.done && (_f = _u.return)) _f.call(_u);
|
|
14391
|
+
}
|
|
14392
|
+
finally { if (e_8) throw e_8.error; }
|
|
14393
|
+
}
|
|
14394
|
+
}
|
|
14395
|
+
}
|
|
14396
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
14397
|
+
finally {
|
|
14398
|
+
try {
|
|
14399
|
+
if (_t && !_t.done && (_e = _s.return)) _e.call(_s);
|
|
14400
|
+
}
|
|
14401
|
+
finally { if (e_7) throw e_7.error; }
|
|
14402
|
+
}
|
|
14403
|
+
this.item.delaying = true;
|
|
14404
|
+
if (!this.item.reusable && !this.reusable) {
|
|
14405
|
+
this.item.dispose();
|
|
14406
|
+
return;
|
|
14407
|
+
}
|
|
14435
14408
|
}
|
|
14436
14409
|
}
|
|
14437
|
-
|
|
14438
|
-
|
|
14439
|
-
|
|
14440
|
-
|
|
14410
|
+
}
|
|
14411
|
+
// TODO: [1.31] @茂安 验证 https://github.com/galacean/effects-runtime/commits/main/packages/effects-core/src/vfx-item.ts
|
|
14412
|
+
// 在生命周期内更新动画
|
|
14413
|
+
if (!this.item.delaying) {
|
|
14414
|
+
var lifetime = this.time / this.item.duration;
|
|
14415
|
+
this.item.lifetime = lifetime;
|
|
14416
|
+
try {
|
|
14417
|
+
for (var _w = __values$1(this.tracks), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
14418
|
+
var track = _x.value;
|
|
14419
|
+
try {
|
|
14420
|
+
for (var _y = (e_10 = void 0, __values$1(track.getClips())), _z = _y.next(); !_z.done; _z = _y.next()) {
|
|
14421
|
+
var clip = _z.value;
|
|
14422
|
+
clip.playable.setTime(this.time);
|
|
14423
|
+
}
|
|
14424
|
+
}
|
|
14425
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
14426
|
+
finally {
|
|
14427
|
+
try {
|
|
14428
|
+
if (_z && !_z.done && (_h = _y.return)) _h.call(_y);
|
|
14429
|
+
}
|
|
14430
|
+
finally { if (e_10) throw e_10.error; }
|
|
14431
|
+
}
|
|
14432
|
+
}
|
|
14441
14433
|
}
|
|
14442
|
-
|
|
14443
|
-
|
|
14444
|
-
|
|
14434
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
14435
|
+
finally {
|
|
14436
|
+
try {
|
|
14437
|
+
if (_x && !_x.done && (_g = _w.return)) _g.call(_w);
|
|
14438
|
+
}
|
|
14439
|
+
finally { if (e_9) throw e_9.error; }
|
|
14445
14440
|
}
|
|
14446
|
-
|
|
14447
|
-
|
|
14448
|
-
|
|
14449
|
-
|
|
14450
|
-
|
|
14451
|
-
|
|
14441
|
+
this.playableGraph.evaluate(dt);
|
|
14442
|
+
}
|
|
14443
|
+
};
|
|
14444
|
+
// time 单位秒
|
|
14445
|
+
TimelineComponent.prototype.setTime = function (time) {
|
|
14446
|
+
this.time = time;
|
|
14447
|
+
};
|
|
14448
|
+
TimelineComponent.prototype.getTime = function () {
|
|
14449
|
+
return this.time;
|
|
14450
|
+
};
|
|
14451
|
+
TimelineComponent.prototype.toLocalTime = function (time) {
|
|
14452
|
+
var localTime = time - this.options.start;
|
|
14453
|
+
var duration = this.options.duration;
|
|
14454
|
+
if (localTime - duration > 0.001) {
|
|
14455
|
+
if (this.options.endBehavior === END_BEHAVIOR_RESTART$1) {
|
|
14456
|
+
localTime = localTime % duration;
|
|
14452
14457
|
}
|
|
14453
|
-
else {
|
|
14454
|
-
|
|
14458
|
+
else if (this.options.endBehavior === END_BEHAVIOR_FREEZE$1) {
|
|
14459
|
+
localTime = Math.min(duration, localTime);
|
|
14455
14460
|
}
|
|
14456
|
-
this.material.getVector4('_TexOffset').setFromArray([
|
|
14457
|
-
texRectX + texOffset[0],
|
|
14458
|
-
texRectH + texRectY - texOffset[1],
|
|
14459
|
-
dx, dy,
|
|
14460
|
-
]);
|
|
14461
14461
|
}
|
|
14462
|
+
return localTime;
|
|
14462
14463
|
};
|
|
14463
|
-
|
|
14464
|
-
|
|
14465
|
-
|
|
14466
|
-
|
|
14464
|
+
TimelineComponent.prototype.createTrack = function (classConstructor, name) {
|
|
14465
|
+
var newTrack = new classConstructor();
|
|
14466
|
+
newTrack.bindingItem = this.item;
|
|
14467
|
+
newTrack.id = (this.trackSeed++).toString();
|
|
14468
|
+
newTrack.name = name ? name : 'Track' + newTrack.id;
|
|
14469
|
+
this.tracks.push(newTrack);
|
|
14470
|
+
return newTrack;
|
|
14467
14471
|
};
|
|
14468
|
-
|
|
14469
|
-
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
+
TimelineComponent.prototype.getTracks = function () {
|
|
14473
|
+
return this.tracks;
|
|
14474
|
+
};
|
|
14475
|
+
TimelineComponent.prototype.findTrack = function (name) {
|
|
14476
|
+
var e_11, _a;
|
|
14477
|
+
try {
|
|
14478
|
+
for (var _b = __values$1(this.tracks), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
14479
|
+
var track = _c.value;
|
|
14480
|
+
if (track.name === name) {
|
|
14481
|
+
return track;
|
|
14482
|
+
}
|
|
14483
|
+
}
|
|
14472
14484
|
}
|
|
14473
|
-
|
|
14474
|
-
|
|
14475
|
-
|
|
14476
|
-
|
|
14477
|
-
if (!this.wireframe) {
|
|
14478
|
-
for (var i = 0; i < idxCount; i++) {
|
|
14479
|
-
indexData[i] = pointStartIndex + index[i];
|
|
14485
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
14486
|
+
finally {
|
|
14487
|
+
try {
|
|
14488
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
14480
14489
|
}
|
|
14490
|
+
finally { if (e_11) throw e_11.error; }
|
|
14481
14491
|
}
|
|
14482
|
-
return {
|
|
14483
|
-
atlasOffset: geoData.atlasOffset,
|
|
14484
|
-
index: indexData,
|
|
14485
|
-
};
|
|
14486
14492
|
};
|
|
14487
|
-
|
|
14488
|
-
|
|
14489
|
-
|
|
14490
|
-
|
|
14491
|
-
|
|
14492
|
-
|
|
14493
|
-
|
|
14494
|
-
|
|
14495
|
-
|
|
14496
|
-
|
|
14497
|
-
|
|
14498
|
-
|
|
14499
|
-
|
|
14500
|
-
|
|
14501
|
-
var attributes = {
|
|
14502
|
-
atlasOffset: new Float32Array(data.atlasOffset.length),
|
|
14503
|
-
index: new Uint16Array(data.index.length),
|
|
14504
|
-
};
|
|
14505
|
-
attributes.atlasOffset.set(data.atlasOffset);
|
|
14506
|
-
attributes.index.set(data.index);
|
|
14507
|
-
var _a = this, material = _a.material, geometry = _a.geometry;
|
|
14508
|
-
var indexData = attributes.index;
|
|
14509
|
-
geometry.setIndexData(indexData);
|
|
14510
|
-
geometry.setAttributeData('atlasOffset', attributes.atlasOffset);
|
|
14511
|
-
geometry.setDrawCount(data.index.length);
|
|
14512
|
-
for (var i = 0; i < textures.length; i++) {
|
|
14513
|
-
var texture_1 = textures[i];
|
|
14514
|
-
material.setTexture('uSampler' + i, texture_1);
|
|
14493
|
+
TimelineComponent.prototype.rebuildGraph = function () {
|
|
14494
|
+
this.playableGraph = new PlayableGraph();
|
|
14495
|
+
this.compileTracks(this.playableGraph);
|
|
14496
|
+
};
|
|
14497
|
+
TimelineComponent.prototype.compileTracks = function (graph) {
|
|
14498
|
+
var e_12, _a;
|
|
14499
|
+
try {
|
|
14500
|
+
for (var _b = __values$1(this.tracks), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
14501
|
+
var track = _c.value;
|
|
14502
|
+
var trackMixPlayable = track.createPlayebleTree();
|
|
14503
|
+
var trackOutput = track.createOutput();
|
|
14504
|
+
graph.addOutput(trackOutput);
|
|
14505
|
+
trackOutput.setSourcePlayeble(trackMixPlayable);
|
|
14506
|
+
}
|
|
14515
14507
|
}
|
|
14516
|
-
|
|
14517
|
-
|
|
14518
|
-
|
|
14519
|
-
|
|
14508
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
14509
|
+
finally {
|
|
14510
|
+
try {
|
|
14511
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
14512
|
+
}
|
|
14513
|
+
finally { if (e_12) throw e_12.error; }
|
|
14520
14514
|
}
|
|
14521
14515
|
};
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
|
|
14525
|
-
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
data: new Float32Array([
|
|
14530
|
-
-0.5, 0.5, 0,
|
|
14531
|
-
-0.5, -0.5, 0,
|
|
14532
|
-
0.5, 0.5, 0,
|
|
14533
|
-
0.5, -0.5, 0, //右下
|
|
14534
|
-
]),
|
|
14535
|
-
},
|
|
14536
|
-
atlasOffset: {
|
|
14537
|
-
size: 2,
|
|
14538
|
-
offset: 0,
|
|
14539
|
-
releasable: true,
|
|
14540
|
-
type: glContext.FLOAT,
|
|
14541
|
-
data: new Float32Array(0),
|
|
14542
|
-
},
|
|
14543
|
-
},
|
|
14544
|
-
indices: { data: new Uint16Array(0), releasable: true },
|
|
14545
|
-
mode: mode,
|
|
14546
|
-
maxVertex: maxVertex,
|
|
14547
|
-
});
|
|
14548
|
-
};
|
|
14549
|
-
SpriteComponent.prototype.createMaterial = function (renderInfo, count) {
|
|
14550
|
-
var side = renderInfo.side, occlusion = renderInfo.occlusion, blending = renderInfo.blending, maskMode = renderInfo.maskMode, mask = renderInfo.mask;
|
|
14551
|
-
var materialProps = {
|
|
14552
|
-
shader: spriteMeshShaderFromRenderInfo(renderInfo, count, 1),
|
|
14553
|
-
};
|
|
14554
|
-
this.preMultiAlpha = getPreMultiAlpha(blending);
|
|
14555
|
-
var material = Material.create(this.engine, materialProps);
|
|
14556
|
-
var states = {
|
|
14557
|
-
side: side,
|
|
14558
|
-
blending: true,
|
|
14559
|
-
blendMode: blending,
|
|
14560
|
-
mask: mask,
|
|
14561
|
-
maskMode: maskMode,
|
|
14562
|
-
depthTest: true,
|
|
14563
|
-
depthMask: occlusion,
|
|
14516
|
+
TimelineComponent.prototype.fromData = function (data) {
|
|
14517
|
+
_super.prototype.fromData.call(this, data);
|
|
14518
|
+
this.options = {
|
|
14519
|
+
start: this.item.start,
|
|
14520
|
+
duration: this.item.duration,
|
|
14521
|
+
looping: this.item.endBehavior === END_BEHAVIOR_RESTART$1,
|
|
14522
|
+
endBehavior: this.item.endBehavior || END_BEHAVIOR_DESTROY$1,
|
|
14564
14523
|
};
|
|
14565
|
-
|
|
14566
|
-
|
|
14567
|
-
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
|
|
14571
|
-
|
|
14572
|
-
|
|
14573
|
-
|
|
14524
|
+
this.id = this.item.id;
|
|
14525
|
+
this.name = this.item.name;
|
|
14526
|
+
var activationTrack = this.createTrack(Track, 'ActivationTrack');
|
|
14527
|
+
activationTrack.createClip(ActivationClipPlayable, 'ActivationTimelineClip');
|
|
14528
|
+
};
|
|
14529
|
+
TimelineComponent.prototype.toData = function () {
|
|
14530
|
+
_super.prototype.toData.call(this);
|
|
14531
|
+
};
|
|
14532
|
+
__decorate([
|
|
14533
|
+
serialize()
|
|
14534
|
+
], TimelineComponent.prototype, "time", void 0);
|
|
14535
|
+
return TimelineComponent;
|
|
14536
|
+
}(ItemBehaviour));
|
|
14537
|
+
|
|
14538
|
+
var singleSplits = [[0, 0, 1, 1, undefined]];
|
|
14539
|
+
var tempColor = [1, 1, 1, 1];
|
|
14540
|
+
var seed$6 = 0;
|
|
14541
|
+
var SpriteColorPlayable = /** @class */ (function (_super) {
|
|
14542
|
+
__extends(SpriteColorPlayable, _super);
|
|
14543
|
+
function SpriteColorPlayable() {
|
|
14544
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
14545
|
+
_this.renderColor = [1, 1, 1, 1];
|
|
14546
|
+
return _this;
|
|
14547
|
+
}
|
|
14548
|
+
SpriteColorPlayable.prototype.onPlayablePlay = function () {
|
|
14549
|
+
this.spriteMaterial = this.bindingItem.getComponent(SpriteComponent).material;
|
|
14550
|
+
};
|
|
14551
|
+
SpriteColorPlayable.prototype.processFrame = function (dt) {
|
|
14552
|
+
var colorInc = vecFill(tempColor, 1);
|
|
14553
|
+
var colorChanged;
|
|
14554
|
+
var life = this.time / this.bindingItem.duration;
|
|
14555
|
+
var opacityOverLifetime = this.opacityOverLifetime;
|
|
14556
|
+
var colorOverLifetime = this.colorOverLifetime;
|
|
14557
|
+
if (colorOverLifetime) {
|
|
14558
|
+
colorInc = getColorFromGradientStops(colorOverLifetime, life, true);
|
|
14559
|
+
colorChanged = true;
|
|
14574
14560
|
}
|
|
14575
|
-
if (
|
|
14576
|
-
|
|
14561
|
+
if (opacityOverLifetime) {
|
|
14562
|
+
colorInc[3] *= opacityOverLifetime.getValue(life);
|
|
14563
|
+
colorChanged = true;
|
|
14577
14564
|
}
|
|
14578
|
-
if (
|
|
14579
|
-
|
|
14565
|
+
if (colorChanged) {
|
|
14566
|
+
vecMulCombine(this.renderColor, colorInc, this.startColor);
|
|
14567
|
+
this.spriteMaterial.getVector4('_Color').setFromArray(this.renderColor);
|
|
14580
14568
|
}
|
|
14581
|
-
return material;
|
|
14582
14569
|
};
|
|
14583
|
-
|
|
14584
|
-
var
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
|
|
14589
|
-
|
|
14590
|
-
|
|
14591
|
-
for (var i = 0; i < point.length; i += 6) {
|
|
14592
|
-
point[i] *= sx;
|
|
14593
|
-
point[i + 1] *= sy;
|
|
14594
|
-
atlasOffset_1.push(aPoint[i + 2], aPoint[i + 3]);
|
|
14595
|
-
position_1.push(point[i], point[i + 1], 0.0);
|
|
14596
|
-
}
|
|
14597
|
-
this.geometry.setAttributeData('aPos', new Float32Array(position_1));
|
|
14598
|
-
return {
|
|
14599
|
-
index: index_1,
|
|
14600
|
-
atlasOffset: atlasOffset_1,
|
|
14601
|
-
};
|
|
14602
|
-
}
|
|
14603
|
-
var originData = [-.5, .5, -.5, -.5, .5, .5, .5, -.5];
|
|
14604
|
-
var atlasOffset = [];
|
|
14605
|
-
var index = [];
|
|
14606
|
-
var col = 2;
|
|
14607
|
-
var row = 2;
|
|
14608
|
-
if (splits.length === 1) {
|
|
14609
|
-
col = 1;
|
|
14610
|
-
row = 1;
|
|
14611
|
-
}
|
|
14612
|
-
var position = [];
|
|
14613
|
-
for (var x = 0; x < col; x++) {
|
|
14614
|
-
for (var y = 0; y < row; y++) {
|
|
14615
|
-
var base = (y * 2 + x) * 4;
|
|
14616
|
-
// @ts-expect-error
|
|
14617
|
-
var split = textureSheetAnimation ? [0, 0, 1, 1, splits[0][4]] : splits[y * 2 + x];
|
|
14618
|
-
var texOffset = split[4] ? [0, 0, 1, 0, 0, 1, 1, 1] : [0, 1, 0, 0, 1, 1, 1, 0];
|
|
14619
|
-
var dw = ((x + x + 1) / col - 1) / 2;
|
|
14620
|
-
var dh = ((y + y + 1) / row - 1) / 2;
|
|
14621
|
-
var tox = split[0];
|
|
14622
|
-
var toy = split[1];
|
|
14623
|
-
var tsx = split[4] ? split[3] : split[2];
|
|
14624
|
-
var tsy = split[4] ? split[2] : split[3];
|
|
14625
|
-
var origin_1 = [
|
|
14626
|
-
originData[0] / col + dw,
|
|
14627
|
-
originData[1] / row + dh,
|
|
14628
|
-
originData[2] / col + dw,
|
|
14629
|
-
originData[3] / row + dh,
|
|
14630
|
-
originData[4] / col + dw,
|
|
14631
|
-
originData[5] / row + dh,
|
|
14632
|
-
originData[6] / col + dw,
|
|
14633
|
-
originData[7] / row + dh,
|
|
14634
|
-
];
|
|
14635
|
-
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);
|
|
14636
|
-
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);
|
|
14637
|
-
index.push(base, 1 + base, 2 + base, 2 + base, 1 + base, 3 + base);
|
|
14570
|
+
SpriteColorPlayable.prototype.fromData = function (clipData) {
|
|
14571
|
+
var _a;
|
|
14572
|
+
this.clipData = clipData;
|
|
14573
|
+
var colorOverLifetime = clipData.colorOverLifetime;
|
|
14574
|
+
if (colorOverLifetime) {
|
|
14575
|
+
this.opacityOverLifetime = createValueGetter((_a = colorOverLifetime.opacity) !== null && _a !== void 0 ? _a : 1);
|
|
14576
|
+
if (colorOverLifetime.color && colorOverLifetime.color[0] === ValueType$1.GRADIENT_COLOR) {
|
|
14577
|
+
this.colorOverLifetime = colorStopsFromGradient(colorOverLifetime.color[1]);
|
|
14638
14578
|
}
|
|
14639
14579
|
}
|
|
14640
|
-
this.
|
|
14641
|
-
return
|
|
14580
|
+
this.startColor = clipData.startColor || [1, 1, 1, 1];
|
|
14581
|
+
return this;
|
|
14642
14582
|
};
|
|
14643
|
-
|
|
14644
|
-
|
|
14645
|
-
|
|
14646
|
-
|
|
14647
|
-
|
|
14583
|
+
return SpriteColorPlayable;
|
|
14584
|
+
}(Playable));
|
|
14585
|
+
var SpriteComponent = /** @class */ (function (_super) {
|
|
14586
|
+
__extends(SpriteComponent, _super);
|
|
14587
|
+
function SpriteComponent(engine, props) {
|
|
14588
|
+
var _this = _super.call(this, engine) || this;
|
|
14589
|
+
_this.color = [1, 1, 1, 1];
|
|
14590
|
+
_this.visible = true;
|
|
14591
|
+
_this.getHitTestParams = function (force) {
|
|
14592
|
+
var _a;
|
|
14593
|
+
var ui = _this.interaction;
|
|
14594
|
+
if ((force || ui)) {
|
|
14595
|
+
var area = _this.getBoundingBox();
|
|
14596
|
+
if (area) {
|
|
14597
|
+
return {
|
|
14598
|
+
behavior: ((_a = _this.interaction) === null || _a === void 0 ? void 0 : _a.behavior) || 0,
|
|
14599
|
+
type: area.type,
|
|
14600
|
+
triangles: area.area,
|
|
14601
|
+
backfaceCulling: _this.renderer.side === SideMode$1.FRONT,
|
|
14602
|
+
};
|
|
14603
|
+
}
|
|
14604
|
+
}
|
|
14605
|
+
};
|
|
14606
|
+
if (props) {
|
|
14607
|
+
_this.fromData(props);
|
|
14648
14608
|
}
|
|
14649
|
-
return
|
|
14609
|
+
return _this;
|
|
14610
|
+
}
|
|
14611
|
+
/**
|
|
14612
|
+
* 设置当前 Mesh 的可见性。
|
|
14613
|
+
* @param visible - true:可见,false:不可见
|
|
14614
|
+
*/
|
|
14615
|
+
SpriteComponent.prototype.setVisible = function (visible) {
|
|
14616
|
+
this.visible = visible;
|
|
14650
14617
|
};
|
|
14651
14618
|
/**
|
|
14652
|
-
*
|
|
14653
|
-
* @returns
|
|
14619
|
+
* 获取当前 Mesh 的可见性。
|
|
14654
14620
|
*/
|
|
14655
|
-
SpriteComponent.prototype.
|
|
14656
|
-
|
|
14621
|
+
SpriteComponent.prototype.getVisible = function () {
|
|
14622
|
+
return this.visible;
|
|
14623
|
+
};
|
|
14624
|
+
SpriteComponent.prototype.render = function (renderer) {
|
|
14625
|
+
if (!this.getVisible()) {
|
|
14657
14626
|
return;
|
|
14658
14627
|
}
|
|
14659
|
-
var
|
|
14660
|
-
var
|
|
14661
|
-
|
|
14662
|
-
|
|
14663
|
-
worldMatrix.transformPoint(triangle.p1);
|
|
14664
|
-
worldMatrix.transformPoint(triangle.p2);
|
|
14665
|
-
});
|
|
14666
|
-
return {
|
|
14667
|
-
type: HitTestType.triangle,
|
|
14668
|
-
area: triangles,
|
|
14669
|
-
};
|
|
14670
|
-
};
|
|
14671
|
-
// TODO: [1.31] @十弦 https://github.com/galacean/effects-runtime/commit/fe8736540b9a461d8e96658f4d755ff8089a263b#diff-a3618f4527c5fe6e842f20d67d5c82984568502c6bf6fdfcbd24f69e2894ca90
|
|
14672
|
-
SpriteComponent.prototype.fromData = function (data) {
|
|
14673
|
-
var _a, _b, _c, _d, _e, _f;
|
|
14674
|
-
_super.prototype.fromData.call(this, data);
|
|
14675
|
-
var interaction = data.interaction, options = data.options, _g = data.listIndex, listIndex = _g === void 0 ? 0 : _g;
|
|
14676
|
-
var renderer = data.renderer;
|
|
14677
|
-
if (!renderer) {
|
|
14678
|
-
//@ts-expect-error
|
|
14679
|
-
renderer = {};
|
|
14628
|
+
var material = this.material;
|
|
14629
|
+
var geo = this.geometry;
|
|
14630
|
+
if (renderer.renderingData.currentFrame.globalUniforms) {
|
|
14631
|
+
renderer.setGlobalMatrix('effects_ObjectToWorld', this.transform.getWorldMatrix());
|
|
14680
14632
|
}
|
|
14681
|
-
this.
|
|
14682
|
-
|
|
14683
|
-
|
|
14684
|
-
|
|
14685
|
-
texture: (_c = renderer.texture) !== null && _c !== void 0 ? _c : this.engine.emptyTexture,
|
|
14686
|
-
occlusion: !!(renderer.occlusion),
|
|
14687
|
-
transparentOcclusion: !!(renderer.transparentOcclusion) || (renderer.maskMode === MaskMode$1.MASK),
|
|
14688
|
-
side: (_d = renderer.side) !== null && _d !== void 0 ? _d : SideMode$1.DOUBLE,
|
|
14689
|
-
shape: renderer.shape,
|
|
14690
|
-
mask: (_e = renderer.mask) !== null && _e !== void 0 ? _e : 0,
|
|
14691
|
-
maskMode: (_f = renderer.maskMode) !== null && _f !== void 0 ? _f : MaskMode$1.NONE,
|
|
14692
|
-
order: listIndex,
|
|
14693
|
-
};
|
|
14694
|
-
this.emptyTexture = this.engine.emptyTexture;
|
|
14695
|
-
this.splits = data.splits || singleSplits;
|
|
14696
|
-
this.textureSheetAnimation = data.textureSheetAnimation;
|
|
14697
|
-
this.cachePrefix = '-';
|
|
14698
|
-
this.renderInfo = getImageItemRenderInfo(this);
|
|
14699
|
-
var geometry = this.createGeometry(glContext.TRIANGLES);
|
|
14700
|
-
var material = this.createMaterial(this.renderInfo, 2);
|
|
14701
|
-
this.worldMatrix = Matrix4$1.fromIdentity();
|
|
14702
|
-
this.material = material;
|
|
14703
|
-
this.geometry = geometry;
|
|
14704
|
-
this.name = 'MSprite' + seed$7++;
|
|
14705
|
-
var startColor = options.startColor || [1, 1, 1, 1];
|
|
14706
|
-
this.material.setVector4('_Color', new Vector4$1().setFromArray(startColor));
|
|
14707
|
-
this.material.setVector4('_TexOffset', new Vector4$1().setFromArray([0, 0, 1, 1]));
|
|
14708
|
-
this.setItem();
|
|
14709
|
-
// 添加K帧动画
|
|
14710
|
-
var colorTrack = this.item.getComponent(TimelineComponent).createTrack(Track, 'SpriteColorTrack');
|
|
14711
|
-
colorTrack.createClip(SpriteColorPlayable, 'SpriteColorClip').playable.fromData({ colorOverLifetime: data.colorOverLifetime, startColor: data.options.startColor });
|
|
14712
|
-
};
|
|
14713
|
-
SpriteComponent.prototype.toData = function () {
|
|
14714
|
-
_super.prototype.toData.call(this);
|
|
14633
|
+
this.material.setVector2('_Size', this.transform.size);
|
|
14634
|
+
// 执行 Geometry 的数据刷新
|
|
14635
|
+
geo.flush();
|
|
14636
|
+
renderer.drawGeometry(geo, material);
|
|
14715
14637
|
};
|
|
14716
|
-
SpriteComponent =
|
|
14638
|
+
SpriteComponent.prototype.start = function () {
|
|
14639
|
+
this.priority = this.item.listIndex;
|
|
14640
|
+
this.timelineComponent = this.item.getComponent(TimelineComponent);
|
|
14641
|
+
this.item.getHitTestParams = this.getHitTestParams;
|
|
14642
|
+
};
|
|
14643
|
+
SpriteComponent.prototype.update = function (dt) {
|
|
14644
|
+
var time = this.timelineComponent.getTime();
|
|
14645
|
+
var duration = this.item.duration;
|
|
14646
|
+
var life = Math.min(Math.max(time / duration, 0.0), 1.0);
|
|
14647
|
+
var ta = this.textureSheetAnimation;
|
|
14648
|
+
if (ta) {
|
|
14649
|
+
var total = ta.total || (ta.row * ta.col);
|
|
14650
|
+
var texRectX = 0;
|
|
14651
|
+
var texRectY = 0;
|
|
14652
|
+
var texRectW = 1;
|
|
14653
|
+
var texRectH = 1;
|
|
14654
|
+
var flip = void 0;
|
|
14655
|
+
if (this.splits) {
|
|
14656
|
+
var sp = this.splits[0];
|
|
14657
|
+
flip = sp[4];
|
|
14658
|
+
texRectX = sp[0];
|
|
14659
|
+
texRectY = sp[1];
|
|
14660
|
+
if (flip) {
|
|
14661
|
+
texRectW = sp[3];
|
|
14662
|
+
texRectH = sp[2];
|
|
14663
|
+
}
|
|
14664
|
+
else {
|
|
14665
|
+
texRectW = sp[2];
|
|
14666
|
+
texRectH = sp[3];
|
|
14667
|
+
}
|
|
14668
|
+
}
|
|
14669
|
+
var dx = void 0, dy = void 0;
|
|
14670
|
+
if (flip) {
|
|
14671
|
+
dx = 1 / ta.row * texRectW;
|
|
14672
|
+
dy = 1 / ta.col * texRectH;
|
|
14673
|
+
}
|
|
14674
|
+
else {
|
|
14675
|
+
dx = 1 / ta.col * texRectW;
|
|
14676
|
+
dy = 1 / ta.row * texRectH;
|
|
14677
|
+
}
|
|
14678
|
+
var texOffset = void 0;
|
|
14679
|
+
if (ta.animate) {
|
|
14680
|
+
var frameIndex = Math.round(life * (total - 1));
|
|
14681
|
+
var yIndex = Math.floor(frameIndex / ta.col);
|
|
14682
|
+
var xIndex = frameIndex - yIndex * ta.col;
|
|
14683
|
+
texOffset = flip ? [dx * yIndex, dy * (ta.col - xIndex)] : [dx * xIndex, dy * (1 + yIndex)];
|
|
14684
|
+
}
|
|
14685
|
+
else {
|
|
14686
|
+
texOffset = [0, dy];
|
|
14687
|
+
}
|
|
14688
|
+
this.material.getVector4('_TexOffset').setFromArray([
|
|
14689
|
+
texRectX + texOffset[0],
|
|
14690
|
+
texRectH + texRectY - texOffset[1],
|
|
14691
|
+
dx, dy,
|
|
14692
|
+
]);
|
|
14693
|
+
}
|
|
14694
|
+
};
|
|
14695
|
+
SpriteComponent.prototype.onDestroy = function () {
|
|
14696
|
+
if (this.item && this.item.composition) {
|
|
14697
|
+
this.item.composition.destroyTextures(this.getTextures());
|
|
14698
|
+
}
|
|
14699
|
+
};
|
|
14700
|
+
SpriteComponent.prototype.getItemInitData = function (item, idx, pointStartIndex, textureIndex) {
|
|
14701
|
+
var geoData = item.geoData;
|
|
14702
|
+
if (!geoData) {
|
|
14703
|
+
geoData = item.geoData = this.getItemGeometryData(item, idx);
|
|
14704
|
+
}
|
|
14705
|
+
var index = geoData.index;
|
|
14706
|
+
var idxCount = index.length;
|
|
14707
|
+
// @ts-expect-error
|
|
14708
|
+
var indexData = this.wireframe ? new Uint8Array([0, 1, 1, 3, 2, 3, 2, 0]) : new index.constructor(idxCount);
|
|
14709
|
+
if (!this.wireframe) {
|
|
14710
|
+
for (var i = 0; i < idxCount; i++) {
|
|
14711
|
+
indexData[i] = pointStartIndex + index[i];
|
|
14712
|
+
}
|
|
14713
|
+
}
|
|
14714
|
+
return {
|
|
14715
|
+
atlasOffset: geoData.atlasOffset,
|
|
14716
|
+
index: indexData,
|
|
14717
|
+
};
|
|
14718
|
+
};
|
|
14719
|
+
SpriteComponent.prototype.setItem = function () {
|
|
14720
|
+
var textures = [];
|
|
14721
|
+
var texture = this.renderer.texture;
|
|
14722
|
+
if (texture) {
|
|
14723
|
+
addItem(textures, texture);
|
|
14724
|
+
}
|
|
14725
|
+
texture = this.renderer.texture;
|
|
14726
|
+
var textureIndex = texture ? textures.indexOf(texture) : -1;
|
|
14727
|
+
var data = this.getItemInitData(this, 0, 0, textureIndex);
|
|
14728
|
+
var renderer = this.renderer;
|
|
14729
|
+
var texParams = this.material.getVector4('_TexParams');
|
|
14730
|
+
texParams.x = renderer.occlusion ? +(renderer.transparentOcclusion) : 1;
|
|
14731
|
+
texParams.y = +this.preMultiAlpha;
|
|
14732
|
+
texParams.z = renderer.renderMode;
|
|
14733
|
+
var attributes = {
|
|
14734
|
+
atlasOffset: new Float32Array(data.atlasOffset.length),
|
|
14735
|
+
index: new Uint16Array(data.index.length),
|
|
14736
|
+
};
|
|
14737
|
+
attributes.atlasOffset.set(data.atlasOffset);
|
|
14738
|
+
attributes.index.set(data.index);
|
|
14739
|
+
var _a = this, material = _a.material, geometry = _a.geometry;
|
|
14740
|
+
var indexData = attributes.index;
|
|
14741
|
+
geometry.setIndexData(indexData);
|
|
14742
|
+
geometry.setAttributeData('atlasOffset', attributes.atlasOffset);
|
|
14743
|
+
geometry.setDrawCount(data.index.length);
|
|
14744
|
+
for (var i = 0; i < textures.length; i++) {
|
|
14745
|
+
var texture_1 = textures[i];
|
|
14746
|
+
material.setTexture('uSampler' + i, texture_1);
|
|
14747
|
+
}
|
|
14748
|
+
// FIXME: 内存泄漏的临时方案,后面再调整
|
|
14749
|
+
var emptyTexture = this.emptyTexture;
|
|
14750
|
+
for (var k = textures.length; k < maxSpriteMeshItemCount; k++) {
|
|
14751
|
+
material.setTexture('uSampler' + k, emptyTexture);
|
|
14752
|
+
}
|
|
14753
|
+
};
|
|
14754
|
+
SpriteComponent.prototype.createGeometry = function (mode) {
|
|
14755
|
+
var maxVertex = 12 * this.splits.length;
|
|
14756
|
+
return Geometry.create(this.engine, {
|
|
14757
|
+
attributes: {
|
|
14758
|
+
aPos: {
|
|
14759
|
+
type: glContext.FLOAT,
|
|
14760
|
+
size: 3,
|
|
14761
|
+
data: new Float32Array([
|
|
14762
|
+
-0.5, 0.5, 0,
|
|
14763
|
+
-0.5, -0.5, 0,
|
|
14764
|
+
0.5, 0.5, 0,
|
|
14765
|
+
0.5, -0.5, 0, //右下
|
|
14766
|
+
]),
|
|
14767
|
+
},
|
|
14768
|
+
atlasOffset: {
|
|
14769
|
+
size: 2,
|
|
14770
|
+
offset: 0,
|
|
14771
|
+
releasable: true,
|
|
14772
|
+
type: glContext.FLOAT,
|
|
14773
|
+
data: new Float32Array(0),
|
|
14774
|
+
},
|
|
14775
|
+
},
|
|
14776
|
+
indices: { data: new Uint16Array(0), releasable: true },
|
|
14777
|
+
mode: mode,
|
|
14778
|
+
maxVertex: maxVertex,
|
|
14779
|
+
});
|
|
14780
|
+
};
|
|
14781
|
+
SpriteComponent.prototype.createMaterial = function (renderInfo, count) {
|
|
14782
|
+
var side = renderInfo.side, occlusion = renderInfo.occlusion, blending = renderInfo.blending, maskMode = renderInfo.maskMode, mask = renderInfo.mask;
|
|
14783
|
+
var materialProps = {
|
|
14784
|
+
shader: spriteMeshShaderFromRenderInfo(renderInfo, count, 1),
|
|
14785
|
+
};
|
|
14786
|
+
this.preMultiAlpha = getPreMultiAlpha(blending);
|
|
14787
|
+
var material = Material.create(this.engine, materialProps);
|
|
14788
|
+
var states = {
|
|
14789
|
+
side: side,
|
|
14790
|
+
blending: true,
|
|
14791
|
+
blendMode: blending,
|
|
14792
|
+
mask: mask,
|
|
14793
|
+
maskMode: maskMode,
|
|
14794
|
+
depthTest: true,
|
|
14795
|
+
depthMask: occlusion,
|
|
14796
|
+
};
|
|
14797
|
+
material.blending = states.blending;
|
|
14798
|
+
material.stencilRef = states.mask !== undefined ? [states.mask, states.mask] : undefined;
|
|
14799
|
+
material.depthTest = states.depthTest;
|
|
14800
|
+
material.depthMask = states.depthMask;
|
|
14801
|
+
setBlendMode(material, states.blendMode);
|
|
14802
|
+
setMaskMode(material, states.maskMode);
|
|
14803
|
+
setSideMode(material, states.side);
|
|
14804
|
+
if (!material.hasUniform('_Color')) {
|
|
14805
|
+
material.setVector4('_Color', new Vector4$1(0, 0, 0, 1));
|
|
14806
|
+
}
|
|
14807
|
+
if (!material.hasUniform('_TexOffset')) {
|
|
14808
|
+
material.setVector4('_TexOffset', new Vector4$1());
|
|
14809
|
+
}
|
|
14810
|
+
if (!material.hasUniform('_TexParams')) {
|
|
14811
|
+
material.setVector4('_TexParams', new Vector4$1());
|
|
14812
|
+
}
|
|
14813
|
+
return material;
|
|
14814
|
+
};
|
|
14815
|
+
SpriteComponent.prototype.getItemGeometryData = function (item, aIndex) {
|
|
14816
|
+
var splits = item.splits, renderer = item.renderer, textureSheetAnimation = item.textureSheetAnimation;
|
|
14817
|
+
var sx = 1, sy = 1;
|
|
14818
|
+
if (renderer.shape) {
|
|
14819
|
+
var _a = renderer.shape, index_1 = _a.index, aPoint = _a.aPoint;
|
|
14820
|
+
var point = new Float32Array(aPoint);
|
|
14821
|
+
var position_1 = [];
|
|
14822
|
+
var atlasOffset_1 = [];
|
|
14823
|
+
for (var i = 0; i < point.length; i += 6) {
|
|
14824
|
+
point[i] *= sx;
|
|
14825
|
+
point[i + 1] *= sy;
|
|
14826
|
+
atlasOffset_1.push(aPoint[i + 2], aPoint[i + 3]);
|
|
14827
|
+
position_1.push(point[i], point[i + 1], 0.0);
|
|
14828
|
+
}
|
|
14829
|
+
this.geometry.setAttributeData('aPos', new Float32Array(position_1));
|
|
14830
|
+
return {
|
|
14831
|
+
index: index_1,
|
|
14832
|
+
atlasOffset: atlasOffset_1,
|
|
14833
|
+
};
|
|
14834
|
+
}
|
|
14835
|
+
var originData = [-.5, .5, -.5, -.5, .5, .5, .5, -.5];
|
|
14836
|
+
var atlasOffset = [];
|
|
14837
|
+
var index = [];
|
|
14838
|
+
var col = 2;
|
|
14839
|
+
var row = 2;
|
|
14840
|
+
if (splits.length === 1) {
|
|
14841
|
+
col = 1;
|
|
14842
|
+
row = 1;
|
|
14843
|
+
}
|
|
14844
|
+
var position = [];
|
|
14845
|
+
for (var x = 0; x < col; x++) {
|
|
14846
|
+
for (var y = 0; y < row; y++) {
|
|
14847
|
+
var base = (y * 2 + x) * 4;
|
|
14848
|
+
// @ts-expect-error
|
|
14849
|
+
var split = textureSheetAnimation ? [0, 0, 1, 1, splits[0][4]] : splits[y * 2 + x];
|
|
14850
|
+
var texOffset = split[4] ? [0, 0, 1, 0, 0, 1, 1, 1] : [0, 1, 0, 0, 1, 1, 1, 0];
|
|
14851
|
+
var dw = ((x + x + 1) / col - 1) / 2;
|
|
14852
|
+
var dh = ((y + y + 1) / row - 1) / 2;
|
|
14853
|
+
var tox = split[0];
|
|
14854
|
+
var toy = split[1];
|
|
14855
|
+
var tsx = split[4] ? split[3] : split[2];
|
|
14856
|
+
var tsy = split[4] ? split[2] : split[3];
|
|
14857
|
+
var origin_1 = [
|
|
14858
|
+
originData[0] / col + dw,
|
|
14859
|
+
originData[1] / row + dh,
|
|
14860
|
+
originData[2] / col + dw,
|
|
14861
|
+
originData[3] / row + dh,
|
|
14862
|
+
originData[4] / col + dw,
|
|
14863
|
+
originData[5] / row + dh,
|
|
14864
|
+
originData[6] / col + dw,
|
|
14865
|
+
originData[7] / row + dh,
|
|
14866
|
+
];
|
|
14867
|
+
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);
|
|
14868
|
+
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);
|
|
14869
|
+
index.push(base, 1 + base, 2 + base, 2 + base, 1 + base, 3 + base);
|
|
14870
|
+
}
|
|
14871
|
+
}
|
|
14872
|
+
this.geometry.setAttributeData('aPos', new Float32Array(position));
|
|
14873
|
+
return { index: index, atlasOffset: atlasOffset };
|
|
14874
|
+
};
|
|
14875
|
+
SpriteComponent.prototype.getTextures = function () {
|
|
14876
|
+
var ret = [];
|
|
14877
|
+
var tex = this.renderer.texture;
|
|
14878
|
+
if (tex) {
|
|
14879
|
+
ret.push(tex);
|
|
14880
|
+
}
|
|
14881
|
+
return ret;
|
|
14882
|
+
};
|
|
14883
|
+
/**
|
|
14884
|
+
* 获取图层包围盒的类型和世界坐标
|
|
14885
|
+
* @returns
|
|
14886
|
+
*/
|
|
14887
|
+
SpriteComponent.prototype.getBoundingBox = function () {
|
|
14888
|
+
if (!this.item) {
|
|
14889
|
+
return;
|
|
14890
|
+
}
|
|
14891
|
+
var worldMatrix = this.transform.getWorldMatrix();
|
|
14892
|
+
var triangles = trianglesFromRect(Vector3.ZERO, 1 / 2, 1 / 2);
|
|
14893
|
+
triangles.forEach(function (triangle) {
|
|
14894
|
+
worldMatrix.transformPoint(triangle.p0);
|
|
14895
|
+
worldMatrix.transformPoint(triangle.p1);
|
|
14896
|
+
worldMatrix.transformPoint(triangle.p2);
|
|
14897
|
+
});
|
|
14898
|
+
return {
|
|
14899
|
+
type: HitTestType.triangle,
|
|
14900
|
+
area: triangles,
|
|
14901
|
+
};
|
|
14902
|
+
};
|
|
14903
|
+
// TODO: [1.31] @十弦 https://github.com/galacean/effects-runtime/commit/fe8736540b9a461d8e96658f4d755ff8089a263b#diff-a3618f4527c5fe6e842f20d67d5c82984568502c6bf6fdfcbd24f69e2894ca90
|
|
14904
|
+
SpriteComponent.prototype.fromData = function (data) {
|
|
14905
|
+
var _a, _b, _c, _d, _e, _f;
|
|
14906
|
+
_super.prototype.fromData.call(this, data);
|
|
14907
|
+
var interaction = data.interaction, options = data.options, _g = data.listIndex, listIndex = _g === void 0 ? 0 : _g;
|
|
14908
|
+
var renderer = data.renderer;
|
|
14909
|
+
if (!renderer) {
|
|
14910
|
+
//@ts-expect-error
|
|
14911
|
+
renderer = {};
|
|
14912
|
+
}
|
|
14913
|
+
this.interaction = interaction;
|
|
14914
|
+
this.renderer = {
|
|
14915
|
+
renderMode: (_a = renderer.renderMode) !== null && _a !== void 0 ? _a : RenderMode$1.BILLBOARD,
|
|
14916
|
+
blending: (_b = renderer.blending) !== null && _b !== void 0 ? _b : BlendingMode$1.ALPHA,
|
|
14917
|
+
texture: (_c = renderer.texture) !== null && _c !== void 0 ? _c : this.engine.emptyTexture,
|
|
14918
|
+
occlusion: !!(renderer.occlusion),
|
|
14919
|
+
transparentOcclusion: !!(renderer.transparentOcclusion) || (renderer.maskMode === MaskMode$1.MASK),
|
|
14920
|
+
side: (_d = renderer.side) !== null && _d !== void 0 ? _d : SideMode$1.DOUBLE,
|
|
14921
|
+
shape: renderer.shape,
|
|
14922
|
+
mask: (_e = renderer.mask) !== null && _e !== void 0 ? _e : 0,
|
|
14923
|
+
maskMode: (_f = renderer.maskMode) !== null && _f !== void 0 ? _f : MaskMode$1.NONE,
|
|
14924
|
+
order: listIndex,
|
|
14925
|
+
};
|
|
14926
|
+
this.emptyTexture = this.engine.emptyTexture;
|
|
14927
|
+
this.splits = data.splits || singleSplits;
|
|
14928
|
+
this.textureSheetAnimation = data.textureSheetAnimation;
|
|
14929
|
+
this.cachePrefix = '-';
|
|
14930
|
+
this.renderInfo = getImageItemRenderInfo(this);
|
|
14931
|
+
var geometry = this.createGeometry(glContext.TRIANGLES);
|
|
14932
|
+
var material = this.createMaterial(this.renderInfo, 2);
|
|
14933
|
+
this.worldMatrix = Matrix4$1.fromIdentity();
|
|
14934
|
+
this.material = material;
|
|
14935
|
+
this.geometry = geometry;
|
|
14936
|
+
this.name = 'MSprite' + seed$6++;
|
|
14937
|
+
var startColor = options.startColor || [1, 1, 1, 1];
|
|
14938
|
+
this.material.setVector4('_Color', new Vector4$1().setFromArray(startColor));
|
|
14939
|
+
this.material.setVector4('_TexOffset', new Vector4$1().setFromArray([0, 0, 1, 1]));
|
|
14940
|
+
this.setItem();
|
|
14941
|
+
// 添加K帧动画
|
|
14942
|
+
var colorTrack = this.item.getComponent(TimelineComponent).createTrack(Track, 'SpriteColorTrack');
|
|
14943
|
+
colorTrack.createClip(SpriteColorPlayable, 'SpriteColorClip').playable.fromData({ colorOverLifetime: data.colorOverLifetime, startColor: data.options.startColor });
|
|
14944
|
+
};
|
|
14945
|
+
SpriteComponent.prototype.toData = function () {
|
|
14946
|
+
_super.prototype.toData.call(this);
|
|
14947
|
+
};
|
|
14948
|
+
SpriteComponent = __decorate([
|
|
14717
14949
|
effectsClass(DataType.SpriteComponent)
|
|
14718
14950
|
], SpriteComponent);
|
|
14719
14951
|
return SpriteComponent;
|
|
@@ -17706,7 +17938,7 @@ var ParticleSystem = /** @class */ (function (_super) {
|
|
|
17706
17938
|
sprite[1] = tsa.animationDuration.getValue(lifetime);
|
|
17707
17939
|
sprite[2] = tsa.cycles.getValue(lifetime);
|
|
17708
17940
|
}
|
|
17709
|
-
var rot = tempRot
|
|
17941
|
+
var rot = tempRot;
|
|
17710
17942
|
if (options.start3DRotation) {
|
|
17711
17943
|
// @ts-expect-error
|
|
17712
17944
|
rot.set(options.startRotationX.getValue(lifetime), options.startRotationY.getValue(lifetime), options.startRotationZ.getValue(lifetime));
|
|
@@ -17722,7 +17954,7 @@ var ParticleSystem = /** @class */ (function (_super) {
|
|
|
17722
17954
|
if (color.length === 3) {
|
|
17723
17955
|
color[3] = 1;
|
|
17724
17956
|
}
|
|
17725
|
-
var size = tempSize
|
|
17957
|
+
var size = tempSize;
|
|
17726
17958
|
if (options.start3DSize) {
|
|
17727
17959
|
size.x = options.startSizeX.getValue(lifetime);
|
|
17728
17960
|
size.y = options.startSizeY.getValue(lifetime);
|
|
@@ -17884,7 +18116,8 @@ var ParticleSystem = /** @class */ (function (_super) {
|
|
|
17884
18116
|
separateAxes: false,
|
|
17885
18117
|
x: createValueGetter(('size' in sizeOverLifetime ? sizeOverLifetime.size : sizeOverLifetime.x) || 1),
|
|
17886
18118
|
};
|
|
17887
|
-
|
|
18119
|
+
renderer.anchor = renderer.anchor || [0, 0];
|
|
18120
|
+
var anchor = Vector2.fromArray(renderer.anchor);
|
|
17888
18121
|
this.options = {
|
|
17889
18122
|
particleFollowParent: !!options.particleFollowParent,
|
|
17890
18123
|
startLifetime: createValueGetter(options.startLifetime),
|
|
@@ -17896,484 +18129,250 @@ var ParticleSystem = /** @class */ (function (_super) {
|
|
|
17896
18129
|
maxCount: (_e = options.maxCount) !== null && _e !== void 0 ? _e : 0,
|
|
17897
18130
|
gravityModifier: createValueGetter(gravityModifier || 0),
|
|
17898
18131
|
gravity: gravity,
|
|
17899
|
-
start3DSize: !!options.start3DSize,
|
|
17900
|
-
startTurbulence: startTurbulence,
|
|
17901
|
-
turbulence: turbulence,
|
|
17902
|
-
speedOverLifetime: positionOverLifetime.speedOverLifetime && createValueGetter(positionOverLifetime.speedOverLifetime),
|
|
17903
|
-
linearVelOverLifetime: linearVelOverLifetime,
|
|
17904
|
-
orbitalVelOverLifetime: orbitalVelOverLifetime,
|
|
17905
|
-
forceTarget: forceTarget,
|
|
17906
|
-
};
|
|
17907
|
-
if (options.startRotationZ) {
|
|
17908
|
-
this.options.startRotation = createValueGetter(options.startRotationZ || 0);
|
|
17909
|
-
}
|
|
17910
|
-
if (options.startRotationX || options.startRotationY) {
|
|
17911
|
-
this.options.start3DRotation = true;
|
|
17912
|
-
this.options.startRotationX = createValueGetter(options.startRotationX || 0);
|
|
17913
|
-
this.options.startRotationY = createValueGetter(options.startRotationY || 0);
|
|
17914
|
-
this.options.startRotationZ = createValueGetter(options.startRotationZ || 0);
|
|
17915
|
-
}
|
|
17916
|
-
if (options.start3DSize) {
|
|
17917
|
-
this.options.startSizeX = createValueGetter(options.startSizeX);
|
|
17918
|
-
this.options.startSizeY = createValueGetter(options.startSizeY);
|
|
17919
|
-
}
|
|
17920
|
-
else {
|
|
17921
|
-
this.options.startSize = createValueGetter(options.startSize);
|
|
17922
|
-
this.options.sizeAspect = createValueGetter(options.sizeAspect || 1);
|
|
17923
|
-
}
|
|
17924
|
-
var particleMeshProps = {
|
|
17925
|
-
// listIndex: vfxItem.listIndex,
|
|
17926
|
-
meshSlots: options.meshSlots,
|
|
17927
|
-
name: this.name,
|
|
17928
|
-
matrix: Matrix4$1.IDENTITY,
|
|
17929
|
-
filter: props.filter,
|
|
17930
|
-
shaderCachePrefix: shaderCachePrefix,
|
|
17931
|
-
renderMode: renderer.renderMode || RenderMode$1.BILLBOARD,
|
|
17932
|
-
side: renderer.side || SideMode$1.DOUBLE,
|
|
17933
|
-
gravity: gravity,
|
|
17934
|
-
// duration: vfxItem.duration,
|
|
17935
|
-
blending: renderer.blending || BlendingMode$1.ALPHA,
|
|
17936
|
-
rotationOverLifetime: rotationOverLifetime,
|
|
17937
|
-
gravityModifier: this.options.gravityModifier,
|
|
17938
|
-
linearVelOverLifetime: this.options.linearVelOverLifetime,
|
|
17939
|
-
orbitalVelOverLifetime: this.options.orbitalVelOverLifetime,
|
|
17940
|
-
speedOverLifetime: this.options.speedOverLifetime,
|
|
17941
|
-
sprite: textureSheetAnimation,
|
|
17942
|
-
occlusion: !!renderer.occlusion,
|
|
17943
|
-
transparentOcclusion: !!renderer.transparentOcclusion,
|
|
17944
|
-
maxCount: options.maxCount,
|
|
17945
|
-
mask: renderer.mask,
|
|
17946
|
-
maskMode: (_f = renderer.maskMode) !== null && _f !== void 0 ? _f : MaskMode$1.NONE,
|
|
17947
|
-
forceTarget: forceTarget,
|
|
17948
|
-
diffuse: renderer.texture,
|
|
17949
|
-
sizeOverLifetime: sizeOverLifetimeGetter,
|
|
17950
|
-
anchor: anchor,
|
|
17951
|
-
};
|
|
17952
|
-
if (colorOverLifetime) {
|
|
17953
|
-
var color = colorOverLifetime.color, opacity = colorOverLifetime.opacity;
|
|
17954
|
-
particleMeshProps.colorOverLifetime = {};
|
|
17955
|
-
if (opacity) {
|
|
17956
|
-
particleMeshProps.colorOverLifetime.opacity = createValueGetter(colorOverLifetime.opacity);
|
|
17957
|
-
}
|
|
17958
|
-
if (color) {
|
|
17959
|
-
if (color[0] === ValueType$1.GRADIENT_COLOR) {
|
|
17960
|
-
particleMeshProps.colorOverLifetime.color = colorOverLifetime.color[1];
|
|
17961
|
-
}
|
|
17962
|
-
else if (color[0] === ValueType$1.RGBA_COLOR) {
|
|
17963
|
-
particleMeshProps.colorOverLifetime.color = Texture.createWithData(this.engine, {
|
|
17964
|
-
data: new Uint8Array(color[1]),
|
|
17965
|
-
width: 1,
|
|
17966
|
-
height: 1,
|
|
17967
|
-
});
|
|
17968
|
-
}
|
|
17969
|
-
else if (color instanceof Texture) {
|
|
17970
|
-
particleMeshProps.colorOverLifetime.color = color;
|
|
17971
|
-
}
|
|
17972
|
-
}
|
|
17973
|
-
}
|
|
17974
|
-
var uvs = [];
|
|
17975
|
-
var textureMap = [0, 0, 1, 1];
|
|
17976
|
-
var flip;
|
|
17977
|
-
if (props.splits) {
|
|
17978
|
-
var s = props.splits[0];
|
|
17979
|
-
flip = s[4];
|
|
17980
|
-
textureMap = flip ? [s[0], s[1], s[3], s[2]] : [s[0], s[1], s[2], s[3]];
|
|
17981
|
-
}
|
|
17982
|
-
if (textureSheetAnimation && !textureSheetAnimation.animate) {
|
|
17983
|
-
var col = flip ? textureSheetAnimation.row : textureSheetAnimation.col;
|
|
17984
|
-
var row = flip ? textureSheetAnimation.col : textureSheetAnimation.row;
|
|
17985
|
-
var total = textureSheetAnimation.total || col * row;
|
|
17986
|
-
var index$1 = 0;
|
|
17987
|
-
for (var x = 0; x < col; x++) {
|
|
17988
|
-
for (var y = 0; y < row && index$1 < total; y++, index$1++) {
|
|
17989
|
-
uvs.push([
|
|
17990
|
-
x * textureMap[2] / col + textureMap[0],
|
|
17991
|
-
y * textureMap[3] / row + textureMap[1],
|
|
17992
|
-
textureMap[2] / col,
|
|
17993
|
-
textureMap[3] / row
|
|
17994
|
-
]);
|
|
17995
|
-
}
|
|
17996
|
-
}
|
|
17997
|
-
}
|
|
17998
|
-
else {
|
|
17999
|
-
uvs.push(textureMap);
|
|
18000
|
-
}
|
|
18001
|
-
this.uvs = uvs;
|
|
18002
|
-
// @ts-expect-error
|
|
18003
|
-
particleMeshProps.textureFlip = flip;
|
|
18004
|
-
var trails = props.trails;
|
|
18005
|
-
var trailMeshProps;
|
|
18006
|
-
if (trails) {
|
|
18007
|
-
this.trails = {
|
|
18008
|
-
lifetime: createValueGetter(trails.lifetime),
|
|
18009
|
-
dieWithParticles: trails.dieWithParticles !== false,
|
|
18010
|
-
sizeAffectsWidth: !!trails.sizeAffectsWidth,
|
|
18011
|
-
sizeAffectsLifetime: !!trails.sizeAffectsLifetime,
|
|
18012
|
-
inheritParticleColor: !!trails.inheritParticleColor,
|
|
18013
|
-
parentAffectsPosition: !!trails.parentAffectsPosition,
|
|
18014
|
-
};
|
|
18015
|
-
trailMeshProps = {
|
|
18016
|
-
name: 'Trail',
|
|
18017
|
-
matrix: Matrix4$1.IDENTITY,
|
|
18018
|
-
minimumVertexDistance: trails.minimumVertexDistance || 0.02,
|
|
18019
|
-
maxTrailCount: options.maxCount,
|
|
18020
|
-
pointCountPerTrail: Math.round(trails.maxPointPerTrail) || 32,
|
|
18021
|
-
blending: trails.blending,
|
|
18022
|
-
texture: trails.texture,
|
|
18023
|
-
opacityOverLifetime: createValueGetter(trails.opacityOverLifetime || 1),
|
|
18024
|
-
widthOverTrail: createValueGetter(trails.widthOverTrail || 1),
|
|
18025
|
-
// order: vfxItem.listIndex + (trails.orderOffset || 0),
|
|
18026
|
-
shaderCachePrefix: shaderCachePrefix,
|
|
18027
|
-
lifetime: this.trails.lifetime,
|
|
18028
|
-
occlusion: !!trails.occlusion,
|
|
18029
|
-
transparentOcclusion: !!trails.transparentOcclusion,
|
|
18030
|
-
textureMap: trails.textureMap,
|
|
18031
|
-
mask: renderer.mask,
|
|
18032
|
-
maskMode: renderer.maskMode,
|
|
18033
|
-
};
|
|
18034
|
-
if (trails.colorOverLifetime && trails.colorOverLifetime[0] === ValueType$1.GRADIENT_COLOR) {
|
|
18035
|
-
trailMeshProps.colorOverLifetime = trails.colorOverLifetime[1];
|
|
18036
|
-
}
|
|
18037
|
-
if (trails.colorOverTrail && trails.colorOverTrail[0] === ValueType$1.GRADIENT_COLOR) {
|
|
18038
|
-
trailMeshProps.colorOverTrail = trails.colorOverTrail[1];
|
|
18039
|
-
}
|
|
18040
|
-
}
|
|
18041
|
-
this.renderer = new ParticleSystemRenderer(this.engine, particleMeshProps, trailMeshProps);
|
|
18042
|
-
this.meshes = this.renderer.meshes;
|
|
18043
|
-
// this.item = vfxItem;
|
|
18044
|
-
var interaction = props.interaction;
|
|
18045
|
-
if (interaction) {
|
|
18046
|
-
this.interaction = {
|
|
18047
|
-
multiple: interaction.multiple,
|
|
18048
|
-
radius: interaction.radius,
|
|
18049
|
-
behavior: interaction.behavior,
|
|
18050
|
-
};
|
|
18051
|
-
}
|
|
18052
|
-
this.item.getHitTestParams = this.getHitTestParams;
|
|
18053
|
-
this.item._content = this;
|
|
18054
|
-
this.renderer.item = this.item;
|
|
18055
|
-
this.item.components.push(this.renderer);
|
|
18056
|
-
this.item.rendererComponents.push(this.renderer);
|
|
18057
|
-
// 添加粒子动画 clip
|
|
18058
|
-
var timeline = this.item.getComponent(TimelineComponent);
|
|
18059
|
-
timeline.createTrack(Track).createClip(ParticleBehaviourPlayable);
|
|
18060
|
-
};
|
|
18061
|
-
ParticleSystem = __decorate([
|
|
18062
|
-
effectsClass(DataType.ParticleSystem)
|
|
18063
|
-
], ParticleSystem);
|
|
18064
|
-
return ParticleSystem;
|
|
18065
|
-
}(Component));
|
|
18066
|
-
// array performance better for small memory than Float32Array
|
|
18067
|
-
var tempDir = new Vector3();
|
|
18068
|
-
var tempSize$1 = new Vector2();
|
|
18069
|
-
var tempRot$1 = new Euler();
|
|
18070
|
-
var tmpDirX = new Vector3();
|
|
18071
|
-
var tmpDirY = new Vector3();
|
|
18072
|
-
var tempVec3 = new Vector3();
|
|
18073
|
-
var tempEuler = new Euler();
|
|
18074
|
-
var tempSprite = [0, 0, 0];
|
|
18075
|
-
var tempMat4 = new Matrix4$1();
|
|
18076
|
-
function getBurstOffsets(burstOffsets) {
|
|
18077
|
-
var ret = {};
|
|
18078
|
-
if (Array.isArray(burstOffsets)) {
|
|
18079
|
-
burstOffsets.forEach(function (arr) {
|
|
18080
|
-
var isArr = arr instanceof Array;
|
|
18081
|
-
var index = isArr ? arr[0] : arr.index;
|
|
18082
|
-
var offsets = ret[index];
|
|
18083
|
-
if (!offsets) {
|
|
18084
|
-
offsets = ret[index] = [];
|
|
18085
|
-
}
|
|
18086
|
-
if (isArr) {
|
|
18087
|
-
offsets.push(arr.slice(1, 4));
|
|
18088
|
-
}
|
|
18089
|
-
else {
|
|
18090
|
-
offsets.push([+arr.x, +arr.y, +arr.z]);
|
|
18091
|
-
}
|
|
18092
|
-
});
|
|
18093
|
-
}
|
|
18094
|
-
return ret;
|
|
18095
|
-
}
|
|
18096
|
-
function randomArrItem(arr, keepArr) {
|
|
18097
|
-
var index = Math.floor(Math.random() * arr.length);
|
|
18098
|
-
var item = arr[index];
|
|
18099
|
-
if (!keepArr) {
|
|
18100
|
-
arr.splice(index, 1);
|
|
18101
|
-
}
|
|
18102
|
-
return item;
|
|
18103
|
-
}
|
|
18104
|
-
|
|
18105
|
-
/**
|
|
18106
|
-
* @since 2.0.0
|
|
18107
|
-
* @internal
|
|
18108
|
-
*/
|
|
18109
|
-
var ParticleBehaviourPlayable = /** @class */ (function (_super) {
|
|
18110
|
-
__extends(ParticleBehaviourPlayable, _super);
|
|
18111
|
-
function ParticleBehaviourPlayable() {
|
|
18112
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
18113
|
-
}
|
|
18114
|
-
ParticleBehaviourPlayable.prototype.onPlayablePlay = function () {
|
|
18115
|
-
this.particleSystem = this.bindingItem.getComponent(ParticleSystem);
|
|
18116
|
-
if (this.particleSystem) {
|
|
18117
|
-
this.particleSystem.name = this.bindingItem.name;
|
|
18118
|
-
this.particleSystem.start();
|
|
18119
|
-
this.particleSystem.initEmitterTransform();
|
|
18132
|
+
start3DSize: !!options.start3DSize,
|
|
18133
|
+
startTurbulence: startTurbulence,
|
|
18134
|
+
turbulence: turbulence,
|
|
18135
|
+
speedOverLifetime: positionOverLifetime.speedOverLifetime && createValueGetter(positionOverLifetime.speedOverLifetime),
|
|
18136
|
+
linearVelOverLifetime: linearVelOverLifetime,
|
|
18137
|
+
orbitalVelOverLifetime: orbitalVelOverLifetime,
|
|
18138
|
+
forceTarget: forceTarget,
|
|
18139
|
+
};
|
|
18140
|
+
if (options.startRotationZ) {
|
|
18141
|
+
this.options.startRotation = createValueGetter(options.startRotationZ || 0);
|
|
18120
18142
|
}
|
|
18121
|
-
|
|
18122
|
-
|
|
18123
|
-
|
|
18124
|
-
|
|
18125
|
-
this.
|
|
18126
|
-
// TODO: [1.31] @十弦 验证 https://github.com/galacean/effects-runtime/commit/3e7d73d37b7d98c2a25e4544e80e928b17801ccd#diff-fae062f28caf3771cfedd3a20dc22f9749bd054c7541bf2fd50a9a5e413153d4
|
|
18127
|
-
// particleSystem.setParentTransform(parentItem.transform);
|
|
18128
|
-
particleSystem.setVisible(true);
|
|
18129
|
-
particleSystem.onUpdate(dt);
|
|
18143
|
+
if (options.startRotationX || options.startRotationY) {
|
|
18144
|
+
this.options.start3DRotation = true;
|
|
18145
|
+
this.options.startRotationX = createValueGetter(options.startRotationX || 0);
|
|
18146
|
+
this.options.startRotationY = createValueGetter(options.startRotationY || 0);
|
|
18147
|
+
this.options.startRotationZ = createValueGetter(options.startRotationZ || 0);
|
|
18130
18148
|
}
|
|
18131
|
-
|
|
18132
|
-
|
|
18133
|
-
|
|
18134
|
-
|
|
18135
|
-
var CalculateLoader = /** @class */ (function (_super) {
|
|
18136
|
-
__extends(CalculateLoader, _super);
|
|
18137
|
-
function CalculateLoader() {
|
|
18138
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
18139
|
-
}
|
|
18140
|
-
return CalculateLoader;
|
|
18141
|
-
}(AbstractPlugin));
|
|
18142
|
-
|
|
18143
|
-
var AnimationStream = /** @class */ (function () {
|
|
18144
|
-
function AnimationStream(playable) {
|
|
18145
|
-
this.curveValues = {};
|
|
18146
|
-
this.playable = playable;
|
|
18147
|
-
}
|
|
18148
|
-
AnimationStream.prototype.setCurveValue = function (componentType, propertyName, value) {
|
|
18149
|
-
if (!this.findCurveValue(componentType, propertyName)) {
|
|
18150
|
-
this.curveValues[componentType + propertyName] = { componentType: componentType, propertyName: propertyName, value: value };
|
|
18149
|
+
if (options.start3DSize) {
|
|
18150
|
+
this.options.startSizeX = createValueGetter(options.startSizeX);
|
|
18151
|
+
this.options.startSizeY = createValueGetter(options.startSizeY);
|
|
18151
18152
|
}
|
|
18152
18153
|
else {
|
|
18153
|
-
this.
|
|
18154
|
-
|
|
18155
|
-
return this.curveValues[componentType + propertyName];
|
|
18156
|
-
};
|
|
18157
|
-
AnimationStream.prototype.findCurveValue = function (componentType, propertyName) {
|
|
18158
|
-
return this.curveValues[componentType + propertyName];
|
|
18159
|
-
};
|
|
18160
|
-
AnimationStream.prototype.getInputStream = function (index) {
|
|
18161
|
-
var inputPlayable = this.playable.getInput(index);
|
|
18162
|
-
if (inputPlayable instanceof AnimationPlayable) {
|
|
18163
|
-
return inputPlayable.animationStream;
|
|
18164
|
-
}
|
|
18165
|
-
};
|
|
18166
|
-
return AnimationStream;
|
|
18167
|
-
}());
|
|
18168
|
-
|
|
18169
|
-
var AnimationPlayable = /** @class */ (function (_super) {
|
|
18170
|
-
__extends(AnimationPlayable, _super);
|
|
18171
|
-
function AnimationPlayable() {
|
|
18172
|
-
var _this = _super.call(this) || this;
|
|
18173
|
-
_this.animationStream = new AnimationStream(_this);
|
|
18174
|
-
return _this;
|
|
18175
|
-
}
|
|
18176
|
-
return AnimationPlayable;
|
|
18177
|
-
}(Playable));
|
|
18178
|
-
|
|
18179
|
-
var tempRot = new Euler();
|
|
18180
|
-
var tempSize = new Vector3(1, 1, 1);
|
|
18181
|
-
var tempPos = new Vector3();
|
|
18182
|
-
/**
|
|
18183
|
-
* @since 2.0.0
|
|
18184
|
-
* @internal
|
|
18185
|
-
*/
|
|
18186
|
-
var AnimationClipPlayable = /** @class */ (function (_super) {
|
|
18187
|
-
__extends(AnimationClipPlayable, _super);
|
|
18188
|
-
function AnimationClipPlayable() {
|
|
18189
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
18190
|
-
}
|
|
18191
|
-
AnimationClipPlayable.prototype.processFrame = function (dt) {
|
|
18192
|
-
if (this.bindingItem.composition) {
|
|
18193
|
-
this.sampleAnimation();
|
|
18154
|
+
this.options.startSize = createValueGetter(options.startSize);
|
|
18155
|
+
this.options.sizeAspect = createValueGetter(options.sizeAspect || 1);
|
|
18194
18156
|
}
|
|
18195
|
-
|
|
18196
|
-
|
|
18197
|
-
|
|
18198
|
-
|
|
18199
|
-
|
|
18200
|
-
|
|
18201
|
-
|
|
18202
|
-
|
|
18203
|
-
|
|
18204
|
-
|
|
18205
|
-
|
|
18206
|
-
|
|
18207
|
-
|
|
18208
|
-
|
|
18157
|
+
var particleMeshProps = {
|
|
18158
|
+
// listIndex: vfxItem.listIndex,
|
|
18159
|
+
meshSlots: options.meshSlots,
|
|
18160
|
+
name: this.name,
|
|
18161
|
+
matrix: Matrix4$1.IDENTITY,
|
|
18162
|
+
filter: props.filter,
|
|
18163
|
+
shaderCachePrefix: shaderCachePrefix,
|
|
18164
|
+
renderMode: renderer.renderMode || RenderMode$1.BILLBOARD,
|
|
18165
|
+
side: renderer.side || SideMode$1.DOUBLE,
|
|
18166
|
+
gravity: gravity,
|
|
18167
|
+
// duration: vfxItem.duration,
|
|
18168
|
+
blending: renderer.blending || BlendingMode$1.ALPHA,
|
|
18169
|
+
rotationOverLifetime: rotationOverLifetime,
|
|
18170
|
+
gravityModifier: this.options.gravityModifier,
|
|
18171
|
+
linearVelOverLifetime: this.options.linearVelOverLifetime,
|
|
18172
|
+
orbitalVelOverLifetime: this.options.orbitalVelOverLifetime,
|
|
18173
|
+
speedOverLifetime: this.options.speedOverLifetime,
|
|
18174
|
+
sprite: textureSheetAnimation,
|
|
18175
|
+
occlusion: !!renderer.occlusion,
|
|
18176
|
+
transparentOcclusion: !!renderer.transparentOcclusion,
|
|
18177
|
+
maxCount: options.maxCount,
|
|
18178
|
+
mask: renderer.mask,
|
|
18179
|
+
maskMode: (_f = renderer.maskMode) !== null && _f !== void 0 ? _f : MaskMode$1.NONE,
|
|
18180
|
+
forceTarget: forceTarget,
|
|
18181
|
+
diffuse: renderer.texture,
|
|
18182
|
+
sizeOverLifetime: sizeOverLifetimeGetter,
|
|
18183
|
+
anchor: anchor,
|
|
18184
|
+
};
|
|
18185
|
+
if (colorOverLifetime) {
|
|
18186
|
+
var color = colorOverLifetime.color, opacity = colorOverLifetime.opacity;
|
|
18187
|
+
particleMeshProps.colorOverLifetime = {};
|
|
18188
|
+
if (opacity) {
|
|
18189
|
+
particleMeshProps.colorOverLifetime.opacity = createValueGetter(colorOverLifetime.opacity);
|
|
18209
18190
|
}
|
|
18210
|
-
|
|
18211
|
-
|
|
18191
|
+
if (color) {
|
|
18192
|
+
if (color[0] === ValueType$1.GRADIENT_COLOR) {
|
|
18193
|
+
particleMeshProps.colorOverLifetime.color = colorOverLifetime.color[1];
|
|
18194
|
+
}
|
|
18195
|
+
else if (color[0] === ValueType$1.RGBA_COLOR) {
|
|
18196
|
+
particleMeshProps.colorOverLifetime.color = Texture.createWithData(this.engine, {
|
|
18197
|
+
data: new Uint8Array(color[1]),
|
|
18198
|
+
width: 1,
|
|
18199
|
+
height: 1,
|
|
18200
|
+
});
|
|
18201
|
+
}
|
|
18202
|
+
else if (color instanceof Texture) {
|
|
18203
|
+
particleMeshProps.colorOverLifetime.color = color;
|
|
18204
|
+
}
|
|
18212
18205
|
}
|
|
18213
|
-
var startSize = this.originalTransform.scale;
|
|
18214
|
-
this.bindingItem.transform.setScale(tempSize.x * startSize.x, tempSize.y * startSize.y, tempSize.z * startSize.z);
|
|
18215
|
-
// this.animationStream.setCurveValue('transform', 'scale.x', tempSize.x * startSize.x);
|
|
18216
|
-
// this.animationStream.setCurveValue('transform', 'scale.y', tempSize.y * startSize.y);
|
|
18217
|
-
// this.animationStream.setCurveValue('transform', 'scale.z', tempSize.z * startSize.z);
|
|
18218
18206
|
}
|
|
18219
|
-
|
|
18220
|
-
|
|
18221
|
-
|
|
18222
|
-
|
|
18223
|
-
|
|
18224
|
-
|
|
18225
|
-
|
|
18226
|
-
var rot = tempRot.addEulers(this.originalTransform.rotation, tempRot);
|
|
18227
|
-
this.bindingItem.transform.setRotation(rot.x, rot.y, rot.z);
|
|
18228
|
-
// this.animationStream.setCurveValue('transform', 'rotation.x', rot.x);
|
|
18229
|
-
// this.animationStream.setCurveValue('transform', 'rotation.y', rot.y);
|
|
18230
|
-
// this.animationStream.setCurveValue('transform', 'rotation.z', rot.z);
|
|
18207
|
+
var uvs = [];
|
|
18208
|
+
var textureMap = [0, 0, 1, 1];
|
|
18209
|
+
var flip;
|
|
18210
|
+
if (props.splits) {
|
|
18211
|
+
var s = props.splits[0];
|
|
18212
|
+
flip = s[4];
|
|
18213
|
+
textureMap = flip ? [s[0], s[1], s[3], s[2]] : [s[0], s[1], s[2], s[3]];
|
|
18231
18214
|
}
|
|
18232
|
-
if (
|
|
18233
|
-
var
|
|
18234
|
-
|
|
18235
|
-
|
|
18236
|
-
|
|
18215
|
+
if (textureSheetAnimation && !textureSheetAnimation.animate) {
|
|
18216
|
+
var col = flip ? textureSheetAnimation.row : textureSheetAnimation.col;
|
|
18217
|
+
var row = flip ? textureSheetAnimation.col : textureSheetAnimation.row;
|
|
18218
|
+
var total = textureSheetAnimation.total || col * row;
|
|
18219
|
+
var index$1 = 0;
|
|
18220
|
+
for (var x = 0; x < col; x++) {
|
|
18221
|
+
for (var y = 0; y < row && index$1 < total; y++, index$1++) {
|
|
18222
|
+
uvs.push([
|
|
18223
|
+
x * textureMap[2] / col + textureMap[0],
|
|
18224
|
+
y * textureMap[3] / row + textureMap[1],
|
|
18225
|
+
textureMap[2] / col,
|
|
18226
|
+
textureMap[3] / row
|
|
18227
|
+
]);
|
|
18228
|
+
}
|
|
18237
18229
|
}
|
|
18238
|
-
this.bindingItem.transform.setPosition(pos.x, pos.y, pos.z);
|
|
18239
|
-
// this.animationStream.setCurveValue('transform', 'position.x', pos.x);
|
|
18240
|
-
// this.animationStream.setCurveValue('transform', 'position.y', pos.y);
|
|
18241
|
-
// this.animationStream.setCurveValue('transform', 'position.z', pos.z);
|
|
18242
18230
|
}
|
|
18243
|
-
|
|
18244
|
-
|
|
18245
|
-
var _a;
|
|
18246
|
-
var scale = this.bindingItem.transform.scale;
|
|
18247
|
-
this.originalTransform = {
|
|
18248
|
-
position: this.bindingItem.transform.position.clone(),
|
|
18249
|
-
rotation: this.bindingItem.transform.getRotation().clone(),
|
|
18250
|
-
// TODO 编辑器 scale 没有z轴控制
|
|
18251
|
-
scale: new Vector3(scale.x, scale.y, scale.x),
|
|
18252
|
-
};
|
|
18253
|
-
var positionOverLifetime = data.positionOverLifetime;
|
|
18254
|
-
var rotationOverLifetime = data.rotationOverLifetime;
|
|
18255
|
-
var sizeOverLifetime = data.sizeOverLifetime;
|
|
18256
|
-
// TODO: 没有 K 帧数据的不需要传 positionOverLifetime 空对象
|
|
18257
|
-
if (positionOverLifetime && Object.keys(positionOverLifetime).length !== 0) {
|
|
18258
|
-
this.positionOverLifetime = positionOverLifetime;
|
|
18259
|
-
if (positionOverLifetime.path) {
|
|
18260
|
-
this.originalTransform.path = createValueGetter(positionOverLifetime.path);
|
|
18261
|
-
}
|
|
18262
|
-
var linearVelEnable = positionOverLifetime.linearX || positionOverLifetime.linearY || positionOverLifetime.linearZ;
|
|
18263
|
-
if (linearVelEnable) {
|
|
18264
|
-
this.linearVelOverLifetime = {
|
|
18265
|
-
x: positionOverLifetime.linearX && createValueGetter(positionOverLifetime.linearX),
|
|
18266
|
-
y: positionOverLifetime.linearY && createValueGetter(positionOverLifetime.linearY),
|
|
18267
|
-
z: positionOverLifetime.linearZ && createValueGetter(positionOverLifetime.linearZ),
|
|
18268
|
-
asMovement: positionOverLifetime.asMovement,
|
|
18269
|
-
enabled: !!linearVelEnable,
|
|
18270
|
-
};
|
|
18271
|
-
}
|
|
18272
|
-
var orbitalVelEnable = positionOverLifetime.orbitalX || positionOverLifetime.orbitalY || positionOverLifetime.orbitalZ;
|
|
18273
|
-
if (orbitalVelEnable) {
|
|
18274
|
-
this.orbitalVelOverLifetime = {
|
|
18275
|
-
x: positionOverLifetime.orbitalX && createValueGetter(positionOverLifetime.orbitalX),
|
|
18276
|
-
y: positionOverLifetime.orbitalY && createValueGetter(positionOverLifetime.orbitalY),
|
|
18277
|
-
z: positionOverLifetime.orbitalZ && createValueGetter(positionOverLifetime.orbitalZ),
|
|
18278
|
-
center: ensureVec3(positionOverLifetime.orbCenter),
|
|
18279
|
-
asRotation: positionOverLifetime.asRotation,
|
|
18280
|
-
enabled: !!orbitalVelEnable,
|
|
18281
|
-
};
|
|
18282
|
-
}
|
|
18283
|
-
this.speedOverLifetime = positionOverLifetime.speedOverLifetime && createValueGetter(positionOverLifetime.speedOverLifetime);
|
|
18231
|
+
else {
|
|
18232
|
+
uvs.push(textureMap);
|
|
18284
18233
|
}
|
|
18285
|
-
|
|
18286
|
-
|
|
18287
|
-
|
|
18288
|
-
|
|
18289
|
-
|
|
18290
|
-
|
|
18234
|
+
this.uvs = uvs;
|
|
18235
|
+
// @ts-expect-error
|
|
18236
|
+
particleMeshProps.textureFlip = flip;
|
|
18237
|
+
var trails = props.trails;
|
|
18238
|
+
var trailMeshProps;
|
|
18239
|
+
if (trails) {
|
|
18240
|
+
this.trails = {
|
|
18241
|
+
lifetime: createValueGetter(trails.lifetime),
|
|
18242
|
+
dieWithParticles: trails.dieWithParticles !== false,
|
|
18243
|
+
sizeAffectsWidth: !!trails.sizeAffectsWidth,
|
|
18244
|
+
sizeAffectsLifetime: !!trails.sizeAffectsLifetime,
|
|
18245
|
+
inheritParticleColor: !!trails.inheritParticleColor,
|
|
18246
|
+
parentAffectsPosition: !!trails.parentAffectsPosition,
|
|
18247
|
+
};
|
|
18248
|
+
trailMeshProps = {
|
|
18249
|
+
name: 'Trail',
|
|
18250
|
+
matrix: Matrix4$1.IDENTITY,
|
|
18251
|
+
minimumVertexDistance: trails.minimumVertexDistance || 0.02,
|
|
18252
|
+
maxTrailCount: options.maxCount,
|
|
18253
|
+
pointCountPerTrail: Math.round(trails.maxPointPerTrail) || 32,
|
|
18254
|
+
blending: trails.blending,
|
|
18255
|
+
texture: trails.texture,
|
|
18256
|
+
opacityOverLifetime: createValueGetter(trails.opacityOverLifetime || 1),
|
|
18257
|
+
widthOverTrail: createValueGetter(trails.widthOverTrail || 1),
|
|
18258
|
+
// order: vfxItem.listIndex + (trails.orderOffset || 0),
|
|
18259
|
+
shaderCachePrefix: shaderCachePrefix,
|
|
18260
|
+
lifetime: this.trails.lifetime,
|
|
18261
|
+
occlusion: !!trails.occlusion,
|
|
18262
|
+
transparentOcclusion: !!trails.transparentOcclusion,
|
|
18263
|
+
textureMap: trails.textureMap,
|
|
18264
|
+
mask: renderer.mask,
|
|
18265
|
+
maskMode: renderer.maskMode,
|
|
18266
|
+
};
|
|
18267
|
+
if (trails.colorOverLifetime && trails.colorOverLifetime[0] === ValueType$1.GRADIENT_COLOR) {
|
|
18268
|
+
trailMeshProps.colorOverLifetime = trails.colorOverLifetime[1];
|
|
18291
18269
|
}
|
|
18292
|
-
|
|
18293
|
-
|
|
18270
|
+
if (trails.colorOverTrail && trails.colorOverTrail[0] === ValueType$1.GRADIENT_COLOR) {
|
|
18271
|
+
trailMeshProps.colorOverTrail = trails.colorOverTrail[1];
|
|
18294
18272
|
}
|
|
18295
18273
|
}
|
|
18296
|
-
|
|
18297
|
-
|
|
18298
|
-
|
|
18299
|
-
|
|
18300
|
-
|
|
18274
|
+
this.renderer = new ParticleSystemRenderer(this.engine, particleMeshProps, trailMeshProps);
|
|
18275
|
+
this.meshes = this.renderer.meshes;
|
|
18276
|
+
// this.item = vfxItem;
|
|
18277
|
+
var interaction = props.interaction;
|
|
18278
|
+
if (interaction) {
|
|
18279
|
+
this.interaction = {
|
|
18280
|
+
multiple: interaction.multiple,
|
|
18281
|
+
radius: interaction.radius,
|
|
18282
|
+
behavior: interaction.behavior,
|
|
18301
18283
|
};
|
|
18302
|
-
if (rotationOverLifetime.separateAxes) {
|
|
18303
|
-
var rotLt = this.rotationOverLifetime;
|
|
18304
|
-
rotLt.x = createValueGetter(rotationOverLifetime.x || 0);
|
|
18305
|
-
rotLt.y = createValueGetter(rotationOverLifetime.y || 0);
|
|
18306
|
-
}
|
|
18307
18284
|
}
|
|
18308
|
-
this.
|
|
18309
|
-
this.
|
|
18310
|
-
this.
|
|
18311
|
-
this.
|
|
18312
|
-
this.
|
|
18313
|
-
|
|
18285
|
+
this.item.getHitTestParams = this.getHitTestParams;
|
|
18286
|
+
this.item._content = this;
|
|
18287
|
+
this.renderer.item = this.item;
|
|
18288
|
+
this.item.components.push(this.renderer);
|
|
18289
|
+
this.item.rendererComponents.push(this.renderer);
|
|
18290
|
+
// 添加粒子动画 clip
|
|
18291
|
+
var timeline = this.item.getComponent(TimelineComponent);
|
|
18292
|
+
timeline.createTrack(Track).createClip(ParticleBehaviourPlayable);
|
|
18314
18293
|
};
|
|
18315
|
-
|
|
18316
|
-
|
|
18294
|
+
ParticleSystem = __decorate([
|
|
18295
|
+
effectsClass(DataType.ParticleSystem)
|
|
18296
|
+
], ParticleSystem);
|
|
18297
|
+
return ParticleSystem;
|
|
18298
|
+
}(Component));
|
|
18299
|
+
// array performance better for small memory than Float32Array
|
|
18300
|
+
var tempDir = new Vector3();
|
|
18301
|
+
var tempSize = new Vector2();
|
|
18302
|
+
var tempRot = new Euler();
|
|
18303
|
+
var tmpDirX = new Vector3();
|
|
18304
|
+
var tmpDirY = new Vector3();
|
|
18305
|
+
var tempVec3 = new Vector3();
|
|
18306
|
+
var tempEuler = new Euler();
|
|
18307
|
+
var tempSprite = [0, 0, 0];
|
|
18308
|
+
var tempMat4 = new Matrix4$1();
|
|
18309
|
+
function getBurstOffsets(burstOffsets) {
|
|
18310
|
+
var ret = {};
|
|
18311
|
+
if (Array.isArray(burstOffsets)) {
|
|
18312
|
+
burstOffsets.forEach(function (arr) {
|
|
18313
|
+
var isArr = arr instanceof Array;
|
|
18314
|
+
var index = isArr ? arr[0] : arr.index;
|
|
18315
|
+
var offsets = ret[index];
|
|
18316
|
+
if (!offsets) {
|
|
18317
|
+
offsets = ret[index] = [];
|
|
18318
|
+
}
|
|
18319
|
+
if (isArr) {
|
|
18320
|
+
offsets.push(arr.slice(1, 4));
|
|
18321
|
+
}
|
|
18322
|
+
else {
|
|
18323
|
+
offsets.push([+arr.x, +arr.y, +arr.z]);
|
|
18324
|
+
}
|
|
18325
|
+
});
|
|
18326
|
+
}
|
|
18327
|
+
return ret;
|
|
18328
|
+
}
|
|
18329
|
+
function randomArrItem(arr, keepArr) {
|
|
18330
|
+
var index = Math.floor(Math.random() * arr.length);
|
|
18331
|
+
var item = arr[index];
|
|
18332
|
+
if (!keepArr) {
|
|
18333
|
+
arr.splice(index, 1);
|
|
18334
|
+
}
|
|
18335
|
+
return item;
|
|
18336
|
+
}
|
|
18337
|
+
|
|
18317
18338
|
/**
|
|
18318
18339
|
* @since 2.0.0
|
|
18319
18340
|
* @internal
|
|
18320
18341
|
*/
|
|
18321
|
-
var
|
|
18322
|
-
__extends(
|
|
18323
|
-
function
|
|
18342
|
+
var ParticleBehaviourPlayable = /** @class */ (function (_super) {
|
|
18343
|
+
__extends(ParticleBehaviourPlayable, _super);
|
|
18344
|
+
function ParticleBehaviourPlayable() {
|
|
18324
18345
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
18325
18346
|
}
|
|
18326
|
-
|
|
18327
|
-
this.bindingItem.
|
|
18328
|
-
this.
|
|
18329
|
-
|
|
18330
|
-
|
|
18331
|
-
|
|
18332
|
-
this.showRendererComponents();
|
|
18333
|
-
};
|
|
18334
|
-
ActivationClipPlayable.prototype.onPlayableDestroy = function () {
|
|
18335
|
-
this.bindingItem.transform.setValid(false);
|
|
18336
|
-
this.hideRendererComponents();
|
|
18337
|
-
};
|
|
18338
|
-
ActivationClipPlayable.prototype.hideRendererComponents = function () {
|
|
18339
|
-
var e_1, _a;
|
|
18340
|
-
try {
|
|
18341
|
-
for (var _b = __values$1(this.bindingItem.rendererComponents), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
18342
|
-
var rendererComponent = _c.value;
|
|
18343
|
-
if (rendererComponent.enabled) {
|
|
18344
|
-
rendererComponent.enabled = false;
|
|
18345
|
-
}
|
|
18346
|
-
}
|
|
18347
|
-
}
|
|
18348
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
18349
|
-
finally {
|
|
18350
|
-
try {
|
|
18351
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
18352
|
-
}
|
|
18353
|
-
finally { if (e_1) throw e_1.error; }
|
|
18347
|
+
ParticleBehaviourPlayable.prototype.onPlayablePlay = function () {
|
|
18348
|
+
this.particleSystem = this.bindingItem.getComponent(ParticleSystem);
|
|
18349
|
+
if (this.particleSystem) {
|
|
18350
|
+
this.particleSystem.name = this.bindingItem.name;
|
|
18351
|
+
this.particleSystem.start();
|
|
18352
|
+
this.particleSystem.initEmitterTransform();
|
|
18354
18353
|
}
|
|
18355
18354
|
};
|
|
18356
|
-
|
|
18357
|
-
var
|
|
18358
|
-
|
|
18359
|
-
|
|
18360
|
-
|
|
18361
|
-
|
|
18362
|
-
|
|
18363
|
-
|
|
18364
|
-
}
|
|
18365
|
-
}
|
|
18366
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
18367
|
-
finally {
|
|
18368
|
-
try {
|
|
18369
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
18370
|
-
}
|
|
18371
|
-
finally { if (e_2) throw e_2.error; }
|
|
18355
|
+
ParticleBehaviourPlayable.prototype.processFrame = function (dt) {
|
|
18356
|
+
var particleSystem = this.particleSystem;
|
|
18357
|
+
if (particleSystem) {
|
|
18358
|
+
this.bindingItem.parent;
|
|
18359
|
+
// TODO: [1.31] @十弦 验证 https://github.com/galacean/effects-runtime/commit/3e7d73d37b7d98c2a25e4544e80e928b17801ccd#diff-fae062f28caf3771cfedd3a20dc22f9749bd054c7541bf2fd50a9a5e413153d4
|
|
18360
|
+
// particleSystem.setParentTransform(parentItem.transform);
|
|
18361
|
+
particleSystem.setVisible(true);
|
|
18362
|
+
particleSystem.onUpdate(dt);
|
|
18372
18363
|
}
|
|
18373
18364
|
};
|
|
18374
|
-
return
|
|
18365
|
+
return ParticleBehaviourPlayable;
|
|
18375
18366
|
}(Playable));
|
|
18376
18367
|
|
|
18368
|
+
var CalculateLoader = /** @class */ (function (_super) {
|
|
18369
|
+
__extends(CalculateLoader, _super);
|
|
18370
|
+
function CalculateLoader() {
|
|
18371
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
18372
|
+
}
|
|
18373
|
+
return CalculateLoader;
|
|
18374
|
+
}(AbstractPlugin));
|
|
18375
|
+
|
|
18377
18376
|
var TextLayout = /** @class */ (function () {
|
|
18378
18377
|
function TextLayout(options) {
|
|
18379
18378
|
this.width = 0;
|
|
@@ -19671,9 +19670,10 @@ var TextComponent = /** @class */ (function (_super) {
|
|
|
19671
19670
|
if (this.textStyle.fontSize === value) {
|
|
19672
19671
|
return;
|
|
19673
19672
|
}
|
|
19673
|
+
// 保证字号变化后位置正常
|
|
19674
|
+
var diff = this.textStyle.fontSize - value;
|
|
19675
|
+
this.textLayout.lineHeight += diff;
|
|
19674
19676
|
this.textStyle.fontSize = value;
|
|
19675
|
-
// 1.5175 = 31.43 / 20
|
|
19676
|
-
this.textLayout.lineHeight = this.textStyle.fontSize * 1.5175;
|
|
19677
19677
|
this.isDirty = true;
|
|
19678
19678
|
};
|
|
19679
19679
|
/**
|
|
@@ -19999,7 +19999,7 @@ var TextLoader = /** @class */ (function (_super) {
|
|
|
19999
19999
|
return TextLoader;
|
|
20000
20000
|
}(AbstractPlugin));
|
|
20001
20001
|
|
|
20002
|
-
var seed$
|
|
20002
|
+
var seed$5 = 1;
|
|
20003
20003
|
/**
|
|
20004
20004
|
* @since 2.0.0
|
|
20005
20005
|
* @internal
|
|
@@ -20025,24 +20025,9 @@ var EffectComponent = /** @class */ (function (_super) {
|
|
|
20025
20025
|
};
|
|
20026
20026
|
}
|
|
20027
20027
|
};
|
|
20028
|
-
_this.id = 'Mesh' + seed$
|
|
20028
|
+
_this.id = 'Mesh' + seed$5++;
|
|
20029
20029
|
_this.name = '<unnamed>';
|
|
20030
20030
|
_this._priority = 0;
|
|
20031
|
-
_this.geometry = Geometry.create(_this.engine);
|
|
20032
|
-
var geometryData = {
|
|
20033
|
-
vertices: [
|
|
20034
|
-
-1, 1, 0,
|
|
20035
|
-
-1, -1, 0,
|
|
20036
|
-
1, 1, 0,
|
|
20037
|
-
1, -1, 0, //右下
|
|
20038
|
-
],
|
|
20039
|
-
uvs: [0, 1, 0, 0, 1, 1, 1, 0],
|
|
20040
|
-
indices: [0, 1, 2, 2, 1, 3],
|
|
20041
|
-
dataType: DataType.Geometry,
|
|
20042
|
-
id: generateGUID(),
|
|
20043
|
-
};
|
|
20044
|
-
_this.geometry.fromData(geometryData);
|
|
20045
|
-
_this.triangles = geometryToTriangles(_this.geometry);
|
|
20046
20031
|
return _this;
|
|
20047
20032
|
}
|
|
20048
20033
|
Object.defineProperty(EffectComponent.prototype, "isDestroyed", {
|
|
@@ -20579,11 +20564,6 @@ var VFXItem = /** @class */ (function (_super) {
|
|
|
20579
20564
|
this.id = id.toString(); // TODO 老数据 id 是 number,需要转换
|
|
20580
20565
|
this.name = name;
|
|
20581
20566
|
this.start = delay ? delay : this.start;
|
|
20582
|
-
// TODO spec 数据需要区分 scale 和 size
|
|
20583
|
-
if (transform && transform.scale && data.type !== 'ECS') {
|
|
20584
|
-
//@ts-expect-error TODO 数据改造后移除 expect-error
|
|
20585
|
-
transform.scale.z = transform.scale.x;
|
|
20586
|
-
}
|
|
20587
20567
|
if (transform) {
|
|
20588
20568
|
//@ts-expect-error TODO 数据改造后移除 expect-error
|
|
20589
20569
|
transform.position = new Vector3().copyFrom(transform.position);
|
|
@@ -20591,51 +20571,36 @@ var VFXItem = /** @class */ (function (_super) {
|
|
|
20591
20571
|
transform.rotation = new Euler().copyFrom(transform.rotation);
|
|
20592
20572
|
//@ts-expect-error
|
|
20593
20573
|
transform.scale = new Vector3().copyFrom(transform.scale);
|
|
20574
|
+
//@ts-expect-error
|
|
20575
|
+
if (transform.size) {
|
|
20576
|
+
//@ts-expect-error
|
|
20577
|
+
transform.size = new Vector2().copyFrom(transform.size);
|
|
20578
|
+
}
|
|
20579
|
+
//@ts-expect-error
|
|
20580
|
+
if (transform.anchor) {
|
|
20581
|
+
//@ts-expect-error
|
|
20582
|
+
transform.anchor = new Vector2().copyFrom(transform.anchor);
|
|
20583
|
+
}
|
|
20594
20584
|
this.transform.setTransform(transform);
|
|
20595
20585
|
}
|
|
20596
20586
|
this.transform.name = this.name;
|
|
20597
20587
|
this.transform.engine = this.engine;
|
|
20598
|
-
// TODO spec 数据需要区分 scale 和 size
|
|
20599
|
-
if (data.type === ItemType$1.sprite && transform) {
|
|
20600
|
-
this.transform.setSize(this.transform.scale.x, this.transform.scale.y);
|
|
20601
|
-
this.transform.setScale(1, 1, 1);
|
|
20602
|
-
}
|
|
20603
20588
|
this.parentId = parentId;
|
|
20604
20589
|
this.duration = duration;
|
|
20605
20590
|
this.endBehavior = endBehavior;
|
|
20606
|
-
// TODO: 放到 Spec 处理
|
|
20607
|
-
if (this.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY$1 || this.endBehavior === END_BEHAVIOR_PAUSE$1) {
|
|
20608
|
-
this.endBehavior = END_BEHAVIOR_FREEZE$1;
|
|
20609
|
-
}
|
|
20610
20591
|
this.lifetime = -(this.start / this.duration);
|
|
20611
20592
|
this.listIndex = listIndex;
|
|
20593
|
+
//@ts-expect-error
|
|
20594
|
+
this.oldId = data.oldId;
|
|
20612
20595
|
if (!data.content) {
|
|
20613
20596
|
data.content = { options: {} };
|
|
20614
20597
|
}
|
|
20615
20598
|
var timelineComponent = this.getComponent(TimelineComponent);
|
|
20616
20599
|
timelineComponent.fromData(data.content);
|
|
20617
|
-
// TODO anchor 应该放在 transform data
|
|
20618
|
-
if (data.type === ItemType$1.sprite) {
|
|
20619
|
-
var content = data.content;
|
|
20620
|
-
if (!content.renderer) {
|
|
20621
|
-
//@ts-expect-error
|
|
20622
|
-
content.renderer = {};
|
|
20623
|
-
}
|
|
20624
|
-
var realAnchor = convertAnchor(content.renderer.anchor, content.renderer.particleOrigin);
|
|
20625
|
-
var startSize = this.transform.size;
|
|
20626
|
-
// 兼容旧JSON(anchor和particleOrigin可能同时存在)
|
|
20627
|
-
if (!content.renderer.anchor && content.renderer.particleOrigin !== undefined) {
|
|
20628
|
-
this.transform.position.add([-realAnchor[0] * startSize.x, -realAnchor[1] * startSize.y, 0]);
|
|
20629
|
-
}
|
|
20630
|
-
this.transform.setAnchor(realAnchor[0] * startSize.x, realAnchor[1] * startSize.y, 0);
|
|
20631
|
-
}
|
|
20632
|
-
// TODO 要放在上面的 if 后面添加,否则会 position 初始化错误
|
|
20633
20600
|
if (this.type !== ItemType$1.particle) {
|
|
20634
20601
|
var track = timelineComponent.createTrack(Track, 'AnimationTrack');
|
|
20635
20602
|
track.createClip(AnimationClipPlayable, 'AnimationTimelineClip').playable.fromData(data.content);
|
|
20636
20603
|
}
|
|
20637
|
-
var activationTrack = timelineComponent.createTrack(Track, 'ActivationTrack');
|
|
20638
|
-
activationTrack.createClip(ActivationClipPlayable, 'ActivationTimelineClip');
|
|
20639
20604
|
if (duration <= 0) {
|
|
20640
20605
|
throw Error("Item duration can't be less than 0, see ".concat(HELP_LINK$1['Item duration can\'t be less than 0']));
|
|
20641
20606
|
}
|
|
@@ -22650,7 +22615,7 @@ function isScene(scene) {
|
|
|
22650
22615
|
|
|
22651
22616
|
function version3Migration(scene) {
|
|
22652
22617
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
|
|
22653
|
-
scene.jsonScene.version = 3.0;
|
|
22618
|
+
scene.jsonScene.version = '3.0';
|
|
22654
22619
|
var ecScene = scene.jsonScene;
|
|
22655
22620
|
if (!ecScene.items) {
|
|
22656
22621
|
ecScene.items = [];
|
|
@@ -22662,6 +22627,10 @@ function version3Migration(scene) {
|
|
|
22662
22627
|
for (var i = 0; i < composition.items.length; i++) {
|
|
22663
22628
|
ecScene.items.push(composition.items[i]);
|
|
22664
22629
|
}
|
|
22630
|
+
// composition 的 endbehaviour 兼容
|
|
22631
|
+
if (composition.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY$1 || composition.endBehavior === END_BEHAVIOR_PAUSE$1) {
|
|
22632
|
+
composition.endBehavior = END_BEHAVIOR_FREEZE$1;
|
|
22633
|
+
}
|
|
22665
22634
|
}
|
|
22666
22635
|
}
|
|
22667
22636
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -22677,6 +22646,9 @@ function version3Migration(scene) {
|
|
|
22677
22646
|
for (var _j = __values$1(ecScene.items), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
22678
22647
|
var item = _k.value;
|
|
22679
22648
|
itemGuidMap[item.id] = generateGUID();
|
|
22649
|
+
// TODO: 编辑器测试用,上线后删除
|
|
22650
|
+
//@ts-expect-error
|
|
22651
|
+
item.oldId = item.id;
|
|
22680
22652
|
item.id = itemGuidMap[item.id];
|
|
22681
22653
|
}
|
|
22682
22654
|
}
|
|
@@ -22784,12 +22756,61 @@ function version3Migration(scene) {
|
|
|
22784
22756
|
if (!scale) {
|
|
22785
22757
|
scale = [1, 1, 1];
|
|
22786
22758
|
}
|
|
22759
|
+
item.transform = {
|
|
22760
|
+
//@ts-expect-error
|
|
22761
|
+
position: { x: position[0], y: position[1], z: position[2] },
|
|
22762
|
+
//@ts-expect-error
|
|
22763
|
+
rotation: { x: rotation[0], y: rotation[1], z: rotation[2] },
|
|
22764
|
+
//@ts-expect-error
|
|
22765
|
+
scale: { x: scale[0], y: scale[1], z: scale[0] },
|
|
22766
|
+
};
|
|
22767
|
+
// sprite 的 scale 转为 size
|
|
22768
|
+
if (item.type === ItemType$1.sprite) {
|
|
22769
|
+
//@ts-expect-error
|
|
22770
|
+
item.transform.size = { x: scale[0], y: scale[1] };
|
|
22771
|
+
//@ts-expect-error
|
|
22772
|
+
item.transform.scale = { x: 1, y: 1, z: 1 };
|
|
22773
|
+
}
|
|
22774
|
+
// sprite 的 anchor 修正
|
|
22775
|
+
if (item.type === ItemType$1.sprite) {
|
|
22776
|
+
var content = item.content;
|
|
22777
|
+
//@ts-expect-error
|
|
22778
|
+
if (!content.renderer) {
|
|
22779
|
+
//@ts-expect-error
|
|
22780
|
+
content.renderer = {};
|
|
22781
|
+
}
|
|
22782
|
+
//@ts-expect-error
|
|
22783
|
+
var renderer = content.renderer;
|
|
22784
|
+
var realAnchor = convertAnchor(renderer.anchor, renderer.particleOrigin);
|
|
22785
|
+
//@ts-expect-error
|
|
22786
|
+
var startSize = item.transform.size;
|
|
22787
|
+
// 兼容旧JSON(anchor和particleOrigin可能同时存在)
|
|
22788
|
+
if (!renderer.anchor && renderer.particleOrigin !== undefined) {
|
|
22789
|
+
//@ts-expect-error
|
|
22790
|
+
item.transform.position.x += -realAnchor[0] * startSize.x;
|
|
22791
|
+
//@ts-expect-error
|
|
22792
|
+
item.transform.position.y += -realAnchor[1] * startSize.y;
|
|
22793
|
+
}
|
|
22794
|
+
//@ts-expect-error
|
|
22795
|
+
item.transform.anchor = { x: realAnchor[0] * startSize.x, y: realAnchor[1] * startSize.y };
|
|
22796
|
+
}
|
|
22797
|
+
}
|
|
22798
|
+
if (item.type === ItemType$1.particle) {
|
|
22799
|
+
var content = item.content;
|
|
22787
22800
|
//@ts-expect-error
|
|
22788
|
-
|
|
22801
|
+
if (!content.renderer) {
|
|
22802
|
+
//@ts-expect-error
|
|
22803
|
+
content.renderer = {};
|
|
22804
|
+
}
|
|
22789
22805
|
//@ts-expect-error
|
|
22790
|
-
|
|
22806
|
+
var renderer = content.renderer;
|
|
22791
22807
|
//@ts-expect-error
|
|
22792
|
-
|
|
22808
|
+
content.renderer.anchor = convertAnchor(renderer.anchor, renderer.particleOrigin);
|
|
22809
|
+
}
|
|
22810
|
+
// item 的 endbehaviour 兼容
|
|
22811
|
+
// @ts-expect-error
|
|
22812
|
+
if (item.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY$1 || item.endBehavior === END_BEHAVIOR_PAUSE$1) {
|
|
22813
|
+
item.endBehavior = END_BEHAVIOR_FREEZE$1;
|
|
22793
22814
|
}
|
|
22794
22815
|
// item 的 content 转为 component data 加入 JSONScene.components
|
|
22795
22816
|
var uuid = v4().replace(/-/g, '');
|
|
@@ -22964,8 +22985,22 @@ function version3Migration(scene) {
|
|
|
22964
22985
|
}
|
|
22965
22986
|
return scene;
|
|
22966
22987
|
}
|
|
22988
|
+
/**
|
|
22989
|
+
* 提取并转换 JSON 数据中的 anchor 值
|
|
22990
|
+
*/
|
|
22991
|
+
function convertAnchor(anchor, particleOrigin) {
|
|
22992
|
+
if (anchor) {
|
|
22993
|
+
return [anchor[0] - 0.5, 0.5 - anchor[1]];
|
|
22994
|
+
}
|
|
22995
|
+
else if (particleOrigin) {
|
|
22996
|
+
return particleOriginTranslateMap[particleOrigin];
|
|
22997
|
+
}
|
|
22998
|
+
else {
|
|
22999
|
+
return [0, 0];
|
|
23000
|
+
}
|
|
23001
|
+
}
|
|
22967
23002
|
|
|
22968
|
-
var seed$
|
|
23003
|
+
var seed$4 = 1;
|
|
22969
23004
|
/**
|
|
22970
23005
|
* 资源管理器
|
|
22971
23006
|
* 用于加载和动效中所有的资源文件,包括图片、插件、图层粒子数据等
|
|
@@ -22985,7 +23020,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
22985
23020
|
* 图像资源,用于创建和释放GPU纹理资源
|
|
22986
23021
|
*/
|
|
22987
23022
|
this.assets = {};
|
|
22988
|
-
this.id = seed$
|
|
23023
|
+
this.id = seed$4++;
|
|
22989
23024
|
/**
|
|
22990
23025
|
* 场景加载的超时定时器
|
|
22991
23026
|
*/
|
|
@@ -23001,6 +23036,26 @@ var AssetManager = /** @class */ (function () {
|
|
|
23001
23036
|
var _a = options.timeout, timeout = _a === void 0 ? 10 : _a;
|
|
23002
23037
|
this.timeout = timeout;
|
|
23003
23038
|
};
|
|
23039
|
+
/**
|
|
23040
|
+
* 根据用户传入的参数修改场景数据
|
|
23041
|
+
*/
|
|
23042
|
+
AssetManager.prototype.updateSceneData = function (compositions) {
|
|
23043
|
+
var variables = this.options.variables;
|
|
23044
|
+
if (!variables || Object.keys(variables).length <= 0) {
|
|
23045
|
+
return compositions;
|
|
23046
|
+
}
|
|
23047
|
+
compositions.forEach(function (composition) {
|
|
23048
|
+
composition.items.forEach(function (item) {
|
|
23049
|
+
if (item.type === ItemType$1.text) {
|
|
23050
|
+
var textVariable = variables[item.name];
|
|
23051
|
+
if (textVariable) {
|
|
23052
|
+
item.content.options.text = textVariable;
|
|
23053
|
+
}
|
|
23054
|
+
}
|
|
23055
|
+
});
|
|
23056
|
+
});
|
|
23057
|
+
return compositions;
|
|
23058
|
+
};
|
|
23004
23059
|
/**
|
|
23005
23060
|
* 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
|
|
23006
23061
|
* @param url - json 的 URL 链接或者 json 对象
|
|
@@ -23092,6 +23147,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23092
23147
|
for (i = 0; i < scene.images.length; i++) {
|
|
23093
23148
|
scene.textureOptions[i].image = scene.images[i];
|
|
23094
23149
|
}
|
|
23150
|
+
scene.jsonScene.compositions = this.updateSceneData(scene.jsonScene.compositions);
|
|
23095
23151
|
_e.label = 5;
|
|
23096
23152
|
case 5: return [3 /*break*/, 12];
|
|
23097
23153
|
case 6: return [4 /*yield*/, hookTimeInfo('processJSON', function () { return _this.processJSON(rawJSON); })];
|
|
@@ -23111,6 +23167,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23111
23167
|
return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(loadedImages_1, loadedBins_1, jsonScene_1); })];
|
|
23112
23168
|
case 10:
|
|
23113
23169
|
loadedTextures = _e.sent();
|
|
23170
|
+
jsonScene_1.compositions = this.updateSceneData(jsonScene_1.compositions);
|
|
23114
23171
|
scene = {
|
|
23115
23172
|
url: url,
|
|
23116
23173
|
renderLevel: this.options.renderLevel,
|
|
@@ -23957,7 +24014,9 @@ var CompositionComponent = /** @class */ (function (_super) {
|
|
|
23957
24014
|
}
|
|
23958
24015
|
// endBehaviour 类型需优化
|
|
23959
24016
|
props.content = itemData.content;
|
|
23960
|
-
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
|
|
24017
|
+
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,
|
|
24018
|
+
// @ts-expect-error TODO: 2.0 编辑器测试代码,后续移除
|
|
24019
|
+
oldId: itemData.oldId }));
|
|
23961
24020
|
// TODO 编辑器数据传入 composition type 后移除
|
|
23962
24021
|
item.type = ItemType$1.composition;
|
|
23963
24022
|
item.composition = this.item.composition;
|
|
@@ -24092,7 +24151,6 @@ var CompositionComponent = /** @class */ (function (_super) {
|
|
|
24092
24151
|
return CompositionComponent;
|
|
24093
24152
|
}(ItemBehaviour));
|
|
24094
24153
|
|
|
24095
|
-
var seed$4 = 1;
|
|
24096
24154
|
/**
|
|
24097
24155
|
* 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
|
|
24098
24156
|
* 合成中包含了相关的 Item 元素,支持对 Item 元素的创建、更新和销毁。
|
|
@@ -24165,7 +24223,7 @@ var Composition = /** @class */ (function () {
|
|
|
24165
24223
|
this.width = width;
|
|
24166
24224
|
this.height = height;
|
|
24167
24225
|
this.renderOrder = baseRenderOrder;
|
|
24168
|
-
this.id =
|
|
24226
|
+
this.id = sourceContent.id;
|
|
24169
24227
|
this.renderer = renderer;
|
|
24170
24228
|
this.texInfo = imageUsage !== null && imageUsage !== void 0 ? imageUsage : {};
|
|
24171
24229
|
this.event = event;
|
|
@@ -24192,7 +24250,7 @@ var Composition = /** @class */ (function () {
|
|
|
24192
24250
|
this.rootItem.onEnd = function () {
|
|
24193
24251
|
window.setTimeout(function () {
|
|
24194
24252
|
var _a;
|
|
24195
|
-
(_a = _this.
|
|
24253
|
+
(_a = _this.onEnd) === null || _a === void 0 ? void 0 : _a.call(_this, _this);
|
|
24196
24254
|
}, 0);
|
|
24197
24255
|
};
|
|
24198
24256
|
this.pluginSystem.resetComposition(this, this.renderFrame);
|
|
@@ -24271,9 +24329,9 @@ var Composition = /** @class */ (function () {
|
|
|
24271
24329
|
* 重新开始合成
|
|
24272
24330
|
*/
|
|
24273
24331
|
Composition.prototype.restart = function () {
|
|
24274
|
-
|
|
24275
|
-
contentItems.forEach(
|
|
24276
|
-
contentItems.length = 0;
|
|
24332
|
+
this.rootComposition.items;
|
|
24333
|
+
// contentItems.forEach(item => item.dispose());
|
|
24334
|
+
// contentItems.length = 0;
|
|
24277
24335
|
this.prepareRender();
|
|
24278
24336
|
this.reset();
|
|
24279
24337
|
this.transform.setValid(true);
|
|
@@ -24556,7 +24614,8 @@ var Composition = /** @class */ (function () {
|
|
|
24556
24614
|
var time = this.getUpdateTime(deltaTime * this.speed);
|
|
24557
24615
|
this.globalTime += time;
|
|
24558
24616
|
if (this.rootTimeline.isActiveAndEnabled) {
|
|
24559
|
-
this.rootTimeline.
|
|
24617
|
+
var localTime = this.rootTimeline.toLocalTime(this.globalTime / 1000);
|
|
24618
|
+
this.rootTimeline.setTime(localTime);
|
|
24560
24619
|
}
|
|
24561
24620
|
this.updateVideo();
|
|
24562
24621
|
// 更新 model-tree-plugin
|
|
@@ -25021,6 +25080,9 @@ var Composition = /** @class */ (function () {
|
|
|
25021
25080
|
}
|
|
25022
25081
|
this.compositionSourceManager.dispose();
|
|
25023
25082
|
this.refCompositionProps.clear();
|
|
25083
|
+
if (this.renderer.env === PLAYER_OPTIONS_ENV_EDITOR) {
|
|
25084
|
+
return;
|
|
25085
|
+
}
|
|
25024
25086
|
this.renderer.clear({
|
|
25025
25087
|
stencilAction: TextureLoadAction.clear,
|
|
25026
25088
|
clearStencil: 0,
|
|
@@ -25691,9 +25753,20 @@ var Ticker = /** @class */ (function () {
|
|
|
25691
25753
|
if (fps === void 0) { fps = 60; }
|
|
25692
25754
|
this.paused = true;
|
|
25693
25755
|
this.lastTime = 0;
|
|
25756
|
+
this._deltaTime = 0;
|
|
25694
25757
|
this.setFPS(fps);
|
|
25695
25758
|
this.tickers = [];
|
|
25696
25759
|
}
|
|
25760
|
+
Object.defineProperty(Ticker.prototype, "deltaTime", {
|
|
25761
|
+
/**
|
|
25762
|
+
* 获取定时器当前帧更新的时间
|
|
25763
|
+
*/
|
|
25764
|
+
get: function () {
|
|
25765
|
+
return this._deltaTime;
|
|
25766
|
+
},
|
|
25767
|
+
enumerable: false,
|
|
25768
|
+
configurable: true
|
|
25769
|
+
});
|
|
25697
25770
|
/**
|
|
25698
25771
|
* FPS 帧率设置
|
|
25699
25772
|
*/
|
|
@@ -25720,6 +25793,7 @@ var Ticker = /** @class */ (function () {
|
|
|
25720
25793
|
Ticker.prototype.start = function () {
|
|
25721
25794
|
var _this = this;
|
|
25722
25795
|
this.paused = false;
|
|
25796
|
+
this._deltaTime = 0;
|
|
25723
25797
|
if (!this.intervalId) {
|
|
25724
25798
|
this.lastTime = performance.now();
|
|
25725
25799
|
var raf_1 = requestAnimationFrame || function (func) {
|
|
@@ -25742,6 +25816,7 @@ var Ticker = /** @class */ (function () {
|
|
|
25742
25816
|
this.intervalId = 0;
|
|
25743
25817
|
this.lastTime = 0;
|
|
25744
25818
|
this.paused = true;
|
|
25819
|
+
this._deltaTime = 0;
|
|
25745
25820
|
this.tickers = [];
|
|
25746
25821
|
};
|
|
25747
25822
|
/**
|
|
@@ -25749,12 +25824,14 @@ var Ticker = /** @class */ (function () {
|
|
|
25749
25824
|
*/
|
|
25750
25825
|
Ticker.prototype.pause = function () {
|
|
25751
25826
|
this.paused = true;
|
|
25827
|
+
this._deltaTime = 0;
|
|
25752
25828
|
};
|
|
25753
25829
|
/**
|
|
25754
25830
|
* 定时器恢复方法
|
|
25755
25831
|
*/
|
|
25756
25832
|
Ticker.prototype.resume = function () {
|
|
25757
25833
|
this.paused = false;
|
|
25834
|
+
this._deltaTime = 0;
|
|
25758
25835
|
};
|
|
25759
25836
|
/**
|
|
25760
25837
|
* 定时器 tick 方法
|
|
@@ -25764,8 +25841,8 @@ var Ticker = /** @class */ (function () {
|
|
|
25764
25841
|
return;
|
|
25765
25842
|
}
|
|
25766
25843
|
var startTime = performance.now();
|
|
25767
|
-
|
|
25768
|
-
if (
|
|
25844
|
+
this._deltaTime = startTime - this.lastTime;
|
|
25845
|
+
if (this._deltaTime >= this.interval) {
|
|
25769
25846
|
this.lastTime = startTime;
|
|
25770
25847
|
if (this.resetTickers) {
|
|
25771
25848
|
this.tickers = this.tickers.filter(function (tick) { return tick; });
|
|
@@ -25773,7 +25850,7 @@ var Ticker = /** @class */ (function () {
|
|
|
25773
25850
|
}
|
|
25774
25851
|
for (var i = 0, len = this.tickers.length; i < len; i++) {
|
|
25775
25852
|
var tick = this.tickers[i];
|
|
25776
|
-
tick(
|
|
25853
|
+
tick(this._deltaTime);
|
|
25777
25854
|
}
|
|
25778
25855
|
}
|
|
25779
25856
|
};
|
|
@@ -26970,35 +27047,39 @@ var GLGeometry = /** @class */ (function (_super) {
|
|
|
26970
27047
|
};
|
|
26971
27048
|
GLGeometry.prototype.fromData = function (data) {
|
|
26972
27049
|
_super.prototype.fromData.call(this, data);
|
|
26973
|
-
var
|
|
26974
|
-
var
|
|
27050
|
+
var buffer = decodeBase64ToArrays(data.buffer);
|
|
27051
|
+
var vertexCount = data.vertexData.vertexCount;
|
|
27052
|
+
var positionChannel = data.vertexData.channels[0];
|
|
27053
|
+
var uvChannel = data.vertexData.channels[1];
|
|
27054
|
+
var normalChannel = data.vertexData.channels[2];
|
|
27055
|
+
// 根据提供的长度信息创建 Float32Array
|
|
27056
|
+
var positionBuffer = new Float32Array(buffer, positionChannel.offset, positionChannel.dimension * vertexCount);
|
|
27057
|
+
var uvBuffer = new Float32Array(buffer, uvChannel.offset, uvChannel.dimension * vertexCount);
|
|
27058
|
+
var normalBuffer = new Float32Array(buffer, normalChannel.offset, normalChannel.dimension * vertexCount);
|
|
27059
|
+
// 根据提供的长度信息创建 Uint16Array,它紧随 Float32Array 数据之后
|
|
27060
|
+
var indexBuffer = new Uint16Array(buffer, data.indexOffset);
|
|
26975
27061
|
var geometryProps = {
|
|
26976
27062
|
mode: glContext.TRIANGLES,
|
|
26977
27063
|
attributes: {
|
|
26978
27064
|
aPos: {
|
|
26979
27065
|
type: glContext.FLOAT,
|
|
26980
27066
|
size: 3,
|
|
26981
|
-
data:
|
|
27067
|
+
data: positionBuffer,
|
|
26982
27068
|
},
|
|
26983
27069
|
aUV: {
|
|
26984
27070
|
type: glContext.FLOAT,
|
|
26985
27071
|
size: 2,
|
|
26986
|
-
data:
|
|
27072
|
+
data: uvBuffer,
|
|
26987
27073
|
},
|
|
26988
27074
|
aNormal: {
|
|
26989
27075
|
type: glContext.FLOAT,
|
|
26990
27076
|
size: 3,
|
|
26991
|
-
data:
|
|
27077
|
+
data: normalBuffer,
|
|
26992
27078
|
},
|
|
26993
27079
|
},
|
|
26994
27080
|
};
|
|
26995
|
-
|
|
26996
|
-
|
|
26997
|
-
geometryProps.drawCount = fullGeometryData.indices.length;
|
|
26998
|
-
}
|
|
26999
|
-
else {
|
|
27000
|
-
geometryProps.drawCount = fullGeometryData.vertices.length / 3;
|
|
27001
|
-
}
|
|
27081
|
+
geometryProps.indices = { data: indexBuffer };
|
|
27082
|
+
geometryProps.drawCount = indexBuffer.length;
|
|
27002
27083
|
this.processProps(geometryProps);
|
|
27003
27084
|
};
|
|
27004
27085
|
GLGeometry.prototype.dispose = function () {
|
|
@@ -27033,6 +27114,19 @@ var GLGeometry = /** @class */ (function (_super) {
|
|
|
27033
27114
|
};
|
|
27034
27115
|
return GLGeometry;
|
|
27035
27116
|
}(Geometry));
|
|
27117
|
+
function decodeBase64ToArrays(base64String) {
|
|
27118
|
+
// 将 Base64 编码的字符串转换为二进制字符串
|
|
27119
|
+
var binaryString = atob(base64String);
|
|
27120
|
+
// 将二进制字符串转换为字节数组
|
|
27121
|
+
var bytes = new Uint8Array(binaryString.length);
|
|
27122
|
+
for (var i = 0; i < binaryString.length; i++) {
|
|
27123
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
27124
|
+
}
|
|
27125
|
+
// 创建 ArrayBuffer 并为其创建视图
|
|
27126
|
+
var buffer = bytes.buffer;
|
|
27127
|
+
// 返回解码后的数组
|
|
27128
|
+
return buffer;
|
|
27129
|
+
}
|
|
27036
27130
|
|
|
27037
27131
|
var GLMaterialState = /** @class */ (function () {
|
|
27038
27132
|
function GLMaterialState() {
|
|
@@ -30884,7 +30978,7 @@ var Player = /** @class */ (function () {
|
|
|
30884
30978
|
}());
|
|
30885
30979
|
function isSceneWithOptions(scene) {
|
|
30886
30980
|
// TODO: 判断不太优雅,后期试情况优化
|
|
30887
|
-
return isObject(scene) && 'scene' in scene;
|
|
30981
|
+
return isObject(scene) && 'scene' in scene && 'options' in scene;
|
|
30888
30982
|
}
|
|
30889
30983
|
/**
|
|
30890
30984
|
* 禁止/允许创建新的播放器,已创建的不受影响
|
|
@@ -31014,8 +31108,8 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
31014
31108
|
Engine.create = function (gl) {
|
|
31015
31109
|
return new GLEngine(gl);
|
|
31016
31110
|
};
|
|
31017
|
-
var version = "2.0.0-alpha.
|
|
31111
|
+
var version = "2.0.0-alpha.2";
|
|
31018
31112
|
logger.info('player version: ' + version);
|
|
31019
31113
|
|
|
31020
|
-
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, GLEngine, GLGeometry, GLRenderer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK$1 as 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, Player, 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,
|
|
31114
|
+
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, GLEngine, GLGeometry, GLRenderer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK$1 as 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, Player, 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, disableAllPlayer, distortion_frag as distortionFrag, distortion_vert as distortionVert, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, getActivePlayers, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPlayerByCanvas, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAndroid, isArray, isCanvasUsedByPlayer, isFunction, isIOS, isObject, isScene, isSceneWithOptions, 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$1 as throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version };
|
|
31021
31115
|
//# sourceMappingURL=weapp.mjs.map
|