@galacean/effects-threejs 2.9.0-alpha.1 → 2.9.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +340 -222
- 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 +340 -222
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
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.9.0-alpha.
|
|
6
|
+
* Version: v2.9.0-alpha.2
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as THREE from 'three';
|
|
@@ -4095,7 +4095,7 @@ function getDirectStore(target) {
|
|
|
4095
4095
|
function EffectsObject(engine) {
|
|
4096
4096
|
this.engine = engine;
|
|
4097
4097
|
this.guid = generateGUID();
|
|
4098
|
-
this.
|
|
4098
|
+
this.definition = {};
|
|
4099
4099
|
this.engine.addInstance(this);
|
|
4100
4100
|
}
|
|
4101
4101
|
var _proto = EffectsObject.prototype;
|
|
@@ -6999,6 +6999,11 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
6999
6999
|
// OVERRIDE
|
|
7000
7000
|
};
|
|
7001
7001
|
/**
|
|
7002
|
+
* 当父级或间接父级发生改变时调用
|
|
7003
|
+
*/ _proto.onParentChanged = function onParentChanged() {
|
|
7004
|
+
// OVERRIDE
|
|
7005
|
+
};
|
|
7006
|
+
/**
|
|
7002
7007
|
* @internal
|
|
7003
7008
|
*/ _proto.enable = function enable() {
|
|
7004
7009
|
if (this.item.composition) {
|
|
@@ -9229,7 +9234,6 @@ var MaterialRenderType;
|
|
|
9229
9234
|
for(var _iterator4 = _create_for_of_iterator_helper_loose(frameClipMasks), _step4; !(_step4 = _iterator4()).done;){
|
|
9230
9235
|
var frameClipMask1 = _step4.value;
|
|
9231
9236
|
this.removeMaskReference(frameClipMask1);
|
|
9232
|
-
maskedComponent.frameClipMasks = [];
|
|
9233
9237
|
}
|
|
9234
9238
|
};
|
|
9235
9239
|
/**
|
|
@@ -10667,7 +10671,6 @@ BoundingBox.tempVector2 = new Vector3();
|
|
|
10667
10671
|
_this.materials = [];
|
|
10668
10672
|
/**
|
|
10669
10673
|
* @hidden
|
|
10670
|
-
* @internal
|
|
10671
10674
|
* Internal utility.
|
|
10672
10675
|
* Not part of the public API — do not rely on this in your code.
|
|
10673
10676
|
*/ _this.frameClipMasks = [];
|
|
@@ -10691,6 +10694,9 @@ BoundingBox.tempVector2 = new Vector3();
|
|
|
10691
10694
|
var _this_item_composition;
|
|
10692
10695
|
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.removeMeshFromDefaultRenderPass(this);
|
|
10693
10696
|
};
|
|
10697
|
+
_proto.onParentChanged = function onParentChanged() {
|
|
10698
|
+
this.frameClipMasks = [];
|
|
10699
|
+
};
|
|
10694
10700
|
/**
|
|
10695
10701
|
* 获取包围盒信息
|
|
10696
10702
|
*/ _proto.getBoundingBoxInfo = function getBoundingBoxInfo() {
|
|
@@ -13209,6 +13215,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
13209
13215
|
if (!this.composition && vfxItem.composition) {
|
|
13210
13216
|
this.composition = vfxItem.composition;
|
|
13211
13217
|
}
|
|
13218
|
+
this.onParentChanged();
|
|
13212
13219
|
if (!this.isDuringPlay && vfxItem.isDuringPlay) {
|
|
13213
13220
|
this.awake();
|
|
13214
13221
|
this.beginPlay();
|
|
@@ -13341,6 +13348,122 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
13341
13348
|
// OVERRIDE
|
|
13342
13349
|
};
|
|
13343
13350
|
/**
|
|
13351
|
+
* 对当前元素及其子节点进行射线命中测试
|
|
13352
|
+
*
|
|
13353
|
+
* @param ray - 射线
|
|
13354
|
+
* @param x - 归一化屏幕坐标 x
|
|
13355
|
+
* @param y - 归一化屏幕坐标 y
|
|
13356
|
+
* @param regions - 命中结果收集数组
|
|
13357
|
+
* @param hitPositions - 共享的命中位置数组,所有 region 共享同一引用
|
|
13358
|
+
* @param force - 是否强制测试无交互信息的元素
|
|
13359
|
+
* @param options - 额外选项(maxCount、stop、skip)
|
|
13360
|
+
* @returns 是否有任何命中
|
|
13361
|
+
*/ _proto.hitTest = function hitTest(ray, x, y, regions, hitPositions, force, options) {
|
|
13362
|
+
var _this_composition;
|
|
13363
|
+
if (!this.isActive) {
|
|
13364
|
+
return false;
|
|
13365
|
+
}
|
|
13366
|
+
var hitTestSuccess = false;
|
|
13367
|
+
var maxCount = options == null ? void 0 : options.maxCount;
|
|
13368
|
+
var hitParams = this.getHitTestParams(force);
|
|
13369
|
+
// 1. 测试自身
|
|
13370
|
+
if (hitParams) {
|
|
13371
|
+
var clipMasks = hitParams.clipMasks;
|
|
13372
|
+
var clipPassed = true;
|
|
13373
|
+
if (clipMasks.length > 0 && !hitTestMask(ray, clipMasks)) {
|
|
13374
|
+
clipPassed = false;
|
|
13375
|
+
}
|
|
13376
|
+
if (clipPassed) {
|
|
13377
|
+
var success = false;
|
|
13378
|
+
var intersectPoint = new Vector3();
|
|
13379
|
+
if (hitParams.type === HitTestType.triangle) {
|
|
13380
|
+
var triangles = hitParams.triangles, backfaceCulling = hitParams.backfaceCulling;
|
|
13381
|
+
for(var j = 0; j < triangles.length; j++){
|
|
13382
|
+
if (ray.intersectTriangle(triangles[j], intersectPoint, backfaceCulling)) {
|
|
13383
|
+
success = true;
|
|
13384
|
+
hitPositions.push(intersectPoint);
|
|
13385
|
+
break;
|
|
13386
|
+
}
|
|
13387
|
+
}
|
|
13388
|
+
} else if (hitParams.type === HitTestType.box) {
|
|
13389
|
+
var center = hitParams.center, size = hitParams.size;
|
|
13390
|
+
var boxMin = center.clone().addScaledVector(size, 0.5);
|
|
13391
|
+
var boxMax = center.clone().addScaledVector(size, -0.5);
|
|
13392
|
+
if (ray.intersectBox({
|
|
13393
|
+
min: boxMin,
|
|
13394
|
+
max: boxMax
|
|
13395
|
+
}, intersectPoint)) {
|
|
13396
|
+
success = true;
|
|
13397
|
+
hitPositions.push(intersectPoint);
|
|
13398
|
+
}
|
|
13399
|
+
} else if (hitParams.type === HitTestType.sphere) {
|
|
13400
|
+
var center1 = hitParams.center, radius = hitParams.radius;
|
|
13401
|
+
if (ray.intersectSphere({
|
|
13402
|
+
center: center1,
|
|
13403
|
+
radius: radius
|
|
13404
|
+
}, intersectPoint)) {
|
|
13405
|
+
success = true;
|
|
13406
|
+
hitPositions.push(intersectPoint);
|
|
13407
|
+
}
|
|
13408
|
+
} else if (hitParams.type === HitTestType.custom) {
|
|
13409
|
+
var tempPosition = hitParams.collect(ray, new Vector2(x, y));
|
|
13410
|
+
if (tempPosition && tempPosition.length > 0) {
|
|
13411
|
+
tempPosition.forEach(function(pos) {
|
|
13412
|
+
hitPositions.push(pos);
|
|
13413
|
+
});
|
|
13414
|
+
success = true;
|
|
13415
|
+
}
|
|
13416
|
+
}
|
|
13417
|
+
if (success) {
|
|
13418
|
+
var _options_stop;
|
|
13419
|
+
var region = {
|
|
13420
|
+
id: this.getInstanceId(),
|
|
13421
|
+
name: this.name,
|
|
13422
|
+
position: hitPositions[hitPositions.length - 1],
|
|
13423
|
+
parentId: this.parentId,
|
|
13424
|
+
hitPositions: hitPositions,
|
|
13425
|
+
behavior: hitParams.behavior,
|
|
13426
|
+
item: this,
|
|
13427
|
+
composition: this.composition
|
|
13428
|
+
};
|
|
13429
|
+
regions.push(region);
|
|
13430
|
+
hitTestSuccess = true;
|
|
13431
|
+
if (options == null ? void 0 : (_options_stop = options.stop) == null ? void 0 : _options_stop.call(options, region)) {
|
|
13432
|
+
return true;
|
|
13433
|
+
}
|
|
13434
|
+
}
|
|
13435
|
+
}
|
|
13436
|
+
}
|
|
13437
|
+
// 2. 递归测试子节点
|
|
13438
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
13439
|
+
var child = _step.value;
|
|
13440
|
+
var _options_skip;
|
|
13441
|
+
if (maxCount !== undefined && regions.length >= maxCount) {
|
|
13442
|
+
break;
|
|
13443
|
+
}
|
|
13444
|
+
if (options == null ? void 0 : (_options_skip = options.skip) == null ? void 0 : _options_skip.call(options, child)) {
|
|
13445
|
+
continue;
|
|
13446
|
+
}
|
|
13447
|
+
if (child.hitTest(ray, x, y, regions, hitPositions, force, options)) {
|
|
13448
|
+
hitTestSuccess = true;
|
|
13449
|
+
}
|
|
13450
|
+
}
|
|
13451
|
+
// 3. composition 元素:子元素命中时,将自身也加入结果(根元素除外)
|
|
13452
|
+
if (VFXItem.isComposition(this) && hitTestSuccess && this !== ((_this_composition = this.composition) == null ? void 0 : _this_composition.rootItem)) {
|
|
13453
|
+
regions.push({
|
|
13454
|
+
id: this.getInstanceId(),
|
|
13455
|
+
name: this.name,
|
|
13456
|
+
position: hitPositions[hitPositions.length - 1],
|
|
13457
|
+
parentId: this.parentId,
|
|
13458
|
+
hitPositions: hitPositions,
|
|
13459
|
+
behavior: InteractBehavior.NONE,
|
|
13460
|
+
item: this,
|
|
13461
|
+
composition: this.composition
|
|
13462
|
+
});
|
|
13463
|
+
}
|
|
13464
|
+
return hitTestSuccess;
|
|
13465
|
+
};
|
|
13466
|
+
/**
|
|
13344
13467
|
* 获取元素当前世界坐标
|
|
13345
13468
|
*/ _proto.getCurrentPosition = function getCurrentPosition() {
|
|
13346
13469
|
var pos = new Vector3();
|
|
@@ -13376,7 +13499,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
13376
13499
|
// 重新设置当前元素和组件的 ID 以及子元素和子元素组件的 ID,避免实例化新的对象时产生碰撞
|
|
13377
13500
|
this.refreshGUIDRecursive();
|
|
13378
13501
|
var newItem = this.engine.findObject({
|
|
13379
|
-
id: this.
|
|
13502
|
+
id: this.definition.id
|
|
13380
13503
|
});
|
|
13381
13504
|
newItem.refreshGUIDRecursive();
|
|
13382
13505
|
this.refreshGUIDRecursive(previousObjectIDMap);
|
|
@@ -13452,6 +13575,16 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
13452
13575
|
}
|
|
13453
13576
|
}
|
|
13454
13577
|
};
|
|
13578
|
+
_proto.onParentChanged = function onParentChanged() {
|
|
13579
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
13580
|
+
var component = _step.value;
|
|
13581
|
+
component.onParentChanged();
|
|
13582
|
+
}
|
|
13583
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.children), _step1; !(_step1 = _iterator1()).done;){
|
|
13584
|
+
var child = _step1.value;
|
|
13585
|
+
child.onParentChanged();
|
|
13586
|
+
}
|
|
13587
|
+
};
|
|
13455
13588
|
/**
|
|
13456
13589
|
* @internal
|
|
13457
13590
|
*/ _proto.setRendererComponentOrder = function setRendererComponentOrder(renderOrder) {
|
|
@@ -13471,7 +13604,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
13471
13604
|
this.parentId = parentId;
|
|
13472
13605
|
this.components.length = 0;
|
|
13473
13606
|
if (VFXItem.isComposition(this)) {
|
|
13474
|
-
var refId = this.
|
|
13607
|
+
var refId = this.definition.content.options.refId;
|
|
13475
13608
|
var compositionData = this.engine.findEffectsObjectData(refId);
|
|
13476
13609
|
if (!compositionData) {
|
|
13477
13610
|
throw new Error("Referenced precomposition with Id: " + refId + " does not exist.");
|
|
@@ -13518,24 +13651,24 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
13518
13651
|
};
|
|
13519
13652
|
_proto.toData = function toData() {
|
|
13520
13653
|
var _this_parent;
|
|
13521
|
-
this.
|
|
13522
|
-
this.
|
|
13523
|
-
this.
|
|
13654
|
+
this.definition.id = this.guid;
|
|
13655
|
+
this.definition.transform = this.transform.toData();
|
|
13656
|
+
this.definition.dataType = DataType.VFXItemData;
|
|
13524
13657
|
if (((_this_parent = this.parent) == null ? void 0 : _this_parent.name) !== "rootItem") {
|
|
13525
13658
|
var _this_parent1;
|
|
13526
|
-
this.
|
|
13659
|
+
this.definition.parentId = (_this_parent1 = this.parent) == null ? void 0 : _this_parent1.guid;
|
|
13527
13660
|
}
|
|
13528
13661
|
// TODO 统一 sprite 等其他组件的序列化逻辑
|
|
13529
|
-
if (!this.
|
|
13530
|
-
this.
|
|
13662
|
+
if (!this.definition.components) {
|
|
13663
|
+
this.definition.components = [];
|
|
13531
13664
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
13532
13665
|
var component = _step.value;
|
|
13533
13666
|
if (_instanceof1(component, EffectComponent)) {
|
|
13534
|
-
this.
|
|
13667
|
+
this.definition.components.push(component);
|
|
13535
13668
|
}
|
|
13536
13669
|
}
|
|
13537
13670
|
}
|
|
13538
|
-
this.
|
|
13671
|
+
this.definition.content = {};
|
|
13539
13672
|
};
|
|
13540
13673
|
/**
|
|
13541
13674
|
* 销毁元素
|
|
@@ -13792,6 +13925,47 @@ var Item;
|
|
|
13792
13925
|
}
|
|
13793
13926
|
Item.isNull = isNull;
|
|
13794
13927
|
})(Item || (Item = {}));
|
|
13928
|
+
/**
|
|
13929
|
+
* 遮罩命中测试:检查射线是否通过所有遮罩区域
|
|
13930
|
+
* 根据每个遮罩的 transform(size、scale、position、rotation、anchor)构建世界空间矩形,
|
|
13931
|
+
* 然后检测射线是否与该矩形相交。所有遮罩都必须通过才算测试通过。
|
|
13932
|
+
* @param ray - 射线
|
|
13933
|
+
* @param clipMasks - 遮罩列表
|
|
13934
|
+
* @returns 射线是否通过所有遮罩测试
|
|
13935
|
+
*/ function hitTestMask(ray, clipMasks) {
|
|
13936
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(clipMasks), _step; !(_step = _iterator()).done;){
|
|
13937
|
+
var mask = _step.value;
|
|
13938
|
+
var item = mask.item;
|
|
13939
|
+
if (!item.isActive || !item.transform.getValid()) {
|
|
13940
|
+
continue;
|
|
13941
|
+
}
|
|
13942
|
+
var transform = item.transform;
|
|
13943
|
+
var worldMatrix = transform.getWorldMatrix();
|
|
13944
|
+
var sx = transform.size.x;
|
|
13945
|
+
var sy = transform.size.y;
|
|
13946
|
+
// 将遮罩矩形的四个顶点从本地空间变换到世界空间
|
|
13947
|
+
// 本地空间顶点为单位矩形 (-0.5, -0.5) 到 (0.5, 0.5),按 size 缩放
|
|
13948
|
+
var p0 = new Vector3(-0.5 * sx, 0.5 * sy, 0).applyMatrix(worldMatrix);
|
|
13949
|
+
var p1 = new Vector3(-0.5 * sx, -0.5 * sy, 0).applyMatrix(worldMatrix);
|
|
13950
|
+
var p2 = new Vector3(0.5 * sx, 0.5 * sy, 0).applyMatrix(worldMatrix);
|
|
13951
|
+
var p3 = new Vector3(0.5 * sx, -0.5 * sy, 0).applyMatrix(worldMatrix);
|
|
13952
|
+
// 矩形由两个三角形组成,检测射线与任一三角形的相交
|
|
13953
|
+
var triangle1 = {
|
|
13954
|
+
p0: p0,
|
|
13955
|
+
p1: p1,
|
|
13956
|
+
p2: p2
|
|
13957
|
+
};
|
|
13958
|
+
var triangle2 = {
|
|
13959
|
+
p0: p2,
|
|
13960
|
+
p1: p1,
|
|
13961
|
+
p2: p3
|
|
13962
|
+
};
|
|
13963
|
+
if (!ray.intersectTriangle(triangle1) && !ray.intersectTriangle(triangle2)) {
|
|
13964
|
+
return false;
|
|
13965
|
+
}
|
|
13966
|
+
}
|
|
13967
|
+
return true;
|
|
13968
|
+
}
|
|
13795
13969
|
|
|
13796
13970
|
var toHalf = function() {
|
|
13797
13971
|
var floatView = new Float32Array(1);
|
|
@@ -17399,7 +17573,7 @@ function triangulate(contours) {
|
|
|
17399
17573
|
*/ _proto.getY = function getY() {
|
|
17400
17574
|
return this.points[this.points.length - 1];
|
|
17401
17575
|
};
|
|
17402
|
-
_proto.build = function build(points) {
|
|
17576
|
+
_proto.build = function build(points, screenScale) {
|
|
17403
17577
|
for(var i = 0; i < this.points.length; i++){
|
|
17404
17578
|
points[i] = this.points[i];
|
|
17405
17579
|
}
|
|
@@ -17501,11 +17675,10 @@ var RECURSION_LIMIT = 8;
|
|
|
17501
17675
|
var FLT_EPSILON = 1.19209290e-7;
|
|
17502
17676
|
var PATH_DISTANCE_EPSILON = 1.0;
|
|
17503
17677
|
var defaultBezierSmoothness = 0.5;
|
|
17504
|
-
function buildAdaptiveBezier(points, sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, smoothness) {
|
|
17505
|
-
|
|
17506
|
-
var scale = 5;
|
|
17678
|
+
function buildAdaptiveBezier(points, sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, smoothness, scale) {
|
|
17679
|
+
var s = scale != null ? scale : 1;
|
|
17507
17680
|
var smoothing = Math.min(0.99, Math.max(0, smoothness != null ? smoothness : defaultBezierSmoothness));
|
|
17508
|
-
var distanceTolerance = (PATH_DISTANCE_EPSILON - smoothing) /
|
|
17681
|
+
var distanceTolerance = (PATH_DISTANCE_EPSILON - smoothing) / s;
|
|
17509
17682
|
distanceTolerance *= distanceTolerance;
|
|
17510
17683
|
begin(sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, points, distanceTolerance);
|
|
17511
17684
|
return points;
|
|
@@ -17695,7 +17868,7 @@ function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, le
|
|
|
17695
17868
|
_proto.getY = function getY() {
|
|
17696
17869
|
return this.y;
|
|
17697
17870
|
};
|
|
17698
|
-
_proto.build = function build(points) {
|
|
17871
|
+
_proto.build = function build(points, screenScale) {
|
|
17699
17872
|
var x = this.x;
|
|
17700
17873
|
var y = this.y;
|
|
17701
17874
|
var rx = this.halfWidth;
|
|
@@ -17705,9 +17878,10 @@ function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, le
|
|
|
17705
17878
|
if (!(rx >= 0 && ry >= 0 && dx >= 0 && dy >= 0)) {
|
|
17706
17879
|
return points;
|
|
17707
17880
|
}
|
|
17708
|
-
//
|
|
17709
|
-
|
|
17710
|
-
var
|
|
17881
|
+
// n 个等分段逼近四分之一椭圆弧,最大弦高误差 ε = R·π²/(8n²)
|
|
17882
|
+
// 屏幕误差 = ε × ppu = ppu·R·π²/(8n²),令 n = √(ppu·(rx+ry)),则误差 ≈ π²/8 ≈ 1.2px
|
|
17883
|
+
var ppu = screenScale != null ? screenScale : 1;
|
|
17884
|
+
var n = Math.ceil(Math.sqrt(ppu * (rx + ry)));
|
|
17711
17885
|
var m = n * 8 + (0) + (0);
|
|
17712
17886
|
if (m === 0) {
|
|
17713
17887
|
return points;
|
|
@@ -17842,7 +18016,7 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
17842
18016
|
_proto.copyTo = function copyTo(destination) {
|
|
17843
18017
|
destination.copyFrom(this);
|
|
17844
18018
|
};
|
|
17845
|
-
_proto.build = function build(points) {
|
|
18019
|
+
_proto.build = function build(points, screenScale) {
|
|
17846
18020
|
switch(this.starType){
|
|
17847
18021
|
case 0:
|
|
17848
18022
|
{
|
|
@@ -17855,13 +18029,13 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
17855
18029
|
break;
|
|
17856
18030
|
}
|
|
17857
18031
|
}
|
|
17858
|
-
var
|
|
18032
|
+
var ppu = screenScale != null ? screenScale : 1;
|
|
17859
18033
|
for(var i = 0; i < this.v.length - 2; i += 2){
|
|
17860
|
-
buildAdaptiveBezier(points, this.v[i], this.v[i + 1], this.out[i], this.out[i + 1], this.in[i + 2], this.in[i + 3], this.v[i + 2], this.v[i + 3],
|
|
18034
|
+
buildAdaptiveBezier(points, this.v[i], this.v[i + 1], this.out[i], this.out[i + 1], this.in[i + 2], this.in[i + 3], this.v[i + 2], this.v[i + 3], undefined, ppu);
|
|
17861
18035
|
}
|
|
17862
18036
|
// draw last curve
|
|
17863
18037
|
var lastIndex = this.v.length - 1;
|
|
17864
|
-
buildAdaptiveBezier(points, this.v[lastIndex - 1], this.v[lastIndex], this.out[lastIndex - 1], this.out[lastIndex], this.in[0], this.in[1], this.v[0], this.v[1],
|
|
18038
|
+
buildAdaptiveBezier(points, this.v[lastIndex - 1], this.v[lastIndex], this.out[lastIndex - 1], this.out[lastIndex], this.in[0], this.in[1], this.v[0], this.v[1], undefined, ppu);
|
|
17865
18039
|
};
|
|
17866
18040
|
_proto.triangulate = function triangulate1(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
17867
18041
|
var triangles = triangulate([
|
|
@@ -18006,7 +18180,7 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
18006
18180
|
rectangle.copyFrom(this);
|
|
18007
18181
|
return rectangle;
|
|
18008
18182
|
};
|
|
18009
|
-
_proto.build = function build(points) {
|
|
18183
|
+
_proto.build = function build(points, screenScale) {
|
|
18010
18184
|
var ry;
|
|
18011
18185
|
var halfWidth = this.width / 2;
|
|
18012
18186
|
var halfHeight = this.height / 2;
|
|
@@ -18018,10 +18192,10 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
18018
18192
|
if (!(rx >= 0 && ry >= 0 && dx >= 0 && dy >= 0)) {
|
|
18019
18193
|
return;
|
|
18020
18194
|
}
|
|
18021
|
-
//
|
|
18022
|
-
|
|
18023
|
-
|
|
18024
|
-
var n =
|
|
18195
|
+
// n 个等分段逼近四分之一圆角弧,最大弦高误差 ε = R·π²/(8n²)
|
|
18196
|
+
// 屏幕误差 = ε × ppu,令 n = √(ppu·(rx+ry)),则误差 ≈ π²/8 ≈ 1.2px
|
|
18197
|
+
var ppu = screenScale != null ? screenScale : 1;
|
|
18198
|
+
var n = Math.ceil(Math.sqrt(ppu * (rx + ry)));
|
|
18025
18199
|
var m = n * 8 + (dx ? 4 : 0) + (dy ? 4 : 0);
|
|
18026
18200
|
if (m === 0) {
|
|
18027
18201
|
return;
|
|
@@ -18230,7 +18404,7 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
18230
18404
|
_proto.getY = function getY() {
|
|
18231
18405
|
return this.y;
|
|
18232
18406
|
};
|
|
18233
|
-
_proto.build = function build(points) {
|
|
18407
|
+
_proto.build = function build(points, screenScale) {
|
|
18234
18408
|
points[0] = this.x;
|
|
18235
18409
|
points[1] = this.y;
|
|
18236
18410
|
points[2] = this.x2;
|
|
@@ -18447,7 +18621,7 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
18447
18621
|
circle.copyFrom(this);
|
|
18448
18622
|
return circle;
|
|
18449
18623
|
};
|
|
18450
|
-
_proto.build = function build(points) {
|
|
18624
|
+
_proto.build = function build(points, screenScale) {
|
|
18451
18625
|
var x = this.x;
|
|
18452
18626
|
var y = this.y;
|
|
18453
18627
|
var dx = 0;
|
|
@@ -18457,8 +18631,10 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
18457
18631
|
if (rx <= 0) {
|
|
18458
18632
|
return;
|
|
18459
18633
|
}
|
|
18460
|
-
//
|
|
18461
|
-
|
|
18634
|
+
// n 个等分段逼近四分之一圆弧,最大弦高误差 ε = R·π²/(8n²)
|
|
18635
|
+
// 屏幕误差 = ε × ppu = ppu·R·π²/(8n²),令 n = √(ppu·(rx+ry)),则误差 ≈ π²/8 ≈ 1.2px
|
|
18636
|
+
var ppu = screenScale != null ? screenScale : 1;
|
|
18637
|
+
var n = Math.ceil(Math.sqrt(ppu * (rx + ry)));
|
|
18462
18638
|
var m = n * 8 + (0) + (0);
|
|
18463
18639
|
if (m === 0) {
|
|
18464
18640
|
return;
|
|
@@ -18568,7 +18744,7 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
18568
18744
|
switch(action){
|
|
18569
18745
|
case "bezierCurveTo":
|
|
18570
18746
|
{
|
|
18571
|
-
this.bezierCurveTo(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
|
|
18747
|
+
this.bezierCurveTo(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
|
|
18572
18748
|
break;
|
|
18573
18749
|
}
|
|
18574
18750
|
case "moveTo":
|
|
@@ -18627,10 +18803,10 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
18627
18803
|
* @param y - The y-coordinate of the end point.
|
|
18628
18804
|
* @param smoothness - Optional parameter to adjust the smoothness of the curve.
|
|
18629
18805
|
* @returns The instance of the current object for chaining.
|
|
18630
|
-
*/ _proto.bezierCurveTo = function bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness) {
|
|
18806
|
+
*/ _proto.bezierCurveTo = function bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness, scale) {
|
|
18631
18807
|
this.ensurePoly();
|
|
18632
18808
|
var currentPoly = this.currentPoly;
|
|
18633
|
-
buildAdaptiveBezier(currentPoly.points, currentPoly.lastX, currentPoly.lastY, cp1x, cp1y, cp2x, cp2y, x, y, smoothness);
|
|
18809
|
+
buildAdaptiveBezier(currentPoly.points, currentPoly.lastX, currentPoly.lastY, cp1x, cp1y, cp2x, cp2y, x, y, smoothness, scale);
|
|
18634
18810
|
return this;
|
|
18635
18811
|
};
|
|
18636
18812
|
_proto.moveTo = function moveTo(x, y) {
|
|
@@ -18795,7 +18971,7 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
18795
18971
|
* @param y - The y-coordinate of the end point.
|
|
18796
18972
|
* @param smoothness - Optional parameter to adjust the smoothness of the curve.
|
|
18797
18973
|
* @returns The instance of the current object for chaining.
|
|
18798
|
-
*/ _proto.bezierCurveTo = function bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness) {
|
|
18974
|
+
*/ _proto.bezierCurveTo = function bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness, scale) {
|
|
18799
18975
|
this.instructions.push({
|
|
18800
18976
|
action: "bezierCurveTo",
|
|
18801
18977
|
data: [
|
|
@@ -18805,7 +18981,8 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
18805
18981
|
cp2y,
|
|
18806
18982
|
x,
|
|
18807
18983
|
y,
|
|
18808
|
-
smoothness
|
|
18984
|
+
smoothness,
|
|
18985
|
+
scale
|
|
18809
18986
|
]
|
|
18810
18987
|
});
|
|
18811
18988
|
this.dirty = true;
|
|
@@ -19106,28 +19283,6 @@ var CompositionComponent = /*#__PURE__*/ function(Component) {
|
|
|
19106
19283
|
return item.dispose();
|
|
19107
19284
|
});
|
|
19108
19285
|
};
|
|
19109
|
-
_proto.hitTest = function hitTest(ray, x, y, regions, force, options) {
|
|
19110
|
-
var _this_item_composition;
|
|
19111
|
-
var isHitTestSuccess = hitTestRecursive(this.item, ray, x, y, regions, force, options);
|
|
19112
|
-
// 子元素碰撞测试成功加入当前预合成元素,判断是否是合成根元素,根元素不加入
|
|
19113
|
-
if (isHitTestSuccess && this.item !== ((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.rootItem)) {
|
|
19114
|
-
var item = this.item;
|
|
19115
|
-
var lastRegion = regions[regions.length - 1];
|
|
19116
|
-
var hitPositions = lastRegion.hitPositions;
|
|
19117
|
-
var region = {
|
|
19118
|
-
id: item.getInstanceId(),
|
|
19119
|
-
name: item.name,
|
|
19120
|
-
position: hitPositions[hitPositions.length - 1],
|
|
19121
|
-
parentId: item.parentId,
|
|
19122
|
-
hitPositions: hitPositions,
|
|
19123
|
-
behavior: InteractBehavior.NONE,
|
|
19124
|
-
item: item,
|
|
19125
|
-
composition: item.composition
|
|
19126
|
-
};
|
|
19127
|
-
regions.push(region);
|
|
19128
|
-
}
|
|
19129
|
-
return isHitTestSuccess;
|
|
19130
|
-
};
|
|
19131
19286
|
/**
|
|
19132
19287
|
* 设置当前合成子元素的渲染顺序
|
|
19133
19288
|
*
|
|
@@ -19237,98 +19392,6 @@ __decorate([
|
|
|
19237
19392
|
CompositionComponent = __decorate([
|
|
19238
19393
|
effectsClass("CompositionComponent")
|
|
19239
19394
|
], CompositionComponent);
|
|
19240
|
-
function hitTestRecursive(item, ray, x, y, regions, force, options) {
|
|
19241
|
-
var _loop = function() {
|
|
19242
|
-
var hitTestItem = _step.value;
|
|
19243
|
-
if (hitTestItem.isActive && hitTestItem.transform.getValid() && !skip(hitTestItem)) {
|
|
19244
|
-
var hitParams = hitTestItem.getHitTestParams(force);
|
|
19245
|
-
if (hitParams) {
|
|
19246
|
-
var success = false;
|
|
19247
|
-
var intersectPoint = new Vector3();
|
|
19248
|
-
if (hitParams.type === HitTestType.triangle) {
|
|
19249
|
-
var triangles = hitParams.triangles, backfaceCulling = hitParams.backfaceCulling;
|
|
19250
|
-
for(var j = 0; j < triangles.length; j++){
|
|
19251
|
-
var triangle = triangles[j];
|
|
19252
|
-
if (ray.intersectTriangle(triangle, intersectPoint, backfaceCulling)) {
|
|
19253
|
-
success = true;
|
|
19254
|
-
hitPositions.push(intersectPoint);
|
|
19255
|
-
break;
|
|
19256
|
-
}
|
|
19257
|
-
}
|
|
19258
|
-
} else if (hitParams.type === HitTestType.box) {
|
|
19259
|
-
var center = hitParams.center, size = hitParams.size;
|
|
19260
|
-
var boxMin = center.clone().addScaledVector(size, 0.5);
|
|
19261
|
-
var boxMax = center.clone().addScaledVector(size, -0.5);
|
|
19262
|
-
if (ray.intersectBox({
|
|
19263
|
-
min: boxMin,
|
|
19264
|
-
max: boxMax
|
|
19265
|
-
}, intersectPoint)) {
|
|
19266
|
-
success = true;
|
|
19267
|
-
hitPositions.push(intersectPoint);
|
|
19268
|
-
}
|
|
19269
|
-
} else if (hitParams.type === HitTestType.sphere) {
|
|
19270
|
-
var center1 = hitParams.center, radius = hitParams.radius;
|
|
19271
|
-
if (ray.intersectSphere({
|
|
19272
|
-
center: center1,
|
|
19273
|
-
radius: radius
|
|
19274
|
-
}, intersectPoint)) {
|
|
19275
|
-
success = true;
|
|
19276
|
-
hitPositions.push(intersectPoint);
|
|
19277
|
-
}
|
|
19278
|
-
} else if (hitParams.type === HitTestType.custom) {
|
|
19279
|
-
var tempPosition = hitParams.collect(ray, new Vector2(x, y));
|
|
19280
|
-
if (tempPosition && tempPosition.length > 0) {
|
|
19281
|
-
tempPosition.forEach(function(pos) {
|
|
19282
|
-
hitPositions.push(pos);
|
|
19283
|
-
});
|
|
19284
|
-
success = true;
|
|
19285
|
-
}
|
|
19286
|
-
}
|
|
19287
|
-
if (success) {
|
|
19288
|
-
var region = {
|
|
19289
|
-
id: hitTestItem.getInstanceId(),
|
|
19290
|
-
name: hitTestItem.name,
|
|
19291
|
-
position: hitPositions[hitPositions.length - 1],
|
|
19292
|
-
parentId: hitTestItem.parentId,
|
|
19293
|
-
hitPositions: hitPositions,
|
|
19294
|
-
behavior: hitParams.behavior,
|
|
19295
|
-
item: hitTestItem,
|
|
19296
|
-
composition: hitTestItem.composition
|
|
19297
|
-
};
|
|
19298
|
-
regions.push(region);
|
|
19299
|
-
hitTestSuccess = true;
|
|
19300
|
-
if (stop(region)) {
|
|
19301
|
-
return {
|
|
19302
|
-
v: true
|
|
19303
|
-
};
|
|
19304
|
-
}
|
|
19305
|
-
}
|
|
19306
|
-
}
|
|
19307
|
-
}
|
|
19308
|
-
if (VFXItem.isComposition(hitTestItem)) {
|
|
19309
|
-
if (hitTestItem.getComponent(CompositionComponent).hitTest(ray, x, y, regions, force, options)) {
|
|
19310
|
-
hitTestSuccess = true;
|
|
19311
|
-
}
|
|
19312
|
-
} else {
|
|
19313
|
-
if (hitTestRecursive(hitTestItem, ray, x, y, regions, force, options)) {
|
|
19314
|
-
hitTestSuccess = true;
|
|
19315
|
-
}
|
|
19316
|
-
}
|
|
19317
|
-
};
|
|
19318
|
-
var hitPositions = [];
|
|
19319
|
-
var stop = (options == null ? void 0 : options.stop) || noop;
|
|
19320
|
-
var skip = (options == null ? void 0 : options.skip) || noop;
|
|
19321
|
-
var maxCount = options == null ? void 0 : options.maxCount;
|
|
19322
|
-
if (maxCount !== undefined && regions.length >= maxCount) {
|
|
19323
|
-
return false;
|
|
19324
|
-
}
|
|
19325
|
-
var hitTestSuccess = false;
|
|
19326
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.children), _step; !(_step = _iterator()).done;){
|
|
19327
|
-
var _ret = _loop();
|
|
19328
|
-
if (_type_of(_ret) === "object") return _ret.v;
|
|
19329
|
-
}
|
|
19330
|
-
return hitTestSuccess;
|
|
19331
|
-
}
|
|
19332
19395
|
|
|
19333
19396
|
/**
|
|
19334
19397
|
* Mesh 组件
|
|
@@ -19345,7 +19408,8 @@ function hitTestRecursive(item, ray, x, y, regions, force, options) {
|
|
|
19345
19408
|
if (area) {
|
|
19346
19409
|
return {
|
|
19347
19410
|
type: area.type,
|
|
19348
|
-
triangles: area.area
|
|
19411
|
+
triangles: area.area,
|
|
19412
|
+
clipMasks: _this.frameClipMasks
|
|
19349
19413
|
};
|
|
19350
19414
|
}
|
|
19351
19415
|
};
|
|
@@ -21484,7 +21548,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
21484
21548
|
behavior: ((_this_interaction = _this.interaction) == null ? void 0 : _this_interaction.behavior) || 0,
|
|
21485
21549
|
type: area.type,
|
|
21486
21550
|
triangles: area.area,
|
|
21487
|
-
backfaceCulling: _this.renderer.side === SideMode.FRONT
|
|
21551
|
+
backfaceCulling: _this.renderer.side === SideMode.FRONT,
|
|
21552
|
+
clipMasks: _this.frameClipMasks
|
|
21488
21553
|
};
|
|
21489
21554
|
}
|
|
21490
21555
|
}
|
|
@@ -21783,7 +21848,8 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
21783
21848
|
behavior: 0,
|
|
21784
21849
|
type: area.type,
|
|
21785
21850
|
triangles: area.area,
|
|
21786
|
-
backfaceCulling: _this.rendererOptions.side === SideMode.FRONT
|
|
21851
|
+
backfaceCulling: _this.rendererOptions.side === SideMode.FRONT,
|
|
21852
|
+
clipMasks: _this.frameClipMasks
|
|
21787
21853
|
};
|
|
21788
21854
|
}
|
|
21789
21855
|
}
|
|
@@ -21886,8 +21952,9 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
21886
21952
|
};
|
|
21887
21953
|
_proto.onUpdate = function onUpdate(dt) {
|
|
21888
21954
|
if (this.shapeDirty) {
|
|
21889
|
-
this.
|
|
21890
|
-
this.
|
|
21955
|
+
var screenScale = this.computeScreenScale();
|
|
21956
|
+
this.buildPath(this.shapeAttributes, screenScale);
|
|
21957
|
+
this.buildGeometryFromPath(this.graphicsPath.shapePath, screenScale);
|
|
21891
21958
|
this.shapeDirty = false;
|
|
21892
21959
|
}
|
|
21893
21960
|
if (this.materialDirty) {
|
|
@@ -21938,7 +22005,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
21938
22005
|
}
|
|
21939
22006
|
return this.boundingBoxInfo;
|
|
21940
22007
|
};
|
|
21941
|
-
_proto.buildGeometryFromPath = function buildGeometryFromPath(shapePath) {
|
|
22008
|
+
_proto.buildGeometryFromPath = function buildGeometryFromPath(shapePath, screenScale) {
|
|
21942
22009
|
var shapePrimitives = shapePath.shapePrimitives;
|
|
21943
22010
|
var vertices = [];
|
|
21944
22011
|
var indices = [];
|
|
@@ -21950,7 +22017,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
21950
22017
|
var points = [];
|
|
21951
22018
|
var indexOffset = indices.length;
|
|
21952
22019
|
var vertOffset = vertices.length / 2;
|
|
21953
|
-
shape.build(points);
|
|
22020
|
+
shape.build(points, screenScale);
|
|
21954
22021
|
shape.triangulate(points, vertices, vertOffset, indices, indexOffset);
|
|
21955
22022
|
}
|
|
21956
22023
|
}
|
|
@@ -21970,7 +22037,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
21970
22037
|
if (this.shapeAttributes.type === ShapePrimitiveType.Custom) {
|
|
21971
22038
|
close = shape1.closePath;
|
|
21972
22039
|
}
|
|
21973
|
-
shape1.build(points1);
|
|
22040
|
+
shape1.build(points1, screenScale);
|
|
21974
22041
|
buildLine(points1, lineStyle, false, close, vertices, 2, vertOffset1, indices);
|
|
21975
22042
|
}
|
|
21976
22043
|
}
|
|
@@ -22030,8 +22097,40 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
22030
22097
|
strokeSubMesh.offset = fillIndexCount * u16Size;
|
|
22031
22098
|
strokeSubMesh.indexCount = strokeIndexCount;
|
|
22032
22099
|
};
|
|
22033
|
-
_proto.
|
|
22100
|
+
_proto.computeScreenScale = function computeScreenScale() {
|
|
22101
|
+
var defaultPpu = 1;
|
|
22102
|
+
var composition = this.item.composition;
|
|
22103
|
+
if (!composition) {
|
|
22104
|
+
return defaultPpu;
|
|
22105
|
+
}
|
|
22106
|
+
var camera = composition.camera;
|
|
22107
|
+
if (!camera) {
|
|
22108
|
+
return defaultPpu;
|
|
22109
|
+
}
|
|
22110
|
+
var mvp = camera.getModelViewProjection(ShapeComponent.tempMVP, this.transform.getWorldMatrix());
|
|
22111
|
+
var e = mvp.elements;
|
|
22112
|
+
// 列优先:col0=[e[0],e[1]], col1=[e[4],e[5]]
|
|
22113
|
+
// 透视投影下 MVP 不含 w-divide,cols 0-1 的长度是 clip-space 缩放
|
|
22114
|
+
// 需要除以物体中心的 w 值才能得到 NDC 缩放
|
|
22115
|
+
// 物体局部原点 [0,0,0,1] 经 MVP 后 w = e[15](≈ 物体到相机距离)
|
|
22116
|
+
var w = Math.abs(e[15]) || 1;
|
|
22117
|
+
var sx = Math.sqrt(e[0] * e[0] + e[1] * e[1]) / w;
|
|
22118
|
+
var sy = Math.sqrt(e[4] * e[4] + e[5] * e[5]) / w;
|
|
22119
|
+
var maxNdcScale = Math.max(sx, sy);
|
|
22120
|
+
// NDC -> 像素: canvasSize / 2
|
|
22121
|
+
var canvasRect = this.engine.canvas.getBoundingClientRect();
|
|
22122
|
+
var ndcToPixels = Math.max(canvasRect.width, canvasRect.height) / 2;
|
|
22123
|
+
// pixelsPerUnit: 1个局部空间单位在屏幕上对应多少像素
|
|
22124
|
+
// 椭圆/圆/矩形中使用 n = ceil(√(ppu × (rx+ry))) 确保圆弧误差 ≈ 1.2px
|
|
22125
|
+
var pixelsPerUnit = maxNdcScale * ndcToPixels * this.engine.pixelRatio;
|
|
22126
|
+
var minPpu = 1;
|
|
22127
|
+
var maxPpu = 2000;
|
|
22128
|
+
return Math.max(minPpu, Math.min(maxPpu, pixelsPerUnit));
|
|
22129
|
+
};
|
|
22130
|
+
_proto.buildPath = function buildPath(shapeAttribute, screenScale) {
|
|
22131
|
+
if (screenScale === void 0) screenScale = 1;
|
|
22034
22132
|
this.graphicsPath.clear();
|
|
22133
|
+
var ppu = screenScale;
|
|
22035
22134
|
switch(shapeAttribute.type){
|
|
22036
22135
|
case ShapePrimitiveType.Custom:
|
|
22037
22136
|
{
|
|
@@ -22051,7 +22150,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
22051
22150
|
var lastPoint = points[lastPointIndex.point];
|
|
22052
22151
|
var control1 = easingOuts[lastPointIndex.easingOut];
|
|
22053
22152
|
var control2 = easingIns[pointIndex.easingIn];
|
|
22054
|
-
this.graphicsPath.bezierCurveTo(control1.x + lastPoint.x, control1.y + lastPoint.y, control2.x + point.x, control2.y + point.y, point.x, point.y,
|
|
22153
|
+
this.graphicsPath.bezierCurveTo(control1.x + lastPoint.x, control1.y + lastPoint.y, control2.x + point.x, control2.y + point.y, point.x, point.y, undefined, ppu);
|
|
22055
22154
|
}
|
|
22056
22155
|
if (shape.close) {
|
|
22057
22156
|
var pointIndex1 = indices[0];
|
|
@@ -22060,7 +22159,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
22060
22159
|
var lastPoint1 = points[lastPointIndex1.point];
|
|
22061
22160
|
var control11 = easingOuts[lastPointIndex1.easingOut];
|
|
22062
22161
|
var control21 = easingIns[pointIndex1.easingIn];
|
|
22063
|
-
this.graphicsPath.bezierCurveTo(control11.x + lastPoint1.x, control11.y + lastPoint1.y, control21.x + point1.x, control21.y + point1.y, point1.x, point1.y,
|
|
22162
|
+
this.graphicsPath.bezierCurveTo(control11.x + lastPoint1.x, control11.y + lastPoint1.y, control21.x + point1.x, control21.y + point1.y, point1.x, point1.y, undefined, ppu);
|
|
22064
22163
|
this.graphicsPath.closePath();
|
|
22065
22164
|
}
|
|
22066
22165
|
}
|
|
@@ -22355,6 +22454,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
22355
22454
|
]);
|
|
22356
22455
|
return ShapeComponent;
|
|
22357
22456
|
}(RendererComponent);
|
|
22457
|
+
ShapeComponent.tempMVP = Matrix4.fromIdentity();
|
|
22358
22458
|
ShapeComponent = __decorate([
|
|
22359
22459
|
effectsClass("ShapeComponent")
|
|
22360
22460
|
], ShapeComponent);
|
|
@@ -22501,7 +22601,8 @@ var FrameComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
22501
22601
|
if (area) {
|
|
22502
22602
|
return {
|
|
22503
22603
|
type: area.type,
|
|
22504
|
-
triangles: area.area
|
|
22604
|
+
triangles: area.area,
|
|
22605
|
+
clipMasks: _this.frameClipMasks
|
|
22505
22606
|
};
|
|
22506
22607
|
}
|
|
22507
22608
|
}
|
|
@@ -22614,7 +22715,7 @@ var FrameComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
22614
22715
|
var child = _step.value;
|
|
22615
22716
|
var childFrameComponent = child.getComponent(RendererComponent);
|
|
22616
22717
|
if (childFrameComponent) {
|
|
22617
|
-
childFrameComponent.frameClipMasks
|
|
22718
|
+
addItem(childFrameComponent.frameClipMasks, this);
|
|
22618
22719
|
}
|
|
22619
22720
|
this.setClipRectangleRecursive(child);
|
|
22620
22721
|
}
|
|
@@ -23151,7 +23252,8 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
23151
23252
|
return {
|
|
23152
23253
|
type: area.type,
|
|
23153
23254
|
triangles: area.area,
|
|
23154
|
-
behavior: behavior
|
|
23255
|
+
behavior: behavior,
|
|
23256
|
+
clipMasks: _this.frameClipMasks
|
|
23155
23257
|
};
|
|
23156
23258
|
}
|
|
23157
23259
|
};
|
|
@@ -27555,6 +27657,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
27555
27657
|
if (force || interactParams) {
|
|
27556
27658
|
return {
|
|
27557
27659
|
type: HitTestType.custom,
|
|
27660
|
+
clipMasks: _this.renderer.frameClipMasks,
|
|
27558
27661
|
collect: function(ray) {
|
|
27559
27662
|
return _this.raycast({
|
|
27560
27663
|
radius: (interactParams == null ? void 0 : interactParams.radius) || 0.4,
|
|
@@ -29290,13 +29393,14 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
29290
29393
|
}
|
|
29291
29394
|
var _proto = TextLayout.prototype;
|
|
29292
29395
|
_proto.update = function update(options) {
|
|
29293
|
-
var _options_textHeight = options.textHeight, textHeight = _options_textHeight === void 0 ? 100 : _options_textHeight, _options_textWidth = options.textWidth, textWidth = _options_textWidth === void 0 ? 100 : _options_textWidth, _options_textOverflow = options.textOverflow, textOverflow = _options_textOverflow === void 0 ? TextOverflow.clip : _options_textOverflow, _options_textVerticalAlign = options.textVerticalAlign, textVerticalAlign = _options_textVerticalAlign === void 0 ? TextVerticalAlign.top : _options_textVerticalAlign, _options_textAlign = options.textAlign, textAlign = _options_textAlign === void 0 ? TextAlignment.left : _options_textAlign, _options_letterSpace = options.letterSpace, letterSpace = _options_letterSpace === void 0 ? 0 : _options_letterSpace, fontSize = options.fontSize, _options_lineHeight = options.lineHeight, lineHeight = _options_lineHeight === void 0 ? fontSize : _options_lineHeight;
|
|
29396
|
+
var _options_textHeight = options.textHeight, textHeight = _options_textHeight === void 0 ? 100 : _options_textHeight, _options_textWidth = options.textWidth, textWidth = _options_textWidth === void 0 ? 100 : _options_textWidth, _options_textOverflow = options.textOverflow, textOverflow = _options_textOverflow === void 0 ? TextOverflow.clip : _options_textOverflow, _options_textVerticalAlign = options.textVerticalAlign, textVerticalAlign = _options_textVerticalAlign === void 0 ? TextVerticalAlign.top : _options_textVerticalAlign, _options_textAlign = options.textAlign, textAlign = _options_textAlign === void 0 ? TextAlignment.left : _options_textAlign, _options_letterSpace = options.letterSpace, letterSpace = _options_letterSpace === void 0 ? 0 : _options_letterSpace, fontSize = options.fontSize, _options_lineHeight = options.lineHeight, lineHeight = _options_lineHeight === void 0 ? fontSize : _options_lineHeight, _options_autoResize = options.autoResize, autoResize = _options_autoResize === void 0 ? TextSizeMode.fixed : _options_autoResize;
|
|
29294
29397
|
this.letterSpace = letterSpace;
|
|
29295
29398
|
this.overflow = textOverflow;
|
|
29296
29399
|
this.textVerticalAlign = textVerticalAlign;
|
|
29297
29400
|
this.textAlign = textAlign;
|
|
29298
29401
|
this.width = textWidth;
|
|
29299
29402
|
this.height = textHeight;
|
|
29403
|
+
this.autoResize = autoResize;
|
|
29300
29404
|
this.lineHeight = lineHeight;
|
|
29301
29405
|
};
|
|
29302
29406
|
/**
|
|
@@ -29308,7 +29412,6 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
29308
29412
|
* @param totalLineHeight - 可选的实际总行高,用于替代默认计算
|
|
29309
29413
|
* @returns - 行高偏移值
|
|
29310
29414
|
*/ _proto.getOffsetY = function getOffsetY(style, lineCount, lineHeight, fontSize, totalLineHeight) {
|
|
29311
|
-
var fontScale = style.fontScale;
|
|
29312
29415
|
// /3 计算Y轴偏移量,以匹配编辑器行为
|
|
29313
29416
|
var offsetY = (lineHeight - fontSize) / 3;
|
|
29314
29417
|
// 计算基础偏移量
|
|
@@ -29320,10 +29423,10 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
29320
29423
|
offsetResult = baseOffset + offsetY;
|
|
29321
29424
|
break;
|
|
29322
29425
|
case TextVerticalAlign.middle:
|
|
29323
|
-
offsetResult = (this.height
|
|
29426
|
+
offsetResult = (this.height - commonCalculation + baseOffset) / 2;
|
|
29324
29427
|
break;
|
|
29325
29428
|
case TextVerticalAlign.bottom:
|
|
29326
|
-
offsetResult = this.height
|
|
29429
|
+
offsetResult = this.height - commonCalculation - offsetY;
|
|
29327
29430
|
break;
|
|
29328
29431
|
}
|
|
29329
29432
|
return offsetResult;
|
|
@@ -29340,10 +29443,10 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
29340
29443
|
offsetX = 0;
|
|
29341
29444
|
break;
|
|
29342
29445
|
case TextAlignment.middle:
|
|
29343
|
-
offsetX = (this.width
|
|
29446
|
+
offsetX = (this.width - maxWidth) / 2;
|
|
29344
29447
|
break;
|
|
29345
29448
|
case TextAlignment.right:
|
|
29346
|
-
offsetX = this.width
|
|
29449
|
+
offsetX = this.width - maxWidth;
|
|
29347
29450
|
break;
|
|
29348
29451
|
}
|
|
29349
29452
|
return offsetX;
|
|
@@ -29596,8 +29699,8 @@ var TextStyle = /*#__PURE__*/ function() {
|
|
|
29596
29699
|
};
|
|
29597
29700
|
// 通用工具方法
|
|
29598
29701
|
_proto.getFontDesc = function getFontDesc(size) {
|
|
29599
|
-
var _this_textStyle = this.textStyle, fontSize = _this_textStyle.fontSize,
|
|
29600
|
-
var fontDesc = "" + (size || fontSize
|
|
29702
|
+
var _this_textStyle = this.textStyle, fontSize = _this_textStyle.fontSize, fontFamily = _this_textStyle.fontFamily, textWeight = _this_textStyle.textWeight, fontStyle = _this_textStyle.fontStyle;
|
|
29703
|
+
var fontDesc = "" + (size || fontSize).toString() + "px ";
|
|
29601
29704
|
if (![
|
|
29602
29705
|
"serif",
|
|
29603
29706
|
"sans-serif",
|
|
@@ -29627,13 +29730,13 @@ var TextStyle = /*#__PURE__*/ function() {
|
|
|
29627
29730
|
};
|
|
29628
29731
|
_proto.setupShadow = function setupShadow() {
|
|
29629
29732
|
var context = this.context;
|
|
29630
|
-
var _this_textStyle = this.textStyle, shadowColor = _this_textStyle.shadowColor, shadowBlur = _this_textStyle.shadowBlur, shadowOffsetX = _this_textStyle.shadowOffsetX, shadowOffsetY = _this_textStyle.shadowOffsetY;
|
|
29733
|
+
var _this_textStyle = this.textStyle, shadowColor = _this_textStyle.shadowColor, shadowBlur = _this_textStyle.shadowBlur, shadowOffsetX = _this_textStyle.shadowOffsetX, shadowOffsetY = _this_textStyle.shadowOffsetY, fontScale = _this_textStyle.fontScale;
|
|
29631
29734
|
var r = shadowColor[0], g = shadowColor[1], b = shadowColor[2], a = shadowColor[3];
|
|
29632
29735
|
if (context) {
|
|
29633
29736
|
context.shadowColor = "rgba(" + r * 255 + ", " + g * 255 + ", " + b * 255 + ", " + a + ")";
|
|
29634
|
-
context.shadowBlur = shadowBlur;
|
|
29635
|
-
context.shadowOffsetX = shadowOffsetX;
|
|
29636
|
-
context.shadowOffsetY = -shadowOffsetY;
|
|
29737
|
+
context.shadowBlur = shadowBlur * fontScale;
|
|
29738
|
+
context.shadowOffsetX = shadowOffsetX * fontScale;
|
|
29739
|
+
context.shadowOffsetY = -shadowOffsetY * fontScale;
|
|
29637
29740
|
}
|
|
29638
29741
|
};
|
|
29639
29742
|
// 通用纹理生命周期管理
|
|
@@ -29878,30 +29981,40 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29878
29981
|
layout.width = this.getTextWidth();
|
|
29879
29982
|
this.lineCount = this.getLineCount(this.text);
|
|
29880
29983
|
layout.height = layout.lineHeight * this.lineCount;
|
|
29984
|
+
} else if (layout.autoResize === TextSizeMode.autoHeight) {
|
|
29985
|
+
this.lineCount = this.getLineCount(this.text);
|
|
29986
|
+
layout.height = layout.lineHeight * this.lineCount;
|
|
29881
29987
|
} else {
|
|
29882
29988
|
this.lineCount = this.getLineCount(this.text);
|
|
29883
29989
|
}
|
|
29884
|
-
var baseWidth =
|
|
29885
|
-
var baseHeight = layout.height
|
|
29886
|
-
var fontSize = style.fontSize
|
|
29887
|
-
var lineHeight = layout.lineHeight
|
|
29990
|
+
var baseWidth = layout.width + style.fontOffset;
|
|
29991
|
+
var baseHeight = layout.height;
|
|
29992
|
+
var fontSize = style.fontSize;
|
|
29993
|
+
var lineHeight = layout.lineHeight;
|
|
29888
29994
|
style.fontDesc = this.getFontDesc(fontSize);
|
|
29889
29995
|
// 使用 Array.from 正确分割 Unicode 字符(包括 emoji)
|
|
29890
29996
|
var char = Array.from(this.text || "");
|
|
29891
29997
|
var _this_getEffectPadding = this.getEffectPadding(), padL = _this_getEffectPadding.padL, padR = _this_getEffectPadding.padR, padT = _this_getEffectPadding.padT, padB = _this_getEffectPadding.padB;
|
|
29892
29998
|
var hasEffect = (padL | padR | padT | padB) !== 0;
|
|
29893
|
-
|
|
29894
|
-
var
|
|
29999
|
+
// 限制 fontScale,确保纹理尺寸不超过 maxTextureSize / 2
|
|
30000
|
+
var maxTexSize = this.engine.gpuCapability.detail.maxTextureSize / 2;
|
|
30001
|
+
var logicalWidth = hasEffect ? baseWidth + padL + padR : baseWidth;
|
|
30002
|
+
var logicalHeight = hasEffect ? baseHeight + padT + padB : baseHeight;
|
|
30003
|
+
var maxLogical = Math.max(logicalWidth, logicalHeight, 1);
|
|
30004
|
+
fontScale = Math.min(fontScale, maxTexSize / maxLogical);
|
|
30005
|
+
var texWidth = Math.ceil(logicalWidth * fontScale);
|
|
30006
|
+
var texHeight = Math.ceil(logicalHeight * fontScale);
|
|
29895
30007
|
var shiftX = hasEffect ? padL : 0;
|
|
29896
30008
|
var shiftY = hasEffect ? flipY ? padT : padB : 0;
|
|
29897
30009
|
// 给渲染层用:扩容比例
|
|
29898
|
-
this.effectScaleX = baseWidth > 0 ? texWidth / baseWidth : 1;
|
|
29899
|
-
this.effectScaleY = baseHeight > 0 ? texHeight / baseHeight : 1;
|
|
30010
|
+
this.effectScaleX = baseWidth > 0 ? texWidth / (baseWidth * fontScale) : 1;
|
|
30011
|
+
this.effectScaleY = baseHeight > 0 ? texHeight / (baseHeight * fontScale) : 1;
|
|
29900
30012
|
// 默认 camera 下的 world per pixel
|
|
29901
30013
|
var scaleFactor = 0.11092565;
|
|
29902
30014
|
var scaleFactor2 = scaleFactor * scaleFactor;
|
|
29903
|
-
this.transform.setSize(baseWidth * scaleFactor2
|
|
30015
|
+
this.transform.setSize(baseWidth * scaleFactor2, baseHeight * scaleFactor2);
|
|
29904
30016
|
this.renderToTexture(texWidth, texHeight, flipY, function(context) {
|
|
30017
|
+
context.scale(fontScale, fontScale);
|
|
29905
30018
|
// canvas size 变化后重新刷新 context
|
|
29906
30019
|
if (_this.maxLineWidth > baseWidth && layout.overflow === TextOverflow.display) {
|
|
29907
30020
|
context.font = _this.getFontDesc(fontSize * baseWidth / _this.maxLineWidth);
|
|
@@ -29922,7 +30035,7 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29922
30035
|
// 和浏览器行为保持一致
|
|
29923
30036
|
// 字符间距只应用在字符之间,每行第一个字符不加间距
|
|
29924
30037
|
if (charsArray.length > 0) {
|
|
29925
|
-
x += layout.letterSpace
|
|
30038
|
+
x += layout.letterSpace;
|
|
29926
30039
|
}
|
|
29927
30040
|
if (x + textMetrics.width > baseWidth && i > 0 || str === "\n") {
|
|
29928
30041
|
charsInfo.push({
|
|
@@ -30007,9 +30120,9 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30007
30120
|
*/ _proto.getEffectPadding = function getEffectPadding() {
|
|
30008
30121
|
var style = this.textStyle;
|
|
30009
30122
|
var hasDrawOutline = style.isOutlined && style.outlineWidth > 0;
|
|
30010
|
-
var outlinePad = hasDrawOutline ? Math.ceil(style.outlineWidth * 2
|
|
30123
|
+
var outlinePad = hasDrawOutline ? Math.ceil(style.outlineWidth * 2) : 0;
|
|
30011
30124
|
var hasShadow = style.hasShadow && (style.shadowBlur > 0 || style.shadowOffsetX !== 0 || style.shadowOffsetY !== 0);
|
|
30012
|
-
var shadowPad = hasShadow ? Math.ceil(
|
|
30125
|
+
var shadowPad = hasShadow ? Math.ceil(Math.abs(style.shadowOffsetX) + Math.abs(style.shadowOffsetY) + style.shadowBlur) : 0;
|
|
30013
30126
|
var pad = outlinePad + shadowPad;
|
|
30014
30127
|
return {
|
|
30015
30128
|
padL: pad,
|
|
@@ -30034,11 +30147,13 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30034
30147
|
var width = Math.max(0, Number(value) || 0);
|
|
30035
30148
|
var layout = this.textLayout;
|
|
30036
30149
|
// 宽度没变且已是非 autoWidth 模式,直接返回
|
|
30037
|
-
if (layout.width === width
|
|
30150
|
+
if (layout.width === width) {
|
|
30038
30151
|
return;
|
|
30039
30152
|
}
|
|
30040
30153
|
// 手动设置宽度时关闭 autoWidth
|
|
30041
|
-
layout.autoResize
|
|
30154
|
+
if (layout.autoResize === TextSizeMode.autoWidth) {
|
|
30155
|
+
layout.autoResize = TextSizeMode.autoHeight;
|
|
30156
|
+
}
|
|
30042
30157
|
layout.width = width;
|
|
30043
30158
|
// 按当前 overflow 模式重新计算 maxLineWidth
|
|
30044
30159
|
this.isDirty = true;
|
|
@@ -30151,7 +30266,7 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30151
30266
|
*
|
|
30152
30267
|
* 说明:
|
|
30153
30268
|
* - 使用 Canvas 2D 的 measureText,并按当前实现的逐字符排版规则累加宽度(与 updateTexture 保持一致)。
|
|
30154
|
-
* - 结果为"逻辑宽度"
|
|
30269
|
+
* - 结果为"逻辑宽度"(扣除 fontOffset),可直接写回 options.textWidth。,可直接写回 options.textWidth。
|
|
30155
30270
|
* - 通过 padding 追加少量冗余像素,用于降低边缘裁切风险。
|
|
30156
30271
|
*
|
|
30157
30272
|
* @returns 文本宽度(>= 0)
|
|
@@ -30166,10 +30281,8 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30166
30281
|
var text = ((_this_text = this.text) != null ? _this_text : "").toString();
|
|
30167
30282
|
var layout = this.textLayout;
|
|
30168
30283
|
var style = this.textStyle;
|
|
30169
|
-
|
|
30170
|
-
|
|
30171
|
-
// 与 updateTexture 一致:用 render 字号测量
|
|
30172
|
-
ctx.font = this.getFontDesc(renderFontSize);
|
|
30284
|
+
// 与 updateTexture 一致:用逻辑字号测量
|
|
30285
|
+
ctx.font = this.getFontDesc(style.fontSize);
|
|
30173
30286
|
var maxLineWidthRender = 0;
|
|
30174
30287
|
var x = 0;
|
|
30175
30288
|
for(var i = 0; i < text.length; i++){
|
|
@@ -30179,17 +30292,14 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30179
30292
|
x = 0;
|
|
30180
30293
|
continue;
|
|
30181
30294
|
}
|
|
30182
|
-
// 与 updateTexture 一致:每个字符前加一次 letterSpace
|
|
30183
|
-
x +=
|
|
30295
|
+
// 与 updateTexture 一致:每个字符前加一次 letterSpace
|
|
30296
|
+
x += layout.letterSpace || 0;
|
|
30184
30297
|
x += ctx.measureText(ch).width;
|
|
30185
30298
|
}
|
|
30186
30299
|
maxLineWidthRender = Math.max(maxLineWidthRender, x);
|
|
30187
|
-
// render -> 逻辑宽度
|
|
30188
|
-
var logicalMax = maxLineWidthRender / fontScale;
|
|
30189
|
-
// 反推 layout.width:renderWidth = (layout.width + fontOffset) * fontScale
|
|
30190
30300
|
var padding = 2;
|
|
30191
30301
|
var EPS = 1e-4;
|
|
30192
|
-
var w = Math.ceil(
|
|
30302
|
+
var w = Math.ceil(maxLineWidthRender - (style.fontOffset || 0) - EPS) + padding;
|
|
30193
30303
|
return Math.max(0, w);
|
|
30194
30304
|
};
|
|
30195
30305
|
_proto.getDefaultProps = function getDefaultProps() {
|
|
@@ -30301,9 +30411,9 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
30301
30411
|
}
|
|
30302
30412
|
}
|
|
30303
30413
|
// TODO 待移除 tagggedProperties 为没有装饰器的临时方案
|
|
30304
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(effectsObject.
|
|
30414
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(effectsObject.definition)), _step1; !(_step1 = _iterator1()).done;){
|
|
30305
30415
|
var key1 = _step1.value;
|
|
30306
|
-
var value1 = effectsObject.
|
|
30416
|
+
var value1 = effectsObject.definition[key1];
|
|
30307
30417
|
if (typeof value1 === "number" || typeof value1 === "string" || typeof value1 === "boolean" || SerializationHelper.checkTypedArray(value1)) {
|
|
30308
30418
|
// TODO json 数据避免传 typedArray
|
|
30309
30419
|
serializedData[key1] = value1;
|
|
@@ -30327,7 +30437,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
30327
30437
|
return serializedData;
|
|
30328
30438
|
};
|
|
30329
30439
|
SerializationHelper.deserialize = function deserialize(serializedData, effectsObject) {
|
|
30330
|
-
effectsObject.
|
|
30440
|
+
effectsObject.definition = serializedData;
|
|
30331
30441
|
var serializedProperties = getMergedStore(effectsObject);
|
|
30332
30442
|
var engine = effectsObject.engine;
|
|
30333
30443
|
if (serializedProperties) {
|
|
@@ -30342,7 +30452,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
30342
30452
|
effectsObject[key] = SerializationHelper.deserializeProperty(value, engine, 0, propertyType);
|
|
30343
30453
|
}
|
|
30344
30454
|
}
|
|
30345
|
-
effectsObject.fromData(effectsObject.
|
|
30455
|
+
effectsObject.fromData(effectsObject.definition);
|
|
30346
30456
|
};
|
|
30347
30457
|
SerializationHelper.checkTypedArray = function checkTypedArray(obj) {
|
|
30348
30458
|
return _instanceof1(obj, Int8Array) || _instanceof1(obj, Uint8Array) || _instanceof1(obj, Uint8ClampedArray) || _instanceof1(obj, Int16Array) || _instanceof1(obj, Uint16Array) || _instanceof1(obj, Int32Array) || _instanceof1(obj, Uint32Array) || _instanceof1(obj, Float32Array) || _instanceof1(obj, Float64Array) || _instanceof1(obj, ArrayBuffer);
|
|
@@ -30473,7 +30583,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
30473
30583
|
var effectsObjectData = this.findData(guid);
|
|
30474
30584
|
var effectsObject;
|
|
30475
30585
|
if (!effectsObjectData) {
|
|
30476
|
-
console.
|
|
30586
|
+
console.warn("Object data with uuid: " + guid + " not found.");
|
|
30477
30587
|
return undefined;
|
|
30478
30588
|
}
|
|
30479
30589
|
switch(effectsObjectData.dataType){
|
|
@@ -30495,7 +30605,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
30495
30605
|
}
|
|
30496
30606
|
}
|
|
30497
30607
|
if (!effectsObject) {
|
|
30498
|
-
console.
|
|
30608
|
+
console.warn("Constructor for DataType: " + effectsObjectData.dataType + " not found.");
|
|
30499
30609
|
return undefined;
|
|
30500
30610
|
}
|
|
30501
30611
|
effectsObject.setInstanceId(effectsObjectData.id);
|
|
@@ -32337,7 +32447,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
32337
32447
|
return ret;
|
|
32338
32448
|
}
|
|
32339
32449
|
|
|
32340
|
-
var version$2 = "2.9.0-alpha.
|
|
32450
|
+
var version$2 = "2.9.0-alpha.2";
|
|
32341
32451
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
32342
32452
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
32343
32453
|
var reverseParticle = false;
|
|
@@ -34656,7 +34766,9 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
34656
34766
|
}
|
|
34657
34767
|
var regions = [];
|
|
34658
34768
|
var ray = this.getHitTestRay(x, y);
|
|
34659
|
-
|
|
34769
|
+
// 所有命中的元素共享同一个 hitPositions 数组,保持与原有行为一致
|
|
34770
|
+
var hitPositions = [];
|
|
34771
|
+
this.rootItem.hitTest(ray, x, y, regions, hitPositions, force, options);
|
|
34660
34772
|
return regions;
|
|
34661
34773
|
};
|
|
34662
34774
|
/**
|
|
@@ -37224,10 +37336,6 @@ var PassTextureCache = /*#__PURE__*/ function() {
|
|
|
37224
37336
|
height: renderer.getHeight(),
|
|
37225
37337
|
event: engine.eventSystem
|
|
37226
37338
|
}), scene);
|
|
37227
|
-
// 中低端设备降帧到 30fps·
|
|
37228
|
-
if (engine.ticker && options.renderLevel === RenderLevel.B) {
|
|
37229
|
-
engine.ticker.setFPS(Math.min(engine.ticker.getFPS(), 30));
|
|
37230
|
-
}
|
|
37231
37339
|
// TODO 目前编辑器会每帧调用 loadScene, 在这编译会导致闪帧,待编辑器渲染逻辑优化后移除。
|
|
37232
37340
|
if (engine.env !== PLAYER_OPTIONS_ENV_EDITOR) {
|
|
37233
37341
|
engine.assetService.createShaderVariant();
|
|
@@ -37292,7 +37400,7 @@ registerPlugin("text", TextLoader);
|
|
|
37292
37400
|
registerPlugin("sprite", SpriteLoader);
|
|
37293
37401
|
registerPlugin("particle", ParticleLoader);
|
|
37294
37402
|
registerPlugin("interact", InteractLoader);
|
|
37295
|
-
var version$1 = "2.9.0-alpha.
|
|
37403
|
+
var version$1 = "2.9.0-alpha.2";
|
|
37296
37404
|
logger.info("Core version: " + version$1 + ".");
|
|
37297
37405
|
|
|
37298
37406
|
var _obj;
|
|
@@ -38450,11 +38558,21 @@ var seed = 1;
|
|
|
38450
38558
|
}
|
|
38451
38559
|
var _proto = ThreeComposition.prototype;
|
|
38452
38560
|
_proto.prepareRender = function prepareRender() {
|
|
38453
|
-
var _this_rootItem_getComponent;
|
|
38454
38561
|
var render = this.renderer;
|
|
38455
38562
|
var frame = this.renderFrame;
|
|
38456
38563
|
frame.renderPasses[0].meshes.length = 0;
|
|
38457
|
-
|
|
38564
|
+
var items = this.rootItem.getDescendants();
|
|
38565
|
+
// 主合成元素
|
|
38566
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
38567
|
+
var vfxItem = _step.value;
|
|
38568
|
+
var rendererComponents = vfxItem.getComponents(RendererComponent);
|
|
38569
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
38570
|
+
var rendererComponent = _step1.value;
|
|
38571
|
+
if (rendererComponent.isActiveAndEnabled) {
|
|
38572
|
+
rendererComponent.render(render);
|
|
38573
|
+
}
|
|
38574
|
+
}
|
|
38575
|
+
}
|
|
38458
38576
|
};
|
|
38459
38577
|
return ThreeComposition;
|
|
38460
38578
|
}(Composition);
|
|
@@ -38858,7 +38976,7 @@ applyMixins(ThreeTextComponent, [
|
|
|
38858
38976
|
*/ Mesh.create = function(engine, props) {
|
|
38859
38977
|
return new ThreeMesh(engine, props);
|
|
38860
38978
|
};
|
|
38861
|
-
var version = "2.9.0-alpha.
|
|
38979
|
+
var version = "2.9.0-alpha.2";
|
|
38862
38980
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
38863
38981
|
|
|
38864
38982
|
export { ActivationMixerPlayable, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AndNode, AndNodeData, Animatable, AnimationClip, AnimationClipNode, AnimationClipNodeData, AnimationEvent, AnimationGraphAsset, Animator, ApplyAdditiveNode, ApplyAdditiveNodeData, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, BlendNode, BlendNodeData, BoolValueNode, BoundingBoxInfo, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPlayable, ColorPropertyMixerPlayable, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, ComponentTimePlayable, ComponentTimePlayableAsset, ComponentTimeTrack, Composition, CompositionComponent, CompressTextureCapabilityType, ConstBoolNode, ConstBoolNodeData, ConstFloatNode, ConstFloatNodeData, ConstraintTarget, ControlParameterBoolNode, ControlParameterBoolNodeData, ControlParameterFloatNode, ControlParameterFloatNodeData, ControlParameterTriggerNode, ControlParameterTriggerNodeData, DEFAULT_FONTS, DEFAULT_FPS, Database, Deferred, DestroyOptions, Downloader, DrawObjectPass, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectComponentTimeTrack, EffectsObject, EffectsPackage, Ellipse, Engine, EqualNodeData, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatComparisonNode, FloatComparisonNodeData, FloatPropertyMixerPlayable, FloatPropertyPlayableAsset, FloatPropertyTrack, FloatValueNode, FrameComponent, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, GraphInstance, GraphNode, GraphNodeData, Graphics, GraphicsPath, GreaterNodeData, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, InvalidIndex, Item, LayerBlendNode, LayerBlendNodeData, LessNodeData, LineSegments, LinearValue, MaskMode, MaskProcessor, MaskableGraphic, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, NodeTransform, NotNode, NotNodeData, NotifyEvent, ObjectBindingTrack, OrNode, OrNodeData, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleMixerPlayable, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PlayState, Playable, PlayableAsset, PlayableOutput, Plugin, PluginSystem, PointerEventData, PointerEventType, PolyStar, Polygon, Pose, PoseNode, PositionConstraint, PostProcessVolume, Precomposition, PrecompositionManager, PropertyClipPlayable, PropertyTrack, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RaycastResult, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTargetPool, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SceneLoader, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, ShapePath, SourceType, SpriteColorMixerPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteComponentTimeTrack, SpriteLoader, StarType, StateMachineNode, StateMachineNodeData, StateNode, StateNodeData, StaticValue, SubCompositionClipPlayable, SubCompositionMixerPlayable, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TangentMode, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TexturePaintScaleMode, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelineInstance, TrackAsset, TrackMixerPlayable, TrackType, Transform, TransformMixerPlayable, TransformPlayable, TransformPlayableAsset, TransformTrack, TransitionNode, TransitionNodeData, TransitionState, UpdateModes, VFXItem, ValueGetter, ValueNode, Vector2Curve, Vector2PropertyMixerPlayable, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector3Curve, Vector3PropertyMixerPlayable, Vector3PropertyTrack, Vector3ropertyPlayableAsset, Vector4Curve, Vector4PropertyMixerPlayable, Vector4PropertyPlayableAsset, Vector4PropertyTrack, WeightedMode, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, buildLine, calculateTranslation, canUseBOM, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createGLContext, createKeyFrameMeta, createShape, createValueGetter, curveEps, decimalEqual, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, extractMinAndMax, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getClass, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getKeyFrameMetaByRawValue, getMergedStore, getNodeDataClass, getParticleMeshShader, getPixelRatio, getPluginUsageInfo, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isOpenHarmony, isPlainObject, isPowerOfTwo, isSafeFontFamily, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, modifyMaxKeyframeShader, nearestPowerOfTwo, nodeDataClass, noop, normalizeColor, numberToFix, oldBezierKeyFramesToNew, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setRayFromCamera, setSideMode, setUniformValue, sortByOrder, index$1 as spec, textureLoaderRegistry, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|