1 |
- {"ast":null,"code":"import _asyncToGenerator from \"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { Tools } from \"../../Misc/tools.js\";\n/**\n * Meshopt compression (https://github.com/zeux/meshoptimizer)\n *\n * This class wraps the meshopt library from https://github.com/zeux/meshoptimizer/tree/master/js.\n *\n * **Encoder**\n *\n * The encoder is not currently implemented.\n *\n * **Decoder**\n *\n * By default, the configuration points to a copy of the meshopt files on the Babylon.js preview CDN (e.g. https://preview.babylonjs.com/meshopt_decoder.js).\n *\n * To update the configuration, use the following code:\n * ```javascript\n * MeshoptCompression.Configuration = {\n * decoder: {\n * url: \"<url to the meshopt decoder library>\"\n * }\n * };\n * ```\n */\nexport class MeshoptCompression {\n /**\n * Default instance for the meshoptimizer object.\n */\n static get Default() {\n if (!MeshoptCompression._Default) {\n MeshoptCompression._Default = new MeshoptCompression();\n }\n return MeshoptCompression._Default;\n }\n /**\n * Constructor\n */\n constructor() {\n const decoder = MeshoptCompression.Configuration.decoder;\n this._decoderModulePromise = Tools.LoadBabylonScriptAsync(decoder.url).then(() => {\n // Wait for WebAssembly compilation before resolving promise\n return MeshoptDecoder.ready;\n });\n }\n /**\n * Stop all async operations and release resources.\n */\n dispose() {\n delete this._decoderModulePromise;\n }\n /**\n * Decode meshopt data.\n * @see https://github.com/zeux/meshoptimizer/tree/master/js#decoder\n * @param source The input data.\n * @param count The number of elements.\n * @param stride The stride in bytes.\n * @param mode The compression mode.\n * @param filter The compression filter.\n * @returns a Promise<Uint8Array> that resolves to the decoded data\n */\n decodeGltfBufferAsync(source, count, stride, mode, filter) {\n return this._decoderModulePromise.then( /*#__PURE__*/_asyncToGenerator(function* () {\n MeshoptDecoder.useWorkers(1);\n const result = yield MeshoptDecoder.decodeGltfBufferAsync(count, stride, source, mode, filter);\n MeshoptDecoder.useWorkers(0);\n return result;\n }));\n }\n}\n/**\n * The configuration. Defaults to the following:\n * ```javascript\n * decoder: {\n * url: \"https://cdn.babylonjs.com/meshopt_decoder.js\"\n * }\n * ```\n */\nMeshoptCompression.Configuration = {\n decoder: {\n url: `${Tools._DefaultCdnUrl}/meshopt_decoder.js`\n }\n};\nMeshoptCompression._Default = null;","map":{"version":3,"names":["Tools","MeshoptCompression","Default","_Default","constructor","decoder","Configuration","_decoderModulePromise","LoadBabylonScriptAsync","url","then","MeshoptDecoder","ready","dispose","decodeGltfBufferAsync","source","count","stride","mode","filter","_asyncToGenerator","useWorkers","result","_DefaultCdnUrl"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Compression/meshoptCompression.js"],"sourcesContent":["import { Tools } from \"../../Misc/tools.js\";\n/**\n * Meshopt compression (https://github.com/zeux/meshoptimizer)\n *\n * This class wraps the meshopt library from https://github.com/zeux/meshoptimizer/tree/master/js.\n *\n * **Encoder**\n *\n * The encoder is not currently implemented.\n *\n * **Decoder**\n *\n * By default, the configuration points to a copy of the meshopt files on the Babylon.js preview CDN (e.g. https://preview.babylonjs.com/meshopt_decoder.js).\n *\n * To update the configuration, use the following code:\n * ```javascript\n * MeshoptCompression.Configuration = {\n * decoder: {\n * url: \"<url to the meshopt decoder library>\"\n * }\n * };\n * ```\n */\nexport class MeshoptCompression {\n /**\n * Default instance for the meshoptimizer object.\n */\n static get Default() {\n if (!MeshoptCompression._Default) {\n MeshoptCompression._Default = new MeshoptCompression();\n }\n return MeshoptCompression._Default;\n }\n /**\n * Constructor\n */\n constructor() {\n const decoder = MeshoptCompression.Configuration.decoder;\n this._decoderModulePromise = Tools.LoadBabylonScriptAsync(decoder.url).then(() => {\n // Wait for WebAssembly compilation before resolving promise\n return MeshoptDecoder.ready;\n });\n }\n /**\n * Stop all async operations and release resources.\n */\n dispose() {\n delete this._decoderModulePromise;\n }\n /**\n * Decode meshopt data.\n * @see https://github.com/zeux/meshoptimizer/tree/master/js#decoder\n * @param source The input data.\n * @param count The number of elements.\n * @param stride The stride in bytes.\n * @param mode The compression mode.\n * @param filter The compression filter.\n * @returns a Promise<Uint8Array> that resolves to the decoded data\n */\n decodeGltfBufferAsync(source, count, stride, mode, filter) {\n return this._decoderModulePromise.then(async () => {\n MeshoptDecoder.useWorkers(1);\n const result = await MeshoptDecoder.decodeGltfBufferAsync(count, stride, source, mode, filter);\n MeshoptDecoder.useWorkers(0);\n return result;\n });\n }\n}\n/**\n * The configuration. Defaults to the following:\n * ```javascript\n * decoder: {\n * url: \"https://cdn.babylonjs.com/meshopt_decoder.js\"\n * }\n * ```\n */\nMeshoptCompression.Configuration = {\n decoder: {\n url: `${Tools._DefaultCdnUrl}/meshopt_decoder.js`,\n },\n};\nMeshoptCompression._Default = null;\n"],"mappings":";AAAA,SAASA,KAAK,QAAQ,qBAAqB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,CAAC;EAC5B;AACJ;AACA;EACI,WAAWC,OAAOA,CAAA,EAAG;IACjB,IAAI,CAACD,kBAAkB,CAACE,QAAQ,EAAE;MAC9BF,kBAAkB,CAACE,QAAQ,GAAG,IAAIF,kBAAkB,CAAC,CAAC;IAC1D;IACA,OAAOA,kBAAkB,CAACE,QAAQ;EACtC;EACA;AACJ;AACA;EACIC,WAAWA,CAAA,EAAG;IACV,MAAMC,OAAO,GAAGJ,kBAAkB,CAACK,aAAa,CAACD,OAAO;IACxD,IAAI,CAACE,qBAAqB,GAAGP,KAAK,CAACQ,sBAAsB,CAACH,OAAO,CAACI,GAAG,CAAC,CAACC,IAAI,CAAC,MAAM;MAC9E;MACA,OAAOC,cAAc,CAACC,KAAK;IAC/B,CAAC,CAAC;EACN;EACA;AACJ;AACA;EACIC,OAAOA,CAAA,EAAG;IACN,OAAO,IAAI,CAACN,qBAAqB;EACrC;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACIO,qBAAqBA,CAACC,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAE;IACvD,OAAO,IAAI,CAACZ,qBAAqB,CAACG,IAAI,eAAAU,iBAAA,CAAC,aAAY;MAC/CT,cAAc,CAACU,UAAU,CAAC,CAAC,CAAC;MAC5B,MAAMC,MAAM,SAASX,cAAc,CAACG,qBAAqB,CAACE,KAAK,EAAEC,MAAM,EAAEF,MAAM,EAAEG,IAAI,EAAEC,MAAM,CAAC;MAC9FR,cAAc,CAACU,UAAU,CAAC,CAAC,CAAC;MAC5B,OAAOC,MAAM;IACjB,CAAC,EAAC;EACN;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACArB,kBAAkB,CAACK,aAAa,GAAG;EAC/BD,OAAO,EAAE;IACLI,GAAG,EAAE,GAAGT,KAAK,CAACuB,cAAc;EAChC;AACJ,CAAC;AACDtB,kBAAkB,CAACE,QAAQ,GAAG,IAAI","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}
|