@galacean/effects-threejs 2.7.0-alpha.1 → 2.7.0-beta.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 +459 -296
- 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 +460 -297
- 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-beta.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
|
/**
|
|
@@ -3732,20 +3747,21 @@ var BuiltinObjectGUID = {
|
|
|
3732
3747
|
UnlitShader: "unlit000000000000000000000000000"
|
|
3733
3748
|
};
|
|
3734
3749
|
|
|
3735
|
-
|
|
3736
|
-
* 填充类型
|
|
3737
|
-
*/ var FillType$1;
|
|
3750
|
+
var FillType;
|
|
3738
3751
|
(function(FillType) {
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3752
|
+
FillType[FillType["Solid"] = 0] = "Solid";
|
|
3753
|
+
FillType[FillType["GradientLinear"] = 1] = "GradientLinear";
|
|
3754
|
+
FillType[FillType["GradientRadial"] = 2] = "GradientRadial";
|
|
3755
|
+
FillType[FillType["GradientAngular"] = 3] = "GradientAngular";
|
|
3756
|
+
FillType[FillType["Texture"] = 4] = "Texture";
|
|
3757
|
+
})(FillType || (FillType = {}));
|
|
3758
|
+
var TexturePaintScaleMode$1;
|
|
3759
|
+
(function(TexturePaintScaleMode) {
|
|
3760
|
+
TexturePaintScaleMode[TexturePaintScaleMode["Fill"] = 0] = "Fill";
|
|
3761
|
+
TexturePaintScaleMode[TexturePaintScaleMode["Fit"] = 1] = "Fit";
|
|
3762
|
+
TexturePaintScaleMode[TexturePaintScaleMode["Crop"] = 2] = "Crop";
|
|
3763
|
+
TexturePaintScaleMode[TexturePaintScaleMode["Tile"] = 3] = "Tile";
|
|
3764
|
+
})(TexturePaintScaleMode$1 || (TexturePaintScaleMode$1 = {}));
|
|
3749
3765
|
|
|
3750
3766
|
/**
|
|
3751
3767
|
* 矢量图形类型
|
|
@@ -4009,12 +4025,14 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
4009
4025
|
get MaterialBlending () { return MaterialBlending; },
|
|
4010
4026
|
get RenderMode3D () { return RenderMode3D; },
|
|
4011
4027
|
get TextOverflow () { return TextOverflow; },
|
|
4028
|
+
get TextSizeMode () { return TextSizeMode; },
|
|
4012
4029
|
get TextBaseline () { return TextBaseline; },
|
|
4013
4030
|
get TextAlignment () { return TextAlignment; },
|
|
4014
4031
|
get TextWeight () { return TextWeight; },
|
|
4015
4032
|
get FontStyle () { return FontStyle; },
|
|
4016
4033
|
BuiltinObjectGUID: BuiltinObjectGUID,
|
|
4017
|
-
get FillType () { return FillType
|
|
4034
|
+
get FillType () { return FillType; },
|
|
4035
|
+
get TexturePaintScaleMode () { return TexturePaintScaleMode$1; },
|
|
4018
4036
|
get ShapePrimitiveType () { return ShapePrimitiveType; },
|
|
4019
4037
|
get LineCap () { return LineCap; },
|
|
4020
4038
|
get LineJoin () { return LineJoin; },
|
|
@@ -4122,10 +4140,16 @@ function getDirectStore(target) {
|
|
|
4122
4140
|
* 反序列化函数
|
|
4123
4141
|
*
|
|
4124
4142
|
* @param data - 对象的序列化的数据
|
|
4125
|
-
*/ _proto.fromData = function fromData(data) {
|
|
4143
|
+
*/ _proto.fromData = function fromData(data) {
|
|
4144
|
+
if (data.id !== undefined) {
|
|
4145
|
+
this.setInstanceId(data.id);
|
|
4146
|
+
}
|
|
4147
|
+
};
|
|
4126
4148
|
/**
|
|
4127
|
-
*
|
|
4128
|
-
*/ _proto.dispose = function dispose() {
|
|
4149
|
+
* 销毁当前对象
|
|
4150
|
+
*/ _proto.dispose = function dispose() {
|
|
4151
|
+
this.engine.removeInstance(this.guid);
|
|
4152
|
+
};
|
|
4129
4153
|
/**
|
|
4130
4154
|
*
|
|
4131
4155
|
* @param obj
|
|
@@ -5219,7 +5243,7 @@ var Pose = /*#__PURE__*/ function() {
|
|
|
5219
5243
|
}
|
|
5220
5244
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(skeleton.defaultColorPropertyValues), _step2; !(_step2 = _iterator2()).done;){
|
|
5221
5245
|
var defaultColor = _step2.value;
|
|
5222
|
-
this.colorPropertyValues.push(defaultColor);
|
|
5246
|
+
this.colorPropertyValues.push(new Color().copyFrom(defaultColor));
|
|
5223
5247
|
}
|
|
5224
5248
|
}
|
|
5225
5249
|
var _proto = Pose.prototype;
|
|
@@ -6694,7 +6718,7 @@ var Skeleton = /*#__PURE__*/ function() {
|
|
|
6694
6718
|
break;
|
|
6695
6719
|
case 1:
|
|
6696
6720
|
this.colorAnimatedObjects.push(animatedObject);
|
|
6697
|
-
this.defaultColorPropertyValues.push(directTarget[lastPropertyName]);
|
|
6721
|
+
this.defaultColorPropertyValues.push(new Color().copyFrom(directTarget[lastPropertyName]));
|
|
6698
6722
|
this.pathToObjectIndex.set(totalPath, this.colorAnimatedObjects.length - 1);
|
|
6699
6723
|
}
|
|
6700
6724
|
};
|
|
@@ -6991,6 +7015,7 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
6991
7015
|
if (this.item) {
|
|
6992
7016
|
removeItem(this.item.components, this);
|
|
6993
7017
|
}
|
|
7018
|
+
EffectsObject.prototype.dispose.call(this);
|
|
6994
7019
|
};
|
|
6995
7020
|
_proto.start = function start() {
|
|
6996
7021
|
if (this.isStartCalled) {
|
|
@@ -12181,9 +12206,8 @@ var seed$8 = 1;
|
|
|
12181
12206
|
this.destroyed = true;
|
|
12182
12207
|
if (this.engine !== undefined) {
|
|
12183
12208
|
this.engine.removeMesh(this);
|
|
12184
|
-
// @ts-expect-error
|
|
12185
|
-
this.engine = undefined;
|
|
12186
12209
|
}
|
|
12210
|
+
RendererComponent.prototype.dispose.call(this);
|
|
12187
12211
|
};
|
|
12188
12212
|
_create_class(Mesh, [
|
|
12189
12213
|
{
|
|
@@ -13339,8 +13363,6 @@ var seed$6 = 1;
|
|
|
13339
13363
|
this.clearAction = clearAction;
|
|
13340
13364
|
this.name = "RenderFrame" + seed$6++;
|
|
13341
13365
|
var firstRP = renderPasses[0];
|
|
13342
|
-
this.emptyTexture = generateWhiteTexture(engine);
|
|
13343
|
-
this.transparentTexture = generateTransparentTexture(engine);
|
|
13344
13366
|
this.camera = camera;
|
|
13345
13367
|
this.keepColorBuffer = keepColorBuffer;
|
|
13346
13368
|
this.renderPassInfoMap.set(firstRP, {
|
|
@@ -13389,8 +13411,6 @@ var seed$6 = 1;
|
|
|
13389
13411
|
}
|
|
13390
13412
|
this.passTextureCache.dispose();
|
|
13391
13413
|
this._renderPasses.length = 0;
|
|
13392
|
-
this.emptyTexture.dispose();
|
|
13393
|
-
this.transparentTexture.dispose();
|
|
13394
13414
|
if (this.resource) {
|
|
13395
13415
|
var _this_resource_depthStencil_texture, _this_resource_depthStencil;
|
|
13396
13416
|
this.resource.color_a.dispose();
|
|
@@ -14050,7 +14070,7 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
14050
14070
|
_this.renderer = {
|
|
14051
14071
|
renderMode: RenderMode.MESH,
|
|
14052
14072
|
blending: BlendingMode.ALPHA,
|
|
14053
|
-
texture: _this.engine.
|
|
14073
|
+
texture: _this.engine.whiteTexture,
|
|
14054
14074
|
occlusion: false,
|
|
14055
14075
|
transparentOcclusion: false,
|
|
14056
14076
|
side: SideMode.DOUBLE,
|
|
@@ -14258,7 +14278,7 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
14258
14278
|
this.renderer = {
|
|
14259
14279
|
renderMode: (_renderer_renderMode = renderer.renderMode) != null ? _renderer_renderMode : RenderMode.MESH,
|
|
14260
14280
|
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
14261
|
-
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.
|
|
14281
|
+
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.whiteTexture,
|
|
14262
14282
|
occlusion: !!renderer.occlusion,
|
|
14263
14283
|
transparentOcclusion: !!renderer.transparentOcclusion || this.maskManager.maskMode === MaskMode.MASK,
|
|
14264
14284
|
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
@@ -16102,20 +16122,26 @@ function oldBezierKeyFramesToNew(props) {
|
|
|
16102
16122
|
keyDatas.push(keyData);
|
|
16103
16123
|
lastControl = p2;
|
|
16104
16124
|
}
|
|
16105
|
-
var
|
|
16125
|
+
var calculateSlope = function(p0, p1) {
|
|
16106
16126
|
return (p1.y - p0.y) / (p1.x - p0.x + NumberEpsilon);
|
|
16107
16127
|
};
|
|
16108
16128
|
for(var i1 = 0; i1 < keyDatas.length; i1++){
|
|
16109
16129
|
var leftControl = keyDatas[i1].leftControl;
|
|
16110
16130
|
var value = keyDatas[i1].value;
|
|
16111
16131
|
var rightControl = keyDatas[i1].rightControl;
|
|
16112
|
-
var
|
|
16113
|
-
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
|
+
}
|
|
16114
16140
|
var keyframe = {
|
|
16115
16141
|
time: value.x,
|
|
16116
16142
|
value: value.y,
|
|
16117
|
-
inSlope:
|
|
16118
|
-
outSlope:
|
|
16143
|
+
inSlope: inSlope,
|
|
16144
|
+
outSlope: outSlope,
|
|
16119
16145
|
inWeight: 0,
|
|
16120
16146
|
outWeight: 0,
|
|
16121
16147
|
tangentMode: keyDatas[i1].tangentMode,
|
|
@@ -16238,16 +16264,8 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
16238
16264
|
|
|
16239
16265
|
var vert = "precision highp float;attribute vec3 aPos;attribute vec2 aUV;varying vec2 uv0;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;void main(){vec4 pos=vec4(aPos.xyz,1.0);uv0=aUV;gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}";
|
|
16240
16266
|
|
|
16241
|
-
var frag = "precision highp float;\n#define _MAX_STOPS 8\n#define PI 3.14159265359\nuniform vec4 _Color;uniform vec4 _Colors[_MAX_STOPS];uniform float _Stops[_MAX_STOPS];uniform int _StopsCount;uniform float _FillType;uniform vec2 _StartPoint;uniform vec2 _EndPoint;uniform sampler2D _ImageTex;uniform vec2 _ImageSize;uniform vec2 _DestSize;uniform int _ImageScaleMode;uniform mat3
|
|
16267
|
+
var frag = "precision highp float;\n#define _MAX_STOPS 8\n#define PI 3.14159265359\nuniform vec4 _Color;uniform vec4 _Colors[_MAX_STOPS];uniform float _Stops[_MAX_STOPS];uniform int _StopsCount;uniform float _FillType;uniform vec2 _StartPoint;uniform vec2 _EndPoint;uniform sampler2D _ImageTex;uniform vec2 _ImageSize;uniform vec2 _DestSize;uniform int _ImageScaleMode;uniform mat3 _TextureTransform;uniform float _ImageScalingFactor;uniform float _ImageOpacity;varying vec2 uv0;vec4 smoothMix(vec4 a,vec4 b,float t){return mix(a,b,smoothstep(0.0,1.0,t));}float calculateAngleRatio(vec2 v1,vec2 v2){float angle=atan(v2.y,v2.x)-atan(v1.y,v1.x);if(angle<0.0)angle+=2.0*PI;return angle/(2.0*PI);}vec2 applyTransform(mat3 m,vec2 uv){uv=uv-vec2(0.5,0.5);vec3 p=m*vec3(uv,1.0);p.xy=p.xy+vec2(0.5,0.5);return p.xy;}void main(){vec4 finalColor=vec4(1.0);if(_FillType==0.0){finalColor=_Color;}else if(_FillType==1.0||_FillType==2.0||_FillType==3.0){float t=0.0;if(_FillType==1.0){vec2 gradientVector=_EndPoint-_StartPoint;vec2 pixelVector=uv0-_StartPoint;float denom=max(dot(gradientVector,gradientVector),1e-6);t=clamp(dot(pixelVector,gradientVector)/denom,0.0,1.0);}else if(_FillType==2.0){float maxRadius=max(distance(_EndPoint,_StartPoint),0.001);t=clamp(distance(uv0,_StartPoint)/maxRadius,0.0,1.0);}else{vec2 center=_StartPoint;vec2 referenceVector=_EndPoint-center;vec2 targetVector=uv0-center;if(length(targetVector)>0.001){t=calculateAngleRatio(referenceVector,targetVector);}}finalColor=_Colors[0];for(int i=1;i<_MAX_STOPS;i++){if(i>=_StopsCount)break;float prevStop=_Stops[i-1];float currStop=_Stops[i];if(t>=prevStop&&t<=currStop){float localT=(t-prevStop)/max(currStop-prevStop,1e-6);finalColor=smoothMix(_Colors[i-1],_Colors[i],localT);break;}}}else if(_FillType==4.0){vec2 uv=uv0;float rSrc=_ImageSize.x/max(_ImageSize.y,1.0);float rDst=_DestSize.x/max(_DestSize.y,1.0);bool maskOutside=false;if(_ImageScaleMode==0){vec2 scale=vec2(1.0);if(rDst>rSrc){scale=vec2(1.0,rSrc/rDst);}else{scale=vec2(rDst/rSrc,1.0);}uv=(uv-0.5)*scale+0.5;uv=clamp(uv,0.0,1.0);}else if(_ImageScaleMode==1){vec2 scale=vec2(1.0);if(rDst>rSrc){scale=vec2(rSrc/rDst,1.0);}else{scale=vec2(1.0,rSrc/rDst);}uv=(uv-0.5)*scale+0.5;maskOutside=true;}else if(_ImageScaleMode==2){uv=applyTransform(_TextureTransform,uv0);maskOutside=true;}else if(_ImageScaleMode==3){float aspectFix=rDst/max(rSrc,1e-6);vec2 uvTile=(uv0-0.5)*vec2(aspectFix,1.0)+0.5;float s=max(abs(_ImageScalingFactor),1e-6);uv=fract(uvTile*s);}vec4 img=texture2D(_ImageTex,uv);if(maskOutside){if(uv.x<0.0||uv.x>1.0||uv.y<0.0||uv.y>1.0){img.a=0.0;}}img.a*=_ImageOpacity;finalColor=img;}finalColor.rgb*=finalColor.a;gl_FragColor=finalColor;}";
|
|
16242
16268
|
|
|
16243
|
-
var FillType;
|
|
16244
|
-
(function(FillType) {
|
|
16245
|
-
FillType[FillType["Solid"] = 0] = "Solid";
|
|
16246
|
-
FillType[FillType["GradientLinear"] = 1] = "GradientLinear";
|
|
16247
|
-
FillType[FillType["GradientRadial"] = 2] = "GradientRadial";
|
|
16248
|
-
FillType[FillType["GradientAngular"] = 3] = "GradientAngular";
|
|
16249
|
-
FillType[FillType["Texture"] = 4] = "Texture";
|
|
16250
|
-
})(FillType || (FillType = {}));
|
|
16251
16269
|
var TexturePaintScaleMode;
|
|
16252
16270
|
(function(TexturePaintScaleMode) {
|
|
16253
16271
|
TexturePaintScaleMode[TexturePaintScaleMode["Fill"] = 0] = "Fill";
|
|
@@ -16260,8 +16278,6 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16260
16278
|
function ShapeComponent(engine) {
|
|
16261
16279
|
var _this;
|
|
16262
16280
|
_this = RendererComponent.call(this, engine) || this;
|
|
16263
|
-
_this.hasStroke = false;
|
|
16264
|
-
_this.hasFill = false;
|
|
16265
16281
|
_this.shapeDirty = true;
|
|
16266
16282
|
_this.materialDirty = true;
|
|
16267
16283
|
_this.graphicsPath = new GraphicsPath();
|
|
@@ -16273,10 +16289,15 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16273
16289
|
join: LineJoin.Miter,
|
|
16274
16290
|
miterLimit: 10
|
|
16275
16291
|
};
|
|
16292
|
+
_this.strokeWidth = 1;
|
|
16293
|
+
_this.strokeCap = LineCap.Butt;
|
|
16294
|
+
_this.strokeJoin = LineJoin.Miter;
|
|
16276
16295
|
_this.strokes = [];
|
|
16277
16296
|
/**
|
|
16278
16297
|
* 用于点击测试的碰撞器
|
|
16279
16298
|
*/ _this.meshCollider = new MeshCollider();
|
|
16299
|
+
_this.fillMaterials = [];
|
|
16300
|
+
_this.strokeMaterials = [];
|
|
16280
16301
|
_this.getHitTestParams = function(force) {
|
|
16281
16302
|
var sizeMatrix = Matrix4.fromScale(_this.transform.size.x, _this.transform.size.y, 1);
|
|
16282
16303
|
var worldMatrix = sizeMatrix.premultiply(_this.transform.getWorldMatrix());
|
|
@@ -16288,15 +16309,15 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16288
16309
|
behavior: 0,
|
|
16289
16310
|
type: area.type,
|
|
16290
16311
|
triangles: area.area,
|
|
16291
|
-
backfaceCulling: _this.
|
|
16312
|
+
backfaceCulling: _this.rendererOptions.side === SideMode.FRONT
|
|
16292
16313
|
};
|
|
16293
16314
|
}
|
|
16294
16315
|
}
|
|
16295
16316
|
};
|
|
16296
|
-
_this.
|
|
16317
|
+
_this.rendererOptions = {
|
|
16297
16318
|
renderMode: RenderMode.MESH,
|
|
16298
16319
|
blending: BlendingMode.ALPHA,
|
|
16299
|
-
texture: _this.engine.
|
|
16320
|
+
texture: _this.engine.whiteTexture,
|
|
16300
16321
|
occlusion: false,
|
|
16301
16322
|
transparentOcclusion: false,
|
|
16302
16323
|
side: SideMode.DOUBLE,
|
|
@@ -16306,12 +16327,12 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16306
16327
|
// Create Shape Attrributes
|
|
16307
16328
|
//-------------------------------------------------------------------------
|
|
16308
16329
|
var gradientStrokeFill = {
|
|
16309
|
-
type:
|
|
16330
|
+
type: FillType.Solid,
|
|
16310
16331
|
color: new Color(1, 1, 1, 1)
|
|
16311
16332
|
};
|
|
16312
16333
|
_this.strokes.push(gradientStrokeFill);
|
|
16313
16334
|
var gradientLayerFill = {
|
|
16314
|
-
type:
|
|
16335
|
+
type: FillType.Solid,
|
|
16315
16336
|
color: new Color(1, 1, 1, 1)
|
|
16316
16337
|
};
|
|
16317
16338
|
_this.fills.push(gradientLayerFill);
|
|
@@ -16384,25 +16405,6 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16384
16405
|
indexCount: 0,
|
|
16385
16406
|
vertexCount: 0
|
|
16386
16407
|
});
|
|
16387
|
-
// Create Material
|
|
16388
|
-
//-------------------------------------------------------------------------
|
|
16389
|
-
var materialProps = {
|
|
16390
|
-
shader: {
|
|
16391
|
-
vertex: vert,
|
|
16392
|
-
fragment: frag,
|
|
16393
|
-
glslVersion: GLSLVersion.GLSL1
|
|
16394
|
-
}
|
|
16395
|
-
};
|
|
16396
|
-
var fillMaterial = Material.create(engine, materialProps);
|
|
16397
|
-
var strokeMaterial = Material.create(engine, materialProps);
|
|
16398
|
-
fillMaterial.depthMask = false;
|
|
16399
|
-
fillMaterial.depthTest = true;
|
|
16400
|
-
fillMaterial.blending = true;
|
|
16401
|
-
_this.material = fillMaterial;
|
|
16402
|
-
strokeMaterial.depthMask = false;
|
|
16403
|
-
strokeMaterial.depthTest = true;
|
|
16404
|
-
strokeMaterial.blending = true;
|
|
16405
|
-
_this.materials[1] = strokeMaterial;
|
|
16406
16408
|
return _this;
|
|
16407
16409
|
}
|
|
16408
16410
|
var _proto = ShapeComponent.prototype;
|
|
@@ -16430,18 +16432,26 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16430
16432
|
if (!this.isActiveAndEnabled) {
|
|
16431
16433
|
return;
|
|
16432
16434
|
}
|
|
16433
|
-
var
|
|
16434
|
-
var
|
|
16435
|
-
|
|
16436
|
-
|
|
16437
|
-
|
|
16438
|
-
|
|
16439
|
-
|
|
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
|
+
}
|
|
16440
16448
|
};
|
|
16441
16449
|
_proto.draw = function draw(renderer) {
|
|
16442
|
-
for(var i = 0; i < this.
|
|
16443
|
-
|
|
16444
|
-
|
|
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);
|
|
16445
16455
|
}
|
|
16446
16456
|
};
|
|
16447
16457
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
@@ -16455,7 +16465,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16455
16465
|
var vertices = [];
|
|
16456
16466
|
var indices = [];
|
|
16457
16467
|
// Triangulate shapePrimitives, build fill and stroke shape geometry
|
|
16458
|
-
if (this.
|
|
16468
|
+
if (this.fills.length > 0) {
|
|
16459
16469
|
for(var _iterator = _create_for_of_iterator_helper_loose(shapePrimitives), _step; !(_step = _iterator()).done;){
|
|
16460
16470
|
var shapePrimitive = _step.value;
|
|
16461
16471
|
var shape = shapePrimitive.shape;
|
|
@@ -16467,7 +16477,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16467
16477
|
}
|
|
16468
16478
|
}
|
|
16469
16479
|
var fillIndexCount = indices.length;
|
|
16470
|
-
if (this.
|
|
16480
|
+
if (this.strokes.length > 0) {
|
|
16471
16481
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(shapePrimitives), _step1; !(_step1 = _iterator1()).done;){
|
|
16472
16482
|
var shapePrimitive1 = _step1.value;
|
|
16473
16483
|
var shape1 = shapePrimitive1.shape;
|
|
@@ -16475,6 +16485,9 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16475
16485
|
indices.length;
|
|
16476
16486
|
var vertOffset1 = vertices.length / 2;
|
|
16477
16487
|
var lineStyle = this.strokeAttributes;
|
|
16488
|
+
lineStyle.cap = this.strokeCap;
|
|
16489
|
+
lineStyle.join = this.strokeJoin;
|
|
16490
|
+
lineStyle.width = this.strokeWidth;
|
|
16478
16491
|
var close = true;
|
|
16479
16492
|
if (this.shapeAttributes.type === ShapePrimitiveType.Custom) {
|
|
16480
16493
|
close = shape1.closePath;
|
|
@@ -16602,48 +16615,20 @@ 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);
|
|
16642
|
-
if (paint.type ===
|
|
16627
|
+
if (paint.type === FillType.Solid) {
|
|
16643
16628
|
material.color = paint.color;
|
|
16644
|
-
} else if (paint.type ===
|
|
16629
|
+
} else if (paint.type === FillType.GradientLinear || paint.type === FillType.GradientAngular || paint.type === FillType.GradientRadial) {
|
|
16645
16630
|
this.updateGradientMaterial(material, paint.gradientStops, paint.startPoint, paint.endPoint);
|
|
16646
|
-
} else if (paint.type ===
|
|
16631
|
+
} else if (paint.type === FillType.Texture) {
|
|
16647
16632
|
material.setInt("_ImageScaleMode", paint.scaleMode);
|
|
16648
16633
|
material.setVector2("_ImageSize", new Vector2(paint.texture.getWidth(), paint.texture.getHeight()));
|
|
16649
16634
|
var boundingBox = this.getBoundingBox();
|
|
@@ -16653,6 +16638,8 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16653
16638
|
material.setFloat("_ImageOpacity", paint.opacity);
|
|
16654
16639
|
material.setFloat("_ImageScalingFactor", paint.scalingFactor);
|
|
16655
16640
|
material.setTexture("_ImageTex", paint.texture);
|
|
16641
|
+
var transform = paint.textureTransform;
|
|
16642
|
+
material.setMatrix3("_TextureTransform", new Matrix3().scale(transform.scale.x, transform.scale.y).rotate(transform.rotation).translate(transform.offset.x, transform.offset.y).invert());
|
|
16656
16643
|
}
|
|
16657
16644
|
};
|
|
16658
16645
|
_proto.updateGradientMaterial = function updateGradientMaterial(material, gradient, startPoint, endPoint) {
|
|
@@ -16670,6 +16657,46 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16670
16657
|
material.setVector2("_StartPoint", startPoint);
|
|
16671
16658
|
material.setVector2("_EndPoint", endPoint);
|
|
16672
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
|
+
};
|
|
16673
16700
|
_proto.fromData = function fromData(data) {
|
|
16674
16701
|
RendererComponent.prototype.fromData.call(this, data);
|
|
16675
16702
|
this.shapeDirty = true;
|
|
@@ -16678,44 +16705,37 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16678
16705
|
}
|
|
16679
16706
|
var _data_renderer;
|
|
16680
16707
|
var renderer = (_data_renderer = data.renderer) != null ? _data_renderer : {};
|
|
16681
|
-
var
|
|
16682
|
-
this.
|
|
16683
|
-
renderMode:
|
|
16708
|
+
var _renderer_blending, _renderer_side;
|
|
16709
|
+
this.rendererOptions = {
|
|
16710
|
+
renderMode: RenderMode.MESH,
|
|
16684
16711
|
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
16685
|
-
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.
|
|
16712
|
+
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.whiteTexture,
|
|
16686
16713
|
occlusion: !!renderer.occlusion,
|
|
16687
16714
|
transparentOcclusion: !!renderer.transparentOcclusion || this.maskManager.maskMode === MaskMode.MASK,
|
|
16688
16715
|
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
16689
16716
|
mask: this.maskManager.getRefValue()
|
|
16690
16717
|
};
|
|
16691
|
-
var
|
|
16692
|
-
|
|
16693
|
-
|
|
16694
|
-
|
|
16695
|
-
|
|
16696
|
-
|
|
16697
|
-
|
|
16698
|
-
|
|
16699
|
-
|
|
16700
|
-
|
|
16701
|
-
|
|
16702
|
-
|
|
16703
|
-
|
|
16704
|
-
|
|
16705
|
-
|
|
16706
|
-
|
|
16707
|
-
|
|
16708
|
-
|
|
16709
|
-
|
|
16710
|
-
|
|
16711
|
-
|
|
16712
|
-
var fill = _step1.value;
|
|
16713
|
-
var fillParam = fill;
|
|
16714
|
-
if (fillParam) {
|
|
16715
|
-
this.hasFill = true;
|
|
16716
|
-
this.fills[0] = this.createPaint(fillParam);
|
|
16717
|
-
}
|
|
16718
|
-
}
|
|
16718
|
+
var _data_strokeCap;
|
|
16719
|
+
this.strokeCap = (_data_strokeCap = data.strokeCap) != null ? _data_strokeCap : LineCap.Butt;
|
|
16720
|
+
var _data_strokeWidth;
|
|
16721
|
+
this.strokeWidth = (_data_strokeWidth = data.strokeWidth) != null ? _data_strokeWidth : 1;
|
|
16722
|
+
var _data_strokeJoin;
|
|
16723
|
+
this.strokeJoin = (_data_strokeJoin = data.strokeJoin) != null ? _data_strokeJoin : LineJoin.Miter;
|
|
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);
|
|
16719
16739
|
switch(data.type){
|
|
16720
16740
|
case ShapePrimitiveType.Custom:
|
|
16721
16741
|
{
|
|
@@ -16797,7 +16817,7 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16797
16817
|
_proto.createPaint = function createPaint(paintData) {
|
|
16798
16818
|
var paint;
|
|
16799
16819
|
switch(paintData.type){
|
|
16800
|
-
case
|
|
16820
|
+
case FillType.Solid:
|
|
16801
16821
|
{
|
|
16802
16822
|
paint = {
|
|
16803
16823
|
type: paintData.type,
|
|
@@ -16805,9 +16825,9 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16805
16825
|
};
|
|
16806
16826
|
break;
|
|
16807
16827
|
}
|
|
16808
|
-
case
|
|
16809
|
-
case
|
|
16810
|
-
case
|
|
16828
|
+
case FillType.GradientLinear:
|
|
16829
|
+
case FillType.GradientAngular:
|
|
16830
|
+
case FillType.GradientRadial:
|
|
16811
16831
|
{
|
|
16812
16832
|
paint = {
|
|
16813
16833
|
type: paintData.type,
|
|
@@ -16817,15 +16837,32 @@ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16817
16837
|
};
|
|
16818
16838
|
break;
|
|
16819
16839
|
}
|
|
16820
|
-
case
|
|
16840
|
+
case FillType.Texture:
|
|
16821
16841
|
{
|
|
16842
|
+
var _paintData_textureTransform;
|
|
16843
|
+
var textureTransform = _extends({
|
|
16844
|
+
offset: {
|
|
16845
|
+
x: 0,
|
|
16846
|
+
y: 0
|
|
16847
|
+
},
|
|
16848
|
+
rotation: 0,
|
|
16849
|
+
scale: {
|
|
16850
|
+
x: 1,
|
|
16851
|
+
y: 1
|
|
16852
|
+
}
|
|
16853
|
+
}, (_paintData_textureTransform = paintData.textureTransform) != null ? _paintData_textureTransform : {});
|
|
16822
16854
|
var _paintData_scalingFactor, _paintData_opacity;
|
|
16823
16855
|
paint = {
|
|
16824
16856
|
type: paintData.type,
|
|
16825
16857
|
texture: this.engine.findObject(paintData.texture),
|
|
16826
16858
|
scaleMode: paintData.scaleMode,
|
|
16827
16859
|
scalingFactor: (_paintData_scalingFactor = paintData.scalingFactor) != null ? _paintData_scalingFactor : 1,
|
|
16828
|
-
opacity: (_paintData_opacity = paintData.opacity) != null ? _paintData_opacity : 1
|
|
16860
|
+
opacity: (_paintData_opacity = paintData.opacity) != null ? _paintData_opacity : 1,
|
|
16861
|
+
textureTransform: {
|
|
16862
|
+
offset: new Vector2().copyFrom(textureTransform.offset),
|
|
16863
|
+
rotation: textureTransform.rotation,
|
|
16864
|
+
scale: new Vector2().copyFrom(textureTransform.scale)
|
|
16865
|
+
}
|
|
16829
16866
|
};
|
|
16830
16867
|
break;
|
|
16831
16868
|
}
|
|
@@ -17216,11 +17253,11 @@ var vertex = "\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 u
|
|
|
17216
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";
|
|
17217
17254
|
var seed$5 = 1;
|
|
17218
17255
|
var InteractMesh = /*#__PURE__*/ function() {
|
|
17219
|
-
function InteractMesh(props,
|
|
17256
|
+
function InteractMesh(props, transform, engine) {
|
|
17220
17257
|
this.transform = transform;
|
|
17221
17258
|
this.engine = engine;
|
|
17222
17259
|
this.color = props.options.previewColor;
|
|
17223
|
-
var material = this.createMaterial(
|
|
17260
|
+
var material = this.createMaterial();
|
|
17224
17261
|
var geometry = this.createGeometry();
|
|
17225
17262
|
this.mesh = this.createMesh(geometry, material);
|
|
17226
17263
|
this.updateMesh();
|
|
@@ -17243,7 +17280,7 @@ var InteractMesh = /*#__PURE__*/ function() {
|
|
|
17243
17280
|
material.setVector4("uPos", uPos);
|
|
17244
17281
|
material.setQuaternion("uQuat", tempQuat);
|
|
17245
17282
|
};
|
|
17246
|
-
_proto.createMaterial = function createMaterial(
|
|
17283
|
+
_proto.createMaterial = function createMaterial() {
|
|
17247
17284
|
var _this_engine_renderer;
|
|
17248
17285
|
var macros = [
|
|
17249
17286
|
[
|
|
@@ -17257,7 +17294,6 @@ var InteractMesh = /*#__PURE__*/ function() {
|
|
|
17257
17294
|
vertex: vertex,
|
|
17258
17295
|
fragment: fragment,
|
|
17259
17296
|
glslVersion: GLSLVersion.GLSL1,
|
|
17260
|
-
cacheId: "" + rendererOptions.cachePrefix + "_effects_interact",
|
|
17261
17297
|
macros: macros
|
|
17262
17298
|
}
|
|
17263
17299
|
};
|
|
@@ -17379,19 +17415,33 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
17379
17415
|
return _this;
|
|
17380
17416
|
}
|
|
17381
17417
|
var _proto = InteractComponent.prototype;
|
|
17382
|
-
|
|
17418
|
+
/**
|
|
17419
|
+
* 获取拖拽范围 X 轴
|
|
17420
|
+
* @returns 拖拽范围 [min, max]
|
|
17421
|
+
*/ _proto.getDragRangeX = function getDragRangeX() {
|
|
17383
17422
|
return this.dragRange.dxRange;
|
|
17384
17423
|
};
|
|
17385
|
-
|
|
17424
|
+
/**
|
|
17425
|
+
* 设置拖拽范围 X 轴
|
|
17426
|
+
* @param min 最小值
|
|
17427
|
+
* @param max 最大值
|
|
17428
|
+
*/ _proto.setDragRangeX = function setDragRangeX(min, max) {
|
|
17386
17429
|
this.dragRange.dxRange = [
|
|
17387
17430
|
min,
|
|
17388
17431
|
max
|
|
17389
17432
|
];
|
|
17390
17433
|
};
|
|
17391
|
-
|
|
17434
|
+
/**
|
|
17435
|
+
* 获取拖拽范围 Y 轴
|
|
17436
|
+
* @returns 拖拽范围 [min, max]
|
|
17437
|
+
*/ _proto.getDragRangeY = function getDragRangeY() {
|
|
17392
17438
|
return this.dragRange.dyRange;
|
|
17393
17439
|
};
|
|
17394
|
-
|
|
17440
|
+
/**
|
|
17441
|
+
* 设置拖拽范围 Y 轴
|
|
17442
|
+
* @param min 最小值
|
|
17443
|
+
* @param max 最大值
|
|
17444
|
+
*/ _proto.setDragRangeY = function setDragRangeY(min, max) {
|
|
17395
17445
|
this.dragRange.dyRange = [
|
|
17396
17446
|
min,
|
|
17397
17447
|
max
|
|
@@ -17399,15 +17449,11 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
17399
17449
|
};
|
|
17400
17450
|
_proto.onStart = function onStart() {
|
|
17401
17451
|
var env = this.item.engine.renderer.env;
|
|
17402
|
-
var composition = this.item.composition;
|
|
17403
17452
|
var _this_interactData_options = this.interactData.options, type = _this_interactData_options.type, showPreview = _this_interactData_options.showPreview;
|
|
17404
17453
|
if (type === InteractType.CLICK) {
|
|
17405
17454
|
this.clickable = true;
|
|
17406
17455
|
if (showPreview && env === PLAYER_OPTIONS_ENV_EDITOR) {
|
|
17407
|
-
|
|
17408
|
-
if (rendererOptions !== undefined) {
|
|
17409
|
-
this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
|
|
17410
|
-
}
|
|
17456
|
+
this.previewContent = new InteractMesh(this.item.props.content, this.transform, this.engine);
|
|
17411
17457
|
}
|
|
17412
17458
|
}
|
|
17413
17459
|
if (this.previewContent) {
|
|
@@ -17616,7 +17662,10 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
17616
17662
|
}
|
|
17617
17663
|
}
|
|
17618
17664
|
};
|
|
17619
|
-
|
|
17665
|
+
/**
|
|
17666
|
+
* 是否可以交互
|
|
17667
|
+
* @returns
|
|
17668
|
+
*/ _proto.canInteract = function canInteract() {
|
|
17620
17669
|
var _this_item_composition;
|
|
17621
17670
|
return Boolean((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.interactive) && this._interactive;
|
|
17622
17671
|
};
|
|
@@ -17651,7 +17700,9 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
17651
17700
|
get: function get() {
|
|
17652
17701
|
return this._interactive;
|
|
17653
17702
|
},
|
|
17654
|
-
set:
|
|
17703
|
+
set: /**
|
|
17704
|
+
* 是否响应点击和拖拽交互事件
|
|
17705
|
+
*/ function set(enable) {
|
|
17655
17706
|
this._interactive = enable;
|
|
17656
17707
|
if (!enable) {
|
|
17657
17708
|
// 立刻停止惯性滑动
|
|
@@ -18408,6 +18459,12 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
18408
18459
|
this./**
|
|
18409
18460
|
* @internal
|
|
18410
18461
|
*/ transform = new Transform();
|
|
18462
|
+
this./**
|
|
18463
|
+
* 画布的像素宽度
|
|
18464
|
+
*/ pixelWidth = 0;
|
|
18465
|
+
this./**
|
|
18466
|
+
* 画布的像素高度
|
|
18467
|
+
*/ pixelHeight = 0;
|
|
18411
18468
|
this.viewportMatrix = Matrix4.fromIdentity();
|
|
18412
18469
|
this.viewMatrix = Matrix4.fromIdentity();
|
|
18413
18470
|
this.projectionMatrix = Matrix4.fromIdentity();
|
|
@@ -18422,7 +18479,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
18422
18479
|
0,
|
|
18423
18480
|
0,
|
|
18424
18481
|
0
|
|
18425
|
-
] : _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;
|
|
18426
18483
|
var euler = new Euler(rotation[0], rotation[1], rotation[2]);
|
|
18427
18484
|
var quat = new Quaternion().setFromEuler(euler);
|
|
18428
18485
|
this.options = {
|
|
@@ -18432,6 +18489,8 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
18432
18489
|
aspect: aspect,
|
|
18433
18490
|
clipMode: clipMode
|
|
18434
18491
|
};
|
|
18492
|
+
this.pixelWidth = pixelWidth;
|
|
18493
|
+
this.pixelHeight = pixelHeight;
|
|
18435
18494
|
this.transform.setPosition(position[0], position[1], position[2]);
|
|
18436
18495
|
this.transform.setQuaternion(quat.x, quat.y, quat.z, quat.w);
|
|
18437
18496
|
this.dirty = true;
|
|
@@ -18578,6 +18637,48 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
18578
18637
|
this.dirty = false;
|
|
18579
18638
|
}
|
|
18580
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
|
+
};
|
|
18581
18682
|
_create_class(Camera, [
|
|
18582
18683
|
{
|
|
18583
18684
|
key: "near",
|
|
@@ -21439,7 +21540,6 @@ function modifyMaxKeyframeShader(shader, maxVertex, maxFrag) {
|
|
|
21439
21540
|
var _proto = ParticleSystemRenderer.prototype;
|
|
21440
21541
|
_proto.onStart = function onStart() {
|
|
21441
21542
|
this._priority = this.item.renderOrder;
|
|
21442
|
-
this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);
|
|
21443
21543
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
21444
21544
|
var mesh = _step.value;
|
|
21445
21545
|
mesh.onStart();
|
|
@@ -22400,7 +22500,6 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
22400
22500
|
};
|
|
22401
22501
|
}
|
|
22402
22502
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
22403
|
-
this.item._content = this;
|
|
22404
22503
|
};
|
|
22405
22504
|
_create_class(ParticleSystem, [
|
|
22406
22505
|
{
|
|
@@ -22925,7 +23024,7 @@ var tempPos = new Vector3();
|
|
|
22925
23024
|
*/ _proto.sampleAnimation = function sampleAnimation() {
|
|
22926
23025
|
var _this = this;
|
|
22927
23026
|
var boundItem = this.boundObject;
|
|
22928
|
-
var duration =
|
|
23027
|
+
var duration = this.getDuration();
|
|
22929
23028
|
var life = this.time / duration;
|
|
22930
23029
|
life = life < 0 ? 0 : life > 1 ? 1 : life;
|
|
22931
23030
|
if (this.sizeXOverLifetime) {
|
|
@@ -23395,41 +23494,45 @@ var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
|
23395
23494
|
if (!_instanceof1(boundItem, VFXItem)) {
|
|
23396
23495
|
return;
|
|
23397
23496
|
}
|
|
23398
|
-
var hasActiveTrack = false;
|
|
23399
23497
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.getChildTracks()), _step; !(_step = _iterator()).done;){
|
|
23400
23498
|
var childTrack = _step.value;
|
|
23401
23499
|
if (_instanceof1(childTrack, ActivationTrack)) {
|
|
23402
|
-
|
|
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
|
+
}
|
|
23403
23533
|
break;
|
|
23404
23534
|
}
|
|
23405
23535
|
}
|
|
23406
|
-
if (!hasActiveTrack) {
|
|
23407
|
-
return;
|
|
23408
|
-
}
|
|
23409
|
-
// 添加粒子动画 clip // TODO 待移除
|
|
23410
|
-
if (boundItem.getComponent(ParticleSystem)) {
|
|
23411
|
-
var particleTrack = timelineAsset.createTrack(ParticleTrack, this, "ParticleTrack");
|
|
23412
|
-
var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
|
|
23413
|
-
particleClip.start = boundItem.start;
|
|
23414
|
-
particleClip.duration = boundItem.duration;
|
|
23415
|
-
particleClip.endBehavior = boundItem.endBehavior;
|
|
23416
|
-
}
|
|
23417
|
-
// 添加图层帧动画动画时间 clip // TODO 待移除
|
|
23418
|
-
if (boundItem.getComponent(SpriteComponent)) {
|
|
23419
|
-
var componentTimeTrack = timelineAsset.createTrack(SpriteComponentTimeTrack, this, "SpriteComponentTimeTrack");
|
|
23420
|
-
var clip = componentTimeTrack.createClip(ComponentTimePlayableAsset);
|
|
23421
|
-
clip.start = boundItem.start;
|
|
23422
|
-
clip.duration = boundItem.duration;
|
|
23423
|
-
clip.endBehavior = boundItem.endBehavior;
|
|
23424
|
-
}
|
|
23425
|
-
// 添加图层帧动画动画时间 clip // TODO 待移除
|
|
23426
|
-
if (boundItem.getComponent(EffectComponent)) {
|
|
23427
|
-
var componentTimeTrack1 = timelineAsset.createTrack(EffectComponentTimeTrack, this, "EffectComponentTimeTrack");
|
|
23428
|
-
var clip1 = componentTimeTrack1.createClip(ComponentTimePlayableAsset);
|
|
23429
|
-
clip1.start = boundItem.start;
|
|
23430
|
-
clip1.duration = boundItem.duration;
|
|
23431
|
-
clip1.endBehavior = boundItem.endBehavior;
|
|
23432
|
-
}
|
|
23433
23536
|
};
|
|
23434
23537
|
return ObjectBindingTrack;
|
|
23435
23538
|
}(TrackAsset);
|
|
@@ -24214,13 +24317,14 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24214
24317
|
_this.pluginSystem = scene.pluginSystem;
|
|
24215
24318
|
_this.pluginSystem.initializeComposition(_assert_this_initialized(_this), scene);
|
|
24216
24319
|
_this.camera = new Camera(_this.name, _extends({}, sourceContent == null ? void 0 : sourceContent.camera, {
|
|
24217
|
-
aspect: width / height
|
|
24320
|
+
aspect: width / height,
|
|
24321
|
+
pixelWidth: width,
|
|
24322
|
+
pixelHeight: height
|
|
24218
24323
|
}));
|
|
24219
24324
|
_this.url = scene.url;
|
|
24220
24325
|
_this.interactive = true;
|
|
24221
24326
|
_this.handleItemMessage = handleItemMessage;
|
|
24222
24327
|
_this.createRenderFrame();
|
|
24223
|
-
_this.rendererOptions = null;
|
|
24224
24328
|
Composition.buildItemTree(_this.rootItem);
|
|
24225
24329
|
_this.rootComposition.setChildrenRenderOrder(0);
|
|
24226
24330
|
_this.pluginSystem.resetComposition(_assert_this_initialized(_this), _this.renderFrame);
|
|
@@ -24276,9 +24380,11 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24276
24380
|
this.restart();
|
|
24277
24381
|
}
|
|
24278
24382
|
if (this.rootComposition.isStartCalled) {
|
|
24279
|
-
this.
|
|
24383
|
+
this.setTime(this.time - this.startTime);
|
|
24384
|
+
this.resume();
|
|
24280
24385
|
} else {
|
|
24281
|
-
this.
|
|
24386
|
+
this.setTime(0);
|
|
24387
|
+
this.resume();
|
|
24282
24388
|
}
|
|
24283
24389
|
};
|
|
24284
24390
|
/**
|
|
@@ -24310,6 +24416,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24310
24416
|
* @param time - 相对 startTime 的时间
|
|
24311
24417
|
*/ _proto.gotoAndPlay = function gotoAndPlay(time) {
|
|
24312
24418
|
this.setTime(time);
|
|
24419
|
+
this.emit("goto", {
|
|
24420
|
+
time: time
|
|
24421
|
+
});
|
|
24313
24422
|
this.resume();
|
|
24314
24423
|
};
|
|
24315
24424
|
/**
|
|
@@ -24317,6 +24426,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24317
24426
|
* @param time - 相对 startTime 的时间
|
|
24318
24427
|
*/ _proto.gotoAndStop = function gotoAndStop(time) {
|
|
24319
24428
|
this.setTime(time);
|
|
24429
|
+
this.emit("goto", {
|
|
24430
|
+
time: time
|
|
24431
|
+
});
|
|
24320
24432
|
this.pause();
|
|
24321
24433
|
};
|
|
24322
24434
|
/**
|
|
@@ -24347,9 +24459,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24347
24459
|
if (pause) {
|
|
24348
24460
|
this.paused = true;
|
|
24349
24461
|
}
|
|
24350
|
-
this.emit("goto", {
|
|
24351
|
-
time: time
|
|
24352
|
-
});
|
|
24353
24462
|
};
|
|
24354
24463
|
_proto.addItem = function addItem(item) {
|
|
24355
24464
|
this.items.push(item);
|
|
@@ -24381,7 +24490,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24381
24490
|
/**
|
|
24382
24491
|
* 重置状态函数
|
|
24383
24492
|
*/ _proto.reset = function reset() {
|
|
24384
|
-
this.rendererOptions = null;
|
|
24385
24493
|
this.isEnded = false;
|
|
24386
24494
|
this.isEndCalled = false;
|
|
24387
24495
|
this.rootComposition.time = 0;
|
|
@@ -24407,9 +24515,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24407
24515
|
if (this.getPaused()) {
|
|
24408
24516
|
return;
|
|
24409
24517
|
}
|
|
24410
|
-
//
|
|
24518
|
+
// Scene VFXItem components lifetime function
|
|
24411
24519
|
if (!this.rootItem.isDuringPlay) {
|
|
24412
|
-
this.
|
|
24520
|
+
this.rootItem.awake();
|
|
24413
24521
|
this.rootItem.beginPlay();
|
|
24414
24522
|
}
|
|
24415
24523
|
var previousCompositionTime = this.time;
|
|
@@ -24434,19 +24542,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24434
24542
|
_proto.shouldDispose = function shouldDispose() {
|
|
24435
24543
|
return this.isEnded && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
|
|
24436
24544
|
};
|
|
24437
|
-
_proto.callAwake = function callAwake(item) {
|
|
24438
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
24439
|
-
var component = _step.value;
|
|
24440
|
-
if (!component.isAwakeCalled) {
|
|
24441
|
-
component.onAwake();
|
|
24442
|
-
component.isAwakeCalled = true;
|
|
24443
|
-
}
|
|
24444
|
-
}
|
|
24445
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.children), _step1; !(_step1 = _iterator1()).done;){
|
|
24446
|
-
var child = _step1.value;
|
|
24447
|
-
this.callAwake(child);
|
|
24448
|
-
}
|
|
24449
|
-
};
|
|
24450
24545
|
/**
|
|
24451
24546
|
* 更新相机
|
|
24452
24547
|
* @override
|
|
@@ -24535,7 +24630,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24535
24630
|
return (_this_renderer = this.renderer) == null ? void 0 : _this_renderer.engine;
|
|
24536
24631
|
};
|
|
24537
24632
|
/**
|
|
24538
|
-
* Item 求交测试,返回求交结果列表,x 和 y 是归一化到[-1, 1]
|
|
24633
|
+
* Item 求交测试,返回求交结果列表,x 和 y 是归一化到[-1, 1]区间的值,x 向右,y 向上
|
|
24539
24634
|
* @param x - 鼠标或触点的 x,已经归一化到[-1, 1]
|
|
24540
24635
|
* @param y - 鼠标或触点的 y,已经归一化到[-1, 1]
|
|
24541
24636
|
* @param force - 是否强制求交,没有交互信息的 Item 也要进行求交测试
|
|
@@ -24634,7 +24729,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24634
24729
|
* 合成对象销毁
|
|
24635
24730
|
*/ _proto.dispose = function dispose() {
|
|
24636
24731
|
var _this = this;
|
|
24637
|
-
var
|
|
24732
|
+
var _this_pluginSystem;
|
|
24638
24733
|
if (this.destroyed) {
|
|
24639
24734
|
return;
|
|
24640
24735
|
}
|
|
@@ -24654,7 +24749,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24654
24749
|
this.rootItem.dispose();
|
|
24655
24750
|
// FIXME: 注意这里增加了renderFrame销毁
|
|
24656
24751
|
this.renderFrame.dispose();
|
|
24657
|
-
(_this_rendererOptions = this.rendererOptions) == null ? void 0 : _this_rendererOptions.emptyTexture.dispose();
|
|
24658
24752
|
(_this_pluginSystem = this.pluginSystem) == null ? void 0 : _this_pluginSystem.destroyComposition(this);
|
|
24659
24753
|
this.update = function() {
|
|
24660
24754
|
{
|
|
@@ -24751,15 +24845,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24751
24845
|
this.textureOffloaded = true;
|
|
24752
24846
|
}
|
|
24753
24847
|
};
|
|
24754
|
-
_proto.getRendererOptions = function getRendererOptions() {
|
|
24755
|
-
if (!this.rendererOptions) {
|
|
24756
|
-
this.rendererOptions = {
|
|
24757
|
-
emptyTexture: this.renderFrame.emptyTexture,
|
|
24758
|
-
cachePrefix: "-"
|
|
24759
|
-
};
|
|
24760
|
-
}
|
|
24761
|
-
return this.rendererOptions;
|
|
24762
|
-
};
|
|
24763
24848
|
/**
|
|
24764
24849
|
* 重新加载纹理
|
|
24765
24850
|
*/ _proto.reloadTexture = function reloadTexture() {
|
|
@@ -24873,7 +24958,9 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
24873
24958
|
function VFXItem(engine, props) {
|
|
24874
24959
|
var _this;
|
|
24875
24960
|
_this = EffectsObject.call(this, engine) || this;
|
|
24876
|
-
|
|
24961
|
+
/**
|
|
24962
|
+
* 元素的子元素列表
|
|
24963
|
+
*/ _this.children = [];
|
|
24877
24964
|
/**
|
|
24878
24965
|
* 元素的变换包含位置、旋转、缩放。
|
|
24879
24966
|
*/ _this.transform = new Transform();
|
|
@@ -24884,9 +24971,6 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
24884
24971
|
* 元素动画的持续时间
|
|
24885
24972
|
*/ _this.duration = 0;
|
|
24886
24973
|
/**
|
|
24887
|
-
* 元素动画的开始时间
|
|
24888
|
-
*/ _this.start = 0;
|
|
24889
|
-
/**
|
|
24890
24974
|
* 元素动画结束时行为(如何处理元素)
|
|
24891
24975
|
*/ _this.endBehavior = EndBehavior.forward;
|
|
24892
24976
|
_this.type = ItemType.base;
|
|
@@ -25006,6 +25090,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25006
25090
|
this.composition = vfxItem.composition;
|
|
25007
25091
|
}
|
|
25008
25092
|
if (!this.isDuringPlay && vfxItem.isDuringPlay) {
|
|
25093
|
+
this.awake();
|
|
25009
25094
|
this.beginPlay();
|
|
25010
25095
|
}
|
|
25011
25096
|
};
|
|
@@ -25181,6 +25266,21 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25181
25266
|
};
|
|
25182
25267
|
/**
|
|
25183
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
|
|
25184
25284
|
*/ _proto.onActiveChanged = function onActiveChanged() {
|
|
25185
25285
|
if (!this.isEnabled) {
|
|
25186
25286
|
this.onEnable();
|
|
@@ -25219,12 +25319,11 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25219
25319
|
};
|
|
25220
25320
|
_proto.fromData = function fromData(data) {
|
|
25221
25321
|
EffectsObject.prototype.fromData.call(this, data);
|
|
25222
|
-
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;
|
|
25223
25323
|
this.props = data;
|
|
25224
25324
|
this.type = data.type;
|
|
25225
25325
|
this.id = id.toString(); // TODO 老数据 id 是 number,需要转换
|
|
25226
25326
|
this.name = name;
|
|
25227
|
-
this.start = delay ? delay : this.start;
|
|
25228
25327
|
if (transform) {
|
|
25229
25328
|
this.transform.fromData(transform);
|
|
25230
25329
|
}
|
|
@@ -25301,10 +25400,10 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25301
25400
|
component.dispose();
|
|
25302
25401
|
}
|
|
25303
25402
|
this.components = [];
|
|
25304
|
-
this._content = undefined;
|
|
25305
25403
|
this._composition = null;
|
|
25306
25404
|
this.transform.setValid(false);
|
|
25307
25405
|
}
|
|
25406
|
+
EffectsObject.prototype.dispose.call(this);
|
|
25308
25407
|
};
|
|
25309
25408
|
_proto.resetChildrenParent = function resetChildrenParent() {
|
|
25310
25409
|
// GE 父元素销毁子元素继承逻辑
|
|
@@ -25444,14 +25543,6 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25444
25543
|
return false;
|
|
25445
25544
|
};
|
|
25446
25545
|
_create_class(VFXItem, [
|
|
25447
|
-
{
|
|
25448
|
-
key: "content",
|
|
25449
|
-
get: /**
|
|
25450
|
-
* 返回元素创建的数据
|
|
25451
|
-
*/ function get() {
|
|
25452
|
-
return this._content;
|
|
25453
|
-
}
|
|
25454
|
-
},
|
|
25455
25546
|
{
|
|
25456
25547
|
key: "composition",
|
|
25457
25548
|
get: /**
|
|
@@ -25585,7 +25676,7 @@ var ColorPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
25585
25676
|
}
|
|
25586
25677
|
var colorInc = vecFill(tempColor, 1);
|
|
25587
25678
|
var colorChanged;
|
|
25588
|
-
var life = this.time /
|
|
25679
|
+
var life = this.time / this.getDuration();
|
|
25589
25680
|
var opacityOverLifetime = this.opacityOverLifetime;
|
|
25590
25681
|
var colorOverLifetime = this.colorOverLifetime;
|
|
25591
25682
|
if (colorOverLifetime) {
|
|
@@ -25869,7 +25960,7 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25869
25960
|
_this = MaskableGraphic.call(this, engine) || this;
|
|
25870
25961
|
_this.time = 0;
|
|
25871
25962
|
_this.duration = 0;
|
|
25872
|
-
_this.
|
|
25963
|
+
_this.loop = true;
|
|
25873
25964
|
/**
|
|
25874
25965
|
* @internal
|
|
25875
25966
|
*/ _this.splits = singleSplits;
|
|
@@ -25884,7 +25975,7 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25884
25975
|
var _this = this;
|
|
25885
25976
|
var time = this.time;
|
|
25886
25977
|
var duration = this.duration;
|
|
25887
|
-
if (time > duration && this.
|
|
25978
|
+
if (time > duration && this.loop) {
|
|
25888
25979
|
time = time % duration;
|
|
25889
25980
|
}
|
|
25890
25981
|
var life = Math.min(Math.max(time / duration, 0.0), 1.0);
|
|
@@ -26124,6 +26215,8 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
26124
26215
|
var _data_duration;
|
|
26125
26216
|
//@ts-expect-error
|
|
26126
26217
|
this.duration = (_data_duration = data.duration) != null ? _data_duration : this.item.duration;
|
|
26218
|
+
var _data_loop;
|
|
26219
|
+
this.loop = (_data_loop = data.loop) != null ? _data_loop : true;
|
|
26127
26220
|
};
|
|
26128
26221
|
return SpriteComponent;
|
|
26129
26222
|
}(MaskableGraphic);
|
|
@@ -28876,7 +28969,8 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
28876
28969
|
function TextLayout(options) {
|
|
28877
28970
|
this.width = 0;
|
|
28878
28971
|
this.height = 0;
|
|
28879
|
-
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,
|
|
28972
|
+
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
|
|
28973
|
+
useLegacyRichText, useLegacyRichText = _options_useLegacyRichText === void 0 ? false : _options_useLegacyRichText;
|
|
28880
28974
|
var tempWidth = fontSize + letterSpace;
|
|
28881
28975
|
this.autoWidth = autoWidth;
|
|
28882
28976
|
this.maxTextWidth = text.length * tempWidth;
|
|
@@ -28884,6 +28978,7 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
28884
28978
|
this.height = textHeight;
|
|
28885
28979
|
this.letterSpace = letterSpace;
|
|
28886
28980
|
this.lineGap = lineGap;
|
|
28981
|
+
this.useLegacyRichText = useLegacyRichText;
|
|
28887
28982
|
this.overflow = textOverflow;
|
|
28888
28983
|
this.textBaseline = textBaseline;
|
|
28889
28984
|
this.textAlign = textAlign;
|
|
@@ -28934,6 +29029,38 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
28934
29029
|
return offsetX;
|
|
28935
29030
|
};
|
|
28936
29031
|
/**
|
|
29032
|
+
* 富文本垂直对齐计算
|
|
29033
|
+
* @param style - 字体样式
|
|
29034
|
+
* @param lineHeights - 每行高度数组
|
|
29035
|
+
* @param fontSize - 字体大小
|
|
29036
|
+
* @returns 第一行基线的 Y 坐标
|
|
29037
|
+
*/ _proto.getOffsetYRich = function getOffsetYRich(style, lineHeights, fontSize) {
|
|
29038
|
+
var outlineWidth = style.outlineWidth, fontScale = style.fontScale;
|
|
29039
|
+
var total = lineHeights.reduce(function(a, b) {
|
|
29040
|
+
return a + b;
|
|
29041
|
+
}, 0);
|
|
29042
|
+
// 使用与原始 getOffsetY 相同的经验值计算
|
|
29043
|
+
// /3 计算 Y 轴偏移量,以匹配编辑器行为
|
|
29044
|
+
var offsetY = (lineHeights[0] - fontSize) / 3;
|
|
29045
|
+
// 计算基础偏移量(从画布顶部到第一行基线的距离)
|
|
29046
|
+
var baseOffset = fontSize + outlineWidth * fontScale;
|
|
29047
|
+
// 除第一行外的所有行的总高度
|
|
29048
|
+
var commonCalculation = total - lineHeights[0]; // 使用实际总高度减去第一行高度
|
|
29049
|
+
var offsetResult = 0;
|
|
29050
|
+
switch(this.textBaseline){
|
|
29051
|
+
case TextBaseline.top:
|
|
29052
|
+
offsetResult = baseOffset + offsetY;
|
|
29053
|
+
break;
|
|
29054
|
+
case TextBaseline.middle:
|
|
29055
|
+
offsetResult = (this.height * fontScale - total + this.lineGap * fontScale) / 2 + baseOffset;
|
|
29056
|
+
break;
|
|
29057
|
+
case TextBaseline.bottom:
|
|
29058
|
+
offsetResult = this.height * fontScale - commonCalculation - offsetY;
|
|
29059
|
+
break;
|
|
29060
|
+
}
|
|
29061
|
+
return offsetResult;
|
|
29062
|
+
};
|
|
29063
|
+
/**
|
|
28937
29064
|
* 设置文本框的宽度和高度
|
|
28938
29065
|
* @param width 文本框宽度
|
|
28939
29066
|
* @param height 文本框高度
|
|
@@ -29064,6 +29191,10 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29064
29191
|
MaskableGraphic.prototype.onUpdate.call(this, dt);
|
|
29065
29192
|
this.updateTexture();
|
|
29066
29193
|
};
|
|
29194
|
+
_proto.onDestroy = function onDestroy() {
|
|
29195
|
+
MaskableGraphic.prototype.onDestroy.call(this);
|
|
29196
|
+
this.disposeTextTexture();
|
|
29197
|
+
};
|
|
29067
29198
|
_proto.fromData = function fromData(data) {
|
|
29068
29199
|
MaskableGraphic.prototype.fromData.call(this, data);
|
|
29069
29200
|
var interaction = data.interaction, options = data.options;
|
|
@@ -29104,10 +29235,10 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
29104
29235
|
var width = this.textLayout.width + this.textStyle.fontOffset;
|
|
29105
29236
|
var lineCount = 1;
|
|
29106
29237
|
var x = 0;
|
|
29107
|
-
|
|
29108
|
-
|
|
29109
|
-
|
|
29110
|
-
|
|
29238
|
+
// 设置context.font的字号,确保measureText能正确计算字宽
|
|
29239
|
+
if (context) {
|
|
29240
|
+
context.font = this.getFontDesc(this.textStyle.fontSize);
|
|
29241
|
+
}
|
|
29111
29242
|
for(var i = 0; i < text.length; i++){
|
|
29112
29243
|
var _context_measureText;
|
|
29113
29244
|
var str = text[i];
|
|
@@ -29437,10 +29568,17 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
29437
29568
|
wrapS: glContext.CLAMP_TO_EDGE,
|
|
29438
29569
|
wrapT: glContext.CLAMP_TO_EDGE
|
|
29439
29570
|
});
|
|
29571
|
+
this.disposeTextTexture();
|
|
29440
29572
|
this.renderer.texture = texture;
|
|
29441
29573
|
this.material.setTexture("_MainTex", texture);
|
|
29442
29574
|
this.isDirty = false;
|
|
29443
29575
|
};
|
|
29576
|
+
_proto.disposeTextTexture = function disposeTextTexture() {
|
|
29577
|
+
var texture = this.renderer.texture;
|
|
29578
|
+
if (texture && texture !== this.engine.whiteTexture) {
|
|
29579
|
+
texture.dispose();
|
|
29580
|
+
}
|
|
29581
|
+
};
|
|
29444
29582
|
_proto.getFontDesc = function getFontDesc(size) {
|
|
29445
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;
|
|
29446
29584
|
var fontDesc = "" + (size || fontSize * fontScale).toString() + "px ";
|
|
@@ -30481,35 +30619,75 @@ function version34Migration(json) {
|
|
|
30481
30619
|
}
|
|
30482
30620
|
if (componentData1.dataType === DataType.ShapeComponent) {
|
|
30483
30621
|
var shapeComponentData = componentData1;
|
|
30484
|
-
//@ts-expect-error
|
|
30485
30622
|
shapeComponentData.fills = [];
|
|
30623
|
+
//@ts-expect-error
|
|
30486
30624
|
if (shapeComponentData.fill) {
|
|
30487
30625
|
var solidPaintData = {
|
|
30488
30626
|
type: FillType.Solid,
|
|
30627
|
+
//@ts-expect-error
|
|
30489
30628
|
color: shapeComponentData.fill.color
|
|
30490
30629
|
};
|
|
30491
|
-
//@ts-expect-error
|
|
30492
30630
|
shapeComponentData.fills.push(solidPaintData);
|
|
30493
30631
|
}
|
|
30494
|
-
delete shapeComponentData.fill;
|
|
30495
30632
|
//@ts-expect-error
|
|
30633
|
+
delete shapeComponentData.fill;
|
|
30496
30634
|
shapeComponentData.strokes = [];
|
|
30635
|
+
//@ts-expect-error
|
|
30497
30636
|
if (shapeComponentData.stroke) {
|
|
30498
30637
|
var solidPaintData1 = {
|
|
30499
30638
|
type: FillType.Solid,
|
|
30639
|
+
//@ts-expect-error
|
|
30500
30640
|
color: shapeComponentData.stroke.color
|
|
30501
30641
|
};
|
|
30502
|
-
//@ts-expect-error
|
|
30503
30642
|
shapeComponentData.strokes.push(solidPaintData1);
|
|
30504
30643
|
//@ts-expect-error
|
|
30505
|
-
shapeComponentData.
|
|
30644
|
+
shapeComponentData.strokeWidth = shapeComponentData.stroke.width;
|
|
30645
|
+
//@ts-expect-error
|
|
30646
|
+
shapeComponentData.strokeCap = shapeComponentData.stroke.cap;
|
|
30647
|
+
//@ts-expect-error
|
|
30648
|
+
shapeComponentData.strokeJoin = shapeComponentData.stroke.join;
|
|
30649
|
+
//@ts-expect-error
|
|
30650
|
+
delete shapeComponentData.stroke;
|
|
30506
30651
|
}
|
|
30507
30652
|
}
|
|
30508
30653
|
}
|
|
30654
|
+
// 处理富文本lineGap兼容性
|
|
30655
|
+
processRichTextLineGapCompatibility(json);
|
|
30509
30656
|
//@ts-expect-error
|
|
30510
30657
|
json.version = "3.5";
|
|
30511
30658
|
return json;
|
|
30512
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
|
+
}
|
|
30513
30691
|
/**
|
|
30514
30692
|
* 根据形状获取形状几何体数据
|
|
30515
30693
|
* @param shape - 形状
|
|
@@ -31432,7 +31610,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31432
31610
|
return ret;
|
|
31433
31611
|
}
|
|
31434
31612
|
|
|
31435
|
-
var version$2 = "2.7.0-
|
|
31613
|
+
var version$2 = "2.7.0-beta.0";
|
|
31436
31614
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31437
31615
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31438
31616
|
var reverseParticle = false;
|
|
@@ -32668,7 +32846,7 @@ function createTextureOptionsBySource(image, sourceFrom, id) {
|
|
|
32668
32846
|
function AssetService(engine) {
|
|
32669
32847
|
this.engine = engine;
|
|
32670
32848
|
this.builtinObjects = [];
|
|
32671
|
-
this.builtinObjects.push(
|
|
32849
|
+
this.builtinObjects.push(engine.whiteTexture);
|
|
32672
32850
|
}
|
|
32673
32851
|
var _proto = AssetService.prototype;
|
|
32674
32852
|
/**
|
|
@@ -34344,7 +34522,7 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
34344
34522
|
this.jsonSceneData = {};
|
|
34345
34523
|
this.objectInstance = {};
|
|
34346
34524
|
this.assetLoader = new AssetLoader(this);
|
|
34347
|
-
this.
|
|
34525
|
+
this.whiteTexture = generateWhiteTexture(this);
|
|
34348
34526
|
this.transparentTexture = generateTransparentTexture(this);
|
|
34349
34527
|
}
|
|
34350
34528
|
var _proto = Engine.prototype;
|
|
@@ -34705,7 +34883,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem);
|
|
|
34705
34883
|
registerPlugin("particle", ParticleLoader, VFXItem);
|
|
34706
34884
|
registerPlugin("cal", CalculateLoader, VFXItem);
|
|
34707
34885
|
registerPlugin("interact", InteractLoader, VFXItem);
|
|
34708
|
-
var version$1 = "2.7.0-
|
|
34886
|
+
var version$1 = "2.7.0-beta.0";
|
|
34709
34887
|
logger.info("Core version: " + version$1 + ".");
|
|
34710
34888
|
|
|
34711
34889
|
var _obj;
|
|
@@ -35024,12 +35202,13 @@ var _obj3;
|
|
|
35024
35202
|
//FIXME: 暂时不实现
|
|
35025
35203
|
throw new Error("Method not implemented.");
|
|
35026
35204
|
};
|
|
35027
|
-
_proto.dispose = function dispose(
|
|
35028
|
-
if (
|
|
35205
|
+
_proto.dispose = function dispose() {
|
|
35206
|
+
if (this.destroyed) {
|
|
35029
35207
|
return;
|
|
35030
35208
|
}
|
|
35031
35209
|
this.material.dispose();
|
|
35032
35210
|
this.destroyed = true;
|
|
35211
|
+
Material.prototype.dispose.call(this);
|
|
35033
35212
|
};
|
|
35034
35213
|
_create_class(ThreeMaterial, [
|
|
35035
35214
|
{
|
|
@@ -35516,6 +35695,7 @@ var seed = 1;
|
|
|
35516
35695
|
}
|
|
35517
35696
|
this.geometry.dispose();
|
|
35518
35697
|
this.destroyed = true;
|
|
35698
|
+
Geometry.prototype.dispose.call(this);
|
|
35519
35699
|
};
|
|
35520
35700
|
_proto.setAttributeType = function setAttributeType(name, attr, geometry, attributes, maxCount) {
|
|
35521
35701
|
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;
|
|
@@ -35657,6 +35837,7 @@ var seed = 1;
|
|
|
35657
35837
|
this.mesh.clear();
|
|
35658
35838
|
this.destroyed = true;
|
|
35659
35839
|
}
|
|
35840
|
+
Mesh.prototype.dispose.call(this);
|
|
35660
35841
|
};
|
|
35661
35842
|
_create_class(ThreeMesh, [
|
|
35662
35843
|
{
|
|
@@ -35744,6 +35925,7 @@ var seed = 1;
|
|
|
35744
35925
|
* 释放纹理占用的内存
|
|
35745
35926
|
*/ _proto.dispose = function dispose() {
|
|
35746
35927
|
this.texture.dispose();
|
|
35928
|
+
Texture.prototype.dispose.call(this);
|
|
35747
35929
|
};
|
|
35748
35930
|
/**
|
|
35749
35931
|
* 通过图层设置创建贴图
|
|
@@ -35883,25 +36065,6 @@ var seed = 1;
|
|
|
35883
36065
|
}
|
|
35884
36066
|
}
|
|
35885
36067
|
};
|
|
35886
|
-
/**
|
|
35887
|
-
* 获取 render 参数
|
|
35888
|
-
*
|
|
35889
|
-
* @returns
|
|
35890
|
-
*/ _proto.getRendererOptions = function getRendererOptions() {
|
|
35891
|
-
var emptyTexture = ThreeTexture.createWithData(this.renderer.engine, {
|
|
35892
|
-
data: new Uint8Array(4).fill(255),
|
|
35893
|
-
width: 1,
|
|
35894
|
-
height: 1
|
|
35895
|
-
});
|
|
35896
|
-
emptyTexture.texture.needsUpdate = true;
|
|
35897
|
-
if (!this.rendererOptions) {
|
|
35898
|
-
this.rendererOptions = {
|
|
35899
|
-
emptyTexture: emptyTexture,
|
|
35900
|
-
cachePrefix: "-"
|
|
35901
|
-
};
|
|
35902
|
-
}
|
|
35903
|
-
return this.rendererOptions;
|
|
35904
|
-
};
|
|
35905
36068
|
return ThreeComposition;
|
|
35906
36069
|
}(Composition);
|
|
35907
36070
|
/**
|
|
@@ -36143,10 +36306,10 @@ var ThreeSpriteComponent = /*#__PURE__*/ function(SpriteComponent) {
|
|
|
36143
36306
|
* 销毁方法
|
|
36144
36307
|
*
|
|
36145
36308
|
*/ _proto.dispose = function dispose() {
|
|
36146
|
-
SpriteComponent.prototype.dispose.call(this);
|
|
36147
36309
|
if (!this.isActiveAndEnabled) {
|
|
36148
36310
|
this.threeMesh.clear();
|
|
36149
36311
|
}
|
|
36312
|
+
SpriteComponent.prototype.dispose.call(this);
|
|
36150
36313
|
};
|
|
36151
36314
|
_proto.fromData = function fromData(data) {
|
|
36152
36315
|
SpriteComponent.prototype.fromData.call(this, data);
|
|
@@ -36301,8 +36464,8 @@ setMaxSpriteMeshItemCount(8);
|
|
|
36301
36464
|
*/ Mesh.create = function(engine, props) {
|
|
36302
36465
|
return new ThreeMesh(engine, props);
|
|
36303
36466
|
};
|
|
36304
|
-
var version = "2.7.0-
|
|
36467
|
+
var version = "2.7.0-beta.0";
|
|
36305
36468
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
36306
36469
|
|
|
36307
|
-
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,
|
|
36470
|
+
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 };
|
|
36308
36471
|
//# sourceMappingURL=index.mjs.map
|