import{a as n,b as r}from"./index-T8LZyOXI.js";import{I as i}from"./iblCdfGenerator-BhezIjBr.js";import"./index-BkylzejB.js";import"./rawTexture-Duv-4ySK.js";Object.defineProperty(r.prototype,"iblCdfGenerator",{get:function(){return this._iblCdfGenerator},set:function(e){e&&(this._iblCdfGenerator=e)},enumerable:!0,configurable:!0});r.prototype.enableIblCdfGenerator=function(){return this._iblCdfGenerator?this._iblCdfGenerator:(this._iblCdfGenerator=new i(this),this._iblCdfGenerator.isSupported?(this.environmentTexture&&(this._iblCdfGenerator.iblSource=this.environmentTexture),this._iblCdfGenerator):(this._iblCdfGenerator=null,null))};r.prototype.disableIblCdfGenerator=function(){this._iblCdfGenerator&&(this._iblCdfGenerator.dispose(),this._iblCdfGenerator=null)};class o{constructor(t){this.name=n.NAME_IBLCDFGENERATOR,this._newIblObserver=null,this.scene=t}register(){this._updateIblSource(),this._newIblObserver=this.scene.onEnvironmentTextureChangedObservable.add(this._updateIblSource.bind(this))}rebuild(){}dispose(){this.scene.onEnvironmentTextureChangedObservable.remove(this._newIblObserver)}_updateIblSource(){this.scene.iblCdfGenerator&&this.scene.environmentTexture&&(this.scene.iblCdfGenerator.iblSource=this.scene.environmentTexture)}}i._SceneComponentInitialization=e=>{let t=e._getComponent(n.NAME_IBLCDFGENERATOR);t||(t=new o(e),e._addComponent(t))};export{o as IblCdfGeneratorSceneComponent};
