import{GLTFLoader as l}from"./glTFLoader-Bp7IfGPK.js";import{aG as u,aH as m}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.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};
