1 |
- {"ast":null,"code":"import _asyncToGenerator from \"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { SceneLoader } from \"@babylonjs/core/Loading/sceneLoader.js\";\nimport { GaussianSplattingMesh } from \"@babylonjs/core/Meshes/GaussianSplatting/gaussianSplattingMesh.js\";\n/**\n * @experimental\n * SPLAT file type loader.\n * This is a babylon scene loader plugin.\n */\nexport class SPLATFileLoader {\n //private _loadingOptions: SPLATLoadingOptions;\n /**\n * Creates loader for gaussian splatting files\n */\n constructor() {\n /**\n * Defines the name of the plugin.\n */\n this.name = \"splat\";\n /**\n * Defines the extensions the splat loader is able to load.\n * force data to come in as an ArrayBuffer\n */\n this.extensions = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n \".splat\": {\n isBinary: true\n },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n \".ply\": {\n isBinary: true\n }\n };\n }\n /**\n * Instantiates a gaussian splatting file loader plugin.\n * @returns the created plugin\n */\n createPlugin() {\n return new SPLATFileLoader();\n }\n /**\n * If the data string can be loaded directly.\n * @returns if the data can be loaded directly\n */\n canDirectLoad() {\n return false;\n }\n /**\n * Imports from the loaded gaussian splatting data and adds them to the scene\n * @param _meshesNames a string or array of strings of the mesh names that should be loaded from the file\n * @param scene the scene the meshes should be added to\n * @param data the gaussian splatting data to load\n * @param rootUrl root url to load from\n * @param onProgress callback called while file is loading\n * @param fileName Defines the name of the file to load\n * @returns a promise containing the loaded meshes, particles, skeletons and animations\n */\n importMeshAsync(_meshesNames, scene, data, rootUrl, onProgress, fileName) {\n return _asyncToGenerator(function* () {\n const gaussianSplatting = new GaussianSplattingMesh(\"GaussianSplatting\", null, scene);\n yield gaussianSplatting.loadFileAsync(rootUrl + (fileName !== null && fileName !== void 0 ? fileName : \"\"));\n return {\n meshes: [gaussianSplatting],\n particleSystems: [],\n skeletons: [],\n animationGroups: [],\n transformNodes: [],\n geometries: [],\n lights: [],\n spriteManagers: []\n };\n })();\n }\n /**\n * Imports all objects from the loaded gaussian splatting data and adds them to the scene\n * @param scene the scene the objects should be added to\n * @param data the gaussian splatting data to load\n * @param _rootUrl root url to load from\n * @returns a promise which completes when objects have been loaded to the scene\n */\n loadAsync(scene, data, _rootUrl) {\n const gaussianSplatting = new GaussianSplattingMesh(\"GaussianSplatting\", null, scene);\n return gaussianSplatting.loadDataAsync(GaussianSplattingMesh.ConvertPLYToSplat(data));\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Load into an asset container.\n * @param _scene The scene to load into\n * @param _data The data to import\n * @param _rootUrl The root url for scene and resources\n * @returns The loaded asset container\n */\n loadAssetContainerAsync(_scene, _data, _rootUrl) {\n throw new Error(\"loadAssetContainerAsync not implemented for Gaussian Splatting loading\");\n }\n}\nif (SceneLoader) {\n //Add this loader into the register plugin\n SceneLoader.RegisterPlugin(new SPLATFileLoader());\n}","map":{"version":3,"names":["SceneLoader","GaussianSplattingMesh","SPLATFileLoader","constructor","name","extensions","isBinary","createPlugin","canDirectLoad","importMeshAsync","_meshesNames","scene","data","rootUrl","onProgress","fileName","_asyncToGenerator","gaussianSplatting","loadFileAsync","meshes","particleSystems","skeletons","animationGroups","transformNodes","geometries","lights","spriteManagers","loadAsync","_rootUrl","loadDataAsync","ConvertPLYToSplat","loadAssetContainerAsync","_scene","_data","Error","RegisterPlugin"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/loaders/SPLAT/splatFileLoader.js"],"sourcesContent":["import { SceneLoader } from \"@babylonjs/core/Loading/sceneLoader.js\";\nimport { GaussianSplattingMesh } from \"@babylonjs/core/Meshes/GaussianSplatting/gaussianSplattingMesh.js\";\n/**\n * @experimental\n * SPLAT file type loader.\n * This is a babylon scene loader plugin.\n */\nexport class SPLATFileLoader {\n //private _loadingOptions: SPLATLoadingOptions;\n /**\n * Creates loader for gaussian splatting files\n */\n constructor() {\n /**\n * Defines the name of the plugin.\n */\n this.name = \"splat\";\n /**\n * Defines the extensions the splat loader is able to load.\n * force data to come in as an ArrayBuffer\n */\n this.extensions = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n \".splat\": { isBinary: true },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n \".ply\": { isBinary: true },\n };\n }\n /**\n * Instantiates a gaussian splatting file loader plugin.\n * @returns the created plugin\n */\n createPlugin() {\n return new SPLATFileLoader();\n }\n /**\n * If the data string can be loaded directly.\n * @returns if the data can be loaded directly\n */\n canDirectLoad() {\n return false;\n }\n /**\n * Imports from the loaded gaussian splatting data and adds them to the scene\n * @param _meshesNames a string or array of strings of the mesh names that should be loaded from the file\n * @param scene the scene the meshes should be added to\n * @param data the gaussian splatting data to load\n * @param rootUrl root url to load from\n * @param onProgress callback called while file is loading\n * @param fileName Defines the name of the file to load\n * @returns a promise containing the loaded meshes, particles, skeletons and animations\n */\n async importMeshAsync(_meshesNames, scene, data, rootUrl, onProgress, fileName) {\n const gaussianSplatting = new GaussianSplattingMesh(\"GaussianSplatting\", null, scene);\n await gaussianSplatting.loadFileAsync(rootUrl + (fileName ?? \"\"));\n return {\n meshes: [gaussianSplatting],\n particleSystems: [],\n skeletons: [],\n animationGroups: [],\n transformNodes: [],\n geometries: [],\n lights: [],\n spriteManagers: [],\n };\n }\n /**\n * Imports all objects from the loaded gaussian splatting data and adds them to the scene\n * @param scene the scene the objects should be added to\n * @param data the gaussian splatting data to load\n * @param _rootUrl root url to load from\n * @returns a promise which completes when objects have been loaded to the scene\n */\n loadAsync(scene, data, _rootUrl) {\n const gaussianSplatting = new GaussianSplattingMesh(\"GaussianSplatting\", null, scene);\n return gaussianSplatting.loadDataAsync(GaussianSplattingMesh.ConvertPLYToSplat(data));\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Load into an asset container.\n * @param _scene The scene to load into\n * @param _data The data to import\n * @param _rootUrl The root url for scene and resources\n * @returns The loaded asset container\n */\n loadAssetContainerAsync(_scene, _data, _rootUrl) {\n throw new Error(\"loadAssetContainerAsync not implemented for Gaussian Splatting loading\");\n }\n}\nif (SceneLoader) {\n //Add this loader into the register plugin\n SceneLoader.RegisterPlugin(new SPLATFileLoader());\n}\n"],"mappings":";AAAA,SAASA,WAAW,QAAQ,wCAAwC;AACpE,SAASC,qBAAqB,QAAQ,mEAAmE;AACzG;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,CAAC;EACzB;EACA;AACJ;AACA;EACIC,WAAWA,CAAA,EAAG;IACV;AACR;AACA;IACQ,IAAI,CAACC,IAAI,GAAG,OAAO;IACnB;AACR;AACA;AACA;IACQ,IAAI,CAACC,UAAU,GAAG;MACd;MACA,QAAQ,EAAE;QAAEC,QAAQ,EAAE;MAAK,CAAC;MAC5B;MACA,MAAM,EAAE;QAAEA,QAAQ,EAAE;MAAK;IAC7B,CAAC;EACL;EACA;AACJ;AACA;AACA;EACIC,YAAYA,CAAA,EAAG;IACX,OAAO,IAAIL,eAAe,CAAC,CAAC;EAChC;EACA;AACJ;AACA;AACA;EACIM,aAAaA,CAAA,EAAG;IACZ,OAAO,KAAK;EAChB;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACUC,eAAeA,CAACC,YAAY,EAAEC,KAAK,EAAEC,IAAI,EAAEC,OAAO,EAAEC,UAAU,EAAEC,QAAQ,EAAE;IAAA,OAAAC,iBAAA;MAC5E,MAAMC,iBAAiB,GAAG,IAAIhB,qBAAqB,CAAC,mBAAmB,EAAE,IAAI,EAAEU,KAAK,CAAC;MACrF,MAAMM,iBAAiB,CAACC,aAAa,CAACL,OAAO,IAAIE,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAI,EAAE,CAAC,CAAC;MACjE,OAAO;QACHI,MAAM,EAAE,CAACF,iBAAiB,CAAC;QAC3BG,eAAe,EAAE,EAAE;QACnBC,SAAS,EAAE,EAAE;QACbC,eAAe,EAAE,EAAE;QACnBC,cAAc,EAAE,EAAE;QAClBC,UAAU,EAAE,EAAE;QACdC,MAAM,EAAE,EAAE;QAC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