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