@galacean/effects-threejs 2.0.0-alpha.26 → 2.0.0-alpha.27

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.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.26
6
+ * Version: v2.0.0-alpha.27
7
7
  */
8
8
 
9
9
  import * as THREE from 'three';
@@ -3999,13 +3999,29 @@ var RenderFace;
3999
3999
  RenderFace["Front"] = "Front";
4000
4000
  })(RenderFace || (RenderFace = {}));
4001
4001
 
4002
- var END_BEHAVIOR_DESTROY = 0;
4003
- var END_BEHAVIOR_PAUSE = 1;
4004
- var END_BEHAVIOR_FORWARD = 2;
4005
- var END_BEHAVIOR_PAUSE_AND_DESTROY = 3;
4006
- var END_BEHAVIOR_FREEZE = 4;
4007
- var END_BEHAVIOR_RESTART = 5;
4008
- var END_BEHAVIOR_DESTROY_CHILDREN = 6;
4002
+ /**
4003
+ * 销毁
4004
+ */ var END_BEHAVIOR_DESTROY = 0;
4005
+ /**
4006
+ * 暂停
4007
+ * @deprecated since 2.0 - use `END_BEHAVIOR_FREEZE` instead
4008
+ */ var END_BEHAVIOR_PAUSE = 1;
4009
+ /**
4010
+ * 无限播放
4011
+ */ var END_BEHAVIOR_FORWARD = 2;
4012
+ /**
4013
+ * 销毁并保留最后一帧
4014
+ * @deprecated since 2.0
4015
+ */ var END_BEHAVIOR_PAUSE_AND_DESTROY = 3;
4016
+ /**
4017
+ * 冻结
4018
+ */ var END_BEHAVIOR_FREEZE = 4;
4019
+ /**
4020
+ * 重播
4021
+ */ var END_BEHAVIOR_RESTART = 5;
4022
+ /**
4023
+ *
4024
+ */ var END_BEHAVIOR_DESTROY_CHILDREN = 6;
4009
4025
  var CAMERA_CLIP_MODE_VERTICAL = 1;
4010
4026
  var CAMERA_CLIP_MODE_NORMAL = 0;
4011
4027
  var MESSAGE_ITEM_PHRASE_BEGIN = 2;
@@ -4020,29 +4036,6 @@ var CameraClipMode;
4020
4036
  * 剪裁左右
4021
4037
  */ CameraClipMode[CameraClipMode["landscape"] = 0] = "landscape";
4022
4038
  })(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
4039
 
4047
4040
  /**
4048
4041
  * 动态换图类型
@@ -4123,12 +4116,23 @@ var CameraClipMode;
4123
4116
  BezierKeyframeType[BezierKeyframeType["LINE_OUT"] = 6] = "LINE_OUT";
4124
4117
  })(BezierKeyframeType || (BezierKeyframeType = {}));
4125
4118
 
4126
- var ItemEndBehavior;
4127
- (function(ItemEndBehavior) {
4128
- ItemEndBehavior[ItemEndBehavior["destroy"] = 0] = "destroy";
4129
- ItemEndBehavior[ItemEndBehavior["loop"] = 5] = "loop";
4130
- ItemEndBehavior[ItemEndBehavior["freeze"] = 4] = "freeze";
4131
- })(ItemEndBehavior || (ItemEndBehavior = {}));
4119
+ /**
4120
+ * 结束行为
4121
+ */ var EndBehavior;
4122
+ (function(EndBehavior) {
4123
+ /**
4124
+ * 销毁
4125
+ */ EndBehavior[EndBehavior["destroy"] = 0] = "destroy";
4126
+ /**
4127
+ * 重播
4128
+ */ EndBehavior[EndBehavior["restart"] = 5] = "restart";
4129
+ /**
4130
+ * 无限播放
4131
+ */ EndBehavior[EndBehavior["forward"] = 2] = "forward";
4132
+ /**
4133
+ * 冻结
4134
+ */ EndBehavior[EndBehavior["freeze"] = 4] = "freeze";
4135
+ })(EndBehavior || (EndBehavior = {}));
4132
4136
  var ParentItemEndBehavior;
4133
4137
  (function(ParentItemEndBehavior) {
4134
4138
  ParentItemEndBehavior[ParentItemEndBehavior["destroyChildren"] = 6] = "destroyChildren";
@@ -4453,7 +4457,6 @@ var index$1 = /*#__PURE__*/Object.freeze({
4453
4457
  get RenderType () { return RenderType; },
4454
4458
  get RenderFace () { return RenderFace; },
4455
4459
  get CameraClipMode () { return CameraClipMode; },
4456
- get CompositionEndBehavior () { return CompositionEndBehavior; },
4457
4460
  get BackgroundType () { return BackgroundType; },
4458
4461
  END_BEHAVIOR_DESTROY: END_BEHAVIOR_DESTROY,
4459
4462
  END_BEHAVIOR_PAUSE: END_BEHAVIOR_PAUSE,
@@ -4468,7 +4471,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
4468
4471
  MESSAGE_ITEM_PHRASE_END: MESSAGE_ITEM_PHRASE_END,
4469
4472
  get ValueType () { return ValueType; },
4470
4473
  get BezierKeyframeType () { return BezierKeyframeType; },
4471
- get ItemEndBehavior () { return ItemEndBehavior; },
4474
+ get EndBehavior () { return EndBehavior; },
4472
4475
  get ParentItemEndBehavior () { return ParentItemEndBehavior; },
4473
4476
  get ParticleInteractionBehavior () { return ParticleInteractionBehavior; },
4474
4477
  get ShapeArcMode () { return ShapeArcMode; },
@@ -16618,7 +16621,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
16618
16621
  }
16619
16622
  }
16620
16623
  }
16621
- } else if (this.item.endBehavior === ItemEndBehavior.loop) {
16624
+ } else if (this.item.endBehavior === EndBehavior.restart) {
16622
16625
  updateTrail();
16623
16626
  this.loopStartTime = now - duration;
16624
16627
  this.lastEmitTime -= duration;
@@ -16637,12 +16640,12 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
16637
16640
  this.ended = true;
16638
16641
  this.onEnd(this);
16639
16642
  var endBehavior = this.item.endBehavior;
16640
- if (endBehavior === ItemEndBehavior.freeze) {
16643
+ if (endBehavior === EndBehavior.freeze) {
16641
16644
  this.frozen = true;
16642
16645
  }
16643
16646
  }
16644
- } else if (this.item.endBehavior !== ItemEndBehavior.loop) {
16645
- if (ItemEndBehavior.destroy === this.item.endBehavior) {
16647
+ } else if (this.item.endBehavior !== EndBehavior.restart) {
16648
+ if (EndBehavior.destroy === this.item.endBehavior) {
16646
16649
  var node = link.last;
16647
16650
  if (node && node.content[0] < this.lastUpdate) {
16648
16651
  this.destroyed = true;
@@ -18722,9 +18725,9 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
18722
18725
  var localTime = time - this.start;
18723
18726
  var duration = this.duration;
18724
18727
  if (localTime - duration > 0.001) {
18725
- if (this.endBehavior === ItemEndBehavior.loop) {
18728
+ if (this.endBehavior === EndBehavior.restart) {
18726
18729
  localTime = localTime % duration;
18727
- } else if (this.endBehavior === ItemEndBehavior.freeze) {
18730
+ } else if (this.endBehavior === EndBehavior.freeze) {
18728
18731
  localTime = Math.min(duration, localTime);
18729
18732
  }
18730
18733
  }
@@ -18850,7 +18853,7 @@ var RuntimeClip = /*#__PURE__*/ function() {
18850
18853
  var ended = false;
18851
18854
  var started = false;
18852
18855
  var boundObject = this.track.binding;
18853
- if (localTime > clip.start + clip.duration + 0.001 && clip.endBehavior === ItemEndBehavior.destroy) {
18856
+ if (localTime > clip.start + clip.duration + 0.001 && clip.endBehavior === EndBehavior.destroy) {
18854
18857
  if (_instanceof1(boundObject, VFXItem) && VFXItem.isParticle(boundObject) && this.particleSystem && !this.particleSystem.destroyed) {
18855
18858
  weight = 1.0;
18856
18859
  } else {
@@ -19158,7 +19161,7 @@ function compareTracks(a, b) {
19158
19161
  this.resolveBindings();
19159
19162
  this.timelinePlayable = this.timelineAsset.createPlayable(this.graph);
19160
19163
  // 重播不销毁元素
19161
- if (this.item.endBehavior !== ItemEndBehavior.destroy) {
19164
+ if (this.item.endBehavior !== EndBehavior.destroy) {
19162
19165
  this.setReusable(true);
19163
19166
  }
19164
19167
  };
@@ -19225,7 +19228,7 @@ function compareTracks(a, b) {
19225
19228
  compositionComponent.refId = refId;
19226
19229
  item.transform.parentTransform = this.transform;
19227
19230
  this.item.composition.refContent.push(item);
19228
- if (item.endBehavior === ItemEndBehavior.loop) {
19231
+ if (item.endBehavior === EndBehavior.restart) {
19229
19232
  this.item.composition.autoRefTex = false;
19230
19233
  }
19231
19234
  compositionComponent.createContent();
@@ -22207,8 +22210,8 @@ function getStandardCameraContent(model) {
22207
22210
  json.compositions.forEach(function(composition) {
22208
22211
  composition.items.forEach(function(item) {
22209
22212
  if (item.type === ItemType.null) {
22210
- if (item.endBehavior === ItemEndBehavior.destroy) {
22211
- item.endBehavior = ItemEndBehavior.freeze;
22213
+ if (item.endBehavior === EndBehavior.destroy) {
22214
+ item.endBehavior = EndBehavior.freeze;
22212
22215
  }
22213
22216
  }
22214
22217
  });
@@ -22227,7 +22230,7 @@ function getStandardCameraContent(model) {
22227
22230
  json.compositions.forEach(function(composition) {
22228
22231
  composition.items.forEach(function(item) {
22229
22232
  if (item.type === ItemType.mesh || item.type === ItemType.light) {
22230
- item.endBehavior = item.endBehavior === 1 ? ItemEndBehavior.destroy : item.endBehavior;
22233
+ item.endBehavior = item.endBehavior === 1 ? EndBehavior.destroy : item.endBehavior;
22231
22234
  }
22232
22235
  });
22233
22236
  });
@@ -22239,7 +22242,11 @@ function getStandardCameraContent(model) {
22239
22242
  var _loop = function() {
22240
22243
  var composition = _step1.value;
22241
22244
  // composition 的 endBehavior 兼容
22242
- if (composition.endBehavior === CompositionEndBehavior.pause_destroy || composition.endBehavior === CompositionEndBehavior.pause) {
22245
+ if (// @ts-expect-error
22246
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
22247
+ composition.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY || // @ts-expect-error
22248
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
22249
+ composition.endBehavior === END_BEHAVIOR_PAUSE) {
22243
22250
  composition.endBehavior = END_BEHAVIOR_FREEZE;
22244
22251
  }
22245
22252
  // 过滤掉滤镜元素
@@ -23026,13 +23033,13 @@ function getStandardItem(item, opt) {
23026
23033
  var looping = (_originContent_options = originContent.options) == null ? void 0 : _originContent_options.looping;
23027
23034
  if (looping) {
23028
23035
  if (Array.isArray(looping)) {
23029
- endBehavior = looping[1] ? ItemEndBehavior.loop : ItemEndBehavior.destroy;
23036
+ endBehavior = looping[1] ? EndBehavior.restart : EndBehavior.destroy;
23030
23037
  } else {
23031
- endBehavior = ItemEndBehavior.loop;
23038
+ endBehavior = EndBehavior.restart;
23032
23039
  }
23033
23040
  } else {
23034
23041
  var _originContent_options1;
23035
- endBehavior = endBehavior || (originContent == null ? void 0 : (_originContent_options1 = originContent.options) == null ? void 0 : _originContent_options1.endBehavior) || ItemEndBehavior.destroy;
23042
+ endBehavior = endBehavior || (originContent == null ? void 0 : (_originContent_options1 = originContent.options) == null ? void 0 : _originContent_options1.endBehavior) || EndBehavior.destroy;
23036
23043
  }
23037
23044
  if (originContent.options.renderLevel) {
23038
23045
  renderLevel = originContent.options.renderLevel;
@@ -24377,7 +24384,7 @@ var listOrder = 0;
24377
24384
  id: id,
24378
24385
  duration: duration,
24379
24386
  name: name,
24380
- endBehavior: isNaN(endBehavior) ? END_BEHAVIOR_PAUSE : endBehavior,
24387
+ endBehavior: isNaN(endBehavior) ? EndBehavior.freeze : endBehavior,
24381
24388
  // looping,
24382
24389
  items: items,
24383
24390
  camera: camera,
@@ -24561,7 +24568,7 @@ var listOrder = 0;
24561
24568
  };
24562
24569
  this.reusable = reusable;
24563
24570
  this.speed = speed;
24564
- this.autoRefTex = !this.keepResource && imageUsage && this.rootItem.endBehavior !== ItemEndBehavior.loop;
24571
+ this.autoRefTex = !this.keepResource && imageUsage && this.rootItem.endBehavior !== EndBehavior.restart;
24565
24572
  this.name = sourceContent.name;
24566
24573
  this.pluginSystem = pluginSystem;
24567
24574
  this.pluginSystem.initializeComposition(this, scene);
@@ -24761,7 +24768,7 @@ var listOrder = 0;
24761
24768
  * @returns 重新播放合成标志位
24762
24769
  */ _proto.shouldRestart = function shouldRestart() {
24763
24770
  var _this_rootItem = this.rootItem, ended = _this_rootItem.ended, endBehavior = _this_rootItem.endBehavior;
24764
- return ended && endBehavior === ItemEndBehavior.loop;
24771
+ return ended && endBehavior === EndBehavior.restart;
24765
24772
  };
24766
24773
  /**
24767
24774
  * 是否合成需要销毁
@@ -24814,9 +24821,9 @@ var listOrder = 0;
24814
24821
  var localTime = time - this.rootItem.start;
24815
24822
  var duration = this.rootItem.duration;
24816
24823
  if (localTime - duration > 0.001) {
24817
- if (this.rootItem.endBehavior === ItemEndBehavior.loop) {
24824
+ if (this.rootItem.endBehavior === EndBehavior.restart) {
24818
24825
  localTime = localTime % duration;
24819
- } else if (this.rootItem.endBehavior === ItemEndBehavior.freeze) {
24826
+ } else if (this.rootItem.endBehavior === EndBehavior.freeze) {
24820
24827
  localTime = Math.min(duration, localTime);
24821
24828
  }
24822
24829
  }
@@ -24867,7 +24874,7 @@ var listOrder = 0;
24867
24874
  for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
24868
24875
  var child = _step2.value;
24869
24876
  if (VFXItem.isComposition(child)) {
24870
- if (child.ended && child.endBehavior === ItemEndBehavior.loop) {
24877
+ if (child.ended && child.endBehavior === EndBehavior.restart) {
24871
24878
  child.ended = false;
24872
24879
  // TODO K帧动画在元素重建后需要 tick ,否则会导致元素位置和 k 帧第一帧位置不一致
24873
24880
  this.callUpdate(child, 0);
@@ -25078,7 +25085,7 @@ var listOrder = 0;
25078
25085
  var _this = this;
25079
25086
  // 预合成元素销毁时销毁其中的item
25080
25087
  if (item.type == ItemType.composition) {
25081
- if (item.endBehavior !== ItemEndBehavior.freeze) {
25088
+ if (item.endBehavior !== EndBehavior.freeze) {
25082
25089
  var contentItems = item.getComponent(CompositionComponent).items;
25083
25090
  contentItems.forEach(function(it) {
25084
25091
  return _this.pluginSystem.plugins.forEach(function(loader) {
@@ -25337,6 +25344,1567 @@ var listOrder = 0;
25337
25344
  return Composition;
25338
25345
  }();
25339
25346
 
25347
+ var SIZEOF_SHORT = 2;
25348
+ var SIZEOF_INT = 4;
25349
+ var FILE_IDENTIFIER_LENGTH = 4;
25350
+ var SIZE_PREFIX_LENGTH = 4;
25351
+
25352
+ var int32 = new Int32Array(2);
25353
+ var float32 = new Float32Array(int32.buffer);
25354
+ var float64 = new Float64Array(int32.buffer);
25355
+ var isLittleEndian = new Uint16Array(new Uint8Array([
25356
+ 1,
25357
+ 0
25358
+ ]).buffer)[0] === 1;
25359
+
25360
+ var Encoding;
25361
+ (function(Encoding) {
25362
+ Encoding[Encoding["UTF8_BYTES"] = 1] = "UTF8_BYTES";
25363
+ Encoding[Encoding["UTF16_STRING"] = 2] = "UTF16_STRING";
25364
+ })(Encoding || (Encoding = {}));
25365
+
25366
+ var ByteBuffer = /*#__PURE__*/ function() {
25367
+ function ByteBuffer(bytes_) {
25368
+ this.bytes_ = bytes_;
25369
+ this.position_ = 0;
25370
+ this.text_decoder_ = new TextDecoder();
25371
+ }
25372
+ var _proto = ByteBuffer.prototype;
25373
+ _proto.clear = function clear() {
25374
+ this.position_ = 0;
25375
+ };
25376
+ /**
25377
+ * Get the underlying `Uint8Array`.
25378
+ */ _proto.bytes = function bytes() {
25379
+ return this.bytes_;
25380
+ };
25381
+ /**
25382
+ * Get the buffer's position.
25383
+ */ _proto.position = function position() {
25384
+ return this.position_;
25385
+ };
25386
+ /**
25387
+ * Set the buffer's position.
25388
+ */ _proto.setPosition = function setPosition(position) {
25389
+ this.position_ = position;
25390
+ };
25391
+ /**
25392
+ * Get the buffer's capacity.
25393
+ */ _proto.capacity = function capacity() {
25394
+ return this.bytes_.length;
25395
+ };
25396
+ _proto.readInt8 = function readInt8(offset) {
25397
+ return this.readUint8(offset) << 24 >> 24;
25398
+ };
25399
+ _proto.readUint8 = function readUint8(offset) {
25400
+ return this.bytes_[offset];
25401
+ };
25402
+ _proto.readInt16 = function readInt16(offset) {
25403
+ return this.readUint16(offset) << 16 >> 16;
25404
+ };
25405
+ _proto.readUint16 = function readUint16(offset) {
25406
+ return this.bytes_[offset] | this.bytes_[offset + 1] << 8;
25407
+ };
25408
+ _proto.readInt32 = function readInt32(offset) {
25409
+ return this.bytes_[offset] | this.bytes_[offset + 1] << 8 | this.bytes_[offset + 2] << 16 | this.bytes_[offset + 3] << 24;
25410
+ };
25411
+ _proto.readUint32 = function readUint32(offset) {
25412
+ return this.readInt32(offset) >>> 0;
25413
+ };
25414
+ _proto.readInt64 = function readInt64(offset) {
25415
+ return BigInt.asIntN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
25416
+ };
25417
+ _proto.readUint64 = function readUint64(offset) {
25418
+ return BigInt.asUintN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
25419
+ };
25420
+ _proto.readFloat32 = function readFloat32(offset) {
25421
+ int32[0] = this.readInt32(offset);
25422
+ return float32[0];
25423
+ };
25424
+ _proto.readFloat64 = function readFloat64(offset) {
25425
+ int32[isLittleEndian ? 0 : 1] = this.readInt32(offset);
25426
+ int32[isLittleEndian ? 1 : 0] = this.readInt32(offset + 4);
25427
+ return float64[0];
25428
+ };
25429
+ _proto.writeInt8 = function writeInt8(offset, value) {
25430
+ this.bytes_[offset] = value;
25431
+ };
25432
+ _proto.writeUint8 = function writeUint8(offset, value) {
25433
+ this.bytes_[offset] = value;
25434
+ };
25435
+ _proto.writeInt16 = function writeInt16(offset, value) {
25436
+ this.bytes_[offset] = value;
25437
+ this.bytes_[offset + 1] = value >> 8;
25438
+ };
25439
+ _proto.writeUint16 = function writeUint16(offset, value) {
25440
+ this.bytes_[offset] = value;
25441
+ this.bytes_[offset + 1] = value >> 8;
25442
+ };
25443
+ _proto.writeInt32 = function writeInt32(offset, value) {
25444
+ this.bytes_[offset] = value;
25445
+ this.bytes_[offset + 1] = value >> 8;
25446
+ this.bytes_[offset + 2] = value >> 16;
25447
+ this.bytes_[offset + 3] = value >> 24;
25448
+ };
25449
+ _proto.writeUint32 = function writeUint32(offset, value) {
25450
+ this.bytes_[offset] = value;
25451
+ this.bytes_[offset + 1] = value >> 8;
25452
+ this.bytes_[offset + 2] = value >> 16;
25453
+ this.bytes_[offset + 3] = value >> 24;
25454
+ };
25455
+ _proto.writeInt64 = function writeInt64(offset, value) {
25456
+ this.writeInt32(offset, Number(BigInt.asIntN(32, value)));
25457
+ this.writeInt32(offset + 4, Number(BigInt.asIntN(32, value >> BigInt(32))));
25458
+ };
25459
+ _proto.writeUint64 = function writeUint64(offset, value) {
25460
+ this.writeUint32(offset, Number(BigInt.asUintN(32, value)));
25461
+ this.writeUint32(offset + 4, Number(BigInt.asUintN(32, value >> BigInt(32))));
25462
+ };
25463
+ _proto.writeFloat32 = function writeFloat32(offset, value) {
25464
+ float32[0] = value;
25465
+ this.writeInt32(offset, int32[0]);
25466
+ };
25467
+ _proto.writeFloat64 = function writeFloat64(offset, value) {
25468
+ float64[0] = value;
25469
+ this.writeInt32(offset, int32[isLittleEndian ? 0 : 1]);
25470
+ this.writeInt32(offset + 4, int32[isLittleEndian ? 1 : 0]);
25471
+ };
25472
+ /**
25473
+ * Return the file identifier. Behavior is undefined for FlatBuffers whose
25474
+ * schema does not include a file_identifier (likely points at padding or the
25475
+ * start of a the root vtable).
25476
+ */ _proto.getBufferIdentifier = function getBufferIdentifier() {
25477
+ if (this.bytes_.length < this.position_ + SIZEOF_INT + FILE_IDENTIFIER_LENGTH) {
25478
+ throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");
25479
+ }
25480
+ var result = "";
25481
+ for(var i = 0; i < FILE_IDENTIFIER_LENGTH; i++){
25482
+ result += String.fromCharCode(this.readInt8(this.position_ + SIZEOF_INT + i));
25483
+ }
25484
+ return result;
25485
+ };
25486
+ /**
25487
+ * Look up a field in the vtable, return an offset into the object, or 0 if the
25488
+ * field is not present.
25489
+ */ _proto.__offset = function __offset(bb_pos, vtable_offset) {
25490
+ var vtable = bb_pos - this.readInt32(bb_pos);
25491
+ return vtable_offset < this.readInt16(vtable) ? this.readInt16(vtable + vtable_offset) : 0;
25492
+ };
25493
+ /**
25494
+ * Initialize any Table-derived type to point to the union at the given offset.
25495
+ */ _proto.__union = function __union(t, offset) {
25496
+ t.bb_pos = offset + this.readInt32(offset);
25497
+ t.bb = this;
25498
+ return t;
25499
+ };
25500
+ /**
25501
+ * Create a JavaScript string from UTF-8 data stored inside the FlatBuffer.
25502
+ * This allocates a new string and converts to wide chars upon each access.
25503
+ *
25504
+ * To avoid the conversion to string, pass Encoding.UTF8_BYTES as the
25505
+ * "optionalEncoding" argument. This is useful for avoiding conversion when
25506
+ * the data will just be packaged back up in another FlatBuffer later on.
25507
+ *
25508
+ * @param offset
25509
+ * @param opt_encoding Defaults to UTF16_STRING
25510
+ */ _proto.__string = function __string(offset, opt_encoding) {
25511
+ offset += this.readInt32(offset);
25512
+ var length = this.readInt32(offset);
25513
+ offset += SIZEOF_INT;
25514
+ var utf8bytes = this.bytes_.subarray(offset, offset + length);
25515
+ if (opt_encoding === Encoding.UTF8_BYTES) return utf8bytes;
25516
+ else return this.text_decoder_.decode(utf8bytes);
25517
+ };
25518
+ /**
25519
+ * Handle unions that can contain string as its member, if a Table-derived type then initialize it,
25520
+ * if a string then return a new one
25521
+ *
25522
+ * WARNING: strings are immutable in JS so we can't change the string that the user gave us, this
25523
+ * makes the behaviour of __union_with_string different compared to __union
25524
+ */ _proto.__union_with_string = function __union_with_string(o, offset) {
25525
+ if (typeof o === "string") {
25526
+ return this.__string(offset);
25527
+ }
25528
+ return this.__union(o, offset);
25529
+ };
25530
+ /**
25531
+ * Retrieve the relative offset stored at "offset"
25532
+ */ _proto.__indirect = function __indirect(offset) {
25533
+ return offset + this.readInt32(offset);
25534
+ };
25535
+ /**
25536
+ * Get the start of data of a vector whose offset is stored at "offset" in this object.
25537
+ */ _proto.__vector = function __vector(offset) {
25538
+ return offset + this.readInt32(offset) + SIZEOF_INT; // data starts after the length
25539
+ };
25540
+ /**
25541
+ * Get the length of a vector whose offset is stored at "offset" in this object.
25542
+ */ _proto.__vector_len = function __vector_len(offset) {
25543
+ return this.readInt32(offset + this.readInt32(offset));
25544
+ };
25545
+ _proto.__has_identifier = function __has_identifier(ident) {
25546
+ if (ident.length != FILE_IDENTIFIER_LENGTH) {
25547
+ throw new Error("FlatBuffers: file identifier must be length " + FILE_IDENTIFIER_LENGTH);
25548
+ }
25549
+ for(var i = 0; i < FILE_IDENTIFIER_LENGTH; i++){
25550
+ if (ident.charCodeAt(i) != this.readInt8(this.position() + SIZEOF_INT + i)) {
25551
+ return false;
25552
+ }
25553
+ }
25554
+ return true;
25555
+ };
25556
+ /**
25557
+ * A helper function for generating list for obj api
25558
+ */ _proto.createScalarList = function createScalarList(listAccessor, listLength) {
25559
+ var ret = [];
25560
+ for(var i = 0; i < listLength; ++i){
25561
+ var val = listAccessor(i);
25562
+ if (val !== null) {
25563
+ ret.push(val);
25564
+ }
25565
+ }
25566
+ return ret;
25567
+ };
25568
+ /**
25569
+ * A helper function for generating list for obj api
25570
+ * @param listAccessor function that accepts an index and return data at that index
25571
+ * @param listLength listLength
25572
+ * @param res result list
25573
+ */ _proto.createObjList = function createObjList(listAccessor, listLength) {
25574
+ var ret = [];
25575
+ for(var i = 0; i < listLength; ++i){
25576
+ var val = listAccessor(i);
25577
+ if (val !== null) {
25578
+ ret.push(val.unpack());
25579
+ }
25580
+ }
25581
+ return ret;
25582
+ };
25583
+ /**
25584
+ * Create and allocate a new ByteBuffer with a given size.
25585
+ */ ByteBuffer.allocate = function allocate(byte_size) {
25586
+ return new ByteBuffer(new Uint8Array(byte_size));
25587
+ };
25588
+ return ByteBuffer;
25589
+ }();
25590
+
25591
+ var Builder = /*#__PURE__*/ function() {
25592
+ function Builder(opt_initial_size) {
25593
+ /** Minimum alignment encountered so far. */ this.minalign = 1;
25594
+ /** The vtable for the current table. */ this.vtable = null;
25595
+ /** The amount of fields we're actually using. */ this.vtable_in_use = 0;
25596
+ /** Whether we are currently serializing a table. */ this.isNested = false;
25597
+ /** Starting offset of the current struct/table. */ this.object_start = 0;
25598
+ /** List of offsets of all vtables. */ this.vtables = [];
25599
+ /** For the current vector being built. */ this.vector_num_elems = 0;
25600
+ /** False omits default values from the serialized data */ this.force_defaults = false;
25601
+ this.string_maps = null;
25602
+ this.text_encoder = new TextEncoder();
25603
+ var initial_size;
25604
+ if (!opt_initial_size) {
25605
+ initial_size = 1024;
25606
+ } else {
25607
+ initial_size = opt_initial_size;
25608
+ }
25609
+ /**
25610
+ * @type {ByteBuffer}
25611
+ * @private
25612
+ */ this.bb = ByteBuffer.allocate(initial_size);
25613
+ this.space = initial_size;
25614
+ }
25615
+ var _proto = Builder.prototype;
25616
+ _proto.clear = function clear() {
25617
+ this.bb.clear();
25618
+ this.space = this.bb.capacity();
25619
+ this.minalign = 1;
25620
+ this.vtable = null;
25621
+ this.vtable_in_use = 0;
25622
+ this.isNested = false;
25623
+ this.object_start = 0;
25624
+ this.vtables = [];
25625
+ this.vector_num_elems = 0;
25626
+ this.force_defaults = false;
25627
+ this.string_maps = null;
25628
+ };
25629
+ /**
25630
+ * In order to save space, fields that are set to their default value
25631
+ * don't get serialized into the buffer. Forcing defaults provides a
25632
+ * way to manually disable this optimization.
25633
+ *
25634
+ * @param forceDefaults true always serializes default values
25635
+ */ _proto.forceDefaults = function forceDefaults(forceDefaults) {
25636
+ this.force_defaults = forceDefaults;
25637
+ };
25638
+ /**
25639
+ * Get the ByteBuffer representing the FlatBuffer. Only call this after you've
25640
+ * called finish(). The actual data starts at the ByteBuffer's current position,
25641
+ * not necessarily at 0.
25642
+ */ _proto.dataBuffer = function dataBuffer() {
25643
+ return this.bb;
25644
+ };
25645
+ /**
25646
+ * Get the bytes representing the FlatBuffer. Only call this after you've
25647
+ * called finish().
25648
+ */ _proto.asUint8Array = function asUint8Array() {
25649
+ return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());
25650
+ };
25651
+ /**
25652
+ * Prepare to write an element of `size` after `additional_bytes` have been
25653
+ * written, e.g. if you write a string, you need to align such the int length
25654
+ * field is aligned to 4 bytes, and the string data follows it directly. If all
25655
+ * you need to do is alignment, `additional_bytes` will be 0.
25656
+ *
25657
+ * @param size This is the of the new element to write
25658
+ * @param additional_bytes The padding size
25659
+ */ _proto.prep = function prep(size, additional_bytes) {
25660
+ // Track the biggest thing we've ever aligned to.
25661
+ if (size > this.minalign) {
25662
+ this.minalign = size;
25663
+ }
25664
+ // Find the amount of alignment needed such that `size` is properly
25665
+ // aligned after `additional_bytes`
25666
+ var align_size = ~(this.bb.capacity() - this.space + additional_bytes) + 1 & size - 1;
25667
+ // Reallocate the buffer if needed.
25668
+ while(this.space < align_size + size + additional_bytes){
25669
+ var old_buf_size = this.bb.capacity();
25670
+ this.bb = Builder.growByteBuffer(this.bb);
25671
+ this.space += this.bb.capacity() - old_buf_size;
25672
+ }
25673
+ this.pad(align_size);
25674
+ };
25675
+ _proto.pad = function pad(byte_size) {
25676
+ for(var i = 0; i < byte_size; i++){
25677
+ this.bb.writeInt8(--this.space, 0);
25678
+ }
25679
+ };
25680
+ _proto.writeInt8 = function writeInt8(value) {
25681
+ this.bb.writeInt8(this.space -= 1, value);
25682
+ };
25683
+ _proto.writeInt16 = function writeInt16(value) {
25684
+ this.bb.writeInt16(this.space -= 2, value);
25685
+ };
25686
+ _proto.writeInt32 = function writeInt32(value) {
25687
+ this.bb.writeInt32(this.space -= 4, value);
25688
+ };
25689
+ _proto.writeInt64 = function writeInt64(value) {
25690
+ this.bb.writeInt64(this.space -= 8, value);
25691
+ };
25692
+ _proto.writeFloat32 = function writeFloat32(value) {
25693
+ this.bb.writeFloat32(this.space -= 4, value);
25694
+ };
25695
+ _proto.writeFloat64 = function writeFloat64(value) {
25696
+ this.bb.writeFloat64(this.space -= 8, value);
25697
+ };
25698
+ /**
25699
+ * Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary).
25700
+ * @param value The `int8` to add the buffer.
25701
+ */ _proto.addInt8 = function addInt8(value) {
25702
+ this.prep(1, 0);
25703
+ this.writeInt8(value);
25704
+ };
25705
+ /**
25706
+ * Add an `int16` to the buffer, properly aligned, and grows the buffer (if necessary).
25707
+ * @param value The `int16` to add the buffer.
25708
+ */ _proto.addInt16 = function addInt16(value) {
25709
+ this.prep(2, 0);
25710
+ this.writeInt16(value);
25711
+ };
25712
+ /**
25713
+ * Add an `int32` to the buffer, properly aligned, and grows the buffer (if necessary).
25714
+ * @param value The `int32` to add the buffer.
25715
+ */ _proto.addInt32 = function addInt32(value) {
25716
+ this.prep(4, 0);
25717
+ this.writeInt32(value);
25718
+ };
25719
+ /**
25720
+ * Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).
25721
+ * @param value The `int64` to add the buffer.
25722
+ */ _proto.addInt64 = function addInt64(value) {
25723
+ this.prep(8, 0);
25724
+ this.writeInt64(value);
25725
+ };
25726
+ /**
25727
+ * Add a `float32` to the buffer, properly aligned, and grows the buffer (if necessary).
25728
+ * @param value The `float32` to add the buffer.
25729
+ */ _proto.addFloat32 = function addFloat32(value) {
25730
+ this.prep(4, 0);
25731
+ this.writeFloat32(value);
25732
+ };
25733
+ /**
25734
+ * Add a `float64` to the buffer, properly aligned, and grows the buffer (if necessary).
25735
+ * @param value The `float64` to add the buffer.
25736
+ */ _proto.addFloat64 = function addFloat64(value) {
25737
+ this.prep(8, 0);
25738
+ this.writeFloat64(value);
25739
+ };
25740
+ _proto.addFieldInt8 = function addFieldInt8(voffset, value, defaultValue) {
25741
+ if (this.force_defaults || value != defaultValue) {
25742
+ this.addInt8(value);
25743
+ this.slot(voffset);
25744
+ }
25745
+ };
25746
+ _proto.addFieldInt16 = function addFieldInt16(voffset, value, defaultValue) {
25747
+ if (this.force_defaults || value != defaultValue) {
25748
+ this.addInt16(value);
25749
+ this.slot(voffset);
25750
+ }
25751
+ };
25752
+ _proto.addFieldInt32 = function addFieldInt32(voffset, value, defaultValue) {
25753
+ if (this.force_defaults || value != defaultValue) {
25754
+ this.addInt32(value);
25755
+ this.slot(voffset);
25756
+ }
25757
+ };
25758
+ _proto.addFieldInt64 = function addFieldInt64(voffset, value, defaultValue) {
25759
+ if (this.force_defaults || value !== defaultValue) {
25760
+ this.addInt64(value);
25761
+ this.slot(voffset);
25762
+ }
25763
+ };
25764
+ _proto.addFieldFloat32 = function addFieldFloat32(voffset, value, defaultValue) {
25765
+ if (this.force_defaults || value != defaultValue) {
25766
+ this.addFloat32(value);
25767
+ this.slot(voffset);
25768
+ }
25769
+ };
25770
+ _proto.addFieldFloat64 = function addFieldFloat64(voffset, value, defaultValue) {
25771
+ if (this.force_defaults || value != defaultValue) {
25772
+ this.addFloat64(value);
25773
+ this.slot(voffset);
25774
+ }
25775
+ };
25776
+ _proto.addFieldOffset = function addFieldOffset(voffset, value, defaultValue) {
25777
+ if (this.force_defaults || value != defaultValue) {
25778
+ this.addOffset(value);
25779
+ this.slot(voffset);
25780
+ }
25781
+ };
25782
+ /**
25783
+ * Structs are stored inline, so nothing additional is being added. `d` is always 0.
25784
+ */ _proto.addFieldStruct = function addFieldStruct(voffset, value, defaultValue) {
25785
+ if (value != defaultValue) {
25786
+ this.nested(value);
25787
+ this.slot(voffset);
25788
+ }
25789
+ };
25790
+ /**
25791
+ * Structures are always stored inline, they need to be created right
25792
+ * where they're used. You'll get this assertion failure if you
25793
+ * created it elsewhere.
25794
+ */ _proto.nested = function nested(obj) {
25795
+ if (obj != this.offset()) {
25796
+ throw new TypeError("FlatBuffers: struct must be serialized inline.");
25797
+ }
25798
+ };
25799
+ /**
25800
+ * Should not be creating any other object, string or vector
25801
+ * while an object is being constructed
25802
+ */ _proto.notNested = function notNested() {
25803
+ if (this.isNested) {
25804
+ throw new TypeError("FlatBuffers: object serialization must not be nested.");
25805
+ }
25806
+ };
25807
+ /**
25808
+ * Set the current vtable at `voffset` to the current location in the buffer.
25809
+ */ _proto.slot = function slot(voffset) {
25810
+ if (this.vtable !== null) this.vtable[voffset] = this.offset();
25811
+ };
25812
+ /**
25813
+ * @returns Offset relative to the end of the buffer.
25814
+ */ _proto.offset = function offset() {
25815
+ return this.bb.capacity() - this.space;
25816
+ };
25817
+ /**
25818
+ * Adds on offset, relative to where it will be written.
25819
+ *
25820
+ * @param offset The offset to add.
25821
+ */ _proto.addOffset = function addOffset(offset) {
25822
+ this.prep(SIZEOF_INT, 0); // Ensure alignment is already done.
25823
+ this.writeInt32(this.offset() - offset + SIZEOF_INT);
25824
+ };
25825
+ /**
25826
+ * Start encoding a new object in the buffer. Users will not usually need to
25827
+ * call this directly. The FlatBuffers compiler will generate helper methods
25828
+ * that call this method internally.
25829
+ */ _proto.startObject = function startObject(numfields) {
25830
+ this.notNested();
25831
+ if (this.vtable == null) {
25832
+ this.vtable = [];
25833
+ }
25834
+ this.vtable_in_use = numfields;
25835
+ for(var i = 0; i < numfields; i++){
25836
+ this.vtable[i] = 0; // This will push additional elements as needed
25837
+ }
25838
+ this.isNested = true;
25839
+ this.object_start = this.offset();
25840
+ };
25841
+ /**
25842
+ * Finish off writing the object that is under construction.
25843
+ *
25844
+ * @returns The offset to the object inside `dataBuffer`
25845
+ */ _proto.endObject = function endObject() {
25846
+ if (this.vtable == null || !this.isNested) {
25847
+ throw new Error("FlatBuffers: endObject called without startObject");
25848
+ }
25849
+ this.addInt32(0);
25850
+ var vtableloc = this.offset();
25851
+ // Trim trailing zeroes.
25852
+ var i = this.vtable_in_use - 1;
25853
+ // eslint-disable-next-line no-empty
25854
+ for(; i >= 0 && this.vtable[i] == 0; i--){}
25855
+ var trimmed_size = i + 1;
25856
+ // Write out the current vtable.
25857
+ for(; i >= 0; i--){
25858
+ // Offset relative to the start of the table.
25859
+ this.addInt16(this.vtable[i] != 0 ? vtableloc - this.vtable[i] : 0);
25860
+ }
25861
+ var standard_fields = 2; // The fields below:
25862
+ this.addInt16(vtableloc - this.object_start);
25863
+ var len = (trimmed_size + standard_fields) * SIZEOF_SHORT;
25864
+ this.addInt16(len);
25865
+ // Search for an existing vtable that matches the current one.
25866
+ var existing_vtable = 0;
25867
+ var vt1 = this.space;
25868
+ outer_loop: for(i = 0; i < this.vtables.length; i++){
25869
+ var vt2 = this.bb.capacity() - this.vtables[i];
25870
+ if (len == this.bb.readInt16(vt2)) {
25871
+ for(var j = SIZEOF_SHORT; j < len; j += SIZEOF_SHORT){
25872
+ if (this.bb.readInt16(vt1 + j) != this.bb.readInt16(vt2 + j)) {
25873
+ continue outer_loop;
25874
+ }
25875
+ }
25876
+ existing_vtable = this.vtables[i];
25877
+ break;
25878
+ }
25879
+ }
25880
+ if (existing_vtable) {
25881
+ // Found a match:
25882
+ // Remove the current vtable.
25883
+ this.space = this.bb.capacity() - vtableloc;
25884
+ // Point table to existing vtable.
25885
+ this.bb.writeInt32(this.space, existing_vtable - vtableloc);
25886
+ } else {
25887
+ // No match:
25888
+ // Add the location of the current vtable to the list of vtables.
25889
+ this.vtables.push(this.offset());
25890
+ // Point table to current vtable.
25891
+ this.bb.writeInt32(this.bb.capacity() - vtableloc, this.offset() - vtableloc);
25892
+ }
25893
+ this.isNested = false;
25894
+ return vtableloc;
25895
+ };
25896
+ /**
25897
+ * Finalize a buffer, poiting to the given `root_table`.
25898
+ */ _proto.finish = function finish(root_table, opt_file_identifier, opt_size_prefix) {
25899
+ var size_prefix = opt_size_prefix ? SIZE_PREFIX_LENGTH : 0;
25900
+ if (opt_file_identifier) {
25901
+ var file_identifier = opt_file_identifier;
25902
+ this.prep(this.minalign, SIZEOF_INT + FILE_IDENTIFIER_LENGTH + size_prefix);
25903
+ if (file_identifier.length != FILE_IDENTIFIER_LENGTH) {
25904
+ throw new TypeError("FlatBuffers: file identifier must be length " + FILE_IDENTIFIER_LENGTH);
25905
+ }
25906
+ for(var i = FILE_IDENTIFIER_LENGTH - 1; i >= 0; i--){
25907
+ this.writeInt8(file_identifier.charCodeAt(i));
25908
+ }
25909
+ }
25910
+ this.prep(this.minalign, SIZEOF_INT + size_prefix);
25911
+ this.addOffset(root_table);
25912
+ if (size_prefix) {
25913
+ this.addInt32(this.bb.capacity() - this.space);
25914
+ }
25915
+ this.bb.setPosition(this.space);
25916
+ };
25917
+ /**
25918
+ * Finalize a size prefixed buffer, pointing to the given `root_table`.
25919
+ */ _proto.finishSizePrefixed = function finishSizePrefixed(root_table, opt_file_identifier) {
25920
+ this.finish(root_table, opt_file_identifier, true);
25921
+ };
25922
+ /**
25923
+ * This checks a required field has been set in a given table that has
25924
+ * just been constructed.
25925
+ */ _proto.requiredField = function requiredField(table, field) {
25926
+ var table_start = this.bb.capacity() - table;
25927
+ var vtable_start = table_start - this.bb.readInt32(table_start);
25928
+ var ok = field < this.bb.readInt16(vtable_start) && this.bb.readInt16(vtable_start + field) != 0;
25929
+ // If this fails, the caller will show what field needs to be set.
25930
+ if (!ok) {
25931
+ throw new TypeError("FlatBuffers: field " + field + " must be set");
25932
+ }
25933
+ };
25934
+ /**
25935
+ * Start a new array/vector of objects. Users usually will not call
25936
+ * this directly. The FlatBuffers compiler will create a start/end
25937
+ * method for vector types in generated code.
25938
+ *
25939
+ * @param elem_size The size of each element in the array
25940
+ * @param num_elems The number of elements in the array
25941
+ * @param alignment The alignment of the array
25942
+ */ _proto.startVector = function startVector(elem_size, num_elems, alignment) {
25943
+ this.notNested();
25944
+ this.vector_num_elems = num_elems;
25945
+ this.prep(SIZEOF_INT, elem_size * num_elems);
25946
+ this.prep(alignment, elem_size * num_elems); // Just in case alignment > int.
25947
+ };
25948
+ /**
25949
+ * Finish off the creation of an array and all its elements. The array must be
25950
+ * created with `startVector`.
25951
+ *
25952
+ * @returns The offset at which the newly created array
25953
+ * starts.
25954
+ */ _proto.endVector = function endVector() {
25955
+ this.writeInt32(this.vector_num_elems);
25956
+ return this.offset();
25957
+ };
25958
+ /**
25959
+ * Encode the string `s` in the buffer using UTF-8. If the string passed has
25960
+ * already been seen, we return the offset of the already written string
25961
+ *
25962
+ * @param s The string to encode
25963
+ * @return The offset in the buffer where the encoded string starts
25964
+ */ _proto.createSharedString = function createSharedString(s) {
25965
+ if (!s) {
25966
+ return 0;
25967
+ }
25968
+ if (!this.string_maps) {
25969
+ this.string_maps = new Map();
25970
+ }
25971
+ if (this.string_maps.has(s)) {
25972
+ return this.string_maps.get(s);
25973
+ }
25974
+ var offset = this.createString(s);
25975
+ this.string_maps.set(s, offset);
25976
+ return offset;
25977
+ };
25978
+ /**
25979
+ * Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed
25980
+ * instead of a string, it is assumed to contain valid UTF-8 encoded data.
25981
+ *
25982
+ * @param s The string to encode
25983
+ * @return The offset in the buffer where the encoded string starts
25984
+ */ _proto.createString = function createString(s) {
25985
+ if (s === null || s === undefined) {
25986
+ return 0;
25987
+ }
25988
+ var utf8;
25989
+ if (_instanceof1(s, Uint8Array)) {
25990
+ utf8 = s;
25991
+ } else {
25992
+ utf8 = this.text_encoder.encode(s);
25993
+ }
25994
+ this.addInt8(0);
25995
+ this.startVector(1, utf8.length, 1);
25996
+ this.bb.setPosition(this.space -= utf8.length);
25997
+ this.bb.bytes().set(utf8, this.space);
25998
+ return this.endVector();
25999
+ };
26000
+ /**
26001
+ * Create a byte vector.
26002
+ *
26003
+ * @param v The bytes to add
26004
+ * @returns The offset in the buffer where the byte vector starts
26005
+ */ _proto.createByteVector = function createByteVector(v) {
26006
+ if (v === null || v === undefined) {
26007
+ return 0;
26008
+ }
26009
+ this.startVector(1, v.length, 1);
26010
+ this.bb.setPosition(this.space -= v.length);
26011
+ this.bb.bytes().set(v, this.space);
26012
+ return this.endVector();
26013
+ };
26014
+ /**
26015
+ * A helper function to pack an object
26016
+ *
26017
+ * @returns offset of obj
26018
+ */ _proto.createObjectOffset = function createObjectOffset(obj) {
26019
+ if (obj === null) {
26020
+ return 0;
26021
+ }
26022
+ if (typeof obj === "string") {
26023
+ return this.createString(obj);
26024
+ } else {
26025
+ return obj.pack(this);
26026
+ }
26027
+ };
26028
+ /**
26029
+ * A helper function to pack a list of object
26030
+ *
26031
+ * @returns list of offsets of each non null object
26032
+ */ _proto.createObjectOffsetList = function createObjectOffsetList(list) {
26033
+ var ret = [];
26034
+ for(var i = 0; i < list.length; ++i){
26035
+ var val = list[i];
26036
+ if (val !== null) {
26037
+ ret.push(this.createObjectOffset(val));
26038
+ } else {
26039
+ throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");
26040
+ }
26041
+ }
26042
+ return ret;
26043
+ };
26044
+ _proto.createStructOffsetList = function createStructOffsetList(list, startFunc) {
26045
+ startFunc(this, list.length);
26046
+ this.createObjectOffsetList(list.slice().reverse());
26047
+ return this.endVector();
26048
+ };
26049
+ /**
26050
+ * Doubles the size of the backing ByteBuffer and copies the old data towards
26051
+ * the end of the new buffer (since we build the buffer backwards).
26052
+ *
26053
+ * @param bb The current buffer with the existing data
26054
+ * @returns A new byte buffer with the old data copied
26055
+ * to it. The data is located at the end of the buffer.
26056
+ *
26057
+ * uint8Array.set() formally takes {Array<number>|ArrayBufferView}, so to pass
26058
+ * it a uint8Array we need to suppress the type check:
26059
+ * @suppress {checkTypes}
26060
+ */ Builder.growByteBuffer = function growByteBuffer(bb) {
26061
+ var old_buf_size = bb.capacity();
26062
+ // Ensure we don't grow beyond what fits in an int.
26063
+ if (old_buf_size & 0xC0000000) {
26064
+ throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");
26065
+ }
26066
+ var new_buf_size = old_buf_size << 1;
26067
+ var nbb = ByteBuffer.allocate(new_buf_size);
26068
+ nbb.setPosition(new_buf_size - old_buf_size);
26069
+ nbb.bytes().set(bb.bytes(), new_buf_size - old_buf_size);
26070
+ return nbb;
26071
+ };
26072
+ return Builder;
26073
+ }();
26074
+
26075
+ // automatically generated by the FlatBuffers compiler, do not modify
26076
+ var FBEffectsObjectData = /*#__PURE__*/ function() {
26077
+ function FBEffectsObjectData() {
26078
+ this.bb = null;
26079
+ this.bb_pos = 0;
26080
+ }
26081
+ var _proto = FBEffectsObjectData.prototype;
26082
+ _proto.__init = function __init(i, bb) {
26083
+ this.bb_pos = i;
26084
+ this.bb = bb;
26085
+ return this;
26086
+ };
26087
+ _proto.dataType = function dataType(optionalEncoding) {
26088
+ var offset = this.bb.__offset(this.bb_pos, 4);
26089
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
26090
+ };
26091
+ _proto.data = function data(index) {
26092
+ var offset = this.bb.__offset(this.bb_pos, 6);
26093
+ return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
26094
+ };
26095
+ _proto.dataLength = function dataLength() {
26096
+ var offset = this.bb.__offset(this.bb_pos, 6);
26097
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
26098
+ };
26099
+ _proto.dataArray = function dataArray() {
26100
+ var offset = this.bb.__offset(this.bb_pos, 6);
26101
+ 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;
26102
+ };
26103
+ _proto.unpack = function unpack() {
26104
+ return new FBEffectsObjectDataT(this.dataType(), this.bb.createScalarList(this.data.bind(this), this.dataLength()));
26105
+ };
26106
+ _proto.unpackTo = function unpackTo(_o) {
26107
+ _o.dataType = this.dataType();
26108
+ _o.data = this.bb.createScalarList(this.data.bind(this), this.dataLength());
26109
+ };
26110
+ FBEffectsObjectData.getRootAsFBEffectsObjectData = function getRootAsFBEffectsObjectData(bb, obj) {
26111
+ return (obj || new FBEffectsObjectData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26112
+ };
26113
+ FBEffectsObjectData.getSizePrefixedRootAsFBEffectsObjectData = function getSizePrefixedRootAsFBEffectsObjectData(bb, obj) {
26114
+ bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
26115
+ return (obj || new FBEffectsObjectData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26116
+ };
26117
+ FBEffectsObjectData.startFBEffectsObjectData = function startFBEffectsObjectData(builder) {
26118
+ builder.startObject(2);
26119
+ };
26120
+ FBEffectsObjectData.addDataType = function addDataType(builder, dataTypeOffset) {
26121
+ builder.addFieldOffset(0, dataTypeOffset, 0);
26122
+ };
26123
+ FBEffectsObjectData.addData = function addData(builder, dataOffset) {
26124
+ builder.addFieldOffset(1, dataOffset, 0);
26125
+ };
26126
+ FBEffectsObjectData.createDataVector = function createDataVector(builder, data) {
26127
+ builder.startVector(1, data.length, 1);
26128
+ for(var i = data.length - 1; i >= 0; i--){
26129
+ builder.addInt8(data[i]);
26130
+ }
26131
+ return builder.endVector();
26132
+ };
26133
+ FBEffectsObjectData.startDataVector = function startDataVector(builder, numElems) {
26134
+ builder.startVector(1, numElems, 1);
26135
+ };
26136
+ FBEffectsObjectData.endFBEffectsObjectData = function endFBEffectsObjectData(builder) {
26137
+ var offset = builder.endObject();
26138
+ return offset;
26139
+ };
26140
+ FBEffectsObjectData.createFBEffectsObjectData = function createFBEffectsObjectData(builder, dataTypeOffset, dataOffset) {
26141
+ FBEffectsObjectData.startFBEffectsObjectData(builder);
26142
+ FBEffectsObjectData.addDataType(builder, dataTypeOffset);
26143
+ FBEffectsObjectData.addData(builder, dataOffset);
26144
+ return FBEffectsObjectData.endFBEffectsObjectData(builder);
26145
+ };
26146
+ return FBEffectsObjectData;
26147
+ }();
26148
+ var FBEffectsObjectDataT = /*#__PURE__*/ function() {
26149
+ function FBEffectsObjectDataT(dataType, data) {
26150
+ if (dataType === void 0) dataType = null;
26151
+ if (data === void 0) data = [];
26152
+ this.dataType = dataType;
26153
+ this.data = data;
26154
+ }
26155
+ var _proto = FBEffectsObjectDataT.prototype;
26156
+ _proto.pack = function pack(builder) {
26157
+ var dataType = this.dataType !== null ? builder.createString(this.dataType) : 0;
26158
+ var data = FBEffectsObjectData.createDataVector(builder, this.data);
26159
+ return FBEffectsObjectData.createFBEffectsObjectData(builder, dataType, data);
26160
+ };
26161
+ return FBEffectsObjectDataT;
26162
+ }();
26163
+
26164
+ // automatically generated by the FlatBuffers compiler, do not modify
26165
+ var FBEffectsPackageData = /*#__PURE__*/ function() {
26166
+ function FBEffectsPackageData() {
26167
+ this.bb = null;
26168
+ this.bb_pos = 0;
26169
+ }
26170
+ var _proto = FBEffectsPackageData.prototype;
26171
+ _proto.__init = function __init(i, bb) {
26172
+ this.bb_pos = i;
26173
+ this.bb = bb;
26174
+ return this;
26175
+ };
26176
+ _proto.exportObjects = function exportObjects(index, obj) {
26177
+ var offset = this.bb.__offset(this.bb_pos, 4);
26178
+ return offset ? (obj || new FBEffectsObjectData()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
26179
+ };
26180
+ _proto.exportObjectsLength = function exportObjectsLength() {
26181
+ var offset = this.bb.__offset(this.bb_pos, 4);
26182
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
26183
+ };
26184
+ _proto.unpack = function unpack() {
26185
+ return new FBEffectsPackageDataT(this.bb.createObjList(this.exportObjects.bind(this), this.exportObjectsLength()));
26186
+ };
26187
+ _proto.unpackTo = function unpackTo(_o) {
26188
+ _o.exportObjects = this.bb.createObjList(this.exportObjects.bind(this), this.exportObjectsLength());
26189
+ };
26190
+ FBEffectsPackageData.getRootAsFBEffectsPackageData = function getRootAsFBEffectsPackageData(bb, obj) {
26191
+ return (obj || new FBEffectsPackageData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26192
+ };
26193
+ FBEffectsPackageData.getSizePrefixedRootAsFBEffectsPackageData = function getSizePrefixedRootAsFBEffectsPackageData(bb, obj) {
26194
+ bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
26195
+ return (obj || new FBEffectsPackageData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26196
+ };
26197
+ FBEffectsPackageData.startFBEffectsPackageData = function startFBEffectsPackageData(builder) {
26198
+ builder.startObject(1);
26199
+ };
26200
+ FBEffectsPackageData.addExportObjects = function addExportObjects(builder, exportObjectsOffset) {
26201
+ builder.addFieldOffset(0, exportObjectsOffset, 0);
26202
+ };
26203
+ FBEffectsPackageData.createExportObjectsVector = function createExportObjectsVector(builder, data) {
26204
+ builder.startVector(4, data.length, 4);
26205
+ for(var i = data.length - 1; i >= 0; i--){
26206
+ builder.addOffset(data[i]);
26207
+ }
26208
+ return builder.endVector();
26209
+ };
26210
+ FBEffectsPackageData.startExportObjectsVector = function startExportObjectsVector(builder, numElems) {
26211
+ builder.startVector(4, numElems, 4);
26212
+ };
26213
+ FBEffectsPackageData.endFBEffectsPackageData = function endFBEffectsPackageData(builder) {
26214
+ var offset = builder.endObject();
26215
+ return offset;
26216
+ };
26217
+ FBEffectsPackageData.finishFBEffectsPackageDataBuffer = function finishFBEffectsPackageDataBuffer(builder, offset) {
26218
+ builder.finish(offset);
26219
+ };
26220
+ FBEffectsPackageData.finishSizePrefixedFBEffectsPackageDataBuffer = function finishSizePrefixedFBEffectsPackageDataBuffer(builder, offset) {
26221
+ builder.finish(offset, undefined, true);
26222
+ };
26223
+ FBEffectsPackageData.createFBEffectsPackageData = function createFBEffectsPackageData(builder, exportObjectsOffset) {
26224
+ FBEffectsPackageData.startFBEffectsPackageData(builder);
26225
+ FBEffectsPackageData.addExportObjects(builder, exportObjectsOffset);
26226
+ return FBEffectsPackageData.endFBEffectsPackageData(builder);
26227
+ };
26228
+ return FBEffectsPackageData;
26229
+ }();
26230
+ var FBEffectsPackageDataT = /*#__PURE__*/ function() {
26231
+ function FBEffectsPackageDataT(exportObjects) {
26232
+ if (exportObjects === void 0) exportObjects = [];
26233
+ this.exportObjects = exportObjects;
26234
+ }
26235
+ var _proto = FBEffectsPackageDataT.prototype;
26236
+ _proto.pack = function pack(builder) {
26237
+ var exportObjects = FBEffectsPackageData.createExportObjectsVector(builder, builder.createObjectOffsetList(this.exportObjects));
26238
+ return FBEffectsPackageData.createFBEffectsPackageData(builder, exportObjects);
26239
+ };
26240
+ return FBEffectsPackageDataT;
26241
+ }();
26242
+
26243
+ // automatically generated by the FlatBuffers compiler, do not modify
26244
+ var FBSubMesh = /*#__PURE__*/ function() {
26245
+ function FBSubMesh() {
26246
+ this.bb = null;
26247
+ this.bb_pos = 0;
26248
+ }
26249
+ var _proto = FBSubMesh.prototype;
26250
+ _proto.__init = function __init(i, bb) {
26251
+ this.bb_pos = i;
26252
+ this.bb = bb;
26253
+ return this;
26254
+ };
26255
+ _proto.offset = function offset() {
26256
+ var offset = this.bb.__offset(this.bb_pos, 4);
26257
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
26258
+ };
26259
+ _proto.indexCount = function indexCount() {
26260
+ var offset = this.bb.__offset(this.bb_pos, 6);
26261
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
26262
+ };
26263
+ _proto.vertexCount = function vertexCount() {
26264
+ var offset = this.bb.__offset(this.bb_pos, 8);
26265
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
26266
+ };
26267
+ _proto.unpack = function unpack() {
26268
+ return new FBSubMeshT(this.offset(), this.indexCount(), this.vertexCount());
26269
+ };
26270
+ _proto.unpackTo = function unpackTo(_o) {
26271
+ _o.offset = this.offset();
26272
+ _o.indexCount = this.indexCount();
26273
+ _o.vertexCount = this.vertexCount();
26274
+ };
26275
+ FBSubMesh.getRootAsFBSubMesh = function getRootAsFBSubMesh(bb, obj) {
26276
+ return (obj || new FBSubMesh()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26277
+ };
26278
+ FBSubMesh.getSizePrefixedRootAsFBSubMesh = function getSizePrefixedRootAsFBSubMesh(bb, obj) {
26279
+ bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
26280
+ return (obj || new FBSubMesh()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26281
+ };
26282
+ FBSubMesh.startFBSubMesh = function startFBSubMesh(builder) {
26283
+ builder.startObject(3);
26284
+ };
26285
+ FBSubMesh.addOffset = function addOffset(builder, offset) {
26286
+ builder.addFieldInt32(0, offset, 0);
26287
+ };
26288
+ FBSubMesh.addIndexCount = function addIndexCount(builder, indexCount) {
26289
+ builder.addFieldInt32(1, indexCount, 0);
26290
+ };
26291
+ FBSubMesh.addVertexCount = function addVertexCount(builder, vertexCount) {
26292
+ builder.addFieldInt32(2, vertexCount, 0);
26293
+ };
26294
+ FBSubMesh.endFBSubMesh = function endFBSubMesh(builder) {
26295
+ var offset = builder.endObject();
26296
+ return offset;
26297
+ };
26298
+ FBSubMesh.createFBSubMesh = function createFBSubMesh(builder, offset, indexCount, vertexCount) {
26299
+ FBSubMesh.startFBSubMesh(builder);
26300
+ FBSubMesh.addOffset(builder, offset);
26301
+ FBSubMesh.addIndexCount(builder, indexCount);
26302
+ FBSubMesh.addVertexCount(builder, vertexCount);
26303
+ return FBSubMesh.endFBSubMesh(builder);
26304
+ };
26305
+ return FBSubMesh;
26306
+ }();
26307
+ var FBSubMeshT = /*#__PURE__*/ function() {
26308
+ function FBSubMeshT(offset, indexCount, vertexCount) {
26309
+ if (offset === void 0) offset = 0;
26310
+ if (indexCount === void 0) indexCount = 0;
26311
+ if (vertexCount === void 0) vertexCount = 0;
26312
+ this.offset = offset;
26313
+ this.indexCount = indexCount;
26314
+ this.vertexCount = vertexCount;
26315
+ }
26316
+ var _proto = FBSubMeshT.prototype;
26317
+ _proto.pack = function pack(builder) {
26318
+ return FBSubMesh.createFBSubMesh(builder, this.offset, this.indexCount, this.vertexCount);
26319
+ };
26320
+ return FBSubMeshT;
26321
+ }();
26322
+
26323
+ // automatically generated by the FlatBuffers compiler, do not modify
26324
+ var FBVertexChannel = /*#__PURE__*/ function() {
26325
+ function FBVertexChannel() {
26326
+ this.bb = null;
26327
+ this.bb_pos = 0;
26328
+ }
26329
+ var _proto = FBVertexChannel.prototype;
26330
+ _proto.__init = function __init(i, bb) {
26331
+ this.bb_pos = i;
26332
+ this.bb = bb;
26333
+ return this;
26334
+ };
26335
+ _proto.semantic = function semantic(optionalEncoding) {
26336
+ var offset = this.bb.__offset(this.bb_pos, 4);
26337
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
26338
+ };
26339
+ _proto.offset = function offset() {
26340
+ var offset = this.bb.__offset(this.bb_pos, 6);
26341
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
26342
+ };
26343
+ _proto.format = function format() {
26344
+ var offset = this.bb.__offset(this.bb_pos, 8);
26345
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
26346
+ };
26347
+ _proto.dimension = function dimension() {
26348
+ var offset = this.bb.__offset(this.bb_pos, 10);
26349
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
26350
+ };
26351
+ _proto.normalize = function normalize() {
26352
+ var offset = this.bb.__offset(this.bb_pos, 12);
26353
+ return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
26354
+ };
26355
+ _proto.unpack = function unpack() {
26356
+ return new FBVertexChannelT(this.semantic(), this.offset(), this.format(), this.dimension(), this.normalize());
26357
+ };
26358
+ _proto.unpackTo = function unpackTo(_o) {
26359
+ _o.semantic = this.semantic();
26360
+ _o.offset = this.offset();
26361
+ _o.format = this.format();
26362
+ _o.dimension = this.dimension();
26363
+ _o.normalize = this.normalize();
26364
+ };
26365
+ FBVertexChannel.getRootAsFBVertexChannel = function getRootAsFBVertexChannel(bb, obj) {
26366
+ return (obj || new FBVertexChannel()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26367
+ };
26368
+ FBVertexChannel.getSizePrefixedRootAsFBVertexChannel = function getSizePrefixedRootAsFBVertexChannel(bb, obj) {
26369
+ bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
26370
+ return (obj || new FBVertexChannel()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26371
+ };
26372
+ FBVertexChannel.startFBVertexChannel = function startFBVertexChannel(builder) {
26373
+ builder.startObject(5);
26374
+ };
26375
+ FBVertexChannel.addSemantic = function addSemantic(builder, semanticOffset) {
26376
+ builder.addFieldOffset(0, semanticOffset, 0);
26377
+ };
26378
+ FBVertexChannel.addOffset = function addOffset(builder, offset) {
26379
+ builder.addFieldInt32(1, offset, 0);
26380
+ };
26381
+ FBVertexChannel.addFormat = function addFormat(builder, format) {
26382
+ builder.addFieldInt32(2, format, 0);
26383
+ };
26384
+ FBVertexChannel.addDimension = function addDimension(builder, dimension) {
26385
+ builder.addFieldInt32(3, dimension, 0);
26386
+ };
26387
+ FBVertexChannel.addNormalize = function addNormalize(builder, normalize) {
26388
+ builder.addFieldInt8(4, +normalize, +false);
26389
+ };
26390
+ FBVertexChannel.endFBVertexChannel = function endFBVertexChannel(builder) {
26391
+ var offset = builder.endObject();
26392
+ return offset;
26393
+ };
26394
+ FBVertexChannel.createFBVertexChannel = function createFBVertexChannel(builder, semanticOffset, offset, format, dimension, normalize) {
26395
+ FBVertexChannel.startFBVertexChannel(builder);
26396
+ FBVertexChannel.addSemantic(builder, semanticOffset);
26397
+ FBVertexChannel.addOffset(builder, offset);
26398
+ FBVertexChannel.addFormat(builder, format);
26399
+ FBVertexChannel.addDimension(builder, dimension);
26400
+ FBVertexChannel.addNormalize(builder, normalize);
26401
+ return FBVertexChannel.endFBVertexChannel(builder);
26402
+ };
26403
+ return FBVertexChannel;
26404
+ }();
26405
+ var FBVertexChannelT = /*#__PURE__*/ function() {
26406
+ function FBVertexChannelT(semantic, offset, format, dimension, normalize) {
26407
+ if (semantic === void 0) semantic = null;
26408
+ if (offset === void 0) offset = 0;
26409
+ if (format === void 0) format = 0;
26410
+ if (dimension === void 0) dimension = 0;
26411
+ if (normalize === void 0) normalize = false;
26412
+ this.semantic = semantic;
26413
+ this.offset = offset;
26414
+ this.format = format;
26415
+ this.dimension = dimension;
26416
+ this.normalize = normalize;
26417
+ }
26418
+ var _proto = FBVertexChannelT.prototype;
26419
+ _proto.pack = function pack(builder) {
26420
+ var semantic = this.semantic !== null ? builder.createString(this.semantic) : 0;
26421
+ return FBVertexChannel.createFBVertexChannel(builder, semantic, this.offset, this.format, this.dimension, this.normalize);
26422
+ };
26423
+ return FBVertexChannelT;
26424
+ }();
26425
+
26426
+ // automatically generated by the FlatBuffers compiler, do not modify
26427
+ var FBVertexData = /*#__PURE__*/ function() {
26428
+ function FBVertexData() {
26429
+ this.bb = null;
26430
+ this.bb_pos = 0;
26431
+ }
26432
+ var _proto = FBVertexData.prototype;
26433
+ _proto.__init = function __init(i, bb) {
26434
+ this.bb_pos = i;
26435
+ this.bb = bb;
26436
+ return this;
26437
+ };
26438
+ _proto.vertexCount = function vertexCount() {
26439
+ var offset = this.bb.__offset(this.bb_pos, 4);
26440
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
26441
+ };
26442
+ _proto.channels = function channels(index, obj) {
26443
+ var offset = this.bb.__offset(this.bb_pos, 6);
26444
+ return offset ? (obj || new FBVertexChannel()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
26445
+ };
26446
+ _proto.channelsLength = function channelsLength() {
26447
+ var offset = this.bb.__offset(this.bb_pos, 6);
26448
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
26449
+ };
26450
+ _proto.unpack = function unpack() {
26451
+ return new FBVertexDataT(this.vertexCount(), this.bb.createObjList(this.channels.bind(this), this.channelsLength()));
26452
+ };
26453
+ _proto.unpackTo = function unpackTo(_o) {
26454
+ _o.vertexCount = this.vertexCount();
26455
+ _o.channels = this.bb.createObjList(this.channels.bind(this), this.channelsLength());
26456
+ };
26457
+ FBVertexData.getRootAsFBVertexData = function getRootAsFBVertexData(bb, obj) {
26458
+ return (obj || new FBVertexData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26459
+ };
26460
+ FBVertexData.getSizePrefixedRootAsFBVertexData = function getSizePrefixedRootAsFBVertexData(bb, obj) {
26461
+ bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
26462
+ return (obj || new FBVertexData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26463
+ };
26464
+ FBVertexData.startFBVertexData = function startFBVertexData(builder) {
26465
+ builder.startObject(2);
26466
+ };
26467
+ FBVertexData.addVertexCount = function addVertexCount(builder, vertexCount) {
26468
+ builder.addFieldInt32(0, vertexCount, 0);
26469
+ };
26470
+ FBVertexData.addChannels = function addChannels(builder, channelsOffset) {
26471
+ builder.addFieldOffset(1, channelsOffset, 0);
26472
+ };
26473
+ FBVertexData.createChannelsVector = function createChannelsVector(builder, data) {
26474
+ builder.startVector(4, data.length, 4);
26475
+ for(var i = data.length - 1; i >= 0; i--){
26476
+ builder.addOffset(data[i]);
26477
+ }
26478
+ return builder.endVector();
26479
+ };
26480
+ FBVertexData.startChannelsVector = function startChannelsVector(builder, numElems) {
26481
+ builder.startVector(4, numElems, 4);
26482
+ };
26483
+ FBVertexData.endFBVertexData = function endFBVertexData(builder) {
26484
+ var offset = builder.endObject();
26485
+ return offset;
26486
+ };
26487
+ FBVertexData.createFBVertexData = function createFBVertexData(builder, vertexCount, channelsOffset) {
26488
+ FBVertexData.startFBVertexData(builder);
26489
+ FBVertexData.addVertexCount(builder, vertexCount);
26490
+ FBVertexData.addChannels(builder, channelsOffset);
26491
+ return FBVertexData.endFBVertexData(builder);
26492
+ };
26493
+ return FBVertexData;
26494
+ }();
26495
+ var FBVertexDataT = /*#__PURE__*/ function() {
26496
+ function FBVertexDataT(vertexCount, channels) {
26497
+ if (vertexCount === void 0) vertexCount = 0;
26498
+ if (channels === void 0) channels = [];
26499
+ this.vertexCount = vertexCount;
26500
+ this.channels = channels;
26501
+ }
26502
+ var _proto = FBVertexDataT.prototype;
26503
+ _proto.pack = function pack(builder) {
26504
+ var channels = FBVertexData.createChannelsVector(builder, builder.createObjectOffsetList(this.channels));
26505
+ return FBVertexData.createFBVertexData(builder, this.vertexCount, channels);
26506
+ };
26507
+ return FBVertexDataT;
26508
+ }();
26509
+
26510
+ // automatically generated by the FlatBuffers compiler, do not modify
26511
+ var FBGeometryData = /*#__PURE__*/ function() {
26512
+ function FBGeometryData() {
26513
+ this.bb = null;
26514
+ this.bb_pos = 0;
26515
+ }
26516
+ var _proto = FBGeometryData.prototype;
26517
+ _proto.__init = function __init(i, bb) {
26518
+ this.bb_pos = i;
26519
+ this.bb = bb;
26520
+ return this;
26521
+ };
26522
+ _proto.id = function id(optionalEncoding) {
26523
+ var offset = this.bb.__offset(this.bb_pos, 4);
26524
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
26525
+ };
26526
+ _proto.name = function name(optionalEncoding) {
26527
+ var offset = this.bb.__offset(this.bb_pos, 6);
26528
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
26529
+ };
26530
+ _proto.vertexData = function vertexData(obj) {
26531
+ var offset = this.bb.__offset(this.bb_pos, 8);
26532
+ return offset ? (obj || new FBVertexData()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
26533
+ };
26534
+ _proto.indexFormat = function indexFormat() {
26535
+ var offset = this.bb.__offset(this.bb_pos, 10);
26536
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
26537
+ };
26538
+ _proto.indexOffset = function indexOffset() {
26539
+ var offset = this.bb.__offset(this.bb_pos, 12);
26540
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
26541
+ };
26542
+ _proto.subMeshes = function subMeshes(index, obj) {
26543
+ var offset = this.bb.__offset(this.bb_pos, 14);
26544
+ return offset ? (obj || new FBSubMesh()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
26545
+ };
26546
+ _proto.subMeshesLength = function subMeshesLength() {
26547
+ var offset = this.bb.__offset(this.bb_pos, 14);
26548
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
26549
+ };
26550
+ _proto.mode = function mode() {
26551
+ var offset = this.bb.__offset(this.bb_pos, 16);
26552
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
26553
+ };
26554
+ _proto.buffer = function buffer(optionalEncoding) {
26555
+ var offset = this.bb.__offset(this.bb_pos, 18);
26556
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
26557
+ };
26558
+ _proto.binaryData = function binaryData(index) {
26559
+ var offset = this.bb.__offset(this.bb_pos, 20);
26560
+ return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
26561
+ };
26562
+ _proto.binaryDataLength = function binaryDataLength() {
26563
+ var offset = this.bb.__offset(this.bb_pos, 20);
26564
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
26565
+ };
26566
+ _proto.binaryDataArray = function binaryDataArray() {
26567
+ var offset = this.bb.__offset(this.bb_pos, 20);
26568
+ 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;
26569
+ };
26570
+ _proto.boneNames = function boneNames(index, optionalEncoding) {
26571
+ var offset = this.bb.__offset(this.bb_pos, 22);
26572
+ return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
26573
+ };
26574
+ _proto.boneNamesLength = function boneNamesLength() {
26575
+ var offset = this.bb.__offset(this.bb_pos, 22);
26576
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
26577
+ };
26578
+ _proto.rootBoneName = function rootBoneName(optionalEncoding) {
26579
+ var offset = this.bb.__offset(this.bb_pos, 24);
26580
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
26581
+ };
26582
+ _proto.inverseBindMatrices = function inverseBindMatrices(index) {
26583
+ var offset = this.bb.__offset(this.bb_pos, 26);
26584
+ return offset ? this.bb.readFloat32(this.bb.__vector(this.bb_pos + offset) + index * 4) : 0;
26585
+ };
26586
+ _proto.inverseBindMatricesLength = function inverseBindMatricesLength() {
26587
+ var offset = this.bb.__offset(this.bb_pos, 26);
26588
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
26589
+ };
26590
+ _proto.inverseBindMatricesArray = function inverseBindMatricesArray() {
26591
+ var offset = this.bb.__offset(this.bb_pos, 26);
26592
+ 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;
26593
+ };
26594
+ _proto.unpack = function unpack() {
26595
+ 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()));
26596
+ };
26597
+ _proto.unpackTo = function unpackTo(_o) {
26598
+ _o.id = this.id();
26599
+ _o.name = this.name();
26600
+ _o.vertexData = this.vertexData() !== null ? this.vertexData().unpack() : null;
26601
+ _o.indexFormat = this.indexFormat();
26602
+ _o.indexOffset = this.indexOffset();
26603
+ _o.subMeshes = this.bb.createObjList(this.subMeshes.bind(this), this.subMeshesLength());
26604
+ _o.mode = this.mode();
26605
+ _o.buffer = this.buffer();
26606
+ _o.binaryData = this.bb.createScalarList(this.binaryData.bind(this), this.binaryDataLength());
26607
+ _o.boneNames = this.bb.createScalarList(this.boneNames.bind(this), this.boneNamesLength());
26608
+ _o.rootBoneName = this.rootBoneName();
26609
+ _o.inverseBindMatrices = this.bb.createScalarList(this.inverseBindMatrices.bind(this), this.inverseBindMatricesLength());
26610
+ };
26611
+ FBGeometryData.getRootAsFBGeometryData = function getRootAsFBGeometryData(bb, obj) {
26612
+ return (obj || new FBGeometryData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26613
+ };
26614
+ FBGeometryData.getSizePrefixedRootAsFBGeometryData = function getSizePrefixedRootAsFBGeometryData(bb, obj) {
26615
+ bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
26616
+ return (obj || new FBGeometryData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26617
+ };
26618
+ FBGeometryData.startFBGeometryData = function startFBGeometryData(builder) {
26619
+ builder.startObject(12);
26620
+ };
26621
+ FBGeometryData.addId = function addId(builder, idOffset) {
26622
+ builder.addFieldOffset(0, idOffset, 0);
26623
+ };
26624
+ FBGeometryData.addName = function addName(builder, nameOffset) {
26625
+ builder.addFieldOffset(1, nameOffset, 0);
26626
+ };
26627
+ FBGeometryData.addVertexData = function addVertexData(builder, vertexDataOffset) {
26628
+ builder.addFieldOffset(2, vertexDataOffset, 0);
26629
+ };
26630
+ FBGeometryData.addIndexFormat = function addIndexFormat(builder, indexFormat) {
26631
+ builder.addFieldInt32(3, indexFormat, 0);
26632
+ };
26633
+ FBGeometryData.addIndexOffset = function addIndexOffset(builder, indexOffset) {
26634
+ builder.addFieldInt32(4, indexOffset, 0);
26635
+ };
26636
+ FBGeometryData.addSubMeshes = function addSubMeshes(builder, subMeshesOffset) {
26637
+ builder.addFieldOffset(5, subMeshesOffset, 0);
26638
+ };
26639
+ FBGeometryData.createSubMeshesVector = function createSubMeshesVector(builder, data) {
26640
+ builder.startVector(4, data.length, 4);
26641
+ for(var i = data.length - 1; i >= 0; i--){
26642
+ builder.addOffset(data[i]);
26643
+ }
26644
+ return builder.endVector();
26645
+ };
26646
+ FBGeometryData.startSubMeshesVector = function startSubMeshesVector(builder, numElems) {
26647
+ builder.startVector(4, numElems, 4);
26648
+ };
26649
+ FBGeometryData.addMode = function addMode(builder, mode) {
26650
+ builder.addFieldInt32(6, mode, 0);
26651
+ };
26652
+ FBGeometryData.addBuffer = function addBuffer(builder, bufferOffset) {
26653
+ builder.addFieldOffset(7, bufferOffset, 0);
26654
+ };
26655
+ FBGeometryData.addBinaryData = function addBinaryData(builder, binaryDataOffset) {
26656
+ builder.addFieldOffset(8, binaryDataOffset, 0);
26657
+ };
26658
+ FBGeometryData.createBinaryDataVector = function createBinaryDataVector(builder, data) {
26659
+ builder.startVector(1, data.length, 1);
26660
+ for(var i = data.length - 1; i >= 0; i--){
26661
+ builder.addInt8(data[i]);
26662
+ }
26663
+ return builder.endVector();
26664
+ };
26665
+ FBGeometryData.startBinaryDataVector = function startBinaryDataVector(builder, numElems) {
26666
+ builder.startVector(1, numElems, 1);
26667
+ };
26668
+ FBGeometryData.addBoneNames = function addBoneNames(builder, boneNamesOffset) {
26669
+ builder.addFieldOffset(9, boneNamesOffset, 0);
26670
+ };
26671
+ FBGeometryData.createBoneNamesVector = function createBoneNamesVector(builder, data) {
26672
+ builder.startVector(4, data.length, 4);
26673
+ for(var i = data.length - 1; i >= 0; i--){
26674
+ builder.addOffset(data[i]);
26675
+ }
26676
+ return builder.endVector();
26677
+ };
26678
+ FBGeometryData.startBoneNamesVector = function startBoneNamesVector(builder, numElems) {
26679
+ builder.startVector(4, numElems, 4);
26680
+ };
26681
+ FBGeometryData.addRootBoneName = function addRootBoneName(builder, rootBoneNameOffset) {
26682
+ builder.addFieldOffset(10, rootBoneNameOffset, 0);
26683
+ };
26684
+ FBGeometryData.addInverseBindMatrices = function addInverseBindMatrices(builder, inverseBindMatricesOffset) {
26685
+ builder.addFieldOffset(11, inverseBindMatricesOffset, 0);
26686
+ };
26687
+ FBGeometryData.createInverseBindMatricesVector = function createInverseBindMatricesVector(builder, data) {
26688
+ builder.startVector(4, data.length, 4);
26689
+ for(var i = data.length - 1; i >= 0; i--){
26690
+ builder.addFloat32(data[i]);
26691
+ }
26692
+ return builder.endVector();
26693
+ };
26694
+ FBGeometryData.startInverseBindMatricesVector = function startInverseBindMatricesVector(builder, numElems) {
26695
+ builder.startVector(4, numElems, 4);
26696
+ };
26697
+ FBGeometryData.endFBGeometryData = function endFBGeometryData(builder) {
26698
+ var offset = builder.endObject();
26699
+ return offset;
26700
+ };
26701
+ return FBGeometryData;
26702
+ }();
26703
+ var FBGeometryDataT = /*#__PURE__*/ function() {
26704
+ function FBGeometryDataT(id, name, vertexData, indexFormat, indexOffset, subMeshes, mode, buffer, binaryData, boneNames, rootBoneName, inverseBindMatrices) {
26705
+ if (id === void 0) id = null;
26706
+ if (name === void 0) name = null;
26707
+ if (vertexData === void 0) vertexData = null;
26708
+ if (indexFormat === void 0) indexFormat = 0;
26709
+ if (indexOffset === void 0) indexOffset = 0;
26710
+ if (subMeshes === void 0) subMeshes = [];
26711
+ if (mode === void 0) mode = 0;
26712
+ if (buffer === void 0) buffer = null;
26713
+ if (binaryData === void 0) binaryData = [];
26714
+ if (boneNames === void 0) boneNames = [];
26715
+ if (rootBoneName === void 0) rootBoneName = null;
26716
+ if (inverseBindMatrices === void 0) inverseBindMatrices = [];
26717
+ this.id = id;
26718
+ this.name = name;
26719
+ this.vertexData = vertexData;
26720
+ this.indexFormat = indexFormat;
26721
+ this.indexOffset = indexOffset;
26722
+ this.subMeshes = subMeshes;
26723
+ this.mode = mode;
26724
+ this.buffer = buffer;
26725
+ this.binaryData = binaryData;
26726
+ this.boneNames = boneNames;
26727
+ this.rootBoneName = rootBoneName;
26728
+ this.inverseBindMatrices = inverseBindMatrices;
26729
+ }
26730
+ var _proto = FBGeometryDataT.prototype;
26731
+ _proto.pack = function pack(builder) {
26732
+ var id = this.id !== null ? builder.createString(this.id) : 0;
26733
+ var name = this.name !== null ? builder.createString(this.name) : 0;
26734
+ var vertexData = this.vertexData !== null ? this.vertexData.pack(builder) : 0;
26735
+ var subMeshes = FBGeometryData.createSubMeshesVector(builder, builder.createObjectOffsetList(this.subMeshes));
26736
+ var buffer = this.buffer !== null ? builder.createString(this.buffer) : 0;
26737
+ var binaryData = FBGeometryData.createBinaryDataVector(builder, this.binaryData);
26738
+ var boneNames = FBGeometryData.createBoneNamesVector(builder, builder.createObjectOffsetList(this.boneNames));
26739
+ var rootBoneName = this.rootBoneName !== null ? builder.createString(this.rootBoneName) : 0;
26740
+ var inverseBindMatrices = FBGeometryData.createInverseBindMatricesVector(builder, this.inverseBindMatrices);
26741
+ FBGeometryData.startFBGeometryData(builder);
26742
+ FBGeometryData.addId(builder, id);
26743
+ FBGeometryData.addName(builder, name);
26744
+ FBGeometryData.addVertexData(builder, vertexData);
26745
+ FBGeometryData.addIndexFormat(builder, this.indexFormat);
26746
+ FBGeometryData.addIndexOffset(builder, this.indexOffset);
26747
+ FBGeometryData.addSubMeshes(builder, subMeshes);
26748
+ FBGeometryData.addMode(builder, this.mode);
26749
+ FBGeometryData.addBuffer(builder, buffer);
26750
+ FBGeometryData.addBinaryData(builder, binaryData);
26751
+ FBGeometryData.addBoneNames(builder, boneNames);
26752
+ FBGeometryData.addRootBoneName(builder, rootBoneName);
26753
+ FBGeometryData.addInverseBindMatrices(builder, inverseBindMatrices);
26754
+ return FBGeometryData.endFBGeometryData(builder);
26755
+ };
26756
+ return FBGeometryDataT;
26757
+ }();
26758
+
26759
+ var EffectsPackage = /*#__PURE__*/ function() {
26760
+ function EffectsPackage() {
26761
+ this.exportObjectDatas = [];
26762
+ }
26763
+ var _proto = EffectsPackage.prototype;
26764
+ _proto.addData = function addData(effectsObjectData) {
26765
+ this.exportObjectDatas.push(effectsObjectData);
26766
+ };
26767
+ _proto.serializeToBinary = function serializeToBinary() {
26768
+ var fbb = new Builder(1);
26769
+ var effectsPackage = new FBEffectsPackageDataT();
26770
+ var exportObjects = [];
26771
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.exportObjectDatas), _step; !(_step = _iterator()).done;){
26772
+ var effectsObjectData = _step.value;
26773
+ var fbEffectsObjectData = void 0;
26774
+ if (effectsObjectData.dataType === DataType.Geometry) {
26775
+ fbEffectsObjectData = new FBEffectsObjectDataT("Geometry", this.geometryDataToBinary(effectsObjectData));
26776
+ }
26777
+ if (!fbEffectsObjectData) {
26778
+ continue;
26779
+ }
26780
+ exportObjects.push(fbEffectsObjectData);
26781
+ }
26782
+ effectsPackage.exportObjects = exportObjects;
26783
+ FBEffectsPackageData.finishFBEffectsPackageDataBuffer(fbb, effectsPackage.pack(fbb));
26784
+ var buffer = fbb.asUint8Array(); // Of type `Uint8Array`.
26785
+ return buffer;
26786
+ };
26787
+ _proto.deserializeFromBinary = function deserializeFromBinary(buffer) {
26788
+ var buf = new ByteBuffer(buffer);
26789
+ var fbEffectsPackage = FBEffectsPackageData.getRootAsFBEffectsPackageData(buf);
26790
+ for(var i = 0; i < fbEffectsPackage.exportObjectsLength(); i++){
26791
+ var fbEffectsObjectData = fbEffectsPackage.exportObjects(i);
26792
+ if (!fbEffectsObjectData) {
26793
+ continue;
26794
+ }
26795
+ var dataBuffer = fbEffectsObjectData.dataArray();
26796
+ var dataType = fbEffectsObjectData.dataType();
26797
+ if (!dataBuffer) {
26798
+ continue;
26799
+ }
26800
+ var effectsObjectData = void 0;
26801
+ if (dataType === DataType.Geometry) {
26802
+ effectsObjectData = this.binaryToGeometryData(dataBuffer);
26803
+ }
26804
+ if (!effectsObjectData) {
26805
+ continue;
26806
+ }
26807
+ this.exportObjectDatas.push(effectsObjectData);
26808
+ }
26809
+ };
26810
+ _proto.geometryDataToBinary = function geometryDataToBinary(geometryData) {
26811
+ var fbb = new Builder(1);
26812
+ var fbGeometryData = new FBGeometryDataT();
26813
+ fbGeometryData.indexFormat = geometryData.indexFormat;
26814
+ fbGeometryData.indexOffset = geometryData.indexOffset;
26815
+ fbGeometryData.mode = geometryData.mode;
26816
+ fbGeometryData.id = geometryData.id;
26817
+ var _geometryData_boneNames;
26818
+ fbGeometryData.boneNames = (_geometryData_boneNames = geometryData.boneNames) != null ? _geometryData_boneNames : [];
26819
+ var _geometryData_rootBoneName;
26820
+ fbGeometryData.rootBoneName = (_geometryData_rootBoneName = geometryData.rootBoneName) != null ? _geometryData_rootBoneName : "";
26821
+ var _geometryData_inverseBindMatrices;
26822
+ fbGeometryData.inverseBindMatrices = (_geometryData_inverseBindMatrices = geometryData.inverseBindMatrices) != null ? _geometryData_inverseBindMatrices : [];
26823
+ var _geometryData_binaryData;
26824
+ fbGeometryData.binaryData = (_geometryData_binaryData = geometryData.binaryData) != null ? _geometryData_binaryData : [];
26825
+ var fbVertexdata = new FBVertexDataT();
26826
+ fbVertexdata.vertexCount = geometryData.vertexData.vertexCount;
26827
+ fbVertexdata.channels = [];
26828
+ for(var _iterator = _create_for_of_iterator_helper_loose(geometryData.vertexData.channels), _step; !(_step = _iterator()).done;){
26829
+ var channel = _step.value;
26830
+ var fbChannel = new FBVertexChannelT(channel.semantic, channel.offset, channel.format, channel.dimension, channel.normalize);
26831
+ fbVertexdata.channels.push(fbChannel);
26832
+ }
26833
+ fbGeometryData.vertexData = fbVertexdata;
26834
+ var fbSubMeshes = [];
26835
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(geometryData.subMeshes), _step1; !(_step1 = _iterator1()).done;){
26836
+ var subMesh = _step1.value;
26837
+ var fbSubMesh = new FBSubMeshT(subMesh.offset, subMesh.indexCount, subMesh.vertexCount);
26838
+ fbSubMeshes.push(fbSubMesh);
26839
+ }
26840
+ fbGeometryData.subMeshes = fbSubMeshes;
26841
+ FBEffectsPackageData.finishFBEffectsPackageDataBuffer(fbb, fbGeometryData.pack(fbb));
26842
+ var buffer = fbb.asUint8Array(); // Of type `Uint8Array`.
26843
+ return buffer;
26844
+ };
26845
+ _proto.binaryToGeometryData = function binaryToGeometryData(buffer) {
26846
+ var buf = new ByteBuffer(buffer);
26847
+ var fbGeometryData = FBGeometryData.getRootAsFBGeometryData(buf);
26848
+ var vertexData = {
26849
+ vertexCount: 0,
26850
+ channels: []
26851
+ };
26852
+ var fbVertexData = fbGeometryData.vertexData();
26853
+ if (fbVertexData) {
26854
+ vertexData.vertexCount = fbVertexData.vertexCount();
26855
+ for(var i = 0; i < fbVertexData.channelsLength(); i++){
26856
+ var channel = fbVertexData.channels(i);
26857
+ if (!channel) {
26858
+ continue;
26859
+ }
26860
+ var _channel_semantic;
26861
+ var vertexChannel = {
26862
+ semantic: (_channel_semantic = channel.semantic()) != null ? _channel_semantic : "",
26863
+ offset: channel.offset(),
26864
+ format: channel.format(),
26865
+ dimension: channel.dimension()
26866
+ };
26867
+ vertexData.channels.push(vertexChannel);
26868
+ }
26869
+ }
26870
+ var subMeshes = [];
26871
+ for(var i1 = 0; i1 < fbGeometryData.subMeshesLength(); i1++){
26872
+ var fbSubMesh = fbGeometryData.subMeshes(i1);
26873
+ if (!fbSubMesh) {
26874
+ continue;
26875
+ }
26876
+ var subMesh = {
26877
+ offset: fbSubMesh.offset(),
26878
+ vertexCount: fbSubMesh.vertexCount()
26879
+ };
26880
+ subMeshes.push(subMesh);
26881
+ }
26882
+ var boneNames = [];
26883
+ for(var i2 = 0; i2 < fbGeometryData.boneNamesLength(); i2++){
26884
+ var boneName = fbGeometryData.boneNames(i2);
26885
+ boneNames.push(boneName);
26886
+ }
26887
+ var inverseBindMatricesArray = fbGeometryData.inverseBindMatricesArray();
26888
+ var _fbGeometryData_buffer, _fbGeometryData_rootBoneName, _fbGeometryData_binaryDataArray, _fbGeometryData_id;
26889
+ var geometryData = {
26890
+ vertexData: vertexData,
26891
+ indexFormat: fbGeometryData.indexFormat(),
26892
+ indexOffset: fbGeometryData.indexOffset(),
26893
+ subMeshes: subMeshes,
26894
+ mode: fbGeometryData.mode(),
26895
+ buffer: (_fbGeometryData_buffer = fbGeometryData.buffer()) != null ? _fbGeometryData_buffer : "",
26896
+ boneNames: boneNames,
26897
+ rootBoneName: (_fbGeometryData_rootBoneName = fbGeometryData.rootBoneName()) != null ? _fbGeometryData_rootBoneName : "",
26898
+ inverseBindMatrices: inverseBindMatricesArray ? Array.from(inverseBindMatricesArray) : undefined,
26899
+ binaryData: (_fbGeometryData_binaryDataArray = fbGeometryData.binaryDataArray()) != null ? _fbGeometryData_binaryDataArray : undefined,
26900
+ id: (_fbGeometryData_id = fbGeometryData.id()) != null ? _fbGeometryData_id : "",
26901
+ dataType: DataType.Geometry
26902
+ };
26903
+ return geometryData;
26904
+ };
26905
+ return EffectsPackage;
26906
+ }();
26907
+
25340
26908
  /**
25341
26909
  * Engine 基类,负责维护所有 GPU 资源的管理及销毁
25342
26910
  */ var Engine = /*#__PURE__*/ function() {
@@ -25410,16 +26978,23 @@ var listOrder = 0;
25410
26978
  for(var i = 0; i < bins.length; i++){
25411
26979
  var binaryData = bins[i];
25412
26980
  var binaryBuffer = scene.bins[i];
25413
- //@ts-expect-error
25414
- binaryData.buffer = binaryBuffer;
25415
- //@ts-expect-error
25416
- if (binaryData.id) {
26981
+ if (binaryData.dataType === DataType.BinaryAsset) {
25417
26982
  //@ts-expect-error
25418
- this.addEffectsObjectData(binaryData);
26983
+ binaryData.buffer = binaryBuffer;
26984
+ if (binaryData.id) {
26985
+ this.addEffectsObjectData(binaryData);
26986
+ }
26987
+ } else {
26988
+ var effectsPackage = new EffectsPackage();
26989
+ effectsPackage.deserializeFromBinary(new Uint8Array(binaryBuffer));
26990
+ for(var _iterator7 = _create_for_of_iterator_helper_loose(effectsPackage.exportObjectDatas), _step7; !(_step7 = _iterator7()).done;){
26991
+ var effectsObjectData = _step7.value;
26992
+ this.addEffectsObjectData(effectsObjectData);
26993
+ }
25419
26994
  }
25420
26995
  }
25421
- for(var _iterator7 = _create_for_of_iterator_helper_loose(textureOptions), _step7; !(_step7 = _iterator7()).done;){
25422
- var textureData = _step7.value;
26996
+ for(var _iterator8 = _create_for_of_iterator_helper_loose(textureOptions), _step8; !(_step8 = _iterator8()).done;){
26997
+ var textureData = _step8.value;
25423
26998
  this.addEffectsObjectData(textureData);
25424
26999
  }
25425
27000
  };
@@ -25729,7 +27304,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
25729
27304
  registerPlugin("particle", ParticleLoader, VFXItem, true);
25730
27305
  registerPlugin("cal", CalculateLoader, VFXItem, true);
25731
27306
  registerPlugin("interact", InteractLoader, VFXItem, true);
25732
- var version$1 = "2.0.0-alpha.26";
27307
+ var version$1 = "2.0.0-alpha.27";
25733
27308
  logger.info("Core version: " + version$1 + ".");
25734
27309
 
25735
27310
  var _obj;
@@ -27362,8 +28937,8 @@ setMaxSpriteMeshItemCount(8);
27362
28937
  */ Mesh.create = function(engine, props) {
27363
28938
  return new ThreeMesh(engine, props);
27364
28939
  };
27365
- var version = "2.0.0-alpha.26";
28940
+ var version = "2.0.0-alpha.27";
27366
28941
  logger.info("THREEJS plugin version: " + version + ".");
27367
28942
 
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, createVFXItem, 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, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, 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 };
28943
+ export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMacros, createShape, createVFXItem, 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, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, 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
28944
  //# sourceMappingURL=index.mjs.map