import{C as h,aG as u,aH as d}from"./index-T8LZyOXI.js";import{GLTFLoader as m}from"./glTFLoader-f5CXkgzs.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 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};
