1import{i as c,cn as s,co as z,cp as T,cq as a,cr as B,cs as t,w as r,ct as G,cu as l,cv as I}from"./babylonjs-BJ4KKJpI.js";import"./index-C38E2mBW.js";try{let h=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new h.Error().stack;e&&(h._sentryDebugIds=h._sentryDebugIds||{},h._sentryDebugIds[e]="be0e5f3d-855c-4a4d-9a71-bc6e159ccce2",h._sentryDebugIdIdentifier="sentry-dbid-be0e5f3d-855c-4a4d-9a71-bc6e159ccce2")}catch{}class L{constructor(e){this._specWorkflow=!1,this._diffuseTransmissionTint=c.White(),this._diffuseTransmissionTintTexture=null,this._material=e}get material(){return this._material}get isUnlit(){return this._material.unlit}set isUnlit(e){this._material.unlit=e}set backFaceCulling(e){this._material.backFaceCulling=e}get backFaceCulling(){return this._material.backFaceCulling}set twoSidedLighting(e){this._material.twoSidedLighting=e}get twoSidedLighting(){return this._material.twoSidedLighting}set alphaCutOff(e){this._material.alphaCutOff=e}get alphaCutOff(){return this._material.alphaCutOff}set useAlphaFromBaseColorTexture(e){this._material._useAlphaFromBaseColorTexture=e}get useAlphaFromBaseColorTexture(){return this._material._useAlphaFromBaseColorTexture}get transparencyAsAlphaCoverage(){return!1}set transparencyAsAlphaCoverage(e){}set baseColor(e){this._material.baseColor=e}get baseColor(){return this._material.baseColor}set baseColorTexture(e){this._material.baseColorTexture=e}get baseColorTexture(){return this._material.baseColorTexture}set baseDiffuseRoughness(e){this._material.baseDiffuseRoughness=e}get baseDiffuseRoughness(){return this._material.baseDiffuseRoughness}set baseDiffuseRoughnessTexture(e){this._material.baseDiffuseRoughnessTexture=e}get baseDiffuseRoughnessTexture(){return this._material.baseDiffuseRoughnessTexture}set baseMetalness(e){this._material.baseMetalness=e}get baseMetalness(){return this._material.baseMetalness}set baseMetalnessTexture(e){this._material.baseMetalnessTexture=e}get baseMetalnessTexture(){return this._material.baseMetalnessTexture}set useRoughnessFromMetallicTextureGreen(e){this._material._useRoughnessFromMetallicTextureGreen=e}set useMetallicFromMetallicTextureBlue(e){this._material._useMetallicFromMetallicTextureBlue=e}enableSpecularEdgeColor(e=!1){}configureSpecularGlossiness(){this._specWorkflow=!0}set specularWeight(e){this._material.specularWeight=e}get specularWeight(){return this._material.specularWeight}set specularWeightTexture(e){this._material.specularColorTexture===e?(this._material.specularWeightTexture=null,this._material._useSpecularWeightFromSpecularColorTexture=!0,this._material._useSpecularWeightFromAlpha=!0):this._material.specularWeightTexture=e}get specularWeightTexture(){return this._material.specularWeightTexture}set specularColor(e){this._material.specularColor=e}get specularColor(){return this._material.specularColor}set specularColorTexture(e){this._material.specularColorTexture=e,this._material.specularWeightTexture===this._material.specularColorTexture&&(this._material.specularWeightTexture=null,this._material._useSpecularWeightFromSpecularColorTexture=!0,this._material._useSpecularWeightFromAlpha=!0)}get specularColorTexture(){return this._material.specularColorTexture}set specularRoughness(e){this._material.specularRoughness=e}get specularRoughness(){return this._material.specularRoughness}set specularRoughnessTexture(e){this._material.specularRoughnessTexture=e}get specularRoughnessTexture(){return this._material.specularRoughnessTexture}set specularIor(e){this._material.specularIor=e}get specularIor(){return this._material.specularIor}set glossiness(e){this._material.specularRoughness=Math.max(1-e,0)}get glossiness(){return 1-this._material.specularRoughness}set emissionColor(e){this._material.emissionColor=e}get emissionColor(){return this._material.emissionColor}set emissionLuminance(e){this._material.emissionLuminance=e}get emissionLuminance(){return this._material.emissionLuminance}set emissionColorTexture(e){this._material.emissionColorTexture=e}get emissionColorTexture(){return this._material.emissionColorTexture}set ambientOcclusionTexture(e){this._material.ambientOcclusionTexture=e}get ambientOcclusionTexture(){return this._material.ambientOcclusionTexture}set ambientOcclusionTextureStrength(e){const o=this._material.ambientOcclusionTexture;o&&(o.level=e)}get ambientOcclusionTextureStrength(){return this._material.ambientOcclusionTexture?.level??1}configureCoat(){}set coatWeight(e){this._material.coatWeight=e}get coatWeight(){return this._material.coatWeight}set coatWeightTexture(e){this._material.coatWeightTexture=e}get coatWeightTexture(){return this._material.coatWeightTexture}set coatColor(e){this._material.coatColor=e}get coatColor(){return this._material.coatColor}set coatColorTexture(e){this._material.coatColorTexture=e}set coatRoughness(e){this._material.coatRoughness=e}get coatRoughness(){return this._material.coatRoughness}set coatRoughnessTexture(e){this._material.coatRoughnessTexture=e,e&&(this._material._useCoatRoughnessFromGreenChannel=!0)}get coatRoughnessTexture(){return this._material.coatRoughnessTexture}set coatIor(e){this._material.coatIor=e}get coatIor(){return this._material.coatIor}set coatDarkening(e){this._material.coatDarkening=e}get coatDarkening(){return this._material.coatDarkening}set coatDarkeningTexture(e){this._material.coatDarkeningTexture=e}set coatRoughnessAnisotropy(e){this._material.coatRoughnessAnisotropy=e}get coatRoughnessAnisotropy(){return this._material.coatRoughnessAnisotropy}set geometryCoatTangentAngle(e){this._material.geometryCoatTangentAngle=e}set geometryCoatTangentTexture(e){this._material.geometryCoatTangentTexture=e,e&&(this._material._useCoatRoughnessAnisotropyFromTangentTexture=!0)}get geometryCoatTangentTexture(){return this._material.geometryCoatTangentTexture}configureTransmission(){this._material.geometryThinWalled=1,this._material.transmissionDepth=0}set transmissionWeight(e){this._material.transmissionWeight=e}set transmissionWeightTexture(e){this._material.transmissionWeightTexture=e}get transmissionWeightTexture(){return this._material.transmissionWeightTexture}get transmissionWeight(){return this._material.transmissionWeight}set transmissionScatter(e){this._material.transmissionScatter=e}get transmissionScatter(){return this._material.transmissionScatter}set transmissionScatterTexture(e){this._material.transmissionScatterTexture=e}get transmissionScatterTexture(){return this._material.transmissionScatterTexture}set transmissionScatterAnisotropy(e){this._material.transmissionScatterAnisotropy=e}set transmissionDispersionAbbeNumber(e){this._material.transmissionDispersionAbbeNumber=e}set transmissionDispersionScale(e){this._material.transmissionDispersionScale=e}set transmissionDepth(e){e!==Number.MAX_VALUE||this._material.transmissionDepth!==0?this._material.transmissionDepth=e:this._material.transmissionDepth=0}get transmissionDepth(){return this._material.transmissionDepth}set transmissionColor(e){e.equals(c.White())||(this._material.transmissionColor=e)}get transmissionColor(){return this._material.transmissionColor}
1get refractionBackgroundTexture(){return this._material.backgroundRefractionTexture}set refractionBackgroundTexture(e){this._material.backgroundRefractionTexture=e}configureVolume(){this._material.geometryThinWalled=0}set geometryThinWalled(e){this._material.geometryThinWalled=e?1:0}get geometryThinWalled(){return!!this._material.geometryThinWalled}set volumeThicknessTexture(e){this._material.geometryThicknessTexture=e,this._material._useGeometryThicknessFromGreenChannel=!0}set volumeThickness(e){this._material.geometryThickness=e}configureSubsurface(){this._material.geometryThinWalled=1,this._material.subsurfaceScatterAnisotropy=1}set subsurfaceWeight(e){this._material.subsurfaceWeight=e}get subsurfaceWeight(){return this._material.subsurfaceWeight}set subsurfaceWeightTexture(e){this._material.subsurfaceWeightTexture=e,this._material._useSubsurfaceWeightFromTextureAlpha=!0}get subsurfaceWeightTexture(){return this._material.subsurfaceWeightTexture}set subsurfaceColor(e){this._material.subsurfaceColor=e}set subsurfaceColorTexture(e){this._material.subsurfaceColorTexture=e}set diffuseTransmissionTint(e){this._diffuseTransmissionTint=e}get diffuseTransmissionTint(){return this._diffuseTransmissionTint}set diffuseTransmissionTintTexture(e){this._diffuseTransmissionTintTexture=e}get subsurfaceRadius(){return this._material.subsurfaceRadius}set subsurfaceRadius(e){this._material.subsurfaceRadius=e}get subsurfaceRadiusScale(){return this._material.subsurfaceRadiusScale}set subsurfaceRadiusScale(e){this._material.subsurfaceRadiusScale=e}set subsurfaceScatterAnisotropy(e){this._material.subsurfaceScatterAnisotropy=e}isTranslucent(){return this.transmissionWeight>0||this.subsurfaceWeight>0}configureFuzz(){}set fuzzWeight(e){this._material.fuzzWeight=e}set fuzzWeightTexture(e){this._material.fuzzWeightTexture=e}set fuzzColor(e){this._material.fuzzColor=e}set fuzzColorTexture(e){this._material.fuzzColorTexture=e}set fuzzRoughness(e){this._material.fuzzRoughness=e}set fuzzRoughnessTexture(e){this._material.fuzzRoughnessTexture=e,this._material._useFuzzRoughnessFromTextureAlpha=!0}set specularRoughnessAnisotropy(e){this._material.specularRoughnessAnisotropy=e}get specularRoughnessAnisotropy(){return this._material.specularRoughnessAnisotropy}set geometryTangentAngle(e){this._material.geometryTangentAngle=e}set geometryTangentTexture(e){this._material.geometryTangentTexture=e,this._material._useSpecularRoughnessAnisotropyFromTangentTexture=!0}get geometryTangentTexture(){return this._material.geometryTangentTexture}configureGltfStyleAnisotropy(e=!0){this._material._useGltfStyleAnisotropy=e}set thinFilmWeight(e){this._material.thinFilmWeight=e}set thinFilmIor(e){this._material.thinFilmIor=e}set thinFilmThicknessMinimum(e){this._material.thinFilmThicknessMin=e/1e3}set thinFilmThicknessMaximum(e){this._material.thinFilmThickness=e/1e3}set thinFilmWeightTexture(e){this._material.thinFilmWeightTexture=e}set thinFilmThicknessTexture(e){this._material.thinFilmThicknessTexture=e,this._material._useThinFilmThicknessFromTextureGreen=!0}set unlit(e){this._material.unlit=e}set geometryOpacity(e){this._material.geometryOpacity=e}get geometryOpacity(){return this._material.geometryOpacity}set geometryNormalTexture(e){this._material.geometryNormalTexture=e}get geometryNormalTexture(){return this._material.geometryNormalTexture}setNormalMapInversions(e,o){}set geometryCoatNormalTexture(e){this._material.geometryCoatNormalTexture=e}get geometryCoatNormalTexture(){return this._material.geometryCoatNormalTexture}set geometryCoatNormalTextureScale(e){this._material.geometryCoatNormalTexture&&(this._material.geometryCoatNormalTexture.level=e)}async finalizeAsync(e){if(this._diffuseTransmissionTint&&!this._diffuseTransmissionTint.equals(c.White())||this._diffuseTransmissionTintTexture){if(this._material.geometryThinWalled)this.subsurfaceColor=this._diffuseTransmissionTint,this.subsurfaceColorTexture=this._diffuseTransmissionTintTexture;else if(await this.copySurfaceToCoatAsync(e,this.subsurfaceWeight,this.subsurfaceWeightTexture,s.A,this._diffuseTransmissionTint,this._diffuseTransmissionTintTexture,!0),e._disposed)return}if(this.transmissionWeight>0){if(this._material.geometryThinWalled||this._material.transmissionDepth===0)this._material.transmissionColor=this._material.baseColor,this._material.transmissionColorTexture=this._material.baseColorTexture;else if((!this.baseColor.equals(c.White())||this.baseColorTexture!==null)&&(await this.copySurfaceToCoatAsync(e,this.transmissionWeight,this.transmissionWeightTexture,s.R,this.baseColor,this.baseColorTexture,!1),e._disposed))return}if(this._specWorkflow){const o=await z("newRoughnessTexture ("+this._material.name+")",await B("glossiness ("+this._material.name+")",t(this.specularColorTexture,new r(this.specularColor.r,this.specularColor.g,this.specularColor.b,this.glossiness),s.A,a.Linear),s.A,this._material.getScene(),a.Linear,T.R),this._material.getScene(),T.R,a.Linear,T.R);if(e._disposed){o.texture?.dispose();return}this.specularRoughnessTexture=o.texture,this.specularRoughness=o.factor?o.factor.r:1;const u=await G("metallicTexture ("+this._material.name+")",t(this.specularColorTexture,this.specularColor.toColor4(),s.RGBA,a.Linear),this._material.getScene(),!1,a.SRGB,T.RGB);if(e._disposed){u.texture?.dispose();return}this.baseMetalnessTexture=u.texture,this.baseMetalness=u.factor?u.factor.r:1;const n=await l("newBaseColor ("+this._material.name+")",t(this.baseColorTexture,this.baseColor.toColor4(),s.RGBA,a.Linear),t(this.specularColorTexture,this.specularColor.toColor4(),s.RGBA,a.Linear),{...u,dispose:void 0,colorSpace:a.Linear},this._material.getScene(),a.SRGB,T.RGB);if(e._disposed){n.texture?.dispose();return}this.baseColorTexture?.dispose(),this.baseColorTexture=n.texture,this.baseColor=n.factor?new c(n.factor.r,n.factor.g,n.factor.b):c.White(),this.specularColorTexture?.dispose(),this.specularColorTexture=null}}async copySurfaceToCoatAsync(e,o,u,n,b,y,F=!1){const x=this._material.coatWeight,g=this._material.coatWeightTexture,k=this._material.coatColor.clone(),D=this._material.coatColorTexture,p=this._material.geometryCoatNormalTexture,_=ne
1w r(x,x,x,x),W=new r(o,o,o,o);this.coatWeightTexture=null,this.coatWeight=1;const C=await Promise.allSettled([l("lerpExistingCoat",t(null,new r(1,1,1,1)),t(D,k.toColor4(),s.RGBA,a.SRGB),t(g,_,s.R),this._material.getScene(),a.SRGB),l("lerpSurfaceColor",t(null,new r(1,1,1,1)),t(y,b.toColor4(),s.RGBA,a.SRGB),t(u,W,n),this._material.getScene(),a.SRGB)]),S=C.find(i=>i.status==="rejected");if(S){for(const i of C)i.status==="fulfilled"&&i.value.texture?.dispose();throw S.reason}const[w,A]=C.map(i=>i.value);if(e._disposed){w.texture?.dispose(),A.texture?.dispose();return}const m=await I("newCoatColor ("+this._material.name+")",w,A,this._material.getScene(),a.SRGB);if(e._disposed){m.texture?.dispose();return}m.texture?(this.coatColorTexture=m.texture,this.coatColor=c.White()):m.factor&&(this.coatColorTexture=null,this.coatColor.fromArray([m.factor.r,m.factor.g,m.factor.b]));const R=await l("newCoatIor ("+this._material.name+")",t(null,new r(this._material.specularIor,this._material.specularIor,this._material.specularIor,1),s.R),t(null,new r(this.coatIor,this.coatIor,this.coatIor,1),s.R),t(g,_,s.R),this._material.getScene());if(e._disposed){R.texture?.dispose();return}this.coatIor=R.factor?R.factor.r:this.coatIor;const f=await l("newCoatRoughness ("+this._material.name+")",t(this.specularRoughnessTexture,new r(this.specularRoughness,this.specularRoughness,this.specularRoughness,1),s.G),t(this.coatRoughnessTexture,new r(this.coatRoughness,this.coatRoughness,this.coatRoughness,1),s.G),t(g,_,s.R),this._material.getScene());if(e._disposed){f.texture?.dispose();return}this.coatRoughness=f.factor?f.factor.r:1,this.coatRoughnessTexture=f.texture;const d=await l("newCoatDarkening ("+this._material.name+")",t(null,new r(0,0,0,1),s.R),t(null,new r(this.coatDarkening,this.coatDarkening,this.coatDarkening,1),s.R),t(g,_,s.R),this._material.getScene());if(e._disposed){d.texture?.dispose();return}if(this.coatDarkening=d.factor?d.factor.r:this.coatDarkening,F){const i=await l("newSpecularRoughness ("+this._material.name+")",t(this.specularRoughnessTexture,new r(this._material.specularRoughness,this._material.specularRoughness,this._material.specularRoughness,1),s.G),t(null,new r(1,1,1,1),s.R),t(u,W,n),this._material.getScene());if(e._disposed){i.texture?.dispose();return}this.specularRoughness=i.factor?i.factor.r:1,this.specularRoughnessTexture=i.texture}if(p||this.geometryNormalTexture){const i=await l("newCoatNormal ("+this._material.name+")",t(this.geometryNormalTexture,this.geometryNormalTexture?new r(1,1,1,1):new r(.5,.5,1,1),s.RGBA),t(p,p?new r(1,1,1,1):new r(.5,.5,1,1),s.RGBA),t(g,_,s.R),this._material.getScene());if(e._disposed){i.texture?.dispose();return}i.texture&&(this.geometryCoatNormalTexture=i.texture)}}}export{L as OpenPBRMaterialLoadingAdapter};
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.