@galacean/effects-core 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/camera.d.ts +4 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/post-process-volume.d.ts +15 -0
- package/dist/composition-source-manager.d.ts +0 -2
- package/dist/composition.d.ts +6 -5
- package/dist/downloader.d.ts +9 -0
- package/dist/effects-package.d.ts +10 -6
- package/dist/index.js +825 -680
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +822 -680
- package/dist/index.mjs.map +1 -1
- package/dist/math/translate.d.ts +1 -1
- package/dist/plugins/interact/interact-item.d.ts +1 -0
- package/dist/plugins/particle/particle-system.d.ts +1 -0
- package/dist/plugins/sprite/sprite-item.d.ts +0 -1
- package/dist/plugins/text/text-item.d.ts +8 -0
- package/dist/render/global-volume.d.ts +4 -5
- package/dist/render/render-frame.d.ts +6 -6
- package/dist/scene.d.ts +1 -1
- package/dist/template-image.d.ts +3 -3
- package/dist/utils/device.d.ts +3 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/vfx-item.d.ts +1 -7
- package/package.json +2 -2
- package/dist/asset-migrations.d.ts +0 -5
- package/dist/plugins/cal/animation-mixer-playable.d.ts +0 -4
- package/dist/plugins/cal/animation-playable-output.d.ts +0 -4
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.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.29
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -440,16 +440,27 @@ function isIOS() {
|
|
|
440
440
|
// real ios device not in simulator
|
|
441
441
|
return !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
|
|
442
442
|
}
|
|
443
|
+
function isIOSByUA() {
|
|
444
|
+
var str = navigator.userAgent.toLowerCase();
|
|
445
|
+
var ver = str.match(/cpu (iphone )?os (.*?) like mac os/);
|
|
446
|
+
return ver ? parseInt(ver[2], 10) : 0;
|
|
447
|
+
}
|
|
443
448
|
function isAndroid() {
|
|
444
449
|
return /\b[Aa]ndroid\b/.test(navigator.userAgent);
|
|
445
450
|
}
|
|
446
451
|
function isSimulatorCellPhone() {
|
|
447
452
|
return isAndroid() || /\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent);
|
|
448
453
|
}
|
|
454
|
+
function isMiniProgram() {
|
|
455
|
+
return isAlipayMiniApp() || isWechatMiniApp();
|
|
456
|
+
}
|
|
449
457
|
function isAlipayMiniApp() {
|
|
450
458
|
var _my;
|
|
451
459
|
return typeof my !== "undefined" && ((_my = my) == null ? void 0 : _my.renderTarget) === "web";
|
|
452
460
|
}
|
|
461
|
+
function isWechatMiniApp() {
|
|
462
|
+
return window.__wxjs_environment === "miniprogram";
|
|
463
|
+
}
|
|
453
464
|
|
|
454
465
|
function imageDataFromColor(value) {
|
|
455
466
|
if (isString(value)) {
|
|
@@ -4587,9 +4598,6 @@ function getDirectStore(target) {
|
|
|
4587
4598
|
};
|
|
4588
4599
|
return EffectsObject;
|
|
4589
4600
|
}();
|
|
4590
|
-
__decorate([
|
|
4591
|
-
serialize()
|
|
4592
|
-
], EffectsObject.prototype, "guid", void 0);
|
|
4593
4601
|
|
|
4594
4602
|
/**
|
|
4595
4603
|
* @since 2.0.0
|
|
@@ -4867,8 +4875,8 @@ var CameraController = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
4867
4875
|
camera.far = this.options.far;
|
|
4868
4876
|
camera.fov = this.options.fov;
|
|
4869
4877
|
camera.clipMode = this.options.clipMode;
|
|
4870
|
-
camera.position = this.transform.
|
|
4871
|
-
camera.rotation = this.transform.
|
|
4878
|
+
camera.position = this.transform.getWorldPosition();
|
|
4879
|
+
camera.rotation = this.transform.getWorldRotation();
|
|
4872
4880
|
}
|
|
4873
4881
|
};
|
|
4874
4882
|
_proto.fromData = function fromData(data) {
|
|
@@ -7853,6 +7861,7 @@ var TextureSourceType;
|
|
|
7853
7861
|
return Downloader;
|
|
7854
7862
|
}();
|
|
7855
7863
|
var webPFailed = false;
|
|
7864
|
+
var avifFailed = false;
|
|
7856
7865
|
/**
|
|
7857
7866
|
* 异步加载一个 WebP 图片文件,如果不支持 WebP,则加载 PNG 图片文件
|
|
7858
7867
|
* @param png - PNG 图片文件的 URL
|
|
@@ -7928,6 +7937,81 @@ function _loadWebPOptional() {
|
|
|
7928
7937
|
});
|
|
7929
7938
|
return _loadWebPOptional.apply(this, arguments);
|
|
7930
7939
|
}
|
|
7940
|
+
/**
|
|
7941
|
+
* 异步加载一个 AVIF 图片文件,如果不支持 AVIF,则加载 PNG 图片文件
|
|
7942
|
+
* @param png - PNG 图片文件的 URL
|
|
7943
|
+
* @param avif - AVIF 图片文件的 URL
|
|
7944
|
+
*/ function loadAVIFOptional(png, avif) {
|
|
7945
|
+
return _loadAVIFOptional.apply(this, arguments);
|
|
7946
|
+
}
|
|
7947
|
+
function _loadAVIFOptional() {
|
|
7948
|
+
_loadAVIFOptional = _async_to_generator(function(png, avif) {
|
|
7949
|
+
var image, image1, image2;
|
|
7950
|
+
return __generator(this, function(_state) {
|
|
7951
|
+
switch(_state.label){
|
|
7952
|
+
case 0:
|
|
7953
|
+
if (!(avifFailed || !avif)) return [
|
|
7954
|
+
3,
|
|
7955
|
+
2
|
|
7956
|
+
];
|
|
7957
|
+
return [
|
|
7958
|
+
4,
|
|
7959
|
+
loadImage(png)
|
|
7960
|
+
];
|
|
7961
|
+
case 1:
|
|
7962
|
+
image = _state.sent();
|
|
7963
|
+
return [
|
|
7964
|
+
2,
|
|
7965
|
+
{
|
|
7966
|
+
image: image,
|
|
7967
|
+
url: png
|
|
7968
|
+
}
|
|
7969
|
+
];
|
|
7970
|
+
case 2:
|
|
7971
|
+
_state.trys.push([
|
|
7972
|
+
2,
|
|
7973
|
+
4,
|
|
7974
|
+
,
|
|
7975
|
+
6
|
|
7976
|
+
]);
|
|
7977
|
+
return [
|
|
7978
|
+
4,
|
|
7979
|
+
loadImage(avif)
|
|
7980
|
+
];
|
|
7981
|
+
case 3:
|
|
7982
|
+
image1 = _state.sent();
|
|
7983
|
+
return [
|
|
7984
|
+
2,
|
|
7985
|
+
{
|
|
7986
|
+
image: image1,
|
|
7987
|
+
url: avif
|
|
7988
|
+
}
|
|
7989
|
+
];
|
|
7990
|
+
case 4:
|
|
7991
|
+
_state.sent();
|
|
7992
|
+
avifFailed = true;
|
|
7993
|
+
return [
|
|
7994
|
+
4,
|
|
7995
|
+
loadImage(png)
|
|
7996
|
+
];
|
|
7997
|
+
case 5:
|
|
7998
|
+
image2 = _state.sent();
|
|
7999
|
+
return [
|
|
8000
|
+
2,
|
|
8001
|
+
{
|
|
8002
|
+
image: image2,
|
|
8003
|
+
url: png
|
|
8004
|
+
}
|
|
8005
|
+
];
|
|
8006
|
+
case 6:
|
|
8007
|
+
return [
|
|
8008
|
+
2
|
|
8009
|
+
];
|
|
8010
|
+
}
|
|
8011
|
+
});
|
|
8012
|
+
});
|
|
8013
|
+
return _loadAVIFOptional.apply(this, arguments);
|
|
8014
|
+
}
|
|
7931
8015
|
/**
|
|
7932
8016
|
* 异步加载一个图片文件
|
|
7933
8017
|
* @param source - 图片文件的 URL、Blob 或 HTMLImageElement 对象
|
|
@@ -8129,31 +8213,35 @@ function deserializeMipmapTexture(textureOptions, bins, engine) {
|
|
|
8129
8213
|
}
|
|
8130
8214
|
function _deserializeMipmapTexture() {
|
|
8131
8215
|
_deserializeMipmapTexture = _async_to_generator(function(textureOptions, bins, engine, files) {
|
|
8132
|
-
var mipmaps, target,
|
|
8216
|
+
var mipmaps, target, jobs, loadedMipmaps, mipmaps1, target1, jobs1, loadedMipmaps1, bin;
|
|
8133
8217
|
return __generator(this, function(_state) {
|
|
8134
8218
|
switch(_state.label){
|
|
8135
8219
|
case 0:
|
|
8136
8220
|
if (files === void 0) files = [];
|
|
8137
8221
|
if (!(textureOptions.target === 34067)) return [
|
|
8138
8222
|
3,
|
|
8139
|
-
|
|
8223
|
+
2
|
|
8140
8224
|
];
|
|
8141
8225
|
mipmaps = textureOptions.mipmaps, target = textureOptions.target;
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
for(_iterator = _create_for_of_iterator_helper_loose(mipmaps); !(_step = _iterator()).done;){
|
|
8145
|
-
level = _step.value;
|
|
8146
|
-
newLevel = [];
|
|
8147
|
-
for(_iterator1 = _create_for_of_iterator_helper_loose(level); !(_step1 = _iterator1()).done;){
|
|
8148
|
-
face = _step1.value;
|
|
8226
|
+
jobs = mipmaps.map(function(mipmap) {
|
|
8227
|
+
return Promise.all(mipmap.map(function(pointer) {
|
|
8149
8228
|
// @ts-expect-error
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8229
|
+
if (pointer.id) {
|
|
8230
|
+
// @ts-expect-error
|
|
8231
|
+
var loadedImageAsset = engine.assetLoader.loadGUID(pointer.id);
|
|
8232
|
+
// @ts-expect-error
|
|
8233
|
+
return loadedImageAsset.data;
|
|
8234
|
+
} else {
|
|
8235
|
+
return loadMipmapImage(pointer, bins);
|
|
8236
|
+
}
|
|
8237
|
+
}));
|
|
8238
|
+
});
|
|
8239
|
+
return [
|
|
8240
|
+
4,
|
|
8241
|
+
Promise.all(jobs)
|
|
8242
|
+
];
|
|
8243
|
+
case 1:
|
|
8244
|
+
loadedMipmaps = _state.sent();
|
|
8157
8245
|
return [
|
|
8158
8246
|
2,
|
|
8159
8247
|
_extends({
|
|
@@ -8167,17 +8255,17 @@ function _deserializeMipmapTexture() {
|
|
|
8167
8255
|
}
|
|
8168
8256
|
})
|
|
8169
8257
|
];
|
|
8170
|
-
case
|
|
8258
|
+
case 2:
|
|
8171
8259
|
// TODO: 补充测试用例
|
|
8172
8260
|
mipmaps1 = textureOptions.mipmaps, target1 = textureOptions.target;
|
|
8173
|
-
|
|
8261
|
+
jobs1 = mipmaps1.map(function(pointer) {
|
|
8174
8262
|
return loadMipmapImage(pointer, bins);
|
|
8175
8263
|
});
|
|
8176
8264
|
return [
|
|
8177
8265
|
4,
|
|
8178
|
-
Promise.all(
|
|
8266
|
+
Promise.all(jobs1)
|
|
8179
8267
|
];
|
|
8180
|
-
case
|
|
8268
|
+
case 3:
|
|
8181
8269
|
loadedMipmaps1 = _state.sent();
|
|
8182
8270
|
bin = files[mipmaps1[0][1][0]].url;
|
|
8183
8271
|
return [
|
|
@@ -8200,7 +8288,7 @@ function _deserializeMipmapTexture() {
|
|
|
8200
8288
|
}
|
|
8201
8289
|
})
|
|
8202
8290
|
];
|
|
8203
|
-
case
|
|
8291
|
+
case 4:
|
|
8204
8292
|
return [
|
|
8205
8293
|
2
|
|
8206
8294
|
];
|
|
@@ -11555,7 +11643,7 @@ var valueDefine = "#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValu
|
|
|
11555
11643
|
|
|
11556
11644
|
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.;}";
|
|
11557
11645
|
|
|
11558
|
-
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);}";
|
|
11646
|
+
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);}";
|
|
11559
11647
|
|
|
11560
11648
|
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);}";
|
|
11561
11649
|
|
|
@@ -11565,7 +11653,7 @@ var gaussianDownVFrag = "precision highp float;varying vec2 uv;uniform sampler2D
|
|
|
11565
11653
|
|
|
11566
11654
|
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);}";
|
|
11567
11655
|
|
|
11568
|
-
var thresholdFrag = "precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4
|
|
11656
|
+
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);}";
|
|
11569
11657
|
|
|
11570
11658
|
// Bloom 阈值 Pass
|
|
11571
11659
|
var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
|
|
@@ -11843,7 +11931,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11843
11931
|
this.screenMesh.material.setFloat("_Brightness", brightness);
|
|
11844
11932
|
this.screenMesh.material.setFloat("_Saturation", saturation);
|
|
11845
11933
|
this.screenMesh.material.setFloat("_Contrast", contrast);
|
|
11846
|
-
this.screenMesh.material.setInt("_UseBloom", useBloom);
|
|
11934
|
+
this.screenMesh.material.setInt("_UseBloom", Number(useBloom));
|
|
11847
11935
|
if (useBloom) {
|
|
11848
11936
|
this.screenMesh.material.setTexture("_GaussianTex", this.mainTexture);
|
|
11849
11937
|
this.screenMesh.material.setFloat("_BloomIntensity", bloomIntensity);
|
|
@@ -11855,7 +11943,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11855
11943
|
this.screenMesh.material.setVector2("_VignetteCenter", new Vector2(0.5, 0.5));
|
|
11856
11944
|
this.screenMesh.material.setVector3("_VignetteColor", new Vector3(0.0, 0.0, 0.0));
|
|
11857
11945
|
}
|
|
11858
|
-
this.screenMesh.material.setInt("_UseToneMapping", useToneMapping);
|
|
11946
|
+
this.screenMesh.material.setInt("_UseToneMapping", Number(useToneMapping));
|
|
11859
11947
|
renderer.renderMeshes([
|
|
11860
11948
|
this.screenMesh
|
|
11861
11949
|
]);
|
|
@@ -11863,29 +11951,6 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11863
11951
|
return ToneMappingPass;
|
|
11864
11952
|
}(RenderPass);
|
|
11865
11953
|
|
|
11866
|
-
/**
|
|
11867
|
-
* 后处理配置
|
|
11868
|
-
*/ var defaultGlobalVolume = {
|
|
11869
|
-
useHDR: false,
|
|
11870
|
-
usePostProcessing: false,
|
|
11871
|
-
/***** Material Uniform *****/ // Bloom
|
|
11872
|
-
useBloom: 1.0,
|
|
11873
|
-
threshold: 1.0,
|
|
11874
|
-
bloomIntensity: 1.0,
|
|
11875
|
-
// ColorAdjustments
|
|
11876
|
-
brightness: 1.0,
|
|
11877
|
-
saturation: 1.0,
|
|
11878
|
-
contrast: 1.0,
|
|
11879
|
-
// Vignette
|
|
11880
|
-
// vignetteColor: new math.Color(0, 0, 0, 1),
|
|
11881
|
-
// vignetteCenter: new math.Vector2(0.5, 0.5),
|
|
11882
|
-
vignetteIntensity: 0.2,
|
|
11883
|
-
vignetteSmoothness: 0.4,
|
|
11884
|
-
vignetteRoundness: 1.0,
|
|
11885
|
-
// ToneMapping
|
|
11886
|
-
useToneMapping: 1
|
|
11887
|
-
};
|
|
11888
|
-
|
|
11889
11954
|
var RENDER_PASS_NAME_PREFIX = "_effects_default_";
|
|
11890
11955
|
var seed$5 = 1;
|
|
11891
11956
|
/**
|
|
@@ -11909,7 +11974,7 @@ var seed$5 = 1;
|
|
|
11909
11974
|
} : _options_clearAction;
|
|
11910
11975
|
var engine = renderer.engine;
|
|
11911
11976
|
if (globalVolume) {
|
|
11912
|
-
this.globalVolume =
|
|
11977
|
+
this.globalVolume = globalVolume;
|
|
11913
11978
|
}
|
|
11914
11979
|
this.globalUniforms = new GlobalUniforms();
|
|
11915
11980
|
var attachments = []; //渲染场景物体Pass的RT
|
|
@@ -11952,20 +12017,36 @@ var seed$5 = 1;
|
|
|
11952
12017
|
];
|
|
11953
12018
|
this.setRenderPasses(renderPasses);
|
|
11954
12019
|
if (this.globalVolume) {
|
|
11955
|
-
var useBloom = this.globalVolume.useBloom;
|
|
11956
12020
|
var sceneTextureHandle = new RenderTargetHandle(engine); //保存后处理前的屏幕图像
|
|
11957
|
-
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
|
|
11964
|
-
|
|
11965
|
-
|
|
11966
|
-
|
|
11967
|
-
|
|
11968
|
-
|
|
12021
|
+
var gaussianStep = 7; // 高斯模糊的迭代次数,次数越高模糊范围越大
|
|
12022
|
+
var viewport = [
|
|
12023
|
+
0,
|
|
12024
|
+
0,
|
|
12025
|
+
this.renderer.getWidth() / 2,
|
|
12026
|
+
this.renderer.getHeight() / 2
|
|
12027
|
+
];
|
|
12028
|
+
var gaussianDownResults = new Array(gaussianStep); //存放多个高斯Pass的模糊结果,用于Bloom
|
|
12029
|
+
var textureType1 = this.globalVolume.useHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
|
|
12030
|
+
var bloomThresholdPass = new BloomThresholdPass(renderer, {
|
|
12031
|
+
name: "BloomThresholdPass",
|
|
12032
|
+
attachments: [
|
|
12033
|
+
{
|
|
12034
|
+
texture: {
|
|
12035
|
+
format: glContext.RGBA,
|
|
12036
|
+
type: textureType1,
|
|
12037
|
+
minFilter: glContext.LINEAR,
|
|
12038
|
+
magFilter: glContext.LINEAR
|
|
12039
|
+
}
|
|
12040
|
+
}
|
|
12041
|
+
]
|
|
12042
|
+
});
|
|
12043
|
+
bloomThresholdPass.sceneTextureHandle = sceneTextureHandle;
|
|
12044
|
+
this.addRenderPass(bloomThresholdPass);
|
|
12045
|
+
for(var i = 0; i < gaussianStep; i++){
|
|
12046
|
+
gaussianDownResults[i] = new RenderTargetHandle(engine);
|
|
12047
|
+
var gaussianDownHPass = new HQGaussianDownSamplePass(renderer, "H", {
|
|
12048
|
+
name: "GaussianDownPassH" + i,
|
|
12049
|
+
viewport: viewport,
|
|
11969
12050
|
attachments: [
|
|
11970
12051
|
{
|
|
11971
12052
|
texture: {
|
|
@@ -11977,74 +12058,50 @@ var seed$5 = 1;
|
|
|
11977
12058
|
}
|
|
11978
12059
|
]
|
|
11979
12060
|
});
|
|
11980
|
-
|
|
11981
|
-
|
|
11982
|
-
|
|
11983
|
-
|
|
11984
|
-
|
|
11985
|
-
|
|
11986
|
-
|
|
11987
|
-
|
|
11988
|
-
|
|
11989
|
-
|
|
11990
|
-
format: glContext.RGBA,
|
|
11991
|
-
type: textureType1,
|
|
11992
|
-
minFilter: glContext.LINEAR,
|
|
11993
|
-
magFilter: glContext.LINEAR
|
|
11994
|
-
}
|
|
11995
|
-
}
|
|
11996
|
-
]
|
|
11997
|
-
});
|
|
11998
|
-
var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", {
|
|
11999
|
-
name: "GaussianDownPassV" + i,
|
|
12000
|
-
viewport: viewport,
|
|
12001
|
-
attachments: [
|
|
12002
|
-
{
|
|
12003
|
-
texture: {
|
|
12004
|
-
format: glContext.RGBA,
|
|
12005
|
-
type: textureType1,
|
|
12006
|
-
minFilter: glContext.LINEAR,
|
|
12007
|
-
magFilter: glContext.LINEAR
|
|
12008
|
-
}
|
|
12061
|
+
var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", {
|
|
12062
|
+
name: "GaussianDownPassV" + i,
|
|
12063
|
+
viewport: viewport,
|
|
12064
|
+
attachments: [
|
|
12065
|
+
{
|
|
12066
|
+
texture: {
|
|
12067
|
+
format: glContext.RGBA,
|
|
12068
|
+
type: textureType1,
|
|
12069
|
+
minFilter: glContext.LINEAR,
|
|
12070
|
+
magFilter: glContext.LINEAR
|
|
12009
12071
|
}
|
|
12010
|
-
|
|
12011
|
-
|
|
12012
|
-
|
|
12013
|
-
|
|
12014
|
-
|
|
12015
|
-
|
|
12016
|
-
|
|
12017
|
-
|
|
12018
|
-
|
|
12019
|
-
|
|
12020
|
-
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
|
|
12025
|
-
|
|
12026
|
-
|
|
12027
|
-
|
|
12028
|
-
|
|
12029
|
-
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
|
|
12072
|
+
}
|
|
12073
|
+
]
|
|
12074
|
+
});
|
|
12075
|
+
gaussianDownVPass.gaussianResult = gaussianDownResults[i];
|
|
12076
|
+
this.addRenderPass(gaussianDownHPass);
|
|
12077
|
+
this.addRenderPass(gaussianDownVPass);
|
|
12078
|
+
viewport[2] /= 2;
|
|
12079
|
+
viewport[3] /= 2;
|
|
12080
|
+
// TODO 限制最大迭代
|
|
12081
|
+
}
|
|
12082
|
+
viewport[2] *= 4;
|
|
12083
|
+
viewport[3] *= 4;
|
|
12084
|
+
for(var i1 = 0; i1 < gaussianStep - 1; i1++){
|
|
12085
|
+
var gaussianUpPass = new HQGaussianUpSamplePass(renderer, {
|
|
12086
|
+
name: "GaussianUpPass" + i1,
|
|
12087
|
+
viewport: viewport,
|
|
12088
|
+
attachments: [
|
|
12089
|
+
{
|
|
12090
|
+
texture: {
|
|
12091
|
+
format: glContext.RGBA,
|
|
12092
|
+
type: textureType1,
|
|
12093
|
+
minFilter: glContext.LINEAR,
|
|
12094
|
+
magFilter: glContext.LINEAR
|
|
12033
12095
|
}
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
|
|
12038
|
-
|
|
12039
|
-
|
|
12040
|
-
|
|
12041
|
-
}
|
|
12042
|
-
var postProcessPass;
|
|
12043
|
-
if (useBloom) {
|
|
12044
|
-
postProcessPass = new ToneMappingPass(renderer, sceneTextureHandle);
|
|
12045
|
-
} else {
|
|
12046
|
-
postProcessPass = new ToneMappingPass(renderer);
|
|
12096
|
+
}
|
|
12097
|
+
]
|
|
12098
|
+
});
|
|
12099
|
+
gaussianUpPass.gaussianDownSampleResult = gaussianDownResults[gaussianStep - 2 - i1];
|
|
12100
|
+
this.addRenderPass(gaussianUpPass);
|
|
12101
|
+
viewport[2] *= 2;
|
|
12102
|
+
viewport[3] *= 2;
|
|
12047
12103
|
}
|
|
12104
|
+
var postProcessPass = new ToneMappingPass(renderer, sceneTextureHandle);
|
|
12048
12105
|
this.addRenderPass(postProcessPass);
|
|
12049
12106
|
}
|
|
12050
12107
|
this.semantics = new SemanticMap(options.semantics);
|
|
@@ -12954,6 +13011,28 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
12954
13011
|
return Renderer;
|
|
12955
13012
|
}();
|
|
12956
13013
|
|
|
13014
|
+
/**
|
|
13015
|
+
* 后处理配置
|
|
13016
|
+
*/ var defaultGlobalVolume = {
|
|
13017
|
+
useHDR: false,
|
|
13018
|
+
/***** Material Uniform *****/ // Bloom
|
|
13019
|
+
useBloom: true,
|
|
13020
|
+
threshold: 1.0,
|
|
13021
|
+
bloomIntensity: 1.0,
|
|
13022
|
+
// ColorAdjustments
|
|
13023
|
+
brightness: 1.0,
|
|
13024
|
+
saturation: 1.0,
|
|
13025
|
+
contrast: 1.0,
|
|
13026
|
+
// Vignette
|
|
13027
|
+
// vignetteColor: new math.Color(0, 0, 0, 1),
|
|
13028
|
+
// vignetteCenter: new math.Vector2(0.5, 0.5),
|
|
13029
|
+
vignetteIntensity: 0.2,
|
|
13030
|
+
vignetteSmoothness: 0.4,
|
|
13031
|
+
vignetteRoundness: 1.0,
|
|
13032
|
+
// ToneMapping
|
|
13033
|
+
useToneMapping: true
|
|
13034
|
+
};
|
|
13035
|
+
|
|
12957
13036
|
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";
|
|
12958
13037
|
var fragment = "\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor;\n}\n";
|
|
12959
13038
|
var seed$4 = 1;
|
|
@@ -13081,6 +13160,7 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13081
13160
|
1
|
|
13082
13161
|
];
|
|
13083
13162
|
/** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
|
|
13163
|
+
_this.hasBeenAddedToComposition = false;
|
|
13084
13164
|
_this.getHitTestParams = function(force) {
|
|
13085
13165
|
if (!_this.clickable) {
|
|
13086
13166
|
return;
|
|
@@ -13111,10 +13191,6 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13111
13191
|
this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
|
|
13112
13192
|
}
|
|
13113
13193
|
}
|
|
13114
|
-
composition.addInteractiveItem(this.item, options.type);
|
|
13115
|
-
this.item.onEnd = function() {
|
|
13116
|
-
return composition.removeInteractiveItem(_this.item, options.type);
|
|
13117
|
-
};
|
|
13118
13194
|
if (options.type === InteractType.DRAG) {
|
|
13119
13195
|
if (env !== PLAYER_OPTIONS_ENV_EDITOR || options.enableInEditor) {
|
|
13120
13196
|
composition.event && this.beginDragTarget(options, composition.event);
|
|
@@ -13125,10 +13201,25 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13125
13201
|
this.materials = this.previewContent.mesh.materials;
|
|
13126
13202
|
}
|
|
13127
13203
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
13204
|
+
this.item.onEnd = function() {
|
|
13205
|
+
if (_this.item && _this.item.composition) {
|
|
13206
|
+
var _this_previewContent;
|
|
13207
|
+
_this.item.composition.removeInteractiveItem(_this.item, _this.item.props.content.options.type);
|
|
13208
|
+
_this.clickable = false;
|
|
13209
|
+
_this.hasBeenAddedToComposition = false;
|
|
13210
|
+
(_this_previewContent = _this.previewContent) == null ? void 0 : _this_previewContent.mesh.dispose();
|
|
13211
|
+
_this.endDragTarget();
|
|
13212
|
+
}
|
|
13213
|
+
};
|
|
13128
13214
|
};
|
|
13129
13215
|
_proto.update = function update(dt) {
|
|
13130
13216
|
var _this_previewContent;
|
|
13131
13217
|
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
13218
|
+
if (!this.hasBeenAddedToComposition && this.item.composition) {
|
|
13219
|
+
var options = this.item.props.content.options;
|
|
13220
|
+
this.item.composition.addInteractiveItem(this.item, options.type);
|
|
13221
|
+
this.hasBeenAddedToComposition = true;
|
|
13222
|
+
}
|
|
13132
13223
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
13133
13224
|
return;
|
|
13134
13225
|
}
|
|
@@ -13148,15 +13239,7 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13148
13239
|
this.previewContent.mesh.render(renderer);
|
|
13149
13240
|
}
|
|
13150
13241
|
};
|
|
13151
|
-
_proto.onDestroy = function onDestroy() {
|
|
13152
|
-
if (this.item && this.item.composition) {
|
|
13153
|
-
var _this_previewContent;
|
|
13154
|
-
this.item.composition.removeInteractiveItem(this.item, this.item.props.content.options.type);
|
|
13155
|
-
this.clickable = false;
|
|
13156
|
-
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.mesh.dispose();
|
|
13157
|
-
this.endDragTarget();
|
|
13158
|
-
}
|
|
13159
|
-
};
|
|
13242
|
+
_proto.onDestroy = function onDestroy() {};
|
|
13160
13243
|
_proto.endDragTarget = function endDragTarget() {
|
|
13161
13244
|
// OVERRIDE
|
|
13162
13245
|
};
|
|
@@ -13739,6 +13822,10 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
13739
13822
|
}
|
|
13740
13823
|
if (!this.spriteMaterial) {
|
|
13741
13824
|
this.spriteMaterial = boundObject.getComponent(SpriteComponent).material;
|
|
13825
|
+
var startColor = this.spriteMaterial.getVector4("_Color");
|
|
13826
|
+
if (startColor) {
|
|
13827
|
+
this.startColor = startColor.toArray();
|
|
13828
|
+
}
|
|
13742
13829
|
}
|
|
13743
13830
|
var colorInc = vecFill(tempColor, 1);
|
|
13744
13831
|
var colorChanged;
|
|
@@ -13768,12 +13855,6 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
13768
13855
|
this.colorOverLifetime = colorStopsFromGradient(colorOverLifetime.color[1]);
|
|
13769
13856
|
}
|
|
13770
13857
|
}
|
|
13771
|
-
this.startColor = clipData.startColor || [
|
|
13772
|
-
1,
|
|
13773
|
-
1,
|
|
13774
|
-
1,
|
|
13775
|
-
1
|
|
13776
|
-
];
|
|
13777
13858
|
return this;
|
|
13778
13859
|
};
|
|
13779
13860
|
return SpriteColorPlayable;
|
|
@@ -14081,7 +14162,7 @@ var SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
14081
14162
|
var splits = item.splits, renderer = item.renderer, textureSheetAnimation = item.textureSheetAnimation;
|
|
14082
14163
|
var sx = 1, sy = 1;
|
|
14083
14164
|
if (renderer.shape) {
|
|
14084
|
-
var _renderer_shape = renderer.shape,
|
|
14165
|
+
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;
|
|
14085
14166
|
var point = new Float32Array(aPoint);
|
|
14086
14167
|
var position = [];
|
|
14087
14168
|
var atlasOffset = [];
|
|
@@ -14852,8 +14933,7 @@ var RectangleEdge = /*#__PURE__*/ function() {
|
|
|
14852
14933
|
}();
|
|
14853
14934
|
var Edge = /*#__PURE__*/ function() {
|
|
14854
14935
|
function Edge(args) {
|
|
14855
|
-
|
|
14856
|
-
this._d = (args.width || 1) / 2;
|
|
14936
|
+
this._d = args.width || 1;
|
|
14857
14937
|
this.arcMode = args.arcMode;
|
|
14858
14938
|
}
|
|
14859
14939
|
var _proto = Edge.prototype;
|
|
@@ -16952,6 +17032,12 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16952
17032
|
area: area
|
|
16953
17033
|
};
|
|
16954
17034
|
};
|
|
17035
|
+
_proto.onAttached = function onAttached() {
|
|
17036
|
+
Component.prototype.onAttached.call(this);
|
|
17037
|
+
this.renderer.item = this.item;
|
|
17038
|
+
this.item.components.push(this.renderer);
|
|
17039
|
+
this.item.rendererComponents.push(this.renderer);
|
|
17040
|
+
};
|
|
16955
17041
|
_proto.fromData = function fromData(data) {
|
|
16956
17042
|
Component.prototype.fromData.call(this, data);
|
|
16957
17043
|
var props = data;
|
|
@@ -17233,9 +17319,6 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
17233
17319
|
}
|
|
17234
17320
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
17235
17321
|
this.item._content = this;
|
|
17236
|
-
this.renderer.item = this.item;
|
|
17237
|
-
this.item.components.push(this.renderer);
|
|
17238
|
-
this.item.rendererComponents.push(this.renderer);
|
|
17239
17322
|
};
|
|
17240
17323
|
_create_class(ParticleSystem, [
|
|
17241
17324
|
{
|
|
@@ -19265,7 +19348,7 @@ function compareTracks(a, b) {
|
|
|
19265
19348
|
_proto.hitTest = function hitTest(ray, x, y, regions, force, options) {
|
|
19266
19349
|
var _this, _loop = function(i) {
|
|
19267
19350
|
var item = _this.items[i];
|
|
19268
|
-
if (item.getVisible() && !item.ended && !VFXItem.isComposition(item) && !skip(item)) {
|
|
19351
|
+
if (item.getVisible() && item.transform.getValid() && !item.ended && !VFXItem.isComposition(item) && !skip(item)) {
|
|
19269
19352
|
var hitParams = item.getHitTestParams(force);
|
|
19270
19353
|
if (hitParams) {
|
|
19271
19354
|
var success = false;
|
|
@@ -19421,18 +19504,6 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
19421
19504
|
var tempWidth = fontSize + letterSpace;
|
|
19422
19505
|
this.autoWidth = autoWidth;
|
|
19423
19506
|
this.maxTextWidth = text.length * tempWidth;
|
|
19424
|
-
// if (autoWidth) {
|
|
19425
|
-
// this.width = this.maxTextWidth + this.lineWidth;
|
|
19426
|
-
// this.height = fontSize + this.lineHeight;
|
|
19427
|
-
// } else {
|
|
19428
|
-
// if (textWidth) {
|
|
19429
|
-
// this.maxCharCount = Math.floor((textWidth - this.lineWidth) / (tempWidth));
|
|
19430
|
-
// this.width = textWidth;
|
|
19431
|
-
// } else {
|
|
19432
|
-
// this.width = basicScale[0] * 100;
|
|
19433
|
-
// }
|
|
19434
|
-
// this.height = basicScale[1] * 100;
|
|
19435
|
-
// }
|
|
19436
19507
|
this.width = textWidth;
|
|
19437
19508
|
this.height = textHeight;
|
|
19438
19509
|
this.letterSpace = letterSpace;
|
|
@@ -19869,6 +19940,17 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19869
19940
|
this.isDirty = true;
|
|
19870
19941
|
};
|
|
19871
19942
|
/**
|
|
19943
|
+
* 设置自适应宽高开关
|
|
19944
|
+
* @param value - 是否自适应宽高开关
|
|
19945
|
+
* @returns
|
|
19946
|
+
*/ _proto.setAutoWidth = function setAutoWidth(value) {
|
|
19947
|
+
if (this.textLayout.autoWidth === value) {
|
|
19948
|
+
return;
|
|
19949
|
+
}
|
|
19950
|
+
this.textLayout.autoWidth = value;
|
|
19951
|
+
this.isDirty = true;
|
|
19952
|
+
};
|
|
19953
|
+
/**
|
|
19872
19954
|
* 更新文本
|
|
19873
19955
|
* @returns
|
|
19874
19956
|
*/ _proto.updateTexture = function updateTexture(flipY) {
|
|
@@ -19881,20 +19963,26 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19881
19963
|
var layout = this.textLayout;
|
|
19882
19964
|
var fontScale = style.fontScale;
|
|
19883
19965
|
var width = (layout.width + style.fontOffset) * fontScale;
|
|
19884
|
-
var
|
|
19966
|
+
var finalHeight = layout.lineHeight * this.lineCount;
|
|
19885
19967
|
var fontSize = style.fontSize * fontScale;
|
|
19886
19968
|
var lineHeight = layout.lineHeight * fontScale;
|
|
19887
19969
|
this.char = (this.text || "").split("");
|
|
19888
19970
|
this.canvas.width = width;
|
|
19889
|
-
|
|
19890
|
-
|
|
19971
|
+
if (layout.autoWidth) {
|
|
19972
|
+
this.canvas.height = finalHeight * fontScale;
|
|
19973
|
+
this.item.transform.size.set(1, finalHeight / layout.height);
|
|
19974
|
+
} else {
|
|
19975
|
+
this.canvas.height = layout.height * fontScale;
|
|
19976
|
+
}
|
|
19977
|
+
var height = this.canvas.height;
|
|
19978
|
+
context.clearRect(0, 0, width, height);
|
|
19891
19979
|
// fix bug 1/255
|
|
19892
19980
|
context.fillStyle = "rgba(255, 255, 255, 0.0039)";
|
|
19893
19981
|
if (!flipY) {
|
|
19894
19982
|
context.translate(0, height);
|
|
19895
19983
|
context.scale(1, -1);
|
|
19896
19984
|
}
|
|
19897
|
-
context.fillRect(0, 0, width,
|
|
19985
|
+
context.fillRect(0, 0, width, height);
|
|
19898
19986
|
style.fontDesc = this.getFontDesc();
|
|
19899
19987
|
context.font = style.fontDesc;
|
|
19900
19988
|
if (style.hasShadow) {
|
|
@@ -20178,6 +20266,76 @@ function geometryToTriangles(geometry) {
|
|
|
20178
20266
|
return res;
|
|
20179
20267
|
}
|
|
20180
20268
|
|
|
20269
|
+
var PostProcessVolume = /*#__PURE__*/ function(ItemBehaviour) {
|
|
20270
|
+
_inherits(PostProcessVolume, ItemBehaviour);
|
|
20271
|
+
function PostProcessVolume() {
|
|
20272
|
+
var _this;
|
|
20273
|
+
_this = ItemBehaviour.apply(this, arguments) || this;
|
|
20274
|
+
_this.useHDR = true;
|
|
20275
|
+
// Bloom
|
|
20276
|
+
_this.useBloom = true;
|
|
20277
|
+
_this.threshold = 1.0;
|
|
20278
|
+
_this.bloomIntensity = 1.0;
|
|
20279
|
+
// ColorAdjustments
|
|
20280
|
+
_this.brightness = 1.0;
|
|
20281
|
+
_this.saturation = 1.0;
|
|
20282
|
+
_this.contrast = 1.0;
|
|
20283
|
+
// Vignette
|
|
20284
|
+
_this.vignetteIntensity = 0.2;
|
|
20285
|
+
_this.vignetteSmoothness = 0.4;
|
|
20286
|
+
_this.vignetteRoundness = 1.0;
|
|
20287
|
+
// ToneMapping
|
|
20288
|
+
_this.useToneMapping = true // 1: true, 0: false
|
|
20289
|
+
;
|
|
20290
|
+
return _this;
|
|
20291
|
+
}
|
|
20292
|
+
var _proto = PostProcessVolume.prototype;
|
|
20293
|
+
_proto.start = function start() {
|
|
20294
|
+
var composition = this.item.composition;
|
|
20295
|
+
if (composition) {
|
|
20296
|
+
composition.globalVolume = this;
|
|
20297
|
+
composition.createRenderFrame();
|
|
20298
|
+
}
|
|
20299
|
+
};
|
|
20300
|
+
return PostProcessVolume;
|
|
20301
|
+
}(ItemBehaviour);
|
|
20302
|
+
__decorate([
|
|
20303
|
+
serialize()
|
|
20304
|
+
], PostProcessVolume.prototype, "useHDR", void 0);
|
|
20305
|
+
__decorate([
|
|
20306
|
+
serialize()
|
|
20307
|
+
], PostProcessVolume.prototype, "useBloom", void 0);
|
|
20308
|
+
__decorate([
|
|
20309
|
+
serialize()
|
|
20310
|
+
], PostProcessVolume.prototype, "threshold", void 0);
|
|
20311
|
+
__decorate([
|
|
20312
|
+
serialize()
|
|
20313
|
+
], PostProcessVolume.prototype, "bloomIntensity", void 0);
|
|
20314
|
+
__decorate([
|
|
20315
|
+
serialize()
|
|
20316
|
+
], PostProcessVolume.prototype, "brightness", void 0);
|
|
20317
|
+
__decorate([
|
|
20318
|
+
serialize()
|
|
20319
|
+
], PostProcessVolume.prototype, "saturation", void 0);
|
|
20320
|
+
__decorate([
|
|
20321
|
+
serialize()
|
|
20322
|
+
], PostProcessVolume.prototype, "contrast", void 0);
|
|
20323
|
+
__decorate([
|
|
20324
|
+
serialize()
|
|
20325
|
+
], PostProcessVolume.prototype, "vignetteIntensity", void 0);
|
|
20326
|
+
__decorate([
|
|
20327
|
+
serialize()
|
|
20328
|
+
], PostProcessVolume.prototype, "vignetteSmoothness", void 0);
|
|
20329
|
+
__decorate([
|
|
20330
|
+
serialize()
|
|
20331
|
+
], PostProcessVolume.prototype, "vignetteRoundness", void 0);
|
|
20332
|
+
__decorate([
|
|
20333
|
+
serialize()
|
|
20334
|
+
], PostProcessVolume.prototype, "useToneMapping", void 0);
|
|
20335
|
+
PostProcessVolume = __decorate([
|
|
20336
|
+
effectsClass("PostProcessVolume")
|
|
20337
|
+
], PostProcessVolume);
|
|
20338
|
+
|
|
20181
20339
|
var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
20182
20340
|
_inherits(VFXItem, EffectsObject);
|
|
20183
20341
|
function VFXItem(engine, props) {
|
|
@@ -20401,7 +20559,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20401
20559
|
/**
|
|
20402
20560
|
* 获取元素用于计算光线投射的面片类型和参数
|
|
20403
20561
|
* @override
|
|
20404
|
-
* @param force 元素没有开启交互也返回参数
|
|
20562
|
+
* @param force - 元素没有开启交互也返回参数
|
|
20405
20563
|
*/ _proto.getHitTestParams = function getHitTestParams(force) {
|
|
20406
20564
|
// OVERRIDE
|
|
20407
20565
|
};
|
|
@@ -20651,46 +20809,10 @@ var Item;
|
|
|
20651
20809
|
}
|
|
20652
20810
|
Item.isNull = isNull;
|
|
20653
20811
|
})(Item || (Item = {}));
|
|
20654
|
-
|
|
20655
|
-
|
|
20656
|
-
|
|
20657
|
-
|
|
20658
|
-
*/ function createVFXItem(props, composition) {
|
|
20659
|
-
var type = props.type;
|
|
20660
|
-
var pluginName = props.pluginName;
|
|
20661
|
-
if (!pluginName) {
|
|
20662
|
-
switch(type){
|
|
20663
|
-
case ItemType.null:
|
|
20664
|
-
pluginName = "cal";
|
|
20665
|
-
break;
|
|
20666
|
-
case ItemType.sprite:
|
|
20667
|
-
pluginName = "sprite";
|
|
20668
|
-
break;
|
|
20669
|
-
case ItemType.particle:
|
|
20670
|
-
pluginName = "particle";
|
|
20671
|
-
break;
|
|
20672
|
-
case ItemType.interact:
|
|
20673
|
-
pluginName = "interact";
|
|
20674
|
-
break;
|
|
20675
|
-
case ItemType.camera:
|
|
20676
|
-
pluginName = "camera";
|
|
20677
|
-
break;
|
|
20678
|
-
case ItemType.text:
|
|
20679
|
-
pluginName = "text";
|
|
20680
|
-
break;
|
|
20681
|
-
case ItemType.tree:
|
|
20682
|
-
pluginName = "tree";
|
|
20683
|
-
break;
|
|
20684
|
-
default:
|
|
20685
|
-
throw new Error("Invalid vfx item type.");
|
|
20686
|
-
}
|
|
20687
|
-
}
|
|
20688
|
-
return composition.pluginSystem.createPluginItem(pluginName, props, composition);
|
|
20689
|
-
}
|
|
20690
|
-
|
|
20691
|
-
var pluginLoaderMap = {};
|
|
20692
|
-
var defaultPlugins = [];
|
|
20693
|
-
var pluginCtrlMap = {};
|
|
20812
|
+
|
|
20813
|
+
var pluginLoaderMap = {};
|
|
20814
|
+
var defaultPlugins = [];
|
|
20815
|
+
var pluginCtrlMap = {};
|
|
20694
20816
|
/**
|
|
20695
20817
|
* 注册 plugin
|
|
20696
20818
|
* @param name
|
|
@@ -20699,6 +20821,9 @@ var pluginCtrlMap = {};
|
|
|
20699
20821
|
* @param isDefault load
|
|
20700
20822
|
*/ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20701
20823
|
function registerPlugin(name, pluginClass, itemClass, isDefault) {
|
|
20824
|
+
if (pluginCtrlMap[name]) {
|
|
20825
|
+
logger.error("Duplicate registration for plugin " + name + ".");
|
|
20826
|
+
}
|
|
20702
20827
|
pluginCtrlMap[name] = itemClass;
|
|
20703
20828
|
pluginLoaderMap[name] = pluginClass;
|
|
20704
20829
|
if (isDefault) {
|
|
@@ -21171,27 +21296,46 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21171
21296
|
res1
|
|
21172
21297
|
];
|
|
21173
21298
|
case 7:
|
|
21174
|
-
if (isObject(property) && property.constructor === Object)
|
|
21175
|
-
|
|
21176
|
-
|
|
21177
|
-
|
|
21178
|
-
|
|
21179
|
-
|
|
21180
|
-
for(_iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property)); !(_step1 = _iterator1()).done;){
|
|
21181
|
-
key = _step1.value;
|
|
21182
|
-
res2[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
|
|
21183
|
-
}
|
|
21184
|
-
return [
|
|
21185
|
-
2,
|
|
21186
|
-
res2
|
|
21187
|
-
];
|
|
21299
|
+
if (!(isObject(property) && property.constructor === Object)) return [
|
|
21300
|
+
3,
|
|
21301
|
+
12
|
|
21302
|
+
];
|
|
21303
|
+
if (type) {
|
|
21304
|
+
res2 = new type();
|
|
21188
21305
|
} else {
|
|
21189
|
-
|
|
21190
|
-
2,
|
|
21191
|
-
property
|
|
21192
|
-
];
|
|
21306
|
+
res2 = {};
|
|
21193
21307
|
}
|
|
21308
|
+
_iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property));
|
|
21309
|
+
_state.label = 8;
|
|
21194
21310
|
case 8:
|
|
21311
|
+
if (!!(_step1 = _iterator1()).done) return [
|
|
21312
|
+
3,
|
|
21313
|
+
11
|
|
21314
|
+
];
|
|
21315
|
+
key = _step1.value;
|
|
21316
|
+
return [
|
|
21317
|
+
4,
|
|
21318
|
+
SerializationHelper.deserializePropertyAsync(property[key], engine, level + 1)
|
|
21319
|
+
];
|
|
21320
|
+
case 9:
|
|
21321
|
+
res2[key] = _state.sent();
|
|
21322
|
+
_state.label = 10;
|
|
21323
|
+
case 10:
|
|
21324
|
+
return [
|
|
21325
|
+
3,
|
|
21326
|
+
8
|
|
21327
|
+
];
|
|
21328
|
+
case 11:
|
|
21329
|
+
return [
|
|
21330
|
+
2,
|
|
21331
|
+
res2
|
|
21332
|
+
];
|
|
21333
|
+
case 12:
|
|
21334
|
+
return [
|
|
21335
|
+
2,
|
|
21336
|
+
property
|
|
21337
|
+
];
|
|
21338
|
+
case 13:
|
|
21195
21339
|
return [
|
|
21196
21340
|
2
|
|
21197
21341
|
];
|
|
@@ -21277,8 +21421,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21277
21421
|
if (this.engine.objectInstance[guid]) {
|
|
21278
21422
|
return this.engine.objectInstance[guid];
|
|
21279
21423
|
}
|
|
21280
|
-
var effectsObject;
|
|
21281
21424
|
var effectsObjectData = this.findData(guid);
|
|
21425
|
+
var effectsObject;
|
|
21282
21426
|
if (!effectsObjectData) {
|
|
21283
21427
|
console.error("Object data with uuid: " + guid + " not found.");
|
|
21284
21428
|
return undefined;
|
|
@@ -21314,7 +21458,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21314
21458
|
_proto.loadGUIDAsync = function loadGUIDAsync(guid) {
|
|
21315
21459
|
var _this = this;
|
|
21316
21460
|
return _async_to_generator(function() {
|
|
21317
|
-
var
|
|
21461
|
+
var effectsObjectData, effectsObject, classConstructor;
|
|
21318
21462
|
return __generator(this, function(_state) {
|
|
21319
21463
|
switch(_state.label){
|
|
21320
21464
|
case 0:
|
|
@@ -21850,277 +21994,39 @@ function getBezierCurveFromHermiteInGE(geHermiteCurves) {
|
|
|
21850
21994
|
});
|
|
21851
21995
|
}
|
|
21852
21996
|
|
|
21853
|
-
function
|
|
21854
|
-
var
|
|
21855
|
-
var
|
|
21856
|
-
var shape = {
|
|
21857
|
-
type: ShapeType.NONE
|
|
21858
|
-
};
|
|
21859
|
-
if (particle.shape) {
|
|
21860
|
-
var _particle_shape_shape;
|
|
21861
|
-
var shapeType = (_particle_shape_shape = particle.shape.shape) == null ? void 0 : _particle_shape_shape.replace(/([A-Z])/g, "_$1").toUpperCase().replace(/^_/, "");
|
|
21862
|
-
shape = _extends({}, particle.shape, {
|
|
21863
|
-
type: ShapeType[shapeType]
|
|
21864
|
-
});
|
|
21865
|
-
if (particle.shape.upDirection) {
|
|
21866
|
-
var _particle_shape_upDirection = particle.shape.upDirection, x = _particle_shape_upDirection[0], y = _particle_shape_upDirection[1], z = _particle_shape_upDirection[2];
|
|
21867
|
-
if (x === 0 && y === 0 && z === 0) {
|
|
21868
|
-
delete shape.upDirection;
|
|
21869
|
-
}
|
|
21870
|
-
}
|
|
21871
|
-
}
|
|
21872
|
-
if (options.startTurbulence) {
|
|
21873
|
-
shape.turbulenceX = ensureNumberExpression(options.turbulenceX);
|
|
21874
|
-
shape.turbulenceY = ensureNumberExpression(options.turbulenceY);
|
|
21875
|
-
shape.turbulenceZ = ensureNumberExpression(options.turbulenceZ);
|
|
21876
|
-
}
|
|
21877
|
-
var emission = particle.emission;
|
|
21878
|
-
if (emission.bursts && emission.bursts.length > 0) {
|
|
21879
|
-
emission.bursts = emission.bursts.map(function(b) {
|
|
21880
|
-
return objectValueToNumber(b);
|
|
21881
|
-
});
|
|
21882
|
-
}
|
|
21883
|
-
if (emission.burstOffsets && emission.burstOffsets.length > 0) {
|
|
21884
|
-
emission.burstOffsets = emission.burstOffsets.map(function(b) {
|
|
21885
|
-
return objectValueToNumber(b);
|
|
21886
|
-
});
|
|
21887
|
-
}
|
|
21888
|
-
if (emission.rateOverTime) {
|
|
21889
|
-
emission.rateOverTime = ensureNumberExpression(emission.rateOverTime);
|
|
21890
|
-
}
|
|
21997
|
+
function getStandardCameraContent(model) {
|
|
21998
|
+
var _model_transform;
|
|
21999
|
+
var opt = model.options;
|
|
21891
22000
|
var ret = {
|
|
21892
|
-
renderer: particle.renderer,
|
|
21893
|
-
shape: shape,
|
|
21894
|
-
splits: particle.splits,
|
|
21895
|
-
emission: emission,
|
|
21896
22001
|
options: {
|
|
21897
|
-
|
|
21898
|
-
|
|
21899
|
-
|
|
21900
|
-
|
|
21901
|
-
startSizeY: ensureNumberExpression(options.startSizeY),
|
|
21902
|
-
sizeAspect: ensureNumberExpression(options.sizeAspect),
|
|
21903
|
-
maxCount: options.maxCount,
|
|
21904
|
-
startDelay: ensureNumberExpression(options.startDelay),
|
|
21905
|
-
startColor: ensureColorExpression(options.startColor, true),
|
|
21906
|
-
startRotationZ: ensureNumberExpression(options.startRotation || options.startRotationZ),
|
|
21907
|
-
particleFollowParent: options.particleFollowParent
|
|
21908
|
-
}
|
|
21909
|
-
};
|
|
21910
|
-
if (options.start3DRotation) {
|
|
21911
|
-
ret.options.startRotationX = ensureNumberExpression(options.startRotationX);
|
|
21912
|
-
ret.options.startRotationY = ensureNumberExpression(options.startRotationY);
|
|
21913
|
-
}
|
|
21914
|
-
if (transform && transform.path) {
|
|
21915
|
-
ret.emitterTransform = {
|
|
21916
|
-
path: ensureFixedVec3(transform.path)
|
|
21917
|
-
};
|
|
21918
|
-
}
|
|
21919
|
-
var sizeOverLifetime = particle.sizeOverLifetime;
|
|
21920
|
-
if (sizeOverLifetime) {
|
|
21921
|
-
if (sizeOverLifetime.separateAxes) {
|
|
21922
|
-
ret.sizeOverLifetime = {
|
|
21923
|
-
separateAxes: true,
|
|
21924
|
-
x: ensureNumberExpression(sizeOverLifetime.x),
|
|
21925
|
-
y: ensureNumberExpression(sizeOverLifetime.y)
|
|
21926
|
-
};
|
|
21927
|
-
} else {
|
|
21928
|
-
ret.sizeOverLifetime = {
|
|
21929
|
-
size: ensureNumberExpression(sizeOverLifetime.size)
|
|
21930
|
-
};
|
|
22002
|
+
fov: opt.fov,
|
|
22003
|
+
far: opt.far,
|
|
22004
|
+
near: opt.near,
|
|
22005
|
+
clipMode: opt.clipMode
|
|
21931
22006
|
}
|
|
21932
|
-
}
|
|
21933
|
-
var velocityOverLifetime = particle.velocityOverLifetime || {};
|
|
21934
|
-
var sol = velocityOverLifetime.speedOverLifetime;
|
|
21935
|
-
if (sol) {
|
|
21936
|
-
sol = ensureFixedNumber(sol);
|
|
21937
|
-
} else {
|
|
21938
|
-
sol = undefined;
|
|
21939
|
-
}
|
|
21940
|
-
ret.positionOverLifetime = {
|
|
21941
|
-
gravity: options.gravity,
|
|
21942
|
-
gravityOverLifetime: ensureFixedNumber(options.gravityModifier),
|
|
21943
|
-
startSpeed: ensureNumberExpression(options.startSpeed),
|
|
21944
|
-
speedOverLifetime: sol,
|
|
21945
|
-
asMovement: velocityOverLifetime.asMovement,
|
|
21946
|
-
linearX: ensureNumberExpression(velocityOverLifetime.linearX),
|
|
21947
|
-
linearY: ensureNumberExpression(velocityOverLifetime.linearY),
|
|
21948
|
-
linearZ: ensureNumberExpression(velocityOverLifetime.linearZ),
|
|
21949
|
-
asRotation: velocityOverLifetime.asRotation,
|
|
21950
|
-
orbCenter: velocityOverLifetime.orbCenter,
|
|
21951
|
-
orbitalX: ensureNumberExpression(velocityOverLifetime.orbitalX),
|
|
21952
|
-
orbitalY: ensureNumberExpression(velocityOverLifetime.orbitalY),
|
|
21953
|
-
orbitalZ: ensureNumberExpression(velocityOverLifetime.orbitalZ),
|
|
21954
|
-
forceTarget: velocityOverLifetime.forceTarget,
|
|
21955
|
-
target: velocityOverLifetime.target,
|
|
21956
|
-
forceCurve: ensureFixedNumber(velocityOverLifetime.forceCurve)
|
|
21957
22007
|
};
|
|
21958
|
-
|
|
21959
|
-
|
|
21960
|
-
|
|
21961
|
-
|
|
21962
|
-
|
|
21963
|
-
|
|
21964
|
-
|
|
21965
|
-
|
|
21966
|
-
if (rotationOverLifetime.separateAxes) {
|
|
21967
|
-
ret.rotationOverLifetime.y = ensureFixedNumber(rotationOverLifetime.y);
|
|
21968
|
-
ret.rotationOverLifetime.x = ensureFixedNumber(rotationOverLifetime.x);
|
|
21969
|
-
}
|
|
21970
|
-
}
|
|
21971
|
-
var colorOverLifetime = particle.colorOverLifetime;
|
|
21972
|
-
if (colorOverLifetime) {
|
|
21973
|
-
var col = ret.colorOverLifetime = {
|
|
21974
|
-
opacity: ensureFixedNumber(colorOverLifetime.opacity)
|
|
21975
|
-
};
|
|
21976
|
-
if (colorOverLifetime.color) {
|
|
21977
|
-
col.color = getGradientColor(colorOverLifetime.color);
|
|
21978
|
-
}
|
|
21979
|
-
}
|
|
21980
|
-
var textureSheetAnimation = particle.textureSheetAnimation;
|
|
21981
|
-
if (textureSheetAnimation) {
|
|
21982
|
-
ret.textureSheetAnimation = {
|
|
21983
|
-
row: textureSheetAnimation.row,
|
|
21984
|
-
col: textureSheetAnimation.col,
|
|
21985
|
-
total: textureSheetAnimation.total,
|
|
21986
|
-
animate: textureSheetAnimation.animate,
|
|
21987
|
-
cycles: ensureFixedNumber(textureSheetAnimation.cycles),
|
|
21988
|
-
animationDelay: ensureFixedNumberWithRandom(textureSheetAnimation.animationDelay, 0),
|
|
21989
|
-
animationDuration: ensureFixedNumberWithRandom(textureSheetAnimation.animationDuration, 0)
|
|
21990
|
-
};
|
|
21991
|
-
}
|
|
21992
|
-
var trials = particle.trails;
|
|
21993
|
-
if (trials) {
|
|
21994
|
-
ret.trails = {
|
|
21995
|
-
lifetime: ensureNumberExpression(trials.lifetime),
|
|
21996
|
-
dieWithParticles: trials.dieWithParticles,
|
|
21997
|
-
maxPointPerTrail: trials.maxPointPerTrail,
|
|
21998
|
-
minimumVertexDistance: trials.minimumVertexDistance,
|
|
21999
|
-
widthOverTrail: ensureFixedNumber(trials.widthOverTrail),
|
|
22000
|
-
colorOverTrail: trials.colorOverTrail && getGradientColor(trials.colorOverTrail, false),
|
|
22001
|
-
blending: trials.blending,
|
|
22002
|
-
colorOverLifetime: trials.colorOverLifetime && getGradientColor(trials.colorOverLifetime, false),
|
|
22003
|
-
inheritParticleColor: trials.inheritParticleColor,
|
|
22004
|
-
occlusion: trials.occlusion,
|
|
22005
|
-
transparentOcclusion: trials.transparentOcclusion,
|
|
22006
|
-
orderOffset: trials.orderOffset,
|
|
22007
|
-
sizeAffectsLifetime: trials.sizeAffectsLifetime,
|
|
22008
|
-
sizeAffectsWidth: trials.sizeAffectsWidth,
|
|
22009
|
-
texture: trials.texture,
|
|
22010
|
-
parentAffectsPosition: trials.parentAffectsPosition,
|
|
22011
|
-
opacityOverLifetime: ensureNumberExpression(trials.opacityOverLifetime)
|
|
22008
|
+
var velocityOverLifetime = model.velocityOverLifetime;
|
|
22009
|
+
if (velocityOverLifetime || ((_model_transform = model.transform) == null ? void 0 : _model_transform.path)) {
|
|
22010
|
+
var _model_transform1;
|
|
22011
|
+
var positionOverLifetime = {
|
|
22012
|
+
path: ensureFixedVec3((_model_transform1 = model.transform) == null ? void 0 : _model_transform1.path),
|
|
22013
|
+
linearX: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateX),
|
|
22014
|
+
linearY: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateY),
|
|
22015
|
+
linearZ: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateZ)
|
|
22012
22016
|
};
|
|
22017
|
+
deleteEmptyValue(positionOverLifetime);
|
|
22018
|
+
ret.positionOverLifetime = positionOverLifetime;
|
|
22013
22019
|
}
|
|
22014
|
-
|
|
22015
|
-
|
|
22016
|
-
|
|
22017
|
-
|
|
22018
|
-
|
|
22019
|
-
|
|
22020
|
-
|
|
22020
|
+
var rol = model.rotationOverLifetime;
|
|
22021
|
+
if (rol) {
|
|
22022
|
+
var rotationOverLifetime = {
|
|
22023
|
+
separateAxes: rol.separateAxes,
|
|
22024
|
+
x: ensureFixedNumber(rol == null ? void 0 : rol.rotateX),
|
|
22025
|
+
y: ensureFixedNumber(rol == null ? void 0 : rol.rotateY),
|
|
22026
|
+
z: rol.separateAxes ? ensureFixedNumber(rol == null ? void 0 : rol.rotateZ) : ensureFixedNumber(rol.rotation)
|
|
22021
22027
|
};
|
|
22022
|
-
|
|
22023
|
-
|
|
22024
|
-
}
|
|
22025
|
-
|
|
22026
|
-
function getStandardNullContent(sprite, transform) {
|
|
22027
|
-
var _sprite_transform;
|
|
22028
|
-
var opt = sprite.options;
|
|
22029
|
-
var velocityOverLifetime = sprite.velocityOverLifetime || {};
|
|
22030
|
-
var positionOverLifetime = {
|
|
22031
|
-
path: ensureFixedVec3((_sprite_transform = sprite.transform) == null ? void 0 : _sprite_transform.path),
|
|
22032
|
-
gravity: opt.gravity,
|
|
22033
|
-
gravityOverLifetime: ensureFixedNumber(opt.gravityModifier),
|
|
22034
|
-
direction: opt.direction,
|
|
22035
|
-
startSpeed: opt.startSpeed,
|
|
22036
|
-
asMovement: velocityOverLifetime.asMovement,
|
|
22037
|
-
linearX: ensureFixedNumber(velocityOverLifetime.linearX),
|
|
22038
|
-
linearY: ensureFixedNumber(velocityOverLifetime.linearY),
|
|
22039
|
-
linearZ: ensureFixedNumber(velocityOverLifetime.linearZ),
|
|
22040
|
-
asRotation: velocityOverLifetime.asRotation,
|
|
22041
|
-
orbCenter: velocityOverLifetime.orbCenter,
|
|
22042
|
-
orbitalX: ensureFixedNumber(velocityOverLifetime.orbitalX),
|
|
22043
|
-
orbitalY: ensureFixedNumber(velocityOverLifetime.orbitalY),
|
|
22044
|
-
orbitalZ: ensureFixedNumber(velocityOverLifetime.orbitalZ),
|
|
22045
|
-
speedOverLifetime: ensureFixedNumber(velocityOverLifetime.speedOverLifetime)
|
|
22046
|
-
};
|
|
22047
|
-
deleteEmptyValue(positionOverLifetime);
|
|
22048
|
-
var ret = {
|
|
22049
|
-
options: {
|
|
22050
|
-
startColor: ensureRGBAValue(opt.startColor)
|
|
22051
|
-
},
|
|
22052
|
-
positionOverLifetime: positionOverLifetime
|
|
22053
|
-
};
|
|
22054
|
-
if (opt.startSize) {
|
|
22055
|
-
transform.scale = [
|
|
22056
|
-
opt.startSize,
|
|
22057
|
-
opt.startSize / (opt.sizeAspect || 1),
|
|
22058
|
-
1
|
|
22059
|
-
];
|
|
22060
|
-
}
|
|
22061
|
-
if (opt.startRotation) {
|
|
22062
|
-
if (!transform.rotation) {
|
|
22063
|
-
transform.rotation = [
|
|
22064
|
-
0,
|
|
22065
|
-
0,
|
|
22066
|
-
opt.startRotation
|
|
22067
|
-
];
|
|
22068
|
-
} else {
|
|
22069
|
-
transform.rotation[2] += opt.startRotation;
|
|
22070
|
-
}
|
|
22071
|
-
}
|
|
22072
|
-
var rotationOverLifetime = sprite.rotationOverLifetime;
|
|
22073
|
-
if (rotationOverLifetime) {
|
|
22074
|
-
var rot = ret.rotationOverLifetime = {
|
|
22075
|
-
separateAxes: rotationOverLifetime.separateAxes,
|
|
22076
|
-
asRotation: rotationOverLifetime.asRotation
|
|
22077
|
-
};
|
|
22078
|
-
if (rot.separateAxes) {
|
|
22079
|
-
rot.x = ensureFixedNumber(rotationOverLifetime.x);
|
|
22080
|
-
rot.y = ensureFixedNumber(rotationOverLifetime.y);
|
|
22081
|
-
rot.z = ensureFixedNumber(rotationOverLifetime.z);
|
|
22082
|
-
} else {
|
|
22083
|
-
rot.z = ensureFixedNumber(rotationOverLifetime.angularVelocity);
|
|
22084
|
-
}
|
|
22085
|
-
}
|
|
22086
|
-
var colorOverLifetime = sprite.colorOverLifetime;
|
|
22087
|
-
if (colorOverLifetime) {
|
|
22088
|
-
var col = ret.colorOverLifetime = {
|
|
22089
|
-
opacity: ensureFixedNumber(colorOverLifetime.opacity)
|
|
22090
|
-
};
|
|
22091
|
-
if (colorOverLifetime.color) {
|
|
22092
|
-
col.color = getGradientColor(colorOverLifetime.color);
|
|
22093
|
-
}
|
|
22094
|
-
}
|
|
22095
|
-
var sizeOverLifetime = sprite.sizeOverLifetime;
|
|
22096
|
-
if (sizeOverLifetime) {
|
|
22097
|
-
ret.sizeOverLifetime = {
|
|
22098
|
-
separateAxes: sizeOverLifetime.separateAxes,
|
|
22099
|
-
size: ensureFixedNumber(sizeOverLifetime.size),
|
|
22100
|
-
x: ensureFixedNumber(sizeOverLifetime.x),
|
|
22101
|
-
y: ensureFixedNumber(sizeOverLifetime.y),
|
|
22102
|
-
z: ensureFixedNumber(sizeOverLifetime.z)
|
|
22103
|
-
};
|
|
22104
|
-
}
|
|
22105
|
-
return ret;
|
|
22106
|
-
}
|
|
22107
|
-
function getStandardSpriteContent(sprite, transform) {
|
|
22108
|
-
var ret = getStandardNullContent(sprite, transform);
|
|
22109
|
-
var texAni = sprite.textureSheetAnimation;
|
|
22110
|
-
if (texAni) {
|
|
22111
|
-
ret.textureSheetAnimation = {
|
|
22112
|
-
row: texAni.row,
|
|
22113
|
-
col: texAni.col,
|
|
22114
|
-
total: texAni.total || undefined,
|
|
22115
|
-
animate: texAni.animate
|
|
22116
|
-
};
|
|
22117
|
-
}
|
|
22118
|
-
ret.renderer = sprite.renderer;
|
|
22119
|
-
if (sprite.splits) {
|
|
22120
|
-
ret.splits = sprite.splits;
|
|
22121
|
-
}
|
|
22122
|
-
if (sprite.interaction) {
|
|
22123
|
-
ret.interaction = sprite.interaction;
|
|
22028
|
+
deleteEmptyValue(rotationOverLifetime);
|
|
22029
|
+
ret.rotationOverLifetime = rotationOverLifetime;
|
|
22124
22030
|
}
|
|
22125
22031
|
return ret;
|
|
22126
22032
|
}
|
|
@@ -22165,43 +22071,6 @@ function getStandardInteractContent(ui) {
|
|
|
22165
22071
|
return ret;
|
|
22166
22072
|
}
|
|
22167
22073
|
|
|
22168
|
-
function getStandardCameraContent(model) {
|
|
22169
|
-
var _model_transform;
|
|
22170
|
-
var opt = model.options;
|
|
22171
|
-
var ret = {
|
|
22172
|
-
options: {
|
|
22173
|
-
fov: opt.fov,
|
|
22174
|
-
far: opt.far,
|
|
22175
|
-
near: opt.near,
|
|
22176
|
-
clipMode: opt.clipMode
|
|
22177
|
-
}
|
|
22178
|
-
};
|
|
22179
|
-
var velocityOverLifetime = model.velocityOverLifetime;
|
|
22180
|
-
if (velocityOverLifetime || ((_model_transform = model.transform) == null ? void 0 : _model_transform.path)) {
|
|
22181
|
-
var _model_transform1;
|
|
22182
|
-
var positionOverLifetime = {
|
|
22183
|
-
path: ensureFixedVec3((_model_transform1 = model.transform) == null ? void 0 : _model_transform1.path),
|
|
22184
|
-
linearX: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateX),
|
|
22185
|
-
linearY: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateY),
|
|
22186
|
-
linearZ: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateZ)
|
|
22187
|
-
};
|
|
22188
|
-
deleteEmptyValue(positionOverLifetime);
|
|
22189
|
-
ret.positionOverLifetime = positionOverLifetime;
|
|
22190
|
-
}
|
|
22191
|
-
var rol = model.rotationOverLifetime;
|
|
22192
|
-
if (rol) {
|
|
22193
|
-
var rotationOverLifetime = {
|
|
22194
|
-
separateAxes: rol.separateAxes,
|
|
22195
|
-
x: ensureFixedNumber(rol == null ? void 0 : rol.rotateX),
|
|
22196
|
-
y: ensureFixedNumber(rol == null ? void 0 : rol.rotateY),
|
|
22197
|
-
z: rol.separateAxes ? ensureFixedNumber(rol == null ? void 0 : rol.rotateZ) : ensureFixedNumber(rol.rotation)
|
|
22198
|
-
};
|
|
22199
|
-
deleteEmptyValue(rotationOverLifetime);
|
|
22200
|
-
ret.rotationOverLifetime = rotationOverLifetime;
|
|
22201
|
-
}
|
|
22202
|
-
return ret;
|
|
22203
|
-
}
|
|
22204
|
-
|
|
22205
22074
|
/**
|
|
22206
22075
|
* 2.1 以下版本数据适配(mars-player@2.4.0 及以上版本支持 2.1 以下数据的适配)
|
|
22207
22076
|
*/ function version21Migration(json) {
|
|
@@ -22318,11 +22187,12 @@ function getStandardCameraContent(model) {
|
|
|
22318
22187
|
var _textures;
|
|
22319
22188
|
(_textures = (_result = result).textures) != null ? _textures : _result.textures = [];
|
|
22320
22189
|
result.textures.forEach(function(textureOptions) {
|
|
22190
|
+
var _result_images_textureOptions_source;
|
|
22321
22191
|
textureOptions.id = generateGUID();
|
|
22322
22192
|
textureOptions.dataType = DataType.Texture;
|
|
22323
22193
|
// @ts-expect-error
|
|
22324
22194
|
textureOptions.source = {
|
|
22325
|
-
id: result.images[textureOptions.source].id
|
|
22195
|
+
id: (_result_images_textureOptions_source = result.images[textureOptions.source]) == null ? void 0 : _result_images_textureOptions_source.id
|
|
22326
22196
|
};
|
|
22327
22197
|
});
|
|
22328
22198
|
if (result.textures.length < result.images.length) {
|
|
@@ -22676,8 +22546,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22676
22546
|
var newSpriteColorPlayableAssetData = {
|
|
22677
22547
|
id: generateGUID(),
|
|
22678
22548
|
dataType: "SpriteColorPlayableAsset",
|
|
22679
|
-
colorOverLifetime: item.content.colorOverLifetime
|
|
22680
|
-
startColor: item.content.options.startColor
|
|
22549
|
+
colorOverLifetime: item.content.colorOverLifetime
|
|
22681
22550
|
};
|
|
22682
22551
|
playableAssetDatas.push(newSpriteColorPlayableAssetData);
|
|
22683
22552
|
var newTrackData1 = {
|
|
@@ -22726,83 +22595,358 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22726
22595
|
});
|
|
22727
22596
|
trackDatas.push(newTrackData2);
|
|
22728
22597
|
}
|
|
22729
|
-
var bindingTrackData = {
|
|
22730
|
-
id: generateGUID(),
|
|
22731
|
-
dataType: "ObjectBindingTrack",
|
|
22732
|
-
children: subTrackDatas,
|
|
22733
|
-
clips: []
|
|
22598
|
+
var bindingTrackData = {
|
|
22599
|
+
id: generateGUID(),
|
|
22600
|
+
dataType: "ObjectBindingTrack",
|
|
22601
|
+
children: subTrackDatas,
|
|
22602
|
+
clips: []
|
|
22603
|
+
};
|
|
22604
|
+
trackDatas.push(bindingTrackData);
|
|
22605
|
+
timelineAssetData.tracks.push({
|
|
22606
|
+
id: bindingTrackData.id
|
|
22607
|
+
});
|
|
22608
|
+
sceneBindings.push({
|
|
22609
|
+
key: {
|
|
22610
|
+
id: bindingTrackData.id
|
|
22611
|
+
},
|
|
22612
|
+
value: {
|
|
22613
|
+
id: item.id
|
|
22614
|
+
}
|
|
22615
|
+
});
|
|
22616
|
+
}
|
|
22617
|
+
var trackIds = [];
|
|
22618
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(trackDatas), _step1; !(_step1 = _iterator1()).done;){
|
|
22619
|
+
var trackData = _step1.value;
|
|
22620
|
+
trackIds.push({
|
|
22621
|
+
id: trackData.id
|
|
22622
|
+
});
|
|
22623
|
+
}
|
|
22624
|
+
composition.timelineAsset = {
|
|
22625
|
+
id: timelineAssetData.id
|
|
22626
|
+
};
|
|
22627
|
+
composition.sceneBindings = sceneBindings;
|
|
22628
|
+
jsonScene.miscs.push(timelineAssetData);
|
|
22629
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(trackDatas), _step2; !(_step2 = _iterator2()).done;){
|
|
22630
|
+
var trackData1 = _step2.value;
|
|
22631
|
+
//@ts-expect-error
|
|
22632
|
+
jsonScene.miscs.push(trackData1);
|
|
22633
|
+
}
|
|
22634
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(playableAssetDatas), _step3; !(_step3 = _iterator3()).done;){
|
|
22635
|
+
var playableAsset = _step3.value;
|
|
22636
|
+
//@ts-expect-error
|
|
22637
|
+
jsonScene.miscs.push(playableAsset);
|
|
22638
|
+
}
|
|
22639
|
+
}
|
|
22640
|
+
function convertBinaryAsset(bins, jsonScene) {
|
|
22641
|
+
//@ts-expect-error
|
|
22642
|
+
jsonScene.bins = bins.map(function(bin) {
|
|
22643
|
+
return {
|
|
22644
|
+
url: bin.url,
|
|
22645
|
+
"dataType": "BinaryAsset",
|
|
22646
|
+
id: generateGUID()
|
|
22647
|
+
};
|
|
22648
|
+
});
|
|
22649
|
+
}
|
|
22650
|
+
function convertSpineData(resource, content, jsonScene) {
|
|
22651
|
+
//@ts-expect-error
|
|
22652
|
+
content.resource = {
|
|
22653
|
+
"atlas": {
|
|
22654
|
+
"bins": {
|
|
22655
|
+
//@ts-expect-error
|
|
22656
|
+
"id": jsonScene.bins[resource.atlas[1][0]].id
|
|
22657
|
+
},
|
|
22658
|
+
"source": resource.atlas[1].slice(1)
|
|
22659
|
+
},
|
|
22660
|
+
"skeleton": {
|
|
22661
|
+
"bins": {
|
|
22662
|
+
//@ts-expect-error
|
|
22663
|
+
"id": jsonScene.bins[resource.skeleton[1][0]].id
|
|
22664
|
+
},
|
|
22665
|
+
"source": resource.skeleton[1].slice(1)
|
|
22666
|
+
},
|
|
22667
|
+
"skeletonType": resource.skeletonType,
|
|
22668
|
+
"images": resource.images.map(function(i) {
|
|
22669
|
+
return {
|
|
22670
|
+
//@ts-expect-error
|
|
22671
|
+
id: jsonScene.textures[i].id
|
|
22672
|
+
};
|
|
22673
|
+
})
|
|
22674
|
+
};
|
|
22675
|
+
}
|
|
22676
|
+
|
|
22677
|
+
function getStandardParticleContent(particle) {
|
|
22678
|
+
var options = particle.options;
|
|
22679
|
+
var transform = particle.transform;
|
|
22680
|
+
var shape = {
|
|
22681
|
+
type: ShapeType.NONE
|
|
22682
|
+
};
|
|
22683
|
+
if (particle.shape) {
|
|
22684
|
+
var _particle_shape_shape;
|
|
22685
|
+
var shapeType = (_particle_shape_shape = particle.shape.shape) == null ? void 0 : _particle_shape_shape.replace(/([A-Z])/g, "_$1").toUpperCase().replace(/^_/, "");
|
|
22686
|
+
shape = _extends({}, particle.shape, {
|
|
22687
|
+
type: ShapeType[shapeType]
|
|
22688
|
+
});
|
|
22689
|
+
if (particle.shape.upDirection) {
|
|
22690
|
+
var _particle_shape_upDirection = particle.shape.upDirection, x = _particle_shape_upDirection[0], y = _particle_shape_upDirection[1], z = _particle_shape_upDirection[2];
|
|
22691
|
+
if (x === 0 && y === 0 && z === 0) {
|
|
22692
|
+
delete shape.upDirection;
|
|
22693
|
+
}
|
|
22694
|
+
}
|
|
22695
|
+
}
|
|
22696
|
+
if (options.startTurbulence) {
|
|
22697
|
+
shape.turbulenceX = ensureNumberExpression(options.turbulenceX);
|
|
22698
|
+
shape.turbulenceY = ensureNumberExpression(options.turbulenceY);
|
|
22699
|
+
shape.turbulenceZ = ensureNumberExpression(options.turbulenceZ);
|
|
22700
|
+
}
|
|
22701
|
+
var emission = particle.emission;
|
|
22702
|
+
if (emission.bursts && emission.bursts.length > 0) {
|
|
22703
|
+
emission.bursts = emission.bursts.map(function(b) {
|
|
22704
|
+
return objectValueToNumber(b);
|
|
22705
|
+
});
|
|
22706
|
+
}
|
|
22707
|
+
if (emission.burstOffsets && emission.burstOffsets.length > 0) {
|
|
22708
|
+
emission.burstOffsets = emission.burstOffsets.map(function(b) {
|
|
22709
|
+
return objectValueToNumber(b);
|
|
22710
|
+
});
|
|
22711
|
+
}
|
|
22712
|
+
if (emission.rateOverTime) {
|
|
22713
|
+
emission.rateOverTime = ensureNumberExpression(emission.rateOverTime);
|
|
22714
|
+
}
|
|
22715
|
+
var ret = {
|
|
22716
|
+
renderer: particle.renderer,
|
|
22717
|
+
shape: shape,
|
|
22718
|
+
splits: particle.splits,
|
|
22719
|
+
emission: emission,
|
|
22720
|
+
options: {
|
|
22721
|
+
startLifetime: ensureNumberExpression(options.startLifetime),
|
|
22722
|
+
start3DSize: !!options.start3DSize,
|
|
22723
|
+
startSize: ensureNumberExpression(options.startSize),
|
|
22724
|
+
startSizeX: ensureNumberExpression(options.startSizeX),
|
|
22725
|
+
startSizeY: ensureNumberExpression(options.startSizeY),
|
|
22726
|
+
sizeAspect: ensureNumberExpression(options.sizeAspect),
|
|
22727
|
+
maxCount: options.maxCount,
|
|
22728
|
+
startDelay: ensureNumberExpression(options.startDelay),
|
|
22729
|
+
startColor: ensureColorExpression(options.startColor, true),
|
|
22730
|
+
startRotationZ: ensureNumberExpression(options.startRotation || options.startRotationZ),
|
|
22731
|
+
particleFollowParent: options.particleFollowParent
|
|
22732
|
+
}
|
|
22733
|
+
};
|
|
22734
|
+
if (options.start3DRotation) {
|
|
22735
|
+
ret.options.startRotationX = ensureNumberExpression(options.startRotationX);
|
|
22736
|
+
ret.options.startRotationY = ensureNumberExpression(options.startRotationY);
|
|
22737
|
+
}
|
|
22738
|
+
if (transform && transform.path) {
|
|
22739
|
+
ret.emitterTransform = {
|
|
22740
|
+
path: ensureFixedVec3(transform.path)
|
|
22741
|
+
};
|
|
22742
|
+
}
|
|
22743
|
+
var sizeOverLifetime = particle.sizeOverLifetime;
|
|
22744
|
+
if (sizeOverLifetime) {
|
|
22745
|
+
if (sizeOverLifetime.separateAxes) {
|
|
22746
|
+
ret.sizeOverLifetime = {
|
|
22747
|
+
separateAxes: true,
|
|
22748
|
+
x: ensureNumberExpression(sizeOverLifetime.x),
|
|
22749
|
+
y: ensureNumberExpression(sizeOverLifetime.y)
|
|
22750
|
+
};
|
|
22751
|
+
} else {
|
|
22752
|
+
ret.sizeOverLifetime = {
|
|
22753
|
+
size: ensureNumberExpression(sizeOverLifetime.size)
|
|
22754
|
+
};
|
|
22755
|
+
}
|
|
22756
|
+
}
|
|
22757
|
+
var velocityOverLifetime = particle.velocityOverLifetime || {};
|
|
22758
|
+
var sol = velocityOverLifetime.speedOverLifetime;
|
|
22759
|
+
if (sol) {
|
|
22760
|
+
sol = ensureFixedNumber(sol);
|
|
22761
|
+
} else {
|
|
22762
|
+
sol = undefined;
|
|
22763
|
+
}
|
|
22764
|
+
ret.positionOverLifetime = {
|
|
22765
|
+
gravity: options.gravity,
|
|
22766
|
+
gravityOverLifetime: ensureFixedNumber(options.gravityModifier),
|
|
22767
|
+
startSpeed: ensureNumberExpression(options.startSpeed),
|
|
22768
|
+
speedOverLifetime: sol,
|
|
22769
|
+
asMovement: velocityOverLifetime.asMovement,
|
|
22770
|
+
linearX: ensureNumberExpression(velocityOverLifetime.linearX),
|
|
22771
|
+
linearY: ensureNumberExpression(velocityOverLifetime.linearY),
|
|
22772
|
+
linearZ: ensureNumberExpression(velocityOverLifetime.linearZ),
|
|
22773
|
+
asRotation: velocityOverLifetime.asRotation,
|
|
22774
|
+
orbCenter: velocityOverLifetime.orbCenter,
|
|
22775
|
+
orbitalX: ensureNumberExpression(velocityOverLifetime.orbitalX),
|
|
22776
|
+
orbitalY: ensureNumberExpression(velocityOverLifetime.orbitalY),
|
|
22777
|
+
orbitalZ: ensureNumberExpression(velocityOverLifetime.orbitalZ),
|
|
22778
|
+
forceTarget: velocityOverLifetime.forceTarget,
|
|
22779
|
+
target: velocityOverLifetime.target,
|
|
22780
|
+
forceCurve: ensureFixedNumber(velocityOverLifetime.forceCurve)
|
|
22781
|
+
};
|
|
22782
|
+
deleteEmptyValue(ret.positionOverLifetime);
|
|
22783
|
+
var rotationOverLifetime = particle.rotationOverLifetime;
|
|
22784
|
+
if (rotationOverLifetime) {
|
|
22785
|
+
ret.rotationOverLifetime = {
|
|
22786
|
+
separateAxes: rotationOverLifetime.separateAxes,
|
|
22787
|
+
asRotation: rotationOverLifetime.asRotation,
|
|
22788
|
+
z: ensureNumberExpression(rotationOverLifetime.separateAxes ? rotationOverLifetime.z : rotationOverLifetime.angularVelocity)
|
|
22789
|
+
};
|
|
22790
|
+
if (rotationOverLifetime.separateAxes) {
|
|
22791
|
+
ret.rotationOverLifetime.y = ensureFixedNumber(rotationOverLifetime.y);
|
|
22792
|
+
ret.rotationOverLifetime.x = ensureFixedNumber(rotationOverLifetime.x);
|
|
22793
|
+
}
|
|
22794
|
+
}
|
|
22795
|
+
var colorOverLifetime = particle.colorOverLifetime;
|
|
22796
|
+
if (colorOverLifetime) {
|
|
22797
|
+
var col = ret.colorOverLifetime = {
|
|
22798
|
+
opacity: ensureFixedNumber(colorOverLifetime.opacity)
|
|
22799
|
+
};
|
|
22800
|
+
if (colorOverLifetime.color) {
|
|
22801
|
+
col.color = getGradientColor(colorOverLifetime.color);
|
|
22802
|
+
}
|
|
22803
|
+
}
|
|
22804
|
+
var textureSheetAnimation = particle.textureSheetAnimation;
|
|
22805
|
+
if (textureSheetAnimation) {
|
|
22806
|
+
ret.textureSheetAnimation = {
|
|
22807
|
+
row: textureSheetAnimation.row,
|
|
22808
|
+
col: textureSheetAnimation.col,
|
|
22809
|
+
total: textureSheetAnimation.total,
|
|
22810
|
+
animate: textureSheetAnimation.animate,
|
|
22811
|
+
cycles: ensureFixedNumber(textureSheetAnimation.cycles),
|
|
22812
|
+
animationDelay: ensureFixedNumberWithRandom(textureSheetAnimation.animationDelay, 0),
|
|
22813
|
+
animationDuration: ensureFixedNumberWithRandom(textureSheetAnimation.animationDuration, 0)
|
|
22734
22814
|
};
|
|
22735
|
-
trackDatas.push(bindingTrackData);
|
|
22736
|
-
timelineAssetData.tracks.push({
|
|
22737
|
-
id: bindingTrackData.id
|
|
22738
|
-
});
|
|
22739
|
-
sceneBindings.push({
|
|
22740
|
-
key: {
|
|
22741
|
-
id: bindingTrackData.id
|
|
22742
|
-
},
|
|
22743
|
-
value: {
|
|
22744
|
-
id: item.id
|
|
22745
|
-
}
|
|
22746
|
-
});
|
|
22747
22815
|
}
|
|
22748
|
-
var
|
|
22749
|
-
|
|
22750
|
-
|
|
22751
|
-
|
|
22752
|
-
|
|
22753
|
-
|
|
22816
|
+
var trials = particle.trails;
|
|
22817
|
+
if (trials) {
|
|
22818
|
+
ret.trails = {
|
|
22819
|
+
lifetime: ensureNumberExpression(trials.lifetime),
|
|
22820
|
+
dieWithParticles: trials.dieWithParticles,
|
|
22821
|
+
maxPointPerTrail: trials.maxPointPerTrail,
|
|
22822
|
+
minimumVertexDistance: trials.minimumVertexDistance,
|
|
22823
|
+
widthOverTrail: ensureFixedNumber(trials.widthOverTrail),
|
|
22824
|
+
colorOverTrail: trials.colorOverTrail && getGradientColor(trials.colorOverTrail, false),
|
|
22825
|
+
blending: trials.blending,
|
|
22826
|
+
colorOverLifetime: trials.colorOverLifetime && getGradientColor(trials.colorOverLifetime, false),
|
|
22827
|
+
inheritParticleColor: trials.inheritParticleColor,
|
|
22828
|
+
occlusion: trials.occlusion,
|
|
22829
|
+
transparentOcclusion: trials.transparentOcclusion,
|
|
22830
|
+
orderOffset: trials.orderOffset,
|
|
22831
|
+
sizeAffectsLifetime: trials.sizeAffectsLifetime,
|
|
22832
|
+
sizeAffectsWidth: trials.sizeAffectsWidth,
|
|
22833
|
+
texture: trials.texture,
|
|
22834
|
+
parentAffectsPosition: trials.parentAffectsPosition,
|
|
22835
|
+
opacityOverLifetime: ensureNumberExpression(trials.opacityOverLifetime)
|
|
22836
|
+
};
|
|
22754
22837
|
}
|
|
22755
|
-
|
|
22756
|
-
|
|
22838
|
+
ret.trails && deleteEmptyValue(ret.trails);
|
|
22839
|
+
var interaction = particle.interaction;
|
|
22840
|
+
if (interaction) {
|
|
22841
|
+
ret.interaction = {
|
|
22842
|
+
behavior: interaction.behavior,
|
|
22843
|
+
radius: interaction.radius,
|
|
22844
|
+
multiple: interaction.multiple
|
|
22845
|
+
};
|
|
22846
|
+
}
|
|
22847
|
+
return ret;
|
|
22848
|
+
}
|
|
22849
|
+
|
|
22850
|
+
function getStandardNullContent(sprite, transform) {
|
|
22851
|
+
var _sprite_transform;
|
|
22852
|
+
var opt = sprite.options;
|
|
22853
|
+
var velocityOverLifetime = sprite.velocityOverLifetime || {};
|
|
22854
|
+
var positionOverLifetime = {
|
|
22855
|
+
path: ensureFixedVec3((_sprite_transform = sprite.transform) == null ? void 0 : _sprite_transform.path),
|
|
22856
|
+
gravity: opt.gravity,
|
|
22857
|
+
gravityOverLifetime: ensureFixedNumber(opt.gravityModifier),
|
|
22858
|
+
direction: opt.direction,
|
|
22859
|
+
startSpeed: opt.startSpeed,
|
|
22860
|
+
asMovement: velocityOverLifetime.asMovement,
|
|
22861
|
+
linearX: ensureFixedNumber(velocityOverLifetime.linearX),
|
|
22862
|
+
linearY: ensureFixedNumber(velocityOverLifetime.linearY),
|
|
22863
|
+
linearZ: ensureFixedNumber(velocityOverLifetime.linearZ),
|
|
22864
|
+
asRotation: velocityOverLifetime.asRotation,
|
|
22865
|
+
orbCenter: velocityOverLifetime.orbCenter,
|
|
22866
|
+
orbitalX: ensureFixedNumber(velocityOverLifetime.orbitalX),
|
|
22867
|
+
orbitalY: ensureFixedNumber(velocityOverLifetime.orbitalY),
|
|
22868
|
+
orbitalZ: ensureFixedNumber(velocityOverLifetime.orbitalZ),
|
|
22869
|
+
speedOverLifetime: ensureFixedNumber(velocityOverLifetime.speedOverLifetime)
|
|
22757
22870
|
};
|
|
22758
|
-
|
|
22759
|
-
|
|
22760
|
-
|
|
22761
|
-
|
|
22762
|
-
|
|
22763
|
-
|
|
22871
|
+
deleteEmptyValue(positionOverLifetime);
|
|
22872
|
+
var ret = {
|
|
22873
|
+
options: {
|
|
22874
|
+
startColor: ensureRGBAValue(opt.startColor)
|
|
22875
|
+
},
|
|
22876
|
+
positionOverLifetime: positionOverLifetime
|
|
22877
|
+
};
|
|
22878
|
+
if (opt.startSize) {
|
|
22879
|
+
transform.scale = [
|
|
22880
|
+
opt.startSize,
|
|
22881
|
+
opt.startSize / (opt.sizeAspect || 1),
|
|
22882
|
+
1
|
|
22883
|
+
];
|
|
22764
22884
|
}
|
|
22765
|
-
|
|
22766
|
-
|
|
22767
|
-
|
|
22768
|
-
|
|
22885
|
+
if (opt.startRotation) {
|
|
22886
|
+
if (!transform.rotation) {
|
|
22887
|
+
transform.rotation = [
|
|
22888
|
+
0,
|
|
22889
|
+
0,
|
|
22890
|
+
opt.startRotation
|
|
22891
|
+
];
|
|
22892
|
+
} else {
|
|
22893
|
+
transform.rotation[2] += opt.startRotation;
|
|
22894
|
+
}
|
|
22769
22895
|
}
|
|
22770
|
-
|
|
22771
|
-
|
|
22772
|
-
|
|
22773
|
-
|
|
22774
|
-
|
|
22775
|
-
url: bin.url,
|
|
22776
|
-
"dataType": "BinaryAsset",
|
|
22777
|
-
id: generateGUID()
|
|
22896
|
+
var rotationOverLifetime = sprite.rotationOverLifetime;
|
|
22897
|
+
if (rotationOverLifetime) {
|
|
22898
|
+
var rot = ret.rotationOverLifetime = {
|
|
22899
|
+
separateAxes: rotationOverLifetime.separateAxes,
|
|
22900
|
+
asRotation: rotationOverLifetime.asRotation
|
|
22778
22901
|
};
|
|
22779
|
-
|
|
22902
|
+
if (rot.separateAxes) {
|
|
22903
|
+
rot.x = ensureFixedNumber(rotationOverLifetime.x);
|
|
22904
|
+
rot.y = ensureFixedNumber(rotationOverLifetime.y);
|
|
22905
|
+
rot.z = ensureFixedNumber(rotationOverLifetime.z);
|
|
22906
|
+
} else {
|
|
22907
|
+
rot.z = ensureFixedNumber(rotationOverLifetime.angularVelocity);
|
|
22908
|
+
}
|
|
22909
|
+
}
|
|
22910
|
+
var colorOverLifetime = sprite.colorOverLifetime;
|
|
22911
|
+
if (colorOverLifetime) {
|
|
22912
|
+
var col = ret.colorOverLifetime = {
|
|
22913
|
+
opacity: ensureFixedNumber(colorOverLifetime.opacity)
|
|
22914
|
+
};
|
|
22915
|
+
if (colorOverLifetime.color) {
|
|
22916
|
+
col.color = getGradientColor(colorOverLifetime.color);
|
|
22917
|
+
}
|
|
22918
|
+
}
|
|
22919
|
+
var sizeOverLifetime = sprite.sizeOverLifetime;
|
|
22920
|
+
if (sizeOverLifetime) {
|
|
22921
|
+
ret.sizeOverLifetime = {
|
|
22922
|
+
separateAxes: sizeOverLifetime.separateAxes,
|
|
22923
|
+
size: ensureFixedNumber(sizeOverLifetime.size),
|
|
22924
|
+
x: ensureFixedNumber(sizeOverLifetime.x),
|
|
22925
|
+
y: ensureFixedNumber(sizeOverLifetime.y),
|
|
22926
|
+
z: ensureFixedNumber(sizeOverLifetime.z)
|
|
22927
|
+
};
|
|
22928
|
+
}
|
|
22929
|
+
return ret;
|
|
22780
22930
|
}
|
|
22781
|
-
function
|
|
22782
|
-
|
|
22783
|
-
|
|
22784
|
-
|
|
22785
|
-
|
|
22786
|
-
|
|
22787
|
-
|
|
22788
|
-
|
|
22789
|
-
|
|
22790
|
-
}
|
|
22791
|
-
|
|
22792
|
-
|
|
22793
|
-
|
|
22794
|
-
|
|
22795
|
-
|
|
22796
|
-
|
|
22797
|
-
|
|
22798
|
-
|
|
22799
|
-
|
|
22800
|
-
return {
|
|
22801
|
-
//@ts-expect-error
|
|
22802
|
-
id: jsonScene.textures[i].id
|
|
22803
|
-
};
|
|
22804
|
-
})
|
|
22805
|
-
};
|
|
22931
|
+
function getStandardSpriteContent(sprite, transform) {
|
|
22932
|
+
var ret = getStandardNullContent(sprite, transform);
|
|
22933
|
+
var texAni = sprite.textureSheetAnimation;
|
|
22934
|
+
if (texAni) {
|
|
22935
|
+
ret.textureSheetAnimation = {
|
|
22936
|
+
row: texAni.row,
|
|
22937
|
+
col: texAni.col,
|
|
22938
|
+
total: texAni.total || undefined,
|
|
22939
|
+
animate: texAni.animate
|
|
22940
|
+
};
|
|
22941
|
+
}
|
|
22942
|
+
ret.renderer = sprite.renderer;
|
|
22943
|
+
if (sprite.splits) {
|
|
22944
|
+
ret.splits = sprite.splits;
|
|
22945
|
+
}
|
|
22946
|
+
if (sprite.interaction) {
|
|
22947
|
+
ret.interaction = sprite.interaction;
|
|
22948
|
+
}
|
|
22949
|
+
return ret;
|
|
22806
22950
|
}
|
|
22807
22951
|
|
|
22808
22952
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
@@ -23184,7 +23328,7 @@ function getBackgroundImage(template, variables) {
|
|
|
23184
23328
|
}
|
|
23185
23329
|
function _combineImageTemplate() {
|
|
23186
23330
|
_combineImageTemplate = _async_to_generator(function(url, template, variables) {
|
|
23187
|
-
var image,
|
|
23331
|
+
var image, templateBackground;
|
|
23188
23332
|
return __generator(this, function(_state) {
|
|
23189
23333
|
switch(_state.label){
|
|
23190
23334
|
case 0:
|
|
@@ -23215,37 +23359,25 @@ function _combineImageTemplate() {
|
|
|
23215
23359
|
image
|
|
23216
23360
|
];
|
|
23217
23361
|
}
|
|
23218
|
-
drawImage = image;
|
|
23219
23362
|
// 获取动态换图的图片对象或 url 地址
|
|
23220
23363
|
templateBackground = getBackgroundImage(template, variables);
|
|
23221
|
-
if (
|
|
23222
|
-
|
|
23223
|
-
|
|
23224
|
-
|
|
23225
|
-
|
|
23226
|
-
|
|
23227
|
-
|
|
23228
|
-
|
|
23229
|
-
|
|
23230
|
-
|
|
23231
|
-
|
|
23232
|
-
|
|
23233
|
-
|
|
23234
|
-
|
|
23235
|
-
return [
|
|
23236
|
-
3,
|
|
23237
|
-
6
|
|
23238
|
-
];
|
|
23239
|
-
case 5:
|
|
23240
|
-
_tmp = templateBackground;
|
|
23241
|
-
_state.label = 6;
|
|
23242
|
-
case 6:
|
|
23243
|
-
drawImage = _tmp;
|
|
23244
|
-
_state.label = 7;
|
|
23245
|
-
case 7:
|
|
23364
|
+
if (templateBackground) {
|
|
23365
|
+
if (isString(templateBackground) && templateBackground !== image.src) {
|
|
23366
|
+
return [
|
|
23367
|
+
2,
|
|
23368
|
+
loadImage(templateBackground)
|
|
23369
|
+
];
|
|
23370
|
+
}
|
|
23371
|
+
if (_instanceof1(templateBackground, HTMLImageElement)) {
|
|
23372
|
+
return [
|
|
23373
|
+
2,
|
|
23374
|
+
templateBackground
|
|
23375
|
+
];
|
|
23376
|
+
}
|
|
23377
|
+
}
|
|
23246
23378
|
return [
|
|
23247
23379
|
2,
|
|
23248
|
-
|
|
23380
|
+
image
|
|
23249
23381
|
];
|
|
23250
23382
|
}
|
|
23251
23383
|
});
|
|
@@ -23579,14 +23711,6 @@ var seed = 1;
|
|
|
23579
23711
|
case 0:
|
|
23580
23712
|
// TODO: 后面切换到新的数据版本,就不用掉用 getStandardJSON 做转换了
|
|
23581
23713
|
jsonScene = getStandardJSON(json);
|
|
23582
|
-
// FIXME: hack globalVolume,specification 更新后需移除
|
|
23583
|
-
// @ts-expect-error
|
|
23584
|
-
json.compositions.forEach(function(composition, i) {
|
|
23585
|
-
if (composition.globalVolume) {
|
|
23586
|
-
// @ts-expect-error
|
|
23587
|
-
jsonScene.compositions[i].globalVolume = composition.globalVolume;
|
|
23588
|
-
}
|
|
23589
|
-
});
|
|
23590
23714
|
_jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins, sceneCompositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, images = jsonScene.images;
|
|
23591
23715
|
pluginSystem = new PluginSystem(plugins);
|
|
23592
23716
|
return [
|
|
@@ -23717,15 +23841,17 @@ var seed = 1;
|
|
|
23717
23841
|
_this_options = _this.options, useCompressedTexture = _this_options.useCompressedTexture, variables = _this_options.variables;
|
|
23718
23842
|
baseUrl = _this.baseUrl;
|
|
23719
23843
|
jobs = images.map(/*#__PURE__*/ _async_to_generator(function(img, idx) {
|
|
23720
|
-
var png, webp, imageURL, webpURL, template, background, url, isVideo, loadFn, resultImage, e, compressed, src, bufferURL, _ref, url1, image;
|
|
23844
|
+
var png, webp, avif, imageURL, webpURL, avifURL, template, background, url, isVideo, loadFn, resultImage, e, compressed, src, bufferURL, _ref, url1, image, _tmp;
|
|
23721
23845
|
return __generator(this, function(_state) {
|
|
23722
23846
|
switch(_state.label){
|
|
23723
23847
|
case 0:
|
|
23724
|
-
png = img.url, webp = img.webp;
|
|
23848
|
+
png = img.url, webp = img.webp, avif = img.avif;
|
|
23725
23849
|
// eslint-disable-next-line compat/compat
|
|
23726
23850
|
imageURL = new URL(png, baseUrl).href;
|
|
23727
23851
|
// eslint-disable-next-line compat/compat
|
|
23728
23852
|
webpURL = webp && new URL(webp, baseUrl).href;
|
|
23853
|
+
// eslint-disable-next-line compat/compat
|
|
23854
|
+
avifURL = avif && new URL(avif, baseUrl).href;
|
|
23729
23855
|
if (!("template" in img)) return [
|
|
23730
23856
|
3,
|
|
23731
23857
|
8
|
|
@@ -23825,12 +23951,30 @@ var seed = 1;
|
|
|
23825
23951
|
}
|
|
23826
23952
|
_state.label = 9;
|
|
23827
23953
|
case 9:
|
|
23954
|
+
if (!avifURL) return [
|
|
23955
|
+
3,
|
|
23956
|
+
11
|
|
23957
|
+
];
|
|
23828
23958
|
return [
|
|
23829
23959
|
4,
|
|
23830
|
-
|
|
23960
|
+
loadAVIFOptional(imageURL, avifURL)
|
|
23831
23961
|
];
|
|
23832
23962
|
case 10:
|
|
23833
|
-
|
|
23963
|
+
_tmp = _state.sent();
|
|
23964
|
+
return [
|
|
23965
|
+
3,
|
|
23966
|
+
13
|
|
23967
|
+
];
|
|
23968
|
+
case 11:
|
|
23969
|
+
return [
|
|
23970
|
+
4,
|
|
23971
|
+
loadWebPOptional(imageURL, webpURL)
|
|
23972
|
+
];
|
|
23973
|
+
case 12:
|
|
23974
|
+
_tmp = _state.sent();
|
|
23975
|
+
_state.label = 13;
|
|
23976
|
+
case 13:
|
|
23977
|
+
_ref = _tmp, url1 = _ref.url, image = _ref.image;
|
|
23834
23978
|
_this.assets[idx] = {
|
|
23835
23979
|
url: url1,
|
|
23836
23980
|
type: TextureSourceType.image
|
|
@@ -24374,9 +24518,7 @@ var listOrder = 0;
|
|
|
24374
24518
|
}
|
|
24375
24519
|
var _proto = CompositionSourceManager.prototype;
|
|
24376
24520
|
_proto.getContent = function getContent(composition) {
|
|
24377
|
-
|
|
24378
|
-
// @ts-expect-error
|
|
24379
|
-
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;
|
|
24521
|
+
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;
|
|
24380
24522
|
var items = this.assembleItems(composition);
|
|
24381
24523
|
return _extends({}, composition, {
|
|
24382
24524
|
id: id,
|
|
@@ -24386,8 +24528,7 @@ var listOrder = 0;
|
|
|
24386
24528
|
// looping,
|
|
24387
24529
|
items: items,
|
|
24388
24530
|
camera: camera,
|
|
24389
|
-
startTime: startTime
|
|
24390
|
-
globalVolume: globalVolume
|
|
24531
|
+
startTime: startTime
|
|
24391
24532
|
});
|
|
24392
24533
|
};
|
|
24393
24534
|
_proto.assembleItems = function assembleItems(composition) {
|
|
@@ -24549,7 +24690,6 @@ var listOrder = 0;
|
|
|
24549
24690
|
this.rootComposition = this.rootItem.addComponent(CompositionComponent);
|
|
24550
24691
|
this.rootComposition.data = sourceContent;
|
|
24551
24692
|
var imageUsage = !reusable && imgUsage;
|
|
24552
|
-
this.globalVolume = sourceContent.globalVolume;
|
|
24553
24693
|
this.width = width;
|
|
24554
24694
|
this.height = height;
|
|
24555
24695
|
this.renderOrder = baseRenderOrder;
|
|
@@ -26754,7 +26894,10 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
26754
26894
|
return FBGeometryDataT;
|
|
26755
26895
|
}();
|
|
26756
26896
|
|
|
26757
|
-
|
|
26897
|
+
/**
|
|
26898
|
+
* @since 2.0.0
|
|
26899
|
+
* @internal
|
|
26900
|
+
*/ var EffectsPackage = /*#__PURE__*/ function() {
|
|
26758
26901
|
function EffectsPackage() {
|
|
26759
26902
|
this.exportObjectDatas = [];
|
|
26760
26903
|
}
|
|
@@ -26779,8 +26922,7 @@ var EffectsPackage = /*#__PURE__*/ function() {
|
|
|
26779
26922
|
}
|
|
26780
26923
|
effectsPackage.exportObjects = exportObjects;
|
|
26781
26924
|
FBEffectsPackageData.finishFBEffectsPackageDataBuffer(fbb, effectsPackage.pack(fbb));
|
|
26782
|
-
|
|
26783
|
-
return buffer;
|
|
26925
|
+
return fbb.asUint8Array(); // Of type `Uint8Array`.
|
|
26784
26926
|
};
|
|
26785
26927
|
_proto.deserializeFromBinary = function deserializeFromBinary(buffer) {
|
|
26786
26928
|
var buf = new ByteBuffer(buffer);
|
|
@@ -26808,37 +26950,35 @@ var EffectsPackage = /*#__PURE__*/ function() {
|
|
|
26808
26950
|
_proto.geometryDataToBinary = function geometryDataToBinary(geometryData) {
|
|
26809
26951
|
var fbb = new Builder(1);
|
|
26810
26952
|
var fbGeometryData = new FBGeometryDataT();
|
|
26811
|
-
|
|
26812
|
-
fbGeometryData.
|
|
26813
|
-
fbGeometryData.
|
|
26814
|
-
fbGeometryData.
|
|
26815
|
-
|
|
26816
|
-
fbGeometryData.boneNames =
|
|
26817
|
-
|
|
26818
|
-
fbGeometryData.
|
|
26819
|
-
|
|
26820
|
-
fbGeometryData.inverseBindMatrices = (_geometryData_inverseBindMatrices = geometryData.inverseBindMatrices) != null ? _geometryData_inverseBindMatrices : [];
|
|
26821
|
-
var _geometryData_binaryData;
|
|
26822
|
-
fbGeometryData.binaryData = (_geometryData_binaryData = geometryData.binaryData) != null ? _geometryData_binaryData : [];
|
|
26953
|
+
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;
|
|
26954
|
+
fbGeometryData.indexFormat = indexFormat;
|
|
26955
|
+
fbGeometryData.indexOffset = indexOffset;
|
|
26956
|
+
fbGeometryData.mode = mode;
|
|
26957
|
+
fbGeometryData.id = id;
|
|
26958
|
+
fbGeometryData.boneNames = boneNames;
|
|
26959
|
+
fbGeometryData.rootBoneName = rootBoneName;
|
|
26960
|
+
fbGeometryData.inverseBindMatrices = inverseBindMatrices;
|
|
26961
|
+
fbGeometryData.binaryData = binaryData;
|
|
26823
26962
|
var fbVertexdata = new FBVertexDataT();
|
|
26824
|
-
fbVertexdata.vertexCount =
|
|
26963
|
+
fbVertexdata.vertexCount = vertexData.vertexCount;
|
|
26825
26964
|
fbVertexdata.channels = [];
|
|
26826
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(
|
|
26965
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(vertexData.channels), _step; !(_step = _iterator()).done;){
|
|
26827
26966
|
var channel = _step.value;
|
|
26828
|
-
var
|
|
26967
|
+
var semantic = channel.semantic, offset = channel.offset, format = channel.format, dimension = channel.dimension, normalize = channel.normalize;
|
|
26968
|
+
var fbChannel = new FBVertexChannelT(semantic, offset, format, dimension, normalize);
|
|
26829
26969
|
fbVertexdata.channels.push(fbChannel);
|
|
26830
26970
|
}
|
|
26831
26971
|
fbGeometryData.vertexData = fbVertexdata;
|
|
26832
26972
|
var fbSubMeshes = [];
|
|
26833
26973
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(geometryData.subMeshes), _step1; !(_step1 = _iterator1()).done;){
|
|
26834
26974
|
var subMesh = _step1.value;
|
|
26835
|
-
var
|
|
26975
|
+
var offset1 = subMesh.offset, indexCount = subMesh.indexCount, vertexCount = subMesh.vertexCount;
|
|
26976
|
+
var fbSubMesh = new FBSubMeshT(offset1, indexCount, vertexCount);
|
|
26836
26977
|
fbSubMeshes.push(fbSubMesh);
|
|
26837
26978
|
}
|
|
26838
26979
|
fbGeometryData.subMeshes = fbSubMeshes;
|
|
26839
26980
|
FBEffectsPackageData.finishFBEffectsPackageDataBuffer(fbb, fbGeometryData.pack(fbb));
|
|
26840
|
-
|
|
26841
|
-
return buffer;
|
|
26981
|
+
return fbb.asUint8Array(); // Of type `Uint8Array`.
|
|
26842
26982
|
};
|
|
26843
26983
|
_proto.binaryToGeometryData = function binaryToGeometryData(buffer) {
|
|
26844
26984
|
var buf = new ByteBuffer(buffer);
|
|
@@ -26860,7 +27000,8 @@ var EffectsPackage = /*#__PURE__*/ function() {
|
|
|
26860
27000
|
semantic: (_channel_semantic = channel.semantic()) != null ? _channel_semantic : "",
|
|
26861
27001
|
offset: channel.offset(),
|
|
26862
27002
|
format: channel.format(),
|
|
26863
|
-
dimension: channel.dimension()
|
|
27003
|
+
dimension: channel.dimension(),
|
|
27004
|
+
normalize: channel.normalize()
|
|
26864
27005
|
};
|
|
26865
27006
|
vertexData.channels.push(vertexChannel);
|
|
26866
27007
|
}
|
|
@@ -26873,7 +27014,8 @@ var EffectsPackage = /*#__PURE__*/ function() {
|
|
|
26873
27014
|
}
|
|
26874
27015
|
var subMesh = {
|
|
26875
27016
|
offset: fbSubMesh.offset(),
|
|
26876
|
-
vertexCount: fbSubMesh.vertexCount()
|
|
27017
|
+
vertexCount: fbSubMesh.vertexCount(),
|
|
27018
|
+
indexCount: fbSubMesh.indexCount()
|
|
26877
27019
|
};
|
|
26878
27020
|
subMeshes.push(subMesh);
|
|
26879
27021
|
}
|
|
@@ -27302,8 +27444,8 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
27302
27444
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
27303
27445
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
27304
27446
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
27305
|
-
var version = "2.0.0-alpha.
|
|
27447
|
+
var version = "2.0.0-alpha.29";
|
|
27306
27448
|
logger.info("Core version: " + version + ".");
|
|
27307
27449
|
|
|
27308
|
-
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, 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, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, 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, 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, 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, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMacros, createShape,
|
|
27450
|
+
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, 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, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, 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, 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, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMacros, 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, getDefaultTemplateCanvasPool, 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, pointOnLine, 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, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };
|
|
27309
27451
|
//# sourceMappingURL=index.mjs.map
|