@galacean/effects-core 2.7.0-alpha.2 → 2.7.0
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/camera.d.ts +30 -0
- package/dist/components/shape-component.d.ts +4 -3
- package/dist/composition.d.ts +2 -5
- package/dist/effects-object.d.ts +1 -1
- package/dist/engine.d.ts +1 -1
- package/dist/index.js +384 -224
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +384 -224
- package/dist/index.mjs.map +1 -1
- package/dist/material/material.d.ts +0 -4
- package/dist/plugin-system.d.ts +3 -2
- package/dist/plugins/animation-graph/pose.d.ts +1 -1
- package/dist/plugins/animation-graph/skeleton.d.ts +1 -1
- package/dist/plugins/interact/interact-item.d.ts +25 -0
- package/dist/plugins/interact/interact-mesh.d.ts +1 -2
- package/dist/plugins/sprite/sprite-item.d.ts +1 -1
- package/dist/plugins/text/text-item.d.ts +2 -0
- package/dist/plugins/text/text-layout.d.ts +12 -0
- package/dist/render/index.d.ts +0 -1
- package/dist/render/render-frame.d.ts +0 -8
- package/dist/texture/texture.d.ts +0 -4
- package/dist/vfx-item.d.ts +7 -20
- package/package.json +2 -2
- package/dist/render/types.d.ts +0 -5
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.7.0
|
|
6
|
+
* Version: v2.7.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -3658,15 +3658,30 @@ var MaterialBlending;
|
|
|
3658
3658
|
var TextOverflow;
|
|
3659
3659
|
(function(TextOverflow) {
|
|
3660
3660
|
/**
|
|
3661
|
-
*
|
|
3662
|
-
*/ TextOverflow[TextOverflow["
|
|
3661
|
+
* visible 模式下,文本内容超出边界框时,会继续显示内容,不进行裁剪或缩放。
|
|
3662
|
+
*/ TextOverflow[TextOverflow["visible"] = 0] = "visible";
|
|
3663
|
+
/**
|
|
3664
|
+
* display 模式下,会显示所有文本,文本字号大小会根据边界框调整。
|
|
3665
|
+
*/ TextOverflow[TextOverflow["display"] = 1] = "display";
|
|
3663
3666
|
/**
|
|
3664
3667
|
* clip 模式下,当文本内容超出边界框时,多余的会被截断。
|
|
3665
|
-
*/ TextOverflow[TextOverflow["clip"] =
|
|
3668
|
+
*/ TextOverflow[TextOverflow["clip"] = 2] = "clip";
|
|
3666
3669
|
/**
|
|
3667
3670
|
* ellipsis 模式下,会使用(...)来代替超出边界框的内容。
|
|
3668
|
-
*/ TextOverflow[TextOverflow["ellipsis"] =
|
|
3671
|
+
*/ TextOverflow[TextOverflow["ellipsis"] = 3] = "ellipsis";
|
|
3669
3672
|
})(TextOverflow || (TextOverflow = {}));
|
|
3673
|
+
var TextSizeMode;
|
|
3674
|
+
(function(TextSizeMode) {
|
|
3675
|
+
/**
|
|
3676
|
+
* 自适应宽度
|
|
3677
|
+
*/ TextSizeMode[TextSizeMode["autoWidth"] = 0] = "autoWidth";
|
|
3678
|
+
/**
|
|
3679
|
+
* 自适应高度
|
|
3680
|
+
*/ TextSizeMode[TextSizeMode["autoHeight"] = 1] = "autoHeight";
|
|
3681
|
+
/**
|
|
3682
|
+
* 固定宽高
|
|
3683
|
+
*/ TextSizeMode[TextSizeMode["fixed"] = 2] = "fixed";
|
|
3684
|
+
})(TextSizeMode || (TextSizeMode = {}));
|
|
3670
3685
|
var TextBaseline;
|
|
3671
3686
|
(function(TextBaseline) {
|
|
3672
3687
|
/**
|
|
@@ -4008,6 +4023,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
4008
4023
|
get MaterialBlending () { return MaterialBlending; },
|
|
4009
4024
|
get RenderMode3D () { return RenderMode3D; },
|
|
4010
4025
|
get TextOverflow () { return TextOverflow; },
|
|
4026
|
+
get TextSizeMode () { return TextSizeMode; },
|
|
4011
4027
|
get TextBaseline () { return TextBaseline; },
|
|
4012
4028
|
get TextAlignment () { return TextAlignment; },
|
|
4013
4029
|
get TextWeight () { return TextWeight; },
|
|
@@ -4122,10 +4138,16 @@ function getDirectStore(target) {
|
|
|
4122
4138
|
* 反序列化函数
|
|
4123
4139
|
*
|
|
4124
4140
|
* @param data - 对象的序列化的数据
|
|
4125
|
-
*/ _proto.fromData = function fromData(data) {
|
|
4141
|
+
*/ _proto.fromData = function fromData(data) {
|
|
4142
|
+
if (data.id !== undefined) {
|
|
4143
|
+
this.setInstanceId(data.id);
|
|
4144
|
+
}
|
|
4145
|
+
};
|
|
4126
4146
|
/**
|
|
4127
|
-
*
|
|
4128
|
-
*/ _proto.dispose = function dispose() {
|
|
4147
|
+
* 销毁当前对象
|
|
4148
|
+
*/ _proto.dispose = function dispose() {
|
|
4149
|
+
this.engine.removeInstance(this.guid);
|
|
4150
|
+
};
|
|
4129
4151
|
/**
|
|
4130
4152
|
*
|
|
4131
4153
|
* @param obj
|
|
@@ -5219,7 +5241,7 @@ var Pose = /*#__PURE__*/ function() {
|
|
|
5219
5241
|
}
|
|
5220
5242
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(skeleton.defaultColorPropertyValues), _step2; !(_step2 = _iterator2()).done;){
|
|
5221
5243
|
var defaultColor = _step2.value;
|
|
5222
|
-
this.colorPropertyValues.push(defaultColor);
|
|
5244
|
+
this.colorPropertyValues.push(new Color().copyFrom(defaultColor));
|
|
5223
5245
|
}
|
|
5224
5246
|
}
|
|
5225
5247
|
var _proto = Pose.prototype;
|
|
@@ -6694,7 +6716,7 @@ var Skeleton = /*#__PURE__*/ function() {
|
|
|
6694
6716
|
break;
|
|
6695
6717
|
case 1:
|
|
6696
6718
|
this.colorAnimatedObjects.push(animatedObject);
|
|
6697
|
-
this.defaultColorPropertyValues.push(directTarget[lastPropertyName]);
|
|
6719
|
+
this.defaultColorPropertyValues.push(new Color().copyFrom(directTarget[lastPropertyName]));
|
|
6698
6720
|
this.pathToObjectIndex.set(totalPath, this.colorAnimatedObjects.length - 1);
|
|
6699
6721
|
}
|
|
6700
6722
|
};
|
|
@@ -6991,6 +7013,7 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
6991
7013
|
if (this.item) {
|
|
6992
7014
|
removeItem(this.item.components, this);
|
|
6993
7015
|
}
|
|
7016
|
+
EffectsObject.prototype.dispose.call(this);
|
|
6994
7017
|
};
|
|
6995
7018
|
_proto.start = function start() {
|
|
6996
7019
|
if (this.isStartCalled) {
|
|
@@ -12181,9 +12204,8 @@ var seed$7 = 1;
|
|
|
12181
12204
|
this.destroyed = true;
|
|
12182
12205
|
if (this.engine !== undefined) {
|
|
12183
12206
|
this.engine.removeMesh(this);
|
|
12184
|
-
// @ts-expect-error
|
|
12185
|
-
this.engine = undefined;
|
|
12186
12207
|
}
|
|
12208
|
+
RendererComponent.prototype.dispose.call(this);
|
|
12187
12209
|
};
|
|
12188
12210
|
_create_class(Mesh, [
|
|
12189
12211
|
{
|
|
@@ -13339,8 +13361,6 @@ var seed$5 = 1;
|
|
|
13339
13361
|
this.clearAction = clearAction;
|
|
13340
13362
|
this.name = "RenderFrame" + seed$5++;
|
|
13341
13363
|
var firstRP = renderPasses[0];
|
|
13342
|
-
this.emptyTexture = generateWhiteTexture(engine);
|
|
13343
|
-
this.transparentTexture = generateTransparentTexture(engine);
|
|
13344
13364
|
this.camera = camera;
|
|
13345
13365
|
this.keepColorBuffer = keepColorBuffer;
|
|
13346
13366
|
this.renderPassInfoMap.set(firstRP, {
|
|
@@ -13389,8 +13409,6 @@ var seed$5 = 1;
|
|
|
13389
13409
|
}
|
|
13390
13410
|
this.passTextureCache.dispose();
|
|
13391
13411
|
this._renderPasses.length = 0;
|
|
13392
|
-
this.emptyTexture.dispose();
|
|
13393
|
-
this.transparentTexture.dispose();
|
|
13394
13412
|
if (this.resource) {
|
|
13395
13413
|
var _this_resource_depthStencil_texture, _this_resource_depthStencil;
|
|
13396
13414
|
this.resource.color_a.dispose();
|
|
@@ -14050,7 +14068,7 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
14050
14068
|
_this.renderer = {
|
|
14051
14069
|
renderMode: RenderMode.MESH,
|
|
14052
14070
|
blending: BlendingMode.ALPHA,
|
|
14053
|
-
texture: _this.engine.
|
|
14071
|
+
texture: _this.engine.whiteTexture,
|
|
14054
14072
|
occlusion: false,
|
|
14055
14073
|
transparentOcclusion: false,
|
|
14056
14074
|
side: SideMode.DOUBLE,
|
|
@@ -14258,7 +14276,7 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
14258
14276
|
this.renderer = {
|
|
14259
14277
|
renderMode: (_renderer_renderMode = renderer.renderMode) != null ? _renderer_renderMode : RenderMode.MESH,
|
|
14260
14278
|
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
14261
|
-
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.
|
|
14279
|
+
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.whiteTexture,
|
|
14262
14280
|
occlusion: !!renderer.occlusion,
|
|
14263
14281
|
transparentOcclusion: !!renderer.transparentOcclusion || this.maskManager.maskMode === MaskMode.MASK,
|
|
14264
14282
|
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
@@ -16102,20 +16120,26 @@ function oldBezierKeyFramesToNew(props) {
|
|
|
16102
16120
|
keyDatas.push(keyData);
|
|
16103
16121
|
lastControl = p2;
|
|
16104
16122
|
}
|
|
16105
|
-
var
|
|
16123
|
+
var calculateSlope = function(p0, p1) {
|
|
16106
16124
|
return (p1.y - p0.y) / (p1.x - p0.x + NumberEpsilon);
|
|
16107
16125
|
};
|
|
16108
16126
|
for(var i1 = 0; i1 < keyDatas.length; i1++){
|
|
16109
16127
|
var leftControl = keyDatas[i1].leftControl;
|
|
16110
16128
|
var value = keyDatas[i1].value;
|
|
16111
16129
|
var rightControl = keyDatas[i1].rightControl;
|
|
16112
|
-
var
|
|
16113
|
-
var
|
|
16130
|
+
var inSlope = 0;
|
|
16131
|
+
var outSlope = 0;
|
|
16132
|
+
if (i1 > 0) {
|
|
16133
|
+
inSlope = calculateSlope(leftControl, value);
|
|
16134
|
+
}
|
|
16135
|
+
if (i1 < keyDatas.length - 1) {
|
|
16136
|
+
outSlope = calculateSlope(value, rightControl);
|
|
16137
|
+
}
|
|
16114
16138
|
var keyframe = {
|
|
16115
16139
|
time: value.x,
|
|
16116
16140
|
value: value.y,
|
|
16117
|
-
inSlope:
|
|
16118
|
-
outSlope:
|
|
16141
|
+
inSlope: inSlope,
|
|
16142
|
+
outSlope: outSlope,
|
|
16119
16143
|
inWeight: 0,
|
|
16120
16144
|
outWeight: 0,
|
|
16121
16145
|
tangentMode: keyDatas[i1].tangentMode,
|
|
@@ -16252,8 +16276,6 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16252
16276
|
function ShapeComponent(engine) {
|
|
16253
16277
|
var _this;
|
|
16254
16278
|
_this = RendererComponent.call(this, engine) || this;
|
|
16255
|
-
_this.hasStroke = false;
|
|
16256
|
-
_this.hasFill = false;
|
|
16257
16279
|
_this.shapeDirty = true;
|
|
16258
16280
|
_this.materialDirty = true;
|
|
16259
16281
|
_this.graphicsPath = new GraphicsPath();
|
|
@@ -16272,6 +16294,8 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16272
16294
|
/**
|
|
16273
16295
|
* 用于点击测试的碰撞器
|
|
16274
16296
|
*/ _this.meshCollider = new MeshCollider();
|
|
16297
|
+
_this.fillMaterials = [];
|
|
16298
|
+
_this.strokeMaterials = [];
|
|
16275
16299
|
_this.getHitTestParams = function(force) {
|
|
16276
16300
|
var sizeMatrix = Matrix4.fromScale(_this.transform.size.x, _this.transform.size.y, 1);
|
|
16277
16301
|
var worldMatrix = sizeMatrix.premultiply(_this.transform.getWorldMatrix());
|
|
@@ -16283,15 +16307,15 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16283
16307
|
behavior: 0,
|
|
16284
16308
|
type: area.type,
|
|
16285
16309
|
triangles: area.area,
|
|
16286
|
-
backfaceCulling: _this.
|
|
16310
|
+
backfaceCulling: _this.rendererOptions.side === SideMode.FRONT
|
|
16287
16311
|
};
|
|
16288
16312
|
}
|
|
16289
16313
|
}
|
|
16290
16314
|
};
|
|
16291
|
-
_this.
|
|
16315
|
+
_this.rendererOptions = {
|
|
16292
16316
|
renderMode: RenderMode.MESH,
|
|
16293
16317
|
blending: BlendingMode.ALPHA,
|
|
16294
|
-
texture: _this.engine.
|
|
16318
|
+
texture: _this.engine.whiteTexture,
|
|
16295
16319
|
occlusion: false,
|
|
16296
16320
|
transparentOcclusion: false,
|
|
16297
16321
|
side: SideMode.DOUBLE,
|
|
@@ -16379,25 +16403,6 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16379
16403
|
indexCount: 0,
|
|
16380
16404
|
vertexCount: 0
|
|
16381
16405
|
});
|
|
16382
|
-
// Create Material
|
|
16383
|
-
//-------------------------------------------------------------------------
|
|
16384
|
-
var materialProps = {
|
|
16385
|
-
shader: {
|
|
16386
|
-
vertex: vert,
|
|
16387
|
-
fragment: frag,
|
|
16388
|
-
glslVersion: GLSLVersion.GLSL1
|
|
16389
|
-
}
|
|
16390
|
-
};
|
|
16391
|
-
var fillMaterial = Material.create(engine, materialProps);
|
|
16392
|
-
var strokeMaterial = Material.create(engine, materialProps);
|
|
16393
|
-
fillMaterial.depthMask = false;
|
|
16394
|
-
fillMaterial.depthTest = true;
|
|
16395
|
-
fillMaterial.blending = true;
|
|
16396
|
-
_this.material = fillMaterial;
|
|
16397
|
-
strokeMaterial.depthMask = false;
|
|
16398
|
-
strokeMaterial.depthTest = true;
|
|
16399
|
-
strokeMaterial.blending = true;
|
|
16400
|
-
_this.materials[1] = strokeMaterial;
|
|
16401
16406
|
return _this;
|
|
16402
16407
|
}
|
|
16403
16408
|
var _proto = ShapeComponent.prototype;
|
|
@@ -16425,18 +16430,26 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16425
16430
|
if (!this.isActiveAndEnabled) {
|
|
16426
16431
|
return;
|
|
16427
16432
|
}
|
|
16428
|
-
var
|
|
16429
|
-
var
|
|
16430
|
-
|
|
16431
|
-
|
|
16432
|
-
|
|
16433
|
-
|
|
16434
|
-
|
|
16433
|
+
var previousColorMask = false;
|
|
16434
|
+
for(var i = 0; i < this.fillMaterials.length; i++){
|
|
16435
|
+
previousColorMask = this.fillMaterials[i].colorMask;
|
|
16436
|
+
this.fillMaterials[i].colorMask = false;
|
|
16437
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), this.fillMaterials[i], 0);
|
|
16438
|
+
this.fillMaterials[i].colorMask = previousColorMask;
|
|
16439
|
+
}
|
|
16440
|
+
for(var i1 = 0; i1 < this.strokeMaterials.length; i1++){
|
|
16441
|
+
previousColorMask = this.strokeMaterials[i1].colorMask;
|
|
16442
|
+
this.strokeMaterials[i1].colorMask = false;
|
|
16443
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), this.strokeMaterials[i1], 1);
|
|
16444
|
+
this.strokeMaterials[i1].colorMask = previousColorMask;
|
|
16445
|
+
}
|
|
16435
16446
|
};
|
|
16436
16447
|
_proto.draw = function draw(renderer) {
|
|
16437
|
-
for(var i = 0; i < this.
|
|
16438
|
-
|
|
16439
|
-
|
|
16448
|
+
for(var i = 0; i < this.fillMaterials.length; i++){
|
|
16449
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), this.fillMaterials[i], 0);
|
|
16450
|
+
}
|
|
16451
|
+
for(var i1 = 0; i1 < this.strokeMaterials.length; i1++){
|
|
16452
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), this.strokeMaterials[i1], 1);
|
|
16440
16453
|
}
|
|
16441
16454
|
};
|
|
16442
16455
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
@@ -16450,7 +16463,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16450
16463
|
var vertices = [];
|
|
16451
16464
|
var indices = [];
|
|
16452
16465
|
// Triangulate shapePrimitives, build fill and stroke shape geometry
|
|
16453
|
-
if (this.
|
|
16466
|
+
if (this.fills.length > 0) {
|
|
16454
16467
|
for(var _iterator = _create_for_of_iterator_helper_loose(shapePrimitives), _step; !(_step = _iterator()).done;){
|
|
16455
16468
|
var shapePrimitive = _step.value;
|
|
16456
16469
|
var shape = shapePrimitive.shape;
|
|
@@ -16462,7 +16475,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16462
16475
|
}
|
|
16463
16476
|
}
|
|
16464
16477
|
var fillIndexCount = indices.length;
|
|
16465
|
-
if (this.
|
|
16478
|
+
if (this.strokes.length > 0) {
|
|
16466
16479
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(shapePrimitives), _step1; !(_step1 = _iterator1()).done;){
|
|
16467
16480
|
var shapePrimitive1 = _step1.value;
|
|
16468
16481
|
var shape1 = shapePrimitive1.shape;
|
|
@@ -16600,40 +16613,12 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16600
16613
|
}
|
|
16601
16614
|
};
|
|
16602
16615
|
_proto.updateMaterials = function updateMaterials() {
|
|
16603
|
-
for(var
|
|
16604
|
-
|
|
16605
|
-
|
|
16606
|
-
|
|
16607
|
-
|
|
16608
|
-
material.blending = true;
|
|
16609
|
-
material.depthTest = true;
|
|
16610
|
-
material.depthMask = occlusion;
|
|
16611
|
-
material.stencilRef = mask !== undefined ? [
|
|
16612
|
-
mask,
|
|
16613
|
-
mask
|
|
16614
|
-
] : undefined;
|
|
16615
|
-
setBlendMode(material, blendMode);
|
|
16616
|
-
// 兼容旧数据中模板需要渲染的情况
|
|
16617
|
-
setMaskMode(material, maskMode);
|
|
16618
|
-
setSideMode(material, side);
|
|
16619
|
-
material.shader.shaderData.properties = '_MainTex("_MainTex",2D) = "white" {}';
|
|
16620
|
-
material.setVector4("_TexOffset", new Vector4(0, 0, 1, 1));
|
|
16621
|
-
material.setTexture("_MainTex", texture);
|
|
16622
|
-
var preMultiAlpha = getPreMultiAlpha(blendMode);
|
|
16623
|
-
var texParams = new Vector4();
|
|
16624
|
-
texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
|
|
16625
|
-
texParams.y = preMultiAlpha;
|
|
16626
|
-
texParams.z = renderer.renderMode;
|
|
16627
|
-
texParams.w = maskMode;
|
|
16628
|
-
material.setVector4("_TexParams", texParams);
|
|
16629
|
-
if (texParams.x === 0 || this.maskManager.alphaMaskEnabled) {
|
|
16630
|
-
material.enableMacro("ALPHA_CLIP");
|
|
16631
|
-
} else {
|
|
16632
|
-
material.disableMacro("ALPHA_CLIP");
|
|
16633
|
-
}
|
|
16616
|
+
for(var i = 0; i < this.fills.length; i++){
|
|
16617
|
+
this.updatePaintMaterial(this.fillMaterials[i], this.fills[i]);
|
|
16618
|
+
}
|
|
16619
|
+
for(var i1 = 0; i1 < this.strokes.length; i1++){
|
|
16620
|
+
this.updatePaintMaterial(this.strokeMaterials[i1], this.strokes[i1]);
|
|
16634
16621
|
}
|
|
16635
|
-
this.updatePaintMaterial(this.material, this.fills[0]);
|
|
16636
|
-
this.updatePaintMaterial(this.materials[1], this.strokes[0]);
|
|
16637
16622
|
};
|
|
16638
16623
|
_proto.updatePaintMaterial = function updatePaintMaterial(material, paint) {
|
|
16639
16624
|
material.setFloat("_FillType", paint.type);
|
|
@@ -16670,6 +16655,46 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16670
16655
|
material.setVector2("_StartPoint", startPoint);
|
|
16671
16656
|
material.setVector2("_EndPoint", endPoint);
|
|
16672
16657
|
};
|
|
16658
|
+
_proto.createMaterialFromRendererOptions = function createMaterialFromRendererOptions(rendererOptions) {
|
|
16659
|
+
var materialProps = {
|
|
16660
|
+
shader: {
|
|
16661
|
+
vertex: vert,
|
|
16662
|
+
fragment: frag,
|
|
16663
|
+
glslVersion: GLSLVersion.GLSL1
|
|
16664
|
+
}
|
|
16665
|
+
};
|
|
16666
|
+
var material = Material.create(this.engine, materialProps);
|
|
16667
|
+
var renderer = rendererOptions;
|
|
16668
|
+
var side = renderer.side, occlusion = renderer.occlusion, blendMode = renderer.blending, mask = renderer.mask, texture = renderer.texture;
|
|
16669
|
+
var maskMode = this.maskManager.maskMode;
|
|
16670
|
+
material.blending = true;
|
|
16671
|
+
material.depthTest = true;
|
|
16672
|
+
material.depthMask = occlusion;
|
|
16673
|
+
material.stencilRef = mask !== undefined ? [
|
|
16674
|
+
mask,
|
|
16675
|
+
mask
|
|
16676
|
+
] : undefined;
|
|
16677
|
+
setBlendMode(material, blendMode);
|
|
16678
|
+
// 兼容旧数据中模板需要渲染的情况
|
|
16679
|
+
setMaskMode(material, maskMode);
|
|
16680
|
+
setSideMode(material, side);
|
|
16681
|
+
material.shader.shaderData.properties = '_ImageTex("_ImageTex",2D) = "white" {}';
|
|
16682
|
+
material.setVector4("_TexOffset", new Vector4(0, 0, 1, 1));
|
|
16683
|
+
material.setTexture("_ImageTex", texture);
|
|
16684
|
+
var preMultiAlpha = getPreMultiAlpha(blendMode);
|
|
16685
|
+
var texParams = new Vector4();
|
|
16686
|
+
texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
|
|
16687
|
+
texParams.y = preMultiAlpha;
|
|
16688
|
+
texParams.z = renderer.renderMode;
|
|
16689
|
+
texParams.w = maskMode;
|
|
16690
|
+
material.setVector4("_TexParams", texParams);
|
|
16691
|
+
if (texParams.x === 0 || this.maskManager.alphaMaskEnabled) {
|
|
16692
|
+
material.enableMacro("ALPHA_CLIP");
|
|
16693
|
+
} else {
|
|
16694
|
+
material.disableMacro("ALPHA_CLIP");
|
|
16695
|
+
}
|
|
16696
|
+
return material;
|
|
16697
|
+
};
|
|
16673
16698
|
_proto.fromData = function fromData(data) {
|
|
16674
16699
|
RendererComponent.prototype.fromData.call(this, data);
|
|
16675
16700
|
this.shapeDirty = true;
|
|
@@ -16678,11 +16703,11 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16678
16703
|
}
|
|
16679
16704
|
var _data_renderer;
|
|
16680
16705
|
var renderer = (_data_renderer = data.renderer) != null ? _data_renderer : {};
|
|
16681
|
-
var
|
|
16682
|
-
this.
|
|
16683
|
-
renderMode:
|
|
16706
|
+
var _renderer_blending, _renderer_side;
|
|
16707
|
+
this.rendererOptions = {
|
|
16708
|
+
renderMode: RenderMode.MESH,
|
|
16684
16709
|
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
16685
|
-
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.
|
|
16710
|
+
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.whiteTexture,
|
|
16686
16711
|
occlusion: !!renderer.occlusion,
|
|
16687
16712
|
transparentOcclusion: !!renderer.transparentOcclusion || this.maskManager.maskMode === MaskMode.MASK,
|
|
16688
16713
|
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
@@ -16694,22 +16719,21 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16694
16719
|
this.strokeWidth = (_data_strokeWidth = data.strokeWidth) != null ? _data_strokeWidth : 1;
|
|
16695
16720
|
var _data_strokeJoin;
|
|
16696
16721
|
this.strokeJoin = (_data_strokeJoin = data.strokeJoin) != null ? _data_strokeJoin : LineJoin.Miter;
|
|
16697
|
-
|
|
16698
|
-
|
|
16699
|
-
|
|
16700
|
-
|
|
16701
|
-
|
|
16702
|
-
|
|
16703
|
-
|
|
16704
|
-
|
|
16705
|
-
|
|
16706
|
-
|
|
16707
|
-
var
|
|
16708
|
-
|
|
16709
|
-
|
|
16710
|
-
|
|
16711
|
-
|
|
16712
|
-
}
|
|
16722
|
+
this.fills.length = 0;
|
|
16723
|
+
this.fillMaterials.length = 0;
|
|
16724
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(data.fills), _step; !(_step = _iterator()).done;){
|
|
16725
|
+
var fill = _step.value;
|
|
16726
|
+
this.fills.push(this.createPaint(fill));
|
|
16727
|
+
this.fillMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions));
|
|
16728
|
+
}
|
|
16729
|
+
this.strokes.length = 0;
|
|
16730
|
+
this.strokeMaterials.length = 0;
|
|
16731
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(data.strokes), _step1; !(_step1 = _iterator1()).done;){
|
|
16732
|
+
var stroke = _step1.value;
|
|
16733
|
+
this.strokes.push(this.createPaint(stroke));
|
|
16734
|
+
this.strokeMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions));
|
|
16735
|
+
}
|
|
16736
|
+
this.materials = [].concat(this.fillMaterials, this.strokeMaterials);
|
|
16713
16737
|
switch(data.type){
|
|
16714
16738
|
case ShapePrimitiveType.Custom:
|
|
16715
16739
|
{
|
|
@@ -17227,11 +17251,11 @@ var vertex = "\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 u
|
|
|
17227
17251
|
var fragment = "\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n";
|
|
17228
17252
|
var seed$4 = 1;
|
|
17229
17253
|
var InteractMesh = /*#__PURE__*/ function() {
|
|
17230
|
-
function InteractMesh(props,
|
|
17254
|
+
function InteractMesh(props, transform, engine) {
|
|
17231
17255
|
this.transform = transform;
|
|
17232
17256
|
this.engine = engine;
|
|
17233
17257
|
this.color = props.options.previewColor;
|
|
17234
|
-
var material = this.createMaterial(
|
|
17258
|
+
var material = this.createMaterial();
|
|
17235
17259
|
var geometry = this.createGeometry();
|
|
17236
17260
|
this.mesh = this.createMesh(geometry, material);
|
|
17237
17261
|
this.updateMesh();
|
|
@@ -17254,7 +17278,7 @@ var InteractMesh = /*#__PURE__*/ function() {
|
|
|
17254
17278
|
material.setVector4("uPos", uPos);
|
|
17255
17279
|
material.setQuaternion("uQuat", tempQuat);
|
|
17256
17280
|
};
|
|
17257
|
-
_proto.createMaterial = function createMaterial(
|
|
17281
|
+
_proto.createMaterial = function createMaterial() {
|
|
17258
17282
|
var _this_engine_renderer;
|
|
17259
17283
|
var macros = [
|
|
17260
17284
|
[
|
|
@@ -17268,7 +17292,6 @@ var InteractMesh = /*#__PURE__*/ function() {
|
|
|
17268
17292
|
vertex: vertex,
|
|
17269
17293
|
fragment: fragment,
|
|
17270
17294
|
glslVersion: GLSLVersion.GLSL1,
|
|
17271
|
-
cacheId: "" + rendererOptions.cachePrefix + "_effects_interact",
|
|
17272
17295
|
macros: macros
|
|
17273
17296
|
}
|
|
17274
17297
|
};
|
|
@@ -17390,19 +17413,33 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
17390
17413
|
return _this;
|
|
17391
17414
|
}
|
|
17392
17415
|
var _proto = InteractComponent.prototype;
|
|
17393
|
-
|
|
17416
|
+
/**
|
|
17417
|
+
* 获取拖拽范围 X 轴
|
|
17418
|
+
* @returns 拖拽范围 [min, max]
|
|
17419
|
+
*/ _proto.getDragRangeX = function getDragRangeX() {
|
|
17394
17420
|
return this.dragRange.dxRange;
|
|
17395
17421
|
};
|
|
17396
|
-
|
|
17422
|
+
/**
|
|
17423
|
+
* 设置拖拽范围 X 轴
|
|
17424
|
+
* @param min 最小值
|
|
17425
|
+
* @param max 最大值
|
|
17426
|
+
*/ _proto.setDragRangeX = function setDragRangeX(min, max) {
|
|
17397
17427
|
this.dragRange.dxRange = [
|
|
17398
17428
|
min,
|
|
17399
17429
|
max
|
|
17400
17430
|
];
|
|
17401
17431
|
};
|
|
17402
|
-
|
|
17432
|
+
/**
|
|
17433
|
+
* 获取拖拽范围 Y 轴
|
|
17434
|
+
* @returns 拖拽范围 [min, max]
|
|
17435
|
+
*/ _proto.getDragRangeY = function getDragRangeY() {
|
|
17403
17436
|
return this.dragRange.dyRange;
|
|
17404
17437
|
};
|
|
17405
|
-
|
|
17438
|
+
/**
|
|
17439
|
+
* 设置拖拽范围 Y 轴
|
|
17440
|
+
* @param min 最小值
|
|
17441
|
+
* @param max 最大值
|
|
17442
|
+
*/ _proto.setDragRangeY = function setDragRangeY(min, max) {
|
|
17406
17443
|
this.dragRange.dyRange = [
|
|
17407
17444
|
min,
|
|
17408
17445
|
max
|
|
@@ -17410,15 +17447,11 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
17410
17447
|
};
|
|
17411
17448
|
_proto.onStart = function onStart() {
|
|
17412
17449
|
var env = this.item.engine.renderer.env;
|
|
17413
|
-
var composition = this.item.composition;
|
|
17414
17450
|
var _this_interactData_options = this.interactData.options, type = _this_interactData_options.type, showPreview = _this_interactData_options.showPreview;
|
|
17415
17451
|
if (type === InteractType.CLICK) {
|
|
17416
17452
|
this.clickable = true;
|
|
17417
17453
|
if (showPreview && env === PLAYER_OPTIONS_ENV_EDITOR) {
|
|
17418
|
-
|
|
17419
|
-
if (rendererOptions !== undefined) {
|
|
17420
|
-
this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
|
|
17421
|
-
}
|
|
17454
|
+
this.previewContent = new InteractMesh(this.item.props.content, this.transform, this.engine);
|
|
17422
17455
|
}
|
|
17423
17456
|
}
|
|
17424
17457
|
if (this.previewContent) {
|
|
@@ -17627,7 +17660,10 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
17627
17660
|
}
|
|
17628
17661
|
}
|
|
17629
17662
|
};
|
|
17630
|
-
|
|
17663
|
+
/**
|
|
17664
|
+
* 是否可以交互
|
|
17665
|
+
* @returns
|
|
17666
|
+
*/ _proto.canInteract = function canInteract() {
|
|
17631
17667
|
var _this_item_composition;
|
|
17632
17668
|
return Boolean((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.interactive) && this._interactive;
|
|
17633
17669
|
};
|
|
@@ -17662,7 +17698,9 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
17662
17698
|
get: function get() {
|
|
17663
17699
|
return this._interactive;
|
|
17664
17700
|
},
|
|
17665
|
-
set:
|
|
17701
|
+
set: /**
|
|
17702
|
+
* 是否响应点击和拖拽交互事件
|
|
17703
|
+
*/ function set(enable) {
|
|
17666
17704
|
this._interactive = enable;
|
|
17667
17705
|
if (!enable) {
|
|
17668
17706
|
// 立刻停止惯性滑动
|
|
@@ -18419,6 +18457,12 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
18419
18457
|
this./**
|
|
18420
18458
|
* @internal
|
|
18421
18459
|
*/ transform = new Transform();
|
|
18460
|
+
this./**
|
|
18461
|
+
* 画布的像素宽度
|
|
18462
|
+
*/ pixelWidth = 0;
|
|
18463
|
+
this./**
|
|
18464
|
+
* 画布的像素高度
|
|
18465
|
+
*/ pixelHeight = 0;
|
|
18422
18466
|
this.viewportMatrix = Matrix4.fromIdentity();
|
|
18423
18467
|
this.viewMatrix = Matrix4.fromIdentity();
|
|
18424
18468
|
this.projectionMatrix = Matrix4.fromIdentity();
|
|
@@ -18433,7 +18477,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
18433
18477
|
0,
|
|
18434
18478
|
0,
|
|
18435
18479
|
0
|
|
18436
|
-
] : _options_rotation;
|
|
18480
|
+
] : _options_rotation, _options_pixelWidth = options.pixelWidth, pixelWidth = _options_pixelWidth === void 0 ? 0 : _options_pixelWidth, _options_pixelHeight = options.pixelHeight, pixelHeight = _options_pixelHeight === void 0 ? 0 : _options_pixelHeight;
|
|
18437
18481
|
var euler = new Euler(rotation[0], rotation[1], rotation[2]);
|
|
18438
18482
|
var quat = new Quaternion().setFromEuler(euler);
|
|
18439
18483
|
this.options = {
|
|
@@ -18443,6 +18487,8 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
18443
18487
|
aspect: aspect,
|
|
18444
18488
|
clipMode: clipMode
|
|
18445
18489
|
};
|
|
18490
|
+
this.pixelWidth = pixelWidth;
|
|
18491
|
+
this.pixelHeight = pixelHeight;
|
|
18446
18492
|
this.transform.setPosition(position[0], position[1], position[2]);
|
|
18447
18493
|
this.transform.setQuaternion(quat.x, quat.y, quat.z, quat.w);
|
|
18448
18494
|
this.dirty = true;
|
|
@@ -18589,6 +18635,48 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
18589
18635
|
this.dirty = false;
|
|
18590
18636
|
}
|
|
18591
18637
|
};
|
|
18638
|
+
/**
|
|
18639
|
+
* 将世界坐标转换为屏幕像素坐标
|
|
18640
|
+
* @param position - 世界坐标
|
|
18641
|
+
* @param out - 输出的屏幕坐标,如果不传则创建新的 Vector3
|
|
18642
|
+
* @returns 屏幕坐标 (x, y 为像素坐标,左下角为(0,0),右上角为(width,height),z 为深度比例 [0,1],0=近平面,1=远平面)
|
|
18643
|
+
*/ _proto.worldToScreenPoint = function worldToScreenPoint(position, out) {
|
|
18644
|
+
this.updateMatrix();
|
|
18645
|
+
var result = out != null ? out : new Vector3();
|
|
18646
|
+
var vpMatrix = this.getViewProjectionMatrix();
|
|
18647
|
+
// 应用视图投影矩阵,得到 NDC 坐标 [-1, 1]
|
|
18648
|
+
result.set(position.x, position.y, position.z);
|
|
18649
|
+
vpMatrix.projectPoint(result, result);
|
|
18650
|
+
// 将 NDC 坐标转换为像素坐标
|
|
18651
|
+
// NDC: x,y in [-1, 1], 其中 (-1,-1) 是左下角,(1,1) 是右上角
|
|
18652
|
+
// Screen: x,y in [0, width/height], 其中 (0,0) 是左下角
|
|
18653
|
+
result.x = (result.x + 1) * 0.5 * this.pixelWidth;
|
|
18654
|
+
result.y = (result.y + 1) * 0.5 * this.pixelHeight;
|
|
18655
|
+
// 将 NDC z 值从 [-1, 1] 转换为深度比例 [0, 1]
|
|
18656
|
+
// -1 (近平面) -> 0, 1 (远平面) -> 1
|
|
18657
|
+
result.z = (result.z + 1) * 0.5;
|
|
18658
|
+
return result;
|
|
18659
|
+
};
|
|
18660
|
+
/**
|
|
18661
|
+
* 将屏幕像素坐标转换为世界坐标
|
|
18662
|
+
* @param position - 屏幕坐标 (x, y 为像素坐标,左下角为(0,0),z 为深度比例 [0,1],0=近平面,1=远平面)
|
|
18663
|
+
* @param out - 输出的世界坐标,如果不传则创建新的 Vector3
|
|
18664
|
+
* @returns 世界坐标
|
|
18665
|
+
*/ _proto.screenToWorldPoint = function screenToWorldPoint(position, out) {
|
|
18666
|
+
this.updateMatrix();
|
|
18667
|
+
var result = out != null ? out : new Vector3();
|
|
18668
|
+
var invVPMatrix = this.getInverseViewProjectionMatrix();
|
|
18669
|
+
// 将像素坐标转换为 NDC 坐标 [-1, 1]
|
|
18670
|
+
var ndcX = position.x / this.pixelWidth * 2 - 1;
|
|
18671
|
+
var ndcY = position.y / this.pixelHeight * 2 - 1;
|
|
18672
|
+
// 将深度比例 [0, 1] 转换为 NDC z 值 [-1, 1]
|
|
18673
|
+
// 0 (近平面) -> -1, 1 (远平面) -> 1
|
|
18674
|
+
var ndcZ = position.z * 2 - 1;
|
|
18675
|
+
// 应用逆视图投影矩阵
|
|
18676
|
+
result.set(ndcX, ndcY, ndcZ);
|
|
18677
|
+
invVPMatrix.projectPoint(result, result);
|
|
18678
|
+
return result;
|
|
18679
|
+
};
|
|
18592
18680
|
_create_class(Camera, [
|
|
18593
18681
|
{
|
|
18594
18682
|
key: "near",
|
|
@@ -21450,7 +21538,6 @@ function modifyMaxKeyframeShader(shader, maxVertex, maxFrag) {
|
|
|
21450
21538
|
var _proto = ParticleSystemRenderer.prototype;
|
|
21451
21539
|
_proto.onStart = function onStart() {
|
|
21452
21540
|
this._priority = this.item.renderOrder;
|
|
21453
|
-
this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);
|
|
21454
21541
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
21455
21542
|
var mesh = _step.value;
|
|
21456
21543
|
mesh.onStart();
|
|
@@ -22411,7 +22498,6 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
22411
22498
|
};
|
|
22412
22499
|
}
|
|
22413
22500
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
22414
|
-
this.item._content = this;
|
|
22415
22501
|
};
|
|
22416
22502
|
_create_class(ParticleSystem, [
|
|
22417
22503
|
{
|
|
@@ -22936,7 +23022,7 @@ var tempPos = new Vector3();
|
|
|
22936
23022
|
*/ _proto.sampleAnimation = function sampleAnimation() {
|
|
22937
23023
|
var _this = this;
|
|
22938
23024
|
var boundItem = this.boundObject;
|
|
22939
|
-
var duration =
|
|
23025
|
+
var duration = this.getDuration();
|
|
22940
23026
|
var life = this.time / duration;
|
|
22941
23027
|
life = life < 0 ? 0 : life > 1 ? 1 : life;
|
|
22942
23028
|
if (this.sizeXOverLifetime) {
|
|
@@ -23406,41 +23492,45 @@ var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
|
23406
23492
|
if (!_instanceof1(boundItem, VFXItem)) {
|
|
23407
23493
|
return;
|
|
23408
23494
|
}
|
|
23409
|
-
var hasActiveTrack = false;
|
|
23410
23495
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.getChildTracks()), _step; !(_step = _iterator()).done;){
|
|
23411
23496
|
var childTrack = _step.value;
|
|
23412
23497
|
if (_instanceof1(childTrack, ActivationTrack)) {
|
|
23413
|
-
|
|
23498
|
+
// 添加粒子动画 clip // TODO 待移除
|
|
23499
|
+
if (boundItem.getComponent(ParticleSystem)) {
|
|
23500
|
+
var particleTrack = timelineAsset.createTrack(ParticleTrack, this, "ParticleTrack");
|
|
23501
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(childTrack.getClips()), _step1; !(_step1 = _iterator1()).done;){
|
|
23502
|
+
var activationClip = _step1.value;
|
|
23503
|
+
var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
|
|
23504
|
+
particleClip.start = activationClip.start;
|
|
23505
|
+
particleClip.duration = activationClip.duration;
|
|
23506
|
+
particleClip.endBehavior = activationClip.endBehavior;
|
|
23507
|
+
}
|
|
23508
|
+
}
|
|
23509
|
+
// 添加图层帧动画动画时间 clip // TODO 待移除
|
|
23510
|
+
if (boundItem.getComponent(SpriteComponent)) {
|
|
23511
|
+
var componentTimeTrack = timelineAsset.createTrack(SpriteComponentTimeTrack, this, "SpriteComponentTimeTrack");
|
|
23512
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(childTrack.getClips()), _step2; !(_step2 = _iterator2()).done;){
|
|
23513
|
+
var activationClip1 = _step2.value;
|
|
23514
|
+
var clip = componentTimeTrack.createClip(ComponentTimePlayableAsset);
|
|
23515
|
+
clip.start = activationClip1.start;
|
|
23516
|
+
clip.duration = activationClip1.duration;
|
|
23517
|
+
clip.endBehavior = activationClip1.endBehavior;
|
|
23518
|
+
}
|
|
23519
|
+
}
|
|
23520
|
+
// 添加图层帧动画动画时间 clip // TODO 待移除
|
|
23521
|
+
if (boundItem.getComponent(EffectComponent)) {
|
|
23522
|
+
var componentTimeTrack1 = timelineAsset.createTrack(EffectComponentTimeTrack, this, "EffectComponentTimeTrack");
|
|
23523
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(childTrack.getClips()), _step3; !(_step3 = _iterator3()).done;){
|
|
23524
|
+
var activationClip2 = _step3.value;
|
|
23525
|
+
var clip1 = componentTimeTrack1.createClip(ComponentTimePlayableAsset);
|
|
23526
|
+
clip1.start = activationClip2.start;
|
|
23527
|
+
clip1.duration = activationClip2.duration;
|
|
23528
|
+
clip1.endBehavior = activationClip2.endBehavior;
|
|
23529
|
+
}
|
|
23530
|
+
}
|
|
23414
23531
|
break;
|
|
23415
23532
|
}
|
|
23416
23533
|
}
|
|
23417
|
-
if (!hasActiveTrack) {
|
|
23418
|
-
return;
|
|
23419
|
-
}
|
|
23420
|
-
// 添加粒子动画 clip // TODO 待移除
|
|
23421
|
-
if (boundItem.getComponent(ParticleSystem)) {
|
|
23422
|
-
var particleTrack = timelineAsset.createTrack(ParticleTrack, this, "ParticleTrack");
|
|
23423
|
-
var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
|
|
23424
|
-
particleClip.start = boundItem.start;
|
|
23425
|
-
particleClip.duration = boundItem.duration;
|
|
23426
|
-
particleClip.endBehavior = boundItem.endBehavior;
|
|
23427
|
-
}
|
|
23428
|
-
// 添加图层帧动画动画时间 clip // TODO 待移除
|
|
23429
|
-
if (boundItem.getComponent(SpriteComponent)) {
|
|
23430
|
-
var componentTimeTrack = timelineAsset.createTrack(SpriteComponentTimeTrack, this, "SpriteComponentTimeTrack");
|
|
23431
|
-
var clip = componentTimeTrack.createClip(ComponentTimePlayableAsset);
|
|
23432
|
-
clip.start = boundItem.start;
|
|
23433
|
-
clip.duration = boundItem.duration;
|
|
23434
|
-
clip.endBehavior = boundItem.endBehavior;
|
|
23435
|
-
}
|
|
23436
|
-
// 添加图层帧动画动画时间 clip // TODO 待移除
|
|
23437
|
-
if (boundItem.getComponent(EffectComponent)) {
|
|
23438
|
-
var componentTimeTrack1 = timelineAsset.createTrack(EffectComponentTimeTrack, this, "EffectComponentTimeTrack");
|
|
23439
|
-
var clip1 = componentTimeTrack1.createClip(ComponentTimePlayableAsset);
|
|
23440
|
-
clip1.start = boundItem.start;
|
|
23441
|
-
clip1.duration = boundItem.duration;
|
|
23442
|
-
clip1.endBehavior = boundItem.endBehavior;
|
|
23443
|
-
}
|
|
23444
23534
|
};
|
|
23445
23535
|
return ObjectBindingTrack;
|
|
23446
23536
|
}(TrackAsset);
|
|
@@ -24225,13 +24315,14 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24225
24315
|
_this.pluginSystem = scene.pluginSystem;
|
|
24226
24316
|
_this.pluginSystem.initializeComposition(_assert_this_initialized(_this), scene);
|
|
24227
24317
|
_this.camera = new Camera(_this.name, _extends({}, sourceContent == null ? void 0 : sourceContent.camera, {
|
|
24228
|
-
aspect: width / height
|
|
24318
|
+
aspect: width / height,
|
|
24319
|
+
pixelWidth: width,
|
|
24320
|
+
pixelHeight: height
|
|
24229
24321
|
}));
|
|
24230
24322
|
_this.url = scene.url;
|
|
24231
24323
|
_this.interactive = true;
|
|
24232
24324
|
_this.handleItemMessage = handleItemMessage;
|
|
24233
24325
|
_this.createRenderFrame();
|
|
24234
|
-
_this.rendererOptions = null;
|
|
24235
24326
|
Composition.buildItemTree(_this.rootItem);
|
|
24236
24327
|
_this.rootComposition.setChildrenRenderOrder(0);
|
|
24237
24328
|
_this.pluginSystem.resetComposition(_assert_this_initialized(_this), _this.renderFrame);
|
|
@@ -24287,9 +24378,11 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24287
24378
|
this.restart();
|
|
24288
24379
|
}
|
|
24289
24380
|
if (this.rootComposition.isStartCalled) {
|
|
24290
|
-
this.
|
|
24381
|
+
this.setTime(this.time - this.startTime);
|
|
24382
|
+
this.resume();
|
|
24291
24383
|
} else {
|
|
24292
|
-
this.
|
|
24384
|
+
this.setTime(0);
|
|
24385
|
+
this.resume();
|
|
24293
24386
|
}
|
|
24294
24387
|
};
|
|
24295
24388
|
/**
|
|
@@ -24321,6 +24414,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24321
24414
|
* @param time - 相对 startTime 的时间
|
|
24322
24415
|
*/ _proto.gotoAndPlay = function gotoAndPlay(time) {
|
|
24323
24416
|
this.setTime(time);
|
|
24417
|
+
this.emit("goto", {
|
|
24418
|
+
time: time
|
|
24419
|
+
});
|
|
24324
24420
|
this.resume();
|
|
24325
24421
|
};
|
|
24326
24422
|
/**
|
|
@@ -24328,6 +24424,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24328
24424
|
* @param time - 相对 startTime 的时间
|
|
24329
24425
|
*/ _proto.gotoAndStop = function gotoAndStop(time) {
|
|
24330
24426
|
this.setTime(time);
|
|
24427
|
+
this.emit("goto", {
|
|
24428
|
+
time: time
|
|
24429
|
+
});
|
|
24331
24430
|
this.pause();
|
|
24332
24431
|
};
|
|
24333
24432
|
/**
|
|
@@ -24358,9 +24457,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24358
24457
|
if (pause) {
|
|
24359
24458
|
this.paused = true;
|
|
24360
24459
|
}
|
|
24361
|
-
this.emit("goto", {
|
|
24362
|
-
time: time
|
|
24363
|
-
});
|
|
24364
24460
|
};
|
|
24365
24461
|
_proto.addItem = function addItem(item) {
|
|
24366
24462
|
this.items.push(item);
|
|
@@ -24392,7 +24488,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24392
24488
|
/**
|
|
24393
24489
|
* 重置状态函数
|
|
24394
24490
|
*/ _proto.reset = function reset() {
|
|
24395
|
-
this.rendererOptions = null;
|
|
24396
24491
|
this.isEnded = false;
|
|
24397
24492
|
this.isEndCalled = false;
|
|
24398
24493
|
this.rootComposition.time = 0;
|
|
@@ -24418,9 +24513,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24418
24513
|
if (this.getPaused()) {
|
|
24419
24514
|
return;
|
|
24420
24515
|
}
|
|
24421
|
-
//
|
|
24516
|
+
// Scene VFXItem components lifetime function
|
|
24422
24517
|
if (!this.rootItem.isDuringPlay) {
|
|
24423
|
-
this.
|
|
24518
|
+
this.rootItem.awake();
|
|
24424
24519
|
this.rootItem.beginPlay();
|
|
24425
24520
|
}
|
|
24426
24521
|
var previousCompositionTime = this.time;
|
|
@@ -24445,19 +24540,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24445
24540
|
_proto.shouldDispose = function shouldDispose() {
|
|
24446
24541
|
return this.isEnded && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
|
|
24447
24542
|
};
|
|
24448
|
-
_proto.callAwake = function callAwake(item) {
|
|
24449
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
24450
|
-
var component = _step.value;
|
|
24451
|
-
if (!component.isAwakeCalled) {
|
|
24452
|
-
component.onAwake();
|
|
24453
|
-
component.isAwakeCalled = true;
|
|
24454
|
-
}
|
|
24455
|
-
}
|
|
24456
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.children), _step1; !(_step1 = _iterator1()).done;){
|
|
24457
|
-
var child = _step1.value;
|
|
24458
|
-
this.callAwake(child);
|
|
24459
|
-
}
|
|
24460
|
-
};
|
|
24461
24543
|
/**
|
|
24462
24544
|
* 更新相机
|
|
24463
24545
|
* @override
|
|
@@ -24546,7 +24628,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24546
24628
|
return (_this_renderer = this.renderer) == null ? void 0 : _this_renderer.engine;
|
|
24547
24629
|
};
|
|
24548
24630
|
/**
|
|
24549
|
-
* Item 求交测试,返回求交结果列表,x 和 y 是归一化到[-1, 1]
|
|
24631
|
+
* Item 求交测试,返回求交结果列表,x 和 y 是归一化到[-1, 1]区间的值,x 向右,y 向上
|
|
24550
24632
|
* @param x - 鼠标或触点的 x,已经归一化到[-1, 1]
|
|
24551
24633
|
* @param y - 鼠标或触点的 y,已经归一化到[-1, 1]
|
|
24552
24634
|
* @param force - 是否强制求交,没有交互信息的 Item 也要进行求交测试
|
|
@@ -24645,7 +24727,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24645
24727
|
* 合成对象销毁
|
|
24646
24728
|
*/ _proto.dispose = function dispose() {
|
|
24647
24729
|
var _this = this;
|
|
24648
|
-
var
|
|
24730
|
+
var _this_pluginSystem;
|
|
24649
24731
|
if (this.destroyed) {
|
|
24650
24732
|
return;
|
|
24651
24733
|
}
|
|
@@ -24665,7 +24747,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24665
24747
|
this.rootItem.dispose();
|
|
24666
24748
|
// FIXME: 注意这里增加了renderFrame销毁
|
|
24667
24749
|
this.renderFrame.dispose();
|
|
24668
|
-
(_this_rendererOptions = this.rendererOptions) == null ? void 0 : _this_rendererOptions.emptyTexture.dispose();
|
|
24669
24750
|
(_this_pluginSystem = this.pluginSystem) == null ? void 0 : _this_pluginSystem.destroyComposition(this);
|
|
24670
24751
|
this.update = function() {
|
|
24671
24752
|
{
|
|
@@ -24762,15 +24843,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24762
24843
|
this.textureOffloaded = true;
|
|
24763
24844
|
}
|
|
24764
24845
|
};
|
|
24765
|
-
_proto.getRendererOptions = function getRendererOptions() {
|
|
24766
|
-
if (!this.rendererOptions) {
|
|
24767
|
-
this.rendererOptions = {
|
|
24768
|
-
emptyTexture: this.renderFrame.emptyTexture,
|
|
24769
|
-
cachePrefix: "-"
|
|
24770
|
-
};
|
|
24771
|
-
}
|
|
24772
|
-
return this.rendererOptions;
|
|
24773
|
-
};
|
|
24774
24846
|
/**
|
|
24775
24847
|
* 重新加载纹理
|
|
24776
24848
|
*/ _proto.reloadTexture = function reloadTexture() {
|
|
@@ -24884,7 +24956,9 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
24884
24956
|
function VFXItem(engine, props) {
|
|
24885
24957
|
var _this;
|
|
24886
24958
|
_this = EffectsObject.call(this, engine) || this;
|
|
24887
|
-
|
|
24959
|
+
/**
|
|
24960
|
+
* 元素的子元素列表
|
|
24961
|
+
*/ _this.children = [];
|
|
24888
24962
|
/**
|
|
24889
24963
|
* 元素的变换包含位置、旋转、缩放。
|
|
24890
24964
|
*/ _this.transform = new Transform();
|
|
@@ -24895,9 +24969,6 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
24895
24969
|
* 元素动画的持续时间
|
|
24896
24970
|
*/ _this.duration = 0;
|
|
24897
24971
|
/**
|
|
24898
|
-
* 元素动画的开始时间
|
|
24899
|
-
*/ _this.start = 0;
|
|
24900
|
-
/**
|
|
24901
24972
|
* 元素动画结束时行为(如何处理元素)
|
|
24902
24973
|
*/ _this.endBehavior = EndBehavior.forward;
|
|
24903
24974
|
_this.type = ItemType.base;
|
|
@@ -25017,6 +25088,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25017
25088
|
this.composition = vfxItem.composition;
|
|
25018
25089
|
}
|
|
25019
25090
|
if (!this.isDuringPlay && vfxItem.isDuringPlay) {
|
|
25091
|
+
this.awake();
|
|
25020
25092
|
this.beginPlay();
|
|
25021
25093
|
}
|
|
25022
25094
|
};
|
|
@@ -25192,6 +25264,21 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25192
25264
|
};
|
|
25193
25265
|
/**
|
|
25194
25266
|
* @internal
|
|
25267
|
+
*/ _proto.awake = function awake() {
|
|
25268
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
25269
|
+
var component = _step.value;
|
|
25270
|
+
if (!component.isAwakeCalled) {
|
|
25271
|
+
component.onAwake();
|
|
25272
|
+
component.isAwakeCalled = true;
|
|
25273
|
+
}
|
|
25274
|
+
}
|
|
25275
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.children), _step1; !(_step1 = _iterator1()).done;){
|
|
25276
|
+
var child = _step1.value;
|
|
25277
|
+
child.awake();
|
|
25278
|
+
}
|
|
25279
|
+
};
|
|
25280
|
+
/**
|
|
25281
|
+
* @internal
|
|
25195
25282
|
*/ _proto.onActiveChanged = function onActiveChanged() {
|
|
25196
25283
|
if (!this.isEnabled) {
|
|
25197
25284
|
this.onEnable();
|
|
@@ -25230,12 +25317,11 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25230
25317
|
};
|
|
25231
25318
|
_proto.fromData = function fromData(data) {
|
|
25232
25319
|
EffectsObject.prototype.fromData.call(this, data);
|
|
25233
|
-
var id = data.id, name = data.name,
|
|
25320
|
+
var id = data.id, name = data.name, parentId = data.parentId, endBehavior = data.endBehavior, transform = data.transform, _data_duration = data.duration, duration = _data_duration === void 0 ? 0 : _data_duration, _data_visible = data.visible, visible = _data_visible === void 0 ? true : _data_visible;
|
|
25234
25321
|
this.props = data;
|
|
25235
25322
|
this.type = data.type;
|
|
25236
25323
|
this.id = id.toString(); // TODO 老数据 id 是 number,需要转换
|
|
25237
25324
|
this.name = name;
|
|
25238
|
-
this.start = delay ? delay : this.start;
|
|
25239
25325
|
if (transform) {
|
|
25240
25326
|
this.transform.fromData(transform);
|
|
25241
25327
|
}
|
|
@@ -25269,6 +25355,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25269
25355
|
if (VFXItem.isComposition(this)) {
|
|
25270
25356
|
this.instantiatePreComposition();
|
|
25271
25357
|
}
|
|
25358
|
+
this.setVisible(visible);
|
|
25272
25359
|
};
|
|
25273
25360
|
_proto.toData = function toData() {
|
|
25274
25361
|
var _this_parent;
|
|
@@ -25312,10 +25399,10 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25312
25399
|
component.dispose();
|
|
25313
25400
|
}
|
|
25314
25401
|
this.components = [];
|
|
25315
|
-
this._content = undefined;
|
|
25316
25402
|
this._composition = null;
|
|
25317
25403
|
this.transform.setValid(false);
|
|
25318
25404
|
}
|
|
25405
|
+
EffectsObject.prototype.dispose.call(this);
|
|
25319
25406
|
};
|
|
25320
25407
|
_proto.resetChildrenParent = function resetChildrenParent() {
|
|
25321
25408
|
// GE 父元素销毁子元素继承逻辑
|
|
@@ -25455,14 +25542,6 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25455
25542
|
return false;
|
|
25456
25543
|
};
|
|
25457
25544
|
_create_class(VFXItem, [
|
|
25458
|
-
{
|
|
25459
|
-
key: "content",
|
|
25460
|
-
get: /**
|
|
25461
|
-
* 返回元素创建的数据
|
|
25462
|
-
*/ function get() {
|
|
25463
|
-
return this._content;
|
|
25464
|
-
}
|
|
25465
|
-
},
|
|
25466
25545
|
{
|
|
25467
25546
|
key: "composition",
|
|
25468
25547
|
get: /**
|
|
@@ -25596,7 +25675,7 @@ var ColorPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
25596
25675
|
}
|
|
25597
25676
|
var colorInc = vecFill(tempColor, 1);
|
|
25598
25677
|
var colorChanged;
|
|
25599
|
-
var life = this.time /
|
|
25678
|
+
var life = this.time / this.getDuration();
|
|
25600
25679
|
var opacityOverLifetime = this.opacityOverLifetime;
|
|
25601
25680
|
var colorOverLifetime = this.colorOverLifetime;
|
|
25602
25681
|
if (colorOverLifetime) {
|
|
@@ -25880,7 +25959,7 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25880
25959
|
_this = MaskableGraphic.call(this, engine) || this;
|
|
25881
25960
|
_this.time = 0;
|
|
25882
25961
|
_this.duration = 0;
|
|
25883
|
-
_this.
|
|
25962
|
+
_this.loop = true;
|
|
25884
25963
|
/**
|
|
25885
25964
|
* @internal
|
|
25886
25965
|
*/ _this.splits = singleSplits;
|
|
@@ -25895,7 +25974,7 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25895
25974
|
var _this = this;
|
|
25896
25975
|
var time = this.time;
|
|
25897
25976
|
var duration = this.duration;
|
|
25898
|
-
if (time > duration && this.
|
|
25977
|
+
if (time > duration && this.loop) {
|
|
25899
25978
|
time = time % duration;
|
|
25900
25979
|
}
|
|
25901
25980
|
var life = Math.min(Math.max(time / duration, 0.0), 1.0);
|
|
@@ -26135,6 +26214,8 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
26135
26214
|
var _data_duration;
|
|
26136
26215
|
//@ts-expect-error
|
|
26137
26216
|
this.duration = (_data_duration = data.duration) != null ? _data_duration : this.item.duration;
|
|
26217
|
+
var _data_loop;
|
|
26218
|
+
this.loop = (_data_loop = data.loop) != null ? _data_loop : true;
|
|
26138
26219
|
};
|
|
26139
26220
|
return SpriteComponent;
|
|
26140
26221
|
}(MaskableGraphic);
|
|
@@ -28887,7 +28968,8 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
28887
28968
|
function TextLayout(options) {
|
|
28888
28969
|
this.width = 0;
|
|
28889
28970
|
this.height = 0;
|
|
28890
|
-
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_textBaseline = options.textBaseline, textBaseline = _options_textBaseline === void 0 ? TextBaseline.top : _options_textBaseline, _options_textAlign = options.textAlign, textAlign = _options_textAlign === void 0 ? TextAlignment.left : _options_textAlign, _options_text = options.text, text = _options_text === void 0 ? " " : _options_text, _options_letterSpace = options.letterSpace, letterSpace = _options_letterSpace === void 0 ? 0 : _options_letterSpace, _options_lineGap = options.lineGap, lineGap = _options_lineGap === void 0 ? 0.571 : _options_lineGap, _options_autoWidth = options.autoWidth, autoWidth = _options_autoWidth === void 0 ? false : _options_autoWidth,
|
|
28971
|
+
var fontSize = options.fontSize, _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_textBaseline = options.textBaseline, textBaseline = _options_textBaseline === void 0 ? TextBaseline.top : _options_textBaseline, _options_textAlign = options.textAlign, textAlign = _options_textAlign === void 0 ? TextAlignment.left : _options_textAlign, _options_text = options.text, text = _options_text === void 0 ? " " : _options_text, _options_letterSpace = options.letterSpace, letterSpace = _options_letterSpace === void 0 ? 0 : _options_letterSpace, _options_lineGap = options.lineGap, lineGap = _options_lineGap === void 0 ? 0.571 : _options_lineGap, _options_autoWidth = options.autoWidth, autoWidth = _options_autoWidth === void 0 ? false : _options_autoWidth, _options_lineHeight = options.lineHeight, lineHeight = _options_lineHeight === void 0 ? fontSize : _options_lineHeight, _options_useLegacyRichText = options.// @ts-expect-error
|
|
28972
|
+
useLegacyRichText, useLegacyRichText = _options_useLegacyRichText === void 0 ? false : _options_useLegacyRichText;
|
|
28891
28973
|
var tempWidth = fontSize + letterSpace;
|
|
28892
28974
|
this.autoWidth = autoWidth;
|
|
28893
28975
|
this.maxTextWidth = text.length * tempWidth;
|
|
@@ -28895,6 +28977,7 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
28895
28977
|
this.height = textHeight;
|
|
28896
28978
|
this.letterSpace = letterSpace;
|
|
28897
28979
|
this.lineGap = lineGap;
|
|
28980
|
+
this.useLegacyRichText = useLegacyRichText;
|
|
28898
28981
|
this.overflow = textOverflow;
|
|
28899
28982
|
this.textBaseline = textBaseline;
|
|
28900
28983
|
this.textAlign = textAlign;
|
|
@@ -28945,6 +29028,38 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
28945
29028
|
return offsetX;
|
|
28946
29029
|
};
|
|
28947
29030
|
/**
|
|
29031
|
+
* 富文本垂直对齐计算
|
|
29032
|
+
* @param style - 字体样式
|
|
29033
|
+
* @param lineHeights - 每行高度数组
|
|
29034
|
+
* @param fontSize - 字体大小
|
|
29035
|
+
* @returns 第一行基线的 Y 坐标
|
|
29036
|
+
*/ _proto.getOffsetYRich = function getOffsetYRich(style, lineHeights, fontSize) {
|
|
29037
|
+
var outlineWidth = style.outlineWidth, fontScale = style.fontScale;
|
|
29038
|
+
var total = lineHeights.reduce(function(a, b) {
|
|
29039
|
+
return a + b;
|
|
29040
|
+
}, 0);
|
|
29041
|
+
// 使用与原始 getOffsetY 相同的经验值计算
|
|
29042
|
+
// /3 计算 Y 轴偏移量,以匹配编辑器行为
|
|
29043
|
+
var offsetY = (lineHeights[0] - fontSize) / 3;
|
|
29044
|
+
// 计算基础偏移量(从画布顶部到第一行基线的距离)
|
|
29045
|
+
var baseOffset = fontSize + outlineWidth * fontScale;
|
|
29046
|
+
// 除第一行外的所有行的总高度
|
|
29047
|
+
var commonCalculation = total - lineHeights[0]; // 使用实际总高度减去第一行高度
|
|
29048
|
+
var offsetResult = 0;
|
|
29049
|
+
switch(this.textBaseline){
|
|
29050
|
+
case TextBaseline.top:
|
|
29051
|
+
offsetResult = baseOffset + offsetY;
|
|
29052
|
+
break;
|
|
29053
|
+
case TextBaseline.middle:
|
|
29054
|
+
offsetResult = (this.height * fontScale - total + this.lineGap * fontScale) / 2 + baseOffset;
|
|
29055
|
+
break;
|
|
29056
|
+
case TextBaseline.bottom:
|
|
29057
|
+
offsetResult = this.height * fontScale - commonCalculation - offsetY;
|
|
29058
|
+
break;
|
|
29059
|
+
}
|
|
29060
|
+
return offsetResult;
|
|
29061
|
+
};
|
|
29062
|
+
/**
|
|
28948
29063
|
* 设置文本框的宽度和高度
|
|
28949
29064
|
* @param width 文本框宽度
|
|
28950
29065
|
* @param height 文本框高度
|
|
@@ -29075,6 +29190,10 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29075
29190
|
MaskableGraphic.prototype.onUpdate.call(this, dt);
|
|
29076
29191
|
this.updateTexture();
|
|
29077
29192
|
};
|
|
29193
|
+
_proto.onDestroy = function onDestroy() {
|
|
29194
|
+
MaskableGraphic.prototype.onDestroy.call(this);
|
|
29195
|
+
this.disposeTextTexture();
|
|
29196
|
+
};
|
|
29078
29197
|
_proto.fromData = function fromData(data) {
|
|
29079
29198
|
MaskableGraphic.prototype.fromData.call(this, data);
|
|
29080
29199
|
var interaction = data.interaction, options = data.options;
|
|
@@ -29111,19 +29230,20 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
29111
29230
|
_proto.getLineCount = function getLineCount(text, init) {
|
|
29112
29231
|
var context = this.context;
|
|
29113
29232
|
var _this_textLayout = this.textLayout, letterSpace = _this_textLayout.letterSpace, overflow = _this_textLayout.overflow;
|
|
29114
|
-
|
|
29233
|
+
// const fontScale = init ? this.textStyle.fontSize / 10 : 1 / this.textStyle.fontScale;
|
|
29234
|
+
this.maxLineWidth = 0;
|
|
29115
29235
|
var width = this.textLayout.width + this.textStyle.fontOffset;
|
|
29116
29236
|
var lineCount = 1;
|
|
29117
29237
|
var x = 0;
|
|
29118
|
-
|
|
29119
|
-
|
|
29120
|
-
|
|
29121
|
-
|
|
29238
|
+
// 设置context.font的字号,确保measureText能正确计算字宽
|
|
29239
|
+
if (context) {
|
|
29240
|
+
context.font = this.getFontDesc(this.textStyle.fontSize);
|
|
29241
|
+
}
|
|
29122
29242
|
for(var i = 0; i < text.length; i++){
|
|
29123
29243
|
var _context_measureText;
|
|
29124
29244
|
var str = text[i];
|
|
29125
29245
|
var _context_measureText_width;
|
|
29126
|
-
var textMetrics = (
|
|
29246
|
+
var textMetrics = (_context_measureText_width = context == null ? void 0 : (_context_measureText = context.measureText(str)) == null ? void 0 : _context_measureText.width) != null ? _context_measureText_width : 0;
|
|
29127
29247
|
// 和浏览器行为保持一致
|
|
29128
29248
|
x += letterSpace;
|
|
29129
29249
|
// 处理文本结束行为
|
|
@@ -29448,10 +29568,17 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
29448
29568
|
wrapS: glContext.CLAMP_TO_EDGE,
|
|
29449
29569
|
wrapT: glContext.CLAMP_TO_EDGE
|
|
29450
29570
|
});
|
|
29571
|
+
this.disposeTextTexture();
|
|
29451
29572
|
this.renderer.texture = texture;
|
|
29452
29573
|
this.material.setTexture("_MainTex", texture);
|
|
29453
29574
|
this.isDirty = false;
|
|
29454
29575
|
};
|
|
29576
|
+
_proto.disposeTextTexture = function disposeTextTexture() {
|
|
29577
|
+
var texture = this.renderer.texture;
|
|
29578
|
+
if (texture && texture !== this.engine.whiteTexture) {
|
|
29579
|
+
texture.dispose();
|
|
29580
|
+
}
|
|
29581
|
+
};
|
|
29455
29582
|
_proto.getFontDesc = function getFontDesc(size) {
|
|
29456
29583
|
var _this_textStyle = this.textStyle, fontSize = _this_textStyle.fontSize, fontScale = _this_textStyle.fontScale, fontFamily = _this_textStyle.fontFamily, textWeight = _this_textStyle.textWeight, fontStyle = _this_textStyle.fontStyle;
|
|
29457
29584
|
var fontDesc = "" + (size || fontSize * fontScale).toString() + "px ";
|
|
@@ -30524,10 +30651,43 @@ function version34Migration(json) {
|
|
|
30524
30651
|
}
|
|
30525
30652
|
}
|
|
30526
30653
|
}
|
|
30654
|
+
// 处理富文本lineGap兼容性
|
|
30655
|
+
processRichTextLineGapCompatibility(json);
|
|
30527
30656
|
//@ts-expect-error
|
|
30528
30657
|
json.version = "3.5";
|
|
30529
30658
|
return json;
|
|
30530
30659
|
}
|
|
30660
|
+
/**
|
|
30661
|
+
* 处理富文本 lineGap 兼容性
|
|
30662
|
+
*/ function processRichTextLineGapCompatibility(json) {
|
|
30663
|
+
if (!json.components) {
|
|
30664
|
+
return;
|
|
30665
|
+
}
|
|
30666
|
+
// 遍历所有组件,处理富文本组件
|
|
30667
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(json.components), _step; !(_step = _iterator()).done;){
|
|
30668
|
+
var component = _step.value;
|
|
30669
|
+
// 识别富文本组件并处理 lineGap 兼容性
|
|
30670
|
+
if (component.dataType === DataType.RichTextComponent && component.options) {
|
|
30671
|
+
ensureRichTextLineGap(component.options);
|
|
30672
|
+
}
|
|
30673
|
+
}
|
|
30674
|
+
}
|
|
30675
|
+
/**
|
|
30676
|
+
* 确保富文本组件有版本标识字段
|
|
30677
|
+
*/ function ensureRichTextLineGap(options) {
|
|
30678
|
+
// 检查是否已经处理过
|
|
30679
|
+
if (!options || options.useLegacyRichText !== undefined) {
|
|
30680
|
+
return;
|
|
30681
|
+
}
|
|
30682
|
+
// 根据是否存在 lineGap 字段来判断版本
|
|
30683
|
+
if (options.lineGap === undefined) {
|
|
30684
|
+
// 旧版本(没有 lineGap 字段)
|
|
30685
|
+
options.useLegacyRichText = true;
|
|
30686
|
+
} else {
|
|
30687
|
+
// 新版本(有 lineGap 字段)
|
|
30688
|
+
options.useLegacyRichText = false;
|
|
30689
|
+
}
|
|
30690
|
+
}
|
|
30531
30691
|
/**
|
|
30532
30692
|
* 根据形状获取形状几何体数据
|
|
30533
30693
|
* @param shape - 形状
|
|
@@ -31450,7 +31610,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31450
31610
|
return ret;
|
|
31451
31611
|
}
|
|
31452
31612
|
|
|
31453
|
-
var version$1 = "2.7.0
|
|
31613
|
+
var version$1 = "2.7.0";
|
|
31454
31614
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31455
31615
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31456
31616
|
var reverseParticle = false;
|
|
@@ -32686,7 +32846,7 @@ function createTextureOptionsBySource(image, sourceFrom, id) {
|
|
|
32686
32846
|
function AssetService(engine) {
|
|
32687
32847
|
this.engine = engine;
|
|
32688
32848
|
this.builtinObjects = [];
|
|
32689
|
-
this.builtinObjects.push(
|
|
32849
|
+
this.builtinObjects.push(engine.whiteTexture);
|
|
32690
32850
|
}
|
|
32691
32851
|
var _proto = AssetService.prototype;
|
|
32692
32852
|
/**
|
|
@@ -34362,7 +34522,7 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
34362
34522
|
this.jsonSceneData = {};
|
|
34363
34523
|
this.objectInstance = {};
|
|
34364
34524
|
this.assetLoader = new AssetLoader(this);
|
|
34365
|
-
this.
|
|
34525
|
+
this.whiteTexture = generateWhiteTexture(this);
|
|
34366
34526
|
this.transparentTexture = generateTransparentTexture(this);
|
|
34367
34527
|
}
|
|
34368
34528
|
var _proto = Engine.prototype;
|
|
@@ -34723,7 +34883,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem);
|
|
|
34723
34883
|
registerPlugin("particle", ParticleLoader, VFXItem);
|
|
34724
34884
|
registerPlugin("cal", CalculateLoader, VFXItem);
|
|
34725
34885
|
registerPlugin("interact", InteractLoader, VFXItem);
|
|
34726
|
-
var version = "2.7.0
|
|
34886
|
+
var version = "2.7.0";
|
|
34727
34887
|
logger.info("Core version: " + version + ".");
|
|
34728
34888
|
|
|
34729
34889
|
export { AbstractPlugin, ActivationMixerPlayable, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AndNode, AndNodeData, Animatable, AnimationClip, AnimationClipNode, AnimationClipNodeData, AnimationGraphAsset, Animator, ApplyAdditiveNode, ApplyAdditiveNodeData, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, BlendNode, BlendNodeData, BoolValueNode, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPlayable, ColorPropertyMixerPlayable, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, ComponentTimePlayable, ComponentTimePlayableAsset, ComponentTimeTrack, Composition, CompositionComponent, ConstBoolNode, ConstBoolNodeData, ConstFloatNode, ConstFloatNodeData, ControlParameterBoolNode, ControlParameterBoolNodeData, ControlParameterFloatNode, ControlParameterFloatNodeData, ControlParameterTriggerNode, ControlParameterTriggerNodeData, DEFAULT_FONTS, DEFAULT_FPS, Database, Deferred, DestroyOptions, Downloader, 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, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, GraphInstance, GraphNode, GraphNodeData, GraphicsPath, GreaterNodeData, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, InvalidIndex, Item, KTXTexture, LayerBlendNode, LayerBlendNodeData, LessNodeData, LineSegments, LinearValue, MaskMode, MaskProcessor, MaskableGraphic, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, NodeTransform, NotNode, NotNodeData, 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, PluginSystem, PolyStar, Polygon, Pose, PoseNode, PostProcessVolume, PropertyClipPlayable, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, 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, SemanticMap, 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, 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, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, curveEps, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getClass, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getNodeDataClass, getParticleMeshShader, getPixelRatio, 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, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, 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, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|