@galacean/effects-core 2.0.0-alpha.26 → 2.0.0-alpha.28
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/__definations__/fbeffects-object-data.d.ts +28 -0
- package/dist/__definations__/fbeffects-package-data.d.ts +26 -0
- package/dist/__definations__/fbgeometry-data.d.ts +77 -0
- package/dist/__definations__/fbsub-mesh.d.ts +26 -0
- package/dist/__definations__/fbvertex-channel.d.ts +33 -0
- package/dist/__definations__/fbvertex-data.d.ts +27 -0
- package/dist/__definations__/index.d.ts +6 -0
- package/dist/camera.d.ts +4 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/post-process-volume.d.ts +16 -0
- package/dist/composition-source-manager.d.ts +1 -3
- package/dist/composition.d.ts +5 -5
- package/dist/effects-package.d.ts +19 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1925 -285
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1922 -285
- package/dist/index.mjs.map +1 -1
- package/dist/math/translate.d.ts +1 -1
- package/dist/plugins/interact/interact-item.d.ts +1 -0
- package/dist/plugins/timeline/track.d.ts +2 -2
- package/dist/render/global-volume.d.ts +4 -5
- package/dist/render/render-frame.d.ts +6 -5
- package/dist/utils/device.d.ts +3 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/vfx-item.d.ts +2 -8
- package/package.json +5 -3
- package/dist/asset-migrations.d.ts +0 -5
- package/dist/plugins/cal/animation-mixer-playable.d.ts +0 -4
- package/dist/plugins/cal/animation-playable-output.d.ts +0 -4
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.28
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -444,16 +444,27 @@ function isIOS() {
|
|
|
444
444
|
// real ios device not in simulator
|
|
445
445
|
return !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
|
|
446
446
|
}
|
|
447
|
+
function isIOSByUA() {
|
|
448
|
+
var str = navigator.userAgent.toLowerCase();
|
|
449
|
+
var ver = str.match(/cpu (iphone )?os (.*?) like mac os/);
|
|
450
|
+
return ver ? parseInt(ver[2], 10) : 0;
|
|
451
|
+
}
|
|
447
452
|
function isAndroid() {
|
|
448
453
|
return /\b[Aa]ndroid\b/.test(navigator.userAgent);
|
|
449
454
|
}
|
|
450
455
|
function isSimulatorCellPhone() {
|
|
451
456
|
return isAndroid() || /\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent);
|
|
452
457
|
}
|
|
458
|
+
function isMiniProgram() {
|
|
459
|
+
return isAlipayMiniApp() || isWechatMiniApp();
|
|
460
|
+
}
|
|
453
461
|
function isAlipayMiniApp() {
|
|
454
462
|
var _my;
|
|
455
463
|
return typeof my !== "undefined" && ((_my = my) == null ? void 0 : _my.renderTarget) === "web";
|
|
456
464
|
}
|
|
465
|
+
function isWechatMiniApp() {
|
|
466
|
+
return window.__wxjs_environment === "miniprogram";
|
|
467
|
+
}
|
|
457
468
|
|
|
458
469
|
function imageDataFromColor(value) {
|
|
459
470
|
if (isString(value)) {
|
|
@@ -4001,13 +4012,29 @@ var RenderFace;
|
|
|
4001
4012
|
RenderFace["Front"] = "Front";
|
|
4002
4013
|
})(RenderFace || (RenderFace = {}));
|
|
4003
4014
|
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
var
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
var
|
|
4015
|
+
/**
|
|
4016
|
+
* 销毁
|
|
4017
|
+
*/ var END_BEHAVIOR_DESTROY = 0;
|
|
4018
|
+
/**
|
|
4019
|
+
* 暂停
|
|
4020
|
+
* @deprecated since 2.0 - use `END_BEHAVIOR_FREEZE` instead
|
|
4021
|
+
*/ var END_BEHAVIOR_PAUSE = 1;
|
|
4022
|
+
/**
|
|
4023
|
+
* 无限播放
|
|
4024
|
+
*/ var END_BEHAVIOR_FORWARD = 2;
|
|
4025
|
+
/**
|
|
4026
|
+
* 销毁并保留最后一帧
|
|
4027
|
+
* @deprecated since 2.0
|
|
4028
|
+
*/ var END_BEHAVIOR_PAUSE_AND_DESTROY = 3;
|
|
4029
|
+
/**
|
|
4030
|
+
* 冻结
|
|
4031
|
+
*/ var END_BEHAVIOR_FREEZE = 4;
|
|
4032
|
+
/**
|
|
4033
|
+
* 重播
|
|
4034
|
+
*/ var END_BEHAVIOR_RESTART = 5;
|
|
4035
|
+
/**
|
|
4036
|
+
*
|
|
4037
|
+
*/ var END_BEHAVIOR_DESTROY_CHILDREN = 6;
|
|
4011
4038
|
var CAMERA_CLIP_MODE_VERTICAL = 1;
|
|
4012
4039
|
var CAMERA_CLIP_MODE_NORMAL = 0;
|
|
4013
4040
|
var MESSAGE_ITEM_PHRASE_BEGIN = 2;
|
|
@@ -4022,29 +4049,6 @@ var CameraClipMode;
|
|
|
4022
4049
|
* 剪裁左右
|
|
4023
4050
|
*/ CameraClipMode[CameraClipMode["landscape"] = 0] = "landscape";
|
|
4024
4051
|
})(CameraClipMode || (CameraClipMode = {}));
|
|
4025
|
-
/**
|
|
4026
|
-
* 结束行为
|
|
4027
|
-
*/ var CompositionEndBehavior;
|
|
4028
|
-
(function(CompositionEndBehavior) {
|
|
4029
|
-
/**
|
|
4030
|
-
* 销毁
|
|
4031
|
-
*/ CompositionEndBehavior[CompositionEndBehavior["destroy"] = 0] = "destroy";
|
|
4032
|
-
/**
|
|
4033
|
-
* 暂停
|
|
4034
|
-
*/ CompositionEndBehavior[CompositionEndBehavior["pause"] = 1] = "pause";
|
|
4035
|
-
/**
|
|
4036
|
-
* 重播
|
|
4037
|
-
*/ CompositionEndBehavior[CompositionEndBehavior["restart"] = 5] = "restart";
|
|
4038
|
-
/**
|
|
4039
|
-
* 无限播放
|
|
4040
|
-
*/ CompositionEndBehavior[CompositionEndBehavior["forward"] = 2] = "forward";
|
|
4041
|
-
/**
|
|
4042
|
-
* 销毁并保留最后一帧
|
|
4043
|
-
*/ CompositionEndBehavior[CompositionEndBehavior["pause_destroy"] = 3] = "pause_destroy";
|
|
4044
|
-
/**
|
|
4045
|
-
* 冻结
|
|
4046
|
-
*/ CompositionEndBehavior[CompositionEndBehavior["freeze"] = 4] = "freeze";
|
|
4047
|
-
})(CompositionEndBehavior || (CompositionEndBehavior = {}));
|
|
4048
4052
|
|
|
4049
4053
|
/**
|
|
4050
4054
|
* 动态换图类型
|
|
@@ -4125,12 +4129,23 @@ var CameraClipMode;
|
|
|
4125
4129
|
BezierKeyframeType[BezierKeyframeType["LINE_OUT"] = 6] = "LINE_OUT";
|
|
4126
4130
|
})(BezierKeyframeType || (BezierKeyframeType = {}));
|
|
4127
4131
|
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4132
|
+
/**
|
|
4133
|
+
* 结束行为
|
|
4134
|
+
*/ var EndBehavior;
|
|
4135
|
+
(function(EndBehavior) {
|
|
4136
|
+
/**
|
|
4137
|
+
* 销毁
|
|
4138
|
+
*/ EndBehavior[EndBehavior["destroy"] = 0] = "destroy";
|
|
4139
|
+
/**
|
|
4140
|
+
* 重播
|
|
4141
|
+
*/ EndBehavior[EndBehavior["restart"] = 5] = "restart";
|
|
4142
|
+
/**
|
|
4143
|
+
* 无限播放
|
|
4144
|
+
*/ EndBehavior[EndBehavior["forward"] = 2] = "forward";
|
|
4145
|
+
/**
|
|
4146
|
+
* 冻结
|
|
4147
|
+
*/ EndBehavior[EndBehavior["freeze"] = 4] = "freeze";
|
|
4148
|
+
})(EndBehavior || (EndBehavior = {}));
|
|
4134
4149
|
var ParentItemEndBehavior;
|
|
4135
4150
|
(function(ParentItemEndBehavior) {
|
|
4136
4151
|
ParentItemEndBehavior[ParentItemEndBehavior["destroyChildren"] = 6] = "destroyChildren";
|
|
@@ -4455,7 +4470,6 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
4455
4470
|
get RenderType () { return RenderType; },
|
|
4456
4471
|
get RenderFace () { return RenderFace; },
|
|
4457
4472
|
get CameraClipMode () { return CameraClipMode; },
|
|
4458
|
-
get CompositionEndBehavior () { return CompositionEndBehavior; },
|
|
4459
4473
|
get BackgroundType () { return BackgroundType; },
|
|
4460
4474
|
END_BEHAVIOR_DESTROY: END_BEHAVIOR_DESTROY,
|
|
4461
4475
|
END_BEHAVIOR_PAUSE: END_BEHAVIOR_PAUSE,
|
|
@@ -4470,7 +4484,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
4470
4484
|
MESSAGE_ITEM_PHRASE_END: MESSAGE_ITEM_PHRASE_END,
|
|
4471
4485
|
get ValueType () { return ValueType; },
|
|
4472
4486
|
get BezierKeyframeType () { return BezierKeyframeType; },
|
|
4473
|
-
get
|
|
4487
|
+
get EndBehavior () { return EndBehavior; },
|
|
4474
4488
|
get ParentItemEndBehavior () { return ParentItemEndBehavior; },
|
|
4475
4489
|
get ParticleInteractionBehavior () { return ParticleInteractionBehavior; },
|
|
4476
4490
|
get ShapeArcMode () { return ShapeArcMode; },
|
|
@@ -8130,31 +8144,35 @@ function deserializeMipmapTexture(textureOptions, bins, engine) {
|
|
|
8130
8144
|
}
|
|
8131
8145
|
function _deserializeMipmapTexture() {
|
|
8132
8146
|
_deserializeMipmapTexture = _async_to_generator(function(textureOptions, bins, engine, files) {
|
|
8133
|
-
var mipmaps, target,
|
|
8147
|
+
var mipmaps, target, jobs, loadedMipmaps, mipmaps1, target1, jobs1, loadedMipmaps1, bin;
|
|
8134
8148
|
return __generator(this, function(_state) {
|
|
8135
8149
|
switch(_state.label){
|
|
8136
8150
|
case 0:
|
|
8137
8151
|
if (files === void 0) files = [];
|
|
8138
8152
|
if (!(textureOptions.target === 34067)) return [
|
|
8139
8153
|
3,
|
|
8140
|
-
|
|
8154
|
+
2
|
|
8141
8155
|
];
|
|
8142
8156
|
mipmaps = textureOptions.mipmaps, target = textureOptions.target;
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
for(_iterator = _create_for_of_iterator_helper_loose(mipmaps); !(_step = _iterator()).done;){
|
|
8146
|
-
level = _step.value;
|
|
8147
|
-
newLevel = [];
|
|
8148
|
-
for(_iterator1 = _create_for_of_iterator_helper_loose(level); !(_step1 = _iterator1()).done;){
|
|
8149
|
-
face = _step1.value;
|
|
8157
|
+
jobs = mipmaps.map(function(mipmap) {
|
|
8158
|
+
return Promise.all(mipmap.map(function(pointer) {
|
|
8150
8159
|
// @ts-expect-error
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8160
|
+
if (pointer.id) {
|
|
8161
|
+
// @ts-expect-error
|
|
8162
|
+
var loadedImageAsset = engine.assetLoader.loadGUID(pointer.id);
|
|
8163
|
+
// @ts-expect-error
|
|
8164
|
+
return loadedImageAsset.data;
|
|
8165
|
+
} else {
|
|
8166
|
+
return loadMipmapImage(pointer, bins);
|
|
8167
|
+
}
|
|
8168
|
+
}));
|
|
8169
|
+
});
|
|
8170
|
+
return [
|
|
8171
|
+
4,
|
|
8172
|
+
Promise.all(jobs)
|
|
8173
|
+
];
|
|
8174
|
+
case 1:
|
|
8175
|
+
loadedMipmaps = _state.sent();
|
|
8158
8176
|
return [
|
|
8159
8177
|
2,
|
|
8160
8178
|
_extends({
|
|
@@ -8168,17 +8186,17 @@ function _deserializeMipmapTexture() {
|
|
|
8168
8186
|
}
|
|
8169
8187
|
})
|
|
8170
8188
|
];
|
|
8171
|
-
case
|
|
8189
|
+
case 2:
|
|
8172
8190
|
// TODO: 补充测试用例
|
|
8173
8191
|
mipmaps1 = textureOptions.mipmaps, target1 = textureOptions.target;
|
|
8174
|
-
|
|
8192
|
+
jobs1 = mipmaps1.map(function(pointer) {
|
|
8175
8193
|
return loadMipmapImage(pointer, bins);
|
|
8176
8194
|
});
|
|
8177
8195
|
return [
|
|
8178
8196
|
4,
|
|
8179
|
-
Promise.all(
|
|
8197
|
+
Promise.all(jobs1)
|
|
8180
8198
|
];
|
|
8181
|
-
case
|
|
8199
|
+
case 3:
|
|
8182
8200
|
loadedMipmaps1 = _state.sent();
|
|
8183
8201
|
bin = files[mipmaps1[0][1][0]].url;
|
|
8184
8202
|
return [
|
|
@@ -8201,7 +8219,7 @@ function _deserializeMipmapTexture() {
|
|
|
8201
8219
|
}
|
|
8202
8220
|
})
|
|
8203
8221
|
];
|
|
8204
|
-
case
|
|
8222
|
+
case 4:
|
|
8205
8223
|
return [
|
|
8206
8224
|
2
|
|
8207
8225
|
];
|
|
@@ -11556,7 +11574,7 @@ var valueDefine = "#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValu
|
|
|
11556
11574
|
|
|
11557
11575
|
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.;}";
|
|
11558
11576
|
|
|
11559
|
-
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);}";
|
|
11577
|
+
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);}";
|
|
11560
11578
|
|
|
11561
11579
|
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);}";
|
|
11562
11580
|
|
|
@@ -11844,7 +11862,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11844
11862
|
this.screenMesh.material.setFloat("_Brightness", brightness);
|
|
11845
11863
|
this.screenMesh.material.setFloat("_Saturation", saturation);
|
|
11846
11864
|
this.screenMesh.material.setFloat("_Contrast", contrast);
|
|
11847
|
-
this.screenMesh.material.setInt("_UseBloom", useBloom);
|
|
11865
|
+
this.screenMesh.material.setInt("_UseBloom", Number(useBloom));
|
|
11848
11866
|
if (useBloom) {
|
|
11849
11867
|
this.screenMesh.material.setTexture("_GaussianTex", this.mainTexture);
|
|
11850
11868
|
this.screenMesh.material.setFloat("_BloomIntensity", bloomIntensity);
|
|
@@ -11856,7 +11874,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11856
11874
|
this.screenMesh.material.setVector2("_VignetteCenter", new Vector2(0.5, 0.5));
|
|
11857
11875
|
this.screenMesh.material.setVector3("_VignetteColor", new Vector3(0.0, 0.0, 0.0));
|
|
11858
11876
|
}
|
|
11859
|
-
this.screenMesh.material.setInt("_UseToneMapping", useToneMapping);
|
|
11877
|
+
this.screenMesh.material.setInt("_UseToneMapping", Number(useToneMapping));
|
|
11860
11878
|
renderer.renderMeshes([
|
|
11861
11879
|
this.screenMesh
|
|
11862
11880
|
]);
|
|
@@ -11868,9 +11886,8 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11868
11886
|
* 后处理配置
|
|
11869
11887
|
*/ var defaultGlobalVolume = {
|
|
11870
11888
|
useHDR: false,
|
|
11871
|
-
usePostProcessing: false,
|
|
11872
11889
|
/***** Material Uniform *****/ // Bloom
|
|
11873
|
-
useBloom:
|
|
11890
|
+
useBloom: true,
|
|
11874
11891
|
threshold: 1.0,
|
|
11875
11892
|
bloomIntensity: 1.0,
|
|
11876
11893
|
// ColorAdjustments
|
|
@@ -11884,7 +11901,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11884
11901
|
vignetteSmoothness: 0.4,
|
|
11885
11902
|
vignetteRoundness: 1.0,
|
|
11886
11903
|
// ToneMapping
|
|
11887
|
-
useToneMapping:
|
|
11904
|
+
useToneMapping: true
|
|
11888
11905
|
};
|
|
11889
11906
|
|
|
11890
11907
|
var RENDER_PASS_NAME_PREFIX = "_effects_default_";
|
|
@@ -11953,20 +11970,36 @@ var seed$5 = 1;
|
|
|
11953
11970
|
];
|
|
11954
11971
|
this.setRenderPasses(renderPasses);
|
|
11955
11972
|
if (this.globalVolume) {
|
|
11956
|
-
var useBloom = this.globalVolume.useBloom;
|
|
11957
11973
|
var sceneTextureHandle = new RenderTargetHandle(engine); //保存后处理前的屏幕图像
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
|
|
11964
|
-
|
|
11965
|
-
|
|
11966
|
-
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
11974
|
+
var gaussianStep = 7; // 高斯模糊的迭代次数,次数越高模糊范围越大
|
|
11975
|
+
var viewport = [
|
|
11976
|
+
0,
|
|
11977
|
+
0,
|
|
11978
|
+
this.renderer.getWidth() / 2,
|
|
11979
|
+
this.renderer.getHeight() / 2
|
|
11980
|
+
];
|
|
11981
|
+
var gaussianDownResults = new Array(gaussianStep); //存放多个高斯Pass的模糊结果,用于Bloom
|
|
11982
|
+
var textureType1 = this.globalVolume.useHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
|
|
11983
|
+
var bloomThresholdPass = new BloomThresholdPass(renderer, {
|
|
11984
|
+
name: "BloomThresholdPass",
|
|
11985
|
+
attachments: [
|
|
11986
|
+
{
|
|
11987
|
+
texture: {
|
|
11988
|
+
format: glContext.RGBA,
|
|
11989
|
+
type: textureType1,
|
|
11990
|
+
minFilter: glContext.LINEAR,
|
|
11991
|
+
magFilter: glContext.LINEAR
|
|
11992
|
+
}
|
|
11993
|
+
}
|
|
11994
|
+
]
|
|
11995
|
+
});
|
|
11996
|
+
bloomThresholdPass.sceneTextureHandle = sceneTextureHandle;
|
|
11997
|
+
this.addRenderPass(bloomThresholdPass);
|
|
11998
|
+
for(var i = 0; i < gaussianStep; i++){
|
|
11999
|
+
gaussianDownResults[i] = new RenderTargetHandle(engine);
|
|
12000
|
+
var gaussianDownHPass = new HQGaussianDownSamplePass(renderer, "H", {
|
|
12001
|
+
name: "GaussianDownPassH" + i,
|
|
12002
|
+
viewport: viewport,
|
|
11970
12003
|
attachments: [
|
|
11971
12004
|
{
|
|
11972
12005
|
texture: {
|
|
@@ -11978,74 +12011,50 @@ var seed$5 = 1;
|
|
|
11978
12011
|
}
|
|
11979
12012
|
]
|
|
11980
12013
|
});
|
|
11981
|
-
|
|
11982
|
-
|
|
11983
|
-
|
|
11984
|
-
|
|
11985
|
-
|
|
11986
|
-
|
|
11987
|
-
|
|
11988
|
-
|
|
11989
|
-
|
|
11990
|
-
|
|
11991
|
-
format: glContext.RGBA,
|
|
11992
|
-
type: textureType1,
|
|
11993
|
-
minFilter: glContext.LINEAR,
|
|
11994
|
-
magFilter: glContext.LINEAR
|
|
11995
|
-
}
|
|
11996
|
-
}
|
|
11997
|
-
]
|
|
11998
|
-
});
|
|
11999
|
-
var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", {
|
|
12000
|
-
name: "GaussianDownPassV" + i,
|
|
12001
|
-
viewport: viewport,
|
|
12002
|
-
attachments: [
|
|
12003
|
-
{
|
|
12004
|
-
texture: {
|
|
12005
|
-
format: glContext.RGBA,
|
|
12006
|
-
type: textureType1,
|
|
12007
|
-
minFilter: glContext.LINEAR,
|
|
12008
|
-
magFilter: glContext.LINEAR
|
|
12009
|
-
}
|
|
12014
|
+
var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", {
|
|
12015
|
+
name: "GaussianDownPassV" + i,
|
|
12016
|
+
viewport: viewport,
|
|
12017
|
+
attachments: [
|
|
12018
|
+
{
|
|
12019
|
+
texture: {
|
|
12020
|
+
format: glContext.RGBA,
|
|
12021
|
+
type: textureType1,
|
|
12022
|
+
minFilter: glContext.LINEAR,
|
|
12023
|
+
magFilter: glContext.LINEAR
|
|
12010
12024
|
}
|
|
12011
|
-
|
|
12012
|
-
|
|
12013
|
-
|
|
12014
|
-
|
|
12015
|
-
|
|
12016
|
-
|
|
12017
|
-
|
|
12018
|
-
|
|
12019
|
-
|
|
12020
|
-
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
|
|
12025
|
-
|
|
12026
|
-
|
|
12027
|
-
|
|
12028
|
-
|
|
12029
|
-
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
|
|
12033
|
-
|
|
12025
|
+
}
|
|
12026
|
+
]
|
|
12027
|
+
});
|
|
12028
|
+
gaussianDownVPass.gaussianResult = gaussianDownResults[i];
|
|
12029
|
+
this.addRenderPass(gaussianDownHPass);
|
|
12030
|
+
this.addRenderPass(gaussianDownVPass);
|
|
12031
|
+
viewport[2] /= 2;
|
|
12032
|
+
viewport[3] /= 2;
|
|
12033
|
+
// TODO 限制最大迭代
|
|
12034
|
+
}
|
|
12035
|
+
viewport[2] *= 4;
|
|
12036
|
+
viewport[3] *= 4;
|
|
12037
|
+
for(var i1 = 0; i1 < gaussianStep - 1; i1++){
|
|
12038
|
+
var gaussianUpPass = new HQGaussianUpSamplePass(renderer, {
|
|
12039
|
+
name: "GaussianUpPass" + i1,
|
|
12040
|
+
viewport: viewport,
|
|
12041
|
+
attachments: [
|
|
12042
|
+
{
|
|
12043
|
+
texture: {
|
|
12044
|
+
format: glContext.RGBA,
|
|
12045
|
+
type: textureType1,
|
|
12046
|
+
minFilter: glContext.LINEAR,
|
|
12047
|
+
magFilter: glContext.LINEAR
|
|
12034
12048
|
}
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
|
|
12038
|
-
|
|
12039
|
-
|
|
12040
|
-
|
|
12041
|
-
|
|
12042
|
-
}
|
|
12043
|
-
var postProcessPass;
|
|
12044
|
-
if (useBloom) {
|
|
12045
|
-
postProcessPass = new ToneMappingPass(renderer, sceneTextureHandle);
|
|
12046
|
-
} else {
|
|
12047
|
-
postProcessPass = new ToneMappingPass(renderer);
|
|
12049
|
+
}
|
|
12050
|
+
]
|
|
12051
|
+
});
|
|
12052
|
+
gaussianUpPass.gaussianDownSampleResult = gaussianDownResults[gaussianStep - 2 - i1];
|
|
12053
|
+
this.addRenderPass(gaussianUpPass);
|
|
12054
|
+
viewport[2] *= 2;
|
|
12055
|
+
viewport[3] *= 2;
|
|
12048
12056
|
}
|
|
12057
|
+
var postProcessPass = new ToneMappingPass(renderer, sceneTextureHandle);
|
|
12049
12058
|
this.addRenderPass(postProcessPass);
|
|
12050
12059
|
}
|
|
12051
12060
|
this.semantics = new SemanticMap(options.semantics);
|
|
@@ -13082,6 +13091,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13082
13091
|
1
|
|
13083
13092
|
];
|
|
13084
13093
|
/** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
|
|
13094
|
+
_this.hasBeenAddedToComposition = false;
|
|
13085
13095
|
_this.getHitTestParams = function(force) {
|
|
13086
13096
|
if (!_this.clickable) {
|
|
13087
13097
|
return;
|
|
@@ -13100,7 +13110,6 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13100
13110
|
}
|
|
13101
13111
|
var _proto = InteractComponent.prototype;
|
|
13102
13112
|
_proto.start = function start() {
|
|
13103
|
-
var _this = this;
|
|
13104
13113
|
var options = this.item.props.content.options;
|
|
13105
13114
|
var env = this.item.engine.renderer.env;
|
|
13106
13115
|
var composition = this.item.composition;
|
|
@@ -13112,10 +13121,6 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13112
13121
|
this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
|
|
13113
13122
|
}
|
|
13114
13123
|
}
|
|
13115
|
-
composition.addInteractiveItem(this.item, options.type);
|
|
13116
|
-
this.item.onEnd = function() {
|
|
13117
|
-
return composition.removeInteractiveItem(_this.item, options.type);
|
|
13118
|
-
};
|
|
13119
13124
|
if (options.type === InteractType.DRAG) {
|
|
13120
13125
|
if (env !== PLAYER_OPTIONS_ENV_EDITOR || options.enableInEditor) {
|
|
13121
13126
|
composition.event && this.beginDragTarget(options, composition.event);
|
|
@@ -13130,6 +13135,11 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13130
13135
|
_proto.update = function update(dt) {
|
|
13131
13136
|
var _this_previewContent;
|
|
13132
13137
|
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
13138
|
+
if (!this.hasBeenAddedToComposition && this.item.composition) {
|
|
13139
|
+
var options = this.item.props.content.options;
|
|
13140
|
+
this.item.composition.addInteractiveItem(this.item, options.type);
|
|
13141
|
+
this.hasBeenAddedToComposition = true;
|
|
13142
|
+
}
|
|
13133
13143
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
13134
13144
|
return;
|
|
13135
13145
|
}
|
|
@@ -14853,8 +14863,7 @@ var RectangleEdge = /*#__PURE__*/ function() {
|
|
|
14853
14863
|
}();
|
|
14854
14864
|
var Edge = /*#__PURE__*/ function() {
|
|
14855
14865
|
function Edge(args) {
|
|
14856
|
-
|
|
14857
|
-
this._d = (args.width || 1) / 2;
|
|
14866
|
+
this._d = args.width || 1;
|
|
14858
14867
|
this.arcMode = args.arcMode;
|
|
14859
14868
|
}
|
|
14860
14869
|
var _proto = Edge.prototype;
|
|
@@ -16620,7 +16629,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16620
16629
|
}
|
|
16621
16630
|
}
|
|
16622
16631
|
}
|
|
16623
|
-
} else if (this.item.endBehavior ===
|
|
16632
|
+
} else if (this.item.endBehavior === EndBehavior.restart) {
|
|
16624
16633
|
updateTrail();
|
|
16625
16634
|
this.loopStartTime = now - duration;
|
|
16626
16635
|
this.lastEmitTime -= duration;
|
|
@@ -16639,12 +16648,12 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16639
16648
|
this.ended = true;
|
|
16640
16649
|
this.onEnd(this);
|
|
16641
16650
|
var endBehavior = this.item.endBehavior;
|
|
16642
|
-
if (endBehavior ===
|
|
16651
|
+
if (endBehavior === EndBehavior.freeze) {
|
|
16643
16652
|
this.frozen = true;
|
|
16644
16653
|
}
|
|
16645
16654
|
}
|
|
16646
|
-
} else if (this.item.endBehavior !==
|
|
16647
|
-
if (
|
|
16655
|
+
} else if (this.item.endBehavior !== EndBehavior.restart) {
|
|
16656
|
+
if (EndBehavior.destroy === this.item.endBehavior) {
|
|
16648
16657
|
var node = link.last;
|
|
16649
16658
|
if (node && node.content[0] < this.lastUpdate) {
|
|
16650
16659
|
this.destroyed = true;
|
|
@@ -18724,9 +18733,9 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
18724
18733
|
var localTime = time - this.start;
|
|
18725
18734
|
var duration = this.duration;
|
|
18726
18735
|
if (localTime - duration > 0.001) {
|
|
18727
|
-
if (this.endBehavior ===
|
|
18736
|
+
if (this.endBehavior === EndBehavior.restart) {
|
|
18728
18737
|
localTime = localTime % duration;
|
|
18729
|
-
} else if (this.endBehavior ===
|
|
18738
|
+
} else if (this.endBehavior === EndBehavior.freeze) {
|
|
18730
18739
|
localTime = Math.min(duration, localTime);
|
|
18731
18740
|
}
|
|
18732
18741
|
}
|
|
@@ -18852,7 +18861,7 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
18852
18861
|
var ended = false;
|
|
18853
18862
|
var started = false;
|
|
18854
18863
|
var boundObject = this.track.binding;
|
|
18855
|
-
if (localTime > clip.start + clip.duration + 0.001 && clip.endBehavior ===
|
|
18864
|
+
if (localTime > clip.start + clip.duration + 0.001 && clip.endBehavior === EndBehavior.destroy) {
|
|
18856
18865
|
if (_instanceof1(boundObject, exports.VFXItem) && exports.VFXItem.isParticle(boundObject) && this.particleSystem && !this.particleSystem.destroyed) {
|
|
18857
18866
|
weight = 1.0;
|
|
18858
18867
|
} else {
|
|
@@ -19160,7 +19169,7 @@ function compareTracks(a, b) {
|
|
|
19160
19169
|
this.resolveBindings();
|
|
19161
19170
|
this.timelinePlayable = this.timelineAsset.createPlayable(this.graph);
|
|
19162
19171
|
// 重播不销毁元素
|
|
19163
|
-
if (this.item.endBehavior !==
|
|
19172
|
+
if (this.item.endBehavior !== EndBehavior.destroy) {
|
|
19164
19173
|
this.setReusable(true);
|
|
19165
19174
|
}
|
|
19166
19175
|
};
|
|
@@ -19227,7 +19236,7 @@ function compareTracks(a, b) {
|
|
|
19227
19236
|
compositionComponent.refId = refId;
|
|
19228
19237
|
item.transform.parentTransform = this.transform;
|
|
19229
19238
|
this.item.composition.refContent.push(item);
|
|
19230
|
-
if (item.endBehavior ===
|
|
19239
|
+
if (item.endBehavior === EndBehavior.restart) {
|
|
19231
19240
|
this.item.composition.autoRefTex = false;
|
|
19232
19241
|
}
|
|
19233
19242
|
compositionComponent.createContent();
|
|
@@ -20179,6 +20188,105 @@ function geometryToTriangles(geometry) {
|
|
|
20179
20188
|
return res;
|
|
20180
20189
|
}
|
|
20181
20190
|
|
|
20191
|
+
exports.PostProcessVolume = /*#__PURE__*/ function(ItemBehaviour) {
|
|
20192
|
+
_inherits(PostProcessVolume, ItemBehaviour);
|
|
20193
|
+
function PostProcessVolume() {
|
|
20194
|
+
var _this;
|
|
20195
|
+
_this = ItemBehaviour.apply(this, arguments) || this;
|
|
20196
|
+
_this.useHDR = true;
|
|
20197
|
+
// Bloom
|
|
20198
|
+
_this.useBloom = true;
|
|
20199
|
+
_this.threshold = 1.0;
|
|
20200
|
+
_this.bloomIntensity = 1.0;
|
|
20201
|
+
// ColorAdjustments
|
|
20202
|
+
_this.brightness = 1.0;
|
|
20203
|
+
_this.saturation = 1.0;
|
|
20204
|
+
_this.contrast = 1.0;
|
|
20205
|
+
// Vignette
|
|
20206
|
+
_this.vignetteIntensity = 0.2;
|
|
20207
|
+
_this.vignetteSmoothness = 0.4;
|
|
20208
|
+
_this.vignetteRoundness = 1.0;
|
|
20209
|
+
// ToneMapping
|
|
20210
|
+
_this.useToneMapping = true // 1: true, 0: false
|
|
20211
|
+
;
|
|
20212
|
+
return _this;
|
|
20213
|
+
}
|
|
20214
|
+
var _proto = PostProcessVolume.prototype;
|
|
20215
|
+
_proto.start = function start() {
|
|
20216
|
+
var composition = this.item.composition;
|
|
20217
|
+
if (composition) {
|
|
20218
|
+
composition.globalVolume = {
|
|
20219
|
+
useHDR: this.useHDR,
|
|
20220
|
+
useBloom: this.useBloom,
|
|
20221
|
+
threshold: this.threshold,
|
|
20222
|
+
bloomIntensity: this.bloomIntensity,
|
|
20223
|
+
brightness: this.brightness,
|
|
20224
|
+
saturation: this.saturation,
|
|
20225
|
+
contrast: this.contrast,
|
|
20226
|
+
vignetteIntensity: this.vignetteIntensity,
|
|
20227
|
+
vignetteSmoothness: this.vignetteSmoothness,
|
|
20228
|
+
vignetteRoundness: this.vignetteRoundness,
|
|
20229
|
+
useToneMapping: this.useToneMapping
|
|
20230
|
+
};
|
|
20231
|
+
composition.createRenderFrame();
|
|
20232
|
+
}
|
|
20233
|
+
};
|
|
20234
|
+
_proto.update = function update(dt) {
|
|
20235
|
+
var composition = this.item.composition;
|
|
20236
|
+
if (composition) {
|
|
20237
|
+
var globalVolume = composition.renderFrame.globalVolume;
|
|
20238
|
+
globalVolume.useHDR = this.useHDR;
|
|
20239
|
+
globalVolume.useBloom = this.useBloom;
|
|
20240
|
+
globalVolume.threshold = this.threshold;
|
|
20241
|
+
globalVolume.bloomIntensity = this.bloomIntensity;
|
|
20242
|
+
globalVolume.brightness = this.brightness;
|
|
20243
|
+
globalVolume.saturation = this.saturation;
|
|
20244
|
+
globalVolume.contrast = this.contrast;
|
|
20245
|
+
globalVolume.vignetteIntensity = this.vignetteIntensity;
|
|
20246
|
+
globalVolume.vignetteSmoothness = this.vignetteSmoothness;
|
|
20247
|
+
globalVolume.vignetteRoundness = this.vignetteRoundness;
|
|
20248
|
+
globalVolume.useToneMapping = this.useToneMapping;
|
|
20249
|
+
}
|
|
20250
|
+
};
|
|
20251
|
+
return PostProcessVolume;
|
|
20252
|
+
}(ItemBehaviour);
|
|
20253
|
+
__decorate([
|
|
20254
|
+
serialize()
|
|
20255
|
+
], exports.PostProcessVolume.prototype, "useHDR", void 0);
|
|
20256
|
+
__decorate([
|
|
20257
|
+
serialize()
|
|
20258
|
+
], exports.PostProcessVolume.prototype, "useBloom", void 0);
|
|
20259
|
+
__decorate([
|
|
20260
|
+
serialize()
|
|
20261
|
+
], exports.PostProcessVolume.prototype, "threshold", void 0);
|
|
20262
|
+
__decorate([
|
|
20263
|
+
serialize()
|
|
20264
|
+
], exports.PostProcessVolume.prototype, "bloomIntensity", void 0);
|
|
20265
|
+
__decorate([
|
|
20266
|
+
serialize()
|
|
20267
|
+
], exports.PostProcessVolume.prototype, "brightness", void 0);
|
|
20268
|
+
__decorate([
|
|
20269
|
+
serialize()
|
|
20270
|
+
], exports.PostProcessVolume.prototype, "saturation", void 0);
|
|
20271
|
+
__decorate([
|
|
20272
|
+
serialize()
|
|
20273
|
+
], exports.PostProcessVolume.prototype, "contrast", void 0);
|
|
20274
|
+
__decorate([
|
|
20275
|
+
serialize()
|
|
20276
|
+
], exports.PostProcessVolume.prototype, "vignetteIntensity", void 0);
|
|
20277
|
+
__decorate([
|
|
20278
|
+
serialize()
|
|
20279
|
+
], exports.PostProcessVolume.prototype, "vignetteSmoothness", void 0);
|
|
20280
|
+
__decorate([
|
|
20281
|
+
serialize()
|
|
20282
|
+
], exports.PostProcessVolume.prototype, "vignetteRoundness", void 0);
|
|
20283
|
+
__decorate([
|
|
20284
|
+
serialize()
|
|
20285
|
+
], exports.PostProcessVolume.prototype, "useToneMapping", void 0);
|
|
20286
|
+
exports.PostProcessVolume = __decorate([
|
|
20287
|
+
effectsClass("PostProcessVolume")
|
|
20288
|
+
], exports.PostProcessVolume);
|
|
20289
|
+
|
|
20182
20290
|
exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
20183
20291
|
_inherits(VFXItem, EffectsObject);
|
|
20184
20292
|
function VFXItem(engine, props) {
|
|
@@ -20402,7 +20510,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20402
20510
|
/**
|
|
20403
20511
|
* 获取元素用于计算光线投射的面片类型和参数
|
|
20404
20512
|
* @override
|
|
20405
|
-
* @param force 元素没有开启交互也返回参数
|
|
20513
|
+
* @param force - 元素没有开启交互也返回参数
|
|
20406
20514
|
*/ _proto.getHitTestParams = function getHitTestParams(force) {
|
|
20407
20515
|
// OVERRIDE
|
|
20408
20516
|
};
|
|
@@ -20652,42 +20760,6 @@ exports.Item = void 0;
|
|
|
20652
20760
|
}
|
|
20653
20761
|
Item.isNull = isNull;
|
|
20654
20762
|
})(exports.Item || (exports.Item = {}));
|
|
20655
|
-
/**
|
|
20656
|
-
* (待废弃) 根据元素的类型创建对应的 `VFXItem` 实例
|
|
20657
|
-
* @param props
|
|
20658
|
-
* @param composition
|
|
20659
|
-
*/ function createVFXItem(props, composition) {
|
|
20660
|
-
var type = props.type;
|
|
20661
|
-
var pluginName = props.pluginName;
|
|
20662
|
-
if (!pluginName) {
|
|
20663
|
-
switch(type){
|
|
20664
|
-
case ItemType.null:
|
|
20665
|
-
pluginName = "cal";
|
|
20666
|
-
break;
|
|
20667
|
-
case ItemType.sprite:
|
|
20668
|
-
pluginName = "sprite";
|
|
20669
|
-
break;
|
|
20670
|
-
case ItemType.particle:
|
|
20671
|
-
pluginName = "particle";
|
|
20672
|
-
break;
|
|
20673
|
-
case ItemType.interact:
|
|
20674
|
-
pluginName = "interact";
|
|
20675
|
-
break;
|
|
20676
|
-
case ItemType.camera:
|
|
20677
|
-
pluginName = "camera";
|
|
20678
|
-
break;
|
|
20679
|
-
case ItemType.text:
|
|
20680
|
-
pluginName = "text";
|
|
20681
|
-
break;
|
|
20682
|
-
case ItemType.tree:
|
|
20683
|
-
pluginName = "tree";
|
|
20684
|
-
break;
|
|
20685
|
-
default:
|
|
20686
|
-
throw new Error("Invalid vfx item type.");
|
|
20687
|
-
}
|
|
20688
|
-
}
|
|
20689
|
-
return composition.pluginSystem.createPluginItem(pluginName, props, composition);
|
|
20690
|
-
}
|
|
20691
20763
|
|
|
20692
20764
|
var pluginLoaderMap = {};
|
|
20693
20765
|
var defaultPlugins = [];
|
|
@@ -20700,6 +20772,9 @@ var pluginCtrlMap = {};
|
|
|
20700
20772
|
* @param isDefault load
|
|
20701
20773
|
*/ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20702
20774
|
function registerPlugin(name, pluginClass, itemClass, isDefault) {
|
|
20775
|
+
if (pluginCtrlMap[name]) {
|
|
20776
|
+
logger.error("Duplicate registration for plugin " + name + ".");
|
|
20777
|
+
}
|
|
20703
20778
|
pluginCtrlMap[name] = itemClass;
|
|
20704
20779
|
pluginLoaderMap[name] = pluginClass;
|
|
20705
20780
|
if (isDefault) {
|
|
@@ -21278,8 +21353,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21278
21353
|
if (this.engine.objectInstance[guid]) {
|
|
21279
21354
|
return this.engine.objectInstance[guid];
|
|
21280
21355
|
}
|
|
21281
|
-
var effectsObject;
|
|
21282
21356
|
var effectsObjectData = this.findData(guid);
|
|
21357
|
+
var effectsObject;
|
|
21283
21358
|
if (!effectsObjectData) {
|
|
21284
21359
|
console.error("Object data with uuid: " + guid + " not found.");
|
|
21285
21360
|
return undefined;
|
|
@@ -21315,7 +21390,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21315
21390
|
_proto.loadGUIDAsync = function loadGUIDAsync(guid) {
|
|
21316
21391
|
var _this = this;
|
|
21317
21392
|
return _async_to_generator(function() {
|
|
21318
|
-
var
|
|
21393
|
+
var effectsObjectData, effectsObject, classConstructor;
|
|
21319
21394
|
return __generator(this, function(_state) {
|
|
21320
21395
|
switch(_state.label){
|
|
21321
21396
|
case 0:
|
|
@@ -22209,8 +22284,8 @@ function getStandardCameraContent(model) {
|
|
|
22209
22284
|
json.compositions.forEach(function(composition) {
|
|
22210
22285
|
composition.items.forEach(function(item) {
|
|
22211
22286
|
if (item.type === ItemType.null) {
|
|
22212
|
-
if (item.endBehavior ===
|
|
22213
|
-
item.endBehavior =
|
|
22287
|
+
if (item.endBehavior === EndBehavior.destroy) {
|
|
22288
|
+
item.endBehavior = EndBehavior.freeze;
|
|
22214
22289
|
}
|
|
22215
22290
|
}
|
|
22216
22291
|
});
|
|
@@ -22229,7 +22304,7 @@ function getStandardCameraContent(model) {
|
|
|
22229
22304
|
json.compositions.forEach(function(composition) {
|
|
22230
22305
|
composition.items.forEach(function(item) {
|
|
22231
22306
|
if (item.type === ItemType.mesh || item.type === ItemType.light) {
|
|
22232
|
-
item.endBehavior = item.endBehavior === 1 ?
|
|
22307
|
+
item.endBehavior = item.endBehavior === 1 ? EndBehavior.destroy : item.endBehavior;
|
|
22233
22308
|
}
|
|
22234
22309
|
});
|
|
22235
22310
|
});
|
|
@@ -22241,7 +22316,11 @@ function getStandardCameraContent(model) {
|
|
|
22241
22316
|
var _loop = function() {
|
|
22242
22317
|
var composition = _step1.value;
|
|
22243
22318
|
// composition 的 endBehavior 兼容
|
|
22244
|
-
if (
|
|
22319
|
+
if (// @ts-expect-error
|
|
22320
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
|
|
22321
|
+
composition.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY || // @ts-expect-error
|
|
22322
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
|
|
22323
|
+
composition.endBehavior === END_BEHAVIOR_PAUSE) {
|
|
22245
22324
|
composition.endBehavior = END_BEHAVIOR_FREEZE;
|
|
22246
22325
|
}
|
|
22247
22326
|
// 过滤掉滤镜元素
|
|
@@ -23028,13 +23107,13 @@ function getStandardItem(item, opt) {
|
|
|
23028
23107
|
var looping = (_originContent_options = originContent.options) == null ? void 0 : _originContent_options.looping;
|
|
23029
23108
|
if (looping) {
|
|
23030
23109
|
if (Array.isArray(looping)) {
|
|
23031
|
-
endBehavior = looping[1] ?
|
|
23110
|
+
endBehavior = looping[1] ? EndBehavior.restart : EndBehavior.destroy;
|
|
23032
23111
|
} else {
|
|
23033
|
-
endBehavior =
|
|
23112
|
+
endBehavior = EndBehavior.restart;
|
|
23034
23113
|
}
|
|
23035
23114
|
} else {
|
|
23036
23115
|
var _originContent_options1;
|
|
23037
|
-
endBehavior = endBehavior || (originContent == null ? void 0 : (_originContent_options1 = originContent.options) == null ? void 0 : _originContent_options1.endBehavior) ||
|
|
23116
|
+
endBehavior = endBehavior || (originContent == null ? void 0 : (_originContent_options1 = originContent.options) == null ? void 0 : _originContent_options1.endBehavior) || EndBehavior.destroy;
|
|
23038
23117
|
}
|
|
23039
23118
|
if (originContent.options.renderLevel) {
|
|
23040
23119
|
renderLevel = originContent.options.renderLevel;
|
|
@@ -23576,14 +23655,6 @@ var seed = 1;
|
|
|
23576
23655
|
case 0:
|
|
23577
23656
|
// TODO: 后面切换到新的数据版本,就不用掉用 getStandardJSON 做转换了
|
|
23578
23657
|
jsonScene = getStandardJSON(json);
|
|
23579
|
-
// FIXME: hack globalVolume,specification 更新后需移除
|
|
23580
|
-
// @ts-expect-error
|
|
23581
|
-
json.compositions.forEach(function(composition, i) {
|
|
23582
|
-
if (composition.globalVolume) {
|
|
23583
|
-
// @ts-expect-error
|
|
23584
|
-
jsonScene.compositions[i].globalVolume = composition.globalVolume;
|
|
23585
|
-
}
|
|
23586
|
-
});
|
|
23587
23658
|
_jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins, sceneCompositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, images = jsonScene.images;
|
|
23588
23659
|
pluginSystem = new PluginSystem(plugins);
|
|
23589
23660
|
return [
|
|
@@ -24371,20 +24442,17 @@ var listOrder = 0;
|
|
|
24371
24442
|
}
|
|
24372
24443
|
var _proto = CompositionSourceManager.prototype;
|
|
24373
24444
|
_proto.getContent = function getContent(composition) {
|
|
24374
|
-
|
|
24375
|
-
// @ts-expect-error
|
|
24376
|
-
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;
|
|
24445
|
+
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;
|
|
24377
24446
|
var items = this.assembleItems(composition);
|
|
24378
24447
|
return _extends({}, composition, {
|
|
24379
24448
|
id: id,
|
|
24380
24449
|
duration: duration,
|
|
24381
24450
|
name: name,
|
|
24382
|
-
endBehavior: isNaN(endBehavior) ?
|
|
24451
|
+
endBehavior: isNaN(endBehavior) ? EndBehavior.freeze : endBehavior,
|
|
24383
24452
|
// looping,
|
|
24384
24453
|
items: items,
|
|
24385
24454
|
camera: camera,
|
|
24386
|
-
startTime: startTime
|
|
24387
|
-
globalVolume: globalVolume
|
|
24455
|
+
startTime: startTime
|
|
24388
24456
|
});
|
|
24389
24457
|
};
|
|
24390
24458
|
_proto.assembleItems = function assembleItems(composition) {
|
|
@@ -24546,7 +24614,6 @@ var listOrder = 0;
|
|
|
24546
24614
|
this.rootComposition = this.rootItem.addComponent(CompositionComponent);
|
|
24547
24615
|
this.rootComposition.data = sourceContent;
|
|
24548
24616
|
var imageUsage = !reusable && imgUsage;
|
|
24549
|
-
this.globalVolume = sourceContent.globalVolume;
|
|
24550
24617
|
this.width = width;
|
|
24551
24618
|
this.height = height;
|
|
24552
24619
|
this.renderOrder = baseRenderOrder;
|
|
@@ -24563,7 +24630,7 @@ var listOrder = 0;
|
|
|
24563
24630
|
};
|
|
24564
24631
|
this.reusable = reusable;
|
|
24565
24632
|
this.speed = speed;
|
|
24566
|
-
this.autoRefTex = !this.keepResource && imageUsage && this.rootItem.endBehavior !==
|
|
24633
|
+
this.autoRefTex = !this.keepResource && imageUsage && this.rootItem.endBehavior !== EndBehavior.restart;
|
|
24567
24634
|
this.name = sourceContent.name;
|
|
24568
24635
|
this.pluginSystem = pluginSystem;
|
|
24569
24636
|
this.pluginSystem.initializeComposition(this, scene);
|
|
@@ -24763,7 +24830,7 @@ var listOrder = 0;
|
|
|
24763
24830
|
* @returns 重新播放合成标志位
|
|
24764
24831
|
*/ _proto.shouldRestart = function shouldRestart() {
|
|
24765
24832
|
var _this_rootItem = this.rootItem, ended = _this_rootItem.ended, endBehavior = _this_rootItem.endBehavior;
|
|
24766
|
-
return ended && endBehavior ===
|
|
24833
|
+
return ended && endBehavior === EndBehavior.restart;
|
|
24767
24834
|
};
|
|
24768
24835
|
/**
|
|
24769
24836
|
* 是否合成需要销毁
|
|
@@ -24816,9 +24883,9 @@ var listOrder = 0;
|
|
|
24816
24883
|
var localTime = time - this.rootItem.start;
|
|
24817
24884
|
var duration = this.rootItem.duration;
|
|
24818
24885
|
if (localTime - duration > 0.001) {
|
|
24819
|
-
if (this.rootItem.endBehavior ===
|
|
24886
|
+
if (this.rootItem.endBehavior === EndBehavior.restart) {
|
|
24820
24887
|
localTime = localTime % duration;
|
|
24821
|
-
} else if (this.rootItem.endBehavior ===
|
|
24888
|
+
} else if (this.rootItem.endBehavior === EndBehavior.freeze) {
|
|
24822
24889
|
localTime = Math.min(duration, localTime);
|
|
24823
24890
|
}
|
|
24824
24891
|
}
|
|
@@ -24869,7 +24936,7 @@ var listOrder = 0;
|
|
|
24869
24936
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
24870
24937
|
var child = _step2.value;
|
|
24871
24938
|
if (exports.VFXItem.isComposition(child)) {
|
|
24872
|
-
if (child.ended && child.endBehavior ===
|
|
24939
|
+
if (child.ended && child.endBehavior === EndBehavior.restart) {
|
|
24873
24940
|
child.ended = false;
|
|
24874
24941
|
// TODO K帧动画在元素重建后需要 tick ,否则会导致元素位置和 k 帧第一帧位置不一致
|
|
24875
24942
|
this.callUpdate(child, 0);
|
|
@@ -25080,7 +25147,7 @@ var listOrder = 0;
|
|
|
25080
25147
|
var _this = this;
|
|
25081
25148
|
// 预合成元素销毁时销毁其中的item
|
|
25082
25149
|
if (item.type == ItemType.composition) {
|
|
25083
|
-
if (item.endBehavior !==
|
|
25150
|
+
if (item.endBehavior !== EndBehavior.freeze) {
|
|
25084
25151
|
var contentItems = item.getComponent(CompositionComponent).items;
|
|
25085
25152
|
contentItems.forEach(function(it) {
|
|
25086
25153
|
return _this.pluginSystem.plugins.forEach(function(loader) {
|
|
@@ -25339,65 +25406,1628 @@ var listOrder = 0;
|
|
|
25339
25406
|
return Composition;
|
|
25340
25407
|
}();
|
|
25341
25408
|
|
|
25342
|
-
|
|
25343
|
-
|
|
25344
|
-
|
|
25345
|
-
|
|
25346
|
-
|
|
25347
|
-
|
|
25348
|
-
|
|
25349
|
-
|
|
25350
|
-
|
|
25351
|
-
|
|
25352
|
-
|
|
25353
|
-
|
|
25354
|
-
|
|
25355
|
-
|
|
25356
|
-
|
|
25357
|
-
|
|
25358
|
-
|
|
25359
|
-
|
|
25409
|
+
var SIZEOF_SHORT = 2;
|
|
25410
|
+
var SIZEOF_INT = 4;
|
|
25411
|
+
var FILE_IDENTIFIER_LENGTH = 4;
|
|
25412
|
+
var SIZE_PREFIX_LENGTH = 4;
|
|
25413
|
+
|
|
25414
|
+
var int32 = new Int32Array(2);
|
|
25415
|
+
var float32 = new Float32Array(int32.buffer);
|
|
25416
|
+
var float64 = new Float64Array(int32.buffer);
|
|
25417
|
+
var isLittleEndian = new Uint16Array(new Uint8Array([
|
|
25418
|
+
1,
|
|
25419
|
+
0
|
|
25420
|
+
]).buffer)[0] === 1;
|
|
25421
|
+
|
|
25422
|
+
var Encoding;
|
|
25423
|
+
(function(Encoding) {
|
|
25424
|
+
Encoding[Encoding["UTF8_BYTES"] = 1] = "UTF8_BYTES";
|
|
25425
|
+
Encoding[Encoding["UTF16_STRING"] = 2] = "UTF16_STRING";
|
|
25426
|
+
})(Encoding || (Encoding = {}));
|
|
25427
|
+
|
|
25428
|
+
var ByteBuffer = /*#__PURE__*/ function() {
|
|
25429
|
+
function ByteBuffer(bytes_) {
|
|
25430
|
+
this.bytes_ = bytes_;
|
|
25431
|
+
this.position_ = 0;
|
|
25432
|
+
this.text_decoder_ = new TextDecoder();
|
|
25360
25433
|
}
|
|
25361
|
-
var _proto =
|
|
25362
|
-
_proto.
|
|
25363
|
-
this.
|
|
25364
|
-
this.objectInstance = {};
|
|
25434
|
+
var _proto = ByteBuffer.prototype;
|
|
25435
|
+
_proto.clear = function clear() {
|
|
25436
|
+
this.position_ = 0;
|
|
25365
25437
|
};
|
|
25366
|
-
|
|
25367
|
-
|
|
25438
|
+
/**
|
|
25439
|
+
* Get the underlying `Uint8Array`.
|
|
25440
|
+
*/ _proto.bytes = function bytes() {
|
|
25441
|
+
return this.bytes_;
|
|
25368
25442
|
};
|
|
25369
|
-
|
|
25370
|
-
|
|
25443
|
+
/**
|
|
25444
|
+
* Get the buffer's position.
|
|
25445
|
+
*/ _proto.position = function position() {
|
|
25446
|
+
return this.position_;
|
|
25371
25447
|
};
|
|
25372
|
-
|
|
25373
|
-
|
|
25448
|
+
/**
|
|
25449
|
+
* Set the buffer's position.
|
|
25450
|
+
*/ _proto.setPosition = function setPosition(position) {
|
|
25451
|
+
this.position_ = position;
|
|
25374
25452
|
};
|
|
25375
|
-
|
|
25376
|
-
|
|
25453
|
+
/**
|
|
25454
|
+
* Get the buffer's capacity.
|
|
25455
|
+
*/ _proto.capacity = function capacity() {
|
|
25456
|
+
return this.bytes_.length;
|
|
25377
25457
|
};
|
|
25378
|
-
_proto.
|
|
25379
|
-
|
|
25458
|
+
_proto.readInt8 = function readInt8(offset) {
|
|
25459
|
+
return this.readUint8(offset) << 24 >> 24;
|
|
25380
25460
|
};
|
|
25381
|
-
_proto.
|
|
25382
|
-
|
|
25383
|
-
|
|
25384
|
-
|
|
25385
|
-
|
|
25386
|
-
|
|
25387
|
-
|
|
25388
|
-
|
|
25389
|
-
|
|
25390
|
-
|
|
25461
|
+
_proto.readUint8 = function readUint8(offset) {
|
|
25462
|
+
return this.bytes_[offset];
|
|
25463
|
+
};
|
|
25464
|
+
_proto.readInt16 = function readInt16(offset) {
|
|
25465
|
+
return this.readUint16(offset) << 16 >> 16;
|
|
25466
|
+
};
|
|
25467
|
+
_proto.readUint16 = function readUint16(offset) {
|
|
25468
|
+
return this.bytes_[offset] | this.bytes_[offset + 1] << 8;
|
|
25469
|
+
};
|
|
25470
|
+
_proto.readInt32 = function readInt32(offset) {
|
|
25471
|
+
return this.bytes_[offset] | this.bytes_[offset + 1] << 8 | this.bytes_[offset + 2] << 16 | this.bytes_[offset + 3] << 24;
|
|
25472
|
+
};
|
|
25473
|
+
_proto.readUint32 = function readUint32(offset) {
|
|
25474
|
+
return this.readInt32(offset) >>> 0;
|
|
25475
|
+
};
|
|
25476
|
+
_proto.readInt64 = function readInt64(offset) {
|
|
25477
|
+
return BigInt.asIntN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
|
|
25478
|
+
};
|
|
25479
|
+
_proto.readUint64 = function readUint64(offset) {
|
|
25480
|
+
return BigInt.asUintN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
|
|
25481
|
+
};
|
|
25482
|
+
_proto.readFloat32 = function readFloat32(offset) {
|
|
25483
|
+
int32[0] = this.readInt32(offset);
|
|
25484
|
+
return float32[0];
|
|
25485
|
+
};
|
|
25486
|
+
_proto.readFloat64 = function readFloat64(offset) {
|
|
25487
|
+
int32[isLittleEndian ? 0 : 1] = this.readInt32(offset);
|
|
25488
|
+
int32[isLittleEndian ? 1 : 0] = this.readInt32(offset + 4);
|
|
25489
|
+
return float64[0];
|
|
25490
|
+
};
|
|
25491
|
+
_proto.writeInt8 = function writeInt8(offset, value) {
|
|
25492
|
+
this.bytes_[offset] = value;
|
|
25493
|
+
};
|
|
25494
|
+
_proto.writeUint8 = function writeUint8(offset, value) {
|
|
25495
|
+
this.bytes_[offset] = value;
|
|
25496
|
+
};
|
|
25497
|
+
_proto.writeInt16 = function writeInt16(offset, value) {
|
|
25498
|
+
this.bytes_[offset] = value;
|
|
25499
|
+
this.bytes_[offset + 1] = value >> 8;
|
|
25500
|
+
};
|
|
25501
|
+
_proto.writeUint16 = function writeUint16(offset, value) {
|
|
25502
|
+
this.bytes_[offset] = value;
|
|
25503
|
+
this.bytes_[offset + 1] = value >> 8;
|
|
25504
|
+
};
|
|
25505
|
+
_proto.writeInt32 = function writeInt32(offset, value) {
|
|
25506
|
+
this.bytes_[offset] = value;
|
|
25507
|
+
this.bytes_[offset + 1] = value >> 8;
|
|
25508
|
+
this.bytes_[offset + 2] = value >> 16;
|
|
25509
|
+
this.bytes_[offset + 3] = value >> 24;
|
|
25510
|
+
};
|
|
25511
|
+
_proto.writeUint32 = function writeUint32(offset, value) {
|
|
25512
|
+
this.bytes_[offset] = value;
|
|
25513
|
+
this.bytes_[offset + 1] = value >> 8;
|
|
25514
|
+
this.bytes_[offset + 2] = value >> 16;
|
|
25515
|
+
this.bytes_[offset + 3] = value >> 24;
|
|
25516
|
+
};
|
|
25517
|
+
_proto.writeInt64 = function writeInt64(offset, value) {
|
|
25518
|
+
this.writeInt32(offset, Number(BigInt.asIntN(32, value)));
|
|
25519
|
+
this.writeInt32(offset + 4, Number(BigInt.asIntN(32, value >> BigInt(32))));
|
|
25520
|
+
};
|
|
25521
|
+
_proto.writeUint64 = function writeUint64(offset, value) {
|
|
25522
|
+
this.writeUint32(offset, Number(BigInt.asUintN(32, value)));
|
|
25523
|
+
this.writeUint32(offset + 4, Number(BigInt.asUintN(32, value >> BigInt(32))));
|
|
25524
|
+
};
|
|
25525
|
+
_proto.writeFloat32 = function writeFloat32(offset, value) {
|
|
25526
|
+
float32[0] = value;
|
|
25527
|
+
this.writeInt32(offset, int32[0]);
|
|
25528
|
+
};
|
|
25529
|
+
_proto.writeFloat64 = function writeFloat64(offset, value) {
|
|
25530
|
+
float64[0] = value;
|
|
25531
|
+
this.writeInt32(offset, int32[isLittleEndian ? 0 : 1]);
|
|
25532
|
+
this.writeInt32(offset + 4, int32[isLittleEndian ? 1 : 0]);
|
|
25533
|
+
};
|
|
25534
|
+
/**
|
|
25535
|
+
* Return the file identifier. Behavior is undefined for FlatBuffers whose
|
|
25536
|
+
* schema does not include a file_identifier (likely points at padding or the
|
|
25537
|
+
* start of a the root vtable).
|
|
25538
|
+
*/ _proto.getBufferIdentifier = function getBufferIdentifier() {
|
|
25539
|
+
if (this.bytes_.length < this.position_ + SIZEOF_INT + FILE_IDENTIFIER_LENGTH) {
|
|
25540
|
+
throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");
|
|
25391
25541
|
}
|
|
25392
|
-
|
|
25393
|
-
|
|
25394
|
-
this.
|
|
25542
|
+
var result = "";
|
|
25543
|
+
for(var i = 0; i < FILE_IDENTIFIER_LENGTH; i++){
|
|
25544
|
+
result += String.fromCharCode(this.readInt8(this.position_ + SIZEOF_INT + i));
|
|
25395
25545
|
}
|
|
25396
|
-
|
|
25397
|
-
|
|
25398
|
-
|
|
25546
|
+
return result;
|
|
25547
|
+
};
|
|
25548
|
+
/**
|
|
25549
|
+
* Look up a field in the vtable, return an offset into the object, or 0 if the
|
|
25550
|
+
* field is not present.
|
|
25551
|
+
*/ _proto.__offset = function __offset(bb_pos, vtable_offset) {
|
|
25552
|
+
var vtable = bb_pos - this.readInt32(bb_pos);
|
|
25553
|
+
return vtable_offset < this.readInt16(vtable) ? this.readInt16(vtable + vtable_offset) : 0;
|
|
25554
|
+
};
|
|
25555
|
+
/**
|
|
25556
|
+
* Initialize any Table-derived type to point to the union at the given offset.
|
|
25557
|
+
*/ _proto.__union = function __union(t, offset) {
|
|
25558
|
+
t.bb_pos = offset + this.readInt32(offset);
|
|
25559
|
+
t.bb = this;
|
|
25560
|
+
return t;
|
|
25561
|
+
};
|
|
25562
|
+
/**
|
|
25563
|
+
* Create a JavaScript string from UTF-8 data stored inside the FlatBuffer.
|
|
25564
|
+
* This allocates a new string and converts to wide chars upon each access.
|
|
25565
|
+
*
|
|
25566
|
+
* To avoid the conversion to string, pass Encoding.UTF8_BYTES as the
|
|
25567
|
+
* "optionalEncoding" argument. This is useful for avoiding conversion when
|
|
25568
|
+
* the data will just be packaged back up in another FlatBuffer later on.
|
|
25569
|
+
*
|
|
25570
|
+
* @param offset
|
|
25571
|
+
* @param opt_encoding Defaults to UTF16_STRING
|
|
25572
|
+
*/ _proto.__string = function __string(offset, opt_encoding) {
|
|
25573
|
+
offset += this.readInt32(offset);
|
|
25574
|
+
var length = this.readInt32(offset);
|
|
25575
|
+
offset += SIZEOF_INT;
|
|
25576
|
+
var utf8bytes = this.bytes_.subarray(offset, offset + length);
|
|
25577
|
+
if (opt_encoding === Encoding.UTF8_BYTES) return utf8bytes;
|
|
25578
|
+
else return this.text_decoder_.decode(utf8bytes);
|
|
25579
|
+
};
|
|
25580
|
+
/**
|
|
25581
|
+
* Handle unions that can contain string as its member, if a Table-derived type then initialize it,
|
|
25582
|
+
* if a string then return a new one
|
|
25583
|
+
*
|
|
25584
|
+
* WARNING: strings are immutable in JS so we can't change the string that the user gave us, this
|
|
25585
|
+
* makes the behaviour of __union_with_string different compared to __union
|
|
25586
|
+
*/ _proto.__union_with_string = function __union_with_string(o, offset) {
|
|
25587
|
+
if (typeof o === "string") {
|
|
25588
|
+
return this.__string(offset);
|
|
25399
25589
|
}
|
|
25400
|
-
|
|
25590
|
+
return this.__union(o, offset);
|
|
25591
|
+
};
|
|
25592
|
+
/**
|
|
25593
|
+
* Retrieve the relative offset stored at "offset"
|
|
25594
|
+
*/ _proto.__indirect = function __indirect(offset) {
|
|
25595
|
+
return offset + this.readInt32(offset);
|
|
25596
|
+
};
|
|
25597
|
+
/**
|
|
25598
|
+
* Get the start of data of a vector whose offset is stored at "offset" in this object.
|
|
25599
|
+
*/ _proto.__vector = function __vector(offset) {
|
|
25600
|
+
return offset + this.readInt32(offset) + SIZEOF_INT; // data starts after the length
|
|
25601
|
+
};
|
|
25602
|
+
/**
|
|
25603
|
+
* Get the length of a vector whose offset is stored at "offset" in this object.
|
|
25604
|
+
*/ _proto.__vector_len = function __vector_len(offset) {
|
|
25605
|
+
return this.readInt32(offset + this.readInt32(offset));
|
|
25606
|
+
};
|
|
25607
|
+
_proto.__has_identifier = function __has_identifier(ident) {
|
|
25608
|
+
if (ident.length != FILE_IDENTIFIER_LENGTH) {
|
|
25609
|
+
throw new Error("FlatBuffers: file identifier must be length " + FILE_IDENTIFIER_LENGTH);
|
|
25610
|
+
}
|
|
25611
|
+
for(var i = 0; i < FILE_IDENTIFIER_LENGTH; i++){
|
|
25612
|
+
if (ident.charCodeAt(i) != this.readInt8(this.position() + SIZEOF_INT + i)) {
|
|
25613
|
+
return false;
|
|
25614
|
+
}
|
|
25615
|
+
}
|
|
25616
|
+
return true;
|
|
25617
|
+
};
|
|
25618
|
+
/**
|
|
25619
|
+
* A helper function for generating list for obj api
|
|
25620
|
+
*/ _proto.createScalarList = function createScalarList(listAccessor, listLength) {
|
|
25621
|
+
var ret = [];
|
|
25622
|
+
for(var i = 0; i < listLength; ++i){
|
|
25623
|
+
var val = listAccessor(i);
|
|
25624
|
+
if (val !== null) {
|
|
25625
|
+
ret.push(val);
|
|
25626
|
+
}
|
|
25627
|
+
}
|
|
25628
|
+
return ret;
|
|
25629
|
+
};
|
|
25630
|
+
/**
|
|
25631
|
+
* A helper function for generating list for obj api
|
|
25632
|
+
* @param listAccessor function that accepts an index and return data at that index
|
|
25633
|
+
* @param listLength listLength
|
|
25634
|
+
* @param res result list
|
|
25635
|
+
*/ _proto.createObjList = function createObjList(listAccessor, listLength) {
|
|
25636
|
+
var ret = [];
|
|
25637
|
+
for(var i = 0; i < listLength; ++i){
|
|
25638
|
+
var val = listAccessor(i);
|
|
25639
|
+
if (val !== null) {
|
|
25640
|
+
ret.push(val.unpack());
|
|
25641
|
+
}
|
|
25642
|
+
}
|
|
25643
|
+
return ret;
|
|
25644
|
+
};
|
|
25645
|
+
/**
|
|
25646
|
+
* Create and allocate a new ByteBuffer with a given size.
|
|
25647
|
+
*/ ByteBuffer.allocate = function allocate(byte_size) {
|
|
25648
|
+
return new ByteBuffer(new Uint8Array(byte_size));
|
|
25649
|
+
};
|
|
25650
|
+
return ByteBuffer;
|
|
25651
|
+
}();
|
|
25652
|
+
|
|
25653
|
+
var Builder = /*#__PURE__*/ function() {
|
|
25654
|
+
function Builder(opt_initial_size) {
|
|
25655
|
+
/** Minimum alignment encountered so far. */ this.minalign = 1;
|
|
25656
|
+
/** The vtable for the current table. */ this.vtable = null;
|
|
25657
|
+
/** The amount of fields we're actually using. */ this.vtable_in_use = 0;
|
|
25658
|
+
/** Whether we are currently serializing a table. */ this.isNested = false;
|
|
25659
|
+
/** Starting offset of the current struct/table. */ this.object_start = 0;
|
|
25660
|
+
/** List of offsets of all vtables. */ this.vtables = [];
|
|
25661
|
+
/** For the current vector being built. */ this.vector_num_elems = 0;
|
|
25662
|
+
/** False omits default values from the serialized data */ this.force_defaults = false;
|
|
25663
|
+
this.string_maps = null;
|
|
25664
|
+
this.text_encoder = new TextEncoder();
|
|
25665
|
+
var initial_size;
|
|
25666
|
+
if (!opt_initial_size) {
|
|
25667
|
+
initial_size = 1024;
|
|
25668
|
+
} else {
|
|
25669
|
+
initial_size = opt_initial_size;
|
|
25670
|
+
}
|
|
25671
|
+
/**
|
|
25672
|
+
* @type {ByteBuffer}
|
|
25673
|
+
* @private
|
|
25674
|
+
*/ this.bb = ByteBuffer.allocate(initial_size);
|
|
25675
|
+
this.space = initial_size;
|
|
25676
|
+
}
|
|
25677
|
+
var _proto = Builder.prototype;
|
|
25678
|
+
_proto.clear = function clear() {
|
|
25679
|
+
this.bb.clear();
|
|
25680
|
+
this.space = this.bb.capacity();
|
|
25681
|
+
this.minalign = 1;
|
|
25682
|
+
this.vtable = null;
|
|
25683
|
+
this.vtable_in_use = 0;
|
|
25684
|
+
this.isNested = false;
|
|
25685
|
+
this.object_start = 0;
|
|
25686
|
+
this.vtables = [];
|
|
25687
|
+
this.vector_num_elems = 0;
|
|
25688
|
+
this.force_defaults = false;
|
|
25689
|
+
this.string_maps = null;
|
|
25690
|
+
};
|
|
25691
|
+
/**
|
|
25692
|
+
* In order to save space, fields that are set to their default value
|
|
25693
|
+
* don't get serialized into the buffer. Forcing defaults provides a
|
|
25694
|
+
* way to manually disable this optimization.
|
|
25695
|
+
*
|
|
25696
|
+
* @param forceDefaults true always serializes default values
|
|
25697
|
+
*/ _proto.forceDefaults = function forceDefaults(forceDefaults) {
|
|
25698
|
+
this.force_defaults = forceDefaults;
|
|
25699
|
+
};
|
|
25700
|
+
/**
|
|
25701
|
+
* Get the ByteBuffer representing the FlatBuffer. Only call this after you've
|
|
25702
|
+
* called finish(). The actual data starts at the ByteBuffer's current position,
|
|
25703
|
+
* not necessarily at 0.
|
|
25704
|
+
*/ _proto.dataBuffer = function dataBuffer() {
|
|
25705
|
+
return this.bb;
|
|
25706
|
+
};
|
|
25707
|
+
/**
|
|
25708
|
+
* Get the bytes representing the FlatBuffer. Only call this after you've
|
|
25709
|
+
* called finish().
|
|
25710
|
+
*/ _proto.asUint8Array = function asUint8Array() {
|
|
25711
|
+
return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());
|
|
25712
|
+
};
|
|
25713
|
+
/**
|
|
25714
|
+
* Prepare to write an element of `size` after `additional_bytes` have been
|
|
25715
|
+
* written, e.g. if you write a string, you need to align such the int length
|
|
25716
|
+
* field is aligned to 4 bytes, and the string data follows it directly. If all
|
|
25717
|
+
* you need to do is alignment, `additional_bytes` will be 0.
|
|
25718
|
+
*
|
|
25719
|
+
* @param size This is the of the new element to write
|
|
25720
|
+
* @param additional_bytes The padding size
|
|
25721
|
+
*/ _proto.prep = function prep(size, additional_bytes) {
|
|
25722
|
+
// Track the biggest thing we've ever aligned to.
|
|
25723
|
+
if (size > this.minalign) {
|
|
25724
|
+
this.minalign = size;
|
|
25725
|
+
}
|
|
25726
|
+
// Find the amount of alignment needed such that `size` is properly
|
|
25727
|
+
// aligned after `additional_bytes`
|
|
25728
|
+
var align_size = ~(this.bb.capacity() - this.space + additional_bytes) + 1 & size - 1;
|
|
25729
|
+
// Reallocate the buffer if needed.
|
|
25730
|
+
while(this.space < align_size + size + additional_bytes){
|
|
25731
|
+
var old_buf_size = this.bb.capacity();
|
|
25732
|
+
this.bb = Builder.growByteBuffer(this.bb);
|
|
25733
|
+
this.space += this.bb.capacity() - old_buf_size;
|
|
25734
|
+
}
|
|
25735
|
+
this.pad(align_size);
|
|
25736
|
+
};
|
|
25737
|
+
_proto.pad = function pad(byte_size) {
|
|
25738
|
+
for(var i = 0; i < byte_size; i++){
|
|
25739
|
+
this.bb.writeInt8(--this.space, 0);
|
|
25740
|
+
}
|
|
25741
|
+
};
|
|
25742
|
+
_proto.writeInt8 = function writeInt8(value) {
|
|
25743
|
+
this.bb.writeInt8(this.space -= 1, value);
|
|
25744
|
+
};
|
|
25745
|
+
_proto.writeInt16 = function writeInt16(value) {
|
|
25746
|
+
this.bb.writeInt16(this.space -= 2, value);
|
|
25747
|
+
};
|
|
25748
|
+
_proto.writeInt32 = function writeInt32(value) {
|
|
25749
|
+
this.bb.writeInt32(this.space -= 4, value);
|
|
25750
|
+
};
|
|
25751
|
+
_proto.writeInt64 = function writeInt64(value) {
|
|
25752
|
+
this.bb.writeInt64(this.space -= 8, value);
|
|
25753
|
+
};
|
|
25754
|
+
_proto.writeFloat32 = function writeFloat32(value) {
|
|
25755
|
+
this.bb.writeFloat32(this.space -= 4, value);
|
|
25756
|
+
};
|
|
25757
|
+
_proto.writeFloat64 = function writeFloat64(value) {
|
|
25758
|
+
this.bb.writeFloat64(this.space -= 8, value);
|
|
25759
|
+
};
|
|
25760
|
+
/**
|
|
25761
|
+
* Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
25762
|
+
* @param value The `int8` to add the buffer.
|
|
25763
|
+
*/ _proto.addInt8 = function addInt8(value) {
|
|
25764
|
+
this.prep(1, 0);
|
|
25765
|
+
this.writeInt8(value);
|
|
25766
|
+
};
|
|
25767
|
+
/**
|
|
25768
|
+
* Add an `int16` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
25769
|
+
* @param value The `int16` to add the buffer.
|
|
25770
|
+
*/ _proto.addInt16 = function addInt16(value) {
|
|
25771
|
+
this.prep(2, 0);
|
|
25772
|
+
this.writeInt16(value);
|
|
25773
|
+
};
|
|
25774
|
+
/**
|
|
25775
|
+
* Add an `int32` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
25776
|
+
* @param value The `int32` to add the buffer.
|
|
25777
|
+
*/ _proto.addInt32 = function addInt32(value) {
|
|
25778
|
+
this.prep(4, 0);
|
|
25779
|
+
this.writeInt32(value);
|
|
25780
|
+
};
|
|
25781
|
+
/**
|
|
25782
|
+
* Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
25783
|
+
* @param value The `int64` to add the buffer.
|
|
25784
|
+
*/ _proto.addInt64 = function addInt64(value) {
|
|
25785
|
+
this.prep(8, 0);
|
|
25786
|
+
this.writeInt64(value);
|
|
25787
|
+
};
|
|
25788
|
+
/**
|
|
25789
|
+
* Add a `float32` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
25790
|
+
* @param value The `float32` to add the buffer.
|
|
25791
|
+
*/ _proto.addFloat32 = function addFloat32(value) {
|
|
25792
|
+
this.prep(4, 0);
|
|
25793
|
+
this.writeFloat32(value);
|
|
25794
|
+
};
|
|
25795
|
+
/**
|
|
25796
|
+
* Add a `float64` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
25797
|
+
* @param value The `float64` to add the buffer.
|
|
25798
|
+
*/ _proto.addFloat64 = function addFloat64(value) {
|
|
25799
|
+
this.prep(8, 0);
|
|
25800
|
+
this.writeFloat64(value);
|
|
25801
|
+
};
|
|
25802
|
+
_proto.addFieldInt8 = function addFieldInt8(voffset, value, defaultValue) {
|
|
25803
|
+
if (this.force_defaults || value != defaultValue) {
|
|
25804
|
+
this.addInt8(value);
|
|
25805
|
+
this.slot(voffset);
|
|
25806
|
+
}
|
|
25807
|
+
};
|
|
25808
|
+
_proto.addFieldInt16 = function addFieldInt16(voffset, value, defaultValue) {
|
|
25809
|
+
if (this.force_defaults || value != defaultValue) {
|
|
25810
|
+
this.addInt16(value);
|
|
25811
|
+
this.slot(voffset);
|
|
25812
|
+
}
|
|
25813
|
+
};
|
|
25814
|
+
_proto.addFieldInt32 = function addFieldInt32(voffset, value, defaultValue) {
|
|
25815
|
+
if (this.force_defaults || value != defaultValue) {
|
|
25816
|
+
this.addInt32(value);
|
|
25817
|
+
this.slot(voffset);
|
|
25818
|
+
}
|
|
25819
|
+
};
|
|
25820
|
+
_proto.addFieldInt64 = function addFieldInt64(voffset, value, defaultValue) {
|
|
25821
|
+
if (this.force_defaults || value !== defaultValue) {
|
|
25822
|
+
this.addInt64(value);
|
|
25823
|
+
this.slot(voffset);
|
|
25824
|
+
}
|
|
25825
|
+
};
|
|
25826
|
+
_proto.addFieldFloat32 = function addFieldFloat32(voffset, value, defaultValue) {
|
|
25827
|
+
if (this.force_defaults || value != defaultValue) {
|
|
25828
|
+
this.addFloat32(value);
|
|
25829
|
+
this.slot(voffset);
|
|
25830
|
+
}
|
|
25831
|
+
};
|
|
25832
|
+
_proto.addFieldFloat64 = function addFieldFloat64(voffset, value, defaultValue) {
|
|
25833
|
+
if (this.force_defaults || value != defaultValue) {
|
|
25834
|
+
this.addFloat64(value);
|
|
25835
|
+
this.slot(voffset);
|
|
25836
|
+
}
|
|
25837
|
+
};
|
|
25838
|
+
_proto.addFieldOffset = function addFieldOffset(voffset, value, defaultValue) {
|
|
25839
|
+
if (this.force_defaults || value != defaultValue) {
|
|
25840
|
+
this.addOffset(value);
|
|
25841
|
+
this.slot(voffset);
|
|
25842
|
+
}
|
|
25843
|
+
};
|
|
25844
|
+
/**
|
|
25845
|
+
* Structs are stored inline, so nothing additional is being added. `d` is always 0.
|
|
25846
|
+
*/ _proto.addFieldStruct = function addFieldStruct(voffset, value, defaultValue) {
|
|
25847
|
+
if (value != defaultValue) {
|
|
25848
|
+
this.nested(value);
|
|
25849
|
+
this.slot(voffset);
|
|
25850
|
+
}
|
|
25851
|
+
};
|
|
25852
|
+
/**
|
|
25853
|
+
* Structures are always stored inline, they need to be created right
|
|
25854
|
+
* where they're used. You'll get this assertion failure if you
|
|
25855
|
+
* created it elsewhere.
|
|
25856
|
+
*/ _proto.nested = function nested(obj) {
|
|
25857
|
+
if (obj != this.offset()) {
|
|
25858
|
+
throw new TypeError("FlatBuffers: struct must be serialized inline.");
|
|
25859
|
+
}
|
|
25860
|
+
};
|
|
25861
|
+
/**
|
|
25862
|
+
* Should not be creating any other object, string or vector
|
|
25863
|
+
* while an object is being constructed
|
|
25864
|
+
*/ _proto.notNested = function notNested() {
|
|
25865
|
+
if (this.isNested) {
|
|
25866
|
+
throw new TypeError("FlatBuffers: object serialization must not be nested.");
|
|
25867
|
+
}
|
|
25868
|
+
};
|
|
25869
|
+
/**
|
|
25870
|
+
* Set the current vtable at `voffset` to the current location in the buffer.
|
|
25871
|
+
*/ _proto.slot = function slot(voffset) {
|
|
25872
|
+
if (this.vtable !== null) this.vtable[voffset] = this.offset();
|
|
25873
|
+
};
|
|
25874
|
+
/**
|
|
25875
|
+
* @returns Offset relative to the end of the buffer.
|
|
25876
|
+
*/ _proto.offset = function offset() {
|
|
25877
|
+
return this.bb.capacity() - this.space;
|
|
25878
|
+
};
|
|
25879
|
+
/**
|
|
25880
|
+
* Adds on offset, relative to where it will be written.
|
|
25881
|
+
*
|
|
25882
|
+
* @param offset The offset to add.
|
|
25883
|
+
*/ _proto.addOffset = function addOffset(offset) {
|
|
25884
|
+
this.prep(SIZEOF_INT, 0); // Ensure alignment is already done.
|
|
25885
|
+
this.writeInt32(this.offset() - offset + SIZEOF_INT);
|
|
25886
|
+
};
|
|
25887
|
+
/**
|
|
25888
|
+
* Start encoding a new object in the buffer. Users will not usually need to
|
|
25889
|
+
* call this directly. The FlatBuffers compiler will generate helper methods
|
|
25890
|
+
* that call this method internally.
|
|
25891
|
+
*/ _proto.startObject = function startObject(numfields) {
|
|
25892
|
+
this.notNested();
|
|
25893
|
+
if (this.vtable == null) {
|
|
25894
|
+
this.vtable = [];
|
|
25895
|
+
}
|
|
25896
|
+
this.vtable_in_use = numfields;
|
|
25897
|
+
for(var i = 0; i < numfields; i++){
|
|
25898
|
+
this.vtable[i] = 0; // This will push additional elements as needed
|
|
25899
|
+
}
|
|
25900
|
+
this.isNested = true;
|
|
25901
|
+
this.object_start = this.offset();
|
|
25902
|
+
};
|
|
25903
|
+
/**
|
|
25904
|
+
* Finish off writing the object that is under construction.
|
|
25905
|
+
*
|
|
25906
|
+
* @returns The offset to the object inside `dataBuffer`
|
|
25907
|
+
*/ _proto.endObject = function endObject() {
|
|
25908
|
+
if (this.vtable == null || !this.isNested) {
|
|
25909
|
+
throw new Error("FlatBuffers: endObject called without startObject");
|
|
25910
|
+
}
|
|
25911
|
+
this.addInt32(0);
|
|
25912
|
+
var vtableloc = this.offset();
|
|
25913
|
+
// Trim trailing zeroes.
|
|
25914
|
+
var i = this.vtable_in_use - 1;
|
|
25915
|
+
// eslint-disable-next-line no-empty
|
|
25916
|
+
for(; i >= 0 && this.vtable[i] == 0; i--){}
|
|
25917
|
+
var trimmed_size = i + 1;
|
|
25918
|
+
// Write out the current vtable.
|
|
25919
|
+
for(; i >= 0; i--){
|
|
25920
|
+
// Offset relative to the start of the table.
|
|
25921
|
+
this.addInt16(this.vtable[i] != 0 ? vtableloc - this.vtable[i] : 0);
|
|
25922
|
+
}
|
|
25923
|
+
var standard_fields = 2; // The fields below:
|
|
25924
|
+
this.addInt16(vtableloc - this.object_start);
|
|
25925
|
+
var len = (trimmed_size + standard_fields) * SIZEOF_SHORT;
|
|
25926
|
+
this.addInt16(len);
|
|
25927
|
+
// Search for an existing vtable that matches the current one.
|
|
25928
|
+
var existing_vtable = 0;
|
|
25929
|
+
var vt1 = this.space;
|
|
25930
|
+
outer_loop: for(i = 0; i < this.vtables.length; i++){
|
|
25931
|
+
var vt2 = this.bb.capacity() - this.vtables[i];
|
|
25932
|
+
if (len == this.bb.readInt16(vt2)) {
|
|
25933
|
+
for(var j = SIZEOF_SHORT; j < len; j += SIZEOF_SHORT){
|
|
25934
|
+
if (this.bb.readInt16(vt1 + j) != this.bb.readInt16(vt2 + j)) {
|
|
25935
|
+
continue outer_loop;
|
|
25936
|
+
}
|
|
25937
|
+
}
|
|
25938
|
+
existing_vtable = this.vtables[i];
|
|
25939
|
+
break;
|
|
25940
|
+
}
|
|
25941
|
+
}
|
|
25942
|
+
if (existing_vtable) {
|
|
25943
|
+
// Found a match:
|
|
25944
|
+
// Remove the current vtable.
|
|
25945
|
+
this.space = this.bb.capacity() - vtableloc;
|
|
25946
|
+
// Point table to existing vtable.
|
|
25947
|
+
this.bb.writeInt32(this.space, existing_vtable - vtableloc);
|
|
25948
|
+
} else {
|
|
25949
|
+
// No match:
|
|
25950
|
+
// Add the location of the current vtable to the list of vtables.
|
|
25951
|
+
this.vtables.push(this.offset());
|
|
25952
|
+
// Point table to current vtable.
|
|
25953
|
+
this.bb.writeInt32(this.bb.capacity() - vtableloc, this.offset() - vtableloc);
|
|
25954
|
+
}
|
|
25955
|
+
this.isNested = false;
|
|
25956
|
+
return vtableloc;
|
|
25957
|
+
};
|
|
25958
|
+
/**
|
|
25959
|
+
* Finalize a buffer, poiting to the given `root_table`.
|
|
25960
|
+
*/ _proto.finish = function finish(root_table, opt_file_identifier, opt_size_prefix) {
|
|
25961
|
+
var size_prefix = opt_size_prefix ? SIZE_PREFIX_LENGTH : 0;
|
|
25962
|
+
if (opt_file_identifier) {
|
|
25963
|
+
var file_identifier = opt_file_identifier;
|
|
25964
|
+
this.prep(this.minalign, SIZEOF_INT + FILE_IDENTIFIER_LENGTH + size_prefix);
|
|
25965
|
+
if (file_identifier.length != FILE_IDENTIFIER_LENGTH) {
|
|
25966
|
+
throw new TypeError("FlatBuffers: file identifier must be length " + FILE_IDENTIFIER_LENGTH);
|
|
25967
|
+
}
|
|
25968
|
+
for(var i = FILE_IDENTIFIER_LENGTH - 1; i >= 0; i--){
|
|
25969
|
+
this.writeInt8(file_identifier.charCodeAt(i));
|
|
25970
|
+
}
|
|
25971
|
+
}
|
|
25972
|
+
this.prep(this.minalign, SIZEOF_INT + size_prefix);
|
|
25973
|
+
this.addOffset(root_table);
|
|
25974
|
+
if (size_prefix) {
|
|
25975
|
+
this.addInt32(this.bb.capacity() - this.space);
|
|
25976
|
+
}
|
|
25977
|
+
this.bb.setPosition(this.space);
|
|
25978
|
+
};
|
|
25979
|
+
/**
|
|
25980
|
+
* Finalize a size prefixed buffer, pointing to the given `root_table`.
|
|
25981
|
+
*/ _proto.finishSizePrefixed = function finishSizePrefixed(root_table, opt_file_identifier) {
|
|
25982
|
+
this.finish(root_table, opt_file_identifier, true);
|
|
25983
|
+
};
|
|
25984
|
+
/**
|
|
25985
|
+
* This checks a required field has been set in a given table that has
|
|
25986
|
+
* just been constructed.
|
|
25987
|
+
*/ _proto.requiredField = function requiredField(table, field) {
|
|
25988
|
+
var table_start = this.bb.capacity() - table;
|
|
25989
|
+
var vtable_start = table_start - this.bb.readInt32(table_start);
|
|
25990
|
+
var ok = field < this.bb.readInt16(vtable_start) && this.bb.readInt16(vtable_start + field) != 0;
|
|
25991
|
+
// If this fails, the caller will show what field needs to be set.
|
|
25992
|
+
if (!ok) {
|
|
25993
|
+
throw new TypeError("FlatBuffers: field " + field + " must be set");
|
|
25994
|
+
}
|
|
25995
|
+
};
|
|
25996
|
+
/**
|
|
25997
|
+
* Start a new array/vector of objects. Users usually will not call
|
|
25998
|
+
* this directly. The FlatBuffers compiler will create a start/end
|
|
25999
|
+
* method for vector types in generated code.
|
|
26000
|
+
*
|
|
26001
|
+
* @param elem_size The size of each element in the array
|
|
26002
|
+
* @param num_elems The number of elements in the array
|
|
26003
|
+
* @param alignment The alignment of the array
|
|
26004
|
+
*/ _proto.startVector = function startVector(elem_size, num_elems, alignment) {
|
|
26005
|
+
this.notNested();
|
|
26006
|
+
this.vector_num_elems = num_elems;
|
|
26007
|
+
this.prep(SIZEOF_INT, elem_size * num_elems);
|
|
26008
|
+
this.prep(alignment, elem_size * num_elems); // Just in case alignment > int.
|
|
26009
|
+
};
|
|
26010
|
+
/**
|
|
26011
|
+
* Finish off the creation of an array and all its elements. The array must be
|
|
26012
|
+
* created with `startVector`.
|
|
26013
|
+
*
|
|
26014
|
+
* @returns The offset at which the newly created array
|
|
26015
|
+
* starts.
|
|
26016
|
+
*/ _proto.endVector = function endVector() {
|
|
26017
|
+
this.writeInt32(this.vector_num_elems);
|
|
26018
|
+
return this.offset();
|
|
26019
|
+
};
|
|
26020
|
+
/**
|
|
26021
|
+
* Encode the string `s` in the buffer using UTF-8. If the string passed has
|
|
26022
|
+
* already been seen, we return the offset of the already written string
|
|
26023
|
+
*
|
|
26024
|
+
* @param s The string to encode
|
|
26025
|
+
* @return The offset in the buffer where the encoded string starts
|
|
26026
|
+
*/ _proto.createSharedString = function createSharedString(s) {
|
|
26027
|
+
if (!s) {
|
|
26028
|
+
return 0;
|
|
26029
|
+
}
|
|
26030
|
+
if (!this.string_maps) {
|
|
26031
|
+
this.string_maps = new Map();
|
|
26032
|
+
}
|
|
26033
|
+
if (this.string_maps.has(s)) {
|
|
26034
|
+
return this.string_maps.get(s);
|
|
26035
|
+
}
|
|
26036
|
+
var offset = this.createString(s);
|
|
26037
|
+
this.string_maps.set(s, offset);
|
|
26038
|
+
return offset;
|
|
26039
|
+
};
|
|
26040
|
+
/**
|
|
26041
|
+
* Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed
|
|
26042
|
+
* instead of a string, it is assumed to contain valid UTF-8 encoded data.
|
|
26043
|
+
*
|
|
26044
|
+
* @param s The string to encode
|
|
26045
|
+
* @return The offset in the buffer where the encoded string starts
|
|
26046
|
+
*/ _proto.createString = function createString(s) {
|
|
26047
|
+
if (s === null || s === undefined) {
|
|
26048
|
+
return 0;
|
|
26049
|
+
}
|
|
26050
|
+
var utf8;
|
|
26051
|
+
if (_instanceof1(s, Uint8Array)) {
|
|
26052
|
+
utf8 = s;
|
|
26053
|
+
} else {
|
|
26054
|
+
utf8 = this.text_encoder.encode(s);
|
|
26055
|
+
}
|
|
26056
|
+
this.addInt8(0);
|
|
26057
|
+
this.startVector(1, utf8.length, 1);
|
|
26058
|
+
this.bb.setPosition(this.space -= utf8.length);
|
|
26059
|
+
this.bb.bytes().set(utf8, this.space);
|
|
26060
|
+
return this.endVector();
|
|
26061
|
+
};
|
|
26062
|
+
/**
|
|
26063
|
+
* Create a byte vector.
|
|
26064
|
+
*
|
|
26065
|
+
* @param v The bytes to add
|
|
26066
|
+
* @returns The offset in the buffer where the byte vector starts
|
|
26067
|
+
*/ _proto.createByteVector = function createByteVector(v) {
|
|
26068
|
+
if (v === null || v === undefined) {
|
|
26069
|
+
return 0;
|
|
26070
|
+
}
|
|
26071
|
+
this.startVector(1, v.length, 1);
|
|
26072
|
+
this.bb.setPosition(this.space -= v.length);
|
|
26073
|
+
this.bb.bytes().set(v, this.space);
|
|
26074
|
+
return this.endVector();
|
|
26075
|
+
};
|
|
26076
|
+
/**
|
|
26077
|
+
* A helper function to pack an object
|
|
26078
|
+
*
|
|
26079
|
+
* @returns offset of obj
|
|
26080
|
+
*/ _proto.createObjectOffset = function createObjectOffset(obj) {
|
|
26081
|
+
if (obj === null) {
|
|
26082
|
+
return 0;
|
|
26083
|
+
}
|
|
26084
|
+
if (typeof obj === "string") {
|
|
26085
|
+
return this.createString(obj);
|
|
26086
|
+
} else {
|
|
26087
|
+
return obj.pack(this);
|
|
26088
|
+
}
|
|
26089
|
+
};
|
|
26090
|
+
/**
|
|
26091
|
+
* A helper function to pack a list of object
|
|
26092
|
+
*
|
|
26093
|
+
* @returns list of offsets of each non null object
|
|
26094
|
+
*/ _proto.createObjectOffsetList = function createObjectOffsetList(list) {
|
|
26095
|
+
var ret = [];
|
|
26096
|
+
for(var i = 0; i < list.length; ++i){
|
|
26097
|
+
var val = list[i];
|
|
26098
|
+
if (val !== null) {
|
|
26099
|
+
ret.push(this.createObjectOffset(val));
|
|
26100
|
+
} else {
|
|
26101
|
+
throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");
|
|
26102
|
+
}
|
|
26103
|
+
}
|
|
26104
|
+
return ret;
|
|
26105
|
+
};
|
|
26106
|
+
_proto.createStructOffsetList = function createStructOffsetList(list, startFunc) {
|
|
26107
|
+
startFunc(this, list.length);
|
|
26108
|
+
this.createObjectOffsetList(list.slice().reverse());
|
|
26109
|
+
return this.endVector();
|
|
26110
|
+
};
|
|
26111
|
+
/**
|
|
26112
|
+
* Doubles the size of the backing ByteBuffer and copies the old data towards
|
|
26113
|
+
* the end of the new buffer (since we build the buffer backwards).
|
|
26114
|
+
*
|
|
26115
|
+
* @param bb The current buffer with the existing data
|
|
26116
|
+
* @returns A new byte buffer with the old data copied
|
|
26117
|
+
* to it. The data is located at the end of the buffer.
|
|
26118
|
+
*
|
|
26119
|
+
* uint8Array.set() formally takes {Array<number>|ArrayBufferView}, so to pass
|
|
26120
|
+
* it a uint8Array we need to suppress the type check:
|
|
26121
|
+
* @suppress {checkTypes}
|
|
26122
|
+
*/ Builder.growByteBuffer = function growByteBuffer(bb) {
|
|
26123
|
+
var old_buf_size = bb.capacity();
|
|
26124
|
+
// Ensure we don't grow beyond what fits in an int.
|
|
26125
|
+
if (old_buf_size & 0xC0000000) {
|
|
26126
|
+
throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");
|
|
26127
|
+
}
|
|
26128
|
+
var new_buf_size = old_buf_size << 1;
|
|
26129
|
+
var nbb = ByteBuffer.allocate(new_buf_size);
|
|
26130
|
+
nbb.setPosition(new_buf_size - old_buf_size);
|
|
26131
|
+
nbb.bytes().set(bb.bytes(), new_buf_size - old_buf_size);
|
|
26132
|
+
return nbb;
|
|
26133
|
+
};
|
|
26134
|
+
return Builder;
|
|
26135
|
+
}();
|
|
26136
|
+
|
|
26137
|
+
// automatically generated by the FlatBuffers compiler, do not modify
|
|
26138
|
+
var FBEffectsObjectData = /*#__PURE__*/ function() {
|
|
26139
|
+
function FBEffectsObjectData() {
|
|
26140
|
+
this.bb = null;
|
|
26141
|
+
this.bb_pos = 0;
|
|
26142
|
+
}
|
|
26143
|
+
var _proto = FBEffectsObjectData.prototype;
|
|
26144
|
+
_proto.__init = function __init(i, bb) {
|
|
26145
|
+
this.bb_pos = i;
|
|
26146
|
+
this.bb = bb;
|
|
26147
|
+
return this;
|
|
26148
|
+
};
|
|
26149
|
+
_proto.dataType = function dataType(optionalEncoding) {
|
|
26150
|
+
var offset = this.bb.__offset(this.bb_pos, 4);
|
|
26151
|
+
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
26152
|
+
};
|
|
26153
|
+
_proto.data = function data(index) {
|
|
26154
|
+
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
26155
|
+
return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
|
|
26156
|
+
};
|
|
26157
|
+
_proto.dataLength = function dataLength() {
|
|
26158
|
+
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
26159
|
+
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
26160
|
+
};
|
|
26161
|
+
_proto.dataArray = function dataArray() {
|
|
26162
|
+
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
26163
|
+
return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
|
|
26164
|
+
};
|
|
26165
|
+
_proto.unpack = function unpack() {
|
|
26166
|
+
return new FBEffectsObjectDataT(this.dataType(), this.bb.createScalarList(this.data.bind(this), this.dataLength()));
|
|
26167
|
+
};
|
|
26168
|
+
_proto.unpackTo = function unpackTo(_o) {
|
|
26169
|
+
_o.dataType = this.dataType();
|
|
26170
|
+
_o.data = this.bb.createScalarList(this.data.bind(this), this.dataLength());
|
|
26171
|
+
};
|
|
26172
|
+
FBEffectsObjectData.getRootAsFBEffectsObjectData = function getRootAsFBEffectsObjectData(bb, obj) {
|
|
26173
|
+
return (obj || new FBEffectsObjectData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26174
|
+
};
|
|
26175
|
+
FBEffectsObjectData.getSizePrefixedRootAsFBEffectsObjectData = function getSizePrefixedRootAsFBEffectsObjectData(bb, obj) {
|
|
26176
|
+
bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
|
|
26177
|
+
return (obj || new FBEffectsObjectData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26178
|
+
};
|
|
26179
|
+
FBEffectsObjectData.startFBEffectsObjectData = function startFBEffectsObjectData(builder) {
|
|
26180
|
+
builder.startObject(2);
|
|
26181
|
+
};
|
|
26182
|
+
FBEffectsObjectData.addDataType = function addDataType(builder, dataTypeOffset) {
|
|
26183
|
+
builder.addFieldOffset(0, dataTypeOffset, 0);
|
|
26184
|
+
};
|
|
26185
|
+
FBEffectsObjectData.addData = function addData(builder, dataOffset) {
|
|
26186
|
+
builder.addFieldOffset(1, dataOffset, 0);
|
|
26187
|
+
};
|
|
26188
|
+
FBEffectsObjectData.createDataVector = function createDataVector(builder, data) {
|
|
26189
|
+
builder.startVector(1, data.length, 1);
|
|
26190
|
+
for(var i = data.length - 1; i >= 0; i--){
|
|
26191
|
+
builder.addInt8(data[i]);
|
|
26192
|
+
}
|
|
26193
|
+
return builder.endVector();
|
|
26194
|
+
};
|
|
26195
|
+
FBEffectsObjectData.startDataVector = function startDataVector(builder, numElems) {
|
|
26196
|
+
builder.startVector(1, numElems, 1);
|
|
26197
|
+
};
|
|
26198
|
+
FBEffectsObjectData.endFBEffectsObjectData = function endFBEffectsObjectData(builder) {
|
|
26199
|
+
var offset = builder.endObject();
|
|
26200
|
+
return offset;
|
|
26201
|
+
};
|
|
26202
|
+
FBEffectsObjectData.createFBEffectsObjectData = function createFBEffectsObjectData(builder, dataTypeOffset, dataOffset) {
|
|
26203
|
+
FBEffectsObjectData.startFBEffectsObjectData(builder);
|
|
26204
|
+
FBEffectsObjectData.addDataType(builder, dataTypeOffset);
|
|
26205
|
+
FBEffectsObjectData.addData(builder, dataOffset);
|
|
26206
|
+
return FBEffectsObjectData.endFBEffectsObjectData(builder);
|
|
26207
|
+
};
|
|
26208
|
+
return FBEffectsObjectData;
|
|
26209
|
+
}();
|
|
26210
|
+
var FBEffectsObjectDataT = /*#__PURE__*/ function() {
|
|
26211
|
+
function FBEffectsObjectDataT(dataType, data) {
|
|
26212
|
+
if (dataType === void 0) dataType = null;
|
|
26213
|
+
if (data === void 0) data = [];
|
|
26214
|
+
this.dataType = dataType;
|
|
26215
|
+
this.data = data;
|
|
26216
|
+
}
|
|
26217
|
+
var _proto = FBEffectsObjectDataT.prototype;
|
|
26218
|
+
_proto.pack = function pack(builder) {
|
|
26219
|
+
var dataType = this.dataType !== null ? builder.createString(this.dataType) : 0;
|
|
26220
|
+
var data = FBEffectsObjectData.createDataVector(builder, this.data);
|
|
26221
|
+
return FBEffectsObjectData.createFBEffectsObjectData(builder, dataType, data);
|
|
26222
|
+
};
|
|
26223
|
+
return FBEffectsObjectDataT;
|
|
26224
|
+
}();
|
|
26225
|
+
|
|
26226
|
+
// automatically generated by the FlatBuffers compiler, do not modify
|
|
26227
|
+
var FBEffectsPackageData = /*#__PURE__*/ function() {
|
|
26228
|
+
function FBEffectsPackageData() {
|
|
26229
|
+
this.bb = null;
|
|
26230
|
+
this.bb_pos = 0;
|
|
26231
|
+
}
|
|
26232
|
+
var _proto = FBEffectsPackageData.prototype;
|
|
26233
|
+
_proto.__init = function __init(i, bb) {
|
|
26234
|
+
this.bb_pos = i;
|
|
26235
|
+
this.bb = bb;
|
|
26236
|
+
return this;
|
|
26237
|
+
};
|
|
26238
|
+
_proto.exportObjects = function exportObjects(index, obj) {
|
|
26239
|
+
var offset = this.bb.__offset(this.bb_pos, 4);
|
|
26240
|
+
return offset ? (obj || new FBEffectsObjectData()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
|
|
26241
|
+
};
|
|
26242
|
+
_proto.exportObjectsLength = function exportObjectsLength() {
|
|
26243
|
+
var offset = this.bb.__offset(this.bb_pos, 4);
|
|
26244
|
+
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
26245
|
+
};
|
|
26246
|
+
_proto.unpack = function unpack() {
|
|
26247
|
+
return new FBEffectsPackageDataT(this.bb.createObjList(this.exportObjects.bind(this), this.exportObjectsLength()));
|
|
26248
|
+
};
|
|
26249
|
+
_proto.unpackTo = function unpackTo(_o) {
|
|
26250
|
+
_o.exportObjects = this.bb.createObjList(this.exportObjects.bind(this), this.exportObjectsLength());
|
|
26251
|
+
};
|
|
26252
|
+
FBEffectsPackageData.getRootAsFBEffectsPackageData = function getRootAsFBEffectsPackageData(bb, obj) {
|
|
26253
|
+
return (obj || new FBEffectsPackageData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26254
|
+
};
|
|
26255
|
+
FBEffectsPackageData.getSizePrefixedRootAsFBEffectsPackageData = function getSizePrefixedRootAsFBEffectsPackageData(bb, obj) {
|
|
26256
|
+
bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
|
|
26257
|
+
return (obj || new FBEffectsPackageData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26258
|
+
};
|
|
26259
|
+
FBEffectsPackageData.startFBEffectsPackageData = function startFBEffectsPackageData(builder) {
|
|
26260
|
+
builder.startObject(1);
|
|
26261
|
+
};
|
|
26262
|
+
FBEffectsPackageData.addExportObjects = function addExportObjects(builder, exportObjectsOffset) {
|
|
26263
|
+
builder.addFieldOffset(0, exportObjectsOffset, 0);
|
|
26264
|
+
};
|
|
26265
|
+
FBEffectsPackageData.createExportObjectsVector = function createExportObjectsVector(builder, data) {
|
|
26266
|
+
builder.startVector(4, data.length, 4);
|
|
26267
|
+
for(var i = data.length - 1; i >= 0; i--){
|
|
26268
|
+
builder.addOffset(data[i]);
|
|
26269
|
+
}
|
|
26270
|
+
return builder.endVector();
|
|
26271
|
+
};
|
|
26272
|
+
FBEffectsPackageData.startExportObjectsVector = function startExportObjectsVector(builder, numElems) {
|
|
26273
|
+
builder.startVector(4, numElems, 4);
|
|
26274
|
+
};
|
|
26275
|
+
FBEffectsPackageData.endFBEffectsPackageData = function endFBEffectsPackageData(builder) {
|
|
26276
|
+
var offset = builder.endObject();
|
|
26277
|
+
return offset;
|
|
26278
|
+
};
|
|
26279
|
+
FBEffectsPackageData.finishFBEffectsPackageDataBuffer = function finishFBEffectsPackageDataBuffer(builder, offset) {
|
|
26280
|
+
builder.finish(offset);
|
|
26281
|
+
};
|
|
26282
|
+
FBEffectsPackageData.finishSizePrefixedFBEffectsPackageDataBuffer = function finishSizePrefixedFBEffectsPackageDataBuffer(builder, offset) {
|
|
26283
|
+
builder.finish(offset, undefined, true);
|
|
26284
|
+
};
|
|
26285
|
+
FBEffectsPackageData.createFBEffectsPackageData = function createFBEffectsPackageData(builder, exportObjectsOffset) {
|
|
26286
|
+
FBEffectsPackageData.startFBEffectsPackageData(builder);
|
|
26287
|
+
FBEffectsPackageData.addExportObjects(builder, exportObjectsOffset);
|
|
26288
|
+
return FBEffectsPackageData.endFBEffectsPackageData(builder);
|
|
26289
|
+
};
|
|
26290
|
+
return FBEffectsPackageData;
|
|
26291
|
+
}();
|
|
26292
|
+
var FBEffectsPackageDataT = /*#__PURE__*/ function() {
|
|
26293
|
+
function FBEffectsPackageDataT(exportObjects) {
|
|
26294
|
+
if (exportObjects === void 0) exportObjects = [];
|
|
26295
|
+
this.exportObjects = exportObjects;
|
|
26296
|
+
}
|
|
26297
|
+
var _proto = FBEffectsPackageDataT.prototype;
|
|
26298
|
+
_proto.pack = function pack(builder) {
|
|
26299
|
+
var exportObjects = FBEffectsPackageData.createExportObjectsVector(builder, builder.createObjectOffsetList(this.exportObjects));
|
|
26300
|
+
return FBEffectsPackageData.createFBEffectsPackageData(builder, exportObjects);
|
|
26301
|
+
};
|
|
26302
|
+
return FBEffectsPackageDataT;
|
|
26303
|
+
}();
|
|
26304
|
+
|
|
26305
|
+
// automatically generated by the FlatBuffers compiler, do not modify
|
|
26306
|
+
var FBSubMesh = /*#__PURE__*/ function() {
|
|
26307
|
+
function FBSubMesh() {
|
|
26308
|
+
this.bb = null;
|
|
26309
|
+
this.bb_pos = 0;
|
|
26310
|
+
}
|
|
26311
|
+
var _proto = FBSubMesh.prototype;
|
|
26312
|
+
_proto.__init = function __init(i, bb) {
|
|
26313
|
+
this.bb_pos = i;
|
|
26314
|
+
this.bb = bb;
|
|
26315
|
+
return this;
|
|
26316
|
+
};
|
|
26317
|
+
_proto.offset = function offset() {
|
|
26318
|
+
var offset = this.bb.__offset(this.bb_pos, 4);
|
|
26319
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26320
|
+
};
|
|
26321
|
+
_proto.indexCount = function indexCount() {
|
|
26322
|
+
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
26323
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26324
|
+
};
|
|
26325
|
+
_proto.vertexCount = function vertexCount() {
|
|
26326
|
+
var offset = this.bb.__offset(this.bb_pos, 8);
|
|
26327
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26328
|
+
};
|
|
26329
|
+
_proto.unpack = function unpack() {
|
|
26330
|
+
return new FBSubMeshT(this.offset(), this.indexCount(), this.vertexCount());
|
|
26331
|
+
};
|
|
26332
|
+
_proto.unpackTo = function unpackTo(_o) {
|
|
26333
|
+
_o.offset = this.offset();
|
|
26334
|
+
_o.indexCount = this.indexCount();
|
|
26335
|
+
_o.vertexCount = this.vertexCount();
|
|
26336
|
+
};
|
|
26337
|
+
FBSubMesh.getRootAsFBSubMesh = function getRootAsFBSubMesh(bb, obj) {
|
|
26338
|
+
return (obj || new FBSubMesh()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26339
|
+
};
|
|
26340
|
+
FBSubMesh.getSizePrefixedRootAsFBSubMesh = function getSizePrefixedRootAsFBSubMesh(bb, obj) {
|
|
26341
|
+
bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
|
|
26342
|
+
return (obj || new FBSubMesh()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26343
|
+
};
|
|
26344
|
+
FBSubMesh.startFBSubMesh = function startFBSubMesh(builder) {
|
|
26345
|
+
builder.startObject(3);
|
|
26346
|
+
};
|
|
26347
|
+
FBSubMesh.addOffset = function addOffset(builder, offset) {
|
|
26348
|
+
builder.addFieldInt32(0, offset, 0);
|
|
26349
|
+
};
|
|
26350
|
+
FBSubMesh.addIndexCount = function addIndexCount(builder, indexCount) {
|
|
26351
|
+
builder.addFieldInt32(1, indexCount, 0);
|
|
26352
|
+
};
|
|
26353
|
+
FBSubMesh.addVertexCount = function addVertexCount(builder, vertexCount) {
|
|
26354
|
+
builder.addFieldInt32(2, vertexCount, 0);
|
|
26355
|
+
};
|
|
26356
|
+
FBSubMesh.endFBSubMesh = function endFBSubMesh(builder) {
|
|
26357
|
+
var offset = builder.endObject();
|
|
26358
|
+
return offset;
|
|
26359
|
+
};
|
|
26360
|
+
FBSubMesh.createFBSubMesh = function createFBSubMesh(builder, offset, indexCount, vertexCount) {
|
|
26361
|
+
FBSubMesh.startFBSubMesh(builder);
|
|
26362
|
+
FBSubMesh.addOffset(builder, offset);
|
|
26363
|
+
FBSubMesh.addIndexCount(builder, indexCount);
|
|
26364
|
+
FBSubMesh.addVertexCount(builder, vertexCount);
|
|
26365
|
+
return FBSubMesh.endFBSubMesh(builder);
|
|
26366
|
+
};
|
|
26367
|
+
return FBSubMesh;
|
|
26368
|
+
}();
|
|
26369
|
+
var FBSubMeshT = /*#__PURE__*/ function() {
|
|
26370
|
+
function FBSubMeshT(offset, indexCount, vertexCount) {
|
|
26371
|
+
if (offset === void 0) offset = 0;
|
|
26372
|
+
if (indexCount === void 0) indexCount = 0;
|
|
26373
|
+
if (vertexCount === void 0) vertexCount = 0;
|
|
26374
|
+
this.offset = offset;
|
|
26375
|
+
this.indexCount = indexCount;
|
|
26376
|
+
this.vertexCount = vertexCount;
|
|
26377
|
+
}
|
|
26378
|
+
var _proto = FBSubMeshT.prototype;
|
|
26379
|
+
_proto.pack = function pack(builder) {
|
|
26380
|
+
return FBSubMesh.createFBSubMesh(builder, this.offset, this.indexCount, this.vertexCount);
|
|
26381
|
+
};
|
|
26382
|
+
return FBSubMeshT;
|
|
26383
|
+
}();
|
|
26384
|
+
|
|
26385
|
+
// automatically generated by the FlatBuffers compiler, do not modify
|
|
26386
|
+
var FBVertexChannel = /*#__PURE__*/ function() {
|
|
26387
|
+
function FBVertexChannel() {
|
|
26388
|
+
this.bb = null;
|
|
26389
|
+
this.bb_pos = 0;
|
|
26390
|
+
}
|
|
26391
|
+
var _proto = FBVertexChannel.prototype;
|
|
26392
|
+
_proto.__init = function __init(i, bb) {
|
|
26393
|
+
this.bb_pos = i;
|
|
26394
|
+
this.bb = bb;
|
|
26395
|
+
return this;
|
|
26396
|
+
};
|
|
26397
|
+
_proto.semantic = function semantic(optionalEncoding) {
|
|
26398
|
+
var offset = this.bb.__offset(this.bb_pos, 4);
|
|
26399
|
+
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
26400
|
+
};
|
|
26401
|
+
_proto.offset = function offset() {
|
|
26402
|
+
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
26403
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26404
|
+
};
|
|
26405
|
+
_proto.format = function format() {
|
|
26406
|
+
var offset = this.bb.__offset(this.bb_pos, 8);
|
|
26407
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26408
|
+
};
|
|
26409
|
+
_proto.dimension = function dimension() {
|
|
26410
|
+
var offset = this.bb.__offset(this.bb_pos, 10);
|
|
26411
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26412
|
+
};
|
|
26413
|
+
_proto.normalize = function normalize() {
|
|
26414
|
+
var offset = this.bb.__offset(this.bb_pos, 12);
|
|
26415
|
+
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
|
|
26416
|
+
};
|
|
26417
|
+
_proto.unpack = function unpack() {
|
|
26418
|
+
return new FBVertexChannelT(this.semantic(), this.offset(), this.format(), this.dimension(), this.normalize());
|
|
26419
|
+
};
|
|
26420
|
+
_proto.unpackTo = function unpackTo(_o) {
|
|
26421
|
+
_o.semantic = this.semantic();
|
|
26422
|
+
_o.offset = this.offset();
|
|
26423
|
+
_o.format = this.format();
|
|
26424
|
+
_o.dimension = this.dimension();
|
|
26425
|
+
_o.normalize = this.normalize();
|
|
26426
|
+
};
|
|
26427
|
+
FBVertexChannel.getRootAsFBVertexChannel = function getRootAsFBVertexChannel(bb, obj) {
|
|
26428
|
+
return (obj || new FBVertexChannel()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26429
|
+
};
|
|
26430
|
+
FBVertexChannel.getSizePrefixedRootAsFBVertexChannel = function getSizePrefixedRootAsFBVertexChannel(bb, obj) {
|
|
26431
|
+
bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
|
|
26432
|
+
return (obj || new FBVertexChannel()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26433
|
+
};
|
|
26434
|
+
FBVertexChannel.startFBVertexChannel = function startFBVertexChannel(builder) {
|
|
26435
|
+
builder.startObject(5);
|
|
26436
|
+
};
|
|
26437
|
+
FBVertexChannel.addSemantic = function addSemantic(builder, semanticOffset) {
|
|
26438
|
+
builder.addFieldOffset(0, semanticOffset, 0);
|
|
26439
|
+
};
|
|
26440
|
+
FBVertexChannel.addOffset = function addOffset(builder, offset) {
|
|
26441
|
+
builder.addFieldInt32(1, offset, 0);
|
|
26442
|
+
};
|
|
26443
|
+
FBVertexChannel.addFormat = function addFormat(builder, format) {
|
|
26444
|
+
builder.addFieldInt32(2, format, 0);
|
|
26445
|
+
};
|
|
26446
|
+
FBVertexChannel.addDimension = function addDimension(builder, dimension) {
|
|
26447
|
+
builder.addFieldInt32(3, dimension, 0);
|
|
26448
|
+
};
|
|
26449
|
+
FBVertexChannel.addNormalize = function addNormalize(builder, normalize) {
|
|
26450
|
+
builder.addFieldInt8(4, +normalize, +false);
|
|
26451
|
+
};
|
|
26452
|
+
FBVertexChannel.endFBVertexChannel = function endFBVertexChannel(builder) {
|
|
26453
|
+
var offset = builder.endObject();
|
|
26454
|
+
return offset;
|
|
26455
|
+
};
|
|
26456
|
+
FBVertexChannel.createFBVertexChannel = function createFBVertexChannel(builder, semanticOffset, offset, format, dimension, normalize) {
|
|
26457
|
+
FBVertexChannel.startFBVertexChannel(builder);
|
|
26458
|
+
FBVertexChannel.addSemantic(builder, semanticOffset);
|
|
26459
|
+
FBVertexChannel.addOffset(builder, offset);
|
|
26460
|
+
FBVertexChannel.addFormat(builder, format);
|
|
26461
|
+
FBVertexChannel.addDimension(builder, dimension);
|
|
26462
|
+
FBVertexChannel.addNormalize(builder, normalize);
|
|
26463
|
+
return FBVertexChannel.endFBVertexChannel(builder);
|
|
26464
|
+
};
|
|
26465
|
+
return FBVertexChannel;
|
|
26466
|
+
}();
|
|
26467
|
+
var FBVertexChannelT = /*#__PURE__*/ function() {
|
|
26468
|
+
function FBVertexChannelT(semantic, offset, format, dimension, normalize) {
|
|
26469
|
+
if (semantic === void 0) semantic = null;
|
|
26470
|
+
if (offset === void 0) offset = 0;
|
|
26471
|
+
if (format === void 0) format = 0;
|
|
26472
|
+
if (dimension === void 0) dimension = 0;
|
|
26473
|
+
if (normalize === void 0) normalize = false;
|
|
26474
|
+
this.semantic = semantic;
|
|
26475
|
+
this.offset = offset;
|
|
26476
|
+
this.format = format;
|
|
26477
|
+
this.dimension = dimension;
|
|
26478
|
+
this.normalize = normalize;
|
|
26479
|
+
}
|
|
26480
|
+
var _proto = FBVertexChannelT.prototype;
|
|
26481
|
+
_proto.pack = function pack(builder) {
|
|
26482
|
+
var semantic = this.semantic !== null ? builder.createString(this.semantic) : 0;
|
|
26483
|
+
return FBVertexChannel.createFBVertexChannel(builder, semantic, this.offset, this.format, this.dimension, this.normalize);
|
|
26484
|
+
};
|
|
26485
|
+
return FBVertexChannelT;
|
|
26486
|
+
}();
|
|
26487
|
+
|
|
26488
|
+
// automatically generated by the FlatBuffers compiler, do not modify
|
|
26489
|
+
var FBVertexData = /*#__PURE__*/ function() {
|
|
26490
|
+
function FBVertexData() {
|
|
26491
|
+
this.bb = null;
|
|
26492
|
+
this.bb_pos = 0;
|
|
26493
|
+
}
|
|
26494
|
+
var _proto = FBVertexData.prototype;
|
|
26495
|
+
_proto.__init = function __init(i, bb) {
|
|
26496
|
+
this.bb_pos = i;
|
|
26497
|
+
this.bb = bb;
|
|
26498
|
+
return this;
|
|
26499
|
+
};
|
|
26500
|
+
_proto.vertexCount = function vertexCount() {
|
|
26501
|
+
var offset = this.bb.__offset(this.bb_pos, 4);
|
|
26502
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26503
|
+
};
|
|
26504
|
+
_proto.channels = function channels(index, obj) {
|
|
26505
|
+
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
26506
|
+
return offset ? (obj || new FBVertexChannel()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
|
|
26507
|
+
};
|
|
26508
|
+
_proto.channelsLength = function channelsLength() {
|
|
26509
|
+
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
26510
|
+
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
26511
|
+
};
|
|
26512
|
+
_proto.unpack = function unpack() {
|
|
26513
|
+
return new FBVertexDataT(this.vertexCount(), this.bb.createObjList(this.channels.bind(this), this.channelsLength()));
|
|
26514
|
+
};
|
|
26515
|
+
_proto.unpackTo = function unpackTo(_o) {
|
|
26516
|
+
_o.vertexCount = this.vertexCount();
|
|
26517
|
+
_o.channels = this.bb.createObjList(this.channels.bind(this), this.channelsLength());
|
|
26518
|
+
};
|
|
26519
|
+
FBVertexData.getRootAsFBVertexData = function getRootAsFBVertexData(bb, obj) {
|
|
26520
|
+
return (obj || new FBVertexData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26521
|
+
};
|
|
26522
|
+
FBVertexData.getSizePrefixedRootAsFBVertexData = function getSizePrefixedRootAsFBVertexData(bb, obj) {
|
|
26523
|
+
bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
|
|
26524
|
+
return (obj || new FBVertexData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26525
|
+
};
|
|
26526
|
+
FBVertexData.startFBVertexData = function startFBVertexData(builder) {
|
|
26527
|
+
builder.startObject(2);
|
|
26528
|
+
};
|
|
26529
|
+
FBVertexData.addVertexCount = function addVertexCount(builder, vertexCount) {
|
|
26530
|
+
builder.addFieldInt32(0, vertexCount, 0);
|
|
26531
|
+
};
|
|
26532
|
+
FBVertexData.addChannels = function addChannels(builder, channelsOffset) {
|
|
26533
|
+
builder.addFieldOffset(1, channelsOffset, 0);
|
|
26534
|
+
};
|
|
26535
|
+
FBVertexData.createChannelsVector = function createChannelsVector(builder, data) {
|
|
26536
|
+
builder.startVector(4, data.length, 4);
|
|
26537
|
+
for(var i = data.length - 1; i >= 0; i--){
|
|
26538
|
+
builder.addOffset(data[i]);
|
|
26539
|
+
}
|
|
26540
|
+
return builder.endVector();
|
|
26541
|
+
};
|
|
26542
|
+
FBVertexData.startChannelsVector = function startChannelsVector(builder, numElems) {
|
|
26543
|
+
builder.startVector(4, numElems, 4);
|
|
26544
|
+
};
|
|
26545
|
+
FBVertexData.endFBVertexData = function endFBVertexData(builder) {
|
|
26546
|
+
var offset = builder.endObject();
|
|
26547
|
+
return offset;
|
|
26548
|
+
};
|
|
26549
|
+
FBVertexData.createFBVertexData = function createFBVertexData(builder, vertexCount, channelsOffset) {
|
|
26550
|
+
FBVertexData.startFBVertexData(builder);
|
|
26551
|
+
FBVertexData.addVertexCount(builder, vertexCount);
|
|
26552
|
+
FBVertexData.addChannels(builder, channelsOffset);
|
|
26553
|
+
return FBVertexData.endFBVertexData(builder);
|
|
26554
|
+
};
|
|
26555
|
+
return FBVertexData;
|
|
26556
|
+
}();
|
|
26557
|
+
var FBVertexDataT = /*#__PURE__*/ function() {
|
|
26558
|
+
function FBVertexDataT(vertexCount, channels) {
|
|
26559
|
+
if (vertexCount === void 0) vertexCount = 0;
|
|
26560
|
+
if (channels === void 0) channels = [];
|
|
26561
|
+
this.vertexCount = vertexCount;
|
|
26562
|
+
this.channels = channels;
|
|
26563
|
+
}
|
|
26564
|
+
var _proto = FBVertexDataT.prototype;
|
|
26565
|
+
_proto.pack = function pack(builder) {
|
|
26566
|
+
var channels = FBVertexData.createChannelsVector(builder, builder.createObjectOffsetList(this.channels));
|
|
26567
|
+
return FBVertexData.createFBVertexData(builder, this.vertexCount, channels);
|
|
26568
|
+
};
|
|
26569
|
+
return FBVertexDataT;
|
|
26570
|
+
}();
|
|
26571
|
+
|
|
26572
|
+
// automatically generated by the FlatBuffers compiler, do not modify
|
|
26573
|
+
var FBGeometryData = /*#__PURE__*/ function() {
|
|
26574
|
+
function FBGeometryData() {
|
|
26575
|
+
this.bb = null;
|
|
26576
|
+
this.bb_pos = 0;
|
|
26577
|
+
}
|
|
26578
|
+
var _proto = FBGeometryData.prototype;
|
|
26579
|
+
_proto.__init = function __init(i, bb) {
|
|
26580
|
+
this.bb_pos = i;
|
|
26581
|
+
this.bb = bb;
|
|
26582
|
+
return this;
|
|
26583
|
+
};
|
|
26584
|
+
_proto.id = function id(optionalEncoding) {
|
|
26585
|
+
var offset = this.bb.__offset(this.bb_pos, 4);
|
|
26586
|
+
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
26587
|
+
};
|
|
26588
|
+
_proto.name = function name(optionalEncoding) {
|
|
26589
|
+
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
26590
|
+
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
26591
|
+
};
|
|
26592
|
+
_proto.vertexData = function vertexData(obj) {
|
|
26593
|
+
var offset = this.bb.__offset(this.bb_pos, 8);
|
|
26594
|
+
return offset ? (obj || new FBVertexData()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
|
|
26595
|
+
};
|
|
26596
|
+
_proto.indexFormat = function indexFormat() {
|
|
26597
|
+
var offset = this.bb.__offset(this.bb_pos, 10);
|
|
26598
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26599
|
+
};
|
|
26600
|
+
_proto.indexOffset = function indexOffset() {
|
|
26601
|
+
var offset = this.bb.__offset(this.bb_pos, 12);
|
|
26602
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26603
|
+
};
|
|
26604
|
+
_proto.subMeshes = function subMeshes(index, obj) {
|
|
26605
|
+
var offset = this.bb.__offset(this.bb_pos, 14);
|
|
26606
|
+
return offset ? (obj || new FBSubMesh()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
|
|
26607
|
+
};
|
|
26608
|
+
_proto.subMeshesLength = function subMeshesLength() {
|
|
26609
|
+
var offset = this.bb.__offset(this.bb_pos, 14);
|
|
26610
|
+
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
26611
|
+
};
|
|
26612
|
+
_proto.mode = function mode() {
|
|
26613
|
+
var offset = this.bb.__offset(this.bb_pos, 16);
|
|
26614
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26615
|
+
};
|
|
26616
|
+
_proto.buffer = function buffer(optionalEncoding) {
|
|
26617
|
+
var offset = this.bb.__offset(this.bb_pos, 18);
|
|
26618
|
+
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
26619
|
+
};
|
|
26620
|
+
_proto.binaryData = function binaryData(index) {
|
|
26621
|
+
var offset = this.bb.__offset(this.bb_pos, 20);
|
|
26622
|
+
return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
|
|
26623
|
+
};
|
|
26624
|
+
_proto.binaryDataLength = function binaryDataLength() {
|
|
26625
|
+
var offset = this.bb.__offset(this.bb_pos, 20);
|
|
26626
|
+
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
26627
|
+
};
|
|
26628
|
+
_proto.binaryDataArray = function binaryDataArray() {
|
|
26629
|
+
var offset = this.bb.__offset(this.bb_pos, 20);
|
|
26630
|
+
return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
|
|
26631
|
+
};
|
|
26632
|
+
_proto.boneNames = function boneNames(index, optionalEncoding) {
|
|
26633
|
+
var offset = this.bb.__offset(this.bb_pos, 22);
|
|
26634
|
+
return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
|
|
26635
|
+
};
|
|
26636
|
+
_proto.boneNamesLength = function boneNamesLength() {
|
|
26637
|
+
var offset = this.bb.__offset(this.bb_pos, 22);
|
|
26638
|
+
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
26639
|
+
};
|
|
26640
|
+
_proto.rootBoneName = function rootBoneName(optionalEncoding) {
|
|
26641
|
+
var offset = this.bb.__offset(this.bb_pos, 24);
|
|
26642
|
+
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
26643
|
+
};
|
|
26644
|
+
_proto.inverseBindMatrices = function inverseBindMatrices(index) {
|
|
26645
|
+
var offset = this.bb.__offset(this.bb_pos, 26);
|
|
26646
|
+
return offset ? this.bb.readFloat32(this.bb.__vector(this.bb_pos + offset) + index * 4) : 0;
|
|
26647
|
+
};
|
|
26648
|
+
_proto.inverseBindMatricesLength = function inverseBindMatricesLength() {
|
|
26649
|
+
var offset = this.bb.__offset(this.bb_pos, 26);
|
|
26650
|
+
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
26651
|
+
};
|
|
26652
|
+
_proto.inverseBindMatricesArray = function inverseBindMatricesArray() {
|
|
26653
|
+
var offset = this.bb.__offset(this.bb_pos, 26);
|
|
26654
|
+
return offset ? new Float32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
|
|
26655
|
+
};
|
|
26656
|
+
_proto.unpack = function unpack() {
|
|
26657
|
+
return new FBGeometryDataT(this.id(), this.name(), this.vertexData() !== null ? this.vertexData().unpack() : null, this.indexFormat(), this.indexOffset(), this.bb.createObjList(this.subMeshes.bind(this), this.subMeshesLength()), this.mode(), this.buffer(), this.bb.createScalarList(this.binaryData.bind(this), this.binaryDataLength()), this.bb.createScalarList(this.boneNames.bind(this), this.boneNamesLength()), this.rootBoneName(), this.bb.createScalarList(this.inverseBindMatrices.bind(this), this.inverseBindMatricesLength()));
|
|
26658
|
+
};
|
|
26659
|
+
_proto.unpackTo = function unpackTo(_o) {
|
|
26660
|
+
_o.id = this.id();
|
|
26661
|
+
_o.name = this.name();
|
|
26662
|
+
_o.vertexData = this.vertexData() !== null ? this.vertexData().unpack() : null;
|
|
26663
|
+
_o.indexFormat = this.indexFormat();
|
|
26664
|
+
_o.indexOffset = this.indexOffset();
|
|
26665
|
+
_o.subMeshes = this.bb.createObjList(this.subMeshes.bind(this), this.subMeshesLength());
|
|
26666
|
+
_o.mode = this.mode();
|
|
26667
|
+
_o.buffer = this.buffer();
|
|
26668
|
+
_o.binaryData = this.bb.createScalarList(this.binaryData.bind(this), this.binaryDataLength());
|
|
26669
|
+
_o.boneNames = this.bb.createScalarList(this.boneNames.bind(this), this.boneNamesLength());
|
|
26670
|
+
_o.rootBoneName = this.rootBoneName();
|
|
26671
|
+
_o.inverseBindMatrices = this.bb.createScalarList(this.inverseBindMatrices.bind(this), this.inverseBindMatricesLength());
|
|
26672
|
+
};
|
|
26673
|
+
FBGeometryData.getRootAsFBGeometryData = function getRootAsFBGeometryData(bb, obj) {
|
|
26674
|
+
return (obj || new FBGeometryData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26675
|
+
};
|
|
26676
|
+
FBGeometryData.getSizePrefixedRootAsFBGeometryData = function getSizePrefixedRootAsFBGeometryData(bb, obj) {
|
|
26677
|
+
bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
|
|
26678
|
+
return (obj || new FBGeometryData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26679
|
+
};
|
|
26680
|
+
FBGeometryData.startFBGeometryData = function startFBGeometryData(builder) {
|
|
26681
|
+
builder.startObject(12);
|
|
26682
|
+
};
|
|
26683
|
+
FBGeometryData.addId = function addId(builder, idOffset) {
|
|
26684
|
+
builder.addFieldOffset(0, idOffset, 0);
|
|
26685
|
+
};
|
|
26686
|
+
FBGeometryData.addName = function addName(builder, nameOffset) {
|
|
26687
|
+
builder.addFieldOffset(1, nameOffset, 0);
|
|
26688
|
+
};
|
|
26689
|
+
FBGeometryData.addVertexData = function addVertexData(builder, vertexDataOffset) {
|
|
26690
|
+
builder.addFieldOffset(2, vertexDataOffset, 0);
|
|
26691
|
+
};
|
|
26692
|
+
FBGeometryData.addIndexFormat = function addIndexFormat(builder, indexFormat) {
|
|
26693
|
+
builder.addFieldInt32(3, indexFormat, 0);
|
|
26694
|
+
};
|
|
26695
|
+
FBGeometryData.addIndexOffset = function addIndexOffset(builder, indexOffset) {
|
|
26696
|
+
builder.addFieldInt32(4, indexOffset, 0);
|
|
26697
|
+
};
|
|
26698
|
+
FBGeometryData.addSubMeshes = function addSubMeshes(builder, subMeshesOffset) {
|
|
26699
|
+
builder.addFieldOffset(5, subMeshesOffset, 0);
|
|
26700
|
+
};
|
|
26701
|
+
FBGeometryData.createSubMeshesVector = function createSubMeshesVector(builder, data) {
|
|
26702
|
+
builder.startVector(4, data.length, 4);
|
|
26703
|
+
for(var i = data.length - 1; i >= 0; i--){
|
|
26704
|
+
builder.addOffset(data[i]);
|
|
26705
|
+
}
|
|
26706
|
+
return builder.endVector();
|
|
26707
|
+
};
|
|
26708
|
+
FBGeometryData.startSubMeshesVector = function startSubMeshesVector(builder, numElems) {
|
|
26709
|
+
builder.startVector(4, numElems, 4);
|
|
26710
|
+
};
|
|
26711
|
+
FBGeometryData.addMode = function addMode(builder, mode) {
|
|
26712
|
+
builder.addFieldInt32(6, mode, 0);
|
|
26713
|
+
};
|
|
26714
|
+
FBGeometryData.addBuffer = function addBuffer(builder, bufferOffset) {
|
|
26715
|
+
builder.addFieldOffset(7, bufferOffset, 0);
|
|
26716
|
+
};
|
|
26717
|
+
FBGeometryData.addBinaryData = function addBinaryData(builder, binaryDataOffset) {
|
|
26718
|
+
builder.addFieldOffset(8, binaryDataOffset, 0);
|
|
26719
|
+
};
|
|
26720
|
+
FBGeometryData.createBinaryDataVector = function createBinaryDataVector(builder, data) {
|
|
26721
|
+
builder.startVector(1, data.length, 1);
|
|
26722
|
+
for(var i = data.length - 1; i >= 0; i--){
|
|
26723
|
+
builder.addInt8(data[i]);
|
|
26724
|
+
}
|
|
26725
|
+
return builder.endVector();
|
|
26726
|
+
};
|
|
26727
|
+
FBGeometryData.startBinaryDataVector = function startBinaryDataVector(builder, numElems) {
|
|
26728
|
+
builder.startVector(1, numElems, 1);
|
|
26729
|
+
};
|
|
26730
|
+
FBGeometryData.addBoneNames = function addBoneNames(builder, boneNamesOffset) {
|
|
26731
|
+
builder.addFieldOffset(9, boneNamesOffset, 0);
|
|
26732
|
+
};
|
|
26733
|
+
FBGeometryData.createBoneNamesVector = function createBoneNamesVector(builder, data) {
|
|
26734
|
+
builder.startVector(4, data.length, 4);
|
|
26735
|
+
for(var i = data.length - 1; i >= 0; i--){
|
|
26736
|
+
builder.addOffset(data[i]);
|
|
26737
|
+
}
|
|
26738
|
+
return builder.endVector();
|
|
26739
|
+
};
|
|
26740
|
+
FBGeometryData.startBoneNamesVector = function startBoneNamesVector(builder, numElems) {
|
|
26741
|
+
builder.startVector(4, numElems, 4);
|
|
26742
|
+
};
|
|
26743
|
+
FBGeometryData.addRootBoneName = function addRootBoneName(builder, rootBoneNameOffset) {
|
|
26744
|
+
builder.addFieldOffset(10, rootBoneNameOffset, 0);
|
|
26745
|
+
};
|
|
26746
|
+
FBGeometryData.addInverseBindMatrices = function addInverseBindMatrices(builder, inverseBindMatricesOffset) {
|
|
26747
|
+
builder.addFieldOffset(11, inverseBindMatricesOffset, 0);
|
|
26748
|
+
};
|
|
26749
|
+
FBGeometryData.createInverseBindMatricesVector = function createInverseBindMatricesVector(builder, data) {
|
|
26750
|
+
builder.startVector(4, data.length, 4);
|
|
26751
|
+
for(var i = data.length - 1; i >= 0; i--){
|
|
26752
|
+
builder.addFloat32(data[i]);
|
|
26753
|
+
}
|
|
26754
|
+
return builder.endVector();
|
|
26755
|
+
};
|
|
26756
|
+
FBGeometryData.startInverseBindMatricesVector = function startInverseBindMatricesVector(builder, numElems) {
|
|
26757
|
+
builder.startVector(4, numElems, 4);
|
|
26758
|
+
};
|
|
26759
|
+
FBGeometryData.endFBGeometryData = function endFBGeometryData(builder) {
|
|
26760
|
+
var offset = builder.endObject();
|
|
26761
|
+
return offset;
|
|
26762
|
+
};
|
|
26763
|
+
return FBGeometryData;
|
|
26764
|
+
}();
|
|
26765
|
+
var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
26766
|
+
function FBGeometryDataT(id, name, vertexData, indexFormat, indexOffset, subMeshes, mode, buffer, binaryData, boneNames, rootBoneName, inverseBindMatrices) {
|
|
26767
|
+
if (id === void 0) id = null;
|
|
26768
|
+
if (name === void 0) name = null;
|
|
26769
|
+
if (vertexData === void 0) vertexData = null;
|
|
26770
|
+
if (indexFormat === void 0) indexFormat = 0;
|
|
26771
|
+
if (indexOffset === void 0) indexOffset = 0;
|
|
26772
|
+
if (subMeshes === void 0) subMeshes = [];
|
|
26773
|
+
if (mode === void 0) mode = 0;
|
|
26774
|
+
if (buffer === void 0) buffer = null;
|
|
26775
|
+
if (binaryData === void 0) binaryData = [];
|
|
26776
|
+
if (boneNames === void 0) boneNames = [];
|
|
26777
|
+
if (rootBoneName === void 0) rootBoneName = null;
|
|
26778
|
+
if (inverseBindMatrices === void 0) inverseBindMatrices = [];
|
|
26779
|
+
this.id = id;
|
|
26780
|
+
this.name = name;
|
|
26781
|
+
this.vertexData = vertexData;
|
|
26782
|
+
this.indexFormat = indexFormat;
|
|
26783
|
+
this.indexOffset = indexOffset;
|
|
26784
|
+
this.subMeshes = subMeshes;
|
|
26785
|
+
this.mode = mode;
|
|
26786
|
+
this.buffer = buffer;
|
|
26787
|
+
this.binaryData = binaryData;
|
|
26788
|
+
this.boneNames = boneNames;
|
|
26789
|
+
this.rootBoneName = rootBoneName;
|
|
26790
|
+
this.inverseBindMatrices = inverseBindMatrices;
|
|
26791
|
+
}
|
|
26792
|
+
var _proto = FBGeometryDataT.prototype;
|
|
26793
|
+
_proto.pack = function pack(builder) {
|
|
26794
|
+
var id = this.id !== null ? builder.createString(this.id) : 0;
|
|
26795
|
+
var name = this.name !== null ? builder.createString(this.name) : 0;
|
|
26796
|
+
var vertexData = this.vertexData !== null ? this.vertexData.pack(builder) : 0;
|
|
26797
|
+
var subMeshes = FBGeometryData.createSubMeshesVector(builder, builder.createObjectOffsetList(this.subMeshes));
|
|
26798
|
+
var buffer = this.buffer !== null ? builder.createString(this.buffer) : 0;
|
|
26799
|
+
var binaryData = FBGeometryData.createBinaryDataVector(builder, this.binaryData);
|
|
26800
|
+
var boneNames = FBGeometryData.createBoneNamesVector(builder, builder.createObjectOffsetList(this.boneNames));
|
|
26801
|
+
var rootBoneName = this.rootBoneName !== null ? builder.createString(this.rootBoneName) : 0;
|
|
26802
|
+
var inverseBindMatrices = FBGeometryData.createInverseBindMatricesVector(builder, this.inverseBindMatrices);
|
|
26803
|
+
FBGeometryData.startFBGeometryData(builder);
|
|
26804
|
+
FBGeometryData.addId(builder, id);
|
|
26805
|
+
FBGeometryData.addName(builder, name);
|
|
26806
|
+
FBGeometryData.addVertexData(builder, vertexData);
|
|
26807
|
+
FBGeometryData.addIndexFormat(builder, this.indexFormat);
|
|
26808
|
+
FBGeometryData.addIndexOffset(builder, this.indexOffset);
|
|
26809
|
+
FBGeometryData.addSubMeshes(builder, subMeshes);
|
|
26810
|
+
FBGeometryData.addMode(builder, this.mode);
|
|
26811
|
+
FBGeometryData.addBuffer(builder, buffer);
|
|
26812
|
+
FBGeometryData.addBinaryData(builder, binaryData);
|
|
26813
|
+
FBGeometryData.addBoneNames(builder, boneNames);
|
|
26814
|
+
FBGeometryData.addRootBoneName(builder, rootBoneName);
|
|
26815
|
+
FBGeometryData.addInverseBindMatrices(builder, inverseBindMatrices);
|
|
26816
|
+
return FBGeometryData.endFBGeometryData(builder);
|
|
26817
|
+
};
|
|
26818
|
+
return FBGeometryDataT;
|
|
26819
|
+
}();
|
|
26820
|
+
|
|
26821
|
+
/**
|
|
26822
|
+
* @since 2.0.0
|
|
26823
|
+
* @internal
|
|
26824
|
+
*/ var EffectsPackage = /*#__PURE__*/ function() {
|
|
26825
|
+
function EffectsPackage() {
|
|
26826
|
+
this.exportObjectDatas = [];
|
|
26827
|
+
}
|
|
26828
|
+
var _proto = EffectsPackage.prototype;
|
|
26829
|
+
_proto.addData = function addData(effectsObjectData) {
|
|
26830
|
+
this.exportObjectDatas.push(effectsObjectData);
|
|
26831
|
+
};
|
|
26832
|
+
_proto.serializeToBinary = function serializeToBinary() {
|
|
26833
|
+
var fbb = new Builder(1);
|
|
26834
|
+
var effectsPackage = new FBEffectsPackageDataT();
|
|
26835
|
+
var exportObjects = [];
|
|
26836
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.exportObjectDatas), _step; !(_step = _iterator()).done;){
|
|
26837
|
+
var effectsObjectData = _step.value;
|
|
26838
|
+
var fbEffectsObjectData = void 0;
|
|
26839
|
+
if (effectsObjectData.dataType === DataType.Geometry) {
|
|
26840
|
+
fbEffectsObjectData = new FBEffectsObjectDataT("Geometry", this.geometryDataToBinary(effectsObjectData));
|
|
26841
|
+
}
|
|
26842
|
+
if (!fbEffectsObjectData) {
|
|
26843
|
+
continue;
|
|
26844
|
+
}
|
|
26845
|
+
exportObjects.push(fbEffectsObjectData);
|
|
26846
|
+
}
|
|
26847
|
+
effectsPackage.exportObjects = exportObjects;
|
|
26848
|
+
FBEffectsPackageData.finishFBEffectsPackageDataBuffer(fbb, effectsPackage.pack(fbb));
|
|
26849
|
+
return fbb.asUint8Array(); // Of type `Uint8Array`.
|
|
26850
|
+
};
|
|
26851
|
+
_proto.deserializeFromBinary = function deserializeFromBinary(buffer) {
|
|
26852
|
+
var buf = new ByteBuffer(buffer);
|
|
26853
|
+
var fbEffectsPackage = FBEffectsPackageData.getRootAsFBEffectsPackageData(buf);
|
|
26854
|
+
for(var i = 0; i < fbEffectsPackage.exportObjectsLength(); i++){
|
|
26855
|
+
var fbEffectsObjectData = fbEffectsPackage.exportObjects(i);
|
|
26856
|
+
if (!fbEffectsObjectData) {
|
|
26857
|
+
continue;
|
|
26858
|
+
}
|
|
26859
|
+
var dataBuffer = fbEffectsObjectData.dataArray();
|
|
26860
|
+
var dataType = fbEffectsObjectData.dataType();
|
|
26861
|
+
if (!dataBuffer) {
|
|
26862
|
+
continue;
|
|
26863
|
+
}
|
|
26864
|
+
var effectsObjectData = void 0;
|
|
26865
|
+
if (dataType === DataType.Geometry) {
|
|
26866
|
+
effectsObjectData = this.binaryToGeometryData(dataBuffer);
|
|
26867
|
+
}
|
|
26868
|
+
if (!effectsObjectData) {
|
|
26869
|
+
continue;
|
|
26870
|
+
}
|
|
26871
|
+
this.exportObjectDatas.push(effectsObjectData);
|
|
26872
|
+
}
|
|
26873
|
+
};
|
|
26874
|
+
_proto.geometryDataToBinary = function geometryDataToBinary(geometryData) {
|
|
26875
|
+
var fbb = new Builder(1);
|
|
26876
|
+
var fbGeometryData = new FBGeometryDataT();
|
|
26877
|
+
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;
|
|
26878
|
+
fbGeometryData.indexFormat = indexFormat;
|
|
26879
|
+
fbGeometryData.indexOffset = indexOffset;
|
|
26880
|
+
fbGeometryData.mode = mode;
|
|
26881
|
+
fbGeometryData.id = id;
|
|
26882
|
+
fbGeometryData.boneNames = boneNames;
|
|
26883
|
+
fbGeometryData.rootBoneName = rootBoneName;
|
|
26884
|
+
fbGeometryData.inverseBindMatrices = inverseBindMatrices;
|
|
26885
|
+
fbGeometryData.binaryData = binaryData;
|
|
26886
|
+
var fbVertexdata = new FBVertexDataT();
|
|
26887
|
+
fbVertexdata.vertexCount = vertexData.vertexCount;
|
|
26888
|
+
fbVertexdata.channels = [];
|
|
26889
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(vertexData.channels), _step; !(_step = _iterator()).done;){
|
|
26890
|
+
var channel = _step.value;
|
|
26891
|
+
var semantic = channel.semantic, offset = channel.offset, format = channel.format, dimension = channel.dimension, normalize = channel.normalize;
|
|
26892
|
+
var fbChannel = new FBVertexChannelT(semantic, offset, format, dimension, normalize);
|
|
26893
|
+
fbVertexdata.channels.push(fbChannel);
|
|
26894
|
+
}
|
|
26895
|
+
fbGeometryData.vertexData = fbVertexdata;
|
|
26896
|
+
var fbSubMeshes = [];
|
|
26897
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(geometryData.subMeshes), _step1; !(_step1 = _iterator1()).done;){
|
|
26898
|
+
var subMesh = _step1.value;
|
|
26899
|
+
var offset1 = subMesh.offset, indexCount = subMesh.indexCount, vertexCount = subMesh.vertexCount;
|
|
26900
|
+
var fbSubMesh = new FBSubMeshT(offset1, indexCount, vertexCount);
|
|
26901
|
+
fbSubMeshes.push(fbSubMesh);
|
|
26902
|
+
}
|
|
26903
|
+
fbGeometryData.subMeshes = fbSubMeshes;
|
|
26904
|
+
FBEffectsPackageData.finishFBEffectsPackageDataBuffer(fbb, fbGeometryData.pack(fbb));
|
|
26905
|
+
return fbb.asUint8Array(); // Of type `Uint8Array`.
|
|
26906
|
+
};
|
|
26907
|
+
_proto.binaryToGeometryData = function binaryToGeometryData(buffer) {
|
|
26908
|
+
var buf = new ByteBuffer(buffer);
|
|
26909
|
+
var fbGeometryData = FBGeometryData.getRootAsFBGeometryData(buf);
|
|
26910
|
+
var vertexData = {
|
|
26911
|
+
vertexCount: 0,
|
|
26912
|
+
channels: []
|
|
26913
|
+
};
|
|
26914
|
+
var fbVertexData = fbGeometryData.vertexData();
|
|
26915
|
+
if (fbVertexData) {
|
|
26916
|
+
vertexData.vertexCount = fbVertexData.vertexCount();
|
|
26917
|
+
for(var i = 0; i < fbVertexData.channelsLength(); i++){
|
|
26918
|
+
var channel = fbVertexData.channels(i);
|
|
26919
|
+
if (!channel) {
|
|
26920
|
+
continue;
|
|
26921
|
+
}
|
|
26922
|
+
var _channel_semantic;
|
|
26923
|
+
var vertexChannel = {
|
|
26924
|
+
semantic: (_channel_semantic = channel.semantic()) != null ? _channel_semantic : "",
|
|
26925
|
+
offset: channel.offset(),
|
|
26926
|
+
format: channel.format(),
|
|
26927
|
+
dimension: channel.dimension(),
|
|
26928
|
+
normalize: channel.normalize()
|
|
26929
|
+
};
|
|
26930
|
+
vertexData.channels.push(vertexChannel);
|
|
26931
|
+
}
|
|
26932
|
+
}
|
|
26933
|
+
var subMeshes = [];
|
|
26934
|
+
for(var i1 = 0; i1 < fbGeometryData.subMeshesLength(); i1++){
|
|
26935
|
+
var fbSubMesh = fbGeometryData.subMeshes(i1);
|
|
26936
|
+
if (!fbSubMesh) {
|
|
26937
|
+
continue;
|
|
26938
|
+
}
|
|
26939
|
+
var subMesh = {
|
|
26940
|
+
offset: fbSubMesh.offset(),
|
|
26941
|
+
vertexCount: fbSubMesh.vertexCount(),
|
|
26942
|
+
indexCount: fbSubMesh.indexCount()
|
|
26943
|
+
};
|
|
26944
|
+
subMeshes.push(subMesh);
|
|
26945
|
+
}
|
|
26946
|
+
var boneNames = [];
|
|
26947
|
+
for(var i2 = 0; i2 < fbGeometryData.boneNamesLength(); i2++){
|
|
26948
|
+
var boneName = fbGeometryData.boneNames(i2);
|
|
26949
|
+
boneNames.push(boneName);
|
|
26950
|
+
}
|
|
26951
|
+
var inverseBindMatricesArray = fbGeometryData.inverseBindMatricesArray();
|
|
26952
|
+
var _fbGeometryData_buffer, _fbGeometryData_rootBoneName, _fbGeometryData_binaryDataArray, _fbGeometryData_id;
|
|
26953
|
+
var geometryData = {
|
|
26954
|
+
vertexData: vertexData,
|
|
26955
|
+
indexFormat: fbGeometryData.indexFormat(),
|
|
26956
|
+
indexOffset: fbGeometryData.indexOffset(),
|
|
26957
|
+
subMeshes: subMeshes,
|
|
26958
|
+
mode: fbGeometryData.mode(),
|
|
26959
|
+
buffer: (_fbGeometryData_buffer = fbGeometryData.buffer()) != null ? _fbGeometryData_buffer : "",
|
|
26960
|
+
boneNames: boneNames,
|
|
26961
|
+
rootBoneName: (_fbGeometryData_rootBoneName = fbGeometryData.rootBoneName()) != null ? _fbGeometryData_rootBoneName : "",
|
|
26962
|
+
inverseBindMatrices: inverseBindMatricesArray ? Array.from(inverseBindMatricesArray) : undefined,
|
|
26963
|
+
binaryData: (_fbGeometryData_binaryDataArray = fbGeometryData.binaryDataArray()) != null ? _fbGeometryData_binaryDataArray : undefined,
|
|
26964
|
+
id: (_fbGeometryData_id = fbGeometryData.id()) != null ? _fbGeometryData_id : "",
|
|
26965
|
+
dataType: DataType.Geometry
|
|
26966
|
+
};
|
|
26967
|
+
return geometryData;
|
|
26968
|
+
};
|
|
26969
|
+
return EffectsPackage;
|
|
26970
|
+
}();
|
|
26971
|
+
|
|
26972
|
+
/**
|
|
26973
|
+
* Engine 基类,负责维护所有 GPU 资源的管理及销毁
|
|
26974
|
+
*/ var Engine = /*#__PURE__*/ function() {
|
|
26975
|
+
function Engine() {
|
|
26976
|
+
/**
|
|
26977
|
+
* 渲染过程中错误队列
|
|
26978
|
+
*/ this.renderErrors = new Set();
|
|
26979
|
+
this.destroyed = false;
|
|
26980
|
+
this.textures = [];
|
|
26981
|
+
this.materials = [];
|
|
26982
|
+
this.geometries = [];
|
|
26983
|
+
this.meshes = [];
|
|
26984
|
+
this.renderPasses = [];
|
|
26985
|
+
this.jsonSceneData = {};
|
|
26986
|
+
this.objectInstance = {};
|
|
26987
|
+
this.assetLoader = new AssetLoader(this);
|
|
26988
|
+
this.emptyTexture = generateWhiteTexture(this);
|
|
26989
|
+
this.transparentTexture = generateTransparentTexture(this);
|
|
26990
|
+
}
|
|
26991
|
+
var _proto = Engine.prototype;
|
|
26992
|
+
_proto.clearResources = function clearResources() {
|
|
26993
|
+
this.jsonSceneData = {};
|
|
26994
|
+
this.objectInstance = {};
|
|
26995
|
+
};
|
|
26996
|
+
_proto.addEffectsObjectData = function addEffectsObjectData(data) {
|
|
26997
|
+
this.jsonSceneData[data.id] = data;
|
|
26998
|
+
};
|
|
26999
|
+
_proto.findEffectsObjectData = function findEffectsObjectData(uuid) {
|
|
27000
|
+
return this.jsonSceneData[uuid];
|
|
27001
|
+
};
|
|
27002
|
+
_proto.addInstance = function addInstance(effectsObject) {
|
|
27003
|
+
this.objectInstance[effectsObject.getInstanceId()] = effectsObject;
|
|
27004
|
+
};
|
|
27005
|
+
_proto.getInstance = function getInstance(id) {
|
|
27006
|
+
return this.objectInstance[id];
|
|
27007
|
+
};
|
|
27008
|
+
_proto.removeInstance = function removeInstance(id) {
|
|
27009
|
+
delete this.objectInstance[id];
|
|
27010
|
+
};
|
|
27011
|
+
_proto.addPackageDatas = function addPackageDatas(scene) {
|
|
27012
|
+
var jsonScene = scene.jsonScene, _scene_textureOptions = scene.textureOptions, textureOptions = _scene_textureOptions === void 0 ? [] : _scene_textureOptions;
|
|
27013
|
+
var _jsonScene_items = jsonScene.items, items = _jsonScene_items === void 0 ? [] : _jsonScene_items, _jsonScene_materials = jsonScene.materials, materials = _jsonScene_materials === void 0 ? [] : _jsonScene_materials, _jsonScene_shaders = jsonScene.shaders, shaders = _jsonScene_shaders === void 0 ? [] : _jsonScene_shaders, _jsonScene_geometries = jsonScene.geometries, geometries = _jsonScene_geometries === void 0 ? [] : _jsonScene_geometries, _jsonScene_components = jsonScene.components, components = _jsonScene_components === void 0 ? [] : _jsonScene_components, _jsonScene_animations = jsonScene.animations, animations = _jsonScene_animations === void 0 ? [] : _jsonScene_animations, _jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, _jsonScene_miscs = jsonScene.miscs, miscs = _jsonScene_miscs === void 0 ? [] : _jsonScene_miscs;
|
|
27014
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
27015
|
+
var vfxItemData = _step.value;
|
|
27016
|
+
this.addEffectsObjectData(vfxItemData);
|
|
27017
|
+
}
|
|
27018
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(materials), _step1; !(_step1 = _iterator1()).done;){
|
|
27019
|
+
var materialData = _step1.value;
|
|
27020
|
+
this.addEffectsObjectData(materialData);
|
|
27021
|
+
}
|
|
27022
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(shaders), _step2; !(_step2 = _iterator2()).done;){
|
|
27023
|
+
var shaderData = _step2.value;
|
|
27024
|
+
this.addEffectsObjectData(shaderData);
|
|
27025
|
+
}
|
|
27026
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(geometries), _step3; !(_step3 = _iterator3()).done;){
|
|
27027
|
+
var geometryData = _step3.value;
|
|
27028
|
+
this.addEffectsObjectData(geometryData);
|
|
27029
|
+
}
|
|
27030
|
+
for(var _iterator4 = _create_for_of_iterator_helper_loose(components), _step4; !(_step4 = _iterator4()).done;){
|
|
25401
27031
|
var componentData = _step4.value;
|
|
25402
27032
|
this.addEffectsObjectData(componentData);
|
|
25403
27033
|
}
|
|
@@ -25412,16 +27042,23 @@ var listOrder = 0;
|
|
|
25412
27042
|
for(var i = 0; i < bins.length; i++){
|
|
25413
27043
|
var binaryData = bins[i];
|
|
25414
27044
|
var binaryBuffer = scene.bins[i];
|
|
25415
|
-
|
|
25416
|
-
binaryData.buffer = binaryBuffer;
|
|
25417
|
-
//@ts-expect-error
|
|
25418
|
-
if (binaryData.id) {
|
|
27045
|
+
if (binaryData.dataType === DataType.BinaryAsset) {
|
|
25419
27046
|
//@ts-expect-error
|
|
25420
|
-
|
|
27047
|
+
binaryData.buffer = binaryBuffer;
|
|
27048
|
+
if (binaryData.id) {
|
|
27049
|
+
this.addEffectsObjectData(binaryData);
|
|
27050
|
+
}
|
|
27051
|
+
} else {
|
|
27052
|
+
var effectsPackage = new EffectsPackage();
|
|
27053
|
+
effectsPackage.deserializeFromBinary(new Uint8Array(binaryBuffer));
|
|
27054
|
+
for(var _iterator7 = _create_for_of_iterator_helper_loose(effectsPackage.exportObjectDatas), _step7; !(_step7 = _iterator7()).done;){
|
|
27055
|
+
var effectsObjectData = _step7.value;
|
|
27056
|
+
this.addEffectsObjectData(effectsObjectData);
|
|
27057
|
+
}
|
|
25421
27058
|
}
|
|
25422
27059
|
}
|
|
25423
|
-
for(var
|
|
25424
|
-
var textureData =
|
|
27060
|
+
for(var _iterator8 = _create_for_of_iterator_helper_loose(textureOptions), _step8; !(_step8 = _iterator8()).done;){
|
|
27061
|
+
var textureData = _step8.value;
|
|
25425
27062
|
this.addEffectsObjectData(textureData);
|
|
25426
27063
|
}
|
|
25427
27064
|
};
|
|
@@ -25731,7 +27368,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
25731
27368
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
25732
27369
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
25733
27370
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
25734
|
-
var version = "2.0.0-alpha.
|
|
27371
|
+
var version = "2.0.0-alpha.28";
|
|
25735
27372
|
logger.info("Core version: " + version + ".");
|
|
25736
27373
|
|
|
25737
27374
|
exports.AbstractPlugin = AbstractPlugin;
|
|
@@ -25763,6 +27400,7 @@ exports.EVENT_TYPE_TOUCH_END = EVENT_TYPE_TOUCH_END;
|
|
|
25763
27400
|
exports.EVENT_TYPE_TOUCH_MOVE = EVENT_TYPE_TOUCH_MOVE;
|
|
25764
27401
|
exports.EVENT_TYPE_TOUCH_START = EVENT_TYPE_TOUCH_START;
|
|
25765
27402
|
exports.EffectsObject = EffectsObject;
|
|
27403
|
+
exports.EffectsPackage = EffectsPackage;
|
|
25766
27404
|
exports.Engine = Engine;
|
|
25767
27405
|
exports.EventSystem = EventSystem;
|
|
25768
27406
|
exports.Float16ArrayWrapper = Float16ArrayWrapper;
|
|
@@ -25853,7 +27491,6 @@ exports.createGLContext = createGLContext;
|
|
|
25853
27491
|
exports.createKeyFrameMeta = createKeyFrameMeta;
|
|
25854
27492
|
exports.createShaderWithMacros = createShaderWithMacros;
|
|
25855
27493
|
exports.createShape = createShape;
|
|
25856
|
-
exports.createVFXItem = createVFXItem;
|
|
25857
27494
|
exports.createValueGetter = createValueGetter;
|
|
25858
27495
|
exports.decimalEqual = decimalEqual;
|
|
25859
27496
|
exports.defaultGlobalVolume = defaultGlobalVolume;
|
|
@@ -25909,6 +27546,8 @@ exports.isArray = isArray;
|
|
|
25909
27546
|
exports.isCanvas = isCanvas;
|
|
25910
27547
|
exports.isFunction = isFunction;
|
|
25911
27548
|
exports.isIOS = isIOS;
|
|
27549
|
+
exports.isIOSByUA = isIOSByUA;
|
|
27550
|
+
exports.isMiniProgram = isMiniProgram;
|
|
25912
27551
|
exports.isObject = isObject;
|
|
25913
27552
|
exports.isSceneJSON = isSceneJSON;
|
|
25914
27553
|
exports.isSceneURL = isSceneURL;
|
|
@@ -25919,6 +27558,7 @@ exports.isUniformStruct = isUniformStruct;
|
|
|
25919
27558
|
exports.isUniformStructArray = isUniformStructArray;
|
|
25920
27559
|
exports.isValidFontFamily = isValidFontFamily;
|
|
25921
27560
|
exports.isWebGL2 = isWebGL2;
|
|
27561
|
+
exports.isWechatMiniApp = isWechatMiniApp;
|
|
25922
27562
|
exports.itemFrag = itemFrag;
|
|
25923
27563
|
exports.itemFrameFrag = itemFrameFrag;
|
|
25924
27564
|
exports.itemVert = itemVert;
|