@galacean/effects-threejs 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/index.js +1926 -286
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +1923 -286
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.28
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -466,16 +466,27 @@ function isIOS() {
|
|
|
466
466
|
// real ios device not in simulator
|
|
467
467
|
return !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
|
|
468
468
|
}
|
|
469
|
+
function isIOSByUA() {
|
|
470
|
+
var str = navigator.userAgent.toLowerCase();
|
|
471
|
+
var ver = str.match(/cpu (iphone )?os (.*?) like mac os/);
|
|
472
|
+
return ver ? parseInt(ver[2], 10) : 0;
|
|
473
|
+
}
|
|
469
474
|
function isAndroid() {
|
|
470
475
|
return /\b[Aa]ndroid\b/.test(navigator.userAgent);
|
|
471
476
|
}
|
|
472
477
|
function isSimulatorCellPhone() {
|
|
473
478
|
return isAndroid() || /\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent);
|
|
474
479
|
}
|
|
480
|
+
function isMiniProgram() {
|
|
481
|
+
return isAlipayMiniApp() || isWechatMiniApp();
|
|
482
|
+
}
|
|
475
483
|
function isAlipayMiniApp() {
|
|
476
484
|
var _my;
|
|
477
485
|
return typeof my !== "undefined" && ((_my = my) == null ? void 0 : _my.renderTarget) === "web";
|
|
478
486
|
}
|
|
487
|
+
function isWechatMiniApp() {
|
|
488
|
+
return window.__wxjs_environment === "miniprogram";
|
|
489
|
+
}
|
|
479
490
|
|
|
480
491
|
function imageDataFromColor(value) {
|
|
481
492
|
if (isString(value)) {
|
|
@@ -4023,13 +4034,29 @@ var RenderFace;
|
|
|
4023
4034
|
RenderFace["Front"] = "Front";
|
|
4024
4035
|
})(RenderFace || (RenderFace = {}));
|
|
4025
4036
|
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
var
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
var
|
|
4037
|
+
/**
|
|
4038
|
+
* 销毁
|
|
4039
|
+
*/ var END_BEHAVIOR_DESTROY = 0;
|
|
4040
|
+
/**
|
|
4041
|
+
* 暂停
|
|
4042
|
+
* @deprecated since 2.0 - use `END_BEHAVIOR_FREEZE` instead
|
|
4043
|
+
*/ var END_BEHAVIOR_PAUSE = 1;
|
|
4044
|
+
/**
|
|
4045
|
+
* 无限播放
|
|
4046
|
+
*/ var END_BEHAVIOR_FORWARD = 2;
|
|
4047
|
+
/**
|
|
4048
|
+
* 销毁并保留最后一帧
|
|
4049
|
+
* @deprecated since 2.0
|
|
4050
|
+
*/ var END_BEHAVIOR_PAUSE_AND_DESTROY = 3;
|
|
4051
|
+
/**
|
|
4052
|
+
* 冻结
|
|
4053
|
+
*/ var END_BEHAVIOR_FREEZE = 4;
|
|
4054
|
+
/**
|
|
4055
|
+
* 重播
|
|
4056
|
+
*/ var END_BEHAVIOR_RESTART = 5;
|
|
4057
|
+
/**
|
|
4058
|
+
*
|
|
4059
|
+
*/ var END_BEHAVIOR_DESTROY_CHILDREN = 6;
|
|
4033
4060
|
var CAMERA_CLIP_MODE_VERTICAL = 1;
|
|
4034
4061
|
var CAMERA_CLIP_MODE_NORMAL = 0;
|
|
4035
4062
|
var MESSAGE_ITEM_PHRASE_BEGIN = 2;
|
|
@@ -4044,29 +4071,6 @@ var CameraClipMode;
|
|
|
4044
4071
|
* 剪裁左右
|
|
4045
4072
|
*/ CameraClipMode[CameraClipMode["landscape"] = 0] = "landscape";
|
|
4046
4073
|
})(CameraClipMode || (CameraClipMode = {}));
|
|
4047
|
-
/**
|
|
4048
|
-
* 结束行为
|
|
4049
|
-
*/ var CompositionEndBehavior;
|
|
4050
|
-
(function(CompositionEndBehavior) {
|
|
4051
|
-
/**
|
|
4052
|
-
* 销毁
|
|
4053
|
-
*/ CompositionEndBehavior[CompositionEndBehavior["destroy"] = 0] = "destroy";
|
|
4054
|
-
/**
|
|
4055
|
-
* 暂停
|
|
4056
|
-
*/ CompositionEndBehavior[CompositionEndBehavior["pause"] = 1] = "pause";
|
|
4057
|
-
/**
|
|
4058
|
-
* 重播
|
|
4059
|
-
*/ CompositionEndBehavior[CompositionEndBehavior["restart"] = 5] = "restart";
|
|
4060
|
-
/**
|
|
4061
|
-
* 无限播放
|
|
4062
|
-
*/ CompositionEndBehavior[CompositionEndBehavior["forward"] = 2] = "forward";
|
|
4063
|
-
/**
|
|
4064
|
-
* 销毁并保留最后一帧
|
|
4065
|
-
*/ CompositionEndBehavior[CompositionEndBehavior["pause_destroy"] = 3] = "pause_destroy";
|
|
4066
|
-
/**
|
|
4067
|
-
* 冻结
|
|
4068
|
-
*/ CompositionEndBehavior[CompositionEndBehavior["freeze"] = 4] = "freeze";
|
|
4069
|
-
})(CompositionEndBehavior || (CompositionEndBehavior = {}));
|
|
4070
4074
|
|
|
4071
4075
|
/**
|
|
4072
4076
|
* 动态换图类型
|
|
@@ -4147,12 +4151,23 @@ var CameraClipMode;
|
|
|
4147
4151
|
BezierKeyframeType[BezierKeyframeType["LINE_OUT"] = 6] = "LINE_OUT";
|
|
4148
4152
|
})(BezierKeyframeType || (BezierKeyframeType = {}));
|
|
4149
4153
|
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4154
|
+
/**
|
|
4155
|
+
* 结束行为
|
|
4156
|
+
*/ var EndBehavior;
|
|
4157
|
+
(function(EndBehavior) {
|
|
4158
|
+
/**
|
|
4159
|
+
* 销毁
|
|
4160
|
+
*/ EndBehavior[EndBehavior["destroy"] = 0] = "destroy";
|
|
4161
|
+
/**
|
|
4162
|
+
* 重播
|
|
4163
|
+
*/ EndBehavior[EndBehavior["restart"] = 5] = "restart";
|
|
4164
|
+
/**
|
|
4165
|
+
* 无限播放
|
|
4166
|
+
*/ EndBehavior[EndBehavior["forward"] = 2] = "forward";
|
|
4167
|
+
/**
|
|
4168
|
+
* 冻结
|
|
4169
|
+
*/ EndBehavior[EndBehavior["freeze"] = 4] = "freeze";
|
|
4170
|
+
})(EndBehavior || (EndBehavior = {}));
|
|
4156
4171
|
var ParentItemEndBehavior;
|
|
4157
4172
|
(function(ParentItemEndBehavior) {
|
|
4158
4173
|
ParentItemEndBehavior[ParentItemEndBehavior["destroyChildren"] = 6] = "destroyChildren";
|
|
@@ -4477,7 +4492,6 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
4477
4492
|
get RenderType () { return RenderType; },
|
|
4478
4493
|
get RenderFace () { return RenderFace; },
|
|
4479
4494
|
get CameraClipMode () { return CameraClipMode; },
|
|
4480
|
-
get CompositionEndBehavior () { return CompositionEndBehavior; },
|
|
4481
4495
|
get BackgroundType () { return BackgroundType; },
|
|
4482
4496
|
END_BEHAVIOR_DESTROY: END_BEHAVIOR_DESTROY,
|
|
4483
4497
|
END_BEHAVIOR_PAUSE: END_BEHAVIOR_PAUSE,
|
|
@@ -4492,7 +4506,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
4492
4506
|
MESSAGE_ITEM_PHRASE_END: MESSAGE_ITEM_PHRASE_END,
|
|
4493
4507
|
get ValueType () { return ValueType; },
|
|
4494
4508
|
get BezierKeyframeType () { return BezierKeyframeType; },
|
|
4495
|
-
get
|
|
4509
|
+
get EndBehavior () { return EndBehavior; },
|
|
4496
4510
|
get ParentItemEndBehavior () { return ParentItemEndBehavior; },
|
|
4497
4511
|
get ParticleInteractionBehavior () { return ParticleInteractionBehavior; },
|
|
4498
4512
|
get ShapeArcMode () { return ShapeArcMode; },
|
|
@@ -8152,31 +8166,35 @@ function deserializeMipmapTexture(textureOptions, bins, engine) {
|
|
|
8152
8166
|
}
|
|
8153
8167
|
function _deserializeMipmapTexture() {
|
|
8154
8168
|
_deserializeMipmapTexture = _async_to_generator(function(textureOptions, bins, engine, files) {
|
|
8155
|
-
var mipmaps, target,
|
|
8169
|
+
var mipmaps, target, jobs, loadedMipmaps, mipmaps1, target1, jobs1, loadedMipmaps1, bin;
|
|
8156
8170
|
return __generator(this, function(_state) {
|
|
8157
8171
|
switch(_state.label){
|
|
8158
8172
|
case 0:
|
|
8159
8173
|
if (files === void 0) files = [];
|
|
8160
8174
|
if (!(textureOptions.target === 34067)) return [
|
|
8161
8175
|
3,
|
|
8162
|
-
|
|
8176
|
+
2
|
|
8163
8177
|
];
|
|
8164
8178
|
mipmaps = textureOptions.mipmaps, target = textureOptions.target;
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
for(_iterator = _create_for_of_iterator_helper_loose(mipmaps); !(_step = _iterator()).done;){
|
|
8168
|
-
level = _step.value;
|
|
8169
|
-
newLevel = [];
|
|
8170
|
-
for(_iterator1 = _create_for_of_iterator_helper_loose(level); !(_step1 = _iterator1()).done;){
|
|
8171
|
-
face = _step1.value;
|
|
8179
|
+
jobs = mipmaps.map(function(mipmap) {
|
|
8180
|
+
return Promise.all(mipmap.map(function(pointer) {
|
|
8172
8181
|
// @ts-expect-error
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8182
|
+
if (pointer.id) {
|
|
8183
|
+
// @ts-expect-error
|
|
8184
|
+
var loadedImageAsset = engine.assetLoader.loadGUID(pointer.id);
|
|
8185
|
+
// @ts-expect-error
|
|
8186
|
+
return loadedImageAsset.data;
|
|
8187
|
+
} else {
|
|
8188
|
+
return loadMipmapImage(pointer, bins);
|
|
8189
|
+
}
|
|
8190
|
+
}));
|
|
8191
|
+
});
|
|
8192
|
+
return [
|
|
8193
|
+
4,
|
|
8194
|
+
Promise.all(jobs)
|
|
8195
|
+
];
|
|
8196
|
+
case 1:
|
|
8197
|
+
loadedMipmaps = _state.sent();
|
|
8180
8198
|
return [
|
|
8181
8199
|
2,
|
|
8182
8200
|
_extends({
|
|
@@ -8190,17 +8208,17 @@ function _deserializeMipmapTexture() {
|
|
|
8190
8208
|
}
|
|
8191
8209
|
})
|
|
8192
8210
|
];
|
|
8193
|
-
case
|
|
8211
|
+
case 2:
|
|
8194
8212
|
// TODO: 补充测试用例
|
|
8195
8213
|
mipmaps1 = textureOptions.mipmaps, target1 = textureOptions.target;
|
|
8196
|
-
|
|
8214
|
+
jobs1 = mipmaps1.map(function(pointer) {
|
|
8197
8215
|
return loadMipmapImage(pointer, bins);
|
|
8198
8216
|
});
|
|
8199
8217
|
return [
|
|
8200
8218
|
4,
|
|
8201
|
-
Promise.all(
|
|
8219
|
+
Promise.all(jobs1)
|
|
8202
8220
|
];
|
|
8203
|
-
case
|
|
8221
|
+
case 3:
|
|
8204
8222
|
loadedMipmaps1 = _state.sent();
|
|
8205
8223
|
bin = files[mipmaps1[0][1][0]].url;
|
|
8206
8224
|
return [
|
|
@@ -8223,7 +8241,7 @@ function _deserializeMipmapTexture() {
|
|
|
8223
8241
|
}
|
|
8224
8242
|
})
|
|
8225
8243
|
];
|
|
8226
|
-
case
|
|
8244
|
+
case 4:
|
|
8227
8245
|
return [
|
|
8228
8246
|
2
|
|
8229
8247
|
];
|
|
@@ -11578,7 +11596,7 @@ var valueDefine = "#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValu
|
|
|
11578
11596
|
|
|
11579
11597
|
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.;}";
|
|
11580
11598
|
|
|
11581
|
-
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);}";
|
|
11599
|
+
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);}";
|
|
11582
11600
|
|
|
11583
11601
|
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);}";
|
|
11584
11602
|
|
|
@@ -11866,7 +11884,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11866
11884
|
this.screenMesh.material.setFloat("_Brightness", brightness);
|
|
11867
11885
|
this.screenMesh.material.setFloat("_Saturation", saturation);
|
|
11868
11886
|
this.screenMesh.material.setFloat("_Contrast", contrast);
|
|
11869
|
-
this.screenMesh.material.setInt("_UseBloom", useBloom);
|
|
11887
|
+
this.screenMesh.material.setInt("_UseBloom", Number(useBloom));
|
|
11870
11888
|
if (useBloom) {
|
|
11871
11889
|
this.screenMesh.material.setTexture("_GaussianTex", this.mainTexture);
|
|
11872
11890
|
this.screenMesh.material.setFloat("_BloomIntensity", bloomIntensity);
|
|
@@ -11878,7 +11896,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11878
11896
|
this.screenMesh.material.setVector2("_VignetteCenter", new Vector2(0.5, 0.5));
|
|
11879
11897
|
this.screenMesh.material.setVector3("_VignetteColor", new Vector3(0.0, 0.0, 0.0));
|
|
11880
11898
|
}
|
|
11881
|
-
this.screenMesh.material.setInt("_UseToneMapping", useToneMapping);
|
|
11899
|
+
this.screenMesh.material.setInt("_UseToneMapping", Number(useToneMapping));
|
|
11882
11900
|
renderer.renderMeshes([
|
|
11883
11901
|
this.screenMesh
|
|
11884
11902
|
]);
|
|
@@ -11890,9 +11908,8 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11890
11908
|
* 后处理配置
|
|
11891
11909
|
*/ var defaultGlobalVolume = {
|
|
11892
11910
|
useHDR: false,
|
|
11893
|
-
usePostProcessing: false,
|
|
11894
11911
|
/***** Material Uniform *****/ // Bloom
|
|
11895
|
-
useBloom:
|
|
11912
|
+
useBloom: true,
|
|
11896
11913
|
threshold: 1.0,
|
|
11897
11914
|
bloomIntensity: 1.0,
|
|
11898
11915
|
// ColorAdjustments
|
|
@@ -11906,7 +11923,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11906
11923
|
vignetteSmoothness: 0.4,
|
|
11907
11924
|
vignetteRoundness: 1.0,
|
|
11908
11925
|
// ToneMapping
|
|
11909
|
-
useToneMapping:
|
|
11926
|
+
useToneMapping: true
|
|
11910
11927
|
};
|
|
11911
11928
|
|
|
11912
11929
|
var RENDER_PASS_NAME_PREFIX = "_effects_default_";
|
|
@@ -11975,20 +11992,36 @@ var seed$6 = 1;
|
|
|
11975
11992
|
];
|
|
11976
11993
|
this.setRenderPasses(renderPasses);
|
|
11977
11994
|
if (this.globalVolume) {
|
|
11978
|
-
var useBloom = this.globalVolume.useBloom;
|
|
11979
11995
|
var sceneTextureHandle = new RenderTargetHandle(engine); //保存后处理前的屏幕图像
|
|
11980
|
-
|
|
11981
|
-
|
|
11982
|
-
|
|
11983
|
-
|
|
11984
|
-
|
|
11985
|
-
|
|
11986
|
-
|
|
11987
|
-
|
|
11988
|
-
|
|
11989
|
-
|
|
11990
|
-
|
|
11991
|
-
|
|
11996
|
+
var gaussianStep = 7; // 高斯模糊的迭代次数,次数越高模糊范围越大
|
|
11997
|
+
var viewport = [
|
|
11998
|
+
0,
|
|
11999
|
+
0,
|
|
12000
|
+
this.renderer.getWidth() / 2,
|
|
12001
|
+
this.renderer.getHeight() / 2
|
|
12002
|
+
];
|
|
12003
|
+
var gaussianDownResults = new Array(gaussianStep); //存放多个高斯Pass的模糊结果,用于Bloom
|
|
12004
|
+
var textureType1 = this.globalVolume.useHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
|
|
12005
|
+
var bloomThresholdPass = new BloomThresholdPass(renderer, {
|
|
12006
|
+
name: "BloomThresholdPass",
|
|
12007
|
+
attachments: [
|
|
12008
|
+
{
|
|
12009
|
+
texture: {
|
|
12010
|
+
format: glContext.RGBA,
|
|
12011
|
+
type: textureType1,
|
|
12012
|
+
minFilter: glContext.LINEAR,
|
|
12013
|
+
magFilter: glContext.LINEAR
|
|
12014
|
+
}
|
|
12015
|
+
}
|
|
12016
|
+
]
|
|
12017
|
+
});
|
|
12018
|
+
bloomThresholdPass.sceneTextureHandle = sceneTextureHandle;
|
|
12019
|
+
this.addRenderPass(bloomThresholdPass);
|
|
12020
|
+
for(var i = 0; i < gaussianStep; i++){
|
|
12021
|
+
gaussianDownResults[i] = new RenderTargetHandle(engine);
|
|
12022
|
+
var gaussianDownHPass = new HQGaussianDownSamplePass(renderer, "H", {
|
|
12023
|
+
name: "GaussianDownPassH" + i,
|
|
12024
|
+
viewport: viewport,
|
|
11992
12025
|
attachments: [
|
|
11993
12026
|
{
|
|
11994
12027
|
texture: {
|
|
@@ -12000,74 +12033,50 @@ var seed$6 = 1;
|
|
|
12000
12033
|
}
|
|
12001
12034
|
]
|
|
12002
12035
|
});
|
|
12003
|
-
|
|
12004
|
-
|
|
12005
|
-
|
|
12006
|
-
|
|
12007
|
-
|
|
12008
|
-
|
|
12009
|
-
|
|
12010
|
-
|
|
12011
|
-
|
|
12012
|
-
|
|
12013
|
-
format: glContext.RGBA,
|
|
12014
|
-
type: textureType1,
|
|
12015
|
-
minFilter: glContext.LINEAR,
|
|
12016
|
-
magFilter: glContext.LINEAR
|
|
12017
|
-
}
|
|
12018
|
-
}
|
|
12019
|
-
]
|
|
12020
|
-
});
|
|
12021
|
-
var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", {
|
|
12022
|
-
name: "GaussianDownPassV" + i,
|
|
12023
|
-
viewport: viewport,
|
|
12024
|
-
attachments: [
|
|
12025
|
-
{
|
|
12026
|
-
texture: {
|
|
12027
|
-
format: glContext.RGBA,
|
|
12028
|
-
type: textureType1,
|
|
12029
|
-
minFilter: glContext.LINEAR,
|
|
12030
|
-
magFilter: glContext.LINEAR
|
|
12031
|
-
}
|
|
12036
|
+
var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", {
|
|
12037
|
+
name: "GaussianDownPassV" + i,
|
|
12038
|
+
viewport: viewport,
|
|
12039
|
+
attachments: [
|
|
12040
|
+
{
|
|
12041
|
+
texture: {
|
|
12042
|
+
format: glContext.RGBA,
|
|
12043
|
+
type: textureType1,
|
|
12044
|
+
minFilter: glContext.LINEAR,
|
|
12045
|
+
magFilter: glContext.LINEAR
|
|
12032
12046
|
}
|
|
12033
|
-
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
|
|
12038
|
-
|
|
12039
|
-
|
|
12040
|
-
|
|
12041
|
-
|
|
12042
|
-
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
|
|
12046
|
-
|
|
12047
|
-
|
|
12048
|
-
|
|
12049
|
-
|
|
12050
|
-
|
|
12051
|
-
|
|
12052
|
-
|
|
12053
|
-
|
|
12054
|
-
|
|
12055
|
-
|
|
12047
|
+
}
|
|
12048
|
+
]
|
|
12049
|
+
});
|
|
12050
|
+
gaussianDownVPass.gaussianResult = gaussianDownResults[i];
|
|
12051
|
+
this.addRenderPass(gaussianDownHPass);
|
|
12052
|
+
this.addRenderPass(gaussianDownVPass);
|
|
12053
|
+
viewport[2] /= 2;
|
|
12054
|
+
viewport[3] /= 2;
|
|
12055
|
+
// TODO 限制最大迭代
|
|
12056
|
+
}
|
|
12057
|
+
viewport[2] *= 4;
|
|
12058
|
+
viewport[3] *= 4;
|
|
12059
|
+
for(var i1 = 0; i1 < gaussianStep - 1; i1++){
|
|
12060
|
+
var gaussianUpPass = new HQGaussianUpSamplePass(renderer, {
|
|
12061
|
+
name: "GaussianUpPass" + i1,
|
|
12062
|
+
viewport: viewport,
|
|
12063
|
+
attachments: [
|
|
12064
|
+
{
|
|
12065
|
+
texture: {
|
|
12066
|
+
format: glContext.RGBA,
|
|
12067
|
+
type: textureType1,
|
|
12068
|
+
minFilter: glContext.LINEAR,
|
|
12069
|
+
magFilter: glContext.LINEAR
|
|
12056
12070
|
}
|
|
12057
|
-
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
|
|
12061
|
-
|
|
12062
|
-
|
|
12063
|
-
|
|
12064
|
-
}
|
|
12065
|
-
var postProcessPass;
|
|
12066
|
-
if (useBloom) {
|
|
12067
|
-
postProcessPass = new ToneMappingPass(renderer, sceneTextureHandle);
|
|
12068
|
-
} else {
|
|
12069
|
-
postProcessPass = new ToneMappingPass(renderer);
|
|
12071
|
+
}
|
|
12072
|
+
]
|
|
12073
|
+
});
|
|
12074
|
+
gaussianUpPass.gaussianDownSampleResult = gaussianDownResults[gaussianStep - 2 - i1];
|
|
12075
|
+
this.addRenderPass(gaussianUpPass);
|
|
12076
|
+
viewport[2] *= 2;
|
|
12077
|
+
viewport[3] *= 2;
|
|
12070
12078
|
}
|
|
12079
|
+
var postProcessPass = new ToneMappingPass(renderer, sceneTextureHandle);
|
|
12071
12080
|
this.addRenderPass(postProcessPass);
|
|
12072
12081
|
}
|
|
12073
12082
|
this.semantics = new SemanticMap(options.semantics);
|
|
@@ -13104,6 +13113,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13104
13113
|
1
|
|
13105
13114
|
];
|
|
13106
13115
|
/** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
|
|
13116
|
+
_this.hasBeenAddedToComposition = false;
|
|
13107
13117
|
_this.getHitTestParams = function(force) {
|
|
13108
13118
|
if (!_this.clickable) {
|
|
13109
13119
|
return;
|
|
@@ -13122,7 +13132,6 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13122
13132
|
}
|
|
13123
13133
|
var _proto = InteractComponent.prototype;
|
|
13124
13134
|
_proto.start = function start() {
|
|
13125
|
-
var _this = this;
|
|
13126
13135
|
var options = this.item.props.content.options;
|
|
13127
13136
|
var env = this.item.engine.renderer.env;
|
|
13128
13137
|
var composition = this.item.composition;
|
|
@@ -13134,10 +13143,6 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13134
13143
|
this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
|
|
13135
13144
|
}
|
|
13136
13145
|
}
|
|
13137
|
-
composition.addInteractiveItem(this.item, options.type);
|
|
13138
|
-
this.item.onEnd = function() {
|
|
13139
|
-
return composition.removeInteractiveItem(_this.item, options.type);
|
|
13140
|
-
};
|
|
13141
13146
|
if (options.type === InteractType.DRAG) {
|
|
13142
13147
|
if (env !== PLAYER_OPTIONS_ENV_EDITOR || options.enableInEditor) {
|
|
13143
13148
|
composition.event && this.beginDragTarget(options, composition.event);
|
|
@@ -13152,6 +13157,11 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13152
13157
|
_proto.update = function update(dt) {
|
|
13153
13158
|
var _this_previewContent;
|
|
13154
13159
|
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
13160
|
+
if (!this.hasBeenAddedToComposition && this.item.composition) {
|
|
13161
|
+
var options = this.item.props.content.options;
|
|
13162
|
+
this.item.composition.addInteractiveItem(this.item, options.type);
|
|
13163
|
+
this.hasBeenAddedToComposition = true;
|
|
13164
|
+
}
|
|
13155
13165
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
13156
13166
|
return;
|
|
13157
13167
|
}
|
|
@@ -14875,8 +14885,7 @@ var RectangleEdge = /*#__PURE__*/ function() {
|
|
|
14875
14885
|
}();
|
|
14876
14886
|
var Edge = /*#__PURE__*/ function() {
|
|
14877
14887
|
function Edge(args) {
|
|
14878
|
-
|
|
14879
|
-
this._d = (args.width || 1) / 2;
|
|
14888
|
+
this._d = args.width || 1;
|
|
14880
14889
|
this.arcMode = args.arcMode;
|
|
14881
14890
|
}
|
|
14882
14891
|
var _proto = Edge.prototype;
|
|
@@ -16642,7 +16651,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16642
16651
|
}
|
|
16643
16652
|
}
|
|
16644
16653
|
}
|
|
16645
|
-
} else if (this.item.endBehavior ===
|
|
16654
|
+
} else if (this.item.endBehavior === EndBehavior.restart) {
|
|
16646
16655
|
updateTrail();
|
|
16647
16656
|
this.loopStartTime = now - duration;
|
|
16648
16657
|
this.lastEmitTime -= duration;
|
|
@@ -16661,12 +16670,12 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16661
16670
|
this.ended = true;
|
|
16662
16671
|
this.onEnd(this);
|
|
16663
16672
|
var endBehavior = this.item.endBehavior;
|
|
16664
|
-
if (endBehavior ===
|
|
16673
|
+
if (endBehavior === EndBehavior.freeze) {
|
|
16665
16674
|
this.frozen = true;
|
|
16666
16675
|
}
|
|
16667
16676
|
}
|
|
16668
|
-
} else if (this.item.endBehavior !==
|
|
16669
|
-
if (
|
|
16677
|
+
} else if (this.item.endBehavior !== EndBehavior.restart) {
|
|
16678
|
+
if (EndBehavior.destroy === this.item.endBehavior) {
|
|
16670
16679
|
var node = link.last;
|
|
16671
16680
|
if (node && node.content[0] < this.lastUpdate) {
|
|
16672
16681
|
this.destroyed = true;
|
|
@@ -18746,9 +18755,9 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
18746
18755
|
var localTime = time - this.start;
|
|
18747
18756
|
var duration = this.duration;
|
|
18748
18757
|
if (localTime - duration > 0.001) {
|
|
18749
|
-
if (this.endBehavior ===
|
|
18758
|
+
if (this.endBehavior === EndBehavior.restart) {
|
|
18750
18759
|
localTime = localTime % duration;
|
|
18751
|
-
} else if (this.endBehavior ===
|
|
18760
|
+
} else if (this.endBehavior === EndBehavior.freeze) {
|
|
18752
18761
|
localTime = Math.min(duration, localTime);
|
|
18753
18762
|
}
|
|
18754
18763
|
}
|
|
@@ -18874,7 +18883,7 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
18874
18883
|
var ended = false;
|
|
18875
18884
|
var started = false;
|
|
18876
18885
|
var boundObject = this.track.binding;
|
|
18877
|
-
if (localTime > clip.start + clip.duration + 0.001 && clip.endBehavior ===
|
|
18886
|
+
if (localTime > clip.start + clip.duration + 0.001 && clip.endBehavior === EndBehavior.destroy) {
|
|
18878
18887
|
if (_instanceof1(boundObject, exports.VFXItem) && exports.VFXItem.isParticle(boundObject) && this.particleSystem && !this.particleSystem.destroyed) {
|
|
18879
18888
|
weight = 1.0;
|
|
18880
18889
|
} else {
|
|
@@ -19182,7 +19191,7 @@ function compareTracks(a, b) {
|
|
|
19182
19191
|
this.resolveBindings();
|
|
19183
19192
|
this.timelinePlayable = this.timelineAsset.createPlayable(this.graph);
|
|
19184
19193
|
// 重播不销毁元素
|
|
19185
|
-
if (this.item.endBehavior !==
|
|
19194
|
+
if (this.item.endBehavior !== EndBehavior.destroy) {
|
|
19186
19195
|
this.setReusable(true);
|
|
19187
19196
|
}
|
|
19188
19197
|
};
|
|
@@ -19249,7 +19258,7 @@ function compareTracks(a, b) {
|
|
|
19249
19258
|
compositionComponent.refId = refId;
|
|
19250
19259
|
item.transform.parentTransform = this.transform;
|
|
19251
19260
|
this.item.composition.refContent.push(item);
|
|
19252
|
-
if (item.endBehavior ===
|
|
19261
|
+
if (item.endBehavior === EndBehavior.restart) {
|
|
19253
19262
|
this.item.composition.autoRefTex = false;
|
|
19254
19263
|
}
|
|
19255
19264
|
compositionComponent.createContent();
|
|
@@ -20201,6 +20210,105 @@ function geometryToTriangles(geometry) {
|
|
|
20201
20210
|
return res;
|
|
20202
20211
|
}
|
|
20203
20212
|
|
|
20213
|
+
exports.PostProcessVolume = /*#__PURE__*/ function(ItemBehaviour) {
|
|
20214
|
+
_inherits(PostProcessVolume, ItemBehaviour);
|
|
20215
|
+
function PostProcessVolume() {
|
|
20216
|
+
var _this;
|
|
20217
|
+
_this = ItemBehaviour.apply(this, arguments) || this;
|
|
20218
|
+
_this.useHDR = true;
|
|
20219
|
+
// Bloom
|
|
20220
|
+
_this.useBloom = true;
|
|
20221
|
+
_this.threshold = 1.0;
|
|
20222
|
+
_this.bloomIntensity = 1.0;
|
|
20223
|
+
// ColorAdjustments
|
|
20224
|
+
_this.brightness = 1.0;
|
|
20225
|
+
_this.saturation = 1.0;
|
|
20226
|
+
_this.contrast = 1.0;
|
|
20227
|
+
// Vignette
|
|
20228
|
+
_this.vignetteIntensity = 0.2;
|
|
20229
|
+
_this.vignetteSmoothness = 0.4;
|
|
20230
|
+
_this.vignetteRoundness = 1.0;
|
|
20231
|
+
// ToneMapping
|
|
20232
|
+
_this.useToneMapping = true // 1: true, 0: false
|
|
20233
|
+
;
|
|
20234
|
+
return _this;
|
|
20235
|
+
}
|
|
20236
|
+
var _proto = PostProcessVolume.prototype;
|
|
20237
|
+
_proto.start = function start() {
|
|
20238
|
+
var composition = this.item.composition;
|
|
20239
|
+
if (composition) {
|
|
20240
|
+
composition.globalVolume = {
|
|
20241
|
+
useHDR: this.useHDR,
|
|
20242
|
+
useBloom: this.useBloom,
|
|
20243
|
+
threshold: this.threshold,
|
|
20244
|
+
bloomIntensity: this.bloomIntensity,
|
|
20245
|
+
brightness: this.brightness,
|
|
20246
|
+
saturation: this.saturation,
|
|
20247
|
+
contrast: this.contrast,
|
|
20248
|
+
vignetteIntensity: this.vignetteIntensity,
|
|
20249
|
+
vignetteSmoothness: this.vignetteSmoothness,
|
|
20250
|
+
vignetteRoundness: this.vignetteRoundness,
|
|
20251
|
+
useToneMapping: this.useToneMapping
|
|
20252
|
+
};
|
|
20253
|
+
composition.createRenderFrame();
|
|
20254
|
+
}
|
|
20255
|
+
};
|
|
20256
|
+
_proto.update = function update(dt) {
|
|
20257
|
+
var composition = this.item.composition;
|
|
20258
|
+
if (composition) {
|
|
20259
|
+
var globalVolume = composition.renderFrame.globalVolume;
|
|
20260
|
+
globalVolume.useHDR = this.useHDR;
|
|
20261
|
+
globalVolume.useBloom = this.useBloom;
|
|
20262
|
+
globalVolume.threshold = this.threshold;
|
|
20263
|
+
globalVolume.bloomIntensity = this.bloomIntensity;
|
|
20264
|
+
globalVolume.brightness = this.brightness;
|
|
20265
|
+
globalVolume.saturation = this.saturation;
|
|
20266
|
+
globalVolume.contrast = this.contrast;
|
|
20267
|
+
globalVolume.vignetteIntensity = this.vignetteIntensity;
|
|
20268
|
+
globalVolume.vignetteSmoothness = this.vignetteSmoothness;
|
|
20269
|
+
globalVolume.vignetteRoundness = this.vignetteRoundness;
|
|
20270
|
+
globalVolume.useToneMapping = this.useToneMapping;
|
|
20271
|
+
}
|
|
20272
|
+
};
|
|
20273
|
+
return PostProcessVolume;
|
|
20274
|
+
}(ItemBehaviour);
|
|
20275
|
+
__decorate([
|
|
20276
|
+
serialize()
|
|
20277
|
+
], exports.PostProcessVolume.prototype, "useHDR", void 0);
|
|
20278
|
+
__decorate([
|
|
20279
|
+
serialize()
|
|
20280
|
+
], exports.PostProcessVolume.prototype, "useBloom", void 0);
|
|
20281
|
+
__decorate([
|
|
20282
|
+
serialize()
|
|
20283
|
+
], exports.PostProcessVolume.prototype, "threshold", void 0);
|
|
20284
|
+
__decorate([
|
|
20285
|
+
serialize()
|
|
20286
|
+
], exports.PostProcessVolume.prototype, "bloomIntensity", void 0);
|
|
20287
|
+
__decorate([
|
|
20288
|
+
serialize()
|
|
20289
|
+
], exports.PostProcessVolume.prototype, "brightness", void 0);
|
|
20290
|
+
__decorate([
|
|
20291
|
+
serialize()
|
|
20292
|
+
], exports.PostProcessVolume.prototype, "saturation", void 0);
|
|
20293
|
+
__decorate([
|
|
20294
|
+
serialize()
|
|
20295
|
+
], exports.PostProcessVolume.prototype, "contrast", void 0);
|
|
20296
|
+
__decorate([
|
|
20297
|
+
serialize()
|
|
20298
|
+
], exports.PostProcessVolume.prototype, "vignetteIntensity", void 0);
|
|
20299
|
+
__decorate([
|
|
20300
|
+
serialize()
|
|
20301
|
+
], exports.PostProcessVolume.prototype, "vignetteSmoothness", void 0);
|
|
20302
|
+
__decorate([
|
|
20303
|
+
serialize()
|
|
20304
|
+
], exports.PostProcessVolume.prototype, "vignetteRoundness", void 0);
|
|
20305
|
+
__decorate([
|
|
20306
|
+
serialize()
|
|
20307
|
+
], exports.PostProcessVolume.prototype, "useToneMapping", void 0);
|
|
20308
|
+
exports.PostProcessVolume = __decorate([
|
|
20309
|
+
effectsClass("PostProcessVolume")
|
|
20310
|
+
], exports.PostProcessVolume);
|
|
20311
|
+
|
|
20204
20312
|
exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
20205
20313
|
_inherits(VFXItem, EffectsObject);
|
|
20206
20314
|
function VFXItem(engine, props) {
|
|
@@ -20424,7 +20532,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20424
20532
|
/**
|
|
20425
20533
|
* 获取元素用于计算光线投射的面片类型和参数
|
|
20426
20534
|
* @override
|
|
20427
|
-
* @param force 元素没有开启交互也返回参数
|
|
20535
|
+
* @param force - 元素没有开启交互也返回参数
|
|
20428
20536
|
*/ _proto.getHitTestParams = function getHitTestParams(force) {
|
|
20429
20537
|
// OVERRIDE
|
|
20430
20538
|
};
|
|
@@ -20674,42 +20782,6 @@ exports.Item = void 0;
|
|
|
20674
20782
|
}
|
|
20675
20783
|
Item.isNull = isNull;
|
|
20676
20784
|
})(exports.Item || (exports.Item = {}));
|
|
20677
|
-
/**
|
|
20678
|
-
* (待废弃) 根据元素的类型创建对应的 `VFXItem` 实例
|
|
20679
|
-
* @param props
|
|
20680
|
-
* @param composition
|
|
20681
|
-
*/ function createVFXItem(props, composition) {
|
|
20682
|
-
var type = props.type;
|
|
20683
|
-
var pluginName = props.pluginName;
|
|
20684
|
-
if (!pluginName) {
|
|
20685
|
-
switch(type){
|
|
20686
|
-
case ItemType.null:
|
|
20687
|
-
pluginName = "cal";
|
|
20688
|
-
break;
|
|
20689
|
-
case ItemType.sprite:
|
|
20690
|
-
pluginName = "sprite";
|
|
20691
|
-
break;
|
|
20692
|
-
case ItemType.particle:
|
|
20693
|
-
pluginName = "particle";
|
|
20694
|
-
break;
|
|
20695
|
-
case ItemType.interact:
|
|
20696
|
-
pluginName = "interact";
|
|
20697
|
-
break;
|
|
20698
|
-
case ItemType.camera:
|
|
20699
|
-
pluginName = "camera";
|
|
20700
|
-
break;
|
|
20701
|
-
case ItemType.text:
|
|
20702
|
-
pluginName = "text";
|
|
20703
|
-
break;
|
|
20704
|
-
case ItemType.tree:
|
|
20705
|
-
pluginName = "tree";
|
|
20706
|
-
break;
|
|
20707
|
-
default:
|
|
20708
|
-
throw new Error("Invalid vfx item type.");
|
|
20709
|
-
}
|
|
20710
|
-
}
|
|
20711
|
-
return composition.pluginSystem.createPluginItem(pluginName, props, composition);
|
|
20712
|
-
}
|
|
20713
20785
|
|
|
20714
20786
|
var pluginLoaderMap = {};
|
|
20715
20787
|
var defaultPlugins = [];
|
|
@@ -20722,6 +20794,9 @@ var pluginCtrlMap = {};
|
|
|
20722
20794
|
* @param isDefault load
|
|
20723
20795
|
*/ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20724
20796
|
function registerPlugin(name, pluginClass, itemClass, isDefault) {
|
|
20797
|
+
if (pluginCtrlMap[name]) {
|
|
20798
|
+
logger.error("Duplicate registration for plugin " + name + ".");
|
|
20799
|
+
}
|
|
20725
20800
|
pluginCtrlMap[name] = itemClass;
|
|
20726
20801
|
pluginLoaderMap[name] = pluginClass;
|
|
20727
20802
|
if (isDefault) {
|
|
@@ -21300,8 +21375,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21300
21375
|
if (this.engine.objectInstance[guid]) {
|
|
21301
21376
|
return this.engine.objectInstance[guid];
|
|
21302
21377
|
}
|
|
21303
|
-
var effectsObject;
|
|
21304
21378
|
var effectsObjectData = this.findData(guid);
|
|
21379
|
+
var effectsObject;
|
|
21305
21380
|
if (!effectsObjectData) {
|
|
21306
21381
|
console.error("Object data with uuid: " + guid + " not found.");
|
|
21307
21382
|
return undefined;
|
|
@@ -21337,7 +21412,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21337
21412
|
_proto.loadGUIDAsync = function loadGUIDAsync(guid) {
|
|
21338
21413
|
var _this = this;
|
|
21339
21414
|
return _async_to_generator(function() {
|
|
21340
|
-
var
|
|
21415
|
+
var effectsObjectData, effectsObject, classConstructor;
|
|
21341
21416
|
return __generator(this, function(_state) {
|
|
21342
21417
|
switch(_state.label){
|
|
21343
21418
|
case 0:
|
|
@@ -22231,8 +22306,8 @@ function getStandardCameraContent(model) {
|
|
|
22231
22306
|
json.compositions.forEach(function(composition) {
|
|
22232
22307
|
composition.items.forEach(function(item) {
|
|
22233
22308
|
if (item.type === ItemType.null) {
|
|
22234
|
-
if (item.endBehavior ===
|
|
22235
|
-
item.endBehavior =
|
|
22309
|
+
if (item.endBehavior === EndBehavior.destroy) {
|
|
22310
|
+
item.endBehavior = EndBehavior.freeze;
|
|
22236
22311
|
}
|
|
22237
22312
|
}
|
|
22238
22313
|
});
|
|
@@ -22251,7 +22326,7 @@ function getStandardCameraContent(model) {
|
|
|
22251
22326
|
json.compositions.forEach(function(composition) {
|
|
22252
22327
|
composition.items.forEach(function(item) {
|
|
22253
22328
|
if (item.type === ItemType.mesh || item.type === ItemType.light) {
|
|
22254
|
-
item.endBehavior = item.endBehavior === 1 ?
|
|
22329
|
+
item.endBehavior = item.endBehavior === 1 ? EndBehavior.destroy : item.endBehavior;
|
|
22255
22330
|
}
|
|
22256
22331
|
});
|
|
22257
22332
|
});
|
|
@@ -22263,7 +22338,11 @@ function getStandardCameraContent(model) {
|
|
|
22263
22338
|
var _loop = function() {
|
|
22264
22339
|
var composition = _step1.value;
|
|
22265
22340
|
// composition 的 endBehavior 兼容
|
|
22266
|
-
if (
|
|
22341
|
+
if (// @ts-expect-error
|
|
22342
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
|
|
22343
|
+
composition.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY || // @ts-expect-error
|
|
22344
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
|
|
22345
|
+
composition.endBehavior === END_BEHAVIOR_PAUSE) {
|
|
22267
22346
|
composition.endBehavior = END_BEHAVIOR_FREEZE;
|
|
22268
22347
|
}
|
|
22269
22348
|
// 过滤掉滤镜元素
|
|
@@ -23050,13 +23129,13 @@ function getStandardItem(item, opt) {
|
|
|
23050
23129
|
var looping = (_originContent_options = originContent.options) == null ? void 0 : _originContent_options.looping;
|
|
23051
23130
|
if (looping) {
|
|
23052
23131
|
if (Array.isArray(looping)) {
|
|
23053
|
-
endBehavior = looping[1] ?
|
|
23132
|
+
endBehavior = looping[1] ? EndBehavior.restart : EndBehavior.destroy;
|
|
23054
23133
|
} else {
|
|
23055
|
-
endBehavior =
|
|
23134
|
+
endBehavior = EndBehavior.restart;
|
|
23056
23135
|
}
|
|
23057
23136
|
} else {
|
|
23058
23137
|
var _originContent_options1;
|
|
23059
|
-
endBehavior = endBehavior || (originContent == null ? void 0 : (_originContent_options1 = originContent.options) == null ? void 0 : _originContent_options1.endBehavior) ||
|
|
23138
|
+
endBehavior = endBehavior || (originContent == null ? void 0 : (_originContent_options1 = originContent.options) == null ? void 0 : _originContent_options1.endBehavior) || EndBehavior.destroy;
|
|
23060
23139
|
}
|
|
23061
23140
|
if (originContent.options.renderLevel) {
|
|
23062
23141
|
renderLevel = originContent.options.renderLevel;
|
|
@@ -23598,14 +23677,6 @@ var seed$1 = 1;
|
|
|
23598
23677
|
case 0:
|
|
23599
23678
|
// TODO: 后面切换到新的数据版本,就不用掉用 getStandardJSON 做转换了
|
|
23600
23679
|
jsonScene = getStandardJSON(json);
|
|
23601
|
-
// FIXME: hack globalVolume,specification 更新后需移除
|
|
23602
|
-
// @ts-expect-error
|
|
23603
|
-
json.compositions.forEach(function(composition, i) {
|
|
23604
|
-
if (composition.globalVolume) {
|
|
23605
|
-
// @ts-expect-error
|
|
23606
|
-
jsonScene.compositions[i].globalVolume = composition.globalVolume;
|
|
23607
|
-
}
|
|
23608
|
-
});
|
|
23609
23680
|
_jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins, sceneCompositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, images = jsonScene.images;
|
|
23610
23681
|
pluginSystem = new PluginSystem(plugins);
|
|
23611
23682
|
return [
|
|
@@ -24393,20 +24464,17 @@ var listOrder = 0;
|
|
|
24393
24464
|
}
|
|
24394
24465
|
var _proto = CompositionSourceManager.prototype;
|
|
24395
24466
|
_proto.getContent = function getContent(composition) {
|
|
24396
|
-
|
|
24397
|
-
// @ts-expect-error
|
|
24398
|
-
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;
|
|
24467
|
+
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;
|
|
24399
24468
|
var items = this.assembleItems(composition);
|
|
24400
24469
|
return _extends({}, composition, {
|
|
24401
24470
|
id: id,
|
|
24402
24471
|
duration: duration,
|
|
24403
24472
|
name: name,
|
|
24404
|
-
endBehavior: isNaN(endBehavior) ?
|
|
24473
|
+
endBehavior: isNaN(endBehavior) ? EndBehavior.freeze : endBehavior,
|
|
24405
24474
|
// looping,
|
|
24406
24475
|
items: items,
|
|
24407
24476
|
camera: camera,
|
|
24408
|
-
startTime: startTime
|
|
24409
|
-
globalVolume: globalVolume
|
|
24477
|
+
startTime: startTime
|
|
24410
24478
|
});
|
|
24411
24479
|
};
|
|
24412
24480
|
_proto.assembleItems = function assembleItems(composition) {
|
|
@@ -24568,7 +24636,6 @@ var listOrder = 0;
|
|
|
24568
24636
|
this.rootComposition = this.rootItem.addComponent(CompositionComponent);
|
|
24569
24637
|
this.rootComposition.data = sourceContent;
|
|
24570
24638
|
var imageUsage = !reusable && imgUsage;
|
|
24571
|
-
this.globalVolume = sourceContent.globalVolume;
|
|
24572
24639
|
this.width = width;
|
|
24573
24640
|
this.height = height;
|
|
24574
24641
|
this.renderOrder = baseRenderOrder;
|
|
@@ -24585,7 +24652,7 @@ var listOrder = 0;
|
|
|
24585
24652
|
};
|
|
24586
24653
|
this.reusable = reusable;
|
|
24587
24654
|
this.speed = speed;
|
|
24588
|
-
this.autoRefTex = !this.keepResource && imageUsage && this.rootItem.endBehavior !==
|
|
24655
|
+
this.autoRefTex = !this.keepResource && imageUsage && this.rootItem.endBehavior !== EndBehavior.restart;
|
|
24589
24656
|
this.name = sourceContent.name;
|
|
24590
24657
|
this.pluginSystem = pluginSystem;
|
|
24591
24658
|
this.pluginSystem.initializeComposition(this, scene);
|
|
@@ -24785,7 +24852,7 @@ var listOrder = 0;
|
|
|
24785
24852
|
* @returns 重新播放合成标志位
|
|
24786
24853
|
*/ _proto.shouldRestart = function shouldRestart() {
|
|
24787
24854
|
var _this_rootItem = this.rootItem, ended = _this_rootItem.ended, endBehavior = _this_rootItem.endBehavior;
|
|
24788
|
-
return ended && endBehavior ===
|
|
24855
|
+
return ended && endBehavior === EndBehavior.restart;
|
|
24789
24856
|
};
|
|
24790
24857
|
/**
|
|
24791
24858
|
* 是否合成需要销毁
|
|
@@ -24838,9 +24905,9 @@ var listOrder = 0;
|
|
|
24838
24905
|
var localTime = time - this.rootItem.start;
|
|
24839
24906
|
var duration = this.rootItem.duration;
|
|
24840
24907
|
if (localTime - duration > 0.001) {
|
|
24841
|
-
if (this.rootItem.endBehavior ===
|
|
24908
|
+
if (this.rootItem.endBehavior === EndBehavior.restart) {
|
|
24842
24909
|
localTime = localTime % duration;
|
|
24843
|
-
} else if (this.rootItem.endBehavior ===
|
|
24910
|
+
} else if (this.rootItem.endBehavior === EndBehavior.freeze) {
|
|
24844
24911
|
localTime = Math.min(duration, localTime);
|
|
24845
24912
|
}
|
|
24846
24913
|
}
|
|
@@ -24891,7 +24958,7 @@ var listOrder = 0;
|
|
|
24891
24958
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
24892
24959
|
var child = _step2.value;
|
|
24893
24960
|
if (exports.VFXItem.isComposition(child)) {
|
|
24894
|
-
if (child.ended && child.endBehavior ===
|
|
24961
|
+
if (child.ended && child.endBehavior === EndBehavior.restart) {
|
|
24895
24962
|
child.ended = false;
|
|
24896
24963
|
// TODO K帧动画在元素重建后需要 tick ,否则会导致元素位置和 k 帧第一帧位置不一致
|
|
24897
24964
|
this.callUpdate(child, 0);
|
|
@@ -25102,7 +25169,7 @@ var listOrder = 0;
|
|
|
25102
25169
|
var _this = this;
|
|
25103
25170
|
// 预合成元素销毁时销毁其中的item
|
|
25104
25171
|
if (item.type == ItemType.composition) {
|
|
25105
|
-
if (item.endBehavior !==
|
|
25172
|
+
if (item.endBehavior !== EndBehavior.freeze) {
|
|
25106
25173
|
var contentItems = item.getComponent(CompositionComponent).items;
|
|
25107
25174
|
contentItems.forEach(function(it) {
|
|
25108
25175
|
return _this.pluginSystem.plugins.forEach(function(loader) {
|
|
@@ -25361,65 +25428,1628 @@ var listOrder = 0;
|
|
|
25361
25428
|
return Composition;
|
|
25362
25429
|
}();
|
|
25363
25430
|
|
|
25364
|
-
|
|
25365
|
-
|
|
25366
|
-
|
|
25367
|
-
|
|
25368
|
-
|
|
25369
|
-
|
|
25370
|
-
|
|
25371
|
-
|
|
25372
|
-
|
|
25373
|
-
|
|
25374
|
-
|
|
25375
|
-
|
|
25376
|
-
|
|
25377
|
-
|
|
25378
|
-
|
|
25379
|
-
|
|
25380
|
-
|
|
25381
|
-
|
|
25431
|
+
var SIZEOF_SHORT = 2;
|
|
25432
|
+
var SIZEOF_INT = 4;
|
|
25433
|
+
var FILE_IDENTIFIER_LENGTH = 4;
|
|
25434
|
+
var SIZE_PREFIX_LENGTH = 4;
|
|
25435
|
+
|
|
25436
|
+
var int32 = new Int32Array(2);
|
|
25437
|
+
var float32 = new Float32Array(int32.buffer);
|
|
25438
|
+
var float64 = new Float64Array(int32.buffer);
|
|
25439
|
+
var isLittleEndian = new Uint16Array(new Uint8Array([
|
|
25440
|
+
1,
|
|
25441
|
+
0
|
|
25442
|
+
]).buffer)[0] === 1;
|
|
25443
|
+
|
|
25444
|
+
var Encoding;
|
|
25445
|
+
(function(Encoding) {
|
|
25446
|
+
Encoding[Encoding["UTF8_BYTES"] = 1] = "UTF8_BYTES";
|
|
25447
|
+
Encoding[Encoding["UTF16_STRING"] = 2] = "UTF16_STRING";
|
|
25448
|
+
})(Encoding || (Encoding = {}));
|
|
25449
|
+
|
|
25450
|
+
var ByteBuffer = /*#__PURE__*/ function() {
|
|
25451
|
+
function ByteBuffer(bytes_) {
|
|
25452
|
+
this.bytes_ = bytes_;
|
|
25453
|
+
this.position_ = 0;
|
|
25454
|
+
this.text_decoder_ = new TextDecoder();
|
|
25382
25455
|
}
|
|
25383
|
-
var _proto =
|
|
25384
|
-
_proto.
|
|
25385
|
-
this.
|
|
25386
|
-
this.objectInstance = {};
|
|
25456
|
+
var _proto = ByteBuffer.prototype;
|
|
25457
|
+
_proto.clear = function clear() {
|
|
25458
|
+
this.position_ = 0;
|
|
25387
25459
|
};
|
|
25388
|
-
|
|
25389
|
-
|
|
25460
|
+
/**
|
|
25461
|
+
* Get the underlying `Uint8Array`.
|
|
25462
|
+
*/ _proto.bytes = function bytes() {
|
|
25463
|
+
return this.bytes_;
|
|
25390
25464
|
};
|
|
25391
|
-
|
|
25392
|
-
|
|
25465
|
+
/**
|
|
25466
|
+
* Get the buffer's position.
|
|
25467
|
+
*/ _proto.position = function position() {
|
|
25468
|
+
return this.position_;
|
|
25393
25469
|
};
|
|
25394
|
-
|
|
25395
|
-
|
|
25470
|
+
/**
|
|
25471
|
+
* Set the buffer's position.
|
|
25472
|
+
*/ _proto.setPosition = function setPosition(position) {
|
|
25473
|
+
this.position_ = position;
|
|
25396
25474
|
};
|
|
25397
|
-
|
|
25398
|
-
|
|
25475
|
+
/**
|
|
25476
|
+
* Get the buffer's capacity.
|
|
25477
|
+
*/ _proto.capacity = function capacity() {
|
|
25478
|
+
return this.bytes_.length;
|
|
25399
25479
|
};
|
|
25400
|
-
_proto.
|
|
25401
|
-
|
|
25480
|
+
_proto.readInt8 = function readInt8(offset) {
|
|
25481
|
+
return this.readUint8(offset) << 24 >> 24;
|
|
25402
25482
|
};
|
|
25403
|
-
_proto.
|
|
25404
|
-
|
|
25405
|
-
|
|
25406
|
-
|
|
25407
|
-
|
|
25408
|
-
|
|
25409
|
-
|
|
25410
|
-
|
|
25411
|
-
|
|
25412
|
-
|
|
25483
|
+
_proto.readUint8 = function readUint8(offset) {
|
|
25484
|
+
return this.bytes_[offset];
|
|
25485
|
+
};
|
|
25486
|
+
_proto.readInt16 = function readInt16(offset) {
|
|
25487
|
+
return this.readUint16(offset) << 16 >> 16;
|
|
25488
|
+
};
|
|
25489
|
+
_proto.readUint16 = function readUint16(offset) {
|
|
25490
|
+
return this.bytes_[offset] | this.bytes_[offset + 1] << 8;
|
|
25491
|
+
};
|
|
25492
|
+
_proto.readInt32 = function readInt32(offset) {
|
|
25493
|
+
return this.bytes_[offset] | this.bytes_[offset + 1] << 8 | this.bytes_[offset + 2] << 16 | this.bytes_[offset + 3] << 24;
|
|
25494
|
+
};
|
|
25495
|
+
_proto.readUint32 = function readUint32(offset) {
|
|
25496
|
+
return this.readInt32(offset) >>> 0;
|
|
25497
|
+
};
|
|
25498
|
+
_proto.readInt64 = function readInt64(offset) {
|
|
25499
|
+
return BigInt.asIntN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
|
|
25500
|
+
};
|
|
25501
|
+
_proto.readUint64 = function readUint64(offset) {
|
|
25502
|
+
return BigInt.asUintN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
|
|
25503
|
+
};
|
|
25504
|
+
_proto.readFloat32 = function readFloat32(offset) {
|
|
25505
|
+
int32[0] = this.readInt32(offset);
|
|
25506
|
+
return float32[0];
|
|
25507
|
+
};
|
|
25508
|
+
_proto.readFloat64 = function readFloat64(offset) {
|
|
25509
|
+
int32[isLittleEndian ? 0 : 1] = this.readInt32(offset);
|
|
25510
|
+
int32[isLittleEndian ? 1 : 0] = this.readInt32(offset + 4);
|
|
25511
|
+
return float64[0];
|
|
25512
|
+
};
|
|
25513
|
+
_proto.writeInt8 = function writeInt8(offset, value) {
|
|
25514
|
+
this.bytes_[offset] = value;
|
|
25515
|
+
};
|
|
25516
|
+
_proto.writeUint8 = function writeUint8(offset, value) {
|
|
25517
|
+
this.bytes_[offset] = value;
|
|
25518
|
+
};
|
|
25519
|
+
_proto.writeInt16 = function writeInt16(offset, value) {
|
|
25520
|
+
this.bytes_[offset] = value;
|
|
25521
|
+
this.bytes_[offset + 1] = value >> 8;
|
|
25522
|
+
};
|
|
25523
|
+
_proto.writeUint16 = function writeUint16(offset, value) {
|
|
25524
|
+
this.bytes_[offset] = value;
|
|
25525
|
+
this.bytes_[offset + 1] = value >> 8;
|
|
25526
|
+
};
|
|
25527
|
+
_proto.writeInt32 = function writeInt32(offset, value) {
|
|
25528
|
+
this.bytes_[offset] = value;
|
|
25529
|
+
this.bytes_[offset + 1] = value >> 8;
|
|
25530
|
+
this.bytes_[offset + 2] = value >> 16;
|
|
25531
|
+
this.bytes_[offset + 3] = value >> 24;
|
|
25532
|
+
};
|
|
25533
|
+
_proto.writeUint32 = function writeUint32(offset, value) {
|
|
25534
|
+
this.bytes_[offset] = value;
|
|
25535
|
+
this.bytes_[offset + 1] = value >> 8;
|
|
25536
|
+
this.bytes_[offset + 2] = value >> 16;
|
|
25537
|
+
this.bytes_[offset + 3] = value >> 24;
|
|
25538
|
+
};
|
|
25539
|
+
_proto.writeInt64 = function writeInt64(offset, value) {
|
|
25540
|
+
this.writeInt32(offset, Number(BigInt.asIntN(32, value)));
|
|
25541
|
+
this.writeInt32(offset + 4, Number(BigInt.asIntN(32, value >> BigInt(32))));
|
|
25542
|
+
};
|
|
25543
|
+
_proto.writeUint64 = function writeUint64(offset, value) {
|
|
25544
|
+
this.writeUint32(offset, Number(BigInt.asUintN(32, value)));
|
|
25545
|
+
this.writeUint32(offset + 4, Number(BigInt.asUintN(32, value >> BigInt(32))));
|
|
25546
|
+
};
|
|
25547
|
+
_proto.writeFloat32 = function writeFloat32(offset, value) {
|
|
25548
|
+
float32[0] = value;
|
|
25549
|
+
this.writeInt32(offset, int32[0]);
|
|
25550
|
+
};
|
|
25551
|
+
_proto.writeFloat64 = function writeFloat64(offset, value) {
|
|
25552
|
+
float64[0] = value;
|
|
25553
|
+
this.writeInt32(offset, int32[isLittleEndian ? 0 : 1]);
|
|
25554
|
+
this.writeInt32(offset + 4, int32[isLittleEndian ? 1 : 0]);
|
|
25555
|
+
};
|
|
25556
|
+
/**
|
|
25557
|
+
* Return the file identifier. Behavior is undefined for FlatBuffers whose
|
|
25558
|
+
* schema does not include a file_identifier (likely points at padding or the
|
|
25559
|
+
* start of a the root vtable).
|
|
25560
|
+
*/ _proto.getBufferIdentifier = function getBufferIdentifier() {
|
|
25561
|
+
if (this.bytes_.length < this.position_ + SIZEOF_INT + FILE_IDENTIFIER_LENGTH) {
|
|
25562
|
+
throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");
|
|
25413
25563
|
}
|
|
25414
|
-
|
|
25415
|
-
|
|
25416
|
-
this.
|
|
25564
|
+
var result = "";
|
|
25565
|
+
for(var i = 0; i < FILE_IDENTIFIER_LENGTH; i++){
|
|
25566
|
+
result += String.fromCharCode(this.readInt8(this.position_ + SIZEOF_INT + i));
|
|
25417
25567
|
}
|
|
25418
|
-
|
|
25419
|
-
|
|
25420
|
-
|
|
25568
|
+
return result;
|
|
25569
|
+
};
|
|
25570
|
+
/**
|
|
25571
|
+
* Look up a field in the vtable, return an offset into the object, or 0 if the
|
|
25572
|
+
* field is not present.
|
|
25573
|
+
*/ _proto.__offset = function __offset(bb_pos, vtable_offset) {
|
|
25574
|
+
var vtable = bb_pos - this.readInt32(bb_pos);
|
|
25575
|
+
return vtable_offset < this.readInt16(vtable) ? this.readInt16(vtable + vtable_offset) : 0;
|
|
25576
|
+
};
|
|
25577
|
+
/**
|
|
25578
|
+
* Initialize any Table-derived type to point to the union at the given offset.
|
|
25579
|
+
*/ _proto.__union = function __union(t, offset) {
|
|
25580
|
+
t.bb_pos = offset + this.readInt32(offset);
|
|
25581
|
+
t.bb = this;
|
|
25582
|
+
return t;
|
|
25583
|
+
};
|
|
25584
|
+
/**
|
|
25585
|
+
* Create a JavaScript string from UTF-8 data stored inside the FlatBuffer.
|
|
25586
|
+
* This allocates a new string and converts to wide chars upon each access.
|
|
25587
|
+
*
|
|
25588
|
+
* To avoid the conversion to string, pass Encoding.UTF8_BYTES as the
|
|
25589
|
+
* "optionalEncoding" argument. This is useful for avoiding conversion when
|
|
25590
|
+
* the data will just be packaged back up in another FlatBuffer later on.
|
|
25591
|
+
*
|
|
25592
|
+
* @param offset
|
|
25593
|
+
* @param opt_encoding Defaults to UTF16_STRING
|
|
25594
|
+
*/ _proto.__string = function __string(offset, opt_encoding) {
|
|
25595
|
+
offset += this.readInt32(offset);
|
|
25596
|
+
var length = this.readInt32(offset);
|
|
25597
|
+
offset += SIZEOF_INT;
|
|
25598
|
+
var utf8bytes = this.bytes_.subarray(offset, offset + length);
|
|
25599
|
+
if (opt_encoding === Encoding.UTF8_BYTES) return utf8bytes;
|
|
25600
|
+
else return this.text_decoder_.decode(utf8bytes);
|
|
25601
|
+
};
|
|
25602
|
+
/**
|
|
25603
|
+
* Handle unions that can contain string as its member, if a Table-derived type then initialize it,
|
|
25604
|
+
* if a string then return a new one
|
|
25605
|
+
*
|
|
25606
|
+
* WARNING: strings are immutable in JS so we can't change the string that the user gave us, this
|
|
25607
|
+
* makes the behaviour of __union_with_string different compared to __union
|
|
25608
|
+
*/ _proto.__union_with_string = function __union_with_string(o, offset) {
|
|
25609
|
+
if (typeof o === "string") {
|
|
25610
|
+
return this.__string(offset);
|
|
25421
25611
|
}
|
|
25422
|
-
|
|
25612
|
+
return this.__union(o, offset);
|
|
25613
|
+
};
|
|
25614
|
+
/**
|
|
25615
|
+
* Retrieve the relative offset stored at "offset"
|
|
25616
|
+
*/ _proto.__indirect = function __indirect(offset) {
|
|
25617
|
+
return offset + this.readInt32(offset);
|
|
25618
|
+
};
|
|
25619
|
+
/**
|
|
25620
|
+
* Get the start of data of a vector whose offset is stored at "offset" in this object.
|
|
25621
|
+
*/ _proto.__vector = function __vector(offset) {
|
|
25622
|
+
return offset + this.readInt32(offset) + SIZEOF_INT; // data starts after the length
|
|
25623
|
+
};
|
|
25624
|
+
/**
|
|
25625
|
+
* Get the length of a vector whose offset is stored at "offset" in this object.
|
|
25626
|
+
*/ _proto.__vector_len = function __vector_len(offset) {
|
|
25627
|
+
return this.readInt32(offset + this.readInt32(offset));
|
|
25628
|
+
};
|
|
25629
|
+
_proto.__has_identifier = function __has_identifier(ident) {
|
|
25630
|
+
if (ident.length != FILE_IDENTIFIER_LENGTH) {
|
|
25631
|
+
throw new Error("FlatBuffers: file identifier must be length " + FILE_IDENTIFIER_LENGTH);
|
|
25632
|
+
}
|
|
25633
|
+
for(var i = 0; i < FILE_IDENTIFIER_LENGTH; i++){
|
|
25634
|
+
if (ident.charCodeAt(i) != this.readInt8(this.position() + SIZEOF_INT + i)) {
|
|
25635
|
+
return false;
|
|
25636
|
+
}
|
|
25637
|
+
}
|
|
25638
|
+
return true;
|
|
25639
|
+
};
|
|
25640
|
+
/**
|
|
25641
|
+
* A helper function for generating list for obj api
|
|
25642
|
+
*/ _proto.createScalarList = function createScalarList(listAccessor, listLength) {
|
|
25643
|
+
var ret = [];
|
|
25644
|
+
for(var i = 0; i < listLength; ++i){
|
|
25645
|
+
var val = listAccessor(i);
|
|
25646
|
+
if (val !== null) {
|
|
25647
|
+
ret.push(val);
|
|
25648
|
+
}
|
|
25649
|
+
}
|
|
25650
|
+
return ret;
|
|
25651
|
+
};
|
|
25652
|
+
/**
|
|
25653
|
+
* A helper function for generating list for obj api
|
|
25654
|
+
* @param listAccessor function that accepts an index and return data at that index
|
|
25655
|
+
* @param listLength listLength
|
|
25656
|
+
* @param res result list
|
|
25657
|
+
*/ _proto.createObjList = function createObjList(listAccessor, listLength) {
|
|
25658
|
+
var ret = [];
|
|
25659
|
+
for(var i = 0; i < listLength; ++i){
|
|
25660
|
+
var val = listAccessor(i);
|
|
25661
|
+
if (val !== null) {
|
|
25662
|
+
ret.push(val.unpack());
|
|
25663
|
+
}
|
|
25664
|
+
}
|
|
25665
|
+
return ret;
|
|
25666
|
+
};
|
|
25667
|
+
/**
|
|
25668
|
+
* Create and allocate a new ByteBuffer with a given size.
|
|
25669
|
+
*/ ByteBuffer.allocate = function allocate(byte_size) {
|
|
25670
|
+
return new ByteBuffer(new Uint8Array(byte_size));
|
|
25671
|
+
};
|
|
25672
|
+
return ByteBuffer;
|
|
25673
|
+
}();
|
|
25674
|
+
|
|
25675
|
+
var Builder = /*#__PURE__*/ function() {
|
|
25676
|
+
function Builder(opt_initial_size) {
|
|
25677
|
+
/** Minimum alignment encountered so far. */ this.minalign = 1;
|
|
25678
|
+
/** The vtable for the current table. */ this.vtable = null;
|
|
25679
|
+
/** The amount of fields we're actually using. */ this.vtable_in_use = 0;
|
|
25680
|
+
/** Whether we are currently serializing a table. */ this.isNested = false;
|
|
25681
|
+
/** Starting offset of the current struct/table. */ this.object_start = 0;
|
|
25682
|
+
/** List of offsets of all vtables. */ this.vtables = [];
|
|
25683
|
+
/** For the current vector being built. */ this.vector_num_elems = 0;
|
|
25684
|
+
/** False omits default values from the serialized data */ this.force_defaults = false;
|
|
25685
|
+
this.string_maps = null;
|
|
25686
|
+
this.text_encoder = new TextEncoder();
|
|
25687
|
+
var initial_size;
|
|
25688
|
+
if (!opt_initial_size) {
|
|
25689
|
+
initial_size = 1024;
|
|
25690
|
+
} else {
|
|
25691
|
+
initial_size = opt_initial_size;
|
|
25692
|
+
}
|
|
25693
|
+
/**
|
|
25694
|
+
* @type {ByteBuffer}
|
|
25695
|
+
* @private
|
|
25696
|
+
*/ this.bb = ByteBuffer.allocate(initial_size);
|
|
25697
|
+
this.space = initial_size;
|
|
25698
|
+
}
|
|
25699
|
+
var _proto = Builder.prototype;
|
|
25700
|
+
_proto.clear = function clear() {
|
|
25701
|
+
this.bb.clear();
|
|
25702
|
+
this.space = this.bb.capacity();
|
|
25703
|
+
this.minalign = 1;
|
|
25704
|
+
this.vtable = null;
|
|
25705
|
+
this.vtable_in_use = 0;
|
|
25706
|
+
this.isNested = false;
|
|
25707
|
+
this.object_start = 0;
|
|
25708
|
+
this.vtables = [];
|
|
25709
|
+
this.vector_num_elems = 0;
|
|
25710
|
+
this.force_defaults = false;
|
|
25711
|
+
this.string_maps = null;
|
|
25712
|
+
};
|
|
25713
|
+
/**
|
|
25714
|
+
* In order to save space, fields that are set to their default value
|
|
25715
|
+
* don't get serialized into the buffer. Forcing defaults provides a
|
|
25716
|
+
* way to manually disable this optimization.
|
|
25717
|
+
*
|
|
25718
|
+
* @param forceDefaults true always serializes default values
|
|
25719
|
+
*/ _proto.forceDefaults = function forceDefaults(forceDefaults) {
|
|
25720
|
+
this.force_defaults = forceDefaults;
|
|
25721
|
+
};
|
|
25722
|
+
/**
|
|
25723
|
+
* Get the ByteBuffer representing the FlatBuffer. Only call this after you've
|
|
25724
|
+
* called finish(). The actual data starts at the ByteBuffer's current position,
|
|
25725
|
+
* not necessarily at 0.
|
|
25726
|
+
*/ _proto.dataBuffer = function dataBuffer() {
|
|
25727
|
+
return this.bb;
|
|
25728
|
+
};
|
|
25729
|
+
/**
|
|
25730
|
+
* Get the bytes representing the FlatBuffer. Only call this after you've
|
|
25731
|
+
* called finish().
|
|
25732
|
+
*/ _proto.asUint8Array = function asUint8Array() {
|
|
25733
|
+
return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());
|
|
25734
|
+
};
|
|
25735
|
+
/**
|
|
25736
|
+
* Prepare to write an element of `size` after `additional_bytes` have been
|
|
25737
|
+
* written, e.g. if you write a string, you need to align such the int length
|
|
25738
|
+
* field is aligned to 4 bytes, and the string data follows it directly. If all
|
|
25739
|
+
* you need to do is alignment, `additional_bytes` will be 0.
|
|
25740
|
+
*
|
|
25741
|
+
* @param size This is the of the new element to write
|
|
25742
|
+
* @param additional_bytes The padding size
|
|
25743
|
+
*/ _proto.prep = function prep(size, additional_bytes) {
|
|
25744
|
+
// Track the biggest thing we've ever aligned to.
|
|
25745
|
+
if (size > this.minalign) {
|
|
25746
|
+
this.minalign = size;
|
|
25747
|
+
}
|
|
25748
|
+
// Find the amount of alignment needed such that `size` is properly
|
|
25749
|
+
// aligned after `additional_bytes`
|
|
25750
|
+
var align_size = ~(this.bb.capacity() - this.space + additional_bytes) + 1 & size - 1;
|
|
25751
|
+
// Reallocate the buffer if needed.
|
|
25752
|
+
while(this.space < align_size + size + additional_bytes){
|
|
25753
|
+
var old_buf_size = this.bb.capacity();
|
|
25754
|
+
this.bb = Builder.growByteBuffer(this.bb);
|
|
25755
|
+
this.space += this.bb.capacity() - old_buf_size;
|
|
25756
|
+
}
|
|
25757
|
+
this.pad(align_size);
|
|
25758
|
+
};
|
|
25759
|
+
_proto.pad = function pad(byte_size) {
|
|
25760
|
+
for(var i = 0; i < byte_size; i++){
|
|
25761
|
+
this.bb.writeInt8(--this.space, 0);
|
|
25762
|
+
}
|
|
25763
|
+
};
|
|
25764
|
+
_proto.writeInt8 = function writeInt8(value) {
|
|
25765
|
+
this.bb.writeInt8(this.space -= 1, value);
|
|
25766
|
+
};
|
|
25767
|
+
_proto.writeInt16 = function writeInt16(value) {
|
|
25768
|
+
this.bb.writeInt16(this.space -= 2, value);
|
|
25769
|
+
};
|
|
25770
|
+
_proto.writeInt32 = function writeInt32(value) {
|
|
25771
|
+
this.bb.writeInt32(this.space -= 4, value);
|
|
25772
|
+
};
|
|
25773
|
+
_proto.writeInt64 = function writeInt64(value) {
|
|
25774
|
+
this.bb.writeInt64(this.space -= 8, value);
|
|
25775
|
+
};
|
|
25776
|
+
_proto.writeFloat32 = function writeFloat32(value) {
|
|
25777
|
+
this.bb.writeFloat32(this.space -= 4, value);
|
|
25778
|
+
};
|
|
25779
|
+
_proto.writeFloat64 = function writeFloat64(value) {
|
|
25780
|
+
this.bb.writeFloat64(this.space -= 8, value);
|
|
25781
|
+
};
|
|
25782
|
+
/**
|
|
25783
|
+
* Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
25784
|
+
* @param value The `int8` to add the buffer.
|
|
25785
|
+
*/ _proto.addInt8 = function addInt8(value) {
|
|
25786
|
+
this.prep(1, 0);
|
|
25787
|
+
this.writeInt8(value);
|
|
25788
|
+
};
|
|
25789
|
+
/**
|
|
25790
|
+
* Add an `int16` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
25791
|
+
* @param value The `int16` to add the buffer.
|
|
25792
|
+
*/ _proto.addInt16 = function addInt16(value) {
|
|
25793
|
+
this.prep(2, 0);
|
|
25794
|
+
this.writeInt16(value);
|
|
25795
|
+
};
|
|
25796
|
+
/**
|
|
25797
|
+
* Add an `int32` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
25798
|
+
* @param value The `int32` to add the buffer.
|
|
25799
|
+
*/ _proto.addInt32 = function addInt32(value) {
|
|
25800
|
+
this.prep(4, 0);
|
|
25801
|
+
this.writeInt32(value);
|
|
25802
|
+
};
|
|
25803
|
+
/**
|
|
25804
|
+
* Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
25805
|
+
* @param value The `int64` to add the buffer.
|
|
25806
|
+
*/ _proto.addInt64 = function addInt64(value) {
|
|
25807
|
+
this.prep(8, 0);
|
|
25808
|
+
this.writeInt64(value);
|
|
25809
|
+
};
|
|
25810
|
+
/**
|
|
25811
|
+
* Add a `float32` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
25812
|
+
* @param value The `float32` to add the buffer.
|
|
25813
|
+
*/ _proto.addFloat32 = function addFloat32(value) {
|
|
25814
|
+
this.prep(4, 0);
|
|
25815
|
+
this.writeFloat32(value);
|
|
25816
|
+
};
|
|
25817
|
+
/**
|
|
25818
|
+
* Add a `float64` to the buffer, properly aligned, and grows the buffer (if necessary).
|
|
25819
|
+
* @param value The `float64` to add the buffer.
|
|
25820
|
+
*/ _proto.addFloat64 = function addFloat64(value) {
|
|
25821
|
+
this.prep(8, 0);
|
|
25822
|
+
this.writeFloat64(value);
|
|
25823
|
+
};
|
|
25824
|
+
_proto.addFieldInt8 = function addFieldInt8(voffset, value, defaultValue) {
|
|
25825
|
+
if (this.force_defaults || value != defaultValue) {
|
|
25826
|
+
this.addInt8(value);
|
|
25827
|
+
this.slot(voffset);
|
|
25828
|
+
}
|
|
25829
|
+
};
|
|
25830
|
+
_proto.addFieldInt16 = function addFieldInt16(voffset, value, defaultValue) {
|
|
25831
|
+
if (this.force_defaults || value != defaultValue) {
|
|
25832
|
+
this.addInt16(value);
|
|
25833
|
+
this.slot(voffset);
|
|
25834
|
+
}
|
|
25835
|
+
};
|
|
25836
|
+
_proto.addFieldInt32 = function addFieldInt32(voffset, value, defaultValue) {
|
|
25837
|
+
if (this.force_defaults || value != defaultValue) {
|
|
25838
|
+
this.addInt32(value);
|
|
25839
|
+
this.slot(voffset);
|
|
25840
|
+
}
|
|
25841
|
+
};
|
|
25842
|
+
_proto.addFieldInt64 = function addFieldInt64(voffset, value, defaultValue) {
|
|
25843
|
+
if (this.force_defaults || value !== defaultValue) {
|
|
25844
|
+
this.addInt64(value);
|
|
25845
|
+
this.slot(voffset);
|
|
25846
|
+
}
|
|
25847
|
+
};
|
|
25848
|
+
_proto.addFieldFloat32 = function addFieldFloat32(voffset, value, defaultValue) {
|
|
25849
|
+
if (this.force_defaults || value != defaultValue) {
|
|
25850
|
+
this.addFloat32(value);
|
|
25851
|
+
this.slot(voffset);
|
|
25852
|
+
}
|
|
25853
|
+
};
|
|
25854
|
+
_proto.addFieldFloat64 = function addFieldFloat64(voffset, value, defaultValue) {
|
|
25855
|
+
if (this.force_defaults || value != defaultValue) {
|
|
25856
|
+
this.addFloat64(value);
|
|
25857
|
+
this.slot(voffset);
|
|
25858
|
+
}
|
|
25859
|
+
};
|
|
25860
|
+
_proto.addFieldOffset = function addFieldOffset(voffset, value, defaultValue) {
|
|
25861
|
+
if (this.force_defaults || value != defaultValue) {
|
|
25862
|
+
this.addOffset(value);
|
|
25863
|
+
this.slot(voffset);
|
|
25864
|
+
}
|
|
25865
|
+
};
|
|
25866
|
+
/**
|
|
25867
|
+
* Structs are stored inline, so nothing additional is being added. `d` is always 0.
|
|
25868
|
+
*/ _proto.addFieldStruct = function addFieldStruct(voffset, value, defaultValue) {
|
|
25869
|
+
if (value != defaultValue) {
|
|
25870
|
+
this.nested(value);
|
|
25871
|
+
this.slot(voffset);
|
|
25872
|
+
}
|
|
25873
|
+
};
|
|
25874
|
+
/**
|
|
25875
|
+
* Structures are always stored inline, they need to be created right
|
|
25876
|
+
* where they're used. You'll get this assertion failure if you
|
|
25877
|
+
* created it elsewhere.
|
|
25878
|
+
*/ _proto.nested = function nested(obj) {
|
|
25879
|
+
if (obj != this.offset()) {
|
|
25880
|
+
throw new TypeError("FlatBuffers: struct must be serialized inline.");
|
|
25881
|
+
}
|
|
25882
|
+
};
|
|
25883
|
+
/**
|
|
25884
|
+
* Should not be creating any other object, string or vector
|
|
25885
|
+
* while an object is being constructed
|
|
25886
|
+
*/ _proto.notNested = function notNested() {
|
|
25887
|
+
if (this.isNested) {
|
|
25888
|
+
throw new TypeError("FlatBuffers: object serialization must not be nested.");
|
|
25889
|
+
}
|
|
25890
|
+
};
|
|
25891
|
+
/**
|
|
25892
|
+
* Set the current vtable at `voffset` to the current location in the buffer.
|
|
25893
|
+
*/ _proto.slot = function slot(voffset) {
|
|
25894
|
+
if (this.vtable !== null) this.vtable[voffset] = this.offset();
|
|
25895
|
+
};
|
|
25896
|
+
/**
|
|
25897
|
+
* @returns Offset relative to the end of the buffer.
|
|
25898
|
+
*/ _proto.offset = function offset() {
|
|
25899
|
+
return this.bb.capacity() - this.space;
|
|
25900
|
+
};
|
|
25901
|
+
/**
|
|
25902
|
+
* Adds on offset, relative to where it will be written.
|
|
25903
|
+
*
|
|
25904
|
+
* @param offset The offset to add.
|
|
25905
|
+
*/ _proto.addOffset = function addOffset(offset) {
|
|
25906
|
+
this.prep(SIZEOF_INT, 0); // Ensure alignment is already done.
|
|
25907
|
+
this.writeInt32(this.offset() - offset + SIZEOF_INT);
|
|
25908
|
+
};
|
|
25909
|
+
/**
|
|
25910
|
+
* Start encoding a new object in the buffer. Users will not usually need to
|
|
25911
|
+
* call this directly. The FlatBuffers compiler will generate helper methods
|
|
25912
|
+
* that call this method internally.
|
|
25913
|
+
*/ _proto.startObject = function startObject(numfields) {
|
|
25914
|
+
this.notNested();
|
|
25915
|
+
if (this.vtable == null) {
|
|
25916
|
+
this.vtable = [];
|
|
25917
|
+
}
|
|
25918
|
+
this.vtable_in_use = numfields;
|
|
25919
|
+
for(var i = 0; i < numfields; i++){
|
|
25920
|
+
this.vtable[i] = 0; // This will push additional elements as needed
|
|
25921
|
+
}
|
|
25922
|
+
this.isNested = true;
|
|
25923
|
+
this.object_start = this.offset();
|
|
25924
|
+
};
|
|
25925
|
+
/**
|
|
25926
|
+
* Finish off writing the object that is under construction.
|
|
25927
|
+
*
|
|
25928
|
+
* @returns The offset to the object inside `dataBuffer`
|
|
25929
|
+
*/ _proto.endObject = function endObject() {
|
|
25930
|
+
if (this.vtable == null || !this.isNested) {
|
|
25931
|
+
throw new Error("FlatBuffers: endObject called without startObject");
|
|
25932
|
+
}
|
|
25933
|
+
this.addInt32(0);
|
|
25934
|
+
var vtableloc = this.offset();
|
|
25935
|
+
// Trim trailing zeroes.
|
|
25936
|
+
var i = this.vtable_in_use - 1;
|
|
25937
|
+
// eslint-disable-next-line no-empty
|
|
25938
|
+
for(; i >= 0 && this.vtable[i] == 0; i--){}
|
|
25939
|
+
var trimmed_size = i + 1;
|
|
25940
|
+
// Write out the current vtable.
|
|
25941
|
+
for(; i >= 0; i--){
|
|
25942
|
+
// Offset relative to the start of the table.
|
|
25943
|
+
this.addInt16(this.vtable[i] != 0 ? vtableloc - this.vtable[i] : 0);
|
|
25944
|
+
}
|
|
25945
|
+
var standard_fields = 2; // The fields below:
|
|
25946
|
+
this.addInt16(vtableloc - this.object_start);
|
|
25947
|
+
var len = (trimmed_size + standard_fields) * SIZEOF_SHORT;
|
|
25948
|
+
this.addInt16(len);
|
|
25949
|
+
// Search for an existing vtable that matches the current one.
|
|
25950
|
+
var existing_vtable = 0;
|
|
25951
|
+
var vt1 = this.space;
|
|
25952
|
+
outer_loop: for(i = 0; i < this.vtables.length; i++){
|
|
25953
|
+
var vt2 = this.bb.capacity() - this.vtables[i];
|
|
25954
|
+
if (len == this.bb.readInt16(vt2)) {
|
|
25955
|
+
for(var j = SIZEOF_SHORT; j < len; j += SIZEOF_SHORT){
|
|
25956
|
+
if (this.bb.readInt16(vt1 + j) != this.bb.readInt16(vt2 + j)) {
|
|
25957
|
+
continue outer_loop;
|
|
25958
|
+
}
|
|
25959
|
+
}
|
|
25960
|
+
existing_vtable = this.vtables[i];
|
|
25961
|
+
break;
|
|
25962
|
+
}
|
|
25963
|
+
}
|
|
25964
|
+
if (existing_vtable) {
|
|
25965
|
+
// Found a match:
|
|
25966
|
+
// Remove the current vtable.
|
|
25967
|
+
this.space = this.bb.capacity() - vtableloc;
|
|
25968
|
+
// Point table to existing vtable.
|
|
25969
|
+
this.bb.writeInt32(this.space, existing_vtable - vtableloc);
|
|
25970
|
+
} else {
|
|
25971
|
+
// No match:
|
|
25972
|
+
// Add the location of the current vtable to the list of vtables.
|
|
25973
|
+
this.vtables.push(this.offset());
|
|
25974
|
+
// Point table to current vtable.
|
|
25975
|
+
this.bb.writeInt32(this.bb.capacity() - vtableloc, this.offset() - vtableloc);
|
|
25976
|
+
}
|
|
25977
|
+
this.isNested = false;
|
|
25978
|
+
return vtableloc;
|
|
25979
|
+
};
|
|
25980
|
+
/**
|
|
25981
|
+
* Finalize a buffer, poiting to the given `root_table`.
|
|
25982
|
+
*/ _proto.finish = function finish(root_table, opt_file_identifier, opt_size_prefix) {
|
|
25983
|
+
var size_prefix = opt_size_prefix ? SIZE_PREFIX_LENGTH : 0;
|
|
25984
|
+
if (opt_file_identifier) {
|
|
25985
|
+
var file_identifier = opt_file_identifier;
|
|
25986
|
+
this.prep(this.minalign, SIZEOF_INT + FILE_IDENTIFIER_LENGTH + size_prefix);
|
|
25987
|
+
if (file_identifier.length != FILE_IDENTIFIER_LENGTH) {
|
|
25988
|
+
throw new TypeError("FlatBuffers: file identifier must be length " + FILE_IDENTIFIER_LENGTH);
|
|
25989
|
+
}
|
|
25990
|
+
for(var i = FILE_IDENTIFIER_LENGTH - 1; i >= 0; i--){
|
|
25991
|
+
this.writeInt8(file_identifier.charCodeAt(i));
|
|
25992
|
+
}
|
|
25993
|
+
}
|
|
25994
|
+
this.prep(this.minalign, SIZEOF_INT + size_prefix);
|
|
25995
|
+
this.addOffset(root_table);
|
|
25996
|
+
if (size_prefix) {
|
|
25997
|
+
this.addInt32(this.bb.capacity() - this.space);
|
|
25998
|
+
}
|
|
25999
|
+
this.bb.setPosition(this.space);
|
|
26000
|
+
};
|
|
26001
|
+
/**
|
|
26002
|
+
* Finalize a size prefixed buffer, pointing to the given `root_table`.
|
|
26003
|
+
*/ _proto.finishSizePrefixed = function finishSizePrefixed(root_table, opt_file_identifier) {
|
|
26004
|
+
this.finish(root_table, opt_file_identifier, true);
|
|
26005
|
+
};
|
|
26006
|
+
/**
|
|
26007
|
+
* This checks a required field has been set in a given table that has
|
|
26008
|
+
* just been constructed.
|
|
26009
|
+
*/ _proto.requiredField = function requiredField(table, field) {
|
|
26010
|
+
var table_start = this.bb.capacity() - table;
|
|
26011
|
+
var vtable_start = table_start - this.bb.readInt32(table_start);
|
|
26012
|
+
var ok = field < this.bb.readInt16(vtable_start) && this.bb.readInt16(vtable_start + field) != 0;
|
|
26013
|
+
// If this fails, the caller will show what field needs to be set.
|
|
26014
|
+
if (!ok) {
|
|
26015
|
+
throw new TypeError("FlatBuffers: field " + field + " must be set");
|
|
26016
|
+
}
|
|
26017
|
+
};
|
|
26018
|
+
/**
|
|
26019
|
+
* Start a new array/vector of objects. Users usually will not call
|
|
26020
|
+
* this directly. The FlatBuffers compiler will create a start/end
|
|
26021
|
+
* method for vector types in generated code.
|
|
26022
|
+
*
|
|
26023
|
+
* @param elem_size The size of each element in the array
|
|
26024
|
+
* @param num_elems The number of elements in the array
|
|
26025
|
+
* @param alignment The alignment of the array
|
|
26026
|
+
*/ _proto.startVector = function startVector(elem_size, num_elems, alignment) {
|
|
26027
|
+
this.notNested();
|
|
26028
|
+
this.vector_num_elems = num_elems;
|
|
26029
|
+
this.prep(SIZEOF_INT, elem_size * num_elems);
|
|
26030
|
+
this.prep(alignment, elem_size * num_elems); // Just in case alignment > int.
|
|
26031
|
+
};
|
|
26032
|
+
/**
|
|
26033
|
+
* Finish off the creation of an array and all its elements. The array must be
|
|
26034
|
+
* created with `startVector`.
|
|
26035
|
+
*
|
|
26036
|
+
* @returns The offset at which the newly created array
|
|
26037
|
+
* starts.
|
|
26038
|
+
*/ _proto.endVector = function endVector() {
|
|
26039
|
+
this.writeInt32(this.vector_num_elems);
|
|
26040
|
+
return this.offset();
|
|
26041
|
+
};
|
|
26042
|
+
/**
|
|
26043
|
+
* Encode the string `s` in the buffer using UTF-8. If the string passed has
|
|
26044
|
+
* already been seen, we return the offset of the already written string
|
|
26045
|
+
*
|
|
26046
|
+
* @param s The string to encode
|
|
26047
|
+
* @return The offset in the buffer where the encoded string starts
|
|
26048
|
+
*/ _proto.createSharedString = function createSharedString(s) {
|
|
26049
|
+
if (!s) {
|
|
26050
|
+
return 0;
|
|
26051
|
+
}
|
|
26052
|
+
if (!this.string_maps) {
|
|
26053
|
+
this.string_maps = new Map();
|
|
26054
|
+
}
|
|
26055
|
+
if (this.string_maps.has(s)) {
|
|
26056
|
+
return this.string_maps.get(s);
|
|
26057
|
+
}
|
|
26058
|
+
var offset = this.createString(s);
|
|
26059
|
+
this.string_maps.set(s, offset);
|
|
26060
|
+
return offset;
|
|
26061
|
+
};
|
|
26062
|
+
/**
|
|
26063
|
+
* Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed
|
|
26064
|
+
* instead of a string, it is assumed to contain valid UTF-8 encoded data.
|
|
26065
|
+
*
|
|
26066
|
+
* @param s The string to encode
|
|
26067
|
+
* @return The offset in the buffer where the encoded string starts
|
|
26068
|
+
*/ _proto.createString = function createString(s) {
|
|
26069
|
+
if (s === null || s === undefined) {
|
|
26070
|
+
return 0;
|
|
26071
|
+
}
|
|
26072
|
+
var utf8;
|
|
26073
|
+
if (_instanceof1(s, Uint8Array)) {
|
|
26074
|
+
utf8 = s;
|
|
26075
|
+
} else {
|
|
26076
|
+
utf8 = this.text_encoder.encode(s);
|
|
26077
|
+
}
|
|
26078
|
+
this.addInt8(0);
|
|
26079
|
+
this.startVector(1, utf8.length, 1);
|
|
26080
|
+
this.bb.setPosition(this.space -= utf8.length);
|
|
26081
|
+
this.bb.bytes().set(utf8, this.space);
|
|
26082
|
+
return this.endVector();
|
|
26083
|
+
};
|
|
26084
|
+
/**
|
|
26085
|
+
* Create a byte vector.
|
|
26086
|
+
*
|
|
26087
|
+
* @param v The bytes to add
|
|
26088
|
+
* @returns The offset in the buffer where the byte vector starts
|
|
26089
|
+
*/ _proto.createByteVector = function createByteVector(v) {
|
|
26090
|
+
if (v === null || v === undefined) {
|
|
26091
|
+
return 0;
|
|
26092
|
+
}
|
|
26093
|
+
this.startVector(1, v.length, 1);
|
|
26094
|
+
this.bb.setPosition(this.space -= v.length);
|
|
26095
|
+
this.bb.bytes().set(v, this.space);
|
|
26096
|
+
return this.endVector();
|
|
26097
|
+
};
|
|
26098
|
+
/**
|
|
26099
|
+
* A helper function to pack an object
|
|
26100
|
+
*
|
|
26101
|
+
* @returns offset of obj
|
|
26102
|
+
*/ _proto.createObjectOffset = function createObjectOffset(obj) {
|
|
26103
|
+
if (obj === null) {
|
|
26104
|
+
return 0;
|
|
26105
|
+
}
|
|
26106
|
+
if (typeof obj === "string") {
|
|
26107
|
+
return this.createString(obj);
|
|
26108
|
+
} else {
|
|
26109
|
+
return obj.pack(this);
|
|
26110
|
+
}
|
|
26111
|
+
};
|
|
26112
|
+
/**
|
|
26113
|
+
* A helper function to pack a list of object
|
|
26114
|
+
*
|
|
26115
|
+
* @returns list of offsets of each non null object
|
|
26116
|
+
*/ _proto.createObjectOffsetList = function createObjectOffsetList(list) {
|
|
26117
|
+
var ret = [];
|
|
26118
|
+
for(var i = 0; i < list.length; ++i){
|
|
26119
|
+
var val = list[i];
|
|
26120
|
+
if (val !== null) {
|
|
26121
|
+
ret.push(this.createObjectOffset(val));
|
|
26122
|
+
} else {
|
|
26123
|
+
throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");
|
|
26124
|
+
}
|
|
26125
|
+
}
|
|
26126
|
+
return ret;
|
|
26127
|
+
};
|
|
26128
|
+
_proto.createStructOffsetList = function createStructOffsetList(list, startFunc) {
|
|
26129
|
+
startFunc(this, list.length);
|
|
26130
|
+
this.createObjectOffsetList(list.slice().reverse());
|
|
26131
|
+
return this.endVector();
|
|
26132
|
+
};
|
|
26133
|
+
/**
|
|
26134
|
+
* Doubles the size of the backing ByteBuffer and copies the old data towards
|
|
26135
|
+
* the end of the new buffer (since we build the buffer backwards).
|
|
26136
|
+
*
|
|
26137
|
+
* @param bb The current buffer with the existing data
|
|
26138
|
+
* @returns A new byte buffer with the old data copied
|
|
26139
|
+
* to it. The data is located at the end of the buffer.
|
|
26140
|
+
*
|
|
26141
|
+
* uint8Array.set() formally takes {Array<number>|ArrayBufferView}, so to pass
|
|
26142
|
+
* it a uint8Array we need to suppress the type check:
|
|
26143
|
+
* @suppress {checkTypes}
|
|
26144
|
+
*/ Builder.growByteBuffer = function growByteBuffer(bb) {
|
|
26145
|
+
var old_buf_size = bb.capacity();
|
|
26146
|
+
// Ensure we don't grow beyond what fits in an int.
|
|
26147
|
+
if (old_buf_size & 0xC0000000) {
|
|
26148
|
+
throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");
|
|
26149
|
+
}
|
|
26150
|
+
var new_buf_size = old_buf_size << 1;
|
|
26151
|
+
var nbb = ByteBuffer.allocate(new_buf_size);
|
|
26152
|
+
nbb.setPosition(new_buf_size - old_buf_size);
|
|
26153
|
+
nbb.bytes().set(bb.bytes(), new_buf_size - old_buf_size);
|
|
26154
|
+
return nbb;
|
|
26155
|
+
};
|
|
26156
|
+
return Builder;
|
|
26157
|
+
}();
|
|
26158
|
+
|
|
26159
|
+
// automatically generated by the FlatBuffers compiler, do not modify
|
|
26160
|
+
var FBEffectsObjectData = /*#__PURE__*/ function() {
|
|
26161
|
+
function FBEffectsObjectData() {
|
|
26162
|
+
this.bb = null;
|
|
26163
|
+
this.bb_pos = 0;
|
|
26164
|
+
}
|
|
26165
|
+
var _proto = FBEffectsObjectData.prototype;
|
|
26166
|
+
_proto.__init = function __init(i, bb) {
|
|
26167
|
+
this.bb_pos = i;
|
|
26168
|
+
this.bb = bb;
|
|
26169
|
+
return this;
|
|
26170
|
+
};
|
|
26171
|
+
_proto.dataType = function dataType(optionalEncoding) {
|
|
26172
|
+
var offset = this.bb.__offset(this.bb_pos, 4);
|
|
26173
|
+
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
26174
|
+
};
|
|
26175
|
+
_proto.data = function data(index) {
|
|
26176
|
+
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
26177
|
+
return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
|
|
26178
|
+
};
|
|
26179
|
+
_proto.dataLength = function dataLength() {
|
|
26180
|
+
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
26181
|
+
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
26182
|
+
};
|
|
26183
|
+
_proto.dataArray = function dataArray() {
|
|
26184
|
+
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
26185
|
+
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;
|
|
26186
|
+
};
|
|
26187
|
+
_proto.unpack = function unpack() {
|
|
26188
|
+
return new FBEffectsObjectDataT(this.dataType(), this.bb.createScalarList(this.data.bind(this), this.dataLength()));
|
|
26189
|
+
};
|
|
26190
|
+
_proto.unpackTo = function unpackTo(_o) {
|
|
26191
|
+
_o.dataType = this.dataType();
|
|
26192
|
+
_o.data = this.bb.createScalarList(this.data.bind(this), this.dataLength());
|
|
26193
|
+
};
|
|
26194
|
+
FBEffectsObjectData.getRootAsFBEffectsObjectData = function getRootAsFBEffectsObjectData(bb, obj) {
|
|
26195
|
+
return (obj || new FBEffectsObjectData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26196
|
+
};
|
|
26197
|
+
FBEffectsObjectData.getSizePrefixedRootAsFBEffectsObjectData = function getSizePrefixedRootAsFBEffectsObjectData(bb, obj) {
|
|
26198
|
+
bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
|
|
26199
|
+
return (obj || new FBEffectsObjectData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26200
|
+
};
|
|
26201
|
+
FBEffectsObjectData.startFBEffectsObjectData = function startFBEffectsObjectData(builder) {
|
|
26202
|
+
builder.startObject(2);
|
|
26203
|
+
};
|
|
26204
|
+
FBEffectsObjectData.addDataType = function addDataType(builder, dataTypeOffset) {
|
|
26205
|
+
builder.addFieldOffset(0, dataTypeOffset, 0);
|
|
26206
|
+
};
|
|
26207
|
+
FBEffectsObjectData.addData = function addData(builder, dataOffset) {
|
|
26208
|
+
builder.addFieldOffset(1, dataOffset, 0);
|
|
26209
|
+
};
|
|
26210
|
+
FBEffectsObjectData.createDataVector = function createDataVector(builder, data) {
|
|
26211
|
+
builder.startVector(1, data.length, 1);
|
|
26212
|
+
for(var i = data.length - 1; i >= 0; i--){
|
|
26213
|
+
builder.addInt8(data[i]);
|
|
26214
|
+
}
|
|
26215
|
+
return builder.endVector();
|
|
26216
|
+
};
|
|
26217
|
+
FBEffectsObjectData.startDataVector = function startDataVector(builder, numElems) {
|
|
26218
|
+
builder.startVector(1, numElems, 1);
|
|
26219
|
+
};
|
|
26220
|
+
FBEffectsObjectData.endFBEffectsObjectData = function endFBEffectsObjectData(builder) {
|
|
26221
|
+
var offset = builder.endObject();
|
|
26222
|
+
return offset;
|
|
26223
|
+
};
|
|
26224
|
+
FBEffectsObjectData.createFBEffectsObjectData = function createFBEffectsObjectData(builder, dataTypeOffset, dataOffset) {
|
|
26225
|
+
FBEffectsObjectData.startFBEffectsObjectData(builder);
|
|
26226
|
+
FBEffectsObjectData.addDataType(builder, dataTypeOffset);
|
|
26227
|
+
FBEffectsObjectData.addData(builder, dataOffset);
|
|
26228
|
+
return FBEffectsObjectData.endFBEffectsObjectData(builder);
|
|
26229
|
+
};
|
|
26230
|
+
return FBEffectsObjectData;
|
|
26231
|
+
}();
|
|
26232
|
+
var FBEffectsObjectDataT = /*#__PURE__*/ function() {
|
|
26233
|
+
function FBEffectsObjectDataT(dataType, data) {
|
|
26234
|
+
if (dataType === void 0) dataType = null;
|
|
26235
|
+
if (data === void 0) data = [];
|
|
26236
|
+
this.dataType = dataType;
|
|
26237
|
+
this.data = data;
|
|
26238
|
+
}
|
|
26239
|
+
var _proto = FBEffectsObjectDataT.prototype;
|
|
26240
|
+
_proto.pack = function pack(builder) {
|
|
26241
|
+
var dataType = this.dataType !== null ? builder.createString(this.dataType) : 0;
|
|
26242
|
+
var data = FBEffectsObjectData.createDataVector(builder, this.data);
|
|
26243
|
+
return FBEffectsObjectData.createFBEffectsObjectData(builder, dataType, data);
|
|
26244
|
+
};
|
|
26245
|
+
return FBEffectsObjectDataT;
|
|
26246
|
+
}();
|
|
26247
|
+
|
|
26248
|
+
// automatically generated by the FlatBuffers compiler, do not modify
|
|
26249
|
+
var FBEffectsPackageData = /*#__PURE__*/ function() {
|
|
26250
|
+
function FBEffectsPackageData() {
|
|
26251
|
+
this.bb = null;
|
|
26252
|
+
this.bb_pos = 0;
|
|
26253
|
+
}
|
|
26254
|
+
var _proto = FBEffectsPackageData.prototype;
|
|
26255
|
+
_proto.__init = function __init(i, bb) {
|
|
26256
|
+
this.bb_pos = i;
|
|
26257
|
+
this.bb = bb;
|
|
26258
|
+
return this;
|
|
26259
|
+
};
|
|
26260
|
+
_proto.exportObjects = function exportObjects(index, obj) {
|
|
26261
|
+
var offset = this.bb.__offset(this.bb_pos, 4);
|
|
26262
|
+
return offset ? (obj || new FBEffectsObjectData()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
|
|
26263
|
+
};
|
|
26264
|
+
_proto.exportObjectsLength = function exportObjectsLength() {
|
|
26265
|
+
var offset = this.bb.__offset(this.bb_pos, 4);
|
|
26266
|
+
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
26267
|
+
};
|
|
26268
|
+
_proto.unpack = function unpack() {
|
|
26269
|
+
return new FBEffectsPackageDataT(this.bb.createObjList(this.exportObjects.bind(this), this.exportObjectsLength()));
|
|
26270
|
+
};
|
|
26271
|
+
_proto.unpackTo = function unpackTo(_o) {
|
|
26272
|
+
_o.exportObjects = this.bb.createObjList(this.exportObjects.bind(this), this.exportObjectsLength());
|
|
26273
|
+
};
|
|
26274
|
+
FBEffectsPackageData.getRootAsFBEffectsPackageData = function getRootAsFBEffectsPackageData(bb, obj) {
|
|
26275
|
+
return (obj || new FBEffectsPackageData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26276
|
+
};
|
|
26277
|
+
FBEffectsPackageData.getSizePrefixedRootAsFBEffectsPackageData = function getSizePrefixedRootAsFBEffectsPackageData(bb, obj) {
|
|
26278
|
+
bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
|
|
26279
|
+
return (obj || new FBEffectsPackageData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26280
|
+
};
|
|
26281
|
+
FBEffectsPackageData.startFBEffectsPackageData = function startFBEffectsPackageData(builder) {
|
|
26282
|
+
builder.startObject(1);
|
|
26283
|
+
};
|
|
26284
|
+
FBEffectsPackageData.addExportObjects = function addExportObjects(builder, exportObjectsOffset) {
|
|
26285
|
+
builder.addFieldOffset(0, exportObjectsOffset, 0);
|
|
26286
|
+
};
|
|
26287
|
+
FBEffectsPackageData.createExportObjectsVector = function createExportObjectsVector(builder, data) {
|
|
26288
|
+
builder.startVector(4, data.length, 4);
|
|
26289
|
+
for(var i = data.length - 1; i >= 0; i--){
|
|
26290
|
+
builder.addOffset(data[i]);
|
|
26291
|
+
}
|
|
26292
|
+
return builder.endVector();
|
|
26293
|
+
};
|
|
26294
|
+
FBEffectsPackageData.startExportObjectsVector = function startExportObjectsVector(builder, numElems) {
|
|
26295
|
+
builder.startVector(4, numElems, 4);
|
|
26296
|
+
};
|
|
26297
|
+
FBEffectsPackageData.endFBEffectsPackageData = function endFBEffectsPackageData(builder) {
|
|
26298
|
+
var offset = builder.endObject();
|
|
26299
|
+
return offset;
|
|
26300
|
+
};
|
|
26301
|
+
FBEffectsPackageData.finishFBEffectsPackageDataBuffer = function finishFBEffectsPackageDataBuffer(builder, offset) {
|
|
26302
|
+
builder.finish(offset);
|
|
26303
|
+
};
|
|
26304
|
+
FBEffectsPackageData.finishSizePrefixedFBEffectsPackageDataBuffer = function finishSizePrefixedFBEffectsPackageDataBuffer(builder, offset) {
|
|
26305
|
+
builder.finish(offset, undefined, true);
|
|
26306
|
+
};
|
|
26307
|
+
FBEffectsPackageData.createFBEffectsPackageData = function createFBEffectsPackageData(builder, exportObjectsOffset) {
|
|
26308
|
+
FBEffectsPackageData.startFBEffectsPackageData(builder);
|
|
26309
|
+
FBEffectsPackageData.addExportObjects(builder, exportObjectsOffset);
|
|
26310
|
+
return FBEffectsPackageData.endFBEffectsPackageData(builder);
|
|
26311
|
+
};
|
|
26312
|
+
return FBEffectsPackageData;
|
|
26313
|
+
}();
|
|
26314
|
+
var FBEffectsPackageDataT = /*#__PURE__*/ function() {
|
|
26315
|
+
function FBEffectsPackageDataT(exportObjects) {
|
|
26316
|
+
if (exportObjects === void 0) exportObjects = [];
|
|
26317
|
+
this.exportObjects = exportObjects;
|
|
26318
|
+
}
|
|
26319
|
+
var _proto = FBEffectsPackageDataT.prototype;
|
|
26320
|
+
_proto.pack = function pack(builder) {
|
|
26321
|
+
var exportObjects = FBEffectsPackageData.createExportObjectsVector(builder, builder.createObjectOffsetList(this.exportObjects));
|
|
26322
|
+
return FBEffectsPackageData.createFBEffectsPackageData(builder, exportObjects);
|
|
26323
|
+
};
|
|
26324
|
+
return FBEffectsPackageDataT;
|
|
26325
|
+
}();
|
|
26326
|
+
|
|
26327
|
+
// automatically generated by the FlatBuffers compiler, do not modify
|
|
26328
|
+
var FBSubMesh = /*#__PURE__*/ function() {
|
|
26329
|
+
function FBSubMesh() {
|
|
26330
|
+
this.bb = null;
|
|
26331
|
+
this.bb_pos = 0;
|
|
26332
|
+
}
|
|
26333
|
+
var _proto = FBSubMesh.prototype;
|
|
26334
|
+
_proto.__init = function __init(i, bb) {
|
|
26335
|
+
this.bb_pos = i;
|
|
26336
|
+
this.bb = bb;
|
|
26337
|
+
return this;
|
|
26338
|
+
};
|
|
26339
|
+
_proto.offset = function offset() {
|
|
26340
|
+
var offset = this.bb.__offset(this.bb_pos, 4);
|
|
26341
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26342
|
+
};
|
|
26343
|
+
_proto.indexCount = function indexCount() {
|
|
26344
|
+
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
26345
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26346
|
+
};
|
|
26347
|
+
_proto.vertexCount = function vertexCount() {
|
|
26348
|
+
var offset = this.bb.__offset(this.bb_pos, 8);
|
|
26349
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26350
|
+
};
|
|
26351
|
+
_proto.unpack = function unpack() {
|
|
26352
|
+
return new FBSubMeshT(this.offset(), this.indexCount(), this.vertexCount());
|
|
26353
|
+
};
|
|
26354
|
+
_proto.unpackTo = function unpackTo(_o) {
|
|
26355
|
+
_o.offset = this.offset();
|
|
26356
|
+
_o.indexCount = this.indexCount();
|
|
26357
|
+
_o.vertexCount = this.vertexCount();
|
|
26358
|
+
};
|
|
26359
|
+
FBSubMesh.getRootAsFBSubMesh = function getRootAsFBSubMesh(bb, obj) {
|
|
26360
|
+
return (obj || new FBSubMesh()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26361
|
+
};
|
|
26362
|
+
FBSubMesh.getSizePrefixedRootAsFBSubMesh = function getSizePrefixedRootAsFBSubMesh(bb, obj) {
|
|
26363
|
+
bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
|
|
26364
|
+
return (obj || new FBSubMesh()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26365
|
+
};
|
|
26366
|
+
FBSubMesh.startFBSubMesh = function startFBSubMesh(builder) {
|
|
26367
|
+
builder.startObject(3);
|
|
26368
|
+
};
|
|
26369
|
+
FBSubMesh.addOffset = function addOffset(builder, offset) {
|
|
26370
|
+
builder.addFieldInt32(0, offset, 0);
|
|
26371
|
+
};
|
|
26372
|
+
FBSubMesh.addIndexCount = function addIndexCount(builder, indexCount) {
|
|
26373
|
+
builder.addFieldInt32(1, indexCount, 0);
|
|
26374
|
+
};
|
|
26375
|
+
FBSubMesh.addVertexCount = function addVertexCount(builder, vertexCount) {
|
|
26376
|
+
builder.addFieldInt32(2, vertexCount, 0);
|
|
26377
|
+
};
|
|
26378
|
+
FBSubMesh.endFBSubMesh = function endFBSubMesh(builder) {
|
|
26379
|
+
var offset = builder.endObject();
|
|
26380
|
+
return offset;
|
|
26381
|
+
};
|
|
26382
|
+
FBSubMesh.createFBSubMesh = function createFBSubMesh(builder, offset, indexCount, vertexCount) {
|
|
26383
|
+
FBSubMesh.startFBSubMesh(builder);
|
|
26384
|
+
FBSubMesh.addOffset(builder, offset);
|
|
26385
|
+
FBSubMesh.addIndexCount(builder, indexCount);
|
|
26386
|
+
FBSubMesh.addVertexCount(builder, vertexCount);
|
|
26387
|
+
return FBSubMesh.endFBSubMesh(builder);
|
|
26388
|
+
};
|
|
26389
|
+
return FBSubMesh;
|
|
26390
|
+
}();
|
|
26391
|
+
var FBSubMeshT = /*#__PURE__*/ function() {
|
|
26392
|
+
function FBSubMeshT(offset, indexCount, vertexCount) {
|
|
26393
|
+
if (offset === void 0) offset = 0;
|
|
26394
|
+
if (indexCount === void 0) indexCount = 0;
|
|
26395
|
+
if (vertexCount === void 0) vertexCount = 0;
|
|
26396
|
+
this.offset = offset;
|
|
26397
|
+
this.indexCount = indexCount;
|
|
26398
|
+
this.vertexCount = vertexCount;
|
|
26399
|
+
}
|
|
26400
|
+
var _proto = FBSubMeshT.prototype;
|
|
26401
|
+
_proto.pack = function pack(builder) {
|
|
26402
|
+
return FBSubMesh.createFBSubMesh(builder, this.offset, this.indexCount, this.vertexCount);
|
|
26403
|
+
};
|
|
26404
|
+
return FBSubMeshT;
|
|
26405
|
+
}();
|
|
26406
|
+
|
|
26407
|
+
// automatically generated by the FlatBuffers compiler, do not modify
|
|
26408
|
+
var FBVertexChannel = /*#__PURE__*/ function() {
|
|
26409
|
+
function FBVertexChannel() {
|
|
26410
|
+
this.bb = null;
|
|
26411
|
+
this.bb_pos = 0;
|
|
26412
|
+
}
|
|
26413
|
+
var _proto = FBVertexChannel.prototype;
|
|
26414
|
+
_proto.__init = function __init(i, bb) {
|
|
26415
|
+
this.bb_pos = i;
|
|
26416
|
+
this.bb = bb;
|
|
26417
|
+
return this;
|
|
26418
|
+
};
|
|
26419
|
+
_proto.semantic = function semantic(optionalEncoding) {
|
|
26420
|
+
var offset = this.bb.__offset(this.bb_pos, 4);
|
|
26421
|
+
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
26422
|
+
};
|
|
26423
|
+
_proto.offset = function offset() {
|
|
26424
|
+
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
26425
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26426
|
+
};
|
|
26427
|
+
_proto.format = function format() {
|
|
26428
|
+
var offset = this.bb.__offset(this.bb_pos, 8);
|
|
26429
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26430
|
+
};
|
|
26431
|
+
_proto.dimension = function dimension() {
|
|
26432
|
+
var offset = this.bb.__offset(this.bb_pos, 10);
|
|
26433
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26434
|
+
};
|
|
26435
|
+
_proto.normalize = function normalize() {
|
|
26436
|
+
var offset = this.bb.__offset(this.bb_pos, 12);
|
|
26437
|
+
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
|
|
26438
|
+
};
|
|
26439
|
+
_proto.unpack = function unpack() {
|
|
26440
|
+
return new FBVertexChannelT(this.semantic(), this.offset(), this.format(), this.dimension(), this.normalize());
|
|
26441
|
+
};
|
|
26442
|
+
_proto.unpackTo = function unpackTo(_o) {
|
|
26443
|
+
_o.semantic = this.semantic();
|
|
26444
|
+
_o.offset = this.offset();
|
|
26445
|
+
_o.format = this.format();
|
|
26446
|
+
_o.dimension = this.dimension();
|
|
26447
|
+
_o.normalize = this.normalize();
|
|
26448
|
+
};
|
|
26449
|
+
FBVertexChannel.getRootAsFBVertexChannel = function getRootAsFBVertexChannel(bb, obj) {
|
|
26450
|
+
return (obj || new FBVertexChannel()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26451
|
+
};
|
|
26452
|
+
FBVertexChannel.getSizePrefixedRootAsFBVertexChannel = function getSizePrefixedRootAsFBVertexChannel(bb, obj) {
|
|
26453
|
+
bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
|
|
26454
|
+
return (obj || new FBVertexChannel()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26455
|
+
};
|
|
26456
|
+
FBVertexChannel.startFBVertexChannel = function startFBVertexChannel(builder) {
|
|
26457
|
+
builder.startObject(5);
|
|
26458
|
+
};
|
|
26459
|
+
FBVertexChannel.addSemantic = function addSemantic(builder, semanticOffset) {
|
|
26460
|
+
builder.addFieldOffset(0, semanticOffset, 0);
|
|
26461
|
+
};
|
|
26462
|
+
FBVertexChannel.addOffset = function addOffset(builder, offset) {
|
|
26463
|
+
builder.addFieldInt32(1, offset, 0);
|
|
26464
|
+
};
|
|
26465
|
+
FBVertexChannel.addFormat = function addFormat(builder, format) {
|
|
26466
|
+
builder.addFieldInt32(2, format, 0);
|
|
26467
|
+
};
|
|
26468
|
+
FBVertexChannel.addDimension = function addDimension(builder, dimension) {
|
|
26469
|
+
builder.addFieldInt32(3, dimension, 0);
|
|
26470
|
+
};
|
|
26471
|
+
FBVertexChannel.addNormalize = function addNormalize(builder, normalize) {
|
|
26472
|
+
builder.addFieldInt8(4, +normalize, +false);
|
|
26473
|
+
};
|
|
26474
|
+
FBVertexChannel.endFBVertexChannel = function endFBVertexChannel(builder) {
|
|
26475
|
+
var offset = builder.endObject();
|
|
26476
|
+
return offset;
|
|
26477
|
+
};
|
|
26478
|
+
FBVertexChannel.createFBVertexChannel = function createFBVertexChannel(builder, semanticOffset, offset, format, dimension, normalize) {
|
|
26479
|
+
FBVertexChannel.startFBVertexChannel(builder);
|
|
26480
|
+
FBVertexChannel.addSemantic(builder, semanticOffset);
|
|
26481
|
+
FBVertexChannel.addOffset(builder, offset);
|
|
26482
|
+
FBVertexChannel.addFormat(builder, format);
|
|
26483
|
+
FBVertexChannel.addDimension(builder, dimension);
|
|
26484
|
+
FBVertexChannel.addNormalize(builder, normalize);
|
|
26485
|
+
return FBVertexChannel.endFBVertexChannel(builder);
|
|
26486
|
+
};
|
|
26487
|
+
return FBVertexChannel;
|
|
26488
|
+
}();
|
|
26489
|
+
var FBVertexChannelT = /*#__PURE__*/ function() {
|
|
26490
|
+
function FBVertexChannelT(semantic, offset, format, dimension, normalize) {
|
|
26491
|
+
if (semantic === void 0) semantic = null;
|
|
26492
|
+
if (offset === void 0) offset = 0;
|
|
26493
|
+
if (format === void 0) format = 0;
|
|
26494
|
+
if (dimension === void 0) dimension = 0;
|
|
26495
|
+
if (normalize === void 0) normalize = false;
|
|
26496
|
+
this.semantic = semantic;
|
|
26497
|
+
this.offset = offset;
|
|
26498
|
+
this.format = format;
|
|
26499
|
+
this.dimension = dimension;
|
|
26500
|
+
this.normalize = normalize;
|
|
26501
|
+
}
|
|
26502
|
+
var _proto = FBVertexChannelT.prototype;
|
|
26503
|
+
_proto.pack = function pack(builder) {
|
|
26504
|
+
var semantic = this.semantic !== null ? builder.createString(this.semantic) : 0;
|
|
26505
|
+
return FBVertexChannel.createFBVertexChannel(builder, semantic, this.offset, this.format, this.dimension, this.normalize);
|
|
26506
|
+
};
|
|
26507
|
+
return FBVertexChannelT;
|
|
26508
|
+
}();
|
|
26509
|
+
|
|
26510
|
+
// automatically generated by the FlatBuffers compiler, do not modify
|
|
26511
|
+
var FBVertexData = /*#__PURE__*/ function() {
|
|
26512
|
+
function FBVertexData() {
|
|
26513
|
+
this.bb = null;
|
|
26514
|
+
this.bb_pos = 0;
|
|
26515
|
+
}
|
|
26516
|
+
var _proto = FBVertexData.prototype;
|
|
26517
|
+
_proto.__init = function __init(i, bb) {
|
|
26518
|
+
this.bb_pos = i;
|
|
26519
|
+
this.bb = bb;
|
|
26520
|
+
return this;
|
|
26521
|
+
};
|
|
26522
|
+
_proto.vertexCount = function vertexCount() {
|
|
26523
|
+
var offset = this.bb.__offset(this.bb_pos, 4);
|
|
26524
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26525
|
+
};
|
|
26526
|
+
_proto.channels = function channels(index, obj) {
|
|
26527
|
+
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
26528
|
+
return offset ? (obj || new FBVertexChannel()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
|
|
26529
|
+
};
|
|
26530
|
+
_proto.channelsLength = function channelsLength() {
|
|
26531
|
+
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
26532
|
+
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
26533
|
+
};
|
|
26534
|
+
_proto.unpack = function unpack() {
|
|
26535
|
+
return new FBVertexDataT(this.vertexCount(), this.bb.createObjList(this.channels.bind(this), this.channelsLength()));
|
|
26536
|
+
};
|
|
26537
|
+
_proto.unpackTo = function unpackTo(_o) {
|
|
26538
|
+
_o.vertexCount = this.vertexCount();
|
|
26539
|
+
_o.channels = this.bb.createObjList(this.channels.bind(this), this.channelsLength());
|
|
26540
|
+
};
|
|
26541
|
+
FBVertexData.getRootAsFBVertexData = function getRootAsFBVertexData(bb, obj) {
|
|
26542
|
+
return (obj || new FBVertexData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26543
|
+
};
|
|
26544
|
+
FBVertexData.getSizePrefixedRootAsFBVertexData = function getSizePrefixedRootAsFBVertexData(bb, obj) {
|
|
26545
|
+
bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
|
|
26546
|
+
return (obj || new FBVertexData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26547
|
+
};
|
|
26548
|
+
FBVertexData.startFBVertexData = function startFBVertexData(builder) {
|
|
26549
|
+
builder.startObject(2);
|
|
26550
|
+
};
|
|
26551
|
+
FBVertexData.addVertexCount = function addVertexCount(builder, vertexCount) {
|
|
26552
|
+
builder.addFieldInt32(0, vertexCount, 0);
|
|
26553
|
+
};
|
|
26554
|
+
FBVertexData.addChannels = function addChannels(builder, channelsOffset) {
|
|
26555
|
+
builder.addFieldOffset(1, channelsOffset, 0);
|
|
26556
|
+
};
|
|
26557
|
+
FBVertexData.createChannelsVector = function createChannelsVector(builder, data) {
|
|
26558
|
+
builder.startVector(4, data.length, 4);
|
|
26559
|
+
for(var i = data.length - 1; i >= 0; i--){
|
|
26560
|
+
builder.addOffset(data[i]);
|
|
26561
|
+
}
|
|
26562
|
+
return builder.endVector();
|
|
26563
|
+
};
|
|
26564
|
+
FBVertexData.startChannelsVector = function startChannelsVector(builder, numElems) {
|
|
26565
|
+
builder.startVector(4, numElems, 4);
|
|
26566
|
+
};
|
|
26567
|
+
FBVertexData.endFBVertexData = function endFBVertexData(builder) {
|
|
26568
|
+
var offset = builder.endObject();
|
|
26569
|
+
return offset;
|
|
26570
|
+
};
|
|
26571
|
+
FBVertexData.createFBVertexData = function createFBVertexData(builder, vertexCount, channelsOffset) {
|
|
26572
|
+
FBVertexData.startFBVertexData(builder);
|
|
26573
|
+
FBVertexData.addVertexCount(builder, vertexCount);
|
|
26574
|
+
FBVertexData.addChannels(builder, channelsOffset);
|
|
26575
|
+
return FBVertexData.endFBVertexData(builder);
|
|
26576
|
+
};
|
|
26577
|
+
return FBVertexData;
|
|
26578
|
+
}();
|
|
26579
|
+
var FBVertexDataT = /*#__PURE__*/ function() {
|
|
26580
|
+
function FBVertexDataT(vertexCount, channels) {
|
|
26581
|
+
if (vertexCount === void 0) vertexCount = 0;
|
|
26582
|
+
if (channels === void 0) channels = [];
|
|
26583
|
+
this.vertexCount = vertexCount;
|
|
26584
|
+
this.channels = channels;
|
|
26585
|
+
}
|
|
26586
|
+
var _proto = FBVertexDataT.prototype;
|
|
26587
|
+
_proto.pack = function pack(builder) {
|
|
26588
|
+
var channels = FBVertexData.createChannelsVector(builder, builder.createObjectOffsetList(this.channels));
|
|
26589
|
+
return FBVertexData.createFBVertexData(builder, this.vertexCount, channels);
|
|
26590
|
+
};
|
|
26591
|
+
return FBVertexDataT;
|
|
26592
|
+
}();
|
|
26593
|
+
|
|
26594
|
+
// automatically generated by the FlatBuffers compiler, do not modify
|
|
26595
|
+
var FBGeometryData = /*#__PURE__*/ function() {
|
|
26596
|
+
function FBGeometryData() {
|
|
26597
|
+
this.bb = null;
|
|
26598
|
+
this.bb_pos = 0;
|
|
26599
|
+
}
|
|
26600
|
+
var _proto = FBGeometryData.prototype;
|
|
26601
|
+
_proto.__init = function __init(i, bb) {
|
|
26602
|
+
this.bb_pos = i;
|
|
26603
|
+
this.bb = bb;
|
|
26604
|
+
return this;
|
|
26605
|
+
};
|
|
26606
|
+
_proto.id = function id(optionalEncoding) {
|
|
26607
|
+
var offset = this.bb.__offset(this.bb_pos, 4);
|
|
26608
|
+
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
26609
|
+
};
|
|
26610
|
+
_proto.name = function name(optionalEncoding) {
|
|
26611
|
+
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
26612
|
+
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
26613
|
+
};
|
|
26614
|
+
_proto.vertexData = function vertexData(obj) {
|
|
26615
|
+
var offset = this.bb.__offset(this.bb_pos, 8);
|
|
26616
|
+
return offset ? (obj || new FBVertexData()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
|
|
26617
|
+
};
|
|
26618
|
+
_proto.indexFormat = function indexFormat() {
|
|
26619
|
+
var offset = this.bb.__offset(this.bb_pos, 10);
|
|
26620
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26621
|
+
};
|
|
26622
|
+
_proto.indexOffset = function indexOffset() {
|
|
26623
|
+
var offset = this.bb.__offset(this.bb_pos, 12);
|
|
26624
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26625
|
+
};
|
|
26626
|
+
_proto.subMeshes = function subMeshes(index, obj) {
|
|
26627
|
+
var offset = this.bb.__offset(this.bb_pos, 14);
|
|
26628
|
+
return offset ? (obj || new FBSubMesh()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
|
|
26629
|
+
};
|
|
26630
|
+
_proto.subMeshesLength = function subMeshesLength() {
|
|
26631
|
+
var offset = this.bb.__offset(this.bb_pos, 14);
|
|
26632
|
+
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
26633
|
+
};
|
|
26634
|
+
_proto.mode = function mode() {
|
|
26635
|
+
var offset = this.bb.__offset(this.bb_pos, 16);
|
|
26636
|
+
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
26637
|
+
};
|
|
26638
|
+
_proto.buffer = function buffer(optionalEncoding) {
|
|
26639
|
+
var offset = this.bb.__offset(this.bb_pos, 18);
|
|
26640
|
+
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
26641
|
+
};
|
|
26642
|
+
_proto.binaryData = function binaryData(index) {
|
|
26643
|
+
var offset = this.bb.__offset(this.bb_pos, 20);
|
|
26644
|
+
return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
|
|
26645
|
+
};
|
|
26646
|
+
_proto.binaryDataLength = function binaryDataLength() {
|
|
26647
|
+
var offset = this.bb.__offset(this.bb_pos, 20);
|
|
26648
|
+
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
26649
|
+
};
|
|
26650
|
+
_proto.binaryDataArray = function binaryDataArray() {
|
|
26651
|
+
var offset = this.bb.__offset(this.bb_pos, 20);
|
|
26652
|
+
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;
|
|
26653
|
+
};
|
|
26654
|
+
_proto.boneNames = function boneNames(index, optionalEncoding) {
|
|
26655
|
+
var offset = this.bb.__offset(this.bb_pos, 22);
|
|
26656
|
+
return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
|
|
26657
|
+
};
|
|
26658
|
+
_proto.boneNamesLength = function boneNamesLength() {
|
|
26659
|
+
var offset = this.bb.__offset(this.bb_pos, 22);
|
|
26660
|
+
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
26661
|
+
};
|
|
26662
|
+
_proto.rootBoneName = function rootBoneName(optionalEncoding) {
|
|
26663
|
+
var offset = this.bb.__offset(this.bb_pos, 24);
|
|
26664
|
+
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
26665
|
+
};
|
|
26666
|
+
_proto.inverseBindMatrices = function inverseBindMatrices(index) {
|
|
26667
|
+
var offset = this.bb.__offset(this.bb_pos, 26);
|
|
26668
|
+
return offset ? this.bb.readFloat32(this.bb.__vector(this.bb_pos + offset) + index * 4) : 0;
|
|
26669
|
+
};
|
|
26670
|
+
_proto.inverseBindMatricesLength = function inverseBindMatricesLength() {
|
|
26671
|
+
var offset = this.bb.__offset(this.bb_pos, 26);
|
|
26672
|
+
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
26673
|
+
};
|
|
26674
|
+
_proto.inverseBindMatricesArray = function inverseBindMatricesArray() {
|
|
26675
|
+
var offset = this.bb.__offset(this.bb_pos, 26);
|
|
26676
|
+
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;
|
|
26677
|
+
};
|
|
26678
|
+
_proto.unpack = function unpack() {
|
|
26679
|
+
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()));
|
|
26680
|
+
};
|
|
26681
|
+
_proto.unpackTo = function unpackTo(_o) {
|
|
26682
|
+
_o.id = this.id();
|
|
26683
|
+
_o.name = this.name();
|
|
26684
|
+
_o.vertexData = this.vertexData() !== null ? this.vertexData().unpack() : null;
|
|
26685
|
+
_o.indexFormat = this.indexFormat();
|
|
26686
|
+
_o.indexOffset = this.indexOffset();
|
|
26687
|
+
_o.subMeshes = this.bb.createObjList(this.subMeshes.bind(this), this.subMeshesLength());
|
|
26688
|
+
_o.mode = this.mode();
|
|
26689
|
+
_o.buffer = this.buffer();
|
|
26690
|
+
_o.binaryData = this.bb.createScalarList(this.binaryData.bind(this), this.binaryDataLength());
|
|
26691
|
+
_o.boneNames = this.bb.createScalarList(this.boneNames.bind(this), this.boneNamesLength());
|
|
26692
|
+
_o.rootBoneName = this.rootBoneName();
|
|
26693
|
+
_o.inverseBindMatrices = this.bb.createScalarList(this.inverseBindMatrices.bind(this), this.inverseBindMatricesLength());
|
|
26694
|
+
};
|
|
26695
|
+
FBGeometryData.getRootAsFBGeometryData = function getRootAsFBGeometryData(bb, obj) {
|
|
26696
|
+
return (obj || new FBGeometryData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26697
|
+
};
|
|
26698
|
+
FBGeometryData.getSizePrefixedRootAsFBGeometryData = function getSizePrefixedRootAsFBGeometryData(bb, obj) {
|
|
26699
|
+
bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
|
|
26700
|
+
return (obj || new FBGeometryData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
26701
|
+
};
|
|
26702
|
+
FBGeometryData.startFBGeometryData = function startFBGeometryData(builder) {
|
|
26703
|
+
builder.startObject(12);
|
|
26704
|
+
};
|
|
26705
|
+
FBGeometryData.addId = function addId(builder, idOffset) {
|
|
26706
|
+
builder.addFieldOffset(0, idOffset, 0);
|
|
26707
|
+
};
|
|
26708
|
+
FBGeometryData.addName = function addName(builder, nameOffset) {
|
|
26709
|
+
builder.addFieldOffset(1, nameOffset, 0);
|
|
26710
|
+
};
|
|
26711
|
+
FBGeometryData.addVertexData = function addVertexData(builder, vertexDataOffset) {
|
|
26712
|
+
builder.addFieldOffset(2, vertexDataOffset, 0);
|
|
26713
|
+
};
|
|
26714
|
+
FBGeometryData.addIndexFormat = function addIndexFormat(builder, indexFormat) {
|
|
26715
|
+
builder.addFieldInt32(3, indexFormat, 0);
|
|
26716
|
+
};
|
|
26717
|
+
FBGeometryData.addIndexOffset = function addIndexOffset(builder, indexOffset) {
|
|
26718
|
+
builder.addFieldInt32(4, indexOffset, 0);
|
|
26719
|
+
};
|
|
26720
|
+
FBGeometryData.addSubMeshes = function addSubMeshes(builder, subMeshesOffset) {
|
|
26721
|
+
builder.addFieldOffset(5, subMeshesOffset, 0);
|
|
26722
|
+
};
|
|
26723
|
+
FBGeometryData.createSubMeshesVector = function createSubMeshesVector(builder, data) {
|
|
26724
|
+
builder.startVector(4, data.length, 4);
|
|
26725
|
+
for(var i = data.length - 1; i >= 0; i--){
|
|
26726
|
+
builder.addOffset(data[i]);
|
|
26727
|
+
}
|
|
26728
|
+
return builder.endVector();
|
|
26729
|
+
};
|
|
26730
|
+
FBGeometryData.startSubMeshesVector = function startSubMeshesVector(builder, numElems) {
|
|
26731
|
+
builder.startVector(4, numElems, 4);
|
|
26732
|
+
};
|
|
26733
|
+
FBGeometryData.addMode = function addMode(builder, mode) {
|
|
26734
|
+
builder.addFieldInt32(6, mode, 0);
|
|
26735
|
+
};
|
|
26736
|
+
FBGeometryData.addBuffer = function addBuffer(builder, bufferOffset) {
|
|
26737
|
+
builder.addFieldOffset(7, bufferOffset, 0);
|
|
26738
|
+
};
|
|
26739
|
+
FBGeometryData.addBinaryData = function addBinaryData(builder, binaryDataOffset) {
|
|
26740
|
+
builder.addFieldOffset(8, binaryDataOffset, 0);
|
|
26741
|
+
};
|
|
26742
|
+
FBGeometryData.createBinaryDataVector = function createBinaryDataVector(builder, data) {
|
|
26743
|
+
builder.startVector(1, data.length, 1);
|
|
26744
|
+
for(var i = data.length - 1; i >= 0; i--){
|
|
26745
|
+
builder.addInt8(data[i]);
|
|
26746
|
+
}
|
|
26747
|
+
return builder.endVector();
|
|
26748
|
+
};
|
|
26749
|
+
FBGeometryData.startBinaryDataVector = function startBinaryDataVector(builder, numElems) {
|
|
26750
|
+
builder.startVector(1, numElems, 1);
|
|
26751
|
+
};
|
|
26752
|
+
FBGeometryData.addBoneNames = function addBoneNames(builder, boneNamesOffset) {
|
|
26753
|
+
builder.addFieldOffset(9, boneNamesOffset, 0);
|
|
26754
|
+
};
|
|
26755
|
+
FBGeometryData.createBoneNamesVector = function createBoneNamesVector(builder, data) {
|
|
26756
|
+
builder.startVector(4, data.length, 4);
|
|
26757
|
+
for(var i = data.length - 1; i >= 0; i--){
|
|
26758
|
+
builder.addOffset(data[i]);
|
|
26759
|
+
}
|
|
26760
|
+
return builder.endVector();
|
|
26761
|
+
};
|
|
26762
|
+
FBGeometryData.startBoneNamesVector = function startBoneNamesVector(builder, numElems) {
|
|
26763
|
+
builder.startVector(4, numElems, 4);
|
|
26764
|
+
};
|
|
26765
|
+
FBGeometryData.addRootBoneName = function addRootBoneName(builder, rootBoneNameOffset) {
|
|
26766
|
+
builder.addFieldOffset(10, rootBoneNameOffset, 0);
|
|
26767
|
+
};
|
|
26768
|
+
FBGeometryData.addInverseBindMatrices = function addInverseBindMatrices(builder, inverseBindMatricesOffset) {
|
|
26769
|
+
builder.addFieldOffset(11, inverseBindMatricesOffset, 0);
|
|
26770
|
+
};
|
|
26771
|
+
FBGeometryData.createInverseBindMatricesVector = function createInverseBindMatricesVector(builder, data) {
|
|
26772
|
+
builder.startVector(4, data.length, 4);
|
|
26773
|
+
for(var i = data.length - 1; i >= 0; i--){
|
|
26774
|
+
builder.addFloat32(data[i]);
|
|
26775
|
+
}
|
|
26776
|
+
return builder.endVector();
|
|
26777
|
+
};
|
|
26778
|
+
FBGeometryData.startInverseBindMatricesVector = function startInverseBindMatricesVector(builder, numElems) {
|
|
26779
|
+
builder.startVector(4, numElems, 4);
|
|
26780
|
+
};
|
|
26781
|
+
FBGeometryData.endFBGeometryData = function endFBGeometryData(builder) {
|
|
26782
|
+
var offset = builder.endObject();
|
|
26783
|
+
return offset;
|
|
26784
|
+
};
|
|
26785
|
+
return FBGeometryData;
|
|
26786
|
+
}();
|
|
26787
|
+
var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
26788
|
+
function FBGeometryDataT(id, name, vertexData, indexFormat, indexOffset, subMeshes, mode, buffer, binaryData, boneNames, rootBoneName, inverseBindMatrices) {
|
|
26789
|
+
if (id === void 0) id = null;
|
|
26790
|
+
if (name === void 0) name = null;
|
|
26791
|
+
if (vertexData === void 0) vertexData = null;
|
|
26792
|
+
if (indexFormat === void 0) indexFormat = 0;
|
|
26793
|
+
if (indexOffset === void 0) indexOffset = 0;
|
|
26794
|
+
if (subMeshes === void 0) subMeshes = [];
|
|
26795
|
+
if (mode === void 0) mode = 0;
|
|
26796
|
+
if (buffer === void 0) buffer = null;
|
|
26797
|
+
if (binaryData === void 0) binaryData = [];
|
|
26798
|
+
if (boneNames === void 0) boneNames = [];
|
|
26799
|
+
if (rootBoneName === void 0) rootBoneName = null;
|
|
26800
|
+
if (inverseBindMatrices === void 0) inverseBindMatrices = [];
|
|
26801
|
+
this.id = id;
|
|
26802
|
+
this.name = name;
|
|
26803
|
+
this.vertexData = vertexData;
|
|
26804
|
+
this.indexFormat = indexFormat;
|
|
26805
|
+
this.indexOffset = indexOffset;
|
|
26806
|
+
this.subMeshes = subMeshes;
|
|
26807
|
+
this.mode = mode;
|
|
26808
|
+
this.buffer = buffer;
|
|
26809
|
+
this.binaryData = binaryData;
|
|
26810
|
+
this.boneNames = boneNames;
|
|
26811
|
+
this.rootBoneName = rootBoneName;
|
|
26812
|
+
this.inverseBindMatrices = inverseBindMatrices;
|
|
26813
|
+
}
|
|
26814
|
+
var _proto = FBGeometryDataT.prototype;
|
|
26815
|
+
_proto.pack = function pack(builder) {
|
|
26816
|
+
var id = this.id !== null ? builder.createString(this.id) : 0;
|
|
26817
|
+
var name = this.name !== null ? builder.createString(this.name) : 0;
|
|
26818
|
+
var vertexData = this.vertexData !== null ? this.vertexData.pack(builder) : 0;
|
|
26819
|
+
var subMeshes = FBGeometryData.createSubMeshesVector(builder, builder.createObjectOffsetList(this.subMeshes));
|
|
26820
|
+
var buffer = this.buffer !== null ? builder.createString(this.buffer) : 0;
|
|
26821
|
+
var binaryData = FBGeometryData.createBinaryDataVector(builder, this.binaryData);
|
|
26822
|
+
var boneNames = FBGeometryData.createBoneNamesVector(builder, builder.createObjectOffsetList(this.boneNames));
|
|
26823
|
+
var rootBoneName = this.rootBoneName !== null ? builder.createString(this.rootBoneName) : 0;
|
|
26824
|
+
var inverseBindMatrices = FBGeometryData.createInverseBindMatricesVector(builder, this.inverseBindMatrices);
|
|
26825
|
+
FBGeometryData.startFBGeometryData(builder);
|
|
26826
|
+
FBGeometryData.addId(builder, id);
|
|
26827
|
+
FBGeometryData.addName(builder, name);
|
|
26828
|
+
FBGeometryData.addVertexData(builder, vertexData);
|
|
26829
|
+
FBGeometryData.addIndexFormat(builder, this.indexFormat);
|
|
26830
|
+
FBGeometryData.addIndexOffset(builder, this.indexOffset);
|
|
26831
|
+
FBGeometryData.addSubMeshes(builder, subMeshes);
|
|
26832
|
+
FBGeometryData.addMode(builder, this.mode);
|
|
26833
|
+
FBGeometryData.addBuffer(builder, buffer);
|
|
26834
|
+
FBGeometryData.addBinaryData(builder, binaryData);
|
|
26835
|
+
FBGeometryData.addBoneNames(builder, boneNames);
|
|
26836
|
+
FBGeometryData.addRootBoneName(builder, rootBoneName);
|
|
26837
|
+
FBGeometryData.addInverseBindMatrices(builder, inverseBindMatrices);
|
|
26838
|
+
return FBGeometryData.endFBGeometryData(builder);
|
|
26839
|
+
};
|
|
26840
|
+
return FBGeometryDataT;
|
|
26841
|
+
}();
|
|
26842
|
+
|
|
26843
|
+
/**
|
|
26844
|
+
* @since 2.0.0
|
|
26845
|
+
* @internal
|
|
26846
|
+
*/ var EffectsPackage = /*#__PURE__*/ function() {
|
|
26847
|
+
function EffectsPackage() {
|
|
26848
|
+
this.exportObjectDatas = [];
|
|
26849
|
+
}
|
|
26850
|
+
var _proto = EffectsPackage.prototype;
|
|
26851
|
+
_proto.addData = function addData(effectsObjectData) {
|
|
26852
|
+
this.exportObjectDatas.push(effectsObjectData);
|
|
26853
|
+
};
|
|
26854
|
+
_proto.serializeToBinary = function serializeToBinary() {
|
|
26855
|
+
var fbb = new Builder(1);
|
|
26856
|
+
var effectsPackage = new FBEffectsPackageDataT();
|
|
26857
|
+
var exportObjects = [];
|
|
26858
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.exportObjectDatas), _step; !(_step = _iterator()).done;){
|
|
26859
|
+
var effectsObjectData = _step.value;
|
|
26860
|
+
var fbEffectsObjectData = void 0;
|
|
26861
|
+
if (effectsObjectData.dataType === DataType.Geometry) {
|
|
26862
|
+
fbEffectsObjectData = new FBEffectsObjectDataT("Geometry", this.geometryDataToBinary(effectsObjectData));
|
|
26863
|
+
}
|
|
26864
|
+
if (!fbEffectsObjectData) {
|
|
26865
|
+
continue;
|
|
26866
|
+
}
|
|
26867
|
+
exportObjects.push(fbEffectsObjectData);
|
|
26868
|
+
}
|
|
26869
|
+
effectsPackage.exportObjects = exportObjects;
|
|
26870
|
+
FBEffectsPackageData.finishFBEffectsPackageDataBuffer(fbb, effectsPackage.pack(fbb));
|
|
26871
|
+
return fbb.asUint8Array(); // Of type `Uint8Array`.
|
|
26872
|
+
};
|
|
26873
|
+
_proto.deserializeFromBinary = function deserializeFromBinary(buffer) {
|
|
26874
|
+
var buf = new ByteBuffer(buffer);
|
|
26875
|
+
var fbEffectsPackage = FBEffectsPackageData.getRootAsFBEffectsPackageData(buf);
|
|
26876
|
+
for(var i = 0; i < fbEffectsPackage.exportObjectsLength(); i++){
|
|
26877
|
+
var fbEffectsObjectData = fbEffectsPackage.exportObjects(i);
|
|
26878
|
+
if (!fbEffectsObjectData) {
|
|
26879
|
+
continue;
|
|
26880
|
+
}
|
|
26881
|
+
var dataBuffer = fbEffectsObjectData.dataArray();
|
|
26882
|
+
var dataType = fbEffectsObjectData.dataType();
|
|
26883
|
+
if (!dataBuffer) {
|
|
26884
|
+
continue;
|
|
26885
|
+
}
|
|
26886
|
+
var effectsObjectData = void 0;
|
|
26887
|
+
if (dataType === DataType.Geometry) {
|
|
26888
|
+
effectsObjectData = this.binaryToGeometryData(dataBuffer);
|
|
26889
|
+
}
|
|
26890
|
+
if (!effectsObjectData) {
|
|
26891
|
+
continue;
|
|
26892
|
+
}
|
|
26893
|
+
this.exportObjectDatas.push(effectsObjectData);
|
|
26894
|
+
}
|
|
26895
|
+
};
|
|
26896
|
+
_proto.geometryDataToBinary = function geometryDataToBinary(geometryData) {
|
|
26897
|
+
var fbb = new Builder(1);
|
|
26898
|
+
var fbGeometryData = new FBGeometryDataT();
|
|
26899
|
+
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;
|
|
26900
|
+
fbGeometryData.indexFormat = indexFormat;
|
|
26901
|
+
fbGeometryData.indexOffset = indexOffset;
|
|
26902
|
+
fbGeometryData.mode = mode;
|
|
26903
|
+
fbGeometryData.id = id;
|
|
26904
|
+
fbGeometryData.boneNames = boneNames;
|
|
26905
|
+
fbGeometryData.rootBoneName = rootBoneName;
|
|
26906
|
+
fbGeometryData.inverseBindMatrices = inverseBindMatrices;
|
|
26907
|
+
fbGeometryData.binaryData = binaryData;
|
|
26908
|
+
var fbVertexdata = new FBVertexDataT();
|
|
26909
|
+
fbVertexdata.vertexCount = vertexData.vertexCount;
|
|
26910
|
+
fbVertexdata.channels = [];
|
|
26911
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(vertexData.channels), _step; !(_step = _iterator()).done;){
|
|
26912
|
+
var channel = _step.value;
|
|
26913
|
+
var semantic = channel.semantic, offset = channel.offset, format = channel.format, dimension = channel.dimension, normalize = channel.normalize;
|
|
26914
|
+
var fbChannel = new FBVertexChannelT(semantic, offset, format, dimension, normalize);
|
|
26915
|
+
fbVertexdata.channels.push(fbChannel);
|
|
26916
|
+
}
|
|
26917
|
+
fbGeometryData.vertexData = fbVertexdata;
|
|
26918
|
+
var fbSubMeshes = [];
|
|
26919
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(geometryData.subMeshes), _step1; !(_step1 = _iterator1()).done;){
|
|
26920
|
+
var subMesh = _step1.value;
|
|
26921
|
+
var offset1 = subMesh.offset, indexCount = subMesh.indexCount, vertexCount = subMesh.vertexCount;
|
|
26922
|
+
var fbSubMesh = new FBSubMeshT(offset1, indexCount, vertexCount);
|
|
26923
|
+
fbSubMeshes.push(fbSubMesh);
|
|
26924
|
+
}
|
|
26925
|
+
fbGeometryData.subMeshes = fbSubMeshes;
|
|
26926
|
+
FBEffectsPackageData.finishFBEffectsPackageDataBuffer(fbb, fbGeometryData.pack(fbb));
|
|
26927
|
+
return fbb.asUint8Array(); // Of type `Uint8Array`.
|
|
26928
|
+
};
|
|
26929
|
+
_proto.binaryToGeometryData = function binaryToGeometryData(buffer) {
|
|
26930
|
+
var buf = new ByteBuffer(buffer);
|
|
26931
|
+
var fbGeometryData = FBGeometryData.getRootAsFBGeometryData(buf);
|
|
26932
|
+
var vertexData = {
|
|
26933
|
+
vertexCount: 0,
|
|
26934
|
+
channels: []
|
|
26935
|
+
};
|
|
26936
|
+
var fbVertexData = fbGeometryData.vertexData();
|
|
26937
|
+
if (fbVertexData) {
|
|
26938
|
+
vertexData.vertexCount = fbVertexData.vertexCount();
|
|
26939
|
+
for(var i = 0; i < fbVertexData.channelsLength(); i++){
|
|
26940
|
+
var channel = fbVertexData.channels(i);
|
|
26941
|
+
if (!channel) {
|
|
26942
|
+
continue;
|
|
26943
|
+
}
|
|
26944
|
+
var _channel_semantic;
|
|
26945
|
+
var vertexChannel = {
|
|
26946
|
+
semantic: (_channel_semantic = channel.semantic()) != null ? _channel_semantic : "",
|
|
26947
|
+
offset: channel.offset(),
|
|
26948
|
+
format: channel.format(),
|
|
26949
|
+
dimension: channel.dimension(),
|
|
26950
|
+
normalize: channel.normalize()
|
|
26951
|
+
};
|
|
26952
|
+
vertexData.channels.push(vertexChannel);
|
|
26953
|
+
}
|
|
26954
|
+
}
|
|
26955
|
+
var subMeshes = [];
|
|
26956
|
+
for(var i1 = 0; i1 < fbGeometryData.subMeshesLength(); i1++){
|
|
26957
|
+
var fbSubMesh = fbGeometryData.subMeshes(i1);
|
|
26958
|
+
if (!fbSubMesh) {
|
|
26959
|
+
continue;
|
|
26960
|
+
}
|
|
26961
|
+
var subMesh = {
|
|
26962
|
+
offset: fbSubMesh.offset(),
|
|
26963
|
+
vertexCount: fbSubMesh.vertexCount(),
|
|
26964
|
+
indexCount: fbSubMesh.indexCount()
|
|
26965
|
+
};
|
|
26966
|
+
subMeshes.push(subMesh);
|
|
26967
|
+
}
|
|
26968
|
+
var boneNames = [];
|
|
26969
|
+
for(var i2 = 0; i2 < fbGeometryData.boneNamesLength(); i2++){
|
|
26970
|
+
var boneName = fbGeometryData.boneNames(i2);
|
|
26971
|
+
boneNames.push(boneName);
|
|
26972
|
+
}
|
|
26973
|
+
var inverseBindMatricesArray = fbGeometryData.inverseBindMatricesArray();
|
|
26974
|
+
var _fbGeometryData_buffer, _fbGeometryData_rootBoneName, _fbGeometryData_binaryDataArray, _fbGeometryData_id;
|
|
26975
|
+
var geometryData = {
|
|
26976
|
+
vertexData: vertexData,
|
|
26977
|
+
indexFormat: fbGeometryData.indexFormat(),
|
|
26978
|
+
indexOffset: fbGeometryData.indexOffset(),
|
|
26979
|
+
subMeshes: subMeshes,
|
|
26980
|
+
mode: fbGeometryData.mode(),
|
|
26981
|
+
buffer: (_fbGeometryData_buffer = fbGeometryData.buffer()) != null ? _fbGeometryData_buffer : "",
|
|
26982
|
+
boneNames: boneNames,
|
|
26983
|
+
rootBoneName: (_fbGeometryData_rootBoneName = fbGeometryData.rootBoneName()) != null ? _fbGeometryData_rootBoneName : "",
|
|
26984
|
+
inverseBindMatrices: inverseBindMatricesArray ? Array.from(inverseBindMatricesArray) : undefined,
|
|
26985
|
+
binaryData: (_fbGeometryData_binaryDataArray = fbGeometryData.binaryDataArray()) != null ? _fbGeometryData_binaryDataArray : undefined,
|
|
26986
|
+
id: (_fbGeometryData_id = fbGeometryData.id()) != null ? _fbGeometryData_id : "",
|
|
26987
|
+
dataType: DataType.Geometry
|
|
26988
|
+
};
|
|
26989
|
+
return geometryData;
|
|
26990
|
+
};
|
|
26991
|
+
return EffectsPackage;
|
|
26992
|
+
}();
|
|
26993
|
+
|
|
26994
|
+
/**
|
|
26995
|
+
* Engine 基类,负责维护所有 GPU 资源的管理及销毁
|
|
26996
|
+
*/ var Engine = /*#__PURE__*/ function() {
|
|
26997
|
+
function Engine() {
|
|
26998
|
+
/**
|
|
26999
|
+
* 渲染过程中错误队列
|
|
27000
|
+
*/ this.renderErrors = new Set();
|
|
27001
|
+
this.destroyed = false;
|
|
27002
|
+
this.textures = [];
|
|
27003
|
+
this.materials = [];
|
|
27004
|
+
this.geometries = [];
|
|
27005
|
+
this.meshes = [];
|
|
27006
|
+
this.renderPasses = [];
|
|
27007
|
+
this.jsonSceneData = {};
|
|
27008
|
+
this.objectInstance = {};
|
|
27009
|
+
this.assetLoader = new AssetLoader(this);
|
|
27010
|
+
this.emptyTexture = generateWhiteTexture(this);
|
|
27011
|
+
this.transparentTexture = generateTransparentTexture(this);
|
|
27012
|
+
}
|
|
27013
|
+
var _proto = Engine.prototype;
|
|
27014
|
+
_proto.clearResources = function clearResources() {
|
|
27015
|
+
this.jsonSceneData = {};
|
|
27016
|
+
this.objectInstance = {};
|
|
27017
|
+
};
|
|
27018
|
+
_proto.addEffectsObjectData = function addEffectsObjectData(data) {
|
|
27019
|
+
this.jsonSceneData[data.id] = data;
|
|
27020
|
+
};
|
|
27021
|
+
_proto.findEffectsObjectData = function findEffectsObjectData(uuid) {
|
|
27022
|
+
return this.jsonSceneData[uuid];
|
|
27023
|
+
};
|
|
27024
|
+
_proto.addInstance = function addInstance(effectsObject) {
|
|
27025
|
+
this.objectInstance[effectsObject.getInstanceId()] = effectsObject;
|
|
27026
|
+
};
|
|
27027
|
+
_proto.getInstance = function getInstance(id) {
|
|
27028
|
+
return this.objectInstance[id];
|
|
27029
|
+
};
|
|
27030
|
+
_proto.removeInstance = function removeInstance(id) {
|
|
27031
|
+
delete this.objectInstance[id];
|
|
27032
|
+
};
|
|
27033
|
+
_proto.addPackageDatas = function addPackageDatas(scene) {
|
|
27034
|
+
var jsonScene = scene.jsonScene, _scene_textureOptions = scene.textureOptions, textureOptions = _scene_textureOptions === void 0 ? [] : _scene_textureOptions;
|
|
27035
|
+
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;
|
|
27036
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
27037
|
+
var vfxItemData = _step.value;
|
|
27038
|
+
this.addEffectsObjectData(vfxItemData);
|
|
27039
|
+
}
|
|
27040
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(materials), _step1; !(_step1 = _iterator1()).done;){
|
|
27041
|
+
var materialData = _step1.value;
|
|
27042
|
+
this.addEffectsObjectData(materialData);
|
|
27043
|
+
}
|
|
27044
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(shaders), _step2; !(_step2 = _iterator2()).done;){
|
|
27045
|
+
var shaderData = _step2.value;
|
|
27046
|
+
this.addEffectsObjectData(shaderData);
|
|
27047
|
+
}
|
|
27048
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(geometries), _step3; !(_step3 = _iterator3()).done;){
|
|
27049
|
+
var geometryData = _step3.value;
|
|
27050
|
+
this.addEffectsObjectData(geometryData);
|
|
27051
|
+
}
|
|
27052
|
+
for(var _iterator4 = _create_for_of_iterator_helper_loose(components), _step4; !(_step4 = _iterator4()).done;){
|
|
25423
27053
|
var componentData = _step4.value;
|
|
25424
27054
|
this.addEffectsObjectData(componentData);
|
|
25425
27055
|
}
|
|
@@ -25434,16 +27064,23 @@ var listOrder = 0;
|
|
|
25434
27064
|
for(var i = 0; i < bins.length; i++){
|
|
25435
27065
|
var binaryData = bins[i];
|
|
25436
27066
|
var binaryBuffer = scene.bins[i];
|
|
25437
|
-
|
|
25438
|
-
binaryData.buffer = binaryBuffer;
|
|
25439
|
-
//@ts-expect-error
|
|
25440
|
-
if (binaryData.id) {
|
|
27067
|
+
if (binaryData.dataType === DataType.BinaryAsset) {
|
|
25441
27068
|
//@ts-expect-error
|
|
25442
|
-
|
|
27069
|
+
binaryData.buffer = binaryBuffer;
|
|
27070
|
+
if (binaryData.id) {
|
|
27071
|
+
this.addEffectsObjectData(binaryData);
|
|
27072
|
+
}
|
|
27073
|
+
} else {
|
|
27074
|
+
var effectsPackage = new EffectsPackage();
|
|
27075
|
+
effectsPackage.deserializeFromBinary(new Uint8Array(binaryBuffer));
|
|
27076
|
+
for(var _iterator7 = _create_for_of_iterator_helper_loose(effectsPackage.exportObjectDatas), _step7; !(_step7 = _iterator7()).done;){
|
|
27077
|
+
var effectsObjectData = _step7.value;
|
|
27078
|
+
this.addEffectsObjectData(effectsObjectData);
|
|
27079
|
+
}
|
|
25443
27080
|
}
|
|
25444
27081
|
}
|
|
25445
|
-
for(var
|
|
25446
|
-
var textureData =
|
|
27082
|
+
for(var _iterator8 = _create_for_of_iterator_helper_loose(textureOptions), _step8; !(_step8 = _iterator8()).done;){
|
|
27083
|
+
var textureData = _step8.value;
|
|
25447
27084
|
this.addEffectsObjectData(textureData);
|
|
25448
27085
|
}
|
|
25449
27086
|
};
|
|
@@ -25753,7 +27390,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
25753
27390
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
25754
27391
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
25755
27392
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
25756
|
-
var version$1 = "2.0.0-alpha.
|
|
27393
|
+
var version$1 = "2.0.0-alpha.28";
|
|
25757
27394
|
logger.info("Core version: " + version$1 + ".");
|
|
25758
27395
|
|
|
25759
27396
|
var _obj;
|
|
@@ -27386,7 +29023,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
27386
29023
|
*/ Mesh.create = function(engine, props) {
|
|
27387
29024
|
return new ThreeMesh(engine, props);
|
|
27388
29025
|
};
|
|
27389
|
-
var version = "2.0.0-alpha.
|
|
29026
|
+
var version = "2.0.0-alpha.28";
|
|
27390
29027
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
27391
29028
|
|
|
27392
29029
|
exports.AbstractPlugin = AbstractPlugin;
|
|
@@ -27422,6 +29059,7 @@ exports.EVENT_TYPE_TOUCH_END = EVENT_TYPE_TOUCH_END;
|
|
|
27422
29059
|
exports.EVENT_TYPE_TOUCH_MOVE = EVENT_TYPE_TOUCH_MOVE;
|
|
27423
29060
|
exports.EVENT_TYPE_TOUCH_START = EVENT_TYPE_TOUCH_START;
|
|
27424
29061
|
exports.EffectsObject = EffectsObject;
|
|
29062
|
+
exports.EffectsPackage = EffectsPackage;
|
|
27425
29063
|
exports.Engine = Engine;
|
|
27426
29064
|
exports.EventSystem = EventSystem;
|
|
27427
29065
|
exports.Float16ArrayWrapper = Float16ArrayWrapper;
|
|
@@ -27518,7 +29156,6 @@ exports.createGLContext = createGLContext;
|
|
|
27518
29156
|
exports.createKeyFrameMeta = createKeyFrameMeta;
|
|
27519
29157
|
exports.createShaderWithMacros = createShaderWithMacros;
|
|
27520
29158
|
exports.createShape = createShape;
|
|
27521
|
-
exports.createVFXItem = createVFXItem;
|
|
27522
29159
|
exports.createValueGetter = createValueGetter;
|
|
27523
29160
|
exports.decimalEqual = decimalEqual;
|
|
27524
29161
|
exports.defaultGlobalVolume = defaultGlobalVolume;
|
|
@@ -27574,6 +29211,8 @@ exports.isArray = isArray;
|
|
|
27574
29211
|
exports.isCanvas = isCanvas;
|
|
27575
29212
|
exports.isFunction = isFunction;
|
|
27576
29213
|
exports.isIOS = isIOS;
|
|
29214
|
+
exports.isIOSByUA = isIOSByUA;
|
|
29215
|
+
exports.isMiniProgram = isMiniProgram;
|
|
27577
29216
|
exports.isObject = isObject;
|
|
27578
29217
|
exports.isSceneJSON = isSceneJSON;
|
|
27579
29218
|
exports.isSceneURL = isSceneURL;
|
|
@@ -27584,6 +29223,7 @@ exports.isUniformStruct = isUniformStruct;
|
|
|
27584
29223
|
exports.isUniformStructArray = isUniformStructArray;
|
|
27585
29224
|
exports.isValidFontFamily = isValidFontFamily;
|
|
27586
29225
|
exports.isWebGL2 = isWebGL2;
|
|
29226
|
+
exports.isWechatMiniApp = isWechatMiniApp;
|
|
27587
29227
|
exports.itemFrag = itemFrag;
|
|
27588
29228
|
exports.itemFrameFrag = itemFrameFrag;
|
|
27589
29229
|
exports.itemVert = itemVert;
|