4cab05c7e8e42d55c56f93bf418f2eae4c19ec87a488d089c42b09ac5eb9d932.json 7.6 KB

1
  1. {"ast":null,"code":"import { Scene } from \"../scene.js\";\nimport { Mesh } from \"./mesh.js\";\nimport { SimplificationQueue } from \"./meshSimplification.js\";\nimport { SceneComponentConstants } from \"../sceneComponent.js\";\nObject.defineProperty(Scene.prototype, \"simplificationQueue\", {\n get: function () {\n if (!this._simplificationQueue) {\n this._simplificationQueue = new SimplificationQueue();\n let component = this._getComponent(SceneComponentConstants.NAME_SIMPLIFICATIONQUEUE);\n if (!component) {\n component = new SimplicationQueueSceneComponent(this);\n this._addComponent(component);\n }\n }\n return this._simplificationQueue;\n },\n set: function (value) {\n this._simplificationQueue = value;\n },\n enumerable: true,\n configurable: true\n});\nMesh.prototype.simplify = function (settings, parallelProcessing = true, simplificationType = 0 /* SimplificationType.QUADRATIC */, successCallback) {\n this.getScene().simplificationQueue.addTask({\n settings: settings,\n parallelProcessing: parallelProcessing,\n mesh: this,\n simplificationType: simplificationType,\n successCallback: successCallback\n });\n return this;\n};\n/**\n * Defines the simplification queue scene component responsible to help scheduling the various simplification task\n * created in a scene\n */\nexport class SimplicationQueueSceneComponent {\n /**\n * Creates a new instance of the component for the given scene\n * @param scene Defines the scene to register the component in\n */\n constructor(scene) {\n /**\n * The component name helpfull to identify the component in the list of scene components.\n */\n this.name = SceneComponentConstants.NAME_SIMPLIFICATIONQUEUE;\n this.scene = scene;\n }\n /**\n * Registers the component in a given scene\n */\n register() {\n this.scene._beforeCameraUpdateStage.registerStep(SceneComponentConstants.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE, this, this._beforeCameraUpdate);\n }\n /**\n * Rebuilds the elements related to this component in case of\n * context lost for instance.\n */\n rebuild() {\n // Nothing to do for this component\n }\n /**\n * Disposes the component and the associated resources\n */\n dispose() {\n // Nothing to do for this component\n }\n _beforeCameraUpdate() {\n if (this.scene._simplificationQueue && !this.scene._simplificationQueue.running) {\n this.scene._simplificationQueue.executeNext();\n }\n }\n}","map":{"version":3,"names":["Scene","Mesh","SimplificationQueue","SceneComponentConstants","Object","defineProperty","prototype","get","_simplificationQueue","component","_getComponent","NAME_SIMPLIFICATIONQUEUE","SimplicationQueueSceneComponent","_addComponent","set","value","enumerable","configurable","simplify","settings","parallelProcessing","simplificationType","successCallback","getScene","simplificationQueue","addTask","mesh","constructor","scene","name","register","_beforeCameraUpdateStage","registerStep","STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE","_beforeCameraUpdate","rebuild","dispose","running","executeNext"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/meshSimplificationSceneComponent.js"],"sourcesContent":["import { Scene } from \"../scene.js\";\nimport { Mesh } from \"./mesh.js\";\nimport { SimplificationQueue } from \"./meshSimplification.js\";\nimport { SceneComponentConstants } from \"../sceneComponent.js\";\nObject.defineProperty(Scene.prototype, \"simplificationQueue\", {\n get: function () {\n if (!this._simplificationQueue) {\n this._simplificationQueue = new SimplificationQueue();\n let component = this._getComponent(SceneComponentConstants.NAME_SIMPLIFICATIONQUEUE);\n if (!component) {\n component = new SimplicationQueueSceneComponent(this);\n this._addComponent(component);\n }\n }\n return this._simplificationQueue;\n },\n set: function (value) {\n this._simplificationQueue = value;\n },\n enumerable: true,\n configurable: true,\n});\nMesh.prototype.simplify = function (settings, parallelProcessing = true, simplificationType = 0 /* SimplificationType.QUADRATIC */, successCallback) {\n this.getScene().simplificationQueue.addTask({\n settings: settings,\n parallelProcessing: parallelProcessing,\n mesh: this,\n simplificationType: simplificationType,\n successCallback: successCallback,\n });\n return this;\n};\n/**\n * Defines the simplification queue scene component responsible to help scheduling the various simplification task\n * created in a scene\n */\nexport class SimplicationQueueSceneComponent {\n /**\n * Creates a new instance of the component for the given scene\n * @param scene Defines the scene to register the component in\n */\n constructor(scene) {\n /**\n * The component name helpfull to identify the component in the list of scene components.\n */\n this.name = SceneComponentConstants.NAME_SIMPLIFICATIONQUEUE;\n this.scene = scene;\n }\n /**\n * Registers the component in a given scene\n */\n register() {\n this.scene._beforeCameraUpdateStage.registerStep(SceneComponentConstants.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE, this, this._beforeCameraUpdate);\n }\n /**\n * Rebuilds the elements related to this component in case of\n * context lost for instance.\n */\n rebuild() {\n // Nothing to do for this component\n }\n /**\n * Disposes the component and the associated resources\n */\n dispose() {\n // Nothing to do for this component\n }\n _beforeCameraUpdate() {\n if (this.scene._simplificationQueue && !this.scene._simplificationQueue.running) {\n this.scene._simplificationQueue.executeNext();\n }\n }\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,aAAa;AACnC,SAASC,IAAI,QAAQ,WAAW;AAChC,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,uBAAuB,QAAQ,sBAAsB;AAC9DC,MAAM,CAACC,cAAc,CAACL,KAAK,CAACM,SAAS,EAAE,qBAAqB,EAAE;EAC1DC,GAAG,EAAE,SAAAA,CAAA,EAAY;IACb,IAAI,CAAC,IAAI,CAACC,oBAAoB,EAAE;MAC5B,IAAI,CAACA,oBAAoB,GAAG,IAAIN,mBAAmB,CAAC,CAAC;MACrD,IAAIO,SAAS,GAAG,IAAI,CAACC,aAAa,CAACP,uBAAuB,CAACQ,wBAAwB,CAAC;MACpF,IAAI,CAACF,SAAS,EAAE;QACZA,SAAS,GAAG,IAAIG,+BAA+B,CAAC,IAAI,CAAC;QACrD,IAAI,CAACC,aAAa,CAACJ,SAAS,CAAC;MACjC;IACJ;IACA,OAAO,IAAI,CAACD,oBAAoB;EACpC,CAAC;EACDM,GAAG,EAAE,SAAAA,CAAUC,KAAK,EAAE;IAClB,IAAI,CAACP,oBAAoB,GAAGO,KAAK;EACrC,CAAC;EACDC,UAAU,EAAE,IAAI;EAChBC,YAAY,EAAE;AAClB,CAAC,CAAC;AACFhB,IAAI,CAACK,SAAS,CAACY,QAAQ,GAAG,UAAUC,QAAQ,EAAEC,kBAAkB,GAAG,IAAI,EAAEC,k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