@galacean/effects-threejs 2.0.0-alpha.27 → 2.0.0-alpha.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.0.0-alpha.27
6
+ * Version: v2.0.0-alpha.29
7
7
  */
8
8
 
9
9
  'use strict';
@@ -466,16 +466,27 @@ function isIOS() {
466
466
  // real ios device not in simulator
467
467
  return !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
468
468
  }
469
+ function isIOSByUA() {
470
+ var str = navigator.userAgent.toLowerCase();
471
+ var ver = str.match(/cpu (iphone )?os (.*?) like mac os/);
472
+ return ver ? parseInt(ver[2], 10) : 0;
473
+ }
469
474
  function isAndroid() {
470
475
  return /\b[Aa]ndroid\b/.test(navigator.userAgent);
471
476
  }
472
477
  function isSimulatorCellPhone() {
473
478
  return isAndroid() || /\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent);
474
479
  }
480
+ function isMiniProgram() {
481
+ return isAlipayMiniApp() || isWechatMiniApp();
482
+ }
475
483
  function isAlipayMiniApp() {
476
484
  var _my;
477
485
  return typeof my !== "undefined" && ((_my = my) == null ? void 0 : _my.renderTarget) === "web";
478
486
  }
487
+ function isWechatMiniApp() {
488
+ return window.__wxjs_environment === "miniprogram";
489
+ }
479
490
 
480
491
  function imageDataFromColor(value) {
481
492
  if (isString(value)) {
@@ -4613,9 +4624,6 @@ function getDirectStore(target) {
4613
4624
  };
4614
4625
  return EffectsObject;
4615
4626
  }();
4616
- __decorate([
4617
- serialize()
4618
- ], EffectsObject.prototype, "guid", void 0);
4619
4627
 
4620
4628
  /**
4621
4629
  * @since 2.0.0
@@ -4893,8 +4901,8 @@ exports.CameraController = /*#__PURE__*/ function(ItemBehaviour) {
4893
4901
  camera.far = this.options.far;
4894
4902
  camera.fov = this.options.fov;
4895
4903
  camera.clipMode = this.options.clipMode;
4896
- camera.position = this.transform.position;
4897
- camera.rotation = this.transform.rotation;
4904
+ camera.position = this.transform.getWorldPosition();
4905
+ camera.rotation = this.transform.getWorldRotation();
4898
4906
  }
4899
4907
  };
4900
4908
  _proto.fromData = function fromData(data) {
@@ -7879,6 +7887,7 @@ exports.TextureSourceType = void 0;
7879
7887
  return Downloader;
7880
7888
  }();
7881
7889
  var webPFailed = false;
7890
+ var avifFailed = false;
7882
7891
  /**
7883
7892
  * 异步加载一个 WebP 图片文件,如果不支持 WebP,则加载 PNG 图片文件
7884
7893
  * @param png - PNG 图片文件的 URL
@@ -7954,6 +7963,81 @@ function _loadWebPOptional() {
7954
7963
  });
7955
7964
  return _loadWebPOptional.apply(this, arguments);
7956
7965
  }
7966
+ /**
7967
+ * 异步加载一个 AVIF 图片文件,如果不支持 AVIF,则加载 PNG 图片文件
7968
+ * @param png - PNG 图片文件的 URL
7969
+ * @param avif - AVIF 图片文件的 URL
7970
+ */ function loadAVIFOptional(png, avif) {
7971
+ return _loadAVIFOptional.apply(this, arguments);
7972
+ }
7973
+ function _loadAVIFOptional() {
7974
+ _loadAVIFOptional = _async_to_generator(function(png, avif) {
7975
+ var image, image1, image2;
7976
+ return __generator(this, function(_state) {
7977
+ switch(_state.label){
7978
+ case 0:
7979
+ if (!(avifFailed || !avif)) return [
7980
+ 3,
7981
+ 2
7982
+ ];
7983
+ return [
7984
+ 4,
7985
+ loadImage(png)
7986
+ ];
7987
+ case 1:
7988
+ image = _state.sent();
7989
+ return [
7990
+ 2,
7991
+ {
7992
+ image: image,
7993
+ url: png
7994
+ }
7995
+ ];
7996
+ case 2:
7997
+ _state.trys.push([
7998
+ 2,
7999
+ 4,
8000
+ ,
8001
+ 6
8002
+ ]);
8003
+ return [
8004
+ 4,
8005
+ loadImage(avif)
8006
+ ];
8007
+ case 3:
8008
+ image1 = _state.sent();
8009
+ return [
8010
+ 2,
8011
+ {
8012
+ image: image1,
8013
+ url: avif
8014
+ }
8015
+ ];
8016
+ case 4:
8017
+ _state.sent();
8018
+ avifFailed = true;
8019
+ return [
8020
+ 4,
8021
+ loadImage(png)
8022
+ ];
8023
+ case 5:
8024
+ image2 = _state.sent();
8025
+ return [
8026
+ 2,
8027
+ {
8028
+ image: image2,
8029
+ url: png
8030
+ }
8031
+ ];
8032
+ case 6:
8033
+ return [
8034
+ 2
8035
+ ];
8036
+ }
8037
+ });
8038
+ });
8039
+ return _loadAVIFOptional.apply(this, arguments);
8040
+ }
7957
8041
  /**
7958
8042
  * 异步加载一个图片文件
7959
8043
  * @param source - 图片文件的 URL、Blob 或 HTMLImageElement 对象
@@ -8155,31 +8239,35 @@ function deserializeMipmapTexture(textureOptions, bins, engine) {
8155
8239
  }
8156
8240
  function _deserializeMipmapTexture() {
8157
8241
  _deserializeMipmapTexture = _async_to_generator(function(textureOptions, bins, engine, files) {
8158
- var mipmaps, target, loadedMipmaps, _iterator, _step, level, newLevel, _iterator1, _step1, face, loadedImageAsset, mipmaps1, target1, jobs, loadedMipmaps1, bin;
8242
+ var mipmaps, target, jobs, loadedMipmaps, mipmaps1, target1, jobs1, loadedMipmaps1, bin;
8159
8243
  return __generator(this, function(_state) {
8160
8244
  switch(_state.label){
8161
8245
  case 0:
8162
8246
  if (files === void 0) files = [];
8163
8247
  if (!(textureOptions.target === 34067)) return [
8164
8248
  3,
8165
- 1
8249
+ 2
8166
8250
  ];
8167
8251
  mipmaps = textureOptions.mipmaps, target = textureOptions.target;
8168
- // const jobs = mipmaps.map(mipmap => Promise.all(mipmap.map(pointer => loadMipmapImage(pointer, bins))));
8169
- loadedMipmaps = [];
8170
- for(_iterator = _create_for_of_iterator_helper_loose(mipmaps); !(_step = _iterator()).done;){
8171
- level = _step.value;
8172
- newLevel = [];
8173
- for(_iterator1 = _create_for_of_iterator_helper_loose(level); !(_step1 = _iterator1()).done;){
8174
- face = _step1.value;
8252
+ jobs = mipmaps.map(function(mipmap) {
8253
+ return Promise.all(mipmap.map(function(pointer) {
8175
8254
  // @ts-expect-error
8176
- loadedImageAsset = engine.assetLoader.loadGUID(face.id);
8177
- // @ts-expect-error
8178
- newLevel.push(loadedImageAsset.data);
8179
- }
8180
- loadedMipmaps.push(newLevel);
8181
- }
8182
- // const bin = files[mipmaps[0][0][1][0]].url;
8255
+ if (pointer.id) {
8256
+ // @ts-expect-error
8257
+ var loadedImageAsset = engine.assetLoader.loadGUID(pointer.id);
8258
+ // @ts-expect-error
8259
+ return loadedImageAsset.data;
8260
+ } else {
8261
+ return loadMipmapImage(pointer, bins);
8262
+ }
8263
+ }));
8264
+ });
8265
+ return [
8266
+ 4,
8267
+ Promise.all(jobs)
8268
+ ];
8269
+ case 1:
8270
+ loadedMipmaps = _state.sent();
8183
8271
  return [
8184
8272
  2,
8185
8273
  _extends({
@@ -8193,17 +8281,17 @@ function _deserializeMipmapTexture() {
8193
8281
  }
8194
8282
  })
8195
8283
  ];
8196
- case 1:
8284
+ case 2:
8197
8285
  // TODO: 补充测试用例
8198
8286
  mipmaps1 = textureOptions.mipmaps, target1 = textureOptions.target;
8199
- jobs = mipmaps1.map(function(pointer) {
8287
+ jobs1 = mipmaps1.map(function(pointer) {
8200
8288
  return loadMipmapImage(pointer, bins);
8201
8289
  });
8202
8290
  return [
8203
8291
  4,
8204
- Promise.all(jobs)
8292
+ Promise.all(jobs1)
8205
8293
  ];
8206
- case 2:
8294
+ case 3:
8207
8295
  loadedMipmaps1 = _state.sent();
8208
8296
  bin = files[mipmaps1[0][1][0]].url;
8209
8297
  return [
@@ -8226,7 +8314,7 @@ function _deserializeMipmapTexture() {
8226
8314
  }
8227
8315
  })
8228
8316
  ];
8229
- case 3:
8317
+ case 4:
8230
8318
  return [
8231
8319
  2
8232
8320
  ];
@@ -11581,7 +11669,7 @@ var valueDefine = "#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValu
11581
11669
 
11582
11670
  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.;}";
11583
11671
 
11584
- 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));}gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),1.0);}";
11672
+ 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);}";
11585
11673
 
11586
11674
  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);}";
11587
11675
 
@@ -11591,7 +11679,7 @@ var gaussianDownVFrag = "precision highp float;varying vec2 uv;uniform sampler2D
11591
11679
 
11592
11680
  var gaussianUpFrag = "precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform sampler2D _GaussianDownTex;uniform vec2 _GaussianDownTextureSize;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=1;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(){vec3 lowResColor=GaussNxN(_MainTex,uv,0.5/_GaussianDownTextureSize,1.0);vec3 highResColor=GaussNxN(_GaussianDownTex,uv,1.0/_GaussianDownTextureSize,1.0);vec3 color=mix(highResColor,lowResColor,0.7);gl_FragColor=vec4(color,1.0);}";
11593
11681
 
11594
- var thresholdFrag = "precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainColor=texture2D(_MainTex,uv);mainColor.rgb=pow(mainColor.rgb,vec3(2.2));float brightness=max(mainColor.r,max(mainColor.g,mainColor.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainColor.rgb*=w;gl_FragColor=vec4(mainColor.rgb,1.0);}";
11682
+ var thresholdFrag = "precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainTex=texture2D(_MainTex,uv);mainTex.rgb=pow(mainTex.rgb,vec3(2.2));float brightness=max(mainTex.r,max(mainTex.g,mainTex.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainTex.rgb*=w;mainTex.rgb*=mainTex.a;gl_FragColor=vec4(mainTex.rgb,1.0);}";
11595
11683
 
11596
11684
  // Bloom 阈值 Pass
11597
11685
  var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
@@ -11869,7 +11957,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
11869
11957
  this.screenMesh.material.setFloat("_Brightness", brightness);
11870
11958
  this.screenMesh.material.setFloat("_Saturation", saturation);
11871
11959
  this.screenMesh.material.setFloat("_Contrast", contrast);
11872
- this.screenMesh.material.setInt("_UseBloom", useBloom);
11960
+ this.screenMesh.material.setInt("_UseBloom", Number(useBloom));
11873
11961
  if (useBloom) {
11874
11962
  this.screenMesh.material.setTexture("_GaussianTex", this.mainTexture);
11875
11963
  this.screenMesh.material.setFloat("_BloomIntensity", bloomIntensity);
@@ -11881,7 +11969,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
11881
11969
  this.screenMesh.material.setVector2("_VignetteCenter", new Vector2(0.5, 0.5));
11882
11970
  this.screenMesh.material.setVector3("_VignetteColor", new Vector3(0.0, 0.0, 0.0));
11883
11971
  }
11884
- this.screenMesh.material.setInt("_UseToneMapping", useToneMapping);
11972
+ this.screenMesh.material.setInt("_UseToneMapping", Number(useToneMapping));
11885
11973
  renderer.renderMeshes([
11886
11974
  this.screenMesh
11887
11975
  ]);
@@ -11889,29 +11977,6 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
11889
11977
  return ToneMappingPass;
11890
11978
  }(RenderPass);
11891
11979
 
11892
- /**
11893
- * 后处理配置
11894
- */ var defaultGlobalVolume = {
11895
- useHDR: false,
11896
- usePostProcessing: false,
11897
- /***** Material Uniform *****/ // Bloom
11898
- useBloom: 1.0,
11899
- threshold: 1.0,
11900
- bloomIntensity: 1.0,
11901
- // ColorAdjustments
11902
- brightness: 1.0,
11903
- saturation: 1.0,
11904
- contrast: 1.0,
11905
- // Vignette
11906
- // vignetteColor: new math.Color(0, 0, 0, 1),
11907
- // vignetteCenter: new math.Vector2(0.5, 0.5),
11908
- vignetteIntensity: 0.2,
11909
- vignetteSmoothness: 0.4,
11910
- vignetteRoundness: 1.0,
11911
- // ToneMapping
11912
- useToneMapping: 1
11913
- };
11914
-
11915
11980
  var RENDER_PASS_NAME_PREFIX = "_effects_default_";
11916
11981
  var seed$6 = 1;
11917
11982
  /**
@@ -11935,7 +12000,7 @@ var seed$6 = 1;
11935
12000
  } : _options_clearAction;
11936
12001
  var engine = renderer.engine;
11937
12002
  if (globalVolume) {
11938
- this.globalVolume = _extends({}, defaultGlobalVolume, globalVolume);
12003
+ this.globalVolume = globalVolume;
11939
12004
  }
11940
12005
  this.globalUniforms = new GlobalUniforms();
11941
12006
  var attachments = []; //渲染场景物体Pass的RT
@@ -11978,20 +12043,36 @@ var seed$6 = 1;
11978
12043
  ];
11979
12044
  this.setRenderPasses(renderPasses);
11980
12045
  if (this.globalVolume) {
11981
- var useBloom = this.globalVolume.useBloom;
11982
12046
  var sceneTextureHandle = new RenderTargetHandle(engine); //保存后处理前的屏幕图像
11983
- if (useBloom) {
11984
- var gaussianStep = 7; // 高斯模糊的迭代次数,次数越高模糊范围越大
11985
- var viewport = [
11986
- 0,
11987
- 0,
11988
- this.renderer.getWidth() / 2,
11989
- this.renderer.getHeight() / 2
11990
- ];
11991
- var gaussianDownResults = new Array(gaussianStep); //存放多个高斯Pass的模糊结果,用于Bloom
11992
- var textureType1 = this.globalVolume.useHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
11993
- var bloomThresholdPass = new BloomThresholdPass(renderer, {
11994
- name: "BloomThresholdPass",
12047
+ var gaussianStep = 7; // 高斯模糊的迭代次数,次数越高模糊范围越大
12048
+ var viewport = [
12049
+ 0,
12050
+ 0,
12051
+ this.renderer.getWidth() / 2,
12052
+ this.renderer.getHeight() / 2
12053
+ ];
12054
+ var gaussianDownResults = new Array(gaussianStep); //存放多个高斯Pass的模糊结果,用于Bloom
12055
+ var textureType1 = this.globalVolume.useHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
12056
+ var bloomThresholdPass = new BloomThresholdPass(renderer, {
12057
+ name: "BloomThresholdPass",
12058
+ attachments: [
12059
+ {
12060
+ texture: {
12061
+ format: glContext.RGBA,
12062
+ type: textureType1,
12063
+ minFilter: glContext.LINEAR,
12064
+ magFilter: glContext.LINEAR
12065
+ }
12066
+ }
12067
+ ]
12068
+ });
12069
+ bloomThresholdPass.sceneTextureHandle = sceneTextureHandle;
12070
+ this.addRenderPass(bloomThresholdPass);
12071
+ for(var i = 0; i < gaussianStep; i++){
12072
+ gaussianDownResults[i] = new RenderTargetHandle(engine);
12073
+ var gaussianDownHPass = new HQGaussianDownSamplePass(renderer, "H", {
12074
+ name: "GaussianDownPassH" + i,
12075
+ viewport: viewport,
11995
12076
  attachments: [
11996
12077
  {
11997
12078
  texture: {
@@ -12003,74 +12084,50 @@ var seed$6 = 1;
12003
12084
  }
12004
12085
  ]
12005
12086
  });
12006
- bloomThresholdPass.sceneTextureHandle = sceneTextureHandle;
12007
- this.addRenderPass(bloomThresholdPass);
12008
- for(var i = 0; i < gaussianStep; i++){
12009
- gaussianDownResults[i] = new RenderTargetHandle(engine);
12010
- var gaussianDownHPass = new HQGaussianDownSamplePass(renderer, "H", {
12011
- name: "GaussianDownPassH" + i,
12012
- viewport: viewport,
12013
- attachments: [
12014
- {
12015
- texture: {
12016
- format: glContext.RGBA,
12017
- type: textureType1,
12018
- minFilter: glContext.LINEAR,
12019
- magFilter: glContext.LINEAR
12020
- }
12021
- }
12022
- ]
12023
- });
12024
- var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", {
12025
- name: "GaussianDownPassV" + i,
12026
- viewport: viewport,
12027
- attachments: [
12028
- {
12029
- texture: {
12030
- format: glContext.RGBA,
12031
- type: textureType1,
12032
- minFilter: glContext.LINEAR,
12033
- magFilter: glContext.LINEAR
12034
- }
12087
+ var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", {
12088
+ name: "GaussianDownPassV" + i,
12089
+ viewport: viewport,
12090
+ attachments: [
12091
+ {
12092
+ texture: {
12093
+ format: glContext.RGBA,
12094
+ type: textureType1,
12095
+ minFilter: glContext.LINEAR,
12096
+ magFilter: glContext.LINEAR
12035
12097
  }
12036
- ]
12037
- });
12038
- gaussianDownVPass.gaussianResult = gaussianDownResults[i];
12039
- this.addRenderPass(gaussianDownHPass);
12040
- this.addRenderPass(gaussianDownVPass);
12041
- viewport[2] /= 2;
12042
- viewport[3] /= 2;
12043
- // TODO 限制最大迭代
12044
- }
12045
- viewport[2] *= 4;
12046
- viewport[3] *= 4;
12047
- for(var i1 = 0; i1 < gaussianStep - 1; i1++){
12048
- var gaussianUpPass = new HQGaussianUpSamplePass(renderer, {
12049
- name: "GaussianUpPass" + i1,
12050
- viewport: viewport,
12051
- attachments: [
12052
- {
12053
- texture: {
12054
- format: glContext.RGBA,
12055
- type: textureType1,
12056
- minFilter: glContext.LINEAR,
12057
- magFilter: glContext.LINEAR
12058
- }
12098
+ }
12099
+ ]
12100
+ });
12101
+ gaussianDownVPass.gaussianResult = gaussianDownResults[i];
12102
+ this.addRenderPass(gaussianDownHPass);
12103
+ this.addRenderPass(gaussianDownVPass);
12104
+ viewport[2] /= 2;
12105
+ viewport[3] /= 2;
12106
+ // TODO 限制最大迭代
12107
+ }
12108
+ viewport[2] *= 4;
12109
+ viewport[3] *= 4;
12110
+ for(var i1 = 0; i1 < gaussianStep - 1; i1++){
12111
+ var gaussianUpPass = new HQGaussianUpSamplePass(renderer, {
12112
+ name: "GaussianUpPass" + i1,
12113
+ viewport: viewport,
12114
+ attachments: [
12115
+ {
12116
+ texture: {
12117
+ format: glContext.RGBA,
12118
+ type: textureType1,
12119
+ minFilter: glContext.LINEAR,
12120
+ magFilter: glContext.LINEAR
12059
12121
  }
12060
- ]
12061
- });
12062
- gaussianUpPass.gaussianDownSampleResult = gaussianDownResults[gaussianStep - 2 - i1];
12063
- this.addRenderPass(gaussianUpPass);
12064
- viewport[2] *= 2;
12065
- viewport[3] *= 2;
12066
- }
12067
- }
12068
- var postProcessPass;
12069
- if (useBloom) {
12070
- postProcessPass = new ToneMappingPass(renderer, sceneTextureHandle);
12071
- } else {
12072
- postProcessPass = new ToneMappingPass(renderer);
12122
+ }
12123
+ ]
12124
+ });
12125
+ gaussianUpPass.gaussianDownSampleResult = gaussianDownResults[gaussianStep - 2 - i1];
12126
+ this.addRenderPass(gaussianUpPass);
12127
+ viewport[2] *= 2;
12128
+ viewport[3] *= 2;
12073
12129
  }
12130
+ var postProcessPass = new ToneMappingPass(renderer, sceneTextureHandle);
12074
12131
  this.addRenderPass(postProcessPass);
12075
12132
  }
12076
12133
  this.semantics = new SemanticMap(options.semantics);
@@ -12980,6 +13037,28 @@ var Renderer = /*#__PURE__*/ function() {
12980
13037
  return Renderer;
12981
13038
  }();
12982
13039
 
13040
+ /**
13041
+ * 后处理配置
13042
+ */ var defaultGlobalVolume = {
13043
+ useHDR: false,
13044
+ /***** Material Uniform *****/ // Bloom
13045
+ useBloom: true,
13046
+ threshold: 1.0,
13047
+ bloomIntensity: 1.0,
13048
+ // ColorAdjustments
13049
+ brightness: 1.0,
13050
+ saturation: 1.0,
13051
+ contrast: 1.0,
13052
+ // Vignette
13053
+ // vignetteColor: new math.Color(0, 0, 0, 1),
13054
+ // vignetteCenter: new math.Vector2(0.5, 0.5),
13055
+ vignetteIntensity: 0.2,
13056
+ vignetteSmoothness: 0.4,
13057
+ vignetteRoundness: 1.0,
13058
+ // ToneMapping
13059
+ useToneMapping: true
13060
+ };
13061
+
12983
13062
  var vertex = "\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n#ifdef ENV_EDITOR\n uniform vec4 uEditorTransform;\n#endif\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n #ifdef ENV_EDITOR\n gl_Position = vec4(gl_Position.xy * uEditorTransform.xy + uEditorTransform.zw * gl_Position.w, gl_Position.zw);\n #endif\n}\n";
12984
13063
  var fragment = "\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor;\n}\n";
12985
13064
  var seed$5 = 1;
@@ -13107,6 +13186,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13107
13186
  1
13108
13187
  ];
13109
13188
  /** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
13189
+ _this.hasBeenAddedToComposition = false;
13110
13190
  _this.getHitTestParams = function(force) {
13111
13191
  if (!_this.clickable) {
13112
13192
  return;
@@ -13137,10 +13217,6 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13137
13217
  this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
13138
13218
  }
13139
13219
  }
13140
- composition.addInteractiveItem(this.item, options.type);
13141
- this.item.onEnd = function() {
13142
- return composition.removeInteractiveItem(_this.item, options.type);
13143
- };
13144
13220
  if (options.type === InteractType.DRAG) {
13145
13221
  if (env !== PLAYER_OPTIONS_ENV_EDITOR || options.enableInEditor) {
13146
13222
  composition.event && this.beginDragTarget(options, composition.event);
@@ -13151,10 +13227,25 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13151
13227
  this.materials = this.previewContent.mesh.materials;
13152
13228
  }
13153
13229
  this.item.getHitTestParams = this.getHitTestParams;
13230
+ this.item.onEnd = function() {
13231
+ if (_this.item && _this.item.composition) {
13232
+ var _this_previewContent;
13233
+ _this.item.composition.removeInteractiveItem(_this.item, _this.item.props.content.options.type);
13234
+ _this.clickable = false;
13235
+ _this.hasBeenAddedToComposition = false;
13236
+ (_this_previewContent = _this.previewContent) == null ? void 0 : _this_previewContent.mesh.dispose();
13237
+ _this.endDragTarget();
13238
+ }
13239
+ };
13154
13240
  };
13155
13241
  _proto.update = function update(dt) {
13156
13242
  var _this_previewContent;
13157
13243
  (_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
13244
+ if (!this.hasBeenAddedToComposition && this.item.composition) {
13245
+ var options = this.item.props.content.options;
13246
+ this.item.composition.addInteractiveItem(this.item, options.type);
13247
+ this.hasBeenAddedToComposition = true;
13248
+ }
13158
13249
  if (!this.dragEvent || !this.bouncingArg) {
13159
13250
  return;
13160
13251
  }
@@ -13174,15 +13265,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13174
13265
  this.previewContent.mesh.render(renderer);
13175
13266
  }
13176
13267
  };
13177
- _proto.onDestroy = function onDestroy() {
13178
- if (this.item && this.item.composition) {
13179
- var _this_previewContent;
13180
- this.item.composition.removeInteractiveItem(this.item, this.item.props.content.options.type);
13181
- this.clickable = false;
13182
- (_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.mesh.dispose();
13183
- this.endDragTarget();
13184
- }
13185
- };
13268
+ _proto.onDestroy = function onDestroy() {};
13186
13269
  _proto.endDragTarget = function endDragTarget() {
13187
13270
  // OVERRIDE
13188
13271
  };
@@ -13765,6 +13848,10 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
13765
13848
  }
13766
13849
  if (!this.spriteMaterial) {
13767
13850
  this.spriteMaterial = boundObject.getComponent(exports.SpriteComponent).material;
13851
+ var startColor = this.spriteMaterial.getVector4("_Color");
13852
+ if (startColor) {
13853
+ this.startColor = startColor.toArray();
13854
+ }
13768
13855
  }
13769
13856
  var colorInc = vecFill(tempColor, 1);
13770
13857
  var colorChanged;
@@ -13794,12 +13881,6 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
13794
13881
  this.colorOverLifetime = colorStopsFromGradient(colorOverLifetime.color[1]);
13795
13882
  }
13796
13883
  }
13797
- this.startColor = clipData.startColor || [
13798
- 1,
13799
- 1,
13800
- 1,
13801
- 1
13802
- ];
13803
13884
  return this;
13804
13885
  };
13805
13886
  return SpriteColorPlayable;
@@ -14107,7 +14188,7 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14107
14188
  var splits = item.splits, renderer = item.renderer, textureSheetAnimation = item.textureSheetAnimation;
14108
14189
  var sx = 1, sy = 1;
14109
14190
  if (renderer.shape) {
14110
- var _renderer_shape = renderer.shape, index = _renderer_shape.index, aPoint = _renderer_shape.aPoint;
14191
+ var _renderer_shape = renderer.shape, _renderer_shape_index = _renderer_shape.index, index = _renderer_shape_index === void 0 ? [] : _renderer_shape_index, _renderer_shape_aPoint = _renderer_shape.aPoint, aPoint = _renderer_shape_aPoint === void 0 ? [] : _renderer_shape_aPoint;
14111
14192
  var point = new Float32Array(aPoint);
14112
14193
  var position = [];
14113
14194
  var atlasOffset = [];
@@ -14878,8 +14959,7 @@ var RectangleEdge = /*#__PURE__*/ function() {
14878
14959
  }();
14879
14960
  var Edge = /*#__PURE__*/ function() {
14880
14961
  function Edge(args) {
14881
- // TODO: 为通过帧对比暂时使用老计算,修复粒子发射器直线宽度问题下面一行改为: this._d = args.width || 1 ;
14882
- this._d = (args.width || 1) / 2;
14962
+ this._d = args.width || 1;
14883
14963
  this.arcMode = args.arcMode;
14884
14964
  }
14885
14965
  var _proto = Edge.prototype;
@@ -16978,6 +17058,12 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16978
17058
  area: area
16979
17059
  };
16980
17060
  };
17061
+ _proto.onAttached = function onAttached() {
17062
+ Component.prototype.onAttached.call(this);
17063
+ this.renderer.item = this.item;
17064
+ this.item.components.push(this.renderer);
17065
+ this.item.rendererComponents.push(this.renderer);
17066
+ };
16981
17067
  _proto.fromData = function fromData(data) {
16982
17068
  Component.prototype.fromData.call(this, data);
16983
17069
  var props = data;
@@ -17259,9 +17345,6 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
17259
17345
  }
17260
17346
  this.item.getHitTestParams = this.getHitTestParams;
17261
17347
  this.item._content = this;
17262
- this.renderer.item = this.item;
17263
- this.item.components.push(this.renderer);
17264
- this.item.rendererComponents.push(this.renderer);
17265
17348
  };
17266
17349
  _create_class(ParticleSystem, [
17267
17350
  {
@@ -19291,7 +19374,7 @@ function compareTracks(a, b) {
19291
19374
  _proto.hitTest = function hitTest(ray, x, y, regions, force, options) {
19292
19375
  var _this, _loop = function(i) {
19293
19376
  var item = _this.items[i];
19294
- if (item.getVisible() && !item.ended && !exports.VFXItem.isComposition(item) && !skip(item)) {
19377
+ if (item.getVisible() && item.transform.getValid() && !item.ended && !exports.VFXItem.isComposition(item) && !skip(item)) {
19295
19378
  var hitParams = item.getHitTestParams(force);
19296
19379
  if (hitParams) {
19297
19380
  var success = false;
@@ -19447,18 +19530,6 @@ var TextLayout = /*#__PURE__*/ function() {
19447
19530
  var tempWidth = fontSize + letterSpace;
19448
19531
  this.autoWidth = autoWidth;
19449
19532
  this.maxTextWidth = text.length * tempWidth;
19450
- // if (autoWidth) {
19451
- // this.width = this.maxTextWidth + this.lineWidth;
19452
- // this.height = fontSize + this.lineHeight;
19453
- // } else {
19454
- // if (textWidth) {
19455
- // this.maxCharCount = Math.floor((textWidth - this.lineWidth) / (tempWidth));
19456
- // this.width = textWidth;
19457
- // } else {
19458
- // this.width = basicScale[0] * 100;
19459
- // }
19460
- // this.height = basicScale[1] * 100;
19461
- // }
19462
19533
  this.width = textWidth;
19463
19534
  this.height = textHeight;
19464
19535
  this.letterSpace = letterSpace;
@@ -19895,6 +19966,17 @@ var TextComponentBase = /*#__PURE__*/ function() {
19895
19966
  this.isDirty = true;
19896
19967
  };
19897
19968
  /**
19969
+ * 设置自适应宽高开关
19970
+ * @param value - 是否自适应宽高开关
19971
+ * @returns
19972
+ */ _proto.setAutoWidth = function setAutoWidth(value) {
19973
+ if (this.textLayout.autoWidth === value) {
19974
+ return;
19975
+ }
19976
+ this.textLayout.autoWidth = value;
19977
+ this.isDirty = true;
19978
+ };
19979
+ /**
19898
19980
  * 更新文本
19899
19981
  * @returns
19900
19982
  */ _proto.updateTexture = function updateTexture(flipY) {
@@ -19907,20 +19989,26 @@ var TextComponentBase = /*#__PURE__*/ function() {
19907
19989
  var layout = this.textLayout;
19908
19990
  var fontScale = style.fontScale;
19909
19991
  var width = (layout.width + style.fontOffset) * fontScale;
19910
- var height = layout.height * fontScale;
19992
+ var finalHeight = layout.lineHeight * this.lineCount;
19911
19993
  var fontSize = style.fontSize * fontScale;
19912
19994
  var lineHeight = layout.lineHeight * fontScale;
19913
19995
  this.char = (this.text || "").split("");
19914
19996
  this.canvas.width = width;
19915
- this.canvas.height = height;
19916
- context.clearRect(0, 0, width, this.canvas.height);
19997
+ if (layout.autoWidth) {
19998
+ this.canvas.height = finalHeight * fontScale;
19999
+ this.item.transform.size.set(1, finalHeight / layout.height);
20000
+ } else {
20001
+ this.canvas.height = layout.height * fontScale;
20002
+ }
20003
+ var height = this.canvas.height;
20004
+ context.clearRect(0, 0, width, height);
19917
20005
  // fix bug 1/255
19918
20006
  context.fillStyle = "rgba(255, 255, 255, 0.0039)";
19919
20007
  if (!flipY) {
19920
20008
  context.translate(0, height);
19921
20009
  context.scale(1, -1);
19922
20010
  }
19923
- context.fillRect(0, 0, width, this.canvas.height);
20011
+ context.fillRect(0, 0, width, height);
19924
20012
  style.fontDesc = this.getFontDesc();
19925
20013
  context.font = style.fontDesc;
19926
20014
  if (style.hasShadow) {
@@ -20204,6 +20292,76 @@ function geometryToTriangles(geometry) {
20204
20292
  return res;
20205
20293
  }
20206
20294
 
20295
+ exports.PostProcessVolume = /*#__PURE__*/ function(ItemBehaviour) {
20296
+ _inherits(PostProcessVolume, ItemBehaviour);
20297
+ function PostProcessVolume() {
20298
+ var _this;
20299
+ _this = ItemBehaviour.apply(this, arguments) || this;
20300
+ _this.useHDR = true;
20301
+ // Bloom
20302
+ _this.useBloom = true;
20303
+ _this.threshold = 1.0;
20304
+ _this.bloomIntensity = 1.0;
20305
+ // ColorAdjustments
20306
+ _this.brightness = 1.0;
20307
+ _this.saturation = 1.0;
20308
+ _this.contrast = 1.0;
20309
+ // Vignette
20310
+ _this.vignetteIntensity = 0.2;
20311
+ _this.vignetteSmoothness = 0.4;
20312
+ _this.vignetteRoundness = 1.0;
20313
+ // ToneMapping
20314
+ _this.useToneMapping = true // 1: true, 0: false
20315
+ ;
20316
+ return _this;
20317
+ }
20318
+ var _proto = PostProcessVolume.prototype;
20319
+ _proto.start = function start() {
20320
+ var composition = this.item.composition;
20321
+ if (composition) {
20322
+ composition.globalVolume = this;
20323
+ composition.createRenderFrame();
20324
+ }
20325
+ };
20326
+ return PostProcessVolume;
20327
+ }(ItemBehaviour);
20328
+ __decorate([
20329
+ serialize()
20330
+ ], exports.PostProcessVolume.prototype, "useHDR", void 0);
20331
+ __decorate([
20332
+ serialize()
20333
+ ], exports.PostProcessVolume.prototype, "useBloom", void 0);
20334
+ __decorate([
20335
+ serialize()
20336
+ ], exports.PostProcessVolume.prototype, "threshold", void 0);
20337
+ __decorate([
20338
+ serialize()
20339
+ ], exports.PostProcessVolume.prototype, "bloomIntensity", void 0);
20340
+ __decorate([
20341
+ serialize()
20342
+ ], exports.PostProcessVolume.prototype, "brightness", void 0);
20343
+ __decorate([
20344
+ serialize()
20345
+ ], exports.PostProcessVolume.prototype, "saturation", void 0);
20346
+ __decorate([
20347
+ serialize()
20348
+ ], exports.PostProcessVolume.prototype, "contrast", void 0);
20349
+ __decorate([
20350
+ serialize()
20351
+ ], exports.PostProcessVolume.prototype, "vignetteIntensity", void 0);
20352
+ __decorate([
20353
+ serialize()
20354
+ ], exports.PostProcessVolume.prototype, "vignetteSmoothness", void 0);
20355
+ __decorate([
20356
+ serialize()
20357
+ ], exports.PostProcessVolume.prototype, "vignetteRoundness", void 0);
20358
+ __decorate([
20359
+ serialize()
20360
+ ], exports.PostProcessVolume.prototype, "useToneMapping", void 0);
20361
+ exports.PostProcessVolume = __decorate([
20362
+ effectsClass("PostProcessVolume")
20363
+ ], exports.PostProcessVolume);
20364
+
20207
20365
  exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
20208
20366
  _inherits(VFXItem, EffectsObject);
20209
20367
  function VFXItem(engine, props) {
@@ -20427,7 +20585,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
20427
20585
  /**
20428
20586
  * 获取元素用于计算光线投射的面片类型和参数
20429
20587
  * @override
20430
- * @param force 元素没有开启交互也返回参数
20588
+ * @param force - 元素没有开启交互也返回参数
20431
20589
  */ _proto.getHitTestParams = function getHitTestParams(force) {
20432
20590
  // OVERRIDE
20433
20591
  };
@@ -20677,46 +20835,10 @@ exports.Item = void 0;
20677
20835
  }
20678
20836
  Item.isNull = isNull;
20679
20837
  })(exports.Item || (exports.Item = {}));
20680
- /**
20681
- * (待废弃) 根据元素的类型创建对应的 `VFXItem` 实例
20682
- * @param props
20683
- * @param composition
20684
- */ function createVFXItem(props, composition) {
20685
- var type = props.type;
20686
- var pluginName = props.pluginName;
20687
- if (!pluginName) {
20688
- switch(type){
20689
- case ItemType.null:
20690
- pluginName = "cal";
20691
- break;
20692
- case ItemType.sprite:
20693
- pluginName = "sprite";
20694
- break;
20695
- case ItemType.particle:
20696
- pluginName = "particle";
20697
- break;
20698
- case ItemType.interact:
20699
- pluginName = "interact";
20700
- break;
20701
- case ItemType.camera:
20702
- pluginName = "camera";
20703
- break;
20704
- case ItemType.text:
20705
- pluginName = "text";
20706
- break;
20707
- case ItemType.tree:
20708
- pluginName = "tree";
20709
- break;
20710
- default:
20711
- throw new Error("Invalid vfx item type.");
20712
- }
20713
- }
20714
- return composition.pluginSystem.createPluginItem(pluginName, props, composition);
20715
- }
20716
-
20717
- var pluginLoaderMap = {};
20718
- var defaultPlugins = [];
20719
- var pluginCtrlMap = {};
20838
+
20839
+ var pluginLoaderMap = {};
20840
+ var defaultPlugins = [];
20841
+ var pluginCtrlMap = {};
20720
20842
  /**
20721
20843
  * 注册 plugin
20722
20844
  * @param name
@@ -20725,6 +20847,9 @@ var pluginCtrlMap = {};
20725
20847
  * @param isDefault load
20726
20848
  */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
20727
20849
  function registerPlugin(name, pluginClass, itemClass, isDefault) {
20850
+ if (pluginCtrlMap[name]) {
20851
+ logger.error("Duplicate registration for plugin " + name + ".");
20852
+ }
20728
20853
  pluginCtrlMap[name] = itemClass;
20729
20854
  pluginLoaderMap[name] = pluginClass;
20730
20855
  if (isDefault) {
@@ -21197,27 +21322,46 @@ var SerializationHelper = /*#__PURE__*/ function() {
21197
21322
  res1
21198
21323
  ];
21199
21324
  case 7:
21200
- if (isObject(property) && property.constructor === Object) {
21201
- if (type) {
21202
- res2 = new type();
21203
- } else {
21204
- res2 = {};
21205
- }
21206
- for(_iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property)); !(_step1 = _iterator1()).done;){
21207
- key = _step1.value;
21208
- res2[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
21209
- }
21210
- return [
21211
- 2,
21212
- res2
21213
- ];
21325
+ if (!(isObject(property) && property.constructor === Object)) return [
21326
+ 3,
21327
+ 12
21328
+ ];
21329
+ if (type) {
21330
+ res2 = new type();
21214
21331
  } else {
21215
- return [
21216
- 2,
21217
- property
21218
- ];
21332
+ res2 = {};
21219
21333
  }
21334
+ _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property));
21335
+ _state.label = 8;
21220
21336
  case 8:
21337
+ if (!!(_step1 = _iterator1()).done) return [
21338
+ 3,
21339
+ 11
21340
+ ];
21341
+ key = _step1.value;
21342
+ return [
21343
+ 4,
21344
+ SerializationHelper.deserializePropertyAsync(property[key], engine, level + 1)
21345
+ ];
21346
+ case 9:
21347
+ res2[key] = _state.sent();
21348
+ _state.label = 10;
21349
+ case 10:
21350
+ return [
21351
+ 3,
21352
+ 8
21353
+ ];
21354
+ case 11:
21355
+ return [
21356
+ 2,
21357
+ res2
21358
+ ];
21359
+ case 12:
21360
+ return [
21361
+ 2,
21362
+ property
21363
+ ];
21364
+ case 13:
21221
21365
  return [
21222
21366
  2
21223
21367
  ];
@@ -21303,8 +21447,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
21303
21447
  if (this.engine.objectInstance[guid]) {
21304
21448
  return this.engine.objectInstance[guid];
21305
21449
  }
21306
- var effectsObject;
21307
21450
  var effectsObjectData = this.findData(guid);
21451
+ var effectsObject;
21308
21452
  if (!effectsObjectData) {
21309
21453
  console.error("Object data with uuid: " + guid + " not found.");
21310
21454
  return undefined;
@@ -21340,7 +21484,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21340
21484
  _proto.loadGUIDAsync = function loadGUIDAsync(guid) {
21341
21485
  var _this = this;
21342
21486
  return _async_to_generator(function() {
21343
- var effectsObject, effectsObjectData, classConstructor;
21487
+ var effectsObjectData, effectsObject, classConstructor;
21344
21488
  return __generator(this, function(_state) {
21345
21489
  switch(_state.label){
21346
21490
  case 0:
@@ -21876,277 +22020,39 @@ function getBezierCurveFromHermiteInGE(geHermiteCurves) {
21876
22020
  });
21877
22021
  }
21878
22022
 
21879
- function getStandardParticleContent(particle) {
21880
- var options = particle.options;
21881
- var transform = particle.transform;
21882
- var shape = {
21883
- type: ShapeType.NONE
21884
- };
21885
- if (particle.shape) {
21886
- var _particle_shape_shape;
21887
- var shapeType = (_particle_shape_shape = particle.shape.shape) == null ? void 0 : _particle_shape_shape.replace(/([A-Z])/g, "_$1").toUpperCase().replace(/^_/, "");
21888
- shape = _extends({}, particle.shape, {
21889
- type: ShapeType[shapeType]
21890
- });
21891
- if (particle.shape.upDirection) {
21892
- var _particle_shape_upDirection = particle.shape.upDirection, x = _particle_shape_upDirection[0], y = _particle_shape_upDirection[1], z = _particle_shape_upDirection[2];
21893
- if (x === 0 && y === 0 && z === 0) {
21894
- delete shape.upDirection;
21895
- }
21896
- }
21897
- }
21898
- if (options.startTurbulence) {
21899
- shape.turbulenceX = ensureNumberExpression(options.turbulenceX);
21900
- shape.turbulenceY = ensureNumberExpression(options.turbulenceY);
21901
- shape.turbulenceZ = ensureNumberExpression(options.turbulenceZ);
21902
- }
21903
- var emission = particle.emission;
21904
- if (emission.bursts && emission.bursts.length > 0) {
21905
- emission.bursts = emission.bursts.map(function(b) {
21906
- return objectValueToNumber(b);
21907
- });
21908
- }
21909
- if (emission.burstOffsets && emission.burstOffsets.length > 0) {
21910
- emission.burstOffsets = emission.burstOffsets.map(function(b) {
21911
- return objectValueToNumber(b);
21912
- });
21913
- }
21914
- if (emission.rateOverTime) {
21915
- emission.rateOverTime = ensureNumberExpression(emission.rateOverTime);
21916
- }
22023
+ function getStandardCameraContent(model) {
22024
+ var _model_transform;
22025
+ var opt = model.options;
21917
22026
  var ret = {
21918
- renderer: particle.renderer,
21919
- shape: shape,
21920
- splits: particle.splits,
21921
- emission: emission,
21922
22027
  options: {
21923
- startLifetime: ensureNumberExpression(options.startLifetime),
21924
- start3DSize: !!options.start3DSize,
21925
- startSize: ensureNumberExpression(options.startSize),
21926
- startSizeX: ensureNumberExpression(options.startSizeX),
21927
- startSizeY: ensureNumberExpression(options.startSizeY),
21928
- sizeAspect: ensureNumberExpression(options.sizeAspect),
21929
- maxCount: options.maxCount,
21930
- startDelay: ensureNumberExpression(options.startDelay),
21931
- startColor: ensureColorExpression(options.startColor, true),
21932
- startRotationZ: ensureNumberExpression(options.startRotation || options.startRotationZ),
21933
- particleFollowParent: options.particleFollowParent
21934
- }
21935
- };
21936
- if (options.start3DRotation) {
21937
- ret.options.startRotationX = ensureNumberExpression(options.startRotationX);
21938
- ret.options.startRotationY = ensureNumberExpression(options.startRotationY);
21939
- }
21940
- if (transform && transform.path) {
21941
- ret.emitterTransform = {
21942
- path: ensureFixedVec3(transform.path)
21943
- };
21944
- }
21945
- var sizeOverLifetime = particle.sizeOverLifetime;
21946
- if (sizeOverLifetime) {
21947
- if (sizeOverLifetime.separateAxes) {
21948
- ret.sizeOverLifetime = {
21949
- separateAxes: true,
21950
- x: ensureNumberExpression(sizeOverLifetime.x),
21951
- y: ensureNumberExpression(sizeOverLifetime.y)
21952
- };
21953
- } else {
21954
- ret.sizeOverLifetime = {
21955
- size: ensureNumberExpression(sizeOverLifetime.size)
21956
- };
22028
+ fov: opt.fov,
22029
+ far: opt.far,
22030
+ near: opt.near,
22031
+ clipMode: opt.clipMode
21957
22032
  }
21958
- }
21959
- var velocityOverLifetime = particle.velocityOverLifetime || {};
21960
- var sol = velocityOverLifetime.speedOverLifetime;
21961
- if (sol) {
21962
- sol = ensureFixedNumber(sol);
21963
- } else {
21964
- sol = undefined;
21965
- }
21966
- ret.positionOverLifetime = {
21967
- gravity: options.gravity,
21968
- gravityOverLifetime: ensureFixedNumber(options.gravityModifier),
21969
- startSpeed: ensureNumberExpression(options.startSpeed),
21970
- speedOverLifetime: sol,
21971
- asMovement: velocityOverLifetime.asMovement,
21972
- linearX: ensureNumberExpression(velocityOverLifetime.linearX),
21973
- linearY: ensureNumberExpression(velocityOverLifetime.linearY),
21974
- linearZ: ensureNumberExpression(velocityOverLifetime.linearZ),
21975
- asRotation: velocityOverLifetime.asRotation,
21976
- orbCenter: velocityOverLifetime.orbCenter,
21977
- orbitalX: ensureNumberExpression(velocityOverLifetime.orbitalX),
21978
- orbitalY: ensureNumberExpression(velocityOverLifetime.orbitalY),
21979
- orbitalZ: ensureNumberExpression(velocityOverLifetime.orbitalZ),
21980
- forceTarget: velocityOverLifetime.forceTarget,
21981
- target: velocityOverLifetime.target,
21982
- forceCurve: ensureFixedNumber(velocityOverLifetime.forceCurve)
21983
22033
  };
21984
- deleteEmptyValue(ret.positionOverLifetime);
21985
- var rotationOverLifetime = particle.rotationOverLifetime;
21986
- if (rotationOverLifetime) {
21987
- ret.rotationOverLifetime = {
21988
- separateAxes: rotationOverLifetime.separateAxes,
21989
- asRotation: rotationOverLifetime.asRotation,
21990
- z: ensureNumberExpression(rotationOverLifetime.separateAxes ? rotationOverLifetime.z : rotationOverLifetime.angularVelocity)
21991
- };
21992
- if (rotationOverLifetime.separateAxes) {
21993
- ret.rotationOverLifetime.y = ensureFixedNumber(rotationOverLifetime.y);
21994
- ret.rotationOverLifetime.x = ensureFixedNumber(rotationOverLifetime.x);
21995
- }
21996
- }
21997
- var colorOverLifetime = particle.colorOverLifetime;
21998
- if (colorOverLifetime) {
21999
- var col = ret.colorOverLifetime = {
22000
- opacity: ensureFixedNumber(colorOverLifetime.opacity)
22001
- };
22002
- if (colorOverLifetime.color) {
22003
- col.color = getGradientColor(colorOverLifetime.color);
22004
- }
22005
- }
22006
- var textureSheetAnimation = particle.textureSheetAnimation;
22007
- if (textureSheetAnimation) {
22008
- ret.textureSheetAnimation = {
22009
- row: textureSheetAnimation.row,
22010
- col: textureSheetAnimation.col,
22011
- total: textureSheetAnimation.total,
22012
- animate: textureSheetAnimation.animate,
22013
- cycles: ensureFixedNumber(textureSheetAnimation.cycles),
22014
- animationDelay: ensureFixedNumberWithRandom(textureSheetAnimation.animationDelay, 0),
22015
- animationDuration: ensureFixedNumberWithRandom(textureSheetAnimation.animationDuration, 0)
22016
- };
22017
- }
22018
- var trials = particle.trails;
22019
- if (trials) {
22020
- ret.trails = {
22021
- lifetime: ensureNumberExpression(trials.lifetime),
22022
- dieWithParticles: trials.dieWithParticles,
22023
- maxPointPerTrail: trials.maxPointPerTrail,
22024
- minimumVertexDistance: trials.minimumVertexDistance,
22025
- widthOverTrail: ensureFixedNumber(trials.widthOverTrail),
22026
- colorOverTrail: trials.colorOverTrail && getGradientColor(trials.colorOverTrail, false),
22027
- blending: trials.blending,
22028
- colorOverLifetime: trials.colorOverLifetime && getGradientColor(trials.colorOverLifetime, false),
22029
- inheritParticleColor: trials.inheritParticleColor,
22030
- occlusion: trials.occlusion,
22031
- transparentOcclusion: trials.transparentOcclusion,
22032
- orderOffset: trials.orderOffset,
22033
- sizeAffectsLifetime: trials.sizeAffectsLifetime,
22034
- sizeAffectsWidth: trials.sizeAffectsWidth,
22035
- texture: trials.texture,
22036
- parentAffectsPosition: trials.parentAffectsPosition,
22037
- opacityOverLifetime: ensureNumberExpression(trials.opacityOverLifetime)
22034
+ var velocityOverLifetime = model.velocityOverLifetime;
22035
+ if (velocityOverLifetime || ((_model_transform = model.transform) == null ? void 0 : _model_transform.path)) {
22036
+ var _model_transform1;
22037
+ var positionOverLifetime = {
22038
+ path: ensureFixedVec3((_model_transform1 = model.transform) == null ? void 0 : _model_transform1.path),
22039
+ linearX: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateX),
22040
+ linearY: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateY),
22041
+ linearZ: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateZ)
22038
22042
  };
22043
+ deleteEmptyValue(positionOverLifetime);
22044
+ ret.positionOverLifetime = positionOverLifetime;
22039
22045
  }
22040
- ret.trails && deleteEmptyValue(ret.trails);
22041
- var interaction = particle.interaction;
22042
- if (interaction) {
22043
- ret.interaction = {
22044
- behavior: interaction.behavior,
22045
- radius: interaction.radius,
22046
- multiple: interaction.multiple
22046
+ var rol = model.rotationOverLifetime;
22047
+ if (rol) {
22048
+ var rotationOverLifetime = {
22049
+ separateAxes: rol.separateAxes,
22050
+ x: ensureFixedNumber(rol == null ? void 0 : rol.rotateX),
22051
+ y: ensureFixedNumber(rol == null ? void 0 : rol.rotateY),
22052
+ z: rol.separateAxes ? ensureFixedNumber(rol == null ? void 0 : rol.rotateZ) : ensureFixedNumber(rol.rotation)
22047
22053
  };
22048
- }
22049
- return ret;
22050
- }
22051
-
22052
- function getStandardNullContent(sprite, transform) {
22053
- var _sprite_transform;
22054
- var opt = sprite.options;
22055
- var velocityOverLifetime = sprite.velocityOverLifetime || {};
22056
- var positionOverLifetime = {
22057
- path: ensureFixedVec3((_sprite_transform = sprite.transform) == null ? void 0 : _sprite_transform.path),
22058
- gravity: opt.gravity,
22059
- gravityOverLifetime: ensureFixedNumber(opt.gravityModifier),
22060
- direction: opt.direction,
22061
- startSpeed: opt.startSpeed,
22062
- asMovement: velocityOverLifetime.asMovement,
22063
- linearX: ensureFixedNumber(velocityOverLifetime.linearX),
22064
- linearY: ensureFixedNumber(velocityOverLifetime.linearY),
22065
- linearZ: ensureFixedNumber(velocityOverLifetime.linearZ),
22066
- asRotation: velocityOverLifetime.asRotation,
22067
- orbCenter: velocityOverLifetime.orbCenter,
22068
- orbitalX: ensureFixedNumber(velocityOverLifetime.orbitalX),
22069
- orbitalY: ensureFixedNumber(velocityOverLifetime.orbitalY),
22070
- orbitalZ: ensureFixedNumber(velocityOverLifetime.orbitalZ),
22071
- speedOverLifetime: ensureFixedNumber(velocityOverLifetime.speedOverLifetime)
22072
- };
22073
- deleteEmptyValue(positionOverLifetime);
22074
- var ret = {
22075
- options: {
22076
- startColor: ensureRGBAValue(opt.startColor)
22077
- },
22078
- positionOverLifetime: positionOverLifetime
22079
- };
22080
- if (opt.startSize) {
22081
- transform.scale = [
22082
- opt.startSize,
22083
- opt.startSize / (opt.sizeAspect || 1),
22084
- 1
22085
- ];
22086
- }
22087
- if (opt.startRotation) {
22088
- if (!transform.rotation) {
22089
- transform.rotation = [
22090
- 0,
22091
- 0,
22092
- opt.startRotation
22093
- ];
22094
- } else {
22095
- transform.rotation[2] += opt.startRotation;
22096
- }
22097
- }
22098
- var rotationOverLifetime = sprite.rotationOverLifetime;
22099
- if (rotationOverLifetime) {
22100
- var rot = ret.rotationOverLifetime = {
22101
- separateAxes: rotationOverLifetime.separateAxes,
22102
- asRotation: rotationOverLifetime.asRotation
22103
- };
22104
- if (rot.separateAxes) {
22105
- rot.x = ensureFixedNumber(rotationOverLifetime.x);
22106
- rot.y = ensureFixedNumber(rotationOverLifetime.y);
22107
- rot.z = ensureFixedNumber(rotationOverLifetime.z);
22108
- } else {
22109
- rot.z = ensureFixedNumber(rotationOverLifetime.angularVelocity);
22110
- }
22111
- }
22112
- var colorOverLifetime = sprite.colorOverLifetime;
22113
- if (colorOverLifetime) {
22114
- var col = ret.colorOverLifetime = {
22115
- opacity: ensureFixedNumber(colorOverLifetime.opacity)
22116
- };
22117
- if (colorOverLifetime.color) {
22118
- col.color = getGradientColor(colorOverLifetime.color);
22119
- }
22120
- }
22121
- var sizeOverLifetime = sprite.sizeOverLifetime;
22122
- if (sizeOverLifetime) {
22123
- ret.sizeOverLifetime = {
22124
- separateAxes: sizeOverLifetime.separateAxes,
22125
- size: ensureFixedNumber(sizeOverLifetime.size),
22126
- x: ensureFixedNumber(sizeOverLifetime.x),
22127
- y: ensureFixedNumber(sizeOverLifetime.y),
22128
- z: ensureFixedNumber(sizeOverLifetime.z)
22129
- };
22130
- }
22131
- return ret;
22132
- }
22133
- function getStandardSpriteContent(sprite, transform) {
22134
- var ret = getStandardNullContent(sprite, transform);
22135
- var texAni = sprite.textureSheetAnimation;
22136
- if (texAni) {
22137
- ret.textureSheetAnimation = {
22138
- row: texAni.row,
22139
- col: texAni.col,
22140
- total: texAni.total || undefined,
22141
- animate: texAni.animate
22142
- };
22143
- }
22144
- ret.renderer = sprite.renderer;
22145
- if (sprite.splits) {
22146
- ret.splits = sprite.splits;
22147
- }
22148
- if (sprite.interaction) {
22149
- ret.interaction = sprite.interaction;
22054
+ deleteEmptyValue(rotationOverLifetime);
22055
+ ret.rotationOverLifetime = rotationOverLifetime;
22150
22056
  }
22151
22057
  return ret;
22152
22058
  }
@@ -22191,43 +22097,6 @@ function getStandardInteractContent(ui) {
22191
22097
  return ret;
22192
22098
  }
22193
22099
 
22194
- function getStandardCameraContent(model) {
22195
- var _model_transform;
22196
- var opt = model.options;
22197
- var ret = {
22198
- options: {
22199
- fov: opt.fov,
22200
- far: opt.far,
22201
- near: opt.near,
22202
- clipMode: opt.clipMode
22203
- }
22204
- };
22205
- var velocityOverLifetime = model.velocityOverLifetime;
22206
- if (velocityOverLifetime || ((_model_transform = model.transform) == null ? void 0 : _model_transform.path)) {
22207
- var _model_transform1;
22208
- var positionOverLifetime = {
22209
- path: ensureFixedVec3((_model_transform1 = model.transform) == null ? void 0 : _model_transform1.path),
22210
- linearX: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateX),
22211
- linearY: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateY),
22212
- linearZ: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateZ)
22213
- };
22214
- deleteEmptyValue(positionOverLifetime);
22215
- ret.positionOverLifetime = positionOverLifetime;
22216
- }
22217
- var rol = model.rotationOverLifetime;
22218
- if (rol) {
22219
- var rotationOverLifetime = {
22220
- separateAxes: rol.separateAxes,
22221
- x: ensureFixedNumber(rol == null ? void 0 : rol.rotateX),
22222
- y: ensureFixedNumber(rol == null ? void 0 : rol.rotateY),
22223
- z: rol.separateAxes ? ensureFixedNumber(rol == null ? void 0 : rol.rotateZ) : ensureFixedNumber(rol.rotation)
22224
- };
22225
- deleteEmptyValue(rotationOverLifetime);
22226
- ret.rotationOverLifetime = rotationOverLifetime;
22227
- }
22228
- return ret;
22229
- }
22230
-
22231
22100
  /**
22232
22101
  * 2.1 以下版本数据适配(mars-player@2.4.0 及以上版本支持 2.1 以下数据的适配)
22233
22102
  */ function version21Migration(json) {
@@ -22344,11 +22213,12 @@ function getStandardCameraContent(model) {
22344
22213
  var _textures;
22345
22214
  (_textures = (_result = result).textures) != null ? _textures : _result.textures = [];
22346
22215
  result.textures.forEach(function(textureOptions) {
22216
+ var _result_images_textureOptions_source;
22347
22217
  textureOptions.id = generateGUID();
22348
22218
  textureOptions.dataType = DataType.Texture;
22349
22219
  // @ts-expect-error
22350
22220
  textureOptions.source = {
22351
- id: result.images[textureOptions.source].id
22221
+ id: (_result_images_textureOptions_source = result.images[textureOptions.source]) == null ? void 0 : _result_images_textureOptions_source.id
22352
22222
  };
22353
22223
  });
22354
22224
  if (result.textures.length < result.images.length) {
@@ -22702,8 +22572,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22702
22572
  var newSpriteColorPlayableAssetData = {
22703
22573
  id: generateGUID(),
22704
22574
  dataType: "SpriteColorPlayableAsset",
22705
- colorOverLifetime: item.content.colorOverLifetime,
22706
- startColor: item.content.options.startColor
22575
+ colorOverLifetime: item.content.colorOverLifetime
22707
22576
  };
22708
22577
  playableAssetDatas.push(newSpriteColorPlayableAssetData);
22709
22578
  var newTrackData1 = {
@@ -22752,83 +22621,358 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22752
22621
  });
22753
22622
  trackDatas.push(newTrackData2);
22754
22623
  }
22755
- var bindingTrackData = {
22756
- id: generateGUID(),
22757
- dataType: "ObjectBindingTrack",
22758
- children: subTrackDatas,
22759
- clips: []
22624
+ var bindingTrackData = {
22625
+ id: generateGUID(),
22626
+ dataType: "ObjectBindingTrack",
22627
+ children: subTrackDatas,
22628
+ clips: []
22629
+ };
22630
+ trackDatas.push(bindingTrackData);
22631
+ timelineAssetData.tracks.push({
22632
+ id: bindingTrackData.id
22633
+ });
22634
+ sceneBindings.push({
22635
+ key: {
22636
+ id: bindingTrackData.id
22637
+ },
22638
+ value: {
22639
+ id: item.id
22640
+ }
22641
+ });
22642
+ }
22643
+ var trackIds = [];
22644
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(trackDatas), _step1; !(_step1 = _iterator1()).done;){
22645
+ var trackData = _step1.value;
22646
+ trackIds.push({
22647
+ id: trackData.id
22648
+ });
22649
+ }
22650
+ composition.timelineAsset = {
22651
+ id: timelineAssetData.id
22652
+ };
22653
+ composition.sceneBindings = sceneBindings;
22654
+ jsonScene.miscs.push(timelineAssetData);
22655
+ for(var _iterator2 = _create_for_of_iterator_helper_loose(trackDatas), _step2; !(_step2 = _iterator2()).done;){
22656
+ var trackData1 = _step2.value;
22657
+ //@ts-expect-error
22658
+ jsonScene.miscs.push(trackData1);
22659
+ }
22660
+ for(var _iterator3 = _create_for_of_iterator_helper_loose(playableAssetDatas), _step3; !(_step3 = _iterator3()).done;){
22661
+ var playableAsset = _step3.value;
22662
+ //@ts-expect-error
22663
+ jsonScene.miscs.push(playableAsset);
22664
+ }
22665
+ }
22666
+ function convertBinaryAsset(bins, jsonScene) {
22667
+ //@ts-expect-error
22668
+ jsonScene.bins = bins.map(function(bin) {
22669
+ return {
22670
+ url: bin.url,
22671
+ "dataType": "BinaryAsset",
22672
+ id: generateGUID()
22673
+ };
22674
+ });
22675
+ }
22676
+ function convertSpineData(resource, content, jsonScene) {
22677
+ //@ts-expect-error
22678
+ content.resource = {
22679
+ "atlas": {
22680
+ "bins": {
22681
+ //@ts-expect-error
22682
+ "id": jsonScene.bins[resource.atlas[1][0]].id
22683
+ },
22684
+ "source": resource.atlas[1].slice(1)
22685
+ },
22686
+ "skeleton": {
22687
+ "bins": {
22688
+ //@ts-expect-error
22689
+ "id": jsonScene.bins[resource.skeleton[1][0]].id
22690
+ },
22691
+ "source": resource.skeleton[1].slice(1)
22692
+ },
22693
+ "skeletonType": resource.skeletonType,
22694
+ "images": resource.images.map(function(i) {
22695
+ return {
22696
+ //@ts-expect-error
22697
+ id: jsonScene.textures[i].id
22698
+ };
22699
+ })
22700
+ };
22701
+ }
22702
+
22703
+ function getStandardParticleContent(particle) {
22704
+ var options = particle.options;
22705
+ var transform = particle.transform;
22706
+ var shape = {
22707
+ type: ShapeType.NONE
22708
+ };
22709
+ if (particle.shape) {
22710
+ var _particle_shape_shape;
22711
+ var shapeType = (_particle_shape_shape = particle.shape.shape) == null ? void 0 : _particle_shape_shape.replace(/([A-Z])/g, "_$1").toUpperCase().replace(/^_/, "");
22712
+ shape = _extends({}, particle.shape, {
22713
+ type: ShapeType[shapeType]
22714
+ });
22715
+ if (particle.shape.upDirection) {
22716
+ var _particle_shape_upDirection = particle.shape.upDirection, x = _particle_shape_upDirection[0], y = _particle_shape_upDirection[1], z = _particle_shape_upDirection[2];
22717
+ if (x === 0 && y === 0 && z === 0) {
22718
+ delete shape.upDirection;
22719
+ }
22720
+ }
22721
+ }
22722
+ if (options.startTurbulence) {
22723
+ shape.turbulenceX = ensureNumberExpression(options.turbulenceX);
22724
+ shape.turbulenceY = ensureNumberExpression(options.turbulenceY);
22725
+ shape.turbulenceZ = ensureNumberExpression(options.turbulenceZ);
22726
+ }
22727
+ var emission = particle.emission;
22728
+ if (emission.bursts && emission.bursts.length > 0) {
22729
+ emission.bursts = emission.bursts.map(function(b) {
22730
+ return objectValueToNumber(b);
22731
+ });
22732
+ }
22733
+ if (emission.burstOffsets && emission.burstOffsets.length > 0) {
22734
+ emission.burstOffsets = emission.burstOffsets.map(function(b) {
22735
+ return objectValueToNumber(b);
22736
+ });
22737
+ }
22738
+ if (emission.rateOverTime) {
22739
+ emission.rateOverTime = ensureNumberExpression(emission.rateOverTime);
22740
+ }
22741
+ var ret = {
22742
+ renderer: particle.renderer,
22743
+ shape: shape,
22744
+ splits: particle.splits,
22745
+ emission: emission,
22746
+ options: {
22747
+ startLifetime: ensureNumberExpression(options.startLifetime),
22748
+ start3DSize: !!options.start3DSize,
22749
+ startSize: ensureNumberExpression(options.startSize),
22750
+ startSizeX: ensureNumberExpression(options.startSizeX),
22751
+ startSizeY: ensureNumberExpression(options.startSizeY),
22752
+ sizeAspect: ensureNumberExpression(options.sizeAspect),
22753
+ maxCount: options.maxCount,
22754
+ startDelay: ensureNumberExpression(options.startDelay),
22755
+ startColor: ensureColorExpression(options.startColor, true),
22756
+ startRotationZ: ensureNumberExpression(options.startRotation || options.startRotationZ),
22757
+ particleFollowParent: options.particleFollowParent
22758
+ }
22759
+ };
22760
+ if (options.start3DRotation) {
22761
+ ret.options.startRotationX = ensureNumberExpression(options.startRotationX);
22762
+ ret.options.startRotationY = ensureNumberExpression(options.startRotationY);
22763
+ }
22764
+ if (transform && transform.path) {
22765
+ ret.emitterTransform = {
22766
+ path: ensureFixedVec3(transform.path)
22767
+ };
22768
+ }
22769
+ var sizeOverLifetime = particle.sizeOverLifetime;
22770
+ if (sizeOverLifetime) {
22771
+ if (sizeOverLifetime.separateAxes) {
22772
+ ret.sizeOverLifetime = {
22773
+ separateAxes: true,
22774
+ x: ensureNumberExpression(sizeOverLifetime.x),
22775
+ y: ensureNumberExpression(sizeOverLifetime.y)
22776
+ };
22777
+ } else {
22778
+ ret.sizeOverLifetime = {
22779
+ size: ensureNumberExpression(sizeOverLifetime.size)
22780
+ };
22781
+ }
22782
+ }
22783
+ var velocityOverLifetime = particle.velocityOverLifetime || {};
22784
+ var sol = velocityOverLifetime.speedOverLifetime;
22785
+ if (sol) {
22786
+ sol = ensureFixedNumber(sol);
22787
+ } else {
22788
+ sol = undefined;
22789
+ }
22790
+ ret.positionOverLifetime = {
22791
+ gravity: options.gravity,
22792
+ gravityOverLifetime: ensureFixedNumber(options.gravityModifier),
22793
+ startSpeed: ensureNumberExpression(options.startSpeed),
22794
+ speedOverLifetime: sol,
22795
+ asMovement: velocityOverLifetime.asMovement,
22796
+ linearX: ensureNumberExpression(velocityOverLifetime.linearX),
22797
+ linearY: ensureNumberExpression(velocityOverLifetime.linearY),
22798
+ linearZ: ensureNumberExpression(velocityOverLifetime.linearZ),
22799
+ asRotation: velocityOverLifetime.asRotation,
22800
+ orbCenter: velocityOverLifetime.orbCenter,
22801
+ orbitalX: ensureNumberExpression(velocityOverLifetime.orbitalX),
22802
+ orbitalY: ensureNumberExpression(velocityOverLifetime.orbitalY),
22803
+ orbitalZ: ensureNumberExpression(velocityOverLifetime.orbitalZ),
22804
+ forceTarget: velocityOverLifetime.forceTarget,
22805
+ target: velocityOverLifetime.target,
22806
+ forceCurve: ensureFixedNumber(velocityOverLifetime.forceCurve)
22807
+ };
22808
+ deleteEmptyValue(ret.positionOverLifetime);
22809
+ var rotationOverLifetime = particle.rotationOverLifetime;
22810
+ if (rotationOverLifetime) {
22811
+ ret.rotationOverLifetime = {
22812
+ separateAxes: rotationOverLifetime.separateAxes,
22813
+ asRotation: rotationOverLifetime.asRotation,
22814
+ z: ensureNumberExpression(rotationOverLifetime.separateAxes ? rotationOverLifetime.z : rotationOverLifetime.angularVelocity)
22815
+ };
22816
+ if (rotationOverLifetime.separateAxes) {
22817
+ ret.rotationOverLifetime.y = ensureFixedNumber(rotationOverLifetime.y);
22818
+ ret.rotationOverLifetime.x = ensureFixedNumber(rotationOverLifetime.x);
22819
+ }
22820
+ }
22821
+ var colorOverLifetime = particle.colorOverLifetime;
22822
+ if (colorOverLifetime) {
22823
+ var col = ret.colorOverLifetime = {
22824
+ opacity: ensureFixedNumber(colorOverLifetime.opacity)
22825
+ };
22826
+ if (colorOverLifetime.color) {
22827
+ col.color = getGradientColor(colorOverLifetime.color);
22828
+ }
22829
+ }
22830
+ var textureSheetAnimation = particle.textureSheetAnimation;
22831
+ if (textureSheetAnimation) {
22832
+ ret.textureSheetAnimation = {
22833
+ row: textureSheetAnimation.row,
22834
+ col: textureSheetAnimation.col,
22835
+ total: textureSheetAnimation.total,
22836
+ animate: textureSheetAnimation.animate,
22837
+ cycles: ensureFixedNumber(textureSheetAnimation.cycles),
22838
+ animationDelay: ensureFixedNumberWithRandom(textureSheetAnimation.animationDelay, 0),
22839
+ animationDuration: ensureFixedNumberWithRandom(textureSheetAnimation.animationDuration, 0)
22760
22840
  };
22761
- trackDatas.push(bindingTrackData);
22762
- timelineAssetData.tracks.push({
22763
- id: bindingTrackData.id
22764
- });
22765
- sceneBindings.push({
22766
- key: {
22767
- id: bindingTrackData.id
22768
- },
22769
- value: {
22770
- id: item.id
22771
- }
22772
- });
22773
22841
  }
22774
- var trackIds = [];
22775
- for(var _iterator1 = _create_for_of_iterator_helper_loose(trackDatas), _step1; !(_step1 = _iterator1()).done;){
22776
- var trackData = _step1.value;
22777
- trackIds.push({
22778
- id: trackData.id
22779
- });
22842
+ var trials = particle.trails;
22843
+ if (trials) {
22844
+ ret.trails = {
22845
+ lifetime: ensureNumberExpression(trials.lifetime),
22846
+ dieWithParticles: trials.dieWithParticles,
22847
+ maxPointPerTrail: trials.maxPointPerTrail,
22848
+ minimumVertexDistance: trials.minimumVertexDistance,
22849
+ widthOverTrail: ensureFixedNumber(trials.widthOverTrail),
22850
+ colorOverTrail: trials.colorOverTrail && getGradientColor(trials.colorOverTrail, false),
22851
+ blending: trials.blending,
22852
+ colorOverLifetime: trials.colorOverLifetime && getGradientColor(trials.colorOverLifetime, false),
22853
+ inheritParticleColor: trials.inheritParticleColor,
22854
+ occlusion: trials.occlusion,
22855
+ transparentOcclusion: trials.transparentOcclusion,
22856
+ orderOffset: trials.orderOffset,
22857
+ sizeAffectsLifetime: trials.sizeAffectsLifetime,
22858
+ sizeAffectsWidth: trials.sizeAffectsWidth,
22859
+ texture: trials.texture,
22860
+ parentAffectsPosition: trials.parentAffectsPosition,
22861
+ opacityOverLifetime: ensureNumberExpression(trials.opacityOverLifetime)
22862
+ };
22780
22863
  }
22781
- composition.timelineAsset = {
22782
- id: timelineAssetData.id
22864
+ ret.trails && deleteEmptyValue(ret.trails);
22865
+ var interaction = particle.interaction;
22866
+ if (interaction) {
22867
+ ret.interaction = {
22868
+ behavior: interaction.behavior,
22869
+ radius: interaction.radius,
22870
+ multiple: interaction.multiple
22871
+ };
22872
+ }
22873
+ return ret;
22874
+ }
22875
+
22876
+ function getStandardNullContent(sprite, transform) {
22877
+ var _sprite_transform;
22878
+ var opt = sprite.options;
22879
+ var velocityOverLifetime = sprite.velocityOverLifetime || {};
22880
+ var positionOverLifetime = {
22881
+ path: ensureFixedVec3((_sprite_transform = sprite.transform) == null ? void 0 : _sprite_transform.path),
22882
+ gravity: opt.gravity,
22883
+ gravityOverLifetime: ensureFixedNumber(opt.gravityModifier),
22884
+ direction: opt.direction,
22885
+ startSpeed: opt.startSpeed,
22886
+ asMovement: velocityOverLifetime.asMovement,
22887
+ linearX: ensureFixedNumber(velocityOverLifetime.linearX),
22888
+ linearY: ensureFixedNumber(velocityOverLifetime.linearY),
22889
+ linearZ: ensureFixedNumber(velocityOverLifetime.linearZ),
22890
+ asRotation: velocityOverLifetime.asRotation,
22891
+ orbCenter: velocityOverLifetime.orbCenter,
22892
+ orbitalX: ensureFixedNumber(velocityOverLifetime.orbitalX),
22893
+ orbitalY: ensureFixedNumber(velocityOverLifetime.orbitalY),
22894
+ orbitalZ: ensureFixedNumber(velocityOverLifetime.orbitalZ),
22895
+ speedOverLifetime: ensureFixedNumber(velocityOverLifetime.speedOverLifetime)
22783
22896
  };
22784
- composition.sceneBindings = sceneBindings;
22785
- jsonScene.miscs.push(timelineAssetData);
22786
- for(var _iterator2 = _create_for_of_iterator_helper_loose(trackDatas), _step2; !(_step2 = _iterator2()).done;){
22787
- var trackData1 = _step2.value;
22788
- //@ts-expect-error
22789
- jsonScene.miscs.push(trackData1);
22897
+ deleteEmptyValue(positionOverLifetime);
22898
+ var ret = {
22899
+ options: {
22900
+ startColor: ensureRGBAValue(opt.startColor)
22901
+ },
22902
+ positionOverLifetime: positionOverLifetime
22903
+ };
22904
+ if (opt.startSize) {
22905
+ transform.scale = [
22906
+ opt.startSize,
22907
+ opt.startSize / (opt.sizeAspect || 1),
22908
+ 1
22909
+ ];
22790
22910
  }
22791
- for(var _iterator3 = _create_for_of_iterator_helper_loose(playableAssetDatas), _step3; !(_step3 = _iterator3()).done;){
22792
- var playableAsset = _step3.value;
22793
- //@ts-expect-error
22794
- jsonScene.miscs.push(playableAsset);
22911
+ if (opt.startRotation) {
22912
+ if (!transform.rotation) {
22913
+ transform.rotation = [
22914
+ 0,
22915
+ 0,
22916
+ opt.startRotation
22917
+ ];
22918
+ } else {
22919
+ transform.rotation[2] += opt.startRotation;
22920
+ }
22795
22921
  }
22796
- }
22797
- function convertBinaryAsset(bins, jsonScene) {
22798
- //@ts-expect-error
22799
- jsonScene.bins = bins.map(function(bin) {
22800
- return {
22801
- url: bin.url,
22802
- "dataType": "BinaryAsset",
22803
- id: generateGUID()
22922
+ var rotationOverLifetime = sprite.rotationOverLifetime;
22923
+ if (rotationOverLifetime) {
22924
+ var rot = ret.rotationOverLifetime = {
22925
+ separateAxes: rotationOverLifetime.separateAxes,
22926
+ asRotation: rotationOverLifetime.asRotation
22804
22927
  };
22805
- });
22928
+ if (rot.separateAxes) {
22929
+ rot.x = ensureFixedNumber(rotationOverLifetime.x);
22930
+ rot.y = ensureFixedNumber(rotationOverLifetime.y);
22931
+ rot.z = ensureFixedNumber(rotationOverLifetime.z);
22932
+ } else {
22933
+ rot.z = ensureFixedNumber(rotationOverLifetime.angularVelocity);
22934
+ }
22935
+ }
22936
+ var colorOverLifetime = sprite.colorOverLifetime;
22937
+ if (colorOverLifetime) {
22938
+ var col = ret.colorOverLifetime = {
22939
+ opacity: ensureFixedNumber(colorOverLifetime.opacity)
22940
+ };
22941
+ if (colorOverLifetime.color) {
22942
+ col.color = getGradientColor(colorOverLifetime.color);
22943
+ }
22944
+ }
22945
+ var sizeOverLifetime = sprite.sizeOverLifetime;
22946
+ if (sizeOverLifetime) {
22947
+ ret.sizeOverLifetime = {
22948
+ separateAxes: sizeOverLifetime.separateAxes,
22949
+ size: ensureFixedNumber(sizeOverLifetime.size),
22950
+ x: ensureFixedNumber(sizeOverLifetime.x),
22951
+ y: ensureFixedNumber(sizeOverLifetime.y),
22952
+ z: ensureFixedNumber(sizeOverLifetime.z)
22953
+ };
22954
+ }
22955
+ return ret;
22806
22956
  }
22807
- function convertSpineData(resource, content, jsonScene) {
22808
- //@ts-expect-error
22809
- content.resource = {
22810
- "atlas": {
22811
- "bins": {
22812
- //@ts-expect-error
22813
- "id": jsonScene.bins[resource.atlas[1][0]].id
22814
- },
22815
- "source": resource.atlas[1].slice(1)
22816
- },
22817
- "skeleton": {
22818
- "bins": {
22819
- //@ts-expect-error
22820
- "id": jsonScene.bins[resource.skeleton[1][0]].id
22821
- },
22822
- "source": resource.skeleton[1].slice(1)
22823
- },
22824
- "skeletonType": resource.skeletonType,
22825
- "images": resource.images.map(function(i) {
22826
- return {
22827
- //@ts-expect-error
22828
- id: jsonScene.textures[i].id
22829
- };
22830
- })
22831
- };
22957
+ function getStandardSpriteContent(sprite, transform) {
22958
+ var ret = getStandardNullContent(sprite, transform);
22959
+ var texAni = sprite.textureSheetAnimation;
22960
+ if (texAni) {
22961
+ ret.textureSheetAnimation = {
22962
+ row: texAni.row,
22963
+ col: texAni.col,
22964
+ total: texAni.total || undefined,
22965
+ animate: texAni.animate
22966
+ };
22967
+ }
22968
+ ret.renderer = sprite.renderer;
22969
+ if (sprite.splits) {
22970
+ ret.splits = sprite.splits;
22971
+ }
22972
+ if (sprite.interaction) {
22973
+ ret.interaction = sprite.interaction;
22974
+ }
22975
+ return ret;
22832
22976
  }
22833
22977
 
22834
22978
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
@@ -23210,7 +23354,7 @@ function getBackgroundImage(template, variables) {
23210
23354
  }
23211
23355
  function _combineImageTemplate() {
23212
23356
  _combineImageTemplate = _async_to_generator(function(url, template, variables) {
23213
- var image, drawImage, templateBackground, _tmp;
23357
+ var image, templateBackground;
23214
23358
  return __generator(this, function(_state) {
23215
23359
  switch(_state.label){
23216
23360
  case 0:
@@ -23241,37 +23385,25 @@ function _combineImageTemplate() {
23241
23385
  image
23242
23386
  ];
23243
23387
  }
23244
- drawImage = image;
23245
23388
  // 获取动态换图的图片对象或 url 地址
23246
23389
  templateBackground = getBackgroundImage(template, variables);
23247
- if (!(templateBackground && isString(templateBackground) && templateBackground !== image.src)) return [
23248
- 3,
23249
- 7
23250
- ];
23251
- if (!isString(templateBackground)) return [
23252
- 3,
23253
- 5
23254
- ];
23255
- return [
23256
- 4,
23257
- loadImage(templateBackground)
23258
- ];
23259
- case 4:
23260
- _tmp = _state.sent();
23261
- return [
23262
- 3,
23263
- 6
23264
- ];
23265
- case 5:
23266
- _tmp = templateBackground;
23267
- _state.label = 6;
23268
- case 6:
23269
- drawImage = _tmp;
23270
- _state.label = 7;
23271
- case 7:
23390
+ if (templateBackground) {
23391
+ if (isString(templateBackground) && templateBackground !== image.src) {
23392
+ return [
23393
+ 2,
23394
+ loadImage(templateBackground)
23395
+ ];
23396
+ }
23397
+ if (_instanceof1(templateBackground, HTMLImageElement)) {
23398
+ return [
23399
+ 2,
23400
+ templateBackground
23401
+ ];
23402
+ }
23403
+ }
23272
23404
  return [
23273
23405
  2,
23274
- drawImage
23406
+ image
23275
23407
  ];
23276
23408
  }
23277
23409
  });
@@ -23605,14 +23737,6 @@ var seed$1 = 1;
23605
23737
  case 0:
23606
23738
  // TODO: 后面切换到新的数据版本,就不用掉用 getStandardJSON 做转换了
23607
23739
  jsonScene = getStandardJSON(json);
23608
- // FIXME: hack globalVolume,specification 更新后需移除
23609
- // @ts-expect-error
23610
- json.compositions.forEach(function(composition, i) {
23611
- if (composition.globalVolume) {
23612
- // @ts-expect-error
23613
- jsonScene.compositions[i].globalVolume = composition.globalVolume;
23614
- }
23615
- });
23616
23740
  _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins, sceneCompositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, images = jsonScene.images;
23617
23741
  pluginSystem = new PluginSystem(plugins);
23618
23742
  return [
@@ -23743,15 +23867,17 @@ var seed$1 = 1;
23743
23867
  _this_options = _this.options, useCompressedTexture = _this_options.useCompressedTexture, variables = _this_options.variables;
23744
23868
  baseUrl = _this.baseUrl;
23745
23869
  jobs = images.map(/*#__PURE__*/ _async_to_generator(function(img, idx) {
23746
- var png, webp, imageURL, webpURL, template, background, url, isVideo, loadFn, resultImage, e, compressed, src, bufferURL, _ref, url1, image;
23870
+ var png, webp, avif, imageURL, webpURL, avifURL, template, background, url, isVideo, loadFn, resultImage, e, compressed, src, bufferURL, _ref, url1, image, _tmp;
23747
23871
  return __generator(this, function(_state) {
23748
23872
  switch(_state.label){
23749
23873
  case 0:
23750
- png = img.url, webp = img.webp;
23874
+ png = img.url, webp = img.webp, avif = img.avif;
23751
23875
  // eslint-disable-next-line compat/compat
23752
23876
  imageURL = new URL(png, baseUrl).href;
23753
23877
  // eslint-disable-next-line compat/compat
23754
23878
  webpURL = webp && new URL(webp, baseUrl).href;
23879
+ // eslint-disable-next-line compat/compat
23880
+ avifURL = avif && new URL(avif, baseUrl).href;
23755
23881
  if (!("template" in img)) return [
23756
23882
  3,
23757
23883
  8
@@ -23851,12 +23977,30 @@ var seed$1 = 1;
23851
23977
  }
23852
23978
  _state.label = 9;
23853
23979
  case 9:
23980
+ if (!avifURL) return [
23981
+ 3,
23982
+ 11
23983
+ ];
23854
23984
  return [
23855
23985
  4,
23856
- loadWebPOptional(imageURL, webpURL)
23986
+ loadAVIFOptional(imageURL, avifURL)
23857
23987
  ];
23858
23988
  case 10:
23859
- _ref = _state.sent(), url1 = _ref.url, image = _ref.image;
23989
+ _tmp = _state.sent();
23990
+ return [
23991
+ 3,
23992
+ 13
23993
+ ];
23994
+ case 11:
23995
+ return [
23996
+ 4,
23997
+ loadWebPOptional(imageURL, webpURL)
23998
+ ];
23999
+ case 12:
24000
+ _tmp = _state.sent();
24001
+ _state.label = 13;
24002
+ case 13:
24003
+ _ref = _tmp, url1 = _ref.url, image = _ref.image;
23860
24004
  _this.assets[idx] = {
23861
24005
  url: url1,
23862
24006
  type: exports.TextureSourceType.image
@@ -24400,9 +24544,7 @@ var listOrder = 0;
24400
24544
  }
24401
24545
  var _proto = CompositionSourceManager.prototype;
24402
24546
  _proto.getContent = function getContent(composition) {
24403
- // TODO: specification 中补充 globalVolume 类型
24404
- // @ts-expect-error
24405
- var id = composition.id, duration = composition.duration, name = composition.name, endBehavior = composition.endBehavior, camera = composition.camera, globalVolume = composition.globalVolume, _composition_startTime = composition.startTime, startTime = _composition_startTime === void 0 ? 0 : _composition_startTime;
24547
+ var id = composition.id, duration = composition.duration, name = composition.name, endBehavior = composition.endBehavior, camera = composition.camera, _composition_startTime = composition.startTime, startTime = _composition_startTime === void 0 ? 0 : _composition_startTime;
24406
24548
  var items = this.assembleItems(composition);
24407
24549
  return _extends({}, composition, {
24408
24550
  id: id,
@@ -24412,8 +24554,7 @@ var listOrder = 0;
24412
24554
  // looping,
24413
24555
  items: items,
24414
24556
  camera: camera,
24415
- startTime: startTime,
24416
- globalVolume: globalVolume
24557
+ startTime: startTime
24417
24558
  });
24418
24559
  };
24419
24560
  _proto.assembleItems = function assembleItems(composition) {
@@ -24575,7 +24716,6 @@ var listOrder = 0;
24575
24716
  this.rootComposition = this.rootItem.addComponent(CompositionComponent);
24576
24717
  this.rootComposition.data = sourceContent;
24577
24718
  var imageUsage = !reusable && imgUsage;
24578
- this.globalVolume = sourceContent.globalVolume;
24579
24719
  this.width = width;
24580
24720
  this.height = height;
24581
24721
  this.renderOrder = baseRenderOrder;
@@ -26780,7 +26920,10 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
26780
26920
  return FBGeometryDataT;
26781
26921
  }();
26782
26922
 
26783
- var EffectsPackage = /*#__PURE__*/ function() {
26923
+ /**
26924
+ * @since 2.0.0
26925
+ * @internal
26926
+ */ var EffectsPackage = /*#__PURE__*/ function() {
26784
26927
  function EffectsPackage() {
26785
26928
  this.exportObjectDatas = [];
26786
26929
  }
@@ -26805,8 +26948,7 @@ var EffectsPackage = /*#__PURE__*/ function() {
26805
26948
  }
26806
26949
  effectsPackage.exportObjects = exportObjects;
26807
26950
  FBEffectsPackageData.finishFBEffectsPackageDataBuffer(fbb, effectsPackage.pack(fbb));
26808
- var buffer = fbb.asUint8Array(); // Of type `Uint8Array`.
26809
- return buffer;
26951
+ return fbb.asUint8Array(); // Of type `Uint8Array`.
26810
26952
  };
26811
26953
  _proto.deserializeFromBinary = function deserializeFromBinary(buffer) {
26812
26954
  var buf = new ByteBuffer(buffer);
@@ -26834,37 +26976,35 @@ var EffectsPackage = /*#__PURE__*/ function() {
26834
26976
  _proto.geometryDataToBinary = function geometryDataToBinary(geometryData) {
26835
26977
  var fbb = new Builder(1);
26836
26978
  var fbGeometryData = new FBGeometryDataT();
26837
- fbGeometryData.indexFormat = geometryData.indexFormat;
26838
- fbGeometryData.indexOffset = geometryData.indexOffset;
26839
- fbGeometryData.mode = geometryData.mode;
26840
- fbGeometryData.id = geometryData.id;
26841
- var _geometryData_boneNames;
26842
- fbGeometryData.boneNames = (_geometryData_boneNames = geometryData.boneNames) != null ? _geometryData_boneNames : [];
26843
- var _geometryData_rootBoneName;
26844
- fbGeometryData.rootBoneName = (_geometryData_rootBoneName = geometryData.rootBoneName) != null ? _geometryData_rootBoneName : "";
26845
- var _geometryData_inverseBindMatrices;
26846
- fbGeometryData.inverseBindMatrices = (_geometryData_inverseBindMatrices = geometryData.inverseBindMatrices) != null ? _geometryData_inverseBindMatrices : [];
26847
- var _geometryData_binaryData;
26848
- fbGeometryData.binaryData = (_geometryData_binaryData = geometryData.binaryData) != null ? _geometryData_binaryData : [];
26979
+ var indexFormat = geometryData.indexFormat, indexOffset = geometryData.indexOffset, mode = geometryData.mode, id = geometryData.id, vertexData = geometryData.vertexData, _geometryData_boneNames = geometryData.boneNames, boneNames = _geometryData_boneNames === void 0 ? [] : _geometryData_boneNames, _geometryData_rootBoneName = geometryData.rootBoneName, rootBoneName = _geometryData_rootBoneName === void 0 ? "" : _geometryData_rootBoneName, _geometryData_inverseBindMatrices = geometryData.inverseBindMatrices, inverseBindMatrices = _geometryData_inverseBindMatrices === void 0 ? [] : _geometryData_inverseBindMatrices, _geometryData_binaryData = geometryData.binaryData, binaryData = _geometryData_binaryData === void 0 ? [] : _geometryData_binaryData;
26980
+ fbGeometryData.indexFormat = indexFormat;
26981
+ fbGeometryData.indexOffset = indexOffset;
26982
+ fbGeometryData.mode = mode;
26983
+ fbGeometryData.id = id;
26984
+ fbGeometryData.boneNames = boneNames;
26985
+ fbGeometryData.rootBoneName = rootBoneName;
26986
+ fbGeometryData.inverseBindMatrices = inverseBindMatrices;
26987
+ fbGeometryData.binaryData = binaryData;
26849
26988
  var fbVertexdata = new FBVertexDataT();
26850
- fbVertexdata.vertexCount = geometryData.vertexData.vertexCount;
26989
+ fbVertexdata.vertexCount = vertexData.vertexCount;
26851
26990
  fbVertexdata.channels = [];
26852
- for(var _iterator = _create_for_of_iterator_helper_loose(geometryData.vertexData.channels), _step; !(_step = _iterator()).done;){
26991
+ for(var _iterator = _create_for_of_iterator_helper_loose(vertexData.channels), _step; !(_step = _iterator()).done;){
26853
26992
  var channel = _step.value;
26854
- var fbChannel = new FBVertexChannelT(channel.semantic, channel.offset, channel.format, channel.dimension, channel.normalize);
26993
+ var semantic = channel.semantic, offset = channel.offset, format = channel.format, dimension = channel.dimension, normalize = channel.normalize;
26994
+ var fbChannel = new FBVertexChannelT(semantic, offset, format, dimension, normalize);
26855
26995
  fbVertexdata.channels.push(fbChannel);
26856
26996
  }
26857
26997
  fbGeometryData.vertexData = fbVertexdata;
26858
26998
  var fbSubMeshes = [];
26859
26999
  for(var _iterator1 = _create_for_of_iterator_helper_loose(geometryData.subMeshes), _step1; !(_step1 = _iterator1()).done;){
26860
27000
  var subMesh = _step1.value;
26861
- var fbSubMesh = new FBSubMeshT(subMesh.offset, subMesh.indexCount, subMesh.vertexCount);
27001
+ var offset1 = subMesh.offset, indexCount = subMesh.indexCount, vertexCount = subMesh.vertexCount;
27002
+ var fbSubMesh = new FBSubMeshT(offset1, indexCount, vertexCount);
26862
27003
  fbSubMeshes.push(fbSubMesh);
26863
27004
  }
26864
27005
  fbGeometryData.subMeshes = fbSubMeshes;
26865
27006
  FBEffectsPackageData.finishFBEffectsPackageDataBuffer(fbb, fbGeometryData.pack(fbb));
26866
- var buffer = fbb.asUint8Array(); // Of type `Uint8Array`.
26867
- return buffer;
27007
+ return fbb.asUint8Array(); // Of type `Uint8Array`.
26868
27008
  };
26869
27009
  _proto.binaryToGeometryData = function binaryToGeometryData(buffer) {
26870
27010
  var buf = new ByteBuffer(buffer);
@@ -26886,7 +27026,8 @@ var EffectsPackage = /*#__PURE__*/ function() {
26886
27026
  semantic: (_channel_semantic = channel.semantic()) != null ? _channel_semantic : "",
26887
27027
  offset: channel.offset(),
26888
27028
  format: channel.format(),
26889
- dimension: channel.dimension()
27029
+ dimension: channel.dimension(),
27030
+ normalize: channel.normalize()
26890
27031
  };
26891
27032
  vertexData.channels.push(vertexChannel);
26892
27033
  }
@@ -26899,7 +27040,8 @@ var EffectsPackage = /*#__PURE__*/ function() {
26899
27040
  }
26900
27041
  var subMesh = {
26901
27042
  offset: fbSubMesh.offset(),
26902
- vertexCount: fbSubMesh.vertexCount()
27043
+ vertexCount: fbSubMesh.vertexCount(),
27044
+ indexCount: fbSubMesh.indexCount()
26903
27045
  };
26904
27046
  subMeshes.push(subMesh);
26905
27047
  }
@@ -27328,7 +27470,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
27328
27470
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
27329
27471
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
27330
27472
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
27331
- var version$1 = "2.0.0-alpha.27";
27473
+ var version$1 = "2.0.0-alpha.29";
27332
27474
  logger.info("Core version: " + version$1 + ".");
27333
27475
 
27334
27476
  var _obj;
@@ -28961,7 +29103,7 @@ setMaxSpriteMeshItemCount(8);
28961
29103
  */ Mesh.create = function(engine, props) {
28962
29104
  return new ThreeMesh(engine, props);
28963
29105
  };
28964
- var version = "2.0.0-alpha.27";
29106
+ var version = "2.0.0-alpha.29";
28965
29107
  logger.info("THREEJS plugin version: " + version + ".");
28966
29108
 
28967
29109
  exports.AbstractPlugin = AbstractPlugin;
@@ -29094,7 +29236,6 @@ exports.createGLContext = createGLContext;
29094
29236
  exports.createKeyFrameMeta = createKeyFrameMeta;
29095
29237
  exports.createShaderWithMacros = createShaderWithMacros;
29096
29238
  exports.createShape = createShape;
29097
- exports.createVFXItem = createVFXItem;
29098
29239
  exports.createValueGetter = createValueGetter;
29099
29240
  exports.decimalEqual = decimalEqual;
29100
29241
  exports.defaultGlobalVolume = defaultGlobalVolume;
@@ -29150,6 +29291,8 @@ exports.isArray = isArray;
29150
29291
  exports.isCanvas = isCanvas;
29151
29292
  exports.isFunction = isFunction;
29152
29293
  exports.isIOS = isIOS;
29294
+ exports.isIOSByUA = isIOSByUA;
29295
+ exports.isMiniProgram = isMiniProgram;
29153
29296
  exports.isObject = isObject;
29154
29297
  exports.isSceneJSON = isSceneJSON;
29155
29298
  exports.isSceneURL = isSceneURL;
@@ -29160,9 +29303,11 @@ exports.isUniformStruct = isUniformStruct;
29160
29303
  exports.isUniformStructArray = isUniformStructArray;
29161
29304
  exports.isValidFontFamily = isValidFontFamily;
29162
29305
  exports.isWebGL2 = isWebGL2;
29306
+ exports.isWechatMiniApp = isWechatMiniApp;
29163
29307
  exports.itemFrag = itemFrag;
29164
29308
  exports.itemFrameFrag = itemFrameFrag;
29165
29309
  exports.itemVert = itemVert;
29310
+ exports.loadAVIFOptional = loadAVIFOptional;
29166
29311
  exports.loadBinary = loadBinary;
29167
29312
  exports.loadBlob = loadBlob;
29168
29313
  exports.loadImage = loadImage;