1import{Color3 as p}from"./math.color-CzLaKyb6.js";import{V as s}from"./math.vector-C1xyPDEl.js";import{G as y}from"./glTFLoader-DlDSYXtl.js";import{u as C,r as _}from"./dynamic-Byj-ExMi.js";import"./math.scalar.functions-DkeaWAWz.js";import"./index-Bc7OztLw.js";import"./tools-D01N7ptR.js";import"./decorators.serialization-C7d7ykGG.js";import"./bufferUtils-DTRdUD8L.js";import"./mesh-BczlZ8bV.js";import"./mesh.vertexData-Cr3zcPIw.js";import"./buffer-DqKlo1ts.js";import"./dataBuffer-CgoqiUzT.js";import"./subMesh-UWDo5wjI.js";import"./drawWrapper-CZVk0xN-.js";import"./smartArray-CO6iJ0u5.js";import"./node-C-Iu0ALa.js";import"./math.viewport-CgkTt1RS.js";import"./sceneComponent-Dflhczui.js";import"./math.plane-Ce_75-g5.js";import"./lightConstants-B1TSTh-k.js";import"./sceneLoaderFlags-wywyb9ml.js";import"./math.axis-Ck7JfPPj.js";import"./material-CrEsrP1R.js";import"./texture-BEqhDl5Y.js";import"./baseTexture-CgAggsey.js";import"./drawWrapper.functions-Dzz0ghog.js";import"./cameraInputsManager-CsnqRZBh.js";import"./deviceInputEvents-BTza-zoR.js";import"./bone-B35odufe.js";import"./skeleton-BVUVDN0a.js";import"./rawTexture-Cp8_XuDs.js";import"./animation-IftAdLIx.js";import"./sceneLoader-CutT-qCn.js";import"./scene-gn_hoGMy.js";import"./renderingManager-CiY2OUrf.js";import"./perfCounter-DusmGz8t.js";import"./assetContainer-41lbZEXn.js";import"./instancedMesh-B9hLhKZd.js";import"./light-DT53MGnW.js";import"./objectModelMapping-DWcnlpHl.js";const c="KHR_materials_volume_scatter";function x(n){const r=new s(n.r,n.g,n.b),i=new s(4.09712,4.09712,4.09712);i.multiplyInPlace(r),i.addInPlace(new s(4.20863,4.20863,4.20863));const e=new s(9.59217,9.59217,9.59217);return e.addInPlace(new s(41.6808,41.6808,41.6808).multiplyInPlace(r)),e.addInPlace(new s(17.7126,17.7126,17.7126).multiplyInPlace(r.multiply(r))),i.subtractInPlace(new s(Math.sqrt(e.x),Math.sqrt(e.y),Math.sqrt(e.z))),new s(1,1,1).subtract(i.multiply(i))}class A{constructor(r){this.name=c,this.order=172,this._loader=r,this.enabled=this._loader.isExtensionUsed(c),this.enabled&&this._loader._disableInstancedMesh++}dispose(){this.enabled&&this._loader._disableInstancedMesh--,this._loader=null}loadMaterialPropertiesAsync(r,i,e){return y.LoadExtensionAsync(r,i,this.name,async(o,t)=>{const l=new Array;return l.push(this._loader.loadMaterialPropertiesAsync(r,i,e)),l.push(this._loadVolumePropertiesAsync(o,i,e,t)),await Promise.all(l).then(()=>{})})}_loadVolumePropertiesAsync(r,i,e,o){const t=this._loader._getOrCreateMaterialAdapter(e);if(t.transmissionWeight===0&&t.subsurfaceWeight===0)return Promise.resolve();const l=o.multiscatterColor!==void 0&&o.multiscatterColor.length==3?p.FromArray(o.multiscatterColor):p.Black(),u=o.scatterAnisotropy!==void 0?o.scatterAnisotropy:0;if(t.transmissionWeight>0){const a=x(l),d=new s(-Math.log(t.transmissionColor.r),-Math.log(t.transmissionColor.g),-Math.log(t.transmissionColor.b));d.scaleInPlace(1/Math.max(t.transmissionDepth,.001));const m=d.multiply(a);m.scaleInPlace(t.transmissionDepth),t.transmissionScatter.set(m.x,m.y,m.z);let f=Promise.resolve(null);return o.multiscatterColorTexture&&(o.multiscatterColorTexture.nonColorData=!0,f=this._loader.loadTextureInfoAsync(`${r}/multiscatterColorTexture`,o.multiscatterColorTexture,h=>{h.name=`${e.name} (Transmission)`,t.transmissionWeightTexture=h})),t.transmissionScatterAnisotropy=u,f.then(()=>{})}if(t.subsurfaceWeight>0){t.subsurfaceScatterAnisotropy=u,t.subsurfaceColor=l;const a=new s(t.extinctionCoefficient.x!==0?1/t.extinctionCoefficient.x:1,t.extinctionCoefficient.y!==0?1/t.extinctionCoefficient.y:1,t.extinctionCoefficient.z!==0?1/t.extinctionCoefficient.z:1);t.subsurfaceRadius=Math.max(a.x,a.y,a.z),t.subsurfaceRadiusScale=new p(a.x/t.subsurfaceRadius,a.y/t.subsurfaceRadius,a.z/t.subsurfaceRadius)}return Promise.resolve()}}C(c);_(c,!0,n=>new A(n));export{A as KHR_materials_volume_scatter};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.