@dcl/playground-assets 7.0.6-3830539086.commit-6152fbd → 7.0.6-3832166523.commit-2a75a6b
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/alpha.d.ts +6 -9
- package/dist/beta.d.ts +6 -9
- package/dist/index.bundled.d.ts +6 -9
- package/dist/index.js +233 -258
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/playground/sdk/dcl-sdk.package.json +2 -2
- package/dist/playground/snippets/billboard.ts +3 -5
- package/dist/playground-assets.d.ts +6 -9
- package/etc/playground-assets.api.json +71 -35
- package/etc/playground-assets.api.md +8 -4
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -9477,11 +9477,14 @@
|
|
|
9477
9477
|
/* eslint-disable */
|
|
9478
9478
|
exports.BillboardMode = void 0;
|
|
9479
9479
|
(function (BillboardMode) {
|
|
9480
|
-
BillboardMode[BillboardMode["
|
|
9481
|
-
BillboardMode[BillboardMode["
|
|
9480
|
+
BillboardMode[BillboardMode["BM_NONE"] = 0] = "BM_NONE";
|
|
9481
|
+
BillboardMode[BillboardMode["BM_X"] = 1] = "BM_X";
|
|
9482
|
+
BillboardMode[BillboardMode["BM_Y"] = 2] = "BM_Y";
|
|
9483
|
+
BillboardMode[BillboardMode["BM_Z"] = 4] = "BM_Z";
|
|
9484
|
+
BillboardMode[BillboardMode["BM_ALL"] = 7] = "BM_ALL";
|
|
9482
9485
|
})(exports.BillboardMode || (exports.BillboardMode = {}));
|
|
9483
9486
|
function createBasePBBillboard() {
|
|
9484
|
-
return { billboardMode: undefined
|
|
9487
|
+
return { billboardMode: undefined };
|
|
9485
9488
|
}
|
|
9486
9489
|
/**
|
|
9487
9490
|
* Internal
|
|
@@ -9491,9 +9494,6 @@
|
|
|
9491
9494
|
if (message.billboardMode !== undefined) {
|
|
9492
9495
|
writer.uint32(8).int32(message.billboardMode);
|
|
9493
9496
|
}
|
|
9494
|
-
if (message.oppositeDirection !== undefined) {
|
|
9495
|
-
writer.uint32(16).bool(message.oppositeDirection);
|
|
9496
|
-
}
|
|
9497
9497
|
return writer;
|
|
9498
9498
|
},
|
|
9499
9499
|
decode(input, length) {
|
|
@@ -9506,9 +9506,6 @@
|
|
|
9506
9506
|
case 1:
|
|
9507
9507
|
message.billboardMode = reader.int32();
|
|
9508
9508
|
break;
|
|
9509
|
-
case 2:
|
|
9510
|
-
message.oppositeDirection = reader.bool();
|
|
9511
|
-
break;
|
|
9512
9509
|
default:
|
|
9513
9510
|
reader.skipType(tag & 7);
|
|
9514
9511
|
break;
|
|
@@ -13687,6 +13684,12 @@
|
|
|
13687
13684
|
|
|
13688
13685
|
var utf8Exports = requireUtf8();
|
|
13689
13686
|
|
|
13687
|
+
var __classPrivateFieldGet = (globalThis && globalThis.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
13688
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13689
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
13690
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
13691
|
+
};
|
|
13692
|
+
var _ReadWriteByteBuffer_instances, _ReadWriteByteBuffer_woAdd, _ReadWriteByteBuffer_roAdd;
|
|
13690
13693
|
/**
|
|
13691
13694
|
* Take the max between currentSize and intendedSize and then plus 1024. Then,
|
|
13692
13695
|
* find the next nearer multiple of 1024.
|
|
@@ -13706,243 +13709,223 @@
|
|
|
13706
13709
|
* - Use read and write function to generate or consume data.
|
|
13707
13710
|
* - Use set and get only if you are sure that you're doing.
|
|
13708
13711
|
*/
|
|
13709
|
-
|
|
13710
|
-
const initialROffset = options.reading?.currentOffset || 0;
|
|
13711
|
-
let initialBuffer = null;
|
|
13712
|
-
let initialWOffset = 0;
|
|
13713
|
-
if (options.writing) {
|
|
13714
|
-
initialBuffer = options.writing.buffer;
|
|
13715
|
-
if (options.writing.currentOffset) {
|
|
13716
|
-
initialWOffset = options.writing.currentOffset;
|
|
13717
|
-
}
|
|
13718
|
-
}
|
|
13719
|
-
else if (options.reading) {
|
|
13720
|
-
initialBuffer = options.reading.buffer;
|
|
13721
|
-
initialWOffset = options.reading.length || options.reading.buffer.length;
|
|
13722
|
-
}
|
|
13723
|
-
else {
|
|
13724
|
-
initialBuffer = new Uint8Array(options.initialCapacity || defaultInitialCapacity);
|
|
13725
|
-
}
|
|
13726
|
-
let buffer = initialBuffer;
|
|
13727
|
-
let view = new DataView(buffer.buffer, buffer.byteOffset);
|
|
13728
|
-
let woffset = initialWOffset;
|
|
13729
|
-
let roffset = initialROffset;
|
|
13730
|
-
/**
|
|
13731
|
-
* Increement the write offset and resize the buffer if it needs.
|
|
13732
|
-
*/
|
|
13733
|
-
const woAdd = (amount) => {
|
|
13734
|
-
if (woffset + amount > buffer.byteLength) {
|
|
13735
|
-
const newsize = getNextSize(buffer.byteLength, woffset + amount);
|
|
13736
|
-
const newBuffer = new Uint8Array(newsize);
|
|
13737
|
-
newBuffer.set(buffer);
|
|
13738
|
-
buffer = newBuffer;
|
|
13739
|
-
view = new DataView(buffer.buffer);
|
|
13740
|
-
}
|
|
13741
|
-
woffset += amount;
|
|
13742
|
-
return woffset - amount;
|
|
13743
|
-
};
|
|
13712
|
+
class ReadWriteByteBuffer {
|
|
13744
13713
|
/**
|
|
13745
|
-
*
|
|
13746
|
-
*
|
|
13714
|
+
* @param buffer - The initial buffer, provide a buffer if you need to set "initial capacity"
|
|
13715
|
+
* @param readingOffset - Set the cursor where begins to read. Default 0
|
|
13716
|
+
* @param writingOffset - Set the cursor to not start writing from the begin of it. Defaults to the buffer size
|
|
13747
13717
|
*/
|
|
13748
|
-
|
|
13749
|
-
|
|
13750
|
-
|
|
13718
|
+
constructor(buffer, readingOffset, writingOffset) {
|
|
13719
|
+
_ReadWriteByteBuffer_instances.add(this);
|
|
13720
|
+
this._buffer = buffer || new Uint8Array(defaultInitialCapacity);
|
|
13721
|
+
this.view = new DataView(this._buffer.buffer, this._buffer.byteOffset);
|
|
13722
|
+
this.woffset = writingOffset ?? (buffer ? this._buffer.length : null) ?? 0;
|
|
13723
|
+
this.roffset = readingOffset ?? 0;
|
|
13724
|
+
}
|
|
13725
|
+
buffer() {
|
|
13726
|
+
return this._buffer;
|
|
13727
|
+
}
|
|
13728
|
+
bufferLength() {
|
|
13729
|
+
return this._buffer.length;
|
|
13730
|
+
}
|
|
13731
|
+
resetBuffer() {
|
|
13732
|
+
this.roffset = 0;
|
|
13733
|
+
this.woffset = 0;
|
|
13734
|
+
}
|
|
13735
|
+
currentReadOffset() {
|
|
13736
|
+
return this.roffset;
|
|
13737
|
+
}
|
|
13738
|
+
currentWriteOffset() {
|
|
13739
|
+
return this.woffset;
|
|
13740
|
+
}
|
|
13741
|
+
incrementReadOffset(amount) {
|
|
13742
|
+
return __classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_roAdd).call(this, amount);
|
|
13743
|
+
}
|
|
13744
|
+
remainingBytes() {
|
|
13745
|
+
return this.woffset - this.roffset;
|
|
13746
|
+
}
|
|
13747
|
+
readFloat32() {
|
|
13748
|
+
return this.view.getFloat32(__classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_roAdd).call(this, 4));
|
|
13749
|
+
}
|
|
13750
|
+
readFloat64() {
|
|
13751
|
+
return this.view.getFloat64(__classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_roAdd).call(this, 8));
|
|
13752
|
+
}
|
|
13753
|
+
readInt8() {
|
|
13754
|
+
return this.view.getInt8(__classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_roAdd).call(this, 1));
|
|
13755
|
+
}
|
|
13756
|
+
readInt16() {
|
|
13757
|
+
return this.view.getInt16(__classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_roAdd).call(this, 2));
|
|
13758
|
+
}
|
|
13759
|
+
readInt32() {
|
|
13760
|
+
return this.view.getInt32(__classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_roAdd).call(this, 4));
|
|
13761
|
+
}
|
|
13762
|
+
readInt64() {
|
|
13763
|
+
return this.view.getBigInt64(__classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_roAdd).call(this, 8));
|
|
13764
|
+
}
|
|
13765
|
+
readUint8() {
|
|
13766
|
+
return this.view.getUint8(__classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_roAdd).call(this, 1));
|
|
13767
|
+
}
|
|
13768
|
+
readUint16() {
|
|
13769
|
+
return this.view.getUint16(__classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_roAdd).call(this, 2));
|
|
13770
|
+
}
|
|
13771
|
+
readUint32() {
|
|
13772
|
+
return this.view.getUint32(__classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_roAdd).call(this, 4));
|
|
13773
|
+
}
|
|
13774
|
+
readUint64() {
|
|
13775
|
+
return this.view.getBigUint64(__classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_roAdd).call(this, 8));
|
|
13776
|
+
}
|
|
13777
|
+
readBuffer() {
|
|
13778
|
+
const length = this.view.getUint32(__classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_roAdd).call(this, 4));
|
|
13779
|
+
return this._buffer.subarray(__classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_roAdd).call(this, length), __classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_roAdd).call(this, 0));
|
|
13780
|
+
}
|
|
13781
|
+
readUtf8String() {
|
|
13782
|
+
const length = this.view.getUint32(__classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_roAdd).call(this, 4));
|
|
13783
|
+
return utf8Exports.read(this._buffer, __classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_roAdd).call(this, length), __classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_roAdd).call(this, 0));
|
|
13784
|
+
}
|
|
13785
|
+
incrementWriteOffset(amount) {
|
|
13786
|
+
return __classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_woAdd).call(this, amount);
|
|
13787
|
+
}
|
|
13788
|
+
toBinary() {
|
|
13789
|
+
return this._buffer.subarray(0, this.woffset);
|
|
13790
|
+
}
|
|
13791
|
+
toCopiedBinary() {
|
|
13792
|
+
return new Uint8Array(this.toBinary());
|
|
13793
|
+
}
|
|
13794
|
+
writeBuffer(value, writeLength = true) {
|
|
13795
|
+
if (writeLength) {
|
|
13796
|
+
this.writeUint32(value.byteLength);
|
|
13751
13797
|
}
|
|
13752
|
-
|
|
13753
|
-
|
|
13754
|
-
}
|
|
13755
|
-
|
|
13756
|
-
|
|
13757
|
-
|
|
13758
|
-
|
|
13759
|
-
bufferLength() {
|
|
13760
|
-
return buffer.length;
|
|
13761
|
-
},
|
|
13762
|
-
resetBuffer() {
|
|
13763
|
-
roffset = 0;
|
|
13764
|
-
woffset = 0;
|
|
13765
|
-
},
|
|
13766
|
-
currentReadOffset() {
|
|
13767
|
-
return roffset;
|
|
13768
|
-
},
|
|
13769
|
-
currentWriteOffset() {
|
|
13770
|
-
return woffset;
|
|
13771
|
-
},
|
|
13772
|
-
incrementReadOffset(amount) {
|
|
13773
|
-
return roAdd(amount);
|
|
13774
|
-
},
|
|
13775
|
-
remainingBytes() {
|
|
13776
|
-
return woffset - roffset;
|
|
13777
|
-
},
|
|
13778
|
-
readFloat32() {
|
|
13779
|
-
return view.getFloat32(roAdd(4));
|
|
13780
|
-
},
|
|
13781
|
-
readFloat64() {
|
|
13782
|
-
return view.getFloat64(roAdd(8));
|
|
13783
|
-
},
|
|
13784
|
-
readInt8() {
|
|
13785
|
-
return view.getInt8(roAdd(1));
|
|
13786
|
-
},
|
|
13787
|
-
readInt16() {
|
|
13788
|
-
return view.getInt16(roAdd(2));
|
|
13789
|
-
},
|
|
13790
|
-
readInt32() {
|
|
13791
|
-
return view.getInt32(roAdd(4));
|
|
13792
|
-
},
|
|
13793
|
-
readInt64() {
|
|
13794
|
-
return view.getBigInt64(roAdd(8));
|
|
13795
|
-
},
|
|
13796
|
-
readUint8() {
|
|
13797
|
-
return view.getUint8(roAdd(1));
|
|
13798
|
-
},
|
|
13799
|
-
readUint16() {
|
|
13800
|
-
return view.getUint16(roAdd(2));
|
|
13801
|
-
},
|
|
13802
|
-
readUint32() {
|
|
13803
|
-
return view.getUint32(roAdd(4));
|
|
13804
|
-
},
|
|
13805
|
-
readUint64() {
|
|
13806
|
-
return view.getBigUint64(roAdd(8));
|
|
13807
|
-
},
|
|
13808
|
-
readBuffer() {
|
|
13809
|
-
const length = view.getUint32(roAdd(4));
|
|
13810
|
-
return buffer.subarray(roAdd(length), roAdd(0));
|
|
13811
|
-
},
|
|
13812
|
-
readUtf8String() {
|
|
13813
|
-
const length = view.getUint32(roAdd(4));
|
|
13814
|
-
return utf8Exports.read(buffer, roAdd(length), roAdd(0));
|
|
13815
|
-
},
|
|
13816
|
-
incrementWriteOffset(amount) {
|
|
13817
|
-
return woAdd(amount);
|
|
13818
|
-
},
|
|
13819
|
-
size() {
|
|
13820
|
-
return woffset;
|
|
13821
|
-
},
|
|
13822
|
-
toBinary() {
|
|
13823
|
-
return buffer.subarray(0, woffset);
|
|
13824
|
-
},
|
|
13825
|
-
toCopiedBinary() {
|
|
13826
|
-
return new Uint8Array(this.toBinary());
|
|
13827
|
-
},
|
|
13828
|
-
writeBuffer(value, writeLength = true) {
|
|
13829
|
-
if (writeLength) {
|
|
13830
|
-
this.writeUint32(value.byteLength);
|
|
13831
|
-
}
|
|
13832
|
-
const o = woAdd(value.byteLength);
|
|
13833
|
-
buffer.set(value, o);
|
|
13834
|
-
},
|
|
13835
|
-
writeUtf8String(value, writeLength = true) {
|
|
13836
|
-
const byteLength = utf8Exports.length(value);
|
|
13837
|
-
if (writeLength) {
|
|
13838
|
-
this.writeUint32(byteLength);
|
|
13839
|
-
}
|
|
13840
|
-
const o = woAdd(byteLength);
|
|
13841
|
-
utf8Exports.write(value, buffer, o);
|
|
13842
|
-
},
|
|
13843
|
-
writeFloat32(value) {
|
|
13844
|
-
const o = woAdd(4);
|
|
13845
|
-
view.setFloat32(o, value);
|
|
13846
|
-
},
|
|
13847
|
-
writeFloat64(value) {
|
|
13848
|
-
const o = woAdd(8);
|
|
13849
|
-
view.setFloat64(o, value);
|
|
13850
|
-
},
|
|
13851
|
-
writeInt8(value) {
|
|
13852
|
-
const o = woAdd(1);
|
|
13853
|
-
view.setInt8(o, value);
|
|
13854
|
-
},
|
|
13855
|
-
writeInt16(value) {
|
|
13856
|
-
const o = woAdd(2);
|
|
13857
|
-
view.setInt16(o, value);
|
|
13858
|
-
},
|
|
13859
|
-
writeInt32(value) {
|
|
13860
|
-
const o = woAdd(4);
|
|
13861
|
-
view.setInt32(o, value);
|
|
13862
|
-
},
|
|
13863
|
-
writeInt64(value) {
|
|
13864
|
-
const o = woAdd(8);
|
|
13865
|
-
view.setBigInt64(o, value);
|
|
13866
|
-
},
|
|
13867
|
-
writeUint8(value) {
|
|
13868
|
-
const o = woAdd(1);
|
|
13869
|
-
view.setUint8(o, value);
|
|
13870
|
-
},
|
|
13871
|
-
writeUint16(value) {
|
|
13872
|
-
const o = woAdd(2);
|
|
13873
|
-
view.setUint16(o, value);
|
|
13874
|
-
},
|
|
13875
|
-
writeUint32(value) {
|
|
13876
|
-
const o = woAdd(4);
|
|
13877
|
-
view.setUint32(o, value);
|
|
13878
|
-
},
|
|
13879
|
-
writeUint64(value) {
|
|
13880
|
-
const o = woAdd(8);
|
|
13881
|
-
view.setBigUint64(o, value);
|
|
13882
|
-
},
|
|
13883
|
-
// Dataview Proxy
|
|
13884
|
-
getFloat32(offset) {
|
|
13885
|
-
return view.getFloat32(offset);
|
|
13886
|
-
},
|
|
13887
|
-
getFloat64(offset) {
|
|
13888
|
-
return view.getFloat64(offset);
|
|
13889
|
-
},
|
|
13890
|
-
getInt8(offset) {
|
|
13891
|
-
return view.getInt8(offset);
|
|
13892
|
-
},
|
|
13893
|
-
getInt16(offset) {
|
|
13894
|
-
return view.getInt16(offset);
|
|
13895
|
-
},
|
|
13896
|
-
getInt32(offset) {
|
|
13897
|
-
return view.getInt32(offset);
|
|
13898
|
-
},
|
|
13899
|
-
getInt64(offset) {
|
|
13900
|
-
return view.getBigInt64(offset);
|
|
13901
|
-
},
|
|
13902
|
-
getUint8(offset) {
|
|
13903
|
-
return view.getUint8(offset);
|
|
13904
|
-
},
|
|
13905
|
-
getUint16(offset) {
|
|
13906
|
-
return view.getUint16(offset);
|
|
13907
|
-
},
|
|
13908
|
-
getUint32(offset) {
|
|
13909
|
-
return view.getUint32(offset);
|
|
13910
|
-
},
|
|
13911
|
-
getUint64(offset) {
|
|
13912
|
-
return view.getBigUint64(offset);
|
|
13913
|
-
},
|
|
13914
|
-
setFloat32(offset, value) {
|
|
13915
|
-
view.setFloat32(offset, value);
|
|
13916
|
-
},
|
|
13917
|
-
setFloat64(offset, value) {
|
|
13918
|
-
view.setFloat64(offset, value);
|
|
13919
|
-
},
|
|
13920
|
-
setInt8(offset, value) {
|
|
13921
|
-
view.setInt8(offset, value);
|
|
13922
|
-
},
|
|
13923
|
-
setInt16(offset, value) {
|
|
13924
|
-
view.setInt16(offset, value);
|
|
13925
|
-
},
|
|
13926
|
-
setInt32(offset, value) {
|
|
13927
|
-
view.setInt32(offset, value);
|
|
13928
|
-
},
|
|
13929
|
-
setInt64(offset, value) {
|
|
13930
|
-
view.setBigInt64(offset, value);
|
|
13931
|
-
},
|
|
13932
|
-
setUint8(offset, value) {
|
|
13933
|
-
view.setUint8(offset, value);
|
|
13934
|
-
},
|
|
13935
|
-
setUint16(offset, value) {
|
|
13936
|
-
view.setUint16(offset, value);
|
|
13937
|
-
},
|
|
13938
|
-
setUint32(offset, value) {
|
|
13939
|
-
view.setUint32(offset, value);
|
|
13940
|
-
},
|
|
13941
|
-
setUint64(offset, value) {
|
|
13942
|
-
view.setBigUint64(offset, value);
|
|
13798
|
+
const o = __classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_woAdd).call(this, value.byteLength);
|
|
13799
|
+
this._buffer.set(value, o);
|
|
13800
|
+
}
|
|
13801
|
+
writeUtf8String(value, writeLength = true) {
|
|
13802
|
+
const byteLength = utf8Exports.length(value);
|
|
13803
|
+
if (writeLength) {
|
|
13804
|
+
this.writeUint32(byteLength);
|
|
13943
13805
|
}
|
|
13944
|
-
|
|
13806
|
+
const o = __classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_woAdd).call(this, byteLength);
|
|
13807
|
+
utf8Exports.write(value, this._buffer, o);
|
|
13808
|
+
}
|
|
13809
|
+
writeFloat32(value) {
|
|
13810
|
+
const o = __classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_woAdd).call(this, 4);
|
|
13811
|
+
this.view.setFloat32(o, value);
|
|
13812
|
+
}
|
|
13813
|
+
writeFloat64(value) {
|
|
13814
|
+
const o = __classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_woAdd).call(this, 8);
|
|
13815
|
+
this.view.setFloat64(o, value);
|
|
13816
|
+
}
|
|
13817
|
+
writeInt8(value) {
|
|
13818
|
+
const o = __classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_woAdd).call(this, 1);
|
|
13819
|
+
this.view.setInt8(o, value);
|
|
13820
|
+
}
|
|
13821
|
+
writeInt16(value) {
|
|
13822
|
+
const o = __classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_woAdd).call(this, 2);
|
|
13823
|
+
this.view.setInt16(o, value);
|
|
13824
|
+
}
|
|
13825
|
+
writeInt32(value) {
|
|
13826
|
+
const o = __classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_woAdd).call(this, 4);
|
|
13827
|
+
this.view.setInt32(o, value);
|
|
13828
|
+
}
|
|
13829
|
+
writeInt64(value) {
|
|
13830
|
+
const o = __classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_woAdd).call(this, 8);
|
|
13831
|
+
this.view.setBigInt64(o, value);
|
|
13832
|
+
}
|
|
13833
|
+
writeUint8(value) {
|
|
13834
|
+
const o = __classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_woAdd).call(this, 1);
|
|
13835
|
+
this.view.setUint8(o, value);
|
|
13836
|
+
}
|
|
13837
|
+
writeUint16(value) {
|
|
13838
|
+
const o = __classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_woAdd).call(this, 2);
|
|
13839
|
+
this.view.setUint16(o, value);
|
|
13840
|
+
}
|
|
13841
|
+
writeUint32(value) {
|
|
13842
|
+
const o = __classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_woAdd).call(this, 4);
|
|
13843
|
+
this.view.setUint32(o, value);
|
|
13844
|
+
}
|
|
13845
|
+
writeUint64(value) {
|
|
13846
|
+
const o = __classPrivateFieldGet(this, _ReadWriteByteBuffer_instances, "m", _ReadWriteByteBuffer_woAdd).call(this, 8);
|
|
13847
|
+
this.view.setBigUint64(o, value);
|
|
13848
|
+
}
|
|
13849
|
+
// DataView Proxy
|
|
13850
|
+
getFloat32(offset) {
|
|
13851
|
+
return this.view.getFloat32(offset);
|
|
13852
|
+
}
|
|
13853
|
+
getFloat64(offset) {
|
|
13854
|
+
return this.view.getFloat64(offset);
|
|
13855
|
+
}
|
|
13856
|
+
getInt8(offset) {
|
|
13857
|
+
return this.view.getInt8(offset);
|
|
13858
|
+
}
|
|
13859
|
+
getInt16(offset) {
|
|
13860
|
+
return this.view.getInt16(offset);
|
|
13861
|
+
}
|
|
13862
|
+
getInt32(offset) {
|
|
13863
|
+
return this.view.getInt32(offset);
|
|
13864
|
+
}
|
|
13865
|
+
getInt64(offset) {
|
|
13866
|
+
return this.view.getBigInt64(offset);
|
|
13867
|
+
}
|
|
13868
|
+
getUint8(offset) {
|
|
13869
|
+
return this.view.getUint8(offset);
|
|
13870
|
+
}
|
|
13871
|
+
getUint16(offset) {
|
|
13872
|
+
return this.view.getUint16(offset);
|
|
13873
|
+
}
|
|
13874
|
+
getUint32(offset) {
|
|
13875
|
+
return this.view.getUint32(offset);
|
|
13876
|
+
}
|
|
13877
|
+
getUint64(offset) {
|
|
13878
|
+
return this.view.getBigUint64(offset);
|
|
13879
|
+
}
|
|
13880
|
+
setFloat32(offset, value) {
|
|
13881
|
+
this.view.setFloat32(offset, value);
|
|
13882
|
+
}
|
|
13883
|
+
setFloat64(offset, value) {
|
|
13884
|
+
this.view.setFloat64(offset, value);
|
|
13885
|
+
}
|
|
13886
|
+
setInt8(offset, value) {
|
|
13887
|
+
this.view.setInt8(offset, value);
|
|
13888
|
+
}
|
|
13889
|
+
setInt16(offset, value) {
|
|
13890
|
+
this.view.setInt16(offset, value);
|
|
13891
|
+
}
|
|
13892
|
+
setInt32(offset, value) {
|
|
13893
|
+
this.view.setInt32(offset, value);
|
|
13894
|
+
}
|
|
13895
|
+
setInt64(offset, value) {
|
|
13896
|
+
this.view.setBigInt64(offset, value);
|
|
13897
|
+
}
|
|
13898
|
+
setUint8(offset, value) {
|
|
13899
|
+
this.view.setUint8(offset, value);
|
|
13900
|
+
}
|
|
13901
|
+
setUint16(offset, value) {
|
|
13902
|
+
this.view.setUint16(offset, value);
|
|
13903
|
+
}
|
|
13904
|
+
setUint32(offset, value) {
|
|
13905
|
+
this.view.setUint32(offset, value);
|
|
13906
|
+
}
|
|
13907
|
+
setUint64(offset, value) {
|
|
13908
|
+
this.view.setBigUint64(offset, value);
|
|
13909
|
+
}
|
|
13945
13910
|
}
|
|
13911
|
+
_ReadWriteByteBuffer_instances = new WeakSet(), _ReadWriteByteBuffer_woAdd = function _ReadWriteByteBuffer_woAdd(amount) {
|
|
13912
|
+
if (this.woffset + amount > this._buffer.byteLength) {
|
|
13913
|
+
const newsize = getNextSize(this._buffer.byteLength, this.woffset + amount);
|
|
13914
|
+
const newBuffer = new Uint8Array(newsize);
|
|
13915
|
+
newBuffer.set(this._buffer);
|
|
13916
|
+
const oldOffset = this._buffer.byteOffset;
|
|
13917
|
+
this._buffer = newBuffer;
|
|
13918
|
+
this.view = new DataView(this._buffer.buffer, oldOffset);
|
|
13919
|
+
}
|
|
13920
|
+
this.woffset += amount;
|
|
13921
|
+
return this.woffset - amount;
|
|
13922
|
+
}, _ReadWriteByteBuffer_roAdd = function _ReadWriteByteBuffer_roAdd(amount) {
|
|
13923
|
+
if (this.roffset + amount > this.woffset) {
|
|
13924
|
+
throw new Error('Outside of the bounds of writen data.');
|
|
13925
|
+
}
|
|
13926
|
+
this.roffset += amount;
|
|
13927
|
+
return this.roffset - amount;
|
|
13928
|
+
};
|
|
13946
13929
|
|
|
13947
13930
|
exports.CrdtMessageType = void 0;
|
|
13948
13931
|
(function (CrdtMessageType) {
|
|
@@ -14011,7 +13994,7 @@
|
|
|
14011
13994
|
const startMessageOffset = buf.incrementWriteOffset(CRDT_MESSAGE_HEADER_LENGTH + PutComponentOperation.MESSAGE_HEADER_LENGTH);
|
|
14012
13995
|
// write body
|
|
14013
13996
|
componentDefinition.writeToByteBuffer(entity, buf);
|
|
14014
|
-
const messageLength = buf.
|
|
13997
|
+
const messageLength = buf.currentWriteOffset() - startMessageOffset;
|
|
14015
13998
|
// Write CrdtMessage header
|
|
14016
13999
|
buf.setUint32(startMessageOffset, messageLength);
|
|
14017
14000
|
buf.setUint32(startMessageOffset + 4, exports.CrdtMessageType.PUT_COMPONENT);
|
|
@@ -14160,9 +14143,7 @@
|
|
|
14160
14143
|
* @param chunkMessage A chunk of binary messages
|
|
14161
14144
|
*/
|
|
14162
14145
|
return function parseChunkMessage(chunkMessage) {
|
|
14163
|
-
const buffer =
|
|
14164
|
-
reading: { buffer: chunkMessage, currentOffset: 0 }
|
|
14165
|
-
});
|
|
14146
|
+
const buffer = new ReadWriteByteBuffer(chunkMessage);
|
|
14166
14147
|
let header;
|
|
14167
14148
|
while ((header = CrdtMessageProtocol.getHeader(buffer))) {
|
|
14168
14149
|
const offset = buffer.currentReadOffset();
|
|
@@ -14222,10 +14203,9 @@
|
|
|
14222
14203
|
*/
|
|
14223
14204
|
async function receiveMessages() {
|
|
14224
14205
|
const messagesToProcess = getMessages(receivedMessages);
|
|
14225
|
-
const bufferForOutdated =
|
|
14206
|
+
const bufferForOutdated = new ReadWriteByteBuffer();
|
|
14226
14207
|
const entitiesShouldBeCleaned = [];
|
|
14227
14208
|
for (const msg of messagesToProcess) {
|
|
14228
|
-
// TODO: emit delete entity to el onCrdtMessage
|
|
14229
14209
|
if (msg.type === exports.CrdtMessageType.DELETE_ENTITY) {
|
|
14230
14210
|
crdtClient.processMessage({
|
|
14231
14211
|
type: typesExports.CRDTMessageType.CRDTMT_DeleteEntity,
|
|
@@ -14234,7 +14214,6 @@
|
|
|
14234
14214
|
entitiesShouldBeCleaned.push(msg.entityId);
|
|
14235
14215
|
}
|
|
14236
14216
|
else {
|
|
14237
|
-
// TODO: emit pu/delete component to el onCrdtMessage
|
|
14238
14217
|
const crdtMessage = {
|
|
14239
14218
|
type: typesExports.CRDTMessageType.CRDTMT_PutComponentData,
|
|
14240
14219
|
entityId: msg.entityId,
|
|
@@ -14270,10 +14249,7 @@
|
|
|
14270
14249
|
component.deleteFrom(msg.entityId, false);
|
|
14271
14250
|
}
|
|
14272
14251
|
else {
|
|
14273
|
-
const
|
|
14274
|
-
reading: { buffer: msg.data, currentOffset: 0 }
|
|
14275
|
-
};
|
|
14276
|
-
const data = createByteBuffer(opts);
|
|
14252
|
+
const data = new ReadWriteByteBuffer(msg.data);
|
|
14277
14253
|
component.upsertFromBinary(msg.entityId, data, false);
|
|
14278
14254
|
}
|
|
14279
14255
|
onProcessEntityComponentChange &&
|
|
@@ -14310,7 +14286,6 @@
|
|
|
14310
14286
|
}
|
|
14311
14287
|
}
|
|
14312
14288
|
}
|
|
14313
|
-
// TODO: emit delete entity to el onCrdtMessage
|
|
14314
14289
|
for (const entity of entitiesShouldBeCleaned) {
|
|
14315
14290
|
// If we tried to resend outdated message and the entity was deleted before, we avoid sending them.
|
|
14316
14291
|
for (let i = outdatedMessages.length - 1; i >= 0; i--) {
|
|
@@ -14366,7 +14341,7 @@
|
|
|
14366
14341
|
// CRDT Messages will be the merge between the recieved transport messages and the new crdt messages
|
|
14367
14342
|
const crdtMessages = getMessages(broadcastMessages);
|
|
14368
14343
|
const outdatedMessagesBkp = getMessages(outdatedMessages);
|
|
14369
|
-
const buffer =
|
|
14344
|
+
const buffer = new ReadWriteByteBuffer();
|
|
14370
14345
|
for (const [component, entities] of dirtyEntities) {
|
|
14371
14346
|
for (const entity of entities) {
|
|
14372
14347
|
// Component will be always defined here since dirtyMap its an iterator of engine.componentsDefinition
|
|
@@ -14415,7 +14390,7 @@
|
|
|
14415
14390
|
});
|
|
14416
14391
|
}
|
|
14417
14392
|
// Send CRDT messages to transports
|
|
14418
|
-
const transportBuffer =
|
|
14393
|
+
const transportBuffer = new ReadWriteByteBuffer();
|
|
14419
14394
|
for (const index in transports) {
|
|
14420
14395
|
const transportIndex = Number(index);
|
|
14421
14396
|
const transport = transports[transportIndex];
|
|
@@ -14440,7 +14415,7 @@
|
|
|
14440
14415
|
transportBuffer.writeBuffer(message.messageBuffer, false);
|
|
14441
14416
|
}
|
|
14442
14417
|
}
|
|
14443
|
-
const message = transportBuffer.
|
|
14418
|
+
const message = transportBuffer.currentWriteOffset()
|
|
14444
14419
|
? transportBuffer.toBinary()
|
|
14445
14420
|
: new Uint8Array([]);
|
|
14446
14421
|
await transport.send(message);
|
|
@@ -14569,7 +14544,7 @@
|
|
|
14569
14544
|
if (!component) {
|
|
14570
14545
|
throw new Error(`[toBinary] Component ${componentId} for ${entity} not found`);
|
|
14571
14546
|
}
|
|
14572
|
-
const writeBuffer =
|
|
14547
|
+
const writeBuffer = new ReadWriteByteBuffer();
|
|
14573
14548
|
spec.serialize(component, writeBuffer);
|
|
14574
14549
|
return writeBuffer;
|
|
14575
14550
|
},
|
|
@@ -14578,7 +14553,7 @@
|
|
|
14578
14553
|
if (!component) {
|
|
14579
14554
|
return null;
|
|
14580
14555
|
}
|
|
14581
|
-
const writeBuffer =
|
|
14556
|
+
const writeBuffer = new ReadWriteByteBuffer();
|
|
14582
14557
|
spec.serialize(component, writeBuffer);
|
|
14583
14558
|
return writeBuffer;
|
|
14584
14559
|
},
|