1 |
- {"ast":null,"code":"/** @internal */\nexport class NativeDataStream {\n constructor() {\n const buffer = new ArrayBuffer(NativeDataStream.DEFAULT_BUFFER_SIZE);\n this._uint32s = new Uint32Array(buffer);\n this._int32s = new Int32Array(buffer);\n this._float32s = new Float32Array(buffer);\n this._length = NativeDataStream.DEFAULT_BUFFER_SIZE / 4;\n this._position = 0;\n this._nativeDataStream = new _native.NativeDataStream(() => {\n this._flush();\n });\n }\n /**\n * Writes a uint32 to the stream\n * @param value the value to write\n */\n writeUint32(value) {\n this._flushIfNecessary(1);\n this._uint32s[this._position++] = value;\n }\n /**\n * Writes an int32 to the stream\n * @param value the value to write\n */\n writeInt32(value) {\n this._flushIfNecessary(1);\n this._int32s[this._position++] = value;\n }\n /**\n * Writes a float32 to the stream\n * @param value the value to write\n */\n writeFloat32(value) {\n this._flushIfNecessary(1);\n this._float32s[this._position++] = value;\n }\n /**\n * Writes a uint32 array to the stream\n * @param values the values to write\n */\n writeUint32Array(values) {\n this._flushIfNecessary(1 + values.length);\n this._uint32s[this._position++] = values.length;\n this._uint32s.set(values, this._position);\n this._position += values.length;\n }\n /**\n * Writes an int32 array to the stream\n * @param values the values to write\n */\n writeInt32Array(values) {\n this._flushIfNecessary(1 + values.length);\n this._uint32s[this._position++] = values.length;\n this._int32s.set(values, this._position);\n this._position += values.length;\n }\n /**\n * Writes a float32 array to the stream\n * @param values the values to write\n */\n writeFloat32Array(values) {\n this._flushIfNecessary(1 + values.length);\n this._uint32s[this._position++] = values.length;\n this._float32s.set(values, this._position);\n this._position += values.length;\n }\n /**\n * Writes native data to the stream\n * @param handle the handle to the native data\n */\n writeNativeData(handle) {\n this._flushIfNecessary(handle.length);\n this._uint32s.set(handle, this._position);\n this._position += handle.length;\n }\n /**\n * Writes a boolean to the stream\n * @param value the value to write\n */\n writeBoolean(value) {\n this.writeUint32(value ? 1 : 0);\n }\n _flushIfNecessary(required) {\n if (this._position + required > this._length) {\n this._flush();\n }\n }\n _flush() {\n this._nativeDataStream.writeBuffer(this._uint32s.buffer, this._position);\n this._position = 0;\n }\n}\n// Must be multiple of 4!\n// eslint-disable-next-line @typescript-eslint/naming-convention\nNativeDataStream.DEFAULT_BUFFER_SIZE = 65536;","map":{"version":3,"names":["NativeDataStream","constructor","buffer","ArrayBuffer","DEFAULT_BUFFER_SIZE","_uint32s","Uint32Array","_int32s","Int32Array","_float32s","Float32Array","_length","_position","_nativeDataStream","_native","_flush","writeUint32","value","_flushIfNecessary","writeInt32","writeFloat32","writeUint32Array","values","length","set","writeInt32Array","writeFloat32Array","writeNativeData","handle","writeBoolean","required","writeBuffer"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Engines/Native/nativeDataStream.js"],"sourcesContent":["/** @internal */\nexport class NativeDataStream {\n constructor() {\n const buffer = new ArrayBuffer(NativeDataStream.DEFAULT_BUFFER_SIZE);\n this._uint32s = new Uint32Array(buffer);\n this._int32s = new Int32Array(buffer);\n this._float32s = new Float32Array(buffer);\n this._length = NativeDataStream.DEFAULT_BUFFER_SIZE / 4;\n this._position = 0;\n this._nativeDataStream = new _native.NativeDataStream(() => {\n this._flush();\n });\n }\n /**\n * Writes a uint32 to the stream\n * @param value the value to write\n */\n writeUint32(value) {\n this._flushIfNecessary(1);\n this._uint32s[this._position++] = value;\n }\n /**\n * Writes an int32 to the stream\n * @param value the value to write\n */\n writeInt32(value) {\n this._flushIfNecessary(1);\n this._int32s[this._position++] = value;\n }\n /**\n * Writes a float32 to the stream\n * @param value the value to write\n */\n writeFloat32(value) {\n this._flushIfNecessary(1);\n this._float32s[this._position++] = value;\n }\n /**\n * Writes a uint32 array to the stream\n * @param values the values to write\n */\n writeUint32Array(values) {\n this._flushIfNecessary(1 + values.length);\n this._uint32s[this._position++] = values.length;\n this._uint32s.set(values, this._position);\n this._position += values.length;\n }\n /**\n * Writes an int32 array to the stream\n * @param values the values to write\n */\n writeInt32Array(values) {\n this._flushIfNecessary(1 + values.length);\n this._uint32s[this._position++] = values.length;\n this._int32s.set(values, this._position);\n this._position += values.length;\n }\n /**\n * Writes a float32 array to the stream\n * @param values the values to write\n */\n writeFloat32Array(values) {\n this._flushIfNecessary(1 + values.length);\n this._uint32s[this._position++] = values.length;\n this._float32s.set(values, this._position);\n this._position += values.length;\n }\n /**\n * Writes native data to the stream\n * @param handle the handle to the native data\n */\n writeNativeData(handle) {\n this._flushIfNecessary(handle.length);\n this._uint32s.set(handle, this._position);\n this._position += handle.length;\n }\n /**\n * Writes a boolean to the stream\n * @param value the value to write\n */\n writeBoolean(value) {\n this.writeUint32(value ? 1 : 0);\n }\n _flushIfNecessary(required) {\n if (this._position + required > this._length) {\n this._flush();\n }\n }\n _flush() {\n this._nativeDataStream.writeBuffer(this._uint32s.buffer, this._position);\n this._position = 0;\n }\n}\n// Must be multiple of 4!\n// eslint-disable-next-line @typescript-eslint/naming-convention\nNativeDataStream.DEFAULT_BUFFER_SIZE = 65536;\n"],"mappings":"AAAA;AACA,OAAO,MAAMA,gBAAgB,CAAC;EAC1BC,WAAWA,CAAA,EAAG;IACV,MAAMC,MAAM,GAAG,IAAIC,WAAW,CAACH,gBAAgB,CAACI,mBAAmB,CAAC;IACpE,IAAI,CAACC,QAAQ,GAAG,IAAIC,WAAW,CAACJ,MAAM,CAAC;IACvC,IAAI,CAACK,OAAO,GAAG,IAAIC,UAAU,CAACN,MAAM,CAAC;IACrC,IAAI,CAACO,SAAS,GAAG,IAAIC,YAAY,CAACR,MAAM,CAAC;IACzC,IAAI,CAACS,OAAO,GAAGX,gBAAgB,CAACI,mBAAmB,GAAG,CAAC;IACvD,IAAI,CAACQ,SAAS,GAAG,CAAC;IAClB,IAAI,CAACC,iBAAiB,GAAG,IAAIC,OAAO,CAACd,gBAAgB,CAAC,MAAM;MACxD,IAAI,CAACe,MAAM,CAAC,CAAC;IACjB,CAAC,CAAC;EACN;EACA;AACJ;AACA;AACA;EACIC,WAAWA,CAACC,KAAK,EAAE;IACf,IAAI,CAACC,iBAAiB,CAAC,CAAC,CAA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AGI,MAAM,CAACC,MAAM,CAAC;IACzC,IAAI,CAAClB,QAAQ,CAAC,IAAI,CAACO,SAAS,EAAE,CAAC,GAAGU,MAAM,CAACC,MAAM;IAC/C,IAAI,CAACd,SAAS,CAACe,GAAG,CAACF,MAAM,EAAE,IAAI,CAACV,SAAS,CAAC;IAC1C,IAAI,CAACA,SAAS,IAAIU,MAAM,CAACC,MAAM;EACnC;EACA;AACJ;AACA;AACA;EACII,eAAeA,CAACC,MAAM,EAAE;IACpB,IAAI,CAACV,iBAAiB,CAACU,MAAM,CAACL,MAAM,CAAC;IACrC,IAAI,CAAClB,QAAQ,CAACmB,GAAG,CAACI,MAAM,EAAE,IAAI,CAAChB,SAAS,CAAC;IACzC,IAAI,CAACA,SAAS,IAAIgB,MAAM,CAACL,MAAM;EACnC;EACA;AACJ;AACA;AACA;EACIM,YAAYA,CAACZ,KAAK,EAAE;IAChB,IAAI,CAACD,WAAW,CAACC,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC;EACnC;EACAC,iBAAiBA,CAACY,QAAQ,EAAE;IACxB,IAAI,IAAI,CAAClB,SAAS,GAAGkB,QAAQ,GAAG,IAAI,CAACnB,OAAO,EAAE;MAC1C,IAAI,CAACI,MAAM,CAAC,CAAC;IACjB;EACJ;EACAA,MAAMA,CAAA,EAAG;IACL,IAAI,CAACF,iBAAiB,CAACkB,WAAW,CAAC,IAAI,CAAC1B,QAAQ,CAACH,MAAM,EAAE,IAAI,CAACU,SAAS,CAAC;IACxE,IAAI,CAACA,SAAS,GAAG,CAAC;EACtB;AACJ;AACA;AACA;AACAZ,gBAAgB,CAACI,mBAAmB,GAAG,KAAK","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}
|