@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.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.29
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -444,16 +444,27 @@ function isIOS() {
|
|
|
444
444
|
// real ios device not in simulator
|
|
445
445
|
return !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
|
|
446
446
|
}
|
|
447
|
+
function isIOSByUA() {
|
|
448
|
+
var str = navigator.userAgent.toLowerCase();
|
|
449
|
+
var ver = str.match(/cpu (iphone )?os (.*?) like mac os/);
|
|
450
|
+
return ver ? parseInt(ver[2], 10) : 0;
|
|
451
|
+
}
|
|
447
452
|
function isAndroid() {
|
|
448
453
|
return /\b[Aa]ndroid\b/.test(navigator.userAgent);
|
|
449
454
|
}
|
|
450
455
|
function isSimulatorCellPhone() {
|
|
451
456
|
return isAndroid() || /\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent);
|
|
452
457
|
}
|
|
458
|
+
function isMiniProgram() {
|
|
459
|
+
return isAlipayMiniApp() || isWechatMiniApp();
|
|
460
|
+
}
|
|
453
461
|
function isAlipayMiniApp() {
|
|
454
462
|
var _my;
|
|
455
463
|
return typeof my !== "undefined" && ((_my = my) == null ? void 0 : _my.renderTarget) === "web";
|
|
456
464
|
}
|
|
465
|
+
function isWechatMiniApp() {
|
|
466
|
+
return window.__wxjs_environment === "miniprogram";
|
|
467
|
+
}
|
|
457
468
|
|
|
458
469
|
function imageDataFromColor(value) {
|
|
459
470
|
if (isString(value)) {
|
|
@@ -4591,9 +4602,6 @@ function getDirectStore(target) {
|
|
|
4591
4602
|
};
|
|
4592
4603
|
return EffectsObject;
|
|
4593
4604
|
}();
|
|
4594
|
-
__decorate([
|
|
4595
|
-
serialize()
|
|
4596
|
-
], EffectsObject.prototype, "guid", void 0);
|
|
4597
4605
|
|
|
4598
4606
|
/**
|
|
4599
4607
|
* @since 2.0.0
|
|
@@ -4871,8 +4879,8 @@ exports.CameraController = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
4871
4879
|
camera.far = this.options.far;
|
|
4872
4880
|
camera.fov = this.options.fov;
|
|
4873
4881
|
camera.clipMode = this.options.clipMode;
|
|
4874
|
-
camera.position = this.transform.
|
|
4875
|
-
camera.rotation = this.transform.
|
|
4882
|
+
camera.position = this.transform.getWorldPosition();
|
|
4883
|
+
camera.rotation = this.transform.getWorldRotation();
|
|
4876
4884
|
}
|
|
4877
4885
|
};
|
|
4878
4886
|
_proto.fromData = function fromData(data) {
|
|
@@ -7857,6 +7865,7 @@ exports.TextureSourceType = void 0;
|
|
|
7857
7865
|
return Downloader;
|
|
7858
7866
|
}();
|
|
7859
7867
|
var webPFailed = false;
|
|
7868
|
+
var avifFailed = false;
|
|
7860
7869
|
/**
|
|
7861
7870
|
* 异步加载一个 WebP 图片文件,如果不支持 WebP,则加载 PNG 图片文件
|
|
7862
7871
|
* @param png - PNG 图片文件的 URL
|
|
@@ -7932,6 +7941,81 @@ function _loadWebPOptional() {
|
|
|
7932
7941
|
});
|
|
7933
7942
|
return _loadWebPOptional.apply(this, arguments);
|
|
7934
7943
|
}
|
|
7944
|
+
/**
|
|
7945
|
+
* 异步加载一个 AVIF 图片文件,如果不支持 AVIF,则加载 PNG 图片文件
|
|
7946
|
+
* @param png - PNG 图片文件的 URL
|
|
7947
|
+
* @param avif - AVIF 图片文件的 URL
|
|
7948
|
+
*/ function loadAVIFOptional(png, avif) {
|
|
7949
|
+
return _loadAVIFOptional.apply(this, arguments);
|
|
7950
|
+
}
|
|
7951
|
+
function _loadAVIFOptional() {
|
|
7952
|
+
_loadAVIFOptional = _async_to_generator(function(png, avif) {
|
|
7953
|
+
var image, image1, image2;
|
|
7954
|
+
return __generator(this, function(_state) {
|
|
7955
|
+
switch(_state.label){
|
|
7956
|
+
case 0:
|
|
7957
|
+
if (!(avifFailed || !avif)) return [
|
|
7958
|
+
3,
|
|
7959
|
+
2
|
|
7960
|
+
];
|
|
7961
|
+
return [
|
|
7962
|
+
4,
|
|
7963
|
+
loadImage(png)
|
|
7964
|
+
];
|
|
7965
|
+
case 1:
|
|
7966
|
+
image = _state.sent();
|
|
7967
|
+
return [
|
|
7968
|
+
2,
|
|
7969
|
+
{
|
|
7970
|
+
image: image,
|
|
7971
|
+
url: png
|
|
7972
|
+
}
|
|
7973
|
+
];
|
|
7974
|
+
case 2:
|
|
7975
|
+
_state.trys.push([
|
|
7976
|
+
2,
|
|
7977
|
+
4,
|
|
7978
|
+
,
|
|
7979
|
+
6
|
|
7980
|
+
]);
|
|
7981
|
+
return [
|
|
7982
|
+
4,
|
|
7983
|
+
loadImage(avif)
|
|
7984
|
+
];
|
|
7985
|
+
case 3:
|
|
7986
|
+
image1 = _state.sent();
|
|
7987
|
+
return [
|
|
7988
|
+
2,
|
|
7989
|
+
{
|
|
7990
|
+
image: image1,
|
|
7991
|
+
url: avif
|
|
7992
|
+
}
|
|
7993
|
+
];
|
|
7994
|
+
case 4:
|
|
7995
|
+
_state.sent();
|
|
7996
|
+
avifFailed = true;
|
|
7997
|
+
return [
|
|
7998
|
+
4,
|
|
7999
|
+
loadImage(png)
|
|
8000
|
+
];
|
|
8001
|
+
case 5:
|
|
8002
|
+
image2 = _state.sent();
|
|
8003
|
+
return [
|
|
8004
|
+
2,
|
|
8005
|
+
{
|
|
8006
|
+
image: image2,
|
|
8007
|
+
url: png
|
|
8008
|
+
}
|
|
8009
|
+
];
|
|
8010
|
+
case 6:
|
|
8011
|
+
return [
|
|
8012
|
+
2
|
|
8013
|
+
];
|
|
8014
|
+
}
|
|
8015
|
+
});
|
|
8016
|
+
});
|
|
8017
|
+
return _loadAVIFOptional.apply(this, arguments);
|
|
8018
|
+
}
|
|
7935
8019
|
/**
|
|
7936
8020
|
* 异步加载一个图片文件
|
|
7937
8021
|
* @param source - 图片文件的 URL、Blob 或 HTMLImageElement 对象
|
|
@@ -8133,31 +8217,35 @@ function deserializeMipmapTexture(textureOptions, bins, engine) {
|
|
|
8133
8217
|
}
|
|
8134
8218
|
function _deserializeMipmapTexture() {
|
|
8135
8219
|
_deserializeMipmapTexture = _async_to_generator(function(textureOptions, bins, engine, files) {
|
|
8136
|
-
var mipmaps, target,
|
|
8220
|
+
var mipmaps, target, jobs, loadedMipmaps, mipmaps1, target1, jobs1, loadedMipmaps1, bin;
|
|
8137
8221
|
return __generator(this, function(_state) {
|
|
8138
8222
|
switch(_state.label){
|
|
8139
8223
|
case 0:
|
|
8140
8224
|
if (files === void 0) files = [];
|
|
8141
8225
|
if (!(textureOptions.target === 34067)) return [
|
|
8142
8226
|
3,
|
|
8143
|
-
|
|
8227
|
+
2
|
|
8144
8228
|
];
|
|
8145
8229
|
mipmaps = textureOptions.mipmaps, target = textureOptions.target;
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
for(_iterator = _create_for_of_iterator_helper_loose(mipmaps); !(_step = _iterator()).done;){
|
|
8149
|
-
level = _step.value;
|
|
8150
|
-
newLevel = [];
|
|
8151
|
-
for(_iterator1 = _create_for_of_iterator_helper_loose(level); !(_step1 = _iterator1()).done;){
|
|
8152
|
-
face = _step1.value;
|
|
8230
|
+
jobs = mipmaps.map(function(mipmap) {
|
|
8231
|
+
return Promise.all(mipmap.map(function(pointer) {
|
|
8153
8232
|
// @ts-expect-error
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8233
|
+
if (pointer.id) {
|
|
8234
|
+
// @ts-expect-error
|
|
8235
|
+
var loadedImageAsset = engine.assetLoader.loadGUID(pointer.id);
|
|
8236
|
+
// @ts-expect-error
|
|
8237
|
+
return loadedImageAsset.data;
|
|
8238
|
+
} else {
|
|
8239
|
+
return loadMipmapImage(pointer, bins);
|
|
8240
|
+
}
|
|
8241
|
+
}));
|
|
8242
|
+
});
|
|
8243
|
+
return [
|
|
8244
|
+
4,
|
|
8245
|
+
Promise.all(jobs)
|
|
8246
|
+
];
|
|
8247
|
+
case 1:
|
|
8248
|
+
loadedMipmaps = _state.sent();
|
|
8161
8249
|
return [
|
|
8162
8250
|
2,
|
|
8163
8251
|
_extends({
|
|
@@ -8171,17 +8259,17 @@ function _deserializeMipmapTexture() {
|
|
|
8171
8259
|
}
|
|
8172
8260
|
})
|
|
8173
8261
|
];
|
|
8174
|
-
case
|
|
8262
|
+
case 2:
|
|
8175
8263
|
// TODO: 补充测试用例
|
|
8176
8264
|
mipmaps1 = textureOptions.mipmaps, target1 = textureOptions.target;
|
|
8177
|
-
|
|
8265
|
+
jobs1 = mipmaps1.map(function(pointer) {
|
|
8178
8266
|
return loadMipmapImage(pointer, bins);
|
|
8179
8267
|
});
|
|
8180
8268
|
return [
|
|
8181
8269
|
4,
|
|
8182
|
-
Promise.all(
|
|
8270
|
+
Promise.all(jobs1)
|
|
8183
8271
|
];
|
|
8184
|
-
case
|
|
8272
|
+
case 3:
|
|
8185
8273
|
loadedMipmaps1 = _state.sent();
|
|
8186
8274
|
bin = files[mipmaps1[0][1][0]].url;
|
|
8187
8275
|
return [
|
|
@@ -8204,7 +8292,7 @@ function _deserializeMipmapTexture() {
|
|
|
8204
8292
|
}
|
|
8205
8293
|
})
|
|
8206
8294
|
];
|
|
8207
|
-
case
|
|
8295
|
+
case 4:
|
|
8208
8296
|
return [
|
|
8209
8297
|
2
|
|
8210
8298
|
];
|
|
@@ -11559,7 +11647,7 @@ var valueDefine = "#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValu
|
|
|
11559
11647
|
|
|
11560
11648
|
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.;}";
|
|
11561
11649
|
|
|
11562
|
-
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);}";
|
|
11650
|
+
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);}";
|
|
11563
11651
|
|
|
11564
11652
|
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);}";
|
|
11565
11653
|
|
|
@@ -11569,7 +11657,7 @@ var gaussianDownVFrag = "precision highp float;varying vec2 uv;uniform sampler2D
|
|
|
11569
11657
|
|
|
11570
11658
|
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);}";
|
|
11571
11659
|
|
|
11572
|
-
var thresholdFrag = "precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4
|
|
11660
|
+
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);}";
|
|
11573
11661
|
|
|
11574
11662
|
// Bloom 阈值 Pass
|
|
11575
11663
|
var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
|
|
@@ -11847,7 +11935,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11847
11935
|
this.screenMesh.material.setFloat("_Brightness", brightness);
|
|
11848
11936
|
this.screenMesh.material.setFloat("_Saturation", saturation);
|
|
11849
11937
|
this.screenMesh.material.setFloat("_Contrast", contrast);
|
|
11850
|
-
this.screenMesh.material.setInt("_UseBloom", useBloom);
|
|
11938
|
+
this.screenMesh.material.setInt("_UseBloom", Number(useBloom));
|
|
11851
11939
|
if (useBloom) {
|
|
11852
11940
|
this.screenMesh.material.setTexture("_GaussianTex", this.mainTexture);
|
|
11853
11941
|
this.screenMesh.material.setFloat("_BloomIntensity", bloomIntensity);
|
|
@@ -11859,7 +11947,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11859
11947
|
this.screenMesh.material.setVector2("_VignetteCenter", new Vector2(0.5, 0.5));
|
|
11860
11948
|
this.screenMesh.material.setVector3("_VignetteColor", new Vector3(0.0, 0.0, 0.0));
|
|
11861
11949
|
}
|
|
11862
|
-
this.screenMesh.material.setInt("_UseToneMapping", useToneMapping);
|
|
11950
|
+
this.screenMesh.material.setInt("_UseToneMapping", Number(useToneMapping));
|
|
11863
11951
|
renderer.renderMeshes([
|
|
11864
11952
|
this.screenMesh
|
|
11865
11953
|
]);
|
|
@@ -11867,29 +11955,6 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11867
11955
|
return ToneMappingPass;
|
|
11868
11956
|
}(RenderPass);
|
|
11869
11957
|
|
|
11870
|
-
/**
|
|
11871
|
-
* 后处理配置
|
|
11872
|
-
*/ var defaultGlobalVolume = {
|
|
11873
|
-
useHDR: false,
|
|
11874
|
-
usePostProcessing: false,
|
|
11875
|
-
/***** Material Uniform *****/ // Bloom
|
|
11876
|
-
useBloom: 1.0,
|
|
11877
|
-
threshold: 1.0,
|
|
11878
|
-
bloomIntensity: 1.0,
|
|
11879
|
-
// ColorAdjustments
|
|
11880
|
-
brightness: 1.0,
|
|
11881
|
-
saturation: 1.0,
|
|
11882
|
-
contrast: 1.0,
|
|
11883
|
-
// Vignette
|
|
11884
|
-
// vignetteColor: new math.Color(0, 0, 0, 1),
|
|
11885
|
-
// vignetteCenter: new math.Vector2(0.5, 0.5),
|
|
11886
|
-
vignetteIntensity: 0.2,
|
|
11887
|
-
vignetteSmoothness: 0.4,
|
|
11888
|
-
vignetteRoundness: 1.0,
|
|
11889
|
-
// ToneMapping
|
|
11890
|
-
useToneMapping: 1
|
|
11891
|
-
};
|
|
11892
|
-
|
|
11893
11958
|
var RENDER_PASS_NAME_PREFIX = "_effects_default_";
|
|
11894
11959
|
var seed$5 = 1;
|
|
11895
11960
|
/**
|
|
@@ -11913,7 +11978,7 @@ var seed$5 = 1;
|
|
|
11913
11978
|
} : _options_clearAction;
|
|
11914
11979
|
var engine = renderer.engine;
|
|
11915
11980
|
if (globalVolume) {
|
|
11916
|
-
this.globalVolume =
|
|
11981
|
+
this.globalVolume = globalVolume;
|
|
11917
11982
|
}
|
|
11918
11983
|
this.globalUniforms = new GlobalUniforms();
|
|
11919
11984
|
var attachments = []; //渲染场景物体Pass的RT
|
|
@@ -11956,20 +12021,36 @@ var seed$5 = 1;
|
|
|
11956
12021
|
];
|
|
11957
12022
|
this.setRenderPasses(renderPasses);
|
|
11958
12023
|
if (this.globalVolume) {
|
|
11959
|
-
var useBloom = this.globalVolume.useBloom;
|
|
11960
12024
|
var sceneTextureHandle = new RenderTargetHandle(engine); //保存后处理前的屏幕图像
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
|
|
11964
|
-
|
|
11965
|
-
|
|
11966
|
-
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
|
|
11972
|
-
|
|
12025
|
+
var gaussianStep = 7; // 高斯模糊的迭代次数,次数越高模糊范围越大
|
|
12026
|
+
var viewport = [
|
|
12027
|
+
0,
|
|
12028
|
+
0,
|
|
12029
|
+
this.renderer.getWidth() / 2,
|
|
12030
|
+
this.renderer.getHeight() / 2
|
|
12031
|
+
];
|
|
12032
|
+
var gaussianDownResults = new Array(gaussianStep); //存放多个高斯Pass的模糊结果,用于Bloom
|
|
12033
|
+
var textureType1 = this.globalVolume.useHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
|
|
12034
|
+
var bloomThresholdPass = new BloomThresholdPass(renderer, {
|
|
12035
|
+
name: "BloomThresholdPass",
|
|
12036
|
+
attachments: [
|
|
12037
|
+
{
|
|
12038
|
+
texture: {
|
|
12039
|
+
format: glContext.RGBA,
|
|
12040
|
+
type: textureType1,
|
|
12041
|
+
minFilter: glContext.LINEAR,
|
|
12042
|
+
magFilter: glContext.LINEAR
|
|
12043
|
+
}
|
|
12044
|
+
}
|
|
12045
|
+
]
|
|
12046
|
+
});
|
|
12047
|
+
bloomThresholdPass.sceneTextureHandle = sceneTextureHandle;
|
|
12048
|
+
this.addRenderPass(bloomThresholdPass);
|
|
12049
|
+
for(var i = 0; i < gaussianStep; i++){
|
|
12050
|
+
gaussianDownResults[i] = new RenderTargetHandle(engine);
|
|
12051
|
+
var gaussianDownHPass = new HQGaussianDownSamplePass(renderer, "H", {
|
|
12052
|
+
name: "GaussianDownPassH" + i,
|
|
12053
|
+
viewport: viewport,
|
|
11973
12054
|
attachments: [
|
|
11974
12055
|
{
|
|
11975
12056
|
texture: {
|
|
@@ -11981,74 +12062,50 @@ var seed$5 = 1;
|
|
|
11981
12062
|
}
|
|
11982
12063
|
]
|
|
11983
12064
|
});
|
|
11984
|
-
|
|
11985
|
-
|
|
11986
|
-
|
|
11987
|
-
|
|
11988
|
-
|
|
11989
|
-
|
|
11990
|
-
|
|
11991
|
-
|
|
11992
|
-
|
|
11993
|
-
|
|
11994
|
-
format: glContext.RGBA,
|
|
11995
|
-
type: textureType1,
|
|
11996
|
-
minFilter: glContext.LINEAR,
|
|
11997
|
-
magFilter: glContext.LINEAR
|
|
11998
|
-
}
|
|
11999
|
-
}
|
|
12000
|
-
]
|
|
12001
|
-
});
|
|
12002
|
-
var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", {
|
|
12003
|
-
name: "GaussianDownPassV" + i,
|
|
12004
|
-
viewport: viewport,
|
|
12005
|
-
attachments: [
|
|
12006
|
-
{
|
|
12007
|
-
texture: {
|
|
12008
|
-
format: glContext.RGBA,
|
|
12009
|
-
type: textureType1,
|
|
12010
|
-
minFilter: glContext.LINEAR,
|
|
12011
|
-
magFilter: glContext.LINEAR
|
|
12012
|
-
}
|
|
12065
|
+
var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", {
|
|
12066
|
+
name: "GaussianDownPassV" + i,
|
|
12067
|
+
viewport: viewport,
|
|
12068
|
+
attachments: [
|
|
12069
|
+
{
|
|
12070
|
+
texture: {
|
|
12071
|
+
format: glContext.RGBA,
|
|
12072
|
+
type: textureType1,
|
|
12073
|
+
minFilter: glContext.LINEAR,
|
|
12074
|
+
magFilter: glContext.LINEAR
|
|
12013
12075
|
}
|
|
12014
|
-
|
|
12015
|
-
|
|
12016
|
-
|
|
12017
|
-
|
|
12018
|
-
|
|
12019
|
-
|
|
12020
|
-
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
|
|
12025
|
-
|
|
12026
|
-
|
|
12027
|
-
|
|
12028
|
-
|
|
12029
|
-
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
|
|
12033
|
-
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
|
|
12076
|
+
}
|
|
12077
|
+
]
|
|
12078
|
+
});
|
|
12079
|
+
gaussianDownVPass.gaussianResult = gaussianDownResults[i];
|
|
12080
|
+
this.addRenderPass(gaussianDownHPass);
|
|
12081
|
+
this.addRenderPass(gaussianDownVPass);
|
|
12082
|
+
viewport[2] /= 2;
|
|
12083
|
+
viewport[3] /= 2;
|
|
12084
|
+
// TODO 限制最大迭代
|
|
12085
|
+
}
|
|
12086
|
+
viewport[2] *= 4;
|
|
12087
|
+
viewport[3] *= 4;
|
|
12088
|
+
for(var i1 = 0; i1 < gaussianStep - 1; i1++){
|
|
12089
|
+
var gaussianUpPass = new HQGaussianUpSamplePass(renderer, {
|
|
12090
|
+
name: "GaussianUpPass" + i1,
|
|
12091
|
+
viewport: viewport,
|
|
12092
|
+
attachments: [
|
|
12093
|
+
{
|
|
12094
|
+
texture: {
|
|
12095
|
+
format: glContext.RGBA,
|
|
12096
|
+
type: textureType1,
|
|
12097
|
+
minFilter: glContext.LINEAR,
|
|
12098
|
+
magFilter: glContext.LINEAR
|
|
12037
12099
|
}
|
|
12038
|
-
|
|
12039
|
-
|
|
12040
|
-
|
|
12041
|
-
|
|
12042
|
-
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
}
|
|
12046
|
-
var postProcessPass;
|
|
12047
|
-
if (useBloom) {
|
|
12048
|
-
postProcessPass = new ToneMappingPass(renderer, sceneTextureHandle);
|
|
12049
|
-
} else {
|
|
12050
|
-
postProcessPass = new ToneMappingPass(renderer);
|
|
12100
|
+
}
|
|
12101
|
+
]
|
|
12102
|
+
});
|
|
12103
|
+
gaussianUpPass.gaussianDownSampleResult = gaussianDownResults[gaussianStep - 2 - i1];
|
|
12104
|
+
this.addRenderPass(gaussianUpPass);
|
|
12105
|
+
viewport[2] *= 2;
|
|
12106
|
+
viewport[3] *= 2;
|
|
12051
12107
|
}
|
|
12108
|
+
var postProcessPass = new ToneMappingPass(renderer, sceneTextureHandle);
|
|
12052
12109
|
this.addRenderPass(postProcessPass);
|
|
12053
12110
|
}
|
|
12054
12111
|
this.semantics = new SemanticMap(options.semantics);
|
|
@@ -12958,6 +13015,28 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
12958
13015
|
return Renderer;
|
|
12959
13016
|
}();
|
|
12960
13017
|
|
|
13018
|
+
/**
|
|
13019
|
+
* 后处理配置
|
|
13020
|
+
*/ var defaultGlobalVolume = {
|
|
13021
|
+
useHDR: false,
|
|
13022
|
+
/***** Material Uniform *****/ // Bloom
|
|
13023
|
+
useBloom: true,
|
|
13024
|
+
threshold: 1.0,
|
|
13025
|
+
bloomIntensity: 1.0,
|
|
13026
|
+
// ColorAdjustments
|
|
13027
|
+
brightness: 1.0,
|
|
13028
|
+
saturation: 1.0,
|
|
13029
|
+
contrast: 1.0,
|
|
13030
|
+
// Vignette
|
|
13031
|
+
// vignetteColor: new math.Color(0, 0, 0, 1),
|
|
13032
|
+
// vignetteCenter: new math.Vector2(0.5, 0.5),
|
|
13033
|
+
vignetteIntensity: 0.2,
|
|
13034
|
+
vignetteSmoothness: 0.4,
|
|
13035
|
+
vignetteRoundness: 1.0,
|
|
13036
|
+
// ToneMapping
|
|
13037
|
+
useToneMapping: true
|
|
13038
|
+
};
|
|
13039
|
+
|
|
12961
13040
|
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";
|
|
12962
13041
|
var fragment = "\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor;\n}\n";
|
|
12963
13042
|
var seed$4 = 1;
|
|
@@ -13085,6 +13164,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13085
13164
|
1
|
|
13086
13165
|
];
|
|
13087
13166
|
/** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
|
|
13167
|
+
_this.hasBeenAddedToComposition = false;
|
|
13088
13168
|
_this.getHitTestParams = function(force) {
|
|
13089
13169
|
if (!_this.clickable) {
|
|
13090
13170
|
return;
|
|
@@ -13115,10 +13195,6 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13115
13195
|
this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
|
|
13116
13196
|
}
|
|
13117
13197
|
}
|
|
13118
|
-
composition.addInteractiveItem(this.item, options.type);
|
|
13119
|
-
this.item.onEnd = function() {
|
|
13120
|
-
return composition.removeInteractiveItem(_this.item, options.type);
|
|
13121
|
-
};
|
|
13122
13198
|
if (options.type === InteractType.DRAG) {
|
|
13123
13199
|
if (env !== PLAYER_OPTIONS_ENV_EDITOR || options.enableInEditor) {
|
|
13124
13200
|
composition.event && this.beginDragTarget(options, composition.event);
|
|
@@ -13129,10 +13205,25 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13129
13205
|
this.materials = this.previewContent.mesh.materials;
|
|
13130
13206
|
}
|
|
13131
13207
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
13208
|
+
this.item.onEnd = function() {
|
|
13209
|
+
if (_this.item && _this.item.composition) {
|
|
13210
|
+
var _this_previewContent;
|
|
13211
|
+
_this.item.composition.removeInteractiveItem(_this.item, _this.item.props.content.options.type);
|
|
13212
|
+
_this.clickable = false;
|
|
13213
|
+
_this.hasBeenAddedToComposition = false;
|
|
13214
|
+
(_this_previewContent = _this.previewContent) == null ? void 0 : _this_previewContent.mesh.dispose();
|
|
13215
|
+
_this.endDragTarget();
|
|
13216
|
+
}
|
|
13217
|
+
};
|
|
13132
13218
|
};
|
|
13133
13219
|
_proto.update = function update(dt) {
|
|
13134
13220
|
var _this_previewContent;
|
|
13135
13221
|
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
13222
|
+
if (!this.hasBeenAddedToComposition && this.item.composition) {
|
|
13223
|
+
var options = this.item.props.content.options;
|
|
13224
|
+
this.item.composition.addInteractiveItem(this.item, options.type);
|
|
13225
|
+
this.hasBeenAddedToComposition = true;
|
|
13226
|
+
}
|
|
13136
13227
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
13137
13228
|
return;
|
|
13138
13229
|
}
|
|
@@ -13152,15 +13243,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13152
13243
|
this.previewContent.mesh.render(renderer);
|
|
13153
13244
|
}
|
|
13154
13245
|
};
|
|
13155
|
-
_proto.onDestroy = function onDestroy() {
|
|
13156
|
-
if (this.item && this.item.composition) {
|
|
13157
|
-
var _this_previewContent;
|
|
13158
|
-
this.item.composition.removeInteractiveItem(this.item, this.item.props.content.options.type);
|
|
13159
|
-
this.clickable = false;
|
|
13160
|
-
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.mesh.dispose();
|
|
13161
|
-
this.endDragTarget();
|
|
13162
|
-
}
|
|
13163
|
-
};
|
|
13246
|
+
_proto.onDestroy = function onDestroy() {};
|
|
13164
13247
|
_proto.endDragTarget = function endDragTarget() {
|
|
13165
13248
|
// OVERRIDE
|
|
13166
13249
|
};
|
|
@@ -13743,6 +13826,10 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
13743
13826
|
}
|
|
13744
13827
|
if (!this.spriteMaterial) {
|
|
13745
13828
|
this.spriteMaterial = boundObject.getComponent(exports.SpriteComponent).material;
|
|
13829
|
+
var startColor = this.spriteMaterial.getVector4("_Color");
|
|
13830
|
+
if (startColor) {
|
|
13831
|
+
this.startColor = startColor.toArray();
|
|
13832
|
+
}
|
|
13746
13833
|
}
|
|
13747
13834
|
var colorInc = vecFill(tempColor, 1);
|
|
13748
13835
|
var colorChanged;
|
|
@@ -13772,12 +13859,6 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
13772
13859
|
this.colorOverLifetime = colorStopsFromGradient(colorOverLifetime.color[1]);
|
|
13773
13860
|
}
|
|
13774
13861
|
}
|
|
13775
|
-
this.startColor = clipData.startColor || [
|
|
13776
|
-
1,
|
|
13777
|
-
1,
|
|
13778
|
-
1,
|
|
13779
|
-
1
|
|
13780
|
-
];
|
|
13781
13862
|
return this;
|
|
13782
13863
|
};
|
|
13783
13864
|
return SpriteColorPlayable;
|
|
@@ -14085,7 +14166,7 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
14085
14166
|
var splits = item.splits, renderer = item.renderer, textureSheetAnimation = item.textureSheetAnimation;
|
|
14086
14167
|
var sx = 1, sy = 1;
|
|
14087
14168
|
if (renderer.shape) {
|
|
14088
|
-
var _renderer_shape = renderer.shape,
|
|
14169
|
+
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;
|
|
14089
14170
|
var point = new Float32Array(aPoint);
|
|
14090
14171
|
var position = [];
|
|
14091
14172
|
var atlasOffset = [];
|
|
@@ -14856,8 +14937,7 @@ var RectangleEdge = /*#__PURE__*/ function() {
|
|
|
14856
14937
|
}();
|
|
14857
14938
|
var Edge = /*#__PURE__*/ function() {
|
|
14858
14939
|
function Edge(args) {
|
|
14859
|
-
|
|
14860
|
-
this._d = (args.width || 1) / 2;
|
|
14940
|
+
this._d = args.width || 1;
|
|
14861
14941
|
this.arcMode = args.arcMode;
|
|
14862
14942
|
}
|
|
14863
14943
|
var _proto = Edge.prototype;
|
|
@@ -16956,6 +17036,12 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16956
17036
|
area: area
|
|
16957
17037
|
};
|
|
16958
17038
|
};
|
|
17039
|
+
_proto.onAttached = function onAttached() {
|
|
17040
|
+
Component.prototype.onAttached.call(this);
|
|
17041
|
+
this.renderer.item = this.item;
|
|
17042
|
+
this.item.components.push(this.renderer);
|
|
17043
|
+
this.item.rendererComponents.push(this.renderer);
|
|
17044
|
+
};
|
|
16959
17045
|
_proto.fromData = function fromData(data) {
|
|
16960
17046
|
Component.prototype.fromData.call(this, data);
|
|
16961
17047
|
var props = data;
|
|
@@ -17237,9 +17323,6 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
17237
17323
|
}
|
|
17238
17324
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
17239
17325
|
this.item._content = this;
|
|
17240
|
-
this.renderer.item = this.item;
|
|
17241
|
-
this.item.components.push(this.renderer);
|
|
17242
|
-
this.item.rendererComponents.push(this.renderer);
|
|
17243
17326
|
};
|
|
17244
17327
|
_create_class(ParticleSystem, [
|
|
17245
17328
|
{
|
|
@@ -19269,7 +19352,7 @@ function compareTracks(a, b) {
|
|
|
19269
19352
|
_proto.hitTest = function hitTest(ray, x, y, regions, force, options) {
|
|
19270
19353
|
var _this, _loop = function(i) {
|
|
19271
19354
|
var item = _this.items[i];
|
|
19272
|
-
if (item.getVisible() && !item.ended && !exports.VFXItem.isComposition(item) && !skip(item)) {
|
|
19355
|
+
if (item.getVisible() && item.transform.getValid() && !item.ended && !exports.VFXItem.isComposition(item) && !skip(item)) {
|
|
19273
19356
|
var hitParams = item.getHitTestParams(force);
|
|
19274
19357
|
if (hitParams) {
|
|
19275
19358
|
var success = false;
|
|
@@ -19425,18 +19508,6 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
19425
19508
|
var tempWidth = fontSize + letterSpace;
|
|
19426
19509
|
this.autoWidth = autoWidth;
|
|
19427
19510
|
this.maxTextWidth = text.length * tempWidth;
|
|
19428
|
-
// if (autoWidth) {
|
|
19429
|
-
// this.width = this.maxTextWidth + this.lineWidth;
|
|
19430
|
-
// this.height = fontSize + this.lineHeight;
|
|
19431
|
-
// } else {
|
|
19432
|
-
// if (textWidth) {
|
|
19433
|
-
// this.maxCharCount = Math.floor((textWidth - this.lineWidth) / (tempWidth));
|
|
19434
|
-
// this.width = textWidth;
|
|
19435
|
-
// } else {
|
|
19436
|
-
// this.width = basicScale[0] * 100;
|
|
19437
|
-
// }
|
|
19438
|
-
// this.height = basicScale[1] * 100;
|
|
19439
|
-
// }
|
|
19440
19511
|
this.width = textWidth;
|
|
19441
19512
|
this.height = textHeight;
|
|
19442
19513
|
this.letterSpace = letterSpace;
|
|
@@ -19873,6 +19944,17 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19873
19944
|
this.isDirty = true;
|
|
19874
19945
|
};
|
|
19875
19946
|
/**
|
|
19947
|
+
* 设置自适应宽高开关
|
|
19948
|
+
* @param value - 是否自适应宽高开关
|
|
19949
|
+
* @returns
|
|
19950
|
+
*/ _proto.setAutoWidth = function setAutoWidth(value) {
|
|
19951
|
+
if (this.textLayout.autoWidth === value) {
|
|
19952
|
+
return;
|
|
19953
|
+
}
|
|
19954
|
+
this.textLayout.autoWidth = value;
|
|
19955
|
+
this.isDirty = true;
|
|
19956
|
+
};
|
|
19957
|
+
/**
|
|
19876
19958
|
* 更新文本
|
|
19877
19959
|
* @returns
|
|
19878
19960
|
*/ _proto.updateTexture = function updateTexture(flipY) {
|
|
@@ -19885,20 +19967,26 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19885
19967
|
var layout = this.textLayout;
|
|
19886
19968
|
var fontScale = style.fontScale;
|
|
19887
19969
|
var width = (layout.width + style.fontOffset) * fontScale;
|
|
19888
|
-
var
|
|
19970
|
+
var finalHeight = layout.lineHeight * this.lineCount;
|
|
19889
19971
|
var fontSize = style.fontSize * fontScale;
|
|
19890
19972
|
var lineHeight = layout.lineHeight * fontScale;
|
|
19891
19973
|
this.char = (this.text || "").split("");
|
|
19892
19974
|
this.canvas.width = width;
|
|
19893
|
-
|
|
19894
|
-
|
|
19975
|
+
if (layout.autoWidth) {
|
|
19976
|
+
this.canvas.height = finalHeight * fontScale;
|
|
19977
|
+
this.item.transform.size.set(1, finalHeight / layout.height);
|
|
19978
|
+
} else {
|
|
19979
|
+
this.canvas.height = layout.height * fontScale;
|
|
19980
|
+
}
|
|
19981
|
+
var height = this.canvas.height;
|
|
19982
|
+
context.clearRect(0, 0, width, height);
|
|
19895
19983
|
// fix bug 1/255
|
|
19896
19984
|
context.fillStyle = "rgba(255, 255, 255, 0.0039)";
|
|
19897
19985
|
if (!flipY) {
|
|
19898
19986
|
context.translate(0, height);
|
|
19899
19987
|
context.scale(1, -1);
|
|
19900
19988
|
}
|
|
19901
|
-
context.fillRect(0, 0, width,
|
|
19989
|
+
context.fillRect(0, 0, width, height);
|
|
19902
19990
|
style.fontDesc = this.getFontDesc();
|
|
19903
19991
|
context.font = style.fontDesc;
|
|
19904
19992
|
if (style.hasShadow) {
|
|
@@ -20182,6 +20270,76 @@ function geometryToTriangles(geometry) {
|
|
|
20182
20270
|
return res;
|
|
20183
20271
|
}
|
|
20184
20272
|
|
|
20273
|
+
exports.PostProcessVolume = /*#__PURE__*/ function(ItemBehaviour) {
|
|
20274
|
+
_inherits(PostProcessVolume, ItemBehaviour);
|
|
20275
|
+
function PostProcessVolume() {
|
|
20276
|
+
var _this;
|
|
20277
|
+
_this = ItemBehaviour.apply(this, arguments) || this;
|
|
20278
|
+
_this.useHDR = true;
|
|
20279
|
+
// Bloom
|
|
20280
|
+
_this.useBloom = true;
|
|
20281
|
+
_this.threshold = 1.0;
|
|
20282
|
+
_this.bloomIntensity = 1.0;
|
|
20283
|
+
// ColorAdjustments
|
|
20284
|
+
_this.brightness = 1.0;
|
|
20285
|
+
_this.saturation = 1.0;
|
|
20286
|
+
_this.contrast = 1.0;
|
|
20287
|
+
// Vignette
|
|
20288
|
+
_this.vignetteIntensity = 0.2;
|
|
20289
|
+
_this.vignetteSmoothness = 0.4;
|
|
20290
|
+
_this.vignetteRoundness = 1.0;
|
|
20291
|
+
// ToneMapping
|
|
20292
|
+
_this.useToneMapping = true // 1: true, 0: false
|
|
20293
|
+
;
|
|
20294
|
+
return _this;
|
|
20295
|
+
}
|
|
20296
|
+
var _proto = PostProcessVolume.prototype;
|
|
20297
|
+
_proto.start = function start() {
|
|
20298
|
+
var composition = this.item.composition;
|
|
20299
|
+
if (composition) {
|
|
20300
|
+
composition.globalVolume = this;
|
|
20301
|
+
composition.createRenderFrame();
|
|
20302
|
+
}
|
|
20303
|
+
};
|
|
20304
|
+
return PostProcessVolume;
|
|
20305
|
+
}(ItemBehaviour);
|
|
20306
|
+
__decorate([
|
|
20307
|
+
serialize()
|
|
20308
|
+
], exports.PostProcessVolume.prototype, "useHDR", void 0);
|
|
20309
|
+
__decorate([
|
|
20310
|
+
serialize()
|
|
20311
|
+
], exports.PostProcessVolume.prototype, "useBloom", void 0);
|
|
20312
|
+
__decorate([
|
|
20313
|
+
serialize()
|
|
20314
|
+
], exports.PostProcessVolume.prototype, "threshold", void 0);
|
|
20315
|
+
__decorate([
|
|
20316
|
+
serialize()
|
|
20317
|
+
], exports.PostProcessVolume.prototype, "bloomIntensity", void 0);
|
|
20318
|
+
__decorate([
|
|
20319
|
+
serialize()
|
|
20320
|
+
], exports.PostProcessVolume.prototype, "brightness", void 0);
|
|
20321
|
+
__decorate([
|
|
20322
|
+
serialize()
|
|
20323
|
+
], exports.PostProcessVolume.prototype, "saturation", void 0);
|
|
20324
|
+
__decorate([
|
|
20325
|
+
serialize()
|
|
20326
|
+
], exports.PostProcessVolume.prototype, "contrast", void 0);
|
|
20327
|
+
__decorate([
|
|
20328
|
+
serialize()
|
|
20329
|
+
], exports.PostProcessVolume.prototype, "vignetteIntensity", void 0);
|
|
20330
|
+
__decorate([
|
|
20331
|
+
serialize()
|
|
20332
|
+
], exports.PostProcessVolume.prototype, "vignetteSmoothness", void 0);
|
|
20333
|
+
__decorate([
|
|
20334
|
+
serialize()
|
|
20335
|
+
], exports.PostProcessVolume.prototype, "vignetteRoundness", void 0);
|
|
20336
|
+
__decorate([
|
|
20337
|
+
serialize()
|
|
20338
|
+
], exports.PostProcessVolume.prototype, "useToneMapping", void 0);
|
|
20339
|
+
exports.PostProcessVolume = __decorate([
|
|
20340
|
+
effectsClass("PostProcessVolume")
|
|
20341
|
+
], exports.PostProcessVolume);
|
|
20342
|
+
|
|
20185
20343
|
exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
20186
20344
|
_inherits(VFXItem, EffectsObject);
|
|
20187
20345
|
function VFXItem(engine, props) {
|
|
@@ -20405,7 +20563,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20405
20563
|
/**
|
|
20406
20564
|
* 获取元素用于计算光线投射的面片类型和参数
|
|
20407
20565
|
* @override
|
|
20408
|
-
* @param force 元素没有开启交互也返回参数
|
|
20566
|
+
* @param force - 元素没有开启交互也返回参数
|
|
20409
20567
|
*/ _proto.getHitTestParams = function getHitTestParams(force) {
|
|
20410
20568
|
// OVERRIDE
|
|
20411
20569
|
};
|
|
@@ -20655,46 +20813,10 @@ exports.Item = void 0;
|
|
|
20655
20813
|
}
|
|
20656
20814
|
Item.isNull = isNull;
|
|
20657
20815
|
})(exports.Item || (exports.Item = {}));
|
|
20658
|
-
|
|
20659
|
-
|
|
20660
|
-
|
|
20661
|
-
|
|
20662
|
-
*/ function createVFXItem(props, composition) {
|
|
20663
|
-
var type = props.type;
|
|
20664
|
-
var pluginName = props.pluginName;
|
|
20665
|
-
if (!pluginName) {
|
|
20666
|
-
switch(type){
|
|
20667
|
-
case ItemType.null:
|
|
20668
|
-
pluginName = "cal";
|
|
20669
|
-
break;
|
|
20670
|
-
case ItemType.sprite:
|
|
20671
|
-
pluginName = "sprite";
|
|
20672
|
-
break;
|
|
20673
|
-
case ItemType.particle:
|
|
20674
|
-
pluginName = "particle";
|
|
20675
|
-
break;
|
|
20676
|
-
case ItemType.interact:
|
|
20677
|
-
pluginName = "interact";
|
|
20678
|
-
break;
|
|
20679
|
-
case ItemType.camera:
|
|
20680
|
-
pluginName = "camera";
|
|
20681
|
-
break;
|
|
20682
|
-
case ItemType.text:
|
|
20683
|
-
pluginName = "text";
|
|
20684
|
-
break;
|
|
20685
|
-
case ItemType.tree:
|
|
20686
|
-
pluginName = "tree";
|
|
20687
|
-
break;
|
|
20688
|
-
default:
|
|
20689
|
-
throw new Error("Invalid vfx item type.");
|
|
20690
|
-
}
|
|
20691
|
-
}
|
|
20692
|
-
return composition.pluginSystem.createPluginItem(pluginName, props, composition);
|
|
20693
|
-
}
|
|
20694
|
-
|
|
20695
|
-
var pluginLoaderMap = {};
|
|
20696
|
-
var defaultPlugins = [];
|
|
20697
|
-
var pluginCtrlMap = {};
|
|
20816
|
+
|
|
20817
|
+
var pluginLoaderMap = {};
|
|
20818
|
+
var defaultPlugins = [];
|
|
20819
|
+
var pluginCtrlMap = {};
|
|
20698
20820
|
/**
|
|
20699
20821
|
* 注册 plugin
|
|
20700
20822
|
* @param name
|
|
@@ -20703,6 +20825,9 @@ var pluginCtrlMap = {};
|
|
|
20703
20825
|
* @param isDefault load
|
|
20704
20826
|
*/ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20705
20827
|
function registerPlugin(name, pluginClass, itemClass, isDefault) {
|
|
20828
|
+
if (pluginCtrlMap[name]) {
|
|
20829
|
+
logger.error("Duplicate registration for plugin " + name + ".");
|
|
20830
|
+
}
|
|
20706
20831
|
pluginCtrlMap[name] = itemClass;
|
|
20707
20832
|
pluginLoaderMap[name] = pluginClass;
|
|
20708
20833
|
if (isDefault) {
|
|
@@ -21175,27 +21300,46 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21175
21300
|
res1
|
|
21176
21301
|
];
|
|
21177
21302
|
case 7:
|
|
21178
|
-
if (isObject(property) && property.constructor === Object)
|
|
21179
|
-
|
|
21180
|
-
|
|
21181
|
-
|
|
21182
|
-
|
|
21183
|
-
|
|
21184
|
-
for(_iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property)); !(_step1 = _iterator1()).done;){
|
|
21185
|
-
key = _step1.value;
|
|
21186
|
-
res2[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
|
|
21187
|
-
}
|
|
21188
|
-
return [
|
|
21189
|
-
2,
|
|
21190
|
-
res2
|
|
21191
|
-
];
|
|
21303
|
+
if (!(isObject(property) && property.constructor === Object)) return [
|
|
21304
|
+
3,
|
|
21305
|
+
12
|
|
21306
|
+
];
|
|
21307
|
+
if (type) {
|
|
21308
|
+
res2 = new type();
|
|
21192
21309
|
} else {
|
|
21193
|
-
|
|
21194
|
-
2,
|
|
21195
|
-
property
|
|
21196
|
-
];
|
|
21310
|
+
res2 = {};
|
|
21197
21311
|
}
|
|
21312
|
+
_iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property));
|
|
21313
|
+
_state.label = 8;
|
|
21198
21314
|
case 8:
|
|
21315
|
+
if (!!(_step1 = _iterator1()).done) return [
|
|
21316
|
+
3,
|
|
21317
|
+
11
|
|
21318
|
+
];
|
|
21319
|
+
key = _step1.value;
|
|
21320
|
+
return [
|
|
21321
|
+
4,
|
|
21322
|
+
SerializationHelper.deserializePropertyAsync(property[key], engine, level + 1)
|
|
21323
|
+
];
|
|
21324
|
+
case 9:
|
|
21325
|
+
res2[key] = _state.sent();
|
|
21326
|
+
_state.label = 10;
|
|
21327
|
+
case 10:
|
|
21328
|
+
return [
|
|
21329
|
+
3,
|
|
21330
|
+
8
|
|
21331
|
+
];
|
|
21332
|
+
case 11:
|
|
21333
|
+
return [
|
|
21334
|
+
2,
|
|
21335
|
+
res2
|
|
21336
|
+
];
|
|
21337
|
+
case 12:
|
|
21338
|
+
return [
|
|
21339
|
+
2,
|
|
21340
|
+
property
|
|
21341
|
+
];
|
|
21342
|
+
case 13:
|
|
21199
21343
|
return [
|
|
21200
21344
|
2
|
|
21201
21345
|
];
|
|
@@ -21281,8 +21425,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21281
21425
|
if (this.engine.objectInstance[guid]) {
|
|
21282
21426
|
return this.engine.objectInstance[guid];
|
|
21283
21427
|
}
|
|
21284
|
-
var effectsObject;
|
|
21285
21428
|
var effectsObjectData = this.findData(guid);
|
|
21429
|
+
var effectsObject;
|
|
21286
21430
|
if (!effectsObjectData) {
|
|
21287
21431
|
console.error("Object data with uuid: " + guid + " not found.");
|
|
21288
21432
|
return undefined;
|
|
@@ -21318,7 +21462,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21318
21462
|
_proto.loadGUIDAsync = function loadGUIDAsync(guid) {
|
|
21319
21463
|
var _this = this;
|
|
21320
21464
|
return _async_to_generator(function() {
|
|
21321
|
-
var
|
|
21465
|
+
var effectsObjectData, effectsObject, classConstructor;
|
|
21322
21466
|
return __generator(this, function(_state) {
|
|
21323
21467
|
switch(_state.label){
|
|
21324
21468
|
case 0:
|
|
@@ -21854,277 +21998,39 @@ function getBezierCurveFromHermiteInGE(geHermiteCurves) {
|
|
|
21854
21998
|
});
|
|
21855
21999
|
}
|
|
21856
22000
|
|
|
21857
|
-
function
|
|
21858
|
-
var
|
|
21859
|
-
var
|
|
21860
|
-
var shape = {
|
|
21861
|
-
type: ShapeType.NONE
|
|
21862
|
-
};
|
|
21863
|
-
if (particle.shape) {
|
|
21864
|
-
var _particle_shape_shape;
|
|
21865
|
-
var shapeType = (_particle_shape_shape = particle.shape.shape) == null ? void 0 : _particle_shape_shape.replace(/([A-Z])/g, "_$1").toUpperCase().replace(/^_/, "");
|
|
21866
|
-
shape = _extends({}, particle.shape, {
|
|
21867
|
-
type: ShapeType[shapeType]
|
|
21868
|
-
});
|
|
21869
|
-
if (particle.shape.upDirection) {
|
|
21870
|
-
var _particle_shape_upDirection = particle.shape.upDirection, x = _particle_shape_upDirection[0], y = _particle_shape_upDirection[1], z = _particle_shape_upDirection[2];
|
|
21871
|
-
if (x === 0 && y === 0 && z === 0) {
|
|
21872
|
-
delete shape.upDirection;
|
|
21873
|
-
}
|
|
21874
|
-
}
|
|
21875
|
-
}
|
|
21876
|
-
if (options.startTurbulence) {
|
|
21877
|
-
shape.turbulenceX = ensureNumberExpression(options.turbulenceX);
|
|
21878
|
-
shape.turbulenceY = ensureNumberExpression(options.turbulenceY);
|
|
21879
|
-
shape.turbulenceZ = ensureNumberExpression(options.turbulenceZ);
|
|
21880
|
-
}
|
|
21881
|
-
var emission = particle.emission;
|
|
21882
|
-
if (emission.bursts && emission.bursts.length > 0) {
|
|
21883
|
-
emission.bursts = emission.bursts.map(function(b) {
|
|
21884
|
-
return objectValueToNumber(b);
|
|
21885
|
-
});
|
|
21886
|
-
}
|
|
21887
|
-
if (emission.burstOffsets && emission.burstOffsets.length > 0) {
|
|
21888
|
-
emission.burstOffsets = emission.burstOffsets.map(function(b) {
|
|
21889
|
-
return objectValueToNumber(b);
|
|
21890
|
-
});
|
|
21891
|
-
}
|
|
21892
|
-
if (emission.rateOverTime) {
|
|
21893
|
-
emission.rateOverTime = ensureNumberExpression(emission.rateOverTime);
|
|
21894
|
-
}
|
|
22001
|
+
function getStandardCameraContent(model) {
|
|
22002
|
+
var _model_transform;
|
|
22003
|
+
var opt = model.options;
|
|
21895
22004
|
var ret = {
|
|
21896
|
-
renderer: particle.renderer,
|
|
21897
|
-
shape: shape,
|
|
21898
|
-
splits: particle.splits,
|
|
21899
|
-
emission: emission,
|
|
21900
22005
|
options: {
|
|
21901
|
-
|
|
21902
|
-
|
|
21903
|
-
|
|
21904
|
-
|
|
21905
|
-
startSizeY: ensureNumberExpression(options.startSizeY),
|
|
21906
|
-
sizeAspect: ensureNumberExpression(options.sizeAspect),
|
|
21907
|
-
maxCount: options.maxCount,
|
|
21908
|
-
startDelay: ensureNumberExpression(options.startDelay),
|
|
21909
|
-
startColor: ensureColorExpression(options.startColor, true),
|
|
21910
|
-
startRotationZ: ensureNumberExpression(options.startRotation || options.startRotationZ),
|
|
21911
|
-
particleFollowParent: options.particleFollowParent
|
|
21912
|
-
}
|
|
21913
|
-
};
|
|
21914
|
-
if (options.start3DRotation) {
|
|
21915
|
-
ret.options.startRotationX = ensureNumberExpression(options.startRotationX);
|
|
21916
|
-
ret.options.startRotationY = ensureNumberExpression(options.startRotationY);
|
|
21917
|
-
}
|
|
21918
|
-
if (transform && transform.path) {
|
|
21919
|
-
ret.emitterTransform = {
|
|
21920
|
-
path: ensureFixedVec3(transform.path)
|
|
21921
|
-
};
|
|
21922
|
-
}
|
|
21923
|
-
var sizeOverLifetime = particle.sizeOverLifetime;
|
|
21924
|
-
if (sizeOverLifetime) {
|
|
21925
|
-
if (sizeOverLifetime.separateAxes) {
|
|
21926
|
-
ret.sizeOverLifetime = {
|
|
21927
|
-
separateAxes: true,
|
|
21928
|
-
x: ensureNumberExpression(sizeOverLifetime.x),
|
|
21929
|
-
y: ensureNumberExpression(sizeOverLifetime.y)
|
|
21930
|
-
};
|
|
21931
|
-
} else {
|
|
21932
|
-
ret.sizeOverLifetime = {
|
|
21933
|
-
size: ensureNumberExpression(sizeOverLifetime.size)
|
|
21934
|
-
};
|
|
22006
|
+
fov: opt.fov,
|
|
22007
|
+
far: opt.far,
|
|
22008
|
+
near: opt.near,
|
|
22009
|
+
clipMode: opt.clipMode
|
|
21935
22010
|
}
|
|
21936
|
-
}
|
|
21937
|
-
var velocityOverLifetime = particle.velocityOverLifetime || {};
|
|
21938
|
-
var sol = velocityOverLifetime.speedOverLifetime;
|
|
21939
|
-
if (sol) {
|
|
21940
|
-
sol = ensureFixedNumber(sol);
|
|
21941
|
-
} else {
|
|
21942
|
-
sol = undefined;
|
|
21943
|
-
}
|
|
21944
|
-
ret.positionOverLifetime = {
|
|
21945
|
-
gravity: options.gravity,
|
|
21946
|
-
gravityOverLifetime: ensureFixedNumber(options.gravityModifier),
|
|
21947
|
-
startSpeed: ensureNumberExpression(options.startSpeed),
|
|
21948
|
-
speedOverLifetime: sol,
|
|
21949
|
-
asMovement: velocityOverLifetime.asMovement,
|
|
21950
|
-
linearX: ensureNumberExpression(velocityOverLifetime.linearX),
|
|
21951
|
-
linearY: ensureNumberExpression(velocityOverLifetime.linearY),
|
|
21952
|
-
linearZ: ensureNumberExpression(velocityOverLifetime.linearZ),
|
|
21953
|
-
asRotation: velocityOverLifetime.asRotation,
|
|
21954
|
-
orbCenter: velocityOverLifetime.orbCenter,
|
|
21955
|
-
orbitalX: ensureNumberExpression(velocityOverLifetime.orbitalX),
|
|
21956
|
-
orbitalY: ensureNumberExpression(velocityOverLifetime.orbitalY),
|
|
21957
|
-
orbitalZ: ensureNumberExpression(velocityOverLifetime.orbitalZ),
|
|
21958
|
-
forceTarget: velocityOverLifetime.forceTarget,
|
|
21959
|
-
target: velocityOverLifetime.target,
|
|
21960
|
-
forceCurve: ensureFixedNumber(velocityOverLifetime.forceCurve)
|
|
21961
22011
|
};
|
|
21962
|
-
|
|
21963
|
-
|
|
21964
|
-
|
|
21965
|
-
|
|
21966
|
-
|
|
21967
|
-
|
|
21968
|
-
|
|
21969
|
-
|
|
21970
|
-
if (rotationOverLifetime.separateAxes) {
|
|
21971
|
-
ret.rotationOverLifetime.y = ensureFixedNumber(rotationOverLifetime.y);
|
|
21972
|
-
ret.rotationOverLifetime.x = ensureFixedNumber(rotationOverLifetime.x);
|
|
21973
|
-
}
|
|
21974
|
-
}
|
|
21975
|
-
var colorOverLifetime = particle.colorOverLifetime;
|
|
21976
|
-
if (colorOverLifetime) {
|
|
21977
|
-
var col = ret.colorOverLifetime = {
|
|
21978
|
-
opacity: ensureFixedNumber(colorOverLifetime.opacity)
|
|
21979
|
-
};
|
|
21980
|
-
if (colorOverLifetime.color) {
|
|
21981
|
-
col.color = getGradientColor(colorOverLifetime.color);
|
|
21982
|
-
}
|
|
21983
|
-
}
|
|
21984
|
-
var textureSheetAnimation = particle.textureSheetAnimation;
|
|
21985
|
-
if (textureSheetAnimation) {
|
|
21986
|
-
ret.textureSheetAnimation = {
|
|
21987
|
-
row: textureSheetAnimation.row,
|
|
21988
|
-
col: textureSheetAnimation.col,
|
|
21989
|
-
total: textureSheetAnimation.total,
|
|
21990
|
-
animate: textureSheetAnimation.animate,
|
|
21991
|
-
cycles: ensureFixedNumber(textureSheetAnimation.cycles),
|
|
21992
|
-
animationDelay: ensureFixedNumberWithRandom(textureSheetAnimation.animationDelay, 0),
|
|
21993
|
-
animationDuration: ensureFixedNumberWithRandom(textureSheetAnimation.animationDuration, 0)
|
|
21994
|
-
};
|
|
21995
|
-
}
|
|
21996
|
-
var trials = particle.trails;
|
|
21997
|
-
if (trials) {
|
|
21998
|
-
ret.trails = {
|
|
21999
|
-
lifetime: ensureNumberExpression(trials.lifetime),
|
|
22000
|
-
dieWithParticles: trials.dieWithParticles,
|
|
22001
|
-
maxPointPerTrail: trials.maxPointPerTrail,
|
|
22002
|
-
minimumVertexDistance: trials.minimumVertexDistance,
|
|
22003
|
-
widthOverTrail: ensureFixedNumber(trials.widthOverTrail),
|
|
22004
|
-
colorOverTrail: trials.colorOverTrail && getGradientColor(trials.colorOverTrail, false),
|
|
22005
|
-
blending: trials.blending,
|
|
22006
|
-
colorOverLifetime: trials.colorOverLifetime && getGradientColor(trials.colorOverLifetime, false),
|
|
22007
|
-
inheritParticleColor: trials.inheritParticleColor,
|
|
22008
|
-
occlusion: trials.occlusion,
|
|
22009
|
-
transparentOcclusion: trials.transparentOcclusion,
|
|
22010
|
-
orderOffset: trials.orderOffset,
|
|
22011
|
-
sizeAffectsLifetime: trials.sizeAffectsLifetime,
|
|
22012
|
-
sizeAffectsWidth: trials.sizeAffectsWidth,
|
|
22013
|
-
texture: trials.texture,
|
|
22014
|
-
parentAffectsPosition: trials.parentAffectsPosition,
|
|
22015
|
-
opacityOverLifetime: ensureNumberExpression(trials.opacityOverLifetime)
|
|
22012
|
+
var velocityOverLifetime = model.velocityOverLifetime;
|
|
22013
|
+
if (velocityOverLifetime || ((_model_transform = model.transform) == null ? void 0 : _model_transform.path)) {
|
|
22014
|
+
var _model_transform1;
|
|
22015
|
+
var positionOverLifetime = {
|
|
22016
|
+
path: ensureFixedVec3((_model_transform1 = model.transform) == null ? void 0 : _model_transform1.path),
|
|
22017
|
+
linearX: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateX),
|
|
22018
|
+
linearY: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateY),
|
|
22019
|
+
linearZ: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateZ)
|
|
22016
22020
|
};
|
|
22021
|
+
deleteEmptyValue(positionOverLifetime);
|
|
22022
|
+
ret.positionOverLifetime = positionOverLifetime;
|
|
22017
22023
|
}
|
|
22018
|
-
|
|
22019
|
-
|
|
22020
|
-
|
|
22021
|
-
|
|
22022
|
-
|
|
22023
|
-
|
|
22024
|
-
|
|
22024
|
+
var rol = model.rotationOverLifetime;
|
|
22025
|
+
if (rol) {
|
|
22026
|
+
var rotationOverLifetime = {
|
|
22027
|
+
separateAxes: rol.separateAxes,
|
|
22028
|
+
x: ensureFixedNumber(rol == null ? void 0 : rol.rotateX),
|
|
22029
|
+
y: ensureFixedNumber(rol == null ? void 0 : rol.rotateY),
|
|
22030
|
+
z: rol.separateAxes ? ensureFixedNumber(rol == null ? void 0 : rol.rotateZ) : ensureFixedNumber(rol.rotation)
|
|
22025
22031
|
};
|
|
22026
|
-
|
|
22027
|
-
|
|
22028
|
-
}
|
|
22029
|
-
|
|
22030
|
-
function getStandardNullContent(sprite, transform) {
|
|
22031
|
-
var _sprite_transform;
|
|
22032
|
-
var opt = sprite.options;
|
|
22033
|
-
var velocityOverLifetime = sprite.velocityOverLifetime || {};
|
|
22034
|
-
var positionOverLifetime = {
|
|
22035
|
-
path: ensureFixedVec3((_sprite_transform = sprite.transform) == null ? void 0 : _sprite_transform.path),
|
|
22036
|
-
gravity: opt.gravity,
|
|
22037
|
-
gravityOverLifetime: ensureFixedNumber(opt.gravityModifier),
|
|
22038
|
-
direction: opt.direction,
|
|
22039
|
-
startSpeed: opt.startSpeed,
|
|
22040
|
-
asMovement: velocityOverLifetime.asMovement,
|
|
22041
|
-
linearX: ensureFixedNumber(velocityOverLifetime.linearX),
|
|
22042
|
-
linearY: ensureFixedNumber(velocityOverLifetime.linearY),
|
|
22043
|
-
linearZ: ensureFixedNumber(velocityOverLifetime.linearZ),
|
|
22044
|
-
asRotation: velocityOverLifetime.asRotation,
|
|
22045
|
-
orbCenter: velocityOverLifetime.orbCenter,
|
|
22046
|
-
orbitalX: ensureFixedNumber(velocityOverLifetime.orbitalX),
|
|
22047
|
-
orbitalY: ensureFixedNumber(velocityOverLifetime.orbitalY),
|
|
22048
|
-
orbitalZ: ensureFixedNumber(velocityOverLifetime.orbitalZ),
|
|
22049
|
-
speedOverLifetime: ensureFixedNumber(velocityOverLifetime.speedOverLifetime)
|
|
22050
|
-
};
|
|
22051
|
-
deleteEmptyValue(positionOverLifetime);
|
|
22052
|
-
var ret = {
|
|
22053
|
-
options: {
|
|
22054
|
-
startColor: ensureRGBAValue(opt.startColor)
|
|
22055
|
-
},
|
|
22056
|
-
positionOverLifetime: positionOverLifetime
|
|
22057
|
-
};
|
|
22058
|
-
if (opt.startSize) {
|
|
22059
|
-
transform.scale = [
|
|
22060
|
-
opt.startSize,
|
|
22061
|
-
opt.startSize / (opt.sizeAspect || 1),
|
|
22062
|
-
1
|
|
22063
|
-
];
|
|
22064
|
-
}
|
|
22065
|
-
if (opt.startRotation) {
|
|
22066
|
-
if (!transform.rotation) {
|
|
22067
|
-
transform.rotation = [
|
|
22068
|
-
0,
|
|
22069
|
-
0,
|
|
22070
|
-
opt.startRotation
|
|
22071
|
-
];
|
|
22072
|
-
} else {
|
|
22073
|
-
transform.rotation[2] += opt.startRotation;
|
|
22074
|
-
}
|
|
22075
|
-
}
|
|
22076
|
-
var rotationOverLifetime = sprite.rotationOverLifetime;
|
|
22077
|
-
if (rotationOverLifetime) {
|
|
22078
|
-
var rot = ret.rotationOverLifetime = {
|
|
22079
|
-
separateAxes: rotationOverLifetime.separateAxes,
|
|
22080
|
-
asRotation: rotationOverLifetime.asRotation
|
|
22081
|
-
};
|
|
22082
|
-
if (rot.separateAxes) {
|
|
22083
|
-
rot.x = ensureFixedNumber(rotationOverLifetime.x);
|
|
22084
|
-
rot.y = ensureFixedNumber(rotationOverLifetime.y);
|
|
22085
|
-
rot.z = ensureFixedNumber(rotationOverLifetime.z);
|
|
22086
|
-
} else {
|
|
22087
|
-
rot.z = ensureFixedNumber(rotationOverLifetime.angularVelocity);
|
|
22088
|
-
}
|
|
22089
|
-
}
|
|
22090
|
-
var colorOverLifetime = sprite.colorOverLifetime;
|
|
22091
|
-
if (colorOverLifetime) {
|
|
22092
|
-
var col = ret.colorOverLifetime = {
|
|
22093
|
-
opacity: ensureFixedNumber(colorOverLifetime.opacity)
|
|
22094
|
-
};
|
|
22095
|
-
if (colorOverLifetime.color) {
|
|
22096
|
-
col.color = getGradientColor(colorOverLifetime.color);
|
|
22097
|
-
}
|
|
22098
|
-
}
|
|
22099
|
-
var sizeOverLifetime = sprite.sizeOverLifetime;
|
|
22100
|
-
if (sizeOverLifetime) {
|
|
22101
|
-
ret.sizeOverLifetime = {
|
|
22102
|
-
separateAxes: sizeOverLifetime.separateAxes,
|
|
22103
|
-
size: ensureFixedNumber(sizeOverLifetime.size),
|
|
22104
|
-
x: ensureFixedNumber(sizeOverLifetime.x),
|
|
22105
|
-
y: ensureFixedNumber(sizeOverLifetime.y),
|
|
22106
|
-
z: ensureFixedNumber(sizeOverLifetime.z)
|
|
22107
|
-
};
|
|
22108
|
-
}
|
|
22109
|
-
return ret;
|
|
22110
|
-
}
|
|
22111
|
-
function getStandardSpriteContent(sprite, transform) {
|
|
22112
|
-
var ret = getStandardNullContent(sprite, transform);
|
|
22113
|
-
var texAni = sprite.textureSheetAnimation;
|
|
22114
|
-
if (texAni) {
|
|
22115
|
-
ret.textureSheetAnimation = {
|
|
22116
|
-
row: texAni.row,
|
|
22117
|
-
col: texAni.col,
|
|
22118
|
-
total: texAni.total || undefined,
|
|
22119
|
-
animate: texAni.animate
|
|
22120
|
-
};
|
|
22121
|
-
}
|
|
22122
|
-
ret.renderer = sprite.renderer;
|
|
22123
|
-
if (sprite.splits) {
|
|
22124
|
-
ret.splits = sprite.splits;
|
|
22125
|
-
}
|
|
22126
|
-
if (sprite.interaction) {
|
|
22127
|
-
ret.interaction = sprite.interaction;
|
|
22032
|
+
deleteEmptyValue(rotationOverLifetime);
|
|
22033
|
+
ret.rotationOverLifetime = rotationOverLifetime;
|
|
22128
22034
|
}
|
|
22129
22035
|
return ret;
|
|
22130
22036
|
}
|
|
@@ -22169,43 +22075,6 @@ function getStandardInteractContent(ui) {
|
|
|
22169
22075
|
return ret;
|
|
22170
22076
|
}
|
|
22171
22077
|
|
|
22172
|
-
function getStandardCameraContent(model) {
|
|
22173
|
-
var _model_transform;
|
|
22174
|
-
var opt = model.options;
|
|
22175
|
-
var ret = {
|
|
22176
|
-
options: {
|
|
22177
|
-
fov: opt.fov,
|
|
22178
|
-
far: opt.far,
|
|
22179
|
-
near: opt.near,
|
|
22180
|
-
clipMode: opt.clipMode
|
|
22181
|
-
}
|
|
22182
|
-
};
|
|
22183
|
-
var velocityOverLifetime = model.velocityOverLifetime;
|
|
22184
|
-
if (velocityOverLifetime || ((_model_transform = model.transform) == null ? void 0 : _model_transform.path)) {
|
|
22185
|
-
var _model_transform1;
|
|
22186
|
-
var positionOverLifetime = {
|
|
22187
|
-
path: ensureFixedVec3((_model_transform1 = model.transform) == null ? void 0 : _model_transform1.path),
|
|
22188
|
-
linearX: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateX),
|
|
22189
|
-
linearY: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateY),
|
|
22190
|
-
linearZ: ensureFixedNumber(velocityOverLifetime == null ? void 0 : velocityOverLifetime.translateZ)
|
|
22191
|
-
};
|
|
22192
|
-
deleteEmptyValue(positionOverLifetime);
|
|
22193
|
-
ret.positionOverLifetime = positionOverLifetime;
|
|
22194
|
-
}
|
|
22195
|
-
var rol = model.rotationOverLifetime;
|
|
22196
|
-
if (rol) {
|
|
22197
|
-
var rotationOverLifetime = {
|
|
22198
|
-
separateAxes: rol.separateAxes,
|
|
22199
|
-
x: ensureFixedNumber(rol == null ? void 0 : rol.rotateX),
|
|
22200
|
-
y: ensureFixedNumber(rol == null ? void 0 : rol.rotateY),
|
|
22201
|
-
z: rol.separateAxes ? ensureFixedNumber(rol == null ? void 0 : rol.rotateZ) : ensureFixedNumber(rol.rotation)
|
|
22202
|
-
};
|
|
22203
|
-
deleteEmptyValue(rotationOverLifetime);
|
|
22204
|
-
ret.rotationOverLifetime = rotationOverLifetime;
|
|
22205
|
-
}
|
|
22206
|
-
return ret;
|
|
22207
|
-
}
|
|
22208
|
-
|
|
22209
22078
|
/**
|
|
22210
22079
|
* 2.1 以下版本数据适配(mars-player@2.4.0 及以上版本支持 2.1 以下数据的适配)
|
|
22211
22080
|
*/ function version21Migration(json) {
|
|
@@ -22322,11 +22191,12 @@ function getStandardCameraContent(model) {
|
|
|
22322
22191
|
var _textures;
|
|
22323
22192
|
(_textures = (_result = result).textures) != null ? _textures : _result.textures = [];
|
|
22324
22193
|
result.textures.forEach(function(textureOptions) {
|
|
22194
|
+
var _result_images_textureOptions_source;
|
|
22325
22195
|
textureOptions.id = generateGUID();
|
|
22326
22196
|
textureOptions.dataType = DataType.Texture;
|
|
22327
22197
|
// @ts-expect-error
|
|
22328
22198
|
textureOptions.source = {
|
|
22329
|
-
id: result.images[textureOptions.source].id
|
|
22199
|
+
id: (_result_images_textureOptions_source = result.images[textureOptions.source]) == null ? void 0 : _result_images_textureOptions_source.id
|
|
22330
22200
|
};
|
|
22331
22201
|
});
|
|
22332
22202
|
if (result.textures.length < result.images.length) {
|
|
@@ -22680,8 +22550,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22680
22550
|
var newSpriteColorPlayableAssetData = {
|
|
22681
22551
|
id: generateGUID(),
|
|
22682
22552
|
dataType: "SpriteColorPlayableAsset",
|
|
22683
|
-
colorOverLifetime: item.content.colorOverLifetime
|
|
22684
|
-
startColor: item.content.options.startColor
|
|
22553
|
+
colorOverLifetime: item.content.colorOverLifetime
|
|
22685
22554
|
};
|
|
22686
22555
|
playableAssetDatas.push(newSpriteColorPlayableAssetData);
|
|
22687
22556
|
var newTrackData1 = {
|
|
@@ -22730,83 +22599,358 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22730
22599
|
});
|
|
22731
22600
|
trackDatas.push(newTrackData2);
|
|
22732
22601
|
}
|
|
22733
|
-
var bindingTrackData = {
|
|
22734
|
-
id: generateGUID(),
|
|
22735
|
-
dataType: "ObjectBindingTrack",
|
|
22736
|
-
children: subTrackDatas,
|
|
22737
|
-
clips: []
|
|
22602
|
+
var bindingTrackData = {
|
|
22603
|
+
id: generateGUID(),
|
|
22604
|
+
dataType: "ObjectBindingTrack",
|
|
22605
|
+
children: subTrackDatas,
|
|
22606
|
+
clips: []
|
|
22607
|
+
};
|
|
22608
|
+
trackDatas.push(bindingTrackData);
|
|
22609
|
+
timelineAssetData.tracks.push({
|
|
22610
|
+
id: bindingTrackData.id
|
|
22611
|
+
});
|
|
22612
|
+
sceneBindings.push({
|
|
22613
|
+
key: {
|
|
22614
|
+
id: bindingTrackData.id
|
|
22615
|
+
},
|
|
22616
|
+
value: {
|
|
22617
|
+
id: item.id
|
|
22618
|
+
}
|
|
22619
|
+
});
|
|
22620
|
+
}
|
|
22621
|
+
var trackIds = [];
|
|
22622
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(trackDatas), _step1; !(_step1 = _iterator1()).done;){
|
|
22623
|
+
var trackData = _step1.value;
|
|
22624
|
+
trackIds.push({
|
|
22625
|
+
id: trackData.id
|
|
22626
|
+
});
|
|
22627
|
+
}
|
|
22628
|
+
composition.timelineAsset = {
|
|
22629
|
+
id: timelineAssetData.id
|
|
22630
|
+
};
|
|
22631
|
+
composition.sceneBindings = sceneBindings;
|
|
22632
|
+
jsonScene.miscs.push(timelineAssetData);
|
|
22633
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(trackDatas), _step2; !(_step2 = _iterator2()).done;){
|
|
22634
|
+
var trackData1 = _step2.value;
|
|
22635
|
+
//@ts-expect-error
|
|
22636
|
+
jsonScene.miscs.push(trackData1);
|
|
22637
|
+
}
|
|
22638
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(playableAssetDatas), _step3; !(_step3 = _iterator3()).done;){
|
|
22639
|
+
var playableAsset = _step3.value;
|
|
22640
|
+
//@ts-expect-error
|
|
22641
|
+
jsonScene.miscs.push(playableAsset);
|
|
22642
|
+
}
|
|
22643
|
+
}
|
|
22644
|
+
function convertBinaryAsset(bins, jsonScene) {
|
|
22645
|
+
//@ts-expect-error
|
|
22646
|
+
jsonScene.bins = bins.map(function(bin) {
|
|
22647
|
+
return {
|
|
22648
|
+
url: bin.url,
|
|
22649
|
+
"dataType": "BinaryAsset",
|
|
22650
|
+
id: generateGUID()
|
|
22651
|
+
};
|
|
22652
|
+
});
|
|
22653
|
+
}
|
|
22654
|
+
function convertSpineData(resource, content, jsonScene) {
|
|
22655
|
+
//@ts-expect-error
|
|
22656
|
+
content.resource = {
|
|
22657
|
+
"atlas": {
|
|
22658
|
+
"bins": {
|
|
22659
|
+
//@ts-expect-error
|
|
22660
|
+
"id": jsonScene.bins[resource.atlas[1][0]].id
|
|
22661
|
+
},
|
|
22662
|
+
"source": resource.atlas[1].slice(1)
|
|
22663
|
+
},
|
|
22664
|
+
"skeleton": {
|
|
22665
|
+
"bins": {
|
|
22666
|
+
//@ts-expect-error
|
|
22667
|
+
"id": jsonScene.bins[resource.skeleton[1][0]].id
|
|
22668
|
+
},
|
|
22669
|
+
"source": resource.skeleton[1].slice(1)
|
|
22670
|
+
},
|
|
22671
|
+
"skeletonType": resource.skeletonType,
|
|
22672
|
+
"images": resource.images.map(function(i) {
|
|
22673
|
+
return {
|
|
22674
|
+
//@ts-expect-error
|
|
22675
|
+
id: jsonScene.textures[i].id
|
|
22676
|
+
};
|
|
22677
|
+
})
|
|
22678
|
+
};
|
|
22679
|
+
}
|
|
22680
|
+
|
|
22681
|
+
function getStandardParticleContent(particle) {
|
|
22682
|
+
var options = particle.options;
|
|
22683
|
+
var transform = particle.transform;
|
|
22684
|
+
var shape = {
|
|
22685
|
+
type: ShapeType.NONE
|
|
22686
|
+
};
|
|
22687
|
+
if (particle.shape) {
|
|
22688
|
+
var _particle_shape_shape;
|
|
22689
|
+
var shapeType = (_particle_shape_shape = particle.shape.shape) == null ? void 0 : _particle_shape_shape.replace(/([A-Z])/g, "_$1").toUpperCase().replace(/^_/, "");
|
|
22690
|
+
shape = _extends({}, particle.shape, {
|
|
22691
|
+
type: ShapeType[shapeType]
|
|
22692
|
+
});
|
|
22693
|
+
if (particle.shape.upDirection) {
|
|
22694
|
+
var _particle_shape_upDirection = particle.shape.upDirection, x = _particle_shape_upDirection[0], y = _particle_shape_upDirection[1], z = _particle_shape_upDirection[2];
|
|
22695
|
+
if (x === 0 && y === 0 && z === 0) {
|
|
22696
|
+
delete shape.upDirection;
|
|
22697
|
+
}
|
|
22698
|
+
}
|
|
22699
|
+
}
|
|
22700
|
+
if (options.startTurbulence) {
|
|
22701
|
+
shape.turbulenceX = ensureNumberExpression(options.turbulenceX);
|
|
22702
|
+
shape.turbulenceY = ensureNumberExpression(options.turbulenceY);
|
|
22703
|
+
shape.turbulenceZ = ensureNumberExpression(options.turbulenceZ);
|
|
22704
|
+
}
|
|
22705
|
+
var emission = particle.emission;
|
|
22706
|
+
if (emission.bursts && emission.bursts.length > 0) {
|
|
22707
|
+
emission.bursts = emission.bursts.map(function(b) {
|
|
22708
|
+
return objectValueToNumber(b);
|
|
22709
|
+
});
|
|
22710
|
+
}
|
|
22711
|
+
if (emission.burstOffsets && emission.burstOffsets.length > 0) {
|
|
22712
|
+
emission.burstOffsets = emission.burstOffsets.map(function(b) {
|
|
22713
|
+
return objectValueToNumber(b);
|
|
22714
|
+
});
|
|
22715
|
+
}
|
|
22716
|
+
if (emission.rateOverTime) {
|
|
22717
|
+
emission.rateOverTime = ensureNumberExpression(emission.rateOverTime);
|
|
22718
|
+
}
|
|
22719
|
+
var ret = {
|
|
22720
|
+
renderer: particle.renderer,
|
|
22721
|
+
shape: shape,
|
|
22722
|
+
splits: particle.splits,
|
|
22723
|
+
emission: emission,
|
|
22724
|
+
options: {
|
|
22725
|
+
startLifetime: ensureNumberExpression(options.startLifetime),
|
|
22726
|
+
start3DSize: !!options.start3DSize,
|
|
22727
|
+
startSize: ensureNumberExpression(options.startSize),
|
|
22728
|
+
startSizeX: ensureNumberExpression(options.startSizeX),
|
|
22729
|
+
startSizeY: ensureNumberExpression(options.startSizeY),
|
|
22730
|
+
sizeAspect: ensureNumberExpression(options.sizeAspect),
|
|
22731
|
+
maxCount: options.maxCount,
|
|
22732
|
+
startDelay: ensureNumberExpression(options.startDelay),
|
|
22733
|
+
startColor: ensureColorExpression(options.startColor, true),
|
|
22734
|
+
startRotationZ: ensureNumberExpression(options.startRotation || options.startRotationZ),
|
|
22735
|
+
particleFollowParent: options.particleFollowParent
|
|
22736
|
+
}
|
|
22737
|
+
};
|
|
22738
|
+
if (options.start3DRotation) {
|
|
22739
|
+
ret.options.startRotationX = ensureNumberExpression(options.startRotationX);
|
|
22740
|
+
ret.options.startRotationY = ensureNumberExpression(options.startRotationY);
|
|
22741
|
+
}
|
|
22742
|
+
if (transform && transform.path) {
|
|
22743
|
+
ret.emitterTransform = {
|
|
22744
|
+
path: ensureFixedVec3(transform.path)
|
|
22745
|
+
};
|
|
22746
|
+
}
|
|
22747
|
+
var sizeOverLifetime = particle.sizeOverLifetime;
|
|
22748
|
+
if (sizeOverLifetime) {
|
|
22749
|
+
if (sizeOverLifetime.separateAxes) {
|
|
22750
|
+
ret.sizeOverLifetime = {
|
|
22751
|
+
separateAxes: true,
|
|
22752
|
+
x: ensureNumberExpression(sizeOverLifetime.x),
|
|
22753
|
+
y: ensureNumberExpression(sizeOverLifetime.y)
|
|
22754
|
+
};
|
|
22755
|
+
} else {
|
|
22756
|
+
ret.sizeOverLifetime = {
|
|
22757
|
+
size: ensureNumberExpression(sizeOverLifetime.size)
|
|
22758
|
+
};
|
|
22759
|
+
}
|
|
22760
|
+
}
|
|
22761
|
+
var velocityOverLifetime = particle.velocityOverLifetime || {};
|
|
22762
|
+
var sol = velocityOverLifetime.speedOverLifetime;
|
|
22763
|
+
if (sol) {
|
|
22764
|
+
sol = ensureFixedNumber(sol);
|
|
22765
|
+
} else {
|
|
22766
|
+
sol = undefined;
|
|
22767
|
+
}
|
|
22768
|
+
ret.positionOverLifetime = {
|
|
22769
|
+
gravity: options.gravity,
|
|
22770
|
+
gravityOverLifetime: ensureFixedNumber(options.gravityModifier),
|
|
22771
|
+
startSpeed: ensureNumberExpression(options.startSpeed),
|
|
22772
|
+
speedOverLifetime: sol,
|
|
22773
|
+
asMovement: velocityOverLifetime.asMovement,
|
|
22774
|
+
linearX: ensureNumberExpression(velocityOverLifetime.linearX),
|
|
22775
|
+
linearY: ensureNumberExpression(velocityOverLifetime.linearY),
|
|
22776
|
+
linearZ: ensureNumberExpression(velocityOverLifetime.linearZ),
|
|
22777
|
+
asRotation: velocityOverLifetime.asRotation,
|
|
22778
|
+
orbCenter: velocityOverLifetime.orbCenter,
|
|
22779
|
+
orbitalX: ensureNumberExpression(velocityOverLifetime.orbitalX),
|
|
22780
|
+
orbitalY: ensureNumberExpression(velocityOverLifetime.orbitalY),
|
|
22781
|
+
orbitalZ: ensureNumberExpression(velocityOverLifetime.orbitalZ),
|
|
22782
|
+
forceTarget: velocityOverLifetime.forceTarget,
|
|
22783
|
+
target: velocityOverLifetime.target,
|
|
22784
|
+
forceCurve: ensureFixedNumber(velocityOverLifetime.forceCurve)
|
|
22785
|
+
};
|
|
22786
|
+
deleteEmptyValue(ret.positionOverLifetime);
|
|
22787
|
+
var rotationOverLifetime = particle.rotationOverLifetime;
|
|
22788
|
+
if (rotationOverLifetime) {
|
|
22789
|
+
ret.rotationOverLifetime = {
|
|
22790
|
+
separateAxes: rotationOverLifetime.separateAxes,
|
|
22791
|
+
asRotation: rotationOverLifetime.asRotation,
|
|
22792
|
+
z: ensureNumberExpression(rotationOverLifetime.separateAxes ? rotationOverLifetime.z : rotationOverLifetime.angularVelocity)
|
|
22793
|
+
};
|
|
22794
|
+
if (rotationOverLifetime.separateAxes) {
|
|
22795
|
+
ret.rotationOverLifetime.y = ensureFixedNumber(rotationOverLifetime.y);
|
|
22796
|
+
ret.rotationOverLifetime.x = ensureFixedNumber(rotationOverLifetime.x);
|
|
22797
|
+
}
|
|
22798
|
+
}
|
|
22799
|
+
var colorOverLifetime = particle.colorOverLifetime;
|
|
22800
|
+
if (colorOverLifetime) {
|
|
22801
|
+
var col = ret.colorOverLifetime = {
|
|
22802
|
+
opacity: ensureFixedNumber(colorOverLifetime.opacity)
|
|
22803
|
+
};
|
|
22804
|
+
if (colorOverLifetime.color) {
|
|
22805
|
+
col.color = getGradientColor(colorOverLifetime.color);
|
|
22806
|
+
}
|
|
22807
|
+
}
|
|
22808
|
+
var textureSheetAnimation = particle.textureSheetAnimation;
|
|
22809
|
+
if (textureSheetAnimation) {
|
|
22810
|
+
ret.textureSheetAnimation = {
|
|
22811
|
+
row: textureSheetAnimation.row,
|
|
22812
|
+
col: textureSheetAnimation.col,
|
|
22813
|
+
total: textureSheetAnimation.total,
|
|
22814
|
+
animate: textureSheetAnimation.animate,
|
|
22815
|
+
cycles: ensureFixedNumber(textureSheetAnimation.cycles),
|
|
22816
|
+
animationDelay: ensureFixedNumberWithRandom(textureSheetAnimation.animationDelay, 0),
|
|
22817
|
+
animationDuration: ensureFixedNumberWithRandom(textureSheetAnimation.animationDuration, 0)
|
|
22738
22818
|
};
|
|
22739
|
-
trackDatas.push(bindingTrackData);
|
|
22740
|
-
timelineAssetData.tracks.push({
|
|
22741
|
-
id: bindingTrackData.id
|
|
22742
|
-
});
|
|
22743
|
-
sceneBindings.push({
|
|
22744
|
-
key: {
|
|
22745
|
-
id: bindingTrackData.id
|
|
22746
|
-
},
|
|
22747
|
-
value: {
|
|
22748
|
-
id: item.id
|
|
22749
|
-
}
|
|
22750
|
-
});
|
|
22751
22819
|
}
|
|
22752
|
-
var
|
|
22753
|
-
|
|
22754
|
-
|
|
22755
|
-
|
|
22756
|
-
|
|
22757
|
-
|
|
22820
|
+
var trials = particle.trails;
|
|
22821
|
+
if (trials) {
|
|
22822
|
+
ret.trails = {
|
|
22823
|
+
lifetime: ensureNumberExpression(trials.lifetime),
|
|
22824
|
+
dieWithParticles: trials.dieWithParticles,
|
|
22825
|
+
maxPointPerTrail: trials.maxPointPerTrail,
|
|
22826
|
+
minimumVertexDistance: trials.minimumVertexDistance,
|
|
22827
|
+
widthOverTrail: ensureFixedNumber(trials.widthOverTrail),
|
|
22828
|
+
colorOverTrail: trials.colorOverTrail && getGradientColor(trials.colorOverTrail, false),
|
|
22829
|
+
blending: trials.blending,
|
|
22830
|
+
colorOverLifetime: trials.colorOverLifetime && getGradientColor(trials.colorOverLifetime, false),
|
|
22831
|
+
inheritParticleColor: trials.inheritParticleColor,
|
|
22832
|
+
occlusion: trials.occlusion,
|
|
22833
|
+
transparentOcclusion: trials.transparentOcclusion,
|
|
22834
|
+
orderOffset: trials.orderOffset,
|
|
22835
|
+
sizeAffectsLifetime: trials.sizeAffectsLifetime,
|
|
22836
|
+
sizeAffectsWidth: trials.sizeAffectsWidth,
|
|
22837
|
+
texture: trials.texture,
|
|
22838
|
+
parentAffectsPosition: trials.parentAffectsPosition,
|
|
22839
|
+
opacityOverLifetime: ensureNumberExpression(trials.opacityOverLifetime)
|
|
22840
|
+
};
|
|
22758
22841
|
}
|
|
22759
|
-
|
|
22760
|
-
|
|
22842
|
+
ret.trails && deleteEmptyValue(ret.trails);
|
|
22843
|
+
var interaction = particle.interaction;
|
|
22844
|
+
if (interaction) {
|
|
22845
|
+
ret.interaction = {
|
|
22846
|
+
behavior: interaction.behavior,
|
|
22847
|
+
radius: interaction.radius,
|
|
22848
|
+
multiple: interaction.multiple
|
|
22849
|
+
};
|
|
22850
|
+
}
|
|
22851
|
+
return ret;
|
|
22852
|
+
}
|
|
22853
|
+
|
|
22854
|
+
function getStandardNullContent(sprite, transform) {
|
|
22855
|
+
var _sprite_transform;
|
|
22856
|
+
var opt = sprite.options;
|
|
22857
|
+
var velocityOverLifetime = sprite.velocityOverLifetime || {};
|
|
22858
|
+
var positionOverLifetime = {
|
|
22859
|
+
path: ensureFixedVec3((_sprite_transform = sprite.transform) == null ? void 0 : _sprite_transform.path),
|
|
22860
|
+
gravity: opt.gravity,
|
|
22861
|
+
gravityOverLifetime: ensureFixedNumber(opt.gravityModifier),
|
|
22862
|
+
direction: opt.direction,
|
|
22863
|
+
startSpeed: opt.startSpeed,
|
|
22864
|
+
asMovement: velocityOverLifetime.asMovement,
|
|
22865
|
+
linearX: ensureFixedNumber(velocityOverLifetime.linearX),
|
|
22866
|
+
linearY: ensureFixedNumber(velocityOverLifetime.linearY),
|
|
22867
|
+
linearZ: ensureFixedNumber(velocityOverLifetime.linearZ),
|
|
22868
|
+
asRotation: velocityOverLifetime.asRotation,
|
|
22869
|
+
orbCenter: velocityOverLifetime.orbCenter,
|
|
22870
|
+
orbitalX: ensureFixedNumber(velocityOverLifetime.orbitalX),
|
|
22871
|
+
orbitalY: ensureFixedNumber(velocityOverLifetime.orbitalY),
|
|
22872
|
+
orbitalZ: ensureFixedNumber(velocityOverLifetime.orbitalZ),
|
|
22873
|
+
speedOverLifetime: ensureFixedNumber(velocityOverLifetime.speedOverLifetime)
|
|
22761
22874
|
};
|
|
22762
|
-
|
|
22763
|
-
|
|
22764
|
-
|
|
22765
|
-
|
|
22766
|
-
|
|
22767
|
-
|
|
22875
|
+
deleteEmptyValue(positionOverLifetime);
|
|
22876
|
+
var ret = {
|
|
22877
|
+
options: {
|
|
22878
|
+
startColor: ensureRGBAValue(opt.startColor)
|
|
22879
|
+
},
|
|
22880
|
+
positionOverLifetime: positionOverLifetime
|
|
22881
|
+
};
|
|
22882
|
+
if (opt.startSize) {
|
|
22883
|
+
transform.scale = [
|
|
22884
|
+
opt.startSize,
|
|
22885
|
+
opt.startSize / (opt.sizeAspect || 1),
|
|
22886
|
+
1
|
|
22887
|
+
];
|
|
22768
22888
|
}
|
|
22769
|
-
|
|
22770
|
-
|
|
22771
|
-
|
|
22772
|
-
|
|
22889
|
+
if (opt.startRotation) {
|
|
22890
|
+
if (!transform.rotation) {
|
|
22891
|
+
transform.rotation = [
|
|
22892
|
+
0,
|
|
22893
|
+
0,
|
|
22894
|
+
opt.startRotation
|
|
22895
|
+
];
|
|
22896
|
+
} else {
|
|
22897
|
+
transform.rotation[2] += opt.startRotation;
|
|
22898
|
+
}
|
|
22773
22899
|
}
|
|
22774
|
-
|
|
22775
|
-
|
|
22776
|
-
|
|
22777
|
-
|
|
22778
|
-
|
|
22779
|
-
url: bin.url,
|
|
22780
|
-
"dataType": "BinaryAsset",
|
|
22781
|
-
id: generateGUID()
|
|
22900
|
+
var rotationOverLifetime = sprite.rotationOverLifetime;
|
|
22901
|
+
if (rotationOverLifetime) {
|
|
22902
|
+
var rot = ret.rotationOverLifetime = {
|
|
22903
|
+
separateAxes: rotationOverLifetime.separateAxes,
|
|
22904
|
+
asRotation: rotationOverLifetime.asRotation
|
|
22782
22905
|
};
|
|
22783
|
-
|
|
22906
|
+
if (rot.separateAxes) {
|
|
22907
|
+
rot.x = ensureFixedNumber(rotationOverLifetime.x);
|
|
22908
|
+
rot.y = ensureFixedNumber(rotationOverLifetime.y);
|
|
22909
|
+
rot.z = ensureFixedNumber(rotationOverLifetime.z);
|
|
22910
|
+
} else {
|
|
22911
|
+
rot.z = ensureFixedNumber(rotationOverLifetime.angularVelocity);
|
|
22912
|
+
}
|
|
22913
|
+
}
|
|
22914
|
+
var colorOverLifetime = sprite.colorOverLifetime;
|
|
22915
|
+
if (colorOverLifetime) {
|
|
22916
|
+
var col = ret.colorOverLifetime = {
|
|
22917
|
+
opacity: ensureFixedNumber(colorOverLifetime.opacity)
|
|
22918
|
+
};
|
|
22919
|
+
if (colorOverLifetime.color) {
|
|
22920
|
+
col.color = getGradientColor(colorOverLifetime.color);
|
|
22921
|
+
}
|
|
22922
|
+
}
|
|
22923
|
+
var sizeOverLifetime = sprite.sizeOverLifetime;
|
|
22924
|
+
if (sizeOverLifetime) {
|
|
22925
|
+
ret.sizeOverLifetime = {
|
|
22926
|
+
separateAxes: sizeOverLifetime.separateAxes,
|
|
22927
|
+
size: ensureFixedNumber(sizeOverLifetime.size),
|
|
22928
|
+
x: ensureFixedNumber(sizeOverLifetime.x),
|
|
22929
|
+
y: ensureFixedNumber(sizeOverLifetime.y),
|
|
22930
|
+
z: ensureFixedNumber(sizeOverLifetime.z)
|
|
22931
|
+
};
|
|
22932
|
+
}
|
|
22933
|
+
return ret;
|
|
22784
22934
|
}
|
|
22785
|
-
function
|
|
22786
|
-
|
|
22787
|
-
|
|
22788
|
-
|
|
22789
|
-
|
|
22790
|
-
|
|
22791
|
-
|
|
22792
|
-
|
|
22793
|
-
|
|
22794
|
-
}
|
|
22795
|
-
|
|
22796
|
-
|
|
22797
|
-
|
|
22798
|
-
|
|
22799
|
-
|
|
22800
|
-
|
|
22801
|
-
|
|
22802
|
-
|
|
22803
|
-
|
|
22804
|
-
return {
|
|
22805
|
-
//@ts-expect-error
|
|
22806
|
-
id: jsonScene.textures[i].id
|
|
22807
|
-
};
|
|
22808
|
-
})
|
|
22809
|
-
};
|
|
22935
|
+
function getStandardSpriteContent(sprite, transform) {
|
|
22936
|
+
var ret = getStandardNullContent(sprite, transform);
|
|
22937
|
+
var texAni = sprite.textureSheetAnimation;
|
|
22938
|
+
if (texAni) {
|
|
22939
|
+
ret.textureSheetAnimation = {
|
|
22940
|
+
row: texAni.row,
|
|
22941
|
+
col: texAni.col,
|
|
22942
|
+
total: texAni.total || undefined,
|
|
22943
|
+
animate: texAni.animate
|
|
22944
|
+
};
|
|
22945
|
+
}
|
|
22946
|
+
ret.renderer = sprite.renderer;
|
|
22947
|
+
if (sprite.splits) {
|
|
22948
|
+
ret.splits = sprite.splits;
|
|
22949
|
+
}
|
|
22950
|
+
if (sprite.interaction) {
|
|
22951
|
+
ret.interaction = sprite.interaction;
|
|
22952
|
+
}
|
|
22953
|
+
return ret;
|
|
22810
22954
|
}
|
|
22811
22955
|
|
|
22812
22956
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
@@ -23188,7 +23332,7 @@ function getBackgroundImage(template, variables) {
|
|
|
23188
23332
|
}
|
|
23189
23333
|
function _combineImageTemplate() {
|
|
23190
23334
|
_combineImageTemplate = _async_to_generator(function(url, template, variables) {
|
|
23191
|
-
var image,
|
|
23335
|
+
var image, templateBackground;
|
|
23192
23336
|
return __generator(this, function(_state) {
|
|
23193
23337
|
switch(_state.label){
|
|
23194
23338
|
case 0:
|
|
@@ -23219,37 +23363,25 @@ function _combineImageTemplate() {
|
|
|
23219
23363
|
image
|
|
23220
23364
|
];
|
|
23221
23365
|
}
|
|
23222
|
-
drawImage = image;
|
|
23223
23366
|
// 获取动态换图的图片对象或 url 地址
|
|
23224
23367
|
templateBackground = getBackgroundImage(template, variables);
|
|
23225
|
-
if (
|
|
23226
|
-
|
|
23227
|
-
|
|
23228
|
-
|
|
23229
|
-
|
|
23230
|
-
|
|
23231
|
-
|
|
23232
|
-
|
|
23233
|
-
|
|
23234
|
-
|
|
23235
|
-
|
|
23236
|
-
|
|
23237
|
-
|
|
23238
|
-
|
|
23239
|
-
return [
|
|
23240
|
-
3,
|
|
23241
|
-
6
|
|
23242
|
-
];
|
|
23243
|
-
case 5:
|
|
23244
|
-
_tmp = templateBackground;
|
|
23245
|
-
_state.label = 6;
|
|
23246
|
-
case 6:
|
|
23247
|
-
drawImage = _tmp;
|
|
23248
|
-
_state.label = 7;
|
|
23249
|
-
case 7:
|
|
23368
|
+
if (templateBackground) {
|
|
23369
|
+
if (isString(templateBackground) && templateBackground !== image.src) {
|
|
23370
|
+
return [
|
|
23371
|
+
2,
|
|
23372
|
+
loadImage(templateBackground)
|
|
23373
|
+
];
|
|
23374
|
+
}
|
|
23375
|
+
if (_instanceof1(templateBackground, HTMLImageElement)) {
|
|
23376
|
+
return [
|
|
23377
|
+
2,
|
|
23378
|
+
templateBackground
|
|
23379
|
+
];
|
|
23380
|
+
}
|
|
23381
|
+
}
|
|
23250
23382
|
return [
|
|
23251
23383
|
2,
|
|
23252
|
-
|
|
23384
|
+
image
|
|
23253
23385
|
];
|
|
23254
23386
|
}
|
|
23255
23387
|
});
|
|
@@ -23583,14 +23715,6 @@ var seed = 1;
|
|
|
23583
23715
|
case 0:
|
|
23584
23716
|
// TODO: 后面切换到新的数据版本,就不用掉用 getStandardJSON 做转换了
|
|
23585
23717
|
jsonScene = getStandardJSON(json);
|
|
23586
|
-
// FIXME: hack globalVolume,specification 更新后需移除
|
|
23587
|
-
// @ts-expect-error
|
|
23588
|
-
json.compositions.forEach(function(composition, i) {
|
|
23589
|
-
if (composition.globalVolume) {
|
|
23590
|
-
// @ts-expect-error
|
|
23591
|
-
jsonScene.compositions[i].globalVolume = composition.globalVolume;
|
|
23592
|
-
}
|
|
23593
|
-
});
|
|
23594
23718
|
_jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins, sceneCompositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, images = jsonScene.images;
|
|
23595
23719
|
pluginSystem = new PluginSystem(plugins);
|
|
23596
23720
|
return [
|
|
@@ -23721,15 +23845,17 @@ var seed = 1;
|
|
|
23721
23845
|
_this_options = _this.options, useCompressedTexture = _this_options.useCompressedTexture, variables = _this_options.variables;
|
|
23722
23846
|
baseUrl = _this.baseUrl;
|
|
23723
23847
|
jobs = images.map(/*#__PURE__*/ _async_to_generator(function(img, idx) {
|
|
23724
|
-
var png, webp, imageURL, webpURL, template, background, url, isVideo, loadFn, resultImage, e, compressed, src, bufferURL, _ref, url1, image;
|
|
23848
|
+
var png, webp, avif, imageURL, webpURL, avifURL, template, background, url, isVideo, loadFn, resultImage, e, compressed, src, bufferURL, _ref, url1, image, _tmp;
|
|
23725
23849
|
return __generator(this, function(_state) {
|
|
23726
23850
|
switch(_state.label){
|
|
23727
23851
|
case 0:
|
|
23728
|
-
png = img.url, webp = img.webp;
|
|
23852
|
+
png = img.url, webp = img.webp, avif = img.avif;
|
|
23729
23853
|
// eslint-disable-next-line compat/compat
|
|
23730
23854
|
imageURL = new URL(png, baseUrl).href;
|
|
23731
23855
|
// eslint-disable-next-line compat/compat
|
|
23732
23856
|
webpURL = webp && new URL(webp, baseUrl).href;
|
|
23857
|
+
// eslint-disable-next-line compat/compat
|
|
23858
|
+
avifURL = avif && new URL(avif, baseUrl).href;
|
|
23733
23859
|
if (!("template" in img)) return [
|
|
23734
23860
|
3,
|
|
23735
23861
|
8
|
|
@@ -23829,12 +23955,30 @@ var seed = 1;
|
|
|
23829
23955
|
}
|
|
23830
23956
|
_state.label = 9;
|
|
23831
23957
|
case 9:
|
|
23958
|
+
if (!avifURL) return [
|
|
23959
|
+
3,
|
|
23960
|
+
11
|
|
23961
|
+
];
|
|
23832
23962
|
return [
|
|
23833
23963
|
4,
|
|
23834
|
-
|
|
23964
|
+
loadAVIFOptional(imageURL, avifURL)
|
|
23835
23965
|
];
|
|
23836
23966
|
case 10:
|
|
23837
|
-
|
|
23967
|
+
_tmp = _state.sent();
|
|
23968
|
+
return [
|
|
23969
|
+
3,
|
|
23970
|
+
13
|
|
23971
|
+
];
|
|
23972
|
+
case 11:
|
|
23973
|
+
return [
|
|
23974
|
+
4,
|
|
23975
|
+
loadWebPOptional(imageURL, webpURL)
|
|
23976
|
+
];
|
|
23977
|
+
case 12:
|
|
23978
|
+
_tmp = _state.sent();
|
|
23979
|
+
_state.label = 13;
|
|
23980
|
+
case 13:
|
|
23981
|
+
_ref = _tmp, url1 = _ref.url, image = _ref.image;
|
|
23838
23982
|
_this.assets[idx] = {
|
|
23839
23983
|
url: url1,
|
|
23840
23984
|
type: exports.TextureSourceType.image
|
|
@@ -24378,9 +24522,7 @@ var listOrder = 0;
|
|
|
24378
24522
|
}
|
|
24379
24523
|
var _proto = CompositionSourceManager.prototype;
|
|
24380
24524
|
_proto.getContent = function getContent(composition) {
|
|
24381
|
-
|
|
24382
|
-
// @ts-expect-error
|
|
24383
|
-
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;
|
|
24525
|
+
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;
|
|
24384
24526
|
var items = this.assembleItems(composition);
|
|
24385
24527
|
return _extends({}, composition, {
|
|
24386
24528
|
id: id,
|
|
@@ -24390,8 +24532,7 @@ var listOrder = 0;
|
|
|
24390
24532
|
// looping,
|
|
24391
24533
|
items: items,
|
|
24392
24534
|
camera: camera,
|
|
24393
|
-
startTime: startTime
|
|
24394
|
-
globalVolume: globalVolume
|
|
24535
|
+
startTime: startTime
|
|
24395
24536
|
});
|
|
24396
24537
|
};
|
|
24397
24538
|
_proto.assembleItems = function assembleItems(composition) {
|
|
@@ -24553,7 +24694,6 @@ var listOrder = 0;
|
|
|
24553
24694
|
this.rootComposition = this.rootItem.addComponent(CompositionComponent);
|
|
24554
24695
|
this.rootComposition.data = sourceContent;
|
|
24555
24696
|
var imageUsage = !reusable && imgUsage;
|
|
24556
|
-
this.globalVolume = sourceContent.globalVolume;
|
|
24557
24697
|
this.width = width;
|
|
24558
24698
|
this.height = height;
|
|
24559
24699
|
this.renderOrder = baseRenderOrder;
|
|
@@ -26758,7 +26898,10 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
26758
26898
|
return FBGeometryDataT;
|
|
26759
26899
|
}();
|
|
26760
26900
|
|
|
26761
|
-
|
|
26901
|
+
/**
|
|
26902
|
+
* @since 2.0.0
|
|
26903
|
+
* @internal
|
|
26904
|
+
*/ var EffectsPackage = /*#__PURE__*/ function() {
|
|
26762
26905
|
function EffectsPackage() {
|
|
26763
26906
|
this.exportObjectDatas = [];
|
|
26764
26907
|
}
|
|
@@ -26783,8 +26926,7 @@ var EffectsPackage = /*#__PURE__*/ function() {
|
|
|
26783
26926
|
}
|
|
26784
26927
|
effectsPackage.exportObjects = exportObjects;
|
|
26785
26928
|
FBEffectsPackageData.finishFBEffectsPackageDataBuffer(fbb, effectsPackage.pack(fbb));
|
|
26786
|
-
|
|
26787
|
-
return buffer;
|
|
26929
|
+
return fbb.asUint8Array(); // Of type `Uint8Array`.
|
|
26788
26930
|
};
|
|
26789
26931
|
_proto.deserializeFromBinary = function deserializeFromBinary(buffer) {
|
|
26790
26932
|
var buf = new ByteBuffer(buffer);
|
|
@@ -26812,37 +26954,35 @@ var EffectsPackage = /*#__PURE__*/ function() {
|
|
|
26812
26954
|
_proto.geometryDataToBinary = function geometryDataToBinary(geometryData) {
|
|
26813
26955
|
var fbb = new Builder(1);
|
|
26814
26956
|
var fbGeometryData = new FBGeometryDataT();
|
|
26815
|
-
|
|
26816
|
-
fbGeometryData.
|
|
26817
|
-
fbGeometryData.
|
|
26818
|
-
fbGeometryData.
|
|
26819
|
-
|
|
26820
|
-
fbGeometryData.boneNames =
|
|
26821
|
-
|
|
26822
|
-
fbGeometryData.
|
|
26823
|
-
|
|
26824
|
-
fbGeometryData.inverseBindMatrices = (_geometryData_inverseBindMatrices = geometryData.inverseBindMatrices) != null ? _geometryData_inverseBindMatrices : [];
|
|
26825
|
-
var _geometryData_binaryData;
|
|
26826
|
-
fbGeometryData.binaryData = (_geometryData_binaryData = geometryData.binaryData) != null ? _geometryData_binaryData : [];
|
|
26957
|
+
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;
|
|
26958
|
+
fbGeometryData.indexFormat = indexFormat;
|
|
26959
|
+
fbGeometryData.indexOffset = indexOffset;
|
|
26960
|
+
fbGeometryData.mode = mode;
|
|
26961
|
+
fbGeometryData.id = id;
|
|
26962
|
+
fbGeometryData.boneNames = boneNames;
|
|
26963
|
+
fbGeometryData.rootBoneName = rootBoneName;
|
|
26964
|
+
fbGeometryData.inverseBindMatrices = inverseBindMatrices;
|
|
26965
|
+
fbGeometryData.binaryData = binaryData;
|
|
26827
26966
|
var fbVertexdata = new FBVertexDataT();
|
|
26828
|
-
fbVertexdata.vertexCount =
|
|
26967
|
+
fbVertexdata.vertexCount = vertexData.vertexCount;
|
|
26829
26968
|
fbVertexdata.channels = [];
|
|
26830
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(
|
|
26969
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(vertexData.channels), _step; !(_step = _iterator()).done;){
|
|
26831
26970
|
var channel = _step.value;
|
|
26832
|
-
var
|
|
26971
|
+
var semantic = channel.semantic, offset = channel.offset, format = channel.format, dimension = channel.dimension, normalize = channel.normalize;
|
|
26972
|
+
var fbChannel = new FBVertexChannelT(semantic, offset, format, dimension, normalize);
|
|
26833
26973
|
fbVertexdata.channels.push(fbChannel);
|
|
26834
26974
|
}
|
|
26835
26975
|
fbGeometryData.vertexData = fbVertexdata;
|
|
26836
26976
|
var fbSubMeshes = [];
|
|
26837
26977
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(geometryData.subMeshes), _step1; !(_step1 = _iterator1()).done;){
|
|
26838
26978
|
var subMesh = _step1.value;
|
|
26839
|
-
var
|
|
26979
|
+
var offset1 = subMesh.offset, indexCount = subMesh.indexCount, vertexCount = subMesh.vertexCount;
|
|
26980
|
+
var fbSubMesh = new FBSubMeshT(offset1, indexCount, vertexCount);
|
|
26840
26981
|
fbSubMeshes.push(fbSubMesh);
|
|
26841
26982
|
}
|
|
26842
26983
|
fbGeometryData.subMeshes = fbSubMeshes;
|
|
26843
26984
|
FBEffectsPackageData.finishFBEffectsPackageDataBuffer(fbb, fbGeometryData.pack(fbb));
|
|
26844
|
-
|
|
26845
|
-
return buffer;
|
|
26985
|
+
return fbb.asUint8Array(); // Of type `Uint8Array`.
|
|
26846
26986
|
};
|
|
26847
26987
|
_proto.binaryToGeometryData = function binaryToGeometryData(buffer) {
|
|
26848
26988
|
var buf = new ByteBuffer(buffer);
|
|
@@ -26864,7 +27004,8 @@ var EffectsPackage = /*#__PURE__*/ function() {
|
|
|
26864
27004
|
semantic: (_channel_semantic = channel.semantic()) != null ? _channel_semantic : "",
|
|
26865
27005
|
offset: channel.offset(),
|
|
26866
27006
|
format: channel.format(),
|
|
26867
|
-
dimension: channel.dimension()
|
|
27007
|
+
dimension: channel.dimension(),
|
|
27008
|
+
normalize: channel.normalize()
|
|
26868
27009
|
};
|
|
26869
27010
|
vertexData.channels.push(vertexChannel);
|
|
26870
27011
|
}
|
|
@@ -26877,7 +27018,8 @@ var EffectsPackage = /*#__PURE__*/ function() {
|
|
|
26877
27018
|
}
|
|
26878
27019
|
var subMesh = {
|
|
26879
27020
|
offset: fbSubMesh.offset(),
|
|
26880
|
-
vertexCount: fbSubMesh.vertexCount()
|
|
27021
|
+
vertexCount: fbSubMesh.vertexCount(),
|
|
27022
|
+
indexCount: fbSubMesh.indexCount()
|
|
26881
27023
|
};
|
|
26882
27024
|
subMeshes.push(subMesh);
|
|
26883
27025
|
}
|
|
@@ -27306,7 +27448,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
27306
27448
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
27307
27449
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
27308
27450
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
27309
|
-
var version = "2.0.0-alpha.
|
|
27451
|
+
var version = "2.0.0-alpha.29";
|
|
27310
27452
|
logger.info("Core version: " + version + ".");
|
|
27311
27453
|
|
|
27312
27454
|
exports.AbstractPlugin = AbstractPlugin;
|
|
@@ -27429,7 +27571,6 @@ exports.createGLContext = createGLContext;
|
|
|
27429
27571
|
exports.createKeyFrameMeta = createKeyFrameMeta;
|
|
27430
27572
|
exports.createShaderWithMacros = createShaderWithMacros;
|
|
27431
27573
|
exports.createShape = createShape;
|
|
27432
|
-
exports.createVFXItem = createVFXItem;
|
|
27433
27574
|
exports.createValueGetter = createValueGetter;
|
|
27434
27575
|
exports.decimalEqual = decimalEqual;
|
|
27435
27576
|
exports.defaultGlobalVolume = defaultGlobalVolume;
|
|
@@ -27485,6 +27626,8 @@ exports.isArray = isArray;
|
|
|
27485
27626
|
exports.isCanvas = isCanvas;
|
|
27486
27627
|
exports.isFunction = isFunction;
|
|
27487
27628
|
exports.isIOS = isIOS;
|
|
27629
|
+
exports.isIOSByUA = isIOSByUA;
|
|
27630
|
+
exports.isMiniProgram = isMiniProgram;
|
|
27488
27631
|
exports.isObject = isObject;
|
|
27489
27632
|
exports.isSceneJSON = isSceneJSON;
|
|
27490
27633
|
exports.isSceneURL = isSceneURL;
|
|
@@ -27495,9 +27638,11 @@ exports.isUniformStruct = isUniformStruct;
|
|
|
27495
27638
|
exports.isUniformStructArray = isUniformStructArray;
|
|
27496
27639
|
exports.isValidFontFamily = isValidFontFamily;
|
|
27497
27640
|
exports.isWebGL2 = isWebGL2;
|
|
27641
|
+
exports.isWechatMiniApp = isWechatMiniApp;
|
|
27498
27642
|
exports.itemFrag = itemFrag;
|
|
27499
27643
|
exports.itemFrameFrag = itemFrameFrag;
|
|
27500
27644
|
exports.itemVert = itemVert;
|
|
27645
|
+
exports.loadAVIFOptional = loadAVIFOptional;
|
|
27501
27646
|
exports.loadBinary = loadBinary;
|
|
27502
27647
|
exports.loadBlob = loadBlob;
|
|
27503
27648
|
exports.loadImage = loadImage;
|