1 |
- {"ast":null,"code":"import _asyncToGenerator from \"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\n/**\n * Utility class to help with bounding info management\n * Warning: using the BoundingInfoHelper class may be slower than executing calculations on the CPU!\n * This will happen if there are a lot of meshes / few vertices (like with the BrainStem model)\n * The BoundingInfoHelper will perform better if there are few meshes / a lot of vertices\n * #BCNJD4#56 =\\> does not use the BoundingInfoHelper class, performs calculations on the CPU\n * #BCNJD4#55 =\\> same as #56 but use the BoundingInfoHelper class\n * #BCNJD4#40 =\\> example with bones and morphs (webGL2)\n * #BCNJD4#42 =\\> example with bones and morphs (webGPU)\n * #HPV2TZ#475 =\\> only morph (webGL2)\n * #HPV2TZ#476 =\\> only morph (webGPU)\n * #B8B8Z2#51 =\\> Large scale test (CPU) =\\> for each mesh, this test calculates a bounding box which is the union of the bounding boxes of all the frames in a given animation\n * #B8B8Z2#49 =\\> Large scale test (webGL2)\n * #B8B8Z2#50 =\\> Large scale test (webGPU)\n */\nexport class BoundingInfoHelper {\n /**\n * Creates a new BoundingInfoHelper\n * @param engine defines the engine to use\n */\n constructor(engine) {\n this._engine = engine;\n }\n _initializePlatform() {\n var _this = this;\n return _asyncToGenerator(function* () {\n if (!_this._platform) {\n if (_this._engine.getCaps().supportComputeShaders) {\n const module = yield import(\"./computeShaderBoundingHelper.js\");\n _this._platform = new module.ComputeShaderBoundingHelper(_this._engine);\n } else if (_this._engine.getCaps().supportTransformFeedbacks) {\n const module = yield import(\"./transformFeedbackBoundingHelper.js\");\n _this._platform = new module.TransformFeedbackBoundingHelper(_this._engine);\n } else {\n throw new Error(\"Your engine does not support Compute Shaders or Transform Feedbacks\");\n }\n }\n })();\n }\n /**\n * Compute the bounding info of a mesh / array of meshes using shaders\n * @param target defines the mesh(es) to update\n * @returns a promise that resolves when the bounding info is/are computed\n */\n computeAsync(target) {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n yield _this2._initializePlatform();\n return _this2._platform.processAsync(target);\n })();\n }\n /**\n * Register a mesh / array of meshes to be processed per batch\n * This method must be called before calling batchProcess (which can be called several times) and batchFetchResultsAsync\n * @param target defines the mesh(es) to be processed per batch\n * @returns a promise that resolves when the initialization is done\n */\n batchInitializeAsync(target) {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n yield _this3._initializePlatform();\n return _this3._platform.registerMeshListAsync(target);\n })();\n }\n /**\n * Processes meshes registered with batchRegisterAsync\n * If called multiple times, the second, third, etc calls will perform a union of the bounding boxes calculated in the previous calls\n */\n batchProcess() {\n this._platform.processMeshList();\n }\n /**\n * Update the bounding info of the meshes registered with batchRegisterAsync, after batchProcess has been called once or several times\n * @returns a promise that resolves when the bounding info is/are computed\n */\n batchFetchResultsAsync() {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n return _this4._platform.fetchResultsForMeshListAsync();\n })();\n }\n /**\n * Dispose and release associated resources\n */\n dispose() {\n this._platform.dispose();\n }\n}","map":{"version":3,"names":["BoundingInfoHelper","constructor","engine","_engine","_initializePlatform","_this","_asyncToGenerator","_platform","getCaps","supportComputeShaders","module","ComputeShaderBoundingHelper","supportTransformFeedbacks","TransformFeedbackBoundingHelper","Error","computeAsync","target","_this2","processAsync","batchInitializeAsync","_this3","registerMeshListAsync","batchProcess","processMeshList","batchFetchResultsAsync","_this4","fetchResultsForMeshListAsync","dispose"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Culling/Helper/boundingInfoHelper.js"],"sourcesContent":["/**\n * Utility class to help with bounding info management\n * Warning: using the BoundingInfoHelper class may be slower than executing calculations on the CPU!\n * This will happen if there are a lot of meshes / few vertices (like with the BrainStem model)\n * The BoundingInfoHelper will perform better if there are few meshes / a lot of vertices\n * #BCNJD4#56 =\\> does not use the BoundingInfoHelper class, performs calculations on the CPU\n * #BCNJD4#55 =\\> same as #56 but use the BoundingInfoHelper class\n * #BCNJD4#40 =\\> example with bones and morphs (webGL2)\n * #BCNJD4#42 =\\> example with bones and morphs (webGPU)\n * #HPV2TZ#475 =\\> only morph (webGL2)\n * #HPV2TZ#476 =\\> only morph (webGPU)\n * #B8B8Z2#51 =\\> Large scale test (CPU) =\\> for each mesh, this test calculates a bounding box which is the union of the bounding boxes of all the frames in a given animation\n * #B8B8Z2#49 =\\> Large scale test (webGL2)\n * #B8B8Z2#50 =\\> Large scale test (webGPU)\n */\nexport class BoundingInfoHelper {\n /**\n * Creates a new BoundingInfoHelper\n * @param engine defines the engine to use\n */\n constructor(engine) {\n this._engine = engine;\n }\n async _initializePlatform() {\n if (!this._platform) {\n if (this._engine.getCaps().supportComputeShaders) {\n const module = await import(\"./computeShaderBoundingHelper.js\");\n this._platform = new module.ComputeShaderBoundingHelper(this._engine);\n }\n else if (this._engine.getCaps().supportTransformFeedbacks) {\n const module = await import(\"./transformFeedbackBoundingHelper.js\");\n this._platform = new module.TransformFeedbackBoundingHelper(this._engine);\n }\n else {\n throw new Error(\"Your engine does not support Compute Shaders or Transform Feedbacks\");\n }\n }\n }\n /**\n * Compute the bounding info of a mesh / array of meshes using shaders\n * @param target defines the mesh(es) to update\n * @returns a promise that resolves when the bounding info is/are computed\n */\n async computeAsync(target) {\n await this._initializePlatform();\n return this._platform.processAsync(target);\n }\n /**\n * Register a mesh / array of meshes to be processed per batch\n * This method must be called before calling batchProcess (which can be called several times) and batchFetchResultsAsync\n * @param target defines the mesh(es) to be processed per batch\n * @returns a promise that resolves when the initialization is done\n */\n async batchInitializeAsync(target) {\n await this._initializePlatform();\n return this._platform.registerMeshListAsync(target);\n }\n /**\n * Processes meshes registered with batchRegisterAsync\n * If called multiple times, the second, third, etc calls will perform a union of the bounding boxes calculated in the previous calls\n */\n batchProcess() {\n this._platform.processMeshList();\n }\n /**\n * Update the bounding info of the meshes registered with batchRegisterAsync, after batchProcess has been called once or several times\n * @returns a promise that resolves when the bounding info is/are computed\n */\n async batchFetchResultsAsync() {\n return this._platform.fetchResultsForMeshListAsync();\n }\n /**\n * Dispose and release associated resources\n */\n dispose()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B,CAAC,CAAC;MAChC,OAAOgB,MAAI,CAACb,SAAS,CAACc,qBAAqB,CAACL,MAAM,CAAC;IAAC;EACxD;EACA;AACJ;AACA;AACA;EACIM,YAAYA,CAAA,EAAG;IACX,IAAI,CAACf,SAAS,CAACgB,eAAe,CAAC,CAAC;EACpC;EACA;AACJ;AACA;AACA;EACUC,sBAAsBA,CAAA,EAAG;IAAA,IAAAC,MAAA;IAAA,OAAAnB,iBAAA;MAC3B,OAAOmB,MAAI,CAAClB,SAAS,CAACmB,4BAA4B,CAAC,CAAC;IAAC;EACzD;EACA;AACJ;AACA;EACIC,OAAOA,CAAA,EAAG;IACN,IAAI,CAACpB,SAAS,CAACoB,OAAO,CAAC,CAAC;EAC5B;AACJ","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}
|