1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/babylon-shaders-wgsl-BeT4-5_R.js","assets/rolldown-runtime-mIaf4CcP.js","assets/babylon-core-CTx9pQT3.js","assets/babylon-shaders-glsl-950gQ6aI.js"])))=>i.map(i=>d[i]); 2import{n as e}from"./rolldown-runtime-mIaf4CcP.js";import{$i as t,$r as s,Ai as i,B as r,Br as n,Da as a,Dr as o,Er as u,F as h,Gr as l,H as c,Hi as _,Hr as T,I as p,Jr as f,Kr as m,L as A,M as d,N as g,Ni as R,Or as E,P as S,Qr as y,Sn as x,Sr as I,Tr as b,Ur as C,V as L,Vr as M,Wr as O,Xi as v,Xr as N,Yi as F,Yr as D,Zi as P,Zr as U,_r as w,ai as k,br as B,ca as G,ci as H,da as z,di as W,ea as V,ei as X,fa as Y,fi as Z,ga as K,hi as Q,ia as j,ii as q,j as $,ki as J,li as ee,mi as te,ni as se,nr as ie,oi as re,pa as ne,pi as ae,qr as oe,ri as ue,rr as he,sa as le,si as ce,ta as _e,ti as Te,tr as pe,ua as fe,ui as me,vr as Ae,wr as de,xn as ge,xr as Re,yr as Ee,z as Se}from"./babylon-core-CTx9pQT3.js";var ye,xe=e({_ENVTextureLoader:()=>Ie}),Ie=class{constructor(){this.supportCascades=!1}loadCubeData(e,t,s,i,r){if(Array.isArray(e))return;const n=pe(e);if(n){t.width=n.width,t.height=n.width;try{he(t,n),ie(t,e,n).then(()=>{t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),i&&i()},e=>{r?.("Can not upload environment levels",e)})}catch(a){r?.("Can not upload environment file",a)}}else r&&r("Can not parse the environment file",null)}loadData(){throw".env not supported in 2d."}};!function(e){e[e.GLSL=0]="GLSL",e[e.WGSL=1]="WGSL"}(ye||(ye={}));var be=class e extends J{constructor(e,t,s,i=!1,r=3,n=5,a){const o=!s||s._isScene;super(null,o?s:s?.scene,o?!i:s,a,r,void 0,void 0,void 0,void 0,n),this.name=e,this.wrapU=J.CLAMP_ADDRESSMODE,this.wrapV=J.CLAMP_ADDRESSMODE,this._generateMipMaps=i;const u=this._getEngine();if(!u)return;if(t.getContext)this._canvas=t,this._ownCanvas=!1,this._texture=u.createDynamicTexture(this._canvas.width,this._canvas.height,i,r);else{this._canvas=u.createCanvas(1,1),this._ownCanvas=!0;const e=t;e.width||0===e.width?this._texture=u.createDynamicTexture(e.width,e.height,i,r):this._texture=u.createDynamicTexture(t,t,i,r)}const h=this.getSize();this._canvas.width!==h.width&&(this._canvas.width=h.width),this._canvas.height!==h.height&&(this._canvas.height=h.height),this._context=this._canvas.getContext("2d")}getClassName(){return"DynamicTexture"}get canRescale(){return!0}_recreate(e){this._canvas.width=e.width,this._canvas.height=e.height,this.releaseInternalTexture(),this._texture=this._getEngine().createDynamicTexture(e.width,e.height,this._generateMipMaps,this.samplingMode)}scale(e){const t=this.getSize();t.width*=e,t.height*=e,this._recreate(t)}scaleTo(e,t){const s=this.getSize();s.width=e,s.height=t,this._recreate(s)}getContext(){return this._context}clear(e){const t=this.getSize();e&&(this._context.fillStyle=e),this._context.clearRect(0,0,t.width,t.height)}update(e,t=!1,s=!1){this._texture&&this._getEngine().updateDynamicTexture(this._texture,this._canvas,void 0===e||e,t,this._format||void 0,void 0,s)}drawText(e,t,s,i,r,n,a,o=!0){const u=this.getSize();if(n&&(this._context.fillStyle=n,this._context.fillRect(0,0,u.width,u.height)),this._context.font=i,null==t){const s=this._context.measureText(e);t=(u.width-s.width)/2}if(null==s){const e=parseInt(i.replace(/\D/g,""));s=u.height/2+e/3.65}this._context.fillStyle=r||"",this._context.fillText(e,t,s),o&&this.update(a)}dispose(){super.dispose(),this._ownCanvas&&this._canvas?.remove?.(),this._canvas=null,this._context=null}clone(){const t=this.getScene();if(!t)return this;const s=this.getSize(),i=new e(this.name,s,t,this._generateMipMaps);return i.hasAlpha=this.hasAlpha,i.level=this.level,i.wrapU=this.wrapU,i.wrapV=this.wrapV,i}serialize(){const t=this.getScene();t&&!t.isReady()&&a.Warn("The scene must be ready before serializing the dynamic texture");const s=super.serialize();return e._IsCanvasElement(this._canvas)&&(s.base64String=this._canvas.toDataURL()),s.invertY=this._invertY,s.samplingMode=this.samplingMode,s}static _IsCanvasElement(e){return void 0!==e.toDataURL}_rebuild(){this.update()}},Ce={effect:null,subMesh:null},Le=class e{populateVectorFromLinkedProperties(t){const s=t.dimension[0];for(const i in this.linkedProperties){const t=this.linkedProperties[i],r=t.numComponents;
2if(s<r||t.targetUniformComponentOffset>s-r)return void(1==r?a.Error(`Float property ${t.name} has an offset that is too large.`):a.Error(`Vector${r} property ${t.name} won't fit in Vector${s} or has an offset that is too large.`));"number"==typeof t.value?e._tmpArray[t.targetUniformComponentOffset]=t.value:t.value.toArray(e._tmpArray,t.targetUniformComponentOffset)}t.fromArray(e._tmpArray)}constructor(e,t){this.linkedProperties={},this.firstLinkedKey="",this.name=e,this.numComponents=t}};Le._tmpArray=[0,0,0,0];var Me=class{constructor(e,t,s,i,r=0,n){this.targetUniformComponentNum=4,this.targetUniformComponentOffset=0,this.name=e,this.targetUniformName=s,this.defaultValue=t,this.value=t,this.targetUniformComponentNum=i,this.targetUniformComponentOffset=r,this.requiredDefine=n}get numComponents(){return"number"==typeof this.defaultValue?1:this.defaultValue.dimension[0]}},Oe=class{get samplerName(){return this.samplerPrefix+"Sampler"}get samplerInfoName(){return"v"+this.samplerPrefix.charAt(0).toUpperCase()+this.samplerPrefix.slice(1)+"Infos"}get samplerMatrixName(){return this.samplerPrefix+"Matrix"}constructor(e,t,s){this.value=null,this.samplerPrefix="",this.textureDefine="",this.name=e,this.samplerPrefix=t,this.textureDefine=s}},ve=class extends(Ae(Ee(o))){},Ne=class extends(function(e){return class extends e{constructor(){super(...arguments),this.REFLECTION=!1,this.REFLECTIONMAP_3D=!1,this.REFLECTIONMAP_SPHERICAL=!1,this.REFLECTIONMAP_PLANAR=!1,this.REFLECTIONMAP_CUBIC=!1,this.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,this.REFLECTIONMAP_PROJECTION=!1,this.REFLECTIONMAP_SKYBOX=!1,this.REFLECTIONMAP_EXPLICIT=!1,this.REFLECTIONMAP_EQUIRECTANGULAR=!1,this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,this.INVERTCUBICMAP=!1,this.USESPHERICALFROMREFLECTIONMAP=!1,this.USEIRRADIANCEMAP=!1,this.USE_IRRADIANCE_DOMINANT_DIRECTION=!1,this.USESPHERICALINVERTEX=!1,this.REFLECTIONMAP_OPPOSITEZ=!1,this.LODINREFLECTIONALPHA=!1,this.GAMMAREFLECTION=!1,this.RGBDREFLECTION=!1}}}(ve)){},Fe=class extends(u(Ne)){constructor(e){super(e),this.NUM_SAMPLES="0",this.REALTIME_FILTERING=!1,this.IBL_CDF_FILTERING=!1,this.LIGHTCOUNT=0,this.VERTEXCOLOR=!1,this.BAKED_VERTEX_ANIMATION_TEXTURE=!1,this.VERTEXALPHA=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.ALPHABLEND=!1,this.ALPHA_FROM_BASE_COLOR_TEXTURE=!1,this.ALPHATESTVALUE="0.5",this.PREMULTIPLYALPHA=!1,this.REFLECTIVITY_GAMMA=!1,this.REFLECTIVITYDIRECTUV=0,this.SPECULARTERM=!1,this.LODBASEDMICROSFURACE=!0,this.SPECULAR_ROUGHNESS_FROM_METALNESS_TEXTURE_GREEN=!1,this.BASE_METALNESS_FROM_METALNESS_TEXTURE_BLUE=!1,this.AOSTOREINMETALMAPRED=!1,this.SPECULAR_WEIGHT_IN_ALPHA=!1,this.SPECULAR_WEIGHT_FROM_SPECULAR_COLOR_TEXTURE=!1,this.SPECULAR_ROUGHNESS_ANISOTROPY_FROM_TANGENT_TEXTURE=!1,this.COAT_ROUGHNESS_FROM_GREEN_CHANNEL=!1,this.COAT_ROUGHNESS_ANISOTROPY_FROM_TANGENT_TEXTURE=!1,this.USE_GLTF_STYLE_ANISOTROPY=!1,this.THIN_FILM_THICKNESS_FROM_THIN_FILM_TEXTURE=!1,this.FUZZ_ROUGHNESS_FROM_TEXTURE_ALPHA=!1,this.SUBSURFACE_WEIGHT_FROM_TEXTURE_ALPHA=!1,this.GEOMETRY_THICKNESS_FROM_GREEN_CHANNEL=!1,this.ENVIRONMENTBRDF=!1,this.ENVIRONMENTBRDF_RGBD=!1,this.FUZZENVIRONMENTBRDF=!1,this.NORMAL=!1,this.TANGENT=!1,this.OBJECTSPACE_NORMALMAP=!1,this.PARALLAX=!1,this.PARALLAX_RHS=!1,this.PARALLAXOCCLUSION=!1,this.NORMALXYSCALE=!0,this.ANISOTROPIC=!1,this.ANISOTROPIC_OPENPBR=!0,this.ANISOTROPIC_BASE=!1,this.ANISOTROPIC_COAT=!1,this.FUZZ_IBL_SAMPLES=6,this.REFRACTION_HIGH_QUALITY_BLUR=!1,this.FUZZ=!1,this.THIN_FILM=!1,this.IRIDESCENCE=!1,this.DISPERSION=!1,this.SCATTERING=!1,this.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING=!1,this.SSS_SAMPLE_COUNT=16,this.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING_GBUFFER=!1,this.TRANSMISSION_SLAB=!1,this.TRANSMISSION_SLAB_VOLUME=!1,this.SUBSURFACE_SLAB=!1,this.GEOMETRY_THIN_WALLED=!1,this.REFRACTED_BACKGROUND=!1,this.REFRACTED_LIGHTS=!1,this.REFRACTED_ENVIRONMENT=!1,this.REFRACTED_ENVIRONMENT_OPPOSITEZ=!1,this.REFRACTED_ENVIRONMENT_LOCAL_CUBE=!1,this.RADIANCEOCCLUSION=!1,this.HORIZONOCCLUSION=!1,this.INSTANCES=!1,this.THIN_INSTANCES=!1,this.INSTANCESCOLOR=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.BONETEXTURE=!1,this.BONES_VELOCITY_ENABLED=!1,this.NONUNIFORMSCALING=!1,this.MORPHTARGETS=!1,this.MORPHTARGETS_POSITION=!1,this.MORPHTARGETS_NORMAL=!1,this.MORPHTARGETS_TANGENT=!1,this.MORPHTARGETS_
2UV=!1,this.MORPHTARGETS_UV2=!1,this.MORPHTARGETS_COLOR=!1,this.MORPHTARGETTEXTURE_HASPOSITIONS=!1,this.MORPHTARGETTEXTURE_HASNORMALS=!1,this.MORPHTARGETTEXTURE_HASTANGENTS=!1,this.MORPHTARGETTEXTURE_HASUVS=!1,this.MORPHTARGETTEXTURE_HASUV2S=!1,this.MORPHTARGETTEXTURE_HASCOLORS=!1,this.NUM_MORPH_INFLUENCERS=0,this.MORPHTARGETS_TEXTURE=!1,this.USEPHYSICALLIGHTFALLOFF=!1,this.USEGLTFLIGHTFALLOFF=!1,this.TWOSIDEDLIGHTING=!1,this.MIRRORED=!1,this.SHADOWFLOAT=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.POINTSIZE=!1,this.FOG=!1,this.LOGARITHMICDEPTH=!1,this.CAMERA_ORTHOGRAPHIC=!1,this.CAMERA_PERSPECTIVE=!1,this.AREALIGHTSUPPORTED=!0,this.FORCENORMALFORWARD=!1,this.SPECULARAA=!1,this.UNLIT=!1,this.DECAL_AFTER_DETAIL=!1,this.TEXTURE_REPETITION_MODE=0,this.DEBUGMODE=0,this.USE_VERTEX_PULLING=!1,this.VERTEX_PULLING_USE_INDEX_BUFFER=!1,this.VERTEX_PULLING_INDEX_BUFFER_32BITS=!1,this.RIGHT_HANDED=!1,this.CLUSTLIGHT_SLICES=0,this.CLUSTLIGHT_BATCH=0,this.BRDF_V_HEIGHT_CORRELATED=!0,this.MS_BRDF_ENERGY_CONSERVATION=!0,this.SPHERICAL_HARMONICS=!0,this.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION=!0,this.MIX_IBL_RADIANCE_WITH_IRRADIANCE=!0,this.LEGACY_SPECULAR_ENERGY_CONSERVATION=!1,this.BASE_DIFFUSE_MODEL=0,this.DIELECTRIC_SPECULAR_MODEL=1,this.CONDUCTOR_SPECULAR_MODEL=1,this.rebuild()}reset(){super.reset(),this.ALPHATESTVALUE="0.5",this.NORMALXYSCALE=!0}},De=class extends(w(b)){},Pe=class e extends De{get geometryTangentAngle(){return Math.atan2(this.geometryTangent.y,this.geometryTangent.x)}set geometryTangentAngle(e){this.geometryTangent=new G(Math.cos(e),Math.sin(e))}get geometryCoatTangentAngle(){return Math.atan2(this.geometryCoatTangent.y,this.geometryCoatTangent.x)}set geometryCoatTangentAngle(e){this.geometryCoatTangent=new G(Math.cos(e),Math.sin(e))}get sssQuality(){return this._sssQuality}set sssQuality(e){this._sssQuality!==e&&(this._sssQuality=e,this.markAsDirty(1))}get sssIrradianceTexture(){return this._sssIrradianceTexture}set sssIrradianceTexture(e){this._sssIrradianceTexture!==e&&(this._sssIrradianceTexture=e,this._markAllSubMeshesAsTexturesDirty())}get sssDepthTexture(){return this._sssDepthTexture}set sssDepthTexture(e){this._sssDepthTexture!==e&&(this._sssDepthTexture=e,this._markAllSubMeshesAsTexturesDirty())}get hasTransparency(){return this.subsurfaceWeight>0||this.transmissionWeight>0}get hasScattering(){return this.transmissionWeight>0&&this.transmissionDepth>0&&!this.transmissionScatter.equals(P.BlackReadOnly)||this.subsurfaceWeight>0}get usePhysicalLightFalloff(){return this._lightFalloff===n.LIGHTFALLOFF_PHYSICAL}set usePhysicalLightFalloff(e){e!==this.usePhysicalLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?n.LIGHTFALLOFF_PHYSICAL:n.LIGHTFALLOFF_STANDARD)}get useGLTFLightFalloff(){return this._lightFalloff===n.LIGHTFALLOFF_GLTF}set useGLTFLightFalloff(e){e!==this.useGLTFLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?n.LIGHTFALLOFF_GLTF:n.LIGHTFALLOFF_STANDARD)}get backgroundRefractionTexture(){return this._backgroundRefractionTexture}set backgroundRefractionTexture(e){this._backgroundRefractionTexture=e,this._markAllSubMeshesAsTexturesDirty()}get refractionHighQualityBlur(){return this._refractionHighQualityBlur}set refractionHighQualityBlur(e){this._refractionHighQualityBlur!==e&&(this._refractionHighQualityBlur=e,this.markAsDirty(1))}get realTimeFiltering(){return this._realTimeFiltering}set realTimeFiltering(e){this._realTimeFiltering=e,this.markAsDirty(1)}get realTimeFilteringQuality(){return this._realTimeFilteringQuality}set realTimeFilteringQuality(e){this._realTimeFilteringQuality=e,this.markAsDirty(1)}get fuzzSampleNumber(){return this._fuzzSampleNumber}set fuzzSampleNumber(e){this._fuzzSampleNumber=e,this.markAsDirty(1)}get canRenderToMRT(){return!0}constructor(t,s,i=!1){super(t,s,void 0,i||e.ForceGLSL),this._baseWeight=new Me("base_weight",1,"vBaseWeight",1),this._baseWeightTexture=new Oe("base_weight","baseWeight","BASE_WEIGHT"),this._baseColor=new Me("base_color",P.White(),"vBaseColor",4),this._baseColorTexture=new Oe("base_color","baseColor","BASE_COLOR"),this._baseDiffuseRoughness=new Me("base_diffuse_roughness",0,"vBaseDiffuseRoughness",1),this._baseDiffuseRoughnessTexture=new Oe("base_diffuse_roughness","baseDiffuseRoughness","BASE_DIFFUSE_ROUGHNESS"),this._baseMetalness=new Me("base_metalness",0,"vReflectanceInfo",4,0),this._baseMetalnessTexture=new Oe("base_metalness","baseMetalness","BASE_METALNESS"),this._specularWeight=new Me("specular_weight",1,"vReflectanceInfo",4,3),this._specularWeightTexture=new Oe("specular_weight","specularWeight","SPECULAR_WEIGHT"),this._specularColor=new Me("specular_color",P.White(),"vSpecularColor",4),this._specularColorTexture=new Oe("specular_color","specularColor","SPECULAR_COLOR"),this._specularRoughness=new Me("specular_roughness",.3,"vReflectanceInfo",4,1),this._specularRoughnessTexture=new Oe("specular_roughness","specularRoughness","SPECULAR_ROUGHNESS"),this._specularRoughnessAnisotropy=new Me("specular_roughness_anisotropy",0,"vSpecularAnisotropy",3,2),this._specularRoughnessAnisotropyTexture=new Oe("specular_roughness_anisotropy","specularRoughnessAnisotropy","SPECULAR_ROUGHNESS_AN
2ISOTROPY"),this._specularIor=new Me("specular_ior",1.5,"vReflectanceInfo",4,2),this._transmissionWeight=new Me("transmission_weight",0,"vTransmissionWeight",1),this._transmissionWeightTexture=new Oe("transmission_weight","transmissionWeight","TRANSMISSION_WEIGHT"),this._transmissionColor=new Me("transmission_color",P.White(),"vTransmissionColor",3,0),this._transmissionColorTexture=new Oe("transmission_color","transmissionColor","TRANSMISSION_COLOR"),this._transmissionDepth=new Me("transmission_depth",0,"vTransmissionDepth",1,0),this._transmissionDepthTexture=new Oe("transmission_depth","transmissionDepth","TRANSMISSION_DEPTH"),this._transmissionScatter=new Me("transmission_scatter",P.Black(),"vTransmissionScatter",3,0),this._transmissionScatterTexture=new Oe("transmission_scatter","transmissionScatter","TRANSMISSION_SCATTER"),this._transmissionScatterAnisotropy=new Me("transmission_scatter_anisotropy",0,"vTransmissionScatterAnisotropy",1,0),this._transmissionDispersionScale=new Me("transmission_dispersion_scale",0,"vTransmissionDispersionScale",1,0),this._transmissionDispersionScaleTexture=new Oe("transmission_dispersion_scale","transmissionDispersionScale","TRANSMISSION_DISPERSION_SCALE"),this._transmissionDispersionAbbeNumber=new Me("transmission_dispersion_abbe_number",20,"vTransmissionDispersionAbbeNumber",1,0),this._subsurfaceWeight=new Me("subsurface_weight",0,"vSubsurfaceWeight",1,0,"SUBSURFACE_SLAB"),this._subsurfaceWeightTexture=new Oe("subsurface_weight","subsurfaceWeight","SUBSURFACE_WEIGHT"),this._subsurfaceColor=new Me("subsurface_color",new P(.8,.8,.8),"vSubsurfaceColor",3,0,"SUBSURFACE_SLAB"),this._subsurfaceColorTexture=new Oe("subsurface_color","subsurfaceColor","SUBSURFACE_COLOR"),this._subsurfaceRadius=new Me("subsurface_radius",.1,"vSubsurfaceRadius",1,0,"SUBSURFACE_SLAB"),this._subsurfaceRadiusScale=new Me("subsurface_radius_scale",new P(1,.5,.25),"vSubsurfaceRadiusScale",3,0,"SUBSURFACE_SLAB"),this._subsurfaceRadiusScaleTexture=new Oe("subsurface_radius_scale","subsurfaceRadiusScale","SUBSURFACE_RADIUS_SCALE"),this._subsurfaceScatterAnisotropy=new Me("subsurface_scatter_anisotropy",0,"vSubsurfaceScatterAnisotropy",1,0,"SUBSURFACE_SLAB"),this._coatWeight=new Me("coat_weight",0,"vCoatWeight",1,0),this._coatWeightTexture=new Oe("coat_weight","coatWeight","COAT_WEIGHT"),this._coatColor=new Me("coat_color",P.White(),"vCoatColor",3,0),this._coatColorTexture=new Oe("coat_color","coatColor","COAT_COLOR"),this._coatRoughness=new Me("coat_roughness",0,"vCoatRoughness",1,0),this._coatRoughnessTexture=new Oe("coat_roughness","coatRoughness","COAT_ROUGHNESS"),this._coatRoughnessAnisotropy=new Me("coat_roughness_anisotropy",0,"vCoatRoughnessAnisotropy",1),this._coatRoughnessAnisotropyTexture=new Oe("coat_roughness_anisotropy","coatRoughnessAnisotropy","COAT_ROUGHNESS_ANISOTROPY"),this._coatIor=new Me("coat_ior",1.5,"vCoatIor",1,0),this._coatDarkening=new Me("coat_darkening",1,"vCoatDarkening",1,0),this._coatDarkeningTexture=new Oe("coat_darkening","coatDarkening","COAT_DARKENING"),this.useCoatRoughnessFromWeightTexture=!1,this._fuzzWeight=new Me("fuzz_weight",0,"vFuzzWeight",1,0),this._fuzzWeightTexture=new Oe("fuzz_weight","fuzzWeight","FUZZ_WEIGHT"),this._fuzzColor=new Me("fuzz_color",P.White(),"vFuzzColor",3,0),this._fuzzColorTexture=new Oe("fuzz_color","fuzzColor","FUZZ_COLOR"),this._fuzzRoughness=new Me("fuzz_roughness",.5,"vFuzzRoughness",1,0),this._fuzzRoughnessTexture=new Oe("fuzz_roughness","fuzzRoughness","FUZZ_ROUGHNESS"),this._geometryThinWalled=new Me("geometry_thin_walled",0,"vGeometryThinWalled",1,0),this._geometryNormalTexture=new Oe("geometry_normal","geometryNormal","GEOMETRY_NORMAL"),this._geometryTangent=new Me("geometry_tangent",new G(1,0),"vSpecularAnisotropy",3,0),this._geometryTangentTexture=new Oe("geometry_tangent","geometryTangent","GEOMETRY_TANGENT"),this._geometryCoatNormalTexture=new Oe("geometry_coat_normal","geometryCoatNormal","GEOMETRY_COAT_NORMAL"),this._geometryCoatTangent=new Me("geometry_coat_tangent",new G(1,0),"vGeometryCoatTangent",2,0),this._geometryCoatTangentTexture=new Oe("geometry_coat_tangent","geometryCoatTangent","GEOMETRY_COAT_TANGENT"),this._geometryOpacity=new Me("geometry_opacity",1,"vBaseColor",4,3),this._geometryOpacityTexture=new Oe("geometry_opacity","geometryOpacity","GEOMETRY_OPACITY"),this._geometryThickness=new Me("geometry_thickness",0,"vGeometryThickness",1,0),this._geometryThicknessTexture=new Oe("geometry_thickness","geometryThickness","GEOMETRY_THICKNESS"),this._emissionLuminance=new Me("emission_luminance",1,"vLightingIntensity",4,1),this._emissionColor=new Me("emission_color",P.Black(),"vEmissionColor",3),this._emissionColorTexture=new Oe("emission_color","emissionColor","EMISSION_COLOR"),this._thinFilmWeight=new Me("thin_film_weight",0,"vThinFilmWeight",1,0),this._thinFilmWeightTexture=new Oe("thin_film_weight","thinFilmWeight","THIN_FILM_WEIGHT"),this._thinFilmThickness=new Me("thin_film_thickness",.5,"vThinFilmThickness",2,0),this._thinFilmThicknessMin=new Me("thin_film_thickness_min",0,"vThinFilmThickness",2,1),this._thinFilmThicknessTexture=new Oe("thin_film_thickness","thinFilmThickness","THIN_FILM_THICKNESS"),this._thinFilmIor=new Me("thin_film_ior",1.4,"vThinFilmIor",1,0),this._ambientOcclusionTexture=new Oe("ambient_occlusion","ambientOcclusion","AMBIENT_OCCLUSION"),this._sssQuality=e.SSS_QUALITY_MEDIUM,this._sssIrradianceTexture=null,this._sssDepthTexture=null,this._uniformsList={},this._uniformsArray=[],this._samplersList={},this._samplerDefines={},this.directIntensity=1,this.environmentIntensity=1,this.useSpecularWeightFromTextureAlpha=!1,this.forceAlphaTest=!1,this.alphaCutOff=.4,this.useAmbientOcclusionFromMetallicTextureRed=!1,this.useAmbientInGrayScale=!1,this.useObjectSpaceNormalMap=!1,this.useParallax=!1,this.useParallaxOcclusion=!1,this.parallaxScaleBias=.05,this.disableLighting=!1,this.forceIrradianceInFragment=!1,this.maxSimultaneousLights=4,this.invertNormalMapX=!1,this.invertNormalMapY=!1,this.twoSidedLighting=!1,this.useAlphaFresnel=!1,this.useLinearAlphaFresnel=!1,this.environmentBRDFTexture=null,this.forceNormalForward=!1,this.enableSpecularAntiAliasing=!1,this.useHorizonOcclusion=!0,this.useRadianceOcclusion=!0,this.unlit=!1,this.applyDecalMapAfterDetailMap=!1,this._lightingInfos=new fe(this.directIntensity,1,this.environmentIntensity,1),this._radianceTexture=null,this._useSpecularWeightFromAlpha=!1,this._useSpecularWeightFromSpecularColorTexture=!1,this._useSpecularRoughnessAnisotropyFromTangentTexture=!1,this._useCoatRoughnessAnisotropyFromTangentTexture=!1,this._useCoatRoughnessFromGreenChannel=!1,this._useGltfStyleAnisotropy=!1,this._useFuzzRoughnessFromTextureAlpha=!1,this._useSubsurfaceWeightFromTextureAlpha=!1,this._useHorizonOcclusion=!0,this._useRadianceOcclusion=!0,this._useAlphaFromBaseColorTexture=!1,this._useAmbientOcclusionFromMetallicTextureRed=!1,this._useRoughnessFromMetallicTextureGreen=!1,this._useMetallicFromMetallicTextureBlue=!1,this._useThinFilmThicknessFromTextureGreen=!1,this._useGeometryThicknessFromGreenChannel=!1,this._lightFalloff=n.LIGHTFALLOFF_PHYSICAL,this._useObjectSpaceNormalMap=!1,this._useParallax=!1,this._useParallaxOcclusion=!1,this._parallaxScaleBias=.05,this._disableLighting=!1,this._maxSimultaneousLights=4,this._invertNormalMapX=!1,this._invertNormalMapY=!1,this._twoSidedLighting=!1,this._alphaCutOff=.4,this._useAlphaFresnel=!1,this._useLinearAlphaFresnel=!1,this._environmentBRDFTexture=null,this._environmentFuzzBRDFTexture=null,this._backgroundRefractionTexture=null,this._refractionHighQualityBlur=!0,this._forceIrradianceInFragment=!1,this._realTimeFiltering=!1,this._realTimeFilteringQuality=8,this._fuzzSampleNumber=4,this._forceNormalForward=!1,this._enableSpecularAntiAliasing=!1,this._renderTargets=new Y(16),this._unlit=!1,this._applyDecalMapAfterDetailMap=!1,this._debugMode=0,this._shadersLoaded=!1,this._breakShaderLoadedCheck=!1,this._vertexPullingMetadata=null,this.debugMode=0,this.debugLimit=-1,this.debugFactor=1,this._cacheHasRenderTargetTextures=!1,this._transparencyMode=n.MATERIAL_OPAQUE,this.get
vendor: 9,489 bytes, line 2
2Scene()&&!this.getScene()?.getEngine().isWebGPU&&this.getScene().getEngine().webGLVersion<2&&a.Error("OpenPBRMaterial: WebGL 2.0 or above is required for this material."),e._noiseTextures[this.getScene().uniqueId]||(e._noiseTextures[this.getScene().uniqueId]=new J(ne.GetAssetUrl("https://assets.babylonjs.com/core/blue_noise/blue_noise_rgb.png"),this.getScene(),!1,!0,1),this.getScene().onDisposeObservable.addOnce(()=>{e._noiseTextures[this.getScene().uniqueId]?.dispose(),delete e._noiseTextures[this.getScene().uniqueId]})),this._attachImageProcessingConfiguration(null),this.getRenderTargetTextures=()=>(this._renderTargets.reset(),ae.ReflectionTextureEnabled&&this._radianceTexture&&this._radianceTexture.isRenderTarget&&this._renderTargets.push(this._radianceTexture),ae.RefractionTextureEnabled&&this._backgroundRefractionTexture&&this._backgroundRefractionTexture.isRenderTarget&&this._renderTargets.push(this._backgroundRefractionTexture),this._eventInfo.renderTargets=this._renderTargets,this._callbackPluginEventFillRenderTargetTextures(this._eventInfo),this._renderTargets),this._environmentBRDFTexture=x(this.getScene()),this._environmentFuzzBRDFTexture=ge(this.getScene()),this.prePassConfiguration=new E,this._propertyList={};for(const e of Object.getOwnPropertyNames(this)){const t=this[e];t instanceof Me&&(this._propertyList[e]=t)}Object.keys(this._propertyList).forEach(e=>{const t=this._propertyList[e];let s=this._uniformsList[t.targetUniformName];s?s.numComponents!==t.targetUniformComponentNum?a.Error(`Uniform ${t.targetUniformName} already exists of size ${s.numComponents}, but trying to set it to ${t.targetUniformComponentNum}.`):s.requiredDefine!==t.requiredDefine&&(s.requiredDefine=void 0):(s=new Le(t.targetUniformName,t.targetUniformComponentNum),s.requiredDefine=t.requiredDefine,this._uniformsList[t.targetUniformName]=s),""===s.firstLinkedKey&&(s.firstLinkedKey=t.name),s.linkedProperties[t.name]=t}),this._uniformsArray=Object.values(this._uniformsList),this._samplersList={};for(const e of Object.getOwnPropertyNames(this)){const t=this[e];t instanceof Oe&&(this._samplersList[e]=t)}for(const e in this._samplersList){const t=this._samplersList[e].textureDefine;this._samplerDefines[t]={type:"boolean",default:!1},this._samplerDefines[t+"DIRECTUV"]={type:"number",default:0},this._samplerDefines[t+"_GAMMA"]={type:"boolean",default:!1}}this._baseWeight,this._baseWeightTexture,this._baseColor,this._baseColorTexture,this._baseDiffuseRoughness,this._baseDiffuseRoughnessTexture,this._baseMetalness,this._baseMetalnessTexture,this._specularWeight,this._specularWeightTexture,this._specularColor,this._specularColorTexture,this._specularRoughness,this._specularIor,this._specularRoughnessTexture,this._specularRoughnessAnisotropy,this._specularRoughnessAnisotropyTexture,this._transmissionWeight,this._transmissionWeightTexture,this._transmissionColor,this._transmissionColorTexture,this._transmissionDepth,this._transmissionDepthTexture,this._transmissionScatter,this._transmissionScatterTexture,this._transmissionScatterAnisotropy,this._transmissionDispersionScale,this._transmissionDispersionScaleTexture,this._transmissionDispersionAbbeNumber,this._subsurfaceWeight,this._subsurfaceWeightTexture,this._subsurfaceColor,this._subsurfaceColorTexture,this._subsurfaceRadius,this._subsurfaceRadiusScale,this._subsurfaceRadiusScaleTexture,this._subsurfaceScatterAnisotropy,this._coatWeight,this._coatWeightTexture,this._coatColor,this._coatColorTexture,this._coatRoughness,this._coatRoughnessTexture,this._coatRoughnessAnisotropy,this._coatRoughnessAnisotropyTexture,this._coatIor,this._coatDarkening,this._coatDarkeningTexture,this._fuzzWeight,this._fuzzWeightTexture,this._fuzzColor,this._fuzzColorTexture,this._fuzzRoughness,this._fuzzRoughnessTexture,this._geometryThinWalled,this._geometryNormalTexture,this._geometryTangent,this._geometryTangentTexture,this._geometryCoatNormalTexture,this._geometryCoatTangent,this._geometryCoatTangentTexture,this._geometryOpacity,this._geometryOpacityTexture,this._geometryThickness,this._geometryThicknessTexture,this._thinFilmWeight,this._thinFilmWeightTexture,this._thinFilmThickness,this._thinFilmThicknessMin,this._thinFilmThicknessTexture,this._thinFilmIor,this._emissionLuminance,this._emissionColor,this._emissionColorTexture,this._ambientOcclusionTexture}get hasRenderTargetTextures(){return!!(ae.ReflectionTextureEnabled&&this._radianceTexture&&this._radianceTexture.isRenderTarget)||!!(ae.RefractionTextureEnabled&&this._backgroundRefractionTexture&&this._backgroundRefractionTexture.isRenderTarget)||this._cacheHasRenderTargetTextures}get isPrePassCapable(){return!this.disableDepthWrite}getClassName(){return"OpenPBRMaterial"}get transparencyMode(){return this._transparencyMode}set transparencyMode(e){this._transparencyMode!==e&&(this._transparencyMode=e,this._markAllSubMeshesAsTexturesAndMiscDirty())}_shouldUseAlphaFromBaseColorTexture(){return this._hasAlphaChannel()&&this._transparencyMode!==n.MATERIAL_OPAQUE&&!this.geometryOpacityTexture}_hasAlphaChannel(){return null!=this.baseColorTexture&&this.baseColorTexture.hasAlpha&&this._useAlphaFromBaseColorTexture||null!=this.geometryOpacityTexture}clone(t,s=!0,i=""){const r=v.Clone(()=>new e(t,this.getScene()),this,{cloneTexturesOnlyOnce:s});return r.id=t,r.name=t,this.stencil.copyTo(r.stencil),this._clonePlugins(r,i),r}serialize(){const e=super.serialize();return e.customType="BABYLON.OpenPBRMaterial",e}static Parse(t,s,i){const r=v.Parse(()=>new e(t.name,s),t,s,i);return t.stencil&&r.stencil.parse(t.stencil,s,i),n._ParsePlugins(t,r,s,i),r}forceCompilation(e,t,s){const i={clipPlane:!1,useInstances:!1,...s};this._uniformBufferLayoutBuilt||this.buildUniformLayout(),this._callbackPluginEventGeneric(4,this._eventInfo),(()=>{if(this._breakShaderLoadedCheck)return;const s=new Fe({...this._eventInfo.defineNames||{},...this._samplerDefines||{}}),r=this._prepareEffect(e,e,s,void 0,void 0,i.useInstances,i.clipPlane);this._onEffectCreatedObservable&&(Ce.effect=r,Ce.subMesh=null,this._onEffectCreatedObservable.notifyObservers(Ce)),r.isReady()?t&&t(this):r.onCompileObservable.add(()=>{t&&t(this)})})()}isReadyForSubMesh(t,s,i){this._uniformBufferLayoutBuilt||this.buildUniformLayout();const r=s._drawWrapper;if(r.effect&&this.isFrozen&&r._wasPreviouslyReady&&r._wasPreviouslyUsingInstances===i)return!0;s.materialDefines||(this._callbackPluginEventGeneric(4,this._eventInfo),s.materialDefines=new Fe({...this._eventInfo.defineNames||{},...this._samplerDefines||{}}));const n=s.materialDefines;if(this._isReadyForSubMesh(s))return!0;const o=this.getScene(),u=o.getEngine();if(n._areTexturesDirty&&(this._eventInfo.hasRenderTargetTextures=!1,this._callbackPluginEventHasRenderTargetTextures(this._eventInfo),this._cacheHasRenderTargetTextures=this._eventInfo.hasRenderTargetTextures,o.texturesEnabled)){for(const e in this._samplersList){const t=this._samplersList[e];if(t.value&&!t.value.isReadyOrNotBlocking())return!1}const t=this._getRadianceTexture();if(t&&ae.ReflectionTextureEnabled){if(!t.isReadyOrNotBlocking())return!1;if(t.irradianceTexture){if(!t.irradianceTexture.isReadyOrNotBlocking())return!1}else if(!t.sphericalPolynomial&&t.getInternalTexture()?._sphericalPolynomialPromise)return!1}if(this._environmentBRDFTexture&&ae.ReflectionTextureEnabled&&!this._environmentBRDFTexture.isReady())return!1;if(this._environmentFuzzBRDFTexture&&ae.ReflectionTextureEnabled&&!this._environmentFuzzBRDFTexture.isReady())return!1;if(this._backgroundRefractionTexture&&ae.RefractionTextureEnabled&&!this._backgroundRefractionTexture.isReadyOrNotBlocking())return!1;if(e._noiseTextures[o.uniqueId]&&!e._noiseTextures[o.uniqueId].isReady())return!1;if(this._sssIrradianceTexture&&this._sssDepthTexture){if(!this._sssIrradianceTexture.isReady())return!1;if(!this._sssDepthTexture.isReady())return!1}}if(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=n,this._eventInfo.subMesh=s,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),!this._eventInfo.isReadyForSubMesh)return!1;if(n._areImageProcessingDirty&&this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.isReady())return!1;if(n.AREALIGHTUSED)for(let e=0;e<t.lightSources.length;e++)if(!t.lightSources[e]._isReady())return!1;if(u.getCaps().standardDerivatives||t.isVerticesDataPresent(_.NormalKind)||(t.createNormals(!0),a.Warn("OpenPBRMaterial: Normals have been created for the mesh: "+t.name)),!M(o,t,this._maxSimultaneousLights,this._disableLighting))return!1;const h=s.effect,l=n._areLightsDisposed,c=this._prepareEffect(t,s.getRenderingMesh(),n,this.onCompiled,this.onError,i,null);let T=!1;if(c)if(this._onEffectCreatedObservable&&(Ce.effect=c,Ce.subMesh=s,this._onEffectCreatedObservable.notifyObservers(Ce)),this.allowShaderHotSwapping&&h&&!c.isReady()){if(n.markAsUnprocessed(),T=this.isFrozen,l)return n._areLightsDisposed=!0,!1}else o.resetCachedMaterial(),s.setEffect(c,n,this._materialContext);return!(!s.effect||!s.effect.isReady()||(n._renderId=o.getRenderId(),r._wasPreviouslyReady=!T,r._wasPreviouslyUsingInstances=!!i,this._checkScenePerformancePriority(),0))}buildUniformLayout(){const e=this._uniformBuffer;e.addUniform("vTangentSpaceParams",2),e.addUniform("vLightingIntensity",4),e.addUniform("pointSize",1),e.addUniform("vDebugMode",2),e.addUniform("renderTargetSize",2),e.addUniform("cameraInfo",4),e.addUniform("vTextureRepetitionHexTilingParams",4),e.addUniform("backgroundRefractionMatrix",16),e.addUniform("vBackgroun
2dRefractionInfos",3),me(e,!0,!0,!0,!0,!0),Object.values(this._uniformsList).forEach(t=>{e.addUniform(t.name,t.numComponents)}),Object.values(this._samplersList).forEach(t=>{e.addUniform(t.samplerInfoName,2),e.addUniform(t.samplerMatrixName,16)}),super.buildUniformLayout()}bindPropertiesForSubMesh(e,t,s,i){if(0===this.geometryThickness)e.updateFloat("vGeometryThickness",0);else{i.getRenderingMesh().getWorldMatrix().decompose(le.Vector3[0]);const t=Math.max(Math.abs(le.Vector3[0].x),Math.abs(le.Vector3[0].y),Math.abs(le.Vector3[0].z));e.updateFloat("vGeometryThickness",this.geometryThickness*t)}}bindForSubMesh(t,s,i){const r=this.getScene(),n=i.materialDefines;if(!n)return;const a=i.effect;if(!a)return;this._activeEffect=a,s.getMeshUniformBuffer().bindToEffect(a,"Mesh"),s.transferToEffect(t);const o=r.getEngine();this._uniformBuffer.bindToEffect(a,"Material"),this.prePassConfiguration.bindForSubMesh(this._activeEffect,r,s,t,this.isFrozen),B.Bind(o.currentRenderPassId,this._activeEffect,s,t,this);const u=r.activeCamera;u?this._uniformBuffer.updateFloat4("cameraInfo",u.minZ,u.maxZ,0,0):this._uniformBuffer.updateFloat4("cameraInfo",0,0,0,0);const h=this.textureRepetitionHexTilingParams;this._uniformBuffer.updateFloat4("vTextureRepetitionHexTilingParams",h[0],h[1],h[2],h[3]),this._eventInfo.subMesh=i,this._callbackPluginEventHardBindForSubMesh(this._eventInfo),n.OBJECTSPACE_NORMALMAP&&(t.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));const c=this._mustRebind(r,a,i,s.visibility),_=o._features.needToAlwaysBindUniformBuffers;T(s,this._activeEffect,this.prePassConfiguration),this._vertexPullingMetadata&&Re(this._activeEffect,this._vertexPullingMetadata);const p=this._uniformBuffer;if(c){this.bindViewProjection(a);const t=this._getRadianceTexture();if(!p.useUbo||!this.isFrozen||!p.isSync||i._drawWrapper._forceRebindOnNextCall){if(r.texturesEnabled){for(const e in this._samplersList){const t=this._samplersList[e];t.value&&(p.updateFloat2(t.samplerInfoName,t.value.coordinatesIndex,t.value.level),D(t.value,p,t.samplerPrefix))}(this.geometryNormalTexture||this.geometryCoatNormalTexture)&&(r._mirroredCameraPosition?p.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):p.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1)),O(r,n,p,P.White(),t,this.realTimeFiltering,!0,!0,!0,!0,!0)}this.pointsCloud&&p.updateFloat("pointSize",this.pointSize);const e=this._uniformsArray;for(let t=0,s=e.length;t<s;t++){const s=e[t];(void 0===s.requiredDefine||n[s.requiredDefine])&&(4===s.numComponents?(s.populateVectorFromLinkedProperties(le.Vector4[0]),p.updateVector4(s.name,le.Vector4[0])):3===s.numComponents?(s.populateVectorFromLinkedProperties(le.Vector3[0]),p.updateVector3(s.name,le.Vector3[0])):2===s.numComponents?(s.populateVectorFromLinkedProperties(le.Vector2[0]),p.updateFloat2(s.name,le.Vector2[0].x,le.Vector2[0].y)):1===s.numComponents&&p.updateFloat(s.name,s.linkedProperties[s.firstLinkedKey].value))}this._lightingInfos.x=this.directIntensity,this._lightingInfos.y=this.emissionLuminance,this._lightingInfos.z=this.environmentIntensity*r.environmentIntensity,this._lightingInfos.w=1,p.updateVector4("vLightingIntensity",this._lightingInfos),p.updateFloat2("vDebugMode",this.debugLimit,this.debugFactor)}if(r.texturesEnabled){for(const e in this._samplersList){const t=this._samplersList[e];t.value&&p.setTexture(t.samplerName,t.value)}if(l(r,n,p,t,this.realTimeFiltering),n.ENVIRONMENTBRDF&&p.setTexture("environmentBrdfSampler",this._environmentBRDFTexture),n.FUZZENVIRONMENTBRDF&&p.setTexture("environmentFuzzBrdfSampler",this._environmentFuzzBRDFTexture),n.REFRACTED_BACKGROUND&&(p.setTexture("backgroundRefractionSampler",this._backgroundRefractionTexture),p.updateMatrix("backgroundRefractionMatrix",this._backgroundRefractionTexture.getReflectionTextureMatrix()),le.Vector3[1].set(Math.log2(this._backgroundRefractionTexture.getSize().width),0,0),p.updateVector3("vBackgroun
2dRefractionInfos",le.Vector3[1])),(n.ANISOTROPIC||n.FUZZ||n.REFRACTED_BACKGROUND||n.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING)&&p.setTexture("blueNoiseSampler",e._noiseTextures[this.getScene().uniqueId]),n.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING&&this.sssIrradianceTexture&&this.sssDepthTexture){const e=this.sssIrradianceTexture.getSize().width,t=this.sssIrradianceTexture.getSize().height;p.setTexture("sceneIrradianceSampler",this.sssIrradianceTexture),p.setTexture("sceneDepthSampler",this.sssDepthTexture),p.updateFloat2("renderTargetSize",e,t)}}this.getScene().useOrderIndependentTransparency&&this.needAlphaBlendingForMesh(s)&&this.getScene().depthPeelingRenderer.bind(a),this._eventInfo.subMesh=i,this._callbackPluginEventBindForSubMesh(this._eventInfo),Q(this._activeEffect,this,r),this.bindEyePosition(a)}else _&&(this._needToBindSceneUbo=!0);this.bindPropertiesForSubMesh(this._uniformBuffer,r,r.getEngine(),i),!c&&this.isFrozen&&!_||!r.lightsEnabled||this._disableLighting||m(r,s,this._activeEffect,n,this._maxSimultaneousLights),!c&&this.isFrozen||(this.bindView(a),C(r,s,this._activeEffect,!0),n.NUM_MORPH_INFLUENCERS&&f(s,this._activeEffect),n.BAKED_VERTEX_ANIMATION_TEXTURE&&s.bakedVertexAnimationManager?.bind(a,n.INSTANCES),this._imageProcessingConfiguration.bind(this._activeEffect),oe(n,this._activeEffect,r)),this._afterBind(s,this._activeEffect,i),p.update()}getAnimatables(){const e=super.getAnimatables();for(const t in this._samplersList){const s=this._samplersList[t];s.value&&s.value.animations&&s.value.animations.length>0&&e.push(s.value)}return this._radianceTexture&&this._radianceTexture.animations&&this._radianceTexture.animations.length>0&&e.push(this._radianceTexture),e}getActiveTextures(){const e=super.getActiveTextures();for(const t in this._samplersList){const s=this._samplersList[t];s.value&&e.push(s.value)}return this._radianceTexture&&e.push(this._radianceTexture),e}hasTexture(e){if(super.hasTexture(e))return!0;for(const t in this._samplersList)if(this._samplersList[t].value===e)return!0;return this._radianceTexture===e}setPrePassRenderer(){return!1}dispose(e,t){if(this._breakShaderLoadedCheck=!0,t){this._environmentBRDFTexture&&this.getScene().openPBREnvironmentBRDFTexture!==this._environmentBRDFTexture&&this._environmentBRDFTexture.dispose(),this._environmentFuzzBRDFTexture&&this.getScene().environmentFuzzBRDFTexture!==this._environmentFuzzBRDFTexture&&this._environmentFuzzBRDFTexture.dispose(),this._backgroundRefractionTexture=null;for(const e in this._samplersList)this._samplersList[e].value?.dispose();this._radianceTexture?.dispose()}this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),super.dispose(e,t)}_getRadianceTexture(){return this._radianceTexture?this._radianceTexture:this.getScene().environmentTexture}_prepareEffect(e,t,r,n=null,a=null,o=null,u=null){if(this._prepareDefines(e,t,r,o,u),!r.isDirty)return null;r.markAsProcessed();const h=this.getScene().getEngine(),l=new de;let c=0;r.USESPHERICALINVERTEX&&l.addFallback(c++,"USESPHERICALINVERTEX"),r.FOG&&l.addFallback(c,"FOG"),r.SPECULARAA&&l.addFallback(c,"SPECULARAA"),r.POINTSIZE&&l.addFallback(c,"POINTSIZE"),r.LOGARITHMICDEPTH&&l.addFallback(c,"LOGARITHMICDEPTH"),r.PARALLAX&&l.addFallback(c,"PARALLAX"),r.PARALLAX_RHS&&l.addFallback(c,"PARALLAX_RHS"),r.PARALLAXOCCLUSION&&l.addFallback(c++,"PARALLAXOCCLUSION"),r.ENVIRONMENTBRDF&&l.addFallback(c++,"ENVIRONMENTBRDF"),r.TANGENT&&l.addFallback(c++,"TANGENT"),c=N(r,l,this._maxSimultaneousLights,c),r.SPECULARTERM&&l.addFallback(c++,"SPECULARTERM"),r.USESPHERICALFROMREFLECTIONMAP&&l.addFallback(c++,"USESPHERICALFROMREFLECTIONMAP"),r.USEIRRADIANCEMAP&&l.addFallback(c++,"USEIRRADIANCEMAP"),r.NORMAL&&l.addFallback(c++,"NORMAL"),r.VERTEXCOLOR&&l.addFallback(c++,"VERTEXCOLOR"),r.MORPHTARGETS&&l.addFallback(c++,"MORPHTARGETS"),r.MULTIVIEW&&l.addFallback(0,"MULTIVIEW");const T=[_.PositionKind];r.NORMAL&&T.push(_.NormalKind),r.TANGENT&&T.push(_.TangentKind);for(let s=1;s<=6;++s)r["UV"+s]&&T.push(`uv${1===s?"":s}`);r.VERTEXCOLOR&&T.push(_.ColorKind),y(T,e,r,l),s(T,r),X(T,e,r),U(T,e,r);let p="openpbr";const f=["world","view","viewProjection","projection","vEyePosition","inverseProjection","renderTargetSize","vLightsType","visibility","vFogInfos","vFogColor","pointSize","mBones","normalMatrix","vLightingIntensity","logarithmicDepthConstant","vTangentSpaceParams","boneTextureInfo","vDebugMode","morphTargetTextureInfo","morphTargetTextureIndices","cameraInfo","vTextureRepetitionHexTilingParams","backgroundRefractionMatrix","vBackgroun
2dRefractionInfos"];for(const s in this._uniformsList)f.push(s);const m=["environmentBrdfSampler","boneSampler","morphTargets","oitDepthSampler","oitFrontColorSampler","areaLightsLTC1Sampler","areaLightsLTC2Sampler"];r.FUZZENVIRONMENTBRDF&&m.push("environmentFuzzBrdfSampler"),r.REFRACTED_BACKGROUND&&m.push("backgroundRefractionSampler"),(r.ANISOTROPIC||r.FUZZ||r.REFRACTED_BACKGROUND||r.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING)&&m.push("blueNoiseSampler"),r.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING&&(m.push("sceneIrradianceSampler"),m.push("sceneDepthSampler"));for(const s in this._samplersList){const e=this._samplersList[s];m.push(e.samplerName),f.push(e.samplerInfoName),f.push(e.samplerMatrixName)}W(f,m,!0);const A=["Material","Scene","Mesh"],d={maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:r.NUM_MORPH_INFLUENCERS};if(this._eventInfo.fallbacks=l,this._eventInfo.fallbackRank=c,this._eventInfo.defines=r,this._eventInfo.uniforms=f,this._eventInfo.attributes=T,this._eventInfo.samplers=m,this._eventInfo.uniformBuffersNames=A,this._eventInfo.customCode=void 0,this._eventInfo.mesh=e,this._eventInfo.indexParameters=d,this._callbackPluginEventGeneric(128,this._eventInfo),B.AddUniformsAndSamplers(f,m),E.AddUniforms(f),E.AddSamplers(m),te(f),this._useVertexPulling){const e=t?.geometry;e&&(this._vertexPullingMetadata=I(e),this._vertexPullingMetadata&&this._vertexPullingMetadata.forEach((e,t)=>{f.push(`vp_${t}_info`)}))}else this._vertexPullingMetadata=null;F&&(F.PrepareUniforms(f,r),F.PrepareSamplers(m,r)),Z({uniformsNames:f,uniformBuffersNames:A,samplers:m,defines:r,maxSimultaneousLights:this._maxSimultaneousLights,shaderLanguage:this._shaderLanguage});const g={};this.customShaderNameResolve&&(p=this.customShaderNameResolve(p,f,A,m,r,T,g));const R=r.toString(),S=h.createEffect(p,{attributes:T,uniformsNames:f,uniformBuffersNames:A,samplers:m,defines:R,fallbacks:l,onCompiled:n,onError:a,indexParameters:d,processFinalCode:g.processFinalCode,processCodeAfterIncludes:this._eventInfo.customCode,multiTarget:r.PREPASS,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:async()=>{1===this.shaderLanguage?await Promise.all([i(()=>import("./babylon-shaders-wgsl-BeT4-5_R.js").then(e=>e.d),__vite__mapDeps([0,1,2])),i(()=>import("./babylon-shaders-wgsl-BeT4-5_R.js").then(e=>e.f),__vite__mapDeps([0,1,2]))]):await Promise.all([i(()=>import("./babylon-shaders-glsl-950gQ6aI.js").then(e=>e.d),__vite__mapDeps([3,1,2])),i(()=>import("./babylon-shaders-glsl-950gQ6aI.js").then(e=>e.f),__vite__mapDeps([3,1,2]))]),this._shadersLoaded=!0}},h);return this._eventInfo.customCode=void 0,S}_prepareDefines(t,s,i,r=null,a=null){const o=s.hasThinInstances,u=this.getScene(),h=u.getEngine();q(u,t,i,!0,this._maxSimultaneousLights,this._disableLighting),i._needNormals=!0,ce(u,i);const l=this.needAlphaBlendingForMesh(t)&&this.getScene().useOrderIndependentTransparency;if(ee(u,i,this.canRenderToMRT&&!l),H(u,i,l),B.PrepareDefines(h.currentRenderPassId,t,i),i._areTexturesDirty){i._needUVs=!1;for(let e=1;e<=6;++e)i["MAINUV"+e]=!1;if(u.texturesEnabled){for(const s in this._samplersList){const e=this._samplersList[s];e.value?(k(e.value,i,e.textureDefine),i[e.textureDefine+"_GAMMA"]=e.value.gammaSpace):i[e.textureDefine]=!1}const e=this._getRadianceTexture(),t=this._forceIrradianceInFragment||this.realTimeFiltering||this._twoSidedLighting||h.getCaps().maxVaryingVectors<=8||null!=this._baseDiffuseRoughnessTexture;if(ue(u,e,i,this.realTimeFiltering,this.realTimeFilteringQuality,!t),this._baseMetalnessTexture&&(i.AOSTOREINMETALMAPRED=this._useAmbientOcclusionFromMetallicTextureRed),i.SPECULAR_WEIGHT_IN_ALPHA=this._useSpecularWeightFromAlpha,i.SPECULAR_WEIGHT_FROM_SPECULAR_COLOR_TEXTURE=this._useSpecularWeightFromSpecularColorTexture,i.SPECULAR_ROUGHNESS_ANISOTROPY_FROM_TANGENT_TEXTURE=this._useSpecularRoughnessAnisotropyFromTangentTexture,i.COAT_ROUGHNESS_ANISOTROPY_FROM_TANGENT_TEXTURE=this._useCoatRoughnessAnisotropyFromTangentTexture,i.COAT_ROUGHNESS_FROM_GREEN_CHANNEL=this._useCoatRoughnessFromGreenChannel,i.SPECULAR_ROUGHNESS_FROM_METALNESS_TEXTURE_GREEN=this._useRoughnessFromMetallicTextureGreen,i.FUZZ_ROUGHNESS_FROM_TEXTURE_ALPHA=this._useFuzzRoughnessFromTextureAlpha,i.SUBSURFACE_WEIGHT_FROM_TEXTURE_ALPHA=this._useSubsurfaceWeightFromTextureAlpha,i.BASE_METALNESS_FROM_METALNESS_TEXTURE_BLUE=this._useMetallicFromMetallicTextureBlue,i.THIN_FILM_THICKNESS_FROM_THIN_FILM_TEXTURE=this._useThinFilmThicknessFromTextureGreen,i.GEOMETRY_THICKNESS_FROM_GREEN_CHANNEL=this._useGeometryThicknessFromGreenChannel,this.geometryNormalTexture?(this._useParallax&&this.baseColorTexture&&ae.DiffuseTextureEnabled?(i.PARALLAX=!0,i.PARALLAX_RHS=u.useRightHandedSystem,i.PARALLAXOCCLUSION=!!this._useParallaxOcclusion):i.PARALLAX=!1,i.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap):(i.PARALLAX=!1,i.PARALLAX_RHS=!1,i.PARALLAXOCCLUSION=!1,i.OBJECTSPACE_NORMALMAP=!1),this._environmentBRDFTexture&&ae.ReflectionTextureEnabled?(i.ENVIRONMENTBRDF=!0,i.ENVIRONMENTBRDF_RGBD=this._environmentBRDFTexture.isRGBD):(i.ENVIRONMENTBRDF=!1,i.ENVIRONMENTBRDF_RGBD=!1),this._environmentFuzzBRDFTexture?i.FUZZENVIRONMENTBRDF=!0:i.FUZZENVIRONMENTBRDF=!1,this.hasTransparency){i.REFRACTED_BACKGROUND=!!this._backgroundRefractionTexture&&ae.RefractionTextureEnabled,i.REFRACTION_HIGH_QUALITY_BLUR=this._refractionHighQualityBlur,i.REFRACTED_LIGHTS=!0;const e=this._getRadianceTexture();e?(i.REFRACTED_ENVIRONMENT=ae.RefractionTextureEnabled,i.REFRACTED_ENVIRONMENT_OPPOSITEZ=this.getScene().useRightHandedSystem?!e.invertZ:e.invertZ,i.REFRACTED_ENVIRONMENT_LOCAL_CUBE=e.isCube&&e.boundingBoxSize):i.REFRACTED_ENVIRONMENT=!1}else i.REFRACTED_BACKGROUND=!1,i.REFRACTED_LIGHTS=!1,i.REFRACTED_ENVIRONMENT=!1;this._shouldUseAlphaFromBaseColorTexture()?i.ALPHA_FROM_BASE_COLOR_TEXTURE=!0:i.ALPHA_FROM_BASE_COLOR_TEXTURE=!1}this._lightFalloff===n.LIGHTFALLOFF_STANDARD?(i.USEPHYSICALLIGHTFA
2LLOFF=!1,i.USEGLTFLIGHTFALLOFF=!1):this._lightFalloff===n.LIGHTFALLOFF_GLTF?(i.USEPHYSICALLIGHTFALLOFF=!1,i.USEGLTFLIGHTFALLOFF=!0):(i.USEPHYSICALLIGHTFALLOFF=!0,i.USEGLTFLIGHTFALLOFF=!1),!this.backFaceCulling&&this._twoSidedLighting?i.TWOSIDEDLIGHTING=!0:i.TWOSIDEDLIGHTING=!1,i.MIRRORED=!!u._mirroredCameraPosition,i.SPECULARAA=h.getCaps().standardDerivatives&&this._enableSpecularAntiAliasing}if((i._areTexturesDirty||i._areMiscDirty)&&(i.ALPHATESTVALUE=`${this._alphaCutOff}${this._alphaCutOff%1==0?".":""}`,i.PREMULTIPLYALPHA=7===this.alphaMode||8===this.alphaMode,i.ALPHABLEND=this.needAlphaBlendingForMesh(t)),i._areTexturesDirty&&(i.TEXTURE_REPETITION_MODE=h.version>1||h.isWebGPU?this.textureRepetitionMode:0),i._areImageProcessingDirty&&this._imageProcessingConfiguration&&this._imageProcessingConfiguration.prepareDefines(i),i.FORCENORMALFORWARD=this._forceNormalForward,i.RADIANCEOCCLUSION=this._useRadianceOcclusion,i.HORIZONOCCLUSION=this._useHorizonOcclusion,(this.specularRoughnessAnisotropy>0||this.coatRoughnessAnisotropy>0)&&e._noiseTextures[u.uniqueId]&&ae.ReflectionTextureEnabled?(i.ANISOTROPIC=!0,t.isVerticesDataPresent(_.TangentKind)||(i._needUVs=!0,i.MAINUV1=!0),this._useGltfStyleAnisotropy&&(i.USE_GLTF_STYLE_ANISOTROPY=!0),i.ANISOTROPIC_BASE=this.specularRoughnessAnisotropy>0,i.ANISOTROPIC_COAT=this.coatRoughnessAnisotropy>0):(i.ANISOTROPIC=!1,i.USE_GLTF_STYLE_ANISOTROPY=!1,i.ANISOTROPIC_BASE=!1,i.ANISOTROPIC_COAT=!1),i.THIN_FILM=this.thinFilmWeight>0,i.IRIDESCENCE=this.thinFilmWeight>0,i.DISPERSION=this.transmissionDispersionScale>0,i.SCATTERING=this.hasScattering,i.SSS_SAMPLE_COUNT=[8,16,32][this._sssQuality]??16,i.TRANSMISSION_SLAB=this.transmissionWeight>0,i.TRANSMISSION_SLAB_VOLUME=this.transmissionWeight>0&&this.transmissionDepth>0,i.SUBSURFACE_SLAB=this.subsurfaceWeight>0,!i.PREPASS&&(i.SUBSURFACE_SLAB||i.TRANSMISSION_SLAB_VOLUME)){let e=!1;if(!this.sssIrradianceTexture&&u.geometryBufferRenderer){const t=u.geometryBufferRenderer.getTextureIndex(c.IRRADIANCE_TEXTURE_TYPE);this.sssIrradianceTexture=u.geometryBufferRenderer.getGBuffer().textures[t],e=!0}if(!this.sssDepthTexture&&u.geometryBufferRenderer){const t=u.geometryBufferRenderer.getTextureIndex(c.SCREENSPACE_DEPTH_TEXTURE_TYPE);this.sssDepthTexture=u.geometryBufferRenderer.getGBuffer().textures[t],e=!0}this.sssIrradianceTexture&&this.sssDepthTexture&&(i.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING=!0,e&&(i.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING_GBUFFER=!0))}i.FUZZ=this.fuzzWeight>0&&ae.ReflectionTextureEnabled,i.GEOMETRY_THIN_WALLED=0!=this.geometryThinWalled,i.FUZZ?(t.isVerticesDataPresent(_.TangentKind)||(i._needUVs=!0,i.MAINUV1=!0),this._environmentFuzzBRDFTexture=ge(this.getScene()),i.FUZZ_IBL_SAMPLES=this.fuzzSampleNumber):(this._environmentFuzzBRDFTexture=null,i.FUZZENVIRONMENTBRDF=!1,i.FUZZ_IBL_SAMPLES=0),i._areMiscDirty&&(re(t,u,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(t),i,this._applyDecalMapAfterDetailMap,this._useVertexPulling,s,this._isVertexOutputInvariant),i.UNLIT=this._unlit||(this.pointsCloud||this.wireframe)&&!t.isVerticesDataPresent(_.NormalKind),i.DEBUGMODE=this._debugMode),se(u,h,this,i,!!r,a,o),this._eventInfo.defines=i,this._eventInfo.mesh=t,this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo),Te(t,i,!0,!0,!0,this._transparencyMode!==n.MATERIAL_OPAQUE),this._callbackPluginEventPrepareDefines(this._eventInfo)}};Pe.SSS_QUALITY_LOW=0,Pe.SSS_QUALITY_MEDIUM=1,Pe.SSS_QUALITY_HIGH=2,Pe._noiseTextures={},Pe.ForceGLSL=!1,j([t("_markAllSubMeshesAsTexturesDirty","baseWeight")],Pe.prototype,"_baseWeight",void 0),j([t("_markAllSubMeshesAsTexturesDirty","baseWeightTexture")],Pe.prototype,"_baseWeightTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","baseColor")],Pe.prototype,"_baseColor",void 0),j([t("_markAllSubMeshesAsTexturesDirty","baseColorTexture")],Pe.prototype,"_baseColorTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","baseDiffuseRoughness")],Pe.prototype,"_baseDiffuseRoughness",void 0),j([t("_markAllSubMeshesAsTexturesDirty","baseDiffuseRoughnessTexture")],Pe.prototype,"_baseDiffuseRoughnessTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","baseMetalness")],Pe.prototype,"_baseMetalness",void 0),j([t("_markAllSubMeshesAsTexturesDirty","baseMetalnessTexture")],Pe.prototype,"_baseMetalnessTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","specularWeight")],Pe.prototype,"_specularWeight",void 0),j([t("_markAllSubMeshesAsTexturesDirty","specularWeightTexture")],Pe.prototype,"_specularWeightTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","specularColor")
2],Pe.prototype,"_specularColor",void 0),j([t("_markAllSubMeshesAsTexturesDirty","specularColorTexture")],Pe.prototype,"_specularColorTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","specularRoughness")],Pe.prototype,"_specularRoughness",void 0),j([t("_markAllSubMeshesAsTexturesDirty","specularRoughnessTexture")],Pe.prototype,"_specularRoughnessTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","specularRoughnessAnisotropy")],Pe.prototype,"_specularRoughnessAnisotropy",void 0),j([t("_markAllSubMeshesAsTexturesDirty","specularRoughnessAnisotropyTexture")],Pe.prototype,"_specularRoughnessAnisotropyTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","specularIor")],Pe.prototype,"_specularIor",void 0),j([t("_markAllSubMeshesAsTexturesDirty","transmissionWeight")],Pe.prototype,"_transmissionWeight",void 0),j([t("_markAllSubMeshesAsTexturesDirty","transmissionWeightTexture")],Pe.prototype,"_transmissionWeightTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","transmissionColor")],Pe.prototype,"_transmissionColor",void 0),j([t("_markAllSubMeshesAsTexturesDirty","transmissionColorTexture")],Pe.prototype,"_transmissionColorTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","transmissionDepth")],Pe.prototype,"_transmissionDepth",void 0),j([t("_markAllSubMeshesAsTexturesDirty","transmissionDepthTexture")],Pe.prototype,"_transmissionDepthTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","transmissionScatter")],Pe.prototype,"_transmissionScatter",void 0),j([t("_markAllSubMeshesAsTexturesDirty","transmissionScatterTexture")],Pe.prototype,"_transmissionScatterTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","transmissionScatterAnisotropy")],Pe.prototype,"_transmissionScatterAnisotropy",void 0),j([t("_markAllSubMeshesAsTexturesDirty","transmissionDispersionScale")],Pe.prototype,"_transmissionDispersionScale",void 0),j([t("_markAllSubMeshesAsTexturesDirty","transmissionDispersionScaleTexture")],Pe.prototype,"_transmissionDispersionScaleTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","transmissionDispersionAbbeNumber")],Pe.prototype,"_transmissionDispersionAbbeNumber",void 0),j([t("_markAllSubMeshesAsTexturesDirty","subsurfaceWeight")],Pe.prototype,"_subsurfaceWeight",void 0),j([t("_markAllSubMeshesAsTexturesDirty","subsurfaceWeightTexture")],Pe.prototype,"_subsurfaceWeightTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","subsurfaceColor")],Pe.prototype,"_subsurfaceColor",void 0),j([t("_markAllSubMeshesAsTexturesDirty","subsurfaceColorTexture")],Pe.prototype,"_subsurfaceColorTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","subsurfaceRadius")],Pe.prototype,"_subsurfaceRadius",void 0),j([t("_markAllSubMeshesAsTexturesDirty","subsurfaceRadiusScale")],Pe.prototype,"_subsurfaceRadiusScale",void 0),j([t("_markAllSubMeshesAsTexturesDirty","subsurfaceRadiusScaleTexture")],Pe.prototype,"_subsurfaceRadiusScaleTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","subsurfaceScatterAnisotropy")],Pe.prototype,"_subsurfaceScatterAnisotropy",void 0),j([t("_markAllSubMeshesAsTexturesDirty","coatWeight")],Pe.prototype,"_coatWeight",void 0),j([t("_markAllSubMeshesAsTexturesDirty","coatWeightTexture")],Pe.prototype,"_coatWeightTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","coatColor")],Pe.prototype,"_coatColor",void 0),j([t("_markAllSubMeshesAsTexturesDirty","coatColorTexture")],Pe.prototype,"_coatColorTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","coatRoughness")],Pe.prototype,"_coatRoughness",void 0),j([t("_markAllSubMeshesAsTexturesDirty","coatRoughnessTexture")],Pe.prototype,"_coatRoughnessTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","coatRoughnessAnisotropy")],Pe.prototype,"_coatRoughnessAnisotropy",void 0),j([t("_markAllSubMeshesAsTexturesDirty","coatRoughnessAnisotropyTexture")],Pe.prototype,"_coatRoughnessAnisotropyTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","coatIor")],Pe.prototype,"_coatIor",void 0),j([t("_markAllSubMeshesAsTexturesDirty","coatDarkening")],Pe.prototype,"_coatDarkening",void 0),j([t("_markAllSubMeshesAsTexturesDirty","coatDarkeningTexture")],Pe.prototype,"_coatDarkeningTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","fuzzWeight")],Pe.prototype,"_fuzzWeight",void 0),j([t("_markAllSubMeshesAsTexturesDirty","fuzzWeightTexture")],Pe.prototype,"_fuzzWeightTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","fuzzColor")],Pe.prototype,"_fuzzColor",void 0),j([t("_markAllSubMeshesAsTexturesDirty","fuzzColorTexture")],Pe.prototype,"_fuzzColorTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","fuzzRoughness")],Pe.prototype,"_fuzzRoughness",void 0),j([t("_markAllSubMeshesAsTexturesDirty","fuzzRoughnessTexture")],Pe.prototype,"_fuzzRoughnessTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","geometryThinWalled")],Pe.prototype,"_geometryThinWalled",void 0),j([t("_markAllSubMeshesAsTexturesDirty","geometryNormalTexture")],Pe.prototype,"_geometryNormalTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","geometryTangent")],Pe.prototype,"_geometryTangent",void 0),j([t("_markAllSubMeshesAsTexturesDirty","geometryTangentTexture")],Pe.prototype,"_geometryTangentTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","geometryCoatNormalTexture")],Pe.prototype,"_geometryCoatNormalTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","geometryCoatTangent")],Pe.prototype,"_geometryCoatTangent",void 0),j([t("_markAllSubMeshesAsTexturesDirty","geometryCoatTangentTexture")],Pe.prototype,"_geometryCoatTangentTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","geometryOpacity")],Pe.prototype,"_geometryOpacity",void 0),j([t("_markAllSubMeshesAsTexturesDirty","geometryOpacityTexture")],Pe.prototype,"_geometryOpacityTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","geometryThickness")],Pe.prototype,"_geometryThickness",void 0),j([t("_markAllSubMeshesAsTexturesDirty","geometryThicknessTexture")],Pe.prototype,"_geometryThicknessTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","emissionLuminance")],Pe.prototype,"_emissionLuminance",void 0),j([t("_markAllSubMeshesAsTexturesDirty","emissionColor")],Pe.prototype,"_emissionColor",void 0),j([t("_markAllSubMeshesAsTexturesDirty","emissionColorTexture")],Pe.prototype,"_emissionColorTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","thinFilmWeight")],Pe.prototype,"_thinFilmWeight",void 0),j([t("_markAllSubMeshesAsTexturesDirty","thinFilmWeightTexture")],Pe.prototype,"_thinFilmWeightTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","thinFilmThickness")],Pe.prototype,"_thinFilmThickness",void 0),j([t("_markAllSubMeshesAsTexturesDirty","thinFilmThicknessMin")],Pe.prototype,"_thinFilmThicknessMin",void 0),j([t("_markAllSubMeshesAsTexturesDirty","thinFilmThicknessTexture")],Pe.prototype,"_thinFilmThicknessTexture",void 0),j([t("_markAllSubMeshesAsTexturesDirty","thinFilmIor")],Pe.prototype,"_thinFilmIor",void 0),j([t("_markAllSubMeshesAsTexturesDirty","ambientOcclusionTexture")],Pe.prototype,"_ambientOcclusionTexture",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"directIntensity",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"environmentIntensity",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"useSpecularWeightFromTextureAlpha",void 0),j([_e(),V("_markAllSubMeshesAsTexturesAndMiscDirty")],Pe.prototype,"forceAlphaTest",void 0),j([_e(),V("_markAllSubMeshesAsTexturesAndMiscDirty")],Pe.prototype,"alphaCutOff",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"useAmbientOcclusionFromMetallicTextureRed",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"useAmbientInGrayScale",void 0),j([_e()],Pe.prototype,"usePhysicalLightFalloff",null),j([_e()],Pe.prototype,"useGLTFLightFalloff",null),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"useObjectSpaceNormalMap",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"useParallax",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"useParallaxOcclusion",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"parallaxScaleBias",void 0),j([_e(),V("_markAllSubMeshesAsLightsDirt
2y")],Pe.prototype,"disableLighting",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"forceIrradianceInFragment",void 0),j([_e(),V("_markAllSubMeshesAsLightsDirty")],Pe.prototype,"maxSimultaneousLights",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"invertNormalMapX",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"invertNormalMapY",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"twoSidedLighting",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"useAlphaFresnel",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"useLinearAlphaFresnel",void 0),j([V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"environmentBRDFTexture",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"forceNormalForward",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"enableSpecularAntiAliasing",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"useHorizonOcclusion",void 0),j([_e(),V("_markAllSubMeshesAsTexturesDirty")],Pe.prototype,"useRadianceOcclusion",void 0),j([_e(),V("_markAllSubMeshesAsMiscDirty")],Pe.prototype,"unlit",void 0),j([_e(),V("_markAllSubMeshesAsMiscDirty")],Pe.prototype,"applyDecalMapAfterDetailMap",void 0),j([V("_markAllSubMeshesAsMiscDirty")],Pe.prototype,"debugMode",void 0),j([_e()],Pe.prototype,"transparencyMode",null);var Ue=!1;function we(){Ue||(Ue=!0,K("BABYLON.OpenPBRMaterial",Pe))}var ke=e({OpenPBRMaterial:()=>Pe,OpenPBRMaterialDefines:()=>Fe,RegisterOpenpbrMaterial:()=>we});we();var Be,Ge,He=e({_BasisTextureLoader:()=>ze}),ze=class{constructor(){this.supportCascades=!1}loadCubeData(e,t,s,i,n){if(Array.isArray(e))return;const a=t.getEngine().getCaps();L(e,{supportedCompressionFormats:{etc1:!!a.etc1,s3tc:!!a.s3tc,pvrtc:!!a.pvrtc,etc2:!!a.etc2,astc:!!a.astc,bc7:!!a.bptc}}).then(e=>{const s=e.fileInfo.images[0].levels.length>1&&t.generateMipMaps;r(t,e),t.getEngine()._setCubeMapTextureParams(t,s),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),i&&i()}).catch(e=>{ne.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),t.isReady=!0,n&&n(e)})}loadData(e,t,s){const i=t.getEngine().getCaps();L(e,{supportedCompressionFormats:{etc1:!!i.etc1,s3tc:!!i.s3tc,pvrtc:!!i.pvrtc,etc2:!!i.etc2,astc:!!i.astc,bc7:!!i.bptc}}).then(e=>{const i=e.fileInfo.images[0].levels[0],n=e.fileInfo.images[0].levels.length>1&&t.generateMipMaps;s(i.width,i.height,n,-1!==e.format,()=>{r(t,e)})}).catch(e=>{ne.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),ne.Warn(`Failed to transcode Basis file: ${e}`),s(0,0,!1,!1,()=>{},!0)})}},We=e({_DDSTextureLoader:()=>Ve}),Ve=class{constructor(){this.supportCascades=!0}loadCubeData(e,t,s,i){const r=t.getEngine();let n,a=!1,o=1e3;if(Array.isArray(e))for(let u=0;u<e.length;u++){const s=e[u];n=Se.GetDDSInfo(s),t.width=n.width,t.height=n.height,a=(n.isRGB||n.isLuminance||n.mipmapCount>1)&&t.generateMipMaps,r._unpackFlipY(n.isCompressed),Se.UploadDDSLevels(r,t,s,n,a,6,-1,u),n.isFourCC||1!==n.mipmapCount?o=n.mipmapCount-1:r.generateMipMapsForCubemap(t)}else{const i=e;n=Se.GetDDSInfo(i),t.width=n.width,t.height=n.height,s&&(n.sphericalPolynomial=new R),a=(n.isRGB||n.isLuminance||n.mipmapCount>1)&&t.generateMipMaps,r._unpackFlipY(n.isCompressed),Se.UploadDDSLevels(r,t,i,n,a,6),n.isFourCC||1!==n.mipmapCount?o=n.mipmapCount-1:r.generateMipMapsForCubemap(t,!1)}r._setCubeMapTextureParams(t,a,o),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),i&&i({isDDS:!0,width:t.width,info:n,data:e,texture:t})}loadData(e,t,s){const i=Se.GetDDSInfo(e),r=(i.isRGB||i.isLuminance||i.mipmapCount>1)&&t.generateMipMaps&&Math.max(i.width,i.height)>>i.mipmapCount-1==1;s(i.width,i.height,r,i.isFourCC,()=>{Se.UploadDDSLevels(t.getEngine(),t,e,i,r,1)})}},Xe=65536,Ye=65537;!function(e){e[e.NO_COMPRESSION=0]="NO_COMPRESSION",e[e.RLE_COMPRESSION=1]="RLE_COMPRESSION",e[e.ZIPS_COMPRESSION=2]="ZIPS_COMPRESSION",e[e.ZIP_COMPRESSION=3]="ZIP_COMPRESSION",e[e.PIZ_COMPRESSION=4]="PIZ_COMPRESSION",e[e.PXR24_COMPRESSION=5]="PXR24_COMPRESSION"}(Be||(Be={})),function(e){e[e.INCREASING_Y=0]="INCREASING_Y",e[e.DECREASING_Y=1
2]="DECREASING_Y"}(Ge||(Ge={}));var Ze=function(){const e=new ArrayBuffer(4),t=new Float32Array(e),s=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let u=0;u<256;++u){const e=u-127;e<-27?(i[u]=0,i[256|u]=32768,r[u]=24,r[256|u]=24):e<-14?(i[u]=1024>>-e-14,i[256|u]=1024>>-e-14|32768,r[u]=-e-1,r[256|u]=-e-1):e<=15?(i[u]=e+15<<10,i[256|u]=e+15<<10|32768,r[u]=13,r[256|u]=13):e<128?(i[u]=31744,i[256|u]=64512,r[u]=24,r[256|u]=24):(i[u]=31744,i[256|u]=64512,r[u]=13,r[256|u]=13)}const n=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let u=1;u<1024;++u){let e=u<<13,t=0;for(;!(8388608&e);)e<<=1,t-=8388608;e&=-8388609,t+=947912704,n[u]=e|t}for(let u=1024;u<2048;++u)n[u]=939524096+(u-1024<<13);for(let u=1;u<31;++u)a[u]=u<<23;a[31]=1199570944,a[32]=2147483648;for(let u=33;u<63;++u)a[u]=2147483648+(u-32<<23);a[63]=3347054592;for(let u=1;u<64;++u)32!==u&&(o[u]=1024);return{floatView:t,uint32View:s,baseTable:i,shiftTable:r,mantissaTable:n,exponentTable:a,offsetTable:o}}();function Ke(e,t){const s=new Uint8Array(e);let i=0;for(;0!=s[t.value+i];)i+=1;const r=(new TextDecoder).decode(s.slice(t.value,t.value+i));return t.value=t.value+i+1,r}function Qe(e,t){const s=e.getInt32(t.value,!0);return t.value+=4,s}function je(e,t){const s=e.getUint32(t.value,!0);return t.value+=4,s}function qe(e,t){const s=e.getUint8(t.value);return t.value+=1,s}function $e(e,t){const s=e.getUint16(t.value,!0);return t.value+=2,s}function Je(e,t){const s=e[t.value];return t.value+=1,s}function et(e,t){let s;return s="getBigInt64"in DataView.prototype?Number(e.getBigInt64(t.value,!0)):e.getUint32(t.value+4,!0)+Number(e.getUint32(t.value,!0)<<32),t.value+=8,s}function tt(e,t){const s=e.getFloat32(t.value,!0);return t.value+=4,s}function st(e,t){return function(e){const t=(31744&e)>>10,s=1023&e;return(e>>15?-1:1)*(t?31===t?s?NaN:1/0:Math.pow(2,t-15)*(1+s/1024):s/1024*6103515625e-14)}($e(e,t))}function it(e,t){return function(e){if(Math.abs(e)>65504)throw new Error("Value out of range.Consider using float instead of half-float.");e=z(e,-65504,65504),Ze.floatView[0]=e;const t=Ze.uint32View[0],s=t>>23&511;return Ze.baseTable[s]+((8388607&t)>>Ze.shiftTable[s])}(tt(e,t))}function rt(e,t,s,i){switch(s){case"string":case"stringvector":case"iccProfile":return function(e,t,s){const i=(new TextDecoder).decode(new Uint8Array(e).slice(t.value,t.value+s));return t.value=t.value+s,i}(e.buffer,t,i);case"chlist":return function(e,t,s){const i=t.value,r=[];for(;t.value<i+s-1;){const s=Ke(e.buffer,t),i=Qe(e,t),n=qe(e,t);t.value+=3;const a=Qe(e,t),o=Qe(e,t);r.push({name:s,pixelType:i,pLinear:n,xSampling:a,ySampling:o})}return t.value+=1,r}(e,t,i);case"chromaticities":return function(e,t){return{redX:tt(e,t),redY:tt(e,t),greenX:tt(e,t),greenY:tt(e,t),blueX:tt(e,t),blueY:tt(e,t),whiteX:tt(e,t),whiteY:tt(e,t)}}(e,t);case"compression":return function(e,t){return qe(e,t)}(e,t);case"box2i":return function(e,t){return{xMin:Qe(e,t),yMin:Qe(e,t),xMax:Qe(e,t),yMax:Qe(e,t)}}(e,t);case"lineOrder":return function(e,t){const s=qe(e,t);return Ge[s]}(e,t);case"float":return tt(e,t);case"v2f":return function(e,t){return[tt(e,t),tt(e,t)]}(e,t);case"v3f":return function(e,t){return[tt(e,t),tt(e,t),tt(e,t)]}(e,t);case"int":return Qe(e,t);case"rational":return function(e,t){return[Qe(e,t),je(e,t)]}(e,t);case"timecode":return function(e,t){return[je(e,t),je(e,t)]}(e,t);case"preview":return t.value+=i,"skipped";default:return void(t.value+=i)}}function nt(e){for(let t=1;t<e.length;t++)e[t]=e[t-1]+e[t]-128}function at(e,t){let s=0,i=Math.floor((e.length+1)/2),r=0;const n=e.length-1;for(;!(r>n||(t[r++]=e[s++],r>n));)t[r++]=e[i++]}function ot(e,t,s,i,r){for(;s<e;)t=t<<8|Je(i,r),s+=8;return{l:t>>(s-=e)&(1<<e)-1,c:t,lc:s}}function ut(e,t,s,i){return{c:e=e<<8|Je(s,i),lc:t+=8}}function ht(e,t,s,i,r,n,a,o,u){if(e==t){if(i<8){const e=ut(s,i,r,n);s=e.c,i=e.lc}let e=s>>(i-=8);if(e=new Uint8Array([e])[0],o.value+e>u)return null;const t=a[o.value-1];for(;e-- >0;)a[o.value++]=t}else{if(!(o.value<u))return null;a[o.value++]=e}return{c:s,lc:i}}var lt,ct=new Array(59);function _t(e){return 63&e}function Tt(e){return e>>6}function pt(e,t,s,i,r,n){const a=s.value,o=je(t,s),u=je(t,s);s.value+=4;const h=je(t,s);if(s.value+=4,o<0||o>=65537||u<0||u>=65537)throw new Error("Wrong HUF_ENCSIZE");const l=new Array(Ye),c=new Array(16384);if(function(e){for(let t=0;t<16384;t++)e[t]={},e[t].len=0,e[t].lit=0,e[t].p=null}(c),function(e,t,s,i,r,n){const a=t;let o=0,u=0;for(;i<=r;i++){if(a.value-t.value>s)return;let h=ot(6,o,u,e,a);const l=h.l;if(o=h.c,u=h.lc,n[i]=l,63==l){if(a.value-t.value>s)throw new Error("Error in HufUnpackEncTable");h=ot(8,o,u,e,a);let l=h.l+6;if(o=h.c,u=h.lc,i+l>r+1)throw new Error("Error in HufUnpackEncTable");for(;l--;)n[i++]=0;i--}else if(l>=59){let e=l-59+2;if(i+e>r+1)throw new Error("Error in HufUnpackEncTable");for(;e--;)n[i++]=0;i--}}!function(e){for(let s=0;s<=58;++s)ct[s]=0;for(let s=0;s<Ye;++s)ct[e[s]]+=1;let t=0;for(let s=58;s>0;--s){const e=t+ct[s]>>1;ct[s]=t,t=e}for(let s=0;s<Ye;++s){const t=e[s];t>
vendor: 8,452 bytes, line 2
20&&(e[s]=t|ct[t]++<<6)}}(n)}(e,s,i-(s.value-a),o,u,l),h>8*(i-(s.value-a)))throw new Error("Wrong hufUncompress");!function(e,t,s,i){for(;t<=s;t++){const s=Tt(e[t]),r=_t(e[t]);if(s>>r)throw new Error("Invalid table entry");if(r>14){const e=i[s>>r-14];if(e.len)throw new Error("Invalid table entry");if(e.lit++,e.p){const t=e.p;e.p=new Array(e.lit);for(let s=0;s<e.lit-1;++s)e.p[s]=t[s]}else e.p=new Array(1);e.p[e.lit-1]=t}else if(r){let e=0;for(let n=1<<14-r;n>0;n--){const n=i[(s<<14-r)+e];if(n.len||n.p)throw new Error("Invalid table entry");n.len=r,n.lit=t,e++}}}}(l,o,u,c),function(e,t,s,i,r,n,a,o,u){let h=0,l=0;const c=a,_=Math.trunc(i.value+(r+7)/8);for(;i.value<_;){let r=ut(h,l,s,i);for(h=r.c,l=r.lc;l>=14;){const a=t[h>>l-14&16383];if(a.len){l-=a.len;const e=ht(a.lit,n,h,l,s,i,o,u,c);e&&(h=e.c,l=e.lc)}else{if(!a.p)throw new Error("hufDecode issues");let t;for(t=0;t<a.lit;t++){const T=_t(e[a.p[t]]);for(;l<T&&i.value<_;)r=ut(h,l,s,i),h=r.c,l=r.lc;if(l>=T&&Tt(e[a.p[t]])==(h>>l-T&(1<<T)-1)){l-=T;const e=ht(a.p[t],n,h,l,s,i,o,u,c);e&&(h=e.c,l=e.lc);break}}if(t==a.lit)throw new Error("HufDecode issues")}}}const T=8-r&7;for(h>>=T,l-=T;l>0;){const e=t[h<<14-l&16383];if(!e.len)throw new Error("HufDecode issues");{l-=e.len;const t=ht(e.lit,n,h,l,s,i,o,u,c);t&&(h=t.c,l=t.lc)}}}(l,c,e,s,h,u,n,r,{value:0})}function ft(e){return 65535&e}function mt(e){const t=ft(e);return t>32767?t-65536:t}function At(e,t){const s=mt(e),i=mt(t),r=s+(1&i)+(i>>1);return{a:r,b:r-i}}function dt(e,t){const s=ft(e),i=ft(t),r=s-(i>>1)&65535;return{a:i+r-32768&65535,b:r}}function gt(e,t,s,i,r,n,a){const o=a<16384,u=s>r?r:s;let h,l,c=1;for(;c<=u;)c<<=1;for(c>>=1,h=c,c>>=1;c>=1;){l=0;const a=l+n*(r-h),u=n*c,_=n*h,T=i*c,p=i*h;let f,m,A,d;for(;l<=a;l+=_){let r=l;const n=l+i*(s-h);for(;r<=n;r+=p){const s=r+T,i=r+u,n=i+T;if(o){let a=At(e[r+t],e[i+t]);f=a.a,A=a.b,a=At(e[s+t],e[n+t]),m=a.a,d=a.b,a=At(f,m),e[r+t]=a.a,e[s+t]=a.b,a=At(A,d),e[i+t]=a.a,e[n+t]=a.b}else{let a=dt(e[r+t],e[i+t]);f=a.a,A=a.b,a=dt(e[s+t],e[n+t]),m=a.a,d=a.b,a=dt(f,m),e[r+t]=a.a,e[s+t]=a.b,a=dt(A,d),e[i+t]=a.a,e[n+t]=a.b}}if(s&c){const s=r+u;let i;i=o?At(e[r+t],e[s+t]):dt(e[r+t],e[s+t]),f=i.a,e[s+t]=i.b,e[r+t]=f}}if(r&c){let r=l;const n=l+i*(s-h);for(;r<=n;r+=p){const s=r+T;let i;i=o?At(e[r+t],e[s+t]):dt(e[r+t],e[s+t]),f=i.a,e[s+t]=i.b,e[r+t]=f}}h=c,c>>=1}return l}function Rt(e){return new DataView(e.array.buffer,e.offset.value,e.size)}function Et(e){const t=e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size),s=new Uint8Array(function(e){let t=e.byteLength;const s=[];let i=0;const r=new DataView(e);for(;t>0;){const e=r.getInt8(i++);if(e<0){const n=-e;t-=n+1;for(let e=0;e<n;e++)s.push(r.getUint8(i++))}else{const n=e;t-=2;const a=r.getUint8(i++);for(let e=0;e<n+1;e++)s.push(a)}}return s}(t)),i=new Uint8Array(s.length);return nt(s),at(s,i),new DataView(i.buffer)}function St(e){const t=e.array.slice(e.offset.value,e.offset.value+e.size),s=fflate.unzlibSync(t),i=new Uint8Array(s.length);return nt(s),at(s,i),new DataView(i.buffer)}function yt(e){const t=e.array.slice(e.offset.value,e.offset.value+e.size),s=fflate.unzlibSync(t),i=e.lines*e.channels*e.width,r=1==e.type?new Uint16Array(i):new Uint32Array(i);let n=0,a=0;const o=new Array(4);for(let u=0;u<e.lines;u++)for(let t=0;t<e.channels;t++){let t=0;switch(e.type){case 1:o[0]=n,o[1]=o[0]+e.width,n=o[1]+e.width;for(let i=0;i<e.width;++i)t+=s[o[0]++]<<8|s[o[1]++],r[a]=t,a++;break;case 2:o[0]=n,o[1]=o[0]+e.width,o[2]=o[1]+e.width,n=o[2]+e.width;for(let i=0;i<e.width;++i)t+=s[o[0]++]<<24|s[o[1]++]<<16|s[o[2]++]<<8,r[a]=t,a++}}return new DataView(r.buffer)}function xt(e){const t=e.viewer,s={value:e.offset.value},i=new Uint16Array(e.width*e.scanlineBlockSize*(e.channels*e.type)),r=new Uint8Array(8192);let n=0;const a=new Array(e.channels);for(let p=0;p<e.channels;p++)a[p]={},a[p].start=n,a[p].end=a[p].start,a[p].nx=e.width,a[p].ny=e.lines,a[p].size=e.type,n+=a[p].nx*a[p].ny*a[p].size;const o=$e(t,s),u=$e(t,s);if(u>=8192)throw new Error("Wrong PIZ_COMPRESSION BITMAP_SIZE");if(o<=u)for(let p=0;p<u-o+1;p++)r[p+o]=qe(t,s);const h=new Uint16Array(Xe),l=function(e,t){let s=0;for(let r=0;r<Xe;++r)(0==r||e[r>>3]&1<<(7&r))&&(t[s++]=r);const i=s-1;for(;s<Xe;)t[s++]=0;return i}(r,h),c=je(t,s);pt(e.array,t,s,c,i,n);for(let p=0;p<e.channels;++p){const e=a[p];for(let t=0;t<a[p].size;++t)gt(i,e.start+t,e.nx,e.size,e.ny,e.nx*e.size,l)}!function(e,t,s){for(let i=0;i<s;++i)t[i]=e[t[i]]}(h,i,n);let _=0;const T=new Uint8Array(i.buffer.byteLength);for(let p=0;p<e.lines;p++)for(let t=0;t<e.channels;t++){const e=a[t],s=e.nx*e.size,r=new Uint8Array(i.buffer,2*e.end,2*s);T.set(r,_),_+=2*s,e.end+=s}return new DataView(T.buffer)}!function(e){e[e.Float=0]="Float",e[e.HalfFloat=1]="HalfFloat"}(lt||(lt={}));var It=class{};It.DefaultOutputType=lt.HalfFloat,It.FFLATEUrl="https://unpkg.com/[email protected]";var bt=e({_ExrTextureLoader:()=>Ct}),Ct=class{constructor(){this.supportCascades=!1}loadCubeData(e,t,s,i,r){throw".exr not supported in Cube."}loadData(e,t,s){const i=new DataView(e.buffer),r={value:0},n=function(e,t){if(20000630!=e.getUint32(0,!0))throw new Error("Incorrect OpenEXR format");const s=e.getUint8(4),i=e.getUint8(5),r={singleTile:!!(2&i),longName:!!(4&i),deepFormat:!!(8&i),multiPart:!!(16&i)};t.value=8;const n={};let o=!0;for(;o;){const s=Ke(e.buffer,t);if(s){const i=Ke(e.buffer,t),r=rt(e,t,i,je(e,t));void 0===r?a.Warn(`Unknown header attribute type ${i}'.`):n[s]=r}else o=!1}if(-5&i)throw new Error("Unsupported file format");return{version:s,spec:r,...n}}(i,r);(async function(e,t,s,i){const r={size:0,viewer:t,array:new Uint8Array(t.buffer),offset:s,width:e.dataWindow.xMax-e.dataWindow.xMin+1,height:e.dataWindow.yMax-e.dataWindow.yMin+1,channels:e.channels.length,channelLineOffsets:{},scanOrder:()=>0,bytesPerLine:0,outLineWidth:0,lines:0,scanlineBlockSize:0,inputSize:null,type:0,uncompress:null,getter:()=>0,format:5,outputChannels:0,decodeChannels:{},blockCount:null,byteArray:null,linearSpace:!1,textureType:0};switch(e.compression){case Be.NO_COMPRESSION:r.lines=1,r.uncompress=Rt;break;case Be.RLE_COMPRESSION:r.lines=1,r.uncompress=Et;break;case Be.ZIPS_COMPRESSION:r.lines=1,r.uncompress=St,await ne.LoadScriptAsync(It.FFLATEUrl);break;case Be.ZIP_COMPRESSION:r.lines=16,r.uncompress=St,await ne.LoadScriptAsync(It.FFLATEUrl);break;case Be.PIZ_COMPRESSION:r.lines=32,r.uncompress=xt;break;case Be.PXR24_COMPRESSION:r.lines=16,r.uncompress=yt,await ne.LoadScriptAsync(It.FFLATEUrl);break;default:throw new Error(Be[e.compression]+" is unsupported")}r.scanlineBlockSize=r.lines;const n={};for(const h of e.channels)switch(h.name){case"R":case"G":case"B":case"A":case"Y":n[h.name]=!0,r.type=h.pixelType}let a=!1;if(n.R&&n.G&&n.B&&n.A)r.outputChannels=4,r.decodeChannels={R:0,G:1,B:2,A:3};else if(n.R&&n.G&&n.B)a=!0,r.outputChannels=4,r.decodeChannels={R:0,G:1,B:2,A:3};else if(n.R&&n.G)r.outputChannels=2,r.decodeChannels={R:0,G:1};else if(n.R)r.outputChannels=1,r.decodeChannels={R:0};else{if(!n.Y)throw new Error("EXRLoader.parse: file contains unsupported data channels.");r.outputChannels=1,r.decodeChannels={Y:0}}if(1===r.type)switch(i){case lt.Float:r.getter=st,r.inputSize=2;break;case lt.HalfFloat:r.getter=$e,r.inputSize=2}else{if(2!==r.type)throw new Error("Unsupported pixelType "+r.type+" for "+e.compression);switch(i){case lt.Float:r.getter=tt,r.inputSize=4;break;case lt.HalfFloat:r.getter=it,r.inputSize=4}}r.blockCount=r.height/r.scanlineBlockSize;for(let h=0;h<r.blockCount;h++)et(t,s);const o=r.width*r.height*r.outputChannels;switch(i){case lt.Float:r.byteArray=new Float32Array(o),r.textureType=1,a&&r.byteArray.fill(1,0,o);break;case lt.HalfFloat:r.byteArray=new Uint16Array(o),r.textureType=2,a&&r.byteArray.fill(15360,0,o);break;default:throw new Error("Unsupported type: "+i)}let u=0;for(const h of e.channels)void 0!==r.decodeChannels[h.name]&&(r.channelLineOffsets[h.name]=u*r.width),u+=2*h.pixelType;return r.bytesPerLine=r.width*u,r.outLineWidth=r.width*r.outputChannels,"INCREASING_Y"===e.lineOrder?r.scanOrder=e=>e:r.scanOrder=e=>r.height-1-e,4==r.outputChannels?(r.format=5,r.linearSpace=!0):(r.format=6,r.linearSpace=!1),r})(n,i,r,It.DefaultOutputType).then(e=>{!function(e,t,s,i){const r={value:0};for(let n=0;n<e.height/e.scanlineBlockSize;n++){const a=Qe(s,i)-t.dataWindow.yMin;e.size=je(s,i),e.lines=a+e.scanlineBlockSize>e.height?e.height-a:e.scanlineBlockSize;const o=e.size<e.lines*e.bytesPerLine&&e.uncompress?e.uncompress(e):Rt(e);i.value+=e.size;
2for(let s=0;s<e.scanlineBlockSize;s++){const i=n*e.scanlineBlockSize,a=s+e.scanOrder(i);if(a>=e.height)continue;const u=s*e.bytesPerLine,h=(e.height-1-a)*e.outLineWidth;for(let s=0;s<e.channels;s++){const i=t.channels[s].name,n=e.channelLineOffsets[i],a=e.decodeChannels[i];if(void 0!==a){r.value=u+n;for(let t=0;t<e.width;t++){const s=h+t*e.outputChannels+a;e.byteArray&&(e.byteArray[s]=e.getter(o,r))}}}}}}(e,n,i,r),s(n.dataWindow.xMax-n.dataWindow.xMin+1,n.dataWindow.yMax-n.dataWindow.yMin+1,t.generateMipMaps,!1,()=>{const s=t.getEngine();t.format=n.format,t.type=e.textureType,t.invertY=!1,t._gammaSpace=!n.linearSpace,e.byteArray&&s._uploadDataToTextureDirectly(t,e.byteArray,0,0,void 0,!0)})}).catch(e=>{a.Error("Failed to load EXR texture: ",e)})}},Lt=e({_HDRTextureLoader:()=>Mt}),Mt=class{constructor(){this.supportCascades=!1}loadCubeData(){throw".hdr not supported in Cube."}loadData(e,t,s){const i=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=p(i),n=A(i,r),a=r.width*r.height,o=new Float32Array(4*a);for(let u=0;u<a;u+=1)o[4*u]=n[3*u],o[4*u+1]=n[3*u+1],o[4*u+2]=n[3*u+2],o[4*u+3]=1;s(r.width,r.height,t.generateMipMaps,!1,()=>{const e=t.getEngine();t.type=1,t.format=5,t._gammaSpace=!1,e._uploadDataToTextureDirectly(t,o)})}},Ot=e({_IESTextureLoader:()=>vt}),vt=class{constructor(){this.supportCascades=!1}loadCubeData(){throw".ies not supported in Cube."}loadData(e,t,s){const i=h(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));s(i.width,i.height,!!t.useMipMaps,!1,()=>{const e=t.getEngine();t.type=1,t.format=6,t._gammaSpace=!1,e._uploadDataToTextureDirectly(t,i.data)})}},Nt=e({_KTXTextureLoader:()=>Ft}),Ft=class{constructor(){this.supportCascades=!1}loadCubeData(e,t,s,i){if(Array.isArray(e))return;t._invertVScale=!t.invertY;const r=t.getEngine(),n=new S(e,6),a=n.numberOfMipmapLevels>1&&t.generateMipMaps;r._unpackFlipY(!0),n.uploadLevels(t,t.generateMipMaps),t.width=n.pixelWidth,t.height=n.pixelHeight,r._setCubeMapTextureParams(t,a,n.numberOfMipmapLevels-1),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),i&&i()}loadData(e,t,s,i){if(S.IsValid(e)){t._invertVScale=!t.invertY;const i=new S(e,1),r=function(e){switch(e){case 35916:return 33776;case 35918:return 33778;case 35919:return 33779;case 37493:return 37492;case 37497:return 37496;case 37495:return 37494;case 37840:return 37808;case 37841:return 37809;case 37842:return 37810;case 37843:return 37811;case 37844:return 37812;case 37845:return 37813;case 37846:return 37814;case 37847:return 37815;case 37848:return 37816;case 37849:return 37817;case 37850:return 37818;case 37851:return 37819;case 37852:return 37820;case 37853:return 37821;case 36493:return 36492}return null}(i.glInternalFormat);r?(t.format=r,t._useSRGBBuffer=t.getEngine()._getUseSRGBBuffer(!0,t.generateMipMaps),t._gammaSpace=!0):t.format=i.glInternalFormat,s(i.pixelWidth,i.pixelHeight,t.generateMipMaps,!0,()=>{i.uploadLevels(t,t.generateMipMaps)},i.isInvalid)}else g.IsValid(e)?new g(t.getEngine())._uploadAsync(e,t,i).then(()=>{s(t.width,t.height,t.generateMipMaps,!0,()=>{},!1)},e=>{a.Warn(`Failed to load KTX2 texture data: ${e.message}`),s(0,0,!1,!1,()=>{},!0)}):(a.Error("texture missing KTX identifier"),s(0,0,!1,!1,()=>{},!0))}},Dt=e({_TGATextureLoader:()=>Pt}),Pt=class{constructor(){this.supportCascades=!1}loadCubeData(){throw".env not supported in Cube."}loadData(e,t,s){const i=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=$(i);s(r.width,r.height,t.generateMipMaps,!1,()=>{d(t,i)})}};export{bt as a,ke as c,xe as d,Lt as i,be as l,Nt as n,We as o,Ot as r,He as s,Dt as t,ye as u};
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.