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