UNPKG

@babylonjs/viewer

Version:

The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.

1 lines 56.4 kB
import{z as e,D as t,l as s,i,Q as a,F as r,U as n,W as l,X as u,Y as h,Z as o,C as c,$ as m,a0 as f,a1 as d,a2 as p,a3 as T,a4 as _,a5 as E,a6 as x,a7 as g,a8 as A,a9 as S,aa as v,ab as R,ac as P,ad as b,ae as F,af as M,ag as I,ah as L,ai as C,aj as O,ak as N,al as D,am as k,an as y,ao as U,ap as B,aq as H,ar as w,o as G,as as V,q as W,at as X,au as Y,av as j,aw as z,J as K,H as Z,K as J,s as Q,ax as $,ay as q,N as ee,u as te}from"./index-BPURObVq.esm.min.js";import{P as se,M as ie,a as ae,U as re}from"./prepass.defines-DBIG3K_p.esm.min.js";import{D as ne}from"./material.detailMapConfiguration-FEC73qwc.esm.min.js";const le={effect:null,subMesh:null};class ue extends(ae(re(z))){}class he extends(X(ue)){constructor(e){super(e),this.DIFFUSE=!1,this.DIFFUSEDIRECTUV=0,this.BAKED_VERTEX_ANIMATION_TEXTURE=!1,this.AMBIENT=!1,this.AMBIENTDIRECTUV=0,this.OPACITY=!1,this.OPACITYDIRECTUV=0,this.OPACITYRGB=!1,this.REFLECTION=!1,this.EMISSIVE=!1,this.EMISSIVEDIRECTUV=0,this.SPECULAR=!1,this.SPECULARDIRECTUV=0,this.BUMP=!1,this.BUMPDIRECTUV=0,this.PARALLAX=!1,this.PARALLAX_RHS=!1,this.PARALLAXOCCLUSION=!1,this.SPECULAROVERALPHA=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.ALPHAFROMDIFFUSE=!1,this.POINTSIZE=!1,this.FOG=!1,this.SPECULARTERM=!1,this.DIFFUSEFRESNEL=!1,this.OPACITYFRESNEL=!1,this.REFLECTIONFRESNEL=!1,this.REFRACTIONFRESNEL=!1,this.EMISSIVEFRESNEL=!1,this.FRESNEL=!1,this.NORMAL=!1,this.TANGENT=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.BONETEXTURE=!1,this.BONES_VELOCITY_ENABLED=!1,this.INSTANCES=!1,this.THIN_INSTANCES=!1,this.INSTANCESCOLOR=!1,this.GLOSSINESS=!1,this.ROUGHNESS=!1,this.EMISSIVEASILLUMINATION=!1,this.LINKEMISSIVEWITHDIFFUSE=!1,this.REFLECTIONFRESNELFROMSPECULAR=!1,this.LIGHTMAP=!1,this.LIGHTMAPDIRECTUV=0,this.OBJECTSPACE_NORMALMAP=!1,this.USELIGHTMAPASSHADOWMAP=!1,this.REFLECTIONMAP_3D=!1,this.REFLECTIONMAP_SPHERICAL=!1,this.REFLECTIONMAP_PLANAR=!1,this.REFLECTIONMAP_CUBIC=!1,this.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,this.USE_LOCAL_REFRACTIONMAP_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.REFLECTIONMAP_OPPOSITEZ=!1,this.INVERTCUBICMAP=!1,this.LOGARITHMICDEPTH=!1,this.REFRACTION=!1,this.REFRACTIONMAP_3D=!1,this.REFLECTIONOVERALPHA=!1,this.TWOSIDEDLIGHTING=!1,this.SHADOWFLOAT=!1,this.MORPHTARGETS=!1,this.MORPHTARGETS_POSITION=!1,this.MORPHTARGETS_NORMAL=!1,this.MORPHTARGETS_TANGENT=!1,this.MORPHTARGETS_UV=!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.NONUNIFORMSCALING=!1,this.PREMULTIPLYALPHA=!1,this.ALPHATEST_AFTERALLALPHACOMPUTATIONS=!1,this.ALPHABLEND=!0,this.RGBDLIGHTMAP=!1,this.RGBDREFLECTION=!1,this.RGBDREFRACTION=!1,this.MULTIVIEW=!1,this.ORDER_INDEPENDENT_TRANSPARENCY=!1,this.ORDER_INDEPENDENT_TRANSPARENCY_16BITS=!1,this.CAMERA_ORTHOGRAPHIC=!1,this.CAMERA_PERSPECTIVE=!1,this.AREALIGHTSUPPORTED=!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.IS_REFLECTION_LINEAR=!1,this.IS_REFRACTION_LINEAR=!1,this.DECAL_AFTER_DETAIL=!1,this.TEXTURE_REPETITION_MODE=0,this.rebuild()}}class oe extends(Y(j)){}let ce=(()=>{var X,Y,j,z,q,ee,te,ae,re,ue,ce,me,fe,de,pe,Te,_e,Ee,xe,ge,Ae,Se,ve,Re,Pe,be,Fe,Me,Ie,Le,Ce,Oe,Ne;let De,ke,ye,Ue,Be,He,we,Ge,Ve,We,Xe,Ye,je,ze,Ke,Ze,Je,Qe,$e,qe,et,tt,st,it,at,rt,nt,lt,ut,ht,ot,ct,mt,ft,dt,pt,Tt,_t,Et,xt,gt,At,St,vt,Rt,Pt,bt,Ft,Mt,It,Lt,Ct,Ot,Nt,Dt,kt,yt,Ut,Bt,Ht,wt,Gt,Vt,Wt,Xt,Yt,jt,zt,Kt,Zt,Jt,Qt,$t,qt=oe,es=[],ts=[],ss=[],is=[],as=[],rs=[],ns=[],ls=[],us=[],hs=[],os=[],cs=[],ms=[],fs=[],ds=[],ps=[],Ts=[],_s=[],Es=[],xs=[],gs=[],As=[],Ss=[],vs=[],Rs=[],Ps=[],bs=[],Fs=[],Ms=[],Is=[],Ls=[],Cs=[],Os=[],Ns=[],Ds=[],ks=[],ys=[],Us=[],Bs=[],Hs=[],ws=[],Gs=[],Vs=[],Ws=[],Xs=[],Ys=[],js=[],zs=[],Ks=[],Zs=[],Js=[],Qs=[],$s=[],qs=[],ei=[],ti=[],si=[],ii=[],ai=[],ri=[],ni=[],li=[],ui=[],hi=[],oi=[],ci=[],mi=[],fi=[],di=[],pi=[],Ti=[],_i=[],Ei=[],xi=[],gi=[],Ai=[],Si=[],vi=[],Ri=[],Pi=[],bi=[],Fi=[],Mi=[],Ii=[],Li=[],Ci=[],Oi=[],Ni=[],Di=[],ki=[],yi=[],Ui=[],Bi=[],Hi=[],wi=[],Gi=[],Vi=[],Wi=[],Xi=[],Yi=[],ji=[],zi=[],Ki=[],Zi=[],Ji=[],Qi=[],$i=[],qi=[],ea=[],ta=[],sa=[],ia=[],aa=[],ra=[],na=[],la=[],ua=[],ha=[],oa=[],ca=[],ma=[],fa=[],da=[],pa=[],Ta=[],_a=[],Ea=[],xa=[],ga=[],Aa=[],Sa=[],va=[],Ra=[],Pa=[],ba=[],Fa=[],Ma=[],Ia=[],La=[],Ca=[],Oa=[],Na=[],Da=[],ka=[],ya=[],Ua=[];return X=class extends qt{get diffuseTexture(){return e(this,Y,"f")}set diffuseTexture(e){t(this,Y,e,"f")}get ambientTexture(){return e(this,j,"f")}set ambientTexture(e){t(this,j,e,"f")}get opacityTexture(){return e(this,z,"f")}set opacityTexture(e){t(this,z,e,"f")}get reflectionTexture(){return e(this,q,"f")}set reflectionTexture(e){t(this,q,e,"f")}get emissiveTexture(){return e(this,ee,"f")}set emissiveTexture(e){t(this,ee,e,"f")}get specularTexture(){return e(this,te,"f")}set specularTexture(e){t(this,te,e,"f")}get bumpTexture(){return e(this,ae,"f")}set bumpTexture(e){t(this,ae,e,"f")}get lightmapTexture(){return e(this,re,"f")}set lightmapTexture(e){t(this,re,e,"f")}get refractionTexture(){return e(this,ue,"f")}set refractionTexture(e){t(this,ue,e,"f")}get useAlphaFromDiffuseTexture(){return e(this,ce,"f")}set useAlphaFromDiffuseTexture(e){t(this,ce,e,"f")}get useEmissiveAsIllumination(){return e(this,me,"f")}set useEmissiveAsIllumination(e){t(this,me,e,"f")}get linkEmissiveWithDiffuse(){return e(this,fe,"f")}set linkEmissiveWithDiffuse(e){t(this,fe,e,"f")}get useSpecularOverAlpha(){return e(this,de,"f")}set useSpecularOverAlpha(e){t(this,de,e,"f")}get useReflectionOverAlpha(){return e(this,pe,"f")}set useReflectionOverAlpha(e){t(this,pe,e,"f")}get disableLighting(){return e(this,Te,"f")}set disableLighting(e){t(this,Te,e,"f")}get useObjectSpaceNormalMap(){return e(this,_e,"f")}set useObjectSpaceNormalMap(e){t(this,_e,e,"f")}get useParallax(){return e(this,Ee,"f")}set useParallax(e){t(this,Ee,e,"f")}get useParallaxOcclusion(){return e(this,xe,"f")}set useParallaxOcclusion(e){t(this,xe,e,"f")}get roughness(){return e(this,ge,"f")}set roughness(e){t(this,ge,e,"f")}get useLightmapAsShadowmap(){return e(this,Ae,"f")}set useLightmapAsShadowmap(e){t(this,Ae,e,"f")}get diffuseFresnelParameters(){return e(this,Se,"f")}set diffuseFresnelParameters(e){t(this,Se,e,"f")}get opacityFresnelParameters(){return e(this,ve,"f")}set opacityFresnelParameters(e){t(this,ve,e,"f")}get reflectionFresnelParameters(){return e(this,Re,"f")}set reflectionFresnelParameters(e){t(this,Re,e,"f")}get refractionFresnelParameters(){return e(this,Pe,"f")}set refractionFresnelParameters(e){t(this,Pe,e,"f")}get emissiveFresnelParameters(){return e(this,be,"f")}set emissiveFresnelParameters(e){t(this,be,e,"f")}get useReflectionFresnelFromSpecular(){return e(this,Fe,"f")}set useReflectionFresnelFromSpecular(e){t(this,Fe,e,"f")}get useGlossinessFromSpecularMapAlpha(){return e(this,Me,"f")}set useGlossinessFromSpecularMapAlpha(e){t(this,Me,e,"f")}get maxSimultaneousLights(){return e(this,Ie,"f")}set maxSimultaneousLights(e){t(this,Ie,e,"f")}get invertNormalMapX(){return e(this,Le,"f")}set invertNormalMapX(e){t(this,Le,e,"f")}get invertNormalMapY(){return e(this,Ce,"f")}set invertNormalMapY(e){t(this,Ce,e,"f")}get twoSidedLighting(){return e(this,Oe,"f")}set twoSidedLighting(e){t(this,Oe,e,"f")}get applyDecalMapAfterDetailMap(){return e(this,Ne,"f")}set applyDecalMapAfterDetailMap(e){t(this,Ne,e,"f")}get isPrePassCapable(){return!this.disableDepthWrite}get canRenderToMRT(){return!0}constructor(e,t,r=!1){super(e,t,void 0,r||X.ForceGLSL),this._diffuseTexture=s(this,es,null),Y.set(this,(s(this,ts),s(this,ss,void 0))),this._ambientTexture=(s(this,is),s(this,as,null)),j.set(this,(s(this,rs),s(this,ns,void 0))),this._opacityTexture=(s(this,ls),s(this,us,null)),z.set(this,(s(this,hs),s(this,os,void 0))),this._reflectionTexture=(s(this,cs),s(this,ms,null)),q.set(this,(s(this,fs),s(this,ds,void 0))),this._emissiveTexture=(s(this,ps),s(this,Ts,null)),ee.set(this,(s(this,_s),s(this,Es,void 0))),this._specularTexture=(s(this,xs),s(this,gs,null)),te.set(this,(s(this,As),s(this,Ss,void 0))),this._bumpTexture=(s(this,vs),s(this,Rs,null)),ae.set(this,(s(this,Ps),s(this,bs,void 0))),this._lightmapTexture=(s(this,Fs),s(this,Ms,null)),re.set(this,(s(this,Is),s(this,Ls,void 0))),this._refractionTexture=(s(this,Cs),s(this,Os,null)),ue.set(this,(s(this,Ns),s(this,Ds,void 0))),this.ambientColor=(s(this,ks),s(this,ys,new i(0,0,0))),this.diffuseColor=(s(this,Us),s(this,Bs,new i(1,1,1))),this.specularColor=(s(this,Hs),s(this,ws,new i(1,1,1))),this.emissiveColor=(s(this,Gs),s(this,Vs,new i(0,0,0))),this.specularPower=(s(this,Ws),s(this,Xs,64)),this._useAlphaFromDiffuseTexture=(s(this,Ys),s(this,js,!1)),ce.set(this,(s(this,zs),s(this,Ks,void 0))),this._useEmissiveAsIllumination=(s(this,Zs),s(this,Js,!1)),me.set(this,(s(this,Qs),s(this,$s,void 0))),this._linkEmissiveWithDiffuse=(s(this,qs),s(this,ei,!1)),fe.set(this,(s(this,ti),s(this,si,void 0))),this._useSpecularOverAlpha=(s(this,ii),s(this,ai,!1)),de.set(this,(s(this,ri),s(this,ni,void 0))),this._useReflectionOverAlpha=(s(this,li),s(this,ui,!1)),pe.set(this,(s(this,hi),s(this,oi,void 0))),this._disableLighting=(s(this,ci),s(this,mi,!1)),Te.set(this,(s(this,fi),s(this,di,void 0))),this._useObjectSpaceNormalMap=(s(this,pi),s(this,Ti,!1)),_e.set(this,(s(this,_i),s(this,Ei,void 0))),this._useParallax=(s(this,xi),s(this,gi,!1)),Ee.set(this,(s(this,Ai),s(this,Si,void 0))),this._useParallaxOcclusion=(s(this,vi),s(this,Ri,!1)),xe.set(this,(s(this,Pi),s(this,bi,void 0))),this.parallaxScaleBias=(s(this,Fi),s(this,Mi,.05)),this._roughness=(s(this,Ii),s(this,Li,0)),ge.set(this,(s(this,Ci),s(this,Oi,void 0))),this.indexOfRefraction=(s(this,Ni),s(this,Di,.98)),this.invertRefractionY=(s(this,ki),s(this,yi,!0)),this.alphaCutOff=(s(this,Ui),s(this,Bi,.4)),this._useLightmapAsShadowmap=(s(this,Hi),s(this,wi,!1)),Ae.set(this,(s(this,Gi),s(this,Vi,void 0))),this._diffuseFresnelParameters=(s(this,Wi),s(this,Xi,void 0)),Se.set(this,(s(this,Yi),s(this,ji,void 0))),this._opacityFresnelParameters=(s(this,zi),s(this,Ki,void 0)),ve.set(this,(s(this,Zi),s(this,Ji,void 0))),this._reflectionFresnelParameters=(s(this,Qi),s(this,$i,void 0)),Re.set(this,(s(this,qi),s(this,ea,void 0))),this._refractionFresnelParameters=(s(this,ta),s(this,sa,void 0)),Pe.set(this,(s(this,ia),s(this,aa,void 0))),this._emissiveFresnelParameters=(s(this,ra),s(this,na,void 0)),be.set(this,(s(this,la),s(this,ua,void 0))),this._useReflectionFresnelFromSpecular=(s(this,ha),s(this,oa,!1)),Fe.set(this,(s(this,ca),s(this,ma,void 0))),this._useGlossinessFromSpecularMapAlpha=(s(this,fa),s(this,da,!1)),Me.set(this,(s(this,pa),s(this,Ta,void 0))),this._maxSimultaneousLights=(s(this,_a),s(this,Ea,4)),Ie.set(this,(s(this,xa),s(this,ga,void 0))),this._invertNormalMapX=(s(this,Aa),s(this,Sa,!1)),Le.set(this,(s(this,va),s(this,Ra,void 0))),this._invertNormalMapY=(s(this,Pa),s(this,ba,!1)),Ce.set(this,(s(this,Fa),s(this,Ma,void 0))),this._twoSidedLighting=(s(this,Ia),s(this,La,!1)),Oe.set(this,(s(this,Ca),s(this,Oa,void 0))),this._applyDecalMapAfterDetailMap=(s(this,Na),s(this,Da,!1)),Ne.set(this,(s(this,ka),s(this,ya,void 0))),this._shadersLoaded=(s(this,Ua),!1),this._vertexPullingMetadata=null,this._renderTargets=new a(16),this._globalAmbientColor=new i(0,0,0),this._cacheHasRenderTargetTextures=!1,this.detailMap=new ne(this),this._attachImageProcessingConfiguration(null),this.prePassConfiguration=new se,this.getRenderTargetTextures=()=>(this._renderTargets.reset(),X.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._renderTargets.push(this._reflectionTexture),X.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget&&this._renderTargets.push(this._refractionTexture),this._eventInfo.renderTargets=this._renderTargets,this._callbackPluginEventFillRenderTargetTextures(this._eventInfo),this._renderTargets)}get hasRenderTargetTextures(){return!!(X.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget)||(!!(X.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget)||this._cacheHasRenderTargetTextures)}getClassName(){return"StandardMaterial"}needAlphaBlending(){return this._hasTransparencyMode?this._transparencyModeIsBlend:!this._disableAlphaBlending&&(this.alpha<1||null!=this._opacityTexture||this._shouldUseAlphaFromDiffuseTexture()||this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled)}needAlphaTesting(){return this._hasTransparencyMode?this._transparencyModeIsTest:this._hasAlphaChannel()&&(null==this._transparencyMode||this._transparencyMode===r.MATERIAL_ALPHATEST)}_shouldUseAlphaFromDiffuseTexture(){return null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha&&this._useAlphaFromDiffuseTexture&&this._transparencyMode!==r.MATERIAL_OPAQUE}_hasAlphaChannel(){return null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha||null!=this._opacityTexture}getAlphaTestTexture(){return this._diffuseTexture}isReadyForSubMesh(e,t,s=!1){this._uniformBufferLayoutBuilt||this.buildUniformLayout();const i=t._drawWrapper;if(i.effect&&this.isFrozen&&i._wasPreviouslyReady&&i._wasPreviouslyUsingInstances===s)return!0;t.materialDefines||(this._callbackPluginEventGeneric(4,this._eventInfo),t.materialDefines=new he(this._eventInfo.defineNames));const a=this.getScene(),r=t.materialDefines;if(this._isReadyForSubMesh(t))return!0;const I=a.getEngine();if(r._needNormals=n(a,e,r,!0,this._maxSimultaneousLights,this._disableLighting),!l(a,e,this._maxSimultaneousLights,this._disableLighting))return!1;u(a,r);const L=this.needAlphaBlendingForMesh(e)&&this.getScene().useOrderIndependentTransparency;if(h(a,r,this.canRenderToMRT&&!L),o(a,r,L),ie.PrepareDefines(I.currentRenderPassId,e,r),r._areTexturesDirty){this._eventInfo.hasRenderTargetTextures=!1,this._callbackPluginEventHasRenderTargetTextures(this._eventInfo),this._cacheHasRenderTargetTextures=this._eventInfo.hasRenderTargetTextures,r._needUVs=!1;for(let e=1;e<=c.MAX_SUPPORTED_UV_SETS;++e)r["MAINUV"+e]=!1;if(a.texturesEnabled){if(r.DIFFUSEDIRECTUV=0,r.BUMPDIRECTUV=0,r.AMBIENTDIRECTUV=0,r.OPACITYDIRECTUV=0,r.EMISSIVEDIRECTUV=0,r.SPECULARDIRECTUV=0,r.LIGHTMAPDIRECTUV=0,this._diffuseTexture&&X.DiffuseTextureEnabled){if(!this._diffuseTexture.isReadyOrNotBlocking())return!1;m(this._diffuseTexture,r,"DIFFUSE")}else r.DIFFUSE=!1;if(this._ambientTexture&&X.AmbientTextureEnabled){if(!this._ambientTexture.isReadyOrNotBlocking())return!1;m(this._ambientTexture,r,"AMBIENT")}else r.AMBIENT=!1;if(this._opacityTexture&&X.OpacityTextureEnabled){if(!this._opacityTexture.isReadyOrNotBlocking())return!1;m(this._opacityTexture,r,"OPACITY"),r.OPACITYRGB=this._opacityTexture.getAlphaFromRGB}else r.OPACITY=!1;if(this._reflectionTexture&&X.ReflectionTextureEnabled?(r.ROUGHNESS=this._roughness>0,r.REFLECTIONOVERALPHA=this._useReflectionOverAlpha):(r.ROUGHNESS=!1,r.REFLECTIONOVERALPHA=!1),!f(a,this._reflectionTexture,r))return!1;if(this._emissiveTexture&&X.EmissiveTextureEnabled){if(!this._emissiveTexture.isReadyOrNotBlocking())return!1;m(this._emissiveTexture,r,"EMISSIVE")}else r.EMISSIVE=!1;if(this._lightmapTexture&&X.LightmapTextureEnabled){if(!this._lightmapTexture.isReadyOrNotBlocking())return!1;m(this._lightmapTexture,r,"LIGHTMAP"),r.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,r.RGBDLIGHTMAP=this._lightmapTexture.isRGBD}else r.LIGHTMAP=!1;if(this._specularTexture&&X.SpecularTextureEnabled){if(!this._specularTexture.isReadyOrNotBlocking())return!1;m(this._specularTexture,r,"SPECULAR"),r.GLOSSINESS=this._useGlossinessFromSpecularMapAlpha}else r.SPECULAR=!1;if(a.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&X.BumpTextureEnabled){if(!this._bumpTexture.isReady())return!1;m(this._bumpTexture,r,"BUMP"),r.PARALLAX=this._useParallax,r.PARALLAX_RHS=a.useRightHandedSystem,r.PARALLAXOCCLUSION=this._useParallaxOcclusion,r.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap}else r.BUMP=!1,r.PARALLAX=!1,r.PARALLAX_RHS=!1,r.PARALLAXOCCLUSION=!1;if(this._refractionTexture&&X.RefractionTextureEnabled){if(!this._refractionTexture.isReadyOrNotBlocking())return!1;r._needUVs=!0,r.REFRACTION=!0,r.REFRACTIONMAP_3D=this._refractionTexture.isCube,r.RGBDREFRACTION=this._refractionTexture.isRGBD,r.USE_LOCAL_REFRACTIONMAP_CUBIC=!!this._refractionTexture.boundingBoxSize}else r.REFRACTION=!1;r.TWOSIDEDLIGHTING=!this._backFaceCulling&&this._twoSidedLighting}else r.DIFFUSE=!1,r.AMBIENT=!1,r.OPACITY=!1,r.REFLECTION=!1,r.EMISSIVE=!1,r.LIGHTMAP=!1,r.BUMP=!1,r.REFRACTION=!1;r.ALPHAFROMDIFFUSE=this._shouldUseAlphaFromDiffuseTexture(),r.EMISSIVEASILLUMINATION=this._useEmissiveAsIllumination,r.LINKEMISSIVEWITHDIFFUSE=this._linkEmissiveWithDiffuse,r.SPECULAROVERALPHA=this._useSpecularOverAlpha,r.PREMULTIPLYALPHA=this.alphaMode===c.ALPHA_PREMULTIPLIED||this.alphaMode===c.ALPHA_PREMULTIPLIED_PORTERDUFF,r.ALPHATEST_AFTERALLALPHACOMPUTATIONS=null!==this.transparencyMode,r.ALPHABLEND=null===this.transparencyMode||this.needAlphaBlendingForMesh(e),r.TEXTURE_REPETITION_MODE=I.version>1||I.isWebGPU?this.textureRepetitionMode:0}if(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=r,this._eventInfo.subMesh=t,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),!this._eventInfo.isReadyForSubMesh)return!1;if(r._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(r),r.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,r.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(r._areFresnelDirty&&(X.FresnelEnabled?(this._diffuseFresnelParameters||this._opacityFresnelParameters||this._emissiveFresnelParameters||this._refractionFresnelParameters||this._reflectionFresnelParameters)&&(r.DIFFUSEFRESNEL=this._diffuseFresnelParameters&&this._diffuseFresnelParameters.isEnabled,r.OPACITYFRESNEL=this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled,r.REFLECTIONFRESNEL=this._reflectionFresnelParameters&&this._reflectionFresnelParameters.isEnabled,r.REFLECTIONFRESNELFROMSPECULAR=this._useReflectionFresnelFromSpecular,r.REFRACTIONFRESNEL=this._refractionFresnelParameters&&this._refractionFresnelParameters.isEnabled,r.EMISSIVEFRESNEL=this._emissiveFresnelParameters&&this._emissiveFresnelParameters.isEnabled,r._needNormals=!0,r.FRESNEL=!0):r.FRESNEL=!1),r.AREALIGHTUSED||r.CLUSTLIGHT_BATCH)for(let t=0;t<e.lightSources.length;t++)if(!e.lightSources[t]._isReady())return!1;d(e,a,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),r,this._applyDecalMapAfterDetailMap,this._useVertexPulling,t.getRenderingMesh(),this._isVertexOutputInvariant),p(a,I,this,r,s,null,t.getRenderingMesh().hasThinInstances),this._eventInfo.defines=r,this._eventInfo.mesh=e,this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo),T(e,r,!0,!0,!0),this._callbackPluginEventPrepareDefines(this._eventInfo);let C=!1;if(r.isDirty){const s=r._areLightsDisposed;r.markAsProcessed();const i=new _;r.REFLECTION&&i.addFallback(0,"REFLECTION"),r.SPECULAR&&i.addFallback(0,"SPECULAR"),r.BUMP&&i.addFallback(0,"BUMP"),r.PARALLAX&&i.addFallback(1,"PARALLAX"),r.PARALLAX_RHS&&i.addFallback(1,"PARALLAX_RHS"),r.PARALLAXOCCLUSION&&i.addFallback(0,"PARALLAXOCCLUSION"),r.SPECULAROVERALPHA&&i.addFallback(0,"SPECULAROVERALPHA"),r.FOG&&i.addFallback(1,"FOG"),r.POINTSIZE&&i.addFallback(0,"POINTSIZE"),r.LOGARITHMICDEPTH&&i.addFallback(0,"LOGARITHMICDEPTH"),E(r,i,this._maxSimultaneousLights),r.SPECULARTERM&&i.addFallback(0,"SPECULARTERM"),r.DIFFUSEFRESNEL&&i.addFallback(1,"DIFFUSEFRESNEL"),r.OPACITYFRESNEL&&i.addFallback(2,"OPACITYFRESNEL"),r.REFLECTIONFRESNEL&&i.addFallback(3,"REFLECTIONFRESNEL"),r.EMISSIVEFRESNEL&&i.addFallback(4,"EMISSIVEFRESNEL"),r.FRESNEL&&i.addFallback(4,"FRESNEL"),r.MULTIVIEW&&i.addFallback(0,"MULTIVIEW");const n=[g.PositionKind];r.NORMAL&&n.push(g.NormalKind),r.TANGENT&&n.push(g.TangentKind);for(let e=1;e<=c.MAX_SUPPORTED_UV_SETS;++e)r["UV"+e]&&n.push(`uv${1===e?"":e}`);r.VERTEXCOLOR&&n.push(g.ColorKind),x(n,e,r,i),A(n,r),S(n,e,r),v(n,e,r);let l="default";const u=["world","view","viewProjection","vEyePosition","vLightsType","vAmbientColor","vDiffuseColor","vSpecularColor","vEmissiveColor","visibility","vFogInfos","vFogColor","pointSize","vDiffuseInfos","vAmbientInfos","vOpacityInfos","vEmissiveInfos","vSpecularInfos","vBumpInfos","vLightmapInfos","vRefractionInfos","mBones","diffuseMatrix","ambientMatrix","opacityMatrix","emissiveMatrix","specularMatrix","bumpMatrix","normalMatrix","lightmapMatrix","refractionMatrix","diffuseLeftColor","diffuseRightColor","opacityParts","reflectionLeftColor","reflectionRightColor","emissiveLeftColor","emissiveRightColor","refractionLeftColor","refractionRightColor","vRefractionPosition","vRefractionSize","logarithmicDepthConstant","vTangentSpaceParams","alphaCutOff","boneTextureInfo","morphTargetTextureInfo","morphTargetTextureIndices","cameraInfo","vTextureRepetitionHexTilingParams"],h=["diffuseSampler","ambientSampler","opacitySampler","reflectionCubeSampler","reflection2DSampler","emissiveSampler","specularSampler","bumpSampler","lightmapSampler","refractionCubeSampler","refraction2DSampler","boneSampler","morphTargets","oitDepthSampler","oitFrontColorSampler","areaLightsLTC1Sampler","areaLightsLTC2Sampler"];R(u,h,!1);const o=["Material","Scene","Mesh"],m={maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:r.NUM_MORPH_INFLUENCERS};if(this._eventInfo.fallbacks=i,this._eventInfo.fallbackRank=0,this._eventInfo.defines=r,this._eventInfo.uniforms=u,this._eventInfo.attributes=n,this._eventInfo.samplers=h,this._eventInfo.uniformBuffersNames=o,this._eventInfo.customCode=void 0,this._eventInfo.mesh=e,this._eventInfo.indexParameters=m,this._callbackPluginEventGeneric(128,this._eventInfo),ie.AddUniformsAndSamplers(u,h),se.AddUniforms(u),P&&(P.PrepareUniforms(u,r),P.PrepareSamplers(h,r)),b({uniformsNames:u,uniformBuffersNames:o,samplers:h,defines:r,maxSimultaneousLights:this._maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),F(u),this._useVertexPulling){const e=t.getRenderingMesh(),s=e?.geometry;s&&(this._vertexPullingMetadata=M(s),this._vertexPullingMetadata&&this._vertexPullingMetadata.forEach((e,t)=>{u.push(`vp_${t}_info`)}))}else this._vertexPullingMetadata=null;const f={};this.customShaderNameResolve&&(l=this.customShaderNameResolve(l,u,o,h,r,n,f));const d=r.toString(),p=t.effect,T=a.getEngine().createEffect(l,{attributes:n,uniformsNames:u,uniformBuffersNames:o,samplers:h,defines:d,fallbacks:i,onCompiled:this.onCompiled,onError:this.onError,indexParameters:m,processFinalCode:f.processFinalCode,processCodeAfterIncludes:this._eventInfo.customCode,multiTarget:r.PREPASS,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:async()=>{1===this._shaderLanguage?await Promise.all([import("./default.vertex-QZgs58Ut.esm.min.js"),import("./default.fragment-BP1NB5tS.esm.min.js")]):await Promise.all([import("./default.vertex-DpFjLkm5.esm.min.js"),import("./default.fragment-fJq2OtNC.esm.min.js")]),this._shadersLoaded=!0}},I);if(this._eventInfo.customCode=void 0,T)if(this._onEffectCreatedObservable&&(le.effect=T,le.subMesh=t,this._onEffectCreatedObservable.notifyObservers(le)),this.allowShaderHotSwapping&&p&&!T.isReady()){if(r.markAsUnprocessed(),C=this.isFrozen,s)return r._areLightsDisposed=!0,!1}else a.resetCachedMaterial(),t.setEffect(T,r,this._materialContext)}return!(!t.effect||!t.effect.isReady())&&(r._renderId=a.getRenderId(),i._wasPreviouslyReady=!C,i._wasPreviouslyUsingInstances=s,this._checkScenePerformancePriority(),!0)}buildUniformLayout(){const e=this._uniformBuffer;e.addUniform("diffuseLeftColor",4),e.addUniform("diffuseRightColor",4),e.addUniform("opacityParts",4),e.addUniform("reflectionLeftColor",4),e.addUniform("reflectionRightColor",4),e.addUniform("refractionLeftColor",4),e.addUniform("refractionRightColor",4),e.addUniform("emissiveLeftColor",4),e.addUniform("emissiveRightColor",4),e.addUniform("vDiffuseInfos",2),e.addUniform("vAmbientInfos",2),e.addUniform("vOpacityInfos",2),e.addUniform("vEmissiveInfos",2),e.addUniform("vLightmapInfos",2),e.addUniform("vSpecularInfos",2),e.addUniform("vBumpInfos",3),e.addUniform("diffuseMatrix",16),e.addUniform("ambientMatrix",16),e.addUniform("opacityMatrix",16),e.addUniform("emissiveMatrix",16),e.addUniform("lightmapMatrix",16),e.addUniform("specularMatrix",16),e.addUniform("bumpMatrix",16),e.addUniform("vTangentSpaceParams",2),e.addUniform("pointSize",1),e.addUniform("alphaCutOff",1),e.addUniform("refractionMatrix",16),e.addUniform("vRefractionInfos",4),e.addUniform("vRefractionPosition",3),e.addUniform("vRefractionSize",3),e.addUniform("vSpecularColor",4),e.addUniform("vEmissiveColor",3),e.addUniform("vDiffuseColor",4),e.addUniform("vAmbientColor",3),e.addUniform("cameraInfo",4),e.addUniform("vTextureRepetitionHexTilingParams",4),I(e,!1,!0),super.buildUniformLayout()}bindForSubMesh(e,t,s){const a=this.getScene(),r=s.materialDefines;if(!r)return;const n=s.effect;if(!n)return;this._activeEffect=n,t.getMeshUniformBuffer().bindToEffect(n,"Mesh"),t.transferToEffect(e),this._uniformBuffer.bindToEffect(n,"Material"),this.prePassConfiguration.bindForSubMesh(this._activeEffect,a,t,e,this.isFrozen),ie.Bind(a.getEngine().currentRenderPassId,this._activeEffect,t,e,this);const l=a.activeCamera;l?this._uniformBuffer.updateFloat4("cameraInfo",l.minZ,l.maxZ,0,0):this._uniformBuffer.updateFloat4("cameraInfo",0,0,0,0);const u=this.textureRepetitionHexTilingParams;this._uniformBuffer.updateFloat4("vTextureRepetitionHexTilingParams",u[0],u[1],u[2],u[3]),this._eventInfo.subMesh=s,this._callbackPluginEventHardBindForSubMesh(this._eventInfo),r.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));const h=this._mustRebind(a,n,s,t.visibility),o=a.getEngine()._features.needToAlwaysBindUniformBuffers;L(t,n),this._vertexPullingMetadata&&C(n,this._vertexPullingMetadata);const c=this._uniformBuffer;if(h){if(this.bindViewProjection(n),!c.useUbo||!this.isFrozen||!c.isSync||s._drawWrapper._forceRebindOnNextCall){if(X.FresnelEnabled&&r.FRESNEL){if(this.diffuseFresnelParameters&&this.diffuseFresnelParameters.isEnabled&&(c.updateColor4("diffuseLeftColor",this.diffuseFresnelParameters.leftColor,this.diffuseFresnelParameters.power),c.updateColor4("diffuseRightColor",this.diffuseFresnelParameters.rightColor,this.diffuseFresnelParameters.bias)),this.opacityFresnelParameters&&this.opacityFresnelParameters.isEnabled){const e=O.Color3[0];e.set(this.opacityFresnelParameters.leftColor.toLuminance(),this.opacityFresnelParameters.rightColor.toLuminance(),this.opacityFresnelParameters.bias),c.updateColor4("opacityParts",e,this.opacityFresnelParameters.power)}this.reflectionFresnelParameters&&this.reflectionFresnelParameters.isEnabled&&(c.updateColor4("reflectionLeftColor",this.reflectionFresnelParameters.leftColor,this.reflectionFresnelParameters.power),c.updateColor4("reflectionRightColor",this.reflectionFresnelParameters.rightColor,this.reflectionFresnelParameters.bias)),this.refractionFresnelParameters&&this.refractionFresnelParameters.isEnabled&&(c.updateColor4("refractionLeftColor",this.refractionFresnelParameters.leftColor,this.refractionFresnelParameters.power),c.updateColor4("refractionRightColor",this.refractionFresnelParameters.rightColor,this.refractionFresnelParameters.bias)),this.emissiveFresnelParameters&&this.emissiveFresnelParameters.isEnabled&&(c.updateColor4("emissiveLeftColor",this.emissiveFresnelParameters.leftColor,this.emissiveFresnelParameters.power),c.updateColor4("emissiveRightColor",this.emissiveFresnelParameters.rightColor,this.emissiveFresnelParameters.bias))}if(a.texturesEnabled&&(this._diffuseTexture&&X.DiffuseTextureEnabled&&(c.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),N(this._diffuseTexture,c,"diffuse")),this._ambientTexture&&X.AmbientTextureEnabled&&(c.updateFloat2("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level),N(this._ambientTexture,c,"ambient")),this._opacityTexture&&X.OpacityTextureEnabled&&(c.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),N(this._opacityTexture,c,"opacity")),this._hasAlphaChannel()&&c.updateFloat("alphaCutOff",this.alphaCutOff),D(a,r,c,i.White(),this._reflectionTexture,!1,!1,!0,!1,!1,!1,this.roughness),this._reflectionTexture&&X.ReflectionTextureEnabled||c.updateFloat2("vReflectionInfos",0,this.roughness),this._emissiveTexture&&X.EmissiveTextureEnabled&&(c.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),N(this._emissiveTexture,c,"emissive")),this._lightmapTexture&&X.LightmapTextureEnabled&&(c.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),N(this._lightmapTexture,c,"lightmap")),this._specularTexture&&X.SpecularTextureEnabled&&(c.updateFloat2("vSpecularInfos",this._specularTexture.coordinatesIndex,this._specularTexture.level),N(this._specularTexture,c,"specular")),this._bumpTexture&&a.getEngine().getCaps().standardDerivatives&&X.BumpTextureEnabled&&(c.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,1/this._bumpTexture.level,this.parallaxScaleBias),N(this._bumpTexture,c,"bump"),a._mirroredCameraPosition?c.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):c.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1)),this._refractionTexture&&X.RefractionTextureEnabled)){let e=1;if(this._refractionTexture.isCube||(c.updateMatrix("refractionMatrix",this._refractionTexture.getReflectionTextureMatrix()),this._refractionTexture.depth&&(e=this._refractionTexture.depth)),c.updateFloat4("vRefractionInfos",this._refractionTexture.level,this.indexOfRefraction,e,this.invertRefractionY?-1:1),this._refractionTexture.boundingBoxSize){const e=this._refractionTexture;c.updateVector3("vRefractionPosition",e.boundingBoxPosition),c.updateVector3("vRefractionSize",e.boundingBoxSize)}}this.pointsCloud&&c.updateFloat("pointSize",this.pointSize),c.updateColor4("vSpecularColor",this.specularColor,this.specularPower),c.updateColor3("vEmissiveColor",X.EmissiveTextureEnabled?this.emissiveColor:i.BlackReadOnly),c.updateColor4("vDiffuseColor",this.diffuseColor,this.alpha),a.ambientColor.multiplyToRef(this.ambientColor,this._globalAmbientColor),c.updateColor3("vAmbientColor",this._globalAmbientColor)}a.texturesEnabled&&(this._diffuseTexture&&X.DiffuseTextureEnabled&&n.setTexture("diffuseSampler",this._diffuseTexture),this._ambientTexture&&X.AmbientTextureEnabled&&n.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&X.OpacityTextureEnabled&&n.setTexture("opacitySampler",this._opacityTexture),this._reflectionTexture&&X.ReflectionTextureEnabled&&(this._reflectionTexture.isCube?n.setTexture("reflectionCubeSampler",this._reflectionTexture):n.setTexture("reflection2DSampler",this._reflectionTexture)),this._emissiveTexture&&X.EmissiveTextureEnabled&&n.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&X.LightmapTextureEnabled&&n.setTexture("lightmapSampler",this._lightmapTexture),this._specularTexture&&X.SpecularTextureEnabled&&n.setTexture("specularSampler",this._specularTexture),this._bumpTexture&&a.getEngine().getCaps().standardDerivatives&&X.BumpTextureEnabled&&n.setTexture("bumpSampler",this._bumpTexture),this._refractionTexture&&X.RefractionTextureEnabled&&(this._refractionTexture.isCube?n.setTexture("refractionCubeSampler",this._refractionTexture):n.setTexture("refraction2DSampler",this._refractionTexture))),this.getScene().useOrderIndependentTransparency&&this.needAlphaBlendingForMesh(t)&&this.getScene().depthPeelingRenderer.bind(n),this._eventInfo.subMesh=s,this._callbackPluginEventBindForSubMesh(this._eventInfo),k(n,this,a),this.bindEyePosition(n)}else o&&(this._needToBindSceneUbo=!0);!h&&this.isFrozen&&!o||!a.lightsEnabled||this._disableLighting||y(a,t,n,r,this._maxSimultaneousLights),!h&&this.isFrozen||((a.fogEnabled&&t.applyFog&&a.fogMode!==U.FOGMODE_NONE||this._reflectionTexture||this._refractionTexture||t.receiveShadows||r.PREPASS||r.CLUSTLIGHT_BATCH)&&this.bindView(n),B(a,t,n),r.NUM_MORPH_INFLUENCERS&&H(t,n),r.BAKED_VERTEX_ANIMATION_TEXTURE&&t.bakedVertexAnimationManager?.bind(n,r.INSTANCES),this.useLogarithmicDepth&&w(r,n,a),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect)),this._afterBind(t,this._activeEffect,s),c.update()}getAnimatables(){const e=super.getAnimatables();return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),this._ambientTexture&&this._ambientTexture.animations&&this._ambientTexture.animations.length>0&&e.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&e.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&this._reflectionTexture.animations.length>0&&e.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&this._emissiveTexture.animations.length>0&&e.push(this._emissiveTexture),this._specularTexture&&this._specularTexture.animations&&this._specularTexture.animations.length>0&&e.push(this._specularTexture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&this._lightmapTexture.animations.length>0&&e.push(this._lightmapTexture),this._refractionTexture&&this._refractionTexture.animations&&this._refractionTexture.animations.length>0&&e.push(this._refractionTexture),e}getActiveTextures(){const e=super.getActiveTextures();return this._diffuseTexture&&e.push(this._diffuseTexture),this._ambientTexture&&e.push(this._ambientTexture),this._opacityTexture&&e.push(this._opacityTexture),this._reflectionTexture&&e.push(this._reflectionTexture),this._emissiveTexture&&e.push(this._emissiveTexture),this._specularTexture&&e.push(this._specularTexture),this._bumpTexture&&e.push(this._bumpTexture),this._lightmapTexture&&e.push(this._lightmapTexture),this._refractionTexture&&e.push(this._refractionTexture),e}hasTexture(e){return!!super.hasTexture(e)||(this._diffuseTexture===e||(this._ambientTexture===e||(this._opacityTexture===e||(this._reflectionTexture===e||(this._emissiveTexture===e||(this._specularTexture===e||(this._bumpTexture===e||(this._lightmapTexture===e||this._refractionTexture===e))))))))}dispose(e,t){t&&(this._diffuseTexture?.dispose(),this._ambientTexture?.dispose(),this._opacityTexture?.dispose(),this._reflectionTexture?.dispose(),this._emissiveTexture?.dispose(),this._specularTexture?.dispose(),this._bumpTexture?.dispose(),this._lightmapTexture?.dispose(),this._refractionTexture?.dispose()),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),super.dispose(e,t)}clone(e,t=!0,s=""){const i=G.Clone(()=>new X(e,this.getScene()),this,{cloneTexturesOnlyOnce:t});return i.name=e,i.id=e,this.stencil.copyTo(i.stencil),this._clonePlugins(i,s),i}static Parse(e,t,s){const i=G.Parse(()=>new X(e.name,t),e,t,s);return e.stencil&&i.stencil.parse(e.stencil,t,s),r._ParsePlugins(e,i,t,s),i}static get DiffuseTextureEnabled(){return V.DiffuseTextureEnabled}static set DiffuseTextureEnabled(e){V.DiffuseTextureEnabled=e}static get DetailTextureEnabled(){return V.DetailTextureEnabled}static set DetailTextureEnabled(e){V.DetailTextureEnabled=e}static get AmbientTextureEnabled(){return V.AmbientTextureEnabled}static set AmbientTextureEnabled(e){V.AmbientTextureEnabled=e}static get OpacityTextureEnabled(){return V.OpacityTextureEnabled}static set OpacityTextureEnabled(e){V.OpacityTextureEnabled=e}static get ReflectionTextureEnabled(){return V.ReflectionTextureEnabled}static set ReflectionTextureEnabled(e){V.ReflectionTextureEnabled=e}static get EmissiveTextureEnabled(){return V.EmissiveTextureEnabled}static set EmissiveTextureEnabled(e){V.EmissiveTextureEnabled=e}static get SpecularTextureEnabled(){return V.SpecularTextureEnabled}static set SpecularTextureEnabled(e){V.SpecularTextureEnabled=e}static get BumpTextureEnabled(){return V.BumpTextureEnabled}static set BumpTextureEnabled(e){V.BumpTextureEnabled=e}static get LightmapTextureEnabled(){return V.LightmapTextureEnabled}static set LightmapTextureEnabled(e){V.LightmapTextureEnabled=e}static get RefractionTextureEnabled(){return V.RefractionTextureEnabled}static set RefractionTextureEnabled(e){V.RefractionTextureEnabled=e}static get ColorGradingTextureEnabled(){return V.ColorGradingTextureEnabled}static set ColorGradingTextureEnabled(e){V.ColorGradingTextureEnabled=e}static get FresnelEnabled(){return V.FresnelEnabled}static set FresnelEnabled(e){V.FresnelEnabled=e}},Y=new WeakMap,j=new WeakMap,z=new WeakMap,q=new WeakMap,ee=new WeakMap,te=new WeakMap,ae=new WeakMap,re=new WeakMap,ue=new WeakMap,ce=new WeakMap,me=new WeakMap,fe=new WeakMap,de=new WeakMap,pe=new WeakMap,Te=new WeakMap,_e=new WeakMap,Ee=new WeakMap,xe=new WeakMap,ge=new WeakMap,Ae=new WeakMap,Se=new WeakMap,ve=new WeakMap,Re=new WeakMap,Pe=new WeakMap,be=new WeakMap,Fe=new WeakMap,Me=new WeakMap,Ie=new WeakMap,Le=new WeakMap,Ce=new WeakMap,Oe=new WeakMap,Ne=new WeakMap,(()=>{const e="function"==typeof Symbol&&Symbol.metadata?Object.create(qt[Symbol.metadata]??null):void 0;De=[K("diffuseTexture")],ke=[Z("_markAllSubMeshesAsTexturesAndMiscDirty")],ye=[K("ambientTexture")],Ue=[Z("_markAllSubMeshesAsTexturesDirty")],Be=[K("opacityTexture")],He=[Z("_markAllSubMeshesAsTexturesAndMiscDirty")],we=[K("reflectionTexture")],Ge=[Z("_markAllSubMeshesAsTexturesDirty")],Ve=[K("emissiveTexture")],We=[Z("_markAllSubMeshesAsTexturesDirty")],Xe=[K("specularTexture")],Ye=[Z("_markAllSubMeshesAsTexturesDirty")],je=[K("bumpTexture")],ze=[Z("_markAllSubMeshesAsTexturesDirty")],Ke=[K("lightmapTexture")],Ze=[Z("_markAllSubMeshesAsTexturesDirty")],Je=[K("refractionTexture")],Qe=[Z("_markAllSubMeshesAsTexturesDirty")],$e=[J("ambient")],qe=[J("diffuse")],et=[J("specular")],tt=[J("emissive")],st=[Q()],it=[Q("useAlphaFromDiffuseTexture")],at=[Z("_markAllSubMeshesAsTexturesAndMiscDirty")],rt=[Q("useEmissiveAsIllumination")],nt=[Z("_markAllSubMeshesAsTexturesDirty")],lt=[Q("linkEmissiveWithDiffuse")],ut=[Z("_markAllSubMeshesAsTexturesDirty")],ht=[Q("useSpecularOverAlpha")],ot=[Z("_markAllSubMeshesAsTexturesDirty")],ct=[Q("useReflectionOverAlpha")],mt=[Z("_markAllSubMeshesAsTexturesDirty")],ft=[Q("disableLighting")],dt=[Z("_markAllSubMeshesAsLightsDirty")],pt=[Q("useObjectSpaceNormalMap")],Tt=[Z("_markAllSubMeshesAsTexturesDirty")],_t=[Q("useParallax")],Et=[Z("_markAllSubMeshesAsTexturesDirty")],xt=[Q("useParallaxOcclusion")],gt=[Z("_markAllSubMeshesAsTexturesDirty")],At=[Q()],St=[Q("roughness")],vt=[Z("_markAllSubMeshesAsTexturesDirty")],Rt=[Q()],Pt=[Q()],bt=[Q()],Ft=[Q("useLightmapAsShadowmap")],Mt=[Z("_markAllSubMeshesAsTexturesDirty")],It=[$("diffuseFresnelParameters")],Lt=[Z("_markAllSubMeshesAsFresnelDirty")],Ct=[$("opacityFresnelParameters")],Ot=[Z("_markAllSubMeshesAsFresnelAndMiscDirty")],Nt=[$("reflectionFresnelParameters")],Dt=[Z("_markAllSubMeshesAsFresnelDirty")],kt=[$("refractionFresnelParameters")],yt=[Z("_markAllSubMeshesAsFresnelDirty")],Ut=[$("emissiveFresnelParameters")],Bt=[Z("_markAllSubMeshesAsFresnelDirty")],Ht=[Q("useReflectionFresnelFromSpecular")],wt=[Z("_markAllSubMeshesAsFresnelDirty")],Gt=[Q("useGlossinessFromSpecularMapAlpha")],Vt=[Z("_markAllSubMeshesAsTexturesDirty")],Wt=[Q("maxSimultaneousLights")],Xt=[Z("_markAllSubMeshesAsLightsDirty")],Yt=[Q("invertNormalMapX")],jt=[Z("_markAllSubMeshesAsTexturesDirty")],zt=[Q("invertNormalMapY")],Kt=[Z("_markAllSubMeshesAsTexturesDirty")],Zt=[Q("twoSidedLighting")],Jt=[Z("_markAllSubMeshesAsTexturesDirty")],Qt=[Q("applyDecalMapAfterDetailMap")],$t=[Z("_markAllSubMeshesAsMiscDirty")],W(X,null,ke,{kind:"accessor",name:"diffuseTexture",static:!1,private:!1,access:{has:e=>"diffuseTexture"in e,get:e=>e.diffuseTexture,set:(e,t)=>{e.diffuseTexture=t}},metadata:e},ss,is),W(X,null,Ue,{kind:"accessor",name:"ambientTexture",static:!1,private:!1,access:{has:e=>"ambientTexture"in e,get:e=>e.ambientTexture,set:(e,t)=>{e.ambientTexture=t}},metadata:e},ns,ls),W(X,null,He,{kind:"accessor",name:"opacityTexture",static:!1,private:!1,access:{has:e=>"opacityTexture"in e,get:e=>e.opacityTexture,set:(e,t)=>{e.opacityTexture=t}},metadata:e},os,cs),W(X,null,Ge,{kind:"accessor",name:"reflectionTexture",static:!1,private:!1,access:{has:e=>"reflectionTexture"in e,get:e=>e.reflectionTexture,set:(e,t)=>{e.reflectionTexture=t}},metadata:e},ds,ps),W(X,null,We,{kind:"accessor",name:"emissiveTexture",static:!1,private:!1,access:{has:e=>"emissiveTexture"in e,get:e=>e.emissiveTexture,set:(e,t)=>{e.emissiveTexture=t}},metadata:e},Es,xs),W(X,null,Ye,{kind:"accessor",name:"specularTexture",static:!1,private:!1,access:{has:e=>"specularTexture"in e,get:e=>e.specularTexture,set:(e,t)=>{e.specularTexture=t}},metadata:e},Ss,vs),W(X,null,ze,{kind:"accessor",name:"bumpTexture",static:!1,private:!1,access:{has:e=>"bumpTexture"in e,get:e=>e.bumpTexture,set:(e,t)=>{e.bumpTexture=t}},metadata:e},bs,Fs),W(X,null,Ze,{kind:"accessor",name:"lightmapTexture",static:!1,private:!1,access:{has:e=>"lightmapTexture"in e,get:e=>e.lightmapTexture,set:(e,t)=>{e.lightmapTexture=t}},metadata:e},Ls,Cs),W(X,null,Qe,{kind:"accessor",name:"refractionTexture",static:!1,private:!1,access:{has:e=>"refractionTexture"in e,get:e=>e.refractionTexture,set:(e,t)=>{e.refractionTexture=t}},metadata:e},Ds,ks),W(X,null,at,{kind:"accessor",name:"useAlphaFromDiffuseTexture",static:!1,private:!1,access:{has:e=>"useAlphaFromDiffuseTexture"in e,get:e=>e.useAlphaFromDiffuseTexture,set:(e,t)=>{e.useAlphaFromDiffuseTexture=t}},metadata:e},Ks,Zs),W(X,null,nt,{kind:"accessor",name:"useEmissiveAsIllumination",static:!1,private:!1,access:{has:e=>"useEmissiveAsIllumination"in e,get:e=>e.useEmissiveAsIllumination,set:(e,t)=>{e.useEmissiveAsIllumination=t}},metadata:e},$s,qs),W(X,null,ut,{kind:"accessor",name:"linkEmissiveWithDiffuse",static:!1,private:!1,access:{has:e=>"linkEmissiveWithDiffuse"in e,get:e=>e.linkEmissiveWithDiffuse,set:(e,t)=>{e.linkEmissiveWithDiffuse=t}},metadata:e},si,ii),W(X,null,ot,{kind:"accessor",name:"useSpecularOverAlpha",static:!1,private:!1,access:{has:e=>"useSpecularOverAlpha"in e,get:e=>e.useSpecularOverAlpha,set:(e,t)=>{e.useSpecularOverAlpha=t}},metadata:e},ni,li),W(X,null,mt,{kind:"accessor",name:"useReflectionOverAlpha",static:!1,private:!1,access:{has:e=>"useReflectionOverAlpha"in e,get:e=>e.useReflectionOverAlpha,set:(e,t)=>{e.useReflectionOverAlpha=t}},metadata:e},oi,ci),W(X,null,dt,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,t)=>{e.disableLighting=t}},metadata:e},di,pi),W(X,null,Tt,{kind:"accessor",name:"useObjectSpaceNormalMap",static:!1,private:!1,access:{has:e=>"useObjectSpaceNormalMap"in e,get:e=>e.useObjectSpaceNormalMap,set:(e,t)=>{e.useObjectSpaceNormalMap=t}},metadata:e},Ei,xi),W(X,null,Et,{kind:"accessor",name:"useParallax",static:!1,private:!1,access:{has:e=>"useParallax"in e,get:e=>e.useParallax,set:(e,t)=>{e.useParallax=t}},metadata:e},Si,vi),W(X,null,gt,{kind:"accessor",name:"useParallaxOcclusion",static:!1,private:!1,access:{has:e=>"useParallaxOcclusion"in e,get:e=>e.useParallaxOcclusion,set:(e,t)=>{e.useParallaxOcclusion=t}},metadata:e},bi,Fi),W(X,null,vt,{kind:"accessor",name:"roughness",static:!1,private:!1,access:{has:e=>"roughness"in e,get:e=>e.roughness,set:(e,t)=>{e.roughness=t}},metadata:e},Oi,Ni),W(X,null,Mt,{kind:"accessor",name:"useLightmapAsShadowmap",static:!1,private:!1,access:{has:e=>"useLightmapAsShadowmap"in e,get:e=>e.useLightmapAsShadowmap,set:(e,t)=>{e.useLightmapAsShadowmap=t}},metadata:e},Vi,Wi),W(X,null,Lt,{kind:"accessor",name:"diffuseFresnelParameters",static:!1,private:!1,access:{has:e=>"diffuseFresnelParameters"in e,get:e=>e.diffuseFresnelParameters,set:(e,t)=>{e.diffuseFresnelParameters=t}},metadata:e},ji,zi),W(X,null,Ot,{kind:"accessor",name:"opacityFresnelParameters",static:!1,private:!1,access:{has:e=>"opacityFresnelParameters"in e,get:e=>e.opacityFresnelParameters,set:(e,t)=>{e.opacityFresnelParameters=t}},metadata:e},Ji,Qi),W(X,null,Dt,{kind:"accessor",name:"reflectionFresnelParameters",static:!1,private:!1,access:{has:e=>"reflectionFresnelParameters"in e,get:e=>e.reflectionFresnelParameters,set:(e,t)=>{e.reflectionFresnelParameters=t}},metadata:e},ea,ta),W(X,null,yt,{kind:"accessor",name:"refractionFresnelParameters",static:!1,private:!1,access:{has:e=>"refractionFresnelParameters"in e,get:e=>e.refractionFresnelParameters,set:(e,t)=>{e.refractionFresnelParameters=t}},metadata:e},aa,ra),W(X,null,Bt,{kind:"accessor",name:"emissiveFresnelParameters",static:!1,private:!1,access:{has:e=>"emissiveFresnelParameters"in e,get:e=>e.emissiveFresnelParameters,set:(e,t)=>{e.emissiveFresnelParameters=t}},metadata:e},ua,ha),W(X,null,wt,{kind:"accessor",name:"useReflectionFresnelFromSpecular",static:!1,private:!1,access:{has:e=>"useReflectionFresnelFromSpecular"in e,get:e=>e.useReflectionFresnelFromSpecular,set:(e,t)=>{e.useReflectionFresnelFromSpecular=t}},metadata:e},ma,fa),W(X,null,Vt,{kind:"accessor",name:"useGlossinessFromSpecularMapAlpha",static:!1,private:!1,access:{has:e=>"useGlossinessFromSpecularMapAlpha"in e,get:e=>e.useGlossinessFromSpecularMapAlpha,set:(e,t)=>{e.useGlossinessFromSpecularMapAlpha=t}},metadata:e},Ta,_a),W(X,null,Xt,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,t)=>{e.maxSimultaneousLights=t}},metadata:e},ga,Aa),W(X,null,jt,{kind:"accessor",name:"invertNormalMapX",static:!1,private:!1,access:{has:e=>"invertNormalMapX"in e,get:e=>e.invertNormalMapX,set:(e,t)=>{e.invertNormalMapX=t}},metadata:e},Ra,Pa),W(X,null,Kt,{kind:"accessor",name:"invertNormalMapY",static:!1,private:!1,access:{has:e=>"invertNormalMapY"in e,get:e=>e.invertNormalMapY,set:(e,t)=>{e.invertNormalMapY=t}},metadata:e},Ma,Ia),W(X,null,Jt,{kind:"accessor",name:"twoSidedLighting",static:!1,private:!1,access:{has:e=>"twoSidedLighting"in e,get:e=>e.twoSidedLighting,set:(e,t)=>{e.twoSidedLighting=t}},metadata:e},Oa,Na),W(X,null,$t,{kind:"accessor",name:"applyDecalMapAfterDetailMap",static:!1,private:!1,access:{has:e=>"applyDecalMapAfterDetailMap"in e,get:e=>e.applyDecalMapAfterDetailMap,set:(e,t)=>{e.applyDecalMapAfterDetailMap=t}},metadata:e},ya,Ua),W(null,null,De,{kind:"field",name:"_diffuseTexture",static:!1,private:!1,access:{has:e=>"_diffuseTexture"in e,get:e=>e._diffuseTexture,set:(e,t)=>{e._diffuseTexture=t}},metadata:e},es,ts),W(null,null,ye,{kind:"field",name:"_ambientTexture",static:!1,private:!1,access:{has:e=>"_ambientTexture"in e,get:e=>e._ambientTexture,set:(e,t)=>{e._ambientTexture=t}},metadata:e},as,rs),W(null,null,Be,{kind:"field",name:"_opacityTexture",static:!1,private:!1,access:{has:e=>"_opacityTexture"in e,get:e=>e._opacityTexture,set:(e,t)=>{e._opacityTexture=t}},metadata:e},us,hs),W(null,null,we,{kind:"field",name:"_reflectionTexture",static:!1,private:!1,access:{has:e=>"_reflectionTexture"in e,get:e=>e._reflectionTexture,set:(e,t)=>{e._reflectionTexture=t}},metadata:e},ms,fs),W(null,null,Ve,{kind:"field",name:"_emissiveTexture",static:!1,private:!1,access:{has:e=>"_emissiveTexture"in e,get:e=>e._emissiveTexture,set:(e,t)=>{e._emissiveTexture=t}},metadata:e},Ts,_s),W(null,null,Xe,{kind:"field",name:"_specularTexture",static:!1,private:!1,access:{has:e=>"_specularTexture"in e,get:e=>e._specularTexture,set:(e,t)=>{e._specularTexture=t}},metadata:e},gs,As),W(null,null,je,{kind:"field",name:"_bumpTexture",static:!1,private:!1,access:{has:e=>"_bumpTexture"in e,get:e=>e._bumpTexture,set:(e,t)=>{e._bumpTexture=t}},metadata:e},Rs,Ps),W(null,null,Ke,{kind:"field",name:"_lightmapTexture",static:!1,private:!1,access:{has:e=>"_lightmapTexture"in e,get:e=>e._lightmapTexture,set:(e,t)=>{e._lightmapTexture=t}},metadata:e},Ms,Is),W(null,null,Je,{kind:"field",name:"_refractionTexture",static:!1,private:!1,access:{has:e=>"_refractionTexture"in e,get:e=>e._refractionTexture,set:(e,t)=>{e._refractionTexture=t}},metadata:e},Os,Ns),W(null,null,$e,{kind:"field",name:"ambientColor",static:!1,private:!1,access:{has:e=>"ambientColor"in e,get:e=>e.ambientColor,set:(e,t)=>{e.ambientColor=t}},metadata:e},ys,Us),W(null,null,qe,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,t)=>{e.diffuseColor=t}},metadata:e},Bs,Hs),W(null,null,et,{kind:"field",name:"specularColor",static:!1,private:!1,access:{has:e=>"specularColor"in e,get:e=>e.specularColor,set:(e,t)=>{e.specularColor=t}},metadata:e},ws,Gs),W(null,null,tt,{kind:"field",name:"emissiveColor",static:!1,private:!1,access:{has:e=>"emissiveColor"in e,get:e=>e.emissiveColor,set:(e,t)=>{e.emissiveColor=t}},metadata:e},Vs,Ws),W(null,null,st,{kind:"field",name:"specularPower",static:!1,private:!1,access:{has:e=>"specularPower