@galacean/effects-core 2.10.0-alpha.0 → 2.10.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/base-render-component.d.ts +4 -0
- package/dist/composition.d.ts +5 -0
- package/dist/engine.d.ts +23 -0
- package/dist/fallback/migration.d.ts +13 -0
- package/dist/index.js +1112 -360
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1107 -361
- package/dist/index.mjs.map +1 -1
- package/dist/material/types.d.ts +4 -0
- package/dist/material/utils.d.ts +4 -0
- package/dist/math/value-getters/index.d.ts +1 -0
- package/dist/math/value-getters/reference-curve.d.ts +19 -0
- package/dist/math/value-getters/value-getter-map.d.ts +5 -0
- package/dist/plugin-system.d.ts +6 -4
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/particle/particle-mesh.d.ts +0 -2
- package/dist/plugins/particle/trail-mesh.d.ts +0 -2
- package/dist/plugins/plugin.d.ts +14 -0
- package/dist/plugins/sprite/sprite-item.d.ts +31 -5
- package/dist/plugins/sprite/sprite.d.ts +42 -0
- package/dist/plugins/text/index.d.ts +1 -0
- package/dist/plugins/text/line-break.d.ts +29 -0
- package/dist/plugins/timeline/playable-assets/index.d.ts +1 -0
- package/dist/plugins/timeline/playable-assets/sprite-property-playable-asset.d.ts +23 -0
- package/dist/plugins/timeline/playables/index.d.ts +1 -0
- package/dist/plugins/timeline/playables/sprite-property-mixer-playable.d.ts +11 -0
- package/dist/plugins/timeline/playables/transform-mixer-playable.d.ts +6 -0
- package/dist/plugins/timeline/playables/transform-playable.d.ts +17 -2
- package/dist/plugins/timeline/tracks/index.d.ts +1 -0
- package/dist/plugins/timeline/tracks/sprite-property-track.d.ts +11 -0
- package/dist/plugins/timeline/transform-clip-mixer.d.ts +33 -0
- package/dist/render/graphics.d.ts +2 -2
- package/dist/render/text-cache.d.ts +22 -14
- package/dist/scene.d.ts +7 -4
- package/dist/utils/index.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.10.0-alpha.
|
|
6
|
+
* Version: v2.10.0-alpha.1
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -699,6 +699,26 @@ function clamp$1(value, min, max) {
|
|
|
699
699
|
array[offset] = this.x;
|
|
700
700
|
array[offset + 1] = this.y;
|
|
701
701
|
};
|
|
702
|
+
/**
|
|
703
|
+
* 计算向量相对于正 x 轴的角度(弧度)
|
|
704
|
+
* @returns 弧度值
|
|
705
|
+
*/ _proto.angle = function angle() {
|
|
706
|
+
var angle = Math.atan2(-this.y, -this.x) + Math.PI;
|
|
707
|
+
return angle;
|
|
708
|
+
};
|
|
709
|
+
/**
|
|
710
|
+
* 绕指定中心点旋转向量
|
|
711
|
+
* @param center - 旋转中心
|
|
712
|
+
* @param angle - 旋转角度(弧度)
|
|
713
|
+
* @returns 旋转结果
|
|
714
|
+
*/ _proto.rotateAround = function rotateAround(center, angle) {
|
|
715
|
+
var c = Math.cos(angle), s = Math.sin(angle);
|
|
716
|
+
var x = this.x - center.x;
|
|
717
|
+
var y = this.y - center.y;
|
|
718
|
+
this.x = x * c - y * s + center.x;
|
|
719
|
+
this.y = x * s + y * c + center.y;
|
|
720
|
+
return this;
|
|
721
|
+
};
|
|
702
722
|
/**
|
|
703
723
|
* 随机生成向量
|
|
704
724
|
* @returns 向量
|
|
@@ -1252,6 +1272,25 @@ Vector2.ZERO = new Vector2(0.0, 0.0);
|
|
|
1252
1272
|
*/ _proto.applyProjectionMatrix = function applyProjectionMatrix(m, out) {
|
|
1253
1273
|
return m.projectPoint(this, out);
|
|
1254
1274
|
};
|
|
1275
|
+
/**
|
|
1276
|
+
* 从四维矩阵提取平移分量
|
|
1277
|
+
* @param m - 四维矩阵
|
|
1278
|
+
* @returns 向量
|
|
1279
|
+
*/ _proto.setFromMatrixPosition = function setFromMatrixPosition(m) {
|
|
1280
|
+
var e = m.elements;
|
|
1281
|
+
this.x = e[12];
|
|
1282
|
+
this.y = e[13];
|
|
1283
|
+
this.z = e[14];
|
|
1284
|
+
return this;
|
|
1285
|
+
};
|
|
1286
|
+
/**
|
|
1287
|
+
* 从四维矩阵提取指定列的三维分量
|
|
1288
|
+
* @param m - 四维矩阵
|
|
1289
|
+
* @param index - 列下标
|
|
1290
|
+
* @returns 向量
|
|
1291
|
+
*/ _proto.setFromMatrixColumn = function setFromMatrixColumn(m, index) {
|
|
1292
|
+
return this.setFromArray(m.elements, index * 4);
|
|
1293
|
+
};
|
|
1255
1294
|
/**
|
|
1256
1295
|
* 通过标量数值创建向量
|
|
1257
1296
|
* @param num - 数值
|
|
@@ -2892,17 +2931,27 @@ var PluginSystem = /*#__PURE__*/ function() {
|
|
|
2892
2931
|
PluginSystem.getPlugins = function getPlugins() {
|
|
2893
2932
|
return plugins;
|
|
2894
2933
|
};
|
|
2895
|
-
PluginSystem.
|
|
2896
|
-
plugins.forEach(function(
|
|
2897
|
-
return
|
|
2934
|
+
PluginSystem.notifyCompositionCreated = function notifyCompositionCreated(composition, scene) {
|
|
2935
|
+
plugins.forEach(function(plugin) {
|
|
2936
|
+
return plugin.onCompositionCreated(composition, scene);
|
|
2937
|
+
});
|
|
2938
|
+
};
|
|
2939
|
+
PluginSystem.notifyCompositionDestroy = function notifyCompositionDestroy(composition) {
|
|
2940
|
+
plugins.forEach(function(plugin) {
|
|
2941
|
+
return plugin.onCompositionDestroy(composition);
|
|
2942
|
+
});
|
|
2943
|
+
};
|
|
2944
|
+
PluginSystem.notifyEngineCreated = function notifyEngineCreated(engine) {
|
|
2945
|
+
plugins.forEach(function(plugin) {
|
|
2946
|
+
return plugin.onEngineCreated(engine);
|
|
2898
2947
|
});
|
|
2899
2948
|
};
|
|
2900
|
-
PluginSystem.
|
|
2901
|
-
plugins.forEach(function(
|
|
2902
|
-
return
|
|
2949
|
+
PluginSystem.notifyEngineDestroy = function notifyEngineDestroy(engine) {
|
|
2950
|
+
plugins.forEach(function(plugin) {
|
|
2951
|
+
return plugin.onEngineDestroy(engine);
|
|
2903
2952
|
});
|
|
2904
2953
|
};
|
|
2905
|
-
PluginSystem.
|
|
2954
|
+
PluginSystem.notifyAssetsLoadStart = function notifyAssetsLoadStart(scene, options) {
|
|
2906
2955
|
return _async_to_generator(function() {
|
|
2907
2956
|
return __generator(this, function(_state) {
|
|
2908
2957
|
return [
|
|
@@ -2914,9 +2963,9 @@ var PluginSystem = /*#__PURE__*/ function() {
|
|
|
2914
2963
|
});
|
|
2915
2964
|
})();
|
|
2916
2965
|
};
|
|
2917
|
-
PluginSystem.
|
|
2918
|
-
plugins.forEach(function(
|
|
2919
|
-
return
|
|
2966
|
+
PluginSystem.notifyAssetsLoadFinish = function notifyAssetsLoadFinish(scene, options, engine) {
|
|
2967
|
+
plugins.forEach(function(plugin) {
|
|
2968
|
+
return plugin.onAssetsLoadFinish(scene, options, engine);
|
|
2920
2969
|
});
|
|
2921
2970
|
};
|
|
2922
2971
|
return PluginSystem;
|
|
@@ -2982,6 +3031,18 @@ function getPluginUsageInfo(name) {
|
|
|
2982
3031
|
* 合成销毁时触发。
|
|
2983
3032
|
* @param composition - 合成对象
|
|
2984
3033
|
*/ _proto.onCompositionDestroy = function onCompositionDestroy(composition) {};
|
|
3034
|
+
/**
|
|
3035
|
+
* 引擎创建完成后触发。
|
|
3036
|
+
* 适用于注册引擎级单例、建立以引擎为键的映射、绑定全局监听等场景。
|
|
3037
|
+
* @param engine - 引擎实例
|
|
3038
|
+
* @since 2.10.0
|
|
3039
|
+
*/ _proto.onEngineCreated = function onEngineCreated(engine) {};
|
|
3040
|
+
/**
|
|
3041
|
+
* 引擎销毁时触发。
|
|
3042
|
+
* 适合解绑监听、释放引擎级资源或清理以引擎为键的映射。
|
|
3043
|
+
* @param engine - 引擎实例
|
|
3044
|
+
* @since 2.10.0
|
|
3045
|
+
*/ _proto.onEngineDestroy = function onEngineDestroy(engine) {};
|
|
2985
3046
|
return Plugin;
|
|
2986
3047
|
}();
|
|
2987
3048
|
|
|
@@ -4969,7 +5030,7 @@ var Animatable = /*#__PURE__*/ function() {
|
|
|
4969
5030
|
* @param qb - 四元数
|
|
4970
5031
|
* @param t - 插值比
|
|
4971
5032
|
*/ _proto.slerpQuaternions = function slerpQuaternions(qa, qb, t) {
|
|
4972
|
-
this.copyFrom(qa).slerp(qb, t);
|
|
5033
|
+
return this.copyFrom(qa).slerp(qb, t);
|
|
4973
5034
|
};
|
|
4974
5035
|
/**
|
|
4975
5036
|
* 通过四元数旋转向量
|
|
@@ -7527,7 +7588,10 @@ function setSideMode(material, side) {
|
|
|
7527
7588
|
material.cullFace = side === SideMode.BACK ? glContext.BACK : glContext.FRONT;
|
|
7528
7589
|
}
|
|
7529
7590
|
}
|
|
7530
|
-
|
|
7591
|
+
/**
|
|
7592
|
+
* @deprecated 2.10 起 runtime 内部已不再通过 `MaskMode` 设置模板测试参数。
|
|
7593
|
+
* 仅为兼容旧版本对外导出的接口而保留,新代码请勿使用。
|
|
7594
|
+
*/ function setMaskMode(material, maskMode) {
|
|
7531
7595
|
switch(maskMode){
|
|
7532
7596
|
case undefined:
|
|
7533
7597
|
material.stencilTest = false;
|
|
@@ -9412,6 +9476,13 @@ function isUniformStructArray(value) {
|
|
|
9412
9476
|
translation.x = te[12];
|
|
9413
9477
|
translation.y = te[13];
|
|
9414
9478
|
translation.z = te[14];
|
|
9479
|
+
scale.x = sx;
|
|
9480
|
+
scale.y = sy;
|
|
9481
|
+
scale.z = sz;
|
|
9482
|
+
if (Math.abs(sx) < 1e-8 || Math.abs(sy) < 1e-8 || Math.abs(sz) < 1e-8) {
|
|
9483
|
+
rotation.set(0, 0, 0, 1);
|
|
9484
|
+
return this;
|
|
9485
|
+
}
|
|
9415
9486
|
// scale the rotation part
|
|
9416
9487
|
var m = Matrix4.tempMat0;
|
|
9417
9488
|
m.copyFrom(this);
|
|
@@ -9428,9 +9499,6 @@ function isUniformStructArray(value) {
|
|
|
9428
9499
|
m.elements[9] *= invSZ;
|
|
9429
9500
|
m.elements[10] *= invSZ;
|
|
9430
9501
|
rotation.setFromRotationMatrix(m);
|
|
9431
|
-
scale.x = sx;
|
|
9432
|
-
scale.y = sy;
|
|
9433
|
-
scale.z = sz;
|
|
9434
9502
|
return this;
|
|
9435
9503
|
};
|
|
9436
9504
|
_proto.getTranslation = function getTranslation(translation) {
|
|
@@ -9441,6 +9509,45 @@ function isUniformStructArray(value) {
|
|
|
9441
9509
|
var te = this.elements;
|
|
9442
9510
|
return scale.set(Math.hypot(te[0], te[1], te[2]), Math.hypot(te[4], te[5], te[6]), Math.hypot(te[8], te[9], te[10]));
|
|
9443
9511
|
};
|
|
9512
|
+
/**
|
|
9513
|
+
* 提取矩阵的旋转部分(去除缩放)
|
|
9514
|
+
* @param m - 源矩阵
|
|
9515
|
+
* @returns 矩阵
|
|
9516
|
+
*/ _proto.extractRotation = function extractRotation(m) {
|
|
9517
|
+
var v = Matrix4.tempVec0;
|
|
9518
|
+
var me = m.elements;
|
|
9519
|
+
var te = this.elements;
|
|
9520
|
+
var scaleX = 1 / v.set(me[0], me[1], me[2]).length();
|
|
9521
|
+
var scaleY = 1 / v.set(me[4], me[5], me[6]).length();
|
|
9522
|
+
var scaleZ = 1 / v.set(me[8], me[9], me[10]).length();
|
|
9523
|
+
te[0] = me[0] * scaleX;
|
|
9524
|
+
te[1] = me[1] * scaleX;
|
|
9525
|
+
te[2] = me[2] * scaleX;
|
|
9526
|
+
te[3] = 0;
|
|
9527
|
+
te[4] = me[4] * scaleY;
|
|
9528
|
+
te[5] = me[5] * scaleY;
|
|
9529
|
+
te[6] = me[6] * scaleY;
|
|
9530
|
+
te[7] = 0;
|
|
9531
|
+
te[8] = me[8] * scaleZ;
|
|
9532
|
+
te[9] = me[9] * scaleZ;
|
|
9533
|
+
te[10] = me[10] * scaleZ;
|
|
9534
|
+
te[11] = 0;
|
|
9535
|
+
te[12] = 0;
|
|
9536
|
+
te[13] = 0;
|
|
9537
|
+
te[14] = 0;
|
|
9538
|
+
te[15] = 1;
|
|
9539
|
+
return this;
|
|
9540
|
+
};
|
|
9541
|
+
/**
|
|
9542
|
+
* 设置矩阵的平移部分(不影响旋转和缩放)
|
|
9543
|
+
* @param v - 平移向量
|
|
9544
|
+
* @returns 矩阵
|
|
9545
|
+
*/ _proto.setPosition = function setPosition(v) {
|
|
9546
|
+
this.elements[12] = v.x;
|
|
9547
|
+
this.elements[13] = v.y;
|
|
9548
|
+
this.elements[14] = v.z;
|
|
9549
|
+
return this;
|
|
9550
|
+
};
|
|
9444
9551
|
/**
|
|
9445
9552
|
* 获得矩阵分解的结果
|
|
9446
9553
|
* @returns 分解的结果
|
|
@@ -10734,6 +10841,23 @@ Euler.tempMat0 = new Matrix4();
|
|
|
10734
10841
|
*/ _proto.equals = function equals(other) {
|
|
10735
10842
|
return this.origin.equals(other.origin) && this.direction.equals(other.direction);
|
|
10736
10843
|
};
|
|
10844
|
+
/**
|
|
10845
|
+
* 光线到平面的距离
|
|
10846
|
+
* @param plane - 平面
|
|
10847
|
+
* @returns 距离值,平行且不在平面上时返回 null,平行且在平面上时返回 0
|
|
10848
|
+
*/ _proto.distanceToPlane = function distanceToPlane(plane) {
|
|
10849
|
+
var normal = plane.normal;
|
|
10850
|
+
var denominator = normal.dot(this.direction);
|
|
10851
|
+
if (denominator === 0) {
|
|
10852
|
+
// 光线与平面平行
|
|
10853
|
+
if (normal.dot(this.origin) + plane.distance === 0) {
|
|
10854
|
+
return 0;
|
|
10855
|
+
}
|
|
10856
|
+
return null;
|
|
10857
|
+
}
|
|
10858
|
+
var t = -(this.origin.dot(normal) + plane.distance) / denominator;
|
|
10859
|
+
return t >= 0 ? t : null;
|
|
10860
|
+
};
|
|
10737
10861
|
/**
|
|
10738
10862
|
* 根据矩阵对光线进行变换
|
|
10739
10863
|
* @param m - 变换矩阵
|
|
@@ -12594,65 +12718,70 @@ exports.MaterialRenderType = void 0;
|
|
|
12594
12718
|
return new Material(engine, props);
|
|
12595
12719
|
};
|
|
12596
12720
|
|
|
12721
|
+
// 8 位 stencil buffer 上限为 255;为反向蒙版的 INCR 预留 1 的递增余量,
|
|
12722
|
+
// 否则当正向蒙版填满到 255 时,反向 INCR 会饱和、无法排除任何像素。
|
|
12723
|
+
var MAX_MASK_REFERENCE_COUNT = 254;
|
|
12597
12724
|
/**
|
|
12598
12725
|
* @internal
|
|
12599
12726
|
*/ var MaskProcessor = /*#__PURE__*/ function() {
|
|
12600
12727
|
function MaskProcessor() {
|
|
12601
12728
|
this.alphaMaskEnabled = false;
|
|
12602
12729
|
this.isMask = false;
|
|
12603
|
-
this.inverted = false;
|
|
12604
|
-
this.maskMode = exports.MaskMode.NONE;
|
|
12605
12730
|
/**
|
|
12606
12731
|
* 多个蒙版引用列表,支持正面和反面蒙版
|
|
12607
12732
|
*/ this.maskReferences = [];
|
|
12608
12733
|
/**
|
|
12609
12734
|
* 期望的 stencil 值(等于正向蒙版的数量)
|
|
12610
12735
|
*/ this.expectedStencilValue = 0;
|
|
12611
|
-
this.prevStencilFunc = [
|
|
12612
|
-
0,
|
|
12613
|
-
0
|
|
12614
|
-
];
|
|
12615
|
-
this.prevStencilOpZPass = [
|
|
12616
|
-
0,
|
|
12617
|
-
0
|
|
12618
|
-
];
|
|
12619
|
-
this.prevStencilRef = [
|
|
12620
|
-
0,
|
|
12621
|
-
0
|
|
12622
|
-
];
|
|
12623
|
-
this.prevStencilMask = [
|
|
12624
|
-
0,
|
|
12625
|
-
0
|
|
12626
|
-
];
|
|
12627
12736
|
this.stencilClearAction = {
|
|
12628
12737
|
stencilAction: exports.TextureLoadAction.clear
|
|
12629
12738
|
};
|
|
12630
12739
|
}
|
|
12631
12740
|
var _proto = MaskProcessor.prototype;
|
|
12632
12741
|
/**
|
|
12633
|
-
*
|
|
12634
|
-
|
|
12635
|
-
|
|
12636
|
-
|
|
12637
|
-
|
|
12638
|
-
* 设置蒙版选项(兼容旧版单蒙版 API)
|
|
12742
|
+
* 设置蒙版选项。
|
|
12743
|
+
*
|
|
12744
|
+
* @param data.references - 蒙版引用列表。
|
|
12745
|
+
* 传入空数组等价于无蒙版。
|
|
12746
|
+
* 超过 254 个引用时,多余部分将被忽略并打印警告。
|
|
12639
12747
|
*/ _proto.setMaskOptions = function setMaskOptions(engine, data) {
|
|
12640
|
-
var _data_isMask = data.isMask, isMask = _data_isMask === void 0 ? false : _data_isMask,
|
|
12748
|
+
var _data_isMask = data.isMask, isMask = _data_isMask === void 0 ? false : _data_isMask, _data_references = data.references, references = _data_references === void 0 ? [] : _data_references, _data_alphaMaskEnabled = data.alphaMaskEnabled, alphaMaskEnabled = _data_alphaMaskEnabled === void 0 ? false : _data_alphaMaskEnabled;
|
|
12641
12749
|
this.alphaMaskEnabled = alphaMaskEnabled;
|
|
12642
12750
|
this.isMask = isMask;
|
|
12643
|
-
this.inverted = inverted;
|
|
12644
12751
|
this.maskReferences = [];
|
|
12645
|
-
if (isMask) {
|
|
12646
|
-
|
|
12647
|
-
}
|
|
12648
|
-
|
|
12649
|
-
|
|
12650
|
-
|
|
12651
|
-
|
|
12652
|
-
|
|
12653
|
-
|
|
12654
|
-
});
|
|
12752
|
+
if (isMask || references.length === 0) {
|
|
12753
|
+
return;
|
|
12754
|
+
}
|
|
12755
|
+
var seen = new Map();
|
|
12756
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(references), _step; !(_step = _iterator()).done;){
|
|
12757
|
+
var ref = _step.value;
|
|
12758
|
+
var maskPath = ref.mask;
|
|
12759
|
+
if (!maskPath) {
|
|
12760
|
+
continue;
|
|
12655
12761
|
}
|
|
12762
|
+
var maskable = engine.findObject(maskPath);
|
|
12763
|
+
if (!maskable) {
|
|
12764
|
+
console.warn("Mask reference not found: " + JSON.stringify(maskPath) + ". Skipping.");
|
|
12765
|
+
continue;
|
|
12766
|
+
}
|
|
12767
|
+
var _ref_inverted;
|
|
12768
|
+
var inverted = (_ref_inverted = ref.inverted) != null ? _ref_inverted : false;
|
|
12769
|
+
var existingInverted = seen.get(maskable);
|
|
12770
|
+
if (existingInverted !== undefined) {
|
|
12771
|
+
if (existingInverted !== inverted) {
|
|
12772
|
+
console.warn("Same maskable referenced with conflicting inverted flags; keeping the first occurrence.");
|
|
12773
|
+
}
|
|
12774
|
+
continue;
|
|
12775
|
+
}
|
|
12776
|
+
if (this.maskReferences.length >= MAX_MASK_REFERENCE_COUNT) {
|
|
12777
|
+
console.warn("Maximum of " + MAX_MASK_REFERENCE_COUNT + " mask references exceeded. Additional masks will be ignored.");
|
|
12778
|
+
break;
|
|
12779
|
+
}
|
|
12780
|
+
seen.set(maskable, inverted);
|
|
12781
|
+
this.maskReferences.push({
|
|
12782
|
+
maskable: maskable,
|
|
12783
|
+
inverted: inverted
|
|
12784
|
+
});
|
|
12656
12785
|
}
|
|
12657
12786
|
};
|
|
12658
12787
|
/**
|
|
@@ -12665,8 +12794,8 @@ exports.MaterialRenderType = void 0;
|
|
|
12665
12794
|
return ref.maskable === maskable;
|
|
12666
12795
|
});
|
|
12667
12796
|
if (!exists) {
|
|
12668
|
-
if (this.maskReferences.length >=
|
|
12669
|
-
console.warn("Maximum of
|
|
12797
|
+
if (this.maskReferences.length >= MAX_MASK_REFERENCE_COUNT) {
|
|
12798
|
+
console.warn("Maximum of " + MAX_MASK_REFERENCE_COUNT + " mask references exceeded. Additional masks will be ignored.");
|
|
12670
12799
|
return;
|
|
12671
12800
|
}
|
|
12672
12801
|
this.maskReferences.push({
|
|
@@ -12692,6 +12821,11 @@ exports.MaterialRenderType = void 0;
|
|
|
12692
12821
|
this.maskReferences = [];
|
|
12693
12822
|
};
|
|
12694
12823
|
/**
|
|
12824
|
+
* 获取当前蒙版引用列表的浅拷贝。
|
|
12825
|
+
*/ _proto.getMaskReferences = function getMaskReferences() {
|
|
12826
|
+
return this.maskReferences.slice();
|
|
12827
|
+
};
|
|
12828
|
+
/**
|
|
12695
12829
|
* 绘制所有蒙版,被蒙版的元素调用。
|
|
12696
12830
|
*
|
|
12697
12831
|
* 使用递增 stencil 计数法实现任意数量蒙版的交集:
|
|
@@ -12699,12 +12833,17 @@ exports.MaterialRenderType = void 0;
|
|
|
12699
12833
|
* 2. 反向蒙版渲染,将已通过所有正向蒙版的像素标记为无效
|
|
12700
12834
|
* 3. 最终只有 stencil == 正向蒙版数量 的像素才通过测试
|
|
12701
12835
|
*
|
|
12702
|
-
* 最多支持
|
|
12836
|
+
* 最多支持 254 个蒙版引用(8 位 stencil buffer 上限 255,需为反向 INCR 预留 1)
|
|
12703
12837
|
*/ _proto.drawStencilMask = function drawStencilMask(renderer, maskedComponent) {
|
|
12704
12838
|
var frameClipMasks = maskedComponent.frameClipMasks;
|
|
12839
|
+
var addedFrameClipMasks = [];
|
|
12705
12840
|
for(var _iterator = _create_for_of_iterator_helper_loose(frameClipMasks), _step; !(_step = _iterator()).done;){
|
|
12706
12841
|
var frameClipMask = _step.value;
|
|
12842
|
+
var referenceCount = this.maskReferences.length;
|
|
12707
12843
|
this.addMaskReference(frameClipMask, false);
|
|
12844
|
+
if (this.maskReferences.length > referenceCount) {
|
|
12845
|
+
addedFrameClipMasks.push(frameClipMask);
|
|
12846
|
+
}
|
|
12708
12847
|
}
|
|
12709
12848
|
if (this.maskReferences.length > 0) {
|
|
12710
12849
|
renderer.clear(this.stencilClearAction);
|
|
@@ -12740,7 +12879,7 @@ exports.MaterialRenderType = void 0;
|
|
|
12740
12879
|
var material = _step3.value;
|
|
12741
12880
|
this.setupMaskedMaterial(material);
|
|
12742
12881
|
}
|
|
12743
|
-
for(var _iterator4 = _create_for_of_iterator_helper_loose(
|
|
12882
|
+
for(var _iterator4 = _create_for_of_iterator_helper_loose(addedFrameClipMasks), _step4; !(_step4 = _iterator4()).done;){
|
|
12744
12883
|
var frameClipMask1 = _step4.value;
|
|
12745
12884
|
this.removeMaskReference(frameClipMask1);
|
|
12746
12885
|
}
|
|
@@ -12749,24 +12888,24 @@ exports.MaterialRenderType = void 0;
|
|
|
12749
12888
|
* 绘制几何体蒙版,蒙版元素绘制时调用
|
|
12750
12889
|
*/ _proto.drawGeometryMask = function drawGeometryMask(renderer, geometry, worldMatrix, material, maskRef, subMeshIndex) {
|
|
12751
12890
|
if (subMeshIndex === void 0) subMeshIndex = 0;
|
|
12752
|
-
var
|
|
12891
|
+
var prevColorMask = material.colorMask;
|
|
12753
12892
|
var prevStencilTest = material.stencilTest;
|
|
12754
|
-
|
|
12755
|
-
|
|
12756
|
-
|
|
12757
|
-
|
|
12758
|
-
|
|
12759
|
-
|
|
12893
|
+
var prevStencilFunc = material.stencilFunc;
|
|
12894
|
+
var prevStencilOpFail = material.stencilOpFail;
|
|
12895
|
+
var prevStencilOpZFail = material.stencilOpZFail;
|
|
12896
|
+
var prevStencilOpZPass = material.stencilOpZPass;
|
|
12897
|
+
var prevStencilRef = material.stencilRef;
|
|
12898
|
+
var prevStencilMask = material.stencilMask;
|
|
12760
12899
|
this.setupMaskMaterial(material, maskRef);
|
|
12761
12900
|
renderer.drawGeometry(geometry, worldMatrix, material, subMeshIndex);
|
|
12762
|
-
material.colorMask =
|
|
12901
|
+
material.colorMask = prevColorMask;
|
|
12763
12902
|
material.stencilTest = prevStencilTest;
|
|
12764
|
-
material.stencilFunc =
|
|
12765
|
-
material.
|
|
12766
|
-
|
|
12767
|
-
|
|
12768
|
-
material.stencilRef =
|
|
12769
|
-
material.stencilMask =
|
|
12903
|
+
material.stencilFunc = prevStencilFunc;
|
|
12904
|
+
material.stencilOpFail = prevStencilOpFail;
|
|
12905
|
+
material.stencilOpZFail = prevStencilOpZFail;
|
|
12906
|
+
material.stencilOpZPass = prevStencilOpZPass;
|
|
12907
|
+
material.stencilRef = prevStencilRef;
|
|
12908
|
+
material.stencilMask = prevStencilMask;
|
|
12770
12909
|
};
|
|
12771
12910
|
/**
|
|
12772
12911
|
* 设置蒙版材质的 stencil 属性(写入蒙版)
|
|
@@ -12794,12 +12933,18 @@ exports.MaterialRenderType = void 0;
|
|
|
12794
12933
|
0xFF
|
|
12795
12934
|
];
|
|
12796
12935
|
// 通过时递增 stencil 值,不通过时保持不变
|
|
12936
|
+
material.stencilOpFail = [
|
|
12937
|
+
glContext.KEEP,
|
|
12938
|
+
glContext.KEEP
|
|
12939
|
+
];
|
|
12940
|
+
material.stencilOpZFail = [
|
|
12941
|
+
glContext.KEEP,
|
|
12942
|
+
glContext.KEEP
|
|
12943
|
+
];
|
|
12797
12944
|
material.stencilOpZPass = [
|
|
12798
12945
|
glContext.INCR,
|
|
12799
12946
|
glContext.INCR
|
|
12800
12947
|
];
|
|
12801
|
-
// material.stencilOpFail = [glContext.KEEP, glContext.KEEP];
|
|
12802
|
-
// material.stencilOpZFail = [glContext.KEEP, glContext.KEEP];
|
|
12803
12948
|
material.colorMask = false; // 不写入颜色
|
|
12804
12949
|
};
|
|
12805
12950
|
/**
|
|
@@ -12834,13 +12979,6 @@ exports.MaterialRenderType = void 0;
|
|
|
12834
12979
|
material.stencilTest = false;
|
|
12835
12980
|
}
|
|
12836
12981
|
};
|
|
12837
|
-
_proto.copyStencilArrayValue = function copyStencilArrayValue(target, source) {
|
|
12838
|
-
if (!source) {
|
|
12839
|
-
return;
|
|
12840
|
-
}
|
|
12841
|
-
target[0] = source[0];
|
|
12842
|
-
target[1] = source[1];
|
|
12843
|
-
};
|
|
12844
12982
|
_create_class(MaskProcessor, [
|
|
12845
12983
|
{
|
|
12846
12984
|
key: "maskable",
|
|
@@ -12856,7 +12994,7 @@ exports.MaterialRenderType = void 0;
|
|
|
12856
12994
|
if (value) {
|
|
12857
12995
|
this.maskReferences.push({
|
|
12858
12996
|
maskable: value,
|
|
12859
|
-
inverted:
|
|
12997
|
+
inverted: false
|
|
12860
12998
|
});
|
|
12861
12999
|
}
|
|
12862
13000
|
}
|
|
@@ -16641,19 +16779,15 @@ function buildBezierEasing(leftKeyframe, rightKeyframe) {
|
|
|
16641
16779
|
y2 = numberToFix((p2.y - p0.y) / valueInterval, 5);
|
|
16642
16780
|
}
|
|
16643
16781
|
if (x1 < 0) {
|
|
16644
|
-
console.error("Invalid bezier points, x1 < 0", p0, p1, p2, p3);
|
|
16645
16782
|
x1 = 0;
|
|
16646
16783
|
}
|
|
16647
16784
|
if (x2 < 0) {
|
|
16648
|
-
console.error("Invalid bezier points, x2 < 0", p0, p1, p2, p3);
|
|
16649
16785
|
x2 = 0;
|
|
16650
16786
|
}
|
|
16651
16787
|
if (x1 > 1) {
|
|
16652
|
-
console.error("Invalid bezier points, x1 >= 1", p0, p1, p2, p3);
|
|
16653
16788
|
x1 = 1;
|
|
16654
16789
|
}
|
|
16655
16790
|
if (x2 > 1) {
|
|
16656
|
-
console.error("Invalid bezier points, x2 >= 1", p0, p1, p2, p3);
|
|
16657
16791
|
x2 = 1;
|
|
16658
16792
|
}
|
|
16659
16793
|
var str = ("bez_" + x1 + "_" + y1 + "_" + x2 + "_" + y2).replace(/\./g, "p");
|
|
@@ -16744,10 +16878,49 @@ function oldBezierKeyFramesToNew(props) {
|
|
|
16744
16878
|
return keyframes;
|
|
16745
16879
|
}
|
|
16746
16880
|
|
|
16881
|
+
/**
|
|
16882
|
+
* 通用对象引用阶梯曲线(不插值)。对象引用不可插值,
|
|
16883
|
+
* 按时间阶梯采样取 time ≤ t 的最近关键帧。
|
|
16884
|
+
*
|
|
16885
|
+
* 继承 ValueGetter 以复用 PropertyClipPlayable<T>;数值相关方法
|
|
16886
|
+
* (toUniform/toData/getIntegrate*)保留基类 NOT_IMPLEMENT——对象引用 curve
|
|
16887
|
+
* 不走 shader 通路。典型用例:T = Sprite(sprite 属性 K 帧切图)。
|
|
16888
|
+
*/ var ReferenceCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
16889
|
+
_inherits(ReferenceCurve, ValueGetter);
|
|
16890
|
+
function ReferenceCurve() {
|
|
16891
|
+
return ValueGetter.apply(this, arguments);
|
|
16892
|
+
}
|
|
16893
|
+
var _proto = ReferenceCurve.prototype;
|
|
16894
|
+
_proto.onCreate = function onCreate(props) {
|
|
16895
|
+
this.keyframes = props;
|
|
16896
|
+
};
|
|
16897
|
+
_proto.getValue = function getValue(time) {
|
|
16898
|
+
var keys = this.keyframes;
|
|
16899
|
+
if (keys.length === 0) {
|
|
16900
|
+
return undefined;
|
|
16901
|
+
}
|
|
16902
|
+
// 阶梯采样:取 time ≤ t 的最大关键帧;t < 首帧取首帧。无插值。
|
|
16903
|
+
var result = keys[0][1];
|
|
16904
|
+
for(var i = 0; i < keys.length; i++){
|
|
16905
|
+
if (keys[i][0] <= (time != null ? time : 0)) {
|
|
16906
|
+
result = keys[i][1];
|
|
16907
|
+
} else {
|
|
16908
|
+
break;
|
|
16909
|
+
}
|
|
16910
|
+
}
|
|
16911
|
+
return result;
|
|
16912
|
+
};
|
|
16913
|
+
return ReferenceCurve;
|
|
16914
|
+
}(ValueGetter);
|
|
16915
|
+
|
|
16747
16916
|
/**
|
|
16748
16917
|
* Vector2 曲线
|
|
16749
16918
|
* TODO: add spec
|
|
16750
16919
|
*/ var VECTOR3_CURVE = 27;
|
|
16920
|
+
/**
|
|
16921
|
+
* 对象引用阶梯曲线(spec ValueType.REFERENCE_CURVE)。
|
|
16922
|
+
* props 为 [[time, value], ...],value 为已解析的对象引用实例。
|
|
16923
|
+
*/ var REFERENCE_CURVE = 28;
|
|
16751
16924
|
var _obj$4;
|
|
16752
16925
|
var map$1 = (_obj$4 = {}, _obj$4[ValueType.RANDOM] = function(props) {
|
|
16753
16926
|
if (_instanceof1(props[0], Array)) {
|
|
@@ -16804,6 +16977,9 @@ var map$1 = (_obj$4 = {}, _obj$4[ValueType.RANDOM] = function(props) {
|
|
|
16804
16977
|
}, // TODO: add spec
|
|
16805
16978
|
_obj$4[VECTOR3_CURVE] = function(props) {
|
|
16806
16979
|
return new Vector3Curve(props);
|
|
16980
|
+
}, // 对象引用阶梯曲线(不插值):props.data 为 [time, value][],value 已解析为 EffectsObject
|
|
16981
|
+
_obj$4[REFERENCE_CURVE] = function(props) {
|
|
16982
|
+
return new ReferenceCurve(props);
|
|
16807
16983
|
}, _obj$4);
|
|
16808
16984
|
function createValueGetter(args) {
|
|
16809
16985
|
if (!args || !isNaN(+args)) {
|
|
@@ -21866,16 +22042,26 @@ var canvasPool = new CanvasPool();
|
|
|
21866
22042
|
* 单张字符 atlas 的边长(像素,scale 后的实际像素,非逻辑尺寸)。
|
|
21867
22043
|
* 512×512 在 24px 字号下约可容纳 250+ 字形,常见 demo 文本足够
|
|
21868
22044
|
*/ var ATLAS_SIZE = 512;
|
|
22045
|
+
/**
|
|
22046
|
+
* 字体度量探针字符串。带重音符的 É/Å 把墨水顶推到接近字体真实 ascent,
|
|
22047
|
+
* 单字 'M' 只有 cap height(~0.7em) 太矮,会让 CJK / 带重音字顶部越过 cell 上界被裁
|
|
22048
|
+
*/ var METRICS_STRING = "|\xc9q\xc5";
|
|
22049
|
+
/** 字体度量基线符号 */ var BASELINE_SYMBOL = "M";
|
|
22050
|
+
/**
|
|
22051
|
+
* 字形 cell 四周留白(逻辑像素)。ink 略超字体度量、或 italic 斜体越界时由它吸收,
|
|
22052
|
+
* 保证 cell 采样矩形内不裁切字形
|
|
22053
|
+
*/ var GLYPH_PADDING = 4;
|
|
21869
22054
|
/**
|
|
21870
22055
|
* 一种字体(family + weight + style + size 唯一确定)对应一张 atlas。
|
|
21871
22056
|
*
|
|
21872
|
-
* Skyline 风格 packer
|
|
22057
|
+
* Skyline 风格 packer:行内堆字,行尾换行,cell 高 = ceil((fontHeight + padding*2) * 1),
|
|
22058
|
+
* 所有字共用同一 cell 高与 baseline,实现同行 baseline 对齐。
|
|
21873
22059
|
* atlas 满后 `ensureChar` 返回 null,调用方应跳过该字(不再扩页,v1 范围)。
|
|
21874
22060
|
*
|
|
21875
22061
|
* canvas 内容变更后需要 `uploadIfDirty` 重新上传到纹理 — 由调用方在使用纹理前主动触发,
|
|
21876
22062
|
* 避免每加一字都 upload 一次造成的 GL 开销
|
|
21877
22063
|
*/ var GlyphAtlas = /*#__PURE__*/ function() {
|
|
21878
|
-
function GlyphAtlas(engine, scaledFontString, ascent, descent) {
|
|
22064
|
+
function GlyphAtlas(engine, scaledFontString, /** baseline 距 cell 顶距离(像素,scale 后,仅 ascent 部分,不含 padding) */ ascentPx, /** baseline 距 cell 底距离(像素,scale 后,仅 descent 部分) */ descentPx, fontStyle) {
|
|
21879
22065
|
this.engine = engine;
|
|
21880
22066
|
this.scaledFontString = scaledFontString;
|
|
21881
22067
|
this.glyphs = new Map();
|
|
@@ -21896,11 +22082,14 @@ var canvasPool = new CanvasPool();
|
|
|
21896
22082
|
ctx.font = scaledFontString;
|
|
21897
22083
|
ctx.textBaseline = "alphabetic";
|
|
21898
22084
|
ctx.fillStyle = "#ffffff";
|
|
21899
|
-
this.
|
|
21900
|
-
this.
|
|
21901
|
-
|
|
21902
|
-
|
|
21903
|
-
|
|
22085
|
+
this.paddingPx = GLYPH_PADDING * FONT_SCALE;
|
|
22086
|
+
this.italicScale = fontStyle === "italic" ? 2 : 1;
|
|
22087
|
+
// ascent/descent 由探针 '|ÉqÅM' 测得 actualBoundingBox(重音字已抬高 ink 顶),
|
|
22088
|
+
// 两者内部保持浮点,仅 cell 高做一次外层 ceil — 与 padding 共同保证 cell 内不裁切
|
|
22089
|
+
var fontHeightPx = ascentPx + descentPx;
|
|
22090
|
+
this.baselinePx = this.paddingPx + ascentPx;
|
|
22091
|
+
this.cellHPx = Math.ceil(fontHeightPx + this.paddingPx * 2);
|
|
22092
|
+
this.lineHeight = this.cellHPx / FONT_SCALE;
|
|
21904
22093
|
this.texture = Texture.create(engine, {
|
|
21905
22094
|
sourceType: exports.TextureSourceType.image,
|
|
21906
22095
|
image: this.canvas,
|
|
@@ -21929,10 +22118,12 @@ var canvasPool = new CanvasPool();
|
|
|
21929
22118
|
ctx.font = this.scaledFontString;
|
|
21930
22119
|
// measureText 用的是 scaledFontString,advance 已经是 scale 后的像素,不能再乘 FONT_SCALE
|
|
21931
22120
|
var advancePx = ctx.measureText(char).width;
|
|
21932
|
-
|
|
21933
|
-
var
|
|
22121
|
+
// italic 放大 cell 宽防斜体越界;ceil 对齐像素网格避免相邻字采样重叠
|
|
22122
|
+
var widthPx = Math.max(1, Math.ceil(advancePx * this.italicScale));
|
|
22123
|
+
var paddedWidthPx = widthPx + this.paddingPx * 2;
|
|
22124
|
+
var cellH = this.cellHPx;
|
|
21934
22125
|
// 行尾换行
|
|
21935
|
-
if (this.currentX +
|
|
22126
|
+
if (this.currentX + paddedWidthPx > ATLAS_SIZE) {
|
|
21936
22127
|
this.currentX = 0;
|
|
21937
22128
|
this.currentY += cellH;
|
|
21938
22129
|
}
|
|
@@ -21944,15 +22135,17 @@ var canvasPool = new CanvasPool();
|
|
|
21944
22135
|
}
|
|
21945
22136
|
var px = this.currentX;
|
|
21946
22137
|
var py = this.currentY;
|
|
21947
|
-
|
|
21948
|
-
this.
|
|
22138
|
+
// baseline 落在 cell 顶部下方 paddingPx + ascentPx 处,四周 padding 吸收越界 ink
|
|
22139
|
+
ctx.fillText(char, px + this.paddingPx, py + this.baselinePx);
|
|
22140
|
+
this.currentX += paddedWidthPx;
|
|
21949
22141
|
this.dirty = true;
|
|
21950
22142
|
var info = {
|
|
21951
22143
|
px: px,
|
|
21952
22144
|
py: py,
|
|
21953
|
-
pw:
|
|
22145
|
+
pw: paddedWidthPx,
|
|
21954
22146
|
ph: cellH,
|
|
21955
|
-
|
|
22147
|
+
advance: advancePx / FONT_SCALE,
|
|
22148
|
+
paddingLeft: this.paddingPx / FONT_SCALE
|
|
21956
22149
|
};
|
|
21957
22150
|
this.glyphs.set(char, info);
|
|
21958
22151
|
return info;
|
|
@@ -22004,22 +22197,25 @@ var canvasPool = new CanvasPool();
|
|
|
22004
22197
|
if (cached) {
|
|
22005
22198
|
return cached;
|
|
22006
22199
|
}
|
|
22007
|
-
var fontString = fontStyle + " " + fontWeight + " " + fontSize + "px " + fontFamily;
|
|
22008
22200
|
var scaledFontString = fontStyle + " " + fontWeight + " " + fontSize * FONT_SCALE + "px " + fontFamily;
|
|
22009
|
-
//
|
|
22201
|
+
// 探一次得到字体级 ascent/descent(整张 atlas 共享 cell 高与 baseline,各字对齐)。
|
|
22202
|
+
// 直接在 scaledFontString 下测,得到的就是 scale 后像素,无需再乘 FONT_SCALE。
|
|
22203
|
+
// 探针用 '|ÉqÅ' + 'M':带重音符的 ÉÅ 把 ink 顶推到接近字体真实 ascent,
|
|
22204
|
+
// 单字 'M' 只有 cap height(~0.7em) 太矮,CJK / 带重音字顶部会越过 cell 上界被裁。
|
|
22205
|
+
// 取 actualBoundingBoxAscent/Descent 度量 ink 边界,跨平台语义稳定
|
|
22010
22206
|
var probeCanvasAndContext = canvasPool.getCanvasAndContext(1, 1);
|
|
22011
22207
|
var probeCtx = probeCanvasAndContext.context;
|
|
22012
|
-
var
|
|
22013
|
-
var
|
|
22208
|
+
var ascentPx = fontSize * 0.8 * FONT_SCALE;
|
|
22209
|
+
var descentPx = fontSize * 0.2 * FONT_SCALE;
|
|
22014
22210
|
try {
|
|
22015
|
-
probeCtx.font =
|
|
22016
|
-
var m = probeCtx.measureText(
|
|
22017
|
-
|
|
22018
|
-
|
|
22211
|
+
probeCtx.font = scaledFontString;
|
|
22212
|
+
var m = probeCtx.measureText(METRICS_STRING + BASELINE_SYMBOL);
|
|
22213
|
+
ascentPx = m.actualBoundingBoxAscent || ascentPx;
|
|
22214
|
+
descentPx = m.actualBoundingBoxDescent || descentPx;
|
|
22019
22215
|
} finally{
|
|
22020
22216
|
canvasPool.releaseCanvasAndContext(probeCanvasAndContext);
|
|
22021
22217
|
}
|
|
22022
|
-
var atlas = new GlyphAtlas(this.engine, scaledFontString,
|
|
22218
|
+
var atlas = new GlyphAtlas(this.engine, scaledFontString, ascentPx, descentPx, fontStyle);
|
|
22023
22219
|
this.atlases.set(fontKey, atlas);
|
|
22024
22220
|
return atlas;
|
|
22025
22221
|
};
|
|
@@ -22423,8 +22619,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
22423
22619
|
* `color` 作为乘色与白色字形 alpha 相乘,任意颜色都不会污染 atlas。
|
|
22424
22620
|
*
|
|
22425
22621
|
* 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
|
|
22426
|
-
* @param x - 文本左下角 X
|
|
22427
|
-
* @param y - 文本左下角 Y
|
|
22622
|
+
* @param x - 文本左下角 X 坐标(首字 ink 起始处,含 padding 的 quad 会向左延伸)
|
|
22623
|
+
* @param y - 文本左下角 Y 坐标(cell 底,含底部 padding;字形 ink 在其上方 padding+ascent 处)
|
|
22428
22624
|
* @param text - 要绘制的文本内容,空串直接 return
|
|
22429
22625
|
* @param fontSize - 字号(逻辑像素)
|
|
22430
22626
|
* @param color - 乘色,默认白色,范围 0-1
|
|
@@ -22455,13 +22651,15 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
22455
22651
|
var u1 = (info.px + info.pw) / ATLAS_SIZE;
|
|
22456
22652
|
var v0 = 1 - (info.py + info.ph) / ATLAS_SIZE;
|
|
22457
22653
|
var v1 = 1 - info.py / ATLAS_SIZE;
|
|
22458
|
-
|
|
22654
|
+
// quad 宽与采样区都含四周 padding(cell 留白透明);但光标只按 advance 前进,
|
|
22655
|
+
// quad 起点左偏 paddingLeft 使字形 ink 落在 cursorX — padding 区重叠无妨
|
|
22656
|
+
this.pushQuad(cursorX - info.paddingLeft, y, info.pw / FONT_SCALE, lineHeight, color, {
|
|
22459
22657
|
u0: u0,
|
|
22460
22658
|
v0: v0,
|
|
22461
22659
|
u1: u1,
|
|
22462
22660
|
v1: v1
|
|
22463
22661
|
});
|
|
22464
|
-
cursorX += info.
|
|
22662
|
+
cursorX += info.advance;
|
|
22465
22663
|
}
|
|
22466
22664
|
};
|
|
22467
22665
|
_proto.dispose = function dispose() {
|
|
@@ -22678,7 +22876,6 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
22678
22876
|
aUV: {
|
|
22679
22877
|
size: 2,
|
|
22680
22878
|
offset: 0,
|
|
22681
|
-
releasable: true,
|
|
22682
22879
|
type: glContext.FLOAT,
|
|
22683
22880
|
data: new Float32Array([
|
|
22684
22881
|
0,
|
|
@@ -22826,7 +23023,6 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
22826
23023
|
};
|
|
22827
23024
|
_proto.configureMaterial = function configureMaterial(renderer) {
|
|
22828
23025
|
var side = renderer.side, occlusion = renderer.occlusion, blendMode = renderer.blending, texture = renderer.texture;
|
|
22829
|
-
var maskMode = this.maskManager.maskMode;
|
|
22830
23026
|
var material = this.material;
|
|
22831
23027
|
material.blending = true;
|
|
22832
23028
|
material.depthTest = true;
|
|
@@ -22841,7 +23037,6 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
22841
23037
|
texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
|
|
22842
23038
|
texParams.y = preMultiAlpha;
|
|
22843
23039
|
texParams.z = renderer.renderMode;
|
|
22844
|
-
texParams.w = maskMode;
|
|
22845
23040
|
material.setVector4("_TexParams", texParams);
|
|
22846
23041
|
if (texParams.x === 0 || this.maskManager.alphaMaskEnabled) {
|
|
22847
23042
|
material.enableMacro("ALPHA_CLIP");
|
|
@@ -22869,9 +23064,9 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
22869
23064
|
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
22870
23065
|
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.whiteTexture,
|
|
22871
23066
|
occlusion: !!renderer.occlusion,
|
|
22872
|
-
transparentOcclusion: !!renderer.transparentOcclusion || this.maskManager.
|
|
23067
|
+
transparentOcclusion: !!renderer.transparentOcclusion || this.maskManager.isMask,
|
|
22873
23068
|
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
22874
|
-
mask:
|
|
23069
|
+
mask: 1
|
|
22875
23070
|
};
|
|
22876
23071
|
this.configureMaterial(this.renderer);
|
|
22877
23072
|
};
|
|
@@ -24938,6 +25133,50 @@ var SpriteLoader = /*#__PURE__*/ function(Plugin) {
|
|
|
24938
25133
|
return SpriteLoader;
|
|
24939
25134
|
}(_wrap_native_super(Plugin));
|
|
24940
25135
|
|
|
25136
|
+
exports.SpriteRotation = void 0;
|
|
25137
|
+
(function(SpriteRotation) {
|
|
25138
|
+
/** 不旋转 */ SpriteRotation[SpriteRotation["None"] = 0] = "None";
|
|
25139
|
+
/** UV 旋转 90°(对应老 splits flip=1) */ SpriteRotation[SpriteRotation["Rotate90"] = 1] = "Rotate90";
|
|
25140
|
+
})(exports.SpriteRotation || (exports.SpriteRotation = {}));
|
|
25141
|
+
exports.Sprite = /*#__PURE__*/ function(EffectsObject) {
|
|
25142
|
+
_inherits(Sprite, EffectsObject);
|
|
25143
|
+
function Sprite(engine, props) {
|
|
25144
|
+
var _this;
|
|
25145
|
+
_this = EffectsObject.call(this, engine) || this;
|
|
25146
|
+
/** 归一化 UV 矩形 [x, y, w, h],默认整张纹理 */ _this.rect = [
|
|
25147
|
+
0,
|
|
25148
|
+
0,
|
|
25149
|
+
1,
|
|
25150
|
+
1
|
|
25151
|
+
];
|
|
25152
|
+
/** UV 旋转方式(对应老 splits 的 flip 0/1) */ _this.rotation = 0;
|
|
25153
|
+
if (props) {
|
|
25154
|
+
_this.fromData(props);
|
|
25155
|
+
}
|
|
25156
|
+
return _this;
|
|
25157
|
+
}
|
|
25158
|
+
var _proto = Sprite.prototype;
|
|
25159
|
+
_proto.fromData = function fromData(data) {
|
|
25160
|
+
EffectsObject.prototype.fromData.call(this, data);
|
|
25161
|
+
// findObject 对 Texture 实例原样返回,对 {id} 解析为 Texture 实例,
|
|
25162
|
+
// 兼容反序列化(data.texture 为 {id})与手动构造(data.texture 为 Texture 实例)两条路径。
|
|
25163
|
+
this.texture = data.texture ? this.engine.findObject(data.texture) : this.engine.whiteTexture;
|
|
25164
|
+
var _data_rect;
|
|
25165
|
+
this.rect = (_data_rect = data.rect) != null ? _data_rect : [
|
|
25166
|
+
0,
|
|
25167
|
+
0,
|
|
25168
|
+
1,
|
|
25169
|
+
1
|
|
25170
|
+
];
|
|
25171
|
+
var _data_rotation;
|
|
25172
|
+
this.rotation = (_data_rotation = data.rotation) != null ? _data_rotation : 0;
|
|
25173
|
+
};
|
|
25174
|
+
return Sprite;
|
|
25175
|
+
}(EffectsObject);
|
|
25176
|
+
exports.Sprite = __decorate([
|
|
25177
|
+
effectsClass("Sprite")
|
|
25178
|
+
], exports.Sprite);
|
|
25179
|
+
|
|
24941
25180
|
/**
|
|
24942
25181
|
* 动画图可播放节点对象
|
|
24943
25182
|
* @since 2.0.0
|
|
@@ -25524,6 +25763,36 @@ var SpriteColorMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
|
|
|
25524
25763
|
return SpriteColorMixerPlayable;
|
|
25525
25764
|
}(TrackMixerPlayable);
|
|
25526
25765
|
|
|
25766
|
+
/**
|
|
25767
|
+
* Sprite 属性 K 帧 mixer。对象引用不混合:取首个激活 clip 的阶梯采样值,
|
|
25768
|
+
* 赋值 boundObject.sprite 触发 setter(同步纹理 + 重建 UV)。
|
|
25769
|
+
* 不继承 PropertyMixerPlayable(其 evaluate 开头"读当前值为 null 则 return"
|
|
25770
|
+
* 会阻断无初始 sprite 组件的 K 帧)。
|
|
25771
|
+
*/ var SpritePropertyMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
|
|
25772
|
+
_inherits(SpritePropertyMixerPlayable, TrackMixerPlayable);
|
|
25773
|
+
function SpritePropertyMixerPlayable() {
|
|
25774
|
+
return TrackMixerPlayable.apply(this, arguments);
|
|
25775
|
+
}
|
|
25776
|
+
var _proto = SpritePropertyMixerPlayable.prototype;
|
|
25777
|
+
_proto.evaluate = function evaluate(context) {
|
|
25778
|
+
var boundObject = context.output.getUserData();
|
|
25779
|
+
if (!boundObject) {
|
|
25780
|
+
return;
|
|
25781
|
+
}
|
|
25782
|
+
// 对象引用不混合:取首个激活 clip 的采样值
|
|
25783
|
+
for(var i = 0; i < this.clipPlayables.length; i++){
|
|
25784
|
+
if (this.getClipWeight(i) > 0) {
|
|
25785
|
+
var clip = this.getClipPlayable(i);
|
|
25786
|
+
if (_instanceof1(clip, PropertyClipPlayable) && clip.value) {
|
|
25787
|
+
boundObject.sprite = clip.value;
|
|
25788
|
+
}
|
|
25789
|
+
break;
|
|
25790
|
+
}
|
|
25791
|
+
}
|
|
25792
|
+
};
|
|
25793
|
+
return SpritePropertyMixerPlayable;
|
|
25794
|
+
}(TrackMixerPlayable);
|
|
25795
|
+
|
|
25527
25796
|
var SubCompositionClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
25528
25797
|
_inherits(SubCompositionClipPlayable, Playable);
|
|
25529
25798
|
function SubCompositionClipPlayable() {
|
|
@@ -25567,94 +25836,148 @@ var SubCompositionMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
|
|
|
25567
25836
|
return SubCompositionMixerPlayable;
|
|
25568
25837
|
}(TrackMixerPlayable);
|
|
25569
25838
|
|
|
25570
|
-
|
|
25571
|
-
|
|
25572
|
-
|
|
25573
|
-
|
|
25574
|
-
|
|
25575
|
-
|
|
25576
|
-
|
|
25577
|
-
|
|
25578
|
-
|
|
25579
|
-
|
|
25580
|
-
|
|
25581
|
-
|
|
25582
|
-
|
|
25583
|
-
|
|
25584
|
-
|
|
25585
|
-
|
|
25586
|
-
|
|
25587
|
-
|
|
25588
|
-
|
|
25589
|
-
this.
|
|
25590
|
-
|
|
25591
|
-
|
|
25592
|
-
|
|
25593
|
-
|
|
25594
|
-
|
|
25595
|
-
|
|
25596
|
-
|
|
25597
|
-
|
|
25598
|
-
|
|
25599
|
-
|
|
25600
|
-
|
|
25601
|
-
|
|
25602
|
-
|
|
25603
|
-
|
|
25604
|
-
|
|
25605
|
-
|
|
25606
|
-
|
|
25607
|
-
|
|
25608
|
-
this.
|
|
25609
|
-
this.
|
|
25610
|
-
|
|
25611
|
-
|
|
25612
|
-
|
|
25613
|
-
|
|
25614
|
-
|
|
25615
|
-
|
|
25616
|
-
|
|
25617
|
-
|
|
25618
|
-
|
|
25619
|
-
|
|
25620
|
-
|
|
25621
|
-
|
|
25622
|
-
|
|
25623
|
-
|
|
25624
|
-
|
|
25625
|
-
|
|
25626
|
-
|
|
25627
|
-
|
|
25628
|
-
|
|
25839
|
+
/**
|
|
25840
|
+
* 对 TransformTrack 当前激活的 Transform clip contribution 做帧内合成。
|
|
25841
|
+
* position 与 rotation 使用增量语义,scale 使用乘子语义;结果由 flush 统一写回。
|
|
25842
|
+
*/ var TransformClipMixer = /*#__PURE__*/ function() {
|
|
25843
|
+
function TransformClipMixer() {
|
|
25844
|
+
this.hasContribution = false;
|
|
25845
|
+
this.hasPosition = false;
|
|
25846
|
+
this.hasRotation = false;
|
|
25847
|
+
this.hasScale = false;
|
|
25848
|
+
this.appliedPosition = false;
|
|
25849
|
+
this.appliedRotation = false;
|
|
25850
|
+
this.appliedScale = false;
|
|
25851
|
+
this.outPos = new Vector3();
|
|
25852
|
+
this.outRot = new Euler();
|
|
25853
|
+
this.outScale = new Vector3(1, 1, 1);
|
|
25854
|
+
this.weightedRot = new Euler();
|
|
25855
|
+
}
|
|
25856
|
+
var _proto = TransformClipMixer.prototype;
|
|
25857
|
+
_proto.captureBasePose = function captureBasePose(item) {
|
|
25858
|
+
this.ensureBasePose(item);
|
|
25859
|
+
};
|
|
25860
|
+
/**
|
|
25861
|
+
* orbital position 的 contribution 依赖 base position。
|
|
25862
|
+
* 这里返回 mixer 持有的 base,确保采样和合成使用同一份参考姿态。
|
|
25863
|
+
*/ _proto.getBasePosition = function getBasePosition() {
|
|
25864
|
+
var _this_basePose;
|
|
25865
|
+
return (_this_basePose = this.basePose) == null ? void 0 : _this_basePose.position;
|
|
25866
|
+
};
|
|
25867
|
+
_proto.resetFrame = function resetFrame() {
|
|
25868
|
+
this.hasContribution = false;
|
|
25869
|
+
this.hasPosition = false;
|
|
25870
|
+
this.hasRotation = false;
|
|
25871
|
+
this.hasScale = false;
|
|
25872
|
+
};
|
|
25873
|
+
_proto.addContribution = function addContribution(item, contribution, weight) {
|
|
25874
|
+
if (weight <= 0) {
|
|
25875
|
+
return;
|
|
25876
|
+
}
|
|
25877
|
+
this.ensureBasePose(item);
|
|
25878
|
+
if (!this.hasContribution) {
|
|
25879
|
+
var base = this.basePose;
|
|
25880
|
+
this.outPos.copyFrom(base.position);
|
|
25881
|
+
this.outRot.copyFrom(base.rotation);
|
|
25882
|
+
this.outScale.copyFrom(base.scale);
|
|
25883
|
+
this.hasContribution = true;
|
|
25884
|
+
}
|
|
25885
|
+
if (contribution.hasPosition) {
|
|
25886
|
+
this.hasPosition = true;
|
|
25887
|
+
this.outPos.x += contribution.position.x * weight;
|
|
25888
|
+
this.outPos.y += contribution.position.y * weight;
|
|
25889
|
+
this.outPos.z += contribution.position.z * weight;
|
|
25890
|
+
}
|
|
25891
|
+
if (contribution.hasRotation) {
|
|
25892
|
+
this.hasRotation = true;
|
|
25893
|
+
this.weightedRot.set(contribution.rotation.x * weight, contribution.rotation.y * weight, contribution.rotation.z * weight, contribution.rotation.order);
|
|
25894
|
+
this.outRot.addEulers(this.outRot, this.weightedRot);
|
|
25895
|
+
}
|
|
25896
|
+
if (contribution.hasScale) {
|
|
25897
|
+
this.hasScale = true;
|
|
25898
|
+
// Scale contribution 使用乘子语义,weight 用于支持 clip blend/crossfade。
|
|
25899
|
+
this.outScale.x *= Math.pow(contribution.scale.x, weight);
|
|
25900
|
+
this.outScale.y *= Math.pow(contribution.scale.y, weight);
|
|
25901
|
+
this.outScale.z *= Math.pow(contribution.scale.z, weight);
|
|
25902
|
+
}
|
|
25903
|
+
};
|
|
25904
|
+
_proto.flush = function flush(item) {
|
|
25905
|
+
var base = this.basePose;
|
|
25906
|
+
if (!base || !this.hasContribution && !this.appliedPosition && !this.appliedRotation && !this.appliedScale) {
|
|
25907
|
+
return;
|
|
25908
|
+
}
|
|
25909
|
+
if (this.hasPosition) {
|
|
25910
|
+
item.transform.setPosition(this.outPos.x, this.outPos.y, this.outPos.z);
|
|
25911
|
+
this.appliedPosition = true;
|
|
25912
|
+
} else if (this.appliedPosition) {
|
|
25913
|
+
item.transform.setPosition(base.position.x, base.position.y, base.position.z);
|
|
25914
|
+
this.appliedPosition = false;
|
|
25915
|
+
}
|
|
25916
|
+
if (this.hasRotation) {
|
|
25917
|
+
item.transform.setRotation(this.outRot.x, this.outRot.y, this.outRot.z);
|
|
25918
|
+
this.appliedRotation = true;
|
|
25919
|
+
} else if (this.appliedRotation) {
|
|
25920
|
+
item.transform.setRotation(base.rotation.x, base.rotation.y, base.rotation.z);
|
|
25921
|
+
this.appliedRotation = false;
|
|
25922
|
+
}
|
|
25923
|
+
if (this.hasScale) {
|
|
25924
|
+
item.transform.setScale(this.outScale.x, this.outScale.y, this.outScale.z);
|
|
25925
|
+
this.appliedScale = true;
|
|
25926
|
+
} else if (this.appliedScale) {
|
|
25927
|
+
item.transform.setScale(base.scale.x, base.scale.y, base.scale.z);
|
|
25928
|
+
this.appliedScale = false;
|
|
25929
|
+
}
|
|
25629
25930
|
};
|
|
25630
|
-
_proto.
|
|
25631
|
-
|
|
25632
|
-
|
|
25633
|
-
|
|
25931
|
+
_proto.dispose = function dispose() {
|
|
25932
|
+
this.basePose = undefined;
|
|
25933
|
+
this.boundInstanceId = undefined;
|
|
25934
|
+
this.appliedPosition = false;
|
|
25935
|
+
this.appliedRotation = false;
|
|
25936
|
+
this.appliedScale = false;
|
|
25937
|
+
this.resetFrame();
|
|
25938
|
+
};
|
|
25939
|
+
_proto.ensureBasePose = function ensureBasePose(item) {
|
|
25940
|
+
if (!this.basePose || this.boundInstanceId !== item.getInstanceId()) {
|
|
25941
|
+
var scale = item.transform.scale;
|
|
25942
|
+
this.basePose = {
|
|
25943
|
+
position: item.transform.position.clone(),
|
|
25944
|
+
rotation: item.transform.getRotation().clone(),
|
|
25945
|
+
scale: new Vector3(scale.x, scale.y, scale.x)
|
|
25946
|
+
};
|
|
25947
|
+
this.boundInstanceId = item.getInstanceId();
|
|
25948
|
+
this.appliedPosition = false;
|
|
25949
|
+
this.appliedRotation = false;
|
|
25950
|
+
this.appliedScale = false;
|
|
25951
|
+
}
|
|
25634
25952
|
};
|
|
25635
|
-
return
|
|
25636
|
-
}(
|
|
25953
|
+
return TransformClipMixer;
|
|
25954
|
+
}();
|
|
25637
25955
|
|
|
25638
25956
|
var tempRot$1 = new Euler();
|
|
25639
|
-
var tempSize$1 = new Vector3(1, 1, 1);
|
|
25640
25957
|
var tempPos = new Vector3();
|
|
25958
|
+
var createEmptyContribution = function() {
|
|
25959
|
+
return {
|
|
25960
|
+
hasPosition: false,
|
|
25961
|
+
position: new Vector3(),
|
|
25962
|
+
hasRotation: false,
|
|
25963
|
+
rotation: new Euler(),
|
|
25964
|
+
hasScale: false,
|
|
25965
|
+
scale: new Vector3(1, 1, 1)
|
|
25966
|
+
};
|
|
25967
|
+
};
|
|
25641
25968
|
/**
|
|
25642
25969
|
* @since 2.0.0
|
|
25643
25970
|
*/ var TransformPlayable = /*#__PURE__*/ function(Playable) {
|
|
25644
25971
|
_inherits(TransformPlayable, Playable);
|
|
25645
25972
|
function TransformPlayable() {
|
|
25646
|
-
|
|
25973
|
+
var _this;
|
|
25974
|
+
_this = Playable.apply(this, arguments) || this;
|
|
25975
|
+
_this.started = false;
|
|
25976
|
+
_this.contribution = createEmptyContribution();
|
|
25977
|
+
return _this;
|
|
25647
25978
|
}
|
|
25648
25979
|
var _proto = TransformPlayable.prototype;
|
|
25649
25980
|
_proto.start = function start() {
|
|
25650
|
-
var boundItem = this.boundObject;
|
|
25651
|
-
var scale = boundItem.transform.scale;
|
|
25652
|
-
this.originalTransform = {
|
|
25653
|
-
position: boundItem.transform.position.clone(),
|
|
25654
|
-
rotation: boundItem.transform.getRotation().clone(),
|
|
25655
|
-
// TODO 编辑器 scale 没有z轴控制
|
|
25656
|
-
scale: new Vector3(scale.x, scale.y, scale.x)
|
|
25657
|
-
};
|
|
25658
25981
|
var positionOverLifetime = this.data.positionOverLifetime;
|
|
25659
25982
|
var rotationOverLifetime = this.data.rotationOverLifetime;
|
|
25660
25983
|
var sizeOverLifetime = this.data.sizeOverLifetime;
|
|
@@ -25662,7 +25985,7 @@ var tempPos = new Vector3();
|
|
|
25662
25985
|
if (positionOverLifetime && Object.keys(positionOverLifetime).length !== 0) {
|
|
25663
25986
|
this.positionOverLifetime = positionOverLifetime;
|
|
25664
25987
|
if (positionOverLifetime.path) {
|
|
25665
|
-
this.
|
|
25988
|
+
this.pathGetter = createValueGetter(positionOverLifetime.path);
|
|
25666
25989
|
}
|
|
25667
25990
|
var linearVelEnable = positionOverLifetime.linearX || positionOverLifetime.linearY || positionOverLifetime.linearZ;
|
|
25668
25991
|
if (linearVelEnable) {
|
|
@@ -25718,37 +26041,53 @@ var tempPos = new Vector3();
|
|
|
25718
26041
|
this.velocity.multiply(this.startSpeed);
|
|
25719
26042
|
};
|
|
25720
26043
|
_proto.processFrame = function processFrame(context) {
|
|
25721
|
-
|
|
25722
|
-
|
|
25723
|
-
|
|
25724
|
-
|
|
25725
|
-
this.start();
|
|
25726
|
-
}
|
|
25727
|
-
}
|
|
25728
|
-
if (this.boundObject && this.boundObject.composition) {
|
|
25729
|
-
this.sampleAnimation();
|
|
26044
|
+
this.ensureStarted();
|
|
26045
|
+
var boundObject = context.output.getUserData();
|
|
26046
|
+
if (!this.originalTransform && _instanceof1(boundObject, exports.VFXItem)) {
|
|
26047
|
+
this.captureOriginalTransform(boundObject);
|
|
25730
26048
|
}
|
|
25731
26049
|
};
|
|
25732
26050
|
/**
|
|
25733
|
-
*
|
|
25734
|
-
|
|
26051
|
+
* 采样当前帧相对 base pose 的 transform contribution。
|
|
26052
|
+
* 返回值为内部复用对象,调用方应在当前帧同步消费,不应缓存。
|
|
26053
|
+
* @param basePosition - orbital position 计算 contribution 时使用的参考位置。
|
|
26054
|
+
*/ _proto.getContribution = function getContribution(basePosition) {
|
|
26055
|
+
this.ensureStarted();
|
|
26056
|
+
this.sampleAnimation(basePosition);
|
|
26057
|
+
return this.contribution;
|
|
26058
|
+
};
|
|
26059
|
+
_proto.ensureStarted = function ensureStarted() {
|
|
26060
|
+
if (!this.started) {
|
|
26061
|
+
this.start();
|
|
26062
|
+
this.started = true;
|
|
26063
|
+
}
|
|
26064
|
+
};
|
|
26065
|
+
_proto.sampleAnimation = function sampleAnimation(basePosition) {
|
|
25735
26066
|
var _this = this;
|
|
25736
|
-
var
|
|
26067
|
+
var out = this.contribution;
|
|
26068
|
+
out.hasPosition = false;
|
|
26069
|
+
out.hasRotation = false;
|
|
26070
|
+
out.hasScale = false;
|
|
25737
26071
|
var duration = this.getDuration();
|
|
26072
|
+
if (duration <= 0) {
|
|
26073
|
+
return;
|
|
26074
|
+
}
|
|
25738
26075
|
var life = this.time / duration;
|
|
25739
26076
|
life = life < 0 ? 0 : life;
|
|
25740
26077
|
if (this.sizeXOverLifetime) {
|
|
25741
|
-
|
|
26078
|
+
out.hasScale = true;
|
|
26079
|
+
out.scale.x = this.sizeXOverLifetime.getValue(life);
|
|
25742
26080
|
if (this.sizeSeparateAxes) {
|
|
25743
|
-
|
|
25744
|
-
|
|
26081
|
+
out.scale.y = this.sizeYOverLifetime.getValue(life);
|
|
26082
|
+
out.scale.z = this.sizeZOverLifetime.getValue(life);
|
|
25745
26083
|
} else {
|
|
25746
|
-
|
|
26084
|
+
out.scale.z = out.scale.y = out.scale.x;
|
|
25747
26085
|
}
|
|
25748
|
-
|
|
25749
|
-
|
|
26086
|
+
} else {
|
|
26087
|
+
out.hasScale = false;
|
|
25750
26088
|
}
|
|
25751
26089
|
if (this.rotationOverLifetime) {
|
|
26090
|
+
out.hasRotation = true;
|
|
25752
26091
|
var func = function(v) {
|
|
25753
26092
|
return _this.rotationOverLifetime.asRotation ? v.getValue(life) : v.getIntegrateValue(0, life, duration);
|
|
25754
26093
|
};
|
|
@@ -25757,16 +26096,42 @@ var tempPos = new Vector3();
|
|
|
25757
26096
|
tempRot$1.x = separateAxes ? func(this.rotationOverLifetime.x) : 0;
|
|
25758
26097
|
tempRot$1.y = separateAxes ? func(this.rotationOverLifetime.y) : 0;
|
|
25759
26098
|
tempRot$1.z = incZ;
|
|
25760
|
-
|
|
25761
|
-
|
|
26099
|
+
out.rotation.copyFrom(tempRot$1);
|
|
26100
|
+
} else {
|
|
26101
|
+
out.hasRotation = false;
|
|
25762
26102
|
}
|
|
25763
26103
|
if (this.positionOverLifetime) {
|
|
25764
|
-
var
|
|
25765
|
-
|
|
25766
|
-
|
|
25767
|
-
|
|
26104
|
+
var _this_orbitalVelOverLifetime;
|
|
26105
|
+
out.hasPosition = true;
|
|
26106
|
+
// Orbital position 依赖参考位置;普通 position 可直接从零向量采样位移贡献。
|
|
26107
|
+
var orbitalEnabled = !!((_this_orbitalVelOverLifetime = this.orbitalVelOverLifetime) == null ? void 0 : _this_orbitalVelOverLifetime.enabled);
|
|
26108
|
+
if (orbitalEnabled && basePosition) {
|
|
26109
|
+
calculateTranslation(out.position, this, this.gravity, this.time, duration, basePosition, this.velocity);
|
|
26110
|
+
if (this.pathGetter) {
|
|
26111
|
+
out.position.add(this.pathGetter.getValue(life));
|
|
26112
|
+
}
|
|
26113
|
+
out.position.subtract(basePosition);
|
|
26114
|
+
} else {
|
|
26115
|
+
tempPos.set(0, 0, 0);
|
|
26116
|
+
calculateTranslation(out.position, this, this.gravity, this.time, duration, tempPos, this.velocity);
|
|
26117
|
+
if (this.pathGetter) {
|
|
26118
|
+
out.position.add(this.pathGetter.getValue(life));
|
|
26119
|
+
}
|
|
25768
26120
|
}
|
|
25769
|
-
|
|
26121
|
+
} else {
|
|
26122
|
+
out.hasPosition = false;
|
|
26123
|
+
}
|
|
26124
|
+
};
|
|
26125
|
+
_proto.captureOriginalTransform = function captureOriginalTransform(boundItem) {
|
|
26126
|
+
var scale = boundItem.transform.scale;
|
|
26127
|
+
this.originalTransform = {
|
|
26128
|
+
position: boundItem.transform.position.clone(),
|
|
26129
|
+
rotation: boundItem.transform.getRotation().clone(),
|
|
26130
|
+
// TODO 编辑器 scale 没有z轴控制
|
|
26131
|
+
scale: new Vector3(scale.x, scale.y, scale.x)
|
|
26132
|
+
};
|
|
26133
|
+
if (this.pathGetter) {
|
|
26134
|
+
this.originalTransform.path = this.pathGetter;
|
|
25770
26135
|
}
|
|
25771
26136
|
};
|
|
25772
26137
|
return TransformPlayable;
|
|
@@ -25791,6 +26156,104 @@ exports.TransformPlayableAsset = __decorate([
|
|
|
25791
26156
|
effectsClass(DataType.TransformPlayableAsset)
|
|
25792
26157
|
], exports.TransformPlayableAsset);
|
|
25793
26158
|
|
|
26159
|
+
/**
|
|
26160
|
+
* TransformTrack 的 mixer。
|
|
26161
|
+
* 收集当前激活的 Transform clip contribution,并委托 TransformClipMixer 合成当前帧输出。
|
|
26162
|
+
*/ var TransformMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
|
|
26163
|
+
_inherits(TransformMixerPlayable, TrackMixerPlayable);
|
|
26164
|
+
function TransformMixerPlayable() {
|
|
26165
|
+
var _this;
|
|
26166
|
+
_this = TrackMixerPlayable.apply(this, arguments) || this;
|
|
26167
|
+
_this.clipMixer = new TransformClipMixer();
|
|
26168
|
+
return _this;
|
|
26169
|
+
}
|
|
26170
|
+
var _proto = TransformMixerPlayable.prototype;
|
|
26171
|
+
_proto.dispose = function dispose() {
|
|
26172
|
+
this.clipMixer.dispose();
|
|
26173
|
+
TrackMixerPlayable.prototype.dispose.call(this);
|
|
26174
|
+
};
|
|
26175
|
+
_proto.evaluate = function evaluate(context) {
|
|
26176
|
+
var item = context.output.getUserData();
|
|
26177
|
+
if (!_instanceof1(item, exports.VFXItem)) {
|
|
26178
|
+
return;
|
|
26179
|
+
}
|
|
26180
|
+
this.clipMixer.captureBasePose(item);
|
|
26181
|
+
this.clipMixer.resetFrame();
|
|
26182
|
+
for(var i = 0; i < this.clipPlayables.length; i++){
|
|
26183
|
+
var weight = this.clipWeights[i];
|
|
26184
|
+
// RuntimeClip 会把已结束且 destroy 的 clip 权重置 0,这类 clip 不参与当前帧合成。
|
|
26185
|
+
if (!weight || weight <= 0) {
|
|
26186
|
+
continue;
|
|
26187
|
+
}
|
|
26188
|
+
var playable = this.clipPlayables[i];
|
|
26189
|
+
if (!_instanceof1(playable, TransformPlayable)) {
|
|
26190
|
+
continue;
|
|
26191
|
+
}
|
|
26192
|
+
this.clipMixer.addContribution(item, playable.getContribution(this.clipMixer.getBasePosition()), weight);
|
|
26193
|
+
}
|
|
26194
|
+
this.clipMixer.flush(item);
|
|
26195
|
+
};
|
|
26196
|
+
return TransformMixerPlayable;
|
|
26197
|
+
}(TrackMixerPlayable);
|
|
26198
|
+
|
|
26199
|
+
var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(PropertyMixerPlayable) {
|
|
26200
|
+
_inherits(Vector4PropertyMixerPlayable, PropertyMixerPlayable);
|
|
26201
|
+
function Vector4PropertyMixerPlayable() {
|
|
26202
|
+
return PropertyMixerPlayable.apply(this, arguments);
|
|
26203
|
+
}
|
|
26204
|
+
var _proto = Vector4PropertyMixerPlayable.prototype;
|
|
26205
|
+
_proto.resetPropertyValue = function resetPropertyValue() {
|
|
26206
|
+
this.propertyValue.x = 0;
|
|
26207
|
+
this.propertyValue.y = 0;
|
|
26208
|
+
this.propertyValue.z = 0;
|
|
26209
|
+
this.propertyValue.w = 0;
|
|
26210
|
+
};
|
|
26211
|
+
_proto.addWeightedValue = function addWeightedValue(curveValue, weight) {
|
|
26212
|
+
var result = this.propertyValue;
|
|
26213
|
+
result.x += curveValue.x * weight;
|
|
26214
|
+
result.y += curveValue.y * weight;
|
|
26215
|
+
result.z += curveValue.z * weight;
|
|
26216
|
+
result.w += curveValue.w * weight;
|
|
26217
|
+
};
|
|
26218
|
+
return Vector4PropertyMixerPlayable;
|
|
26219
|
+
}(PropertyMixerPlayable);
|
|
26220
|
+
var Vector3PropertyMixerPlayable = /*#__PURE__*/ function(PropertyMixerPlayable) {
|
|
26221
|
+
_inherits(Vector3PropertyMixerPlayable, PropertyMixerPlayable);
|
|
26222
|
+
function Vector3PropertyMixerPlayable() {
|
|
26223
|
+
return PropertyMixerPlayable.apply(this, arguments);
|
|
26224
|
+
}
|
|
26225
|
+
var _proto = Vector3PropertyMixerPlayable.prototype;
|
|
26226
|
+
_proto.resetPropertyValue = function resetPropertyValue() {
|
|
26227
|
+
this.propertyValue.x = 0;
|
|
26228
|
+
this.propertyValue.y = 0;
|
|
26229
|
+
this.propertyValue.z = 0;
|
|
26230
|
+
};
|
|
26231
|
+
_proto.addWeightedValue = function addWeightedValue(curveValue, weight) {
|
|
26232
|
+
var result = this.propertyValue;
|
|
26233
|
+
result.x += curveValue.x * weight;
|
|
26234
|
+
result.y += curveValue.y * weight;
|
|
26235
|
+
result.z += curveValue.z * weight;
|
|
26236
|
+
};
|
|
26237
|
+
return Vector3PropertyMixerPlayable;
|
|
26238
|
+
}(PropertyMixerPlayable);
|
|
26239
|
+
var Vector2PropertyMixerPlayable = /*#__PURE__*/ function(PropertyMixerPlayable) {
|
|
26240
|
+
_inherits(Vector2PropertyMixerPlayable, PropertyMixerPlayable);
|
|
26241
|
+
function Vector2PropertyMixerPlayable() {
|
|
26242
|
+
return PropertyMixerPlayable.apply(this, arguments);
|
|
26243
|
+
}
|
|
26244
|
+
var _proto = Vector2PropertyMixerPlayable.prototype;
|
|
26245
|
+
_proto.resetPropertyValue = function resetPropertyValue() {
|
|
26246
|
+
this.propertyValue.x = 0;
|
|
26247
|
+
this.propertyValue.y = 0;
|
|
26248
|
+
};
|
|
26249
|
+
_proto.addWeightedValue = function addWeightedValue(curveValue, weight) {
|
|
26250
|
+
var result = this.propertyValue;
|
|
26251
|
+
result.x += curveValue.x * weight;
|
|
26252
|
+
result.y += curveValue.y * weight;
|
|
26253
|
+
};
|
|
26254
|
+
return Vector2PropertyMixerPlayable;
|
|
26255
|
+
}(PropertyMixerPlayable);
|
|
26256
|
+
|
|
25794
26257
|
/**
|
|
25795
26258
|
* @since 2.0.0
|
|
25796
26259
|
*/ var TimelineClip = /*#__PURE__*/ function() {
|
|
@@ -26180,6 +26643,24 @@ exports.ColorPropertyTrack = __decorate([
|
|
|
26180
26643
|
effectsClass(DataType.ColorPropertyTrack)
|
|
26181
26644
|
], exports.ColorPropertyTrack);
|
|
26182
26645
|
|
|
26646
|
+
exports.SpritePropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
|
|
26647
|
+
_inherits(SpritePropertyTrack, PropertyTrack);
|
|
26648
|
+
function SpritePropertyTrack() {
|
|
26649
|
+
return PropertyTrack.apply(this, arguments);
|
|
26650
|
+
}
|
|
26651
|
+
var _proto = SpritePropertyTrack.prototype;
|
|
26652
|
+
_proto.createTrackMixer = function createTrackMixer() {
|
|
26653
|
+
return new SpritePropertyMixerPlayable();
|
|
26654
|
+
};
|
|
26655
|
+
_proto.updateAnimatedObject = function updateAnimatedObject(boundObject) {
|
|
26656
|
+
return boundObject.getComponent(exports.SpriteComponent);
|
|
26657
|
+
};
|
|
26658
|
+
return SpritePropertyTrack;
|
|
26659
|
+
}(PropertyTrack);
|
|
26660
|
+
exports.SpritePropertyTrack = __decorate([
|
|
26661
|
+
effectsClass("SpritePropertyTrack")
|
|
26662
|
+
], exports.SpritePropertyTrack);
|
|
26663
|
+
|
|
26183
26664
|
var Cone = /*#__PURE__*/ function() {
|
|
26184
26665
|
function Cone(props) {
|
|
26185
26666
|
var _this = this;
|
|
@@ -29684,8 +30165,6 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
29684
30165
|
occlusion: !!renderer.occlusion,
|
|
29685
30166
|
transparentOcclusion: !!renderer.transparentOcclusion,
|
|
29686
30167
|
maxCount: options.maxCount,
|
|
29687
|
-
mask: this.maskManager.getRefValue(),
|
|
29688
|
-
maskMode: this.maskManager.maskMode,
|
|
29689
30168
|
forceTarget: forceTarget,
|
|
29690
30169
|
diffuse: renderer.texture ? this.engine.findObject(renderer.texture) : undefined,
|
|
29691
30170
|
sizeOverLifetime: sizeOverLifetimeGetter,
|
|
@@ -29780,9 +30259,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
29780
30259
|
shaderCachePrefix: shaderCachePrefix,
|
|
29781
30260
|
lifetime: this.trails.lifetime,
|
|
29782
30261
|
occlusion: !!trails.occlusion,
|
|
29783
|
-
transparentOcclusion: !!trails.transparentOcclusion
|
|
29784
|
-
mask: this.maskManager.getRefValue(),
|
|
29785
|
-
maskMode: this.maskManager.maskMode
|
|
30262
|
+
transparentOcclusion: !!trails.transparentOcclusion
|
|
29786
30263
|
};
|
|
29787
30264
|
if (trails.colorOverLifetime && trails.colorOverLifetime[0] === ValueType.GRADIENT_COLOR) {
|
|
29788
30265
|
trailMeshProps.colorOverLifetime = trails.colorOverLifetime[1];
|
|
@@ -30011,6 +30488,44 @@ exports.FloatPropertyPlayableAsset = __decorate([
|
|
|
30011
30488
|
effectsClass(DataType.FloatPropertyPlayableAsset)
|
|
30012
30489
|
], exports.FloatPropertyPlayableAsset);
|
|
30013
30490
|
|
|
30491
|
+
exports.SpritePropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
30492
|
+
_inherits(SpritePropertyPlayableAsset, PlayableAsset);
|
|
30493
|
+
function SpritePropertyPlayableAsset() {
|
|
30494
|
+
var _this;
|
|
30495
|
+
_this = PlayableAsset.apply(this, arguments) || this;
|
|
30496
|
+
_this.curveData = [
|
|
30497
|
+
REFERENCE_CURVE,
|
|
30498
|
+
[]
|
|
30499
|
+
];
|
|
30500
|
+
return _this;
|
|
30501
|
+
}
|
|
30502
|
+
var _proto = SpritePropertyPlayableAsset.prototype;
|
|
30503
|
+
_proto.fromData = function fromData(data) {
|
|
30504
|
+
PlayableAsset.prototype.fromData.call(this, data);
|
|
30505
|
+
var items = data.curveData[1];
|
|
30506
|
+
// 把 DataPath 解析为 Sprite 实例
|
|
30507
|
+
var referenceCurveData = [];
|
|
30508
|
+
for(var i = 0; i < items.length; i++){
|
|
30509
|
+
var _items_i = items[i], t = _items_i[0], ref = _items_i[1];
|
|
30510
|
+
referenceCurveData.push([
|
|
30511
|
+
t,
|
|
30512
|
+
this.engine.findObject(ref)
|
|
30513
|
+
]);
|
|
30514
|
+
}
|
|
30515
|
+
this.curveData[1] = referenceCurveData;
|
|
30516
|
+
};
|
|
30517
|
+
_proto.createPlayable = function createPlayable() {
|
|
30518
|
+
var clip = new PropertyClipPlayable();
|
|
30519
|
+
clip.curve = createValueGetter(this.curveData);
|
|
30520
|
+
clip.value = clip.curve.getValue(0);
|
|
30521
|
+
return clip;
|
|
30522
|
+
};
|
|
30523
|
+
return SpritePropertyPlayableAsset;
|
|
30524
|
+
}(PlayableAsset);
|
|
30525
|
+
exports.SpritePropertyPlayableAsset = __decorate([
|
|
30526
|
+
effectsClass("SpritePropertyPlayableAsset")
|
|
30527
|
+
], exports.SpritePropertyPlayableAsset);
|
|
30528
|
+
|
|
30014
30529
|
exports.SubCompositionPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
30015
30530
|
_inherits(SubCompositionPlayableAsset, PlayableAsset);
|
|
30016
30531
|
function SubCompositionPlayableAsset() {
|
|
@@ -30258,15 +30773,6 @@ var TimelineInstance = /*#__PURE__*/ function() {
|
|
|
30258
30773
|
return TimelineInstance;
|
|
30259
30774
|
}();
|
|
30260
30775
|
|
|
30261
|
-
var singleSplits = [
|
|
30262
|
-
[
|
|
30263
|
-
0,
|
|
30264
|
-
0,
|
|
30265
|
-
1,
|
|
30266
|
-
1,
|
|
30267
|
-
0
|
|
30268
|
-
]
|
|
30269
|
-
];
|
|
30270
30776
|
var seed$2 = 0;
|
|
30271
30777
|
exports.SpriteColorPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
30272
30778
|
_inherits(SpriteColorPlayableAsset, PlayableAsset);
|
|
@@ -30354,9 +30860,6 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30354
30860
|
_this = MaskableGraphic.call(this, engine) || this;
|
|
30355
30861
|
_this.time = 0;
|
|
30356
30862
|
_this.duration = 1;
|
|
30357
|
-
/**
|
|
30358
|
-
* @internal
|
|
30359
|
-
*/ _this.splits = singleSplits;
|
|
30360
30863
|
_this.name = "MSprite" + seed$2++;
|
|
30361
30864
|
if (props) {
|
|
30362
30865
|
_this.fromData(props);
|
|
@@ -30390,38 +30893,33 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30390
30893
|
if (textureAnimation) {
|
|
30391
30894
|
var _this_material_getVector4;
|
|
30392
30895
|
var total = textureAnimation.total || textureAnimation.row * textureAnimation.col;
|
|
30393
|
-
|
|
30394
|
-
|
|
30395
|
-
var
|
|
30396
|
-
var
|
|
30397
|
-
var
|
|
30398
|
-
|
|
30399
|
-
|
|
30400
|
-
|
|
30401
|
-
|
|
30402
|
-
|
|
30403
|
-
|
|
30404
|
-
|
|
30405
|
-
|
|
30406
|
-
|
|
30407
|
-
|
|
30408
|
-
|
|
30409
|
-
|
|
30410
|
-
|
|
30411
|
-
|
|
30412
|
-
|
|
30413
|
-
|
|
30414
|
-
dy = 1 / textureAnimation.col * texRectH;
|
|
30415
|
-
} else {
|
|
30416
|
-
dx = 1 / textureAnimation.col * texRectW;
|
|
30417
|
-
dy = 1 / textureAnimation.row * texRectH;
|
|
30418
|
-
}
|
|
30896
|
+
// 帧动画不与多 split(splits.length>1)同时存在,故此处仅读 sprite 单 rect。
|
|
30897
|
+
// sprite 缺省时按整图 [0,0,1,1] 不旋转处理。
|
|
30898
|
+
var sprite = this.sprite;
|
|
30899
|
+
var _sprite_rect;
|
|
30900
|
+
var rect = (_sprite_rect = sprite == null ? void 0 : sprite.rect) != null ? _sprite_rect : [
|
|
30901
|
+
0,
|
|
30902
|
+
0,
|
|
30903
|
+
1,
|
|
30904
|
+
1
|
|
30905
|
+
];
|
|
30906
|
+
var _sprite_rotation;
|
|
30907
|
+
var flip = (_sprite_rotation = sprite == null ? void 0 : sprite.rotation) != null ? _sprite_rotation : exports.SpriteRotation.None;
|
|
30908
|
+
var isRotate90 = flip === exports.SpriteRotation.Rotate90;
|
|
30909
|
+
// rect 在纹理上的归一化矩形 [x, y, w, h];旋转 90° 时宽高互换。
|
|
30910
|
+
var rectX = rect[0];
|
|
30911
|
+
var rectY = rect[1];
|
|
30912
|
+
var rectW = isRotate90 ? rect[3] : rect[2];
|
|
30913
|
+
var rectH = isRotate90 ? rect[2] : rect[3];
|
|
30914
|
+
// 每帧在 rect 内的偏移步长;旋转 90° 时 row/col 对调。
|
|
30915
|
+
var dx = isRotate90 ? 1 / textureAnimation.row * rectW : 1 / textureAnimation.col * rectW;
|
|
30916
|
+
var dy = isRotate90 ? 1 / textureAnimation.col * rectH : 1 / textureAnimation.row * rectH;
|
|
30419
30917
|
var texOffset;
|
|
30420
30918
|
if (textureAnimation.animate) {
|
|
30421
30919
|
var frameIndex = Math.round(life * (total - 1));
|
|
30422
30920
|
var yIndex = Math.floor(frameIndex / textureAnimation.col);
|
|
30423
30921
|
var xIndex = frameIndex - yIndex * textureAnimation.col;
|
|
30424
|
-
texOffset =
|
|
30922
|
+
texOffset = isRotate90 ? [
|
|
30425
30923
|
dx * yIndex,
|
|
30426
30924
|
dy * (textureAnimation.col - xIndex)
|
|
30427
30925
|
] : [
|
|
@@ -30435,8 +30933,8 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30435
30933
|
];
|
|
30436
30934
|
}
|
|
30437
30935
|
(_this_material_getVector4 = this.material.getVector4("_TexOffset")) == null ? void 0 : _this_material_getVector4.setFromArray([
|
|
30438
|
-
|
|
30439
|
-
|
|
30936
|
+
rectX + texOffset[0],
|
|
30937
|
+
rectH + rectY - texOffset[1],
|
|
30440
30938
|
dx,
|
|
30441
30939
|
dy
|
|
30442
30940
|
]);
|
|
@@ -30457,19 +30955,31 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30457
30955
|
}
|
|
30458
30956
|
};
|
|
30459
30957
|
_proto.updateGeometry = function updateGeometry(geometry) {
|
|
30460
|
-
var
|
|
30958
|
+
var sprite = this.sprite;
|
|
30959
|
+
var _sprite_rotation;
|
|
30960
|
+
// sprite 缺省时按整图 [0,0,1,1] 不旋转处理,等价旧默认 splits=[[0,0,1,1,0]]。
|
|
30961
|
+
var flip = (_sprite_rotation = sprite == null ? void 0 : sprite.rotation) != null ? _sprite_rotation : exports.SpriteRotation.None;
|
|
30962
|
+
var _sprite_rect;
|
|
30963
|
+
var rect = (_sprite_rect = sprite == null ? void 0 : sprite.rect) != null ? _sprite_rect : [
|
|
30461
30964
|
0,
|
|
30462
30965
|
0,
|
|
30463
30966
|
1,
|
|
30967
|
+
1
|
|
30968
|
+
];
|
|
30969
|
+
var _ref = this.textureSheetAnimation ? [
|
|
30970
|
+
0,
|
|
30971
|
+
0,
|
|
30464
30972
|
1,
|
|
30465
|
-
|
|
30466
|
-
] :
|
|
30467
|
-
|
|
30468
|
-
|
|
30469
|
-
|
|
30470
|
-
|
|
30471
|
-
|
|
30472
|
-
var
|
|
30973
|
+
1
|
|
30974
|
+
] : [
|
|
30975
|
+
rect[0],
|
|
30976
|
+
rect[1],
|
|
30977
|
+
rect[2],
|
|
30978
|
+
rect[3]
|
|
30979
|
+
], x = _ref[0], y = _ref[1], w = _ref[2], h = _ref[3];
|
|
30980
|
+
var isRotate90 = flip === exports.SpriteRotation.Rotate90;
|
|
30981
|
+
var width = isRotate90 ? h : w;
|
|
30982
|
+
var height = isRotate90 ? w : h;
|
|
30473
30983
|
var angle = isRotate90 ? -Math.PI / 2 : 0;
|
|
30474
30984
|
var aUV = geometry.getAttributeData("aUV");
|
|
30475
30985
|
var aPos = geometry.getAttributeData("aPos");
|
|
@@ -30506,11 +31016,51 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30506
31016
|
});
|
|
30507
31017
|
}
|
|
30508
31018
|
};
|
|
31019
|
+
_proto.fromData = function fromData(data) {
|
|
31020
|
+
MaskableGraphic.prototype.fromData.call(this, data); // MaskableGraphic: 设 renderer.texture(whiteTexture 或 data.renderer.texture)、_MainTex、_Color
|
|
31021
|
+
// 单 split / 新数据流:引用 Sprite 资产,渲染读 this.sprite
|
|
31022
|
+
if (data.sprite) {
|
|
31023
|
+
var sprite = this.engine.findObject(data.sprite);
|
|
31024
|
+
if (sprite) {
|
|
31025
|
+
this.applySpriteToRenderer(sprite);
|
|
31026
|
+
}
|
|
31027
|
+
}
|
|
31028
|
+
this.textureSheetAnimation = data.textureSheetAnimation;
|
|
31029
|
+
var geometry = data.geometry ? this.engine.findObject(data.geometry) : this.defaultGeometry;
|
|
31030
|
+
var splits = data.splits;
|
|
31031
|
+
if (splits && splits.length > 1) {
|
|
31032
|
+
// 原有打包纹理拆分逻辑(多 split,2x2 纹理打包),保留向后兼容;
|
|
31033
|
+
// 不依赖组件 splits 字段,直接用 data.splits。
|
|
31034
|
+
this.updateGeometryFromMultiSplit(splits);
|
|
31035
|
+
} else {
|
|
31036
|
+
this.updateGeometry(geometry);
|
|
31037
|
+
}
|
|
31038
|
+
this.interaction = data.interaction;
|
|
31039
|
+
var startColor = data.options.startColor || [
|
|
31040
|
+
1,
|
|
31041
|
+
1,
|
|
31042
|
+
1,
|
|
31043
|
+
1
|
|
31044
|
+
];
|
|
31045
|
+
this.material.setColor("_Color", new Color().setFromArray(startColor));
|
|
31046
|
+
var _data_duration;
|
|
31047
|
+
//@ts-expect-error
|
|
31048
|
+
this.duration = (_data_duration = data.duration) != null ? _data_duration : this.item.duration;
|
|
31049
|
+
};
|
|
31050
|
+
/**
|
|
31051
|
+
* 应用 Sprite 资产到渲染器:同步纹理并重绑 _MainTex。不重建几何体。
|
|
31052
|
+
* fromData(后续自行 updateGeometry)与 sprite setter(随后 updateGeometry)共用。
|
|
31053
|
+
* 直接写 _sprite,避免经 setter 触发 updateGeometry。
|
|
31054
|
+
*/ _proto.applySpriteToRenderer = function applySpriteToRenderer(sprite) {
|
|
31055
|
+
this._sprite = sprite;
|
|
31056
|
+
this.renderer.texture = sprite.texture;
|
|
31057
|
+
this.material.setTexture("_MainTex", sprite.texture);
|
|
31058
|
+
};
|
|
30509
31059
|
/**
|
|
30510
31060
|
* @deprecated
|
|
30511
|
-
*
|
|
30512
|
-
|
|
30513
|
-
|
|
31061
|
+
* 原有打包纹理拆分逻辑,仅在老数据 splits.length>1(2x2 纹理打包)时使用,保留向后兼容。
|
|
31062
|
+
* 不依赖组件状态,splits 由参数传入(同时存在帧动画与多 split 的数据不存在)。
|
|
31063
|
+
*/ _proto.updateGeometryFromMultiSplit = function updateGeometryFromMultiSplit(splits) {
|
|
30514
31064
|
var sx = 1, sy = 1;
|
|
30515
31065
|
var geometry = this.defaultGeometry;
|
|
30516
31066
|
var originData = [
|
|
@@ -30531,14 +31081,7 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30531
31081
|
for(var x = 0; x < col; x++){
|
|
30532
31082
|
for(var y = 0; y < row; y++){
|
|
30533
31083
|
var base = (y * 2 + x) * 4;
|
|
30534
|
-
|
|
30535
|
-
var split = textureSheetAnimation ? [
|
|
30536
|
-
0,
|
|
30537
|
-
0,
|
|
30538
|
-
1,
|
|
30539
|
-
1,
|
|
30540
|
-
splits[0][4]
|
|
30541
|
-
] : splits[y * 2 + x];
|
|
31084
|
+
var split = splits[y * 2 + x];
|
|
30542
31085
|
var texOffset = split[4] ? [
|
|
30543
31086
|
0,
|
|
30544
31087
|
0,
|
|
@@ -30584,33 +31127,21 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30584
31127
|
geometry.setAttributeData("aUV", new Float32Array(aUV));
|
|
30585
31128
|
geometry.setDrawCount(index.length);
|
|
30586
31129
|
};
|
|
30587
|
-
|
|
30588
|
-
|
|
30589
|
-
|
|
30590
|
-
|
|
30591
|
-
|
|
30592
|
-
|
|
30593
|
-
|
|
30594
|
-
|
|
30595
|
-
|
|
30596
|
-
|
|
30597
|
-
|
|
30598
|
-
|
|
30599
|
-
|
|
30600
|
-
this.updateGeometryFromMultiSplit();
|
|
31130
|
+
_create_class(SpriteComponent, [
|
|
31131
|
+
{
|
|
31132
|
+
key: "sprite",
|
|
31133
|
+
get: /**
|
|
31134
|
+
* 当前 Sprite 资产。设置时同步纹理、重绑 _MainTex 并重建几何体 UV。
|
|
31135
|
+
* @since 2.10.0
|
|
31136
|
+
*/ function get() {
|
|
31137
|
+
return this._sprite;
|
|
31138
|
+
},
|
|
31139
|
+
set: function set(sprite) {
|
|
31140
|
+
this.applySpriteToRenderer(sprite);
|
|
31141
|
+
this.updateGeometry(this.geometry);
|
|
31142
|
+
}
|
|
30601
31143
|
}
|
|
30602
|
-
|
|
30603
|
-
var startColor = data.options.startColor || [
|
|
30604
|
-
1,
|
|
30605
|
-
1,
|
|
30606
|
-
1,
|
|
30607
|
-
1
|
|
30608
|
-
];
|
|
30609
|
-
this.material.setColor("_Color", new Color().setFromArray(startColor));
|
|
30610
|
-
var _data_duration;
|
|
30611
|
-
//@ts-expect-error
|
|
30612
|
-
this.duration = (_data_duration = data.duration) != null ? _data_duration : this.item.duration;
|
|
30613
|
-
};
|
|
31144
|
+
]);
|
|
30614
31145
|
return SpriteComponent;
|
|
30615
31146
|
}(MaskableGraphic);
|
|
30616
31147
|
exports.SpriteComponent = __decorate([
|
|
@@ -30625,6 +31156,54 @@ var ParticleLoader = /*#__PURE__*/ function(Plugin) {
|
|
|
30625
31156
|
return ParticleLoader;
|
|
30626
31157
|
}(_wrap_native_super(Plugin));
|
|
30627
31158
|
|
|
31159
|
+
/**
|
|
31160
|
+
* 文本换行机会判定:UAX #14 风格的"换行机会"模型。
|
|
31161
|
+
*
|
|
31162
|
+
* - CJK 表意字 / 假名 / 韩文音节:任意两个字之间都是合法断点(字符级)
|
|
31163
|
+
* - 空格 / 制表符 / NBSP:可断,且断行时被吞掉(不留在行尾 / 行首)
|
|
31164
|
+
* - 西文字母 / 数字:词内不可断;整体超宽时由调用方退化到字符级断(overflow-wrap)
|
|
31165
|
+
*
|
|
31166
|
+
* 不含 kinsoku 禁则(句号 / 逗号不进行首等留作后续)。
|
|
31167
|
+
*/ /** 换行机会类型(断点字符之后):决定断点字符归属及断行时是否吞掉 */ /**
|
|
31168
|
+
* 是否为可换行断点字符(空格 / 制表符 / NBSP)。
|
|
31169
|
+
* 断在此字符之前,且断行时该字符被吞掉(不进旧行也不进新行)。
|
|
31170
|
+
* @param ch - 当前字符
|
|
31171
|
+
*/ function isBreakChar(ch) {
|
|
31172
|
+
return ch === " " || ch === " " || ch === "\xa0";
|
|
31173
|
+
}
|
|
31174
|
+
/**
|
|
31175
|
+
* 是否为 CJK 类字符(中文表意字 / 假名 / 韩文音节)。可在其与相邻字符之间换行。
|
|
31176
|
+
* 用码点判定以支持 CJK 扩展 B 等代理对字符(不能用 /u 正则,browserslist 为 iOS 9)。
|
|
31177
|
+
* @param ch - 当前字符(须为完整码点,调用方应使用 Array.from 遍历)
|
|
31178
|
+
*/ function isCJKLike(ch) {
|
|
31179
|
+
var _ch_codePointAt;
|
|
31180
|
+
var cp = (_ch_codePointAt = ch.codePointAt(0)) != null ? _ch_codePointAt : 0;
|
|
31181
|
+
return cp >= 0x3400 && cp <= 0x4DBF || // CJK 统一表意扩展 A
|
|
31182
|
+
cp >= 0x4E00 && cp <= 0x9FFF || // CJK 统一表意
|
|
31183
|
+
cp >= 0xF900 && cp <= 0xFAFF || // CJK 兼容表意
|
|
31184
|
+
cp >= 0x20000 && cp <= 0x2FA1F || // CJK 扩展 B~F + 兼容增补(代理对)
|
|
31185
|
+
cp >= 0x3040 && cp <= 0x309F || // 平假名
|
|
31186
|
+
cp >= 0x30A0 && cp <= 0x30FF || // 片假名
|
|
31187
|
+
cp >= 0x31F0 && cp <= 0x31FF || // 片假名语音扩展
|
|
31188
|
+
cp >= 0xAC00 && cp <= 0xD7AF // 韩文音节
|
|
31189
|
+
;
|
|
31190
|
+
}
|
|
31191
|
+
/**
|
|
31192
|
+
* 计算 prev(已推入的字符)之后是否为换行机会。只看 prev,不看后续字符。
|
|
31193
|
+
* @param prev - 前一字符(已推入旧行)
|
|
31194
|
+
* @returns 'swallow'=prev 是空格类,断行时吞掉 prev;'keep'=prev 是 CJK,prev 留本行末、下行从其后起;false=不可断
|
|
31195
|
+
*/ function breakOpportunityAfter(prev) {
|
|
31196
|
+
// prev 是空格类 → 断在 prev 处,断行时吞掉 prev(不进旧行也不进新行)
|
|
31197
|
+
if (isBreakChar(prev)) {
|
|
31198
|
+
return "swallow";
|
|
31199
|
+
}
|
|
31200
|
+
// prev 是 CJK → prev 留本行末,下行从 prev 之后起(字符级断点,不吞)
|
|
31201
|
+
if (isCJKLike(prev)) {
|
|
31202
|
+
return "keep";
|
|
31203
|
+
}
|
|
31204
|
+
return false;
|
|
31205
|
+
}
|
|
31206
|
+
|
|
30628
31207
|
var TextLayout = /*#__PURE__*/ function() {
|
|
30629
31208
|
function TextLayout(options) {
|
|
30630
31209
|
this.width = 0;
|
|
@@ -31073,9 +31652,6 @@ var DEFAULT_FONTS = [
|
|
|
31073
31652
|
"courier"
|
|
31074
31653
|
];
|
|
31075
31654
|
/** 检测字符串是否包含需要 RTL 和连写排版的字符(阿拉伯语等) */ var HAS_RTL_OR_JOINING = /[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/;
|
|
31076
|
-
/** 可换行断点:空格、制表符等 */ var IS_BREAK_CHAR = function(ch) {
|
|
31077
|
-
return ch === " " || ch === " " || ch === "\xa0";
|
|
31078
|
-
};
|
|
31079
31655
|
var seed$1 = 0;
|
|
31080
31656
|
exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
31081
31657
|
_inherits(TextComponent, MaskableGraphic);
|
|
@@ -31175,13 +31751,15 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
31175
31751
|
var lineCount = 1;
|
|
31176
31752
|
var x = 0;
|
|
31177
31753
|
var charCountInLine = 0;
|
|
31754
|
+
// 使用码点遍历,正确处理 emoji 与 CJK 扩展 B 等代理对字符
|
|
31755
|
+
var chars = Array.from(text);
|
|
31178
31756
|
if (context) {
|
|
31179
31757
|
context.font = this.getFontDesc(this.textStyle.fontSize);
|
|
31180
31758
|
}
|
|
31181
31759
|
if (overflow === TextOverflow.display) {
|
|
31182
|
-
for(var
|
|
31760
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(chars), _step; !(_step = _iterator()).done;){
|
|
31761
|
+
var str = _step.value;
|
|
31183
31762
|
var _context_measureText;
|
|
31184
|
-
var str = text[i];
|
|
31185
31763
|
var _context_measureText_width;
|
|
31186
31764
|
var textMetrics = (_context_measureText_width = context == null ? void 0 : (_context_measureText = context.measureText(str)) == null ? void 0 : _context_measureText.width) != null ? _context_measureText_width : 0;
|
|
31187
31765
|
if (str === "\n") {
|
|
@@ -31200,12 +31778,12 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
31200
31778
|
return lineCount;
|
|
31201
31779
|
}
|
|
31202
31780
|
if (this.textLayout.keepWordIntact) {
|
|
31203
|
-
//
|
|
31781
|
+
// 单词完整换行:优先在换行机会处断行(空格吞断 / CJK 字间可断),避免从西文词中间断开
|
|
31204
31782
|
var lastBreakX = 0;
|
|
31205
31783
|
var countAtBreak = 0;
|
|
31206
|
-
for(var
|
|
31784
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(chars), _step1; !(_step1 = _iterator1()).done;){
|
|
31785
|
+
var str1 = _step1.value;
|
|
31207
31786
|
var _context_measureText1;
|
|
31208
|
-
var str1 = text[i1];
|
|
31209
31787
|
var _context_measureText_width1;
|
|
31210
31788
|
var textMetrics1 = (_context_measureText_width1 = context == null ? void 0 : (_context_measureText1 = context.measureText(str1)) == null ? void 0 : _context_measureText1.width) != null ? _context_measureText_width1 : 0;
|
|
31211
31789
|
if (str1 === "\n") {
|
|
@@ -31238,22 +31816,23 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
31238
31816
|
}
|
|
31239
31817
|
x += textMetrics1;
|
|
31240
31818
|
charCountInLine++;
|
|
31241
|
-
|
|
31819
|
+
// 记换行机会:str 之后可断(空格 swallow / CJK keep)。lastBreakX 含 str 宽度(str 留本行末)
|
|
31820
|
+
if (breakOpportunityAfter(str1) !== false) {
|
|
31242
31821
|
lastBreakX = x;
|
|
31243
31822
|
countAtBreak = charCountInLine;
|
|
31244
31823
|
}
|
|
31245
31824
|
}
|
|
31246
31825
|
} else {
|
|
31247
31826
|
// 逐字符换行:允许在任意字符处断开
|
|
31248
|
-
for(var
|
|
31827
|
+
for(var i = 0; i < chars.length; i++){
|
|
31249
31828
|
var _context_measureText2;
|
|
31250
|
-
var str2 =
|
|
31829
|
+
var str2 = chars[i];
|
|
31251
31830
|
var _context_measureText_width2;
|
|
31252
31831
|
var textMetrics2 = (_context_measureText_width2 = context == null ? void 0 : (_context_measureText2 = context.measureText(str2)) == null ? void 0 : _context_measureText2.width) != null ? _context_measureText_width2 : 0;
|
|
31253
31832
|
if (charCountInLine > 0) {
|
|
31254
31833
|
x += letterSpace;
|
|
31255
31834
|
}
|
|
31256
|
-
if (x + textMetrics2 > width &&
|
|
31835
|
+
if (x + textMetrics2 > width && i > 0 || str2 === "\n") {
|
|
31257
31836
|
lineCount++;
|
|
31258
31837
|
this.maxLineWidth = Math.max(this.maxLineWidth, x);
|
|
31259
31838
|
x = 0;
|
|
@@ -31346,8 +31925,11 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
31346
31925
|
var charsArray = [];
|
|
31347
31926
|
var charOffsetX = [];
|
|
31348
31927
|
if (layout.keepWordIntact) {
|
|
31349
|
-
//
|
|
31928
|
+
// 单词完整换行:优先在换行机会处断行(空格吞断 / CJK 字间可断),避免从西文词中间断开。
|
|
31929
|
+
// lastBreakIdx 指向断点字符在 charsArray 中的索引;breakSwallow=true 时该字符被吞(空格),
|
|
31930
|
+
// false 时该字符留本行末(CJK),下行均从 lastBreakIdx+1 起。
|
|
31350
31931
|
var lastBreakIdx = -1;
|
|
31932
|
+
var breakSwallow = false;
|
|
31351
31933
|
for(var i = 0; i < char.length; i++){
|
|
31352
31934
|
var str = char[i];
|
|
31353
31935
|
var textMetrics = context.measureText(str);
|
|
@@ -31363,15 +31945,18 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
31363
31945
|
charsArray = [];
|
|
31364
31946
|
charOffsetX = [];
|
|
31365
31947
|
lastBreakIdx = -1;
|
|
31948
|
+
breakSwallow = false;
|
|
31366
31949
|
continue;
|
|
31367
31950
|
}
|
|
31368
31951
|
var spacing = charsArray.length > 0 ? layout.letterSpace : 0;
|
|
31369
31952
|
var willWidth = x + spacing + textMetrics.width;
|
|
31370
31953
|
if (willWidth > baseWidth && charsArray.length > 0) {
|
|
31371
31954
|
if (lastBreakIdx > 0) {
|
|
31372
|
-
//
|
|
31373
|
-
|
|
31374
|
-
var
|
|
31955
|
+
// 在换行机会处断行:swallow 取 [0,lastBreakIdx)(吞掉断点字符),
|
|
31956
|
+
// keep 取 [0,lastBreakIdx](断点字符留本行末),下行均从 lastBreakIdx+1 起。
|
|
31957
|
+
var endIdx = breakSwallow ? lastBreakIdx : lastBreakIdx + 1;
|
|
31958
|
+
var lineChars = charsArray.slice(0, endIdx);
|
|
31959
|
+
var lineOffsets = charOffsetX.slice(0, endIdx);
|
|
31375
31960
|
var lineWidth = lineChars.length > 0 ? lineOffsets[lineOffsets.length - 1] + context.measureText(lineChars[lineChars.length - 1]).width : 0;
|
|
31376
31961
|
charsInfo.push({
|
|
31377
31962
|
y: y,
|
|
@@ -31392,6 +31977,7 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
31392
31977
|
x += context.measureText(charsArray[j]).width;
|
|
31393
31978
|
}
|
|
31394
31979
|
lastBreakIdx = -1;
|
|
31980
|
+
breakSwallow = false;
|
|
31395
31981
|
} else {
|
|
31396
31982
|
charsInfo.push({
|
|
31397
31983
|
y: y,
|
|
@@ -31404,6 +31990,7 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
31404
31990
|
charsArray = [];
|
|
31405
31991
|
charOffsetX = [];
|
|
31406
31992
|
lastBreakIdx = -1;
|
|
31993
|
+
breakSwallow = false;
|
|
31407
31994
|
}
|
|
31408
31995
|
}
|
|
31409
31996
|
if (charsArray.length > 0) {
|
|
@@ -31412,8 +31999,12 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
31412
31999
|
charOffsetX.push(x);
|
|
31413
32000
|
charsArray.push(str);
|
|
31414
32001
|
x += textMetrics.width;
|
|
31415
|
-
|
|
32002
|
+
// 记换行机会:str 之后可断。lastBreakIdx 指向 str(charsArray 末尾),
|
|
32003
|
+
// swallow=吞 str(空格),keep=str 留本行末(CJK)。
|
|
32004
|
+
var opp = breakOpportunityAfter(str);
|
|
32005
|
+
if (opp !== false) {
|
|
31416
32006
|
lastBreakIdx = charsArray.length - 1;
|
|
32007
|
+
breakSwallow = opp === "swallow";
|
|
31417
32008
|
}
|
|
31418
32009
|
}
|
|
31419
32010
|
} else {
|
|
@@ -33363,7 +33954,6 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
33363
33954
|
var material = Material.create(this.engine, materialProps);
|
|
33364
33955
|
var renderer = rendererOptions;
|
|
33365
33956
|
var side = renderer.side, occlusion = renderer.occlusion, blendMode = renderer.blending, texture = renderer.texture;
|
|
33366
|
-
var maskMode = this.maskManager.maskMode;
|
|
33367
33957
|
material.blending = true;
|
|
33368
33958
|
material.depthTest = true;
|
|
33369
33959
|
material.depthMask = occlusion;
|
|
@@ -33377,7 +33967,6 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
33377
33967
|
texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
|
|
33378
33968
|
texParams.y = preMultiAlpha;
|
|
33379
33969
|
texParams.z = renderer.renderMode;
|
|
33380
|
-
texParams.w = maskMode;
|
|
33381
33970
|
material.setVector4("_TexParams", texParams);
|
|
33382
33971
|
if (texParams.x === 0 || this.maskManager.alphaMaskEnabled) {
|
|
33383
33972
|
material.enableMacro("ALPHA_CLIP");
|
|
@@ -33400,9 +33989,9 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
33400
33989
|
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
33401
33990
|
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.whiteTexture,
|
|
33402
33991
|
occlusion: !!renderer.occlusion,
|
|
33403
|
-
transparentOcclusion: !!renderer.transparentOcclusion || this.maskManager.
|
|
33992
|
+
transparentOcclusion: !!renderer.transparentOcclusion || this.maskManager.isMask,
|
|
33404
33993
|
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
33405
|
-
mask:
|
|
33994
|
+
mask: 1
|
|
33406
33995
|
};
|
|
33407
33996
|
var _data_strokeCap;
|
|
33408
33997
|
this.strokeCap = (_data_strokeCap = data.strokeCap) != null ? _data_strokeCap : LineCap.Butt;
|
|
@@ -34384,7 +34973,7 @@ function getStandardInteractContent(ui) {
|
|
|
34384
34973
|
return ret;
|
|
34385
34974
|
}
|
|
34386
34975
|
|
|
34387
|
-
var
|
|
34976
|
+
var currentMaskComponentId;
|
|
34388
34977
|
var componentMap = new Map();
|
|
34389
34978
|
var itemMap = new Map();
|
|
34390
34979
|
/**
|
|
@@ -35046,12 +35635,21 @@ function version36Migration(json) {
|
|
|
35046
35635
|
for(var _iterator3 = _create_for_of_iterator_helper_loose(json.compositions), _step3; !(_step3 = _iterator3()).done;){
|
|
35047
35636
|
var composition = _step3.value;
|
|
35048
35637
|
composition.children = [];
|
|
35638
|
+
currentMaskComponentId = undefined;
|
|
35639
|
+
//@ts-expect-error
|
|
35640
|
+
var legacyCompositionItems = composition.items;
|
|
35641
|
+
if (Array.isArray(legacyCompositionItems)) {
|
|
35642
|
+
processMaskReferenceItems(legacyCompositionItems, itemMap, componentMap);
|
|
35643
|
+
}
|
|
35049
35644
|
for(var _iterator4 = _create_for_of_iterator_helper_loose(composition.components), _step4; !(_step4 = _iterator4()).done;){
|
|
35050
35645
|
var componentDataPath = _step4.value;
|
|
35051
35646
|
var componentData = componentMap.get(componentDataPath.id);
|
|
35052
35647
|
if (componentData.dataType === DataType.CompositionComponent) {
|
|
35053
35648
|
var compositionComponent = componentData;
|
|
35054
|
-
|
|
35649
|
+
var _compositionComponent_items;
|
|
35650
|
+
var compositionItems = (_compositionComponent_items = compositionComponent.items) != null ? _compositionComponent_items : [];
|
|
35651
|
+
processMaskReferenceItems(compositionItems, itemMap, componentMap);
|
|
35652
|
+
for(var _iterator5 = _create_for_of_iterator_helper_loose(compositionItems), _step5; !(_step5 = _iterator5()).done;){
|
|
35055
35653
|
var itemPath = _step5.value;
|
|
35056
35654
|
var item1 = itemMap.get(itemPath.id);
|
|
35057
35655
|
if (item1.parentId === undefined) {
|
|
@@ -35081,6 +35679,72 @@ function version36Migration(json) {
|
|
|
35081
35679
|
json.version = JSONSceneVersion["3_7"];
|
|
35082
35680
|
return json;
|
|
35083
35681
|
}
|
|
35682
|
+
/**
|
|
35683
|
+
* 3.8 数据适配:SpriteComponent 的 renderer.texture + splits 迁移为独立 Sprite 资产。
|
|
35684
|
+
*
|
|
35685
|
+
* - 遍历所有未引用 sprite 的 SpriteComponentData,按 splits[0](无则整图 [0,0,1,1])生成
|
|
35686
|
+
* Sprite 资产对象放入 miscs,并把组件的 sprite 指向它。
|
|
35687
|
+
* - 删除组件的 splits 与 renderer.texture(纹理归属 sprite,renderer 仅保留渲染状态)。
|
|
35688
|
+
* - 卫语句 `if (sc.sprite) continue` 处理混合数据(部分组件已用 sprite)。
|
|
35689
|
+
* - 多 split(splits.length>1,2x2 纹理打包)保留原 splits 不迁移,仍走 updateGeometryFromMultiSplit 旧路径。
|
|
35690
|
+
*
|
|
35691
|
+
* 由 getStandardJSON 以 `minorVersion < 8` 守卫调用,数据生命周期内只跑一次。
|
|
35692
|
+
* version 字段设为字符串 '3.8'(JSONSceneVersion 枚举无此值,运行时不依赖枚举)。
|
|
35693
|
+
*/ function version37Migration(json) {
|
|
35694
|
+
var _json;
|
|
35695
|
+
var _miscs;
|
|
35696
|
+
(_miscs = (_json = json).miscs) != null ? _miscs : _json.miscs = [];
|
|
35697
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(json.components), _step; !(_step = _iterator()).done;){
|
|
35698
|
+
var component = _step.value;
|
|
35699
|
+
var _sc_renderer;
|
|
35700
|
+
if (component.dataType !== DataType.SpriteComponent) {
|
|
35701
|
+
continue;
|
|
35702
|
+
}
|
|
35703
|
+
// 本地扩展 sprite 字段(spec 包不可改)。ComponentData 是 SpriteComponentData 的超集,
|
|
35704
|
+
// 故直接当 SpriteComponentData 用;sprite 需要写到对象上,用宽松类型承载。
|
|
35705
|
+
var sc = component;
|
|
35706
|
+
if (sc.sprite) {
|
|
35707
|
+
continue; // 已迁移/新数据
|
|
35708
|
+
}
|
|
35709
|
+
var splits = sc.splits;
|
|
35710
|
+
if (splits && splits.length > 1) {
|
|
35711
|
+
continue;
|
|
35712
|
+
}
|
|
35713
|
+
var first = splits == null ? void 0 : splits[0];
|
|
35714
|
+
var rect = first ? [
|
|
35715
|
+
first[0],
|
|
35716
|
+
first[1],
|
|
35717
|
+
first[2],
|
|
35718
|
+
first[3]
|
|
35719
|
+
] : [
|
|
35720
|
+
0,
|
|
35721
|
+
0,
|
|
35722
|
+
1,
|
|
35723
|
+
1
|
|
35724
|
+
];
|
|
35725
|
+
var _first_;
|
|
35726
|
+
// rotation: 0=None 不旋转, 1=Rotate90(值与 Sprite.SpriteRotation 枚举一致,序列化兼容)
|
|
35727
|
+
var rotation = (_first_ = first == null ? void 0 : first[4]) != null ? _first_ : 0;
|
|
35728
|
+
var spriteData = {
|
|
35729
|
+
id: generateGUID(),
|
|
35730
|
+
dataType: "Sprite",
|
|
35731
|
+
// 可能为 undefined(纯色元素)→ Sprite.fromData 兜底 whiteTexture
|
|
35732
|
+
texture: (_sc_renderer = sc.renderer) == null ? void 0 : _sc_renderer.texture,
|
|
35733
|
+
rect: rect,
|
|
35734
|
+
rotation: rotation
|
|
35735
|
+
};
|
|
35736
|
+
json.miscs.push(spriteData);
|
|
35737
|
+
sc.sprite = {
|
|
35738
|
+
id: spriteData.id
|
|
35739
|
+
};
|
|
35740
|
+
delete sc.splits;
|
|
35741
|
+
if (sc.renderer) {
|
|
35742
|
+
delete sc.renderer.texture; // 纹理归属 sprite,renderer 仅保留渲染状态
|
|
35743
|
+
}
|
|
35744
|
+
}
|
|
35745
|
+
json.version = "3.8";
|
|
35746
|
+
return json;
|
|
35747
|
+
}
|
|
35084
35748
|
/**
|
|
35085
35749
|
* 确保文本组件有版本标识字段
|
|
35086
35750
|
*/ function ensureTextVerticalAlign(options) {
|
|
@@ -35191,6 +35855,21 @@ function processContent(composition) {
|
|
|
35191
35855
|
}
|
|
35192
35856
|
}
|
|
35193
35857
|
}
|
|
35858
|
+
function processMaskReferenceItems(items, itemMap, componentMap) {
|
|
35859
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
35860
|
+
var item = _step.value;
|
|
35861
|
+
var itemProps = itemMap.get(item.id);
|
|
35862
|
+
if (!itemProps) {
|
|
35863
|
+
continue;
|
|
35864
|
+
}
|
|
35865
|
+
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine || itemProps.type === ItemType.text || itemProps.type === ItemType.richtext || itemProps.type === ItemType.video || itemProps.type === ItemType.shape || itemProps.type === ItemType.mesh) {
|
|
35866
|
+
var component = componentMap.get(itemProps.components[0].id);
|
|
35867
|
+
if (component) {
|
|
35868
|
+
processMaskReference(component);
|
|
35869
|
+
}
|
|
35870
|
+
}
|
|
35871
|
+
}
|
|
35872
|
+
}
|
|
35194
35873
|
function processMask(renderContent) {
|
|
35195
35874
|
var renderer = renderContent.renderer;
|
|
35196
35875
|
var maskMode = renderer == null ? void 0 : renderer.maskMode;
|
|
@@ -35201,16 +35880,34 @@ function processMask(renderContent) {
|
|
|
35201
35880
|
renderContent.mask = {
|
|
35202
35881
|
isMask: true
|
|
35203
35882
|
};
|
|
35204
|
-
|
|
35883
|
+
currentMaskComponentId = renderContent.id;
|
|
35205
35884
|
} else if (maskMode === ObscuredMode.OBSCURED || maskMode === ObscuredMode.REVERSE_OBSCURED) {
|
|
35206
35885
|
renderContent.mask = {
|
|
35207
35886
|
inverted: maskMode === ObscuredMode.REVERSE_OBSCURED ? true : false,
|
|
35208
35887
|
reference: {
|
|
35209
|
-
"id":
|
|
35888
|
+
"id": currentMaskComponentId
|
|
35210
35889
|
}
|
|
35211
35890
|
};
|
|
35212
35891
|
}
|
|
35213
35892
|
}
|
|
35893
|
+
function processMaskReference(renderContent) {
|
|
35894
|
+
var mask = renderContent.mask;
|
|
35895
|
+
if (mask && !mask.references && mask.reference) {
|
|
35896
|
+
var _mask_isMask, _mask_alphaMaskEnabled, _mask_inverted;
|
|
35897
|
+
// 处理旧版 mask 格式(mask.reference 和 mask.inverted 字段)
|
|
35898
|
+
// 将旧版单蒙版格式转换为 references 数组
|
|
35899
|
+
renderContent.mask = {
|
|
35900
|
+
isMask: (_mask_isMask = mask.isMask) != null ? _mask_isMask : false,
|
|
35901
|
+
alphaMaskEnabled: (_mask_alphaMaskEnabled = mask.alphaMaskEnabled) != null ? _mask_alphaMaskEnabled : false,
|
|
35902
|
+
references: [
|
|
35903
|
+
{
|
|
35904
|
+
mask: mask.reference,
|
|
35905
|
+
inverted: (_mask_inverted = mask.inverted) != null ? _mask_inverted : false
|
|
35906
|
+
}
|
|
35907
|
+
]
|
|
35908
|
+
};
|
|
35909
|
+
}
|
|
35910
|
+
}
|
|
35214
35911
|
function convertParam(content) {
|
|
35215
35912
|
if (!content) {
|
|
35216
35913
|
return;
|
|
@@ -35885,7 +36582,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
35885
36582
|
return ret;
|
|
35886
36583
|
}
|
|
35887
36584
|
|
|
35888
|
-
var version$1 = "2.10.0-alpha.
|
|
36585
|
+
var version$1 = "2.10.0-alpha.1";
|
|
35889
36586
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
35890
36587
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
35891
36588
|
var reverseParticle = false;
|
|
@@ -35903,7 +36600,7 @@ function getStandardJSON(json) {
|
|
|
35903
36600
|
if (v0.test(json.version)) {
|
|
35904
36601
|
var _exec;
|
|
35905
36602
|
reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
|
|
35906
|
-
return version36Migration(version35Migration(version34Migration(version33Migration(version32Migration(version31Migration(version30Migration(version21Migration(getStandardJSONFromV0(json)))))))));
|
|
36603
|
+
return version37Migration(version36Migration(version35Migration(version34Migration(version33Migration(version32Migration(version31Migration(version30Migration(version21Migration(getStandardJSONFromV0(json))))))))));
|
|
35907
36604
|
}
|
|
35908
36605
|
reverseParticle = false;
|
|
35909
36606
|
var vs = standardVersion.exec(json.version) || [];
|
|
@@ -35940,6 +36637,9 @@ function getStandardJSON(json) {
|
|
|
35940
36637
|
if (minorVersion < 7) {
|
|
35941
36638
|
json = version36Migration(json);
|
|
35942
36639
|
}
|
|
36640
|
+
if (minorVersion < 8) {
|
|
36641
|
+
json = version37Migration(json);
|
|
36642
|
+
}
|
|
35943
36643
|
}
|
|
35944
36644
|
return json;
|
|
35945
36645
|
}
|
|
@@ -36398,11 +37098,15 @@ var seed = 1;
|
|
|
36398
37098
|
var _proto = AssetManager.prototype;
|
|
36399
37099
|
_proto.updateOptions = function updateOptions(options) {
|
|
36400
37100
|
if (options === void 0) options = {};
|
|
36401
|
-
|
|
36402
|
-
|
|
36403
|
-
options.
|
|
37101
|
+
var _options_useCompressedTexture, _options_useHevcVideo;
|
|
37102
|
+
this.options = _extends({}, options, {
|
|
37103
|
+
useCompressedTexture: (_options_useCompressedTexture = options.useCompressedTexture) != null ? _options_useCompressedTexture : true,
|
|
37104
|
+
useHevcVideo: (_options_useHevcVideo = options.useHevcVideo) != null ? _options_useHevcVideo : true
|
|
37105
|
+
});
|
|
37106
|
+
if (!this.options.pluginData) {
|
|
37107
|
+
this.options.pluginData = {};
|
|
36404
37108
|
}
|
|
36405
|
-
var
|
|
37109
|
+
var _this_options = this.options, _this_options_timeout = _this_options.timeout, timeout = _this_options_timeout === void 0 ? 10 : _this_options_timeout;
|
|
36406
37110
|
this.timeout = timeout;
|
|
36407
37111
|
};
|
|
36408
37112
|
/**
|
|
@@ -36660,12 +37364,19 @@ var seed = 1;
|
|
|
36660
37364
|
if (canUseKTX2 === void 0) canUseKTX2 = false;
|
|
36661
37365
|
var _this = this;
|
|
36662
37366
|
return _async_to_generator(function() {
|
|
36663
|
-
var _this_options, useCompressedTexture, variables, disableWebP, disableAVIF, baseUrl, jobs, loadedImages;
|
|
37367
|
+
var _this_options, useCompressedTexture, variables, disableWebP, disableAVIF, isKTX2PluginRegistered, canUseCompressedTexture, baseUrl, jobs, loadedImages;
|
|
36664
37368
|
return __generator(this, function(_state) {
|
|
36665
37369
|
switch(_state.label){
|
|
36666
37370
|
case 0:
|
|
36667
37371
|
_this_options = _this.options, useCompressedTexture = _this_options.useCompressedTexture, variables = _this_options.variables, disableWebP = _this_options.disableWebP, disableAVIF = _this_options.disableAVIF;
|
|
37372
|
+
isKTX2PluginRegistered = !!pluginLoaderMap.ktx2;
|
|
37373
|
+
canUseCompressedTexture = useCompressedTexture && canUseKTX2 && isKTX2PluginRegistered;
|
|
36668
37374
|
baseUrl = _this.baseUrl;
|
|
37375
|
+
if (useCompressedTexture && canUseKTX2 && !isKTX2PluginRegistered && images.some(function(img) {
|
|
37376
|
+
return "ktx2" in img && img.ktx2;
|
|
37377
|
+
})) {
|
|
37378
|
+
logger.warn("The plugin 'ktx2' is not found, unable to use compressed textures." + getPluginUsageInfo("ktx2"));
|
|
37379
|
+
}
|
|
36669
37380
|
jobs = images.map(/*#__PURE__*/ _async_to_generator(function(img, idx) {
|
|
36670
37381
|
var png, webp, avif, ktx2, imageURL, webpURL, avifURL, ktx2URL, id, template, background, url, isVideo, loadFn, resultImage, e, _ref, url1, image, _tmp;
|
|
36671
37382
|
return __generator(this, function(_state) {
|
|
@@ -36680,7 +37391,7 @@ var seed = 1;
|
|
|
36680
37391
|
// eslint-disable-next-line compat/compat
|
|
36681
37392
|
avifURL = !disableAVIF && avif ? new URL(avif, baseUrl).href : undefined;
|
|
36682
37393
|
// eslint-disable-next-line compat/compat
|
|
36683
|
-
ktx2URL = ktx2 &&
|
|
37394
|
+
ktx2URL = ktx2 && canUseCompressedTexture ? new URL(ktx2, baseUrl).href : undefined;
|
|
36684
37395
|
id = img.id;
|
|
36685
37396
|
if (!("template" in img)) return [
|
|
36686
37397
|
3,
|
|
@@ -36832,7 +37543,7 @@ var seed = 1;
|
|
|
36832
37543
|
case 0:
|
|
36833
37544
|
return [
|
|
36834
37545
|
4,
|
|
36835
|
-
PluginSystem.
|
|
37546
|
+
PluginSystem.notifyAssetsLoadStart(scene, _this.options)
|
|
36836
37547
|
];
|
|
36837
37548
|
case 1:
|
|
36838
37549
|
_state.sent();
|
|
@@ -37914,7 +38625,7 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
37914
38625
|
_this.onItemMessage = onItemMessage;
|
|
37915
38626
|
}
|
|
37916
38627
|
_this.createRenderFrame();
|
|
37917
|
-
PluginSystem.
|
|
38628
|
+
PluginSystem.notifyCompositionCreated(_assert_this_initialized(_this), scene);
|
|
37918
38629
|
return _this;
|
|
37919
38630
|
}
|
|
37920
38631
|
var _proto = Composition.prototype;
|
|
@@ -38278,18 +38989,13 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
38278
38989
|
// }
|
|
38279
38990
|
};
|
|
38280
38991
|
_proto.lost = function lost(e) {
|
|
38281
|
-
|
|
38282
|
-
if ("video" in tex.source) {
|
|
38283
|
-
tex.source.video.pause();
|
|
38284
|
-
return tex.source.video.currentTime;
|
|
38285
|
-
}
|
|
38286
|
-
});
|
|
38287
|
-
this.textures.map(function(tex) {
|
|
38288
|
-
return tex.dispose();
|
|
38289
|
-
});
|
|
38290
|
-
this.dispose();
|
|
38992
|
+
// GPU 资源由引擎统一 rebuild,合成仅保留纯 JS 运行时状态,此处无需处理。
|
|
38291
38993
|
};
|
|
38292
38994
|
/**
|
|
38995
|
+
* 上下文恢复后的空操作。
|
|
38996
|
+
* GPU 资源已由引擎统一重建,视频纹理会在下次渲染时自然更新,不自动重新播放。
|
|
38997
|
+
*/ _proto.restore = function restore() {};
|
|
38998
|
+
/**
|
|
38293
38999
|
* 合成对象销毁
|
|
38294
39000
|
*/ _proto.dispose = function dispose() {
|
|
38295
39001
|
var _this = this;
|
|
@@ -38314,7 +39020,7 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
38314
39020
|
this.root.dispose();
|
|
38315
39021
|
// FIXME: 注意这里增加了renderFrame销毁
|
|
38316
39022
|
this.renderFrame.dispose();
|
|
38317
|
-
PluginSystem.
|
|
39023
|
+
PluginSystem.notifyCompositionDestroy(this);
|
|
38318
39024
|
this.update = function() {
|
|
38319
39025
|
{
|
|
38320
39026
|
logger.error("Update disposed composition: " + _this.name + ".");
|
|
@@ -40228,12 +40934,20 @@ var DEFAULT_FPS = 60;
|
|
|
40228
40934
|
* 计时器
|
|
40229
40935
|
* 手动渲染 `manualRender=true` 时不创建计时器
|
|
40230
40936
|
*/ _this.ticker = null;
|
|
40937
|
+
/**
|
|
40938
|
+
* 是否不处理上下文丢失恢复(构造期配置,默认 true)
|
|
40939
|
+
*/ _this.doNotHandleContextLost = true;
|
|
40940
|
+
/**
|
|
40941
|
+
* WebGL 上下文是否处于丢失状态
|
|
40942
|
+
*/ _this.contextWasLost = false;
|
|
40231
40943
|
_this._disposed = false;
|
|
40232
40944
|
_this.textures = [];
|
|
40233
40945
|
_this.materials = [];
|
|
40234
40946
|
_this.geometries = [];
|
|
40235
40947
|
_this.meshes = [];
|
|
40236
40948
|
_this.renderPasses = [];
|
|
40949
|
+
_this.framebuffers = [];
|
|
40950
|
+
_this.renderbuffers = [];
|
|
40237
40951
|
_this.clearAction = {
|
|
40238
40952
|
stencilAction: exports.TextureLoadAction.clear,
|
|
40239
40953
|
clearStencil: 0,
|
|
@@ -40250,6 +40964,8 @@ var DEFAULT_FPS = 60;
|
|
|
40250
40964
|
_this.canvas = canvas;
|
|
40251
40965
|
var _options_env;
|
|
40252
40966
|
_this.env = (_options_env = options == null ? void 0 : options.env) != null ? _options_env : "";
|
|
40967
|
+
var _options_doNotHandleContextLost;
|
|
40968
|
+
_this.doNotHandleContextLost = (_options_doNotHandleContextLost = options == null ? void 0 : options.doNotHandleContextLost) != null ? _options_doNotHandleContextLost : true;
|
|
40253
40969
|
var _options_name;
|
|
40254
40970
|
_this.name = (_options_name = options == null ? void 0 : options.name) != null ? _options_name : _this.name;
|
|
40255
40971
|
var _options_pixelRatio;
|
|
@@ -40275,6 +40991,7 @@ var DEFAULT_FPS = 60;
|
|
|
40275
40991
|
// @ts-expect-error
|
|
40276
40992
|
currentFrame: {}
|
|
40277
40993
|
};
|
|
40994
|
+
PluginSystem.notifyEngineCreated(_assert_this_initialized(_this));
|
|
40278
40995
|
return _this;
|
|
40279
40996
|
}
|
|
40280
40997
|
var _proto = Engine.prototype;
|
|
@@ -40374,6 +41091,10 @@ var DEFAULT_FPS = 60;
|
|
|
40374
41091
|
(_this_ticker = this.ticker) == null ? void 0 : _this_ticker.add(renderFunction);
|
|
40375
41092
|
};
|
|
40376
41093
|
_proto.mainLoop = function mainLoop(dt) {
|
|
41094
|
+
// 上下文丢失/恢复期间跳过渲染,避免打到失效的 GL 上下文。
|
|
41095
|
+
if (this.contextWasLost) {
|
|
41096
|
+
return;
|
|
41097
|
+
}
|
|
40377
41098
|
var renderErrors = this.renderErrors;
|
|
40378
41099
|
if (renderErrors.size > 0) {
|
|
40379
41100
|
var // 有渲染错误时暂停播放
|
|
@@ -40586,6 +41307,30 @@ var DEFAULT_FPS = 60;
|
|
|
40586
41307
|
}
|
|
40587
41308
|
removeItem(this.renderPasses, pass);
|
|
40588
41309
|
};
|
|
41310
|
+
_proto.addFramebuffer = function addFramebuffer(framebuffer) {
|
|
41311
|
+
if (this.disposed) {
|
|
41312
|
+
return;
|
|
41313
|
+
}
|
|
41314
|
+
addItem(this.framebuffers, framebuffer);
|
|
41315
|
+
};
|
|
41316
|
+
_proto.removeFramebuffer = function removeFramebuffer(framebuffer) {
|
|
41317
|
+
if (this.disposed) {
|
|
41318
|
+
return;
|
|
41319
|
+
}
|
|
41320
|
+
removeItem(this.framebuffers, framebuffer);
|
|
41321
|
+
};
|
|
41322
|
+
_proto.addRenderbuffer = function addRenderbuffer(renderbuffer) {
|
|
41323
|
+
if (this.disposed) {
|
|
41324
|
+
return;
|
|
41325
|
+
}
|
|
41326
|
+
addItem(this.renderbuffers, renderbuffer);
|
|
41327
|
+
};
|
|
41328
|
+
_proto.removeRenderbuffer = function removeRenderbuffer(renderbuffer) {
|
|
41329
|
+
if (this.disposed) {
|
|
41330
|
+
return;
|
|
41331
|
+
}
|
|
41332
|
+
removeItem(this.renderbuffers, renderbuffer);
|
|
41333
|
+
};
|
|
40589
41334
|
_proto.addComposition = function addComposition(composition) {
|
|
40590
41335
|
if (this.disposed) {
|
|
40591
41336
|
return;
|
|
@@ -40695,6 +41440,7 @@ var DEFAULT_FPS = 60;
|
|
|
40695
41440
|
return;
|
|
40696
41441
|
}
|
|
40697
41442
|
this._disposed = true;
|
|
41443
|
+
PluginSystem.notifyEngineDestroy(this);
|
|
40698
41444
|
var info = [];
|
|
40699
41445
|
if (this.renderPasses.length > 0) {
|
|
40700
41446
|
info.push("Pass " + this.renderPasses.length);
|
|
@@ -40870,8 +41616,8 @@ var PassTextureCache = /*#__PURE__*/ function() {
|
|
|
40870
41616
|
case 1:
|
|
40871
41617
|
loadedScene = _state.sent();
|
|
40872
41618
|
engine.clearResources();
|
|
40873
|
-
//
|
|
40874
|
-
PluginSystem.
|
|
41619
|
+
// 通过 PluginSystem.notifyAssetsLoadFinish 通知所有插件的 onAssetsLoadFinish 回调
|
|
41620
|
+
PluginSystem.notifyAssetsLoadFinish(loadedScene, assetManager.options, engine);
|
|
40875
41621
|
engine.assetService.prepareAssets(loadedScene, loadedScene.assets);
|
|
40876
41622
|
engine.assetService.updateTextVariables(loadedScene, options.variables);
|
|
40877
41623
|
composition = _this.createComposition(loadedScene, engine, options);
|
|
@@ -40932,8 +41678,8 @@ var PrecompositionManager = /*#__PURE__*/ function() {
|
|
|
40932
41678
|
var options = precomposition.options;
|
|
40933
41679
|
var engine = composition.engine;
|
|
40934
41680
|
engine.clearResources();
|
|
40935
|
-
//
|
|
40936
|
-
PluginSystem.
|
|
41681
|
+
// 通过 PluginSystem.notifyAssetsLoadFinish 通知所有插件的 onAssetsLoadFinish 回调
|
|
41682
|
+
PluginSystem.notifyAssetsLoadFinish(scene, options, engine);
|
|
40937
41683
|
engine.assetService.prepareAssets(scene, scene.assets);
|
|
40938
41684
|
engine.assetService.updateTextVariables(scene, options.variables);
|
|
40939
41685
|
composition.createTexturesFromData(scene.textureOptions);
|
|
@@ -40973,7 +41719,7 @@ registerPlugin("text", TextLoader);
|
|
|
40973
41719
|
registerPlugin("sprite", SpriteLoader);
|
|
40974
41720
|
registerPlugin("particle", ParticleLoader);
|
|
40975
41721
|
registerPlugin("interact", InteractLoader);
|
|
40976
|
-
var version = "2.10.0-alpha.
|
|
41722
|
+
var version = "2.10.0-alpha.1";
|
|
40977
41723
|
logger.info("Core version: " + version + ".");
|
|
40978
41724
|
|
|
40979
41725
|
exports.ATLAS_SIZE = ATLAS_SIZE;
|
|
@@ -41101,6 +41847,7 @@ exports.Precomposition = Precomposition;
|
|
|
41101
41847
|
exports.PrecompositionManager = PrecompositionManager;
|
|
41102
41848
|
exports.PropertyClipPlayable = PropertyClipPlayable;
|
|
41103
41849
|
exports.PropertyTrack = PropertyTrack;
|
|
41850
|
+
exports.REFERENCE_CURVE = REFERENCE_CURVE;
|
|
41104
41851
|
exports.RENDER_PREFER_LOOKUP_TEXTURE = RENDER_PREFER_LOOKUP_TEXTURE;
|
|
41105
41852
|
exports.RUNTIME_ENV = RUNTIME_ENV;
|
|
41106
41853
|
exports.RandomSetValue = RandomSetValue;
|
|
@@ -41109,6 +41856,7 @@ exports.RandomVectorValue = RandomVectorValue;
|
|
|
41109
41856
|
exports.RaycastResult = RaycastResult;
|
|
41110
41857
|
exports.RectTransform = RectTransform;
|
|
41111
41858
|
exports.Rectangle = Rectangle$1;
|
|
41859
|
+
exports.ReferenceCurve = ReferenceCurve;
|
|
41112
41860
|
exports.RenderFrame = RenderFrame;
|
|
41113
41861
|
exports.RenderPass = RenderPass;
|
|
41114
41862
|
exports.RenderPassPriorityNormal = RenderPassPriorityNormal;
|
|
@@ -41132,6 +41880,7 @@ exports.ShaderVariant = ShaderVariant;
|
|
|
41132
41880
|
exports.SpriteColorMixerPlayable = SpriteColorMixerPlayable;
|
|
41133
41881
|
exports.SpriteComponentTimeTrack = SpriteComponentTimeTrack;
|
|
41134
41882
|
exports.SpriteLoader = SpriteLoader;
|
|
41883
|
+
exports.SpritePropertyMixerPlayable = SpritePropertyMixerPlayable;
|
|
41135
41884
|
exports.StateMachineNode = StateMachineNode;
|
|
41136
41885
|
exports.StateNode = StateNode;
|
|
41137
41886
|
exports.StaticValue = StaticValue;
|
|
@@ -41170,6 +41919,7 @@ exports.applyMixins = applyMixins;
|
|
|
41170
41919
|
exports.assertExist = assertExist;
|
|
41171
41920
|
exports.asserts = asserts;
|
|
41172
41921
|
exports.base64ToFile = base64ToFile;
|
|
41922
|
+
exports.breakOpportunityAfter = breakOpportunityAfter;
|
|
41173
41923
|
exports.buildBezierData = buildBezierData;
|
|
41174
41924
|
exports.buildEasingCurve = buildEasingCurve;
|
|
41175
41925
|
exports.buildLine = buildLine;
|
|
@@ -41235,6 +41985,8 @@ exports.interpolateColor = interpolateColor;
|
|
|
41235
41985
|
exports.isAlipayMiniApp = isAlipayMiniApp;
|
|
41236
41986
|
exports.isAndroid = isAndroid;
|
|
41237
41987
|
exports.isArray = isArray;
|
|
41988
|
+
exports.isBreakChar = isBreakChar;
|
|
41989
|
+
exports.isCJKLike = isCJKLike;
|
|
41238
41990
|
exports.isCanvas = isCanvas;
|
|
41239
41991
|
exports.isFunction = isFunction;
|
|
41240
41992
|
exports.isIOS = isIOS;
|