import{EquirectangularReflectionMapping,PMREMGenerator}from"three";import{RGBELoader}from"three/examples/jsm/loaders/RGBELoader";import{definePlugin}from"../../core/extension";export default definePlugin("hdr",{setup(a,b){let c;const d=new PMREMGenerator(b.renderer);d.compileEquirectangularShader(),this.loadHDRAsync(a.hdrUrl).then(a=>{c=d.fromEquirectangular(a).texture,a.dispose(),d.dispose(),b.scene.environment=c});return{loadHDRAsync:async a=>{let b=await new Promise((b,c)=>{new RGBELoader().load(a,function(a){b(a)})});return b.mapping=EquirectangularReflectionMapping,b},remove:()=>{c&&c.dispose(),d.dispose()}}},destroyed(){this.remove()}});