1 |
- {"ast":null,"code":"import { TimingTools } from \"../Misc/timingTools.js\";\n/** @internal */\nexport class DrawWrapper {\n static GetEffect(effect) {\n return effect.getPipelineContext === undefined ? effect.effect : effect;\n }\n constructor(engine, createMaterialContext = true) {\n /**\n * @internal\n * Specifies if the effect was previously ready\n */\n this._wasPreviouslyReady = false;\n /**\n * @internal\n * Forces the code from bindForSubMesh to be fully run the next time it is called\n */\n this._forceRebindOnNextCall = true;\n /**\n * @internal\n * Specifies if the effect was previously using instances\n */\n this._wasPreviouslyUsingInstances = null;\n this.effect = null;\n this.defines = null;\n this.drawContext = engine.createDrawContext();\n if (createMaterialContext) {\n this.materialContext = engine.createMaterialContext();\n }\n }\n setEffect(effect, defines, resetContext = true) {\n this.effect = effect;\n if (defines !== undefined) {\n this.defines = defines;\n }\n if (resetContext) {\n var _this$drawContext;\n (_this$drawContext = this.drawContext) === null || _this$drawContext === void 0 || _this$drawContext.reset();\n }\n }\n /**\n * Dispose the effect wrapper and its resources\n * @param immediate if the effect should be disposed immediately or on the next frame.\n * If dispose() is not called during a scene or engine dispose, we want to delay the dispose of the underlying effect. Mostly to give a chance to user code to reuse the effect in some way.\n */\n dispose(immediate = false) {\n var _this$drawContext2;\n if (this.effect) {\n const effect = this.effect;\n if (immediate) {\n effect.dispose();\n } else {\n TimingTools.SetImmediate(() => {\n effect.getEngine().onEndFrameObservable.addOnce(() => {\n effect.dispose();\n });\n });\n }\n this.effect = null;\n }\n (_this$drawContext2 = this.drawContext) === null || _this$drawContext2 === void 0 || _this$drawContext2.dispose();\n }\n}","map":{"version":3,"names":["TimingTools","DrawWrapper","GetEffect","effect","getPipelineContext","undefined","constructor","engine","createMaterialContext","_wasPreviouslyReady","_forceRebindOnNextCall","_wasPreviouslyUsingInstances","defines","drawContext","createDrawContext","materialContext","setEffect","resetContext","_this$drawContext","reset","dispose","immediate","_this$drawContext2","SetImmediate","getEngine","onEndFrameObservable","addOnce"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/drawWrapper.js"],"sourcesContent":["import { TimingTools } from \"../Misc/timingTools.js\";\n/** @internal */\nexport class DrawWrapper {\n static GetEffect(effect) {\n return effect.getPipelineContext === undefined ? effect.effect : effect;\n }\n constructor(engine, createMaterialContext = true) {\n /**\n * @internal\n * Specifies if the effect was previously ready\n */\n this._wasPreviouslyReady = false;\n /**\n * @internal\n * Forces the code from bindForSubMesh to be fully run the next time it is called\n */\n this._forceRebindOnNextCall = true;\n /**\n * @internal\n * Specifies if the effect was previously using instances\n */\n this._wasPreviouslyUsingInstances = null;\n this.effect = null;\n this.defines = null;\n this.drawContext = engine.createDrawContext();\n if (createMaterialContext) {\n this.materialContext = engine.createMaterialContext();\n }\n }\n setEffect(effect, defines, resetContext = true) {\n this.effect = effect;\n if (defines !== undefined) {\n this.defines = defines;\n }\n if (resetContext) {\n this.drawContext?.reset();\n }\n }\n /**\n * Dispose the effect wrapper and its resources\n * @param immediate if the effect should be disposed immediately or on the next frame.\n * If dispose() is not called during a scene or engine dispose, we want to delay the dispose of the underlying effect. Mostly to give a chance to user code to reuse the effect in some way.\n */\n dispose(immediate = false) {\n if (this.effect) {\n const effect = this.effect;\n if (immediate) {\n effect.dispose();\n }\n else {\n TimingTools.SetImmediate(() => {\n effect.getEngine().onEndFrameObservable.addOnce(() => {\n effect.dispose();\n });\n });\n }\n this.effect = null;\n }\n this.drawContext?.dispose();\n }\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,wBAAwB;AACpD;AACA,OAAO,MAAMC,WAAW,CAAC;EACrB,OAAOC,SAASA,CAACC,MAAM,EAAE;IACrB,OAAOA,MAAM,CAACC,kBAAkB,KAAKC,SAAS,GAAGF,MAAM,CAACA,MAAM,GAAGA,MAAM;EAC3E;EACAG,WAAWA,CAACC,MAAM,EAAEC,qBAAqB,GAAG,IAAI,EAAE;IAC9C;AACR;AACA;AACA;IACQ,IAAI,CAACC,mBAAmB,GAAG,KAAK;IAChC;AACR;AACA;AACA;IACQ,I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