@galacean/effects-core 2.1.0-alpha.4 → 2.1.0-alpha.6

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 CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime core for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.1.0-alpha.4
6
+ * Version: v2.1.0-alpha.6
7
7
  */
8
8
 
9
9
  'use strict';
@@ -3950,6 +3950,12 @@ Euler.tempMat0 = new Matrix4();
3950
3950
  /**
3951
3951
  * 节点元素
3952
3952
  */ ItemType["node"] = "node";
3953
+ /**
3954
+ * 视频元素
3955
+ */ ItemType["video"] = "video";
3956
+ /**
3957
+ * 音频元素
3958
+ */ ItemType["audio"] = "audio";
3953
3959
  })(ItemType || (ItemType = {}));
3954
3960
  /**
3955
3961
  * 渲染模式
@@ -4050,15 +4056,6 @@ var CameraClipMode;
4050
4056
  */ CameraClipMode[CameraClipMode["landscape"] = 0] = "landscape";
4051
4057
  })(CameraClipMode || (CameraClipMode = {}));
4052
4058
 
4053
- /**
4054
- * 动态换图类型
4055
- * @since 1.1.0
4056
- */ var BackgroundType;
4057
- (function(BackgroundType) {
4058
- BackgroundType["video"] = "video";
4059
- BackgroundType["image"] = "image";
4060
- })(BackgroundType || (BackgroundType = {}));
4061
-
4062
4059
  /*********************************************/ /* 基本数值属性参数 */ /*********************************************/ var ValueType;
4063
4060
  (function(ValueType) {
4064
4061
  /**
@@ -4364,6 +4361,8 @@ var DataType;
4364
4361
  DataType["TreeComponent"] = "TreeComponent";
4365
4362
  DataType["AnimationComponent"] = "AnimationComponent";
4366
4363
  DataType["SpineComponent"] = "SpineComponent";
4364
+ DataType["VideoComponent"] = "VideoComponent";
4365
+ DataType["AudioComponent"] = "AudioComponent";
4367
4366
  // Non-EffectObject
4368
4367
  DataType["TimelineClip"] = "TimelineClip";
4369
4368
  })(DataType || (DataType = {}));
@@ -4453,10 +4452,28 @@ var VertexBufferSemantic;
4453
4452
 
4454
4453
  var BuiltinObjectGUID = {
4455
4454
  WhiteTexture: "whitetexture00000000000000000000",
4455
+ TransparentTexture: "transparenttexture00000000000000000000",
4456
4456
  PBRShader: "pbr00000000000000000000000000000",
4457
4457
  UnlitShader: "unlit000000000000000000000000000"
4458
4458
  };
4459
4459
 
4460
+ /**
4461
+ * 动态换图类型
4462
+ * @since 1.1.0
4463
+ */ var BackgroundType;
4464
+ (function(BackgroundType) {
4465
+ BackgroundType["video"] = "video";
4466
+ BackgroundType["image"] = "image";
4467
+ })(BackgroundType || (BackgroundType = {}));
4468
+ /**
4469
+ * 多媒体资源类型
4470
+ * @since 2.1.0
4471
+ */ var MultimediaType;
4472
+ (function(MultimediaType) {
4473
+ MultimediaType["video"] = "video";
4474
+ MultimediaType["audio"] = "audio";
4475
+ })(MultimediaType || (MultimediaType = {}));
4476
+
4460
4477
  var index$1 = /*#__PURE__*/Object.freeze({
4461
4478
  __proto__: null,
4462
4479
  get RenderLevel () { return RenderLevel; },
@@ -4473,7 +4490,6 @@ var index$1 = /*#__PURE__*/Object.freeze({
4473
4490
  get RenderType () { return RenderType; },
4474
4491
  get RenderFace () { return RenderFace; },
4475
4492
  get CameraClipMode () { return CameraClipMode; },
4476
- get BackgroundType () { return BackgroundType; },
4477
4493
  END_BEHAVIOR_DESTROY: END_BEHAVIOR_DESTROY,
4478
4494
  END_BEHAVIOR_PAUSE: END_BEHAVIOR_PAUSE,
4479
4495
  END_BEHAVIOR_FORWARD: END_BEHAVIOR_FORWARD,
@@ -4507,7 +4523,9 @@ var index$1 = /*#__PURE__*/Object.freeze({
4507
4523
  get VertexFormatType () { return VertexFormatType; },
4508
4524
  get IndexFormatType () { return IndexFormatType; },
4509
4525
  get VertexBufferSemantic () { return VertexBufferSemantic; },
4510
- BuiltinObjectGUID: BuiltinObjectGUID
4526
+ BuiltinObjectGUID: BuiltinObjectGUID,
4527
+ get BackgroundType () { return BackgroundType; },
4528
+ get MultimediaType () { return MultimediaType; }
4511
4529
  });
4512
4530
 
4513
4531
  var decoratorInitialStore = new Map();
@@ -8170,11 +8188,11 @@ function _loadMedia() {
8170
8188
  return _loadMedia.apply(this, arguments);
8171
8189
  }
8172
8190
 
8173
- function deserializeMipmapTexture(textureOptions, bins, engine) {
8191
+ function deserializeMipmapTexture(textureOptions, bins, assets) {
8174
8192
  return _deserializeMipmapTexture.apply(this, arguments);
8175
8193
  }
8176
8194
  function _deserializeMipmapTexture() {
8177
- _deserializeMipmapTexture = _async_to_generator(function(textureOptions, bins, engine, files) {
8195
+ _deserializeMipmapTexture = _async_to_generator(function(textureOptions, bins, assets, files) {
8178
8196
  var mipmaps, target, jobs, loadedMipmaps, mipmaps1, target1, jobs1, loadedMipmaps1, bin;
8179
8197
  return __generator(this, function(_state) {
8180
8198
  switch(_state.label){
@@ -8190,9 +8208,8 @@ function _deserializeMipmapTexture() {
8190
8208
  // @ts-expect-error
8191
8209
  if (pointer.id) {
8192
8210
  // @ts-expect-error
8193
- var loadedImageAsset = engine.assetLoader.loadGUID(pointer.id);
8194
- // @ts-expect-error
8195
- return loadedImageAsset.data;
8211
+ var loadedImage = assets[pointer.id];
8212
+ return loadedImage;
8196
8213
  } else {
8197
8214
  return loadMipmapImage(pointer, bins);
8198
8215
  }
@@ -8429,7 +8446,7 @@ var sourceOptions = {
8429
8446
  };
8430
8447
  function generateWhiteTexture(engine) {
8431
8448
  return Texture.create(engine, _extends({
8432
- id: "whitetexture00000000000000000000",
8449
+ id: BuiltinObjectGUID.WhiteTexture,
8433
8450
  data: {
8434
8451
  width: 1,
8435
8452
  height: 1,
@@ -8445,7 +8462,7 @@ function generateWhiteTexture(engine) {
8445
8462
  }
8446
8463
  function generateTransparentTexture(engine) {
8447
8464
  return Texture.create(engine, _extends({
8448
- id: "transparenttexture00000000000000000000",
8465
+ id: BuiltinObjectGUID.TransparentTexture,
8449
8466
  data: {
8450
8467
  width: 1,
8451
8468
  height: 1,
@@ -10804,7 +10821,7 @@ exports.Shader = /*#__PURE__*/ function(EffectsObject) {
10804
10821
  return Shader;
10805
10822
  }(EffectsObject);
10806
10823
  exports.Shader = __decorate([
10807
- effectsClass("Shader")
10824
+ effectsClass(DataType.Shader)
10808
10825
  ], exports.Shader);
10809
10826
 
10810
10827
  var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
@@ -11591,7 +11608,7 @@ var valueDefine = "#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValu
11591
11608
 
11592
11609
  var screenMeshVert = "precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}";
11593
11610
 
11594
- var colorGradingFrag = "precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;uniform vec3 _VignetteColor;uniform vec2 _VignetteCenter;uniform float _VignetteIntensity;uniform float _VignetteSmoothness;uniform float _VignetteRoundness;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}vec3 ApplyVignette(vec3 inputColor,vec2 uv,vec2 center,float intensity,float roundness,float smoothness,vec3 color){vec2 dist=abs(uv-center)*intensity;dist.x*=roundness;float vfactor=pow(clamp((1.0-dot(dist,dist)),0.0,1.0),smoothness);return inputColor*mix(color,vec3(1.0),vfactor);}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor*=hdrColor.a;hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}if(_VignetteIntensity>0.0){finalColor=ApplyVignette(finalColor,uv,_VignetteCenter,_VignetteIntensity,_VignetteRoundness,_VignetteSmoothness,_VignetteColor);}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=max(vec3(0.0),ACESToneMapping(finalColor));}gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),1.0);}";
11611
+ var colorGradingFrag = "precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;uniform vec3 _VignetteColor;uniform vec2 _VignetteCenter;uniform float _VignetteIntensity;uniform float _VignetteSmoothness;uniform float _VignetteRoundness;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}vec3 ApplyVignette(vec3 inputColor,vec2 uv,vec2 center,float intensity,float roundness,float smoothness,vec3 color){vec2 dist=abs(uv-center)*intensity;dist.x*=roundness;float vfactor=pow(clamp((1.0-dot(dist,dist)),0.0,1.0),smoothness);return inputColor*mix(color,vec3(1.0),vfactor);}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}if(_VignetteIntensity>0.0){finalColor=ApplyVignette(finalColor,uv,_VignetteCenter,_VignetteIntensity,_VignetteRoundness,_VignetteSmoothness,_VignetteColor);}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=max(vec3(0.0),ACESToneMapping(finalColor));}float alpha=min(hdrColor.a,1.0);gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),alpha);}";
11595
11612
 
11596
11613
  var gaussianDown_frag = "precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}";
11597
11614
 
@@ -12889,7 +12906,7 @@ var GPUCapability = /*#__PURE__*/ function() {
12889
12906
  shaderTextureLod: level2 || !!gl.getExtension("EXT_shader_texture_lod"),
12890
12907
  instanceDraw: level2 || !!gl.getExtension("ANGLE_instanced_arrays"),
12891
12908
  drawBuffers: level2 || !!this.drawBufferExtension,
12892
- asyncShaderCompile: !!gl.getExtension("KHR_parallel_shader_compile"),
12909
+ asyncShaderCompile: !!this.glAsyncCompileExt,
12893
12910
  intIndexElementBuffer: !!gl.getExtension("OES_element_index_uint"),
12894
12911
  standardDerivatives: level2 || !!gl.getExtension("OES_standard_derivatives"),
12895
12912
  readableDepthStencilTextures: level2 || !!depthTextureExtension,
@@ -15793,7 +15810,7 @@ function getGeometryTriangles(geometry, options) {
15793
15810
  */ function getGeometriesByShapeData(shape) {
15794
15811
  var geometries = [];
15795
15812
  // 该版本的单个形状数据可以包含多个形状,可以加个埋点,五福之后没有就可以下掉
15796
- if (shape.gs) {
15813
+ if ("gs" in shape) {
15797
15814
  shape.gs.forEach(function(gs) {
15798
15815
  geometries.push({
15799
15816
  p: [
@@ -15806,7 +15823,7 @@ function getGeometryTriangles(geometry, options) {
15806
15823
  ]
15807
15824
  });
15808
15825
  });
15809
- } else if (shape.g) {
15826
+ } else if ("g" in shape) {
15810
15827
  geometries.push({
15811
15828
  p: [
15812
15829
  ValueType.SHAPE_POINTS,
@@ -16805,6 +16822,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16805
16822
  });
16806
16823
  this.frozen = false;
16807
16824
  this.ended = false;
16825
+ this.destroyed = false;
16808
16826
  };
16809
16827
  _proto.update = function update(delta) {
16810
16828
  var _this = this;
@@ -18115,7 +18133,9 @@ var ParticleMesh = /*#__PURE__*/ function() {
18115
18133
  aPos: new Float32Array(48),
18116
18134
  aRot: new Float32Array(32),
18117
18135
  aOffset: new Float32Array(16),
18118
- aTranslation: new Float32Array(12)
18136
+ aTranslation: new Float32Array(12),
18137
+ aLinearMove: new Float32Array(12),
18138
+ aRotation0: new Float32Array(36)
18119
18139
  };
18120
18140
  var useSprite = this.useSprite;
18121
18141
  if (useSprite) {
@@ -19091,7 +19111,7 @@ exports.TransformPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
19091
19111
  return TransformPlayableAsset;
19092
19112
  }(PlayableAsset);
19093
19113
  exports.TransformPlayableAsset = __decorate([
19094
- effectsClass("TransformPlayableAsset")
19114
+ effectsClass(DataType.TransformPlayableAsset)
19095
19115
  ], exports.TransformPlayableAsset);
19096
19116
  /**
19097
19117
  * @since 2.0.0
@@ -19122,7 +19142,7 @@ exports.ActivationPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
19122
19142
  return ActivationPlayableAsset;
19123
19143
  }(PlayableAsset);
19124
19144
  exports.ActivationPlayableAsset = __decorate([
19125
- effectsClass("ActivationPlayableAsset")
19145
+ effectsClass(DataType.ActivationPlayableAsset)
19126
19146
  ], exports.ActivationPlayableAsset);
19127
19147
  exports.AnimationClip = /*#__PURE__*/ function(EffectsObject) {
19128
19148
  _inherits(AnimationClip, EffectsObject);
@@ -19365,7 +19385,7 @@ __decorate([
19365
19385
  serialize()
19366
19386
  ], exports.TrackAsset.prototype, "children", void 0);
19367
19387
  exports.TrackAsset = __decorate([
19368
- effectsClass("TrackAsset")
19388
+ effectsClass(DataType.TrackAsset)
19369
19389
  ], exports.TrackAsset);
19370
19390
  exports.TrackType = void 0;
19371
19391
  (function(TrackType) {
@@ -19460,7 +19480,7 @@ exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
19460
19480
  return ObjectBindingTrack;
19461
19481
  }(exports.TrackAsset);
19462
19482
  exports.ObjectBindingTrack = __decorate([
19463
- effectsClass("ObjectBindingTrack")
19483
+ effectsClass(DataType.ObjectBindingTrack)
19464
19484
  ], exports.ObjectBindingTrack);
19465
19485
 
19466
19486
  exports.TransformTrack = /*#__PURE__*/ function(TrackAsset) {
@@ -19471,7 +19491,7 @@ exports.TransformTrack = /*#__PURE__*/ function(TrackAsset) {
19471
19491
  return TransformTrack;
19472
19492
  }(exports.TrackAsset);
19473
19493
  exports.TransformTrack = __decorate([
19474
- effectsClass("TransformTrack")
19494
+ effectsClass(DataType.TransformTrack)
19475
19495
  ], exports.TransformTrack);
19476
19496
 
19477
19497
  var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
@@ -19532,7 +19552,7 @@ exports.ActivationTrack = /*#__PURE__*/ function(TrackAsset) {
19532
19552
  return ActivationTrack;
19533
19553
  }(exports.TrackAsset);
19534
19554
  exports.ActivationTrack = __decorate([
19535
- effectsClass("ActivationTrack")
19555
+ effectsClass(DataType.ActivationTrack)
19536
19556
  ], exports.ActivationTrack);
19537
19557
 
19538
19558
  exports.SpriteColorTrack = /*#__PURE__*/ function(TrackAsset) {
@@ -19543,7 +19563,7 @@ exports.SpriteColorTrack = /*#__PURE__*/ function(TrackAsset) {
19543
19563
  return SpriteColorTrack;
19544
19564
  }(exports.TrackAsset);
19545
19565
  exports.SpriteColorTrack = __decorate([
19546
- effectsClass("SpriteColorTrack")
19566
+ effectsClass(DataType.SpriteColorTrack)
19547
19567
  ], exports.SpriteColorTrack);
19548
19568
 
19549
19569
  exports.TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
@@ -19580,7 +19600,7 @@ __decorate([
19580
19600
  serialize()
19581
19601
  ], exports.TimelineAsset.prototype, "tracks", void 0);
19582
19602
  exports.TimelineAsset = __decorate([
19583
- effectsClass("TimelineAsset")
19603
+ effectsClass(DataType.TimelineAsset)
19584
19604
  ], exports.TimelineAsset);
19585
19605
  var TimelinePlayable = /*#__PURE__*/ function(Playable) {
19586
19606
  _inherits(TimelinePlayable, Playable);
@@ -19945,7 +19965,7 @@ exports.SubCompositionTrack = /*#__PURE__*/ function(TrackAsset) {
19945
19965
  return SubCompositionTrack;
19946
19966
  }(exports.TrackAsset);
19947
19967
  exports.SubCompositionTrack = __decorate([
19948
- effectsClass("SubCompositionTrack")
19968
+ effectsClass(DataType.SubCompositionTrack)
19949
19969
  ], exports.SubCompositionTrack);
19950
19970
 
19951
19971
  var SubCompositionClipPlayable = /*#__PURE__*/ function(Playable) {
@@ -19975,7 +19995,7 @@ exports.SubCompositionPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
19975
19995
  return SubCompositionPlayableAsset;
19976
19996
  }(PlayableAsset);
19977
19997
  exports.SubCompositionPlayableAsset = __decorate([
19978
- effectsClass("SubCompositionPlayableAsset")
19998
+ effectsClass(DataType.SubCompositionPlayableAsset)
19979
19999
  ], exports.SubCompositionPlayableAsset);
19980
20000
 
19981
20001
  function _possible_constructor_return(self, call) {
@@ -20795,6 +20815,1652 @@ exports.PostProcessVolume = __decorate([
20795
20815
  effectsClass("PostProcessVolume")
20796
20816
  ], exports.PostProcessVolume);
20797
20817
 
20818
+ /**
20819
+ * A class to define a shape via user defined coordinates.
20820
+ */ var Polygon = /*#__PURE__*/ function() {
20821
+ function Polygon() {
20822
+ for(var _len = arguments.length, points = new Array(_len), _key = 0; _key < _len; _key++){
20823
+ points[_key] = arguments[_key];
20824
+ }
20825
+ /** An array of the points of this polygon. */ this.points = [];
20826
+ /** `false` after moveTo, `true` after `closePath`. In all other cases it is `true`. */ this.closePath = false;
20827
+ var flat = Array.isArray(points[0]) ? points[0] : points;
20828
+ // if this is an array of points, convert it to a flat array of numbers
20829
+ if (typeof flat[0] !== "number") {
20830
+ var p = [];
20831
+ for(var i = 0, il = flat.length; i < il; i++){
20832
+ p.push(flat[i].x, flat[i].y);
20833
+ }
20834
+ flat = p;
20835
+ }
20836
+ this.points = flat;
20837
+ this.closePath = true;
20838
+ }
20839
+ var _proto = Polygon.prototype;
20840
+ /**
20841
+ * Creates a clone of this polygon.
20842
+ * @returns - A copy of the polygon.
20843
+ */ _proto.clone = function clone() {
20844
+ var points = this.points.slice();
20845
+ var polygon = new Polygon(points);
20846
+ polygon.closePath = this.closePath;
20847
+ return polygon;
20848
+ };
20849
+ /**
20850
+ * Checks whether the x and y coordinates passed to this function are contained within this polygon.
20851
+ * @param x - The X coordinate of the point to test.
20852
+ * @param y - The Y coordinate of the point to test.
20853
+ * @returns - Whether the x/y coordinates are within this polygon.
20854
+ */ _proto.contains = function contains(x, y) {
20855
+ var inside = false;
20856
+ // use some raycasting to test hits
20857
+ // https://github.com/substack/point-in-polygon/blob/master/index.js
20858
+ var length = this.points.length / 2;
20859
+ for(var i = 0, j = length - 1; i < length; j = i++){
20860
+ var xi = this.points[i * 2];
20861
+ var yi = this.points[i * 2 + 1];
20862
+ var xj = this.points[j * 2];
20863
+ var yj = this.points[j * 2 + 1];
20864
+ var intersect = yi > y !== yj > y && x < (xj - xi) * ((y - yi) / (yj - yi)) + xi;
20865
+ if (intersect) {
20866
+ inside = !inside;
20867
+ }
20868
+ }
20869
+ return inside;
20870
+ };
20871
+ /**
20872
+ * Copies another polygon to this one.
20873
+ * @param polygon - The polygon to copy from.
20874
+ * @returns Returns itself.
20875
+ */ _proto.copyFrom = function copyFrom(polygon) {
20876
+ this.points = polygon.points.slice();
20877
+ this.closePath = polygon.closePath;
20878
+ return this;
20879
+ };
20880
+ /**
20881
+ * Copies this polygon to another one.
20882
+ * @param polygon - The polygon to copy to.
20883
+ * @returns Returns given parameter.
20884
+ */ _proto.copyTo = function copyTo(polygon) {
20885
+ polygon.copyFrom(this);
20886
+ return polygon;
20887
+ };
20888
+ _create_class(Polygon, [
20889
+ {
20890
+ key: "lastX",
20891
+ get: /**
20892
+ * Get the last X coordinate of the polygon
20893
+ * @readonly
20894
+ */ function get() {
20895
+ return this.points[this.points.length - 2];
20896
+ }
20897
+ },
20898
+ {
20899
+ key: "lastY",
20900
+ get: /**
20901
+ * Get the last Y coordinate of the polygon
20902
+ * @readonly
20903
+ */ function get() {
20904
+ return this.points[this.points.length - 1];
20905
+ }
20906
+ },
20907
+ {
20908
+ key: "x",
20909
+ get: /**
20910
+ * Get the first X coordinate of the polygon
20911
+ * @readonly
20912
+ */ function get() {
20913
+ return this.points[this.points.length - 2];
20914
+ }
20915
+ },
20916
+ {
20917
+ key: "y",
20918
+ get: /**
20919
+ * Get the first Y coordinate of the polygon
20920
+ * @readonly
20921
+ */ function get() {
20922
+ return this.points[this.points.length - 1];
20923
+ }
20924
+ }
20925
+ ]);
20926
+ return Polygon;
20927
+ }();
20928
+
20929
+ // thanks to https://github.com/mattdesl/adaptive-bezier-curve
20930
+ // for the original code!
20931
+ var RECURSION_LIMIT = 8;
20932
+ var FLT_EPSILON = 1.19209290e-7;
20933
+ var PATH_DISTANCE_EPSILON = 1.0;
20934
+ var defaultBezierSmoothness = 0.5;
20935
+ function buildAdaptiveBezier(points, sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, smoothness) {
20936
+ // TODO expose as a parameter
20937
+ var scale = 5;
20938
+ var smoothing = Math.min(0.99, Math.max(0, smoothness != null ? smoothness : defaultBezierSmoothness));
20939
+ var distanceTolerance = (PATH_DISTANCE_EPSILON - smoothing) / scale;
20940
+ distanceTolerance *= distanceTolerance;
20941
+ begin(sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, points, distanceTolerance);
20942
+ return points;
20943
+ }
20944
+ //// Based on:
20945
+ //// https://github.com/pelson/antigrain/blob/master/agg-2.4/src/agg_curves.cpp
20946
+ function begin(sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, points, distanceTolerance) {
20947
+ // dont need to actually ad this!
20948
+ // points.push(sX, sY);
20949
+ recursive(sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, points, distanceTolerance, 0);
20950
+ points.push(eX, eY);
20951
+ }
20952
+ // eslint-disable-next-line max-params
20953
+ function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, level) {
20954
+ if (level > RECURSION_LIMIT) {
20955
+ return;
20956
+ }
20957
+ // Calculate all the mid-points of the line segments
20958
+ // ----------------------
20959
+ var x12 = (x1 + x2) / 2;
20960
+ var y12 = (y1 + y2) / 2;
20961
+ var x23 = (x2 + x3) / 2;
20962
+ var y23 = (y2 + y3) / 2;
20963
+ var x34 = (x3 + x4) / 2;
20964
+ var y34 = (y3 + y4) / 2;
20965
+ var x123 = (x12 + x23) / 2;
20966
+ var y123 = (y12 + y23) / 2;
20967
+ var x234 = (x23 + x34) / 2;
20968
+ var y234 = (y23 + y34) / 2;
20969
+ var x1234 = (x123 + x234) / 2;
20970
+ var y1234 = (y123 + y234) / 2;
20971
+ if (level > 0) {
20972
+ // Try to approximate the full cubic curve by a single straight line
20973
+ // ------------------
20974
+ var dx = x4 - x1;
20975
+ var dy = y4 - y1;
20976
+ var d2 = Math.abs((x2 - x4) * dy - (y2 - y4) * dx);
20977
+ var d3 = Math.abs((x3 - x4) * dy - (y3 - y4) * dx);
20978
+ if (d2 > FLT_EPSILON && d3 > FLT_EPSILON) {
20979
+ // Regular care
20980
+ // -----------------
20981
+ if ((d2 + d3) * (d2 + d3) <= distanceTolerance * (dx * dx + dy * dy)) {
20982
+ // If the curvature doesn't exceed the distanceTolerance value
20983
+ // we tend to finish subdivisions.
20984
+ // ----------------------
20985
+ {
20986
+ points.push(x1234, y1234);
20987
+ return;
20988
+ }
20989
+ }
20990
+ } else if (d2 > FLT_EPSILON) {
20991
+ // p1,p3,p4 are collinear, p2 is considerable
20992
+ // ----------------------
20993
+ if (d2 * d2 <= distanceTolerance * (dx * dx + dy * dy)) {
20994
+ {
20995
+ points.push(x1234, y1234);
20996
+ return;
20997
+ }
20998
+ }
20999
+ } else if (d3 > FLT_EPSILON) {
21000
+ // p1,p2,p4 are collinear, p3 is considerable
21001
+ // ----------------------
21002
+ if (d3 * d3 <= distanceTolerance * (dx * dx + dy * dy)) {
21003
+ {
21004
+ points.push(x1234, y1234);
21005
+ return;
21006
+ }
21007
+ }
21008
+ } else {
21009
+ // Collinear case
21010
+ // -----------------
21011
+ dx = x1234 - (x1 + x4) / 2;
21012
+ dy = y1234 - (y1 + y4) / 2;
21013
+ if (dx * dx + dy * dy <= distanceTolerance) {
21014
+ points.push(x1234, y1234);
21015
+ return;
21016
+ }
21017
+ }
21018
+ }
21019
+ // Continue subdivision
21020
+ // ----------------------
21021
+ recursive(x1, y1, x12, y12, x123, y123, x1234, y1234, points, distanceTolerance, level + 1);
21022
+ recursive(x1234, y1234, x234, y234, x34, y34, x4, y4, points, distanceTolerance, level + 1);
21023
+ }
21024
+
21025
+ var ShapePath = /*#__PURE__*/ function() {
21026
+ function ShapePath(graphicsPath) {
21027
+ this.graphicsPath = graphicsPath;
21028
+ this.currentPoly = null;
21029
+ this.shapePrimitives = [];
21030
+ }
21031
+ var _proto = ShapePath.prototype;
21032
+ /** Builds the path. */ _proto.buildPath = function buildPath() {
21033
+ this.currentPoly = null;
21034
+ this.shapePrimitives.length = 0;
21035
+ var path = this.graphicsPath;
21036
+ for(var _iterator = _create_for_of_iterator_helper_loose(path.instructions), _step; !(_step = _iterator()).done;){
21037
+ var instruction = _step.value;
21038
+ var action = instruction.action;
21039
+ var data = instruction.data;
21040
+ switch(action){
21041
+ case "bezierCurveTo":
21042
+ {
21043
+ this.bezierCurveTo(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
21044
+ break;
21045
+ }
21046
+ case "moveTo":
21047
+ {
21048
+ this.moveTo(data[0], data[1]);
21049
+ break;
21050
+ }
21051
+ }
21052
+ }
21053
+ this.endPoly();
21054
+ };
21055
+ /**
21056
+ * Adds a cubic Bezier curve to the path.
21057
+ * It requires three points: the first two are control points and the third one is the end point.
21058
+ * The starting point is the last point in the current path.
21059
+ * @param cp1x - The x-coordinate of the first control point.
21060
+ * @param cp1y - The y-coordinate of the first control point.
21061
+ * @param cp2x - The x-coordinate of the second control point.
21062
+ * @param cp2y - The y-coordinate of the second control point.
21063
+ * @param x - The x-coordinate of the end point.
21064
+ * @param y - The y-coordinate of the end point.
21065
+ * @param smoothness - Optional parameter to adjust the smoothness of the curve.
21066
+ * @returns The instance of the current object for chaining.
21067
+ */ _proto.bezierCurveTo = function bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness) {
21068
+ this.ensurePoly();
21069
+ var currentPoly = this.currentPoly;
21070
+ buildAdaptiveBezier(currentPoly.points, currentPoly.lastX, currentPoly.lastY, cp1x, cp1y, cp2x, cp2y, x, y, smoothness);
21071
+ return this;
21072
+ };
21073
+ _proto.moveTo = function moveTo(x, y) {
21074
+ this.startPoly(x, y);
21075
+ return this;
21076
+ };
21077
+ /**
21078
+ * Starts a new polygon path from the specified starting point.
21079
+ * This method initializes a new polygon or ends the current one if it exists.
21080
+ * @param x - The x-coordinate of the starting point of the new polygon.
21081
+ * @param y - The y-coordinate of the starting point of the new polygon.
21082
+ * @returns The instance of the current object for chaining.
21083
+ */ _proto.startPoly = function startPoly(x, y) {
21084
+ var currentPoly = this.currentPoly;
21085
+ if (currentPoly) {
21086
+ this.endPoly();
21087
+ }
21088
+ currentPoly = new Polygon();
21089
+ currentPoly.points.push(x, y);
21090
+ this.currentPoly = currentPoly;
21091
+ return this;
21092
+ };
21093
+ /**
21094
+ * Ends the current polygon path. If `closePath` is set to true,
21095
+ * the path is closed by connecting the last point to the first one.
21096
+ * This method finalizes the current polygon and prepares it for drawing or adding to the shape primitives.
21097
+ * @param closePath - A boolean indicating whether to close the polygon by connecting the last point
21098
+ * back to the starting point. False by default.
21099
+ * @returns The instance of the current object for chaining.
21100
+ */ _proto.endPoly = function endPoly(closePath) {
21101
+ if (closePath === void 0) closePath = false;
21102
+ var shape = this.currentPoly;
21103
+ if (shape && shape.points.length > 2) {
21104
+ shape.closePath = closePath;
21105
+ this.shapePrimitives.push({
21106
+ shape: shape
21107
+ });
21108
+ }
21109
+ this.currentPoly = null;
21110
+ return this;
21111
+ };
21112
+ _proto.ensurePoly = function ensurePoly(start) {
21113
+ if (this.currentPoly) {
21114
+ return;
21115
+ }
21116
+ this.currentPoly = new Polygon();
21117
+ this.currentPoly.points.push(0, 0);
21118
+ };
21119
+ return ShapePath;
21120
+ }();
21121
+
21122
+ var GraphicsPath = /*#__PURE__*/ function() {
21123
+ function GraphicsPath() {
21124
+ this.instructions = [];
21125
+ this.dirty = false;
21126
+ }
21127
+ var _proto = GraphicsPath.prototype;
21128
+ /**
21129
+ * Adds a cubic Bezier curve to the path.
21130
+ * It requires three points: the first two are control points and the third one is the end point.
21131
+ * The starting point is the last point in the current path.
21132
+ * @param cp1x - The x-coordinate of the first control point.
21133
+ * @param cp1y - The y-coordinate of the first control point.
21134
+ * @param cp2x - The x-coordinate of the second control point.
21135
+ * @param cp2y - The y-coordinate of the second control point.
21136
+ * @param x - The x-coordinate of the end point.
21137
+ * @param y - The y-coordinate of the end point.
21138
+ * @param smoothness - Optional parameter to adjust the smoothness of the curve.
21139
+ * @returns The instance of the current object for chaining.
21140
+ */ _proto.bezierCurveTo = function bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness) {
21141
+ this.instructions.push({
21142
+ action: "bezierCurveTo",
21143
+ data: [
21144
+ cp1x,
21145
+ cp1y,
21146
+ cp2x,
21147
+ cp2y,
21148
+ x,
21149
+ y,
21150
+ smoothness
21151
+ ]
21152
+ });
21153
+ this.dirty = true;
21154
+ return this;
21155
+ };
21156
+ _proto.moveTo = function moveTo(x, y) {
21157
+ this.instructions.push({
21158
+ action: "moveTo",
21159
+ data: [
21160
+ x,
21161
+ y
21162
+ ]
21163
+ });
21164
+ this.dirty = true;
21165
+ return this;
21166
+ };
21167
+ _proto.clear = function clear() {
21168
+ this.instructions.length = 0;
21169
+ this.dirty = true;
21170
+ return this;
21171
+ };
21172
+ _create_class(GraphicsPath, [
21173
+ {
21174
+ key: "shapePath",
21175
+ get: /**
21176
+ * Provides access to the internal shape path, ensuring it is up-to-date with the current instructions.
21177
+ * @returns The `ShapePath` instance associated with this `GraphicsPath`.
21178
+ */ function get() {
21179
+ if (!this._shapePath) {
21180
+ this._shapePath = new ShapePath(this);
21181
+ }
21182
+ if (this.dirty) {
21183
+ this.dirty = false;
21184
+ this._shapePath.buildPath();
21185
+ }
21186
+ return this._shapePath;
21187
+ }
21188
+ }
21189
+ ]);
21190
+ return GraphicsPath;
21191
+ }();
21192
+
21193
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
21194
+
21195
+ var libtess_min = {exports: {}};
21196
+
21197
+ /*
21198
+
21199
+ Copyright 2000, Silicon Graphics, Inc. All Rights Reserved.
21200
+ Copyright 2015, Google Inc. All Rights Reserved.
21201
+
21202
+ Permission is hereby granted, free of charge, to any person obtaining a copy
21203
+ of this software and associated documentation files (the "Software"), to
21204
+ deal in the Software without restriction, including without limitation the
21205
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
21206
+ sell copies of the Software, and to permit persons to whom the Software is
21207
+ furnished to do so, subject to the following conditions:
21208
+
21209
+ The above copyright notice including the dates of first publication and
21210
+ either this permission notice or a reference to http://oss.sgi.com/projects/FreeB/
21211
+ shall be included in all copies or substantial portions of the Software.
21212
+
21213
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21214
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21215
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21216
+ SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21217
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
21218
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21219
+
21220
+ Original Code. The Original Code is: OpenGL Sample Implementation,
21221
+ Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
21222
+ Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
21223
+ Copyright in any portions created by third parties is as indicated
21224
+ elsewhere herein. All Rights Reserved.
21225
+ */
21226
+
21227
+ (function (module) {
21228
+ var n;
21229
+ function t(a, b) {
21230
+ return a.b === b.b && a.a === b.a;
21231
+ }
21232
+ function u(a, b) {
21233
+ return a.b < b.b || a.b === b.b && a.a <= b.a;
21234
+ }
21235
+ function v(a, b, c) {
21236
+ var d = b.b - a.b, e = c.b - b.b;
21237
+ return 0 < d + e ? d < e ? b.a - a.a + d / (d + e) * (a.a - c.a) : b.a - c.a + e / (d + e) * (c.a - a.a) : 0;
21238
+ }
21239
+ function x(a, b, c) {
21240
+ var d = b.b - a.b, e = c.b - b.b;
21241
+ return 0 < d + e ? (b.a - c.a) * d + (b.a - a.a) * e : 0;
21242
+ }
21243
+ function z(a, b) {
21244
+ return a.a < b.a || a.a === b.a && a.b <= b.b;
21245
+ }
21246
+ function aa(a, b, c) {
21247
+ var d = b.a - a.a, e = c.a - b.a;
21248
+ return 0 < d + e ? d < e ? b.b - a.b + d / (d + e) * (a.b - c.b) : b.b - c.b + e / (d + e) * (c.b - a.b) : 0;
21249
+ }
21250
+ function ba(a, b, c) {
21251
+ var d = b.a - a.a, e = c.a - b.a;
21252
+ return 0 < d + e ? (b.b - c.b) * d + (b.b - a.b) * e : 0;
21253
+ }
21254
+ function ca(a) {
21255
+ return u(a.b.a, a.a);
21256
+ }
21257
+ function da(a) {
21258
+ return u(a.a, a.b.a);
21259
+ }
21260
+ function A(a, b, c, d) {
21261
+ a = 0 > a ? 0 : a;
21262
+ c = 0 > c ? 0 : c;
21263
+ return a <= c ? 0 === c ? (b + d) / 2 : b + a / (a + c) * (d - b) : d + c / (a + c) * (b - d);
21264
+ }
21265
+ function ea(a) {
21266
+ var b = B(a.b);
21267
+ C(b, a.c);
21268
+ C(b.b, a.c);
21269
+ D(b, a.a);
21270
+ return b;
21271
+ }
21272
+ function E(a, b) {
21273
+ var c = !1, d = !1;
21274
+ a !== b && (b.a !== a.a && (d = !0, F(b.a, a.a)), b.d !== a.d && (c = !0, G(b.d, a.d)), H(b, a), d || (C(b, a.a), a.a.c = a), c || (D(b, a.d), a.d.a = a));
21275
+ }
21276
+ function I(a) {
21277
+ var b = a.b, c = !1;
21278
+ a.d !== a.b.d && (c = !0, G(a.d, a.b.d));
21279
+ a.c === a ? F(a.a, null) : (a.b.d.a = J(a), a.a.c = a.c, H(a, J(a)), c || D(a, a.d));
21280
+ b.c === b ? (F(b.a, null), G(b.d, null)) : (a.d.a = J(b), b.a.c = b.c, H(b, J(b)));
21281
+ fa(a);
21282
+ }
21283
+ function K(a) {
21284
+ var b = B(a), c = b.b;
21285
+ H(b, a.e);
21286
+ b.a = a.b.a;
21287
+ C(c, b.a);
21288
+ b.d = c.d = a.d;
21289
+ b = b.b;
21290
+ H(a.b, J(a.b));
21291
+ H(a.b, b);
21292
+ a.b.a = b.a;
21293
+ b.b.a.c = b.b;
21294
+ b.b.d = a.b.d;
21295
+ b.f = a.f;
21296
+ b.b.f = a.b.f;
21297
+ return b;
21298
+ }
21299
+ function L(a, b) {
21300
+ var c = !1, d = B(a), e = d.b;
21301
+ b.d !== a.d && (c = !0, G(b.d, a.d));
21302
+ H(d, a.e);
21303
+ H(e, b);
21304
+ d.a = a.b.a;
21305
+ e.a = b.a;
21306
+ d.d = e.d = a.d;
21307
+ a.d.a = e;
21308
+ c || D(d, a.d);
21309
+ return d;
21310
+ }
21311
+ function B(a) {
21312
+ var b = new M, c = new M, d = a.b.h;
21313
+ c.h = d;
21314
+ d.b.h = b;
21315
+ b.h = a;
21316
+ a.b.h = c;
21317
+ b.b = c;
21318
+ b.c = b;
21319
+ b.e = c;
21320
+ c.b = b;
21321
+ c.c = c;
21322
+ return c.e = b;
21323
+ }
21324
+ function H(a, b) {
21325
+ var c = a.c, d = b.c;
21326
+ c.b.e = b;
21327
+ d.b.e = a;
21328
+ a.c = d;
21329
+ b.c = c;
21330
+ }
21331
+ function C(a, b) {
21332
+ var c = b.f, d = new N(b, c);
21333
+ c.e = d;
21334
+ b.f = d;
21335
+ c = d.c = a;
21336
+ do c.a = d, c = c.c;
21337
+ while (c !== a);
21338
+ }
21339
+ function D(a, b) {
21340
+ var c = b.d, d = new ga(b, c);
21341
+ c.b = d;
21342
+ b.d = d;
21343
+ d.a = a;
21344
+ d.c = b.c;
21345
+ c = a;
21346
+ do c.d = d, c = c.e;
21347
+ while (c !== a);
21348
+ }
21349
+ function fa(a) {
21350
+ var b = a.h;
21351
+ a = a.b.h;
21352
+ b.b.h = a;
21353
+ a.b.h = b;
21354
+ }
21355
+ function F(a, b) {
21356
+ var c = a.c, d = c;
21357
+ do d.a = b, d = d.c;
21358
+ while (d !== c);
21359
+ c = a.f;
21360
+ d = a.e;
21361
+ d.f = c;
21362
+ c.e = d;
21363
+ }
21364
+ function G(a, b) {
21365
+ var c = a.a, d = c;
21366
+ do d.d = b, d = d.e;
21367
+ while (d !== c);
21368
+ c = a.d;
21369
+ d = a.b;
21370
+ d.d = c;
21371
+ c.b = d;
21372
+ }
21373
+ function ha(a) {
21374
+ var b = 0;
21375
+ Math.abs(a[1]) > Math.abs(a[0]) && (b = 1);
21376
+ Math.abs(a[2]) > Math.abs(a[b]) && (b = 2);
21377
+ return b;
21378
+ }
21379
+ var O = 4 * 1E150;
21380
+ function P(a, b) {
21381
+ a.f += b.f;
21382
+ a.b.f += b.b.f;
21383
+ }
21384
+ function ia(a, b, c) {
21385
+ a = a.a;
21386
+ b = b.a;
21387
+ c = c.a;
21388
+ if (b.b.a === a) return c.b.a === a ? u(b.a, c.a) ? 0 >= x(c.b.a, b.a, c.a) : 0 <= x(b.b.a, c.a, b.a) : 0 >= x(c.b.a, a, c.a);
21389
+ if (c.b.a === a) return 0 <= x(b.b.a, a, b.a);
21390
+ b = v(b.b.a, a, b.a);
21391
+ a = v(c.b.a, a, c.a);
21392
+ return b >= a;
21393
+ }
21394
+ function Q(a) {
21395
+ a.a.i = null;
21396
+ var b = a.e;
21397
+ b.a.c = b.c;
21398
+ b.c.a = b.a;
21399
+ a.e = null;
21400
+ }
21401
+ function ja(a, b) {
21402
+ I(a.a);
21403
+ a.c = !1;
21404
+ a.a = b;
21405
+ b.i = a;
21406
+ }
21407
+ function ka(a) {
21408
+ var b = a.a.a;
21409
+ do a = R(a);
21410
+ while (a.a.a === b);
21411
+ a.c && (b = L(S(a).a.b, a.a.e), ja(a, b), a = R(a));
21412
+ return a;
21413
+ }
21414
+ function la(a, b, c) {
21415
+ var d = new ma;
21416
+ d.a = c;
21417
+ d.e = na(a.f, b.e, d);
21418
+ return c.i = d;
21419
+ }
21420
+ function oa(a, b) {
21421
+ switch(a.s){
21422
+ case 100130:
21423
+ return 0 !== (b & 1);
21424
+ case 100131:
21425
+ return 0 !== b;
21426
+ case 100132:
21427
+ return 0 < b;
21428
+ case 100133:
21429
+ return 0 > b;
21430
+ case 100134:
21431
+ return 2 <= b || -2 >= b;
21432
+ }
21433
+ return !1;
21434
+ }
21435
+ function pa(a) {
21436
+ var b = a.a, c = b.d;
21437
+ c.c = a.d;
21438
+ c.a = b;
21439
+ Q(a);
21440
+ }
21441
+ function T(a, b, c) {
21442
+ a = b;
21443
+ for(b = b.a; a !== c;){
21444
+ a.c = !1;
21445
+ var d = S(a), e = d.a;
21446
+ if (e.a !== b.a) {
21447
+ if (!d.c) {
21448
+ pa(a);
21449
+ break;
21450
+ }
21451
+ e = L(b.c.b, e.b);
21452
+ ja(d, e);
21453
+ }
21454
+ b.c !== e && (E(J(e), e), E(b, e));
21455
+ pa(a);
21456
+ b = d.a;
21457
+ a = d;
21458
+ }
21459
+ return b;
21460
+ }
21461
+ function U(a, b, c, d, e, f) {
21462
+ var g = !0;
21463
+ do la(a, b, c.b), c = c.c;
21464
+ while (c !== d);
21465
+ for(null === e && (e = S(b).a.b.c);;){
21466
+ d = S(b);
21467
+ c = d.a.b;
21468
+ if (c.a !== e.a) break;
21469
+ c.c !== e && (E(J(c), c), E(J(e), c));
21470
+ d.f = b.f - c.f;
21471
+ d.d = oa(a, d.f);
21472
+ b.b = !0;
21473
+ !g && qa(a, b) && (P(c, e), Q(b), I(e));
21474
+ g = !1;
21475
+ b = d;
21476
+ e = c;
21477
+ }
21478
+ b.b = !0;
21479
+ f && ra(a, b);
21480
+ }
21481
+ function sa(a, b, c, d, e) {
21482
+ var f = [
21483
+ b.g[0],
21484
+ b.g[1],
21485
+ b.g[2]
21486
+ ];
21487
+ b.d = null;
21488
+ b.d = a.o ? a.o(f, c, d, a.c) || null : null;
21489
+ null === b.d && (e ? a.n || (V(a, 100156), a.n = !0) : b.d = c[0]);
21490
+ }
21491
+ function ta(a, b, c) {
21492
+ var d = [
21493
+ null,
21494
+ null,
21495
+ null,
21496
+ null
21497
+ ];
21498
+ d[0] = b.a.d;
21499
+ d[1] = c.a.d;
21500
+ sa(a, b.a, d, [
21501
+ .5,
21502
+ .5,
21503
+ 0,
21504
+ 0
21505
+ ], !1);
21506
+ E(b, c);
21507
+ }
21508
+ function ua(a, b, c, d, e) {
21509
+ var f = Math.abs(b.b - a.b) + Math.abs(b.a - a.a), g = Math.abs(c.b - a.b) + Math.abs(c.a - a.a), h = e + 1;
21510
+ d[e] = .5 * g / (f + g);
21511
+ d[h] = .5 * f / (f + g);
21512
+ a.g[0] += d[e] * b.g[0] + d[h] * c.g[0];
21513
+ a.g[1] += d[e] * b.g[1] + d[h] * c.g[1];
21514
+ a.g[2] += d[e] * b.g[2] + d[h] * c.g[2];
21515
+ }
21516
+ function qa(a, b) {
21517
+ var c = S(b), d = b.a, e = c.a;
21518
+ if (u(d.a, e.a)) {
21519
+ if (0 < x(e.b.a, d.a, e.a)) return !1;
21520
+ if (!t(d.a, e.a)) K(e.b), E(d, J(e)), b.b = c.b = !0;
21521
+ else if (d.a !== e.a) {
21522
+ var c = a.e, f = d.a.h;
21523
+ if (0 <= f) {
21524
+ var c = c.b, g = c.d, h = c.e, k = c.c, l = k[f];
21525
+ g[l] = g[c.a];
21526
+ k[g[l]] = l;
21527
+ l <= --c.a && (1 >= l ? W(c, l) : u(h[g[l >> 1]], h[g[l]]) ? W(c, l) : va(c, l));
21528
+ h[f] = null;
21529
+ k[f] = c.b;
21530
+ c.b = f;
21531
+ } else for(c.c[-(f + 1)] = null; 0 < c.a && null === c.c[c.d[c.a - 1]];)--c.a;
21532
+ ta(a, J(e), d);
21533
+ }
21534
+ } else {
21535
+ if (0 > x(d.b.a, e.a, d.a)) return !1;
21536
+ R(b).b = b.b = !0;
21537
+ K(d.b);
21538
+ E(J(e), d);
21539
+ }
21540
+ return !0;
21541
+ }
21542
+ function wa(a, b) {
21543
+ var c = S(b), d = b.a, e = c.a, f = d.a, g = e.a, h = d.b.a, k = e.b.a, l = new N;
21544
+ x(h, a.a, f);
21545
+ x(k, a.a, g);
21546
+ if (f === g || Math.min(f.a, h.a) > Math.max(g.a, k.a)) return !1;
21547
+ if (u(f, g)) {
21548
+ if (0 < x(k, f, g)) return !1;
21549
+ } else if (0 > x(h, g, f)) return !1;
21550
+ var r = h, p = f, q = k, y = g, m, w;
21551
+ u(r, p) || (m = r, r = p, p = m);
21552
+ u(q, y) || (m = q, q = y, y = m);
21553
+ u(r, q) || (m = r, r = q, q = m, m = p, p = y, y = m);
21554
+ u(q, p) ? u(p, y) ? (m = v(r, q, p), w = v(q, p, y), 0 > m + w && (m = -m, w = -w), l.b = A(m, q.b, w, p.b)) : (m = x(r, q, p), w = -x(r, y, p), 0 > m + w && (m = -m, w = -w), l.b = A(m, q.b, w, y.b)) : l.b = (q.b + p.b) / 2;
21555
+ z(r, p) || (m = r, r = p, p = m);
21556
+ z(q, y) || (m = q, q = y, y = m);
21557
+ z(r, q) || (m = r, r = q, q = m, m = p, p = y, y = m);
21558
+ z(q, p) ? z(p, y) ? (m = aa(r, q, p), w = aa(q, p, y), 0 > m + w && (m = -m, w = -w), l.a = A(m, q.a, w, p.a)) : (m = ba(r, q, p), w = -ba(r, y, p), 0 > m + w && (m = -m, w = -w), l.a = A(m, q.a, w, y.a)) : l.a = (q.a + p.a) / 2;
21559
+ u(l, a.a) && (l.b = a.a.b, l.a = a.a.a);
21560
+ r = u(f, g) ? f : g;
21561
+ u(r, l) && (l.b = r.b, l.a = r.a);
21562
+ if (t(l, f) || t(l, g)) return qa(a, b), !1;
21563
+ if (!t(h, a.a) && 0 <= x(h, a.a, l) || !t(k, a.a) && 0 >= x(k, a.a, l)) {
21564
+ if (k === a.a) return K(d.b), E(e.b, d), b = ka(b), d = S(b).a, T(a, S(b), c), U(a, b, J(d), d, d, !0), !0;
21565
+ if (h === a.a) {
21566
+ K(e.b);
21567
+ E(d.e, J(e));
21568
+ f = c = b;
21569
+ g = f.a.b.a;
21570
+ do f = R(f);
21571
+ while (f.a.b.a === g);
21572
+ b = f;
21573
+ f = S(b).a.b.c;
21574
+ c.a = J(e);
21575
+ e = T(a, c, null);
21576
+ U(a, b, e.c, d.b.c, f, !0);
21577
+ return !0;
21578
+ }
21579
+ 0 <= x(h, a.a, l) && (R(b).b = b.b = !0, K(d.b), d.a.b = a.a.b, d.a.a = a.a.a);
21580
+ 0 >= x(k, a.a, l) && (b.b = c.b = !0, K(e.b), e.a.b = a.a.b, e.a.a = a.a.a);
21581
+ return !1;
21582
+ }
21583
+ K(d.b);
21584
+ K(e.b);
21585
+ E(J(e), d);
21586
+ d.a.b = l.b;
21587
+ d.a.a = l.a;
21588
+ d.a.h = xa(a.e, d.a);
21589
+ d = d.a;
21590
+ e = [
21591
+ 0,
21592
+ 0,
21593
+ 0,
21594
+ 0
21595
+ ];
21596
+ l = [
21597
+ f.d,
21598
+ h.d,
21599
+ g.d,
21600
+ k.d
21601
+ ];
21602
+ d.g[0] = d.g[1] = d.g[2] = 0;
21603
+ ua(d, f, h, e, 0);
21604
+ ua(d, g, k, e, 2);
21605
+ sa(a, d, l, e, !0);
21606
+ R(b).b = b.b = c.b = !0;
21607
+ return !1;
21608
+ }
21609
+ function ra(a, b) {
21610
+ for(var c = S(b);;){
21611
+ for(; c.b;)b = c, c = S(c);
21612
+ if (!b.b && (c = b, b = R(b), null === b || !b.b)) break;
21613
+ b.b = !1;
21614
+ var d = b.a, e = c.a, f;
21615
+ if (f = d.b.a !== e.b.a) a: {
21616
+ f = b;
21617
+ var g = S(f), h = f.a, k = g.a, l = void 0;
21618
+ if (u(h.b.a, k.b.a)) {
21619
+ if (0 > x(h.b.a, k.b.a, h.a)) {
21620
+ f = !1;
21621
+ break a;
21622
+ }
21623
+ R(f).b = f.b = !0;
21624
+ l = K(h);
21625
+ E(k.b, l);
21626
+ l.d.c = f.d;
21627
+ } else {
21628
+ if (0 < x(k.b.a, h.b.a, k.a)) {
21629
+ f = !1;
21630
+ break a;
21631
+ }
21632
+ f.b = g.b = !0;
21633
+ l = K(k);
21634
+ E(h.e, k.b);
21635
+ l.b.d.c = f.d;
21636
+ }
21637
+ f = !0;
21638
+ }
21639
+ f && (c.c ? (Q(c), I(e), c = S(b), e = c.a) : b.c && (Q(b), I(d), b = R(c), d = b.a));
21640
+ if (d.a !== e.a) {
21641
+ if (d.b.a === e.b.a || b.c || c.c || d.b.a !== a.a && e.b.a !== a.a) qa(a, b);
21642
+ else if (wa(a, b)) break;
21643
+ }
21644
+ d.a === e.a && d.b.a === e.b.a && (P(e, d), Q(b), I(d), b = R(c));
21645
+ }
21646
+ }
21647
+ function ya(a, b) {
21648
+ a.a = b;
21649
+ for(var c = b.c; null === c.i;)if (c = c.c, c === b.c) {
21650
+ var c = a, d = b, e = new ma;
21651
+ e.a = d.c.b;
21652
+ var f = c.f, g = f.a;
21653
+ do g = g.a;
21654
+ while (null !== g.b && !f.c(f.b, e, g.b));
21655
+ var f = g.b, h = S(f), e = f.a, g = h.a;
21656
+ if (0 === x(e.b.a, d, e.a)) e = f.a, t(e.a, d) || t(e.b.a, d) || (K(e.b), f.c && (I(e.c), f.c = !1), E(d.c, e), ya(c, d));
21657
+ else {
21658
+ var k = u(g.b.a, e.b.a) ? f : h, h = void 0;
21659
+ f.d || k.c ? (k === f ? h = L(d.c.b, e.e) : h = L(g.b.c.b, d.c).b, k.c ? ja(k, h) : (e = c, f = la(c, f, h), f.f = R(f).f + f.a.f, f.d = oa(e, f.f)), ya(c, d)) : U(c, f, d.c, d.c, null, !0);
21660
+ }
21661
+ return;
21662
+ }
21663
+ c = ka(c.i);
21664
+ e = S(c);
21665
+ f = e.a;
21666
+ e = T(a, e, null);
21667
+ if (e.c === f) {
21668
+ var f = e, e = f.c, g = S(c), h = c.a, k = g.a, l = !1;
21669
+ h.b.a !== k.b.a && wa(a, c);
21670
+ t(h.a, a.a) && (E(J(e), h), c = ka(c), e = S(c).a, T(a, S(c), g), l = !0);
21671
+ t(k.a, a.a) && (E(f, J(k)), f = T(a, g, null), l = !0);
21672
+ l ? U(a, c, f.c, e, e, !0) : (u(k.a, h.a) ? d = J(k) : d = h, d = L(f.c.b, d), U(a, c, d, d.c, d.c, !1), d.b.i.c = !0, ra(a, c));
21673
+ } else U(a, c, e.c, f, f, !0);
21674
+ }
21675
+ function za(a, b) {
21676
+ var c = new ma, d = ea(a.b);
21677
+ d.a.b = O;
21678
+ d.a.a = b;
21679
+ d.b.a.b = -O;
21680
+ d.b.a.a = b;
21681
+ a.a = d.b.a;
21682
+ c.a = d;
21683
+ c.f = 0;
21684
+ c.d = !1;
21685
+ c.c = !1;
21686
+ c.h = !0;
21687
+ c.b = !1;
21688
+ d = a.f;
21689
+ d = na(d, d.a, c);
21690
+ c.e = d;
21691
+ }
21692
+ function Aa(a) {
21693
+ this.a = new Ba;
21694
+ this.b = a;
21695
+ this.c = ia;
21696
+ }
21697
+ function na(a, b, c) {
21698
+ do b = b.c;
21699
+ while (null !== b.b && !a.c(a.b, b.b, c));
21700
+ a = new Ba(c, b.a, b);
21701
+ b.a.c = a;
21702
+ return b.a = a;
21703
+ }
21704
+ function Ba(a, b, c) {
21705
+ this.b = a || null;
21706
+ this.a = b || this;
21707
+ this.c = c || this;
21708
+ }
21709
+ function X() {
21710
+ this.d = Y;
21711
+ this.p = this.b = this.q = null;
21712
+ this.j = [
21713
+ 0,
21714
+ 0,
21715
+ 0
21716
+ ];
21717
+ this.s = 100130;
21718
+ this.n = !1;
21719
+ this.o = this.a = this.e = this.f = null;
21720
+ this.m = !1;
21721
+ this.c = this.r = this.i = this.k = this.l = this.h = null;
21722
+ }
21723
+ var Y = 0;
21724
+ n = X.prototype;
21725
+ n.x = function() {
21726
+ Z(this, Y);
21727
+ };
21728
+ n.B = function(a, b) {
21729
+ switch(a){
21730
+ case 100142:
21731
+ return;
21732
+ case 100140:
21733
+ switch(b){
21734
+ case 100130:
21735
+ case 100131:
21736
+ case 100132:
21737
+ case 100133:
21738
+ case 100134:
21739
+ this.s = b;
21740
+ return;
21741
+ }
21742
+ break;
21743
+ case 100141:
21744
+ this.m = !!b;
21745
+ return;
21746
+ default:
21747
+ V(this, 100900);
21748
+ return;
21749
+ }
21750
+ V(this, 100901);
21751
+ };
21752
+ n.y = function(a) {
21753
+ switch(a){
21754
+ case 100142:
21755
+ return 0;
21756
+ case 100140:
21757
+ return this.s;
21758
+ case 100141:
21759
+ return this.m;
21760
+ default:
21761
+ V(this, 100900);
21762
+ }
21763
+ return !1;
21764
+ };
21765
+ n.A = function(a, b, c) {
21766
+ this.j[0] = a;
21767
+ this.j[1] = b;
21768
+ this.j[2] = c;
21769
+ };
21770
+ n.z = function(a, b) {
21771
+ var c = b ? b : null;
21772
+ switch(a){
21773
+ case 100100:
21774
+ case 100106:
21775
+ this.h = c;
21776
+ break;
21777
+ case 100104:
21778
+ case 100110:
21779
+ this.l = c;
21780
+ break;
21781
+ case 100101:
21782
+ case 100107:
21783
+ this.k = c;
21784
+ break;
21785
+ case 100102:
21786
+ case 100108:
21787
+ this.i = c;
21788
+ break;
21789
+ case 100103:
21790
+ case 100109:
21791
+ this.p = c;
21792
+ break;
21793
+ case 100105:
21794
+ case 100111:
21795
+ this.o = c;
21796
+ break;
21797
+ case 100112:
21798
+ this.r = c;
21799
+ break;
21800
+ default:
21801
+ V(this, 100900);
21802
+ }
21803
+ };
21804
+ n.C = function(a, b) {
21805
+ var c = !1, d = [
21806
+ 0,
21807
+ 0,
21808
+ 0
21809
+ ];
21810
+ Z(this, 2);
21811
+ for(var e = 0; 3 > e; ++e){
21812
+ var f = a[e];
21813
+ -1E150 > f && (f = -1E150, c = !0);
21814
+ 1E150 < f && (f = 1E150, c = !0);
21815
+ d[e] = f;
21816
+ }
21817
+ c && V(this, 100155);
21818
+ c = this.q;
21819
+ null === c ? (c = ea(this.b), E(c, c.b)) : (K(c), c = c.e);
21820
+ c.a.d = b;
21821
+ c.a.g[0] = d[0];
21822
+ c.a.g[1] = d[1];
21823
+ c.a.g[2] = d[2];
21824
+ c.f = 1;
21825
+ c.b.f = -1;
21826
+ this.q = c;
21827
+ };
21828
+ n.u = function(a) {
21829
+ Z(this, Y);
21830
+ this.d = 1;
21831
+ this.b = new Ca;
21832
+ this.c = a;
21833
+ };
21834
+ n.t = function() {
21835
+ Z(this, 1);
21836
+ this.d = 2;
21837
+ this.q = null;
21838
+ };
21839
+ n.v = function() {
21840
+ Z(this, 2);
21841
+ this.d = 1;
21842
+ };
21843
+ n.w = function() {
21844
+ Z(this, 1);
21845
+ this.d = Y;
21846
+ var a = this.j[0], b = this.j[1], c = this.j[2], d = !1, e = [
21847
+ a,
21848
+ b,
21849
+ c
21850
+ ];
21851
+ if (0 === a && 0 === b && 0 === c) {
21852
+ for(var b = [
21853
+ -2 * 1E150,
21854
+ -2 * 1E150,
21855
+ -2 * 1E150
21856
+ ], f = [
21857
+ 2 * 1E150,
21858
+ 2 * 1E150,
21859
+ 2 * 1E150
21860
+ ], c = [], g = [], d = this.b.c, a = d.e; a !== d; a = a.e)for(var h = 0; 3 > h; ++h){
21861
+ var k = a.g[h];
21862
+ k < f[h] && (f[h] = k, g[h] = a);
21863
+ k > b[h] && (b[h] = k, c[h] = a);
21864
+ }
21865
+ a = 0;
21866
+ b[1] - f[1] > b[0] - f[0] && (a = 1);
21867
+ b[2] - f[2] > b[a] - f[a] && (a = 2);
21868
+ if (f[a] >= b[a]) e[0] = 0, e[1] = 0, e[2] = 1;
21869
+ else {
21870
+ b = 0;
21871
+ f = g[a];
21872
+ c = c[a];
21873
+ g = [
21874
+ 0,
21875
+ 0,
21876
+ 0
21877
+ ];
21878
+ f = [
21879
+ f.g[0] - c.g[0],
21880
+ f.g[1] - c.g[1],
21881
+ f.g[2] - c.g[2]
21882
+ ];
21883
+ h = [
21884
+ 0,
21885
+ 0,
21886
+ 0
21887
+ ];
21888
+ for(a = d.e; a !== d; a = a.e)h[0] = a.g[0] - c.g[0], h[1] = a.g[1] - c.g[1], h[2] = a.g[2] - c.g[2], g[0] = f[1] * h[2] - f[2] * h[1], g[1] = f[2] * h[0] - f[0] * h[2], g[2] = f[0] * h[1] - f[1] * h[0], k = g[0] * g[0] + g[1] * g[1] + g[2] * g[2], k > b && (b = k, e[0] = g[0], e[1] = g[1], e[2] = g[2]);
21889
+ 0 >= b && (e[0] = e[1] = e[2] = 0, e[ha(f)] = 1);
21890
+ }
21891
+ d = !0;
21892
+ }
21893
+ g = ha(e);
21894
+ a = this.b.c;
21895
+ b = (g + 1) % 3;
21896
+ c = (g + 2) % 3;
21897
+ g = 0 < e[g] ? 1 : -1;
21898
+ for(e = a.e; e !== a; e = e.e)e.b = e.g[b], e.a = g * e.g[c];
21899
+ if (d) {
21900
+ e = 0;
21901
+ d = this.b.a;
21902
+ for(a = d.b; a !== d; a = a.b)if (b = a.a, !(0 >= b.f)) {
21903
+ do e += (b.a.b - b.b.a.b) * (b.a.a + b.b.a.a), b = b.e;
21904
+ while (b !== a.a);
21905
+ }
21906
+ if (0 > e) for(e = this.b.c, d = e.e; d !== e; d = d.e)d.a = -d.a;
21907
+ }
21908
+ this.n = !1;
21909
+ e = this.b.b;
21910
+ for(a = e.h; a !== e; a = d)if (d = a.h, b = a.e, t(a.a, a.b.a) && a.e.e !== a && (ta(this, b, a), I(a), a = b, b = a.e), b.e === a) {
21911
+ if (b !== a) {
21912
+ if (b === d || b === d.b) d = d.h;
21913
+ I(b);
21914
+ }
21915
+ if (a === d || a === d.b) d = d.h;
21916
+ I(a);
21917
+ }
21918
+ this.e = e = new Da;
21919
+ d = this.b.c;
21920
+ for(a = d.e; a !== d; a = a.e)a.h = xa(e, a);
21921
+ Ea(e);
21922
+ this.f = new Aa(this);
21923
+ za(this, -O);
21924
+ for(za(this, O); null !== (e = Fa(this.e));){
21925
+ for(;;){
21926
+ a: if (a = this.e, 0 === a.a) d = Ga(a.b);
21927
+ else if (d = a.c[a.d[a.a - 1]], 0 !== a.b.a && (a = Ga(a.b), u(a, d))) {
21928
+ d = a;
21929
+ break a;
21930
+ }
21931
+ if (null === d || !t(d, e)) break;
21932
+ d = Fa(this.e);
21933
+ ta(this, e.c, d.c);
21934
+ }
21935
+ ya(this, e);
21936
+ }
21937
+ this.a = this.f.a.a.b.a.a;
21938
+ for(e = 0; null !== (d = this.f.a.a.b);)d.h || ++e, Q(d);
21939
+ this.f = null;
21940
+ e = this.e;
21941
+ e.b = null;
21942
+ e.d = null;
21943
+ this.e = e.c = null;
21944
+ e = this.b;
21945
+ for(a = e.a.b; a !== e.a; a = d)d = a.b, a = a.a, a.e.e === a && (P(a.c, a), I(a));
21946
+ if (!this.n) {
21947
+ e = this.b;
21948
+ if (this.m) for(a = e.b.h; a !== e.b; a = d)d = a.h, a.b.d.c !== a.d.c ? a.f = a.d.c ? 1 : -1 : I(a);
21949
+ else for(a = e.a.b; a !== e.a; a = d)if (d = a.b, a.c) {
21950
+ for(a = a.a; u(a.b.a, a.a); a = a.c.b);
21951
+ for(; u(a.a, a.b.a); a = a.e);
21952
+ b = a.c.b;
21953
+ for(c = void 0; a.e !== b;)if (u(a.b.a, b.a)) {
21954
+ for(; b.e !== a && (ca(b.e) || 0 >= x(b.a, b.b.a, b.e.b.a));)c = L(b.e, b), b = c.b;
21955
+ b = b.c.b;
21956
+ } else {
21957
+ for(; b.e !== a && (da(a.c.b) || 0 <= x(a.b.a, a.a, a.c.b.a));)c = L(a, a.c.b), a = c.b;
21958
+ a = a.e;
21959
+ }
21960
+ for(; b.e.e !== a;)c = L(b.e, b), b = c.b;
21961
+ }
21962
+ if (this.h || this.i || this.k || this.l) if (this.m) for(e = this.b, d = e.a.b; d !== e.a; d = d.b){
21963
+ if (d.c) {
21964
+ this.h && this.h(2, this.c);
21965
+ a = d.a;
21966
+ do this.k && this.k(a.a.d, this.c), a = a.e;
21967
+ while (a !== d.a);
21968
+ this.i && this.i(this.c);
21969
+ }
21970
+ }
21971
+ else {
21972
+ e = this.b;
21973
+ d = !!this.l;
21974
+ a = !1;
21975
+ b = -1;
21976
+ for(c = e.a.d; c !== e.a; c = c.d)if (c.c) {
21977
+ a || (this.h && this.h(4, this.c), a = !0);
21978
+ g = c.a;
21979
+ do d && (f = g.b.d.c ? 0 : 1, b !== f && (b = f, this.l && this.l(!!b, this.c))), this.k && this.k(g.a.d, this.c), g = g.e;
21980
+ while (g !== c.a);
21981
+ }
21982
+ a && this.i && this.i(this.c);
21983
+ }
21984
+ if (this.r) {
21985
+ e = this.b;
21986
+ for(a = e.a.b; a !== e.a; a = d)if (d = a.b, !a.c) {
21987
+ b = a.a;
21988
+ c = b.e;
21989
+ g = void 0;
21990
+ do g = c, c = g.e, g.d = null, null === g.b.d && (g.c === g ? F(g.a, null) : (g.a.c = g.c, H(g, J(g))), f = g.b, f.c === f ? F(f.a, null) : (f.a.c = f.c, H(f, J(f))), fa(g));
21991
+ while (g !== b);
21992
+ b = a.d;
21993
+ a = a.b;
21994
+ a.d = b;
21995
+ b.b = a;
21996
+ }
21997
+ this.r(this.b);
21998
+ this.c = this.b = null;
21999
+ return;
22000
+ }
22001
+ }
22002
+ this.b = this.c = null;
22003
+ };
22004
+ function Z(a, b) {
22005
+ if (a.d !== b) for(; a.d !== b;)if (a.d < b) switch(a.d){
22006
+ case Y:
22007
+ V(a, 100151);
22008
+ a.u(null);
22009
+ break;
22010
+ case 1:
22011
+ V(a, 100152), a.t();
22012
+ }
22013
+ else switch(a.d){
22014
+ case 2:
22015
+ V(a, 100154);
22016
+ a.v();
22017
+ break;
22018
+ case 1:
22019
+ V(a, 100153), a.w();
22020
+ }
22021
+ }
22022
+ function V(a, b) {
22023
+ a.p && a.p(b, a.c);
22024
+ }
22025
+ function ga(a, b) {
22026
+ this.b = a || this;
22027
+ this.d = b || this;
22028
+ this.a = null;
22029
+ this.c = !1;
22030
+ }
22031
+ function M() {
22032
+ this.h = this;
22033
+ this.i = this.d = this.a = this.e = this.c = this.b = null;
22034
+ this.f = 0;
22035
+ }
22036
+ function J(a) {
22037
+ return a.b.e;
22038
+ }
22039
+ function Ca() {
22040
+ this.c = new N;
22041
+ this.a = new ga;
22042
+ this.b = new M;
22043
+ this.d = new M;
22044
+ this.b.b = this.d;
22045
+ this.d.b = this.b;
22046
+ }
22047
+ function N(a, b) {
22048
+ this.e = a || this;
22049
+ this.f = b || this;
22050
+ this.d = this.c = null;
22051
+ this.g = [
22052
+ 0,
22053
+ 0,
22054
+ 0
22055
+ ];
22056
+ this.h = this.a = this.b = 0;
22057
+ }
22058
+ function Da() {
22059
+ this.c = [];
22060
+ this.d = null;
22061
+ this.a = 0;
22062
+ this.e = !1;
22063
+ this.b = new Ha;
22064
+ }
22065
+ function Ea(a) {
22066
+ a.d = [];
22067
+ for(var b = 0; b < a.a; b++)a.d[b] = b;
22068
+ a.d.sort(function(a) {
22069
+ return function(b, e) {
22070
+ return u(a[b], a[e]) ? 1 : -1;
22071
+ };
22072
+ }(a.c));
22073
+ a.e = !0;
22074
+ Ia(a.b);
22075
+ }
22076
+ function xa(a, b) {
22077
+ if (a.e) {
22078
+ var c = a.b, d = ++c.a;
22079
+ 2 * d > c.f && (c.f *= 2, c.c = Ja(c.c, c.f + 1));
22080
+ var e;
22081
+ 0 === c.b ? e = d : (e = c.b, c.b = c.c[c.b]);
22082
+ c.e[e] = b;
22083
+ c.c[e] = d;
22084
+ c.d[d] = e;
22085
+ c.h && va(c, d);
22086
+ return e;
22087
+ }
22088
+ c = a.a++;
22089
+ a.c[c] = b;
22090
+ return -(c + 1);
22091
+ }
22092
+ function Fa(a) {
22093
+ if (0 === a.a) return Ka(a.b);
22094
+ var b = a.c[a.d[a.a - 1]];
22095
+ if (0 !== a.b.a && u(Ga(a.b), b)) return Ka(a.b);
22096
+ do --a.a;
22097
+ while (0 < a.a && null === a.c[a.d[a.a - 1]]);
22098
+ return b;
22099
+ }
22100
+ function Ha() {
22101
+ this.d = Ja([
22102
+ 0
22103
+ ], 33);
22104
+ this.e = [
22105
+ null,
22106
+ null
22107
+ ];
22108
+ this.c = [
22109
+ 0,
22110
+ 0
22111
+ ];
22112
+ this.a = 0;
22113
+ this.f = 32;
22114
+ this.b = 0;
22115
+ this.h = !1;
22116
+ this.d[1] = 1;
22117
+ }
22118
+ function Ja(a, b) {
22119
+ for(var c = Array(b), d = 0; d < a.length; d++)c[d] = a[d];
22120
+ for(; d < b; d++)c[d] = 0;
22121
+ return c;
22122
+ }
22123
+ function Ia(a) {
22124
+ for(var b = a.a; 1 <= b; --b)W(a, b);
22125
+ a.h = !0;
22126
+ }
22127
+ function Ga(a) {
22128
+ return a.e[a.d[1]];
22129
+ }
22130
+ function Ka(a) {
22131
+ var b = a.d, c = a.e, d = a.c, e = b[1], f = c[e];
22132
+ 0 < a.a && (b[1] = b[a.a], d[b[1]] = 1, c[e] = null, d[e] = a.b, a.b = e, 0 < --a.a && W(a, 1));
22133
+ return f;
22134
+ }
22135
+ function W(a, b) {
22136
+ for(var c = a.d, d = a.e, e = a.c, f = b, g = c[f];;){
22137
+ var h = f << 1;
22138
+ h < a.a && u(d[c[h + 1]], d[c[h]]) && (h += 1);
22139
+ var k = c[h];
22140
+ if (h > a.a || u(d[g], d[k])) {
22141
+ c[f] = g;
22142
+ e[g] = f;
22143
+ break;
22144
+ }
22145
+ c[f] = k;
22146
+ e[k] = f;
22147
+ f = h;
22148
+ }
22149
+ }
22150
+ function va(a, b) {
22151
+ for(var c = a.d, d = a.e, e = a.c, f = b, g = c[f];;){
22152
+ var h = f >> 1, k = c[h];
22153
+ if (0 === h || u(d[k], d[g])) {
22154
+ c[f] = g;
22155
+ e[g] = f;
22156
+ break;
22157
+ }
22158
+ c[f] = k;
22159
+ e[k] = f;
22160
+ f = h;
22161
+ }
22162
+ }
22163
+ function ma() {
22164
+ this.e = this.a = null;
22165
+ this.f = 0;
22166
+ this.c = this.b = this.h = this.d = !1;
22167
+ }
22168
+ function S(a) {
22169
+ return a.e.c.b;
22170
+ }
22171
+ function R(a) {
22172
+ return a.e.a.b;
22173
+ }
22174
+ commonjsGlobal.libtess = {
22175
+ GluTesselator: X,
22176
+ windingRule: {
22177
+ GLU_TESS_WINDING_ODD: 100130,
22178
+ GLU_TESS_WINDING_NONZERO: 100131,
22179
+ GLU_TESS_WINDING_POSITIVE: 100132,
22180
+ GLU_TESS_WINDING_NEGATIVE: 100133,
22181
+ GLU_TESS_WINDING_ABS_GEQ_TWO: 100134
22182
+ },
22183
+ primitiveType: {
22184
+ GL_LINE_LOOP: 2,
22185
+ GL_TRIANGLES: 4,
22186
+ GL_TRIANGLE_STRIP: 5,
22187
+ GL_TRIANGLE_FAN: 6
22188
+ },
22189
+ errorType: {
22190
+ GLU_TESS_MISSING_BEGIN_POLYGON: 100151,
22191
+ GLU_TESS_MISSING_END_POLYGON: 100153,
22192
+ GLU_TESS_MISSING_BEGIN_CONTOUR: 100152,
22193
+ GLU_TESS_MISSING_END_CONTOUR: 100154,
22194
+ GLU_TESS_COORD_TOO_LARGE: 100155,
22195
+ GLU_TESS_NEED_COMBINE_CALLBACK: 100156
22196
+ },
22197
+ gluEnum: {
22198
+ GLU_TESS_MESH: 100112,
22199
+ GLU_TESS_TOLERANCE: 100142,
22200
+ GLU_TESS_WINDING_RULE: 100140,
22201
+ GLU_TESS_BOUNDARY_ONLY: 100141,
22202
+ GLU_INVALID_ENUM: 100900,
22203
+ GLU_INVALID_VALUE: 100901,
22204
+ GLU_TESS_BEGIN: 100100,
22205
+ GLU_TESS_VERTEX: 100101,
22206
+ GLU_TESS_END: 100102,
22207
+ GLU_TESS_ERROR: 100103,
22208
+ GLU_TESS_EDGE_FLAG: 100104,
22209
+ GLU_TESS_COMBINE: 100105,
22210
+ GLU_TESS_BEGIN_DATA: 100106,
22211
+ GLU_TESS_VERTEX_DATA: 100107,
22212
+ GLU_TESS_END_DATA: 100108,
22213
+ GLU_TESS_ERROR_DATA: 100109,
22214
+ GLU_TESS_EDGE_FLAG_DATA: 100110,
22215
+ GLU_TESS_COMBINE_DATA: 100111
22216
+ }
22217
+ };
22218
+ X.prototype.gluDeleteTess = X.prototype.x;
22219
+ X.prototype.gluTessProperty = X.prototype.B;
22220
+ X.prototype.gluGetTessProperty = X.prototype.y;
22221
+ X.prototype.gluTessNormal = X.prototype.A;
22222
+ X.prototype.gluTessCallback = X.prototype.z;
22223
+ X.prototype.gluTessVertex = X.prototype.C;
22224
+ X.prototype.gluTessBeginPolygon = X.prototype.u;
22225
+ X.prototype.gluTessBeginContour = X.prototype.t;
22226
+ X.prototype.gluTessEndContour = X.prototype.v;
22227
+ X.prototype.gluTessEndPolygon = X.prototype.w;
22228
+ {
22229
+ module.exports = commonjsGlobal.libtess;
22230
+ }
22231
+ }(libtess_min));
22232
+
22233
+ var tessy = function initTesselator() {
22234
+ // function called for each vertex of tesselator output
22235
+ function vertexCallback(data, polyVertArray) {
22236
+ polyVertArray[polyVertArray.length] = data[0];
22237
+ polyVertArray[polyVertArray.length] = data[1];
22238
+ }
22239
+ function begincallback(type) {
22240
+ if (type !== libtess_min.exports.primitiveType.GL_TRIANGLES) {
22241
+ console.info("expected TRIANGLES but got type: " + type);
22242
+ }
22243
+ }
22244
+ function errorcallback(errno) {
22245
+ console.error("error callback, error number: " + errno);
22246
+ }
22247
+ // callback for when segments intersect and must be split
22248
+ function combinecallback(coords, data, weight) {
22249
+ // console.log('combine callback');
22250
+ return [
22251
+ coords[0],
22252
+ coords[1],
22253
+ coords[2]
22254
+ ];
22255
+ }
22256
+ function edgeCallback(flag) {
22257
+ // don't really care about the flag, but need no-strip/no-fan behavior
22258
+ // console.log('edge flag: ' + flag);
22259
+ }
22260
+ var tessy = new libtess_min.exports.GluTesselator();
22261
+ // tessy.gluTessProperty(libtess.gluEnum.GLU_TESS_WINDING_RULE, libtess.windingRule.GLU_TESS_WINDING_POSITIVE);
22262
+ tessy.gluTessCallback(libtess_min.exports.gluEnum.GLU_TESS_VERTEX_DATA, vertexCallback);
22263
+ tessy.gluTessCallback(libtess_min.exports.gluEnum.GLU_TESS_BEGIN, begincallback);
22264
+ tessy.gluTessCallback(libtess_min.exports.gluEnum.GLU_TESS_ERROR, errorcallback);
22265
+ tessy.gluTessCallback(libtess_min.exports.gluEnum.GLU_TESS_COMBINE, combinecallback);
22266
+ tessy.gluTessCallback(libtess_min.exports.gluEnum.GLU_TESS_EDGE_FLAG, edgeCallback);
22267
+ return tessy;
22268
+ }();
22269
+ function triangulate(contours) {
22270
+ // libtess will take 3d verts and flatten to a plane for tesselation
22271
+ // since only doing 2d tesselation here, provide z=1 normal to skip
22272
+ // iterating over verts only to get the same answer.
22273
+ // comment out to test normal-generation code
22274
+ tessy.gluTessNormal(0, 0, 1);
22275
+ var triangleVerts = [];
22276
+ tessy.gluTessBeginPolygon(triangleVerts);
22277
+ for(var i = 0; i < contours.length; i++){
22278
+ tessy.gluTessBeginContour();
22279
+ var contour = contours[i];
22280
+ for(var j = 0; j < contour.length; j += 2){
22281
+ var coords = [
22282
+ contour[j],
22283
+ contour[j + 1],
22284
+ 0
22285
+ ];
22286
+ tessy.gluTessVertex(coords, coords);
22287
+ }
22288
+ tessy.gluTessEndContour();
22289
+ }
22290
+ // finish polygon
22291
+ tessy.gluTessEndPolygon();
22292
+ return triangleVerts;
22293
+ }
22294
+
22295
+ exports.ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
22296
+ _inherits(ShapeComponent, RendererComponent);
22297
+ function ShapeComponent(engine) {
22298
+ var _this;
22299
+ _this = RendererComponent.call(this, engine) || this;
22300
+ _this.path = new GraphicsPath();
22301
+ _this.curveValues = [];
22302
+ _this.dirty = false;
22303
+ _this.vert = "\nprecision highp float;\n\nattribute vec3 aPos;//x y\n\nvarying vec4 vColor;\n\nuniform vec4 _Color;\nuniform mat4 effects_MatrixVP;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_ObjectToWorld;\n\nvoid main() {\n vColor = _Color;\n vec4 pos = vec4(aPos.xyz, 1.0);\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * pos;\n}\n";
22304
+ _this.frag = "\nprecision highp float;\n\nvarying vec4 vColor;\n\nvoid main() {\n vec4 color = vec4(1.0,1.0,1.0,1.0);\n gl_FragColor = color;\n}\n";
22305
+ if (!_this.geometry) {
22306
+ _this.geometry = Geometry.create(engine, {
22307
+ attributes: {
22308
+ aPos: {
22309
+ type: glContext.FLOAT,
22310
+ size: 3,
22311
+ data: new Float32Array([
22312
+ -0.5,
22313
+ 0.5,
22314
+ 0,
22315
+ -0.5,
22316
+ -0.5,
22317
+ 0,
22318
+ 0.5,
22319
+ 0.5,
22320
+ 0,
22321
+ 0.5,
22322
+ -0.5,
22323
+ 0
22324
+ ])
22325
+ },
22326
+ aUV: {
22327
+ type: glContext.FLOAT,
22328
+ size: 2,
22329
+ data: new Float32Array()
22330
+ }
22331
+ },
22332
+ mode: glContext.TRIANGLES,
22333
+ drawCount: 4
22334
+ });
22335
+ }
22336
+ if (!_this.material) {
22337
+ var materialProps = {
22338
+ shader: {
22339
+ vertex: _this.vert,
22340
+ fragment: _this.frag,
22341
+ glslVersion: exports.GLSLVersion.GLSL1
22342
+ }
22343
+ };
22344
+ _this.material = Material.create(engine, materialProps);
22345
+ _this.material.setColor("_Color", new Color(1, 1, 1, 1));
22346
+ _this.material.depthMask = true;
22347
+ _this.material.depthTest = true;
22348
+ _this.material.blending = true;
22349
+ }
22350
+ return _this;
22351
+ }
22352
+ var _proto = ShapeComponent.prototype;
22353
+ _proto.onUpdate = function onUpdate(dt) {
22354
+ if (this.dirty) {
22355
+ this.path.clear();
22356
+ this.path.moveTo(this.curveValues[this.curveValues.length - 1].point.x, this.curveValues[this.curveValues.length - 1].point.y);
22357
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.curveValues), _step; !(_step = _iterator()).done;){
22358
+ var curveValue = _step.value;
22359
+ var point = curveValue.point;
22360
+ var control1 = curveValue.controlPoint1;
22361
+ var control2 = curveValue.controlPoint2;
22362
+ this.path.bezierCurveTo(control1.x, control1.y, control2.x, control2.y, point.x, point.y, 1);
22363
+ }
22364
+ this.buildGeometryFromPath(this.path.shapePath);
22365
+ this.dirty = false;
22366
+ }
22367
+ };
22368
+ _proto.render = function render(renderer) {
22369
+ if (renderer.renderingData.currentFrame.globalUniforms) {
22370
+ renderer.setGlobalMatrix("effects_ObjectToWorld", this.transform.getWorldMatrix());
22371
+ }
22372
+ renderer.drawGeometry(this.geometry, this.material);
22373
+ };
22374
+ _proto.buildGeometryFromPath = function buildGeometryFromPath(shapePath) {
22375
+ var shapePrimitives = shapePath.shapePrimitives;
22376
+ var vertices = [];
22377
+ // triangulate shapePrimitive
22378
+ for(var _iterator = _create_for_of_iterator_helper_loose(shapePrimitives), _step; !(_step = _iterator()).done;){
22379
+ var shapePrimitive = _step.value;
22380
+ var _vertices;
22381
+ var shape = shapePrimitive.shape;
22382
+ (_vertices = vertices).push.apply(_vertices, [].concat(triangulate([
22383
+ shape.points
22384
+ ])));
22385
+ }
22386
+ // build vertices and uvs
22387
+ var vertexCount = vertices.length / 2;
22388
+ var positionArray = this.geometry.getAttributeData("aPos");
22389
+ var uvArray = this.geometry.getAttributeData("aUV");
22390
+ if (!positionArray || positionArray.length < vertexCount * 3) {
22391
+ positionArray = new Float32Array(vertexCount * 3);
22392
+ }
22393
+ if (!uvArray || uvArray.length < vertexCount * 2) {
22394
+ uvArray = new Float32Array(vertexCount * 2);
22395
+ }
22396
+ for(var i = 0; i < vertexCount; i++){
22397
+ var pointsOffset = i * 3;
22398
+ var positionArrayOffset = i * 2;
22399
+ var uvOffset = i * 2;
22400
+ positionArray[pointsOffset] = vertices[positionArrayOffset];
22401
+ positionArray[pointsOffset + 1] = vertices[positionArrayOffset + 1];
22402
+ positionArray[pointsOffset + 2] = 0;
22403
+ uvArray[uvOffset] = positionArray[pointsOffset];
22404
+ uvArray[uvOffset + 1] = positionArray[pointsOffset + 1];
22405
+ }
22406
+ this.geometry.setAttributeData("aPos", positionArray);
22407
+ this.geometry.setAttributeData("aUV", uvArray);
22408
+ this.geometry.setDrawCount(vertexCount);
22409
+ };
22410
+ _proto.fromData = function fromData(data) {
22411
+ RendererComponent.prototype.fromData.call(this, data);
22412
+ var points = data.param.points;
22413
+ var easingIns = data.param.easingIn;
22414
+ var easingOuts = data.param.easingOut;
22415
+ for(var _iterator = _create_for_of_iterator_helper_loose(data.param.shapes), _step; !(_step = _iterator()).done;){
22416
+ var shape = _step.value;
22417
+ var indices = shape.indexes;
22418
+ for(var i = 1; i < indices.length; i++){
22419
+ var pointIndex = indices[i];
22420
+ var lastPointIndex = indices[i - 1];
22421
+ this.curveValues.push({
22422
+ point: points[pointIndex.point],
22423
+ controlPoint1: easingOuts[lastPointIndex.easingOut],
22424
+ controlPoint2: easingIns[pointIndex.easingIn]
22425
+ });
22426
+ }
22427
+ // Push the last curve
22428
+ this.curveValues.push({
22429
+ point: points[indices[0].point],
22430
+ controlPoint1: easingOuts[indices[indices.length - 1].easingOut],
22431
+ controlPoint2: easingIns[indices[0].easingIn]
22432
+ });
22433
+ }
22434
+ this.dirty = true;
22435
+ };
22436
+ return ShapeComponent;
22437
+ }(RendererComponent);
22438
+ exports.ShapeComponent = __decorate([
22439
+ effectsClass("ShapeComponent")
22440
+ ], exports.ShapeComponent);
22441
+ exports.ComponentShapeType = void 0;
22442
+ (function(ComponentShapeType) {
22443
+ /**
22444
+ * 自定义图形
22445
+ */ ComponentShapeType[ComponentShapeType["CUSTOM"] = 0] = "CUSTOM";
22446
+ /**
22447
+ * 矩形
22448
+ */ ComponentShapeType[ComponentShapeType["RECTANGLE"] = 1] = "RECTANGLE";
22449
+ /**
22450
+ * 椭圆
22451
+ */ ComponentShapeType[ComponentShapeType["ELLIPSE"] = 2] = "ELLIPSE";
22452
+ /**
22453
+ * 多边形
22454
+ */ ComponentShapeType[ComponentShapeType["POLYGON"] = 3] = "POLYGON";
22455
+ /**
22456
+ * 星形
22457
+ */ ComponentShapeType[ComponentShapeType["STAR"] = 4] = "STAR";
22458
+ })(exports.ComponentShapeType || (exports.ComponentShapeType = {}));
22459
+ exports.ShapeConnectType = void 0;
22460
+ (function(ShapeConnectType) {})(exports.ShapeConnectType || (exports.ShapeConnectType = {}));
22461
+ exports.ShapePointType = void 0;
22462
+ (function(ShapePointType) {})(exports.ShapePointType || (exports.ShapePointType = {}));
22463
+
20798
22464
  var EventEmitter = function EventEmitter() {
20799
22465
  var _this = this;
20800
22466
  var _this1 = this;
@@ -21164,21 +22830,21 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
21164
22830
  return now - this.duration > 0.001;
21165
22831
  };
21166
22832
  _proto.find = function find(name) {
22833
+ var _queue;
21167
22834
  if (this.name === name) {
21168
22835
  return this;
21169
22836
  }
21170
- for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
21171
- var child = _step.value;
21172
- if (child.name === name) {
21173
- return child;
21174
- }
21175
- }
21176
- for(var _iterator1 = _create_for_of_iterator_helper_loose(this.children), _step1; !(_step1 = _iterator1()).done;){
21177
- var child1 = _step1.value;
21178
- var res = child1.find(name);
21179
- if (res) {
21180
- return res;
22837
+ var queue = [];
22838
+ (_queue = queue).push.apply(_queue, [].concat(this.children));
22839
+ var index = 0;
22840
+ while(index < queue.length){
22841
+ var _queue1;
22842
+ var item = queue[index];
22843
+ index++;
22844
+ if (item.name === name) {
22845
+ return item;
21181
22846
  }
22847
+ (_queue1 = queue).push.apply(_queue1, [].concat(item.children));
21182
22848
  }
21183
22849
  return undefined;
21184
22850
  };
@@ -23922,15 +25588,22 @@ function passRenderLevel(l, renderLevel) {
23922
25588
  return false;
23923
25589
  }
23924
25590
 
23925
- function isSceneJSON(scene) {
23926
- return isObject(scene) && "jsonScene" in scene;
23927
- }
23928
- function isSceneURL(scene) {
23929
- return isObject(scene) && "url" in scene;
23930
- }
23931
- function isSceneWithOptions(scene) {
23932
- return isObject(scene) && "options" in scene;
23933
- }
25591
+ exports.Scene = void 0;
25592
+ (function(Scene) {
25593
+ function isJSONObject(scene) {
25594
+ return isObject(scene) && "jsonScene" in scene;
25595
+ }
25596
+ // JSON 对象
25597
+ Scene.isJSONObject = isJSONObject;
25598
+ function isURL(scene) {
25599
+ return isObject(scene) && "url" in scene;
25600
+ }
25601
+ Scene.isURL = isURL;
25602
+ function isWithOptions(scene) {
25603
+ return isObject(scene) && "options" in scene;
25604
+ }
25605
+ Scene.isWithOptions = isWithOptions;
25606
+ })(exports.Scene || (exports.Scene = {}));
23934
25607
 
23935
25608
  function getBackgroundImage(template, variables) {
23936
25609
  var templateBackground;
@@ -24055,13 +25728,12 @@ var seed = 1;
24055
25728
  */ _proto.loadScene = function loadScene(url, renderer, options) {
24056
25729
  var _this = this;
24057
25730
  return _async_to_generator(function() {
24058
- var _gpuInstance_detail, rawJSON, assetUrl, startTime, timeInfoMessages, gpuInstance, _gpuInstance_detail_asyncShaderCompile, asyncShaderCompile, _gpuInstance_detail_compressedTexture, compressedTexture, timeInfos, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
25731
+ var rawJSON, assetUrl, startTime, timeInfoMessages, gpuInstance, _gpuInstance_detail_compressedTexture, compressedTexture, timeInfos, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
24059
25732
  return __generator(this, function(_state) {
24060
25733
  assetUrl = isString(url) ? url : _this.id;
24061
25734
  startTime = performance.now();
24062
25735
  timeInfoMessages = [];
24063
25736
  gpuInstance = renderer == null ? void 0 : renderer.engine.gpuCapability;
24064
- asyncShaderCompile = (_gpuInstance_detail_asyncShaderCompile = gpuInstance == null ? void 0 : (_gpuInstance_detail = gpuInstance.detail) == null ? void 0 : _gpuInstance_detail.asyncShaderCompile) != null ? _gpuInstance_detail_asyncShaderCompile : false;
24065
25737
  compressedTexture = (_gpuInstance_detail_compressedTexture = gpuInstance == null ? void 0 : gpuInstance.detail.compressedTexture) != null ? _gpuInstance_detail_compressedTexture : exports.COMPRESSED_TEXTURE.NONE;
24066
25738
  timeInfos = {};
24067
25739
  cancelLoading = false;
@@ -24114,81 +25786,55 @@ var seed = 1;
24114
25786
  });
24115
25787
  });
24116
25788
  loadResourcePromise = /*#__PURE__*/ _async_to_generator(function() {
24117
- var scene, _rawJSON_jsonScene, rawImages, images, i, i1, _ref, usedImages, jsonScene, pluginSystem, _jsonScene_bins, bins, images1, compositions, fonts, _ref1, loadedBins, loadedImages, i2, imageAsset, loadedTextures, totalTime;
25789
+ var scene, link, _ref, jsonScene, pluginSystem, _jsonScene_bins, bins, images, compositions, fonts, _ref1, loadedBins, loadedImages, i, i1, imageAsset, loadedTextures, totalTime;
24118
25790
  return __generator(this, function(_state) {
24119
25791
  switch(_state.label){
24120
25792
  case 0:
24121
- if (!isObject(url)) return [
24122
- 3,
24123
- 1
24124
- ];
24125
- // TODO: 原 JSONLoader contructor 判断是否兼容
24126
- rawJSON = url;
24127
- _this.baseUrl = location.href;
24128
- return [
25793
+ if (!isString(url)) return [
24129
25794
  3,
24130
- 3
25795
+ 2
24131
25796
  ];
24132
- case 1:
24133
25797
  // 兼容相对路径
24134
- url = new URL(url, location.href).href;
24135
- _this.baseUrl = url;
25798
+ link = new URL(url, location.href).href;
25799
+ _this.baseUrl = link;
24136
25800
  return [
24137
25801
  4,
24138
25802
  hookTimeInfo("loadJSON", function() {
24139
- return _this.loadJSON(url);
25803
+ return _this.loadJSON(link);
24140
25804
  })
24141
25805
  ];
24142
- case 2:
25806
+ case 1:
24143
25807
  rawJSON = _state.sent();
25808
+ return [
25809
+ 3,
25810
+ 3
25811
+ ];
25812
+ case 2:
25813
+ // url 为 spec.JSONScene 或 Scene 对象
25814
+ rawJSON = url;
25815
+ _this.baseUrl = location.href;
24144
25816
  _state.label = 3;
24145
25817
  case 3:
24146
- if (!isSceneJSON(rawJSON)) return [
25818
+ if (!exports.Scene.isJSONObject(rawJSON)) return [
24147
25819
  3,
24148
- 6
25820
+ 4
24149
25821
  ];
24150
25822
  // 已经加载过的 可能需要更新数据模板
24151
25823
  scene = _extends({}, rawJSON);
24152
- if (!(_this.options && _this.options.variables && Object.keys(_this.options.variables).length !== 0)) return [
24153
- 3,
24154
- 5
24155
- ];
24156
- _rawJSON_jsonScene = rawJSON.jsonScene, rawImages = _rawJSON_jsonScene.images;
24157
- images = scene.images;
24158
- for(i = 0; i < rawImages.length; i++){
24159
- // 仅重新加载数据模板对应的图片
24160
- if (_instanceof1(images[i], HTMLCanvasElement)) {
24161
- images[i] = rawImages[i];
24162
- }
24163
- }
24164
- return [
24165
- 4,
24166
- hookTimeInfo("processImages", function() {
24167
- return _this.processImages(images, compressedTexture);
24168
- })
24169
- ];
24170
- case 4:
24171
- scene.images = _state.sent();
24172
- // 更新 TextureOptions 中的 image 指向
24173
- for(i1 = 0; i1 < scene.images.length; i1++){
24174
- scene.textureOptions[i1].image = scene.images[i1];
24175
- }
24176
- _state.label = 5;
24177
- case 5:
24178
25824
  return [
24179
25825
  3,
24180
- 12
25826
+ 9
24181
25827
  ];
24182
- case 6:
25828
+ case 4:
24183
25829
  return [
24184
25830
  4,
24185
25831
  hookTimeInfo("processJSON", function() {
24186
25832
  return _this.processJSON(rawJSON);
24187
25833
  })
24188
25834
  ];
24189
- case 7:
24190
- _ref = _state.sent(), usedImages = _ref.usedImages, jsonScene = _ref.jsonScene, pluginSystem = _ref.pluginSystem;
24191
- _jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, images1 = jsonScene.images, compositions = jsonScene.compositions, fonts = jsonScene.fonts;
25835
+ case 5:
25836
+ _ref = _state.sent(), jsonScene = _ref.jsonScene, pluginSystem = _ref.pluginSystem;
25837
+ _jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, images = jsonScene.images, compositions = jsonScene.compositions, fonts = jsonScene.fonts;
24192
25838
  return [
24193
25839
  4,
24194
25840
  Promise.all([
@@ -24196,38 +25842,36 @@ var seed = 1;
24196
25842
  return _this.processBins(bins);
24197
25843
  }),
24198
25844
  hookTimeInfo("processImages", function() {
24199
- return _this.processImages(images1, compressedTexture);
25845
+ return _this.processImages(images, compressedTexture);
24200
25846
  }),
24201
- hookTimeInfo("" + (asyncShaderCompile ? "async" : "sync") + "Compile", function() {
25847
+ hookTimeInfo("precompile", function() {
24202
25848
  return _this.precompile(compositions, pluginSystem, renderer, options);
25849
+ }),
25850
+ hookTimeInfo("processFontURL", function() {
25851
+ return _this.processFontURL(fonts);
24203
25852
  })
24204
25853
  ])
24205
25854
  ];
24206
- case 8:
25855
+ case 6:
24207
25856
  _ref1 = _state.sent(), loadedBins = _ref1[0], loadedImages = _ref1[1];
25857
+ for(i = 0; i < images.length; i++){
25858
+ _this.assets[images[i].id] = loadedImages[i];
25859
+ }
24208
25860
  if (renderer) {
24209
- for(i2 = 0; i2 < images1.length; i2++){
25861
+ for(i1 = 0; i1 < images.length; i1++){
24210
25862
  imageAsset = new ImageAsset(renderer.engine);
24211
- imageAsset.data = loadedImages[i2];
24212
- imageAsset.setInstanceId(images1[i2].id);
25863
+ imageAsset.data = loadedImages[i1];
25864
+ imageAsset.setInstanceId(images[i1].id);
24213
25865
  renderer.engine.addInstance(imageAsset);
24214
25866
  }
24215
25867
  }
24216
- return [
24217
- 4,
24218
- hookTimeInfo("processFontURL", function() {
24219
- return _this.processFontURL(fonts);
24220
- })
24221
- ];
24222
- case 9:
24223
- _state.sent();
24224
25868
  return [
24225
25869
  4,
24226
25870
  hookTimeInfo("processTextures", function() {
24227
- return _this.processTextures(loadedImages, loadedBins, jsonScene, renderer.engine);
25871
+ return _this.processTextures(loadedImages, loadedBins, jsonScene);
24228
25872
  })
24229
25873
  ];
24230
- case 10:
25874
+ case 7:
24231
25875
  loadedTextures = _state.sent();
24232
25876
  scene = {
24233
25877
  timeInfos: timeInfos,
@@ -24236,7 +25880,6 @@ var seed = 1;
24236
25880
  storage: {},
24237
25881
  pluginSystem: pluginSystem,
24238
25882
  jsonScene: jsonScene,
24239
- usedImages: usedImages,
24240
25883
  images: loadedImages,
24241
25884
  textureOptions: loadedTextures,
24242
25885
  bins: loadedBins
@@ -24248,10 +25891,10 @@ var seed = 1;
24248
25891
  return pluginSystem.loadResources(scene, _this.options);
24249
25892
  })
24250
25893
  ];
24251
- case 11:
25894
+ case 8:
24252
25895
  _state.sent();
24253
- _state.label = 12;
24254
- case 12:
25896
+ _state.label = 9;
25897
+ case 9:
24255
25898
  totalTime = performance.now() - startTime;
24256
25899
  logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + ".");
24257
25900
  window.clearTimeout(loadTimer);
@@ -24279,7 +25922,6 @@ var seed = 1;
24279
25922
  };
24280
25923
  _proto.precompile = function precompile(compositions, pluginSystem, renderer, options) {
24281
25924
  return _async_to_generator(function() {
24282
- var shaderLibrary;
24283
25925
  return __generator(this, function(_state) {
24284
25926
  switch(_state.label){
24285
25927
  case 0:
@@ -24288,22 +25930,11 @@ var seed = 1;
24288
25930
  2
24289
25931
  ];
24290
25932
  }
24291
- shaderLibrary = renderer == null ? void 0 : renderer.getShaderLibrary();
24292
25933
  return [
24293
25934
  4,
24294
25935
  pluginSystem == null ? void 0 : pluginSystem.precompile(compositions, renderer, options)
24295
25936
  ];
24296
25937
  case 1:
24297
- _state.sent();
24298
- return [
24299
- 4,
24300
- new Promise(function(resolve) {
24301
- shaderLibrary == null ? void 0 : shaderLibrary.compileAllShaders(function() {
24302
- resolve(null);
24303
- });
24304
- })
24305
- ];
24306
- case 2:
24307
25938
  _state.sent();
24308
25939
  return [
24309
25940
  2
@@ -24315,12 +25946,12 @@ var seed = 1;
24315
25946
  _proto.processJSON = function processJSON(json) {
24316
25947
  var _this = this;
24317
25948
  return _async_to_generator(function() {
24318
- var jsonScene, _jsonScene_plugins, plugins, sceneCompositions, imgUsage, images, pluginSystem, renderLevel, usedImages;
25949
+ var jsonScene, _jsonScene_plugins, plugins, pluginSystem;
24319
25950
  return __generator(this, function(_state) {
24320
25951
  switch(_state.label){
24321
25952
  case 0:
24322
25953
  jsonScene = getStandardJSON(json);
24323
- _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins, sceneCompositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, images = jsonScene.images;
25954
+ _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins;
24324
25955
  pluginSystem = new PluginSystem(plugins);
24325
25956
  return [
24326
25957
  4,
@@ -24328,20 +25959,9 @@ var seed = 1;
24328
25959
  ];
24329
25960
  case 1:
24330
25961
  _state.sent();
24331
- renderLevel = _this.options.renderLevel;
24332
- usedImages = {};
24333
- if (imgUsage) {
24334
- // TODO: 考虑放到独立的 fix 文件
24335
- fixOldImageUsage(usedImages, sceneCompositions, imgUsage, images, renderLevel);
24336
- } else {
24337
- images == null ? void 0 : images.forEach(function(_, i) {
24338
- usedImages[i] = true;
24339
- });
24340
- }
24341
25962
  return [
24342
25963
  2,
24343
25964
  {
24344
- usedImages: usedImages,
24345
25965
  jsonScene: jsonScene,
24346
25966
  pluginSystem: pluginSystem
24347
25967
  }
@@ -24413,7 +26033,6 @@ var seed = 1;
24413
26033
  ];
24414
26034
  case 2:
24415
26035
  _state.sent();
24416
- //@ts-expect-error
24417
26036
  document.fonts.add(fontFace);
24418
26037
  AssetManager.fonts.add(font.fontFamily);
24419
26038
  return [
@@ -24495,6 +26114,10 @@ var seed = 1;
24495
26114
  3,
24496
26115
  3
24497
26116
  ];
26117
+ _this.assets[idx] = {
26118
+ url: resultImage.src,
26119
+ type: exports.TextureSourceType.video
26120
+ };
24498
26121
  return [
24499
26122
  2,
24500
26123
  resultImage
@@ -24504,6 +26127,10 @@ var seed = 1;
24504
26127
  if (background && Array.isArray(url) && variables) {
24505
26128
  variables[background.name] = resultImage.src;
24506
26129
  }
26130
+ _this.assets[idx] = {
26131
+ url: resultImage.src,
26132
+ type: exports.TextureSourceType.image
26133
+ };
24507
26134
  return [
24508
26135
  4,
24509
26136
  combineImageTemplate(resultImage, template, variables)
@@ -24546,12 +26173,6 @@ var seed = 1;
24546
26173
  _this.loadBins(bufferURL)
24547
26174
  ];
24548
26175
  }
24549
- } else if ("sourceType" in img) {
24550
- // TODO: 确定是否有用
24551
- return [
24552
- 2,
24553
- img
24554
- ];
24555
26176
  } else if (_instanceof1(img, HTMLImageElement) || _instanceof1(img, HTMLCanvasElement) || _instanceof1(img, HTMLVideoElement) || _instanceof1(img, Texture)) {
24556
26177
  return [
24557
26178
  2,
@@ -24602,7 +26223,7 @@ var seed = 1;
24602
26223
  });
24603
26224
  })();
24604
26225
  };
24605
- _proto.processTextures = function processTextures(images, bins, jsonScene, engine) {
26226
+ _proto.processTextures = function processTextures(images, bins, jsonScene) {
24606
26227
  var _this = this;
24607
26228
  return _async_to_generator(function() {
24608
26229
  var _jsonScene_textures, textures, jobs;
@@ -24613,7 +26234,7 @@ var seed = 1;
24613
26234
  };
24614
26235
  });
24615
26236
  jobs = textures.map(/*#__PURE__*/ _async_to_generator(function(textureOptions, idx) {
24616
- var e, source, image, texture;
26237
+ var e, source, id, image, texture;
24617
26238
  return __generator(this, function(_state) {
24618
26239
  switch(_state.label){
24619
26240
  case 0:
@@ -24637,7 +26258,7 @@ var seed = 1;
24637
26258
  ]);
24638
26259
  return [
24639
26260
  4,
24640
- deserializeMipmapTexture(textureOptions, bins, engine, jsonScene.bins)
26261
+ deserializeMipmapTexture(textureOptions, bins, _this.assets, jsonScene.bins)
24641
26262
  ];
24642
26263
  case 2:
24643
26264
  return [
@@ -24648,12 +26269,12 @@ var seed = 1;
24648
26269
  e = _state.sent();
24649
26270
  throw new Error("Load texture " + idx + " fails, error message: " + e + ".");
24650
26271
  case 4:
24651
- source = textureOptions.source;
26272
+ source = textureOptions.source, id = textureOptions.id;
24652
26273
  if (!isObject(source)) return [
24653
26274
  3,
24654
26275
  5
24655
26276
  ];
24656
- image = engine.assetLoader.loadGUID(source.id).data;
26277
+ image = _this.assets[source.id];
24657
26278
  return [
24658
26279
  3,
24659
26280
  7
@@ -24672,9 +26293,7 @@ var seed = 1;
24672
26293
  _state.label = 7;
24673
26294
  case 7:
24674
26295
  if (image) {
24675
- texture = createTextureOptionsBySource(image, _this.assets[idx]);
24676
- texture.id = textureOptions.id;
24677
- texture.dataType = DataType.Texture;
26296
+ texture = createTextureOptionsBySource(image, _this.assets[idx], id);
24678
26297
  return [
24679
26298
  2,
24680
26299
  texture.sourceType === exports.TextureSourceType.compressed ? texture : _extends({}, texture, textureOptions)
@@ -24735,11 +26354,6 @@ var seed = 1;
24735
26354
  return window.clearTimeout(id);
24736
26355
  });
24737
26356
  }
24738
- for(var key in this.assets){
24739
- var _asset_dispose;
24740
- var asset = this.assets[key];
24741
- asset == null ? void 0 : (_asset_dispose = asset.dispose) == null ? void 0 : _asset_dispose.call(asset);
24742
- }
24743
26357
  this.assets = {};
24744
26358
  this.timers = [];
24745
26359
  };
@@ -24748,55 +26362,44 @@ var seed = 1;
24748
26362
  /**
24749
26363
  * 自定义文本缓存,随页面销毁而销毁
24750
26364
  */ AssetManager.fonts = new Set();
24751
- function fixOldImageUsage(usedImages, compositions, imgUsage, images, renderLevel) {
24752
- for(var i = 0; i < compositions.length; i++){
24753
- var id = compositions[i].id;
24754
- var ids = imgUsage[id];
24755
- if (ids) {
24756
- for(var j = 0; j < ids.length; j++){
24757
- var id1 = ids[j];
24758
- var tag = images[id1].renderLevel;
24759
- if (passRenderLevel(tag, renderLevel)) {
24760
- usedImages[id1] = true;
24761
- }
24762
- }
24763
- }
24764
- }
24765
- }
24766
- function createTextureOptionsBySource(image, sourceFrom) {
26365
+ function createTextureOptionsBySource(image, sourceFrom, id) {
26366
+ var options = {
26367
+ id: id,
26368
+ dataType: DataType.Texture
26369
+ };
24767
26370
  if (_instanceof1(image, Texture)) {
24768
- return image.source;
26371
+ return _extends({}, image.source, options);
24769
26372
  } else if (_instanceof1(image, HTMLImageElement) || isCanvas(image)) {
24770
- return {
26373
+ return _extends({
24771
26374
  image: image,
24772
26375
  sourceType: exports.TextureSourceType.image,
24773
26376
  sourceFrom: sourceFrom,
24774
26377
  keepImageSource: true,
24775
26378
  minFilter: glContext.LINEAR,
24776
26379
  magFilter: glContext.LINEAR
24777
- };
26380
+ }, options);
24778
26381
  } else if (_instanceof1(image, HTMLVideoElement)) {
24779
26382
  // 视频
24780
- return {
26383
+ return _extends({
24781
26384
  sourceType: exports.TextureSourceType.video,
24782
26385
  video: image,
24783
26386
  minFilter: glContext.LINEAR,
24784
26387
  magFilter: glContext.LINEAR
24785
- };
26388
+ }, options);
24786
26389
  } else if (_instanceof1(image, ArrayBuffer)) {
24787
26390
  // 压缩纹理
24788
26391
  return _extends({}, getKTXTextureOptions(image), {
24789
26392
  sourceFrom: sourceFrom
24790
- });
26393
+ }, options);
24791
26394
  } else if ("width" in image && "height" in image && "data" in image) {
24792
- return {
26395
+ return _extends({
24793
26396
  sourceType: exports.TextureSourceType.data,
24794
26397
  data: image,
24795
26398
  wrapS: glContext.CLAMP_TO_EDGE,
24796
26399
  wrapT: glContext.CLAMP_TO_EDGE,
24797
26400
  minFilter: glContext.NEAREST,
24798
26401
  magFilter: glContext.NEAREST
24799
- };
26402
+ }, options);
24800
26403
  }
24801
26404
  throw new Error("Invalid texture options.");
24802
26405
  }
@@ -25100,11 +26703,12 @@ var listOrder = 0;
25100
26703
  function CompositionSourceManager(scene, engine) {
25101
26704
  this.refCompositions = new Map();
25102
26705
  this.refCompositionProps = new Map();
26706
+ this.imgUsage = {};
25103
26707
  this.mask = 0;
25104
26708
  this.engine = engine;
25105
26709
  // 资源
25106
26710
  var jsonScene = scene.jsonScene, renderLevel = scene.renderLevel, textureOptions = scene.textureOptions, pluginSystem = scene.pluginSystem, totalTime = scene.totalTime;
25107
- var compositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, compositionId = jsonScene.compositionId;
26711
+ var compositions = jsonScene.compositions, compositionId = jsonScene.compositionId;
25108
26712
  if (!textureOptions) {
25109
26713
  throw new Error("scene.textures expected.");
25110
26714
  }
@@ -25124,7 +26728,6 @@ var listOrder = 0;
25124
26728
  this.renderLevel = renderLevel;
25125
26729
  this.pluginSystem = pluginSystem;
25126
26730
  this.totalTime = totalTime != null ? totalTime : 0;
25127
- this.imgUsage = imgUsage != null ? imgUsage : {};
25128
26731
  this.textures = cachedTextures;
25129
26732
  listOrder = 0;
25130
26733
  this.sourceContent = this.getContent(this.composition);
@@ -25145,11 +26748,12 @@ var listOrder = 0;
25145
26748
  });
25146
26749
  };
25147
26750
  _proto.assembleItems = function assembleItems(composition) {
26751
+ var _this_jsonScene;
25148
26752
  var items = [];
25149
- this.mask++;
25150
26753
  var componentMap = {};
25151
- //@ts-expect-error
25152
- for(var _iterator = _create_for_of_iterator_helper_loose(this.jsonScene.components), _step; !(_step = _iterator()).done;){
26754
+ this.mask++;
26755
+ var _this_jsonScene_components;
26756
+ for(var _iterator = _create_for_of_iterator_helper_loose((_this_jsonScene_components = (_this_jsonScene = this.jsonScene) == null ? void 0 : _this_jsonScene.components) != null ? _this_jsonScene_components : []), _step; !(_step = _iterator()).done;){
25153
26757
  var component = _step.value;
25154
26758
  componentMap[component.id] = component;
25155
26759
  }
@@ -25186,19 +26790,24 @@ var listOrder = 0;
25186
26790
  _proto.preProcessItemContent = function preProcessItemContent(renderContent) {
25187
26791
  if (renderContent.renderer) {
25188
26792
  renderContent.renderer = this.changeTex(renderContent.renderer);
25189
- if (!renderContent.renderer.mask) {
26793
+ if (!("mask" in renderContent.renderer)) {
25190
26794
  this.processMask(renderContent.renderer);
25191
26795
  }
25192
- var split = renderContent.splits && !renderContent.textureSheetAnimation && renderContent.splits[0];
25193
- if (Number.isInteger(renderContent.renderer.shape)) {
26796
+ var split = renderContent.splits && !renderContent.textureSheetAnimation ? renderContent.splits[0] : undefined;
26797
+ var shape = renderContent.renderer.shape;
26798
+ var shapeData;
26799
+ if (Number.isInteger(shape)) {
25194
26800
  var _this_jsonScene;
25195
- // TODO: scene.shapes 类型问题?
25196
- renderContent.renderer.shape = getGeometryByShape((_this_jsonScene = this.jsonScene) == null ? void 0 : _this_jsonScene.shapes[renderContent.renderer.shape], split);
25197
- } else if (renderContent.renderer.shape && isObject(renderContent.renderer.shape)) {
25198
- renderContent.renderer.shape = getGeometryByShape(renderContent.renderer.shape, split);
26801
+ shapeData = (_this_jsonScene = this.jsonScene) == null ? void 0 : _this_jsonScene.shapes[shape];
26802
+ } else {
26803
+ shapeData = shape;
26804
+ }
26805
+ if (shapeData !== undefined) {
26806
+ // @ts-expect-error 类型转换问题
26807
+ renderContent.renderer.shape = getGeometryByShape(shapeData, split);
25199
26808
  }
25200
26809
  }
25201
- if (renderContent.trails) {
26810
+ if ("trails" in renderContent && renderContent.trails !== undefined) {
25202
26811
  renderContent.trails = this.changeTex(renderContent.trails);
25203
26812
  }
25204
26813
  };
@@ -25206,22 +26815,17 @@ var listOrder = 0;
25206
26815
  if (!renderer.texture) {
25207
26816
  return renderer;
25208
26817
  }
25209
- //@ts-expect-error
25210
26818
  var texIdx = renderer.texture.id;
25211
26819
  if (texIdx !== undefined) {
25212
- //@ts-expect-error
25213
- this.addTextureUsage(texIdx) || texIdx;
26820
+ this.addTextureUsage(texIdx);
25214
26821
  }
25215
26822
  return renderer;
25216
26823
  };
25217
- _proto.addTextureUsage = function addTextureUsage(texIdx) {
25218
- var texId = texIdx;
26824
+ _proto.addTextureUsage = function addTextureUsage(texId) {
25219
26825
  var _this_imgUsage;
25220
- // FIXME: imageUsage 取自 scene.imgUsage,类型为 Record<string, number[]>,这里给的 number,类型对不上
25221
26826
  var imageUsage = (_this_imgUsage = this.imgUsage) != null ? _this_imgUsage : {};
25222
26827
  if (texId && imageUsage) {
25223
- // eslint-disable-next-line no-prototype-builtins
25224
- if (!imageUsage.hasOwnProperty(texId)) {
26828
+ if (!Object.prototype.hasOwnProperty.call(imageUsage, texId)) {
25225
26829
  imageUsage[texId] = 0;
25226
26830
  }
25227
26831
  imageUsage[texId]++;
@@ -25392,7 +26996,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25392
26996
  _this.lastVideoUpdateTime = 0;
25393
26997
  var _props_reusable = props.reusable, reusable = _props_reusable === void 0 ? false : _props_reusable, _props_speed = props.speed, speed = _props_speed === void 0 ? 1 : _props_speed, _props_baseRenderOrder = props.baseRenderOrder, baseRenderOrder = _props_baseRenderOrder === void 0 ? 0 : _props_baseRenderOrder, renderer = props.renderer, event = props.event, width = props.width, height = props.height, handleItemMessage = props.handleItemMessage;
25394
26998
  _this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
25395
- scene.jsonScene.imgUsage = undefined;
25396
26999
  if (reusable) {
25397
27000
  _this.keepResource = true;
25398
27001
  scene.textures = undefined;
@@ -25411,24 +27014,23 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25411
27014
  _this.rootComposition.data = sourceContent;
25412
27015
  _this.rootComposition.item = _this.rootItem;
25413
27016
  _this.rootItem.components.push(_this.rootComposition);
25414
- var imageUsage = !reusable && imgUsage;
25415
27017
  _this.width = width;
25416
27018
  _this.height = height;
25417
27019
  _this.renderOrder = baseRenderOrder;
25418
27020
  _this.id = sourceContent.id;
25419
27021
  _this.renderer = renderer;
25420
- _this.texInfo = imageUsage != null ? imageUsage : {};
27022
+ _this.texInfo = !reusable ? imgUsage : {};
25421
27023
  _this.event = event;
25422
- var _scene_startTime, _scene_timeInfos_asyncCompile;
27024
+ var _scene_startTime;
25423
27025
  _this.statistic = {
25424
- loadTime: totalTime != null ? totalTime : 0,
25425
27026
  loadStart: (_scene_startTime = scene.startTime) != null ? _scene_startTime : 0,
25426
- firstFrameTime: 0,
25427
- precompileTime: (_scene_timeInfos_asyncCompile = scene.timeInfos["asyncCompile"]) != null ? _scene_timeInfos_asyncCompile : scene.timeInfos["syncCompile"]
27027
+ loadTime: totalTime != null ? totalTime : 0,
27028
+ compileTime: 0,
27029
+ firstFrameTime: 0
25428
27030
  };
25429
27031
  _this.reusable = reusable;
25430
27032
  _this.speed = speed;
25431
- _this.autoRefTex = !_this.keepResource && imageUsage && _this.rootItem.endBehavior !== EndBehavior.restart;
27033
+ _this.autoRefTex = !_this.keepResource && _this.texInfo && _this.rootItem.endBehavior !== EndBehavior.restart;
25432
27034
  _this.name = sourceContent.name;
25433
27035
  _this.pluginSystem = pluginSystem;
25434
27036
  _this.pluginSystem.initializeComposition(_assert_this_initialized(_this), scene);
@@ -25437,7 +27039,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25437
27039
  }));
25438
27040
  _this.url = scene.url;
25439
27041
  _this.assigned = true;
25440
- _this.globalTime = 0;
25441
27042
  _this.interactive = true;
25442
27043
  _this.handleItemMessage = handleItemMessage;
25443
27044
  _this.createRenderFrame();
@@ -25600,8 +27201,8 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25600
27201
  * 重置状态函数
25601
27202
  */ _proto.reset = function reset() {
25602
27203
  this.rendererOptions = null;
25603
- this.globalTime = 0;
25604
27204
  this.rootItem.ended = false;
27205
+ this.rootComposition.time = 0;
25605
27206
  this.pluginSystem.resetComposition(this, this.renderFrame);
25606
27207
  };
25607
27208
  _proto.prepareRender = function prepareRender() {
@@ -25638,9 +27239,8 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25638
27239
  if (!this.assigned || this.paused) {
25639
27240
  return;
25640
27241
  }
25641
- var time = this.getUpdateTime(deltaTime * this.speed);
25642
- this.globalTime += time;
25643
- this.updateRootComposition();
27242
+ var dt = this.getUpdateTime(deltaTime * this.speed);
27243
+ this.updateRootComposition(dt / 1000);
25644
27244
  this.updateVideo();
25645
27245
  // 更新 model-tree-plugin
25646
27246
  this.updatePluginLoaders(deltaTime);
@@ -25649,8 +27249,8 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25649
27249
  this.callAwake(this.rootItem);
25650
27250
  this.rootItem.beginPlay();
25651
27251
  }
25652
- this.sceneTicking.update.tick(time);
25653
- this.sceneTicking.lateUpdate.tick(time);
27252
+ this.sceneTicking.update.tick(dt);
27253
+ this.sceneTicking.lateUpdate.tick(dt);
25654
27254
  this.updateCamera();
25655
27255
  this.prepareRender();
25656
27256
  if (this.shouldDispose()) {
@@ -25791,9 +27391,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25791
27391
  };
25792
27392
  /**
25793
27393
  * 更新主合成组件
25794
- */ _proto.updateRootComposition = function updateRootComposition() {
27394
+ */ _proto.updateRootComposition = function updateRootComposition(deltaTime) {
25795
27395
  if (this.rootComposition.isActiveAndEnabled) {
25796
- var localTime = this.toLocalTime(this.globalTime / 1000);
27396
+ var localTime = this.toLocalTime(this.time + deltaTime);
25797
27397
  this.rootComposition.time = localTime;
25798
27398
  }
25799
27399
  };
@@ -28127,7 +29727,7 @@ __decorate([
28127
29727
  serialize()
28128
29728
  ], exports.BinaryAsset.prototype, "buffer", void 0);
28129
29729
  exports.BinaryAsset = __decorate([
28130
- effectsClass("BinaryAsset")
29730
+ effectsClass(DataType.BinaryAsset)
28131
29731
  ], exports.BinaryAsset);
28132
29732
 
28133
29733
  registerPlugin("camera", CameraVFXItemLoader, exports.VFXItem, true);
@@ -28136,7 +29736,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
28136
29736
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
28137
29737
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
28138
29738
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
28139
- var version = "2.1.0-alpha.4";
29739
+ var version = "2.1.0-alpha.6";
28140
29740
  logger.info("Core version: " + version + ".");
28141
29741
 
28142
29742
  exports.AbstractPlugin = AbstractPlugin;
@@ -28315,9 +29915,6 @@ exports.isIOS = isIOS;
28315
29915
  exports.isIOSByUA = isIOSByUA;
28316
29916
  exports.isMiniProgram = isMiniProgram;
28317
29917
  exports.isObject = isObject;
28318
- exports.isSceneJSON = isSceneJSON;
28319
- exports.isSceneURL = isSceneURL;
28320
- exports.isSceneWithOptions = isSceneWithOptions;
28321
29918
  exports.isSimulatorCellPhone = isSimulatorCellPhone;
28322
29919
  exports.isString = isString;
28323
29920
  exports.isUniformStruct = isUniformStruct;