@galacean/effects-core 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/components/component.d.ts +4 -0
- package/dist/components/composition-component.d.ts +1 -4
- package/dist/components/renderer-component.d.ts +8 -1
- package/dist/components/shape-component.d.ts +2 -0
- package/dist/effects-object.d.ts +1 -1
- package/dist/index.js +327 -224
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +327 -224
- package/dist/index.mjs.map +1 -1
- package/dist/material/types.d.ts +2 -0
- package/dist/math/shape/build-adaptive-bezier.d.ts +1 -1
- package/dist/math/shape/circle.d.ts +1 -1
- package/dist/math/shape/ellipse.d.ts +1 -1
- package/dist/math/shape/graphics-path.d.ts +1 -1
- package/dist/math/shape/poly-star.d.ts +1 -1
- package/dist/math/shape/polygon.d.ts +1 -1
- package/dist/math/shape/rectangle.d.ts +1 -1
- package/dist/math/shape/shape-path.d.ts +1 -1
- package/dist/math/shape/shape-primitive.d.ts +1 -1
- package/dist/math/shape/triangle.d.ts +1 -1
- package/dist/plugins/interact/click-handler.d.ts +5 -0
- package/dist/plugins/text/text-item.d.ts +1 -1
- package/dist/scene.d.ts +0 -1
- package/dist/vfx-item.d.ts +18 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.9.0-alpha.
|
|
6
|
+
* Version: v2.9.0-alpha.2
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -39,11 +39,6 @@ function _instanceof1(left, right) {
|
|
|
39
39
|
} else return _instanceof1(left, right);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
function _type_of(obj) {
|
|
43
|
-
"@swc/helpers - typeof";
|
|
44
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
42
|
function __decorate(decorators, target, key, desc) {
|
|
48
43
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
49
44
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4093,7 +4088,7 @@ function getDirectStore(target) {
|
|
|
4093
4088
|
function EffectsObject(engine) {
|
|
4094
4089
|
this.engine = engine;
|
|
4095
4090
|
this.guid = generateGUID();
|
|
4096
|
-
this.
|
|
4091
|
+
this.definition = {};
|
|
4097
4092
|
this.engine.addInstance(this);
|
|
4098
4093
|
}
|
|
4099
4094
|
var _proto = EffectsObject.prototype;
|
|
@@ -6997,6 +6992,11 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
6997
6992
|
// OVERRIDE
|
|
6998
6993
|
};
|
|
6999
6994
|
/**
|
|
6995
|
+
* 当父级或间接父级发生改变时调用
|
|
6996
|
+
*/ _proto.onParentChanged = function onParentChanged() {
|
|
6997
|
+
// OVERRIDE
|
|
6998
|
+
};
|
|
6999
|
+
/**
|
|
7000
7000
|
* @internal
|
|
7001
7001
|
*/ _proto.enable = function enable() {
|
|
7002
7002
|
if (this.item.composition) {
|
|
@@ -9227,7 +9227,6 @@ var MaterialRenderType;
|
|
|
9227
9227
|
for(var _iterator4 = _create_for_of_iterator_helper_loose(frameClipMasks), _step4; !(_step4 = _iterator4()).done;){
|
|
9228
9228
|
var frameClipMask1 = _step4.value;
|
|
9229
9229
|
this.removeMaskReference(frameClipMask1);
|
|
9230
|
-
maskedComponent.frameClipMasks = [];
|
|
9231
9230
|
}
|
|
9232
9231
|
};
|
|
9233
9232
|
/**
|
|
@@ -10665,7 +10664,6 @@ BoundingBox.tempVector2 = new Vector3();
|
|
|
10665
10664
|
_this.materials = [];
|
|
10666
10665
|
/**
|
|
10667
10666
|
* @hidden
|
|
10668
|
-
* @internal
|
|
10669
10667
|
* Internal utility.
|
|
10670
10668
|
* Not part of the public API — do not rely on this in your code.
|
|
10671
10669
|
*/ _this.frameClipMasks = [];
|
|
@@ -10689,6 +10687,9 @@ BoundingBox.tempVector2 = new Vector3();
|
|
|
10689
10687
|
var _this_item_composition;
|
|
10690
10688
|
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.removeMeshFromDefaultRenderPass(this);
|
|
10691
10689
|
};
|
|
10690
|
+
_proto.onParentChanged = function onParentChanged() {
|
|
10691
|
+
this.frameClipMasks = [];
|
|
10692
|
+
};
|
|
10692
10693
|
/**
|
|
10693
10694
|
* 获取包围盒信息
|
|
10694
10695
|
*/ _proto.getBoundingBoxInfo = function getBoundingBoxInfo() {
|
|
@@ -13207,6 +13208,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
13207
13208
|
if (!this.composition && vfxItem.composition) {
|
|
13208
13209
|
this.composition = vfxItem.composition;
|
|
13209
13210
|
}
|
|
13211
|
+
this.onParentChanged();
|
|
13210
13212
|
if (!this.isDuringPlay && vfxItem.isDuringPlay) {
|
|
13211
13213
|
this.awake();
|
|
13212
13214
|
this.beginPlay();
|
|
@@ -13339,6 +13341,122 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
13339
13341
|
// OVERRIDE
|
|
13340
13342
|
};
|
|
13341
13343
|
/**
|
|
13344
|
+
* 对当前元素及其子节点进行射线命中测试
|
|
13345
|
+
*
|
|
13346
|
+
* @param ray - 射线
|
|
13347
|
+
* @param x - 归一化屏幕坐标 x
|
|
13348
|
+
* @param y - 归一化屏幕坐标 y
|
|
13349
|
+
* @param regions - 命中结果收集数组
|
|
13350
|
+
* @param hitPositions - 共享的命中位置数组,所有 region 共享同一引用
|
|
13351
|
+
* @param force - 是否强制测试无交互信息的元素
|
|
13352
|
+
* @param options - 额外选项(maxCount、stop、skip)
|
|
13353
|
+
* @returns 是否有任何命中
|
|
13354
|
+
*/ _proto.hitTest = function hitTest(ray, x, y, regions, hitPositions, force, options) {
|
|
13355
|
+
var _this_composition;
|
|
13356
|
+
if (!this.isActive) {
|
|
13357
|
+
return false;
|
|
13358
|
+
}
|
|
13359
|
+
var hitTestSuccess = false;
|
|
13360
|
+
var maxCount = options == null ? void 0 : options.maxCount;
|
|
13361
|
+
var hitParams = this.getHitTestParams(force);
|
|
13362
|
+
// 1. 测试自身
|
|
13363
|
+
if (hitParams) {
|
|
13364
|
+
var clipMasks = hitParams.clipMasks;
|
|
13365
|
+
var clipPassed = true;
|
|
13366
|
+
if (clipMasks.length > 0 && !hitTestMask(ray, clipMasks)) {
|
|
13367
|
+
clipPassed = false;
|
|
13368
|
+
}
|
|
13369
|
+
if (clipPassed) {
|
|
13370
|
+
var success = false;
|
|
13371
|
+
var intersectPoint = new Vector3();
|
|
13372
|
+
if (hitParams.type === HitTestType.triangle) {
|
|
13373
|
+
var triangles = hitParams.triangles, backfaceCulling = hitParams.backfaceCulling;
|
|
13374
|
+
for(var j = 0; j < triangles.length; j++){
|
|
13375
|
+
if (ray.intersectTriangle(triangles[j], intersectPoint, backfaceCulling)) {
|
|
13376
|
+
success = true;
|
|
13377
|
+
hitPositions.push(intersectPoint);
|
|
13378
|
+
break;
|
|
13379
|
+
}
|
|
13380
|
+
}
|
|
13381
|
+
} else if (hitParams.type === HitTestType.box) {
|
|
13382
|
+
var center = hitParams.center, size = hitParams.size;
|
|
13383
|
+
var boxMin = center.clone().addScaledVector(size, 0.5);
|
|
13384
|
+
var boxMax = center.clone().addScaledVector(size, -0.5);
|
|
13385
|
+
if (ray.intersectBox({
|
|
13386
|
+
min: boxMin,
|
|
13387
|
+
max: boxMax
|
|
13388
|
+
}, intersectPoint)) {
|
|
13389
|
+
success = true;
|
|
13390
|
+
hitPositions.push(intersectPoint);
|
|
13391
|
+
}
|
|
13392
|
+
} else if (hitParams.type === HitTestType.sphere) {
|
|
13393
|
+
var center1 = hitParams.center, radius = hitParams.radius;
|
|
13394
|
+
if (ray.intersectSphere({
|
|
13395
|
+
center: center1,
|
|
13396
|
+
radius: radius
|
|
13397
|
+
}, intersectPoint)) {
|
|
13398
|
+
success = true;
|
|
13399
|
+
hitPositions.push(intersectPoint);
|
|
13400
|
+
}
|
|
13401
|
+
} else if (hitParams.type === HitTestType.custom) {
|
|
13402
|
+
var tempPosition = hitParams.collect(ray, new Vector2(x, y));
|
|
13403
|
+
if (tempPosition && tempPosition.length > 0) {
|
|
13404
|
+
tempPosition.forEach(function(pos) {
|
|
13405
|
+
hitPositions.push(pos);
|
|
13406
|
+
});
|
|
13407
|
+
success = true;
|
|
13408
|
+
}
|
|
13409
|
+
}
|
|
13410
|
+
if (success) {
|
|
13411
|
+
var _options_stop;
|
|
13412
|
+
var region = {
|
|
13413
|
+
id: this.getInstanceId(),
|
|
13414
|
+
name: this.name,
|
|
13415
|
+
position: hitPositions[hitPositions.length - 1],
|
|
13416
|
+
parentId: this.parentId,
|
|
13417
|
+
hitPositions: hitPositions,
|
|
13418
|
+
behavior: hitParams.behavior,
|
|
13419
|
+
item: this,
|
|
13420
|
+
composition: this.composition
|
|
13421
|
+
};
|
|
13422
|
+
regions.push(region);
|
|
13423
|
+
hitTestSuccess = true;
|
|
13424
|
+
if (options == null ? void 0 : (_options_stop = options.stop) == null ? void 0 : _options_stop.call(options, region)) {
|
|
13425
|
+
return true;
|
|
13426
|
+
}
|
|
13427
|
+
}
|
|
13428
|
+
}
|
|
13429
|
+
}
|
|
13430
|
+
// 2. 递归测试子节点
|
|
13431
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
13432
|
+
var child = _step.value;
|
|
13433
|
+
var _options_skip;
|
|
13434
|
+
if (maxCount !== undefined && regions.length >= maxCount) {
|
|
13435
|
+
break;
|
|
13436
|
+
}
|
|
13437
|
+
if (options == null ? void 0 : (_options_skip = options.skip) == null ? void 0 : _options_skip.call(options, child)) {
|
|
13438
|
+
continue;
|
|
13439
|
+
}
|
|
13440
|
+
if (child.hitTest(ray, x, y, regions, hitPositions, force, options)) {
|
|
13441
|
+
hitTestSuccess = true;
|
|
13442
|
+
}
|
|
13443
|
+
}
|
|
13444
|
+
// 3. composition 元素:子元素命中时,将自身也加入结果(根元素除外)
|
|
13445
|
+
if (VFXItem.isComposition(this) && hitTestSuccess && this !== ((_this_composition = this.composition) == null ? void 0 : _this_composition.rootItem)) {
|
|
13446
|
+
regions.push({
|
|
13447
|
+
id: this.getInstanceId(),
|
|
13448
|
+
name: this.name,
|
|
13449
|
+
position: hitPositions[hitPositions.length - 1],
|
|
13450
|
+
parentId: this.parentId,
|
|
13451
|
+
hitPositions: hitPositions,
|
|
13452
|
+
behavior: InteractBehavior.NONE,
|
|
13453
|
+
item: this,
|
|
13454
|
+
composition: this.composition
|
|
13455
|
+
});
|
|
13456
|
+
}
|
|
13457
|
+
return hitTestSuccess;
|
|
13458
|
+
};
|
|
13459
|
+
/**
|
|
13342
13460
|
* 获取元素当前世界坐标
|
|
13343
13461
|
*/ _proto.getCurrentPosition = function getCurrentPosition() {
|
|
13344
13462
|
var pos = new Vector3();
|
|
@@ -13374,7 +13492,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
13374
13492
|
// 重新设置当前元素和组件的 ID 以及子元素和子元素组件的 ID,避免实例化新的对象时产生碰撞
|
|
13375
13493
|
this.refreshGUIDRecursive();
|
|
13376
13494
|
var newItem = this.engine.findObject({
|
|
13377
|
-
id: this.
|
|
13495
|
+
id: this.definition.id
|
|
13378
13496
|
});
|
|
13379
13497
|
newItem.refreshGUIDRecursive();
|
|
13380
13498
|
this.refreshGUIDRecursive(previousObjectIDMap);
|
|
@@ -13450,6 +13568,16 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
13450
13568
|
}
|
|
13451
13569
|
}
|
|
13452
13570
|
};
|
|
13571
|
+
_proto.onParentChanged = function onParentChanged() {
|
|
13572
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
13573
|
+
var component = _step.value;
|
|
13574
|
+
component.onParentChanged();
|
|
13575
|
+
}
|
|
13576
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.children), _step1; !(_step1 = _iterator1()).done;){
|
|
13577
|
+
var child = _step1.value;
|
|
13578
|
+
child.onParentChanged();
|
|
13579
|
+
}
|
|
13580
|
+
};
|
|
13453
13581
|
/**
|
|
13454
13582
|
* @internal
|
|
13455
13583
|
*/ _proto.setRendererComponentOrder = function setRendererComponentOrder(renderOrder) {
|
|
@@ -13469,7 +13597,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
13469
13597
|
this.parentId = parentId;
|
|
13470
13598
|
this.components.length = 0;
|
|
13471
13599
|
if (VFXItem.isComposition(this)) {
|
|
13472
|
-
var refId = this.
|
|
13600
|
+
var refId = this.definition.content.options.refId;
|
|
13473
13601
|
var compositionData = this.engine.findEffectsObjectData(refId);
|
|
13474
13602
|
if (!compositionData) {
|
|
13475
13603
|
throw new Error("Referenced precomposition with Id: " + refId + " does not exist.");
|
|
@@ -13516,24 +13644,24 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
13516
13644
|
};
|
|
13517
13645
|
_proto.toData = function toData() {
|
|
13518
13646
|
var _this_parent;
|
|
13519
|
-
this.
|
|
13520
|
-
this.
|
|
13521
|
-
this.
|
|
13647
|
+
this.definition.id = this.guid;
|
|
13648
|
+
this.definition.transform = this.transform.toData();
|
|
13649
|
+
this.definition.dataType = DataType.VFXItemData;
|
|
13522
13650
|
if (((_this_parent = this.parent) == null ? void 0 : _this_parent.name) !== "rootItem") {
|
|
13523
13651
|
var _this_parent1;
|
|
13524
|
-
this.
|
|
13652
|
+
this.definition.parentId = (_this_parent1 = this.parent) == null ? void 0 : _this_parent1.guid;
|
|
13525
13653
|
}
|
|
13526
13654
|
// TODO 统一 sprite 等其他组件的序列化逻辑
|
|
13527
|
-
if (!this.
|
|
13528
|
-
this.
|
|
13655
|
+
if (!this.definition.components) {
|
|
13656
|
+
this.definition.components = [];
|
|
13529
13657
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
13530
13658
|
var component = _step.value;
|
|
13531
13659
|
if (_instanceof1(component, EffectComponent)) {
|
|
13532
|
-
this.
|
|
13660
|
+
this.definition.components.push(component);
|
|
13533
13661
|
}
|
|
13534
13662
|
}
|
|
13535
13663
|
}
|
|
13536
|
-
this.
|
|
13664
|
+
this.definition.content = {};
|
|
13537
13665
|
};
|
|
13538
13666
|
/**
|
|
13539
13667
|
* 销毁元素
|
|
@@ -13790,6 +13918,47 @@ var Item;
|
|
|
13790
13918
|
}
|
|
13791
13919
|
Item.isNull = isNull;
|
|
13792
13920
|
})(Item || (Item = {}));
|
|
13921
|
+
/**
|
|
13922
|
+
* 遮罩命中测试:检查射线是否通过所有遮罩区域
|
|
13923
|
+
* 根据每个遮罩的 transform(size、scale、position、rotation、anchor)构建世界空间矩形,
|
|
13924
|
+
* 然后检测射线是否与该矩形相交。所有遮罩都必须通过才算测试通过。
|
|
13925
|
+
* @param ray - 射线
|
|
13926
|
+
* @param clipMasks - 遮罩列表
|
|
13927
|
+
* @returns 射线是否通过所有遮罩测试
|
|
13928
|
+
*/ function hitTestMask(ray, clipMasks) {
|
|
13929
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(clipMasks), _step; !(_step = _iterator()).done;){
|
|
13930
|
+
var mask = _step.value;
|
|
13931
|
+
var item = mask.item;
|
|
13932
|
+
if (!item.isActive || !item.transform.getValid()) {
|
|
13933
|
+
continue;
|
|
13934
|
+
}
|
|
13935
|
+
var transform = item.transform;
|
|
13936
|
+
var worldMatrix = transform.getWorldMatrix();
|
|
13937
|
+
var sx = transform.size.x;
|
|
13938
|
+
var sy = transform.size.y;
|
|
13939
|
+
// 将遮罩矩形的四个顶点从本地空间变换到世界空间
|
|
13940
|
+
// 本地空间顶点为单位矩形 (-0.5, -0.5) 到 (0.5, 0.5),按 size 缩放
|
|
13941
|
+
var p0 = new Vector3(-0.5 * sx, 0.5 * sy, 0).applyMatrix(worldMatrix);
|
|
13942
|
+
var p1 = new Vector3(-0.5 * sx, -0.5 * sy, 0).applyMatrix(worldMatrix);
|
|
13943
|
+
var p2 = new Vector3(0.5 * sx, 0.5 * sy, 0).applyMatrix(worldMatrix);
|
|
13944
|
+
var p3 = new Vector3(0.5 * sx, -0.5 * sy, 0).applyMatrix(worldMatrix);
|
|
13945
|
+
// 矩形由两个三角形组成,检测射线与任一三角形的相交
|
|
13946
|
+
var triangle1 = {
|
|
13947
|
+
p0: p0,
|
|
13948
|
+
p1: p1,
|
|
13949
|
+
p2: p2
|
|
13950
|
+
};
|
|
13951
|
+
var triangle2 = {
|
|
13952
|
+
p0: p2,
|
|
13953
|
+
p1: p1,
|
|
13954
|
+
p2: p3
|
|
13955
|
+
};
|
|
13956
|
+
if (!ray.intersectTriangle(triangle1) && !ray.intersectTriangle(triangle2)) {
|
|
13957
|
+
return false;
|
|
13958
|
+
}
|
|
13959
|
+
}
|
|
13960
|
+
return true;
|
|
13961
|
+
}
|
|
13793
13962
|
|
|
13794
13963
|
var toHalf = function() {
|
|
13795
13964
|
var floatView = new Float32Array(1);
|
|
@@ -17397,7 +17566,7 @@ function triangulate(contours) {
|
|
|
17397
17566
|
*/ _proto.getY = function getY() {
|
|
17398
17567
|
return this.points[this.points.length - 1];
|
|
17399
17568
|
};
|
|
17400
|
-
_proto.build = function build(points) {
|
|
17569
|
+
_proto.build = function build(points, screenScale) {
|
|
17401
17570
|
for(var i = 0; i < this.points.length; i++){
|
|
17402
17571
|
points[i] = this.points[i];
|
|
17403
17572
|
}
|
|
@@ -17499,11 +17668,10 @@ var RECURSION_LIMIT = 8;
|
|
|
17499
17668
|
var FLT_EPSILON = 1.19209290e-7;
|
|
17500
17669
|
var PATH_DISTANCE_EPSILON = 1.0;
|
|
17501
17670
|
var defaultBezierSmoothness = 0.5;
|
|
17502
|
-
function buildAdaptiveBezier(points, sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, smoothness) {
|
|
17503
|
-
|
|
17504
|
-
var scale = 5;
|
|
17671
|
+
function buildAdaptiveBezier(points, sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, smoothness, scale) {
|
|
17672
|
+
var s = scale != null ? scale : 1;
|
|
17505
17673
|
var smoothing = Math.min(0.99, Math.max(0, smoothness != null ? smoothness : defaultBezierSmoothness));
|
|
17506
|
-
var distanceTolerance = (PATH_DISTANCE_EPSILON - smoothing) /
|
|
17674
|
+
var distanceTolerance = (PATH_DISTANCE_EPSILON - smoothing) / s;
|
|
17507
17675
|
distanceTolerance *= distanceTolerance;
|
|
17508
17676
|
begin(sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, points, distanceTolerance);
|
|
17509
17677
|
return points;
|
|
@@ -17693,7 +17861,7 @@ function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, le
|
|
|
17693
17861
|
_proto.getY = function getY() {
|
|
17694
17862
|
return this.y;
|
|
17695
17863
|
};
|
|
17696
|
-
_proto.build = function build(points) {
|
|
17864
|
+
_proto.build = function build(points, screenScale) {
|
|
17697
17865
|
var x = this.x;
|
|
17698
17866
|
var y = this.y;
|
|
17699
17867
|
var rx = this.halfWidth;
|
|
@@ -17703,9 +17871,10 @@ function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, le
|
|
|
17703
17871
|
if (!(rx >= 0 && ry >= 0 && dx >= 0 && dy >= 0)) {
|
|
17704
17872
|
return points;
|
|
17705
17873
|
}
|
|
17706
|
-
//
|
|
17707
|
-
|
|
17708
|
-
var
|
|
17874
|
+
// n 个等分段逼近四分之一椭圆弧,最大弦高误差 ε = R·π²/(8n²)
|
|
17875
|
+
// 屏幕误差 = ε × ppu = ppu·R·π²/(8n²),令 n = √(ppu·(rx+ry)),则误差 ≈ π²/8 ≈ 1.2px
|
|
17876
|
+
var ppu = screenScale != null ? screenScale : 1;
|
|
17877
|
+
var n = Math.ceil(Math.sqrt(ppu * (rx + ry)));
|
|
17709
17878
|
var m = n * 8 + (0) + (0);
|
|
17710
17879
|
if (m === 0) {
|
|
17711
17880
|
return points;
|
|
@@ -17840,7 +18009,7 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
17840
18009
|
_proto.copyTo = function copyTo(destination) {
|
|
17841
18010
|
destination.copyFrom(this);
|
|
17842
18011
|
};
|
|
17843
|
-
_proto.build = function build(points) {
|
|
18012
|
+
_proto.build = function build(points, screenScale) {
|
|
17844
18013
|
switch(this.starType){
|
|
17845
18014
|
case 0:
|
|
17846
18015
|
{
|
|
@@ -17853,13 +18022,13 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
17853
18022
|
break;
|
|
17854
18023
|
}
|
|
17855
18024
|
}
|
|
17856
|
-
var
|
|
18025
|
+
var ppu = screenScale != null ? screenScale : 1;
|
|
17857
18026
|
for(var i = 0; i < this.v.length - 2; i += 2){
|
|
17858
|
-
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],
|
|
18027
|
+
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);
|
|
17859
18028
|
}
|
|
17860
18029
|
// draw last curve
|
|
17861
18030
|
var lastIndex = this.v.length - 1;
|
|
17862
|
-
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],
|
|
18031
|
+
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);
|
|
17863
18032
|
};
|
|
17864
18033
|
_proto.triangulate = function triangulate1(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
17865
18034
|
var triangles = triangulate([
|
|
@@ -18004,7 +18173,7 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
18004
18173
|
rectangle.copyFrom(this);
|
|
18005
18174
|
return rectangle;
|
|
18006
18175
|
};
|
|
18007
|
-
_proto.build = function build(points) {
|
|
18176
|
+
_proto.build = function build(points, screenScale) {
|
|
18008
18177
|
var ry;
|
|
18009
18178
|
var halfWidth = this.width / 2;
|
|
18010
18179
|
var halfHeight = this.height / 2;
|
|
@@ -18016,10 +18185,10 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
18016
18185
|
if (!(rx >= 0 && ry >= 0 && dx >= 0 && dy >= 0)) {
|
|
18017
18186
|
return;
|
|
18018
18187
|
}
|
|
18019
|
-
//
|
|
18020
|
-
|
|
18021
|
-
|
|
18022
|
-
var n =
|
|
18188
|
+
// n 个等分段逼近四分之一圆角弧,最大弦高误差 ε = R·π²/(8n²)
|
|
18189
|
+
// 屏幕误差 = ε × ppu,令 n = √(ppu·(rx+ry)),则误差 ≈ π²/8 ≈ 1.2px
|
|
18190
|
+
var ppu = screenScale != null ? screenScale : 1;
|
|
18191
|
+
var n = Math.ceil(Math.sqrt(ppu * (rx + ry)));
|
|
18023
18192
|
var m = n * 8 + (dx ? 4 : 0) + (dy ? 4 : 0);
|
|
18024
18193
|
if (m === 0) {
|
|
18025
18194
|
return;
|
|
@@ -18228,7 +18397,7 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
18228
18397
|
_proto.getY = function getY() {
|
|
18229
18398
|
return this.y;
|
|
18230
18399
|
};
|
|
18231
|
-
_proto.build = function build(points) {
|
|
18400
|
+
_proto.build = function build(points, screenScale) {
|
|
18232
18401
|
points[0] = this.x;
|
|
18233
18402
|
points[1] = this.y;
|
|
18234
18403
|
points[2] = this.x2;
|
|
@@ -18445,7 +18614,7 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
18445
18614
|
circle.copyFrom(this);
|
|
18446
18615
|
return circle;
|
|
18447
18616
|
};
|
|
18448
|
-
_proto.build = function build(points) {
|
|
18617
|
+
_proto.build = function build(points, screenScale) {
|
|
18449
18618
|
var x = this.x;
|
|
18450
18619
|
var y = this.y;
|
|
18451
18620
|
var dx = 0;
|
|
@@ -18455,8 +18624,10 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
18455
18624
|
if (rx <= 0) {
|
|
18456
18625
|
return;
|
|
18457
18626
|
}
|
|
18458
|
-
//
|
|
18459
|
-
|
|
18627
|
+
// n 个等分段逼近四分之一圆弧,最大弦高误差 ε = R·π²/(8n²)
|
|
18628
|
+
// 屏幕误差 = ε × ppu = ppu·R·π²/(8n²),令 n = √(ppu·(rx+ry)),则误差 ≈ π²/8 ≈ 1.2px
|
|
18629
|
+
var ppu = screenScale != null ? screenScale : 1;
|
|
18630
|
+
var n = Math.ceil(Math.sqrt(ppu * (rx + ry)));
|
|
18460
18631
|
var m = n * 8 + (0) + (0);
|
|
18461
18632
|
if (m === 0) {
|
|
18462
18633
|
return;
|
|
@@ -18566,7 +18737,7 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
18566
18737
|
switch(action){
|
|
18567
18738
|
case "bezierCurveTo":
|
|
18568
18739
|
{
|
|
18569
|
-
this.bezierCurveTo(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
|
|
18740
|
+
this.bezierCurveTo(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
|
|
18570
18741
|
break;
|
|
18571
18742
|
}
|
|
18572
18743
|
case "moveTo":
|
|
@@ -18625,10 +18796,10 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
18625
18796
|
* @param y - The y-coordinate of the end point.
|
|
18626
18797
|
* @param smoothness - Optional parameter to adjust the smoothness of the curve.
|
|
18627
18798
|
* @returns The instance of the current object for chaining.
|
|
18628
|
-
*/ _proto.bezierCurveTo = function bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness) {
|
|
18799
|
+
*/ _proto.bezierCurveTo = function bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness, scale) {
|
|
18629
18800
|
this.ensurePoly();
|
|
18630
18801
|
var currentPoly = this.currentPoly;
|
|
18631
|
-
buildAdaptiveBezier(currentPoly.points, currentPoly.lastX, currentPoly.lastY, cp1x, cp1y, cp2x, cp2y, x, y, smoothness);
|
|
18802
|
+
buildAdaptiveBezier(currentPoly.points, currentPoly.lastX, currentPoly.lastY, cp1x, cp1y, cp2x, cp2y, x, y, smoothness, scale);
|
|
18632
18803
|
return this;
|
|
18633
18804
|
};
|
|
18634
18805
|
_proto.moveTo = function moveTo(x, y) {
|
|
@@ -18793,7 +18964,7 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
18793
18964
|
* @param y - The y-coordinate of the end point.
|
|
18794
18965
|
* @param smoothness - Optional parameter to adjust the smoothness of the curve.
|
|
18795
18966
|
* @returns The instance of the current object for chaining.
|
|
18796
|
-
*/ _proto.bezierCurveTo = function bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness) {
|
|
18967
|
+
*/ _proto.bezierCurveTo = function bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness, scale) {
|
|
18797
18968
|
this.instructions.push({
|
|
18798
18969
|
action: "bezierCurveTo",
|
|
18799
18970
|
data: [
|
|
@@ -18803,7 +18974,8 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
18803
18974
|
cp2y,
|
|
18804
18975
|
x,
|
|
18805
18976
|
y,
|
|
18806
|
-
smoothness
|
|
18977
|
+
smoothness,
|
|
18978
|
+
scale
|
|
18807
18979
|
]
|
|
18808
18980
|
});
|
|
18809
18981
|
this.dirty = true;
|
|
@@ -19104,28 +19276,6 @@ var CompositionComponent = /*#__PURE__*/ function(Component) {
|
|
|
19104
19276
|
return item.dispose();
|
|
19105
19277
|
});
|
|
19106
19278
|
};
|
|
19107
|
-
_proto.hitTest = function hitTest(ray, x, y, regions, force, options) {
|
|
19108
|
-
var _this_item_composition;
|
|
19109
|
-
var isHitTestSuccess = hitTestRecursive(this.item, ray, x, y, regions, force, options);
|
|
19110
|
-
// 子元素碰撞测试成功加入当前预合成元素,判断是否是合成根元素,根元素不加入
|
|
19111
|
-
if (isHitTestSuccess && this.item !== ((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.rootItem)) {
|
|
19112
|
-
var item = this.item;
|
|
19113
|
-
var lastRegion = regions[regions.length - 1];
|
|
19114
|
-
var hitPositions = lastRegion.hitPositions;
|
|
19115
|
-
var region = {
|
|
19116
|
-
id: item.getInstanceId(),
|
|
19117
|
-
name: item.name,
|
|
19118
|
-
position: hitPositions[hitPositions.length - 1],
|
|
19119
|
-
parentId: item.parentId,
|
|
19120
|
-
hitPositions: hitPositions,
|
|
19121
|
-
behavior: InteractBehavior.NONE,
|
|
19122
|
-
item: item,
|
|
19123
|
-
composition: item.composition
|
|
19124
|
-
};
|
|
19125
|
-
regions.push(region);
|
|
19126
|
-
}
|
|
19127
|
-
return isHitTestSuccess;
|
|
19128
|
-
};
|
|
19129
19279
|
/**
|
|
19130
19280
|
* 设置当前合成子元素的渲染顺序
|
|
19131
19281
|
*
|
|
@@ -19235,98 +19385,6 @@ __decorate([
|
|
|
19235
19385
|
CompositionComponent = __decorate([
|
|
19236
19386
|
effectsClass("CompositionComponent")
|
|
19237
19387
|
], CompositionComponent);
|
|
19238
|
-
function hitTestRecursive(item, ray, x, y, regions, force, options) {
|
|
19239
|
-
var _loop = function() {
|
|
19240
|
-
var hitTestItem = _step.value;
|
|
19241
|
-
if (hitTestItem.isActive && hitTestItem.transform.getValid() && !skip(hitTestItem)) {
|
|
19242
|
-
var hitParams = hitTestItem.getHitTestParams(force);
|
|
19243
|
-
if (hitParams) {
|
|
19244
|
-
var success = false;
|
|
19245
|
-
var intersectPoint = new Vector3();
|
|
19246
|
-
if (hitParams.type === HitTestType.triangle) {
|
|
19247
|
-
var triangles = hitParams.triangles, backfaceCulling = hitParams.backfaceCulling;
|
|
19248
|
-
for(var j = 0; j < triangles.length; j++){
|
|
19249
|
-
var triangle = triangles[j];
|
|
19250
|
-
if (ray.intersectTriangle(triangle, intersectPoint, backfaceCulling)) {
|
|
19251
|
-
success = true;
|
|
19252
|
-
hitPositions.push(intersectPoint);
|
|
19253
|
-
break;
|
|
19254
|
-
}
|
|
19255
|
-
}
|
|
19256
|
-
} else if (hitParams.type === HitTestType.box) {
|
|
19257
|
-
var center = hitParams.center, size = hitParams.size;
|
|
19258
|
-
var boxMin = center.clone().addScaledVector(size, 0.5);
|
|
19259
|
-
var boxMax = center.clone().addScaledVector(size, -0.5);
|
|
19260
|
-
if (ray.intersectBox({
|
|
19261
|
-
min: boxMin,
|
|
19262
|
-
max: boxMax
|
|
19263
|
-
}, intersectPoint)) {
|
|
19264
|
-
success = true;
|
|
19265
|
-
hitPositions.push(intersectPoint);
|
|
19266
|
-
}
|
|
19267
|
-
} else if (hitParams.type === HitTestType.sphere) {
|
|
19268
|
-
var center1 = hitParams.center, radius = hitParams.radius;
|
|
19269
|
-
if (ray.intersectSphere({
|
|
19270
|
-
center: center1,
|
|
19271
|
-
radius: radius
|
|
19272
|
-
}, intersectPoint)) {
|
|
19273
|
-
success = true;
|
|
19274
|
-
hitPositions.push(intersectPoint);
|
|
19275
|
-
}
|
|
19276
|
-
} else if (hitParams.type === HitTestType.custom) {
|
|
19277
|
-
var tempPosition = hitParams.collect(ray, new Vector2(x, y));
|
|
19278
|
-
if (tempPosition && tempPosition.length > 0) {
|
|
19279
|
-
tempPosition.forEach(function(pos) {
|
|
19280
|
-
hitPositions.push(pos);
|
|
19281
|
-
});
|
|
19282
|
-
success = true;
|
|
19283
|
-
}
|
|
19284
|
-
}
|
|
19285
|
-
if (success) {
|
|
19286
|
-
var region = {
|
|
19287
|
-
id: hitTestItem.getInstanceId(),
|
|
19288
|
-
name: hitTestItem.name,
|
|
19289
|
-
position: hitPositions[hitPositions.length - 1],
|
|
19290
|
-
parentId: hitTestItem.parentId,
|
|
19291
|
-
hitPositions: hitPositions,
|
|
19292
|
-
behavior: hitParams.behavior,
|
|
19293
|
-
item: hitTestItem,
|
|
19294
|
-
composition: hitTestItem.composition
|
|
19295
|
-
};
|
|
19296
|
-
regions.push(region);
|
|
19297
|
-
hitTestSuccess = true;
|
|
19298
|
-
if (stop(region)) {
|
|
19299
|
-
return {
|
|
19300
|
-
v: true
|
|
19301
|
-
};
|
|
19302
|
-
}
|
|
19303
|
-
}
|
|
19304
|
-
}
|
|
19305
|
-
}
|
|
19306
|
-
if (VFXItem.isComposition(hitTestItem)) {
|
|
19307
|
-
if (hitTestItem.getComponent(CompositionComponent).hitTest(ray, x, y, regions, force, options)) {
|
|
19308
|
-
hitTestSuccess = true;
|
|
19309
|
-
}
|
|
19310
|
-
} else {
|
|
19311
|
-
if (hitTestRecursive(hitTestItem, ray, x, y, regions, force, options)) {
|
|
19312
|
-
hitTestSuccess = true;
|
|
19313
|
-
}
|
|
19314
|
-
}
|
|
19315
|
-
};
|
|
19316
|
-
var hitPositions = [];
|
|
19317
|
-
var stop = (options == null ? void 0 : options.stop) || noop;
|
|
19318
|
-
var skip = (options == null ? void 0 : options.skip) || noop;
|
|
19319
|
-
var maxCount = options == null ? void 0 : options.maxCount;
|
|
19320
|
-
if (maxCount !== undefined && regions.length >= maxCount) {
|
|
19321
|
-
return false;
|
|
19322
|
-
}
|
|
19323
|
-
var hitTestSuccess = false;
|
|
19324
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.children), _step; !(_step = _iterator()).done;){
|
|
19325
|
-
var _ret = _loop();
|
|
19326
|
-
if (_type_of(_ret) === "object") return _ret.v;
|
|
19327
|
-
}
|
|
19328
|
-
return hitTestSuccess;
|
|
19329
|
-
}
|
|
19330
19388
|
|
|
19331
19389
|
/**
|
|
19332
19390
|
* Mesh 组件
|
|
@@ -19343,7 +19401,8 @@ function hitTestRecursive(item, ray, x, y, regions, force, options) {
|
|
|
19343
19401
|
if (area) {
|
|
19344
19402
|
return {
|
|
19345
19403
|
type: area.type,
|
|
19346
|
-
triangles: area.area
|
|
19404
|
+
triangles: area.area,
|
|
19405
|
+
clipMasks: _this.frameClipMasks
|
|
19347
19406
|
};
|
|
19348
19407
|
}
|
|
19349
19408
|
};
|
|
@@ -21482,7 +21541,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
21482
21541
|
behavior: ((_this_interaction = _this.interaction) == null ? void 0 : _this_interaction.behavior) || 0,
|
|
21483
21542
|
type: area.type,
|
|
21484
21543
|
triangles: area.area,
|
|
21485
|
-
backfaceCulling: _this.renderer.side === SideMode.FRONT
|
|
21544
|
+
backfaceCulling: _this.renderer.side === SideMode.FRONT,
|
|
21545
|
+
clipMasks: _this.frameClipMasks
|
|
21486
21546
|
};
|
|
21487
21547
|
}
|
|
21488
21548
|
}
|
|
@@ -21781,7 +21841,8 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
21781
21841
|
behavior: 0,
|
|
21782
21842
|
type: area.type,
|
|
21783
21843
|
triangles: area.area,
|
|
21784
|
-
backfaceCulling: _this.rendererOptions.side === SideMode.FRONT
|
|
21844
|
+
backfaceCulling: _this.rendererOptions.side === SideMode.FRONT,
|
|
21845
|
+
clipMasks: _this.frameClipMasks
|
|
21785
21846
|
};
|
|
21786
21847
|
}
|
|
21787
21848
|
}
|
|
@@ -21884,8 +21945,9 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
21884
21945
|
};
|
|
21885
21946
|
_proto.onUpdate = function onUpdate(dt) {
|
|
21886
21947
|
if (this.shapeDirty) {
|
|
21887
|
-
this.
|
|
21888
|
-
this.
|
|
21948
|
+
var screenScale = this.computeScreenScale();
|
|
21949
|
+
this.buildPath(this.shapeAttributes, screenScale);
|
|
21950
|
+
this.buildGeometryFromPath(this.graphicsPath.shapePath, screenScale);
|
|
21889
21951
|
this.shapeDirty = false;
|
|
21890
21952
|
}
|
|
21891
21953
|
if (this.materialDirty) {
|
|
@@ -21936,7 +21998,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
21936
21998
|
}
|
|
21937
21999
|
return this.boundingBoxInfo;
|
|
21938
22000
|
};
|
|
21939
|
-
_proto.buildGeometryFromPath = function buildGeometryFromPath(shapePath) {
|
|
22001
|
+
_proto.buildGeometryFromPath = function buildGeometryFromPath(shapePath, screenScale) {
|
|
21940
22002
|
var shapePrimitives = shapePath.shapePrimitives;
|
|
21941
22003
|
var vertices = [];
|
|
21942
22004
|
var indices = [];
|
|
@@ -21948,7 +22010,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
21948
22010
|
var points = [];
|
|
21949
22011
|
var indexOffset = indices.length;
|
|
21950
22012
|
var vertOffset = vertices.length / 2;
|
|
21951
|
-
shape.build(points);
|
|
22013
|
+
shape.build(points, screenScale);
|
|
21952
22014
|
shape.triangulate(points, vertices, vertOffset, indices, indexOffset);
|
|
21953
22015
|
}
|
|
21954
22016
|
}
|
|
@@ -21968,7 +22030,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
21968
22030
|
if (this.shapeAttributes.type === ShapePrimitiveType.Custom) {
|
|
21969
22031
|
close = shape1.closePath;
|
|
21970
22032
|
}
|
|
21971
|
-
shape1.build(points1);
|
|
22033
|
+
shape1.build(points1, screenScale);
|
|
21972
22034
|
buildLine(points1, lineStyle, false, close, vertices, 2, vertOffset1, indices);
|
|
21973
22035
|
}
|
|
21974
22036
|
}
|
|
@@ -22028,8 +22090,40 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
22028
22090
|
strokeSubMesh.offset = fillIndexCount * u16Size;
|
|
22029
22091
|
strokeSubMesh.indexCount = strokeIndexCount;
|
|
22030
22092
|
};
|
|
22031
|
-
_proto.
|
|
22093
|
+
_proto.computeScreenScale = function computeScreenScale() {
|
|
22094
|
+
var defaultPpu = 1;
|
|
22095
|
+
var composition = this.item.composition;
|
|
22096
|
+
if (!composition) {
|
|
22097
|
+
return defaultPpu;
|
|
22098
|
+
}
|
|
22099
|
+
var camera = composition.camera;
|
|
22100
|
+
if (!camera) {
|
|
22101
|
+
return defaultPpu;
|
|
22102
|
+
}
|
|
22103
|
+
var mvp = camera.getModelViewProjection(ShapeComponent.tempMVP, this.transform.getWorldMatrix());
|
|
22104
|
+
var e = mvp.elements;
|
|
22105
|
+
// 列优先:col0=[e[0],e[1]], col1=[e[4],e[5]]
|
|
22106
|
+
// 透视投影下 MVP 不含 w-divide,cols 0-1 的长度是 clip-space 缩放
|
|
22107
|
+
// 需要除以物体中心的 w 值才能得到 NDC 缩放
|
|
22108
|
+
// 物体局部原点 [0,0,0,1] 经 MVP 后 w = e[15](≈ 物体到相机距离)
|
|
22109
|
+
var w = Math.abs(e[15]) || 1;
|
|
22110
|
+
var sx = Math.sqrt(e[0] * e[0] + e[1] * e[1]) / w;
|
|
22111
|
+
var sy = Math.sqrt(e[4] * e[4] + e[5] * e[5]) / w;
|
|
22112
|
+
var maxNdcScale = Math.max(sx, sy);
|
|
22113
|
+
// NDC -> 像素: canvasSize / 2
|
|
22114
|
+
var canvasRect = this.engine.canvas.getBoundingClientRect();
|
|
22115
|
+
var ndcToPixels = Math.max(canvasRect.width, canvasRect.height) / 2;
|
|
22116
|
+
// pixelsPerUnit: 1个局部空间单位在屏幕上对应多少像素
|
|
22117
|
+
// 椭圆/圆/矩形中使用 n = ceil(√(ppu × (rx+ry))) 确保圆弧误差 ≈ 1.2px
|
|
22118
|
+
var pixelsPerUnit = maxNdcScale * ndcToPixels * this.engine.pixelRatio;
|
|
22119
|
+
var minPpu = 1;
|
|
22120
|
+
var maxPpu = 2000;
|
|
22121
|
+
return Math.max(minPpu, Math.min(maxPpu, pixelsPerUnit));
|
|
22122
|
+
};
|
|
22123
|
+
_proto.buildPath = function buildPath(shapeAttribute, screenScale) {
|
|
22124
|
+
if (screenScale === void 0) screenScale = 1;
|
|
22032
22125
|
this.graphicsPath.clear();
|
|
22126
|
+
var ppu = screenScale;
|
|
22033
22127
|
switch(shapeAttribute.type){
|
|
22034
22128
|
case ShapePrimitiveType.Custom:
|
|
22035
22129
|
{
|
|
@@ -22049,7 +22143,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
22049
22143
|
var lastPoint = points[lastPointIndex.point];
|
|
22050
22144
|
var control1 = easingOuts[lastPointIndex.easingOut];
|
|
22051
22145
|
var control2 = easingIns[pointIndex.easingIn];
|
|
22052
|
-
this.graphicsPath.bezierCurveTo(control1.x + lastPoint.x, control1.y + lastPoint.y, control2.x + point.x, control2.y + point.y, point.x, point.y,
|
|
22146
|
+
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);
|
|
22053
22147
|
}
|
|
22054
22148
|
if (shape.close) {
|
|
22055
22149
|
var pointIndex1 = indices[0];
|
|
@@ -22058,7 +22152,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
22058
22152
|
var lastPoint1 = points[lastPointIndex1.point];
|
|
22059
22153
|
var control11 = easingOuts[lastPointIndex1.easingOut];
|
|
22060
22154
|
var control21 = easingIns[pointIndex1.easingIn];
|
|
22061
|
-
this.graphicsPath.bezierCurveTo(control11.x + lastPoint1.x, control11.y + lastPoint1.y, control21.x + point1.x, control21.y + point1.y, point1.x, point1.y,
|
|
22155
|
+
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);
|
|
22062
22156
|
this.graphicsPath.closePath();
|
|
22063
22157
|
}
|
|
22064
22158
|
}
|
|
@@ -22353,6 +22447,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
22353
22447
|
]);
|
|
22354
22448
|
return ShapeComponent;
|
|
22355
22449
|
}(RendererComponent);
|
|
22450
|
+
ShapeComponent.tempMVP = Matrix4.fromIdentity();
|
|
22356
22451
|
ShapeComponent = __decorate([
|
|
22357
22452
|
effectsClass("ShapeComponent")
|
|
22358
22453
|
], ShapeComponent);
|
|
@@ -22499,7 +22594,8 @@ var FrameComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
22499
22594
|
if (area) {
|
|
22500
22595
|
return {
|
|
22501
22596
|
type: area.type,
|
|
22502
|
-
triangles: area.area
|
|
22597
|
+
triangles: area.area,
|
|
22598
|
+
clipMasks: _this.frameClipMasks
|
|
22503
22599
|
};
|
|
22504
22600
|
}
|
|
22505
22601
|
}
|
|
@@ -22612,7 +22708,7 @@ var FrameComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
22612
22708
|
var child = _step.value;
|
|
22613
22709
|
var childFrameComponent = child.getComponent(RendererComponent);
|
|
22614
22710
|
if (childFrameComponent) {
|
|
22615
|
-
childFrameComponent.frameClipMasks
|
|
22711
|
+
addItem(childFrameComponent.frameClipMasks, this);
|
|
22616
22712
|
}
|
|
22617
22713
|
this.setClipRectangleRecursive(child);
|
|
22618
22714
|
}
|
|
@@ -23149,7 +23245,8 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
23149
23245
|
return {
|
|
23150
23246
|
type: area.type,
|
|
23151
23247
|
triangles: area.area,
|
|
23152
|
-
behavior: behavior
|
|
23248
|
+
behavior: behavior,
|
|
23249
|
+
clipMasks: _this.frameClipMasks
|
|
23153
23250
|
};
|
|
23154
23251
|
}
|
|
23155
23252
|
};
|
|
@@ -27553,6 +27650,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
27553
27650
|
if (force || interactParams) {
|
|
27554
27651
|
return {
|
|
27555
27652
|
type: HitTestType.custom,
|
|
27653
|
+
clipMasks: _this.renderer.frameClipMasks,
|
|
27556
27654
|
collect: function(ray) {
|
|
27557
27655
|
return _this.raycast({
|
|
27558
27656
|
radius: (interactParams == null ? void 0 : interactParams.radius) || 0.4,
|
|
@@ -29288,13 +29386,14 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
29288
29386
|
}
|
|
29289
29387
|
var _proto = TextLayout.prototype;
|
|
29290
29388
|
_proto.update = function update(options) {
|
|
29291
|
-
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;
|
|
29389
|
+
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;
|
|
29292
29390
|
this.letterSpace = letterSpace;
|
|
29293
29391
|
this.overflow = textOverflow;
|
|
29294
29392
|
this.textVerticalAlign = textVerticalAlign;
|
|
29295
29393
|
this.textAlign = textAlign;
|
|
29296
29394
|
this.width = textWidth;
|
|
29297
29395
|
this.height = textHeight;
|
|
29396
|
+
this.autoResize = autoResize;
|
|
29298
29397
|
this.lineHeight = lineHeight;
|
|
29299
29398
|
};
|
|
29300
29399
|
/**
|
|
@@ -29306,7 +29405,6 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
29306
29405
|
* @param totalLineHeight - 可选的实际总行高,用于替代默认计算
|
|
29307
29406
|
* @returns - 行高偏移值
|
|
29308
29407
|
*/ _proto.getOffsetY = function getOffsetY(style, lineCount, lineHeight, fontSize, totalLineHeight) {
|
|
29309
|
-
var fontScale = style.fontScale;
|
|
29310
29408
|
// /3 计算Y轴偏移量,以匹配编辑器行为
|
|
29311
29409
|
var offsetY = (lineHeight - fontSize) / 3;
|
|
29312
29410
|
// 计算基础偏移量
|
|
@@ -29318,10 +29416,10 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
29318
29416
|
offsetResult = baseOffset + offsetY;
|
|
29319
29417
|
break;
|
|
29320
29418
|
case TextVerticalAlign.middle:
|
|
29321
|
-
offsetResult = (this.height
|
|
29419
|
+
offsetResult = (this.height - commonCalculation + baseOffset) / 2;
|
|
29322
29420
|
break;
|
|
29323
29421
|
case TextVerticalAlign.bottom:
|
|
29324
|
-
offsetResult = this.height
|
|
29422
|
+
offsetResult = this.height - commonCalculation - offsetY;
|
|
29325
29423
|
break;
|
|
29326
29424
|
}
|
|
29327
29425
|
return offsetResult;
|
|
@@ -29338,10 +29436,10 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
29338
29436
|
offsetX = 0;
|
|
29339
29437
|
break;
|
|
29340
29438
|
case TextAlignment.middle:
|
|
29341
|
-
offsetX = (this.width
|
|
29439
|
+
offsetX = (this.width - maxWidth) / 2;
|
|
29342
29440
|
break;
|
|
29343
29441
|
case TextAlignment.right:
|
|
29344
|
-
offsetX = this.width
|
|
29442
|
+
offsetX = this.width - maxWidth;
|
|
29345
29443
|
break;
|
|
29346
29444
|
}
|
|
29347
29445
|
return offsetX;
|
|
@@ -29594,8 +29692,8 @@ var TextStyle = /*#__PURE__*/ function() {
|
|
|
29594
29692
|
};
|
|
29595
29693
|
// 通用工具方法
|
|
29596
29694
|
_proto.getFontDesc = function getFontDesc(size) {
|
|
29597
|
-
var _this_textStyle = this.textStyle, fontSize = _this_textStyle.fontSize,
|
|
29598
|
-
var fontDesc = "" + (size || fontSize
|
|
29695
|
+
var _this_textStyle = this.textStyle, fontSize = _this_textStyle.fontSize, fontFamily = _this_textStyle.fontFamily, textWeight = _this_textStyle.textWeight, fontStyle = _this_textStyle.fontStyle;
|
|
29696
|
+
var fontDesc = "" + (size || fontSize).toString() + "px ";
|
|
29599
29697
|
if (![
|
|
29600
29698
|
"serif",
|
|
29601
29699
|
"sans-serif",
|
|
@@ -29625,13 +29723,13 @@ var TextStyle = /*#__PURE__*/ function() {
|
|
|
29625
29723
|
};
|
|
29626
29724
|
_proto.setupShadow = function setupShadow() {
|
|
29627
29725
|
var context = this.context;
|
|
29628
|
-
var _this_textStyle = this.textStyle, shadowColor = _this_textStyle.shadowColor, shadowBlur = _this_textStyle.shadowBlur, shadowOffsetX = _this_textStyle.shadowOffsetX, shadowOffsetY = _this_textStyle.shadowOffsetY;
|
|
29726
|
+
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;
|
|
29629
29727
|
var r = shadowColor[0], g = shadowColor[1], b = shadowColor[2], a = shadowColor[3];
|
|
29630
29728
|
if (context) {
|
|
29631
29729
|
context.shadowColor = "rgba(" + r * 255 + ", " + g * 255 + ", " + b * 255 + ", " + a + ")";
|
|
29632
|
-
context.shadowBlur = shadowBlur;
|
|
29633
|
-
context.shadowOffsetX = shadowOffsetX;
|
|
29634
|
-
context.shadowOffsetY = -shadowOffsetY;
|
|
29730
|
+
context.shadowBlur = shadowBlur * fontScale;
|
|
29731
|
+
context.shadowOffsetX = shadowOffsetX * fontScale;
|
|
29732
|
+
context.shadowOffsetY = -shadowOffsetY * fontScale;
|
|
29635
29733
|
}
|
|
29636
29734
|
};
|
|
29637
29735
|
// 通用纹理生命周期管理
|
|
@@ -29876,30 +29974,40 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29876
29974
|
layout.width = this.getTextWidth();
|
|
29877
29975
|
this.lineCount = this.getLineCount(this.text);
|
|
29878
29976
|
layout.height = layout.lineHeight * this.lineCount;
|
|
29977
|
+
} else if (layout.autoResize === TextSizeMode.autoHeight) {
|
|
29978
|
+
this.lineCount = this.getLineCount(this.text);
|
|
29979
|
+
layout.height = layout.lineHeight * this.lineCount;
|
|
29879
29980
|
} else {
|
|
29880
29981
|
this.lineCount = this.getLineCount(this.text);
|
|
29881
29982
|
}
|
|
29882
|
-
var baseWidth =
|
|
29883
|
-
var baseHeight = layout.height
|
|
29884
|
-
var fontSize = style.fontSize
|
|
29885
|
-
var lineHeight = layout.lineHeight
|
|
29983
|
+
var baseWidth = layout.width + style.fontOffset;
|
|
29984
|
+
var baseHeight = layout.height;
|
|
29985
|
+
var fontSize = style.fontSize;
|
|
29986
|
+
var lineHeight = layout.lineHeight;
|
|
29886
29987
|
style.fontDesc = this.getFontDesc(fontSize);
|
|
29887
29988
|
// 使用 Array.from 正确分割 Unicode 字符(包括 emoji)
|
|
29888
29989
|
var char = Array.from(this.text || "");
|
|
29889
29990
|
var _this_getEffectPadding = this.getEffectPadding(), padL = _this_getEffectPadding.padL, padR = _this_getEffectPadding.padR, padT = _this_getEffectPadding.padT, padB = _this_getEffectPadding.padB;
|
|
29890
29991
|
var hasEffect = (padL | padR | padT | padB) !== 0;
|
|
29891
|
-
|
|
29892
|
-
var
|
|
29992
|
+
// 限制 fontScale,确保纹理尺寸不超过 maxTextureSize / 2
|
|
29993
|
+
var maxTexSize = this.engine.gpuCapability.detail.maxTextureSize / 2;
|
|
29994
|
+
var logicalWidth = hasEffect ? baseWidth + padL + padR : baseWidth;
|
|
29995
|
+
var logicalHeight = hasEffect ? baseHeight + padT + padB : baseHeight;
|
|
29996
|
+
var maxLogical = Math.max(logicalWidth, logicalHeight, 1);
|
|
29997
|
+
fontScale = Math.min(fontScale, maxTexSize / maxLogical);
|
|
29998
|
+
var texWidth = Math.ceil(logicalWidth * fontScale);
|
|
29999
|
+
var texHeight = Math.ceil(logicalHeight * fontScale);
|
|
29893
30000
|
var shiftX = hasEffect ? padL : 0;
|
|
29894
30001
|
var shiftY = hasEffect ? flipY ? padT : padB : 0;
|
|
29895
30002
|
// 给渲染层用:扩容比例
|
|
29896
|
-
this.effectScaleX = baseWidth > 0 ? texWidth / baseWidth : 1;
|
|
29897
|
-
this.effectScaleY = baseHeight > 0 ? texHeight / baseHeight : 1;
|
|
30003
|
+
this.effectScaleX = baseWidth > 0 ? texWidth / (baseWidth * fontScale) : 1;
|
|
30004
|
+
this.effectScaleY = baseHeight > 0 ? texHeight / (baseHeight * fontScale) : 1;
|
|
29898
30005
|
// 默认 camera 下的 world per pixel
|
|
29899
30006
|
var scaleFactor = 0.11092565;
|
|
29900
30007
|
var scaleFactor2 = scaleFactor * scaleFactor;
|
|
29901
|
-
this.transform.setSize(baseWidth * scaleFactor2
|
|
30008
|
+
this.transform.setSize(baseWidth * scaleFactor2, baseHeight * scaleFactor2);
|
|
29902
30009
|
this.renderToTexture(texWidth, texHeight, flipY, function(context) {
|
|
30010
|
+
context.scale(fontScale, fontScale);
|
|
29903
30011
|
// canvas size 变化后重新刷新 context
|
|
29904
30012
|
if (_this.maxLineWidth > baseWidth && layout.overflow === TextOverflow.display) {
|
|
29905
30013
|
context.font = _this.getFontDesc(fontSize * baseWidth / _this.maxLineWidth);
|
|
@@ -29920,7 +30028,7 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29920
30028
|
// 和浏览器行为保持一致
|
|
29921
30029
|
// 字符间距只应用在字符之间,每行第一个字符不加间距
|
|
29922
30030
|
if (charsArray.length > 0) {
|
|
29923
|
-
x += layout.letterSpace
|
|
30031
|
+
x += layout.letterSpace;
|
|
29924
30032
|
}
|
|
29925
30033
|
if (x + textMetrics.width > baseWidth && i > 0 || str === "\n") {
|
|
29926
30034
|
charsInfo.push({
|
|
@@ -30005,9 +30113,9 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30005
30113
|
*/ _proto.getEffectPadding = function getEffectPadding() {
|
|
30006
30114
|
var style = this.textStyle;
|
|
30007
30115
|
var hasDrawOutline = style.isOutlined && style.outlineWidth > 0;
|
|
30008
|
-
var outlinePad = hasDrawOutline ? Math.ceil(style.outlineWidth * 2
|
|
30116
|
+
var outlinePad = hasDrawOutline ? Math.ceil(style.outlineWidth * 2) : 0;
|
|
30009
30117
|
var hasShadow = style.hasShadow && (style.shadowBlur > 0 || style.shadowOffsetX !== 0 || style.shadowOffsetY !== 0);
|
|
30010
|
-
var shadowPad = hasShadow ? Math.ceil(
|
|
30118
|
+
var shadowPad = hasShadow ? Math.ceil(Math.abs(style.shadowOffsetX) + Math.abs(style.shadowOffsetY) + style.shadowBlur) : 0;
|
|
30011
30119
|
var pad = outlinePad + shadowPad;
|
|
30012
30120
|
return {
|
|
30013
30121
|
padL: pad,
|
|
@@ -30032,11 +30140,13 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30032
30140
|
var width = Math.max(0, Number(value) || 0);
|
|
30033
30141
|
var layout = this.textLayout;
|
|
30034
30142
|
// 宽度没变且已是非 autoWidth 模式,直接返回
|
|
30035
|
-
if (layout.width === width
|
|
30143
|
+
if (layout.width === width) {
|
|
30036
30144
|
return;
|
|
30037
30145
|
}
|
|
30038
30146
|
// 手动设置宽度时关闭 autoWidth
|
|
30039
|
-
layout.autoResize
|
|
30147
|
+
if (layout.autoResize === TextSizeMode.autoWidth) {
|
|
30148
|
+
layout.autoResize = TextSizeMode.autoHeight;
|
|
30149
|
+
}
|
|
30040
30150
|
layout.width = width;
|
|
30041
30151
|
// 按当前 overflow 模式重新计算 maxLineWidth
|
|
30042
30152
|
this.isDirty = true;
|
|
@@ -30149,7 +30259,7 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30149
30259
|
*
|
|
30150
30260
|
* 说明:
|
|
30151
30261
|
* - 使用 Canvas 2D 的 measureText,并按当前实现的逐字符排版规则累加宽度(与 updateTexture 保持一致)。
|
|
30152
|
-
* - 结果为"逻辑宽度"
|
|
30262
|
+
* - 结果为"逻辑宽度"(扣除 fontOffset),可直接写回 options.textWidth。,可直接写回 options.textWidth。
|
|
30153
30263
|
* - 通过 padding 追加少量冗余像素,用于降低边缘裁切风险。
|
|
30154
30264
|
*
|
|
30155
30265
|
* @returns 文本宽度(>= 0)
|
|
@@ -30164,10 +30274,8 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30164
30274
|
var text = ((_this_text = this.text) != null ? _this_text : "").toString();
|
|
30165
30275
|
var layout = this.textLayout;
|
|
30166
30276
|
var style = this.textStyle;
|
|
30167
|
-
|
|
30168
|
-
|
|
30169
|
-
// 与 updateTexture 一致:用 render 字号测量
|
|
30170
|
-
ctx.font = this.getFontDesc(renderFontSize);
|
|
30277
|
+
// 与 updateTexture 一致:用逻辑字号测量
|
|
30278
|
+
ctx.font = this.getFontDesc(style.fontSize);
|
|
30171
30279
|
var maxLineWidthRender = 0;
|
|
30172
30280
|
var x = 0;
|
|
30173
30281
|
for(var i = 0; i < text.length; i++){
|
|
@@ -30177,17 +30285,14 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
30177
30285
|
x = 0;
|
|
30178
30286
|
continue;
|
|
30179
30287
|
}
|
|
30180
|
-
// 与 updateTexture 一致:每个字符前加一次 letterSpace
|
|
30181
|
-
x +=
|
|
30288
|
+
// 与 updateTexture 一致:每个字符前加一次 letterSpace
|
|
30289
|
+
x += layout.letterSpace || 0;
|
|
30182
30290
|
x += ctx.measureText(ch).width;
|
|
30183
30291
|
}
|
|
30184
30292
|
maxLineWidthRender = Math.max(maxLineWidthRender, x);
|
|
30185
|
-
// render -> 逻辑宽度
|
|
30186
|
-
var logicalMax = maxLineWidthRender / fontScale;
|
|
30187
|
-
// 反推 layout.width:renderWidth = (layout.width + fontOffset) * fontScale
|
|
30188
30293
|
var padding = 2;
|
|
30189
30294
|
var EPS = 1e-4;
|
|
30190
|
-
var w = Math.ceil(
|
|
30295
|
+
var w = Math.ceil(maxLineWidthRender - (style.fontOffset || 0) - EPS) + padding;
|
|
30191
30296
|
return Math.max(0, w);
|
|
30192
30297
|
};
|
|
30193
30298
|
_proto.getDefaultProps = function getDefaultProps() {
|
|
@@ -30299,9 +30404,9 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
30299
30404
|
}
|
|
30300
30405
|
}
|
|
30301
30406
|
// TODO 待移除 tagggedProperties 为没有装饰器的临时方案
|
|
30302
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(effectsObject.
|
|
30407
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(effectsObject.definition)), _step1; !(_step1 = _iterator1()).done;){
|
|
30303
30408
|
var key1 = _step1.value;
|
|
30304
|
-
var value1 = effectsObject.
|
|
30409
|
+
var value1 = effectsObject.definition[key1];
|
|
30305
30410
|
if (typeof value1 === "number" || typeof value1 === "string" || typeof value1 === "boolean" || SerializationHelper.checkTypedArray(value1)) {
|
|
30306
30411
|
// TODO json 数据避免传 typedArray
|
|
30307
30412
|
serializedData[key1] = value1;
|
|
@@ -30325,7 +30430,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
30325
30430
|
return serializedData;
|
|
30326
30431
|
};
|
|
30327
30432
|
SerializationHelper.deserialize = function deserialize(serializedData, effectsObject) {
|
|
30328
|
-
effectsObject.
|
|
30433
|
+
effectsObject.definition = serializedData;
|
|
30329
30434
|
var serializedProperties = getMergedStore(effectsObject);
|
|
30330
30435
|
var engine = effectsObject.engine;
|
|
30331
30436
|
if (serializedProperties) {
|
|
@@ -30340,7 +30445,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
30340
30445
|
effectsObject[key] = SerializationHelper.deserializeProperty(value, engine, 0, propertyType);
|
|
30341
30446
|
}
|
|
30342
30447
|
}
|
|
30343
|
-
effectsObject.fromData(effectsObject.
|
|
30448
|
+
effectsObject.fromData(effectsObject.definition);
|
|
30344
30449
|
};
|
|
30345
30450
|
SerializationHelper.checkTypedArray = function checkTypedArray(obj) {
|
|
30346
30451
|
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);
|
|
@@ -30471,7 +30576,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
30471
30576
|
var effectsObjectData = this.findData(guid);
|
|
30472
30577
|
var effectsObject;
|
|
30473
30578
|
if (!effectsObjectData) {
|
|
30474
|
-
console.
|
|
30579
|
+
console.warn("Object data with uuid: " + guid + " not found.");
|
|
30475
30580
|
return undefined;
|
|
30476
30581
|
}
|
|
30477
30582
|
switch(effectsObjectData.dataType){
|
|
@@ -30493,7 +30598,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
30493
30598
|
}
|
|
30494
30599
|
}
|
|
30495
30600
|
if (!effectsObject) {
|
|
30496
|
-
console.
|
|
30601
|
+
console.warn("Constructor for DataType: " + effectsObjectData.dataType + " not found.");
|
|
30497
30602
|
return undefined;
|
|
30498
30603
|
}
|
|
30499
30604
|
effectsObject.setInstanceId(effectsObjectData.id);
|
|
@@ -32335,7 +32440,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
32335
32440
|
return ret;
|
|
32336
32441
|
}
|
|
32337
32442
|
|
|
32338
|
-
var version$1 = "2.9.0-alpha.
|
|
32443
|
+
var version$1 = "2.9.0-alpha.2";
|
|
32339
32444
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
32340
32445
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
32341
32446
|
var reverseParticle = false;
|
|
@@ -34654,7 +34759,9 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
34654
34759
|
}
|
|
34655
34760
|
var regions = [];
|
|
34656
34761
|
var ray = this.getHitTestRay(x, y);
|
|
34657
|
-
|
|
34762
|
+
// 所有命中的元素共享同一个 hitPositions 数组,保持与原有行为一致
|
|
34763
|
+
var hitPositions = [];
|
|
34764
|
+
this.rootItem.hitTest(ray, x, y, regions, hitPositions, force, options);
|
|
34658
34765
|
return regions;
|
|
34659
34766
|
};
|
|
34660
34767
|
/**
|
|
@@ -37222,10 +37329,6 @@ var PassTextureCache = /*#__PURE__*/ function() {
|
|
|
37222
37329
|
height: renderer.getHeight(),
|
|
37223
37330
|
event: engine.eventSystem
|
|
37224
37331
|
}), scene);
|
|
37225
|
-
// 中低端设备降帧到 30fps·
|
|
37226
|
-
if (engine.ticker && options.renderLevel === RenderLevel.B) {
|
|
37227
|
-
engine.ticker.setFPS(Math.min(engine.ticker.getFPS(), 30));
|
|
37228
|
-
}
|
|
37229
37332
|
// TODO 目前编辑器会每帧调用 loadScene, 在这编译会导致闪帧,待编辑器渲染逻辑优化后移除。
|
|
37230
37333
|
if (engine.env !== PLAYER_OPTIONS_ENV_EDITOR) {
|
|
37231
37334
|
engine.assetService.createShaderVariant();
|
|
@@ -37290,7 +37393,7 @@ registerPlugin("text", TextLoader);
|
|
|
37290
37393
|
registerPlugin("sprite", SpriteLoader);
|
|
37291
37394
|
registerPlugin("particle", ParticleLoader);
|
|
37292
37395
|
registerPlugin("interact", InteractLoader);
|
|
37293
|
-
var version = "2.9.0-alpha.
|
|
37396
|
+
var version = "2.9.0-alpha.2";
|
|
37294
37397
|
logger.info("Core version: " + version + ".");
|
|
37295
37398
|
|
|
37296
37399
|
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, 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, TangentMode, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TexturePaintScaleMode, TextureSourceType, TextureStoreAction, 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, sortByOrder, index$1 as spec, textureLoaderRegistry, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|