@galacean/effects-threejs 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/index.js +1115 -363
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +1110 -364
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.10.0-alpha.
|
|
6
|
+
* Version: v2.10.0-alpha.1
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -726,6 +726,26 @@ function clamp$1(value, min, max) {
|
|
|
726
726
|
array[offset] = this.x;
|
|
727
727
|
array[offset + 1] = this.y;
|
|
728
728
|
};
|
|
729
|
+
/**
|
|
730
|
+
* 计算向量相对于正 x 轴的角度(弧度)
|
|
731
|
+
* @returns 弧度值
|
|
732
|
+
*/ _proto.angle = function angle() {
|
|
733
|
+
var angle = Math.atan2(-this.y, -this.x) + Math.PI;
|
|
734
|
+
return angle;
|
|
735
|
+
};
|
|
736
|
+
/**
|
|
737
|
+
* 绕指定中心点旋转向量
|
|
738
|
+
* @param center - 旋转中心
|
|
739
|
+
* @param angle - 旋转角度(弧度)
|
|
740
|
+
* @returns 旋转结果
|
|
741
|
+
*/ _proto.rotateAround = function rotateAround(center, angle) {
|
|
742
|
+
var c = Math.cos(angle), s = Math.sin(angle);
|
|
743
|
+
var x = this.x - center.x;
|
|
744
|
+
var y = this.y - center.y;
|
|
745
|
+
this.x = x * c - y * s + center.x;
|
|
746
|
+
this.y = x * s + y * c + center.y;
|
|
747
|
+
return this;
|
|
748
|
+
};
|
|
729
749
|
/**
|
|
730
750
|
* 随机生成向量
|
|
731
751
|
* @returns 向量
|
|
@@ -1279,6 +1299,25 @@ Vector2.ZERO = new Vector2(0.0, 0.0);
|
|
|
1279
1299
|
*/ _proto.applyProjectionMatrix = function applyProjectionMatrix(m, out) {
|
|
1280
1300
|
return m.projectPoint(this, out);
|
|
1281
1301
|
};
|
|
1302
|
+
/**
|
|
1303
|
+
* 从四维矩阵提取平移分量
|
|
1304
|
+
* @param m - 四维矩阵
|
|
1305
|
+
* @returns 向量
|
|
1306
|
+
*/ _proto.setFromMatrixPosition = function setFromMatrixPosition(m) {
|
|
1307
|
+
var e = m.elements;
|
|
1308
|
+
this.x = e[12];
|
|
1309
|
+
this.y = e[13];
|
|
1310
|
+
this.z = e[14];
|
|
1311
|
+
return this;
|
|
1312
|
+
};
|
|
1313
|
+
/**
|
|
1314
|
+
* 从四维矩阵提取指定列的三维分量
|
|
1315
|
+
* @param m - 四维矩阵
|
|
1316
|
+
* @param index - 列下标
|
|
1317
|
+
* @returns 向量
|
|
1318
|
+
*/ _proto.setFromMatrixColumn = function setFromMatrixColumn(m, index) {
|
|
1319
|
+
return this.setFromArray(m.elements, index * 4);
|
|
1320
|
+
};
|
|
1282
1321
|
/**
|
|
1283
1322
|
* 通过标量数值创建向量
|
|
1284
1323
|
* @param num - 数值
|
|
@@ -2919,17 +2958,27 @@ var PluginSystem = /*#__PURE__*/ function() {
|
|
|
2919
2958
|
PluginSystem.getPlugins = function getPlugins() {
|
|
2920
2959
|
return plugins;
|
|
2921
2960
|
};
|
|
2922
|
-
PluginSystem.
|
|
2923
|
-
plugins.forEach(function(
|
|
2924
|
-
return
|
|
2961
|
+
PluginSystem.notifyCompositionCreated = function notifyCompositionCreated(composition, scene) {
|
|
2962
|
+
plugins.forEach(function(plugin) {
|
|
2963
|
+
return plugin.onCompositionCreated(composition, scene);
|
|
2964
|
+
});
|
|
2965
|
+
};
|
|
2966
|
+
PluginSystem.notifyCompositionDestroy = function notifyCompositionDestroy(composition) {
|
|
2967
|
+
plugins.forEach(function(plugin) {
|
|
2968
|
+
return plugin.onCompositionDestroy(composition);
|
|
2969
|
+
});
|
|
2970
|
+
};
|
|
2971
|
+
PluginSystem.notifyEngineCreated = function notifyEngineCreated(engine) {
|
|
2972
|
+
plugins.forEach(function(plugin) {
|
|
2973
|
+
return plugin.onEngineCreated(engine);
|
|
2925
2974
|
});
|
|
2926
2975
|
};
|
|
2927
|
-
PluginSystem.
|
|
2928
|
-
plugins.forEach(function(
|
|
2929
|
-
return
|
|
2976
|
+
PluginSystem.notifyEngineDestroy = function notifyEngineDestroy(engine) {
|
|
2977
|
+
plugins.forEach(function(plugin) {
|
|
2978
|
+
return plugin.onEngineDestroy(engine);
|
|
2930
2979
|
});
|
|
2931
2980
|
};
|
|
2932
|
-
PluginSystem.
|
|
2981
|
+
PluginSystem.notifyAssetsLoadStart = function notifyAssetsLoadStart(scene, options) {
|
|
2933
2982
|
return _async_to_generator(function() {
|
|
2934
2983
|
return __generator(this, function(_state) {
|
|
2935
2984
|
return [
|
|
@@ -2941,9 +2990,9 @@ var PluginSystem = /*#__PURE__*/ function() {
|
|
|
2941
2990
|
});
|
|
2942
2991
|
})();
|
|
2943
2992
|
};
|
|
2944
|
-
PluginSystem.
|
|
2945
|
-
plugins.forEach(function(
|
|
2946
|
-
return
|
|
2993
|
+
PluginSystem.notifyAssetsLoadFinish = function notifyAssetsLoadFinish(scene, options, engine) {
|
|
2994
|
+
plugins.forEach(function(plugin) {
|
|
2995
|
+
return plugin.onAssetsLoadFinish(scene, options, engine);
|
|
2947
2996
|
});
|
|
2948
2997
|
};
|
|
2949
2998
|
return PluginSystem;
|
|
@@ -3009,6 +3058,18 @@ function getPluginUsageInfo(name) {
|
|
|
3009
3058
|
* 合成销毁时触发。
|
|
3010
3059
|
* @param composition - 合成对象
|
|
3011
3060
|
*/ _proto.onCompositionDestroy = function onCompositionDestroy(composition) {};
|
|
3061
|
+
/**
|
|
3062
|
+
* 引擎创建完成后触发。
|
|
3063
|
+
* 适用于注册引擎级单例、建立以引擎为键的映射、绑定全局监听等场景。
|
|
3064
|
+
* @param engine - 引擎实例
|
|
3065
|
+
* @since 2.10.0
|
|
3066
|
+
*/ _proto.onEngineCreated = function onEngineCreated(engine) {};
|
|
3067
|
+
/**
|
|
3068
|
+
* 引擎销毁时触发。
|
|
3069
|
+
* 适合解绑监听、释放引擎级资源或清理以引擎为键的映射。
|
|
3070
|
+
* @param engine - 引擎实例
|
|
3071
|
+
* @since 2.10.0
|
|
3072
|
+
*/ _proto.onEngineDestroy = function onEngineDestroy(engine) {};
|
|
3012
3073
|
return Plugin;
|
|
3013
3074
|
}();
|
|
3014
3075
|
|
|
@@ -4996,7 +5057,7 @@ var Animatable = /*#__PURE__*/ function() {
|
|
|
4996
5057
|
* @param qb - 四元数
|
|
4997
5058
|
* @param t - 插值比
|
|
4998
5059
|
*/ _proto.slerpQuaternions = function slerpQuaternions(qa, qb, t) {
|
|
4999
|
-
this.copyFrom(qa).slerp(qb, t);
|
|
5060
|
+
return this.copyFrom(qa).slerp(qb, t);
|
|
5000
5061
|
};
|
|
5001
5062
|
/**
|
|
5002
5063
|
* 通过四元数旋转向量
|
|
@@ -7554,7 +7615,10 @@ function setSideMode(material, side) {
|
|
|
7554
7615
|
material.cullFace = side === SideMode.BACK ? glContext.BACK : glContext.FRONT;
|
|
7555
7616
|
}
|
|
7556
7617
|
}
|
|
7557
|
-
|
|
7618
|
+
/**
|
|
7619
|
+
* @deprecated 2.10 起 runtime 内部已不再通过 `MaskMode` 设置模板测试参数。
|
|
7620
|
+
* 仅为兼容旧版本对外导出的接口而保留,新代码请勿使用。
|
|
7621
|
+
*/ function setMaskMode(material, maskMode) {
|
|
7558
7622
|
switch(maskMode){
|
|
7559
7623
|
case undefined:
|
|
7560
7624
|
material.stencilTest = false;
|
|
@@ -9439,6 +9503,13 @@ function isUniformStructArray(value) {
|
|
|
9439
9503
|
translation.x = te[12];
|
|
9440
9504
|
translation.y = te[13];
|
|
9441
9505
|
translation.z = te[14];
|
|
9506
|
+
scale.x = sx;
|
|
9507
|
+
scale.y = sy;
|
|
9508
|
+
scale.z = sz;
|
|
9509
|
+
if (Math.abs(sx) < 1e-8 || Math.abs(sy) < 1e-8 || Math.abs(sz) < 1e-8) {
|
|
9510
|
+
rotation.set(0, 0, 0, 1);
|
|
9511
|
+
return this;
|
|
9512
|
+
}
|
|
9442
9513
|
// scale the rotation part
|
|
9443
9514
|
var m = Matrix4.tempMat0;
|
|
9444
9515
|
m.copyFrom(this);
|
|
@@ -9455,9 +9526,6 @@ function isUniformStructArray(value) {
|
|
|
9455
9526
|
m.elements[9] *= invSZ;
|
|
9456
9527
|
m.elements[10] *= invSZ;
|
|
9457
9528
|
rotation.setFromRotationMatrix(m);
|
|
9458
|
-
scale.x = sx;
|
|
9459
|
-
scale.y = sy;
|
|
9460
|
-
scale.z = sz;
|
|
9461
9529
|
return this;
|
|
9462
9530
|
};
|
|
9463
9531
|
_proto.getTranslation = function getTranslation(translation) {
|
|
@@ -9468,6 +9536,45 @@ function isUniformStructArray(value) {
|
|
|
9468
9536
|
var te = this.elements;
|
|
9469
9537
|
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]));
|
|
9470
9538
|
};
|
|
9539
|
+
/**
|
|
9540
|
+
* 提取矩阵的旋转部分(去除缩放)
|
|
9541
|
+
* @param m - 源矩阵
|
|
9542
|
+
* @returns 矩阵
|
|
9543
|
+
*/ _proto.extractRotation = function extractRotation(m) {
|
|
9544
|
+
var v = Matrix4.tempVec0;
|
|
9545
|
+
var me = m.elements;
|
|
9546
|
+
var te = this.elements;
|
|
9547
|
+
var scaleX = 1 / v.set(me[0], me[1], me[2]).length();
|
|
9548
|
+
var scaleY = 1 / v.set(me[4], me[5], me[6]).length();
|
|
9549
|
+
var scaleZ = 1 / v.set(me[8], me[9], me[10]).length();
|
|
9550
|
+
te[0] = me[0] * scaleX;
|
|
9551
|
+
te[1] = me[1] * scaleX;
|
|
9552
|
+
te[2] = me[2] * scaleX;
|
|
9553
|
+
te[3] = 0;
|
|
9554
|
+
te[4] = me[4] * scaleY;
|
|
9555
|
+
te[5] = me[5] * scaleY;
|
|
9556
|
+
te[6] = me[6] * scaleY;
|
|
9557
|
+
te[7] = 0;
|
|
9558
|
+
te[8] = me[8] * scaleZ;
|
|
9559
|
+
te[9] = me[9] * scaleZ;
|
|
9560
|
+
te[10] = me[10] * scaleZ;
|
|
9561
|
+
te[11] = 0;
|
|
9562
|
+
te[12] = 0;
|
|
9563
|
+
te[13] = 0;
|
|
9564
|
+
te[14] = 0;
|
|
9565
|
+
te[15] = 1;
|
|
9566
|
+
return this;
|
|
9567
|
+
};
|
|
9568
|
+
/**
|
|
9569
|
+
* 设置矩阵的平移部分(不影响旋转和缩放)
|
|
9570
|
+
* @param v - 平移向量
|
|
9571
|
+
* @returns 矩阵
|
|
9572
|
+
*/ _proto.setPosition = function setPosition(v) {
|
|
9573
|
+
this.elements[12] = v.x;
|
|
9574
|
+
this.elements[13] = v.y;
|
|
9575
|
+
this.elements[14] = v.z;
|
|
9576
|
+
return this;
|
|
9577
|
+
};
|
|
9471
9578
|
/**
|
|
9472
9579
|
* 获得矩阵分解的结果
|
|
9473
9580
|
* @returns 分解的结果
|
|
@@ -10761,6 +10868,23 @@ Euler.tempMat0 = new Matrix4();
|
|
|
10761
10868
|
*/ _proto.equals = function equals(other) {
|
|
10762
10869
|
return this.origin.equals(other.origin) && this.direction.equals(other.direction);
|
|
10763
10870
|
};
|
|
10871
|
+
/**
|
|
10872
|
+
* 光线到平面的距离
|
|
10873
|
+
* @param plane - 平面
|
|
10874
|
+
* @returns 距离值,平行且不在平面上时返回 null,平行且在平面上时返回 0
|
|
10875
|
+
*/ _proto.distanceToPlane = function distanceToPlane(plane) {
|
|
10876
|
+
var normal = plane.normal;
|
|
10877
|
+
var denominator = normal.dot(this.direction);
|
|
10878
|
+
if (denominator === 0) {
|
|
10879
|
+
// 光线与平面平行
|
|
10880
|
+
if (normal.dot(this.origin) + plane.distance === 0) {
|
|
10881
|
+
return 0;
|
|
10882
|
+
}
|
|
10883
|
+
return null;
|
|
10884
|
+
}
|
|
10885
|
+
var t = -(this.origin.dot(normal) + plane.distance) / denominator;
|
|
10886
|
+
return t >= 0 ? t : null;
|
|
10887
|
+
};
|
|
10764
10888
|
/**
|
|
10765
10889
|
* 根据矩阵对光线进行变换
|
|
10766
10890
|
* @param m - 变换矩阵
|
|
@@ -12621,65 +12745,70 @@ exports.MaterialRenderType = void 0;
|
|
|
12621
12745
|
return new Material(engine, props);
|
|
12622
12746
|
};
|
|
12623
12747
|
|
|
12748
|
+
// 8 位 stencil buffer 上限为 255;为反向蒙版的 INCR 预留 1 的递增余量,
|
|
12749
|
+
// 否则当正向蒙版填满到 255 时,反向 INCR 会饱和、无法排除任何像素。
|
|
12750
|
+
var MAX_MASK_REFERENCE_COUNT = 254;
|
|
12624
12751
|
/**
|
|
12625
12752
|
* @internal
|
|
12626
12753
|
*/ var MaskProcessor = /*#__PURE__*/ function() {
|
|
12627
12754
|
function MaskProcessor() {
|
|
12628
12755
|
this.alphaMaskEnabled = false;
|
|
12629
12756
|
this.isMask = false;
|
|
12630
|
-
this.inverted = false;
|
|
12631
|
-
this.maskMode = exports.MaskMode.NONE;
|
|
12632
12757
|
/**
|
|
12633
12758
|
* 多个蒙版引用列表,支持正面和反面蒙版
|
|
12634
12759
|
*/ this.maskReferences = [];
|
|
12635
12760
|
/**
|
|
12636
12761
|
* 期望的 stencil 值(等于正向蒙版的数量)
|
|
12637
12762
|
*/ this.expectedStencilValue = 0;
|
|
12638
|
-
this.prevStencilFunc = [
|
|
12639
|
-
0,
|
|
12640
|
-
0
|
|
12641
|
-
];
|
|
12642
|
-
this.prevStencilOpZPass = [
|
|
12643
|
-
0,
|
|
12644
|
-
0
|
|
12645
|
-
];
|
|
12646
|
-
this.prevStencilRef = [
|
|
12647
|
-
0,
|
|
12648
|
-
0
|
|
12649
|
-
];
|
|
12650
|
-
this.prevStencilMask = [
|
|
12651
|
-
0,
|
|
12652
|
-
0
|
|
12653
|
-
];
|
|
12654
12763
|
this.stencilClearAction = {
|
|
12655
12764
|
stencilAction: exports.TextureLoadAction.clear
|
|
12656
12765
|
};
|
|
12657
12766
|
}
|
|
12658
12767
|
var _proto = MaskProcessor.prototype;
|
|
12659
12768
|
/**
|
|
12660
|
-
*
|
|
12661
|
-
|
|
12662
|
-
|
|
12663
|
-
|
|
12664
|
-
|
|
12665
|
-
* 设置蒙版选项(兼容旧版单蒙版 API)
|
|
12769
|
+
* 设置蒙版选项。
|
|
12770
|
+
*
|
|
12771
|
+
* @param data.references - 蒙版引用列表。
|
|
12772
|
+
* 传入空数组等价于无蒙版。
|
|
12773
|
+
* 超过 254 个引用时,多余部分将被忽略并打印警告。
|
|
12666
12774
|
*/ _proto.setMaskOptions = function setMaskOptions(engine, data) {
|
|
12667
|
-
var _data_isMask = data.isMask, isMask = _data_isMask === void 0 ? false : _data_isMask,
|
|
12775
|
+
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;
|
|
12668
12776
|
this.alphaMaskEnabled = alphaMaskEnabled;
|
|
12669
12777
|
this.isMask = isMask;
|
|
12670
|
-
this.inverted = inverted;
|
|
12671
12778
|
this.maskReferences = [];
|
|
12672
|
-
if (isMask) {
|
|
12673
|
-
|
|
12674
|
-
}
|
|
12675
|
-
|
|
12676
|
-
|
|
12677
|
-
|
|
12678
|
-
|
|
12679
|
-
|
|
12680
|
-
|
|
12681
|
-
});
|
|
12779
|
+
if (isMask || references.length === 0) {
|
|
12780
|
+
return;
|
|
12781
|
+
}
|
|
12782
|
+
var seen = new Map();
|
|
12783
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(references), _step; !(_step = _iterator()).done;){
|
|
12784
|
+
var ref = _step.value;
|
|
12785
|
+
var maskPath = ref.mask;
|
|
12786
|
+
if (!maskPath) {
|
|
12787
|
+
continue;
|
|
12682
12788
|
}
|
|
12789
|
+
var maskable = engine.findObject(maskPath);
|
|
12790
|
+
if (!maskable) {
|
|
12791
|
+
console.warn("Mask reference not found: " + JSON.stringify(maskPath) + ". Skipping.");
|
|
12792
|
+
continue;
|
|
12793
|
+
}
|
|
12794
|
+
var _ref_inverted;
|
|
12795
|
+
var inverted = (_ref_inverted = ref.inverted) != null ? _ref_inverted : false;
|
|
12796
|
+
var existingInverted = seen.get(maskable);
|
|
12797
|
+
if (existingInverted !== undefined) {
|
|
12798
|
+
if (existingInverted !== inverted) {
|
|
12799
|
+
console.warn("Same maskable referenced with conflicting inverted flags; keeping the first occurrence.");
|
|
12800
|
+
}
|
|
12801
|
+
continue;
|
|
12802
|
+
}
|
|
12803
|
+
if (this.maskReferences.length >= MAX_MASK_REFERENCE_COUNT) {
|
|
12804
|
+
console.warn("Maximum of " + MAX_MASK_REFERENCE_COUNT + " mask references exceeded. Additional masks will be ignored.");
|
|
12805
|
+
break;
|
|
12806
|
+
}
|
|
12807
|
+
seen.set(maskable, inverted);
|
|
12808
|
+
this.maskReferences.push({
|
|
12809
|
+
maskable: maskable,
|
|
12810
|
+
inverted: inverted
|
|
12811
|
+
});
|
|
12683
12812
|
}
|
|
12684
12813
|
};
|
|
12685
12814
|
/**
|
|
@@ -12692,8 +12821,8 @@ exports.MaterialRenderType = void 0;
|
|
|
12692
12821
|
return ref.maskable === maskable;
|
|
12693
12822
|
});
|
|
12694
12823
|
if (!exists) {
|
|
12695
|
-
if (this.maskReferences.length >=
|
|
12696
|
-
console.warn("Maximum of
|
|
12824
|
+
if (this.maskReferences.length >= MAX_MASK_REFERENCE_COUNT) {
|
|
12825
|
+
console.warn("Maximum of " + MAX_MASK_REFERENCE_COUNT + " mask references exceeded. Additional masks will be ignored.");
|
|
12697
12826
|
return;
|
|
12698
12827
|
}
|
|
12699
12828
|
this.maskReferences.push({
|
|
@@ -12719,6 +12848,11 @@ exports.MaterialRenderType = void 0;
|
|
|
12719
12848
|
this.maskReferences = [];
|
|
12720
12849
|
};
|
|
12721
12850
|
/**
|
|
12851
|
+
* 获取当前蒙版引用列表的浅拷贝。
|
|
12852
|
+
*/ _proto.getMaskReferences = function getMaskReferences() {
|
|
12853
|
+
return this.maskReferences.slice();
|
|
12854
|
+
};
|
|
12855
|
+
/**
|
|
12722
12856
|
* 绘制所有蒙版,被蒙版的元素调用。
|
|
12723
12857
|
*
|
|
12724
12858
|
* 使用递增 stencil 计数法实现任意数量蒙版的交集:
|
|
@@ -12726,12 +12860,17 @@ exports.MaterialRenderType = void 0;
|
|
|
12726
12860
|
* 2. 反向蒙版渲染,将已通过所有正向蒙版的像素标记为无效
|
|
12727
12861
|
* 3. 最终只有 stencil == 正向蒙版数量 的像素才通过测试
|
|
12728
12862
|
*
|
|
12729
|
-
* 最多支持
|
|
12863
|
+
* 最多支持 254 个蒙版引用(8 位 stencil buffer 上限 255,需为反向 INCR 预留 1)
|
|
12730
12864
|
*/ _proto.drawStencilMask = function drawStencilMask(renderer, maskedComponent) {
|
|
12731
12865
|
var frameClipMasks = maskedComponent.frameClipMasks;
|
|
12866
|
+
var addedFrameClipMasks = [];
|
|
12732
12867
|
for(var _iterator = _create_for_of_iterator_helper_loose(frameClipMasks), _step; !(_step = _iterator()).done;){
|
|
12733
12868
|
var frameClipMask = _step.value;
|
|
12869
|
+
var referenceCount = this.maskReferences.length;
|
|
12734
12870
|
this.addMaskReference(frameClipMask, false);
|
|
12871
|
+
if (this.maskReferences.length > referenceCount) {
|
|
12872
|
+
addedFrameClipMasks.push(frameClipMask);
|
|
12873
|
+
}
|
|
12735
12874
|
}
|
|
12736
12875
|
if (this.maskReferences.length > 0) {
|
|
12737
12876
|
renderer.clear(this.stencilClearAction);
|
|
@@ -12767,7 +12906,7 @@ exports.MaterialRenderType = void 0;
|
|
|
12767
12906
|
var material = _step3.value;
|
|
12768
12907
|
this.setupMaskedMaterial(material);
|
|
12769
12908
|
}
|
|
12770
|
-
for(var _iterator4 = _create_for_of_iterator_helper_loose(
|
|
12909
|
+
for(var _iterator4 = _create_for_of_iterator_helper_loose(addedFrameClipMasks), _step4; !(_step4 = _iterator4()).done;){
|
|
12771
12910
|
var frameClipMask1 = _step4.value;
|
|
12772
12911
|
this.removeMaskReference(frameClipMask1);
|
|
12773
12912
|
}
|
|
@@ -12776,24 +12915,24 @@ exports.MaterialRenderType = void 0;
|
|
|
12776
12915
|
* 绘制几何体蒙版,蒙版元素绘制时调用
|
|
12777
12916
|
*/ _proto.drawGeometryMask = function drawGeometryMask(renderer, geometry, worldMatrix, material, maskRef, subMeshIndex) {
|
|
12778
12917
|
if (subMeshIndex === void 0) subMeshIndex = 0;
|
|
12779
|
-
var
|
|
12918
|
+
var prevColorMask = material.colorMask;
|
|
12780
12919
|
var prevStencilTest = material.stencilTest;
|
|
12781
|
-
|
|
12782
|
-
|
|
12783
|
-
|
|
12784
|
-
|
|
12785
|
-
|
|
12786
|
-
|
|
12920
|
+
var prevStencilFunc = material.stencilFunc;
|
|
12921
|
+
var prevStencilOpFail = material.stencilOpFail;
|
|
12922
|
+
var prevStencilOpZFail = material.stencilOpZFail;
|
|
12923
|
+
var prevStencilOpZPass = material.stencilOpZPass;
|
|
12924
|
+
var prevStencilRef = material.stencilRef;
|
|
12925
|
+
var prevStencilMask = material.stencilMask;
|
|
12787
12926
|
this.setupMaskMaterial(material, maskRef);
|
|
12788
12927
|
renderer.drawGeometry(geometry, worldMatrix, material, subMeshIndex);
|
|
12789
|
-
material.colorMask =
|
|
12928
|
+
material.colorMask = prevColorMask;
|
|
12790
12929
|
material.stencilTest = prevStencilTest;
|
|
12791
|
-
material.stencilFunc =
|
|
12792
|
-
material.
|
|
12793
|
-
|
|
12794
|
-
|
|
12795
|
-
material.stencilRef =
|
|
12796
|
-
material.stencilMask =
|
|
12930
|
+
material.stencilFunc = prevStencilFunc;
|
|
12931
|
+
material.stencilOpFail = prevStencilOpFail;
|
|
12932
|
+
material.stencilOpZFail = prevStencilOpZFail;
|
|
12933
|
+
material.stencilOpZPass = prevStencilOpZPass;
|
|
12934
|
+
material.stencilRef = prevStencilRef;
|
|
12935
|
+
material.stencilMask = prevStencilMask;
|
|
12797
12936
|
};
|
|
12798
12937
|
/**
|
|
12799
12938
|
* 设置蒙版材质的 stencil 属性(写入蒙版)
|
|
@@ -12821,12 +12960,18 @@ exports.MaterialRenderType = void 0;
|
|
|
12821
12960
|
0xFF
|
|
12822
12961
|
];
|
|
12823
12962
|
// 通过时递增 stencil 值,不通过时保持不变
|
|
12963
|
+
material.stencilOpFail = [
|
|
12964
|
+
glContext.KEEP,
|
|
12965
|
+
glContext.KEEP
|
|
12966
|
+
];
|
|
12967
|
+
material.stencilOpZFail = [
|
|
12968
|
+
glContext.KEEP,
|
|
12969
|
+
glContext.KEEP
|
|
12970
|
+
];
|
|
12824
12971
|
material.stencilOpZPass = [
|
|
12825
12972
|
glContext.INCR,
|
|
12826
12973
|
glContext.INCR
|
|
12827
12974
|
];
|
|
12828
|
-
// material.stencilOpFail = [glContext.KEEP, glContext.KEEP];
|
|
12829
|
-
// material.stencilOpZFail = [glContext.KEEP, glContext.KEEP];
|
|
12830
12975
|
material.colorMask = false; // 不写入颜色
|
|
12831
12976
|
};
|
|
12832
12977
|
/**
|
|
@@ -12861,13 +13006,6 @@ exports.MaterialRenderType = void 0;
|
|
|
12861
13006
|
material.stencilTest = false;
|
|
12862
13007
|
}
|
|
12863
13008
|
};
|
|
12864
|
-
_proto.copyStencilArrayValue = function copyStencilArrayValue(target, source) {
|
|
12865
|
-
if (!source) {
|
|
12866
|
-
return;
|
|
12867
|
-
}
|
|
12868
|
-
target[0] = source[0];
|
|
12869
|
-
target[1] = source[1];
|
|
12870
|
-
};
|
|
12871
13009
|
_create_class(MaskProcessor, [
|
|
12872
13010
|
{
|
|
12873
13011
|
key: "maskable",
|
|
@@ -12883,7 +13021,7 @@ exports.MaterialRenderType = void 0;
|
|
|
12883
13021
|
if (value) {
|
|
12884
13022
|
this.maskReferences.push({
|
|
12885
13023
|
maskable: value,
|
|
12886
|
-
inverted:
|
|
13024
|
+
inverted: false
|
|
12887
13025
|
});
|
|
12888
13026
|
}
|
|
12889
13027
|
}
|
|
@@ -16668,19 +16806,15 @@ function buildBezierEasing(leftKeyframe, rightKeyframe) {
|
|
|
16668
16806
|
y2 = numberToFix((p2.y - p0.y) / valueInterval, 5);
|
|
16669
16807
|
}
|
|
16670
16808
|
if (x1 < 0) {
|
|
16671
|
-
console.error("Invalid bezier points, x1 < 0", p0, p1, p2, p3);
|
|
16672
16809
|
x1 = 0;
|
|
16673
16810
|
}
|
|
16674
16811
|
if (x2 < 0) {
|
|
16675
|
-
console.error("Invalid bezier points, x2 < 0", p0, p1, p2, p3);
|
|
16676
16812
|
x2 = 0;
|
|
16677
16813
|
}
|
|
16678
16814
|
if (x1 > 1) {
|
|
16679
|
-
console.error("Invalid bezier points, x1 >= 1", p0, p1, p2, p3);
|
|
16680
16815
|
x1 = 1;
|
|
16681
16816
|
}
|
|
16682
16817
|
if (x2 > 1) {
|
|
16683
|
-
console.error("Invalid bezier points, x2 >= 1", p0, p1, p2, p3);
|
|
16684
16818
|
x2 = 1;
|
|
16685
16819
|
}
|
|
16686
16820
|
var str = ("bez_" + x1 + "_" + y1 + "_" + x2 + "_" + y2).replace(/\./g, "p");
|
|
@@ -16771,10 +16905,49 @@ function oldBezierKeyFramesToNew(props) {
|
|
|
16771
16905
|
return keyframes;
|
|
16772
16906
|
}
|
|
16773
16907
|
|
|
16908
|
+
/**
|
|
16909
|
+
* 通用对象引用阶梯曲线(不插值)。对象引用不可插值,
|
|
16910
|
+
* 按时间阶梯采样取 time ≤ t 的最近关键帧。
|
|
16911
|
+
*
|
|
16912
|
+
* 继承 ValueGetter 以复用 PropertyClipPlayable<T>;数值相关方法
|
|
16913
|
+
* (toUniform/toData/getIntegrate*)保留基类 NOT_IMPLEMENT——对象引用 curve
|
|
16914
|
+
* 不走 shader 通路。典型用例:T = Sprite(sprite 属性 K 帧切图)。
|
|
16915
|
+
*/ var ReferenceCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
16916
|
+
_inherits(ReferenceCurve, ValueGetter);
|
|
16917
|
+
function ReferenceCurve() {
|
|
16918
|
+
return ValueGetter.apply(this, arguments);
|
|
16919
|
+
}
|
|
16920
|
+
var _proto = ReferenceCurve.prototype;
|
|
16921
|
+
_proto.onCreate = function onCreate(props) {
|
|
16922
|
+
this.keyframes = props;
|
|
16923
|
+
};
|
|
16924
|
+
_proto.getValue = function getValue(time) {
|
|
16925
|
+
var keys = this.keyframes;
|
|
16926
|
+
if (keys.length === 0) {
|
|
16927
|
+
return undefined;
|
|
16928
|
+
}
|
|
16929
|
+
// 阶梯采样:取 time ≤ t 的最大关键帧;t < 首帧取首帧。无插值。
|
|
16930
|
+
var result = keys[0][1];
|
|
16931
|
+
for(var i = 0; i < keys.length; i++){
|
|
16932
|
+
if (keys[i][0] <= (time != null ? time : 0)) {
|
|
16933
|
+
result = keys[i][1];
|
|
16934
|
+
} else {
|
|
16935
|
+
break;
|
|
16936
|
+
}
|
|
16937
|
+
}
|
|
16938
|
+
return result;
|
|
16939
|
+
};
|
|
16940
|
+
return ReferenceCurve;
|
|
16941
|
+
}(ValueGetter);
|
|
16942
|
+
|
|
16774
16943
|
/**
|
|
16775
16944
|
* Vector2 曲线
|
|
16776
16945
|
* TODO: add spec
|
|
16777
16946
|
*/ var VECTOR3_CURVE = 27;
|
|
16947
|
+
/**
|
|
16948
|
+
* 对象引用阶梯曲线(spec ValueType.REFERENCE_CURVE)。
|
|
16949
|
+
* props 为 [[time, value], ...],value 为已解析的对象引用实例。
|
|
16950
|
+
*/ var REFERENCE_CURVE = 28;
|
|
16778
16951
|
var _obj$5;
|
|
16779
16952
|
var map$1 = (_obj$5 = {}, _obj$5[ValueType.RANDOM] = function(props) {
|
|
16780
16953
|
if (_instanceof1(props[0], Array)) {
|
|
@@ -16831,6 +17004,9 @@ var map$1 = (_obj$5 = {}, _obj$5[ValueType.RANDOM] = function(props) {
|
|
|
16831
17004
|
}, // TODO: add spec
|
|
16832
17005
|
_obj$5[VECTOR3_CURVE] = function(props) {
|
|
16833
17006
|
return new Vector3Curve(props);
|
|
17007
|
+
}, // 对象引用阶梯曲线(不插值):props.data 为 [time, value][],value 已解析为 EffectsObject
|
|
17008
|
+
_obj$5[REFERENCE_CURVE] = function(props) {
|
|
17009
|
+
return new ReferenceCurve(props);
|
|
16834
17010
|
}, _obj$5);
|
|
16835
17011
|
function createValueGetter(args) {
|
|
16836
17012
|
if (!args || !isNaN(+args)) {
|
|
@@ -21893,16 +22069,26 @@ var canvasPool = new CanvasPool();
|
|
|
21893
22069
|
* 单张字符 atlas 的边长(像素,scale 后的实际像素,非逻辑尺寸)。
|
|
21894
22070
|
* 512×512 在 24px 字号下约可容纳 250+ 字形,常见 demo 文本足够
|
|
21895
22071
|
*/ var ATLAS_SIZE = 512;
|
|
22072
|
+
/**
|
|
22073
|
+
* 字体度量探针字符串。带重音符的 É/Å 把墨水顶推到接近字体真实 ascent,
|
|
22074
|
+
* 单字 'M' 只有 cap height(~0.7em) 太矮,会让 CJK / 带重音字顶部越过 cell 上界被裁
|
|
22075
|
+
*/ var METRICS_STRING = "|\xc9q\xc5";
|
|
22076
|
+
/** 字体度量基线符号 */ var BASELINE_SYMBOL = "M";
|
|
22077
|
+
/**
|
|
22078
|
+
* 字形 cell 四周留白(逻辑像素)。ink 略超字体度量、或 italic 斜体越界时由它吸收,
|
|
22079
|
+
* 保证 cell 采样矩形内不裁切字形
|
|
22080
|
+
*/ var GLYPH_PADDING = 4;
|
|
21896
22081
|
/**
|
|
21897
22082
|
* 一种字体(family + weight + style + size 唯一确定)对应一张 atlas。
|
|
21898
22083
|
*
|
|
21899
|
-
* Skyline 风格 packer
|
|
22084
|
+
* Skyline 风格 packer:行内堆字,行尾换行,cell 高 = ceil((fontHeight + padding*2) * 1),
|
|
22085
|
+
* 所有字共用同一 cell 高与 baseline,实现同行 baseline 对齐。
|
|
21900
22086
|
* atlas 满后 `ensureChar` 返回 null,调用方应跳过该字(不再扩页,v1 范围)。
|
|
21901
22087
|
*
|
|
21902
22088
|
* canvas 内容变更后需要 `uploadIfDirty` 重新上传到纹理 — 由调用方在使用纹理前主动触发,
|
|
21903
22089
|
* 避免每加一字都 upload 一次造成的 GL 开销
|
|
21904
22090
|
*/ var GlyphAtlas = /*#__PURE__*/ function() {
|
|
21905
|
-
function GlyphAtlas(engine, scaledFontString, ascent, descent) {
|
|
22091
|
+
function GlyphAtlas(engine, scaledFontString, /** baseline 距 cell 顶距离(像素,scale 后,仅 ascent 部分,不含 padding) */ ascentPx, /** baseline 距 cell 底距离(像素,scale 后,仅 descent 部分) */ descentPx, fontStyle) {
|
|
21906
22092
|
this.engine = engine;
|
|
21907
22093
|
this.scaledFontString = scaledFontString;
|
|
21908
22094
|
this.glyphs = new Map();
|
|
@@ -21923,11 +22109,14 @@ var canvasPool = new CanvasPool();
|
|
|
21923
22109
|
ctx.font = scaledFontString;
|
|
21924
22110
|
ctx.textBaseline = "alphabetic";
|
|
21925
22111
|
ctx.fillStyle = "#ffffff";
|
|
21926
|
-
this.
|
|
21927
|
-
this.
|
|
21928
|
-
|
|
21929
|
-
|
|
21930
|
-
|
|
22112
|
+
this.paddingPx = GLYPH_PADDING * FONT_SCALE;
|
|
22113
|
+
this.italicScale = fontStyle === "italic" ? 2 : 1;
|
|
22114
|
+
// ascent/descent 由探针 '|ÉqÅM' 测得 actualBoundingBox(重音字已抬高 ink 顶),
|
|
22115
|
+
// 两者内部保持浮点,仅 cell 高做一次外层 ceil — 与 padding 共同保证 cell 内不裁切
|
|
22116
|
+
var fontHeightPx = ascentPx + descentPx;
|
|
22117
|
+
this.baselinePx = this.paddingPx + ascentPx;
|
|
22118
|
+
this.cellHPx = Math.ceil(fontHeightPx + this.paddingPx * 2);
|
|
22119
|
+
this.lineHeight = this.cellHPx / FONT_SCALE;
|
|
21931
22120
|
this.texture = Texture.create(engine, {
|
|
21932
22121
|
sourceType: exports.TextureSourceType.image,
|
|
21933
22122
|
image: this.canvas,
|
|
@@ -21956,10 +22145,12 @@ var canvasPool = new CanvasPool();
|
|
|
21956
22145
|
ctx.font = this.scaledFontString;
|
|
21957
22146
|
// measureText 用的是 scaledFontString,advance 已经是 scale 后的像素,不能再乘 FONT_SCALE
|
|
21958
22147
|
var advancePx = ctx.measureText(char).width;
|
|
21959
|
-
|
|
21960
|
-
var
|
|
22148
|
+
// italic 放大 cell 宽防斜体越界;ceil 对齐像素网格避免相邻字采样重叠
|
|
22149
|
+
var widthPx = Math.max(1, Math.ceil(advancePx * this.italicScale));
|
|
22150
|
+
var paddedWidthPx = widthPx + this.paddingPx * 2;
|
|
22151
|
+
var cellH = this.cellHPx;
|
|
21961
22152
|
// 行尾换行
|
|
21962
|
-
if (this.currentX +
|
|
22153
|
+
if (this.currentX + paddedWidthPx > ATLAS_SIZE) {
|
|
21963
22154
|
this.currentX = 0;
|
|
21964
22155
|
this.currentY += cellH;
|
|
21965
22156
|
}
|
|
@@ -21971,15 +22162,17 @@ var canvasPool = new CanvasPool();
|
|
|
21971
22162
|
}
|
|
21972
22163
|
var px = this.currentX;
|
|
21973
22164
|
var py = this.currentY;
|
|
21974
|
-
|
|
21975
|
-
this.
|
|
22165
|
+
// baseline 落在 cell 顶部下方 paddingPx + ascentPx 处,四周 padding 吸收越界 ink
|
|
22166
|
+
ctx.fillText(char, px + this.paddingPx, py + this.baselinePx);
|
|
22167
|
+
this.currentX += paddedWidthPx;
|
|
21976
22168
|
this.dirty = true;
|
|
21977
22169
|
var info = {
|
|
21978
22170
|
px: px,
|
|
21979
22171
|
py: py,
|
|
21980
|
-
pw:
|
|
22172
|
+
pw: paddedWidthPx,
|
|
21981
22173
|
ph: cellH,
|
|
21982
|
-
|
|
22174
|
+
advance: advancePx / FONT_SCALE,
|
|
22175
|
+
paddingLeft: this.paddingPx / FONT_SCALE
|
|
21983
22176
|
};
|
|
21984
22177
|
this.glyphs.set(char, info);
|
|
21985
22178
|
return info;
|
|
@@ -22031,22 +22224,25 @@ var canvasPool = new CanvasPool();
|
|
|
22031
22224
|
if (cached) {
|
|
22032
22225
|
return cached;
|
|
22033
22226
|
}
|
|
22034
|
-
var fontString = fontStyle + " " + fontWeight + " " + fontSize + "px " + fontFamily;
|
|
22035
22227
|
var scaledFontString = fontStyle + " " + fontWeight + " " + fontSize * FONT_SCALE + "px " + fontFamily;
|
|
22036
|
-
//
|
|
22228
|
+
// 探一次得到字体级 ascent/descent(整张 atlas 共享 cell 高与 baseline,各字对齐)。
|
|
22229
|
+
// 直接在 scaledFontString 下测,得到的就是 scale 后像素,无需再乘 FONT_SCALE。
|
|
22230
|
+
// 探针用 '|ÉqÅ' + 'M':带重音符的 ÉÅ 把 ink 顶推到接近字体真实 ascent,
|
|
22231
|
+
// 单字 'M' 只有 cap height(~0.7em) 太矮,CJK / 带重音字顶部会越过 cell 上界被裁。
|
|
22232
|
+
// 取 actualBoundingBoxAscent/Descent 度量 ink 边界,跨平台语义稳定
|
|
22037
22233
|
var probeCanvasAndContext = canvasPool.getCanvasAndContext(1, 1);
|
|
22038
22234
|
var probeCtx = probeCanvasAndContext.context;
|
|
22039
|
-
var
|
|
22040
|
-
var
|
|
22235
|
+
var ascentPx = fontSize * 0.8 * FONT_SCALE;
|
|
22236
|
+
var descentPx = fontSize * 0.2 * FONT_SCALE;
|
|
22041
22237
|
try {
|
|
22042
|
-
probeCtx.font =
|
|
22043
|
-
var m = probeCtx.measureText(
|
|
22044
|
-
|
|
22045
|
-
|
|
22238
|
+
probeCtx.font = scaledFontString;
|
|
22239
|
+
var m = probeCtx.measureText(METRICS_STRING + BASELINE_SYMBOL);
|
|
22240
|
+
ascentPx = m.actualBoundingBoxAscent || ascentPx;
|
|
22241
|
+
descentPx = m.actualBoundingBoxDescent || descentPx;
|
|
22046
22242
|
} finally{
|
|
22047
22243
|
canvasPool.releaseCanvasAndContext(probeCanvasAndContext);
|
|
22048
22244
|
}
|
|
22049
|
-
var atlas = new GlyphAtlas(this.engine, scaledFontString,
|
|
22245
|
+
var atlas = new GlyphAtlas(this.engine, scaledFontString, ascentPx, descentPx, fontStyle);
|
|
22050
22246
|
this.atlases.set(fontKey, atlas);
|
|
22051
22247
|
return atlas;
|
|
22052
22248
|
};
|
|
@@ -22450,8 +22646,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
22450
22646
|
* `color` 作为乘色与白色字形 alpha 相乘,任意颜色都不会污染 atlas。
|
|
22451
22647
|
*
|
|
22452
22648
|
* 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
|
|
22453
|
-
* @param x - 文本左下角 X
|
|
22454
|
-
* @param y - 文本左下角 Y
|
|
22649
|
+
* @param x - 文本左下角 X 坐标(首字 ink 起始处,含 padding 的 quad 会向左延伸)
|
|
22650
|
+
* @param y - 文本左下角 Y 坐标(cell 底,含底部 padding;字形 ink 在其上方 padding+ascent 处)
|
|
22455
22651
|
* @param text - 要绘制的文本内容,空串直接 return
|
|
22456
22652
|
* @param fontSize - 字号(逻辑像素)
|
|
22457
22653
|
* @param color - 乘色,默认白色,范围 0-1
|
|
@@ -22482,13 +22678,15 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
22482
22678
|
var u1 = (info.px + info.pw) / ATLAS_SIZE;
|
|
22483
22679
|
var v0 = 1 - (info.py + info.ph) / ATLAS_SIZE;
|
|
22484
22680
|
var v1 = 1 - info.py / ATLAS_SIZE;
|
|
22485
|
-
|
|
22681
|
+
// quad 宽与采样区都含四周 padding(cell 留白透明);但光标只按 advance 前进,
|
|
22682
|
+
// quad 起点左偏 paddingLeft 使字形 ink 落在 cursorX — padding 区重叠无妨
|
|
22683
|
+
this.pushQuad(cursorX - info.paddingLeft, y, info.pw / FONT_SCALE, lineHeight, color, {
|
|
22486
22684
|
u0: u0,
|
|
22487
22685
|
v0: v0,
|
|
22488
22686
|
u1: u1,
|
|
22489
22687
|
v1: v1
|
|
22490
22688
|
});
|
|
22491
|
-
cursorX += info.
|
|
22689
|
+
cursorX += info.advance;
|
|
22492
22690
|
}
|
|
22493
22691
|
};
|
|
22494
22692
|
_proto.dispose = function dispose() {
|
|
@@ -22705,7 +22903,6 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
22705
22903
|
aUV: {
|
|
22706
22904
|
size: 2,
|
|
22707
22905
|
offset: 0,
|
|
22708
|
-
releasable: true,
|
|
22709
22906
|
type: glContext.FLOAT,
|
|
22710
22907
|
data: new Float32Array([
|
|
22711
22908
|
0,
|
|
@@ -22853,7 +23050,6 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
22853
23050
|
};
|
|
22854
23051
|
_proto.configureMaterial = function configureMaterial(renderer) {
|
|
22855
23052
|
var side = renderer.side, occlusion = renderer.occlusion, blendMode = renderer.blending, texture = renderer.texture;
|
|
22856
|
-
var maskMode = this.maskManager.maskMode;
|
|
22857
23053
|
var material = this.material;
|
|
22858
23054
|
material.blending = true;
|
|
22859
23055
|
material.depthTest = true;
|
|
@@ -22868,7 +23064,6 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
22868
23064
|
texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
|
|
22869
23065
|
texParams.y = preMultiAlpha;
|
|
22870
23066
|
texParams.z = renderer.renderMode;
|
|
22871
|
-
texParams.w = maskMode;
|
|
22872
23067
|
material.setVector4("_TexParams", texParams);
|
|
22873
23068
|
if (texParams.x === 0 || this.maskManager.alphaMaskEnabled) {
|
|
22874
23069
|
material.enableMacro("ALPHA_CLIP");
|
|
@@ -22896,9 +23091,9 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
22896
23091
|
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
22897
23092
|
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.whiteTexture,
|
|
22898
23093
|
occlusion: !!renderer.occlusion,
|
|
22899
|
-
transparentOcclusion: !!renderer.transparentOcclusion || this.maskManager.
|
|
23094
|
+
transparentOcclusion: !!renderer.transparentOcclusion || this.maskManager.isMask,
|
|
22900
23095
|
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
22901
|
-
mask:
|
|
23096
|
+
mask: 1
|
|
22902
23097
|
};
|
|
22903
23098
|
this.configureMaterial(this.renderer);
|
|
22904
23099
|
};
|
|
@@ -24965,6 +25160,50 @@ var SpriteLoader = /*#__PURE__*/ function(Plugin) {
|
|
|
24965
25160
|
return SpriteLoader;
|
|
24966
25161
|
}(_wrap_native_super(Plugin));
|
|
24967
25162
|
|
|
25163
|
+
exports.SpriteRotation = void 0;
|
|
25164
|
+
(function(SpriteRotation) {
|
|
25165
|
+
/** 不旋转 */ SpriteRotation[SpriteRotation["None"] = 0] = "None";
|
|
25166
|
+
/** UV 旋转 90°(对应老 splits flip=1) */ SpriteRotation[SpriteRotation["Rotate90"] = 1] = "Rotate90";
|
|
25167
|
+
})(exports.SpriteRotation || (exports.SpriteRotation = {}));
|
|
25168
|
+
exports.Sprite = /*#__PURE__*/ function(EffectsObject) {
|
|
25169
|
+
_inherits(Sprite, EffectsObject);
|
|
25170
|
+
function Sprite(engine, props) {
|
|
25171
|
+
var _this;
|
|
25172
|
+
_this = EffectsObject.call(this, engine) || this;
|
|
25173
|
+
/** 归一化 UV 矩形 [x, y, w, h],默认整张纹理 */ _this.rect = [
|
|
25174
|
+
0,
|
|
25175
|
+
0,
|
|
25176
|
+
1,
|
|
25177
|
+
1
|
|
25178
|
+
];
|
|
25179
|
+
/** UV 旋转方式(对应老 splits 的 flip 0/1) */ _this.rotation = 0;
|
|
25180
|
+
if (props) {
|
|
25181
|
+
_this.fromData(props);
|
|
25182
|
+
}
|
|
25183
|
+
return _this;
|
|
25184
|
+
}
|
|
25185
|
+
var _proto = Sprite.prototype;
|
|
25186
|
+
_proto.fromData = function fromData(data) {
|
|
25187
|
+
EffectsObject.prototype.fromData.call(this, data);
|
|
25188
|
+
// findObject 对 Texture 实例原样返回,对 {id} 解析为 Texture 实例,
|
|
25189
|
+
// 兼容反序列化(data.texture 为 {id})与手动构造(data.texture 为 Texture 实例)两条路径。
|
|
25190
|
+
this.texture = data.texture ? this.engine.findObject(data.texture) : this.engine.whiteTexture;
|
|
25191
|
+
var _data_rect;
|
|
25192
|
+
this.rect = (_data_rect = data.rect) != null ? _data_rect : [
|
|
25193
|
+
0,
|
|
25194
|
+
0,
|
|
25195
|
+
1,
|
|
25196
|
+
1
|
|
25197
|
+
];
|
|
25198
|
+
var _data_rotation;
|
|
25199
|
+
this.rotation = (_data_rotation = data.rotation) != null ? _data_rotation : 0;
|
|
25200
|
+
};
|
|
25201
|
+
return Sprite;
|
|
25202
|
+
}(EffectsObject);
|
|
25203
|
+
exports.Sprite = __decorate([
|
|
25204
|
+
effectsClass("Sprite")
|
|
25205
|
+
], exports.Sprite);
|
|
25206
|
+
|
|
24968
25207
|
/**
|
|
24969
25208
|
* 动画图可播放节点对象
|
|
24970
25209
|
* @since 2.0.0
|
|
@@ -25551,6 +25790,36 @@ var SpriteColorMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
|
|
|
25551
25790
|
return SpriteColorMixerPlayable;
|
|
25552
25791
|
}(TrackMixerPlayable);
|
|
25553
25792
|
|
|
25793
|
+
/**
|
|
25794
|
+
* Sprite 属性 K 帧 mixer。对象引用不混合:取首个激活 clip 的阶梯采样值,
|
|
25795
|
+
* 赋值 boundObject.sprite 触发 setter(同步纹理 + 重建 UV)。
|
|
25796
|
+
* 不继承 PropertyMixerPlayable(其 evaluate 开头"读当前值为 null 则 return"
|
|
25797
|
+
* 会阻断无初始 sprite 组件的 K 帧)。
|
|
25798
|
+
*/ var SpritePropertyMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
|
|
25799
|
+
_inherits(SpritePropertyMixerPlayable, TrackMixerPlayable);
|
|
25800
|
+
function SpritePropertyMixerPlayable() {
|
|
25801
|
+
return TrackMixerPlayable.apply(this, arguments);
|
|
25802
|
+
}
|
|
25803
|
+
var _proto = SpritePropertyMixerPlayable.prototype;
|
|
25804
|
+
_proto.evaluate = function evaluate(context) {
|
|
25805
|
+
var boundObject = context.output.getUserData();
|
|
25806
|
+
if (!boundObject) {
|
|
25807
|
+
return;
|
|
25808
|
+
}
|
|
25809
|
+
// 对象引用不混合:取首个激活 clip 的采样值
|
|
25810
|
+
for(var i = 0; i < this.clipPlayables.length; i++){
|
|
25811
|
+
if (this.getClipWeight(i) > 0) {
|
|
25812
|
+
var clip = this.getClipPlayable(i);
|
|
25813
|
+
if (_instanceof1(clip, PropertyClipPlayable) && clip.value) {
|
|
25814
|
+
boundObject.sprite = clip.value;
|
|
25815
|
+
}
|
|
25816
|
+
break;
|
|
25817
|
+
}
|
|
25818
|
+
}
|
|
25819
|
+
};
|
|
25820
|
+
return SpritePropertyMixerPlayable;
|
|
25821
|
+
}(TrackMixerPlayable);
|
|
25822
|
+
|
|
25554
25823
|
var SubCompositionClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
25555
25824
|
_inherits(SubCompositionClipPlayable, Playable);
|
|
25556
25825
|
function SubCompositionClipPlayable() {
|
|
@@ -25594,94 +25863,148 @@ var SubCompositionMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
|
|
|
25594
25863
|
return SubCompositionMixerPlayable;
|
|
25595
25864
|
}(TrackMixerPlayable);
|
|
25596
25865
|
|
|
25597
|
-
|
|
25598
|
-
|
|
25599
|
-
|
|
25600
|
-
|
|
25601
|
-
|
|
25602
|
-
|
|
25603
|
-
|
|
25604
|
-
|
|
25605
|
-
|
|
25606
|
-
|
|
25607
|
-
|
|
25608
|
-
|
|
25609
|
-
|
|
25610
|
-
|
|
25611
|
-
|
|
25612
|
-
|
|
25613
|
-
|
|
25614
|
-
|
|
25615
|
-
|
|
25616
|
-
this.
|
|
25617
|
-
|
|
25618
|
-
|
|
25619
|
-
|
|
25620
|
-
|
|
25621
|
-
|
|
25622
|
-
|
|
25623
|
-
|
|
25624
|
-
|
|
25625
|
-
|
|
25626
|
-
|
|
25627
|
-
|
|
25628
|
-
|
|
25629
|
-
|
|
25630
|
-
|
|
25631
|
-
|
|
25632
|
-
|
|
25633
|
-
|
|
25634
|
-
|
|
25635
|
-
this.
|
|
25636
|
-
this.
|
|
25637
|
-
|
|
25638
|
-
|
|
25639
|
-
|
|
25640
|
-
|
|
25641
|
-
|
|
25642
|
-
|
|
25643
|
-
|
|
25644
|
-
|
|
25645
|
-
|
|
25646
|
-
|
|
25647
|
-
|
|
25648
|
-
|
|
25649
|
-
|
|
25650
|
-
|
|
25651
|
-
|
|
25652
|
-
|
|
25653
|
-
|
|
25654
|
-
|
|
25655
|
-
|
|
25866
|
+
/**
|
|
25867
|
+
* 对 TransformTrack 当前激活的 Transform clip contribution 做帧内合成。
|
|
25868
|
+
* position 与 rotation 使用增量语义,scale 使用乘子语义;结果由 flush 统一写回。
|
|
25869
|
+
*/ var TransformClipMixer = /*#__PURE__*/ function() {
|
|
25870
|
+
function TransformClipMixer() {
|
|
25871
|
+
this.hasContribution = false;
|
|
25872
|
+
this.hasPosition = false;
|
|
25873
|
+
this.hasRotation = false;
|
|
25874
|
+
this.hasScale = false;
|
|
25875
|
+
this.appliedPosition = false;
|
|
25876
|
+
this.appliedRotation = false;
|
|
25877
|
+
this.appliedScale = false;
|
|
25878
|
+
this.outPos = new Vector3();
|
|
25879
|
+
this.outRot = new Euler();
|
|
25880
|
+
this.outScale = new Vector3(1, 1, 1);
|
|
25881
|
+
this.weightedRot = new Euler();
|
|
25882
|
+
}
|
|
25883
|
+
var _proto = TransformClipMixer.prototype;
|
|
25884
|
+
_proto.captureBasePose = function captureBasePose(item) {
|
|
25885
|
+
this.ensureBasePose(item);
|
|
25886
|
+
};
|
|
25887
|
+
/**
|
|
25888
|
+
* orbital position 的 contribution 依赖 base position。
|
|
25889
|
+
* 这里返回 mixer 持有的 base,确保采样和合成使用同一份参考姿态。
|
|
25890
|
+
*/ _proto.getBasePosition = function getBasePosition() {
|
|
25891
|
+
var _this_basePose;
|
|
25892
|
+
return (_this_basePose = this.basePose) == null ? void 0 : _this_basePose.position;
|
|
25893
|
+
};
|
|
25894
|
+
_proto.resetFrame = function resetFrame() {
|
|
25895
|
+
this.hasContribution = false;
|
|
25896
|
+
this.hasPosition = false;
|
|
25897
|
+
this.hasRotation = false;
|
|
25898
|
+
this.hasScale = false;
|
|
25899
|
+
};
|
|
25900
|
+
_proto.addContribution = function addContribution(item, contribution, weight) {
|
|
25901
|
+
if (weight <= 0) {
|
|
25902
|
+
return;
|
|
25903
|
+
}
|
|
25904
|
+
this.ensureBasePose(item);
|
|
25905
|
+
if (!this.hasContribution) {
|
|
25906
|
+
var base = this.basePose;
|
|
25907
|
+
this.outPos.copyFrom(base.position);
|
|
25908
|
+
this.outRot.copyFrom(base.rotation);
|
|
25909
|
+
this.outScale.copyFrom(base.scale);
|
|
25910
|
+
this.hasContribution = true;
|
|
25911
|
+
}
|
|
25912
|
+
if (contribution.hasPosition) {
|
|
25913
|
+
this.hasPosition = true;
|
|
25914
|
+
this.outPos.x += contribution.position.x * weight;
|
|
25915
|
+
this.outPos.y += contribution.position.y * weight;
|
|
25916
|
+
this.outPos.z += contribution.position.z * weight;
|
|
25917
|
+
}
|
|
25918
|
+
if (contribution.hasRotation) {
|
|
25919
|
+
this.hasRotation = true;
|
|
25920
|
+
this.weightedRot.set(contribution.rotation.x * weight, contribution.rotation.y * weight, contribution.rotation.z * weight, contribution.rotation.order);
|
|
25921
|
+
this.outRot.addEulers(this.outRot, this.weightedRot);
|
|
25922
|
+
}
|
|
25923
|
+
if (contribution.hasScale) {
|
|
25924
|
+
this.hasScale = true;
|
|
25925
|
+
// Scale contribution 使用乘子语义,weight 用于支持 clip blend/crossfade。
|
|
25926
|
+
this.outScale.x *= Math.pow(contribution.scale.x, weight);
|
|
25927
|
+
this.outScale.y *= Math.pow(contribution.scale.y, weight);
|
|
25928
|
+
this.outScale.z *= Math.pow(contribution.scale.z, weight);
|
|
25929
|
+
}
|
|
25930
|
+
};
|
|
25931
|
+
_proto.flush = function flush(item) {
|
|
25932
|
+
var base = this.basePose;
|
|
25933
|
+
if (!base || !this.hasContribution && !this.appliedPosition && !this.appliedRotation && !this.appliedScale) {
|
|
25934
|
+
return;
|
|
25935
|
+
}
|
|
25936
|
+
if (this.hasPosition) {
|
|
25937
|
+
item.transform.setPosition(this.outPos.x, this.outPos.y, this.outPos.z);
|
|
25938
|
+
this.appliedPosition = true;
|
|
25939
|
+
} else if (this.appliedPosition) {
|
|
25940
|
+
item.transform.setPosition(base.position.x, base.position.y, base.position.z);
|
|
25941
|
+
this.appliedPosition = false;
|
|
25942
|
+
}
|
|
25943
|
+
if (this.hasRotation) {
|
|
25944
|
+
item.transform.setRotation(this.outRot.x, this.outRot.y, this.outRot.z);
|
|
25945
|
+
this.appliedRotation = true;
|
|
25946
|
+
} else if (this.appliedRotation) {
|
|
25947
|
+
item.transform.setRotation(base.rotation.x, base.rotation.y, base.rotation.z);
|
|
25948
|
+
this.appliedRotation = false;
|
|
25949
|
+
}
|
|
25950
|
+
if (this.hasScale) {
|
|
25951
|
+
item.transform.setScale(this.outScale.x, this.outScale.y, this.outScale.z);
|
|
25952
|
+
this.appliedScale = true;
|
|
25953
|
+
} else if (this.appliedScale) {
|
|
25954
|
+
item.transform.setScale(base.scale.x, base.scale.y, base.scale.z);
|
|
25955
|
+
this.appliedScale = false;
|
|
25956
|
+
}
|
|
25656
25957
|
};
|
|
25657
|
-
_proto.
|
|
25658
|
-
|
|
25659
|
-
|
|
25660
|
-
|
|
25958
|
+
_proto.dispose = function dispose() {
|
|
25959
|
+
this.basePose = undefined;
|
|
25960
|
+
this.boundInstanceId = undefined;
|
|
25961
|
+
this.appliedPosition = false;
|
|
25962
|
+
this.appliedRotation = false;
|
|
25963
|
+
this.appliedScale = false;
|
|
25964
|
+
this.resetFrame();
|
|
25965
|
+
};
|
|
25966
|
+
_proto.ensureBasePose = function ensureBasePose(item) {
|
|
25967
|
+
if (!this.basePose || this.boundInstanceId !== item.getInstanceId()) {
|
|
25968
|
+
var scale = item.transform.scale;
|
|
25969
|
+
this.basePose = {
|
|
25970
|
+
position: item.transform.position.clone(),
|
|
25971
|
+
rotation: item.transform.getRotation().clone(),
|
|
25972
|
+
scale: new Vector3(scale.x, scale.y, scale.x)
|
|
25973
|
+
};
|
|
25974
|
+
this.boundInstanceId = item.getInstanceId();
|
|
25975
|
+
this.appliedPosition = false;
|
|
25976
|
+
this.appliedRotation = false;
|
|
25977
|
+
this.appliedScale = false;
|
|
25978
|
+
}
|
|
25661
25979
|
};
|
|
25662
|
-
return
|
|
25663
|
-
}(
|
|
25980
|
+
return TransformClipMixer;
|
|
25981
|
+
}();
|
|
25664
25982
|
|
|
25665
25983
|
var tempRot$1 = new Euler();
|
|
25666
|
-
var tempSize$1 = new Vector3(1, 1, 1);
|
|
25667
25984
|
var tempPos = new Vector3();
|
|
25985
|
+
var createEmptyContribution = function() {
|
|
25986
|
+
return {
|
|
25987
|
+
hasPosition: false,
|
|
25988
|
+
position: new Vector3(),
|
|
25989
|
+
hasRotation: false,
|
|
25990
|
+
rotation: new Euler(),
|
|
25991
|
+
hasScale: false,
|
|
25992
|
+
scale: new Vector3(1, 1, 1)
|
|
25993
|
+
};
|
|
25994
|
+
};
|
|
25668
25995
|
/**
|
|
25669
25996
|
* @since 2.0.0
|
|
25670
25997
|
*/ var TransformPlayable = /*#__PURE__*/ function(Playable) {
|
|
25671
25998
|
_inherits(TransformPlayable, Playable);
|
|
25672
25999
|
function TransformPlayable() {
|
|
25673
|
-
|
|
26000
|
+
var _this;
|
|
26001
|
+
_this = Playable.apply(this, arguments) || this;
|
|
26002
|
+
_this.started = false;
|
|
26003
|
+
_this.contribution = createEmptyContribution();
|
|
26004
|
+
return _this;
|
|
25674
26005
|
}
|
|
25675
26006
|
var _proto = TransformPlayable.prototype;
|
|
25676
26007
|
_proto.start = function start() {
|
|
25677
|
-
var boundItem = this.boundObject;
|
|
25678
|
-
var scale = boundItem.transform.scale;
|
|
25679
|
-
this.originalTransform = {
|
|
25680
|
-
position: boundItem.transform.position.clone(),
|
|
25681
|
-
rotation: boundItem.transform.getRotation().clone(),
|
|
25682
|
-
// TODO 编辑器 scale 没有z轴控制
|
|
25683
|
-
scale: new Vector3(scale.x, scale.y, scale.x)
|
|
25684
|
-
};
|
|
25685
26008
|
var positionOverLifetime = this.data.positionOverLifetime;
|
|
25686
26009
|
var rotationOverLifetime = this.data.rotationOverLifetime;
|
|
25687
26010
|
var sizeOverLifetime = this.data.sizeOverLifetime;
|
|
@@ -25689,7 +26012,7 @@ var tempPos = new Vector3();
|
|
|
25689
26012
|
if (positionOverLifetime && Object.keys(positionOverLifetime).length !== 0) {
|
|
25690
26013
|
this.positionOverLifetime = positionOverLifetime;
|
|
25691
26014
|
if (positionOverLifetime.path) {
|
|
25692
|
-
this.
|
|
26015
|
+
this.pathGetter = createValueGetter(positionOverLifetime.path);
|
|
25693
26016
|
}
|
|
25694
26017
|
var linearVelEnable = positionOverLifetime.linearX || positionOverLifetime.linearY || positionOverLifetime.linearZ;
|
|
25695
26018
|
if (linearVelEnable) {
|
|
@@ -25745,37 +26068,53 @@ var tempPos = new Vector3();
|
|
|
25745
26068
|
this.velocity.multiply(this.startSpeed);
|
|
25746
26069
|
};
|
|
25747
26070
|
_proto.processFrame = function processFrame(context) {
|
|
25748
|
-
|
|
25749
|
-
|
|
25750
|
-
|
|
25751
|
-
|
|
25752
|
-
this.start();
|
|
25753
|
-
}
|
|
25754
|
-
}
|
|
25755
|
-
if (this.boundObject && this.boundObject.composition) {
|
|
25756
|
-
this.sampleAnimation();
|
|
26071
|
+
this.ensureStarted();
|
|
26072
|
+
var boundObject = context.output.getUserData();
|
|
26073
|
+
if (!this.originalTransform && _instanceof1(boundObject, exports.VFXItem)) {
|
|
26074
|
+
this.captureOriginalTransform(boundObject);
|
|
25757
26075
|
}
|
|
25758
26076
|
};
|
|
25759
26077
|
/**
|
|
25760
|
-
*
|
|
25761
|
-
|
|
26078
|
+
* 采样当前帧相对 base pose 的 transform contribution。
|
|
26079
|
+
* 返回值为内部复用对象,调用方应在当前帧同步消费,不应缓存。
|
|
26080
|
+
* @param basePosition - orbital position 计算 contribution 时使用的参考位置。
|
|
26081
|
+
*/ _proto.getContribution = function getContribution(basePosition) {
|
|
26082
|
+
this.ensureStarted();
|
|
26083
|
+
this.sampleAnimation(basePosition);
|
|
26084
|
+
return this.contribution;
|
|
26085
|
+
};
|
|
26086
|
+
_proto.ensureStarted = function ensureStarted() {
|
|
26087
|
+
if (!this.started) {
|
|
26088
|
+
this.start();
|
|
26089
|
+
this.started = true;
|
|
26090
|
+
}
|
|
26091
|
+
};
|
|
26092
|
+
_proto.sampleAnimation = function sampleAnimation(basePosition) {
|
|
25762
26093
|
var _this = this;
|
|
25763
|
-
var
|
|
26094
|
+
var out = this.contribution;
|
|
26095
|
+
out.hasPosition = false;
|
|
26096
|
+
out.hasRotation = false;
|
|
26097
|
+
out.hasScale = false;
|
|
25764
26098
|
var duration = this.getDuration();
|
|
26099
|
+
if (duration <= 0) {
|
|
26100
|
+
return;
|
|
26101
|
+
}
|
|
25765
26102
|
var life = this.time / duration;
|
|
25766
26103
|
life = life < 0 ? 0 : life;
|
|
25767
26104
|
if (this.sizeXOverLifetime) {
|
|
25768
|
-
|
|
26105
|
+
out.hasScale = true;
|
|
26106
|
+
out.scale.x = this.sizeXOverLifetime.getValue(life);
|
|
25769
26107
|
if (this.sizeSeparateAxes) {
|
|
25770
|
-
|
|
25771
|
-
|
|
26108
|
+
out.scale.y = this.sizeYOverLifetime.getValue(life);
|
|
26109
|
+
out.scale.z = this.sizeZOverLifetime.getValue(life);
|
|
25772
26110
|
} else {
|
|
25773
|
-
|
|
26111
|
+
out.scale.z = out.scale.y = out.scale.x;
|
|
25774
26112
|
}
|
|
25775
|
-
|
|
25776
|
-
|
|
26113
|
+
} else {
|
|
26114
|
+
out.hasScale = false;
|
|
25777
26115
|
}
|
|
25778
26116
|
if (this.rotationOverLifetime) {
|
|
26117
|
+
out.hasRotation = true;
|
|
25779
26118
|
var func = function(v) {
|
|
25780
26119
|
return _this.rotationOverLifetime.asRotation ? v.getValue(life) : v.getIntegrateValue(0, life, duration);
|
|
25781
26120
|
};
|
|
@@ -25784,16 +26123,42 @@ var tempPos = new Vector3();
|
|
|
25784
26123
|
tempRot$1.x = separateAxes ? func(this.rotationOverLifetime.x) : 0;
|
|
25785
26124
|
tempRot$1.y = separateAxes ? func(this.rotationOverLifetime.y) : 0;
|
|
25786
26125
|
tempRot$1.z = incZ;
|
|
25787
|
-
|
|
25788
|
-
|
|
26126
|
+
out.rotation.copyFrom(tempRot$1);
|
|
26127
|
+
} else {
|
|
26128
|
+
out.hasRotation = false;
|
|
25789
26129
|
}
|
|
25790
26130
|
if (this.positionOverLifetime) {
|
|
25791
|
-
var
|
|
25792
|
-
|
|
25793
|
-
|
|
25794
|
-
|
|
26131
|
+
var _this_orbitalVelOverLifetime;
|
|
26132
|
+
out.hasPosition = true;
|
|
26133
|
+
// Orbital position 依赖参考位置;普通 position 可直接从零向量采样位移贡献。
|
|
26134
|
+
var orbitalEnabled = !!((_this_orbitalVelOverLifetime = this.orbitalVelOverLifetime) == null ? void 0 : _this_orbitalVelOverLifetime.enabled);
|
|
26135
|
+
if (orbitalEnabled && basePosition) {
|
|
26136
|
+
calculateTranslation(out.position, this, this.gravity, this.time, duration, basePosition, this.velocity);
|
|
26137
|
+
if (this.pathGetter) {
|
|
26138
|
+
out.position.add(this.pathGetter.getValue(life));
|
|
26139
|
+
}
|
|
26140
|
+
out.position.subtract(basePosition);
|
|
26141
|
+
} else {
|
|
26142
|
+
tempPos.set(0, 0, 0);
|
|
26143
|
+
calculateTranslation(out.position, this, this.gravity, this.time, duration, tempPos, this.velocity);
|
|
26144
|
+
if (this.pathGetter) {
|
|
26145
|
+
out.position.add(this.pathGetter.getValue(life));
|
|
26146
|
+
}
|
|
25795
26147
|
}
|
|
25796
|
-
|
|
26148
|
+
} else {
|
|
26149
|
+
out.hasPosition = false;
|
|
26150
|
+
}
|
|
26151
|
+
};
|
|
26152
|
+
_proto.captureOriginalTransform = function captureOriginalTransform(boundItem) {
|
|
26153
|
+
var scale = boundItem.transform.scale;
|
|
26154
|
+
this.originalTransform = {
|
|
26155
|
+
position: boundItem.transform.position.clone(),
|
|
26156
|
+
rotation: boundItem.transform.getRotation().clone(),
|
|
26157
|
+
// TODO 编辑器 scale 没有z轴控制
|
|
26158
|
+
scale: new Vector3(scale.x, scale.y, scale.x)
|
|
26159
|
+
};
|
|
26160
|
+
if (this.pathGetter) {
|
|
26161
|
+
this.originalTransform.path = this.pathGetter;
|
|
25797
26162
|
}
|
|
25798
26163
|
};
|
|
25799
26164
|
return TransformPlayable;
|
|
@@ -25818,6 +26183,104 @@ exports.TransformPlayableAsset = __decorate([
|
|
|
25818
26183
|
effectsClass(DataType.TransformPlayableAsset)
|
|
25819
26184
|
], exports.TransformPlayableAsset);
|
|
25820
26185
|
|
|
26186
|
+
/**
|
|
26187
|
+
* TransformTrack 的 mixer。
|
|
26188
|
+
* 收集当前激活的 Transform clip contribution,并委托 TransformClipMixer 合成当前帧输出。
|
|
26189
|
+
*/ var TransformMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
|
|
26190
|
+
_inherits(TransformMixerPlayable, TrackMixerPlayable);
|
|
26191
|
+
function TransformMixerPlayable() {
|
|
26192
|
+
var _this;
|
|
26193
|
+
_this = TrackMixerPlayable.apply(this, arguments) || this;
|
|
26194
|
+
_this.clipMixer = new TransformClipMixer();
|
|
26195
|
+
return _this;
|
|
26196
|
+
}
|
|
26197
|
+
var _proto = TransformMixerPlayable.prototype;
|
|
26198
|
+
_proto.dispose = function dispose() {
|
|
26199
|
+
this.clipMixer.dispose();
|
|
26200
|
+
TrackMixerPlayable.prototype.dispose.call(this);
|
|
26201
|
+
};
|
|
26202
|
+
_proto.evaluate = function evaluate(context) {
|
|
26203
|
+
var item = context.output.getUserData();
|
|
26204
|
+
if (!_instanceof1(item, exports.VFXItem)) {
|
|
26205
|
+
return;
|
|
26206
|
+
}
|
|
26207
|
+
this.clipMixer.captureBasePose(item);
|
|
26208
|
+
this.clipMixer.resetFrame();
|
|
26209
|
+
for(var i = 0; i < this.clipPlayables.length; i++){
|
|
26210
|
+
var weight = this.clipWeights[i];
|
|
26211
|
+
// RuntimeClip 会把已结束且 destroy 的 clip 权重置 0,这类 clip 不参与当前帧合成。
|
|
26212
|
+
if (!weight || weight <= 0) {
|
|
26213
|
+
continue;
|
|
26214
|
+
}
|
|
26215
|
+
var playable = this.clipPlayables[i];
|
|
26216
|
+
if (!_instanceof1(playable, TransformPlayable)) {
|
|
26217
|
+
continue;
|
|
26218
|
+
}
|
|
26219
|
+
this.clipMixer.addContribution(item, playable.getContribution(this.clipMixer.getBasePosition()), weight);
|
|
26220
|
+
}
|
|
26221
|
+
this.clipMixer.flush(item);
|
|
26222
|
+
};
|
|
26223
|
+
return TransformMixerPlayable;
|
|
26224
|
+
}(TrackMixerPlayable);
|
|
26225
|
+
|
|
26226
|
+
var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(PropertyMixerPlayable) {
|
|
26227
|
+
_inherits(Vector4PropertyMixerPlayable, PropertyMixerPlayable);
|
|
26228
|
+
function Vector4PropertyMixerPlayable() {
|
|
26229
|
+
return PropertyMixerPlayable.apply(this, arguments);
|
|
26230
|
+
}
|
|
26231
|
+
var _proto = Vector4PropertyMixerPlayable.prototype;
|
|
26232
|
+
_proto.resetPropertyValue = function resetPropertyValue() {
|
|
26233
|
+
this.propertyValue.x = 0;
|
|
26234
|
+
this.propertyValue.y = 0;
|
|
26235
|
+
this.propertyValue.z = 0;
|
|
26236
|
+
this.propertyValue.w = 0;
|
|
26237
|
+
};
|
|
26238
|
+
_proto.addWeightedValue = function addWeightedValue(curveValue, weight) {
|
|
26239
|
+
var result = this.propertyValue;
|
|
26240
|
+
result.x += curveValue.x * weight;
|
|
26241
|
+
result.y += curveValue.y * weight;
|
|
26242
|
+
result.z += curveValue.z * weight;
|
|
26243
|
+
result.w += curveValue.w * weight;
|
|
26244
|
+
};
|
|
26245
|
+
return Vector4PropertyMixerPlayable;
|
|
26246
|
+
}(PropertyMixerPlayable);
|
|
26247
|
+
var Vector3PropertyMixerPlayable = /*#__PURE__*/ function(PropertyMixerPlayable) {
|
|
26248
|
+
_inherits(Vector3PropertyMixerPlayable, PropertyMixerPlayable);
|
|
26249
|
+
function Vector3PropertyMixerPlayable() {
|
|
26250
|
+
return PropertyMixerPlayable.apply(this, arguments);
|
|
26251
|
+
}
|
|
26252
|
+
var _proto = Vector3PropertyMixerPlayable.prototype;
|
|
26253
|
+
_proto.resetPropertyValue = function resetPropertyValue() {
|
|
26254
|
+
this.propertyValue.x = 0;
|
|
26255
|
+
this.propertyValue.y = 0;
|
|
26256
|
+
this.propertyValue.z = 0;
|
|
26257
|
+
};
|
|
26258
|
+
_proto.addWeightedValue = function addWeightedValue(curveValue, weight) {
|
|
26259
|
+
var result = this.propertyValue;
|
|
26260
|
+
result.x += curveValue.x * weight;
|
|
26261
|
+
result.y += curveValue.y * weight;
|
|
26262
|
+
result.z += curveValue.z * weight;
|
|
26263
|
+
};
|
|
26264
|
+
return Vector3PropertyMixerPlayable;
|
|
26265
|
+
}(PropertyMixerPlayable);
|
|
26266
|
+
var Vector2PropertyMixerPlayable = /*#__PURE__*/ function(PropertyMixerPlayable) {
|
|
26267
|
+
_inherits(Vector2PropertyMixerPlayable, PropertyMixerPlayable);
|
|
26268
|
+
function Vector2PropertyMixerPlayable() {
|
|
26269
|
+
return PropertyMixerPlayable.apply(this, arguments);
|
|
26270
|
+
}
|
|
26271
|
+
var _proto = Vector2PropertyMixerPlayable.prototype;
|
|
26272
|
+
_proto.resetPropertyValue = function resetPropertyValue() {
|
|
26273
|
+
this.propertyValue.x = 0;
|
|
26274
|
+
this.propertyValue.y = 0;
|
|
26275
|
+
};
|
|
26276
|
+
_proto.addWeightedValue = function addWeightedValue(curveValue, weight) {
|
|
26277
|
+
var result = this.propertyValue;
|
|
26278
|
+
result.x += curveValue.x * weight;
|
|
26279
|
+
result.y += curveValue.y * weight;
|
|
26280
|
+
};
|
|
26281
|
+
return Vector2PropertyMixerPlayable;
|
|
26282
|
+
}(PropertyMixerPlayable);
|
|
26283
|
+
|
|
25821
26284
|
/**
|
|
25822
26285
|
* @since 2.0.0
|
|
25823
26286
|
*/ var TimelineClip = /*#__PURE__*/ function() {
|
|
@@ -26207,6 +26670,24 @@ exports.ColorPropertyTrack = __decorate([
|
|
|
26207
26670
|
effectsClass(DataType.ColorPropertyTrack)
|
|
26208
26671
|
], exports.ColorPropertyTrack);
|
|
26209
26672
|
|
|
26673
|
+
exports.SpritePropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
|
|
26674
|
+
_inherits(SpritePropertyTrack, PropertyTrack);
|
|
26675
|
+
function SpritePropertyTrack() {
|
|
26676
|
+
return PropertyTrack.apply(this, arguments);
|
|
26677
|
+
}
|
|
26678
|
+
var _proto = SpritePropertyTrack.prototype;
|
|
26679
|
+
_proto.createTrackMixer = function createTrackMixer() {
|
|
26680
|
+
return new SpritePropertyMixerPlayable();
|
|
26681
|
+
};
|
|
26682
|
+
_proto.updateAnimatedObject = function updateAnimatedObject(boundObject) {
|
|
26683
|
+
return boundObject.getComponent(exports.SpriteComponent);
|
|
26684
|
+
};
|
|
26685
|
+
return SpritePropertyTrack;
|
|
26686
|
+
}(PropertyTrack);
|
|
26687
|
+
exports.SpritePropertyTrack = __decorate([
|
|
26688
|
+
effectsClass("SpritePropertyTrack")
|
|
26689
|
+
], exports.SpritePropertyTrack);
|
|
26690
|
+
|
|
26210
26691
|
var Cone = /*#__PURE__*/ function() {
|
|
26211
26692
|
function Cone(props) {
|
|
26212
26693
|
var _this = this;
|
|
@@ -29711,8 +30192,6 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
29711
30192
|
occlusion: !!renderer.occlusion,
|
|
29712
30193
|
transparentOcclusion: !!renderer.transparentOcclusion,
|
|
29713
30194
|
maxCount: options.maxCount,
|
|
29714
|
-
mask: this.maskManager.getRefValue(),
|
|
29715
|
-
maskMode: this.maskManager.maskMode,
|
|
29716
30195
|
forceTarget: forceTarget,
|
|
29717
30196
|
diffuse: renderer.texture ? this.engine.findObject(renderer.texture) : undefined,
|
|
29718
30197
|
sizeOverLifetime: sizeOverLifetimeGetter,
|
|
@@ -29807,9 +30286,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
29807
30286
|
shaderCachePrefix: shaderCachePrefix,
|
|
29808
30287
|
lifetime: this.trails.lifetime,
|
|
29809
30288
|
occlusion: !!trails.occlusion,
|
|
29810
|
-
transparentOcclusion: !!trails.transparentOcclusion
|
|
29811
|
-
mask: this.maskManager.getRefValue(),
|
|
29812
|
-
maskMode: this.maskManager.maskMode
|
|
30289
|
+
transparentOcclusion: !!trails.transparentOcclusion
|
|
29813
30290
|
};
|
|
29814
30291
|
if (trails.colorOverLifetime && trails.colorOverLifetime[0] === ValueType.GRADIENT_COLOR) {
|
|
29815
30292
|
trailMeshProps.colorOverLifetime = trails.colorOverLifetime[1];
|
|
@@ -30038,6 +30515,44 @@ exports.FloatPropertyPlayableAsset = __decorate([
|
|
|
30038
30515
|
effectsClass(DataType.FloatPropertyPlayableAsset)
|
|
30039
30516
|
], exports.FloatPropertyPlayableAsset);
|
|
30040
30517
|
|
|
30518
|
+
exports.SpritePropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
30519
|
+
_inherits(SpritePropertyPlayableAsset, PlayableAsset);
|
|
30520
|
+
function SpritePropertyPlayableAsset() {
|
|
30521
|
+
var _this;
|
|
30522
|
+
_this = PlayableAsset.apply(this, arguments) || this;
|
|
30523
|
+
_this.curveData = [
|
|
30524
|
+
REFERENCE_CURVE,
|
|
30525
|
+
[]
|
|
30526
|
+
];
|
|
30527
|
+
return _this;
|
|
30528
|
+
}
|
|
30529
|
+
var _proto = SpritePropertyPlayableAsset.prototype;
|
|
30530
|
+
_proto.fromData = function fromData(data) {
|
|
30531
|
+
PlayableAsset.prototype.fromData.call(this, data);
|
|
30532
|
+
var items = data.curveData[1];
|
|
30533
|
+
// 把 DataPath 解析为 Sprite 实例
|
|
30534
|
+
var referenceCurveData = [];
|
|
30535
|
+
for(var i = 0; i < items.length; i++){
|
|
30536
|
+
var _items_i = items[i], t = _items_i[0], ref = _items_i[1];
|
|
30537
|
+
referenceCurveData.push([
|
|
30538
|
+
t,
|
|
30539
|
+
this.engine.findObject(ref)
|
|
30540
|
+
]);
|
|
30541
|
+
}
|
|
30542
|
+
this.curveData[1] = referenceCurveData;
|
|
30543
|
+
};
|
|
30544
|
+
_proto.createPlayable = function createPlayable() {
|
|
30545
|
+
var clip = new PropertyClipPlayable();
|
|
30546
|
+
clip.curve = createValueGetter(this.curveData);
|
|
30547
|
+
clip.value = clip.curve.getValue(0);
|
|
30548
|
+
return clip;
|
|
30549
|
+
};
|
|
30550
|
+
return SpritePropertyPlayableAsset;
|
|
30551
|
+
}(PlayableAsset);
|
|
30552
|
+
exports.SpritePropertyPlayableAsset = __decorate([
|
|
30553
|
+
effectsClass("SpritePropertyPlayableAsset")
|
|
30554
|
+
], exports.SpritePropertyPlayableAsset);
|
|
30555
|
+
|
|
30041
30556
|
exports.SubCompositionPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
30042
30557
|
_inherits(SubCompositionPlayableAsset, PlayableAsset);
|
|
30043
30558
|
function SubCompositionPlayableAsset() {
|
|
@@ -30285,15 +30800,6 @@ var TimelineInstance = /*#__PURE__*/ function() {
|
|
|
30285
30800
|
return TimelineInstance;
|
|
30286
30801
|
}();
|
|
30287
30802
|
|
|
30288
|
-
var singleSplits = [
|
|
30289
|
-
[
|
|
30290
|
-
0,
|
|
30291
|
-
0,
|
|
30292
|
-
1,
|
|
30293
|
-
1,
|
|
30294
|
-
0
|
|
30295
|
-
]
|
|
30296
|
-
];
|
|
30297
30803
|
var seed$3 = 0;
|
|
30298
30804
|
exports.SpriteColorPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
30299
30805
|
_inherits(SpriteColorPlayableAsset, PlayableAsset);
|
|
@@ -30381,9 +30887,6 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30381
30887
|
_this = MaskableGraphic.call(this, engine) || this;
|
|
30382
30888
|
_this.time = 0;
|
|
30383
30889
|
_this.duration = 1;
|
|
30384
|
-
/**
|
|
30385
|
-
* @internal
|
|
30386
|
-
*/ _this.splits = singleSplits;
|
|
30387
30890
|
_this.name = "MSprite" + seed$3++;
|
|
30388
30891
|
if (props) {
|
|
30389
30892
|
_this.fromData(props);
|
|
@@ -30417,38 +30920,33 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30417
30920
|
if (textureAnimation) {
|
|
30418
30921
|
var _this_material_getVector4;
|
|
30419
30922
|
var total = textureAnimation.total || textureAnimation.row * textureAnimation.col;
|
|
30420
|
-
|
|
30421
|
-
|
|
30422
|
-
var
|
|
30423
|
-
var
|
|
30424
|
-
var
|
|
30425
|
-
|
|
30426
|
-
|
|
30427
|
-
|
|
30428
|
-
|
|
30429
|
-
|
|
30430
|
-
|
|
30431
|
-
|
|
30432
|
-
|
|
30433
|
-
|
|
30434
|
-
|
|
30435
|
-
|
|
30436
|
-
|
|
30437
|
-
|
|
30438
|
-
|
|
30439
|
-
|
|
30440
|
-
|
|
30441
|
-
dy = 1 / textureAnimation.col * texRectH;
|
|
30442
|
-
} else {
|
|
30443
|
-
dx = 1 / textureAnimation.col * texRectW;
|
|
30444
|
-
dy = 1 / textureAnimation.row * texRectH;
|
|
30445
|
-
}
|
|
30923
|
+
// 帧动画不与多 split(splits.length>1)同时存在,故此处仅读 sprite 单 rect。
|
|
30924
|
+
// sprite 缺省时按整图 [0,0,1,1] 不旋转处理。
|
|
30925
|
+
var sprite = this.sprite;
|
|
30926
|
+
var _sprite_rect;
|
|
30927
|
+
var rect = (_sprite_rect = sprite == null ? void 0 : sprite.rect) != null ? _sprite_rect : [
|
|
30928
|
+
0,
|
|
30929
|
+
0,
|
|
30930
|
+
1,
|
|
30931
|
+
1
|
|
30932
|
+
];
|
|
30933
|
+
var _sprite_rotation;
|
|
30934
|
+
var flip = (_sprite_rotation = sprite == null ? void 0 : sprite.rotation) != null ? _sprite_rotation : exports.SpriteRotation.None;
|
|
30935
|
+
var isRotate90 = flip === exports.SpriteRotation.Rotate90;
|
|
30936
|
+
// rect 在纹理上的归一化矩形 [x, y, w, h];旋转 90° 时宽高互换。
|
|
30937
|
+
var rectX = rect[0];
|
|
30938
|
+
var rectY = rect[1];
|
|
30939
|
+
var rectW = isRotate90 ? rect[3] : rect[2];
|
|
30940
|
+
var rectH = isRotate90 ? rect[2] : rect[3];
|
|
30941
|
+
// 每帧在 rect 内的偏移步长;旋转 90° 时 row/col 对调。
|
|
30942
|
+
var dx = isRotate90 ? 1 / textureAnimation.row * rectW : 1 / textureAnimation.col * rectW;
|
|
30943
|
+
var dy = isRotate90 ? 1 / textureAnimation.col * rectH : 1 / textureAnimation.row * rectH;
|
|
30446
30944
|
var texOffset;
|
|
30447
30945
|
if (textureAnimation.animate) {
|
|
30448
30946
|
var frameIndex = Math.round(life * (total - 1));
|
|
30449
30947
|
var yIndex = Math.floor(frameIndex / textureAnimation.col);
|
|
30450
30948
|
var xIndex = frameIndex - yIndex * textureAnimation.col;
|
|
30451
|
-
texOffset =
|
|
30949
|
+
texOffset = isRotate90 ? [
|
|
30452
30950
|
dx * yIndex,
|
|
30453
30951
|
dy * (textureAnimation.col - xIndex)
|
|
30454
30952
|
] : [
|
|
@@ -30462,8 +30960,8 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30462
30960
|
];
|
|
30463
30961
|
}
|
|
30464
30962
|
(_this_material_getVector4 = this.material.getVector4("_TexOffset")) == null ? void 0 : _this_material_getVector4.setFromArray([
|
|
30465
|
-
|
|
30466
|
-
|
|
30963
|
+
rectX + texOffset[0],
|
|
30964
|
+
rectH + rectY - texOffset[1],
|
|
30467
30965
|
dx,
|
|
30468
30966
|
dy
|
|
30469
30967
|
]);
|
|
@@ -30484,19 +30982,31 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30484
30982
|
}
|
|
30485
30983
|
};
|
|
30486
30984
|
_proto.updateGeometry = function updateGeometry(geometry) {
|
|
30487
|
-
var
|
|
30985
|
+
var sprite = this.sprite;
|
|
30986
|
+
var _sprite_rotation;
|
|
30987
|
+
// sprite 缺省时按整图 [0,0,1,1] 不旋转处理,等价旧默认 splits=[[0,0,1,1,0]]。
|
|
30988
|
+
var flip = (_sprite_rotation = sprite == null ? void 0 : sprite.rotation) != null ? _sprite_rotation : exports.SpriteRotation.None;
|
|
30989
|
+
var _sprite_rect;
|
|
30990
|
+
var rect = (_sprite_rect = sprite == null ? void 0 : sprite.rect) != null ? _sprite_rect : [
|
|
30488
30991
|
0,
|
|
30489
30992
|
0,
|
|
30490
30993
|
1,
|
|
30994
|
+
1
|
|
30995
|
+
];
|
|
30996
|
+
var _ref = this.textureSheetAnimation ? [
|
|
30997
|
+
0,
|
|
30998
|
+
0,
|
|
30491
30999
|
1,
|
|
30492
|
-
|
|
30493
|
-
] :
|
|
30494
|
-
|
|
30495
|
-
|
|
30496
|
-
|
|
30497
|
-
|
|
30498
|
-
|
|
30499
|
-
var
|
|
31000
|
+
1
|
|
31001
|
+
] : [
|
|
31002
|
+
rect[0],
|
|
31003
|
+
rect[1],
|
|
31004
|
+
rect[2],
|
|
31005
|
+
rect[3]
|
|
31006
|
+
], x = _ref[0], y = _ref[1], w = _ref[2], h = _ref[3];
|
|
31007
|
+
var isRotate90 = flip === exports.SpriteRotation.Rotate90;
|
|
31008
|
+
var width = isRotate90 ? h : w;
|
|
31009
|
+
var height = isRotate90 ? w : h;
|
|
30500
31010
|
var angle = isRotate90 ? -Math.PI / 2 : 0;
|
|
30501
31011
|
var aUV = geometry.getAttributeData("aUV");
|
|
30502
31012
|
var aPos = geometry.getAttributeData("aPos");
|
|
@@ -30533,11 +31043,51 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30533
31043
|
});
|
|
30534
31044
|
}
|
|
30535
31045
|
};
|
|
31046
|
+
_proto.fromData = function fromData(data) {
|
|
31047
|
+
MaskableGraphic.prototype.fromData.call(this, data); // MaskableGraphic: 设 renderer.texture(whiteTexture 或 data.renderer.texture)、_MainTex、_Color
|
|
31048
|
+
// 单 split / 新数据流:引用 Sprite 资产,渲染读 this.sprite
|
|
31049
|
+
if (data.sprite) {
|
|
31050
|
+
var sprite = this.engine.findObject(data.sprite);
|
|
31051
|
+
if (sprite) {
|
|
31052
|
+
this.applySpriteToRenderer(sprite);
|
|
31053
|
+
}
|
|
31054
|
+
}
|
|
31055
|
+
this.textureSheetAnimation = data.textureSheetAnimation;
|
|
31056
|
+
var geometry = data.geometry ? this.engine.findObject(data.geometry) : this.defaultGeometry;
|
|
31057
|
+
var splits = data.splits;
|
|
31058
|
+
if (splits && splits.length > 1) {
|
|
31059
|
+
// 原有打包纹理拆分逻辑(多 split,2x2 纹理打包),保留向后兼容;
|
|
31060
|
+
// 不依赖组件 splits 字段,直接用 data.splits。
|
|
31061
|
+
this.updateGeometryFromMultiSplit(splits);
|
|
31062
|
+
} else {
|
|
31063
|
+
this.updateGeometry(geometry);
|
|
31064
|
+
}
|
|
31065
|
+
this.interaction = data.interaction;
|
|
31066
|
+
var startColor = data.options.startColor || [
|
|
31067
|
+
1,
|
|
31068
|
+
1,
|
|
31069
|
+
1,
|
|
31070
|
+
1
|
|
31071
|
+
];
|
|
31072
|
+
this.material.setColor("_Color", new Color().setFromArray(startColor));
|
|
31073
|
+
var _data_duration;
|
|
31074
|
+
//@ts-expect-error
|
|
31075
|
+
this.duration = (_data_duration = data.duration) != null ? _data_duration : this.item.duration;
|
|
31076
|
+
};
|
|
31077
|
+
/**
|
|
31078
|
+
* 应用 Sprite 资产到渲染器:同步纹理并重绑 _MainTex。不重建几何体。
|
|
31079
|
+
* fromData(后续自行 updateGeometry)与 sprite setter(随后 updateGeometry)共用。
|
|
31080
|
+
* 直接写 _sprite,避免经 setter 触发 updateGeometry。
|
|
31081
|
+
*/ _proto.applySpriteToRenderer = function applySpriteToRenderer(sprite) {
|
|
31082
|
+
this._sprite = sprite;
|
|
31083
|
+
this.renderer.texture = sprite.texture;
|
|
31084
|
+
this.material.setTexture("_MainTex", sprite.texture);
|
|
31085
|
+
};
|
|
30536
31086
|
/**
|
|
30537
31087
|
* @deprecated
|
|
30538
|
-
*
|
|
30539
|
-
|
|
30540
|
-
|
|
31088
|
+
* 原有打包纹理拆分逻辑,仅在老数据 splits.length>1(2x2 纹理打包)时使用,保留向后兼容。
|
|
31089
|
+
* 不依赖组件状态,splits 由参数传入(同时存在帧动画与多 split 的数据不存在)。
|
|
31090
|
+
*/ _proto.updateGeometryFromMultiSplit = function updateGeometryFromMultiSplit(splits) {
|
|
30541
31091
|
var sx = 1, sy = 1;
|
|
30542
31092
|
var geometry = this.defaultGeometry;
|
|
30543
31093
|
var originData = [
|
|
@@ -30558,14 +31108,7 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30558
31108
|
for(var x = 0; x < col; x++){
|
|
30559
31109
|
for(var y = 0; y < row; y++){
|
|
30560
31110
|
var base = (y * 2 + x) * 4;
|
|
30561
|
-
|
|
30562
|
-
var split = textureSheetAnimation ? [
|
|
30563
|
-
0,
|
|
30564
|
-
0,
|
|
30565
|
-
1,
|
|
30566
|
-
1,
|
|
30567
|
-
splits[0][4]
|
|
30568
|
-
] : splits[y * 2 + x];
|
|
31111
|
+
var split = splits[y * 2 + x];
|
|
30569
31112
|
var texOffset = split[4] ? [
|
|
30570
31113
|
0,
|
|
30571
31114
|
0,
|
|
@@ -30611,33 +31154,21 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30611
31154
|
geometry.setAttributeData("aUV", new Float32Array(aUV));
|
|
30612
31155
|
geometry.setDrawCount(index.length);
|
|
30613
31156
|
};
|
|
30614
|
-
|
|
30615
|
-
|
|
30616
|
-
|
|
30617
|
-
|
|
30618
|
-
|
|
30619
|
-
|
|
30620
|
-
|
|
30621
|
-
|
|
30622
|
-
|
|
30623
|
-
|
|
30624
|
-
|
|
30625
|
-
|
|
30626
|
-
|
|
30627
|
-
this.updateGeometryFromMultiSplit();
|
|
31157
|
+
_create_class(SpriteComponent, [
|
|
31158
|
+
{
|
|
31159
|
+
key: "sprite",
|
|
31160
|
+
get: /**
|
|
31161
|
+
* 当前 Sprite 资产。设置时同步纹理、重绑 _MainTex 并重建几何体 UV。
|
|
31162
|
+
* @since 2.10.0
|
|
31163
|
+
*/ function get() {
|
|
31164
|
+
return this._sprite;
|
|
31165
|
+
},
|
|
31166
|
+
set: function set(sprite) {
|
|
31167
|
+
this.applySpriteToRenderer(sprite);
|
|
31168
|
+
this.updateGeometry(this.geometry);
|
|
31169
|
+
}
|
|
30628
31170
|
}
|
|
30629
|
-
|
|
30630
|
-
var startColor = data.options.startColor || [
|
|
30631
|
-
1,
|
|
30632
|
-
1,
|
|
30633
|
-
1,
|
|
30634
|
-
1
|
|
30635
|
-
];
|
|
30636
|
-
this.material.setColor("_Color", new Color().setFromArray(startColor));
|
|
30637
|
-
var _data_duration;
|
|
30638
|
-
//@ts-expect-error
|
|
30639
|
-
this.duration = (_data_duration = data.duration) != null ? _data_duration : this.item.duration;
|
|
30640
|
-
};
|
|
31171
|
+
]);
|
|
30641
31172
|
return SpriteComponent;
|
|
30642
31173
|
}(MaskableGraphic);
|
|
30643
31174
|
exports.SpriteComponent = __decorate([
|
|
@@ -30652,6 +31183,54 @@ var ParticleLoader = /*#__PURE__*/ function(Plugin) {
|
|
|
30652
31183
|
return ParticleLoader;
|
|
30653
31184
|
}(_wrap_native_super(Plugin));
|
|
30654
31185
|
|
|
31186
|
+
/**
|
|
31187
|
+
* 文本换行机会判定:UAX #14 风格的"换行机会"模型。
|
|
31188
|
+
*
|
|
31189
|
+
* - CJK 表意字 / 假名 / 韩文音节:任意两个字之间都是合法断点(字符级)
|
|
31190
|
+
* - 空格 / 制表符 / NBSP:可断,且断行时被吞掉(不留在行尾 / 行首)
|
|
31191
|
+
* - 西文字母 / 数字:词内不可断;整体超宽时由调用方退化到字符级断(overflow-wrap)
|
|
31192
|
+
*
|
|
31193
|
+
* 不含 kinsoku 禁则(句号 / 逗号不进行首等留作后续)。
|
|
31194
|
+
*/ /** 换行机会类型(断点字符之后):决定断点字符归属及断行时是否吞掉 */ /**
|
|
31195
|
+
* 是否为可换行断点字符(空格 / 制表符 / NBSP)。
|
|
31196
|
+
* 断在此字符之前,且断行时该字符被吞掉(不进旧行也不进新行)。
|
|
31197
|
+
* @param ch - 当前字符
|
|
31198
|
+
*/ function isBreakChar(ch) {
|
|
31199
|
+
return ch === " " || ch === " " || ch === "\xa0";
|
|
31200
|
+
}
|
|
31201
|
+
/**
|
|
31202
|
+
* 是否为 CJK 类字符(中文表意字 / 假名 / 韩文音节)。可在其与相邻字符之间换行。
|
|
31203
|
+
* 用码点判定以支持 CJK 扩展 B 等代理对字符(不能用 /u 正则,browserslist 为 iOS 9)。
|
|
31204
|
+
* @param ch - 当前字符(须为完整码点,调用方应使用 Array.from 遍历)
|
|
31205
|
+
*/ function isCJKLike(ch) {
|
|
31206
|
+
var _ch_codePointAt;
|
|
31207
|
+
var cp = (_ch_codePointAt = ch.codePointAt(0)) != null ? _ch_codePointAt : 0;
|
|
31208
|
+
return cp >= 0x3400 && cp <= 0x4DBF || // CJK 统一表意扩展 A
|
|
31209
|
+
cp >= 0x4E00 && cp <= 0x9FFF || // CJK 统一表意
|
|
31210
|
+
cp >= 0xF900 && cp <= 0xFAFF || // CJK 兼容表意
|
|
31211
|
+
cp >= 0x20000 && cp <= 0x2FA1F || // CJK 扩展 B~F + 兼容增补(代理对)
|
|
31212
|
+
cp >= 0x3040 && cp <= 0x309F || // 平假名
|
|
31213
|
+
cp >= 0x30A0 && cp <= 0x30FF || // 片假名
|
|
31214
|
+
cp >= 0x31F0 && cp <= 0x31FF || // 片假名语音扩展
|
|
31215
|
+
cp >= 0xAC00 && cp <= 0xD7AF // 韩文音节
|
|
31216
|
+
;
|
|
31217
|
+
}
|
|
31218
|
+
/**
|
|
31219
|
+
* 计算 prev(已推入的字符)之后是否为换行机会。只看 prev,不看后续字符。
|
|
31220
|
+
* @param prev - 前一字符(已推入旧行)
|
|
31221
|
+
* @returns 'swallow'=prev 是空格类,断行时吞掉 prev;'keep'=prev 是 CJK,prev 留本行末、下行从其后起;false=不可断
|
|
31222
|
+
*/ function breakOpportunityAfter(prev) {
|
|
31223
|
+
// prev 是空格类 → 断在 prev 处,断行时吞掉 prev(不进旧行也不进新行)
|
|
31224
|
+
if (isBreakChar(prev)) {
|
|
31225
|
+
return "swallow";
|
|
31226
|
+
}
|
|
31227
|
+
// prev 是 CJK → prev 留本行末,下行从 prev 之后起(字符级断点,不吞)
|
|
31228
|
+
if (isCJKLike(prev)) {
|
|
31229
|
+
return "keep";
|
|
31230
|
+
}
|
|
31231
|
+
return false;
|
|
31232
|
+
}
|
|
31233
|
+
|
|
30655
31234
|
var TextLayout = /*#__PURE__*/ function() {
|
|
30656
31235
|
function TextLayout(options) {
|
|
30657
31236
|
this.width = 0;
|
|
@@ -31100,9 +31679,6 @@ var DEFAULT_FONTS = [
|
|
|
31100
31679
|
"courier"
|
|
31101
31680
|
];
|
|
31102
31681
|
/** 检测字符串是否包含需要 RTL 和连写排版的字符(阿拉伯语等) */ var HAS_RTL_OR_JOINING = /[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/;
|
|
31103
|
-
/** 可换行断点:空格、制表符等 */ var IS_BREAK_CHAR = function(ch) {
|
|
31104
|
-
return ch === " " || ch === " " || ch === "\xa0";
|
|
31105
|
-
};
|
|
31106
31682
|
var seed$2 = 0;
|
|
31107
31683
|
exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
31108
31684
|
_inherits(TextComponent, MaskableGraphic);
|
|
@@ -31202,13 +31778,15 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
31202
31778
|
var lineCount = 1;
|
|
31203
31779
|
var x = 0;
|
|
31204
31780
|
var charCountInLine = 0;
|
|
31781
|
+
// 使用码点遍历,正确处理 emoji 与 CJK 扩展 B 等代理对字符
|
|
31782
|
+
var chars = Array.from(text);
|
|
31205
31783
|
if (context) {
|
|
31206
31784
|
context.font = this.getFontDesc(this.textStyle.fontSize);
|
|
31207
31785
|
}
|
|
31208
31786
|
if (overflow === TextOverflow.display) {
|
|
31209
|
-
for(var
|
|
31787
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(chars), _step; !(_step = _iterator()).done;){
|
|
31788
|
+
var str = _step.value;
|
|
31210
31789
|
var _context_measureText;
|
|
31211
|
-
var str = text[i];
|
|
31212
31790
|
var _context_measureText_width;
|
|
31213
31791
|
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;
|
|
31214
31792
|
if (str === "\n") {
|
|
@@ -31227,12 +31805,12 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
31227
31805
|
return lineCount;
|
|
31228
31806
|
}
|
|
31229
31807
|
if (this.textLayout.keepWordIntact) {
|
|
31230
|
-
//
|
|
31808
|
+
// 单词完整换行:优先在换行机会处断行(空格吞断 / CJK 字间可断),避免从西文词中间断开
|
|
31231
31809
|
var lastBreakX = 0;
|
|
31232
31810
|
var countAtBreak = 0;
|
|
31233
|
-
for(var
|
|
31811
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(chars), _step1; !(_step1 = _iterator1()).done;){
|
|
31812
|
+
var str1 = _step1.value;
|
|
31234
31813
|
var _context_measureText1;
|
|
31235
|
-
var str1 = text[i1];
|
|
31236
31814
|
var _context_measureText_width1;
|
|
31237
31815
|
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;
|
|
31238
31816
|
if (str1 === "\n") {
|
|
@@ -31265,22 +31843,23 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
31265
31843
|
}
|
|
31266
31844
|
x += textMetrics1;
|
|
31267
31845
|
charCountInLine++;
|
|
31268
|
-
|
|
31846
|
+
// 记换行机会:str 之后可断(空格 swallow / CJK keep)。lastBreakX 含 str 宽度(str 留本行末)
|
|
31847
|
+
if (breakOpportunityAfter(str1) !== false) {
|
|
31269
31848
|
lastBreakX = x;
|
|
31270
31849
|
countAtBreak = charCountInLine;
|
|
31271
31850
|
}
|
|
31272
31851
|
}
|
|
31273
31852
|
} else {
|
|
31274
31853
|
// 逐字符换行:允许在任意字符处断开
|
|
31275
|
-
for(var
|
|
31854
|
+
for(var i = 0; i < chars.length; i++){
|
|
31276
31855
|
var _context_measureText2;
|
|
31277
|
-
var str2 =
|
|
31856
|
+
var str2 = chars[i];
|
|
31278
31857
|
var _context_measureText_width2;
|
|
31279
31858
|
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;
|
|
31280
31859
|
if (charCountInLine > 0) {
|
|
31281
31860
|
x += letterSpace;
|
|
31282
31861
|
}
|
|
31283
|
-
if (x + textMetrics2 > width &&
|
|
31862
|
+
if (x + textMetrics2 > width && i > 0 || str2 === "\n") {
|
|
31284
31863
|
lineCount++;
|
|
31285
31864
|
this.maxLineWidth = Math.max(this.maxLineWidth, x);
|
|
31286
31865
|
x = 0;
|
|
@@ -31373,8 +31952,11 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
31373
31952
|
var charsArray = [];
|
|
31374
31953
|
var charOffsetX = [];
|
|
31375
31954
|
if (layout.keepWordIntact) {
|
|
31376
|
-
//
|
|
31955
|
+
// 单词完整换行:优先在换行机会处断行(空格吞断 / CJK 字间可断),避免从西文词中间断开。
|
|
31956
|
+
// lastBreakIdx 指向断点字符在 charsArray 中的索引;breakSwallow=true 时该字符被吞(空格),
|
|
31957
|
+
// false 时该字符留本行末(CJK),下行均从 lastBreakIdx+1 起。
|
|
31377
31958
|
var lastBreakIdx = -1;
|
|
31959
|
+
var breakSwallow = false;
|
|
31378
31960
|
for(var i = 0; i < char.length; i++){
|
|
31379
31961
|
var str = char[i];
|
|
31380
31962
|
var textMetrics = context.measureText(str);
|
|
@@ -31390,15 +31972,18 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
31390
31972
|
charsArray = [];
|
|
31391
31973
|
charOffsetX = [];
|
|
31392
31974
|
lastBreakIdx = -1;
|
|
31975
|
+
breakSwallow = false;
|
|
31393
31976
|
continue;
|
|
31394
31977
|
}
|
|
31395
31978
|
var spacing = charsArray.length > 0 ? layout.letterSpace : 0;
|
|
31396
31979
|
var willWidth = x + spacing + textMetrics.width;
|
|
31397
31980
|
if (willWidth > baseWidth && charsArray.length > 0) {
|
|
31398
31981
|
if (lastBreakIdx > 0) {
|
|
31399
|
-
//
|
|
31400
|
-
|
|
31401
|
-
var
|
|
31982
|
+
// 在换行机会处断行:swallow 取 [0,lastBreakIdx)(吞掉断点字符),
|
|
31983
|
+
// keep 取 [0,lastBreakIdx](断点字符留本行末),下行均从 lastBreakIdx+1 起。
|
|
31984
|
+
var endIdx = breakSwallow ? lastBreakIdx : lastBreakIdx + 1;
|
|
31985
|
+
var lineChars = charsArray.slice(0, endIdx);
|
|
31986
|
+
var lineOffsets = charOffsetX.slice(0, endIdx);
|
|
31402
31987
|
var lineWidth = lineChars.length > 0 ? lineOffsets[lineOffsets.length - 1] + context.measureText(lineChars[lineChars.length - 1]).width : 0;
|
|
31403
31988
|
charsInfo.push({
|
|
31404
31989
|
y: y,
|
|
@@ -31419,6 +32004,7 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
31419
32004
|
x += context.measureText(charsArray[j]).width;
|
|
31420
32005
|
}
|
|
31421
32006
|
lastBreakIdx = -1;
|
|
32007
|
+
breakSwallow = false;
|
|
31422
32008
|
} else {
|
|
31423
32009
|
charsInfo.push({
|
|
31424
32010
|
y: y,
|
|
@@ -31431,6 +32017,7 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
31431
32017
|
charsArray = [];
|
|
31432
32018
|
charOffsetX = [];
|
|
31433
32019
|
lastBreakIdx = -1;
|
|
32020
|
+
breakSwallow = false;
|
|
31434
32021
|
}
|
|
31435
32022
|
}
|
|
31436
32023
|
if (charsArray.length > 0) {
|
|
@@ -31439,8 +32026,12 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
31439
32026
|
charOffsetX.push(x);
|
|
31440
32027
|
charsArray.push(str);
|
|
31441
32028
|
x += textMetrics.width;
|
|
31442
|
-
|
|
32029
|
+
// 记换行机会:str 之后可断。lastBreakIdx 指向 str(charsArray 末尾),
|
|
32030
|
+
// swallow=吞 str(空格),keep=str 留本行末(CJK)。
|
|
32031
|
+
var opp = breakOpportunityAfter(str);
|
|
32032
|
+
if (opp !== false) {
|
|
31443
32033
|
lastBreakIdx = charsArray.length - 1;
|
|
32034
|
+
breakSwallow = opp === "swallow";
|
|
31444
32035
|
}
|
|
31445
32036
|
}
|
|
31446
32037
|
} else {
|
|
@@ -33390,7 +33981,6 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
33390
33981
|
var material = Material.create(this.engine, materialProps);
|
|
33391
33982
|
var renderer = rendererOptions;
|
|
33392
33983
|
var side = renderer.side, occlusion = renderer.occlusion, blendMode = renderer.blending, texture = renderer.texture;
|
|
33393
|
-
var maskMode = this.maskManager.maskMode;
|
|
33394
33984
|
material.blending = true;
|
|
33395
33985
|
material.depthTest = true;
|
|
33396
33986
|
material.depthMask = occlusion;
|
|
@@ -33404,7 +33994,6 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
33404
33994
|
texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
|
|
33405
33995
|
texParams.y = preMultiAlpha;
|
|
33406
33996
|
texParams.z = renderer.renderMode;
|
|
33407
|
-
texParams.w = maskMode;
|
|
33408
33997
|
material.setVector4("_TexParams", texParams);
|
|
33409
33998
|
if (texParams.x === 0 || this.maskManager.alphaMaskEnabled) {
|
|
33410
33999
|
material.enableMacro("ALPHA_CLIP");
|
|
@@ -33427,9 +34016,9 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
33427
34016
|
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
33428
34017
|
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.whiteTexture,
|
|
33429
34018
|
occlusion: !!renderer.occlusion,
|
|
33430
|
-
transparentOcclusion: !!renderer.transparentOcclusion || this.maskManager.
|
|
34019
|
+
transparentOcclusion: !!renderer.transparentOcclusion || this.maskManager.isMask,
|
|
33431
34020
|
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
33432
|
-
mask:
|
|
34021
|
+
mask: 1
|
|
33433
34022
|
};
|
|
33434
34023
|
var _data_strokeCap;
|
|
33435
34024
|
this.strokeCap = (_data_strokeCap = data.strokeCap) != null ? _data_strokeCap : LineCap.Butt;
|
|
@@ -34411,7 +35000,7 @@ function getStandardInteractContent(ui) {
|
|
|
34411
35000
|
return ret;
|
|
34412
35001
|
}
|
|
34413
35002
|
|
|
34414
|
-
var
|
|
35003
|
+
var currentMaskComponentId;
|
|
34415
35004
|
var componentMap = new Map();
|
|
34416
35005
|
var itemMap = new Map();
|
|
34417
35006
|
/**
|
|
@@ -35073,12 +35662,21 @@ function version36Migration(json) {
|
|
|
35073
35662
|
for(var _iterator3 = _create_for_of_iterator_helper_loose(json.compositions), _step3; !(_step3 = _iterator3()).done;){
|
|
35074
35663
|
var composition = _step3.value;
|
|
35075
35664
|
composition.children = [];
|
|
35665
|
+
currentMaskComponentId = undefined;
|
|
35666
|
+
//@ts-expect-error
|
|
35667
|
+
var legacyCompositionItems = composition.items;
|
|
35668
|
+
if (Array.isArray(legacyCompositionItems)) {
|
|
35669
|
+
processMaskReferenceItems(legacyCompositionItems, itemMap, componentMap);
|
|
35670
|
+
}
|
|
35076
35671
|
for(var _iterator4 = _create_for_of_iterator_helper_loose(composition.components), _step4; !(_step4 = _iterator4()).done;){
|
|
35077
35672
|
var componentDataPath = _step4.value;
|
|
35078
35673
|
var componentData = componentMap.get(componentDataPath.id);
|
|
35079
35674
|
if (componentData.dataType === DataType.CompositionComponent) {
|
|
35080
35675
|
var compositionComponent = componentData;
|
|
35081
|
-
|
|
35676
|
+
var _compositionComponent_items;
|
|
35677
|
+
var compositionItems = (_compositionComponent_items = compositionComponent.items) != null ? _compositionComponent_items : [];
|
|
35678
|
+
processMaskReferenceItems(compositionItems, itemMap, componentMap);
|
|
35679
|
+
for(var _iterator5 = _create_for_of_iterator_helper_loose(compositionItems), _step5; !(_step5 = _iterator5()).done;){
|
|
35082
35680
|
var itemPath = _step5.value;
|
|
35083
35681
|
var item1 = itemMap.get(itemPath.id);
|
|
35084
35682
|
if (item1.parentId === undefined) {
|
|
@@ -35108,6 +35706,72 @@ function version36Migration(json) {
|
|
|
35108
35706
|
json.version = JSONSceneVersion["3_7"];
|
|
35109
35707
|
return json;
|
|
35110
35708
|
}
|
|
35709
|
+
/**
|
|
35710
|
+
* 3.8 数据适配:SpriteComponent 的 renderer.texture + splits 迁移为独立 Sprite 资产。
|
|
35711
|
+
*
|
|
35712
|
+
* - 遍历所有未引用 sprite 的 SpriteComponentData,按 splits[0](无则整图 [0,0,1,1])生成
|
|
35713
|
+
* Sprite 资产对象放入 miscs,并把组件的 sprite 指向它。
|
|
35714
|
+
* - 删除组件的 splits 与 renderer.texture(纹理归属 sprite,renderer 仅保留渲染状态)。
|
|
35715
|
+
* - 卫语句 `if (sc.sprite) continue` 处理混合数据(部分组件已用 sprite)。
|
|
35716
|
+
* - 多 split(splits.length>1,2x2 纹理打包)保留原 splits 不迁移,仍走 updateGeometryFromMultiSplit 旧路径。
|
|
35717
|
+
*
|
|
35718
|
+
* 由 getStandardJSON 以 `minorVersion < 8` 守卫调用,数据生命周期内只跑一次。
|
|
35719
|
+
* version 字段设为字符串 '3.8'(JSONSceneVersion 枚举无此值,运行时不依赖枚举)。
|
|
35720
|
+
*/ function version37Migration(json) {
|
|
35721
|
+
var _json;
|
|
35722
|
+
var _miscs;
|
|
35723
|
+
(_miscs = (_json = json).miscs) != null ? _miscs : _json.miscs = [];
|
|
35724
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(json.components), _step; !(_step = _iterator()).done;){
|
|
35725
|
+
var component = _step.value;
|
|
35726
|
+
var _sc_renderer;
|
|
35727
|
+
if (component.dataType !== DataType.SpriteComponent) {
|
|
35728
|
+
continue;
|
|
35729
|
+
}
|
|
35730
|
+
// 本地扩展 sprite 字段(spec 包不可改)。ComponentData 是 SpriteComponentData 的超集,
|
|
35731
|
+
// 故直接当 SpriteComponentData 用;sprite 需要写到对象上,用宽松类型承载。
|
|
35732
|
+
var sc = component;
|
|
35733
|
+
if (sc.sprite) {
|
|
35734
|
+
continue; // 已迁移/新数据
|
|
35735
|
+
}
|
|
35736
|
+
var splits = sc.splits;
|
|
35737
|
+
if (splits && splits.length > 1) {
|
|
35738
|
+
continue;
|
|
35739
|
+
}
|
|
35740
|
+
var first = splits == null ? void 0 : splits[0];
|
|
35741
|
+
var rect = first ? [
|
|
35742
|
+
first[0],
|
|
35743
|
+
first[1],
|
|
35744
|
+
first[2],
|
|
35745
|
+
first[3]
|
|
35746
|
+
] : [
|
|
35747
|
+
0,
|
|
35748
|
+
0,
|
|
35749
|
+
1,
|
|
35750
|
+
1
|
|
35751
|
+
];
|
|
35752
|
+
var _first_;
|
|
35753
|
+
// rotation: 0=None 不旋转, 1=Rotate90(值与 Sprite.SpriteRotation 枚举一致,序列化兼容)
|
|
35754
|
+
var rotation = (_first_ = first == null ? void 0 : first[4]) != null ? _first_ : 0;
|
|
35755
|
+
var spriteData = {
|
|
35756
|
+
id: generateGUID(),
|
|
35757
|
+
dataType: "Sprite",
|
|
35758
|
+
// 可能为 undefined(纯色元素)→ Sprite.fromData 兜底 whiteTexture
|
|
35759
|
+
texture: (_sc_renderer = sc.renderer) == null ? void 0 : _sc_renderer.texture,
|
|
35760
|
+
rect: rect,
|
|
35761
|
+
rotation: rotation
|
|
35762
|
+
};
|
|
35763
|
+
json.miscs.push(spriteData);
|
|
35764
|
+
sc.sprite = {
|
|
35765
|
+
id: spriteData.id
|
|
35766
|
+
};
|
|
35767
|
+
delete sc.splits;
|
|
35768
|
+
if (sc.renderer) {
|
|
35769
|
+
delete sc.renderer.texture; // 纹理归属 sprite,renderer 仅保留渲染状态
|
|
35770
|
+
}
|
|
35771
|
+
}
|
|
35772
|
+
json.version = "3.8";
|
|
35773
|
+
return json;
|
|
35774
|
+
}
|
|
35111
35775
|
/**
|
|
35112
35776
|
* 确保文本组件有版本标识字段
|
|
35113
35777
|
*/ function ensureTextVerticalAlign(options) {
|
|
@@ -35218,6 +35882,21 @@ function processContent(composition) {
|
|
|
35218
35882
|
}
|
|
35219
35883
|
}
|
|
35220
35884
|
}
|
|
35885
|
+
function processMaskReferenceItems(items, itemMap, componentMap) {
|
|
35886
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
35887
|
+
var item = _step.value;
|
|
35888
|
+
var itemProps = itemMap.get(item.id);
|
|
35889
|
+
if (!itemProps) {
|
|
35890
|
+
continue;
|
|
35891
|
+
}
|
|
35892
|
+
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) {
|
|
35893
|
+
var component = componentMap.get(itemProps.components[0].id);
|
|
35894
|
+
if (component) {
|
|
35895
|
+
processMaskReference(component);
|
|
35896
|
+
}
|
|
35897
|
+
}
|
|
35898
|
+
}
|
|
35899
|
+
}
|
|
35221
35900
|
function processMask(renderContent) {
|
|
35222
35901
|
var renderer = renderContent.renderer;
|
|
35223
35902
|
var maskMode = renderer == null ? void 0 : renderer.maskMode;
|
|
@@ -35228,16 +35907,34 @@ function processMask(renderContent) {
|
|
|
35228
35907
|
renderContent.mask = {
|
|
35229
35908
|
isMask: true
|
|
35230
35909
|
};
|
|
35231
|
-
|
|
35910
|
+
currentMaskComponentId = renderContent.id;
|
|
35232
35911
|
} else if (maskMode === ObscuredMode.OBSCURED || maskMode === ObscuredMode.REVERSE_OBSCURED) {
|
|
35233
35912
|
renderContent.mask = {
|
|
35234
35913
|
inverted: maskMode === ObscuredMode.REVERSE_OBSCURED ? true : false,
|
|
35235
35914
|
reference: {
|
|
35236
|
-
"id":
|
|
35915
|
+
"id": currentMaskComponentId
|
|
35237
35916
|
}
|
|
35238
35917
|
};
|
|
35239
35918
|
}
|
|
35240
35919
|
}
|
|
35920
|
+
function processMaskReference(renderContent) {
|
|
35921
|
+
var mask = renderContent.mask;
|
|
35922
|
+
if (mask && !mask.references && mask.reference) {
|
|
35923
|
+
var _mask_isMask, _mask_alphaMaskEnabled, _mask_inverted;
|
|
35924
|
+
// 处理旧版 mask 格式(mask.reference 和 mask.inverted 字段)
|
|
35925
|
+
// 将旧版单蒙版格式转换为 references 数组
|
|
35926
|
+
renderContent.mask = {
|
|
35927
|
+
isMask: (_mask_isMask = mask.isMask) != null ? _mask_isMask : false,
|
|
35928
|
+
alphaMaskEnabled: (_mask_alphaMaskEnabled = mask.alphaMaskEnabled) != null ? _mask_alphaMaskEnabled : false,
|
|
35929
|
+
references: [
|
|
35930
|
+
{
|
|
35931
|
+
mask: mask.reference,
|
|
35932
|
+
inverted: (_mask_inverted = mask.inverted) != null ? _mask_inverted : false
|
|
35933
|
+
}
|
|
35934
|
+
]
|
|
35935
|
+
};
|
|
35936
|
+
}
|
|
35937
|
+
}
|
|
35241
35938
|
function convertParam(content) {
|
|
35242
35939
|
if (!content) {
|
|
35243
35940
|
return;
|
|
@@ -35912,7 +36609,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
35912
36609
|
return ret;
|
|
35913
36610
|
}
|
|
35914
36611
|
|
|
35915
|
-
var version$2 = "2.10.0-alpha.
|
|
36612
|
+
var version$2 = "2.10.0-alpha.1";
|
|
35916
36613
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
35917
36614
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
35918
36615
|
var reverseParticle = false;
|
|
@@ -35930,7 +36627,7 @@ function getStandardJSON(json) {
|
|
|
35930
36627
|
if (v0.test(json.version)) {
|
|
35931
36628
|
var _exec;
|
|
35932
36629
|
reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
|
|
35933
|
-
return version36Migration(version35Migration(version34Migration(version33Migration(version32Migration(version31Migration(version30Migration(version21Migration(getStandardJSONFromV0(json)))))))));
|
|
36630
|
+
return version37Migration(version36Migration(version35Migration(version34Migration(version33Migration(version32Migration(version31Migration(version30Migration(version21Migration(getStandardJSONFromV0(json))))))))));
|
|
35934
36631
|
}
|
|
35935
36632
|
reverseParticle = false;
|
|
35936
36633
|
var vs = standardVersion.exec(json.version) || [];
|
|
@@ -35967,6 +36664,9 @@ function getStandardJSON(json) {
|
|
|
35967
36664
|
if (minorVersion < 7) {
|
|
35968
36665
|
json = version36Migration(json);
|
|
35969
36666
|
}
|
|
36667
|
+
if (minorVersion < 8) {
|
|
36668
|
+
json = version37Migration(json);
|
|
36669
|
+
}
|
|
35970
36670
|
}
|
|
35971
36671
|
return json;
|
|
35972
36672
|
}
|
|
@@ -36425,11 +37125,15 @@ var seed$1 = 1;
|
|
|
36425
37125
|
var _proto = AssetManager.prototype;
|
|
36426
37126
|
_proto.updateOptions = function updateOptions(options) {
|
|
36427
37127
|
if (options === void 0) options = {};
|
|
36428
|
-
|
|
36429
|
-
|
|
36430
|
-
options.
|
|
37128
|
+
var _options_useCompressedTexture, _options_useHevcVideo;
|
|
37129
|
+
this.options = _extends({}, options, {
|
|
37130
|
+
useCompressedTexture: (_options_useCompressedTexture = options.useCompressedTexture) != null ? _options_useCompressedTexture : true,
|
|
37131
|
+
useHevcVideo: (_options_useHevcVideo = options.useHevcVideo) != null ? _options_useHevcVideo : true
|
|
37132
|
+
});
|
|
37133
|
+
if (!this.options.pluginData) {
|
|
37134
|
+
this.options.pluginData = {};
|
|
36431
37135
|
}
|
|
36432
|
-
var
|
|
37136
|
+
var _this_options = this.options, _this_options_timeout = _this_options.timeout, timeout = _this_options_timeout === void 0 ? 10 : _this_options_timeout;
|
|
36433
37137
|
this.timeout = timeout;
|
|
36434
37138
|
};
|
|
36435
37139
|
/**
|
|
@@ -36687,12 +37391,19 @@ var seed$1 = 1;
|
|
|
36687
37391
|
if (canUseKTX2 === void 0) canUseKTX2 = false;
|
|
36688
37392
|
var _this = this;
|
|
36689
37393
|
return _async_to_generator(function() {
|
|
36690
|
-
var _this_options, useCompressedTexture, variables, disableWebP, disableAVIF, baseUrl, jobs, loadedImages;
|
|
37394
|
+
var _this_options, useCompressedTexture, variables, disableWebP, disableAVIF, isKTX2PluginRegistered, canUseCompressedTexture, baseUrl, jobs, loadedImages;
|
|
36691
37395
|
return __generator(this, function(_state) {
|
|
36692
37396
|
switch(_state.label){
|
|
36693
37397
|
case 0:
|
|
36694
37398
|
_this_options = _this.options, useCompressedTexture = _this_options.useCompressedTexture, variables = _this_options.variables, disableWebP = _this_options.disableWebP, disableAVIF = _this_options.disableAVIF;
|
|
37399
|
+
isKTX2PluginRegistered = !!pluginLoaderMap.ktx2;
|
|
37400
|
+
canUseCompressedTexture = useCompressedTexture && canUseKTX2 && isKTX2PluginRegistered;
|
|
36695
37401
|
baseUrl = _this.baseUrl;
|
|
37402
|
+
if (useCompressedTexture && canUseKTX2 && !isKTX2PluginRegistered && images.some(function(img) {
|
|
37403
|
+
return "ktx2" in img && img.ktx2;
|
|
37404
|
+
})) {
|
|
37405
|
+
logger.warn("The plugin 'ktx2' is not found, unable to use compressed textures." + getPluginUsageInfo("ktx2"));
|
|
37406
|
+
}
|
|
36696
37407
|
jobs = images.map(/*#__PURE__*/ _async_to_generator(function(img, idx) {
|
|
36697
37408
|
var png, webp, avif, ktx2, imageURL, webpURL, avifURL, ktx2URL, id, template, background, url, isVideo, loadFn, resultImage, e, _ref, url1, image, _tmp;
|
|
36698
37409
|
return __generator(this, function(_state) {
|
|
@@ -36707,7 +37418,7 @@ var seed$1 = 1;
|
|
|
36707
37418
|
// eslint-disable-next-line compat/compat
|
|
36708
37419
|
avifURL = !disableAVIF && avif ? new URL(avif, baseUrl).href : undefined;
|
|
36709
37420
|
// eslint-disable-next-line compat/compat
|
|
36710
|
-
ktx2URL = ktx2 &&
|
|
37421
|
+
ktx2URL = ktx2 && canUseCompressedTexture ? new URL(ktx2, baseUrl).href : undefined;
|
|
36711
37422
|
id = img.id;
|
|
36712
37423
|
if (!("template" in img)) return [
|
|
36713
37424
|
3,
|
|
@@ -36859,7 +37570,7 @@ var seed$1 = 1;
|
|
|
36859
37570
|
case 0:
|
|
36860
37571
|
return [
|
|
36861
37572
|
4,
|
|
36862
|
-
PluginSystem.
|
|
37573
|
+
PluginSystem.notifyAssetsLoadStart(scene, _this.options)
|
|
36863
37574
|
];
|
|
36864
37575
|
case 1:
|
|
36865
37576
|
_state.sent();
|
|
@@ -37941,7 +38652,7 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
37941
38652
|
_this.onItemMessage = onItemMessage;
|
|
37942
38653
|
}
|
|
37943
38654
|
_this.createRenderFrame();
|
|
37944
|
-
PluginSystem.
|
|
38655
|
+
PluginSystem.notifyCompositionCreated(_assert_this_initialized(_this), scene);
|
|
37945
38656
|
return _this;
|
|
37946
38657
|
}
|
|
37947
38658
|
var _proto = Composition.prototype;
|
|
@@ -38305,18 +39016,13 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
38305
39016
|
// }
|
|
38306
39017
|
};
|
|
38307
39018
|
_proto.lost = function lost(e) {
|
|
38308
|
-
|
|
38309
|
-
if ("video" in tex.source) {
|
|
38310
|
-
tex.source.video.pause();
|
|
38311
|
-
return tex.source.video.currentTime;
|
|
38312
|
-
}
|
|
38313
|
-
});
|
|
38314
|
-
this.textures.map(function(tex) {
|
|
38315
|
-
return tex.dispose();
|
|
38316
|
-
});
|
|
38317
|
-
this.dispose();
|
|
39019
|
+
// GPU 资源由引擎统一 rebuild,合成仅保留纯 JS 运行时状态,此处无需处理。
|
|
38318
39020
|
};
|
|
38319
39021
|
/**
|
|
39022
|
+
* 上下文恢复后的空操作。
|
|
39023
|
+
* GPU 资源已由引擎统一重建,视频纹理会在下次渲染时自然更新,不自动重新播放。
|
|
39024
|
+
*/ _proto.restore = function restore() {};
|
|
39025
|
+
/**
|
|
38320
39026
|
* 合成对象销毁
|
|
38321
39027
|
*/ _proto.dispose = function dispose() {
|
|
38322
39028
|
var _this = this;
|
|
@@ -38341,7 +39047,7 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
38341
39047
|
this.root.dispose();
|
|
38342
39048
|
// FIXME: 注意这里增加了renderFrame销毁
|
|
38343
39049
|
this.renderFrame.dispose();
|
|
38344
|
-
PluginSystem.
|
|
39050
|
+
PluginSystem.notifyCompositionDestroy(this);
|
|
38345
39051
|
this.update = function() {
|
|
38346
39052
|
{
|
|
38347
39053
|
logger.error("Update disposed composition: " + _this.name + ".");
|
|
@@ -40255,12 +40961,20 @@ var DEFAULT_FPS = 60;
|
|
|
40255
40961
|
* 计时器
|
|
40256
40962
|
* 手动渲染 `manualRender=true` 时不创建计时器
|
|
40257
40963
|
*/ _this.ticker = null;
|
|
40964
|
+
/**
|
|
40965
|
+
* 是否不处理上下文丢失恢复(构造期配置,默认 true)
|
|
40966
|
+
*/ _this.doNotHandleContextLost = true;
|
|
40967
|
+
/**
|
|
40968
|
+
* WebGL 上下文是否处于丢失状态
|
|
40969
|
+
*/ _this.contextWasLost = false;
|
|
40258
40970
|
_this._disposed = false;
|
|
40259
40971
|
_this.textures = [];
|
|
40260
40972
|
_this.materials = [];
|
|
40261
40973
|
_this.geometries = [];
|
|
40262
40974
|
_this.meshes = [];
|
|
40263
40975
|
_this.renderPasses = [];
|
|
40976
|
+
_this.framebuffers = [];
|
|
40977
|
+
_this.renderbuffers = [];
|
|
40264
40978
|
_this.clearAction = {
|
|
40265
40979
|
stencilAction: exports.TextureLoadAction.clear,
|
|
40266
40980
|
clearStencil: 0,
|
|
@@ -40277,6 +40991,8 @@ var DEFAULT_FPS = 60;
|
|
|
40277
40991
|
_this.canvas = canvas;
|
|
40278
40992
|
var _options_env;
|
|
40279
40993
|
_this.env = (_options_env = options == null ? void 0 : options.env) != null ? _options_env : "";
|
|
40994
|
+
var _options_doNotHandleContextLost;
|
|
40995
|
+
_this.doNotHandleContextLost = (_options_doNotHandleContextLost = options == null ? void 0 : options.doNotHandleContextLost) != null ? _options_doNotHandleContextLost : true;
|
|
40280
40996
|
var _options_name;
|
|
40281
40997
|
_this.name = (_options_name = options == null ? void 0 : options.name) != null ? _options_name : _this.name;
|
|
40282
40998
|
var _options_pixelRatio;
|
|
@@ -40302,6 +41018,7 @@ var DEFAULT_FPS = 60;
|
|
|
40302
41018
|
// @ts-expect-error
|
|
40303
41019
|
currentFrame: {}
|
|
40304
41020
|
};
|
|
41021
|
+
PluginSystem.notifyEngineCreated(_assert_this_initialized(_this));
|
|
40305
41022
|
return _this;
|
|
40306
41023
|
}
|
|
40307
41024
|
var _proto = Engine.prototype;
|
|
@@ -40401,6 +41118,10 @@ var DEFAULT_FPS = 60;
|
|
|
40401
41118
|
(_this_ticker = this.ticker) == null ? void 0 : _this_ticker.add(renderFunction);
|
|
40402
41119
|
};
|
|
40403
41120
|
_proto.mainLoop = function mainLoop(dt) {
|
|
41121
|
+
// 上下文丢失/恢复期间跳过渲染,避免打到失效的 GL 上下文。
|
|
41122
|
+
if (this.contextWasLost) {
|
|
41123
|
+
return;
|
|
41124
|
+
}
|
|
40404
41125
|
var renderErrors = this.renderErrors;
|
|
40405
41126
|
if (renderErrors.size > 0) {
|
|
40406
41127
|
var // 有渲染错误时暂停播放
|
|
@@ -40613,6 +41334,30 @@ var DEFAULT_FPS = 60;
|
|
|
40613
41334
|
}
|
|
40614
41335
|
removeItem(this.renderPasses, pass);
|
|
40615
41336
|
};
|
|
41337
|
+
_proto.addFramebuffer = function addFramebuffer(framebuffer) {
|
|
41338
|
+
if (this.disposed) {
|
|
41339
|
+
return;
|
|
41340
|
+
}
|
|
41341
|
+
addItem(this.framebuffers, framebuffer);
|
|
41342
|
+
};
|
|
41343
|
+
_proto.removeFramebuffer = function removeFramebuffer(framebuffer) {
|
|
41344
|
+
if (this.disposed) {
|
|
41345
|
+
return;
|
|
41346
|
+
}
|
|
41347
|
+
removeItem(this.framebuffers, framebuffer);
|
|
41348
|
+
};
|
|
41349
|
+
_proto.addRenderbuffer = function addRenderbuffer(renderbuffer) {
|
|
41350
|
+
if (this.disposed) {
|
|
41351
|
+
return;
|
|
41352
|
+
}
|
|
41353
|
+
addItem(this.renderbuffers, renderbuffer);
|
|
41354
|
+
};
|
|
41355
|
+
_proto.removeRenderbuffer = function removeRenderbuffer(renderbuffer) {
|
|
41356
|
+
if (this.disposed) {
|
|
41357
|
+
return;
|
|
41358
|
+
}
|
|
41359
|
+
removeItem(this.renderbuffers, renderbuffer);
|
|
41360
|
+
};
|
|
40616
41361
|
_proto.addComposition = function addComposition(composition) {
|
|
40617
41362
|
if (this.disposed) {
|
|
40618
41363
|
return;
|
|
@@ -40722,6 +41467,7 @@ var DEFAULT_FPS = 60;
|
|
|
40722
41467
|
return;
|
|
40723
41468
|
}
|
|
40724
41469
|
this._disposed = true;
|
|
41470
|
+
PluginSystem.notifyEngineDestroy(this);
|
|
40725
41471
|
var info = [];
|
|
40726
41472
|
if (this.renderPasses.length > 0) {
|
|
40727
41473
|
info.push("Pass " + this.renderPasses.length);
|
|
@@ -40897,8 +41643,8 @@ var PassTextureCache = /*#__PURE__*/ function() {
|
|
|
40897
41643
|
case 1:
|
|
40898
41644
|
loadedScene = _state.sent();
|
|
40899
41645
|
engine.clearResources();
|
|
40900
|
-
//
|
|
40901
|
-
PluginSystem.
|
|
41646
|
+
// 通过 PluginSystem.notifyAssetsLoadFinish 通知所有插件的 onAssetsLoadFinish 回调
|
|
41647
|
+
PluginSystem.notifyAssetsLoadFinish(loadedScene, assetManager.options, engine);
|
|
40902
41648
|
engine.assetService.prepareAssets(loadedScene, loadedScene.assets);
|
|
40903
41649
|
engine.assetService.updateTextVariables(loadedScene, options.variables);
|
|
40904
41650
|
composition = _this.createComposition(loadedScene, engine, options);
|
|
@@ -40959,8 +41705,8 @@ var PrecompositionManager = /*#__PURE__*/ function() {
|
|
|
40959
41705
|
var options = precomposition.options;
|
|
40960
41706
|
var engine = composition.engine;
|
|
40961
41707
|
engine.clearResources();
|
|
40962
|
-
//
|
|
40963
|
-
PluginSystem.
|
|
41708
|
+
// 通过 PluginSystem.notifyAssetsLoadFinish 通知所有插件的 onAssetsLoadFinish 回调
|
|
41709
|
+
PluginSystem.notifyAssetsLoadFinish(scene, options, engine);
|
|
40964
41710
|
engine.assetService.prepareAssets(scene, scene.assets);
|
|
40965
41711
|
engine.assetService.updateTextVariables(scene, options.variables);
|
|
40966
41712
|
composition.createTexturesFromData(scene.textureOptions);
|
|
@@ -41000,7 +41746,7 @@ registerPlugin("text", TextLoader);
|
|
|
41000
41746
|
registerPlugin("sprite", SpriteLoader);
|
|
41001
41747
|
registerPlugin("particle", ParticleLoader);
|
|
41002
41748
|
registerPlugin("interact", InteractLoader);
|
|
41003
|
-
var version$1 = "2.10.0-alpha.
|
|
41749
|
+
var version$1 = "2.10.0-alpha.1";
|
|
41004
41750
|
logger.info("Core version: " + version$1 + ".");
|
|
41005
41751
|
|
|
41006
41752
|
var _obj;
|
|
@@ -42284,8 +43030,8 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
|
|
|
42284
43030
|
_$scene = _state.sent();
|
|
42285
43031
|
engine = _this.engine;
|
|
42286
43032
|
engine.clearResources();
|
|
42287
|
-
//
|
|
42288
|
-
PluginSystem.
|
|
43033
|
+
// 通过 PluginSystem.notifyAssetsLoadFinish 通知所有插件的 onAssetsLoadFinish 回调
|
|
43034
|
+
PluginSystem.notifyAssetsLoadFinish(_$scene, assetManager.options, engine);
|
|
42289
43035
|
_this.assetService.prepareAssets(_$scene, assetManager.getAssets());
|
|
42290
43036
|
_this.assetService.updateTextVariables(_$scene, assetManager.options.variables);
|
|
42291
43037
|
composition = _this.createComposition(_$scene, opts);
|
|
@@ -42580,7 +43326,7 @@ applyMixins(exports.ThreeTextComponent, [
|
|
|
42580
43326
|
*/ Mesh.create = function(engine, props) {
|
|
42581
43327
|
return new ThreeMesh(engine, props);
|
|
42582
43328
|
};
|
|
42583
|
-
var version = "2.10.0-alpha.
|
|
43329
|
+
var version = "2.10.0-alpha.1";
|
|
42584
43330
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
42585
43331
|
|
|
42586
43332
|
exports.ATLAS_SIZE = ATLAS_SIZE;
|
|
@@ -42712,6 +43458,7 @@ exports.Precomposition = Precomposition;
|
|
|
42712
43458
|
exports.PrecompositionManager = PrecompositionManager;
|
|
42713
43459
|
exports.PropertyClipPlayable = PropertyClipPlayable;
|
|
42714
43460
|
exports.PropertyTrack = PropertyTrack;
|
|
43461
|
+
exports.REFERENCE_CURVE = REFERENCE_CURVE;
|
|
42715
43462
|
exports.RENDER_PREFER_LOOKUP_TEXTURE = RENDER_PREFER_LOOKUP_TEXTURE;
|
|
42716
43463
|
exports.RUNTIME_ENV = RUNTIME_ENV;
|
|
42717
43464
|
exports.RandomSetValue = RandomSetValue;
|
|
@@ -42720,6 +43467,7 @@ exports.RandomVectorValue = RandomVectorValue;
|
|
|
42720
43467
|
exports.RaycastResult = RaycastResult;
|
|
42721
43468
|
exports.RectTransform = RectTransform;
|
|
42722
43469
|
exports.Rectangle = Rectangle$1;
|
|
43470
|
+
exports.ReferenceCurve = ReferenceCurve;
|
|
42723
43471
|
exports.RenderFrame = RenderFrame;
|
|
42724
43472
|
exports.RenderPass = RenderPass;
|
|
42725
43473
|
exports.RenderPassPriorityNormal = RenderPassPriorityNormal;
|
|
@@ -42743,6 +43491,7 @@ exports.ShaderVariant = ShaderVariant;
|
|
|
42743
43491
|
exports.SpriteColorMixerPlayable = SpriteColorMixerPlayable;
|
|
42744
43492
|
exports.SpriteComponentTimeTrack = SpriteComponentTimeTrack;
|
|
42745
43493
|
exports.SpriteLoader = SpriteLoader;
|
|
43494
|
+
exports.SpritePropertyMixerPlayable = SpritePropertyMixerPlayable;
|
|
42746
43495
|
exports.StateMachineNode = StateMachineNode;
|
|
42747
43496
|
exports.StateNode = StateNode;
|
|
42748
43497
|
exports.StaticValue = StaticValue;
|
|
@@ -42787,6 +43536,7 @@ exports.applyMixins = applyMixins;
|
|
|
42787
43536
|
exports.assertExist = assertExist;
|
|
42788
43537
|
exports.asserts = asserts;
|
|
42789
43538
|
exports.base64ToFile = base64ToFile;
|
|
43539
|
+
exports.breakOpportunityAfter = breakOpportunityAfter;
|
|
42790
43540
|
exports.buildBezierData = buildBezierData;
|
|
42791
43541
|
exports.buildEasingCurve = buildEasingCurve;
|
|
42792
43542
|
exports.buildLine = buildLine;
|
|
@@ -42852,6 +43602,8 @@ exports.interpolateColor = interpolateColor;
|
|
|
42852
43602
|
exports.isAlipayMiniApp = isAlipayMiniApp;
|
|
42853
43603
|
exports.isAndroid = isAndroid;
|
|
42854
43604
|
exports.isArray = isArray;
|
|
43605
|
+
exports.isBreakChar = isBreakChar;
|
|
43606
|
+
exports.isCJKLike = isCJKLike;
|
|
42855
43607
|
exports.isCanvas = isCanvas;
|
|
42856
43608
|
exports.isFunction = isFunction;
|
|
42857
43609
|
exports.isIOS = isIOS;
|