@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.js
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
|
'use strict';
|
|
@@ -3684,15 +3684,30 @@ var MaterialBlending;
|
|
|
3684
3684
|
var TextOverflow;
|
|
3685
3685
|
(function(TextOverflow) {
|
|
3686
3686
|
/**
|
|
3687
|
-
*
|
|
3688
|
-
*/ TextOverflow[TextOverflow["
|
|
3687
|
+
* visible 模式下,文本内容超出边界框时,会继续显示内容,不进行裁剪或缩放。
|
|
3688
|
+
*/ TextOverflow[TextOverflow["visible"] = 0] = "visible";
|
|
3689
|
+
/**
|
|
3690
|
+
* display 模式下,会显示所有文本,文本字号大小会根据边界框调整。
|
|
3691
|
+
*/ TextOverflow[TextOverflow["display"] = 1] = "display";
|
|
3689
3692
|
/**
|
|
3690
3693
|
* clip 模式下,当文本内容超出边界框时,多余的会被截断。
|
|
3691
|
-
*/ TextOverflow[TextOverflow["clip"] =
|
|
3694
|
+
*/ TextOverflow[TextOverflow["clip"] = 2] = "clip";
|
|
3692
3695
|
/**
|
|
3693
3696
|
* ellipsis 模式下,会使用(...)来代替超出边界框的内容。
|
|
3694
|
-
*/ TextOverflow[TextOverflow["ellipsis"] =
|
|
3697
|
+
*/ TextOverflow[TextOverflow["ellipsis"] = 3] = "ellipsis";
|
|
3695
3698
|
})(TextOverflow || (TextOverflow = {}));
|
|
3699
|
+
var TextSizeMode;
|
|
3700
|
+
(function(TextSizeMode) {
|
|
3701
|
+
/**
|
|
3702
|
+
* 自适应宽度
|
|
3703
|
+
*/ TextSizeMode[TextSizeMode["autoWidth"] = 0] = "autoWidth";
|
|
3704
|
+
/**
|
|
3705
|
+
* 自适应高度
|
|
3706
|
+
*/ TextSizeMode[TextSizeMode["autoHeight"] = 1] = "autoHeight";
|
|
3707
|
+
/**
|
|
3708
|
+
* 固定宽高
|
|
3709
|
+
*/ TextSizeMode[TextSizeMode["fixed"] = 2] = "fixed";
|
|
3710
|
+
})(TextSizeMode || (TextSizeMode = {}));
|
|
3696
3711
|
var TextBaseline;
|
|
3697
3712
|
(function(TextBaseline) {
|
|
3698
3713
|
/**
|
|
@@ -3756,20 +3771,21 @@ var BuiltinObjectGUID = {
|
|
|
3756
3771
|
UnlitShader: "unlit000000000000000000000000000"
|
|
3757
3772
|
};
|
|
3758
3773
|
|
|
3759
|
-
|
|
3760
|
-
* 填充类型
|
|
3761
|
-
*/ var FillType;
|
|
3774
|
+
var FillType;
|
|
3762
3775
|
(function(FillType) {
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
*/ FillType[FillType["LinearGradient"] = 1] = "LinearGradient";
|
|
3769
|
-
/**
|
|
3770
|
-
* 径向渐变
|
|
3771
|
-
*/ FillType[FillType["RadialGradient"] = 2] = "RadialGradient";
|
|
3776
|
+
FillType[FillType["Solid"] = 0] = "Solid";
|
|
3777
|
+
FillType[FillType["GradientLinear"] = 1] = "GradientLinear";
|
|
3778
|
+
FillType[FillType["GradientRadial"] = 2] = "GradientRadial";
|
|
3779
|
+
FillType[FillType["GradientAngular"] = 3] = "GradientAngular";
|
|
3780
|
+
FillType[FillType["Texture"] = 4] = "Texture";
|
|
3772
3781
|
})(FillType || (FillType = {}));
|
|
3782
|
+
var TexturePaintScaleMode;
|
|
3783
|
+
(function(TexturePaintScaleMode) {
|
|
3784
|
+
TexturePaintScaleMode[TexturePaintScaleMode["Fill"] = 0] = "Fill";
|
|
3785
|
+
TexturePaintScaleMode[TexturePaintScaleMode["Fit"] = 1] = "Fit";
|
|
3786
|
+
TexturePaintScaleMode[TexturePaintScaleMode["Crop"] = 2] = "Crop";
|
|
3787
|
+
TexturePaintScaleMode[TexturePaintScaleMode["Tile"] = 3] = "Tile";
|
|
3788
|
+
})(TexturePaintScaleMode || (TexturePaintScaleMode = {}));
|
|
3773
3789
|
|
|
3774
3790
|
/**
|
|
3775
3791
|
* 矢量图形类型
|
|
@@ -4033,12 +4049,14 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
4033
4049
|
get MaterialBlending () { return MaterialBlending; },
|
|
4034
4050
|
get RenderMode3D () { return RenderMode3D; },
|
|
4035
4051
|
get TextOverflow () { return TextOverflow; },
|
|
4052
|
+
get TextSizeMode () { return TextSizeMode; },
|
|
4036
4053
|
get TextBaseline () { return TextBaseline; },
|
|
4037
4054
|
get TextAlignment () { return TextAlignment; },
|
|
4038
4055
|
get TextWeight () { return TextWeight; },
|
|
4039
4056
|
get FontStyle () { return FontStyle; },
|
|
4040
4057
|
BuiltinObjectGUID: BuiltinObjectGUID,
|
|
4041
4058
|
get FillType () { return FillType; },
|
|
4059
|
+
get TexturePaintScaleMode () { return TexturePaintScaleMode; },
|
|
4042
4060
|
get ShapePrimitiveType () { return ShapePrimitiveType; },
|
|
4043
4061
|
get LineCap () { return LineCap; },
|
|
4044
4062
|
get LineJoin () { return LineJoin; },
|
|
@@ -4146,10 +4164,16 @@ function getDirectStore(target) {
|
|
|
4146
4164
|
* 反序列化函数
|
|
4147
4165
|
*
|
|
4148
4166
|
* @param data - 对象的序列化的数据
|
|
4149
|
-
*/ _proto.fromData = function fromData(data) {
|
|
4167
|
+
*/ _proto.fromData = function fromData(data) {
|
|
4168
|
+
if (data.id !== undefined) {
|
|
4169
|
+
this.setInstanceId(data.id);
|
|
4170
|
+
}
|
|
4171
|
+
};
|
|
4150
4172
|
/**
|
|
4151
|
-
*
|
|
4152
|
-
*/ _proto.dispose = function dispose() {
|
|
4173
|
+
* 销毁当前对象
|
|
4174
|
+
*/ _proto.dispose = function dispose() {
|
|
4175
|
+
this.engine.removeInstance(this.guid);
|
|
4176
|
+
};
|
|
4153
4177
|
/**
|
|
4154
4178
|
*
|
|
4155
4179
|
* @param obj
|
|
@@ -5243,7 +5267,7 @@ var Pose = /*#__PURE__*/ function() {
|
|
|
5243
5267
|
}
|
|
5244
5268
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(skeleton.defaultColorPropertyValues), _step2; !(_step2 = _iterator2()).done;){
|
|
5245
5269
|
var defaultColor = _step2.value;
|
|
5246
|
-
this.colorPropertyValues.push(defaultColor);
|
|
5270
|
+
this.colorPropertyValues.push(new Color().copyFrom(defaultColor));
|
|
5247
5271
|
}
|
|
5248
5272
|
}
|
|
5249
5273
|
var _proto = Pose.prototype;
|
|
@@ -6718,7 +6742,7 @@ var Skeleton = /*#__PURE__*/ function() {
|
|
|
6718
6742
|
break;
|
|
6719
6743
|
case 1:
|
|
6720
6744
|
this.colorAnimatedObjects.push(animatedObject);
|
|
6721
|
-
this.defaultColorPropertyValues.push(directTarget[lastPropertyName]);
|
|
6745
|
+
this.defaultColorPropertyValues.push(new Color().copyFrom(directTarget[lastPropertyName]));
|
|
6722
6746
|
this.pathToObjectIndex.set(totalPath, this.colorAnimatedObjects.length - 1);
|
|
6723
6747
|
}
|
|
6724
6748
|
};
|
|
@@ -7015,6 +7039,7 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
7015
7039
|
if (this.item) {
|
|
7016
7040
|
removeItem(this.item.components, this);
|
|
7017
7041
|
}
|
|
7042
|
+
EffectsObject.prototype.dispose.call(this);
|
|
7018
7043
|
};
|
|
7019
7044
|
_proto.start = function start() {
|
|
7020
7045
|
if (this.isStartCalled) {
|
|
@@ -12205,9 +12230,8 @@ var seed$8 = 1;
|
|
|
12205
12230
|
this.destroyed = true;
|
|
12206
12231
|
if (this.engine !== undefined) {
|
|
12207
12232
|
this.engine.removeMesh(this);
|
|
12208
|
-
// @ts-expect-error
|
|
12209
|
-
this.engine = undefined;
|
|
12210
12233
|
}
|
|
12234
|
+
RendererComponent.prototype.dispose.call(this);
|
|
12211
12235
|
};
|
|
12212
12236
|
_create_class(Mesh, [
|
|
12213
12237
|
{
|
|
@@ -13363,8 +13387,6 @@ var seed$6 = 1;
|
|
|
13363
13387
|
this.clearAction = clearAction;
|
|
13364
13388
|
this.name = "RenderFrame" + seed$6++;
|
|
13365
13389
|
var firstRP = renderPasses[0];
|
|
13366
|
-
this.emptyTexture = generateWhiteTexture(engine);
|
|
13367
|
-
this.transparentTexture = generateTransparentTexture(engine);
|
|
13368
13390
|
this.camera = camera;
|
|
13369
13391
|
this.keepColorBuffer = keepColorBuffer;
|
|
13370
13392
|
this.renderPassInfoMap.set(firstRP, {
|
|
@@ -13413,8 +13435,6 @@ var seed$6 = 1;
|
|
|
13413
13435
|
}
|
|
13414
13436
|
this.passTextureCache.dispose();
|
|
13415
13437
|
this._renderPasses.length = 0;
|
|
13416
|
-
this.emptyTexture.dispose();
|
|
13417
|
-
this.transparentTexture.dispose();
|
|
13418
13438
|
if (this.resource) {
|
|
13419
13439
|
var _this_resource_depthStencil_texture, _this_resource_depthStencil;
|
|
13420
13440
|
this.resource.color_a.dispose();
|
|
@@ -14074,7 +14094,7 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
14074
14094
|
_this.renderer = {
|
|
14075
14095
|
renderMode: RenderMode.MESH,
|
|
14076
14096
|
blending: BlendingMode.ALPHA,
|
|
14077
|
-
texture: _this.engine.
|
|
14097
|
+
texture: _this.engine.whiteTexture,
|
|
14078
14098
|
occlusion: false,
|
|
14079
14099
|
transparentOcclusion: false,
|
|
14080
14100
|
side: SideMode.DOUBLE,
|
|
@@ -14282,7 +14302,7 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
14282
14302
|
this.renderer = {
|
|
14283
14303
|
renderMode: (_renderer_renderMode = renderer.renderMode) != null ? _renderer_renderMode : RenderMode.MESH,
|
|
14284
14304
|
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
14285
|
-
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.
|
|
14305
|
+
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.whiteTexture,
|
|
14286
14306
|
occlusion: !!renderer.occlusion,
|
|
14287
14307
|
transparentOcclusion: !!renderer.transparentOcclusion || this.maskManager.maskMode === exports.MaskMode.MASK,
|
|
14288
14308
|
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
@@ -16126,20 +16146,26 @@ function oldBezierKeyFramesToNew(props) {
|
|
|
16126
16146
|
keyDatas.push(keyData);
|
|
16127
16147
|
lastControl = p2;
|
|
16128
16148
|
}
|
|
16129
|
-
var
|
|
16149
|
+
var calculateSlope = function(p0, p1) {
|
|
16130
16150
|
return (p1.y - p0.y) / (p1.x - p0.x + NumberEpsilon);
|
|
16131
16151
|
};
|
|
16132
16152
|
for(var i1 = 0; i1 < keyDatas.length; i1++){
|
|
16133
16153
|
var leftControl = keyDatas[i1].leftControl;
|
|
16134
16154
|
var value = keyDatas[i1].value;
|
|
16135
16155
|
var rightControl = keyDatas[i1].rightControl;
|
|
16136
|
-
var
|
|
16137
|
-
var
|
|
16156
|
+
var inSlope = 0;
|
|
16157
|
+
var outSlope = 0;
|
|
16158
|
+
if (i1 > 0) {
|
|
16159
|
+
inSlope = calculateSlope(leftControl, value);
|
|
16160
|
+
}
|
|
16161
|
+
if (i1 < keyDatas.length - 1) {
|
|
16162
|
+
outSlope = calculateSlope(value, rightControl);
|
|
16163
|
+
}
|
|
16138
16164
|
var keyframe = {
|
|
16139
16165
|
time: value.x,
|
|
16140
16166
|
value: value.y,
|
|
16141
|
-
inSlope:
|
|
16142
|
-
outSlope:
|
|
16167
|
+
inSlope: inSlope,
|
|
16168
|
+
outSlope: outSlope,
|
|
16143
16169
|
inWeight: 0,
|
|
16144
16170
|
outWeight: 0,
|
|
16145
16171
|
tangentMode: keyDatas[i1].tangentMode,
|
|
@@ -16262,16 +16288,8 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
16262
16288
|
|
|
16263
16289
|
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;}";
|
|
16264
16290
|
|
|
16265
|
-
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
|
|
16291
|
+
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;}";
|
|
16266
16292
|
|
|
16267
|
-
exports.FillType = void 0;
|
|
16268
|
-
(function(FillType) {
|
|
16269
|
-
FillType[FillType["Solid"] = 0] = "Solid";
|
|
16270
|
-
FillType[FillType["GradientLinear"] = 1] = "GradientLinear";
|
|
16271
|
-
FillType[FillType["GradientRadial"] = 2] = "GradientRadial";
|
|
16272
|
-
FillType[FillType["GradientAngular"] = 3] = "GradientAngular";
|
|
16273
|
-
FillType[FillType["Texture"] = 4] = "Texture";
|
|
16274
|
-
})(exports.FillType || (exports.FillType = {}));
|
|
16275
16293
|
exports.TexturePaintScaleMode = void 0;
|
|
16276
16294
|
(function(TexturePaintScaleMode) {
|
|
16277
16295
|
TexturePaintScaleMode[TexturePaintScaleMode["Fill"] = 0] = "Fill";
|
|
@@ -16284,8 +16302,6 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16284
16302
|
function ShapeComponent(engine) {
|
|
16285
16303
|
var _this;
|
|
16286
16304
|
_this = RendererComponent.call(this, engine) || this;
|
|
16287
|
-
_this.hasStroke = false;
|
|
16288
|
-
_this.hasFill = false;
|
|
16289
16305
|
_this.shapeDirty = true;
|
|
16290
16306
|
_this.materialDirty = true;
|
|
16291
16307
|
_this.graphicsPath = new GraphicsPath();
|
|
@@ -16297,10 +16313,15 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16297
16313
|
join: LineJoin.Miter,
|
|
16298
16314
|
miterLimit: 10
|
|
16299
16315
|
};
|
|
16316
|
+
_this.strokeWidth = 1;
|
|
16317
|
+
_this.strokeCap = LineCap.Butt;
|
|
16318
|
+
_this.strokeJoin = LineJoin.Miter;
|
|
16300
16319
|
_this.strokes = [];
|
|
16301
16320
|
/**
|
|
16302
16321
|
* 用于点击测试的碰撞器
|
|
16303
16322
|
*/ _this.meshCollider = new MeshCollider();
|
|
16323
|
+
_this.fillMaterials = [];
|
|
16324
|
+
_this.strokeMaterials = [];
|
|
16304
16325
|
_this.getHitTestParams = function(force) {
|
|
16305
16326
|
var sizeMatrix = Matrix4.fromScale(_this.transform.size.x, _this.transform.size.y, 1);
|
|
16306
16327
|
var worldMatrix = sizeMatrix.premultiply(_this.transform.getWorldMatrix());
|
|
@@ -16312,15 +16333,15 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16312
16333
|
behavior: 0,
|
|
16313
16334
|
type: area.type,
|
|
16314
16335
|
triangles: area.area,
|
|
16315
|
-
backfaceCulling: _this.
|
|
16336
|
+
backfaceCulling: _this.rendererOptions.side === SideMode.FRONT
|
|
16316
16337
|
};
|
|
16317
16338
|
}
|
|
16318
16339
|
}
|
|
16319
16340
|
};
|
|
16320
|
-
_this.
|
|
16341
|
+
_this.rendererOptions = {
|
|
16321
16342
|
renderMode: RenderMode.MESH,
|
|
16322
16343
|
blending: BlendingMode.ALPHA,
|
|
16323
|
-
texture: _this.engine.
|
|
16344
|
+
texture: _this.engine.whiteTexture,
|
|
16324
16345
|
occlusion: false,
|
|
16325
16346
|
transparentOcclusion: false,
|
|
16326
16347
|
side: SideMode.DOUBLE,
|
|
@@ -16330,12 +16351,12 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16330
16351
|
// Create Shape Attrributes
|
|
16331
16352
|
//-------------------------------------------------------------------------
|
|
16332
16353
|
var gradientStrokeFill = {
|
|
16333
|
-
type:
|
|
16354
|
+
type: FillType.Solid,
|
|
16334
16355
|
color: new Color(1, 1, 1, 1)
|
|
16335
16356
|
};
|
|
16336
16357
|
_this.strokes.push(gradientStrokeFill);
|
|
16337
16358
|
var gradientLayerFill = {
|
|
16338
|
-
type:
|
|
16359
|
+
type: FillType.Solid,
|
|
16339
16360
|
color: new Color(1, 1, 1, 1)
|
|
16340
16361
|
};
|
|
16341
16362
|
_this.fills.push(gradientLayerFill);
|
|
@@ -16408,25 +16429,6 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16408
16429
|
indexCount: 0,
|
|
16409
16430
|
vertexCount: 0
|
|
16410
16431
|
});
|
|
16411
|
-
// Create Material
|
|
16412
|
-
//-------------------------------------------------------------------------
|
|
16413
|
-
var materialProps = {
|
|
16414
|
-
shader: {
|
|
16415
|
-
vertex: vert,
|
|
16416
|
-
fragment: frag,
|
|
16417
|
-
glslVersion: exports.GLSLVersion.GLSL1
|
|
16418
|
-
}
|
|
16419
|
-
};
|
|
16420
|
-
var fillMaterial = Material.create(engine, materialProps);
|
|
16421
|
-
var strokeMaterial = Material.create(engine, materialProps);
|
|
16422
|
-
fillMaterial.depthMask = false;
|
|
16423
|
-
fillMaterial.depthTest = true;
|
|
16424
|
-
fillMaterial.blending = true;
|
|
16425
|
-
_this.material = fillMaterial;
|
|
16426
|
-
strokeMaterial.depthMask = false;
|
|
16427
|
-
strokeMaterial.depthTest = true;
|
|
16428
|
-
strokeMaterial.blending = true;
|
|
16429
|
-
_this.materials[1] = strokeMaterial;
|
|
16430
16432
|
return _this;
|
|
16431
16433
|
}
|
|
16432
16434
|
var _proto = ShapeComponent.prototype;
|
|
@@ -16454,18 +16456,26 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16454
16456
|
if (!this.isActiveAndEnabled) {
|
|
16455
16457
|
return;
|
|
16456
16458
|
}
|
|
16457
|
-
var
|
|
16458
|
-
var
|
|
16459
|
-
|
|
16460
|
-
|
|
16461
|
-
|
|
16462
|
-
|
|
16463
|
-
|
|
16459
|
+
var previousColorMask = false;
|
|
16460
|
+
for(var i = 0; i < this.fillMaterials.length; i++){
|
|
16461
|
+
previousColorMask = this.fillMaterials[i].colorMask;
|
|
16462
|
+
this.fillMaterials[i].colorMask = false;
|
|
16463
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), this.fillMaterials[i], 0);
|
|
16464
|
+
this.fillMaterials[i].colorMask = previousColorMask;
|
|
16465
|
+
}
|
|
16466
|
+
for(var i1 = 0; i1 < this.strokeMaterials.length; i1++){
|
|
16467
|
+
previousColorMask = this.strokeMaterials[i1].colorMask;
|
|
16468
|
+
this.strokeMaterials[i1].colorMask = false;
|
|
16469
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), this.strokeMaterials[i1], 1);
|
|
16470
|
+
this.strokeMaterials[i1].colorMask = previousColorMask;
|
|
16471
|
+
}
|
|
16464
16472
|
};
|
|
16465
16473
|
_proto.draw = function draw(renderer) {
|
|
16466
|
-
for(var i = 0; i < this.
|
|
16467
|
-
|
|
16468
|
-
|
|
16474
|
+
for(var i = 0; i < this.fillMaterials.length; i++){
|
|
16475
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), this.fillMaterials[i], 0);
|
|
16476
|
+
}
|
|
16477
|
+
for(var i1 = 0; i1 < this.strokeMaterials.length; i1++){
|
|
16478
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), this.strokeMaterials[i1], 1);
|
|
16469
16479
|
}
|
|
16470
16480
|
};
|
|
16471
16481
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
@@ -16479,7 +16489,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16479
16489
|
var vertices = [];
|
|
16480
16490
|
var indices = [];
|
|
16481
16491
|
// Triangulate shapePrimitives, build fill and stroke shape geometry
|
|
16482
|
-
if (this.
|
|
16492
|
+
if (this.fills.length > 0) {
|
|
16483
16493
|
for(var _iterator = _create_for_of_iterator_helper_loose(shapePrimitives), _step; !(_step = _iterator()).done;){
|
|
16484
16494
|
var shapePrimitive = _step.value;
|
|
16485
16495
|
var shape = shapePrimitive.shape;
|
|
@@ -16491,7 +16501,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16491
16501
|
}
|
|
16492
16502
|
}
|
|
16493
16503
|
var fillIndexCount = indices.length;
|
|
16494
|
-
if (this.
|
|
16504
|
+
if (this.strokes.length > 0) {
|
|
16495
16505
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(shapePrimitives), _step1; !(_step1 = _iterator1()).done;){
|
|
16496
16506
|
var shapePrimitive1 = _step1.value;
|
|
16497
16507
|
var shape1 = shapePrimitive1.shape;
|
|
@@ -16499,6 +16509,9 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16499
16509
|
indices.length;
|
|
16500
16510
|
var vertOffset1 = vertices.length / 2;
|
|
16501
16511
|
var lineStyle = this.strokeAttributes;
|
|
16512
|
+
lineStyle.cap = this.strokeCap;
|
|
16513
|
+
lineStyle.join = this.strokeJoin;
|
|
16514
|
+
lineStyle.width = this.strokeWidth;
|
|
16502
16515
|
var close = true;
|
|
16503
16516
|
if (this.shapeAttributes.type === ShapePrimitiveType.Custom) {
|
|
16504
16517
|
close = shape1.closePath;
|
|
@@ -16626,48 +16639,20 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16626
16639
|
}
|
|
16627
16640
|
};
|
|
16628
16641
|
_proto.updateMaterials = function updateMaterials() {
|
|
16629
|
-
for(var
|
|
16630
|
-
|
|
16631
|
-
|
|
16632
|
-
|
|
16633
|
-
|
|
16634
|
-
material.blending = true;
|
|
16635
|
-
material.depthTest = true;
|
|
16636
|
-
material.depthMask = occlusion;
|
|
16637
|
-
material.stencilRef = mask !== undefined ? [
|
|
16638
|
-
mask,
|
|
16639
|
-
mask
|
|
16640
|
-
] : undefined;
|
|
16641
|
-
setBlendMode(material, blendMode);
|
|
16642
|
-
// 兼容旧数据中模板需要渲染的情况
|
|
16643
|
-
setMaskMode(material, maskMode);
|
|
16644
|
-
setSideMode(material, side);
|
|
16645
|
-
material.shader.shaderData.properties = '_MainTex("_MainTex",2D) = "white" {}';
|
|
16646
|
-
material.setVector4("_TexOffset", new Vector4(0, 0, 1, 1));
|
|
16647
|
-
material.setTexture("_MainTex", texture);
|
|
16648
|
-
var preMultiAlpha = getPreMultiAlpha(blendMode);
|
|
16649
|
-
var texParams = new Vector4();
|
|
16650
|
-
texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
|
|
16651
|
-
texParams.y = preMultiAlpha;
|
|
16652
|
-
texParams.z = renderer.renderMode;
|
|
16653
|
-
texParams.w = maskMode;
|
|
16654
|
-
material.setVector4("_TexParams", texParams);
|
|
16655
|
-
if (texParams.x === 0 || this.maskManager.alphaMaskEnabled) {
|
|
16656
|
-
material.enableMacro("ALPHA_CLIP");
|
|
16657
|
-
} else {
|
|
16658
|
-
material.disableMacro("ALPHA_CLIP");
|
|
16659
|
-
}
|
|
16642
|
+
for(var i = 0; i < this.fills.length; i++){
|
|
16643
|
+
this.updatePaintMaterial(this.fillMaterials[i], this.fills[i]);
|
|
16644
|
+
}
|
|
16645
|
+
for(var i1 = 0; i1 < this.strokes.length; i1++){
|
|
16646
|
+
this.updatePaintMaterial(this.strokeMaterials[i1], this.strokes[i1]);
|
|
16660
16647
|
}
|
|
16661
|
-
this.updatePaintMaterial(this.material, this.fills[0]);
|
|
16662
|
-
this.updatePaintMaterial(this.materials[1], this.strokes[0]);
|
|
16663
16648
|
};
|
|
16664
16649
|
_proto.updatePaintMaterial = function updatePaintMaterial(material, paint) {
|
|
16665
16650
|
material.setFloat("_FillType", paint.type);
|
|
16666
|
-
if (paint.type ===
|
|
16651
|
+
if (paint.type === FillType.Solid) {
|
|
16667
16652
|
material.color = paint.color;
|
|
16668
|
-
} else if (paint.type ===
|
|
16653
|
+
} else if (paint.type === FillType.GradientLinear || paint.type === FillType.GradientAngular || paint.type === FillType.GradientRadial) {
|
|
16669
16654
|
this.updateGradientMaterial(material, paint.gradientStops, paint.startPoint, paint.endPoint);
|
|
16670
|
-
} else if (paint.type ===
|
|
16655
|
+
} else if (paint.type === FillType.Texture) {
|
|
16671
16656
|
material.setInt("_ImageScaleMode", paint.scaleMode);
|
|
16672
16657
|
material.setVector2("_ImageSize", new Vector2(paint.texture.getWidth(), paint.texture.getHeight()));
|
|
16673
16658
|
var boundingBox = this.getBoundingBox();
|
|
@@ -16677,6 +16662,8 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16677
16662
|
material.setFloat("_ImageOpacity", paint.opacity);
|
|
16678
16663
|
material.setFloat("_ImageScalingFactor", paint.scalingFactor);
|
|
16679
16664
|
material.setTexture("_ImageTex", paint.texture);
|
|
16665
|
+
var transform = paint.textureTransform;
|
|
16666
|
+
material.setMatrix3("_TextureTransform", new Matrix3().scale(transform.scale.x, transform.scale.y).rotate(transform.rotation).translate(transform.offset.x, transform.offset.y).invert());
|
|
16680
16667
|
}
|
|
16681
16668
|
};
|
|
16682
16669
|
_proto.updateGradientMaterial = function updateGradientMaterial(material, gradient, startPoint, endPoint) {
|
|
@@ -16694,6 +16681,46 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16694
16681
|
material.setVector2("_StartPoint", startPoint);
|
|
16695
16682
|
material.setVector2("_EndPoint", endPoint);
|
|
16696
16683
|
};
|
|
16684
|
+
_proto.createMaterialFromRendererOptions = function createMaterialFromRendererOptions(rendererOptions) {
|
|
16685
|
+
var materialProps = {
|
|
16686
|
+
shader: {
|
|
16687
|
+
vertex: vert,
|
|
16688
|
+
fragment: frag,
|
|
16689
|
+
glslVersion: exports.GLSLVersion.GLSL1
|
|
16690
|
+
}
|
|
16691
|
+
};
|
|
16692
|
+
var material = Material.create(this.engine, materialProps);
|
|
16693
|
+
var renderer = rendererOptions;
|
|
16694
|
+
var side = renderer.side, occlusion = renderer.occlusion, blendMode = renderer.blending, mask = renderer.mask, texture = renderer.texture;
|
|
16695
|
+
var maskMode = this.maskManager.maskMode;
|
|
16696
|
+
material.blending = true;
|
|
16697
|
+
material.depthTest = true;
|
|
16698
|
+
material.depthMask = occlusion;
|
|
16699
|
+
material.stencilRef = mask !== undefined ? [
|
|
16700
|
+
mask,
|
|
16701
|
+
mask
|
|
16702
|
+
] : undefined;
|
|
16703
|
+
setBlendMode(material, blendMode);
|
|
16704
|
+
// 兼容旧数据中模板需要渲染的情况
|
|
16705
|
+
setMaskMode(material, maskMode);
|
|
16706
|
+
setSideMode(material, side);
|
|
16707
|
+
material.shader.shaderData.properties = '_ImageTex("_ImageTex",2D) = "white" {}';
|
|
16708
|
+
material.setVector4("_TexOffset", new Vector4(0, 0, 1, 1));
|
|
16709
|
+
material.setTexture("_ImageTex", texture);
|
|
16710
|
+
var preMultiAlpha = getPreMultiAlpha(blendMode);
|
|
16711
|
+
var texParams = new Vector4();
|
|
16712
|
+
texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
|
|
16713
|
+
texParams.y = preMultiAlpha;
|
|
16714
|
+
texParams.z = renderer.renderMode;
|
|
16715
|
+
texParams.w = maskMode;
|
|
16716
|
+
material.setVector4("_TexParams", texParams);
|
|
16717
|
+
if (texParams.x === 0 || this.maskManager.alphaMaskEnabled) {
|
|
16718
|
+
material.enableMacro("ALPHA_CLIP");
|
|
16719
|
+
} else {
|
|
16720
|
+
material.disableMacro("ALPHA_CLIP");
|
|
16721
|
+
}
|
|
16722
|
+
return material;
|
|
16723
|
+
};
|
|
16697
16724
|
_proto.fromData = function fromData(data) {
|
|
16698
16725
|
RendererComponent.prototype.fromData.call(this, data);
|
|
16699
16726
|
this.shapeDirty = true;
|
|
@@ -16702,44 +16729,37 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16702
16729
|
}
|
|
16703
16730
|
var _data_renderer;
|
|
16704
16731
|
var renderer = (_data_renderer = data.renderer) != null ? _data_renderer : {};
|
|
16705
|
-
var
|
|
16706
|
-
this.
|
|
16707
|
-
renderMode:
|
|
16732
|
+
var _renderer_blending, _renderer_side;
|
|
16733
|
+
this.rendererOptions = {
|
|
16734
|
+
renderMode: RenderMode.MESH,
|
|
16708
16735
|
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
16709
|
-
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.
|
|
16736
|
+
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.whiteTexture,
|
|
16710
16737
|
occlusion: !!renderer.occlusion,
|
|
16711
16738
|
transparentOcclusion: !!renderer.transparentOcclusion || this.maskManager.maskMode === exports.MaskMode.MASK,
|
|
16712
16739
|
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
16713
16740
|
mask: this.maskManager.getRefValue()
|
|
16714
16741
|
};
|
|
16715
|
-
var
|
|
16716
|
-
|
|
16717
|
-
|
|
16718
|
-
|
|
16719
|
-
|
|
16720
|
-
|
|
16721
|
-
|
|
16722
|
-
|
|
16723
|
-
|
|
16724
|
-
|
|
16725
|
-
|
|
16726
|
-
|
|
16727
|
-
|
|
16728
|
-
|
|
16729
|
-
|
|
16730
|
-
|
|
16731
|
-
|
|
16732
|
-
|
|
16733
|
-
|
|
16734
|
-
|
|
16735
|
-
|
|
16736
|
-
var fill = _step1.value;
|
|
16737
|
-
var fillParam = fill;
|
|
16738
|
-
if (fillParam) {
|
|
16739
|
-
this.hasFill = true;
|
|
16740
|
-
this.fills[0] = this.createPaint(fillParam);
|
|
16741
|
-
}
|
|
16742
|
-
}
|
|
16742
|
+
var _data_strokeCap;
|
|
16743
|
+
this.strokeCap = (_data_strokeCap = data.strokeCap) != null ? _data_strokeCap : LineCap.Butt;
|
|
16744
|
+
var _data_strokeWidth;
|
|
16745
|
+
this.strokeWidth = (_data_strokeWidth = data.strokeWidth) != null ? _data_strokeWidth : 1;
|
|
16746
|
+
var _data_strokeJoin;
|
|
16747
|
+
this.strokeJoin = (_data_strokeJoin = data.strokeJoin) != null ? _data_strokeJoin : LineJoin.Miter;
|
|
16748
|
+
this.fills.length = 0;
|
|
16749
|
+
this.fillMaterials.length = 0;
|
|
16750
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(data.fills), _step; !(_step = _iterator()).done;){
|
|
16751
|
+
var fill = _step.value;
|
|
16752
|
+
this.fills.push(this.createPaint(fill));
|
|
16753
|
+
this.fillMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions));
|
|
16754
|
+
}
|
|
16755
|
+
this.strokes.length = 0;
|
|
16756
|
+
this.strokeMaterials.length = 0;
|
|
16757
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(data.strokes), _step1; !(_step1 = _iterator1()).done;){
|
|
16758
|
+
var stroke = _step1.value;
|
|
16759
|
+
this.strokes.push(this.createPaint(stroke));
|
|
16760
|
+
this.strokeMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions));
|
|
16761
|
+
}
|
|
16762
|
+
this.materials = [].concat(this.fillMaterials, this.strokeMaterials);
|
|
16743
16763
|
switch(data.type){
|
|
16744
16764
|
case ShapePrimitiveType.Custom:
|
|
16745
16765
|
{
|
|
@@ -16821,7 +16841,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16821
16841
|
_proto.createPaint = function createPaint(paintData) {
|
|
16822
16842
|
var paint;
|
|
16823
16843
|
switch(paintData.type){
|
|
16824
|
-
case
|
|
16844
|
+
case FillType.Solid:
|
|
16825
16845
|
{
|
|
16826
16846
|
paint = {
|
|
16827
16847
|
type: paintData.type,
|
|
@@ -16829,9 +16849,9 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16829
16849
|
};
|
|
16830
16850
|
break;
|
|
16831
16851
|
}
|
|
16832
|
-
case
|
|
16833
|
-
case
|
|
16834
|
-
case
|
|
16852
|
+
case FillType.GradientLinear:
|
|
16853
|
+
case FillType.GradientAngular:
|
|
16854
|
+
case FillType.GradientRadial:
|
|
16835
16855
|
{
|
|
16836
16856
|
paint = {
|
|
16837
16857
|
type: paintData.type,
|
|
@@ -16841,15 +16861,32 @@ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16841
16861
|
};
|
|
16842
16862
|
break;
|
|
16843
16863
|
}
|
|
16844
|
-
case
|
|
16864
|
+
case FillType.Texture:
|
|
16845
16865
|
{
|
|
16866
|
+
var _paintData_textureTransform;
|
|
16867
|
+
var textureTransform = _extends({
|
|
16868
|
+
offset: {
|
|
16869
|
+
x: 0,
|
|
16870
|
+
y: 0
|
|
16871
|
+
},
|
|
16872
|
+
rotation: 0,
|
|
16873
|
+
scale: {
|
|
16874
|
+
x: 1,
|
|
16875
|
+
y: 1
|
|
16876
|
+
}
|
|
16877
|
+
}, (_paintData_textureTransform = paintData.textureTransform) != null ? _paintData_textureTransform : {});
|
|
16846
16878
|
var _paintData_scalingFactor, _paintData_opacity;
|
|
16847
16879
|
paint = {
|
|
16848
16880
|
type: paintData.type,
|
|
16849
16881
|
texture: this.engine.findObject(paintData.texture),
|
|
16850
16882
|
scaleMode: paintData.scaleMode,
|
|
16851
16883
|
scalingFactor: (_paintData_scalingFactor = paintData.scalingFactor) != null ? _paintData_scalingFactor : 1,
|
|
16852
|
-
opacity: (_paintData_opacity = paintData.opacity) != null ? _paintData_opacity : 1
|
|
16884
|
+
opacity: (_paintData_opacity = paintData.opacity) != null ? _paintData_opacity : 1,
|
|
16885
|
+
textureTransform: {
|
|
16886
|
+
offset: new Vector2().copyFrom(textureTransform.offset),
|
|
16887
|
+
rotation: textureTransform.rotation,
|
|
16888
|
+
scale: new Vector2().copyFrom(textureTransform.scale)
|
|
16889
|
+
}
|
|
16853
16890
|
};
|
|
16854
16891
|
break;
|
|
16855
16892
|
}
|
|
@@ -17240,11 +17277,11 @@ var vertex = "\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 u
|
|
|
17240
17277
|
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";
|
|
17241
17278
|
var seed$5 = 1;
|
|
17242
17279
|
var InteractMesh = /*#__PURE__*/ function() {
|
|
17243
|
-
function InteractMesh(props,
|
|
17280
|
+
function InteractMesh(props, transform, engine) {
|
|
17244
17281
|
this.transform = transform;
|
|
17245
17282
|
this.engine = engine;
|
|
17246
17283
|
this.color = props.options.previewColor;
|
|
17247
|
-
var material = this.createMaterial(
|
|
17284
|
+
var material = this.createMaterial();
|
|
17248
17285
|
var geometry = this.createGeometry();
|
|
17249
17286
|
this.mesh = this.createMesh(geometry, material);
|
|
17250
17287
|
this.updateMesh();
|
|
@@ -17267,7 +17304,7 @@ var InteractMesh = /*#__PURE__*/ function() {
|
|
|
17267
17304
|
material.setVector4("uPos", uPos);
|
|
17268
17305
|
material.setQuaternion("uQuat", tempQuat);
|
|
17269
17306
|
};
|
|
17270
|
-
_proto.createMaterial = function createMaterial(
|
|
17307
|
+
_proto.createMaterial = function createMaterial() {
|
|
17271
17308
|
var _this_engine_renderer;
|
|
17272
17309
|
var macros = [
|
|
17273
17310
|
[
|
|
@@ -17281,7 +17318,6 @@ var InteractMesh = /*#__PURE__*/ function() {
|
|
|
17281
17318
|
vertex: vertex,
|
|
17282
17319
|
fragment: fragment,
|
|
17283
17320
|
glslVersion: exports.GLSLVersion.GLSL1,
|
|
17284
|
-
cacheId: "" + rendererOptions.cachePrefix + "_effects_interact",
|
|
17285
17321
|
macros: macros
|
|
17286
17322
|
}
|
|
17287
17323
|
};
|
|
@@ -17403,19 +17439,33 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
17403
17439
|
return _this;
|
|
17404
17440
|
}
|
|
17405
17441
|
var _proto = InteractComponent.prototype;
|
|
17406
|
-
|
|
17442
|
+
/**
|
|
17443
|
+
* 获取拖拽范围 X 轴
|
|
17444
|
+
* @returns 拖拽范围 [min, max]
|
|
17445
|
+
*/ _proto.getDragRangeX = function getDragRangeX() {
|
|
17407
17446
|
return this.dragRange.dxRange;
|
|
17408
17447
|
};
|
|
17409
|
-
|
|
17448
|
+
/**
|
|
17449
|
+
* 设置拖拽范围 X 轴
|
|
17450
|
+
* @param min 最小值
|
|
17451
|
+
* @param max 最大值
|
|
17452
|
+
*/ _proto.setDragRangeX = function setDragRangeX(min, max) {
|
|
17410
17453
|
this.dragRange.dxRange = [
|
|
17411
17454
|
min,
|
|
17412
17455
|
max
|
|
17413
17456
|
];
|
|
17414
17457
|
};
|
|
17415
|
-
|
|
17458
|
+
/**
|
|
17459
|
+
* 获取拖拽范围 Y 轴
|
|
17460
|
+
* @returns 拖拽范围 [min, max]
|
|
17461
|
+
*/ _proto.getDragRangeY = function getDragRangeY() {
|
|
17416
17462
|
return this.dragRange.dyRange;
|
|
17417
17463
|
};
|
|
17418
|
-
|
|
17464
|
+
/**
|
|
17465
|
+
* 设置拖拽范围 Y 轴
|
|
17466
|
+
* @param min 最小值
|
|
17467
|
+
* @param max 最大值
|
|
17468
|
+
*/ _proto.setDragRangeY = function setDragRangeY(min, max) {
|
|
17419
17469
|
this.dragRange.dyRange = [
|
|
17420
17470
|
min,
|
|
17421
17471
|
max
|
|
@@ -17423,15 +17473,11 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
17423
17473
|
};
|
|
17424
17474
|
_proto.onStart = function onStart() {
|
|
17425
17475
|
var env = this.item.engine.renderer.env;
|
|
17426
|
-
var composition = this.item.composition;
|
|
17427
17476
|
var _this_interactData_options = this.interactData.options, type = _this_interactData_options.type, showPreview = _this_interactData_options.showPreview;
|
|
17428
17477
|
if (type === InteractType.CLICK) {
|
|
17429
17478
|
this.clickable = true;
|
|
17430
17479
|
if (showPreview && env === PLAYER_OPTIONS_ENV_EDITOR) {
|
|
17431
|
-
|
|
17432
|
-
if (rendererOptions !== undefined) {
|
|
17433
|
-
this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
|
|
17434
|
-
}
|
|
17480
|
+
this.previewContent = new InteractMesh(this.item.props.content, this.transform, this.engine);
|
|
17435
17481
|
}
|
|
17436
17482
|
}
|
|
17437
17483
|
if (this.previewContent) {
|
|
@@ -17640,7 +17686,10 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
17640
17686
|
}
|
|
17641
17687
|
}
|
|
17642
17688
|
};
|
|
17643
|
-
|
|
17689
|
+
/**
|
|
17690
|
+
* 是否可以交互
|
|
17691
|
+
* @returns
|
|
17692
|
+
*/ _proto.canInteract = function canInteract() {
|
|
17644
17693
|
var _this_item_composition;
|
|
17645
17694
|
return Boolean((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.interactive) && this._interactive;
|
|
17646
17695
|
};
|
|
@@ -17675,7 +17724,9 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
17675
17724
|
get: function get() {
|
|
17676
17725
|
return this._interactive;
|
|
17677
17726
|
},
|
|
17678
|
-
set:
|
|
17727
|
+
set: /**
|
|
17728
|
+
* 是否响应点击和拖拽交互事件
|
|
17729
|
+
*/ function set(enable) {
|
|
17679
17730
|
this._interactive = enable;
|
|
17680
17731
|
if (!enable) {
|
|
17681
17732
|
// 立刻停止惯性滑动
|
|
@@ -18432,6 +18483,12 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
18432
18483
|
this./**
|
|
18433
18484
|
* @internal
|
|
18434
18485
|
*/ transform = new Transform();
|
|
18486
|
+
this./**
|
|
18487
|
+
* 画布的像素宽度
|
|
18488
|
+
*/ pixelWidth = 0;
|
|
18489
|
+
this./**
|
|
18490
|
+
* 画布的像素高度
|
|
18491
|
+
*/ pixelHeight = 0;
|
|
18435
18492
|
this.viewportMatrix = Matrix4.fromIdentity();
|
|
18436
18493
|
this.viewMatrix = Matrix4.fromIdentity();
|
|
18437
18494
|
this.projectionMatrix = Matrix4.fromIdentity();
|
|
@@ -18446,7 +18503,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
18446
18503
|
0,
|
|
18447
18504
|
0,
|
|
18448
18505
|
0
|
|
18449
|
-
] : _options_rotation;
|
|
18506
|
+
] : _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;
|
|
18450
18507
|
var euler = new Euler(rotation[0], rotation[1], rotation[2]);
|
|
18451
18508
|
var quat = new Quaternion().setFromEuler(euler);
|
|
18452
18509
|
this.options = {
|
|
@@ -18456,6 +18513,8 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
18456
18513
|
aspect: aspect,
|
|
18457
18514
|
clipMode: clipMode
|
|
18458
18515
|
};
|
|
18516
|
+
this.pixelWidth = pixelWidth;
|
|
18517
|
+
this.pixelHeight = pixelHeight;
|
|
18459
18518
|
this.transform.setPosition(position[0], position[1], position[2]);
|
|
18460
18519
|
this.transform.setQuaternion(quat.x, quat.y, quat.z, quat.w);
|
|
18461
18520
|
this.dirty = true;
|
|
@@ -18602,6 +18661,48 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
18602
18661
|
this.dirty = false;
|
|
18603
18662
|
}
|
|
18604
18663
|
};
|
|
18664
|
+
/**
|
|
18665
|
+
* 将世界坐标转换为屏幕像素坐标
|
|
18666
|
+
* @param position - 世界坐标
|
|
18667
|
+
* @param out - 输出的屏幕坐标,如果不传则创建新的 Vector3
|
|
18668
|
+
* @returns 屏幕坐标 (x, y 为像素坐标,左下角为(0,0),右上角为(width,height),z 为深度比例 [0,1],0=近平面,1=远平面)
|
|
18669
|
+
*/ _proto.worldToScreenPoint = function worldToScreenPoint(position, out) {
|
|
18670
|
+
this.updateMatrix();
|
|
18671
|
+
var result = out != null ? out : new Vector3();
|
|
18672
|
+
var vpMatrix = this.getViewProjectionMatrix();
|
|
18673
|
+
// 应用视图投影矩阵,得到 NDC 坐标 [-1, 1]
|
|
18674
|
+
result.set(position.x, position.y, position.z);
|
|
18675
|
+
vpMatrix.projectPoint(result, result);
|
|
18676
|
+
// 将 NDC 坐标转换为像素坐标
|
|
18677
|
+
// NDC: x,y in [-1, 1], 其中 (-1,-1) 是左下角,(1,1) 是右上角
|
|
18678
|
+
// Screen: x,y in [0, width/height], 其中 (0,0) 是左下角
|
|
18679
|
+
result.x = (result.x + 1) * 0.5 * this.pixelWidth;
|
|
18680
|
+
result.y = (result.y + 1) * 0.5 * this.pixelHeight;
|
|
18681
|
+
// 将 NDC z 值从 [-1, 1] 转换为深度比例 [0, 1]
|
|
18682
|
+
// -1 (近平面) -> 0, 1 (远平面) -> 1
|
|
18683
|
+
result.z = (result.z + 1) * 0.5;
|
|
18684
|
+
return result;
|
|
18685
|
+
};
|
|
18686
|
+
/**
|
|
18687
|
+
* 将屏幕像素坐标转换为世界坐标
|
|
18688
|
+
* @param position - 屏幕坐标 (x, y 为像素坐标,左下角为(0,0),z 为深度比例 [0,1],0=近平面,1=远平面)
|
|
18689
|
+
* @param out - 输出的世界坐标,如果不传则创建新的 Vector3
|
|
18690
|
+
* @returns 世界坐标
|
|
18691
|
+
*/ _proto.screenToWorldPoint = function screenToWorldPoint(position, out) {
|
|
18692
|
+
this.updateMatrix();
|
|
18693
|
+
var result = out != null ? out : new Vector3();
|
|
18694
|
+
var invVPMatrix = this.getInverseViewProjectionMatrix();
|
|
18695
|
+
// 将像素坐标转换为 NDC 坐标 [-1, 1]
|
|
18696
|
+
var ndcX = position.x / this.pixelWidth * 2 - 1;
|
|
18697
|
+
var ndcY = position.y / this.pixelHeight * 2 - 1;
|
|
18698
|
+
// 将深度比例 [0, 1] 转换为 NDC z 值 [-1, 1]
|
|
18699
|
+
// 0 (近平面) -> -1, 1 (远平面) -> 1
|
|
18700
|
+
var ndcZ = position.z * 2 - 1;
|
|
18701
|
+
// 应用逆视图投影矩阵
|
|
18702
|
+
result.set(ndcX, ndcY, ndcZ);
|
|
18703
|
+
invVPMatrix.projectPoint(result, result);
|
|
18704
|
+
return result;
|
|
18705
|
+
};
|
|
18605
18706
|
_create_class(Camera, [
|
|
18606
18707
|
{
|
|
18607
18708
|
key: "near",
|
|
@@ -21463,7 +21564,6 @@ function modifyMaxKeyframeShader(shader, maxVertex, maxFrag) {
|
|
|
21463
21564
|
var _proto = ParticleSystemRenderer.prototype;
|
|
21464
21565
|
_proto.onStart = function onStart() {
|
|
21465
21566
|
this._priority = this.item.renderOrder;
|
|
21466
|
-
this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);
|
|
21467
21567
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
21468
21568
|
var mesh = _step.value;
|
|
21469
21569
|
mesh.onStart();
|
|
@@ -22424,7 +22524,6 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
22424
22524
|
};
|
|
22425
22525
|
}
|
|
22426
22526
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
22427
|
-
this.item._content = this;
|
|
22428
22527
|
};
|
|
22429
22528
|
_create_class(ParticleSystem, [
|
|
22430
22529
|
{
|
|
@@ -22949,7 +23048,7 @@ var tempPos = new Vector3();
|
|
|
22949
23048
|
*/ _proto.sampleAnimation = function sampleAnimation() {
|
|
22950
23049
|
var _this = this;
|
|
22951
23050
|
var boundItem = this.boundObject;
|
|
22952
|
-
var duration =
|
|
23051
|
+
var duration = this.getDuration();
|
|
22953
23052
|
var life = this.time / duration;
|
|
22954
23053
|
life = life < 0 ? 0 : life > 1 ? 1 : life;
|
|
22955
23054
|
if (this.sizeXOverLifetime) {
|
|
@@ -23419,41 +23518,45 @@ exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
|
23419
23518
|
if (!_instanceof1(boundItem, exports.VFXItem)) {
|
|
23420
23519
|
return;
|
|
23421
23520
|
}
|
|
23422
|
-
var hasActiveTrack = false;
|
|
23423
23521
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.getChildTracks()), _step; !(_step = _iterator()).done;){
|
|
23424
23522
|
var childTrack = _step.value;
|
|
23425
23523
|
if (_instanceof1(childTrack, exports.ActivationTrack)) {
|
|
23426
|
-
|
|
23524
|
+
// 添加粒子动画 clip // TODO 待移除
|
|
23525
|
+
if (boundItem.getComponent(exports.ParticleSystem)) {
|
|
23526
|
+
var particleTrack = timelineAsset.createTrack(ParticleTrack, this, "ParticleTrack");
|
|
23527
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(childTrack.getClips()), _step1; !(_step1 = _iterator1()).done;){
|
|
23528
|
+
var activationClip = _step1.value;
|
|
23529
|
+
var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
|
|
23530
|
+
particleClip.start = activationClip.start;
|
|
23531
|
+
particleClip.duration = activationClip.duration;
|
|
23532
|
+
particleClip.endBehavior = activationClip.endBehavior;
|
|
23533
|
+
}
|
|
23534
|
+
}
|
|
23535
|
+
// 添加图层帧动画动画时间 clip // TODO 待移除
|
|
23536
|
+
if (boundItem.getComponent(exports.SpriteComponent)) {
|
|
23537
|
+
var componentTimeTrack = timelineAsset.createTrack(SpriteComponentTimeTrack, this, "SpriteComponentTimeTrack");
|
|
23538
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(childTrack.getClips()), _step2; !(_step2 = _iterator2()).done;){
|
|
23539
|
+
var activationClip1 = _step2.value;
|
|
23540
|
+
var clip = componentTimeTrack.createClip(ComponentTimePlayableAsset);
|
|
23541
|
+
clip.start = activationClip1.start;
|
|
23542
|
+
clip.duration = activationClip1.duration;
|
|
23543
|
+
clip.endBehavior = activationClip1.endBehavior;
|
|
23544
|
+
}
|
|
23545
|
+
}
|
|
23546
|
+
// 添加图层帧动画动画时间 clip // TODO 待移除
|
|
23547
|
+
if (boundItem.getComponent(exports.EffectComponent)) {
|
|
23548
|
+
var componentTimeTrack1 = timelineAsset.createTrack(EffectComponentTimeTrack, this, "EffectComponentTimeTrack");
|
|
23549
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(childTrack.getClips()), _step3; !(_step3 = _iterator3()).done;){
|
|
23550
|
+
var activationClip2 = _step3.value;
|
|
23551
|
+
var clip1 = componentTimeTrack1.createClip(ComponentTimePlayableAsset);
|
|
23552
|
+
clip1.start = activationClip2.start;
|
|
23553
|
+
clip1.duration = activationClip2.duration;
|
|
23554
|
+
clip1.endBehavior = activationClip2.endBehavior;
|
|
23555
|
+
}
|
|
23556
|
+
}
|
|
23427
23557
|
break;
|
|
23428
23558
|
}
|
|
23429
23559
|
}
|
|
23430
|
-
if (!hasActiveTrack) {
|
|
23431
|
-
return;
|
|
23432
|
-
}
|
|
23433
|
-
// 添加粒子动画 clip // TODO 待移除
|
|
23434
|
-
if (boundItem.getComponent(exports.ParticleSystem)) {
|
|
23435
|
-
var particleTrack = timelineAsset.createTrack(ParticleTrack, this, "ParticleTrack");
|
|
23436
|
-
var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
|
|
23437
|
-
particleClip.start = boundItem.start;
|
|
23438
|
-
particleClip.duration = boundItem.duration;
|
|
23439
|
-
particleClip.endBehavior = boundItem.endBehavior;
|
|
23440
|
-
}
|
|
23441
|
-
// 添加图层帧动画动画时间 clip // TODO 待移除
|
|
23442
|
-
if (boundItem.getComponent(exports.SpriteComponent)) {
|
|
23443
|
-
var componentTimeTrack = timelineAsset.createTrack(SpriteComponentTimeTrack, this, "SpriteComponentTimeTrack");
|
|
23444
|
-
var clip = componentTimeTrack.createClip(ComponentTimePlayableAsset);
|
|
23445
|
-
clip.start = boundItem.start;
|
|
23446
|
-
clip.duration = boundItem.duration;
|
|
23447
|
-
clip.endBehavior = boundItem.endBehavior;
|
|
23448
|
-
}
|
|
23449
|
-
// 添加图层帧动画动画时间 clip // TODO 待移除
|
|
23450
|
-
if (boundItem.getComponent(exports.EffectComponent)) {
|
|
23451
|
-
var componentTimeTrack1 = timelineAsset.createTrack(EffectComponentTimeTrack, this, "EffectComponentTimeTrack");
|
|
23452
|
-
var clip1 = componentTimeTrack1.createClip(ComponentTimePlayableAsset);
|
|
23453
|
-
clip1.start = boundItem.start;
|
|
23454
|
-
clip1.duration = boundItem.duration;
|
|
23455
|
-
clip1.endBehavior = boundItem.endBehavior;
|
|
23456
|
-
}
|
|
23457
23560
|
};
|
|
23458
23561
|
return ObjectBindingTrack;
|
|
23459
23562
|
}(exports.TrackAsset);
|
|
@@ -24238,13 +24341,14 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24238
24341
|
_this.pluginSystem = scene.pluginSystem;
|
|
24239
24342
|
_this.pluginSystem.initializeComposition(_assert_this_initialized(_this), scene);
|
|
24240
24343
|
_this.camera = new Camera(_this.name, _extends({}, sourceContent == null ? void 0 : sourceContent.camera, {
|
|
24241
|
-
aspect: width / height
|
|
24344
|
+
aspect: width / height,
|
|
24345
|
+
pixelWidth: width,
|
|
24346
|
+
pixelHeight: height
|
|
24242
24347
|
}));
|
|
24243
24348
|
_this.url = scene.url;
|
|
24244
24349
|
_this.interactive = true;
|
|
24245
24350
|
_this.handleItemMessage = handleItemMessage;
|
|
24246
24351
|
_this.createRenderFrame();
|
|
24247
|
-
_this.rendererOptions = null;
|
|
24248
24352
|
Composition.buildItemTree(_this.rootItem);
|
|
24249
24353
|
_this.rootComposition.setChildrenRenderOrder(0);
|
|
24250
24354
|
_this.pluginSystem.resetComposition(_assert_this_initialized(_this), _this.renderFrame);
|
|
@@ -24300,9 +24404,11 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24300
24404
|
this.restart();
|
|
24301
24405
|
}
|
|
24302
24406
|
if (this.rootComposition.isStartCalled) {
|
|
24303
|
-
this.
|
|
24407
|
+
this.setTime(this.time - this.startTime);
|
|
24408
|
+
this.resume();
|
|
24304
24409
|
} else {
|
|
24305
|
-
this.
|
|
24410
|
+
this.setTime(0);
|
|
24411
|
+
this.resume();
|
|
24306
24412
|
}
|
|
24307
24413
|
};
|
|
24308
24414
|
/**
|
|
@@ -24334,6 +24440,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24334
24440
|
* @param time - 相对 startTime 的时间
|
|
24335
24441
|
*/ _proto.gotoAndPlay = function gotoAndPlay(time) {
|
|
24336
24442
|
this.setTime(time);
|
|
24443
|
+
this.emit("goto", {
|
|
24444
|
+
time: time
|
|
24445
|
+
});
|
|
24337
24446
|
this.resume();
|
|
24338
24447
|
};
|
|
24339
24448
|
/**
|
|
@@ -24341,6 +24450,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24341
24450
|
* @param time - 相对 startTime 的时间
|
|
24342
24451
|
*/ _proto.gotoAndStop = function gotoAndStop(time) {
|
|
24343
24452
|
this.setTime(time);
|
|
24453
|
+
this.emit("goto", {
|
|
24454
|
+
time: time
|
|
24455
|
+
});
|
|
24344
24456
|
this.pause();
|
|
24345
24457
|
};
|
|
24346
24458
|
/**
|
|
@@ -24371,9 +24483,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24371
24483
|
if (pause) {
|
|
24372
24484
|
this.paused = true;
|
|
24373
24485
|
}
|
|
24374
|
-
this.emit("goto", {
|
|
24375
|
-
time: time
|
|
24376
|
-
});
|
|
24377
24486
|
};
|
|
24378
24487
|
_proto.addItem = function addItem(item) {
|
|
24379
24488
|
this.items.push(item);
|
|
@@ -24405,7 +24514,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24405
24514
|
/**
|
|
24406
24515
|
* 重置状态函数
|
|
24407
24516
|
*/ _proto.reset = function reset() {
|
|
24408
|
-
this.rendererOptions = null;
|
|
24409
24517
|
this.isEnded = false;
|
|
24410
24518
|
this.isEndCalled = false;
|
|
24411
24519
|
this.rootComposition.time = 0;
|
|
@@ -24431,9 +24539,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24431
24539
|
if (this.getPaused()) {
|
|
24432
24540
|
return;
|
|
24433
24541
|
}
|
|
24434
|
-
//
|
|
24542
|
+
// Scene VFXItem components lifetime function
|
|
24435
24543
|
if (!this.rootItem.isDuringPlay) {
|
|
24436
|
-
this.
|
|
24544
|
+
this.rootItem.awake();
|
|
24437
24545
|
this.rootItem.beginPlay();
|
|
24438
24546
|
}
|
|
24439
24547
|
var previousCompositionTime = this.time;
|
|
@@ -24458,19 +24566,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24458
24566
|
_proto.shouldDispose = function shouldDispose() {
|
|
24459
24567
|
return this.isEnded && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
|
|
24460
24568
|
};
|
|
24461
|
-
_proto.callAwake = function callAwake(item) {
|
|
24462
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
24463
|
-
var component = _step.value;
|
|
24464
|
-
if (!component.isAwakeCalled) {
|
|
24465
|
-
component.onAwake();
|
|
24466
|
-
component.isAwakeCalled = true;
|
|
24467
|
-
}
|
|
24468
|
-
}
|
|
24469
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.children), _step1; !(_step1 = _iterator1()).done;){
|
|
24470
|
-
var child = _step1.value;
|
|
24471
|
-
this.callAwake(child);
|
|
24472
|
-
}
|
|
24473
|
-
};
|
|
24474
24569
|
/**
|
|
24475
24570
|
* 更新相机
|
|
24476
24571
|
* @override
|
|
@@ -24559,7 +24654,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24559
24654
|
return (_this_renderer = this.renderer) == null ? void 0 : _this_renderer.engine;
|
|
24560
24655
|
};
|
|
24561
24656
|
/**
|
|
24562
|
-
* Item 求交测试,返回求交结果列表,x 和 y 是归一化到[-1, 1]
|
|
24657
|
+
* Item 求交测试,返回求交结果列表,x 和 y 是归一化到[-1, 1]区间的值,x 向右,y 向上
|
|
24563
24658
|
* @param x - 鼠标或触点的 x,已经归一化到[-1, 1]
|
|
24564
24659
|
* @param y - 鼠标或触点的 y,已经归一化到[-1, 1]
|
|
24565
24660
|
* @param force - 是否强制求交,没有交互信息的 Item 也要进行求交测试
|
|
@@ -24658,7 +24753,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24658
24753
|
* 合成对象销毁
|
|
24659
24754
|
*/ _proto.dispose = function dispose() {
|
|
24660
24755
|
var _this = this;
|
|
24661
|
-
var
|
|
24756
|
+
var _this_pluginSystem;
|
|
24662
24757
|
if (this.destroyed) {
|
|
24663
24758
|
return;
|
|
24664
24759
|
}
|
|
@@ -24678,7 +24773,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24678
24773
|
this.rootItem.dispose();
|
|
24679
24774
|
// FIXME: 注意这里增加了renderFrame销毁
|
|
24680
24775
|
this.renderFrame.dispose();
|
|
24681
|
-
(_this_rendererOptions = this.rendererOptions) == null ? void 0 : _this_rendererOptions.emptyTexture.dispose();
|
|
24682
24776
|
(_this_pluginSystem = this.pluginSystem) == null ? void 0 : _this_pluginSystem.destroyComposition(this);
|
|
24683
24777
|
this.update = function() {
|
|
24684
24778
|
{
|
|
@@ -24775,15 +24869,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24775
24869
|
this.textureOffloaded = true;
|
|
24776
24870
|
}
|
|
24777
24871
|
};
|
|
24778
|
-
_proto.getRendererOptions = function getRendererOptions() {
|
|
24779
|
-
if (!this.rendererOptions) {
|
|
24780
|
-
this.rendererOptions = {
|
|
24781
|
-
emptyTexture: this.renderFrame.emptyTexture,
|
|
24782
|
-
cachePrefix: "-"
|
|
24783
|
-
};
|
|
24784
|
-
}
|
|
24785
|
-
return this.rendererOptions;
|
|
24786
|
-
};
|
|
24787
24872
|
/**
|
|
24788
24873
|
* 重新加载纹理
|
|
24789
24874
|
*/ _proto.reloadTexture = function reloadTexture() {
|
|
@@ -24897,7 +24982,9 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
24897
24982
|
function VFXItem(engine, props) {
|
|
24898
24983
|
var _this;
|
|
24899
24984
|
_this = EffectsObject.call(this, engine) || this;
|
|
24900
|
-
|
|
24985
|
+
/**
|
|
24986
|
+
* 元素的子元素列表
|
|
24987
|
+
*/ _this.children = [];
|
|
24901
24988
|
/**
|
|
24902
24989
|
* 元素的变换包含位置、旋转、缩放。
|
|
24903
24990
|
*/ _this.transform = new Transform();
|
|
@@ -24908,9 +24995,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
24908
24995
|
* 元素动画的持续时间
|
|
24909
24996
|
*/ _this.duration = 0;
|
|
24910
24997
|
/**
|
|
24911
|
-
* 元素动画的开始时间
|
|
24912
|
-
*/ _this.start = 0;
|
|
24913
|
-
/**
|
|
24914
24998
|
* 元素动画结束时行为(如何处理元素)
|
|
24915
24999
|
*/ _this.endBehavior = EndBehavior.forward;
|
|
24916
25000
|
_this.type = ItemType.base;
|
|
@@ -25030,6 +25114,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25030
25114
|
this.composition = vfxItem.composition;
|
|
25031
25115
|
}
|
|
25032
25116
|
if (!this.isDuringPlay && vfxItem.isDuringPlay) {
|
|
25117
|
+
this.awake();
|
|
25033
25118
|
this.beginPlay();
|
|
25034
25119
|
}
|
|
25035
25120
|
};
|
|
@@ -25205,6 +25290,21 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25205
25290
|
};
|
|
25206
25291
|
/**
|
|
25207
25292
|
* @internal
|
|
25293
|
+
*/ _proto.awake = function awake() {
|
|
25294
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
25295
|
+
var component = _step.value;
|
|
25296
|
+
if (!component.isAwakeCalled) {
|
|
25297
|
+
component.onAwake();
|
|
25298
|
+
component.isAwakeCalled = true;
|
|
25299
|
+
}
|
|
25300
|
+
}
|
|
25301
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.children), _step1; !(_step1 = _iterator1()).done;){
|
|
25302
|
+
var child = _step1.value;
|
|
25303
|
+
child.awake();
|
|
25304
|
+
}
|
|
25305
|
+
};
|
|
25306
|
+
/**
|
|
25307
|
+
* @internal
|
|
25208
25308
|
*/ _proto.onActiveChanged = function onActiveChanged() {
|
|
25209
25309
|
if (!this.isEnabled) {
|
|
25210
25310
|
this.onEnable();
|
|
@@ -25243,12 +25343,11 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25243
25343
|
};
|
|
25244
25344
|
_proto.fromData = function fromData(data) {
|
|
25245
25345
|
EffectsObject.prototype.fromData.call(this, data);
|
|
25246
|
-
var id = data.id, name = data.name,
|
|
25346
|
+
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;
|
|
25247
25347
|
this.props = data;
|
|
25248
25348
|
this.type = data.type;
|
|
25249
25349
|
this.id = id.toString(); // TODO 老数据 id 是 number,需要转换
|
|
25250
25350
|
this.name = name;
|
|
25251
|
-
this.start = delay ? delay : this.start;
|
|
25252
25351
|
if (transform) {
|
|
25253
25352
|
this.transform.fromData(transform);
|
|
25254
25353
|
}
|
|
@@ -25325,10 +25424,10 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25325
25424
|
component.dispose();
|
|
25326
25425
|
}
|
|
25327
25426
|
this.components = [];
|
|
25328
|
-
this._content = undefined;
|
|
25329
25427
|
this._composition = null;
|
|
25330
25428
|
this.transform.setValid(false);
|
|
25331
25429
|
}
|
|
25430
|
+
EffectsObject.prototype.dispose.call(this);
|
|
25332
25431
|
};
|
|
25333
25432
|
_proto.resetChildrenParent = function resetChildrenParent() {
|
|
25334
25433
|
// GE 父元素销毁子元素继承逻辑
|
|
@@ -25468,14 +25567,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
25468
25567
|
return false;
|
|
25469
25568
|
};
|
|
25470
25569
|
_create_class(VFXItem, [
|
|
25471
|
-
{
|
|
25472
|
-
key: "content",
|
|
25473
|
-
get: /**
|
|
25474
|
-
* 返回元素创建的数据
|
|
25475
|
-
*/ function get() {
|
|
25476
|
-
return this._content;
|
|
25477
|
-
}
|
|
25478
|
-
},
|
|
25479
25570
|
{
|
|
25480
25571
|
key: "composition",
|
|
25481
25572
|
get: /**
|
|
@@ -25609,7 +25700,7 @@ var ColorPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
25609
25700
|
}
|
|
25610
25701
|
var colorInc = vecFill(tempColor, 1);
|
|
25611
25702
|
var colorChanged;
|
|
25612
|
-
var life = this.time /
|
|
25703
|
+
var life = this.time / this.getDuration();
|
|
25613
25704
|
var opacityOverLifetime = this.opacityOverLifetime;
|
|
25614
25705
|
var colorOverLifetime = this.colorOverLifetime;
|
|
25615
25706
|
if (colorOverLifetime) {
|
|
@@ -25893,7 +25984,7 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25893
25984
|
_this = MaskableGraphic.call(this, engine) || this;
|
|
25894
25985
|
_this.time = 0;
|
|
25895
25986
|
_this.duration = 0;
|
|
25896
|
-
_this.
|
|
25987
|
+
_this.loop = true;
|
|
25897
25988
|
/**
|
|
25898
25989
|
* @internal
|
|
25899
25990
|
*/ _this.splits = singleSplits;
|
|
@@ -25908,7 +25999,7 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25908
25999
|
var _this = this;
|
|
25909
26000
|
var time = this.time;
|
|
25910
26001
|
var duration = this.duration;
|
|
25911
|
-
if (time > duration && this.
|
|
26002
|
+
if (time > duration && this.loop) {
|
|
25912
26003
|
time = time % duration;
|
|
25913
26004
|
}
|
|
25914
26005
|
var life = Math.min(Math.max(time / duration, 0.0), 1.0);
|
|
@@ -26148,6 +26239,8 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
26148
26239
|
var _data_duration;
|
|
26149
26240
|
//@ts-expect-error
|
|
26150
26241
|
this.duration = (_data_duration = data.duration) != null ? _data_duration : this.item.duration;
|
|
26242
|
+
var _data_loop;
|
|
26243
|
+
this.loop = (_data_loop = data.loop) != null ? _data_loop : true;
|
|
26151
26244
|
};
|
|
26152
26245
|
return SpriteComponent;
|
|
26153
26246
|
}(MaskableGraphic);
|
|
@@ -28900,7 +28993,8 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
28900
28993
|
function TextLayout(options) {
|
|
28901
28994
|
this.width = 0;
|
|
28902
28995
|
this.height = 0;
|
|
28903
|
-
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,
|
|
28996
|
+
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
|
|
28997
|
+
useLegacyRichText, useLegacyRichText = _options_useLegacyRichText === void 0 ? false : _options_useLegacyRichText;
|
|
28904
28998
|
var tempWidth = fontSize + letterSpace;
|
|
28905
28999
|
this.autoWidth = autoWidth;
|
|
28906
29000
|
this.maxTextWidth = text.length * tempWidth;
|
|
@@ -28908,6 +29002,7 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
28908
29002
|
this.height = textHeight;
|
|
28909
29003
|
this.letterSpace = letterSpace;
|
|
28910
29004
|
this.lineGap = lineGap;
|
|
29005
|
+
this.useLegacyRichText = useLegacyRichText;
|
|
28911
29006
|
this.overflow = textOverflow;
|
|
28912
29007
|
this.textBaseline = textBaseline;
|
|
28913
29008
|
this.textAlign = textAlign;
|
|
@@ -28958,6 +29053,38 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
28958
29053
|
return offsetX;
|
|
28959
29054
|
};
|
|
28960
29055
|
/**
|
|
29056
|
+
* 富文本垂直对齐计算
|
|
29057
|
+
* @param style - 字体样式
|
|
29058
|
+
* @param lineHeights - 每行高度数组
|
|
29059
|
+
* @param fontSize - 字体大小
|
|
29060
|
+
* @returns 第一行基线的 Y 坐标
|
|
29061
|
+
*/ _proto.getOffsetYRich = function getOffsetYRich(style, lineHeights, fontSize) {
|
|
29062
|
+
var outlineWidth = style.outlineWidth, fontScale = style.fontScale;
|
|
29063
|
+
var total = lineHeights.reduce(function(a, b) {
|
|
29064
|
+
return a + b;
|
|
29065
|
+
}, 0);
|
|
29066
|
+
// 使用与原始 getOffsetY 相同的经验值计算
|
|
29067
|
+
// /3 计算 Y 轴偏移量,以匹配编辑器行为
|
|
29068
|
+
var offsetY = (lineHeights[0] - fontSize) / 3;
|
|
29069
|
+
// 计算基础偏移量(从画布顶部到第一行基线的距离)
|
|
29070
|
+
var baseOffset = fontSize + outlineWidth * fontScale;
|
|
29071
|
+
// 除第一行外的所有行的总高度
|
|
29072
|
+
var commonCalculation = total - lineHeights[0]; // 使用实际总高度减去第一行高度
|
|
29073
|
+
var offsetResult = 0;
|
|
29074
|
+
switch(this.textBaseline){
|
|
29075
|
+
case TextBaseline.top:
|
|
29076
|
+
offsetResult = baseOffset + offsetY;
|
|
29077
|
+
break;
|
|
29078
|
+
case TextBaseline.middle:
|
|
29079
|
+
offsetResult = (this.height * fontScale - total + this.lineGap * fontScale) / 2 + baseOffset;
|
|
29080
|
+
break;
|
|
29081
|
+
case TextBaseline.bottom:
|
|
29082
|
+
offsetResult = this.height * fontScale - commonCalculation - offsetY;
|
|
29083
|
+
break;
|
|
29084
|
+
}
|
|
29085
|
+
return offsetResult;
|
|
29086
|
+
};
|
|
29087
|
+
/**
|
|
28961
29088
|
* 设置文本框的宽度和高度
|
|
28962
29089
|
* @param width 文本框宽度
|
|
28963
29090
|
* @param height 文本框高度
|
|
@@ -29088,6 +29215,10 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29088
29215
|
MaskableGraphic.prototype.onUpdate.call(this, dt);
|
|
29089
29216
|
this.updateTexture();
|
|
29090
29217
|
};
|
|
29218
|
+
_proto.onDestroy = function onDestroy() {
|
|
29219
|
+
MaskableGraphic.prototype.onDestroy.call(this);
|
|
29220
|
+
this.disposeTextTexture();
|
|
29221
|
+
};
|
|
29091
29222
|
_proto.fromData = function fromData(data) {
|
|
29092
29223
|
MaskableGraphic.prototype.fromData.call(this, data);
|
|
29093
29224
|
var interaction = data.interaction, options = data.options;
|
|
@@ -29128,10 +29259,10 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
29128
29259
|
var width = this.textLayout.width + this.textStyle.fontOffset;
|
|
29129
29260
|
var lineCount = 1;
|
|
29130
29261
|
var x = 0;
|
|
29131
|
-
|
|
29132
|
-
|
|
29133
|
-
|
|
29134
|
-
|
|
29262
|
+
// 设置context.font的字号,确保measureText能正确计算字宽
|
|
29263
|
+
if (context) {
|
|
29264
|
+
context.font = this.getFontDesc(this.textStyle.fontSize);
|
|
29265
|
+
}
|
|
29135
29266
|
for(var i = 0; i < text.length; i++){
|
|
29136
29267
|
var _context_measureText;
|
|
29137
29268
|
var str = text[i];
|
|
@@ -29461,10 +29592,17 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
29461
29592
|
wrapS: glContext.CLAMP_TO_EDGE,
|
|
29462
29593
|
wrapT: glContext.CLAMP_TO_EDGE
|
|
29463
29594
|
});
|
|
29595
|
+
this.disposeTextTexture();
|
|
29464
29596
|
this.renderer.texture = texture;
|
|
29465
29597
|
this.material.setTexture("_MainTex", texture);
|
|
29466
29598
|
this.isDirty = false;
|
|
29467
29599
|
};
|
|
29600
|
+
_proto.disposeTextTexture = function disposeTextTexture() {
|
|
29601
|
+
var texture = this.renderer.texture;
|
|
29602
|
+
if (texture && texture !== this.engine.whiteTexture) {
|
|
29603
|
+
texture.dispose();
|
|
29604
|
+
}
|
|
29605
|
+
};
|
|
29468
29606
|
_proto.getFontDesc = function getFontDesc(size) {
|
|
29469
29607
|
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;
|
|
29470
29608
|
var fontDesc = "" + (size || fontSize * fontScale).toString() + "px ";
|
|
@@ -30505,35 +30643,75 @@ function version34Migration(json) {
|
|
|
30505
30643
|
}
|
|
30506
30644
|
if (componentData1.dataType === DataType.ShapeComponent) {
|
|
30507
30645
|
var shapeComponentData = componentData1;
|
|
30508
|
-
//@ts-expect-error
|
|
30509
30646
|
shapeComponentData.fills = [];
|
|
30647
|
+
//@ts-expect-error
|
|
30510
30648
|
if (shapeComponentData.fill) {
|
|
30511
30649
|
var solidPaintData = {
|
|
30512
|
-
type:
|
|
30650
|
+
type: FillType.Solid,
|
|
30651
|
+
//@ts-expect-error
|
|
30513
30652
|
color: shapeComponentData.fill.color
|
|
30514
30653
|
};
|
|
30515
|
-
//@ts-expect-error
|
|
30516
30654
|
shapeComponentData.fills.push(solidPaintData);
|
|
30517
30655
|
}
|
|
30518
|
-
delete shapeComponentData.fill;
|
|
30519
30656
|
//@ts-expect-error
|
|
30657
|
+
delete shapeComponentData.fill;
|
|
30520
30658
|
shapeComponentData.strokes = [];
|
|
30659
|
+
//@ts-expect-error
|
|
30521
30660
|
if (shapeComponentData.stroke) {
|
|
30522
30661
|
var solidPaintData1 = {
|
|
30523
|
-
type:
|
|
30662
|
+
type: FillType.Solid,
|
|
30663
|
+
//@ts-expect-error
|
|
30524
30664
|
color: shapeComponentData.stroke.color
|
|
30525
30665
|
};
|
|
30526
|
-
//@ts-expect-error
|
|
30527
30666
|
shapeComponentData.strokes.push(solidPaintData1);
|
|
30528
30667
|
//@ts-expect-error
|
|
30529
|
-
shapeComponentData.
|
|
30668
|
+
shapeComponentData.strokeWidth = shapeComponentData.stroke.width;
|
|
30669
|
+
//@ts-expect-error
|
|
30670
|
+
shapeComponentData.strokeCap = shapeComponentData.stroke.cap;
|
|
30671
|
+
//@ts-expect-error
|
|
30672
|
+
shapeComponentData.strokeJoin = shapeComponentData.stroke.join;
|
|
30673
|
+
//@ts-expect-error
|
|
30674
|
+
delete shapeComponentData.stroke;
|
|
30530
30675
|
}
|
|
30531
30676
|
}
|
|
30532
30677
|
}
|
|
30678
|
+
// 处理富文本lineGap兼容性
|
|
30679
|
+
processRichTextLineGapCompatibility(json);
|
|
30533
30680
|
//@ts-expect-error
|
|
30534
30681
|
json.version = "3.5";
|
|
30535
30682
|
return json;
|
|
30536
30683
|
}
|
|
30684
|
+
/**
|
|
30685
|
+
* 处理富文本 lineGap 兼容性
|
|
30686
|
+
*/ function processRichTextLineGapCompatibility(json) {
|
|
30687
|
+
if (!json.components) {
|
|
30688
|
+
return;
|
|
30689
|
+
}
|
|
30690
|
+
// 遍历所有组件,处理富文本组件
|
|
30691
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(json.components), _step; !(_step = _iterator()).done;){
|
|
30692
|
+
var component = _step.value;
|
|
30693
|
+
// 识别富文本组件并处理 lineGap 兼容性
|
|
30694
|
+
if (component.dataType === DataType.RichTextComponent && component.options) {
|
|
30695
|
+
ensureRichTextLineGap(component.options);
|
|
30696
|
+
}
|
|
30697
|
+
}
|
|
30698
|
+
}
|
|
30699
|
+
/**
|
|
30700
|
+
* 确保富文本组件有版本标识字段
|
|
30701
|
+
*/ function ensureRichTextLineGap(options) {
|
|
30702
|
+
// 检查是否已经处理过
|
|
30703
|
+
if (!options || options.useLegacyRichText !== undefined) {
|
|
30704
|
+
return;
|
|
30705
|
+
}
|
|
30706
|
+
// 根据是否存在 lineGap 字段来判断版本
|
|
30707
|
+
if (options.lineGap === undefined) {
|
|
30708
|
+
// 旧版本(没有 lineGap 字段)
|
|
30709
|
+
options.useLegacyRichText = true;
|
|
30710
|
+
} else {
|
|
30711
|
+
// 新版本(有 lineGap 字段)
|
|
30712
|
+
options.useLegacyRichText = false;
|
|
30713
|
+
}
|
|
30714
|
+
}
|
|
30537
30715
|
/**
|
|
30538
30716
|
* 根据形状获取形状几何体数据
|
|
30539
30717
|
* @param shape - 形状
|
|
@@ -31456,7 +31634,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31456
31634
|
return ret;
|
|
31457
31635
|
}
|
|
31458
31636
|
|
|
31459
|
-
var version$2 = "2.7.0-
|
|
31637
|
+
var version$2 = "2.7.0-beta.0";
|
|
31460
31638
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31461
31639
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31462
31640
|
var reverseParticle = false;
|
|
@@ -32692,7 +32870,7 @@ function createTextureOptionsBySource(image, sourceFrom, id) {
|
|
|
32692
32870
|
function AssetService(engine) {
|
|
32693
32871
|
this.engine = engine;
|
|
32694
32872
|
this.builtinObjects = [];
|
|
32695
|
-
this.builtinObjects.push(
|
|
32873
|
+
this.builtinObjects.push(engine.whiteTexture);
|
|
32696
32874
|
}
|
|
32697
32875
|
var _proto = AssetService.prototype;
|
|
32698
32876
|
/**
|
|
@@ -34368,7 +34546,7 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
34368
34546
|
this.jsonSceneData = {};
|
|
34369
34547
|
this.objectInstance = {};
|
|
34370
34548
|
this.assetLoader = new AssetLoader(this);
|
|
34371
|
-
this.
|
|
34549
|
+
this.whiteTexture = generateWhiteTexture(this);
|
|
34372
34550
|
this.transparentTexture = generateTransparentTexture(this);
|
|
34373
34551
|
}
|
|
34374
34552
|
var _proto = Engine.prototype;
|
|
@@ -34729,7 +34907,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
|
|
|
34729
34907
|
registerPlugin("particle", ParticleLoader, exports.VFXItem);
|
|
34730
34908
|
registerPlugin("cal", CalculateLoader, exports.VFXItem);
|
|
34731
34909
|
registerPlugin("interact", InteractLoader, exports.VFXItem);
|
|
34732
|
-
var version$1 = "2.7.0-
|
|
34910
|
+
var version$1 = "2.7.0-beta.0";
|
|
34733
34911
|
logger.info("Core version: " + version$1 + ".");
|
|
34734
34912
|
|
|
34735
34913
|
var _obj;
|
|
@@ -35048,12 +35226,13 @@ var _obj3;
|
|
|
35048
35226
|
//FIXME: 暂时不实现
|
|
35049
35227
|
throw new Error("Method not implemented.");
|
|
35050
35228
|
};
|
|
35051
|
-
_proto.dispose = function dispose(
|
|
35052
|
-
if (
|
|
35229
|
+
_proto.dispose = function dispose() {
|
|
35230
|
+
if (this.destroyed) {
|
|
35053
35231
|
return;
|
|
35054
35232
|
}
|
|
35055
35233
|
this.material.dispose();
|
|
35056
35234
|
this.destroyed = true;
|
|
35235
|
+
Material.prototype.dispose.call(this);
|
|
35057
35236
|
};
|
|
35058
35237
|
_create_class(ThreeMaterial, [
|
|
35059
35238
|
{
|
|
@@ -35540,6 +35719,7 @@ var seed = 1;
|
|
|
35540
35719
|
}
|
|
35541
35720
|
this.geometry.dispose();
|
|
35542
35721
|
this.destroyed = true;
|
|
35722
|
+
Geometry.prototype.dispose.call(this);
|
|
35543
35723
|
};
|
|
35544
35724
|
_proto.setAttributeType = function setAttributeType(name, attr, geometry, attributes, maxCount) {
|
|
35545
35725
|
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;
|
|
@@ -35681,6 +35861,7 @@ var seed = 1;
|
|
|
35681
35861
|
this.mesh.clear();
|
|
35682
35862
|
this.destroyed = true;
|
|
35683
35863
|
}
|
|
35864
|
+
Mesh.prototype.dispose.call(this);
|
|
35684
35865
|
};
|
|
35685
35866
|
_create_class(ThreeMesh, [
|
|
35686
35867
|
{
|
|
@@ -35768,6 +35949,7 @@ var seed = 1;
|
|
|
35768
35949
|
* 释放纹理占用的内存
|
|
35769
35950
|
*/ _proto.dispose = function dispose() {
|
|
35770
35951
|
this.texture.dispose();
|
|
35952
|
+
Texture.prototype.dispose.call(this);
|
|
35771
35953
|
};
|
|
35772
35954
|
/**
|
|
35773
35955
|
* 通过图层设置创建贴图
|
|
@@ -35907,25 +36089,6 @@ var seed = 1;
|
|
|
35907
36089
|
}
|
|
35908
36090
|
}
|
|
35909
36091
|
};
|
|
35910
|
-
/**
|
|
35911
|
-
* 获取 render 参数
|
|
35912
|
-
*
|
|
35913
|
-
* @returns
|
|
35914
|
-
*/ _proto.getRendererOptions = function getRendererOptions() {
|
|
35915
|
-
var emptyTexture = ThreeTexture.createWithData(this.renderer.engine, {
|
|
35916
|
-
data: new Uint8Array(4).fill(255),
|
|
35917
|
-
width: 1,
|
|
35918
|
-
height: 1
|
|
35919
|
-
});
|
|
35920
|
-
emptyTexture.texture.needsUpdate = true;
|
|
35921
|
-
if (!this.rendererOptions) {
|
|
35922
|
-
this.rendererOptions = {
|
|
35923
|
-
emptyTexture: emptyTexture,
|
|
35924
|
-
cachePrefix: "-"
|
|
35925
|
-
};
|
|
35926
|
-
}
|
|
35927
|
-
return this.rendererOptions;
|
|
35928
|
-
};
|
|
35929
36092
|
return ThreeComposition;
|
|
35930
36093
|
}(Composition);
|
|
35931
36094
|
/**
|
|
@@ -36167,10 +36330,10 @@ exports.ThreeSpriteComponent = /*#__PURE__*/ function(SpriteComponent) {
|
|
|
36167
36330
|
* 销毁方法
|
|
36168
36331
|
*
|
|
36169
36332
|
*/ _proto.dispose = function dispose() {
|
|
36170
|
-
SpriteComponent.prototype.dispose.call(this);
|
|
36171
36333
|
if (!this.isActiveAndEnabled) {
|
|
36172
36334
|
this.threeMesh.clear();
|
|
36173
36335
|
}
|
|
36336
|
+
SpriteComponent.prototype.dispose.call(this);
|
|
36174
36337
|
};
|
|
36175
36338
|
_proto.fromData = function fromData(data) {
|
|
36176
36339
|
SpriteComponent.prototype.fromData.call(this, data);
|
|
@@ -36325,7 +36488,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
36325
36488
|
*/ Mesh.create = function(engine, props) {
|
|
36326
36489
|
return new ThreeMesh(engine, props);
|
|
36327
36490
|
};
|
|
36328
|
-
var version = "2.7.0-
|
|
36491
|
+
var version = "2.7.0-beta.0";
|
|
36329
36492
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
36330
36493
|
|
|
36331
36494
|
exports.AbstractPlugin = AbstractPlugin;
|