import{C as h,aG as u,aH as d}from"./index-CDrXokXW.js";import{GLTFLoader as m}from"./glTFLoader-Bp7IfGPK.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 a="KHR_materials_volume";class c{constructor(t){this.name=a,this.order=173,this._loader=t,this.enabled=this._loader.isExtensionUsed(a),this.enabled&&this._loader._disableInstancedMesh++}dispose(){this.enabled&&this._loader._disableInstancedMesh--,this._loader=null}loadMaterialPropertiesAsync(t,o,i){return m.LoadExtensionAsync(t,o,this.name,async(e,s)=>{const r=new Array;return r.push(this._loader.loadMaterialPropertiesAsync(t,o,i)),r.push(this._loadVolumePropertiesAsync(e,o,i,s)),await Promise.all(r).then(()=>{})})}_loadVolumePropertiesAsync(t,o,i,e){const s=this._loader._getOrCreateMaterialAdapter(i);if(s.transmissionWeight===0&&s.subsurfaceWeight===0||!e.thicknessFactor)return Promise.resolve();s.transmissionDepth=e.attenuationDistance!==void 0?e.attenuationDistance:Number.MAX_VALUE,s.transmissionColor=e.attenuationColor!==void 0&&e.attenuationColor.length==3?h.FromArray(e.attenuationColor):h.White(),s.volumeThickness=e.thicknessFactor??0;const r=new Array;return e.thicknessTexture&&(e.thicknessTexture.nonColorData=!0,r.push(this._loader.loadTextureInfoAsync(`${t}/thicknessTexture`,e.thicknessTexture,l=>{l.name=`${i.name} (Thickness)`,s.volumeThicknessTexture=l}))),Promise.all(r).then(()=>{})}}u(a);d(a,!0,n=>new c(n));export{c as KHR_materials_volume};
