import{V as h,aP as g,F as f,a as b,aN as y,aO as L}from"./index-6jOCfdig.js";import{a as A}from"./objectModelMapping-DT0r674A.js";import{ArrayItem as l,GLTFLoader as _}from"./glTFLoader-Bx351I09.js";import"./index-Ds2meNS5.js";import"./svelte/svelte_svelte.js";import"./svelte/svelte_animate.js";import"./svelte/svelte_attachments.js";import"./svelte/svelte_easing.js";import"./svelte/svelte_internal_client.js";import"./svelte/svelte_internal_flags_async.js";import"./svelte/svelte_internal_flags_legacy.js";import"./svelte/svelte_internal_flags_tracing.js";import"./svelte/svelte_internal_server.js";import"./svelte/svelte_legacy.js";import"./svelte/svelte_motion.js";import"./svelte/svelte_reactivity.js";import"./svelte/svelte_reactivity_window.js";import"./svelte/svelte_server.js";import"./svelte/svelte_store.js";import"./svelte/svelte_transition.js";import"./svelte/svelte_events.js";import"./bone-DdTyU8i_.js";import"./skeleton-C0c5yg7x.js";import"./rawTexture-CpjOe2U7.js";import"./assetContainer-Drc86vic.js";const a="EXT_lights_ies";class w{constructor(i){this.name=a,this._loader=i,this.enabled=this._loader.isExtensionUsed(a)}dispose(){this._loader=null,delete this._lights}onLoading(){const i=this._loader.gltf.extensions;if(i&&i[this.name]){const o=i[this.name];this._lights=o.lights,l.Assign(this._lights)}}loadNodeAsync(i,o,p){return _.LoadExtensionAsync(i,o,this.name,async(m,s)=>{this._loader._allMaterialsDirtyRequired=!0;let e,t;const u=await this._loader.loadNodeAsync(i,o,r=>{t=l.Get(m,this._lights,s.light);const c=t.name||r.name;this._loader.babylonScene._blockEntityCollection=!!this._loader._assetContainer,e=new A(c,h.Zero(),h.Backward(),0,1,this._loader.babylonScene),e.angle=Math.PI/2,e.innerAngle=0,e._parentContainer=this._loader._assetContainer,this._loader.babylonScene._blockEntityCollection=!1,t._babylonLight=e,e.falloffType=g.FALLOFF_GLTF,e.diffuse=s.color?f.FromArray(s.color):f.White(),e.intensity=s.multiplier||1,e.range=Number.MAX_VALUE,e.parent=r,this._loader._babylonLights.push(e),_.AddPointerMetadata(e,m),p(r)});let n;if(t.uri)n=await this._loader.loadUriAsync(i,t,t.uri);else{const r=l.Get(`${i}/bufferView`,this._loader.gltf.bufferViews,t.bufferView);n=await this._loader.loadBufferViewAsync(`/bufferViews/${r.index}`,r)}return e.iesProfileTexture=new b(name+"_iesProfile",this._loader.babylonScene,!0,!1,void 0,null,null,n,!0,void 0,void 0,void 0,void 0,".ies"),u})}}y(a);L(a,!0,d=>new w(d));export{w as EXT_lights_ies};
