@galacean/effects-threejs 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/index.js +392 -247
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +392 -247
- package/dist/index.mjs.map +1 -1
- package/dist/material/three-material.d.ts +2 -2
- package/dist/three-composition.d.ts +1 -7
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.7.0
|
|
6
|
+
* Version: v2.7.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as THREE from 'three';
|
|
@@ -3660,15 +3660,30 @@ var MaterialBlending;
|
|
|
3660
3660
|
var TextOverflow;
|
|
3661
3661
|
(function(TextOverflow) {
|
|
3662
3662
|
/**
|
|
3663
|
-
*
|
|
3664
|
-
*/ TextOverflow[TextOverflow["
|
|
3663
|
+
* visible 模式下,文本内容超出边界框时,会继续显示内容,不进行裁剪或缩放。
|
|
3664
|
+
*/ TextOverflow[TextOverflow["visible"] = 0] = "visible";
|
|
3665
|
+
/**
|
|
3666
|
+
* display 模式下,会显示所有文本,文本字号大小会根据边界框调整。
|
|
3667
|
+
*/ TextOverflow[TextOverflow["display"] = 1] = "display";
|
|
3665
3668
|
/**
|
|
3666
3669
|
* clip 模式下,当文本内容超出边界框时,多余的会被截断。
|
|
3667
|
-
*/ TextOverflow[TextOverflow["clip"] =
|
|
3670
|
+
*/ TextOverflow[TextOverflow["clip"] = 2] = "clip";
|
|
3668
3671
|
/**
|
|
3669
3672
|
* ellipsis 模式下,会使用(...)来代替超出边界框的内容。
|
|
3670
|
-
*/ TextOverflow[TextOverflow["ellipsis"] =
|
|
3673
|
+
*/ TextOverflow[TextOverflow["ellipsis"] = 3] = "ellipsis";
|
|
3671
3674
|
})(TextOverflow || (TextOverflow = {}));
|
|
3675
|
+
var TextSizeMode;
|
|
3676
|
+
(function(TextSizeMode) {
|
|
3677
|
+
/**
|
|
3678
|
+
* 自适应宽度
|
|
3679
|
+
*/ TextSizeMode[TextSizeMode["autoWidth"] = 0] = "autoWidth";
|
|
3680
|
+
/**
|
|
3681
|
+
* 自适应高度
|
|
3682
|
+
*/ TextSizeMode[TextSizeMode["autoHeight"] = 1] = "autoHeight";
|
|
3683
|
+
/**
|
|
3684
|
+
* 固定宽高
|
|
3685
|
+
*/ TextSizeMode[TextSizeMode["fixed"] = 2] = "fixed";
|
|
3686
|
+
})(TextSizeMode || (TextSizeMode = {}));
|
|
3672
3687
|
var TextBaseline;
|
|
3673
3688
|
(function(TextBaseline) {
|
|
3674
3689
|
/**
|
|
@@ -4010,6 +4025,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
4010
4025
|
get MaterialBlending () { return MaterialBlending; },
|
|
4011
4026
|
get RenderMode3D () { return RenderMode3D; },
|
|
4012
4027
|
get TextOverflow () { return TextOverflow; },
|
|
4028
|
+
get TextSizeMode () { return TextSizeMode; },
|
|
4013
4029
|
get TextBaseline () { return TextBaseline; },
|
|
4014
4030
|
get TextAlignment () { return TextAlignment; },
|
|
4015
4031
|
get TextWeight () { return TextWeight; },
|
|
@@ -4124,10 +4140,16 @@ function getDirectStore(target) {
|
|
|
4124
4140
|
* 反序列化函数
|
|
4125
4141
|
*
|
|
4126
4142
|
* @param data - 对象的序列化的数据
|
|
4127
|
-
*/ _proto.fromData = function fromData(data) {
|
|
4143
|
+
*/ _proto.fromData = function fromData(data) {
|
|
4144
|
+
if (data.id !== undefined) {
|
|
4145
|
+
this.setInstanceId(data.id);
|
|
4146
|
+
}
|
|
4147
|
+
};
|
|
4128
4148
|
/**
|
|
4129
|
-
*
|
|
4130
|
-
*/ _proto.dispose = function dispose() {
|
|
4149
|
+
* 销毁当前对象
|
|
4150
|
+
*/ _proto.dispose = function dispose() {
|
|
4151
|
+
this.engine.removeInstance(this.guid);
|
|
4152
|
+
};
|
|
4131
4153
|
/**
|
|
4132
4154
|
*
|
|
4133
4155
|
* @param obj
|
|
@@ -5221,7 +5243,7 @@ var Pose = /*#__PURE__*/ function() {
|
|
|
5221
5243
|
}
|
|
5222
5244
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(skeleton.defaultColorPropertyValues), _step2; !(_step2 = _iterator2()).done;){
|
|
5223
5245
|
var defaultColor = _step2.value;
|
|
5224
|
-
this.colorPropertyValues.push(defaultColor);
|
|
5246
|
+
this.colorPropertyValues.push(new Color().copyFrom(defaultColor));
|
|
5225
5247
|
}
|
|
5226
5248
|
}
|
|
5227
5249
|
var _proto = Pose.prototype;
|
|
@@ -6696,7 +6718,7 @@ var Skeleton = /*#__PURE__*/ function() {
|
|
|
6696
6718
|
break;
|
|
6697
6719
|
case 1:
|
|
6698
6720
|
this.colorAnimatedObjects.push(animatedObject);
|
|
6699
|
-
this.defaultColorPropertyValues.push(directTarget[lastPropertyName]);
|
|
6721
|
+
this.defaultColorPropertyValues.push(new Color().copyFrom(directTarget[lastPropertyName]));
|
|
6700
6722
|
this.pathToObjectIndex.set(totalPath, this.colorAnimatedObjects.length - 1);
|
|
6701
6723
|
}
|
|
6702
6724
|
};
|
|
@@ -6993,6 +7015,7 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
6993
7015
|
if (this.item) {
|
|
6994
7016
|
removeItem(this.item.components, this);
|
|
6995
7017
|
}
|
|
7018
|
+
EffectsObject.prototype.dispose.call(this);
|
|
6996
7019
|
};
|
|
6997
7020
|
_proto.start = function start() {
|
|
6998
7021
|
if (this.isStartCalled) {
|
|
@@ -12183,9 +12206,8 @@ var seed$8 = 1;
|
|
|
12183
12206
|
this.destroyed = true;
|
|
12184
12207
|
if (this.engine !== undefined) {
|
|
12185
12208
|
this.engine.removeMesh(this);
|
|
12186
|
-
// @ts-expect-error
|
|
12187
|
-
this.engine = undefined;
|
|
12188
12209
|
}
|
|
12210
|
+
RendererComponent.prototype.dispose.call(this);
|
|
12189
12211
|
};
|
|
12190
12212
|
_create_class(Mesh, [
|
|
12191
12213
|
{
|
|
@@ -13341,8 +13363,6 @@ var seed$6 = 1;
|
|
|
13341
13363
|
this.clearAction = clearAction;
|
|
13342
13364
|
this.name = "RenderFrame" + seed$6++;
|
|
13343
13365
|
var firstRP = renderPasses[0];
|
|
13344
|
-
this.emptyTexture = generateWhiteTexture(engine);
|
|
13345
|
-
this.transparentTexture = generateTransparentTexture(engine);
|
|
13346
13366
|
this.camera = camera;
|
|
13347
13367
|
this.keepColorBuffer = keepColorBuffer;
|
|
13348
13368
|
this.renderPassInfoMap.set(firstRP, {
|
|
@@ -13391,8 +13411,6 @@ var seed$6 = 1;
|
|
|
13391
13411
|
}
|
|
13392
13412
|
this.passTextureCache.dispose();
|
|
13393
13413
|
this._renderPasses.length = 0;
|
|
13394
|
-
this.emptyTexture.dispose();
|
|
13395
|
-
this.transparentTexture.dispose();
|
|
13396
13414
|
if (this.resource) {
|
|
13397
13415
|
var _this_resource_depthStencil_texture, _this_resource_depthStencil;
|
|
13398
13416
|
this.resource.color_a.dispose();
|
|
@@ -14052,7 +14070,7 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
14052
14070
|
_this.renderer = {
|
|
14053
14071
|
renderMode: RenderMode.MESH,
|
|
14054
14072
|
blending: BlendingMode.ALPHA,
|
|
14055
|
-
texture: _this.engine.
|
|
14073
|
+
texture: _this.engine.whiteTexture,
|
|
14056
14074
|
occlusion: false,
|
|
14057
14075
|
transparentOcclusion: false,
|
|
14058
14076
|
side: SideMode.DOUBLE,
|
|
@@ -14260,7 +14278,7 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
14260
14278
|
this.renderer = {
|
|
14261
14279
|
renderMode: (_renderer_renderMode = renderer.renderMode) != null ? _renderer_renderMode : RenderMode.MESH,
|
|
14262
14280
|
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
14263
|
-
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.
|
|
14281
|
+
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.whiteTexture,
|
|
14264
14282
|
occlusion: !!renderer.occlusion,
|
|
14265
14283
|
transparentOcclusion: !!renderer.transparentOcclusion || this.maskManager.maskMode === MaskMode.MASK,
|
|
14266
14284
|
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
@@ -16104,20 +16122,26 @@ function oldBezierKeyFramesToNew(props) {
|
|
|
16104
16122
|
keyDatas.push(keyData);
|
|
16105
16123
|
lastControl = p2;
|
|
16106
16124
|
}
|
|
16107
|
-
var
|
|
16125
|
+
var calculateSlope = function(p0, p1) {
|
|
16108
16126
|
return (p1.y - p0.y) / (p1.x - p0.x + NumberEpsilon);
|
|
16109
16127
|
};
|
|
16110
16128
|
for(var i1 = 0; i1 < keyDatas.length; i1++){
|
|
16111
16129
|
var leftControl = keyDatas[i1].leftControl;
|
|
16112
16130
|
var value = keyDatas[i1].value;
|
|
16113
16131
|
var rightControl = keyDatas[i1].rightControl;
|
|
16114
|
-
var
|
|
16115
|
-
var
|
|
16132
|
+
var inSlope = 0;
|
|
16133
|
+
var outSlope = 0;
|
|
16134
|
+
if (i1 > 0) {
|
|
16135
|
+
inSlope = calculateSlope(leftControl, value);
|
|
16136
|
+
}
|
|
16137
|
+
if (i1 < keyDatas.length - 1) {
|
|
16138
|
+
outSlope = calculateSlope(value, rightControl);
|
|
16139
|
+
}
|
|
16116
16140
|
var keyframe = {
|
|
16117
16141
|
time: value.x,
|
|
16118
16142
|
value: value.y,
|
|
16119
|
-
inSlope:
|
|
16120
|
-
outSlope:
|
|
16143
|
+
inSlope: inSlope,
|
|
16144
|
+
outSlope: outSlope,
|
|
16121
16145
|
inWeight: 0,
|
|
16122
16146
|
outWeight: 0,
|
|
16123
16147
|
tangentMode: keyDatas[i1].tangentMode,
|
|
@@ -16254,8 +16278,6 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16254
16278
|
function ShapeComponent(engine) {
|
|
16255
16279
|
var _this;
|
|
16256
16280
|
_this = RendererComponent.call(this, engine) || this;
|
|
16257
|
-
_this.hasStroke = false;
|
|
16258
|
-
_this.hasFill = false;
|
|
16259
16281
|
_this.shapeDirty = true;
|
|
16260
16282
|
_this.materialDirty = true;
|
|
16261
16283
|
_this.graphicsPath = new GraphicsPath();
|
|
@@ -16274,6 +16296,8 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16274
16296
|
/**
|
|
16275
16297
|
* 用于点击测试的碰撞器
|
|
16276
16298
|
*/ _this.meshCollider = new MeshCollider();
|
|
16299
|
+
_this.fillMaterials = [];
|
|
16300
|
+
_this.strokeMaterials = [];
|
|
16277
16301
|
_this.getHitTestParams = function(force) {
|
|
16278
16302
|
var sizeMatrix = Matrix4.fromScale(_this.transform.size.x, _this.transform.size.y, 1);
|
|
16279
16303
|
var worldMatrix = sizeMatrix.premultiply(_this.transform.getWorldMatrix());
|
|
@@ -16285,15 +16309,15 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16285
16309
|
behavior: 0,
|
|
16286
16310
|
type: area.type,
|
|
16287
16311
|
triangles: area.area,
|
|
16288
|
-
backfaceCulling: _this.
|
|
16312
|
+
backfaceCulling: _this.rendererOptions.side === SideMode.FRONT
|
|
16289
16313
|
};
|
|
16290
16314
|
}
|
|
16291
16315
|
}
|
|
16292
16316
|
};
|
|
16293
|
-
_this.
|
|
16317
|
+
_this.rendererOptions = {
|
|
16294
16318
|
renderMode: RenderMode.MESH,
|
|
16295
16319
|
blending: BlendingMode.ALPHA,
|
|
16296
|
-
texture: _this.engine.
|
|
16320
|
+
texture: _this.engine.whiteTexture,
|
|
16297
16321
|
occlusion: false,
|
|
16298
16322
|
transparentOcclusion: false,
|
|
16299
16323
|
side: SideMode.DOUBLE,
|
|
@@ -16381,25 +16405,6 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16381
16405
|
indexCount: 0,
|
|
16382
16406
|
vertexCount: 0
|
|
16383
16407
|
});
|
|
16384
|
-
// Create Material
|
|
16385
|
-
//-------------------------------------------------------------------------
|
|
16386
|
-
var materialProps = {
|
|
16387
|
-
shader: {
|
|
16388
|
-
vertex: vert,
|
|
16389
|
-
fragment: frag,
|
|
16390
|
-
glslVersion: GLSLVersion.GLSL1
|
|
16391
|
-
}
|
|
16392
|
-
};
|
|
16393
|
-
var fillMaterial = Material.create(engine, materialProps);
|
|
16394
|
-
var strokeMaterial = Material.create(engine, materialProps);
|
|
16395
|
-
fillMaterial.depthMask = false;
|
|
16396
|
-
fillMaterial.depthTest = true;
|
|
16397
|
-
fillMaterial.blending = true;
|
|
16398
|
-
_this.material = fillMaterial;
|
|
16399
|
-
strokeMaterial.depthMask = false;
|
|
16400
|
-
strokeMaterial.depthTest = true;
|
|
16401
|
-
strokeMaterial.blending = true;
|
|
16402
|
-
_this.materials[1] = strokeMaterial;
|
|
16403
16408
|
return _this;
|
|
16404
16409
|
}
|
|
16405
16410
|
var _proto = ShapeComponent.prototype;
|
|
@@ -16427,18 +16432,26 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16427
16432
|
if (!this.isActiveAndEnabled) {
|
|
16428
16433
|
return;
|
|
16429
16434
|
}
|
|
16430
|
-
var
|
|
16431
|
-
var
|
|
16432
|
-
|
|
16433
|
-
|
|
16434
|
-
|
|
16435
|
-
|
|
16436
|
-
|
|
16435
|
+
var previousColorMask = false;
|
|
16436
|
+
for(var i = 0; i < this.fillMaterials.length; i++){
|
|
16437
|
+
previousColorMask = this.fillMaterials[i].colorMask;
|
|
16438
|
+
this.fillMaterials[i].colorMask = false;
|
|
16439
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), this.fillMaterials[i], 0);
|
|
16440
|
+
this.fillMaterials[i].colorMask = previousColorMask;
|
|
16441
|
+
}
|
|
16442
|
+
for(var i1 = 0; i1 < this.strokeMaterials.length; i1++){
|
|
16443
|
+
previousColorMask = this.strokeMaterials[i1].colorMask;
|
|
16444
|
+
this.strokeMaterials[i1].colorMask = false;
|
|
16445
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), this.strokeMaterials[i1], 1);
|
|
16446
|
+
this.strokeMaterials[i1].colorMask = previousColorMask;
|
|
16447
|
+
}
|
|
16437
16448
|
};
|
|
16438
16449
|
_proto.draw = function draw(renderer) {
|
|
16439
|
-
for(var i = 0; i < this.
|
|
16440
|
-
|
|
16441
|
-
|
|
16450
|
+
for(var i = 0; i < this.fillMaterials.length; i++){
|
|
16451
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), this.fillMaterials[i], 0);
|
|
16452
|
+
}
|
|
16453
|
+
for(var i1 = 0; i1 < this.strokeMaterials.length; i1++){
|
|
16454
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), this.strokeMaterials[i1], 1);
|
|
16442
16455
|
}
|
|
16443
16456
|
};
|
|
16444
16457
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
@@ -16452,7 +16465,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16452
16465
|
var vertices = [];
|
|
16453
16466
|
var indices = [];
|
|
16454
16467
|
// Triangulate shapePrimitives, build fill and stroke shape geometry
|
|
16455
|
-
if (this.
|
|
16468
|
+
if (this.fills.length > 0) {
|
|
16456
16469
|
for(var _iterator = _create_for_of_iterator_helper_loose(shapePrimitives), _step; !(_step = _iterator()).done;){
|
|
16457
16470
|
var shapePrimitive = _step.value;
|
|
16458
16471
|
var shape = shapePrimitive.shape;
|
|
@@ -16464,7 +16477,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16464
16477
|
}
|
|
16465
16478
|
}
|
|
16466
16479
|
var fillIndexCount = indices.length;
|
|
16467
|
-
if (this.
|
|
16480
|
+
if (this.strokes.length > 0) {
|
|
16468
16481
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(shapePrimitives), _step1; !(_step1 = _iterator1()).done;){
|
|
16469
16482
|
var shapePrimitive1 = _step1.value;
|
|
16470
16483
|
var shape1 = shapePrimitive1.shape;
|
|
@@ -16602,40 +16615,12 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16602
16615
|
}
|
|
16603
16616
|
};
|
|
16604
16617
|
_proto.updateMaterials = function updateMaterials() {
|
|
16605
|
-
for(var
|
|
16606
|
-
|
|
16607
|
-
|
|
16608
|
-
|
|
16609
|
-
|
|
16610
|
-
material.blending = true;
|
|
16611
|
-
material.depthTest = true;
|
|
16612
|
-
material.depthMask = occlusion;
|
|
16613
|
-
material.stencilRef = mask !== undefined ? [
|
|
16614
|
-
mask,
|
|
16615
|
-
mask
|
|
16616
|
-
] : undefined;
|
|
16617
|
-
setBlendMode(material, blendMode);
|
|
16618
|
-
// 兼容旧数据中模板需要渲染的情况
|
|
16619
|
-
setMaskMode(material, maskMode);
|
|
16620
|
-
setSideMode(material, side);
|
|
16621
|
-
material.shader.shaderData.properties = '_MainTex("_MainTex",2D) = "white" {}';
|
|
16622
|
-
material.setVector4("_TexOffset", new Vector4(0, 0, 1, 1));
|
|
16623
|
-
material.setTexture("_MainTex", texture);
|
|
16624
|
-
var preMultiAlpha = getPreMultiAlpha(blendMode);
|
|
16625
|
-
var texParams = new Vector4();
|
|
16626
|
-
texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
|
|
16627
|
-
texParams.y = preMultiAlpha;
|
|
16628
|
-
texParams.z = renderer.renderMode;
|
|
16629
|
-
texParams.w = maskMode;
|
|
16630
|
-
material.setVector4("_TexParams", texParams);
|
|
16631
|
-
if (texParams.x === 0 || this.maskManager.alphaMaskEnabled) {
|
|
16632
|
-
material.enableMacro("ALPHA_CLIP");
|
|
16633
|
-
} else {
|
|
16634
|
-
material.disableMacro("ALPHA_CLIP");
|
|
16635
|
-
}
|
|
16618
|
+
for(var i = 0; i < this.fills.length; i++){
|
|
16619
|
+
this.updatePaintMaterial(this.fillMaterials[i], this.fills[i]);
|
|
16620
|
+
}
|
|
16621
|
+
for(var i1 = 0; i1 < this.strokes.length; i1++){
|
|
16622
|
+
this.updatePaintMaterial(this.strokeMaterials[i1], this.strokes[i1]);
|
|
16636
16623
|
}
|
|
16637
|
-
this.updatePaintMaterial(this.material, this.fills[0]);
|
|
16638
|
-
this.updatePaintMaterial(this.materials[1], this.strokes[0]);
|
|
16639
16624
|
};
|
|
16640
16625
|
_proto.updatePaintMaterial = function updatePaintMaterial(material, paint) {
|
|
16641
16626
|
material.setFloat("_FillType", paint.type);
|
|
@@ -16672,6 +16657,46 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16672
16657
|
material.setVector2("_StartPoint", startPoint);
|
|
16673
16658
|
material.setVector2("_EndPoint", endPoint);
|
|
16674
16659
|
};
|
|
16660
|
+
_proto.createMaterialFromRendererOptions = function createMaterialFromRendererOptions(rendererOptions) {
|
|
16661
|
+
var materialProps = {
|
|
16662
|
+
shader: {
|
|
16663
|
+
vertex: vert,
|
|
16664
|
+
fragment: frag,
|
|
16665
|
+
glslVersion: GLSLVersion.GLSL1
|
|
16666
|
+
}
|
|
16667
|
+
};
|
|
16668
|
+
var material = Material.create(this.engine, materialProps);
|
|
16669
|
+
var renderer = rendererOptions;
|
|
16670
|
+
var side = renderer.side, occlusion = renderer.occlusion, blendMode = renderer.blending, mask = renderer.mask, texture = renderer.texture;
|
|
16671
|
+
var maskMode = this.maskManager.maskMode;
|
|
16672
|
+
material.blending = true;
|
|
16673
|
+
material.depthTest = true;
|
|
16674
|
+
material.depthMask = occlusion;
|
|
16675
|
+
material.stencilRef = mask !== undefined ? [
|
|
16676
|
+
mask,
|
|
16677
|
+
mask
|
|
16678
|
+
] : undefined;
|
|
16679
|
+
setBlendMode(material, blendMode);
|
|
16680
|
+
// 兼容旧数据中模板需要渲染的情况
|
|
16681
|
+
setMaskMode(material, maskMode);
|
|
16682
|
+
setSideMode(material, side);
|
|
16683
|
+
material.shader.shaderData.properties = '_ImageTex("_ImageTex",2D) = "white" {}';
|
|
16684
|
+
material.setVector4("_TexOffset", new Vector4(0, 0, 1, 1));
|
|
16685
|
+
material.setTexture("_ImageTex", texture);
|
|
16686
|
+
var preMultiAlpha = getPreMultiAlpha(blendMode);
|
|
16687
|
+
var texParams = new Vector4();
|
|
16688
|
+
texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
|
|
16689
|
+
texParams.y = preMultiAlpha;
|
|
16690
|
+
texParams.z = renderer.renderMode;
|
|
16691
|
+
texParams.w = maskMode;
|
|
16692
|
+
material.setVector4("_TexParams", texParams);
|
|
16693
|
+
if (texParams.x === 0 || this.maskManager.alphaMaskEnabled) {
|
|
16694
|
+
material.enableMacro("ALPHA_CLIP");
|
|
16695
|
+
} else {
|
|
16696
|
+
material.disableMacro("ALPHA_CLIP");
|
|
16697
|
+
}
|
|
16698
|
+
return material;
|
|
16699
|
+
};
|
|
16675
16700
|
_proto.fromData = function fromData(data) {
|
|
16676
16701
|
RendererComponent.prototype.fromData.call(this, data);
|
|
16677
16702
|
this.shapeDirty = true;
|
|
@@ -16680,11 +16705,11 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16680
16705
|
}
|
|
16681
16706
|
var _data_renderer;
|
|
16682
16707
|
var renderer = (_data_renderer = data.renderer) != null ? _data_renderer : {};
|
|
16683
|
-
var
|
|
16684
|
-
this.
|
|
16685
|
-
renderMode:
|
|
16708
|
+
var _renderer_blending, _renderer_side;
|
|
16709
|
+
this.rendererOptions = {
|
|
16710
|
+
renderMode: RenderMode.MESH,
|
|
16686
16711
|
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
16687
|
-
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.
|
|
16712
|
+
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.whiteTexture,
|
|
16688
16713
|
occlusion: !!renderer.occlusion,
|
|
16689
16714
|
transparentOcclusion: !!renderer.transparentOcclusion || this.maskManager.maskMode === MaskMode.MASK,
|
|
16690
16715
|
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
@@ -16696,22 +16721,21 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16696
16721
|
this.strokeWidth = (_data_strokeWidth = data.strokeWidth) != null ? _data_strokeWidth : 1;
|
|
16697
16722
|
var _data_strokeJoin;
|
|
16698
16723
|
this.strokeJoin = (_data_strokeJoin = data.strokeJoin) != null ? _data_strokeJoin : LineJoin.Miter;
|
|
16699
|
-
|
|
16700
|
-
|
|
16701
|
-
|
|
16702
|
-
|
|
16703
|
-
|
|
16704
|
-
|
|
16705
|
-
|
|
16706
|
-
|
|
16707
|
-
|
|
16708
|
-
|
|
16709
|
-
var
|
|
16710
|
-
|
|
16711
|
-
|
|
16712
|
-
|
|
16713
|
-
|
|
16714
|
-
}
|
|
16724
|
+
this.fills.length = 0;
|
|
16725
|
+
this.fillMaterials.length = 0;
|
|
16726
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(data.fills), _step; !(_step = _iterator()).done;){
|
|
16727
|
+
var fill = _step.value;
|
|
16728
|
+
this.fills.push(this.createPaint(fill));
|
|
16729
|
+
this.fillMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions));
|
|
16730
|
+
}
|
|
16731
|
+
this.strokes.length = 0;
|
|
16732
|
+
this.strokeMaterials.length = 0;
|
|
16733
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(data.strokes), _step1; !(_step1 = _iterator1()).done;){
|
|
16734
|
+
var stroke = _step1.value;
|
|
16735
|
+
this.strokes.push(this.createPaint(stroke));
|
|
16736
|
+
this.strokeMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions));
|
|
16737
|
+
}
|
|
16738
|
+
this.materials = [].concat(this.fillMaterials, this.strokeMaterials);
|
|
16715
16739
|
switch(data.type){
|
|
16716
16740
|
case ShapePrimitiveType.Custom:
|
|
16717
16741
|
{
|
|
@@ -17229,11 +17253,11 @@ var vertex = "\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 u
|
|
|
17229
17253
|
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";
|
|
17230
17254
|
var seed$5 = 1;
|
|
17231
17255
|
var InteractMesh = /*#__PURE__*/ function() {
|
|
17232
|
-
function InteractMesh(props,
|
|
17256
|
+
function InteractMesh(props, transform, engine) {
|
|
17233
17257
|
this.transform = transform;
|
|
17234
17258
|
this.engine = engine;
|
|
17235
17259
|
this.color = props.options.previewColor;
|
|
17236
|
-
var material = this.createMaterial(
|
|
17260
|
+
var material = this.createMaterial();
|
|
17237
17261
|
var geometry = this.createGeometry();
|
|
17238
17262
|
this.mesh = this.createMesh(geometry, material);
|
|
17239
17263
|
this.updateMesh();
|
|
@@ -17256,7 +17280,7 @@ var InteractMesh = /*#__PURE__*/ function() {
|
|
|
17256
17280
|
material.setVector4("uPos", uPos);
|
|
17257
17281
|
material.setQuaternion("uQuat", tempQuat);
|
|
17258
17282
|
};
|
|
17259
|
-
_proto.createMaterial = function createMaterial(
|
|
17283
|
+
_proto.createMaterial = function createMaterial() {
|
|
17260
17284
|
var _this_engine_renderer;
|
|
17261
17285
|
var macros = [
|
|
17262
17286
|
[
|
|
@@ -17270,7 +17294,6 @@ var InteractMesh = /*#__PURE__*/ function() {
|
|
|
17270
17294
|
vertex: vertex,
|
|
17271
17295
|
fragment: fragment,
|
|
17272
17296
|
glslVersion: GLSLVersion.GLSL1,
|
|
17273
|
-
cacheId: "" + rendererOptions.cachePrefix + "_effects_interact",
|
|
17274
17297
|
macros: macros
|
|
17275
17298
|
}
|
|
17276
17299
|
};
|
|
@@ -17392,19 +17415,33 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
17392
17415
|
return _this;
|
|
17393
17416
|
}
|
|
17394
17417
|
var _proto = InteractComponent.prototype;
|
|
17395
|
-
|
|
17418
|
+
/**
|
|
17419
|
+
* 获取拖拽范围 X 轴
|
|
17420
|
+
* @returns 拖拽范围 [min, max]
|
|
17421
|
+
*/ _proto.getDragRangeX = function getDragRangeX() {
|
|
17396
17422
|
return this.dragRange.dxRange;
|
|
17397
17423
|
};
|
|
17398
|
-
|
|
17424
|
+
/**
|
|
17425
|
+
* 设置拖拽范围 X 轴
|
|
17426
|
+
* @param min 最小值
|
|
17427
|
+
* @param max 最大值
|
|
17428
|
+
*/ _proto.setDragRangeX = function setDragRangeX(min, max) {
|
|
17399
17429
|
this.dragRange.dxRange = [
|
|
17400
17430
|
min,
|
|
17401
17431
|
max
|
|
17402
17432
|
];
|
|
17403
17433
|
};
|
|
17404
|
-
|
|
17434
|
+
/**
|
|
17435
|
+
* 获取拖拽范围 Y 轴
|
|
17436
|
+
* @returns 拖拽范围 [min, max]
|
|
17437
|
+
*/ _proto.getDragRangeY = function getDragRangeY() {
|
|
17405
17438
|
return this.dragRange.dyRange;
|
|
17406
17439
|
};
|
|
17407
|
-
|
|
17440
|
+
/**
|
|
17441
|
+
* 设置拖拽范围 Y 轴
|
|
17442
|
+
* @param min 最小值
|
|
17443
|
+
* @param max 最大值
|
|
17444
|
+
*/ _proto.setDragRangeY = function setDragRangeY(min, max) {
|
|
17408
17445
|
this.dragRange.dyRange = [
|
|
17409
17446
|
min,
|
|
17410
17447
|
max
|
|
@@ -17412,15 +17449,11 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
17412
17449
|
};
|
|
17413
17450
|
_proto.onStart = function onStart() {
|
|
17414
17451
|
var env = this.item.engine.renderer.env;
|
|
17415
|
-
var composition = this.item.composition;
|
|
17416
17452
|
var _this_interactData_options = this.interactData.options, type = _this_interactData_options.type, showPreview = _this_interactData_options.showPreview;
|
|
17417
17453
|
if (type === InteractType.CLICK) {
|
|
17418
17454
|
this.clickable = true;
|
|
17419
17455
|
if (showPreview && env === PLAYER_OPTIONS_ENV_EDITOR) {
|
|
17420
|
-
|
|
17421
|
-
if (rendererOptions !== undefined) {
|
|
17422
|
-
this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
|
|
17423
|
-
}
|
|
17456
|
+
this.previewContent = new InteractMesh(this.item.props.content, this.transform, this.engine);
|
|
17424
17457
|
}
|
|
17425
17458
|
}
|
|
17426
17459
|
if (this.previewContent) {
|
|
@@ -17629,7 +17662,10 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
17629
17662
|
}
|
|
17630
17663
|
}
|
|
17631
17664
|
};
|
|
17632
|
-
|
|
17665
|
+
/**
|
|
17666
|
+
* 是否可以交互
|
|
17667
|
+
* @returns
|
|
17668
|
+
*/ _proto.canInteract = function canInteract() {
|
|
17633
17669
|
var _this_item_composition;
|
|
17634
17670
|
return Boolean((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.interactive) && this._interactive;
|
|
17635
17671
|
};
|
|
@@ -17664,7 +17700,9 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
17664
17700
|
get: function get() {
|
|
17665
17701
|
return this._interactive;
|
|
17666
17702
|
},
|
|
17667
|
-
set:
|
|
17703
|
+
set: /**
|
|
17704
|
+
* 是否响应点击和拖拽交互事件
|
|
17705
|
+
*/ function set(enable) {
|
|
17668
17706
|
this._interactive = enable;
|
|
17669
17707
|
if (!enable) {
|
|
17670
17708
|
// 立刻停止惯性滑动
|
|
@@ -18421,6 +18459,12 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
18421
18459
|
this./**
|
|
18422
18460
|
* @internal
|
|
18423
18461
|
*/ transform = new Transform();
|
|
18462
|
+
this./**
|
|
18463
|
+
* 画布的像素宽度
|
|
18464
|
+
*/ pixelWidth = 0;
|
|
18465
|
+
this./**
|
|
18466
|
+
* 画布的像素高度
|
|
18467
|
+
*/ pixelHeight = 0;
|
|
18424
18468
|
this.viewportMatrix = Matrix4.fromIdentity();
|
|
18425
18469
|
this.viewMatrix = Matrix4.fromIdentity();
|
|
18426
18470
|
this.projectionMatrix = Matrix4.fromIdentity();
|
|
@@ -18435,7 +18479,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
18435
18479
|
0,
|
|
18436
18480
|
0,
|
|
18437
18481
|
0
|
|
18438
|
-
] : _options_rotation;
|
|
18482
|
+
] : _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;
|
|
18439
18483
|
var euler = new Euler(rotation[0], rotation[1], rotation[2]);
|
|
18440
18484
|
var quat = new Quaternion().setFromEuler(euler);
|
|
18441
18485
|
this.options = {
|
|
@@ -18445,6 +18489,8 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
18445
18489
|
aspect: aspect,
|
|
18446
18490
|
clipMode: clipMode
|
|
18447
18491
|
};
|
|
18492
|
+
this.pixelWidth = pixelWidth;
|
|
18493
|
+
this.pixelHeight = pixelHeight;
|
|
18448
18494
|
this.transform.setPosition(position[0], position[1], position[2]);
|
|
18449
18495
|
this.transform.setQuaternion(quat.x, quat.y, quat.z, quat.w);
|
|
18450
18496
|
this.dirty = true;
|
|
@@ -18591,6 +18637,48 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
18591
18637
|
this.dirty = false;
|
|
18592
18638
|
}
|
|
18593
18639
|
};
|
|
18640
|
+
/**
|
|
18641
|
+
* 将世界坐标转换为屏幕像素坐标
|
|
18642
|
+
* @param position - 世界坐标
|
|
18643
|
+
* @param out - 输出的屏幕坐标,如果不传则创建新的 Vector3
|
|
18644
|
+
* @returns 屏幕坐标 (x, y 为像素坐标,左下角为(0,0),右上角为(width,height),z 为深度比例 [0,1],0=近平面,1=远平面)
|
|
18645
|
+
*/ _proto.worldToScreenPoint = function worldToScreenPoint(position, out) {
|
|
18646
|
+
this.updateMatrix();
|
|
18647
|
+
var result = out != null ? out : new Vector3();
|
|
18648
|
+
var vpMatrix = this.getViewProjectionMatrix();
|
|
18649
|
+
// 应用视图投影矩阵,得到 NDC 坐标 [-1, 1]
|
|
18650
|
+
result.set(position.x, position.y, position.z);
|
|
18651
|
+
vpMatrix.projectPoint(result, result);
|
|
18652
|
+
// 将 NDC 坐标转换为像素坐标
|
|
18653
|
+
// NDC: x,y in [-1, 1], 其中 (-1,-1) 是左下角,(1,1) 是右上角
|
|
18654
|
+
// Screen: x,y in [0, width/height], 其中 (0,0) 是左下角
|
|
18655
|
+
result.x = (result.x + 1) * 0.5 * this.pixelWidth;
|
|
18656
|
+
result.y = (result.y + 1) * 0.5 * this.pixelHeight;
|
|
18657
|
+
// 将 NDC z 值从 [-1, 1] 转换为深度比例 [0, 1]
|
|
18658
|
+
// -1 (近平面) -> 0, 1 (远平面) -> 1
|
|
18659
|
+
result.z = (result.z + 1) * 0.5;
|
|
18660
|
+
return result;
|
|
18661
|
+
};
|
|
18662
|
+
/**
|
|
18663
|
+
* 将屏幕像素坐标转换为世界坐标
|
|
18664
|
+
* @param position - 屏幕坐标 (x, y 为像素坐标,左下角为(0,0),z 为深度比例 [0,1],0=近平面,1=远平面)
|
|
18665
|
+
* @param out - 输出的世界坐标,如果不传则创建新的 Vector3
|
|
18666
|
+
* @returns 世界坐标
|
|
18667
|
+
*/ _proto.screenToWorldPoint = function screenToWorldPoint(position, out) {
|
|
18668
|
+
this.updateMatrix();
|
|
18669
|
+
var result = out != null ? out : new Vector3();
|
|
18670
|
+
var invVPMatrix = this.getInverseViewProjectionMatrix();
|
|
18671
|
+
// 将像素坐标转换为 NDC 坐标 [-1, 1]
|
|
18672
|
+
var ndcX = position.x / this.pixelWidth * 2 - 1;
|
|
18673
|
+
var ndcY = position.y / this.pixelHeight * 2 - 1;
|
|
18674
|
+
// 将深度比例 [0, 1] 转换为 NDC z 值 [-1, 1]
|
|
18675
|
+
// 0 (近平面) -> -1, 1 (远平面) -> 1
|
|
18676
|
+
var ndcZ = position.z * 2 - 1;
|
|
18677
|
+
// 应用逆视图投影矩阵
|
|
18678
|
+
result.set(ndcX, ndcY, ndcZ);
|
|
18679
|
+
invVPMatrix.projectPoint(result, result);
|
|
18680
|
+
return result;
|
|
18681
|
+
};
|
|
18594
18682
|
_create_class(Camera, [
|
|
18595
18683
|
{
|
|
18596
18684
|
key: "near",
|
|
@@ -21452,7 +21540,6 @@ function modifyMaxKeyframeShader(shader, maxVertex, maxFrag) {
|
|
|
21452
21540
|
var _proto = ParticleSystemRenderer.prototype;
|
|
21453
21541
|
_proto.onStart = function onStart() {
|
|
21454
21542
|
this._priority = this.item.renderOrder;
|
|
21455
|
-
this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);
|
|
21456
21543
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
21457
21544
|
var mesh = _step.value;
|
|
21458
21545
|
mesh.onStart();
|
|
@@ -22413,7 +22500,6 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
22413
22500
|
};
|
|
22414
22501
|
}
|
|
22415
22502
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
22416
|
-
this.item._content = this;
|
|
22417
22503
|
};
|
|
22418
22504
|
_create_class(ParticleSystem, [
|
|
22419
22505
|
{
|
|
@@ -22938,7 +23024,7 @@ var tempPos = new Vector3();
|
|
|
22938
23024
|
*/ _proto.sampleAnimation = function sampleAnimation() {
|
|
22939
23025
|
var _this = this;
|
|
22940
23026
|
var boundItem = this.boundObject;
|
|
22941
|
-
var duration =
|
|
23027
|
+
var duration = this.getDuration();
|
|
22942
23028
|
var life = this.time / duration;
|
|
22943
23029
|
life = life < 0 ? 0 : life > 1 ? 1 : life;
|
|
22944
23030
|
if (this.sizeXOverLifetime) {
|
|
@@ -23408,41 +23494,45 @@ var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
|
23408
23494
|
if (!_instanceof1(boundItem, VFXItem)) {
|
|
23409
23495
|
return;
|
|
23410
23496
|
}
|
|
23411
|
-
var hasActiveTrack = false;
|
|
23412
23497
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.getChildTracks()), _step; !(_step = _iterator()).done;){
|
|
23413
23498
|
var childTrack = _step.value;
|
|
23414
23499
|
if (_instanceof1(childTrack, ActivationTrack)) {
|
|
23415
|
-
|
|
23500
|
+
// 添加粒子动画 clip // TODO 待移除
|
|
23501
|
+
if (boundItem.getComponent(ParticleSystem)) {
|
|
23502
|
+
var particleTrack = timelineAsset.createTrack(ParticleTrack, this, "ParticleTrack");
|
|
23503
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(childTrack.getClips()), _step1; !(_step1 = _iterator1()).done;){
|
|
23504
|
+
var activationClip = _step1.value;
|
|
23505
|
+
var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
|
|
23506
|
+
particleClip.start = activationClip.start;
|
|
23507
|
+
particleClip.duration = activationClip.duration;
|
|
23508
|
+
particleClip.endBehavior = activationClip.endBehavior;
|
|
23509
|
+
}
|
|
23510
|
+
}
|
|
23511
|
+
// 添加图层帧动画动画时间 clip // TODO 待移除
|
|
23512
|
+
if (boundItem.getComponent(SpriteComponent)) {
|
|
23513
|
+
var componentTimeTrack = timelineAsset.createTrack(SpriteComponentTimeTrack, this, "SpriteComponentTimeTrack");
|
|
23514
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(childTrack.getClips()), _step2; !(_step2 = _iterator2()).done;){
|
|
23515
|
+
var activationClip1 = _step2.value;
|
|
23516
|
+
var clip = componentTimeTrack.createClip(ComponentTimePlayableAsset);
|
|
23517
|
+
clip.start = activationClip1.start;
|
|
23518
|
+
clip.duration = activationClip1.duration;
|
|
23519
|
+
clip.endBehavior = activationClip1.endBehavior;
|
|
23520
|
+
}
|
|
23521
|
+
}
|
|
23522
|
+
// 添加图层帧动画动画时间 clip // TODO 待移除
|
|
23523
|
+
if (boundItem.getComponent(EffectComponent)) {
|
|
23524
|
+
var componentTimeTrack1 = timelineAsset.createTrack(EffectComponentTimeTrack, this, "EffectComponentTimeTrack");
|
|
23525
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(childTrack.getClips()), _step3; !(_step3 = _iterator3()).done;){
|
|
23526
|
+
var activationClip2 = _step3.value;
|
|
23527
|
+
var clip1 = componentTimeTrack1.createClip(ComponentTimePlayableAsset);
|
|
23528
|
+
clip1.start = activationClip2.start;
|
|
23529
|
+
clip1.duration = activationClip2.duration;
|
|
23530
|
+
clip1.endBehavior = activationClip2.endBehavior;
|
|
23531
|
+
}
|
|
23532
|
+
}
|
|
23416
23533
|
break;
|
|
23417
23534
|
}
|
|
23418
23535
|
}
|
|
23419
|
-
if (!hasActiveTrack) {
|
|
23420
|
-
return;
|
|
23421
|
-
}
|
|
23422
|
-
// 添加粒子动画 clip // TODO 待移除
|
|
23423
|
-
if (boundItem.getComponent(ParticleSystem)) {
|
|
23424
|
-
var particleTrack = timelineAsset.createTrack(ParticleTrack, this, "ParticleTrack");
|
|
23425
|
-
var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
|
|
23426
|
-
particleClip.start = boundItem.start;
|
|
23427
|
-
particleClip.duration = boundItem.duration;
|
|
23428
|
-
particleClip.endBehavior = boundItem.endBehavior;
|
|
23429
|
-
}
|
|
23430
|
-
// 添加图层帧动画动画时间 clip // TODO 待移除
|
|
23431
|
-
if (boundItem.getComponent(SpriteComponent)) {
|
|
23432
|
-
var componentTimeTrack = timelineAsset.createTrack(SpriteComponentTimeTrack, this, "SpriteComponentTimeTrack");
|
|
23433
|
-
var clip = componentTimeTrack.createClip(ComponentTimePlayableAsset);
|
|
23434
|
-
clip.start = boundItem.start;
|
|
23435
|
-
clip.duration = boundItem.duration;
|
|
23436
|
-
clip.endBehavior = boundItem.endBehavior;
|
|
23437
|
-
}
|
|
23438
|
-
// 添加图层帧动画动画时间 clip // TODO 待移除
|
|
23439
|
-
if (boundItem.getComponent(EffectComponent)) {
|
|
23440
|
-
var componentTimeTrack1 = timelineAsset.createTrack(EffectComponentTimeTrack, this, "EffectComponentTimeTrack");
|
|
23441
|
-
var clip1 = componentTimeTrack1.createClip(ComponentTimePlayableAsset);
|
|
23442
|
-
clip1.start = boundItem.start;
|
|
23443
|
-
clip1.duration = boundItem.duration;
|
|
23444
|
-
clip1.endBehavior = boundItem.endBehavior;
|
|
23445
|
-
}
|
|
23446
23536
|
};
|
|
23447
23537
|
return ObjectBindingTrack;
|
|
23448
23538
|
}(TrackAsset);
|
|
@@ -24227,13 +24317,14 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24227
24317
|
_this.pluginSystem = scene.pluginSystem;
|
|
24228
24318
|
_this.pluginSystem.initializeComposition(_assert_this_initialized(_this), scene);
|
|
24229
24319
|
_this.camera = new Camera(_this.name, _extends({}, sourceContent == null ? void 0 : sourceContent.camera, {
|
|
24230
|
-
aspect: width / height
|
|
24320
|
+
aspect: width / height,
|
|
24321
|
+
pixelWidth: width,
|
|
24322
|
+
pixelHeight: height
|
|
24231
24323
|
}));
|
|
24232
24324
|
_this.url = scene.url;
|
|
24233
24325
|
_this.interactive = true;
|
|
24234
24326
|
_this.handleItemMessage = handleItemMessage;
|
|
24235
24327
|
_this.createRenderFrame();
|
|
24236
|
-
_this.rendererOptions = null;
|
|
24237
24328
|
Composition.buildItemTree(_this.rootItem);
|
|
24238
24329
|
_this.rootComposition.setChildrenRenderOrder(0);
|
|
24239
24330
|
_this.pluginSystem.resetComposition(_assert_this_initialized(_this), _this.renderFrame);
|
|
@@ -24289,9 +24380,11 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24289
24380
|
this.restart();
|
|
24290
24381
|
}
|
|
24291
24382
|
if (this.rootComposition.isStartCalled) {
|
|
24292
|
-
this.
|
|
24383
|
+
this.setTime(this.time - this.startTime);
|
|
24384
|
+
this.resume();
|
|
24293
24385
|
} else {
|
|
24294
|
-
this.
|
|
24386
|
+
this.setTime(0);
|
|
24387
|
+
this.resume();
|
|
24295
24388
|
}
|
|
24296
24389
|
};
|
|
24297
24390
|
/**
|
|
@@ -24323,6 +24416,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24323
24416
|
* @param time - 相对 startTime 的时间
|
|
24324
24417
|
*/ _proto.gotoAndPlay = function gotoAndPlay(time) {
|
|
24325
24418
|
this.setTime(time);
|
|
24419
|
+
this.emit("goto", {
|
|
24420
|
+
time: time
|
|
24421
|
+
});
|
|
24326
24422
|
this.resume();
|
|
24327
24423
|
};
|
|
24328
24424
|
/**
|
|
@@ -24330,6 +24426,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24330
24426
|
* @param time - 相对 startTime 的时间
|
|
24331
24427
|
*/ _proto.gotoAndStop = function gotoAndStop(time) {
|
|
24332
24428
|
this.setTime(time);
|
|
24429
|
+
this.emit("goto", {
|
|
24430
|
+
time: time
|
|
24431
|
+
});
|
|
24333
24432
|
this.pause();
|
|
24334
24433
|
};
|
|
24335
24434
|
/**
|
|
@@ -24360,9 +24459,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24360
24459
|
if (pause) {
|
|
24361
24460
|
this.paused = true;
|
|
24362
24461
|
}
|
|
24363
|
-
this.emit("goto", {
|
|
24364
|
-
time: time
|
|
24365
|
-
});
|
|
24366
24462
|
};
|
|
24367
24463
|
_proto.addItem = function addItem(item) {
|
|
24368
24464
|
this.items.push(item);
|
|
@@ -24394,7 +24490,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24394
24490
|
/**
|
|
24395
24491
|
* 重置状态函数
|
|
24396
24492
|
*/ _proto.reset = function reset() {
|
|
24397
|
-
this.rendererOptions = null;
|
|
24398
24493
|
this.isEnded = false;
|
|
24399
24494
|
this.isEndCalled = false;
|
|
24400
24495
|
this.rootComposition.time = 0;
|
|
@@ -24420,9 +24515,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24420
24515
|
if (this.getPaused()) {
|
|
24421
24516
|
return;
|
|
24422
24517
|
}
|
|
24423
|
-
//
|
|
24518
|
+
// Scene VFXItem components lifetime function
|
|
24424
24519
|
if (!this.rootItem.isDuringPlay) {
|
|
24425
|
-
this.
|
|
24520
|
+
this.rootItem.awake();
|
|
24426
24521
|
this.rootItem.beginPlay();
|
|
24427
24522
|
}
|
|
24428
24523
|
var previousCompositionTime = this.time;
|
|
@@ -24447,19 +24542,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24447
24542
|
_proto.shouldDispose = function shouldDispose() {
|
|
24448
24543
|
return this.isEnded && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
|
|
24449
24544
|
};
|
|
24450
|
-
_proto.callAwake = function callAwake(item) {
|
|
24451
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
24452
|
-
var component = _step.value;
|
|
24453
|
-
if (!component.isAwakeCalled) {
|
|
24454
|
-
component.onAwake();
|
|
24455
|
-
component.isAwakeCalled = true;
|
|
24456
|
-
}
|
|
24457
|
-
}
|
|
24458
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.children), _step1; !(_step1 = _iterator1()).done;){
|
|
24459
|
-
var child = _step1.value;
|
|
24460
|
-
this.callAwake(child);
|
|
24461
|
-
}
|
|
24462
|
-
};
|
|
24463
24545
|
/**
|
|
24464
24546
|
* 更新相机
|
|
24465
24547
|
* @override
|
|
@@ -24548,7 +24630,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24548
24630
|
return (_this_renderer = this.renderer) == null ? void 0 : _this_renderer.engine;
|
|
24549
24631
|
};
|
|
24550
24632
|
/**
|
|
24551
|
-
* Item 求交测试,返回求交结果列表,x 和 y 是归一化到[-1, 1]
|
|
24633
|
+
* Item 求交测试,返回求交结果列表,x 和 y 是归一化到[-1, 1]区间的值,x 向右,y 向上
|
|
24552
24634
|
* @param x - 鼠标或触点的 x,已经归一化到[-1, 1]
|
|
24553
24635
|
* @param y - 鼠标或触点的 y,已经归一化到[-1, 1]
|
|
24554
24636
|
* @param force - 是否强制求交,没有交互信息的 Item 也要进行求交测试
|
|
@@ -24647,7 +24729,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24647
24729
|
* 合成对象销毁
|
|
24648
24730
|
*/ _proto.dispose = function dispose() {
|
|
24649
24731
|
var _this = this;
|
|
24650
|
-
var
|
|
24732
|
+
var _this_pluginSystem;
|
|
24651
24733
|
if (this.destroyed) {
|
|
24652
24734
|
return;
|
|
24653
24735
|
}
|
|
@@ -24667,7 +24749,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24667
24749
|
this.rootItem.dispose();
|
|
24668
24750
|
// FIXME: 注意这里增加了renderFrame销毁
|
|
24669
24751
|
this.renderFrame.dispose();
|
|
24670
|
-
(_this_rendererOptions = this.rendererOptions) == null ? void 0 : _this_rendererOptions.emptyTexture.dispose();
|
|
24671
24752
|
(_this_pluginSystem = this.pluginSystem) == null ? void 0 : _this_pluginSystem.destroyComposition(this);
|
|
24672
24753
|
this.update = function() {
|
|
24673
24754
|
{
|
|
@@ -24764,15 +24845,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24764
24845
|
this.textureOffloaded = true;
|
|
24765
24846
|
}
|
|
24766
24847
|
};
|
|
24767
|
-
_proto.getRendererOptions = function getRendererOptions() {
|
|
24768
|
-
if (!this.rendererOptions) {
|
|
24769
|
-
this.rendererOptions = {
|
|
24770
|
-
emptyTexture: this.renderFrame.emptyTexture,
|
|
24771
|
-
cachePrefix: "-"
|
|
24772
|
-
};
|
|
24773
|
-
}
|
|
24774
|
-
return this.rendererOptions;
|
|
24775
|
-
};
|
|
24776
24848
|
/**
|
|
24777
24849
|
* 重新加载纹理
|
|
24778
24850
|
*/ _proto.reloadTexture = function reloadTexture() {
|
|
@@ -24886,7 +24958,9 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
24886
24958
|
function VFXItem(engine, props) {
|
|
24887
24959
|
var _this;
|
|
24888
24960
|
_this = EffectsObject.call(this, engine) || this;
|
|
24889
|
-
|
|
24961
|
+
/**
|
|
24962
|
+
* 元素的子元素列表
|
|
24963
|
+
*/ _this.children = [];
|
|
24890
24964
|
/**
|
|
24891
24965
|
* 元素的变换包含位置、旋转、缩放。
|
|
24892
24966
|
*/ _this.transform = new Transform();
|
|
@@ -24897,9 +24971,6 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
24897
24971
|
* 元素动画的持续时间
|
|
24898
24972
|
*/ _this.duration = 0;
|
|
24899
24973
|
/**
|
|
24900
|
-
* 元素动画的开始时间
|
|
24901
|
-
*/ _this.start = 0;
|
|
24902
|
-
/**
|
|
24903
24974
|
* 元素动画结束时行为(如何处理元素)
|
|
24904
24975
|
*/ _this.endBehavior = EndBehavior.forward;
|
|
24905
24976
|
_this.type = ItemType.base;
|
|
@@ -25019,6 +25090,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25019
25090
|
this.composition = vfxItem.composition;
|
|
25020
25091
|
}
|
|
25021
25092
|
if (!this.isDuringPlay && vfxItem.isDuringPlay) {
|
|
25093
|
+
this.awake();
|
|
25022
25094
|
this.beginPlay();
|
|
25023
25095
|
}
|
|
25024
25096
|
};
|
|
@@ -25194,6 +25266,21 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25194
25266
|
};
|
|
25195
25267
|
/**
|
|
25196
25268
|
* @internal
|
|
25269
|
+
*/ _proto.awake = function awake() {
|
|
25270
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
25271
|
+
var component = _step.value;
|
|
25272
|
+
if (!component.isAwakeCalled) {
|
|
25273
|
+
component.onAwake();
|
|
25274
|
+
component.isAwakeCalled = true;
|
|
25275
|
+
}
|
|
25276
|
+
}
|
|
25277
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.children), _step1; !(_step1 = _iterator1()).done;){
|
|
25278
|
+
var child = _step1.value;
|
|
25279
|
+
child.awake();
|
|
25280
|
+
}
|
|
25281
|
+
};
|
|
25282
|
+
/**
|
|
25283
|
+
* @internal
|
|
25197
25284
|
*/ _proto.onActiveChanged = function onActiveChanged() {
|
|
25198
25285
|
if (!this.isEnabled) {
|
|
25199
25286
|
this.onEnable();
|
|
@@ -25232,12 +25319,11 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25232
25319
|
};
|
|
25233
25320
|
_proto.fromData = function fromData(data) {
|
|
25234
25321
|
EffectsObject.prototype.fromData.call(this, data);
|
|
25235
|
-
var id = data.id, name = data.name,
|
|
25322
|
+
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;
|
|
25236
25323
|
this.props = data;
|
|
25237
25324
|
this.type = data.type;
|
|
25238
25325
|
this.id = id.toString(); // TODO 老数据 id 是 number,需要转换
|
|
25239
25326
|
this.name = name;
|
|
25240
|
-
this.start = delay ? delay : this.start;
|
|
25241
25327
|
if (transform) {
|
|
25242
25328
|
this.transform.fromData(transform);
|
|
25243
25329
|
}
|
|
@@ -25271,6 +25357,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25271
25357
|
if (VFXItem.isComposition(this)) {
|
|
25272
25358
|
this.instantiatePreComposition();
|
|
25273
25359
|
}
|
|
25360
|
+
this.setVisible(visible);
|
|
25274
25361
|
};
|
|
25275
25362
|
_proto.toData = function toData() {
|
|
25276
25363
|
var _this_parent;
|
|
@@ -25314,10 +25401,10 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25314
25401
|
component.dispose();
|
|
25315
25402
|
}
|
|
25316
25403
|
this.components = [];
|
|
25317
|
-
this._content = undefined;
|
|
25318
25404
|
this._composition = null;
|
|
25319
25405
|
this.transform.setValid(false);
|
|
25320
25406
|
}
|
|
25407
|
+
EffectsObject.prototype.dispose.call(this);
|
|
25321
25408
|
};
|
|
25322
25409
|
_proto.resetChildrenParent = function resetChildrenParent() {
|
|
25323
25410
|
// GE 父元素销毁子元素继承逻辑
|
|
@@ -25457,14 +25544,6 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25457
25544
|
return false;
|
|
25458
25545
|
};
|
|
25459
25546
|
_create_class(VFXItem, [
|
|
25460
|
-
{
|
|
25461
|
-
key: "content",
|
|
25462
|
-
get: /**
|
|
25463
|
-
* 返回元素创建的数据
|
|
25464
|
-
*/ function get() {
|
|
25465
|
-
return this._content;
|
|
25466
|
-
}
|
|
25467
|
-
},
|
|
25468
25547
|
{
|
|
25469
25548
|
key: "composition",
|
|
25470
25549
|
get: /**
|
|
@@ -25598,7 +25677,7 @@ var ColorPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
25598
25677
|
}
|
|
25599
25678
|
var colorInc = vecFill(tempColor, 1);
|
|
25600
25679
|
var colorChanged;
|
|
25601
|
-
var life = this.time /
|
|
25680
|
+
var life = this.time / this.getDuration();
|
|
25602
25681
|
var opacityOverLifetime = this.opacityOverLifetime;
|
|
25603
25682
|
var colorOverLifetime = this.colorOverLifetime;
|
|
25604
25683
|
if (colorOverLifetime) {
|
|
@@ -25882,7 +25961,7 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25882
25961
|
_this = MaskableGraphic.call(this, engine) || this;
|
|
25883
25962
|
_this.time = 0;
|
|
25884
25963
|
_this.duration = 0;
|
|
25885
|
-
_this.
|
|
25964
|
+
_this.loop = true;
|
|
25886
25965
|
/**
|
|
25887
25966
|
* @internal
|
|
25888
25967
|
*/ _this.splits = singleSplits;
|
|
@@ -25897,7 +25976,7 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25897
25976
|
var _this = this;
|
|
25898
25977
|
var time = this.time;
|
|
25899
25978
|
var duration = this.duration;
|
|
25900
|
-
if (time > duration && this.
|
|
25979
|
+
if (time > duration && this.loop) {
|
|
25901
25980
|
time = time % duration;
|
|
25902
25981
|
}
|
|
25903
25982
|
var life = Math.min(Math.max(time / duration, 0.0), 1.0);
|
|
@@ -26137,6 +26216,8 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
26137
26216
|
var _data_duration;
|
|
26138
26217
|
//@ts-expect-error
|
|
26139
26218
|
this.duration = (_data_duration = data.duration) != null ? _data_duration : this.item.duration;
|
|
26219
|
+
var _data_loop;
|
|
26220
|
+
this.loop = (_data_loop = data.loop) != null ? _data_loop : true;
|
|
26140
26221
|
};
|
|
26141
26222
|
return SpriteComponent;
|
|
26142
26223
|
}(MaskableGraphic);
|
|
@@ -28889,7 +28970,8 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
28889
28970
|
function TextLayout(options) {
|
|
28890
28971
|
this.width = 0;
|
|
28891
28972
|
this.height = 0;
|
|
28892
|
-
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,
|
|
28973
|
+
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
|
|
28974
|
+
useLegacyRichText, useLegacyRichText = _options_useLegacyRichText === void 0 ? false : _options_useLegacyRichText;
|
|
28893
28975
|
var tempWidth = fontSize + letterSpace;
|
|
28894
28976
|
this.autoWidth = autoWidth;
|
|
28895
28977
|
this.maxTextWidth = text.length * tempWidth;
|
|
@@ -28897,6 +28979,7 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
28897
28979
|
this.height = textHeight;
|
|
28898
28980
|
this.letterSpace = letterSpace;
|
|
28899
28981
|
this.lineGap = lineGap;
|
|
28982
|
+
this.useLegacyRichText = useLegacyRichText;
|
|
28900
28983
|
this.overflow = textOverflow;
|
|
28901
28984
|
this.textBaseline = textBaseline;
|
|
28902
28985
|
this.textAlign = textAlign;
|
|
@@ -28947,6 +29030,38 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
28947
29030
|
return offsetX;
|
|
28948
29031
|
};
|
|
28949
29032
|
/**
|
|
29033
|
+
* 富文本垂直对齐计算
|
|
29034
|
+
* @param style - 字体样式
|
|
29035
|
+
* @param lineHeights - 每行高度数组
|
|
29036
|
+
* @param fontSize - 字体大小
|
|
29037
|
+
* @returns 第一行基线的 Y 坐标
|
|
29038
|
+
*/ _proto.getOffsetYRich = function getOffsetYRich(style, lineHeights, fontSize) {
|
|
29039
|
+
var outlineWidth = style.outlineWidth, fontScale = style.fontScale;
|
|
29040
|
+
var total = lineHeights.reduce(function(a, b) {
|
|
29041
|
+
return a + b;
|
|
29042
|
+
}, 0);
|
|
29043
|
+
// 使用与原始 getOffsetY 相同的经验值计算
|
|
29044
|
+
// /3 计算 Y 轴偏移量,以匹配编辑器行为
|
|
29045
|
+
var offsetY = (lineHeights[0] - fontSize) / 3;
|
|
29046
|
+
// 计算基础偏移量(从画布顶部到第一行基线的距离)
|
|
29047
|
+
var baseOffset = fontSize + outlineWidth * fontScale;
|
|
29048
|
+
// 除第一行外的所有行的总高度
|
|
29049
|
+
var commonCalculation = total - lineHeights[0]; // 使用实际总高度减去第一行高度
|
|
29050
|
+
var offsetResult = 0;
|
|
29051
|
+
switch(this.textBaseline){
|
|
29052
|
+
case TextBaseline.top:
|
|
29053
|
+
offsetResult = baseOffset + offsetY;
|
|
29054
|
+
break;
|
|
29055
|
+
case TextBaseline.middle:
|
|
29056
|
+
offsetResult = (this.height * fontScale - total + this.lineGap * fontScale) / 2 + baseOffset;
|
|
29057
|
+
break;
|
|
29058
|
+
case TextBaseline.bottom:
|
|
29059
|
+
offsetResult = this.height * fontScale - commonCalculation - offsetY;
|
|
29060
|
+
break;
|
|
29061
|
+
}
|
|
29062
|
+
return offsetResult;
|
|
29063
|
+
};
|
|
29064
|
+
/**
|
|
28950
29065
|
* 设置文本框的宽度和高度
|
|
28951
29066
|
* @param width 文本框宽度
|
|
28952
29067
|
* @param height 文本框高度
|
|
@@ -29077,6 +29192,10 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29077
29192
|
MaskableGraphic.prototype.onUpdate.call(this, dt);
|
|
29078
29193
|
this.updateTexture();
|
|
29079
29194
|
};
|
|
29195
|
+
_proto.onDestroy = function onDestroy() {
|
|
29196
|
+
MaskableGraphic.prototype.onDestroy.call(this);
|
|
29197
|
+
this.disposeTextTexture();
|
|
29198
|
+
};
|
|
29080
29199
|
_proto.fromData = function fromData(data) {
|
|
29081
29200
|
MaskableGraphic.prototype.fromData.call(this, data);
|
|
29082
29201
|
var interaction = data.interaction, options = data.options;
|
|
@@ -29113,19 +29232,20 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
29113
29232
|
_proto.getLineCount = function getLineCount(text, init) {
|
|
29114
29233
|
var context = this.context;
|
|
29115
29234
|
var _this_textLayout = this.textLayout, letterSpace = _this_textLayout.letterSpace, overflow = _this_textLayout.overflow;
|
|
29116
|
-
|
|
29235
|
+
// const fontScale = init ? this.textStyle.fontSize / 10 : 1 / this.textStyle.fontScale;
|
|
29236
|
+
this.maxLineWidth = 0;
|
|
29117
29237
|
var width = this.textLayout.width + this.textStyle.fontOffset;
|
|
29118
29238
|
var lineCount = 1;
|
|
29119
29239
|
var x = 0;
|
|
29120
|
-
|
|
29121
|
-
|
|
29122
|
-
|
|
29123
|
-
|
|
29240
|
+
// 设置context.font的字号,确保measureText能正确计算字宽
|
|
29241
|
+
if (context) {
|
|
29242
|
+
context.font = this.getFontDesc(this.textStyle.fontSize);
|
|
29243
|
+
}
|
|
29124
29244
|
for(var i = 0; i < text.length; i++){
|
|
29125
29245
|
var _context_measureText;
|
|
29126
29246
|
var str = text[i];
|
|
29127
29247
|
var _context_measureText_width;
|
|
29128
|
-
var textMetrics = (
|
|
29248
|
+
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;
|
|
29129
29249
|
// 和浏览器行为保持一致
|
|
29130
29250
|
x += letterSpace;
|
|
29131
29251
|
// 处理文本结束行为
|
|
@@ -29450,10 +29570,17 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
29450
29570
|
wrapS: glContext.CLAMP_TO_EDGE,
|
|
29451
29571
|
wrapT: glContext.CLAMP_TO_EDGE
|
|
29452
29572
|
});
|
|
29573
|
+
this.disposeTextTexture();
|
|
29453
29574
|
this.renderer.texture = texture;
|
|
29454
29575
|
this.material.setTexture("_MainTex", texture);
|
|
29455
29576
|
this.isDirty = false;
|
|
29456
29577
|
};
|
|
29578
|
+
_proto.disposeTextTexture = function disposeTextTexture() {
|
|
29579
|
+
var texture = this.renderer.texture;
|
|
29580
|
+
if (texture && texture !== this.engine.whiteTexture) {
|
|
29581
|
+
texture.dispose();
|
|
29582
|
+
}
|
|
29583
|
+
};
|
|
29457
29584
|
_proto.getFontDesc = function getFontDesc(size) {
|
|
29458
29585
|
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;
|
|
29459
29586
|
var fontDesc = "" + (size || fontSize * fontScale).toString() + "px ";
|
|
@@ -30526,10 +30653,43 @@ function version34Migration(json) {
|
|
|
30526
30653
|
}
|
|
30527
30654
|
}
|
|
30528
30655
|
}
|
|
30656
|
+
// 处理富文本lineGap兼容性
|
|
30657
|
+
processRichTextLineGapCompatibility(json);
|
|
30529
30658
|
//@ts-expect-error
|
|
30530
30659
|
json.version = "3.5";
|
|
30531
30660
|
return json;
|
|
30532
30661
|
}
|
|
30662
|
+
/**
|
|
30663
|
+
* 处理富文本 lineGap 兼容性
|
|
30664
|
+
*/ function processRichTextLineGapCompatibility(json) {
|
|
30665
|
+
if (!json.components) {
|
|
30666
|
+
return;
|
|
30667
|
+
}
|
|
30668
|
+
// 遍历所有组件,处理富文本组件
|
|
30669
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(json.components), _step; !(_step = _iterator()).done;){
|
|
30670
|
+
var component = _step.value;
|
|
30671
|
+
// 识别富文本组件并处理 lineGap 兼容性
|
|
30672
|
+
if (component.dataType === DataType.RichTextComponent && component.options) {
|
|
30673
|
+
ensureRichTextLineGap(component.options);
|
|
30674
|
+
}
|
|
30675
|
+
}
|
|
30676
|
+
}
|
|
30677
|
+
/**
|
|
30678
|
+
* 确保富文本组件有版本标识字段
|
|
30679
|
+
*/ function ensureRichTextLineGap(options) {
|
|
30680
|
+
// 检查是否已经处理过
|
|
30681
|
+
if (!options || options.useLegacyRichText !== undefined) {
|
|
30682
|
+
return;
|
|
30683
|
+
}
|
|
30684
|
+
// 根据是否存在 lineGap 字段来判断版本
|
|
30685
|
+
if (options.lineGap === undefined) {
|
|
30686
|
+
// 旧版本(没有 lineGap 字段)
|
|
30687
|
+
options.useLegacyRichText = true;
|
|
30688
|
+
} else {
|
|
30689
|
+
// 新版本(有 lineGap 字段)
|
|
30690
|
+
options.useLegacyRichText = false;
|
|
30691
|
+
}
|
|
30692
|
+
}
|
|
30533
30693
|
/**
|
|
30534
30694
|
* 根据形状获取形状几何体数据
|
|
30535
30695
|
* @param shape - 形状
|
|
@@ -31452,7 +31612,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31452
31612
|
return ret;
|
|
31453
31613
|
}
|
|
31454
31614
|
|
|
31455
|
-
var version$2 = "2.7.0
|
|
31615
|
+
var version$2 = "2.7.0";
|
|
31456
31616
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31457
31617
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31458
31618
|
var reverseParticle = false;
|
|
@@ -32688,7 +32848,7 @@ function createTextureOptionsBySource(image, sourceFrom, id) {
|
|
|
32688
32848
|
function AssetService(engine) {
|
|
32689
32849
|
this.engine = engine;
|
|
32690
32850
|
this.builtinObjects = [];
|
|
32691
|
-
this.builtinObjects.push(
|
|
32851
|
+
this.builtinObjects.push(engine.whiteTexture);
|
|
32692
32852
|
}
|
|
32693
32853
|
var _proto = AssetService.prototype;
|
|
32694
32854
|
/**
|
|
@@ -34364,7 +34524,7 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
34364
34524
|
this.jsonSceneData = {};
|
|
34365
34525
|
this.objectInstance = {};
|
|
34366
34526
|
this.assetLoader = new AssetLoader(this);
|
|
34367
|
-
this.
|
|
34527
|
+
this.whiteTexture = generateWhiteTexture(this);
|
|
34368
34528
|
this.transparentTexture = generateTransparentTexture(this);
|
|
34369
34529
|
}
|
|
34370
34530
|
var _proto = Engine.prototype;
|
|
@@ -34725,7 +34885,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem);
|
|
|
34725
34885
|
registerPlugin("particle", ParticleLoader, VFXItem);
|
|
34726
34886
|
registerPlugin("cal", CalculateLoader, VFXItem);
|
|
34727
34887
|
registerPlugin("interact", InteractLoader, VFXItem);
|
|
34728
|
-
var version$1 = "2.7.0
|
|
34888
|
+
var version$1 = "2.7.0";
|
|
34729
34889
|
logger.info("Core version: " + version$1 + ".");
|
|
34730
34890
|
|
|
34731
34891
|
var _obj;
|
|
@@ -35044,12 +35204,13 @@ var _obj3;
|
|
|
35044
35204
|
//FIXME: 暂时不实现
|
|
35045
35205
|
throw new Error("Method not implemented.");
|
|
35046
35206
|
};
|
|
35047
|
-
_proto.dispose = function dispose(
|
|
35048
|
-
if (
|
|
35207
|
+
_proto.dispose = function dispose() {
|
|
35208
|
+
if (this.destroyed) {
|
|
35049
35209
|
return;
|
|
35050
35210
|
}
|
|
35051
35211
|
this.material.dispose();
|
|
35052
35212
|
this.destroyed = true;
|
|
35213
|
+
Material.prototype.dispose.call(this);
|
|
35053
35214
|
};
|
|
35054
35215
|
_create_class(ThreeMaterial, [
|
|
35055
35216
|
{
|
|
@@ -35536,6 +35697,7 @@ var seed = 1;
|
|
|
35536
35697
|
}
|
|
35537
35698
|
this.geometry.dispose();
|
|
35538
35699
|
this.destroyed = true;
|
|
35700
|
+
Geometry.prototype.dispose.call(this);
|
|
35539
35701
|
};
|
|
35540
35702
|
_proto.setAttributeType = function setAttributeType(name, attr, geometry, attributes, maxCount) {
|
|
35541
35703
|
var _attr_stride = attr.stride, stride = _attr_stride === void 0 ? 0 : _attr_stride, size = attr.size, offset = attr.offset, normalize = attr.normalize, _attr_type = attr.type, type = _attr_type === void 0 ? glContext.FLOAT : _attr_type;
|
|
@@ -35677,6 +35839,7 @@ var seed = 1;
|
|
|
35677
35839
|
this.mesh.clear();
|
|
35678
35840
|
this.destroyed = true;
|
|
35679
35841
|
}
|
|
35842
|
+
Mesh.prototype.dispose.call(this);
|
|
35680
35843
|
};
|
|
35681
35844
|
_create_class(ThreeMesh, [
|
|
35682
35845
|
{
|
|
@@ -35764,6 +35927,7 @@ var seed = 1;
|
|
|
35764
35927
|
* 释放纹理占用的内存
|
|
35765
35928
|
*/ _proto.dispose = function dispose() {
|
|
35766
35929
|
this.texture.dispose();
|
|
35930
|
+
Texture.prototype.dispose.call(this);
|
|
35767
35931
|
};
|
|
35768
35932
|
/**
|
|
35769
35933
|
* 通过图层设置创建贴图
|
|
@@ -35903,25 +36067,6 @@ var seed = 1;
|
|
|
35903
36067
|
}
|
|
35904
36068
|
}
|
|
35905
36069
|
};
|
|
35906
|
-
/**
|
|
35907
|
-
* 获取 render 参数
|
|
35908
|
-
*
|
|
35909
|
-
* @returns
|
|
35910
|
-
*/ _proto.getRendererOptions = function getRendererOptions() {
|
|
35911
|
-
var emptyTexture = ThreeTexture.createWithData(this.renderer.engine, {
|
|
35912
|
-
data: new Uint8Array(4).fill(255),
|
|
35913
|
-
width: 1,
|
|
35914
|
-
height: 1
|
|
35915
|
-
});
|
|
35916
|
-
emptyTexture.texture.needsUpdate = true;
|
|
35917
|
-
if (!this.rendererOptions) {
|
|
35918
|
-
this.rendererOptions = {
|
|
35919
|
-
emptyTexture: emptyTexture,
|
|
35920
|
-
cachePrefix: "-"
|
|
35921
|
-
};
|
|
35922
|
-
}
|
|
35923
|
-
return this.rendererOptions;
|
|
35924
|
-
};
|
|
35925
36070
|
return ThreeComposition;
|
|
35926
36071
|
}(Composition);
|
|
35927
36072
|
/**
|
|
@@ -36163,10 +36308,10 @@ var ThreeSpriteComponent = /*#__PURE__*/ function(SpriteComponent) {
|
|
|
36163
36308
|
* 销毁方法
|
|
36164
36309
|
*
|
|
36165
36310
|
*/ _proto.dispose = function dispose() {
|
|
36166
|
-
SpriteComponent.prototype.dispose.call(this);
|
|
36167
36311
|
if (!this.isActiveAndEnabled) {
|
|
36168
36312
|
this.threeMesh.clear();
|
|
36169
36313
|
}
|
|
36314
|
+
SpriteComponent.prototype.dispose.call(this);
|
|
36170
36315
|
};
|
|
36171
36316
|
_proto.fromData = function fromData(data) {
|
|
36172
36317
|
SpriteComponent.prototype.fromData.call(this, data);
|
|
@@ -36321,7 +36466,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
36321
36466
|
*/ Mesh.create = function(engine, props) {
|
|
36322
36467
|
return new ThreeMesh(engine, props);
|
|
36323
36468
|
};
|
|
36324
|
-
var version = "2.7.0
|
|
36469
|
+
var version = "2.7.0";
|
|
36325
36470
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
36326
36471
|
|
|
36327
36472
|
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, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, 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, TEXTURE_UNIFORM_MAP, TangentMode, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TexturePaintScaleMode, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelineInstance, TrackAsset, TrackMixerPlayable, TrackType, Transform, TransformMixerPlayable, TransformPlayable, TransformPlayableAsset, TransformTrack, TransitionNode, TransitionNodeData, TransitionState, 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, setUniformValue, sortByOrder, index$1 as spec, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|