import{aQ as n,F as t,aN as p,aO as a}from"./index-6jOCfdig.js";import{GLTFLoader as c}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";import"./objectModelMapping-DT0r674A.js";const u="KHR_materials_pbrSpecularGlossiness";class d{constructor(e){this.name=u,this.order=200,this._loader=e,this.enabled=this._loader.isExtensionUsed(u)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,r,s){return c.LoadExtensionAsync(e,r,this.name,async(i,o)=>{const m=new Array;return m.push(this._loader.loadMaterialBasePropertiesAsync(e,r,s)),m.push(this._loadSpecularGlossinessPropertiesAsync(i,o,s)),this._loader.loadMaterialAlphaProperties(e,r,s),await Promise.all(m).then(()=>{})})}_loadSpecularGlossinessPropertiesAsync(e,r,s){if(!(s instanceof n))throw new Error(`${e}: Material type not supported`);const i=new Array;return s.metallic=null,s.roughness=null,r.diffuseFactor?(s.albedoColor=t.FromArray(r.diffuseFactor),s.alpha=r.diffuseFactor[3]):s.albedoColor=t.White(),s.reflectivityColor=r.specularFactor?t.FromArray(r.specularFactor):t.White(),s.microSurface=r.glossinessFactor==null?1:r.glossinessFactor,r.diffuseTexture&&i.push(this._loader.loadTextureInfoAsync(`${e}/diffuseTexture`,r.diffuseTexture,o=>{o.name=`${s.name} (Diffuse)`,s.albedoTexture=o})),r.specularGlossinessTexture&&(i.push(this._loader.loadTextureInfoAsync(`${e}/specularGlossinessTexture`,r.specularGlossinessTexture,o=>{o.name=`${s.name} (Specular Glossiness)`,s.reflectivityTexture=o,s.reflectivityTexture.hasAlpha=!0})),s.useMicroSurfaceFromReflectivityMapAlpha=!0),Promise.all(i).then(()=>{})}}p(u);a(u,!0,l=>new d(l));export{d as KHR_materials_pbrSpecularGlossiness};
