import{GLTFLoader as l}from"./glTFLoader-f5CXkgzs.js";import{aG as u,aH as m}from"./index-T8LZyOXI.js";import"./index-BkylzejB.js";import"./bone-DGunMt7J.js";import"./skeleton-00tPGJ0X.js";import"./rawTexture-Duv-4ySK.js";import"./assetContainer-DNTqZfyb.js";import"./objectModelMapping-D1pI71RW.js";const c="KHR_materials_clearcoat";class i{constructor(r){this.name=c,this.order=190,this._loader=r,this.enabled=this._loader.isExtensionUsed(c)}dispose(){this._loader=null}loadMaterialPropertiesAsync(r,e,t){return l.LoadExtensionAsync(r,e,this.name,async(o,s)=>{const a=new Array;a.push(this._loader.loadMaterialPropertiesAsync(r,e,t)),a.push(this._loadClearCoatPropertiesAsync(o,s,t)),await Promise.all(a)})}_loadClearCoatPropertiesAsync(r,e,t){const o=this._loader._getOrCreateMaterialAdapter(t),s=new Array;return o.configureCoat(),o.coatWeight=e.clearcoatFactor!==void 0?e.clearcoatFactor:0,o.coatRoughness=e.clearcoatRoughnessFactor!==void 0?e.clearcoatRoughnessFactor:0,e.clearcoatTexture&&s.push(this._loader.loadTextureInfoAsync(`${r}/clearcoatTexture`,e.clearcoatTexture,a=>{a.name=`${t.name} (ClearCoat)`,o.coatWeightTexture=a})),e.clearcoatRoughnessTexture&&(e.clearcoatRoughnessTexture.nonColorData=!0,s.push(this._loader.loadTextureInfoAsync(`${r}/clearcoatRoughnessTexture`,e.clearcoatRoughnessTexture,a=>{a.name=`${t.name} (ClearCoat Roughness)`,o.coatRoughnessTexture=a}))),e.clearcoatNormalTexture&&(e.clearcoatNormalTexture.nonColorData=!0,s.push(this._loader.loadTextureInfoAsync(`${r}/clearcoatNormalTexture`,e.clearcoatNormalTexture,a=>{a.name=`${t.name} (ClearCoat Normal)`,o.geometryCoatNormalTexture=a,e.clearcoatNormalTexture?.scale!=null&&(o.geometryCoatNormalTextureScale=e.clearcoatNormalTexture.scale)})),o.setNormalMapInversions(!t.getScene().useRightHandedSystem,t.getScene().useRightHandedSystem)),Promise.all(s).then(()=>{})}}u(c);m(c,!0,n=>new i(n));export{i as KHR_materials_clearcoat};
