@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.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime core for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.1.0-alpha.4
6
+ * Version: v2.1.0-alpha.6
7
7
  */
8
8
 
9
9
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -3946,6 +3946,12 @@ Euler.tempMat0 = new Matrix4();
3946
3946
  /**
3947
3947
  * 节点元素
3948
3948
  */ ItemType["node"] = "node";
3949
+ /**
3950
+ * 视频元素
3951
+ */ ItemType["video"] = "video";
3952
+ /**
3953
+ * 音频元素
3954
+ */ ItemType["audio"] = "audio";
3949
3955
  })(ItemType || (ItemType = {}));
3950
3956
  /**
3951
3957
  * 渲染模式
@@ -4046,15 +4052,6 @@ var CameraClipMode;
4046
4052
  */ CameraClipMode[CameraClipMode["landscape"] = 0] = "landscape";
4047
4053
  })(CameraClipMode || (CameraClipMode = {}));
4048
4054
 
4049
- /**
4050
- * 动态换图类型
4051
- * @since 1.1.0
4052
- */ var BackgroundType;
4053
- (function(BackgroundType) {
4054
- BackgroundType["video"] = "video";
4055
- BackgroundType["image"] = "image";
4056
- })(BackgroundType || (BackgroundType = {}));
4057
-
4058
4055
  /*********************************************/ /* 基本数值属性参数 */ /*********************************************/ var ValueType;
4059
4056
  (function(ValueType) {
4060
4057
  /**
@@ -4360,6 +4357,8 @@ var DataType;
4360
4357
  DataType["TreeComponent"] = "TreeComponent";
4361
4358
  DataType["AnimationComponent"] = "AnimationComponent";
4362
4359
  DataType["SpineComponent"] = "SpineComponent";
4360
+ DataType["VideoComponent"] = "VideoComponent";
4361
+ DataType["AudioComponent"] = "AudioComponent";
4363
4362
  // Non-EffectObject
4364
4363
  DataType["TimelineClip"] = "TimelineClip";
4365
4364
  })(DataType || (DataType = {}));
@@ -4449,10 +4448,28 @@ var VertexBufferSemantic;
4449
4448
 
4450
4449
  var BuiltinObjectGUID = {
4451
4450
  WhiteTexture: "whitetexture00000000000000000000",
4451
+ TransparentTexture: "transparenttexture00000000000000000000",
4452
4452
  PBRShader: "pbr00000000000000000000000000000",
4453
4453
  UnlitShader: "unlit000000000000000000000000000"
4454
4454
  };
4455
4455
 
4456
+ /**
4457
+ * 动态换图类型
4458
+ * @since 1.1.0
4459
+ */ var BackgroundType;
4460
+ (function(BackgroundType) {
4461
+ BackgroundType["video"] = "video";
4462
+ BackgroundType["image"] = "image";
4463
+ })(BackgroundType || (BackgroundType = {}));
4464
+ /**
4465
+ * 多媒体资源类型
4466
+ * @since 2.1.0
4467
+ */ var MultimediaType;
4468
+ (function(MultimediaType) {
4469
+ MultimediaType["video"] = "video";
4470
+ MultimediaType["audio"] = "audio";
4471
+ })(MultimediaType || (MultimediaType = {}));
4472
+
4456
4473
  var index$1 = /*#__PURE__*/Object.freeze({
4457
4474
  __proto__: null,
4458
4475
  get RenderLevel () { return RenderLevel; },
@@ -4469,7 +4486,6 @@ var index$1 = /*#__PURE__*/Object.freeze({
4469
4486
  get RenderType () { return RenderType; },
4470
4487
  get RenderFace () { return RenderFace; },
4471
4488
  get CameraClipMode () { return CameraClipMode; },
4472
- get BackgroundType () { return BackgroundType; },
4473
4489
  END_BEHAVIOR_DESTROY: END_BEHAVIOR_DESTROY,
4474
4490
  END_BEHAVIOR_PAUSE: END_BEHAVIOR_PAUSE,
4475
4491
  END_BEHAVIOR_FORWARD: END_BEHAVIOR_FORWARD,
@@ -4503,7 +4519,9 @@ var index$1 = /*#__PURE__*/Object.freeze({
4503
4519
  get VertexFormatType () { return VertexFormatType; },
4504
4520
  get IndexFormatType () { return IndexFormatType; },
4505
4521
  get VertexBufferSemantic () { return VertexBufferSemantic; },
4506
- BuiltinObjectGUID: BuiltinObjectGUID
4522
+ BuiltinObjectGUID: BuiltinObjectGUID,
4523
+ get BackgroundType () { return BackgroundType; },
4524
+ get MultimediaType () { return MultimediaType; }
4507
4525
  });
4508
4526
 
4509
4527
  var decoratorInitialStore = new Map();
@@ -8166,11 +8184,11 @@ function _loadMedia() {
8166
8184
  return _loadMedia.apply(this, arguments);
8167
8185
  }
8168
8186
 
8169
- function deserializeMipmapTexture(textureOptions, bins, engine) {
8187
+ function deserializeMipmapTexture(textureOptions, bins, assets) {
8170
8188
  return _deserializeMipmapTexture.apply(this, arguments);
8171
8189
  }
8172
8190
  function _deserializeMipmapTexture() {
8173
- _deserializeMipmapTexture = _async_to_generator(function(textureOptions, bins, engine, files) {
8191
+ _deserializeMipmapTexture = _async_to_generator(function(textureOptions, bins, assets, files) {
8174
8192
  var mipmaps, target, jobs, loadedMipmaps, mipmaps1, target1, jobs1, loadedMipmaps1, bin;
8175
8193
  return __generator(this, function(_state) {
8176
8194
  switch(_state.label){
@@ -8186,9 +8204,8 @@ function _deserializeMipmapTexture() {
8186
8204
  // @ts-expect-error
8187
8205
  if (pointer.id) {
8188
8206
  // @ts-expect-error
8189
- var loadedImageAsset = engine.assetLoader.loadGUID(pointer.id);
8190
- // @ts-expect-error
8191
- return loadedImageAsset.data;
8207
+ var loadedImage = assets[pointer.id];
8208
+ return loadedImage;
8192
8209
  } else {
8193
8210
  return loadMipmapImage(pointer, bins);
8194
8211
  }
@@ -8425,7 +8442,7 @@ var sourceOptions = {
8425
8442
  };
8426
8443
  function generateWhiteTexture(engine) {
8427
8444
  return Texture.create(engine, _extends({
8428
- id: "whitetexture00000000000000000000",
8445
+ id: BuiltinObjectGUID.WhiteTexture,
8429
8446
  data: {
8430
8447
  width: 1,
8431
8448
  height: 1,
@@ -8441,7 +8458,7 @@ function generateWhiteTexture(engine) {
8441
8458
  }
8442
8459
  function generateTransparentTexture(engine) {
8443
8460
  return Texture.create(engine, _extends({
8444
- id: "transparenttexture00000000000000000000",
8461
+ id: BuiltinObjectGUID.TransparentTexture,
8445
8462
  data: {
8446
8463
  width: 1,
8447
8464
  height: 1,
@@ -10800,7 +10817,7 @@ var Shader = /*#__PURE__*/ function(EffectsObject) {
10800
10817
  return Shader;
10801
10818
  }(EffectsObject);
10802
10819
  Shader = __decorate([
10803
- effectsClass("Shader")
10820
+ effectsClass(DataType.Shader)
10804
10821
  ], Shader);
10805
10822
 
10806
10823
  var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
@@ -11587,7 +11604,7 @@ var valueDefine = "#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValu
11587
11604
 
11588
11605
  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.;}";
11589
11606
 
11590
- 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);}";
11607
+ 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);}";
11591
11608
 
11592
11609
  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);}";
11593
11610
 
@@ -12885,7 +12902,7 @@ var GPUCapability = /*#__PURE__*/ function() {
12885
12902
  shaderTextureLod: level2 || !!gl.getExtension("EXT_shader_texture_lod"),
12886
12903
  instanceDraw: level2 || !!gl.getExtension("ANGLE_instanced_arrays"),
12887
12904
  drawBuffers: level2 || !!this.drawBufferExtension,
12888
- asyncShaderCompile: !!gl.getExtension("KHR_parallel_shader_compile"),
12905
+ asyncShaderCompile: !!this.glAsyncCompileExt,
12889
12906
  intIndexElementBuffer: !!gl.getExtension("OES_element_index_uint"),
12890
12907
  standardDerivatives: level2 || !!gl.getExtension("OES_standard_derivatives"),
12891
12908
  readableDepthStencilTextures: level2 || !!depthTextureExtension,
@@ -15789,7 +15806,7 @@ function getGeometryTriangles(geometry, options) {
15789
15806
  */ function getGeometriesByShapeData(shape) {
15790
15807
  var geometries = [];
15791
15808
  // 该版本的单个形状数据可以包含多个形状,可以加个埋点,五福之后没有就可以下掉
15792
- if (shape.gs) {
15809
+ if ("gs" in shape) {
15793
15810
  shape.gs.forEach(function(gs) {
15794
15811
  geometries.push({
15795
15812
  p: [
@@ -15802,7 +15819,7 @@ function getGeometryTriangles(geometry, options) {
15802
15819
  ]
15803
15820
  });
15804
15821
  });
15805
- } else if (shape.g) {
15822
+ } else if ("g" in shape) {
15806
15823
  geometries.push({
15807
15824
  p: [
15808
15825
  ValueType.SHAPE_POINTS,
@@ -16801,6 +16818,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
16801
16818
  });
16802
16819
  this.frozen = false;
16803
16820
  this.ended = false;
16821
+ this.destroyed = false;
16804
16822
  };
16805
16823
  _proto.update = function update(delta) {
16806
16824
  var _this = this;
@@ -18111,7 +18129,9 @@ var ParticleMesh = /*#__PURE__*/ function() {
18111
18129
  aPos: new Float32Array(48),
18112
18130
  aRot: new Float32Array(32),
18113
18131
  aOffset: new Float32Array(16),
18114
- aTranslation: new Float32Array(12)
18132
+ aTranslation: new Float32Array(12),
18133
+ aLinearMove: new Float32Array(12),
18134
+ aRotation0: new Float32Array(36)
18115
18135
  };
18116
18136
  var useSprite = this.useSprite;
18117
18137
  if (useSprite) {
@@ -19087,7 +19107,7 @@ var TransformPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
19087
19107
  return TransformPlayableAsset;
19088
19108
  }(PlayableAsset);
19089
19109
  TransformPlayableAsset = __decorate([
19090
- effectsClass("TransformPlayableAsset")
19110
+ effectsClass(DataType.TransformPlayableAsset)
19091
19111
  ], TransformPlayableAsset);
19092
19112
  /**
19093
19113
  * @since 2.0.0
@@ -19118,7 +19138,7 @@ var ActivationPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
19118
19138
  return ActivationPlayableAsset;
19119
19139
  }(PlayableAsset);
19120
19140
  ActivationPlayableAsset = __decorate([
19121
- effectsClass("ActivationPlayableAsset")
19141
+ effectsClass(DataType.ActivationPlayableAsset)
19122
19142
  ], ActivationPlayableAsset);
19123
19143
  var AnimationClip = /*#__PURE__*/ function(EffectsObject) {
19124
19144
  _inherits(AnimationClip, EffectsObject);
@@ -19361,7 +19381,7 @@ __decorate([
19361
19381
  serialize()
19362
19382
  ], TrackAsset.prototype, "children", void 0);
19363
19383
  TrackAsset = __decorate([
19364
- effectsClass("TrackAsset")
19384
+ effectsClass(DataType.TrackAsset)
19365
19385
  ], TrackAsset);
19366
19386
  var TrackType;
19367
19387
  (function(TrackType) {
@@ -19456,7 +19476,7 @@ var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
19456
19476
  return ObjectBindingTrack;
19457
19477
  }(TrackAsset);
19458
19478
  ObjectBindingTrack = __decorate([
19459
- effectsClass("ObjectBindingTrack")
19479
+ effectsClass(DataType.ObjectBindingTrack)
19460
19480
  ], ObjectBindingTrack);
19461
19481
 
19462
19482
  var TransformTrack = /*#__PURE__*/ function(TrackAsset) {
@@ -19467,7 +19487,7 @@ var TransformTrack = /*#__PURE__*/ function(TrackAsset) {
19467
19487
  return TransformTrack;
19468
19488
  }(TrackAsset);
19469
19489
  TransformTrack = __decorate([
19470
- effectsClass("TransformTrack")
19490
+ effectsClass(DataType.TransformTrack)
19471
19491
  ], TransformTrack);
19472
19492
 
19473
19493
  var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
@@ -19528,7 +19548,7 @@ var ActivationTrack = /*#__PURE__*/ function(TrackAsset) {
19528
19548
  return ActivationTrack;
19529
19549
  }(TrackAsset);
19530
19550
  ActivationTrack = __decorate([
19531
- effectsClass("ActivationTrack")
19551
+ effectsClass(DataType.ActivationTrack)
19532
19552
  ], ActivationTrack);
19533
19553
 
19534
19554
  var SpriteColorTrack = /*#__PURE__*/ function(TrackAsset) {
@@ -19539,7 +19559,7 @@ var SpriteColorTrack = /*#__PURE__*/ function(TrackAsset) {
19539
19559
  return SpriteColorTrack;
19540
19560
  }(TrackAsset);
19541
19561
  SpriteColorTrack = __decorate([
19542
- effectsClass("SpriteColorTrack")
19562
+ effectsClass(DataType.SpriteColorTrack)
19543
19563
  ], SpriteColorTrack);
19544
19564
 
19545
19565
  var TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
@@ -19576,7 +19596,7 @@ __decorate([
19576
19596
  serialize()
19577
19597
  ], TimelineAsset.prototype, "tracks", void 0);
19578
19598
  TimelineAsset = __decorate([
19579
- effectsClass("TimelineAsset")
19599
+ effectsClass(DataType.TimelineAsset)
19580
19600
  ], TimelineAsset);
19581
19601
  var TimelinePlayable = /*#__PURE__*/ function(Playable) {
19582
19602
  _inherits(TimelinePlayable, Playable);
@@ -19941,7 +19961,7 @@ var SubCompositionTrack = /*#__PURE__*/ function(TrackAsset) {
19941
19961
  return SubCompositionTrack;
19942
19962
  }(TrackAsset);
19943
19963
  SubCompositionTrack = __decorate([
19944
- effectsClass("SubCompositionTrack")
19964
+ effectsClass(DataType.SubCompositionTrack)
19945
19965
  ], SubCompositionTrack);
19946
19966
 
19947
19967
  var SubCompositionClipPlayable = /*#__PURE__*/ function(Playable) {
@@ -19971,7 +19991,7 @@ var SubCompositionPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
19971
19991
  return SubCompositionPlayableAsset;
19972
19992
  }(PlayableAsset);
19973
19993
  SubCompositionPlayableAsset = __decorate([
19974
- effectsClass("SubCompositionPlayableAsset")
19994
+ effectsClass(DataType.SubCompositionPlayableAsset)
19975
19995
  ], SubCompositionPlayableAsset);
19976
19996
 
19977
19997
  function _possible_constructor_return(self, call) {
@@ -20791,6 +20811,1652 @@ PostProcessVolume = __decorate([
20791
20811
  effectsClass("PostProcessVolume")
20792
20812
  ], PostProcessVolume);
20793
20813
 
20814
+ /**
20815
+ * A class to define a shape via user defined coordinates.
20816
+ */ var Polygon = /*#__PURE__*/ function() {
20817
+ function Polygon() {
20818
+ for(var _len = arguments.length, points = new Array(_len), _key = 0; _key < _len; _key++){
20819
+ points[_key] = arguments[_key];
20820
+ }
20821
+ /** An array of the points of this polygon. */ this.points = [];
20822
+ /** `false` after moveTo, `true` after `closePath`. In all other cases it is `true`. */ this.closePath = false;
20823
+ var flat = Array.isArray(points[0]) ? points[0] : points;
20824
+ // if this is an array of points, convert it to a flat array of numbers
20825
+ if (typeof flat[0] !== "number") {
20826
+ var p = [];
20827
+ for(var i = 0, il = flat.length; i < il; i++){
20828
+ p.push(flat[i].x, flat[i].y);
20829
+ }
20830
+ flat = p;
20831
+ }
20832
+ this.points = flat;
20833
+ this.closePath = true;
20834
+ }
20835
+ var _proto = Polygon.prototype;
20836
+ /**
20837
+ * Creates a clone of this polygon.
20838
+ * @returns - A copy of the polygon.
20839
+ */ _proto.clone = function clone() {
20840
+ var points = this.points.slice();
20841
+ var polygon = new Polygon(points);
20842
+ polygon.closePath = this.closePath;
20843
+ return polygon;
20844
+ };
20845
+ /**
20846
+ * Checks whether the x and y coordinates passed to this function are contained within this polygon.
20847
+ * @param x - The X coordinate of the point to test.
20848
+ * @param y - The Y coordinate of the point to test.
20849
+ * @returns - Whether the x/y coordinates are within this polygon.
20850
+ */ _proto.contains = function contains(x, y) {
20851
+ var inside = false;
20852
+ // use some raycasting to test hits
20853
+ // https://github.com/substack/point-in-polygon/blob/master/index.js
20854
+ var length = this.points.length / 2;
20855
+ for(var i = 0, j = length - 1; i < length; j = i++){
20856
+ var xi = this.points[i * 2];
20857
+ var yi = this.points[i * 2 + 1];
20858
+ var xj = this.points[j * 2];
20859
+ var yj = this.points[j * 2 + 1];
20860
+ var intersect = yi > y !== yj > y && x < (xj - xi) * ((y - yi) / (yj - yi)) + xi;
20861
+ if (intersect) {
20862
+ inside = !inside;
20863
+ }
20864
+ }
20865
+ return inside;
20866
+ };
20867
+ /**
20868
+ * Copies another polygon to this one.
20869
+ * @param polygon - The polygon to copy from.
20870
+ * @returns Returns itself.
20871
+ */ _proto.copyFrom = function copyFrom(polygon) {
20872
+ this.points = polygon.points.slice();
20873
+ this.closePath = polygon.closePath;
20874
+ return this;
20875
+ };
20876
+ /**
20877
+ * Copies this polygon to another one.
20878
+ * @param polygon - The polygon to copy to.
20879
+ * @returns Returns given parameter.
20880
+ */ _proto.copyTo = function copyTo(polygon) {
20881
+ polygon.copyFrom(this);
20882
+ return polygon;
20883
+ };
20884
+ _create_class(Polygon, [
20885
+ {
20886
+ key: "lastX",
20887
+ get: /**
20888
+ * Get the last X coordinate of the polygon
20889
+ * @readonly
20890
+ */ function get() {
20891
+ return this.points[this.points.length - 2];
20892
+ }
20893
+ },
20894
+ {
20895
+ key: "lastY",
20896
+ get: /**
20897
+ * Get the last Y coordinate of the polygon
20898
+ * @readonly
20899
+ */ function get() {
20900
+ return this.points[this.points.length - 1];
20901
+ }
20902
+ },
20903
+ {
20904
+ key: "x",
20905
+ get: /**
20906
+ * Get the first X coordinate of the polygon
20907
+ * @readonly
20908
+ */ function get() {
20909
+ return this.points[this.points.length - 2];
20910
+ }
20911
+ },
20912
+ {
20913
+ key: "y",
20914
+ get: /**
20915
+ * Get the first Y coordinate of the polygon
20916
+ * @readonly
20917
+ */ function get() {
20918
+ return this.points[this.points.length - 1];
20919
+ }
20920
+ }
20921
+ ]);
20922
+ return Polygon;
20923
+ }();
20924
+
20925
+ // thanks to https://github.com/mattdesl/adaptive-bezier-curve
20926
+ // for the original code!
20927
+ var RECURSION_LIMIT = 8;
20928
+ var FLT_EPSILON = 1.19209290e-7;
20929
+ var PATH_DISTANCE_EPSILON = 1.0;
20930
+ var defaultBezierSmoothness = 0.5;
20931
+ function buildAdaptiveBezier(points, sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, smoothness) {
20932
+ // TODO expose as a parameter
20933
+ var scale = 5;
20934
+ var smoothing = Math.min(0.99, Math.max(0, smoothness != null ? smoothness : defaultBezierSmoothness));
20935
+ var distanceTolerance = (PATH_DISTANCE_EPSILON - smoothing) / scale;
20936
+ distanceTolerance *= distanceTolerance;
20937
+ begin(sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, points, distanceTolerance);
20938
+ return points;
20939
+ }
20940
+ //// Based on:
20941
+ //// https://github.com/pelson/antigrain/blob/master/agg-2.4/src/agg_curves.cpp
20942
+ function begin(sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, points, distanceTolerance) {
20943
+ // dont need to actually ad this!
20944
+ // points.push(sX, sY);
20945
+ recursive(sX, sY, cp1x, cp1y, cp2x, cp2y, eX, eY, points, distanceTolerance, 0);
20946
+ points.push(eX, eY);
20947
+ }
20948
+ // eslint-disable-next-line max-params
20949
+ function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, level) {
20950
+ if (level > RECURSION_LIMIT) {
20951
+ return;
20952
+ }
20953
+ // Calculate all the mid-points of the line segments
20954
+ // ----------------------
20955
+ var x12 = (x1 + x2) / 2;
20956
+ var y12 = (y1 + y2) / 2;
20957
+ var x23 = (x2 + x3) / 2;
20958
+ var y23 = (y2 + y3) / 2;
20959
+ var x34 = (x3 + x4) / 2;
20960
+ var y34 = (y3 + y4) / 2;
20961
+ var x123 = (x12 + x23) / 2;
20962
+ var y123 = (y12 + y23) / 2;
20963
+ var x234 = (x23 + x34) / 2;
20964
+ var y234 = (y23 + y34) / 2;
20965
+ var x1234 = (x123 + x234) / 2;
20966
+ var y1234 = (y123 + y234) / 2;
20967
+ if (level > 0) {
20968
+ // Try to approximate the full cubic curve by a single straight line
20969
+ // ------------------
20970
+ var dx = x4 - x1;
20971
+ var dy = y4 - y1;
20972
+ var d2 = Math.abs((x2 - x4) * dy - (y2 - y4) * dx);
20973
+ var d3 = Math.abs((x3 - x4) * dy - (y3 - y4) * dx);
20974
+ if (d2 > FLT_EPSILON && d3 > FLT_EPSILON) {
20975
+ // Regular care
20976
+ // -----------------
20977
+ if ((d2 + d3) * (d2 + d3) <= distanceTolerance * (dx * dx + dy * dy)) {
20978
+ // If the curvature doesn't exceed the distanceTolerance value
20979
+ // we tend to finish subdivisions.
20980
+ // ----------------------
20981
+ {
20982
+ points.push(x1234, y1234);
20983
+ return;
20984
+ }
20985
+ }
20986
+ } else if (d2 > FLT_EPSILON) {
20987
+ // p1,p3,p4 are collinear, p2 is considerable
20988
+ // ----------------------
20989
+ if (d2 * d2 <= distanceTolerance * (dx * dx + dy * dy)) {
20990
+ {
20991
+ points.push(x1234, y1234);
20992
+ return;
20993
+ }
20994
+ }
20995
+ } else if (d3 > FLT_EPSILON) {
20996
+ // p1,p2,p4 are collinear, p3 is considerable
20997
+ // ----------------------
20998
+ if (d3 * d3 <= distanceTolerance * (dx * dx + dy * dy)) {
20999
+ {
21000
+ points.push(x1234, y1234);
21001
+ return;
21002
+ }
21003
+ }
21004
+ } else {
21005
+ // Collinear case
21006
+ // -----------------
21007
+ dx = x1234 - (x1 + x4) / 2;
21008
+ dy = y1234 - (y1 + y4) / 2;
21009
+ if (dx * dx + dy * dy <= distanceTolerance) {
21010
+ points.push(x1234, y1234);
21011
+ return;
21012
+ }
21013
+ }
21014
+ }
21015
+ // Continue subdivision
21016
+ // ----------------------
21017
+ recursive(x1, y1, x12, y12, x123, y123, x1234, y1234, points, distanceTolerance, level + 1);
21018
+ recursive(x1234, y1234, x234, y234, x34, y34, x4, y4, points, distanceTolerance, level + 1);
21019
+ }
21020
+
21021
+ var ShapePath = /*#__PURE__*/ function() {
21022
+ function ShapePath(graphicsPath) {
21023
+ this.graphicsPath = graphicsPath;
21024
+ this.currentPoly = null;
21025
+ this.shapePrimitives = [];
21026
+ }
21027
+ var _proto = ShapePath.prototype;
21028
+ /** Builds the path. */ _proto.buildPath = function buildPath() {
21029
+ this.currentPoly = null;
21030
+ this.shapePrimitives.length = 0;
21031
+ var path = this.graphicsPath;
21032
+ for(var _iterator = _create_for_of_iterator_helper_loose(path.instructions), _step; !(_step = _iterator()).done;){
21033
+ var instruction = _step.value;
21034
+ var action = instruction.action;
21035
+ var data = instruction.data;
21036
+ switch(action){
21037
+ case "bezierCurveTo":
21038
+ {
21039
+ this.bezierCurveTo(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
21040
+ break;
21041
+ }
21042
+ case "moveTo":
21043
+ {
21044
+ this.moveTo(data[0], data[1]);
21045
+ break;
21046
+ }
21047
+ }
21048
+ }
21049
+ this.endPoly();
21050
+ };
21051
+ /**
21052
+ * Adds a cubic Bezier curve to the path.
21053
+ * It requires three points: the first two are control points and the third one is the end point.
21054
+ * The starting point is the last point in the current path.
21055
+ * @param cp1x - The x-coordinate of the first control point.
21056
+ * @param cp1y - The y-coordinate of the first control point.
21057
+ * @param cp2x - The x-coordinate of the second control point.
21058
+ * @param cp2y - The y-coordinate of the second control point.
21059
+ * @param x - The x-coordinate of the end point.
21060
+ * @param y - The y-coordinate of the end point.
21061
+ * @param smoothness - Optional parameter to adjust the smoothness of the curve.
21062
+ * @returns The instance of the current object for chaining.
21063
+ */ _proto.bezierCurveTo = function bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness) {
21064
+ this.ensurePoly();
21065
+ var currentPoly = this.currentPoly;
21066
+ buildAdaptiveBezier(currentPoly.points, currentPoly.lastX, currentPoly.lastY, cp1x, cp1y, cp2x, cp2y, x, y, smoothness);
21067
+ return this;
21068
+ };
21069
+ _proto.moveTo = function moveTo(x, y) {
21070
+ this.startPoly(x, y);
21071
+ return this;
21072
+ };
21073
+ /**
21074
+ * Starts a new polygon path from the specified starting point.
21075
+ * This method initializes a new polygon or ends the current one if it exists.
21076
+ * @param x - The x-coordinate of the starting point of the new polygon.
21077
+ * @param y - The y-coordinate of the starting point of the new polygon.
21078
+ * @returns The instance of the current object for chaining.
21079
+ */ _proto.startPoly = function startPoly(x, y) {
21080
+ var currentPoly = this.currentPoly;
21081
+ if (currentPoly) {
21082
+ this.endPoly();
21083
+ }
21084
+ currentPoly = new Polygon();
21085
+ currentPoly.points.push(x, y);
21086
+ this.currentPoly = currentPoly;
21087
+ return this;
21088
+ };
21089
+ /**
21090
+ * Ends the current polygon path. If `closePath` is set to true,
21091
+ * the path is closed by connecting the last point to the first one.
21092
+ * This method finalizes the current polygon and prepares it for drawing or adding to the shape primitives.
21093
+ * @param closePath - A boolean indicating whether to close the polygon by connecting the last point
21094
+ * back to the starting point. False by default.
21095
+ * @returns The instance of the current object for chaining.
21096
+ */ _proto.endPoly = function endPoly(closePath) {
21097
+ if (closePath === void 0) closePath = false;
21098
+ var shape = this.currentPoly;
21099
+ if (shape && shape.points.length > 2) {
21100
+ shape.closePath = closePath;
21101
+ this.shapePrimitives.push({
21102
+ shape: shape
21103
+ });
21104
+ }
21105
+ this.currentPoly = null;
21106
+ return this;
21107
+ };
21108
+ _proto.ensurePoly = function ensurePoly(start) {
21109
+ if (this.currentPoly) {
21110
+ return;
21111
+ }
21112
+ this.currentPoly = new Polygon();
21113
+ this.currentPoly.points.push(0, 0);
21114
+ };
21115
+ return ShapePath;
21116
+ }();
21117
+
21118
+ var GraphicsPath = /*#__PURE__*/ function() {
21119
+ function GraphicsPath() {
21120
+ this.instructions = [];
21121
+ this.dirty = false;
21122
+ }
21123
+ var _proto = GraphicsPath.prototype;
21124
+ /**
21125
+ * Adds a cubic Bezier curve to the path.
21126
+ * It requires three points: the first two are control points and the third one is the end point.
21127
+ * The starting point is the last point in the current path.
21128
+ * @param cp1x - The x-coordinate of the first control point.
21129
+ * @param cp1y - The y-coordinate of the first control point.
21130
+ * @param cp2x - The x-coordinate of the second control point.
21131
+ * @param cp2y - The y-coordinate of the second control point.
21132
+ * @param x - The x-coordinate of the end point.
21133
+ * @param y - The y-coordinate of the end point.
21134
+ * @param smoothness - Optional parameter to adjust the smoothness of the curve.
21135
+ * @returns The instance of the current object for chaining.
21136
+ */ _proto.bezierCurveTo = function bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness) {
21137
+ this.instructions.push({
21138
+ action: "bezierCurveTo",
21139
+ data: [
21140
+ cp1x,
21141
+ cp1y,
21142
+ cp2x,
21143
+ cp2y,
21144
+ x,
21145
+ y,
21146
+ smoothness
21147
+ ]
21148
+ });
21149
+ this.dirty = true;
21150
+ return this;
21151
+ };
21152
+ _proto.moveTo = function moveTo(x, y) {
21153
+ this.instructions.push({
21154
+ action: "moveTo",
21155
+ data: [
21156
+ x,
21157
+ y
21158
+ ]
21159
+ });
21160
+ this.dirty = true;
21161
+ return this;
21162
+ };
21163
+ _proto.clear = function clear() {
21164
+ this.instructions.length = 0;
21165
+ this.dirty = true;
21166
+ return this;
21167
+ };
21168
+ _create_class(GraphicsPath, [
21169
+ {
21170
+ key: "shapePath",
21171
+ get: /**
21172
+ * Provides access to the internal shape path, ensuring it is up-to-date with the current instructions.
21173
+ * @returns The `ShapePath` instance associated with this `GraphicsPath`.
21174
+ */ function get() {
21175
+ if (!this._shapePath) {
21176
+ this._shapePath = new ShapePath(this);
21177
+ }
21178
+ if (this.dirty) {
21179
+ this.dirty = false;
21180
+ this._shapePath.buildPath();
21181
+ }
21182
+ return this._shapePath;
21183
+ }
21184
+ }
21185
+ ]);
21186
+ return GraphicsPath;
21187
+ }();
21188
+
21189
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
21190
+
21191
+ var libtess_min = {exports: {}};
21192
+
21193
+ /*
21194
+
21195
+ Copyright 2000, Silicon Graphics, Inc. All Rights Reserved.
21196
+ Copyright 2015, Google Inc. All Rights Reserved.
21197
+
21198
+ Permission is hereby granted, free of charge, to any person obtaining a copy
21199
+ of this software and associated documentation files (the "Software"), to
21200
+ deal in the Software without restriction, including without limitation the
21201
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
21202
+ sell copies of the Software, and to permit persons to whom the Software is
21203
+ furnished to do so, subject to the following conditions:
21204
+
21205
+ The above copyright notice including the dates of first publication and
21206
+ either this permission notice or a reference to http://oss.sgi.com/projects/FreeB/
21207
+ shall be included in all copies or substantial portions of the Software.
21208
+
21209
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21210
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21211
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21212
+ SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21213
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
21214
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21215
+
21216
+ Original Code. The Original Code is: OpenGL Sample Implementation,
21217
+ Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
21218
+ Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
21219
+ Copyright in any portions created by third parties is as indicated
21220
+ elsewhere herein. All Rights Reserved.
21221
+ */
21222
+
21223
+ (function (module) {
21224
+ var n;
21225
+ function t(a, b) {
21226
+ return a.b === b.b && a.a === b.a;
21227
+ }
21228
+ function u(a, b) {
21229
+ return a.b < b.b || a.b === b.b && a.a <= b.a;
21230
+ }
21231
+ function v(a, b, c) {
21232
+ var d = b.b - a.b, e = c.b - b.b;
21233
+ 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;
21234
+ }
21235
+ function x(a, b, c) {
21236
+ var d = b.b - a.b, e = c.b - b.b;
21237
+ return 0 < d + e ? (b.a - c.a) * d + (b.a - a.a) * e : 0;
21238
+ }
21239
+ function z(a, b) {
21240
+ return a.a < b.a || a.a === b.a && a.b <= b.b;
21241
+ }
21242
+ function aa(a, b, c) {
21243
+ var d = b.a - a.a, e = c.a - b.a;
21244
+ 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;
21245
+ }
21246
+ function ba(a, b, c) {
21247
+ var d = b.a - a.a, e = c.a - b.a;
21248
+ return 0 < d + e ? (b.b - c.b) * d + (b.b - a.b) * e : 0;
21249
+ }
21250
+ function ca(a) {
21251
+ return u(a.b.a, a.a);
21252
+ }
21253
+ function da(a) {
21254
+ return u(a.a, a.b.a);
21255
+ }
21256
+ function A(a, b, c, d) {
21257
+ a = 0 > a ? 0 : a;
21258
+ c = 0 > c ? 0 : c;
21259
+ return a <= c ? 0 === c ? (b + d) / 2 : b + a / (a + c) * (d - b) : d + c / (a + c) * (b - d);
21260
+ }
21261
+ function ea(a) {
21262
+ var b = B(a.b);
21263
+ C(b, a.c);
21264
+ C(b.b, a.c);
21265
+ D(b, a.a);
21266
+ return b;
21267
+ }
21268
+ function E(a, b) {
21269
+ var c = !1, d = !1;
21270
+ 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));
21271
+ }
21272
+ function I(a) {
21273
+ var b = a.b, c = !1;
21274
+ a.d !== a.b.d && (c = !0, G(a.d, a.b.d));
21275
+ 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));
21276
+ 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)));
21277
+ fa(a);
21278
+ }
21279
+ function K(a) {
21280
+ var b = B(a), c = b.b;
21281
+ H(b, a.e);
21282
+ b.a = a.b.a;
21283
+ C(c, b.a);
21284
+ b.d = c.d = a.d;
21285
+ b = b.b;
21286
+ H(a.b, J(a.b));
21287
+ H(a.b, b);
21288
+ a.b.a = b.a;
21289
+ b.b.a.c = b.b;
21290
+ b.b.d = a.b.d;
21291
+ b.f = a.f;
21292
+ b.b.f = a.b.f;
21293
+ return b;
21294
+ }
21295
+ function L(a, b) {
21296
+ var c = !1, d = B(a), e = d.b;
21297
+ b.d !== a.d && (c = !0, G(b.d, a.d));
21298
+ H(d, a.e);
21299
+ H(e, b);
21300
+ d.a = a.b.a;
21301
+ e.a = b.a;
21302
+ d.d = e.d = a.d;
21303
+ a.d.a = e;
21304
+ c || D(d, a.d);
21305
+ return d;
21306
+ }
21307
+ function B(a) {
21308
+ var b = new M, c = new M, d = a.b.h;
21309
+ c.h = d;
21310
+ d.b.h = b;
21311
+ b.h = a;
21312
+ a.b.h = c;
21313
+ b.b = c;
21314
+ b.c = b;
21315
+ b.e = c;
21316
+ c.b = b;
21317
+ c.c = c;
21318
+ return c.e = b;
21319
+ }
21320
+ function H(a, b) {
21321
+ var c = a.c, d = b.c;
21322
+ c.b.e = b;
21323
+ d.b.e = a;
21324
+ a.c = d;
21325
+ b.c = c;
21326
+ }
21327
+ function C(a, b) {
21328
+ var c = b.f, d = new N(b, c);
21329
+ c.e = d;
21330
+ b.f = d;
21331
+ c = d.c = a;
21332
+ do c.a = d, c = c.c;
21333
+ while (c !== a);
21334
+ }
21335
+ function D(a, b) {
21336
+ var c = b.d, d = new ga(b, c);
21337
+ c.b = d;
21338
+ b.d = d;
21339
+ d.a = a;
21340
+ d.c = b.c;
21341
+ c = a;
21342
+ do c.d = d, c = c.e;
21343
+ while (c !== a);
21344
+ }
21345
+ function fa(a) {
21346
+ var b = a.h;
21347
+ a = a.b.h;
21348
+ b.b.h = a;
21349
+ a.b.h = b;
21350
+ }
21351
+ function F(a, b) {
21352
+ var c = a.c, d = c;
21353
+ do d.a = b, d = d.c;
21354
+ while (d !== c);
21355
+ c = a.f;
21356
+ d = a.e;
21357
+ d.f = c;
21358
+ c.e = d;
21359
+ }
21360
+ function G(a, b) {
21361
+ var c = a.a, d = c;
21362
+ do d.d = b, d = d.e;
21363
+ while (d !== c);
21364
+ c = a.d;
21365
+ d = a.b;
21366
+ d.d = c;
21367
+ c.b = d;
21368
+ }
21369
+ function ha(a) {
21370
+ var b = 0;
21371
+ Math.abs(a[1]) > Math.abs(a[0]) && (b = 1);
21372
+ Math.abs(a[2]) > Math.abs(a[b]) && (b = 2);
21373
+ return b;
21374
+ }
21375
+ var O = 4 * 1E150;
21376
+ function P(a, b) {
21377
+ a.f += b.f;
21378
+ a.b.f += b.b.f;
21379
+ }
21380
+ function ia(a, b, c) {
21381
+ a = a.a;
21382
+ b = b.a;
21383
+ c = c.a;
21384
+ 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);
21385
+ if (c.b.a === a) return 0 <= x(b.b.a, a, b.a);
21386
+ b = v(b.b.a, a, b.a);
21387
+ a = v(c.b.a, a, c.a);
21388
+ return b >= a;
21389
+ }
21390
+ function Q(a) {
21391
+ a.a.i = null;
21392
+ var b = a.e;
21393
+ b.a.c = b.c;
21394
+ b.c.a = b.a;
21395
+ a.e = null;
21396
+ }
21397
+ function ja(a, b) {
21398
+ I(a.a);
21399
+ a.c = !1;
21400
+ a.a = b;
21401
+ b.i = a;
21402
+ }
21403
+ function ka(a) {
21404
+ var b = a.a.a;
21405
+ do a = R(a);
21406
+ while (a.a.a === b);
21407
+ a.c && (b = L(S(a).a.b, a.a.e), ja(a, b), a = R(a));
21408
+ return a;
21409
+ }
21410
+ function la(a, b, c) {
21411
+ var d = new ma;
21412
+ d.a = c;
21413
+ d.e = na(a.f, b.e, d);
21414
+ return c.i = d;
21415
+ }
21416
+ function oa(a, b) {
21417
+ switch(a.s){
21418
+ case 100130:
21419
+ return 0 !== (b & 1);
21420
+ case 100131:
21421
+ return 0 !== b;
21422
+ case 100132:
21423
+ return 0 < b;
21424
+ case 100133:
21425
+ return 0 > b;
21426
+ case 100134:
21427
+ return 2 <= b || -2 >= b;
21428
+ }
21429
+ return !1;
21430
+ }
21431
+ function pa(a) {
21432
+ var b = a.a, c = b.d;
21433
+ c.c = a.d;
21434
+ c.a = b;
21435
+ Q(a);
21436
+ }
21437
+ function T(a, b, c) {
21438
+ a = b;
21439
+ for(b = b.a; a !== c;){
21440
+ a.c = !1;
21441
+ var d = S(a), e = d.a;
21442
+ if (e.a !== b.a) {
21443
+ if (!d.c) {
21444
+ pa(a);
21445
+ break;
21446
+ }
21447
+ e = L(b.c.b, e.b);
21448
+ ja(d, e);
21449
+ }
21450
+ b.c !== e && (E(J(e), e), E(b, e));
21451
+ pa(a);
21452
+ b = d.a;
21453
+ a = d;
21454
+ }
21455
+ return b;
21456
+ }
21457
+ function U(a, b, c, d, e, f) {
21458
+ var g = !0;
21459
+ do la(a, b, c.b), c = c.c;
21460
+ while (c !== d);
21461
+ for(null === e && (e = S(b).a.b.c);;){
21462
+ d = S(b);
21463
+ c = d.a.b;
21464
+ if (c.a !== e.a) break;
21465
+ c.c !== e && (E(J(c), c), E(J(e), c));
21466
+ d.f = b.f - c.f;
21467
+ d.d = oa(a, d.f);
21468
+ b.b = !0;
21469
+ !g && qa(a, b) && (P(c, e), Q(b), I(e));
21470
+ g = !1;
21471
+ b = d;
21472
+ e = c;
21473
+ }
21474
+ b.b = !0;
21475
+ f && ra(a, b);
21476
+ }
21477
+ function sa(a, b, c, d, e) {
21478
+ var f = [
21479
+ b.g[0],
21480
+ b.g[1],
21481
+ b.g[2]
21482
+ ];
21483
+ b.d = null;
21484
+ b.d = a.o ? a.o(f, c, d, a.c) || null : null;
21485
+ null === b.d && (e ? a.n || (V(a, 100156), a.n = !0) : b.d = c[0]);
21486
+ }
21487
+ function ta(a, b, c) {
21488
+ var d = [
21489
+ null,
21490
+ null,
21491
+ null,
21492
+ null
21493
+ ];
21494
+ d[0] = b.a.d;
21495
+ d[1] = c.a.d;
21496
+ sa(a, b.a, d, [
21497
+ .5,
21498
+ .5,
21499
+ 0,
21500
+ 0
21501
+ ], !1);
21502
+ E(b, c);
21503
+ }
21504
+ function ua(a, b, c, d, e) {
21505
+ 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;
21506
+ d[e] = .5 * g / (f + g);
21507
+ d[h] = .5 * f / (f + g);
21508
+ a.g[0] += d[e] * b.g[0] + d[h] * c.g[0];
21509
+ a.g[1] += d[e] * b.g[1] + d[h] * c.g[1];
21510
+ a.g[2] += d[e] * b.g[2] + d[h] * c.g[2];
21511
+ }
21512
+ function qa(a, b) {
21513
+ var c = S(b), d = b.a, e = c.a;
21514
+ if (u(d.a, e.a)) {
21515
+ if (0 < x(e.b.a, d.a, e.a)) return !1;
21516
+ if (!t(d.a, e.a)) K(e.b), E(d, J(e)), b.b = c.b = !0;
21517
+ else if (d.a !== e.a) {
21518
+ var c = a.e, f = d.a.h;
21519
+ if (0 <= f) {
21520
+ var c = c.b, g = c.d, h = c.e, k = c.c, l = k[f];
21521
+ g[l] = g[c.a];
21522
+ k[g[l]] = l;
21523
+ l <= --c.a && (1 >= l ? W(c, l) : u(h[g[l >> 1]], h[g[l]]) ? W(c, l) : va(c, l));
21524
+ h[f] = null;
21525
+ k[f] = c.b;
21526
+ c.b = f;
21527
+ } else for(c.c[-(f + 1)] = null; 0 < c.a && null === c.c[c.d[c.a - 1]];)--c.a;
21528
+ ta(a, J(e), d);
21529
+ }
21530
+ } else {
21531
+ if (0 > x(d.b.a, e.a, d.a)) return !1;
21532
+ R(b).b = b.b = !0;
21533
+ K(d.b);
21534
+ E(J(e), d);
21535
+ }
21536
+ return !0;
21537
+ }
21538
+ function wa(a, b) {
21539
+ 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;
21540
+ x(h, a.a, f);
21541
+ x(k, a.a, g);
21542
+ if (f === g || Math.min(f.a, h.a) > Math.max(g.a, k.a)) return !1;
21543
+ if (u(f, g)) {
21544
+ if (0 < x(k, f, g)) return !1;
21545
+ } else if (0 > x(h, g, f)) return !1;
21546
+ var r = h, p = f, q = k, y = g, m, w;
21547
+ u(r, p) || (m = r, r = p, p = m);
21548
+ u(q, y) || (m = q, q = y, y = m);
21549
+ u(r, q) || (m = r, r = q, q = m, m = p, p = y, y = m);
21550
+ 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;
21551
+ z(r, p) || (m = r, r = p, p = m);
21552
+ z(q, y) || (m = q, q = y, y = m);
21553
+ z(r, q) || (m = r, r = q, q = m, m = p, p = y, y = m);
21554
+ 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;
21555
+ u(l, a.a) && (l.b = a.a.b, l.a = a.a.a);
21556
+ r = u(f, g) ? f : g;
21557
+ u(r, l) && (l.b = r.b, l.a = r.a);
21558
+ if (t(l, f) || t(l, g)) return qa(a, b), !1;
21559
+ if (!t(h, a.a) && 0 <= x(h, a.a, l) || !t(k, a.a) && 0 >= x(k, a.a, l)) {
21560
+ 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;
21561
+ if (h === a.a) {
21562
+ K(e.b);
21563
+ E(d.e, J(e));
21564
+ f = c = b;
21565
+ g = f.a.b.a;
21566
+ do f = R(f);
21567
+ while (f.a.b.a === g);
21568
+ b = f;
21569
+ f = S(b).a.b.c;
21570
+ c.a = J(e);
21571
+ e = T(a, c, null);
21572
+ U(a, b, e.c, d.b.c, f, !0);
21573
+ return !0;
21574
+ }
21575
+ 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);
21576
+ 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);
21577
+ return !1;
21578
+ }
21579
+ K(d.b);
21580
+ K(e.b);
21581
+ E(J(e), d);
21582
+ d.a.b = l.b;
21583
+ d.a.a = l.a;
21584
+ d.a.h = xa(a.e, d.a);
21585
+ d = d.a;
21586
+ e = [
21587
+ 0,
21588
+ 0,
21589
+ 0,
21590
+ 0
21591
+ ];
21592
+ l = [
21593
+ f.d,
21594
+ h.d,
21595
+ g.d,
21596
+ k.d
21597
+ ];
21598
+ d.g[0] = d.g[1] = d.g[2] = 0;
21599
+ ua(d, f, h, e, 0);
21600
+ ua(d, g, k, e, 2);
21601
+ sa(a, d, l, e, !0);
21602
+ R(b).b = b.b = c.b = !0;
21603
+ return !1;
21604
+ }
21605
+ function ra(a, b) {
21606
+ for(var c = S(b);;){
21607
+ for(; c.b;)b = c, c = S(c);
21608
+ if (!b.b && (c = b, b = R(b), null === b || !b.b)) break;
21609
+ b.b = !1;
21610
+ var d = b.a, e = c.a, f;
21611
+ if (f = d.b.a !== e.b.a) a: {
21612
+ f = b;
21613
+ var g = S(f), h = f.a, k = g.a, l = void 0;
21614
+ if (u(h.b.a, k.b.a)) {
21615
+ if (0 > x(h.b.a, k.b.a, h.a)) {
21616
+ f = !1;
21617
+ break a;
21618
+ }
21619
+ R(f).b = f.b = !0;
21620
+ l = K(h);
21621
+ E(k.b, l);
21622
+ l.d.c = f.d;
21623
+ } else {
21624
+ if (0 < x(k.b.a, h.b.a, k.a)) {
21625
+ f = !1;
21626
+ break a;
21627
+ }
21628
+ f.b = g.b = !0;
21629
+ l = K(k);
21630
+ E(h.e, k.b);
21631
+ l.b.d.c = f.d;
21632
+ }
21633
+ f = !0;
21634
+ }
21635
+ 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));
21636
+ if (d.a !== e.a) {
21637
+ if (d.b.a === e.b.a || b.c || c.c || d.b.a !== a.a && e.b.a !== a.a) qa(a, b);
21638
+ else if (wa(a, b)) break;
21639
+ }
21640
+ d.a === e.a && d.b.a === e.b.a && (P(e, d), Q(b), I(d), b = R(c));
21641
+ }
21642
+ }
21643
+ function ya(a, b) {
21644
+ a.a = b;
21645
+ for(var c = b.c; null === c.i;)if (c = c.c, c === b.c) {
21646
+ var c = a, d = b, e = new ma;
21647
+ e.a = d.c.b;
21648
+ var f = c.f, g = f.a;
21649
+ do g = g.a;
21650
+ while (null !== g.b && !f.c(f.b, e, g.b));
21651
+ var f = g.b, h = S(f), e = f.a, g = h.a;
21652
+ 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));
21653
+ else {
21654
+ var k = u(g.b.a, e.b.a) ? f : h, h = void 0;
21655
+ 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);
21656
+ }
21657
+ return;
21658
+ }
21659
+ c = ka(c.i);
21660
+ e = S(c);
21661
+ f = e.a;
21662
+ e = T(a, e, null);
21663
+ if (e.c === f) {
21664
+ var f = e, e = f.c, g = S(c), h = c.a, k = g.a, l = !1;
21665
+ h.b.a !== k.b.a && wa(a, c);
21666
+ t(h.a, a.a) && (E(J(e), h), c = ka(c), e = S(c).a, T(a, S(c), g), l = !0);
21667
+ t(k.a, a.a) && (E(f, J(k)), f = T(a, g, null), l = !0);
21668
+ 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));
21669
+ } else U(a, c, e.c, f, f, !0);
21670
+ }
21671
+ function za(a, b) {
21672
+ var c = new ma, d = ea(a.b);
21673
+ d.a.b = O;
21674
+ d.a.a = b;
21675
+ d.b.a.b = -O;
21676
+ d.b.a.a = b;
21677
+ a.a = d.b.a;
21678
+ c.a = d;
21679
+ c.f = 0;
21680
+ c.d = !1;
21681
+ c.c = !1;
21682
+ c.h = !0;
21683
+ c.b = !1;
21684
+ d = a.f;
21685
+ d = na(d, d.a, c);
21686
+ c.e = d;
21687
+ }
21688
+ function Aa(a) {
21689
+ this.a = new Ba;
21690
+ this.b = a;
21691
+ this.c = ia;
21692
+ }
21693
+ function na(a, b, c) {
21694
+ do b = b.c;
21695
+ while (null !== b.b && !a.c(a.b, b.b, c));
21696
+ a = new Ba(c, b.a, b);
21697
+ b.a.c = a;
21698
+ return b.a = a;
21699
+ }
21700
+ function Ba(a, b, c) {
21701
+ this.b = a || null;
21702
+ this.a = b || this;
21703
+ this.c = c || this;
21704
+ }
21705
+ function X() {
21706
+ this.d = Y;
21707
+ this.p = this.b = this.q = null;
21708
+ this.j = [
21709
+ 0,
21710
+ 0,
21711
+ 0
21712
+ ];
21713
+ this.s = 100130;
21714
+ this.n = !1;
21715
+ this.o = this.a = this.e = this.f = null;
21716
+ this.m = !1;
21717
+ this.c = this.r = this.i = this.k = this.l = this.h = null;
21718
+ }
21719
+ var Y = 0;
21720
+ n = X.prototype;
21721
+ n.x = function() {
21722
+ Z(this, Y);
21723
+ };
21724
+ n.B = function(a, b) {
21725
+ switch(a){
21726
+ case 100142:
21727
+ return;
21728
+ case 100140:
21729
+ switch(b){
21730
+ case 100130:
21731
+ case 100131:
21732
+ case 100132:
21733
+ case 100133:
21734
+ case 100134:
21735
+ this.s = b;
21736
+ return;
21737
+ }
21738
+ break;
21739
+ case 100141:
21740
+ this.m = !!b;
21741
+ return;
21742
+ default:
21743
+ V(this, 100900);
21744
+ return;
21745
+ }
21746
+ V(this, 100901);
21747
+ };
21748
+ n.y = function(a) {
21749
+ switch(a){
21750
+ case 100142:
21751
+ return 0;
21752
+ case 100140:
21753
+ return this.s;
21754
+ case 100141:
21755
+ return this.m;
21756
+ default:
21757
+ V(this, 100900);
21758
+ }
21759
+ return !1;
21760
+ };
21761
+ n.A = function(a, b, c) {
21762
+ this.j[0] = a;
21763
+ this.j[1] = b;
21764
+ this.j[2] = c;
21765
+ };
21766
+ n.z = function(a, b) {
21767
+ var c = b ? b : null;
21768
+ switch(a){
21769
+ case 100100:
21770
+ case 100106:
21771
+ this.h = c;
21772
+ break;
21773
+ case 100104:
21774
+ case 100110:
21775
+ this.l = c;
21776
+ break;
21777
+ case 100101:
21778
+ case 100107:
21779
+ this.k = c;
21780
+ break;
21781
+ case 100102:
21782
+ case 100108:
21783
+ this.i = c;
21784
+ break;
21785
+ case 100103:
21786
+ case 100109:
21787
+ this.p = c;
21788
+ break;
21789
+ case 100105:
21790
+ case 100111:
21791
+ this.o = c;
21792
+ break;
21793
+ case 100112:
21794
+ this.r = c;
21795
+ break;
21796
+ default:
21797
+ V(this, 100900);
21798
+ }
21799
+ };
21800
+ n.C = function(a, b) {
21801
+ var c = !1, d = [
21802
+ 0,
21803
+ 0,
21804
+ 0
21805
+ ];
21806
+ Z(this, 2);
21807
+ for(var e = 0; 3 > e; ++e){
21808
+ var f = a[e];
21809
+ -1E150 > f && (f = -1E150, c = !0);
21810
+ 1E150 < f && (f = 1E150, c = !0);
21811
+ d[e] = f;
21812
+ }
21813
+ c && V(this, 100155);
21814
+ c = this.q;
21815
+ null === c ? (c = ea(this.b), E(c, c.b)) : (K(c), c = c.e);
21816
+ c.a.d = b;
21817
+ c.a.g[0] = d[0];
21818
+ c.a.g[1] = d[1];
21819
+ c.a.g[2] = d[2];
21820
+ c.f = 1;
21821
+ c.b.f = -1;
21822
+ this.q = c;
21823
+ };
21824
+ n.u = function(a) {
21825
+ Z(this, Y);
21826
+ this.d = 1;
21827
+ this.b = new Ca;
21828
+ this.c = a;
21829
+ };
21830
+ n.t = function() {
21831
+ Z(this, 1);
21832
+ this.d = 2;
21833
+ this.q = null;
21834
+ };
21835
+ n.v = function() {
21836
+ Z(this, 2);
21837
+ this.d = 1;
21838
+ };
21839
+ n.w = function() {
21840
+ Z(this, 1);
21841
+ this.d = Y;
21842
+ var a = this.j[0], b = this.j[1], c = this.j[2], d = !1, e = [
21843
+ a,
21844
+ b,
21845
+ c
21846
+ ];
21847
+ if (0 === a && 0 === b && 0 === c) {
21848
+ for(var b = [
21849
+ -2 * 1E150,
21850
+ -2 * 1E150,
21851
+ -2 * 1E150
21852
+ ], f = [
21853
+ 2 * 1E150,
21854
+ 2 * 1E150,
21855
+ 2 * 1E150
21856
+ ], c = [], g = [], d = this.b.c, a = d.e; a !== d; a = a.e)for(var h = 0; 3 > h; ++h){
21857
+ var k = a.g[h];
21858
+ k < f[h] && (f[h] = k, g[h] = a);
21859
+ k > b[h] && (b[h] = k, c[h] = a);
21860
+ }
21861
+ a = 0;
21862
+ b[1] - f[1] > b[0] - f[0] && (a = 1);
21863
+ b[2] - f[2] > b[a] - f[a] && (a = 2);
21864
+ if (f[a] >= b[a]) e[0] = 0, e[1] = 0, e[2] = 1;
21865
+ else {
21866
+ b = 0;
21867
+ f = g[a];
21868
+ c = c[a];
21869
+ g = [
21870
+ 0,
21871
+ 0,
21872
+ 0
21873
+ ];
21874
+ f = [
21875
+ f.g[0] - c.g[0],
21876
+ f.g[1] - c.g[1],
21877
+ f.g[2] - c.g[2]
21878
+ ];
21879
+ h = [
21880
+ 0,
21881
+ 0,
21882
+ 0
21883
+ ];
21884
+ 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]);
21885
+ 0 >= b && (e[0] = e[1] = e[2] = 0, e[ha(f)] = 1);
21886
+ }
21887
+ d = !0;
21888
+ }
21889
+ g = ha(e);
21890
+ a = this.b.c;
21891
+ b = (g + 1) % 3;
21892
+ c = (g + 2) % 3;
21893
+ g = 0 < e[g] ? 1 : -1;
21894
+ for(e = a.e; e !== a; e = e.e)e.b = e.g[b], e.a = g * e.g[c];
21895
+ if (d) {
21896
+ e = 0;
21897
+ d = this.b.a;
21898
+ for(a = d.b; a !== d; a = a.b)if (b = a.a, !(0 >= b.f)) {
21899
+ do e += (b.a.b - b.b.a.b) * (b.a.a + b.b.a.a), b = b.e;
21900
+ while (b !== a.a);
21901
+ }
21902
+ if (0 > e) for(e = this.b.c, d = e.e; d !== e; d = d.e)d.a = -d.a;
21903
+ }
21904
+ this.n = !1;
21905
+ e = this.b.b;
21906
+ 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) {
21907
+ if (b !== a) {
21908
+ if (b === d || b === d.b) d = d.h;
21909
+ I(b);
21910
+ }
21911
+ if (a === d || a === d.b) d = d.h;
21912
+ I(a);
21913
+ }
21914
+ this.e = e = new Da;
21915
+ d = this.b.c;
21916
+ for(a = d.e; a !== d; a = a.e)a.h = xa(e, a);
21917
+ Ea(e);
21918
+ this.f = new Aa(this);
21919
+ za(this, -O);
21920
+ for(za(this, O); null !== (e = Fa(this.e));){
21921
+ for(;;){
21922
+ a: if (a = this.e, 0 === a.a) d = Ga(a.b);
21923
+ else if (d = a.c[a.d[a.a - 1]], 0 !== a.b.a && (a = Ga(a.b), u(a, d))) {
21924
+ d = a;
21925
+ break a;
21926
+ }
21927
+ if (null === d || !t(d, e)) break;
21928
+ d = Fa(this.e);
21929
+ ta(this, e.c, d.c);
21930
+ }
21931
+ ya(this, e);
21932
+ }
21933
+ this.a = this.f.a.a.b.a.a;
21934
+ for(e = 0; null !== (d = this.f.a.a.b);)d.h || ++e, Q(d);
21935
+ this.f = null;
21936
+ e = this.e;
21937
+ e.b = null;
21938
+ e.d = null;
21939
+ this.e = e.c = null;
21940
+ e = this.b;
21941
+ 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));
21942
+ if (!this.n) {
21943
+ e = this.b;
21944
+ 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);
21945
+ else for(a = e.a.b; a !== e.a; a = d)if (d = a.b, a.c) {
21946
+ for(a = a.a; u(a.b.a, a.a); a = a.c.b);
21947
+ for(; u(a.a, a.b.a); a = a.e);
21948
+ b = a.c.b;
21949
+ for(c = void 0; a.e !== b;)if (u(a.b.a, b.a)) {
21950
+ 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;
21951
+ b = b.c.b;
21952
+ } else {
21953
+ 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;
21954
+ a = a.e;
21955
+ }
21956
+ for(; b.e.e !== a;)c = L(b.e, b), b = c.b;
21957
+ }
21958
+ 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){
21959
+ if (d.c) {
21960
+ this.h && this.h(2, this.c);
21961
+ a = d.a;
21962
+ do this.k && this.k(a.a.d, this.c), a = a.e;
21963
+ while (a !== d.a);
21964
+ this.i && this.i(this.c);
21965
+ }
21966
+ }
21967
+ else {
21968
+ e = this.b;
21969
+ d = !!this.l;
21970
+ a = !1;
21971
+ b = -1;
21972
+ for(c = e.a.d; c !== e.a; c = c.d)if (c.c) {
21973
+ a || (this.h && this.h(4, this.c), a = !0);
21974
+ g = c.a;
21975
+ 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;
21976
+ while (g !== c.a);
21977
+ }
21978
+ a && this.i && this.i(this.c);
21979
+ }
21980
+ if (this.r) {
21981
+ e = this.b;
21982
+ for(a = e.a.b; a !== e.a; a = d)if (d = a.b, !a.c) {
21983
+ b = a.a;
21984
+ c = b.e;
21985
+ g = void 0;
21986
+ 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));
21987
+ while (g !== b);
21988
+ b = a.d;
21989
+ a = a.b;
21990
+ a.d = b;
21991
+ b.b = a;
21992
+ }
21993
+ this.r(this.b);
21994
+ this.c = this.b = null;
21995
+ return;
21996
+ }
21997
+ }
21998
+ this.b = this.c = null;
21999
+ };
22000
+ function Z(a, b) {
22001
+ if (a.d !== b) for(; a.d !== b;)if (a.d < b) switch(a.d){
22002
+ case Y:
22003
+ V(a, 100151);
22004
+ a.u(null);
22005
+ break;
22006
+ case 1:
22007
+ V(a, 100152), a.t();
22008
+ }
22009
+ else switch(a.d){
22010
+ case 2:
22011
+ V(a, 100154);
22012
+ a.v();
22013
+ break;
22014
+ case 1:
22015
+ V(a, 100153), a.w();
22016
+ }
22017
+ }
22018
+ function V(a, b) {
22019
+ a.p && a.p(b, a.c);
22020
+ }
22021
+ function ga(a, b) {
22022
+ this.b = a || this;
22023
+ this.d = b || this;
22024
+ this.a = null;
22025
+ this.c = !1;
22026
+ }
22027
+ function M() {
22028
+ this.h = this;
22029
+ this.i = this.d = this.a = this.e = this.c = this.b = null;
22030
+ this.f = 0;
22031
+ }
22032
+ function J(a) {
22033
+ return a.b.e;
22034
+ }
22035
+ function Ca() {
22036
+ this.c = new N;
22037
+ this.a = new ga;
22038
+ this.b = new M;
22039
+ this.d = new M;
22040
+ this.b.b = this.d;
22041
+ this.d.b = this.b;
22042
+ }
22043
+ function N(a, b) {
22044
+ this.e = a || this;
22045
+ this.f = b || this;
22046
+ this.d = this.c = null;
22047
+ this.g = [
22048
+ 0,
22049
+ 0,
22050
+ 0
22051
+ ];
22052
+ this.h = this.a = this.b = 0;
22053
+ }
22054
+ function Da() {
22055
+ this.c = [];
22056
+ this.d = null;
22057
+ this.a = 0;
22058
+ this.e = !1;
22059
+ this.b = new Ha;
22060
+ }
22061
+ function Ea(a) {
22062
+ a.d = [];
22063
+ for(var b = 0; b < a.a; b++)a.d[b] = b;
22064
+ a.d.sort(function(a) {
22065
+ return function(b, e) {
22066
+ return u(a[b], a[e]) ? 1 : -1;
22067
+ };
22068
+ }(a.c));
22069
+ a.e = !0;
22070
+ Ia(a.b);
22071
+ }
22072
+ function xa(a, b) {
22073
+ if (a.e) {
22074
+ var c = a.b, d = ++c.a;
22075
+ 2 * d > c.f && (c.f *= 2, c.c = Ja(c.c, c.f + 1));
22076
+ var e;
22077
+ 0 === c.b ? e = d : (e = c.b, c.b = c.c[c.b]);
22078
+ c.e[e] = b;
22079
+ c.c[e] = d;
22080
+ c.d[d] = e;
22081
+ c.h && va(c, d);
22082
+ return e;
22083
+ }
22084
+ c = a.a++;
22085
+ a.c[c] = b;
22086
+ return -(c + 1);
22087
+ }
22088
+ function Fa(a) {
22089
+ if (0 === a.a) return Ka(a.b);
22090
+ var b = a.c[a.d[a.a - 1]];
22091
+ if (0 !== a.b.a && u(Ga(a.b), b)) return Ka(a.b);
22092
+ do --a.a;
22093
+ while (0 < a.a && null === a.c[a.d[a.a - 1]]);
22094
+ return b;
22095
+ }
22096
+ function Ha() {
22097
+ this.d = Ja([
22098
+ 0
22099
+ ], 33);
22100
+ this.e = [
22101
+ null,
22102
+ null
22103
+ ];
22104
+ this.c = [
22105
+ 0,
22106
+ 0
22107
+ ];
22108
+ this.a = 0;
22109
+ this.f = 32;
22110
+ this.b = 0;
22111
+ this.h = !1;
22112
+ this.d[1] = 1;
22113
+ }
22114
+ function Ja(a, b) {
22115
+ for(var c = Array(b), d = 0; d < a.length; d++)c[d] = a[d];
22116
+ for(; d < b; d++)c[d] = 0;
22117
+ return c;
22118
+ }
22119
+ function Ia(a) {
22120
+ for(var b = a.a; 1 <= b; --b)W(a, b);
22121
+ a.h = !0;
22122
+ }
22123
+ function Ga(a) {
22124
+ return a.e[a.d[1]];
22125
+ }
22126
+ function Ka(a) {
22127
+ var b = a.d, c = a.e, d = a.c, e = b[1], f = c[e];
22128
+ 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));
22129
+ return f;
22130
+ }
22131
+ function W(a, b) {
22132
+ for(var c = a.d, d = a.e, e = a.c, f = b, g = c[f];;){
22133
+ var h = f << 1;
22134
+ h < a.a && u(d[c[h + 1]], d[c[h]]) && (h += 1);
22135
+ var k = c[h];
22136
+ if (h > a.a || u(d[g], d[k])) {
22137
+ c[f] = g;
22138
+ e[g] = f;
22139
+ break;
22140
+ }
22141
+ c[f] = k;
22142
+ e[k] = f;
22143
+ f = h;
22144
+ }
22145
+ }
22146
+ function va(a, b) {
22147
+ for(var c = a.d, d = a.e, e = a.c, f = b, g = c[f];;){
22148
+ var h = f >> 1, k = c[h];
22149
+ if (0 === h || u(d[k], d[g])) {
22150
+ c[f] = g;
22151
+ e[g] = f;
22152
+ break;
22153
+ }
22154
+ c[f] = k;
22155
+ e[k] = f;
22156
+ f = h;
22157
+ }
22158
+ }
22159
+ function ma() {
22160
+ this.e = this.a = null;
22161
+ this.f = 0;
22162
+ this.c = this.b = this.h = this.d = !1;
22163
+ }
22164
+ function S(a) {
22165
+ return a.e.c.b;
22166
+ }
22167
+ function R(a) {
22168
+ return a.e.a.b;
22169
+ }
22170
+ commonjsGlobal.libtess = {
22171
+ GluTesselator: X,
22172
+ windingRule: {
22173
+ GLU_TESS_WINDING_ODD: 100130,
22174
+ GLU_TESS_WINDING_NONZERO: 100131,
22175
+ GLU_TESS_WINDING_POSITIVE: 100132,
22176
+ GLU_TESS_WINDING_NEGATIVE: 100133,
22177
+ GLU_TESS_WINDING_ABS_GEQ_TWO: 100134
22178
+ },
22179
+ primitiveType: {
22180
+ GL_LINE_LOOP: 2,
22181
+ GL_TRIANGLES: 4,
22182
+ GL_TRIANGLE_STRIP: 5,
22183
+ GL_TRIANGLE_FAN: 6
22184
+ },
22185
+ errorType: {
22186
+ GLU_TESS_MISSING_BEGIN_POLYGON: 100151,
22187
+ GLU_TESS_MISSING_END_POLYGON: 100153,
22188
+ GLU_TESS_MISSING_BEGIN_CONTOUR: 100152,
22189
+ GLU_TESS_MISSING_END_CONTOUR: 100154,
22190
+ GLU_TESS_COORD_TOO_LARGE: 100155,
22191
+ GLU_TESS_NEED_COMBINE_CALLBACK: 100156
22192
+ },
22193
+ gluEnum: {
22194
+ GLU_TESS_MESH: 100112,
22195
+ GLU_TESS_TOLERANCE: 100142,
22196
+ GLU_TESS_WINDING_RULE: 100140,
22197
+ GLU_TESS_BOUNDARY_ONLY: 100141,
22198
+ GLU_INVALID_ENUM: 100900,
22199
+ GLU_INVALID_VALUE: 100901,
22200
+ GLU_TESS_BEGIN: 100100,
22201
+ GLU_TESS_VERTEX: 100101,
22202
+ GLU_TESS_END: 100102,
22203
+ GLU_TESS_ERROR: 100103,
22204
+ GLU_TESS_EDGE_FLAG: 100104,
22205
+ GLU_TESS_COMBINE: 100105,
22206
+ GLU_TESS_BEGIN_DATA: 100106,
22207
+ GLU_TESS_VERTEX_DATA: 100107,
22208
+ GLU_TESS_END_DATA: 100108,
22209
+ GLU_TESS_ERROR_DATA: 100109,
22210
+ GLU_TESS_EDGE_FLAG_DATA: 100110,
22211
+ GLU_TESS_COMBINE_DATA: 100111
22212
+ }
22213
+ };
22214
+ X.prototype.gluDeleteTess = X.prototype.x;
22215
+ X.prototype.gluTessProperty = X.prototype.B;
22216
+ X.prototype.gluGetTessProperty = X.prototype.y;
22217
+ X.prototype.gluTessNormal = X.prototype.A;
22218
+ X.prototype.gluTessCallback = X.prototype.z;
22219
+ X.prototype.gluTessVertex = X.prototype.C;
22220
+ X.prototype.gluTessBeginPolygon = X.prototype.u;
22221
+ X.prototype.gluTessBeginContour = X.prototype.t;
22222
+ X.prototype.gluTessEndContour = X.prototype.v;
22223
+ X.prototype.gluTessEndPolygon = X.prototype.w;
22224
+ {
22225
+ module.exports = commonjsGlobal.libtess;
22226
+ }
22227
+ }(libtess_min));
22228
+
22229
+ var tessy = function initTesselator() {
22230
+ // function called for each vertex of tesselator output
22231
+ function vertexCallback(data, polyVertArray) {
22232
+ polyVertArray[polyVertArray.length] = data[0];
22233
+ polyVertArray[polyVertArray.length] = data[1];
22234
+ }
22235
+ function begincallback(type) {
22236
+ if (type !== libtess_min.exports.primitiveType.GL_TRIANGLES) {
22237
+ console.info("expected TRIANGLES but got type: " + type);
22238
+ }
22239
+ }
22240
+ function errorcallback(errno) {
22241
+ console.error("error callback, error number: " + errno);
22242
+ }
22243
+ // callback for when segments intersect and must be split
22244
+ function combinecallback(coords, data, weight) {
22245
+ // console.log('combine callback');
22246
+ return [
22247
+ coords[0],
22248
+ coords[1],
22249
+ coords[2]
22250
+ ];
22251
+ }
22252
+ function edgeCallback(flag) {
22253
+ // don't really care about the flag, but need no-strip/no-fan behavior
22254
+ // console.log('edge flag: ' + flag);
22255
+ }
22256
+ var tessy = new libtess_min.exports.GluTesselator();
22257
+ // tessy.gluTessProperty(libtess.gluEnum.GLU_TESS_WINDING_RULE, libtess.windingRule.GLU_TESS_WINDING_POSITIVE);
22258
+ tessy.gluTessCallback(libtess_min.exports.gluEnum.GLU_TESS_VERTEX_DATA, vertexCallback);
22259
+ tessy.gluTessCallback(libtess_min.exports.gluEnum.GLU_TESS_BEGIN, begincallback);
22260
+ tessy.gluTessCallback(libtess_min.exports.gluEnum.GLU_TESS_ERROR, errorcallback);
22261
+ tessy.gluTessCallback(libtess_min.exports.gluEnum.GLU_TESS_COMBINE, combinecallback);
22262
+ tessy.gluTessCallback(libtess_min.exports.gluEnum.GLU_TESS_EDGE_FLAG, edgeCallback);
22263
+ return tessy;
22264
+ }();
22265
+ function triangulate(contours) {
22266
+ // libtess will take 3d verts and flatten to a plane for tesselation
22267
+ // since only doing 2d tesselation here, provide z=1 normal to skip
22268
+ // iterating over verts only to get the same answer.
22269
+ // comment out to test normal-generation code
22270
+ tessy.gluTessNormal(0, 0, 1);
22271
+ var triangleVerts = [];
22272
+ tessy.gluTessBeginPolygon(triangleVerts);
22273
+ for(var i = 0; i < contours.length; i++){
22274
+ tessy.gluTessBeginContour();
22275
+ var contour = contours[i];
22276
+ for(var j = 0; j < contour.length; j += 2){
22277
+ var coords = [
22278
+ contour[j],
22279
+ contour[j + 1],
22280
+ 0
22281
+ ];
22282
+ tessy.gluTessVertex(coords, coords);
22283
+ }
22284
+ tessy.gluTessEndContour();
22285
+ }
22286
+ // finish polygon
22287
+ tessy.gluTessEndPolygon();
22288
+ return triangleVerts;
22289
+ }
22290
+
22291
+ var ShapeComponent = /*#__PURE__*/ function(RendererComponent) {
22292
+ _inherits(ShapeComponent, RendererComponent);
22293
+ function ShapeComponent(engine) {
22294
+ var _this;
22295
+ _this = RendererComponent.call(this, engine) || this;
22296
+ _this.path = new GraphicsPath();
22297
+ _this.curveValues = [];
22298
+ _this.dirty = false;
22299
+ _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";
22300
+ _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";
22301
+ if (!_this.geometry) {
22302
+ _this.geometry = Geometry.create(engine, {
22303
+ attributes: {
22304
+ aPos: {
22305
+ type: glContext.FLOAT,
22306
+ size: 3,
22307
+ data: new Float32Array([
22308
+ -0.5,
22309
+ 0.5,
22310
+ 0,
22311
+ -0.5,
22312
+ -0.5,
22313
+ 0,
22314
+ 0.5,
22315
+ 0.5,
22316
+ 0,
22317
+ 0.5,
22318
+ -0.5,
22319
+ 0
22320
+ ])
22321
+ },
22322
+ aUV: {
22323
+ type: glContext.FLOAT,
22324
+ size: 2,
22325
+ data: new Float32Array()
22326
+ }
22327
+ },
22328
+ mode: glContext.TRIANGLES,
22329
+ drawCount: 4
22330
+ });
22331
+ }
22332
+ if (!_this.material) {
22333
+ var materialProps = {
22334
+ shader: {
22335
+ vertex: _this.vert,
22336
+ fragment: _this.frag,
22337
+ glslVersion: GLSLVersion.GLSL1
22338
+ }
22339
+ };
22340
+ _this.material = Material.create(engine, materialProps);
22341
+ _this.material.setColor("_Color", new Color(1, 1, 1, 1));
22342
+ _this.material.depthMask = true;
22343
+ _this.material.depthTest = true;
22344
+ _this.material.blending = true;
22345
+ }
22346
+ return _this;
22347
+ }
22348
+ var _proto = ShapeComponent.prototype;
22349
+ _proto.onUpdate = function onUpdate(dt) {
22350
+ if (this.dirty) {
22351
+ this.path.clear();
22352
+ this.path.moveTo(this.curveValues[this.curveValues.length - 1].point.x, this.curveValues[this.curveValues.length - 1].point.y);
22353
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.curveValues), _step; !(_step = _iterator()).done;){
22354
+ var curveValue = _step.value;
22355
+ var point = curveValue.point;
22356
+ var control1 = curveValue.controlPoint1;
22357
+ var control2 = curveValue.controlPoint2;
22358
+ this.path.bezierCurveTo(control1.x, control1.y, control2.x, control2.y, point.x, point.y, 1);
22359
+ }
22360
+ this.buildGeometryFromPath(this.path.shapePath);
22361
+ this.dirty = false;
22362
+ }
22363
+ };
22364
+ _proto.render = function render(renderer) {
22365
+ if (renderer.renderingData.currentFrame.globalUniforms) {
22366
+ renderer.setGlobalMatrix("effects_ObjectToWorld", this.transform.getWorldMatrix());
22367
+ }
22368
+ renderer.drawGeometry(this.geometry, this.material);
22369
+ };
22370
+ _proto.buildGeometryFromPath = function buildGeometryFromPath(shapePath) {
22371
+ var shapePrimitives = shapePath.shapePrimitives;
22372
+ var vertices = [];
22373
+ // triangulate shapePrimitive
22374
+ for(var _iterator = _create_for_of_iterator_helper_loose(shapePrimitives), _step; !(_step = _iterator()).done;){
22375
+ var shapePrimitive = _step.value;
22376
+ var _vertices;
22377
+ var shape = shapePrimitive.shape;
22378
+ (_vertices = vertices).push.apply(_vertices, [].concat(triangulate([
22379
+ shape.points
22380
+ ])));
22381
+ }
22382
+ // build vertices and uvs
22383
+ var vertexCount = vertices.length / 2;
22384
+ var positionArray = this.geometry.getAttributeData("aPos");
22385
+ var uvArray = this.geometry.getAttributeData("aUV");
22386
+ if (!positionArray || positionArray.length < vertexCount * 3) {
22387
+ positionArray = new Float32Array(vertexCount * 3);
22388
+ }
22389
+ if (!uvArray || uvArray.length < vertexCount * 2) {
22390
+ uvArray = new Float32Array(vertexCount * 2);
22391
+ }
22392
+ for(var i = 0; i < vertexCount; i++){
22393
+ var pointsOffset = i * 3;
22394
+ var positionArrayOffset = i * 2;
22395
+ var uvOffset = i * 2;
22396
+ positionArray[pointsOffset] = vertices[positionArrayOffset];
22397
+ positionArray[pointsOffset + 1] = vertices[positionArrayOffset + 1];
22398
+ positionArray[pointsOffset + 2] = 0;
22399
+ uvArray[uvOffset] = positionArray[pointsOffset];
22400
+ uvArray[uvOffset + 1] = positionArray[pointsOffset + 1];
22401
+ }
22402
+ this.geometry.setAttributeData("aPos", positionArray);
22403
+ this.geometry.setAttributeData("aUV", uvArray);
22404
+ this.geometry.setDrawCount(vertexCount);
22405
+ };
22406
+ _proto.fromData = function fromData(data) {
22407
+ RendererComponent.prototype.fromData.call(this, data);
22408
+ var points = data.param.points;
22409
+ var easingIns = data.param.easingIn;
22410
+ var easingOuts = data.param.easingOut;
22411
+ for(var _iterator = _create_for_of_iterator_helper_loose(data.param.shapes), _step; !(_step = _iterator()).done;){
22412
+ var shape = _step.value;
22413
+ var indices = shape.indexes;
22414
+ for(var i = 1; i < indices.length; i++){
22415
+ var pointIndex = indices[i];
22416
+ var lastPointIndex = indices[i - 1];
22417
+ this.curveValues.push({
22418
+ point: points[pointIndex.point],
22419
+ controlPoint1: easingOuts[lastPointIndex.easingOut],
22420
+ controlPoint2: easingIns[pointIndex.easingIn]
22421
+ });
22422
+ }
22423
+ // Push the last curve
22424
+ this.curveValues.push({
22425
+ point: points[indices[0].point],
22426
+ controlPoint1: easingOuts[indices[indices.length - 1].easingOut],
22427
+ controlPoint2: easingIns[indices[0].easingIn]
22428
+ });
22429
+ }
22430
+ this.dirty = true;
22431
+ };
22432
+ return ShapeComponent;
22433
+ }(RendererComponent);
22434
+ ShapeComponent = __decorate([
22435
+ effectsClass("ShapeComponent")
22436
+ ], ShapeComponent);
22437
+ var ComponentShapeType;
22438
+ (function(ComponentShapeType) {
22439
+ /**
22440
+ * 自定义图形
22441
+ */ ComponentShapeType[ComponentShapeType["CUSTOM"] = 0] = "CUSTOM";
22442
+ /**
22443
+ * 矩形
22444
+ */ ComponentShapeType[ComponentShapeType["RECTANGLE"] = 1] = "RECTANGLE";
22445
+ /**
22446
+ * 椭圆
22447
+ */ ComponentShapeType[ComponentShapeType["ELLIPSE"] = 2] = "ELLIPSE";
22448
+ /**
22449
+ * 多边形
22450
+ */ ComponentShapeType[ComponentShapeType["POLYGON"] = 3] = "POLYGON";
22451
+ /**
22452
+ * 星形
22453
+ */ ComponentShapeType[ComponentShapeType["STAR"] = 4] = "STAR";
22454
+ })(ComponentShapeType || (ComponentShapeType = {}));
22455
+ var ShapeConnectType;
22456
+ (function(ShapeConnectType) {})(ShapeConnectType || (ShapeConnectType = {}));
22457
+ var ShapePointType;
22458
+ (function(ShapePointType) {})(ShapePointType || (ShapePointType = {}));
22459
+
20794
22460
  var EventEmitter = function EventEmitter() {
20795
22461
  var _this = this;
20796
22462
  var _this1 = this;
@@ -21160,21 +22826,21 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
21160
22826
  return now - this.duration > 0.001;
21161
22827
  };
21162
22828
  _proto.find = function find(name) {
22829
+ var _queue;
21163
22830
  if (this.name === name) {
21164
22831
  return this;
21165
22832
  }
21166
- for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
21167
- var child = _step.value;
21168
- if (child.name === name) {
21169
- return child;
21170
- }
21171
- }
21172
- for(var _iterator1 = _create_for_of_iterator_helper_loose(this.children), _step1; !(_step1 = _iterator1()).done;){
21173
- var child1 = _step1.value;
21174
- var res = child1.find(name);
21175
- if (res) {
21176
- return res;
22833
+ var queue = [];
22834
+ (_queue = queue).push.apply(_queue, [].concat(this.children));
22835
+ var index = 0;
22836
+ while(index < queue.length){
22837
+ var _queue1;
22838
+ var item = queue[index];
22839
+ index++;
22840
+ if (item.name === name) {
22841
+ return item;
21177
22842
  }
22843
+ (_queue1 = queue).push.apply(_queue1, [].concat(item.children));
21178
22844
  }
21179
22845
  return undefined;
21180
22846
  };
@@ -23918,15 +25584,22 @@ function passRenderLevel(l, renderLevel) {
23918
25584
  return false;
23919
25585
  }
23920
25586
 
23921
- function isSceneJSON(scene) {
23922
- return isObject(scene) && "jsonScene" in scene;
23923
- }
23924
- function isSceneURL(scene) {
23925
- return isObject(scene) && "url" in scene;
23926
- }
23927
- function isSceneWithOptions(scene) {
23928
- return isObject(scene) && "options" in scene;
23929
- }
25587
+ var Scene;
25588
+ (function(Scene) {
25589
+ function isJSONObject(scene) {
25590
+ return isObject(scene) && "jsonScene" in scene;
25591
+ }
25592
+ // JSON 对象
25593
+ Scene.isJSONObject = isJSONObject;
25594
+ function isURL(scene) {
25595
+ return isObject(scene) && "url" in scene;
25596
+ }
25597
+ Scene.isURL = isURL;
25598
+ function isWithOptions(scene) {
25599
+ return isObject(scene) && "options" in scene;
25600
+ }
25601
+ Scene.isWithOptions = isWithOptions;
25602
+ })(Scene || (Scene = {}));
23930
25603
 
23931
25604
  function getBackgroundImage(template, variables) {
23932
25605
  var templateBackground;
@@ -24051,13 +25724,12 @@ var seed = 1;
24051
25724
  */ _proto.loadScene = function loadScene(url, renderer, options) {
24052
25725
  var _this = this;
24053
25726
  return _async_to_generator(function() {
24054
- var _gpuInstance_detail, rawJSON, assetUrl, startTime, timeInfoMessages, gpuInstance, _gpuInstance_detail_asyncShaderCompile, asyncShaderCompile, _gpuInstance_detail_compressedTexture, compressedTexture, timeInfos, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
25727
+ var rawJSON, assetUrl, startTime, timeInfoMessages, gpuInstance, _gpuInstance_detail_compressedTexture, compressedTexture, timeInfos, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
24055
25728
  return __generator(this, function(_state) {
24056
25729
  assetUrl = isString(url) ? url : _this.id;
24057
25730
  startTime = performance.now();
24058
25731
  timeInfoMessages = [];
24059
25732
  gpuInstance = renderer == null ? void 0 : renderer.engine.gpuCapability;
24060
- asyncShaderCompile = (_gpuInstance_detail_asyncShaderCompile = gpuInstance == null ? void 0 : (_gpuInstance_detail = gpuInstance.detail) == null ? void 0 : _gpuInstance_detail.asyncShaderCompile) != null ? _gpuInstance_detail_asyncShaderCompile : false;
24061
25733
  compressedTexture = (_gpuInstance_detail_compressedTexture = gpuInstance == null ? void 0 : gpuInstance.detail.compressedTexture) != null ? _gpuInstance_detail_compressedTexture : COMPRESSED_TEXTURE.NONE;
24062
25734
  timeInfos = {};
24063
25735
  cancelLoading = false;
@@ -24110,81 +25782,55 @@ var seed = 1;
24110
25782
  });
24111
25783
  });
24112
25784
  loadResourcePromise = /*#__PURE__*/ _async_to_generator(function() {
24113
- 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;
25785
+ var scene, link, _ref, jsonScene, pluginSystem, _jsonScene_bins, bins, images, compositions, fonts, _ref1, loadedBins, loadedImages, i, i1, imageAsset, loadedTextures, totalTime;
24114
25786
  return __generator(this, function(_state) {
24115
25787
  switch(_state.label){
24116
25788
  case 0:
24117
- if (!isObject(url)) return [
24118
- 3,
24119
- 1
24120
- ];
24121
- // TODO: 原 JSONLoader contructor 判断是否兼容
24122
- rawJSON = url;
24123
- _this.baseUrl = location.href;
24124
- return [
25789
+ if (!isString(url)) return [
24125
25790
  3,
24126
- 3
25791
+ 2
24127
25792
  ];
24128
- case 1:
24129
25793
  // 兼容相对路径
24130
- url = new URL(url, location.href).href;
24131
- _this.baseUrl = url;
25794
+ link = new URL(url, location.href).href;
25795
+ _this.baseUrl = link;
24132
25796
  return [
24133
25797
  4,
24134
25798
  hookTimeInfo("loadJSON", function() {
24135
- return _this.loadJSON(url);
25799
+ return _this.loadJSON(link);
24136
25800
  })
24137
25801
  ];
24138
- case 2:
25802
+ case 1:
24139
25803
  rawJSON = _state.sent();
25804
+ return [
25805
+ 3,
25806
+ 3
25807
+ ];
25808
+ case 2:
25809
+ // url 为 spec.JSONScene 或 Scene 对象
25810
+ rawJSON = url;
25811
+ _this.baseUrl = location.href;
24140
25812
  _state.label = 3;
24141
25813
  case 3:
24142
- if (!isSceneJSON(rawJSON)) return [
25814
+ if (!Scene.isJSONObject(rawJSON)) return [
24143
25815
  3,
24144
- 6
25816
+ 4
24145
25817
  ];
24146
25818
  // 已经加载过的 可能需要更新数据模板
24147
25819
  scene = _extends({}, rawJSON);
24148
- if (!(_this.options && _this.options.variables && Object.keys(_this.options.variables).length !== 0)) return [
24149
- 3,
24150
- 5
24151
- ];
24152
- _rawJSON_jsonScene = rawJSON.jsonScene, rawImages = _rawJSON_jsonScene.images;
24153
- images = scene.images;
24154
- for(i = 0; i < rawImages.length; i++){
24155
- // 仅重新加载数据模板对应的图片
24156
- if (_instanceof1(images[i], HTMLCanvasElement)) {
24157
- images[i] = rawImages[i];
24158
- }
24159
- }
24160
- return [
24161
- 4,
24162
- hookTimeInfo("processImages", function() {
24163
- return _this.processImages(images, compressedTexture);
24164
- })
24165
- ];
24166
- case 4:
24167
- scene.images = _state.sent();
24168
- // 更新 TextureOptions 中的 image 指向
24169
- for(i1 = 0; i1 < scene.images.length; i1++){
24170
- scene.textureOptions[i1].image = scene.images[i1];
24171
- }
24172
- _state.label = 5;
24173
- case 5:
24174
25820
  return [
24175
25821
  3,
24176
- 12
25822
+ 9
24177
25823
  ];
24178
- case 6:
25824
+ case 4:
24179
25825
  return [
24180
25826
  4,
24181
25827
  hookTimeInfo("processJSON", function() {
24182
25828
  return _this.processJSON(rawJSON);
24183
25829
  })
24184
25830
  ];
24185
- case 7:
24186
- _ref = _state.sent(), usedImages = _ref.usedImages, jsonScene = _ref.jsonScene, pluginSystem = _ref.pluginSystem;
24187
- _jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, images1 = jsonScene.images, compositions = jsonScene.compositions, fonts = jsonScene.fonts;
25831
+ case 5:
25832
+ _ref = _state.sent(), jsonScene = _ref.jsonScene, pluginSystem = _ref.pluginSystem;
25833
+ _jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, images = jsonScene.images, compositions = jsonScene.compositions, fonts = jsonScene.fonts;
24188
25834
  return [
24189
25835
  4,
24190
25836
  Promise.all([
@@ -24192,38 +25838,36 @@ var seed = 1;
24192
25838
  return _this.processBins(bins);
24193
25839
  }),
24194
25840
  hookTimeInfo("processImages", function() {
24195
- return _this.processImages(images1, compressedTexture);
25841
+ return _this.processImages(images, compressedTexture);
24196
25842
  }),
24197
- hookTimeInfo("" + (asyncShaderCompile ? "async" : "sync") + "Compile", function() {
25843
+ hookTimeInfo("precompile", function() {
24198
25844
  return _this.precompile(compositions, pluginSystem, renderer, options);
25845
+ }),
25846
+ hookTimeInfo("processFontURL", function() {
25847
+ return _this.processFontURL(fonts);
24199
25848
  })
24200
25849
  ])
24201
25850
  ];
24202
- case 8:
25851
+ case 6:
24203
25852
  _ref1 = _state.sent(), loadedBins = _ref1[0], loadedImages = _ref1[1];
25853
+ for(i = 0; i < images.length; i++){
25854
+ _this.assets[images[i].id] = loadedImages[i];
25855
+ }
24204
25856
  if (renderer) {
24205
- for(i2 = 0; i2 < images1.length; i2++){
25857
+ for(i1 = 0; i1 < images.length; i1++){
24206
25858
  imageAsset = new ImageAsset(renderer.engine);
24207
- imageAsset.data = loadedImages[i2];
24208
- imageAsset.setInstanceId(images1[i2].id);
25859
+ imageAsset.data = loadedImages[i1];
25860
+ imageAsset.setInstanceId(images[i1].id);
24209
25861
  renderer.engine.addInstance(imageAsset);
24210
25862
  }
24211
25863
  }
24212
- return [
24213
- 4,
24214
- hookTimeInfo("processFontURL", function() {
24215
- return _this.processFontURL(fonts);
24216
- })
24217
- ];
24218
- case 9:
24219
- _state.sent();
24220
25864
  return [
24221
25865
  4,
24222
25866
  hookTimeInfo("processTextures", function() {
24223
- return _this.processTextures(loadedImages, loadedBins, jsonScene, renderer.engine);
25867
+ return _this.processTextures(loadedImages, loadedBins, jsonScene);
24224
25868
  })
24225
25869
  ];
24226
- case 10:
25870
+ case 7:
24227
25871
  loadedTextures = _state.sent();
24228
25872
  scene = {
24229
25873
  timeInfos: timeInfos,
@@ -24232,7 +25876,6 @@ var seed = 1;
24232
25876
  storage: {},
24233
25877
  pluginSystem: pluginSystem,
24234
25878
  jsonScene: jsonScene,
24235
- usedImages: usedImages,
24236
25879
  images: loadedImages,
24237
25880
  textureOptions: loadedTextures,
24238
25881
  bins: loadedBins
@@ -24244,10 +25887,10 @@ var seed = 1;
24244
25887
  return pluginSystem.loadResources(scene, _this.options);
24245
25888
  })
24246
25889
  ];
24247
- case 11:
25890
+ case 8:
24248
25891
  _state.sent();
24249
- _state.label = 12;
24250
- case 12:
25892
+ _state.label = 9;
25893
+ case 9:
24251
25894
  totalTime = performance.now() - startTime;
24252
25895
  logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + ".");
24253
25896
  window.clearTimeout(loadTimer);
@@ -24275,7 +25918,6 @@ var seed = 1;
24275
25918
  };
24276
25919
  _proto.precompile = function precompile(compositions, pluginSystem, renderer, options) {
24277
25920
  return _async_to_generator(function() {
24278
- var shaderLibrary;
24279
25921
  return __generator(this, function(_state) {
24280
25922
  switch(_state.label){
24281
25923
  case 0:
@@ -24284,22 +25926,11 @@ var seed = 1;
24284
25926
  2
24285
25927
  ];
24286
25928
  }
24287
- shaderLibrary = renderer == null ? void 0 : renderer.getShaderLibrary();
24288
25929
  return [
24289
25930
  4,
24290
25931
  pluginSystem == null ? void 0 : pluginSystem.precompile(compositions, renderer, options)
24291
25932
  ];
24292
25933
  case 1:
24293
- _state.sent();
24294
- return [
24295
- 4,
24296
- new Promise(function(resolve) {
24297
- shaderLibrary == null ? void 0 : shaderLibrary.compileAllShaders(function() {
24298
- resolve(null);
24299
- });
24300
- })
24301
- ];
24302
- case 2:
24303
25934
  _state.sent();
24304
25935
  return [
24305
25936
  2
@@ -24311,12 +25942,12 @@ var seed = 1;
24311
25942
  _proto.processJSON = function processJSON(json) {
24312
25943
  var _this = this;
24313
25944
  return _async_to_generator(function() {
24314
- var jsonScene, _jsonScene_plugins, plugins, sceneCompositions, imgUsage, images, pluginSystem, renderLevel, usedImages;
25945
+ var jsonScene, _jsonScene_plugins, plugins, pluginSystem;
24315
25946
  return __generator(this, function(_state) {
24316
25947
  switch(_state.label){
24317
25948
  case 0:
24318
25949
  jsonScene = getStandardJSON(json);
24319
- _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins, sceneCompositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, images = jsonScene.images;
25950
+ _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins;
24320
25951
  pluginSystem = new PluginSystem(plugins);
24321
25952
  return [
24322
25953
  4,
@@ -24324,20 +25955,9 @@ var seed = 1;
24324
25955
  ];
24325
25956
  case 1:
24326
25957
  _state.sent();
24327
- renderLevel = _this.options.renderLevel;
24328
- usedImages = {};
24329
- if (imgUsage) {
24330
- // TODO: 考虑放到独立的 fix 文件
24331
- fixOldImageUsage(usedImages, sceneCompositions, imgUsage, images, renderLevel);
24332
- } else {
24333
- images == null ? void 0 : images.forEach(function(_, i) {
24334
- usedImages[i] = true;
24335
- });
24336
- }
24337
25958
  return [
24338
25959
  2,
24339
25960
  {
24340
- usedImages: usedImages,
24341
25961
  jsonScene: jsonScene,
24342
25962
  pluginSystem: pluginSystem
24343
25963
  }
@@ -24409,7 +26029,6 @@ var seed = 1;
24409
26029
  ];
24410
26030
  case 2:
24411
26031
  _state.sent();
24412
- //@ts-expect-error
24413
26032
  document.fonts.add(fontFace);
24414
26033
  AssetManager.fonts.add(font.fontFamily);
24415
26034
  return [
@@ -24491,6 +26110,10 @@ var seed = 1;
24491
26110
  3,
24492
26111
  3
24493
26112
  ];
26113
+ _this.assets[idx] = {
26114
+ url: resultImage.src,
26115
+ type: TextureSourceType.video
26116
+ };
24494
26117
  return [
24495
26118
  2,
24496
26119
  resultImage
@@ -24500,6 +26123,10 @@ var seed = 1;
24500
26123
  if (background && Array.isArray(url) && variables) {
24501
26124
  variables[background.name] = resultImage.src;
24502
26125
  }
26126
+ _this.assets[idx] = {
26127
+ url: resultImage.src,
26128
+ type: TextureSourceType.image
26129
+ };
24503
26130
  return [
24504
26131
  4,
24505
26132
  combineImageTemplate(resultImage, template, variables)
@@ -24542,12 +26169,6 @@ var seed = 1;
24542
26169
  _this.loadBins(bufferURL)
24543
26170
  ];
24544
26171
  }
24545
- } else if ("sourceType" in img) {
24546
- // TODO: 确定是否有用
24547
- return [
24548
- 2,
24549
- img
24550
- ];
24551
26172
  } else if (_instanceof1(img, HTMLImageElement) || _instanceof1(img, HTMLCanvasElement) || _instanceof1(img, HTMLVideoElement) || _instanceof1(img, Texture)) {
24552
26173
  return [
24553
26174
  2,
@@ -24598,7 +26219,7 @@ var seed = 1;
24598
26219
  });
24599
26220
  })();
24600
26221
  };
24601
- _proto.processTextures = function processTextures(images, bins, jsonScene, engine) {
26222
+ _proto.processTextures = function processTextures(images, bins, jsonScene) {
24602
26223
  var _this = this;
24603
26224
  return _async_to_generator(function() {
24604
26225
  var _jsonScene_textures, textures, jobs;
@@ -24609,7 +26230,7 @@ var seed = 1;
24609
26230
  };
24610
26231
  });
24611
26232
  jobs = textures.map(/*#__PURE__*/ _async_to_generator(function(textureOptions, idx) {
24612
- var e, source, image, texture;
26233
+ var e, source, id, image, texture;
24613
26234
  return __generator(this, function(_state) {
24614
26235
  switch(_state.label){
24615
26236
  case 0:
@@ -24633,7 +26254,7 @@ var seed = 1;
24633
26254
  ]);
24634
26255
  return [
24635
26256
  4,
24636
- deserializeMipmapTexture(textureOptions, bins, engine, jsonScene.bins)
26257
+ deserializeMipmapTexture(textureOptions, bins, _this.assets, jsonScene.bins)
24637
26258
  ];
24638
26259
  case 2:
24639
26260
  return [
@@ -24644,12 +26265,12 @@ var seed = 1;
24644
26265
  e = _state.sent();
24645
26266
  throw new Error("Load texture " + idx + " fails, error message: " + e + ".");
24646
26267
  case 4:
24647
- source = textureOptions.source;
26268
+ source = textureOptions.source, id = textureOptions.id;
24648
26269
  if (!isObject(source)) return [
24649
26270
  3,
24650
26271
  5
24651
26272
  ];
24652
- image = engine.assetLoader.loadGUID(source.id).data;
26273
+ image = _this.assets[source.id];
24653
26274
  return [
24654
26275
  3,
24655
26276
  7
@@ -24668,9 +26289,7 @@ var seed = 1;
24668
26289
  _state.label = 7;
24669
26290
  case 7:
24670
26291
  if (image) {
24671
- texture = createTextureOptionsBySource(image, _this.assets[idx]);
24672
- texture.id = textureOptions.id;
24673
- texture.dataType = DataType.Texture;
26292
+ texture = createTextureOptionsBySource(image, _this.assets[idx], id);
24674
26293
  return [
24675
26294
  2,
24676
26295
  texture.sourceType === TextureSourceType.compressed ? texture : _extends({}, texture, textureOptions)
@@ -24731,11 +26350,6 @@ var seed = 1;
24731
26350
  return window.clearTimeout(id);
24732
26351
  });
24733
26352
  }
24734
- for(var key in this.assets){
24735
- var _asset_dispose;
24736
- var asset = this.assets[key];
24737
- asset == null ? void 0 : (_asset_dispose = asset.dispose) == null ? void 0 : _asset_dispose.call(asset);
24738
- }
24739
26353
  this.assets = {};
24740
26354
  this.timers = [];
24741
26355
  };
@@ -24744,55 +26358,44 @@ var seed = 1;
24744
26358
  /**
24745
26359
  * 自定义文本缓存,随页面销毁而销毁
24746
26360
  */ AssetManager.fonts = new Set();
24747
- function fixOldImageUsage(usedImages, compositions, imgUsage, images, renderLevel) {
24748
- for(var i = 0; i < compositions.length; i++){
24749
- var id = compositions[i].id;
24750
- var ids = imgUsage[id];
24751
- if (ids) {
24752
- for(var j = 0; j < ids.length; j++){
24753
- var id1 = ids[j];
24754
- var tag = images[id1].renderLevel;
24755
- if (passRenderLevel(tag, renderLevel)) {
24756
- usedImages[id1] = true;
24757
- }
24758
- }
24759
- }
24760
- }
24761
- }
24762
- function createTextureOptionsBySource(image, sourceFrom) {
26361
+ function createTextureOptionsBySource(image, sourceFrom, id) {
26362
+ var options = {
26363
+ id: id,
26364
+ dataType: DataType.Texture
26365
+ };
24763
26366
  if (_instanceof1(image, Texture)) {
24764
- return image.source;
26367
+ return _extends({}, image.source, options);
24765
26368
  } else if (_instanceof1(image, HTMLImageElement) || isCanvas(image)) {
24766
- return {
26369
+ return _extends({
24767
26370
  image: image,
24768
26371
  sourceType: TextureSourceType.image,
24769
26372
  sourceFrom: sourceFrom,
24770
26373
  keepImageSource: true,
24771
26374
  minFilter: glContext.LINEAR,
24772
26375
  magFilter: glContext.LINEAR
24773
- };
26376
+ }, options);
24774
26377
  } else if (_instanceof1(image, HTMLVideoElement)) {
24775
26378
  // 视频
24776
- return {
26379
+ return _extends({
24777
26380
  sourceType: TextureSourceType.video,
24778
26381
  video: image,
24779
26382
  minFilter: glContext.LINEAR,
24780
26383
  magFilter: glContext.LINEAR
24781
- };
26384
+ }, options);
24782
26385
  } else if (_instanceof1(image, ArrayBuffer)) {
24783
26386
  // 压缩纹理
24784
26387
  return _extends({}, getKTXTextureOptions(image), {
24785
26388
  sourceFrom: sourceFrom
24786
- });
26389
+ }, options);
24787
26390
  } else if ("width" in image && "height" in image && "data" in image) {
24788
- return {
26391
+ return _extends({
24789
26392
  sourceType: TextureSourceType.data,
24790
26393
  data: image,
24791
26394
  wrapS: glContext.CLAMP_TO_EDGE,
24792
26395
  wrapT: glContext.CLAMP_TO_EDGE,
24793
26396
  minFilter: glContext.NEAREST,
24794
26397
  magFilter: glContext.NEAREST
24795
- };
26398
+ }, options);
24796
26399
  }
24797
26400
  throw new Error("Invalid texture options.");
24798
26401
  }
@@ -25096,11 +26699,12 @@ var listOrder = 0;
25096
26699
  function CompositionSourceManager(scene, engine) {
25097
26700
  this.refCompositions = new Map();
25098
26701
  this.refCompositionProps = new Map();
26702
+ this.imgUsage = {};
25099
26703
  this.mask = 0;
25100
26704
  this.engine = engine;
25101
26705
  // 资源
25102
26706
  var jsonScene = scene.jsonScene, renderLevel = scene.renderLevel, textureOptions = scene.textureOptions, pluginSystem = scene.pluginSystem, totalTime = scene.totalTime;
25103
- var compositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, compositionId = jsonScene.compositionId;
26707
+ var compositions = jsonScene.compositions, compositionId = jsonScene.compositionId;
25104
26708
  if (!textureOptions) {
25105
26709
  throw new Error("scene.textures expected.");
25106
26710
  }
@@ -25120,7 +26724,6 @@ var listOrder = 0;
25120
26724
  this.renderLevel = renderLevel;
25121
26725
  this.pluginSystem = pluginSystem;
25122
26726
  this.totalTime = totalTime != null ? totalTime : 0;
25123
- this.imgUsage = imgUsage != null ? imgUsage : {};
25124
26727
  this.textures = cachedTextures;
25125
26728
  listOrder = 0;
25126
26729
  this.sourceContent = this.getContent(this.composition);
@@ -25141,11 +26744,12 @@ var listOrder = 0;
25141
26744
  });
25142
26745
  };
25143
26746
  _proto.assembleItems = function assembleItems(composition) {
26747
+ var _this_jsonScene;
25144
26748
  var items = [];
25145
- this.mask++;
25146
26749
  var componentMap = {};
25147
- //@ts-expect-error
25148
- for(var _iterator = _create_for_of_iterator_helper_loose(this.jsonScene.components), _step; !(_step = _iterator()).done;){
26750
+ this.mask++;
26751
+ var _this_jsonScene_components;
26752
+ 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;){
25149
26753
  var component = _step.value;
25150
26754
  componentMap[component.id] = component;
25151
26755
  }
@@ -25182,19 +26786,24 @@ var listOrder = 0;
25182
26786
  _proto.preProcessItemContent = function preProcessItemContent(renderContent) {
25183
26787
  if (renderContent.renderer) {
25184
26788
  renderContent.renderer = this.changeTex(renderContent.renderer);
25185
- if (!renderContent.renderer.mask) {
26789
+ if (!("mask" in renderContent.renderer)) {
25186
26790
  this.processMask(renderContent.renderer);
25187
26791
  }
25188
- var split = renderContent.splits && !renderContent.textureSheetAnimation && renderContent.splits[0];
25189
- if (Number.isInteger(renderContent.renderer.shape)) {
26792
+ var split = renderContent.splits && !renderContent.textureSheetAnimation ? renderContent.splits[0] : undefined;
26793
+ var shape = renderContent.renderer.shape;
26794
+ var shapeData;
26795
+ if (Number.isInteger(shape)) {
25190
26796
  var _this_jsonScene;
25191
- // TODO: scene.shapes 类型问题?
25192
- renderContent.renderer.shape = getGeometryByShape((_this_jsonScene = this.jsonScene) == null ? void 0 : _this_jsonScene.shapes[renderContent.renderer.shape], split);
25193
- } else if (renderContent.renderer.shape && isObject(renderContent.renderer.shape)) {
25194
- renderContent.renderer.shape = getGeometryByShape(renderContent.renderer.shape, split);
26797
+ shapeData = (_this_jsonScene = this.jsonScene) == null ? void 0 : _this_jsonScene.shapes[shape];
26798
+ } else {
26799
+ shapeData = shape;
26800
+ }
26801
+ if (shapeData !== undefined) {
26802
+ // @ts-expect-error 类型转换问题
26803
+ renderContent.renderer.shape = getGeometryByShape(shapeData, split);
25195
26804
  }
25196
26805
  }
25197
- if (renderContent.trails) {
26806
+ if ("trails" in renderContent && renderContent.trails !== undefined) {
25198
26807
  renderContent.trails = this.changeTex(renderContent.trails);
25199
26808
  }
25200
26809
  };
@@ -25202,22 +26811,17 @@ var listOrder = 0;
25202
26811
  if (!renderer.texture) {
25203
26812
  return renderer;
25204
26813
  }
25205
- //@ts-expect-error
25206
26814
  var texIdx = renderer.texture.id;
25207
26815
  if (texIdx !== undefined) {
25208
- //@ts-expect-error
25209
- this.addTextureUsage(texIdx) || texIdx;
26816
+ this.addTextureUsage(texIdx);
25210
26817
  }
25211
26818
  return renderer;
25212
26819
  };
25213
- _proto.addTextureUsage = function addTextureUsage(texIdx) {
25214
- var texId = texIdx;
26820
+ _proto.addTextureUsage = function addTextureUsage(texId) {
25215
26821
  var _this_imgUsage;
25216
- // FIXME: imageUsage 取自 scene.imgUsage,类型为 Record<string, number[]>,这里给的 number,类型对不上
25217
26822
  var imageUsage = (_this_imgUsage = this.imgUsage) != null ? _this_imgUsage : {};
25218
26823
  if (texId && imageUsage) {
25219
- // eslint-disable-next-line no-prototype-builtins
25220
- if (!imageUsage.hasOwnProperty(texId)) {
26824
+ if (!Object.prototype.hasOwnProperty.call(imageUsage, texId)) {
25221
26825
  imageUsage[texId] = 0;
25222
26826
  }
25223
26827
  imageUsage[texId]++;
@@ -25388,7 +26992,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25388
26992
  _this.lastVideoUpdateTime = 0;
25389
26993
  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;
25390
26994
  _this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
25391
- scene.jsonScene.imgUsage = undefined;
25392
26995
  if (reusable) {
25393
26996
  _this.keepResource = true;
25394
26997
  scene.textures = undefined;
@@ -25407,24 +27010,23 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25407
27010
  _this.rootComposition.data = sourceContent;
25408
27011
  _this.rootComposition.item = _this.rootItem;
25409
27012
  _this.rootItem.components.push(_this.rootComposition);
25410
- var imageUsage = !reusable && imgUsage;
25411
27013
  _this.width = width;
25412
27014
  _this.height = height;
25413
27015
  _this.renderOrder = baseRenderOrder;
25414
27016
  _this.id = sourceContent.id;
25415
27017
  _this.renderer = renderer;
25416
- _this.texInfo = imageUsage != null ? imageUsage : {};
27018
+ _this.texInfo = !reusable ? imgUsage : {};
25417
27019
  _this.event = event;
25418
- var _scene_startTime, _scene_timeInfos_asyncCompile;
27020
+ var _scene_startTime;
25419
27021
  _this.statistic = {
25420
- loadTime: totalTime != null ? totalTime : 0,
25421
27022
  loadStart: (_scene_startTime = scene.startTime) != null ? _scene_startTime : 0,
25422
- firstFrameTime: 0,
25423
- precompileTime: (_scene_timeInfos_asyncCompile = scene.timeInfos["asyncCompile"]) != null ? _scene_timeInfos_asyncCompile : scene.timeInfos["syncCompile"]
27023
+ loadTime: totalTime != null ? totalTime : 0,
27024
+ compileTime: 0,
27025
+ firstFrameTime: 0
25424
27026
  };
25425
27027
  _this.reusable = reusable;
25426
27028
  _this.speed = speed;
25427
- _this.autoRefTex = !_this.keepResource && imageUsage && _this.rootItem.endBehavior !== EndBehavior.restart;
27029
+ _this.autoRefTex = !_this.keepResource && _this.texInfo && _this.rootItem.endBehavior !== EndBehavior.restart;
25428
27030
  _this.name = sourceContent.name;
25429
27031
  _this.pluginSystem = pluginSystem;
25430
27032
  _this.pluginSystem.initializeComposition(_assert_this_initialized(_this), scene);
@@ -25433,7 +27035,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25433
27035
  }));
25434
27036
  _this.url = scene.url;
25435
27037
  _this.assigned = true;
25436
- _this.globalTime = 0;
25437
27038
  _this.interactive = true;
25438
27039
  _this.handleItemMessage = handleItemMessage;
25439
27040
  _this.createRenderFrame();
@@ -25596,8 +27197,8 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25596
27197
  * 重置状态函数
25597
27198
  */ _proto.reset = function reset() {
25598
27199
  this.rendererOptions = null;
25599
- this.globalTime = 0;
25600
27200
  this.rootItem.ended = false;
27201
+ this.rootComposition.time = 0;
25601
27202
  this.pluginSystem.resetComposition(this, this.renderFrame);
25602
27203
  };
25603
27204
  _proto.prepareRender = function prepareRender() {
@@ -25634,9 +27235,8 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25634
27235
  if (!this.assigned || this.paused) {
25635
27236
  return;
25636
27237
  }
25637
- var time = this.getUpdateTime(deltaTime * this.speed);
25638
- this.globalTime += time;
25639
- this.updateRootComposition();
27238
+ var dt = this.getUpdateTime(deltaTime * this.speed);
27239
+ this.updateRootComposition(dt / 1000);
25640
27240
  this.updateVideo();
25641
27241
  // 更新 model-tree-plugin
25642
27242
  this.updatePluginLoaders(deltaTime);
@@ -25645,8 +27245,8 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25645
27245
  this.callAwake(this.rootItem);
25646
27246
  this.rootItem.beginPlay();
25647
27247
  }
25648
- this.sceneTicking.update.tick(time);
25649
- this.sceneTicking.lateUpdate.tick(time);
27248
+ this.sceneTicking.update.tick(dt);
27249
+ this.sceneTicking.lateUpdate.tick(dt);
25650
27250
  this.updateCamera();
25651
27251
  this.prepareRender();
25652
27252
  if (this.shouldDispose()) {
@@ -25787,9 +27387,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25787
27387
  };
25788
27388
  /**
25789
27389
  * 更新主合成组件
25790
- */ _proto.updateRootComposition = function updateRootComposition() {
27390
+ */ _proto.updateRootComposition = function updateRootComposition(deltaTime) {
25791
27391
  if (this.rootComposition.isActiveAndEnabled) {
25792
- var localTime = this.toLocalTime(this.globalTime / 1000);
27392
+ var localTime = this.toLocalTime(this.time + deltaTime);
25793
27393
  this.rootComposition.time = localTime;
25794
27394
  }
25795
27395
  };
@@ -28123,7 +29723,7 @@ __decorate([
28123
29723
  serialize()
28124
29724
  ], BinaryAsset.prototype, "buffer", void 0);
28125
29725
  BinaryAsset = __decorate([
28126
- effectsClass("BinaryAsset")
29726
+ effectsClass(DataType.BinaryAsset)
28127
29727
  ], BinaryAsset);
28128
29728
 
28129
29729
  registerPlugin("camera", CameraVFXItemLoader, VFXItem, true);
@@ -28132,8 +29732,8 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
28132
29732
  registerPlugin("particle", ParticleLoader, VFXItem, true);
28133
29733
  registerPlugin("cal", CalculateLoader, VFXItem, true);
28134
29734
  registerPlugin("interact", InteractLoader, VFXItem, true);
28135
- var version = "2.1.0-alpha.4";
29735
+ var version = "2.1.0-alpha.6";
28136
29736
  logger.info("Core version: " + version + ".");
28137
29737
 
28138
- export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
29738
+ export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, ComponentShapeType, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, ShapeConnectType, ShapePointType, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
28139
29739
  //# sourceMappingURL=index.mjs.map